fix(cli): declare the ambient CSS module in every styled starter - #3568
Conversation
|
Warning Review limit reached
Next review available in: 35 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
Comment |
|
CI note: The failing case is Same failure, same test, on main-side content at the same time:
It also passed on the main run immediately before (https://github.com/veryfront/veryfront-code/actions/runs/31472887228), so it is an unstable test on main rather than a hard break. Locally, Every other check on this PR is green, including |
An untouched scaffold failed its own type check on a framework-authored
line. `app/layout.tsx` opens with `import "../globals.css";`, and the
scaffold shipped no ambient declaration for `*.css`, so the first
`tsc --noEmit` a developer runs on a brand-new project is red:
app/layout.tsx(1,8): error TS2882: Cannot find module or type
declarations for side-effect import of '../globals.css'.
`docs-agent` already carried `globals.d.ts` from #3074; the other five
styled starters (ai-agent, agentic-workflow, coding-agent,
multi-agent-system, saas-starter) never got it. Ship the same one-line
declaration with each of them and regenerate the template manifest.
The regression lives in cli/templates/index.test.ts because that is where
the scaffolded file set is asserted, and it reads through `getTemplate`
rather than off disk: a declaration that exists in `files/` but never
reaches manifest.json leaves the developer with the same red compiler.
It discovers the starters that import a stylesheet instead of listing
them, so a starter that adopts one later is covered too.
Found on a DX dogfood walk of the create-project quickstart.
53ebac9 to
5d1cb80
Compare
|
Rebased onto current The three red checks from the earlier run are gone. Locally re-verified after the rebase: No review comments to address yet — CodeRabbit is still rate-limited on this PR and has not started a review. |
|
@coderabbitai review |
|
|
Review status: there are no review comments on this PR to address or decline — zero inline threads, zero submitted reviews. CodeRabbit has not reviewed it. It reported the account review limit when the PR opened, and an explicit Final state: head |
|
Tip For best results, initiate chat on the files or code changes.
The reported CI state is clean. The PR is ready for human review and merge. You are interacting with an AI system. |
… trees The documented trees were written before globals.d.ts was added to the styled starters (#3568) and before the minimal template shipped a tsconfig.json, so scaffold-trees.test.ts passed on this branch but failed once merged with main. The merge queue caught it; the trees now match the templates again.
Symptom
A freshly scaffolded project fails its own type check on a line the framework wrote, with no edits by the developer:
That is the only error the scaffold produces after
bun install, so the very firsttsc --noEmiton a brand-new project is red on framework-authored code. The create-project quickstart presents the scaffold as ready to go (✓ test-app ready).Root cause
app/layout.tsxopens withimport "../globals.css";, and the starter'stsconfig.jsonships"strict": truewith notypesentry that supplies an ambient*.cssmodule.docs-agentpicked up aglobals.d.tswhen it was made TypeScript-clean in #3074, but the other five styled starters —ai-agent,agentic-workflow,coding-agent,multi-agent-system,saas-starter— emit the samelayout.tsx+tsconfig.jsonpair without one.Fix
Ship the same one-line
globals.d.ts(declare module "*.css";) with each of the five starters and regeneratecli/templates/manifest.json. Nothing else changes;tsconfig.jsonalready includes**/*.ts, which covers the declaration.Regression test
cli/templates/index.test.ts— "scaffolds an ambient CSS module declaration beside the stylesheet import". That file is where the scaffolded file set is asserted (it already checks the Tailwind entry stylesheet, the layout'sglobals.cssimport, and the consumertsconfigoptions), so the new case sits with its siblings and needs no browser or npm install.Two deliberate choices:
getTemplate, not off disk. A declaration that exists incli/templates/files/but never reachesmanifest.jsonleaves the developer with exactly the same red compiler, and the manifest is whatveryfront initactually writes.globals.csslater is covered without editing the test.Verified red before the fix (
ai-agent imports a stylesheet and must scaffold a "*.css" module declaration), green after.End-to-end verification
Scaffolded with the local CLI,
bun install, thenbunx --bun tsc --noEmit: clean, zero output. Removingglobals.d.tsfrom that same scaffold brings backapp/layout.tsx(1,8): error TS2882and nothing else, so this one file is the whole gap between a red and a green scaffold.Found on a DX dogfood walk of the published getting-started flow.