feat: Add authsome onboard command combining init and credential scan/import
Summary
Add a single authsome onboard command that performs first-time setup end-to-end: initialize local identity, complete daemon registration/claim, then scan for existing API keys and import them into the vault.
Today this requires two separate steps (authsome init then authsome scan --import), which is awkward for new users and agent quick-start flows.
Current state
authsome init (src/authsome/cli/commands/core.py)
RuntimeIdentity.ensure_local(home)— create local Ed25519 identity files under~/.authsome/identities/.ensure_identity_ready()(src/authsome/cli/client.py) — register handle+DID with daemon; ifclaim_required, open claim URL and poll untilclaimed.- Print JSON: handle, DID, encryption mode, etc.
Does not import credentials.
authsome scan (src/authsome/cli/commands/core.py)
_scan_env_sources()(src/authsome/cli/helpers.py) — read.env,.env.local,.env.*variants, and process environment.- Match values against bundled/custom API key providers (
auth_type == API_KEYonly — OAuth providers skipped). - Default: drift report only (
env_only,authsome_only,env_and_authsome_match, etc.). - With
--import: callstart_login+resume_login_sessionper provider to store keys in the encrypted vault.
Requires vault access — claim must be accepted before import succeeds. Running scan --import before init/claim will fail or be incomplete.
Documentation today
docs/site/installation.mdx— documentsinitseparately.docs/site/reference/cli.mdx— documentsscanand--importseparately.- README quick start points to skill install, not a unified onboard path.
Proposed authsome onboard
Single command for “I’m new — set me up and pull in my existing keys”:
authsome onboard
Suggested flow (ordered):
- Initialize — same as
init: local identity + daemon registration. - Claim — same as
ensure_identity_ready: browser claim URL + poll (or print URL for headless). - Scan & import — same as
scan --import: discover API keys from dotenv files and process env, write to vault.
Suggested options:
| Option | Purpose |
|---|---|
--connection <name> |
Target connection name when importing (default: default, same as scan) |
--scan-only |
Report drift without importing (escape hatch) |
--no-scan |
Skip credential scan (init + claim only) |
--json |
Machine-readable combined result |
Default behavior: import discovered keys (user expectation for “onboard” — not report-only). Interactive confirmation may still be useful when keys are found in TTY mode; headless/CI should use --json or explicit flags.
Design notes
- Reuse internals — implement as orchestration calling existing
init/scanlogic (shared helpers), not duplicated scan loop. Address existing TODO: scan duplication with_scan_env_sources. - Output — single JSON blob combining init metadata + scan results (
imported_count, per-provider status). - OAuth — onboard does not replace
authsome login <provider>for OAuth flows; document that API keys are auto-imported, OAuth still needs explicit login. - Related work — credential import/restore ADR spike (
plans/009-spike-credential-import-restore.md) covers export inverse; onboard is complementary (env discovery, not vault backup restore). - Related issue — #426 (single private-key env var) may simplify headless agent onboard later.
Relevant files
src/authsome/cli/commands/core.py—init,scansrc/authsome/cli/helpers.py—_scan_env_sources,_scan_resolve_should_importsrc/authsome/cli/client.py—ensure_identity_ready, login session APIssrc/authsome/cli/commands/__init__.py— command registrationtests/cli/test_init.py,tests/cli/test_import_env.pydocs/site/installation.mdx,docs/site/reference/cli.mdx,README.md
Acceptance criteria
authsome onboardon a fresh machine: identity created, claim completed (or clear headless instructions), API keys from.env/env imported into vault.- No regression to standalone
initandscan(keep or alias — decide in implementation). - Tests cover: fresh onboard, onboard with no keys found, onboard with existing vault keys (skip unchanged).
- Docs and README quick start reference
onboardas the recommended first-run command.