Skip to content

feat(create-helpbase): Ship it now? prompt at end of scaffold (Shape A) - #12

Merged
Codehagen merged 3 commits into
mainfrom
feat/create-helpbase-ship-it-now
Apr 18, 2026
Merged

Codehagen merged 3 commits into
mainfrom
feat/create-helpbase-ship-it-now

Conversation

@Codehagen

@Codehagen Codehagen commented Apr 18, 2026 •

Copy link
Copy Markdown
Owner

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 runs helpbase login (if needed) + helpbase deploy inline — 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.

  • New flags: --deploy / --no-deploy for non-interactive mode
  • Footgun guard: --deploy --source skip refuses in CI (exits 1 with clear message), re-prompts with N-default interactively
  • Fixed --version drift: now reads from package.json instead of hardcoded 0.0.1 (was stuck on 0.0.1 across every release)
  • Deploy-failed note includes the last output line so user doesn't scroll
  • create-helpbase 0.3.1 → 0.4.0

Design: ~/.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 — green
  • pnpm typecheck (monorepo) — 5/5 green
  • Live probe: create-helpbase --version → 0.4.0
  • Live probe: --deploy --source skip < /dev/null → refuses with named-flags message, exit 1
  • Live probe: --no-deploy < /dev/null → silent skip, classic flow
  • Cold-start timing from fresh terminal: target ≤ 90s interactive, ≤ 60s with --deploy
  • Dogfood the Y path end-to-end (login flow + deploy) on a clean machine

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes – create-helpbase 0.4.0

  • New Features

    • Added interactive "Ship it now?" prompt at scaffold completion that automatically runs login and deployment, then displays your live URL and MCP configuration
  • Improvements

    • Added --deploy and --no-deploy CLI flags for non-interactive deployment control in automated environments
    • Enabled dynamic version detection from package manifest
  • Documentation

    • Updated CHANGELOG and README with deployment flow details

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>
@vercel

vercel Bot commented Apr 18, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
helpbase Ready Ready Preview, Comment Apr 18, 2026 6:59pm

Request Review

@coderabbitai

coderabbitai Bot commented Apr 18, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@Codehagen has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 49 minutes and 0 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 191e1bd1-de72-491b-be05-009a598b60ab

📥 Commits

Reviewing files that changed from the base of the PR and between 2ee35de and aa365db.

📒 Files selected for processing (3)
  • packages/create-helpbase/src/index.ts
  • packages/create-helpbase/src/ship-it-now.ts
  • packages/create-helpbase/test/resolve-ship-it-now.unit.test.ts
📝 Walkthrough

Walkthrough

The 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 helpbase login and helpbase deploy inline, printing the live URL and MCP config. New --deploy/--no-deploy flags control non-interactive behavior. Dynamic version reading from package.json replaces hardcoded versioning.

Changes

Cohort / File(s) Summary
Documentation & Versioning
CHANGELOG.md, README.md, packages/create-helpbase/package.json
Documented new ship-it-now feature with conditional deployment prompts and flags, updated quick-start flow examples, and bumped version to 0.4.0.
Core CLI Implementation
packages/create-helpbase/src/index.ts
Added dynamic version reading from package.json, implemented --deploy/--no-deploy flag parsing, integrated resolveShipItNow() decision logic, added runHelpbaseDeploy() helper to execute deployments, and threaded deploy outcomes with authentication checks and outcome printing.
Ship-It-Now Logic
packages/create-helpbase/src/ship-it-now.ts
Introduced ShipItNowRefusedError exception and resolveShipItNow() function to determine deployment intent based on flags, source kind, interactivity, and generation success with precedence-driven decision flow.
Integration & Unit Tests
packages/create-helpbase/test/cli.integration.test.ts, packages/create-helpbase/test/resolve-ship-it-now.unit.test.ts
Updated CLI help assertions to include --deploy/--no-deploy flags, replaced hardcoded version test with dynamic semver validation, and added comprehensive unit test coverage for resolveShipItNow decision precedence across all flag/source/interactivity combinations.

Sequence Diagram

sequenceDiagram
    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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 Hop, hop, hooray! A prompt so merry appears,
"Ship it now?" we ask with interactive cheer,
Deploy flags flutter, the tokens align,
From scaffold to live—just answer Y for shine! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main feature: adding an interactive "Ship it now?" prompt at the end of the scaffold process, with clear scope indication.
Description check ✅ Passed The description comprehensively covers the summary, testing performed, and implementation details. It aligns well with the description template and provides clear context.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/create-helpbase-ship-it-now

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between a535722 and 2ee35de.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • README.md
  • packages/create-helpbase/package.json
  • packages/create-helpbase/src/index.ts
  • packages/create-helpbase/src/ship-it-now.ts
  • packages/create-helpbase/test/cli.integration.test.ts
  • packages/create-helpbase/test/resolve-ship-it-now.unit.test.ts

Comment thread packages/create-helpbase/src/index.ts Resolved
Comment thread packages/create-helpbase/src/index.ts Resolved
…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>
@Codehagen
Codehagen merged commit dd5e3b6 into main Apr 18, 2026
5 checks passed

This branch was successfully deployed

1 active deployment
Preview — aa365db1 Deployed Apr 18, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant