Summary
traceroot login writes credentials to ./.traceroot/config.json relative to the current working directory, and discovery reads exactly $CWD/.traceroot/config.json — no upward walk toward the git root, no home-directory fallback. Run any command from a different directory (even a subdirectory of the same repo) and the CLI reports No API key found. Run 'traceroot login' with no hint that the user is logged in — one directory over. Most developer CLIs log in globally, so this reads as "my login didn't stick."
Related documentation bug: src/config/schema.ts:2 claims the config lives at ~/.traceroot/config.json — a location the CLI never reads or writes.
Current behavior
- In a project directory:
traceroot login → writes ./.traceroot/config.json (0600, auto-gitignored).
cd subdir && traceroot traces list → error: No API key found. Run 'traceroot login', or set TRACEROOT_API_KEY, or pass --api-key.
- Nothing in the error says credentials are per-directory or where the CLI looked.
Where this lives:
configPath() resolves: explicit argument → TRACEROOT_CONFIG_PATH → join(process.cwd(), ".traceroot", "config.json") (src/config/manager.ts:20-29). No other candidate location, no ancestor search. The auto-discovered .env fallback is equally CWD-only.
- The "No API key found" error (
src/commands/shared.ts:25-29) never states which path was checked.
src/config/schema.ts:2 docstring contradicts src/config/manager.ts:13-19.
Proposal
- Keep project-local as the primary (it's genuinely useful for multi-project users), but add a global fallback —
~/.config/traceroot/config.json — read when no project-local config resolves. Alternatively or additionally: walk upward from $CWD to the nearest .traceroot/config.json, bounded by the git root, so subdirectories of a logged-in project just work.
- When resolution fails, say where the CLI looked and that config is per-directory, e.g.
No API key found. Looked for ./.traceroot/config.json (config is stored per-directory). Run 'traceroot login' here, set TRACEROOT_API_KEY, or pass --api-key.
- Fix the
schema.ts docstring.
Impact
- Day-one onboarding trap: the first
cd after login appears to destroy the session; status fails the same way with no breadcrumb.
- Trains users to re-enter their API key repeatedly, scattering key copies across directories.
Acceptance criteria
- With a config written in directory A and no other credential source, commands run elsewhere resolve credentials from the global fallback (or, with the upward-walk approach, from any subdirectory of A).
- Precedence is documented and tested: flags >
--env-file > env vars > project-local config > global config (> auto .env), with status/doctor reporting which source and path won.
- The "No API key found" error names the path(s) checked.
src/config/schema.ts no longer claims ~/.traceroot/config.json.
Summary
traceroot loginwrites credentials to./.traceroot/config.jsonrelative to the current working directory, and discovery reads exactly$CWD/.traceroot/config.json— no upward walk toward the git root, no home-directory fallback. Run any command from a different directory (even a subdirectory of the same repo) and the CLI reportsNo API key found. Run 'traceroot login'with no hint that the user is logged in — one directory over. Most developer CLIs log in globally, so this reads as "my login didn't stick."Related documentation bug:
src/config/schema.ts:2claims the config lives at~/.traceroot/config.json— a location the CLI never reads or writes.Current behavior
traceroot login→ writes./.traceroot/config.json(0600, auto-gitignored).cd subdir && traceroot traces list→error: No API key found. Run 'traceroot login', or set TRACEROOT_API_KEY, or pass --api-key.Where this lives:
configPath()resolves: explicit argument →TRACEROOT_CONFIG_PATH→join(process.cwd(), ".traceroot", "config.json")(src/config/manager.ts:20-29). No other candidate location, no ancestor search. The auto-discovered.envfallback is equally CWD-only.src/commands/shared.ts:25-29) never states which path was checked.src/config/schema.ts:2docstring contradictssrc/config/manager.ts:13-19.Proposal
~/.config/traceroot/config.json— read when no project-local config resolves. Alternatively or additionally: walk upward from$CWDto the nearest.traceroot/config.json, bounded by the git root, so subdirectories of a logged-in project just work.No API key found. Looked for ./.traceroot/config.json (config is stored per-directory). Run 'traceroot login' here, set TRACEROOT_API_KEY, or pass --api-key.schema.tsdocstring.Impact
cdafterloginappears to destroy the session;statusfails the same way with no breadcrumb.Acceptance criteria
--env-file> env vars > project-local config > global config (> auto.env), withstatus/doctorreporting which source and path won.src/config/schema.tsno longer claims~/.traceroot/config.json.