Skip to content

Default amctl login to production URL#994

Draft
jhivandb wants to merge 1 commit into
wso2:mainfrom
jhivandb:feat/amctl-login-default-url
Draft

Default amctl login to production URL#994
jhivandb wants to merge 1 commit into
wso2:mainfrom
jhivandb:feat/amctl-login-default-url

Conversation

@jhivandb

@jhivandb jhivandb commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Purpose

Make amctl login connect to Agent Platform, the SaaS offering, when --url is omitted.

Approach

  • Default the Cobra --url flag to the Agent Platform endpoint without a trailing slash.
  • Apply the same default inside runLogin for direct callers.
  • Preserve explicit --url values as overrides for Agent Manager instances, including http://localhost:9000 for local open-source installs.
  • Update the login reference and CLI installation guide to distinguish the default Agent Platform login from Agent Manager instance login.

Automation tests

  • Added one table-driven test function covering the Agent Platform default and explicit override.
  • Ran cd cli && go test ./....
  • Ran make -C documentation build.
  • Ran git diff --check upstream/main...HEAD.

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The login command now defaults to connecting to the production Agent Manager platform when --url is not provided. A new constant stores the default URL, the flag definition and runtime assignment use it, tests verify the behavior, and documentation is updated across CLI installation and reference guides.

Changes

Login Command Default URL

Layer / File(s) Summary
Default URL implementation
cli/pkg/cmd/login.go
Introduces defaultAgentManagerURL constant, sets it as the --url flag default value, and updates runLogin to assign the default when opts.URL is empty.
URL default verification tests
cli/pkg/cmd/login_test.go
Adds TestNewLoginCmdURL table-driven test with subtests validating that the production URL is the default and that --url http://localhost:9000 overrides it.
Documentation updates
documentation/docs/getting-started/cli-installation.mdx, documentation/docs/reference/cli/login.mdx
Updates CLI installation prerequisites and Step 2 login instructions to show hosted-platform login as the default; updates reference docs synopsis, examples, and --url option description to reflect the default behavior and describe --url for alternate instances.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops with glee,
Default URLs now decree,
No more required, just login free,
Production awaits, you'll see! 🐇🔐

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR description covers the main sections: Purpose explains the goal, Approach details the implementation strategy, and Automation tests documents testing performed. However, several template sections are missing or incomplete. Add missing required sections: Goals (distinct from Purpose), User stories, Release note, Documentation links, Training, Certification, Marketing, Security checks, Samples, Related PRs, Migrations, Test environment, and Learning. At minimum, add N/A with explanations for inapplicable sections.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: defaulting amctl login to use the production URL instead of requiring explicit configuration.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown

Dependency Validation Results

Dependency name: github.com/charmbracelet/huh
Version: v1.0.0
Approved: ❌ No - Module not found in dependency registry


Next Steps

  1. Review the validation failures listed above
  2. Check if dependencies are in the approved dependency list
  3. Options to resolve:
    • Remove the unapproved dependencies from this PR
    • OR submit a PR to add these dependencies to the approved list in engineering-governance
  4. Once resolved, push changes to re-run validation

This PR is blocked until all dependencies are approved.

⚠️ Please verify the scope of the dependencies usage is necessary

@jhivandb jhivandb force-pushed the feat/amctl-login-default-url branch from a817379 to 68cdf9b Compare June 2, 2026 09:49

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cli/go.mod`:
- Line 6: Dependency `github.com/charmbracelet/huh v1.0.0` in go.mod is failing
the repository's dependency-approval gate; resolve by adding the exact module
and version (`github.com/charmbracelet/huh v1.0.0`) to the repository's
approved-modules allowlist (or the central allowlist used by the `Validate Go
Dependencies` pipeline), or replace/remove the dependency with an
already-approved alternative, then re-run the pipeline to confirm the gate
passes; coordinate with the gate owners if you cannot add the module yourself.

In `@cli/pkg/tui/agent_create.go`:
- Around line 109-118: The validator trims input only for checking but doesn't
persist the normalized value, so leading/trailing spaces can slip into
CreateOptions; update the binding or applyAgentCreateInput to normalize fields
before use — trim strings like in.Name (and other core fields copied into
CreateOptions) when assigning to opts (or set the bound variable itself after
Validate), and ensure validate(opts) operates on trimmed values (e.g., reference
in.Name, applyAgentCreateInput, CreateOptions, validate) so checks for empty/"/"
match the actual value used in requests.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4fc71d5e-2456-4c84-94d4-cc1921de5e60

📥 Commits

Reviewing files that changed from the base of the PR and between 39fdbf7 and a817379.

⛔ Files ignored due to path filters (1)
  • cli/go.sum is excluded by !**/*.sum
📒 Files selected for processing (10)
  • cli/go.mod
  • cli/pkg/cmd/agent/create/create.go
  • cli/pkg/cmd/agent/create/create_test.go
  • cli/pkg/cmd/agent/create/interactive.go
  • cli/pkg/cmd/agent/create/interactive_test.go
  • cli/pkg/cmd/login.go
  • cli/pkg/cmd/login_test.go
  • cli/pkg/tui/agent_create.go
  • cli/pkg/tui/tui.go
  • documentation/docs/reference/cli/login.mdx

Comment thread cli/go.mod Outdated
go 1.25.7

require (
github.com/charmbracelet/huh v1.0.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Dependency-approval gate is failing for this module.

The Validate Go Dependencies pipeline reports github.com/charmbracelet/huh as not in the approved module list, which will block the merge. Either add the resolved (valid) version to the repository's approved-modules allowlist or coordinate with the owners of that gate before merging.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cli/go.mod` at line 6, Dependency `github.com/charmbracelet/huh v1.0.0` in
go.mod is failing the repository's dependency-approval gate; resolve by adding
the exact module and version (`github.com/charmbracelet/huh v1.0.0`) to the
repository's approved-modules allowlist (or the central allowlist used by the
`Validate Go Dependencies` pipeline), or replace/remove the dependency with an
already-approved alternative, then re-run the pipeline to confirm the gate
passes; coordinate with the gate owners if you cannot add the module yourself.

Comment thread cli/pkg/tui/agent_create.go Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant