liukaybee on X asked whether the token `claude setup-token` prints can be
pasted into Providers > Claude > Import accounts. It couldn't: the paste
box read every bare line as a refresh token, and a Claude one with no
email failed with "the file doesn't say which Claude account this is".
parseLoginImport now reads each bare line (and a JSON string) through
bareImport. A line that is a setup-token (sk-ant-oat..., bare, as
CLAUDE_CODE_OAUTH_TOKEN=... or export CLAUDE_CODE_OAUTH_TOKEN="...") is
checked by checkClaudeSetupToken and added by AddClaudeSetupToken, the
same path as "Add an account by setup-token...": kept in logins.json,
named by its hash, nothing asked of Anthropic. One magpie already has is
"exists", twice in one paste is "in the files twice", an sk-ant-api key
pasted there is refused as an API key. In the ChatGPT import a setup-token
is refused as Claude's and never sent to ChatGPT's token endpoint.
Refresh-token lines and JSON files in the same import work as before. No
result row carries the token; nothing here logs.
Run (mica, mica-run):
- TestImportClaudeSetupToken red on origin/main's login_import.go
(#2..#5 failed, setup-token lines "doesn't say which Claude account"),
green with the fix.
- go test ./internal/provider -run 'Import|SetupToken|Login': ok
- go vet ./internal/provider: ok
- go test -timeout 45m ./internal/provider ./internal/cli: ok, ok
- gofmt -l internal/provider: clean
Not tried: a real setup-token pasted in the real app (the add path it
calls is the existing one, itself not tried with a real token).