✨ Add explicit project targeting for build commands#239
✨ Add explicit project targeting for build commands#239
Conversation
Make run, upload, preview, and finalize resolve an explicit target from flags, repo config, or project-token context. Also scope login state by API URL and write global config atomically so startup tasks do not race auth reads.
Vizzly - Visual Test ResultsCLI TUI - 2 changes need review
Changes needing review (2)vizzly-help · 1202×1430 · 214.9% diff vizzly-run-help · 1202×722 · 444.9% diff
|
PR ReviewOverall this is a solid, well-motivated PR. The architecture is clear, the 🐛 Potential Issues1. // global-config.js
export function normalizeApiUrl(apiUrl = DEFAULT_AUTH_API_URL) {
let parsedUrl = new URL(apiUrl || DEFAULT_AUTH_API_URL);The default parameter only fires for 2.
let resolvedTarget = await resolveProjectTarget({
command: 'finalize',
options,
config,
requireTarget: true,
});When the API key is a project token, 3. Concurrent migration race window (minor)
🧹 Code Quality4. Identical helper defined in both 5. Two definitions of the default API URL
6.
let resolvedTarget = resolveTargetFromSources({
options,
configTarget: config.target,
// tokenContext not passed
});The token-context lookup path exists in 7. Dead In let apiUrl = globalOptions.apiUrl || options.apiUrl || getApiUrl();Since 8. Inconsistent error display for
c.args[0] === 'Failed to finalize parallel build' && c.args[1]?.message?.includes('...')
c.args[0].includes('This command needs a target project')The error appears as the second argument in ✅ What's Good
One more thing worth confirming: since |


Why
The CLI was still mixing user login state and project-targeted build creation, which made local interactive workflows feel broken after removing
project:select. This PR makes project targeting explicit and repo-local while keeping CI token flows working.Summary
run,upload,preview, andfinalizevia--project-idor--org+--projecttargetconfig invizzly.config.jsand send explicit target payloads to the API when using user authapiUrlfor cloud and self-hosted setups, and write global config atomically to avoid startup races while reading authTest Plan
node --test tests/commands/targeting.integration.test.js tests/utils/global-config.test.js tests/commands/logout.test.js tests/commands/whoami.test.js tests/commands/run.test.js tests/commands/upload.test.js tests/commands/finalize.test.js tests/commands/preview.test.js tests/utils/project-target.test.jsnpm test(currently still fails in unrelatedtests/utils/colors.test.jscases)