mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-20 13:53:32 +08:00
fix(cli): avoid Anthropic preflight during onboarding
Keep first-run CLI setup local-first by building only local onboarding steps. Remove the startup preflight that pinged Anthropic/OAuth endpoints before any explicit login or model request. Fixes #859. Tested: bun test src/components/onboardingSteps.test.ts Tested: bun run check:server Not-tested: bun run verify; check:coverage; check:policy Confidence: high Scope-risk: narrow
This commit is contained in:
parent
dbb2ad08ac
commit
e944db1e2f
File diff suppressed because one or more lines are too long
24
src/components/onboardingSteps.test.ts
Normal file
24
src/components/onboardingSteps.test.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import { describe, expect, test } from 'bun:test'
|
||||||
|
import { buildLocalOnboardingStepIds } from './onboardingSteps.js'
|
||||||
|
|
||||||
|
describe('buildLocalOnboardingStepIds', () => {
|
||||||
|
test('keeps first-run CLI onboarding free of Anthropic network steps', () => {
|
||||||
|
const steps = buildLocalOnboardingStepIds({
|
||||||
|
apiKeyNeedsApproval: false,
|
||||||
|
offerTerminalSetup: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(steps).toEqual(['theme', 'security'])
|
||||||
|
expect(steps).not.toContain('preflight')
|
||||||
|
expect(steps).not.toContain('oauth')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('preserves local-only optional onboarding steps', () => {
|
||||||
|
expect(
|
||||||
|
buildLocalOnboardingStepIds({
|
||||||
|
apiKeyNeedsApproval: true,
|
||||||
|
offerTerminalSetup: true,
|
||||||
|
}),
|
||||||
|
).toEqual(['theme', 'api-key', 'security', 'terminal-setup'])
|
||||||
|
})
|
||||||
|
})
|
||||||
29
src/components/onboardingSteps.ts
Normal file
29
src/components/onboardingSteps.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
export type LocalOnboardingStepId =
|
||||||
|
| 'theme'
|
||||||
|
| 'api-key'
|
||||||
|
| 'security'
|
||||||
|
| 'terminal-setup'
|
||||||
|
|
||||||
|
type BuildLocalOnboardingStepIdsOptions = {
|
||||||
|
apiKeyNeedsApproval: boolean
|
||||||
|
offerTerminalSetup: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export function buildLocalOnboardingStepIds({
|
||||||
|
apiKeyNeedsApproval,
|
||||||
|
offerTerminalSetup,
|
||||||
|
}: BuildLocalOnboardingStepIdsOptions): LocalOnboardingStepId[] {
|
||||||
|
const steps: LocalOnboardingStepId[] = ['theme']
|
||||||
|
|
||||||
|
if (apiKeyNeedsApproval) {
|
||||||
|
steps.push('api-key')
|
||||||
|
}
|
||||||
|
|
||||||
|
steps.push('security')
|
||||||
|
|
||||||
|
if (offerTerminalSetup) {
|
||||||
|
steps.push('terminal-setup')
|
||||||
|
}
|
||||||
|
|
||||||
|
return steps
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user