Skip to content

feat(setup)!: replace init/login/logout with unified agentage setup#145

Merged
vreshch merged 1 commit intomasterfrom
feature/setup-command
Apr 22, 2026
Merged

feat(setup)!: replace init/login/logout with unified agentage setup#145
vreshch merged 1 commit intomasterfrom
feature/setup-command

Conversation

@vreshch
Copy link
Copy Markdown
Contributor

@vreshch vreshch commented Apr 21, 2026

Summary

  • Replaces agentage init, agentage login, and agentage logout with a unified agentage setup command.
  • Interactive when invoked from a TTY — exactly one confirmation prompt (Connect machine "foo" to https://agentage.io ? [Y/n]).
  • Fully headless when invoked with --yes, --token, --machine-id, --reauth, or --disconnect (or when no TTY is present and --token / --no-login are supplied).
  • Cloud-init target: agentage setup --machine-id $ID --token $TK --hub $URL --yes --no-interactive. The daemon's existing resolveMachine precedence (reads machine.json first) means the supplied --machine-id is adopted on first boot — no daemon code change.

Spec: work/specs/cli-setup.md (vault, draft).

BREAKING CHANGE

agentage init, agentage login, agentage logout are removed in this PR — no deprecation wrappers, no warnings. Commander responds with unknown command for any straggler invocation. CHANGELOG entry under [Unreleased].

Migration:

  • agentage init …agentage setup … (same --name, --hub, --dir flags supported)
  • agentage loginagentage setup (interactive) or agentage setup --reauth
  • agentage login --token Tagentage setup --token T
  • agentage logoutagentage setup --disconnect

What changed

File Change
src/commands/setup.ts NEW — runSetup() + registerSetup()
src/commands/setup.test.ts NEW — 21 tests, full §3 behavior matrix + removal proof
src/commands/{init,login,logout}{,.test}.ts DELETED (6 files)
src/cli.ts swap registerInit/Login/LogoutregisterSetup
src/commands/{run,runs,machines,agents}.ts hint text "Run `agentage setup` first"
README.md commands table + structure tree updated
CHANGELOG.md [Unreleased] BREAKING entry

Diff: +856 / −573 across 15 files.

Behavior matrix (covered by tests)

Invocation TTY Auth state Effect Prompts
agentage setup yes none confirm → OAuth 1
agentage setup yes exists summary, exit 0 0
agentage setup no none exit 2 (cannot prompt) 0
agentage setup --yes any none defaults + browser if TTY 0
agentage setup --token T --machine-id M --hub H any any fully headless, overwrites 0
agentage setup --reauth any exists OAuth re-run keeping config 0
agentage setup --disconnect any any best-effort deregister + delete auth.json 0
agentage setup --no-login any any configure, skip auth 0

Exit codes

Code Reason
0 Success / no-op idempotent
1 User declined confirm
2 No TTY + no --token + no --no-login
3 --reauth + --disconnect mutually exclusive
4 OAuth callback timeout / failure
7 Rename or --machine-id change without --force

Test plan

  • npm run verify green (type-check + lint + format:check + test + build)
  • 48 test files / 517 tests passing
  • agentage init, agentage login, agentage logout reject with unknown command (asserted in 3 tests)
  • --machine-id writes ~/.agentage/machine.json before daemon boot (asserted)
  • --token skips browser path
  • Confirm prompt accepts Enter / y / yes; aborts on n
  • Manual: run agentage setup interactively against https://dev.agentage.io and confirm one-prompt OAuth flow
  • Manual: simulate cloud-init invocation with full flags and confirm 0-prompt completion
  • Cross-repo doc sweep — search agentage init, agentage login, agentage logout in agents/, web/landing/, e2e/, infrastructure/ and update any stragglers (not in this PR)

Single command replaces `agentage init`, `agentage login`, and
`agentage logout`. Interactive when invoked from a TTY (one
confirmation prompt) and fully headless with `--yes`, `--token`,
`--machine-id`, `--reauth`, or `--disconnect` flags.

Cloud-init / scripted installs target:
  agentage setup --machine-id $ID --token $TK --hub $URL --yes --no-interactive

The daemon's existing `resolveMachine` precedence (machine.json first)
means `--machine-id` writes the file before the daemon boots and is
adopted automatically — no daemon code change needed.

BREAKING CHANGE: `agentage init`, `agentage login`, and
`agentage logout` are removed. Commander now responds with
`unknown command` for any straggler invocation. Replace with
the corresponding `agentage setup [--reauth|--disconnect]` form.
@vreshch vreshch force-pushed the feature/setup-command branch from d4eea36 to 9f0f01f Compare April 22, 2026 19:36
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

🎉 PR Validation ✅ PASSED

Commit: 9f0f01f6faed334b4642d115b4e0000c93e61851
Branch: feature/setup-command

Checks:

  • ✅ Release guard (no version/changelog changes)
  • ✅ Dependencies installed
  • ✅ Type check passed
  • ✅ Linting passed
  • ✅ Format check passed
  • ✅ Tests + coverage passed
  • ✅ Build successful

Ready to merge!


🔗 View workflow run
⏰ Generated at: 2026-04-22T19:37:32.589Z

@vreshch vreshch merged commit 5d43d4d into master Apr 22, 2026
1 check passed
@vreshch vreshch deleted the feature/setup-command branch April 22, 2026 19:39
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