fix: apply .toclirc and saved profile auth to API requests#17
Conversation
The local resolveAuth() in index.ts only checked --token and --api-key CLI flags, ignoring .toclirc auth config and saved profiles from `auth login`. Now uses the proper resolveAuth() from auth/flags.ts which handles all auth sources with correct priority: 1. Inline flags (--token, --api-key) 2. .toclirc auth config (token or envVar) 3. Spec-detected env vars (API_TOKEN, etc.) 4. Saved profiles (auth login) Also adds support for `auth.token` field in .toclirc. Closes #16 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@claude Review this PR |
|
@claude review this pr |
|
Claude finished @lucianfialho's task in 1m 35s —— View job PR Review
The fix correctly addresses the core bug: Bug:
|
Summary
.toclirctoken,.toclircenvVar,auth loginprofiles), not just inline--token/--api-keyflagsauth.tokenfield support in.toclircfor direct token configurationresolveAuth()inindex.tswith the proper one fromauth/flags.tsthat handles the full priority chainChanges
src/index.ts— Replaced localresolveAuth()with asyncresolveAuthFromFlags(), passing.toclircauth configsrc/auth/flags.ts— AddedrcAuthType,rcAuthToken,rcAuthEnvVarfields toAuthFlags; added priority 2 resolution for.toclircauthsrc/config/rc.ts— Addedtokenfield toRcConfig.auth;resolveConfig()now returnsauthTypeandauthTokensrc/auth/auth.test.ts— 7 new tests for.toclircauth resolutionsrc/config/config.test.ts— 2 new tests forresolveConfigauth token supportTest plan
.toclircwithauth.token, verify requests include Bearer header.toclircwithauth.envVar, set env var, verify auth worksauth login --token <tok>, verify subsequent requests use saved tokenCloses #16
🤖 Implemented by Claude Code dev-pipeline