feat(cli): plumb init with Tailwind detection (#33) - #128
Conversation
`plumb init` now inspects the current directory before writing
`plumb.toml`. When a `tailwind.config.{ts,mts,cts,js,mjs,cjs}` file
exists or `package.json` lists `tailwindcss` in any dependency table,
the command emits a Tailwind-flavoured starter populated with
Tailwind 3.x default spacing, type, and radius scales. The header
records the discovered config path via a placeholder substitution so
the future `extends` directive (tracked separately) can wire to it
without further hand-tuning. Next.js without Tailwind keeps the
generic template — we hint at it in the summary line but don't
switch flavours.
Detection is filesystem-only: no JS evaluation, no env var reads.
`package.json` parse failures fall back to the generic template
silently — `plumb init` is a scaffold, not a validator.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
I have enough context for a complete review. PR #128 —
|
| # | File | Location | Severity |
|---|---|---|---|
| 1 | crates/plumb-cli/tests/cli_integration.rs |
lint_with_viewport_flag_and_no_config_exits_input_error deleted in PR branch |
REQUEST CHANGES — restore regression guard |
| 2 | docs/src/cli.md:30 |
plumb init entry omits Tailwind detection behaviour |
REQUEST CHANGES — update docs |
| 3 | crates/plumb-cli/src/commands/init.rs (render()) |
Fallback label "tailwind.config.js" baked into comment when no file found |
Warning — not a correctness bug |
Verdict: REQUEST_CHANGES
Closes #33.
Summary
plumb initnow detects Tailwind/Next.js in CWD and branches between two scaffolds. Generic dir →examples/plumb.tomlverbatim; Tailwind dir →examples/plumb-tailwind.tomlwith the discoveredtailwind.config.*path substituted into the header comment.tailwind.config.{ts,mts,cts,js,mjs,cjs}in CWD and parsespackage.jsonfortailwindcss/nextacrossdependencies/devDependencies/peerDependencies. The Tailwind template fires when either the config file is present or thetailwindcssdep is listed;nextalone keeps the generic template.0..96, type scalexs..6xl, radius scalenone..3xl/full) soplumb lint plumb-fake://helloruns against the scaffolded config without further hand-tuning.extendsdirective isn't yet a real loader feature — it's recorded in the header comment as a future capability, matching the issue's "extends directive" wording without expanding theConfigschema in this PR.Acceptance criteria
init_detects_tailwind_and_emits_tailwind_template).plumb.tomlparses;plumb lintruns against the fixture (init_then_lint_runs_against_fake_driver, exit 3).init_writes_generic_config_in_clean_dir).Test plan
cargo nextest run --workspace --all-featurescargo clippy --workspace --all-targets --all-features -- -D warningscargo fmt --all --checkjust determinism-checkOut of scope
merge_tailwindintoplumb-cli's lint path. The adapter exists inplumb-configbut no caller invokes it yet — separate ticket.extendsdirective inConfig(would touchplumb-core+plumb-config+ schema regen).🤖 Generated with Claude Code