Skip to content

CLI DX: page-money template, init --dir/--name, validate warnings, harness next-steps - #3

Merged
ZacxDev merged 1 commit into
mainfrom
cli-dx-improvements
Jun 18, 2026
Merged

CLI DX: page-money template, init --dir/--name, validate warnings, harness next-steps#3
ZacxDev merged 1 commit into
mainfrom
cli-dx-improvements

Conversation

@ZacxDev

@ZacxDev ZacxDev commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Four CLI improvements surfaced by the Gen Matrix page-app dogfood. All four are deterministic/structural (no behavior is prose-gated).

1. page-money SDK template (the big one)

The existing page-vite template is plain JS + raw postMessage — useless for a money-path page app. This adds internal/scaffold/templates/page-money (wired into init --template page-money): a real full-page (W10) money-path App Block, modeled on the working civitai-block-buzz-generator reference but a simpler single-generation skeleton.

  • package.json: @civitai/blocks-react@^0.6.0 + @civitai/app-sdk@^0.9.0 + React 19 + Vite/TS; scripts dev / dev:harness / build / test / typecheck / preview.
  • src/App.tsx: prompt → estimate (cost on the button) → first-Generate lazy consent via useRequestConsent → submit → poll → image, using useBuzzWorkflow + useBlockResize. No raw window.parent.postMessage — the SDK does origin-checked messaging.
  • src/Harness.tsx: a mock host (page BLOCK_INIT + consent round-trip + mocked orchestrator estimate/submit/poll) so dev:harness renders.
  • src/generation.ts + src/generation.test.ts: pure logic + a unit-test stub so authors inherit a test setup.
  • .env.development / .env.production / .env.example: allowed parent origins (go:embed can't carry dotfiles, so they're embedded as env.*.tmpl and mapped on render).
  • block.manifest.json: page app, scopes:["ai:write:budgeted"], page.buzzBudgetPerGen, buildCommand/outputDir; server-owned iframe.src/trustTier omitted.

page-vite + static are unchanged. The scaffold passes civitai app validate (asserted in tests), and was independently verified to npm-install → typecheck → vitest (9 pass) → vite build with the published SDK packages.

2. init dir control

--dir <path> and/or a positional [dir] set the output directory; --name overrides the display name independently. So name, slug, and directory can all differ. No flag → ./<slug> (back-compat). Conflicting positional+--dir is a clear error.

3. validate warning tier

Non-fatal WARNINGS distinct from errors — exit 0 with warnings, or --strict to fail. Warnings:

  • ai:write:budgeted in scopes but page.buzzBudgetPerGen missing (the headline footgun: budget-less tokens → every spend fails).
  • money scope on a non-page app (budgeted spend is a page affordance).
  • a budget set with no budgeted scope (inert budget).

4. init next-steps fix

Next-steps are template-aware: page-moneynpm run dev:harness (plain dev renders blank without a host); the cd target is the actual output dir.

Quality

go build / go test / go vet / gofmt -s -l clean; goreleaser check passes. New-logic coverage: scaffold 83.3%, validate 91.5%, cmd 92.4% (warningChecks 94.4%; NeedsHarness/outputName/printWarnings 100%).

🤖 Generated with Claude Code

…ng tier, harness next-steps

Four DX improvements surfaced by the Gen Matrix page-app dogfood:

1. New `page-money` template (`init --template page-money`): a real
   full-page (W10) money-path App Block wired to the published SDK
   (@civitai/blocks-react ^0.6.0 + @civitai/app-sdk ^0.9.0 + React 19 +
   Vite/TS). prompt -> estimate -> lazy consent (useRequestConsent) ->
   submit -> poll -> Buzz spend via useBuzzWorkflow + useBlockResize
   (never raw postMessage). Ships Harness.tsx mock host, dev:harness +
   build + test scripts, .env.{development,production,example}, a
   pure-logic generation.ts + test stub, and a budgeted page manifest
   (scopes ai:write:budgeted + page.buzzBudgetPerGen, server-owned
   iframe.src/trustTier omitted). Scaffolds + validates clean;
   independently verified to npm-install/typecheck/test/build.

2. `init` dir control: `--dir <path>` flag + optional positional [dir];
   `--name` overrides the display name independently of slug/dir. No flag
   -> ./<slug> (back-compat).

3. `validate` warning tier: non-fatal advisories distinct from errors
   (exit 0, or fail with --strict). Headline: ai:write:budgeted scope but
   no page.buzzBudgetPerGen. Plus money-scope-without-page and
   inert-budget-without-scope.

4. `init` next-steps are template-aware: page-money -> `npm run
   dev:harness` (plain `dev` renders blank without a host); next-steps now
   cd into the actual output dir.

Coverage of new logic: scaffold 83.3%, validate 91.5%, cmd 92.4%
(warningChecks 94.4%, NeedsHarness/outputName/printWarnings 100%).
go build/test/vet/gofmt + goreleaser check all clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@ZacxDev
ZacxDev merged commit 1ef9506 into main Jun 18, 2026
1 check passed
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