Repository navigation
feat(create-helpbase): Ship it now? prompt at end of scaffold (Shape A) - #12
Conversation
Collapses cold TTHW from ~3 min (scaffold → cd → login → deploy) to ~90s. After install completes, prompt "Ship it to helpbase cloud? (~20 seconds)" with Y as the default. Y runs `helpbase login` (if needed) + `helpbase deploy` inline via subprocess, so the user sees the real deploy flow: preview, MCP config, live URL. N falls through to today's "Run it locally" + dev-server flow, byte-for-byte. - `--deploy` / `--no-deploy` flags for non-interactive mode - `--deploy --source skip` refuses in CI (footgun guard) and re-prompts with N-default interactively - `--version` now reads from package.json (was hardcoded 0.0.1 and drifted every release) - Deploy-failed note surfaces last output line so user doesn't scroll - 9 new unit tests for resolveShipItNow, +2 integration assertions create-helpbase 0.3.1 → 0.4.0. Design doc: Shape A (2026-04-18). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 49 minutes and 0 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe changes add an interactive "ship-it-now" deployment prompt to the create-helpbase scaffolder (v0.4.0), triggered after scaffold completion. The prompt defaults to Y and, when accepted, runs Changes
Sequence DiagramsequenceDiagram
participant User
participant CLI
participant ShipItNow
participant HelpbaseLogin
participant HelpbaseDeploy
participant Terminal
User->>CLI: create-helpbase [opts]
CLI->>CLI: Scaffold project
CLI->>ShipItNow: resolveShipItNow({flagDeploy, sourceKind, isInteractive, ...})
alt flagDeploy === false
ShipItNow-->>CLI: false
else flagDeploy === true && sourceKind === "skip" && non-interactive
ShipItNow-->>CLI: throw ShipItNowRefusedError
else interactive && generation succeeded
ShipItNow->>User: "Ship it now?" [Y/n]
User-->>ShipItNow: response
ShipItNow-->>CLI: boolean result
else default
ShipItNow-->>CLI: false
end
alt wantsDeploy === true
CLI->>CLI: Read existing token
alt no token
CLI->>HelpbaseLogin: runHelpbaseLogin()
HelpbaseLogin->>Terminal: Spawn helpbase login
Terminal-->>HelpbaseLogin: User completes auth
HelpbaseLogin-->>CLI: Return
CLI->>CLI: Re-read token
end
CLI->>HelpbaseDeploy: runHelpbaseDeploy(projectDir)
HelpbaseDeploy->>Terminal: Spawn helpbase deploy
Terminal->>Terminal: Stream stdout/stderr
Terminal-->>HelpbaseDeploy: Deploy result + logs
alt deploy success
HelpbaseDeploy-->>CLI: DeployOutcome {success: true, url, mcp}
CLI->>Terminal: Print live URL & MCP config
else deploy failure
HelpbaseDeploy-->>CLI: DeployOutcome {success: false, error}
CLI->>Terminal: Print "Deploy failed" + error tail
end
else wantsDeploy === false
CLI->>Terminal: Print local dev instructions
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/create-helpbase/src/index.ts`:
- Around line 321-326: The deploy resolver currently uses the raw TTY-derived
isInteractive when calling resolveShipItNow, which lets CI jobs with allocated
TTYs behave as interactive; change the logic so CI is treated as non-interactive
by deriving a new flag (e.g., interactiveForPrompts = isInteractive &&
!process.env.CI) and pass that into resolveShipItNow instead of the raw
isInteractive; update the call site that passes opts.deploy, source.kind,
isInteractive, generationSucceeded to pass the CI-aware interactive flag so
--deploy --source skip is refused in CI.
- Around line 335-346: The deploy gate currently only checks
readHelpbaseAuthToken() and may spawn runHelpbaseLogin() even when
HELPBASE_TOKEN is provided; modify the logic in the wantsDeploy branch to first
check process.env.HELPBASE_TOKEN and use that as the token (or skip login if
present) before calling readHelpbaseAuthToken() and runHelpbaseLogin(); update
the flow around the token variable so functions/readHelpbaseAuthToken,
runHelpbaseLogin, and the final deploy skip use the env token when available.
In `@packages/create-helpbase/src/ship-it-now.ts`:
- Around line 54-72: The current deploy branch returns true as long as
opts.flagDeploy is set and sourceKind !== "skip", which allows deploy to proceed
even when content generation failed; after the existing --source "skip"
handling, check the generation outcome before returning true (e.g., inspect
whatever generation result/flag your flow sets—name might be genResult,
generationSuccess, or similar) and short-circuit (return false or prompt) when
generation failed; update the branch that currently returns true (the block that
reads "if (opts.flagDeploy === true) { ... return true }") to verify generation
success and only return true when that check passes, using the same
prompt/isCancel pattern if you need interactive confirmation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 99cf20e7-5457-4d3f-8f12-45599236d564
📒 Files selected for processing (7)
CHANGELOG.mdREADME.mdpackages/create-helpbase/package.jsonpackages/create-helpbase/src/index.tspackages/create-helpbase/src/ship-it-now.tspackages/create-helpbase/test/cli.integration.test.tspackages/create-helpbase/test/resolve-ship-it-now.unit.test.ts
…on-failed case The guard that refuses `--deploy` + `--source skip` in non-interactive mode also needs to catch the symmetric case: `--deploy` with `generationSucceeded: false`. Both paths leave sample content on disk and publishing it to a public subdomain is almost always unintended. Non-interactive → throws ShipItNowRefusedError with a message pointing at the generation failure. Interactive → re-prompts with N-default, same pattern as the skip case. Caught by /review on this branch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two CI-path bugs caught by CodeRabbit on PR #12: 1. `isInteractive` is `process.stdin.isTTY`, which CI jobs can allocate. That meant `--deploy --source skip` in CI with a TTY would hit the interactive N-default confirm instead of the non-interactive refuse. Added `humanInteractive = isInteractive && !process.env.CI` for the ship-it-now decision; left `isInteractive` semantics intact for the earlier project-name / source / login prompts. 2. Auth gate only read ~/.helpbase/auth.json via readHelpbaseAuthToken(), missing the advertised CI path (`HELPBASE_TOKEN` env var). That sent CI jobs with a valid env token through runHelpbaseLogin() (blocks without TTY) or straight to the "Couldn't log you in" bail. Treat the env var as a truthy gate; `helpbase deploy` validates it at the real auth boundary. Also only attempt login when humanInteractive — no point spawning an interactive flow in CI. Live-verified: `CI=true --deploy --source skip` refuses exit 1; CI with no token + bad URL skips login, hits generation-failed refuse, exit 1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
Collapses cold TTHW from ~3 min to ~90s by adding a "Ship it to helpbase cloud? (~20 seconds)" prompt at the end of
create-helpbase. Y runshelpbase login(if needed) +helpbase deployinline — user goes from scaffolder to live public URL without leaving the command. N path preserves today's "Run it locally" + dev-server flow byte-for-byte.--deploy/--no-deployfor non-interactive mode--deploy --source skiprefuses in CI (exits 1 with clear message), re-prompts with N-default interactively--versiondrift: now reads frompackage.jsoninstead of hardcoded0.0.1(was stuck on 0.0.1 across every release)create-helpbase0.3.1 → 0.4.0Design:
~/.gstack/projects/help-center/christer-main-design-20260418-shapeA-ship-it-now.md.Test plan
pnpm -F create-helpbase test— 44 green (was 39; +5 for footgun behavior)pnpm -F create-helpbase typecheck— greenpnpm typecheck(monorepo) — 5/5 greencreate-helpbase --version→0.4.0--deploy --source skip < /dev/null→ refuses with named-flags message, exit 1--no-deploy < /dev/null→ silent skip, classic flow--deploy🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes – create-helpbase 0.4.0
New Features
Improvements
--deployand--no-deployCLI flags for non-interactive deployment control in automated environmentsDocumentation