Uh oh!
There was an error while loading. Please reload this page.
fix(cli): objectui doctor diagnoses Tailwind 4 instead of Tailwind 3 - #4064
Merged
Conversation
…问题 (#3891) doctor 的 Tailwind 段是按 v3 写的,在 v4 项目上三个判断全反:把「没有 tailwind.config.js」记成一条 issue(v4 根本不读这个文件,除非样式表用 @config 显式接入);对存在的该文件按 v3 的 content 数组打分(v4 已用 @source 取代),于是给两个死文件回了「✓ content paths configured」的假绿; 而 v4 真正跑不起来的依赖 @tailwindcss/postcss 一次都没查过。 现在检查的是 v4 契约,和 objectui init 生成物一致:@tailwindcss/postcss 已声明或已安装、PostCSS 配置写的是它而不是 v3 的 tailwindcss 键、CSS 入口 跑 @import 'tailwindcss'。缺 tailwind.config.* 不再产生任何一级的结论; 存在且无人 @config 接入时才报「它是死的」。识别不到 CSS 入口(monorepo 根、非常规布局)时整段跳过,不猜。 runDiagnostics(cwd) 返回带稳定 id 的结构化结论,doctor() 只负责渲染和计数 —— 测试因此能按 id 钉住判定,而不是去刮 console 输出。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Qqyix2QcnpUC9XeYVDzx3
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
yinlianghui
marked this pull request as ready for review
August 10, 2026 03:10
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Fixes#3891
The Tailwind section of
objectui doctorwas written against v3 and got every question backwards on a v4 project — which is every project this repo ships. Per the triage direction note of 2026-08-09, this is the v4-only rewrite; no v3-tolerant dual path was added (see "Scope" below).What was wrong, measured both ways
All three anchors in the card re-verified on
origin/mainbefore implementing. Evidence below is real output from the actualorigin/maindoctor.ts(extracted withgit show origin/main:packages/cli/src/commands/doctor.tsand executed as ESM — it carries no type annotations) versus the built new CLI, run in real directories of this repo.origin/main)examples/console-starter— a correct v4 app⚠️ tailwind.config.js not found→Found 1 issue(s)Everything looks good! ✨apps/console— carries an inert v3 config✓ tailwind.config.js found/✓ Tailwind content paths configured→Everything looks good! ✨⚠️ tailwind.config.js not found→Found 1 issue(s)1. A missing
tailwind.config.jscounted as an issue. In v4 that file is not part of the setup: the engine reads CSS-first configuration (@import 'tailwindcss',@theme,@source) and only loads a JS config when a stylesheet opts in with@config. The command reported a problem that did not exist and pushed the reader toward creating a file Tailwind never reads.2. That file was then graded on its
contentarray, the v3 key@sourcereplaced. The twotailwind.config.*files still tracked here are exactly that trap:apps/consoleandexamples/byo-backend-consoleboth declare acontentarray, and@confighas zero occurrences across every.cssfile in the repo — so both files are inert, and the old check answered✓ Tailwind content paths configuredfor them. A false green on a dead file, which is worse than silence.3.
@tailwindcss/postcsswas never checked — the one dependency a v4 build cannot start without. v4 moved the PostCSS plugin out oftailwindcssinto that package, and naming the oldtailwindcsskey in a PostCSS config resolves to a shim whose only job is to throw. That is the failure form #3852 measured on the generated app, and doctor printed✓ Tailwind CSS installedstraight through it.What the checks are now
The v4 contract, matching what
objectui initscaffolds (utils/app-generator.ts, read-only here):@tailwindcss/postcssdeclared inpackage.json, or installed in anode_modulesat the project or an ancestor.@tailwindcss/postcssand not the v3tailwindcsskey. The v3 probe is evaluated independently of the v4 one, so a half-finished migration listing both is still named.@import 'tailwindcss';@sourceis acknowledged when present, and the v3@tailwind base/components/utilitiesdirectives are called out as migration debt.tailwindcssmajor is read, so a v3 range no longer passes as✓ installed. An unparseable range (workspace:*,catalog:) is never reported as wrong — "cannot tell" is not "wrong".Two deliberate silences, because #3891 is about doctor asserting things it cannot see. A missing
tailwind.config.*produces no finding of any level; only a present one does, and only when nothing opts into it via@config. And when no recognised CSS entry exists at all (a monorepo root, a bespoke layout), the CSS verdicts are skipped rather than guessed.Scope
A v3-tolerant dual path — branching on the declared major and running two sets of checks — was not built, per the triage direction: it widens the product surface past this repo's v4-only posture. v3 spellings are diagnosed as migration debt, not supported as a second mode.
Region-exclusive as declared on the card: only
packages/cli/src/commands/doctor.tsplus a new doctor-specific test file and a changeset.init.ts,app-generator.tsandapp-generator.test.tsare untouched (#3892's surface).origin/mainmerged in before opening; the fullpackages/clisuite was re-run after the merge.Structure
runDiagnostics(cwd)now returns structured findings carrying a stableid, anddoctor()only renders and counts them. That split is what makes the matrix testable against real fixture directories instead of scraped console output, and the tests pin verdicts byidso wording can improve without the coverage evaporating.One implementation note worth recording. The "plugin is installed" probe is a manual
node_moduleswalk, deliberately notcreateRequire(...).resolve(). Node's resolver also consultsNODE_PATH, and that is not hypothetical here: vitest setsNODE_PATHto pnpm's virtual store, so under test every package in the monorepo resolved from any directory — including a freshos.tmpdir()fixture with an emptypackage.json. That made the "plugin is missing" branch unreachable in tests and would have shipped it unverified. It was caught by the branch going green when it should have been red, and the walk depends on nothing but the filesystem.Verification
pnpm exec vitest run packages/cli/— 4 files, 84 tests passed (21 of them new indoctor.test.ts), re-run after mergingorigin/main.pnpm --filter @object-ui/cli type-check— clean.pnpm --filter @object-ui/cli lint—0 errors; the 15 warnings are all pre-existing, indev.ts/app-generator.ts/spec-vocabulary-hint.ts, none indoctor.tsordoctor.test.ts.Reverse verification (direction predicted before running: red). Re-introducing just the deleted branch — a
warnwhentailwind.config.*is absent — turned 6 of 21 tests red, including the two that pin the defect directly:does NOT mention tailwind.config at all when the file is absentandreports zero issues for the shape objectui init generates. Restored and re-confirmed green.Out-of-scope finding
Running the fixed doctor at the repo root surfaced a real, pre-existing gap, filed separately and not fixed here: the root
postcss.config.mjsnames@tailwindcss/postcssandautoprefixeras plugins, but the rootpackage.jsondeclares neither@tailwindcss/postcssnorpostcss, and neither resolves from the root. See the linked issue.Generated by Claude Code