feat(#45): dashboard-only project creation; manual Project ID as sole remote path - #135
Conversation
…as sole remote path
📝 WalkthroughWalkthroughThis PR shifts project creation from automatic (extension-driven) to manual (dashboard-first). Projects are no longer auto-created; instead, users must create them in the ReCost dashboard and supply the Project ID to the extension or CLI. Remote scan enrichment only runs when both an API key and a valid Project ID are present; otherwise scans execute locally with a user nudge. ChangesDashboard-Only Project ID Model
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/cli/scan.ts (1)
105-119: 💤 Low valueTrim CLI flag value for consistency with env var handling.
The env var is trimmed on line 119, but the CLI flag value is used as-is. A whitespace-only
--project-id " "would pass validation and be treated as a valid ID, causing an API error later (gracefully caught, but confusing).🔧 Suggested fix
if (arg === "--project-id") { const value = args.shift(); - if (!value) throw new Error("--project-id requires a value"); - projectId = value; + const trimmed = value?.trim(); + if (!trimmed) throw new Error("--project-id requires a value"); + projectId = trimmed; continue; }Then simplify line 119:
- return { target, format, projectId: (projectId ?? process.env.RECOST_PROJECT_ID?.trim()) || undefined }; + return { target, format, projectId: projectId ?? process.env.RECOST_PROJECT_ID?.trim() || undefined };🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/cli/scan.ts` around lines 105 - 119, The CLI parsing currently assigns the raw flag string to projectId when handling "--project-id" (in the argument loop in scan.ts) but trims only the env var later; change the assignment so you trim the CLI value (e.g., set projectId = value.trim()) and then keep the final return simplification that uses projectId ?? process.env.RECOST_PROJECT_ID?.trim() || undefined so both CLI and env values are normalized and whitespace-only inputs become undefined.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/cli/scan.ts`:
- Around line 105-119: The CLI parsing currently assigns the raw flag string to
projectId when handling "--project-id" (in the argument loop in scan.ts) but
trims only the env var later; change the assignment so you trim the CLI value
(e.g., set projectId = value.trim()) and then keep the final return
simplification that uses projectId ?? process.env.RECOST_PROJECT_ID?.trim() ||
undefined so both CLI and env values are normalized and whitespace-only inputs
become undefined.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 283a85fc-e73d-4759-99ed-65b3e6f02826
📒 Files selected for processing (9)
CLAUDE.mddocs/superpowers/plans/2026-06-10-dashboard-only-project-id.mddocs/superpowers/specs/2026-06-09-dashboard-only-project-id-design.mdsrc/api-client.tssrc/cli/scan.tssrc/test/scan-publishing-handler.test.tssrc/webview-provider.tssrc/webview/scan-publishing-handler.tswebview/src/components/KeysPage.tsx
💤 Files with no reviewable changes (1)
- src/api-client.ts
Verification (CLI surface) — PASSDrove the built CLI (
Probes:
Decisive evidence (request the CLI sent with a supplied ID — no auto-create call precedes it): Not yet runtime-verified
Updating the test-plan checkboxes accordingly: build, suite, regression grep, |
Summary
Closes #45 (reframed). Inverts the project-ID model: projects are created only in the web dashboard, and a user-supplied Project ID is the single path to remote scan enrichment. The extension and CLI no longer auto-create projects.
resolveScanProjectTarget()now returns a manual target ornull; deletedgetOrCreateProject(), the 404→auto-recreate recovery, and therecost.projectIdglobalState. No Project ID → local-only results + a nudge.getProjectId()now reads the manual Project ID instead of the retired auto-persisted field.src/cli/scan.ts) — takes--project-id <id>/RECOST_PROJECT_ID; no auto-creation; prints a stderr nudge and runs local-only without one.createProject/findProjectByName.docs/superpowers/, CLAUDE.md auth section updated.Behavior matrix
Test Plan
npm run build(dashboard + webview + extension) succeedsnpm testpasses, including two newscan-publishing-handlertests: null target → nosubmitScan+ nudge; manual target →submitScanwith that IDgetOrCreateProject/createProject/findProjectByName/recost.projectIdremainnode dist/cli/scan.js --helpdocuments--project-id🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
--project-idCLI argument andRECOST_PROJECT_IDenvironment variable support for remote scan syncingRefactor