Skip to content

fix(cli): declare the ambient CSS module in every styled starter - #3568

Merged
kojiwakayama merged 1 commit into
mainfrom
fix/dx-20260811-b2-10
Aug 11, 2026
Merged

kojiwakayama merged 1 commit into
mainfrom
fix/dx-20260811-b2-10

Conversation

@kojiwakayama

Copy link
Copy Markdown
Contributor

Symptom

A freshly scaffolded project fails its own type check on a line the framework wrote, with no edits by the developer:

veryfront init test-app --template ai-agent --runtime bun
cd test-app && bun install && bunx --bun tsc --noEmit

app/layout.tsx(1,8): error TS2882: Cannot find module or type declarations
  for side-effect import of '../globals.css'.

That is the only error the scaffold produces after bun install, so the very first tsc --noEmit on 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.tsx opens with import "../globals.css";, and the starter's tsconfig.json ships "strict": true with no types entry that supplies an ambient *.css module. docs-agent picked up a globals.d.ts when 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 same layout.tsx + tsconfig.json pair without one.

Fix

Ship the same one-line globals.d.ts (declare module "*.css";) with each of the five starters and regenerate cli/templates/manifest.json. Nothing else changes; tsconfig.json already 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's globals.css import, and the consumer tsconfig options), so the new case sits with its siblings and needs no browser or npm install.

Two deliberate choices:

  • It reads through getTemplate, not off disk. A declaration that exists in cli/templates/files/ but never reaches manifest.json leaves the developer with exactly the same red compiler, and the manifest is what veryfront init actually writes.
  • It discovers the starters that import a stylesheet rather than listing them, so a starter that adopts globals.css later 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, then bunx --bun tsc --noEmit: clean, zero output. Removing globals.d.ts from that same scaffold brings back app/layout.tsx(1,8): error TS2882 and 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.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@kojiwakayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 35 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f3a2ebf3-7dd1-46fc-9717-8b93c83aa196

📥 Commits

Reviewing files that changed from the base of the PR and between 718355c and 5d1cb80.

📒 Files selected for processing (7)
  • cli/templates/files/agentic-workflow/globals.d.ts
  • cli/templates/files/ai-agent/globals.d.ts
  • cli/templates/files/coding-agent/globals.d.ts
  • cli/templates/files/multi-agent-system/globals.d.ts
  • cli/templates/files/saas-starter/globals.d.ts
  • cli/templates/index.test.ts
  • cli/templates/manifest.json

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

@kojiwakayama

Copy link
Copy Markdown
Contributor Author

CI note: coverage shard 8/8 (and therefore tests (unit) / coverage gate) is red here on a failure this branch does not cause.

The failing case is HTTP Bundle Cache ... returns a signal-less cache follower after its bounded wait in src/transforms/esm/http-cache.test.ts:803 — a FakeTime follower that has not settled after the tick. This branch changes only cli/templates/** (five one-line globals.d.ts files, the regenerated manifest, and one test in cli/templates/index.test.ts); it touches no runtime source.

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, deno test --preload=src/testing/preload.ts --no-check --allow-all src/transforms/esm/http-cache.test.ts is green (73 steps).

Every other check on this PR is green, including ci (lint), ci (typecheck), ci (format), and the other seven coverage shards. Not fixing it here — it belongs to whoever owns the bounded-wait test.

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.
@kojiwakayama
kojiwakayama force-pushed the fix/dx-20260811-b2-10 branch from 53ebac9 to 5d1cb80 Compare August 11, 2026 09:52
@kojiwakayama

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (7b25cb7bd) and force-pushed; the branch applied cleanly, no conflicts, and the diff is unchanged — five one-line globals.d.ts files, the regenerated cli/templates/manifest.json, and the one regression case in cli/templates/index.test.ts.

The three red checks from the earlier run are gone. coverage shard 8/8 — and therefore its dependents tests (unit) and coverage gate — is green on the rebased commit, which confirms the note above: it was the unstable HTTP Bundle Cache ... returns a signal-less cache follower after its bounded wait case on main, not this branch. Every check now passes: ci (lint), ci (typecheck), ci (format), all eight coverage shards, and the full test matrix (unit, integration, node, bun, binary e2e, rsc browser e2e, npm install smoke, proxy binary).

Locally re-verified after the rebase: deno run -A scripts/build/generate-templates-manifest.ts --check reports the manifest current (48 templates, 463 files), and cli/templates/index.test.ts is green (40 steps).

No review comments to address yet — CodeRabbit is still rate-limited on this PR and has not started a review.

@kojiwakayama

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@kojiwakayama
kojiwakayama added this pull request to the merge queue Aug 11, 2026
@kojiwakayama

Copy link
Copy Markdown
Contributor Author

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 @coderabbitai review was also declined as rate limited, so its CodeRabbit check passes without a review having run. Nothing is waiting on a response from me.

Final state: head 5d1cb80, rebased onto main, mergeStateStatus: CLEAN, 27 checks passing and 6 skipped, none failing. Ready for a human to merge.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@kojiwakayama Acknowledged. CodeRabbit did not review this PR because of the review limit, so there are no CodeRabbit findings to address.

The reported CI state is clean. The PR is ready for human review and merge.

You are interacting with an AI system.

Merged via the queue into main with commit a043100 Aug 11, 2026
33 checks passed
@kojiwakayama
kojiwakayama deleted the fix/dx-20260811-b2-10 branch August 11, 2026 11:22
kojiwakayama added a commit that referenced this pull request Aug 11, 2026
… 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.
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