Repository navigation
fix: affitor status and test run with an API key and no project config (QA-33) - #36
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A program created in the dashboard has a key but no .affitor/config.json; only init writes one, and init creates a new program. The API finds the program from the key alone, so status and test now run with --api-key or AFFITOR_API_KEY when there is no config, and status shows the domain the API returns (it printed config.domain, 'undefined' without it). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…the DNS hint The API returns the website minus its scheme with the path kept, so a site like https://example.com/pricing/ made the hint t.example.com/pricing/. The config's domain is used whenever there is a config (as before); key-only runs reduce the API website to its hostname, and print no DNS hint when there is none. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
affitor statusandaffitor testread the project config through a newreadConfigOrKeyOnly(flags): when the directory has no.affitor/config.jsonbut a key was passed with--api-keyorAFFITOR_API_KEY, they run without it. The API already resolves the program from the key (authenticateRequest→findProgramByApiToken);program_idin the query/body was never used.statusprints the domain the API returns instead ofconfig.domain. With neither config nor key, the error now says "Runnpx affitor initto set up a new program, or set AFFITOR_API_KEY to use an existing one."Why (QA-33)
Measured 13/10 with the test program's key on prod:
affitor@0.4.2 statusin a directory without config →✗ No Affitor config found … Run npx affitor init.initneedsaffitor loginand creates a new program, so a brand whose program was made in the dashboard had no way to usestatus/test.{version, program_id}config, status worked but printedundefinedfor the domain andt.undefinedin the DNS hint.AFFITOR_API_KEY: status 200 for program 1189, domainexample.com(.internal/qa/2026-10-12/raw/qa33-cli-key-only-prod.txt).Separate, not in this PR:
affitor loginoffers only "Sign in with Google", so a brand that signed up with email + password cannot log in to the CLI (auth decision, reported to the manager).Test
tests/status-test-key-only.test.ts(3 cases, committed first, 3 red on main): status with AFFITOR_API_KEY and no config calls/api/v1/cli/statuswith that key and prints the API domain, no "undefined";testwith--api-keyand no config posts the event; with neither, the message names AFFITOR_API_KEY.vitest run: 14 files, 118 tests pass.tsc --noEmit0 errors.npm run buildok.🤖 Generated with Claude Code