Skip to content

refactor: target bootstrap-admin at the active profile instance#66

Merged
Bccorb merged 1 commit into
mainfrom
refactor/bootstrap-admin-profile-targeting
Jul 21, 2026
Merged

refactor: target bootstrap-admin at the active profile instance#66
Bccorb merged 1 commit into
mainfrom
refactor/bootstrap-admin-profile-targeting

Conversation

@Bccorb

@Bccorb Bccorb commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Refactors seamless bootstrap-admin to target instances through the CLI's profile system instead of gating on a local seamless.config.json.

Previously the command loaded ./seamless.config.json purely as a presence check — the parsed contents (services.auth.mode) were never read — and resolved the target from SEAMLESS_API_URL, defaulting to http://localhost:3000. That coupled the command to being run from inside a scaffolded project directory.

Now the target instance is resolved from the active profile, consistent with every other instance-facing command (whoami, sessions, users, org, …).

Behavior

Instance URL precedence:

  1. SEAMLESS_API_URL env override (backward compatible)
  2. Active profile's instanceUrl — respects --profile <name> and SEAMLESS_PROFILE
  3. http://localhost:3000 fallback when no profile is configured (preserves the zero-config local flow)
seamless bootstrap-admin admin@co.com                 # active profile, else localhost:3000
seamless bootstrap-admin admin@co.com --profile prod  # targets the "prod" profile
SEAMLESS_API_URL=... seamless bootstrap-admin ...      # explicit override still wins

Auth is intentionally unchanged

Bootstrap runs before any admin user exists, so it cannot authenticate as the profile's user. It continues to use the shared bootstrap secret (Bearer) resolved from .env / auth/.env / docker-compose.yml, or prompts. The profile is used only for targeting, not auth.

Changes

  • src/commands/bootstrapAdmin.ts — drop the dead seamless.config.json gate; add resolveApiUrl() and --profile parsing (signature is now (args: string[])).
  • src/index.ts — pass args.slice(1) through to the command.
  • src/commands/help.ts — document --profile and the new targeting behavior.
  • Tests updated (bootstrapAdmin.test.ts, index.test.ts) covering profile targeting, --profile, env override, and localhost fallback.

Testing

  • vitest run — 549 passed
  • tsc typecheck clean
  • Coverage thresholds pass; bootstrapAdmin.ts at 100%

Drop the dead seamless.config.json presence gate from bootstrap-admin (its
parsed contents were never used) and resolve the target instance from the
active profile's instanceUrl instead. Precedence is SEAMLESS_API_URL override,
then the active profile (respecting --profile / SEAMLESS_PROFILE), then the
local http://localhost:3000 fallback.

The bootstrap-secret Bearer auth is intentionally unchanged: bootstrap runs
before any admin user exists, so it cannot authenticate as the profile's user.
@Bccorb
Bccorb merged commit 793507a into main Jul 21, 2026
1 check failed
@Bccorb
Bccorb deleted the refactor/bootstrap-admin-profile-targeting branch July 21, 2026 01:05
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