mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-12-02 00:37:18 +00:00
11 KiB
11 KiB
| date | topic |
|---|---|
| 2026-04-25 | cargo-dev-ux-cleanup |
cargo dev UX Cleanup
Problem Frame
cargo dev was created in April 2026 to consolidate five shell scripts into one Rust binary, modeled after uv's ergonomics. Six commands shipped:
docker-build, refresh-spa, check-spa-budgets, generate-cli-reference, generate-options-reference, release.
A few rough edges have surfaced now that the surface is in regular use by humans, agents, and CI:
refresh-spais mandatory before any TypeScript commit, but CI enforces it via a separategit diff --exit-codestep rather than a first-class check mode. The dirty-check lives in CI YAML, not in the dev tool.check-spa-budgetsis a sibling command instead of part of the same SPA verification pass, so contributors need to remember two commands to "verify the SPA is shippable."- Word order is mixed —
docker-buildis noun-verb,refresh-spaandcheck-spa-budgetsare verb-noun, the twogenerate-*-referencecommands are verb-noun-noun. There is no rule a contributor can apply to guess a command name. release [nightly]uses a positional with a single accepted value (nightly), reading awkwardly compared with--nightly.
This brainstorm captures the rename + consolidation pass to fix word order, fold SPA verification into one command, and switch the release prerelease to a flag.
Surface Comparison
| Today | After |
|---|---|
cargo dev docker-build |
cargo dev docker-build (unchanged) |
cargo dev refresh-spa |
cargo dev spa refresh |
cargo dev check-spa-budgets + CI git diff --exit-code |
cargo dev spa check (folds both) |
cargo dev generate-cli-reference |
cargo dev docs refresh (regenerates both artifacts) |
cargo dev generate-cli-reference --check |
cargo dev docs check (verifies both artifacts) |
cargo dev generate-options-reference |
cargo dev docs refresh |
cargo dev generate-options-reference --check |
cargo dev docs check |
cargo dev release |
cargo dev release (unchanged) |
cargo dev release nightly |
cargo dev release --nightly |
| — | cargo dev spa prints SPA command help |
| — | cargo dev docs prints docs command help |
Requirements
Naming convention
- R1. Adopt noun-verb word order (uv style): the group/subject comes first, the action second.
docker-buildis grandfathered as a single hyphenated noun-verb name because it has no siblings;releasestays as a single verb because it has no group. - R2. Group-only invocation is non-mutating help:
cargo dev spaprints the SPA subcommand help and exits successfully;cargo dev docsprints the docs subcommand help and exits successfully. Mutating commands always require an explicit verb (refresh).
SPA group
- R3.
cargo dev spa refreshrebuilds the SPA viabun run build, verifies the builtdist/output against the asset budget gate, and only then replaceslib/crates/fabro-spa/assets/. On budget violation, it exits non-zero and leaves the committed asset directory untouched. This extends today'srefresh-spabehavior with the budget gate so contributors can't ship an oversized bundle by accident without creating a dirty tracked tree on failed refresh. - R4.
cargo dev spa checkis non-mutating with respect to tracked files: it must not rewritelib/crates/fabro-spa/assets/, and it must leave the tracked working tree unchanged whether it passes or fails. It may use ignored temporary output, but it must clean up any temporary directory it creates. It must fail (non-zero exit) when either (a) the SPA bundle inlib/crates/fabro-spa/assets/does not match whatbun run buildwould produce now (given the currentbun.lockand source tree), or (b) the bundle exceeds asset budgets. This subsumes both today'scheck-spa-budgetsand the CIgit diff --exit-code -- lib/crates/fabro-spa/assetsstep. The bit-exact comparison relies onbun run buildbeing reproducible from a frozen lockfile; CI is the authoritative environment becausebun install --frozen-lockfileruns there. If a contributor sees aspa checkfailure locally that they can't explain, the resolution is to runcargo dev spa refreshand commit the result — CI'sspa checkthen arbitrates. - R5. Both
.github/workflows/typescript.yml(Build job) and.github/workflows/release.yml(verify-spajob, lines 29–31) callcargo dev spa checkinstead ofcargo dev refresh-spa+git diff --exit-code -- lib/crates/fabro-spa/assets. The dirty-check no longer lives in workflow YAML. Both CI workflows must runbun install --frozen-lockfilebeforecargo dev spa check; this preserves the TypeScript workflow's existing setup and tightens the release workflow, which currently uses plainbun install.
Docs group
- R6.
cargo dev docs refreshregenerates bothdocs/reference/cli.mdxanddocs/reference/user-configuration.mdxin one pass. Replaces the twogenerate-*-referencecommands' default mode. - R7.
cargo dev docs checkverifies both MDX artifacts are up to date without rewriting them. Replaces the two commands'--checkmode. Non-zero exit on drift in either file.
Release
- R8.
cargo dev releasecuts a stable release;cargo dev release --nightlycuts a nightly prerelease. The[nightly]positional is removed. Other release-mode flags (--dry-run,--skip-tests,--release-date) are unchanged.
Migration
- R9. Hard cut: the old names (
refresh-spa,check-spa-budgets,generate-cli-reference,generate-options-reference,release nightlypositional) are removed in the same PR. No deprecated aliases. - R10. All in-repo callers update in the same PR. Scope explicitly includes:
- CI workflows under
.github/workflows/(includingnightly.yml'scargo dev release nightlyinvocation andrelease.yml'sverify-spajob). AGENTS.md(including its release-mode usage line that shows[nightly]) andCLAUDE.md.- Any live
docs/references that show the user-facing command (historical artifacts underdocs/plans/anddocs/brainstorms/are left alone). - The
lib/crates/fabro-dev/source crate itself: the subprocess invocation insrc/commands/release.rs(currentlycargo dev refresh-spa),bail!and help strings insidesrc/commands/*.rsthat name the old commands, and integration tests undertests/it/that invoke subcommands by name. These must rename in lockstep with the clap subcommand declarations orcargo nextest run -p fabro-devwill fail.
- CI workflows under
Success Criteria
cargo dev --helplistsdocker-build,spa,docs,release(four entries) with consistent noun-verb naming.- A contributor can answer "how do I verify the SPA before pushing?" with one command (
cargo dev spa check) instead of two plus agit diff. - CI's TypeScript Build job, the release pipeline's
verify-spajob, and the docs-reference checks each call exactly onecargo dev <group> checkcommand; the workflow YAML no longer contains agit diff --exit-codeline for SPA assets, and both SPA-checking workflows usebun install --frozen-lockfile. rg "refresh-spa|check-spa-budgets|generate-cli-reference|generate-options-reference|release nightly|release \\[nightly\\]" .github CLAUDE.md AGENTS.md docs/ lib/crates/fabro-dev/ -g '!docs/plans/**' -g '!docs/brainstorms/**'returns no live references after the PR merges. Historical matches insidedocs/plans/anddocs/brainstorms/are acceptable.cargo nextest run -p fabro-devpasses after the rename, and nobail!or help text insidelib/crates/fabro-dev/src/references the removed command names.
Scope Boundaries
- Out of scope:
cargo dev verifyaggregate command,cargo dev doctorenvironment check,--jsonoutput for agents,--watchmode forspa refresh, pre-commit hook installation. These were considered and deferred — worth a separate brainstorm if footgun-reduction proves still painful after this cleanup. - Out of scope: any change to what
docker-builddoes or its flag surface. - Out of scope: extending the release prerelease vocabulary beyond
nightly(--prerelease <kind>style). The single--nightlyflag is enough for the current need; switch to--prereleaseif/when a second prerelease kind is introduced.
Key Decisions
- Noun-verb word order (uv style) wins over verb-noun (cargo style). Rationale:
cargo devwas already modeled afteruvper docs/plans/2026-04-24-001-refactor-adopt-uv-patterns-plan.md, and the user pickedspa refreshdirectly. - One docs command pair, not per-artifact.
docs refreshregenerates both MDX files;docs checkverifies both. Rationale: both regenerations are fast and idempotent, granular targeting has no real use case, and the simpler pair mirrorsspa refresh/spa check. spa checkowns both the diff and the budget gate. Rationale: contributors think of "is the SPA ready to ship?" as one question; splitting it across two commands and a CI YAML step is what produced today's friction.- Group-only commands are help-only. Rationale:
cargo dev spaandcargo dev docsare easy commands for humans and agents to discover; making them mutate the working tree by default is too easy to trigger accidentally. Explicit verbs keep the command surface predictable. spa refreshalso enforces the budget gate before replacing committed assets. Rationale: a successful refresh that quietly produces an over-budget bundle is a footgun, but a failed refresh should not leave tracked assets dirty. Validate the built output first, then mirror it intolib/crates/fabro-spa/assets/only on success.spa check's bit-exact comparison relies onbun install --frozen-lockfile. Rationale: CI is the authoritative environment because both SPA-checking workflows runbun install --frozen-lockfilebeforespa check; locally, contributors runspa refreshto make their working tree match what their bun produces, then trust CI'sspa checkto arbitrate cross-machine drift.- Hard cut, no deprecated aliases. Rationale: the tool is internal-only with all callers in this repo; the user's standing preference is "simplest change, don't care about migration."
Outstanding Questions
Resolve Before Planning
(none)
Deferred to Planning
- [Affects R4][Technical] Implementation strategy for
spa check's diff: build into a temporary output directory and compare it againstlib/crates/fabro-spa/assets/, or rebuildapps/fabro-web/dist/and clean it up after comparison. Whichever path is chosen must leave tracked files untouched and must not require a clean working tree outsidelib/crates/fabro-spa/assets/. - [Affects R10][Needs research] Confirm the explicit caller list is exhaustive via
rg "refresh-spa|check-spa-budgets|generate-cli-reference|generate-options-reference|release nightly|release \\[nightly\\]" . -g '!target/**' -g '!docs/plans/**' -g '!docs/brainstorms/**'immediately before merging.
Next Steps
→ /ce:plan for structured implementation planning