CLI DX: page-money template, init --dir/--name, validate warnings, harness next-steps - #3
Merged
Merged
Conversation
…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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four CLI improvements surfaced by the Gen Matrix page-app dogfood. All four are deterministic/structural (no behavior is prose-gated).
1.
page-moneySDK template (the big one)The existing
page-vitetemplate is plain JS + rawpostMessage— useless for a money-path page app. This addsinternal/scaffold/templates/page-money(wired intoinit --template page-money): a real full-page (W10) money-path App Block, modeled on the workingcivitai-block-buzz-generatorreference but a simpler single-generation skeleton.package.json:@civitai/blocks-react@^0.6.0+@civitai/app-sdk@^0.9.0+ React 19 + Vite/TS; scriptsdev/dev:harness/build/test/typecheck/preview.src/App.tsx: prompt → estimate (cost on the button) → first-Generate lazy consent viauseRequestConsent→ submit → poll → image, usinguseBuzzWorkflow+useBlockResize. No rawwindow.parent.postMessage— the SDK does origin-checked messaging.src/Harness.tsx: a mock host (pageBLOCK_INIT+ consent round-trip + mocked orchestrator estimate/submit/poll) sodev:harnessrenders.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:embedcan't carry dotfiles, so they're embedded asenv.*.tmpland mapped on render).block.manifest.json: page app,scopes:["ai:write:budgeted"],page.buzzBudgetPerGen,buildCommand/outputDir; server-ownediframe.src/trustTieromitted.page-vite+staticare unchanged. The scaffold passescivitai app validate(asserted in tests), and was independently verified to npm-install → typecheck → vitest (9 pass) → vite build with the published SDK packages.2.
initdir control--dir <path>and/or a positional[dir]set the output directory;--nameoverrides the display name independently. So name, slug, and directory can all differ. No flag →./<slug>(back-compat). Conflicting positional+--diris a clear error.3.
validatewarning tierNon-fatal WARNINGS distinct from errors — exit 0 with warnings, or
--strictto fail. Warnings:ai:write:budgetedin scopes butpage.buzzBudgetPerGenmissing (the headline footgun: budget-less tokens → every spend fails).4.
initnext-steps fixNext-steps are template-aware:
page-money→npm run dev:harness(plaindevrenders blank without a host); thecdtarget is the actual output dir.Quality
go build/go test/go vet/gofmt -s -lclean;goreleaser checkpasses. New-logic coverage: scaffold 83.3%, validate 91.5%, cmd 92.4% (warningChecks 94.4%; NeedsHarness/outputName/printWarnings 100%).🤖 Generated with Claude Code