T-STP8-the-repo-adopts-the-shared-prettier-config
State: closed/done · Impact: high · Complexity: medium
No TypeScript or JavaScript project in the repo has a formatting gate except
8 Tauri apps (frontend-format-check); zero libraries have one. About 2,500
source files currently fail @sksizer/prettier-config (624 under
packages/ts, 1,896 under solutions, per the M-3MGB survey). This task
reformats the whole tree in one pass and adds a pre-commit hook that keeps it
formatted, so the reformat does not rot the way an unenforced style rule
always does.
| Location | Role today |
|---|---|
.prettierignore | Root ignore file. Deliberately empty of real entries — a comment explains that ignoring a generated path here would make prettier emit nothing for it and truncate the file. |
apps/agentpants/src-nuxt/.prettierignore | Nested ignore file protecting agentpants’ generated Nuxt sources from reformatting. |
apps/pumice/src-nuxt/.prettierignore | Nested ignore file protecting pumice’s generated Nuxt sources. |
apps/ontological-legacy/src-nuxt/.prettierignore | Nested ignore file for ontological-legacy’s generated Nuxt sources. |
apps/zoo/src-nuxt/.prettierignore | Nested ignore file for zoo’s generated Nuxt sources. |
apps/legacy-polish/src-nuxt/.prettierignore | Nested ignore file for legacy-polish’s generated Nuxt sources. |
solutions/augmented/apps/learn_web/.prettierignore | Nested ignore file for learn_web’s generated/vendored sources. |
solutions/ontological/desktop/src-nuxt/.prettierignore | Nested ignore file protecting sdf’s generated Nuxt sources. |
lefthook.yml | Has markdown-fmt (rumdl) and mdx-fmt (prettier) pre-commit commands, both auto-fixing and re-staging. No equivalent command exists for .ts/.tsx/.js/.vue/.json source, so a commit can currently land unformatted source. |
packages/ts/ | 624 files fail bunx prettier@3.9.6 --check against the shared config. |
solutions/ | 1,896 files fail the same check. |
.moon/tasks/tauri.yml | Declares frontend-format-check (prettier, no writes) for the 8 Tauri apps — the only formatting gate anywhere in the moon graph. |
Proposed
Section titled “Proposed”Every file under packages/ts/ and solutions/ that @sksizer/prettier-config
can format is formatted, verified per tree with bunx prettier@3.9.6 --check
exiting 0. lefthook.yml gains a source-format command, modelled exactly on
markdown-fmt, that runs prettier --write on staged source files and
re-stages the fixes on every commit — the primary enforcement. fmt-check
(landing per-project in tasks 3/4/6 of M-3MGB) is the CI backstop for commits
that bypass the hook. The four codegen-drift targets (sdf, foreman,
agentpants, pumice) still pass after the reformat, proving the generated
TypeScript these projects protect via their own nested .prettierignore (or
via build.rs/codegen_drift.sh invoking prettier internally) was untouched.
If any residue remains that prettier genuinely cannot format, it is recorded
in a baseline file rather than left silently unformatted.
Approach
Section titled “Approach”- Enumerate the trees to reformat:
packages/ts/andsolutions/(the two root directories the file-count survey covers), each formatted with its ownbunx prettier@3.9.6 --write <tree>invocation run with that tree — or, for the 7 nested-.prettierignoresubtrees, their own directory — as the working directory. Never invoke prettier from the repo root: the root.prettierignoreprotects nothing, so a root-level write would reformat (and potentially truncate) the generated files the 7 nested ignore files exist to protect. - Run each
--writepass, then confirmbunx prettier@3.9.6 --checkexits 0 for that same tree before moving to the next one. - Verify the four codegen-drift targets are unaffected:
moon run sdf:codegen-drift,moon run foreman:codegen-drift,moon run agentpants:codegen-drift,moon run pumice:codegen-drift. - If any file fails
--writecleanly (parses but keeps failing--check, or prettier errors on it outright), record it in a new baseline file (.claude/skills/project-check/prettier_baseline.json, following the shape of the existingutil_redeclarations_baseline.json) rather than leaving it silently unformatted. Skip this step if no such residue exists. - Add a
prettier-fmtcommand tolefthook.yml’spre-commit.commands, modelled onmarkdown-fmt:bunx prettier@3.9.6 --write {staged_files}scoped to source globs (.ts,.tsx,.js,.jsx,.vue,.json, excluding.md/.mdx, whichmarkdown-fmt/mdx-fmtalready own), withstage_fixed: true, and any of the existing hook’s directory exclusions (fixture corpora underapps/legacy-polish/fixtures/,packages/rust/wikilink/tests/fixtures/vault/,packages/ts/obsidian-editor/test/fixtures/corpus/) that carry byte-exact TypeScript/JSON test fixtures a reformat would corrupt. - Confirm the new hook re-stages a deliberately unformatted staged file by
testing it locally (stage a one-line change to an existing
.tsfile with bad formatting, runlefthook run pre-commit, confirm the fix lands staged).
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
packages/ts/ | modify | Reformat every file to @sksizer/prettier-config. |
solutions/ | modify | Reformat every file to @sksizer/prettier-config, respecting the 7 nested .prettierignore files. |
lefthook.yml | modify | Add a prettier-fmt pre-commit command that writes and re-stages staged source files, modelled on markdown-fmt. |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1:
cd packages/ts && bunx prettier@3.9.6 --check .exits 0. - AC-2:
cd solutions && bunx prettier@3.9.6 --check .exits 0. - AC-3:
moon run sdf:codegen-drift,moon run foreman:codegen-drift,moon run agentpants:codegen-drift, andmoon run pumice:codegen-driftall exit 0. - AC-4:
lefthook.ymlcontains a pre-commit command that runsprettier --write {staged_files}over source globs withstage_fixed: true. - AC-5: Staging a deliberately misformatted
.tsfile and runninglefthook run pre-commitleaves the fix staged (git diff --cachedshows the corrected formatting, not the original). - AC-6:
git diff --statfor this change touches no file under any of the 7 nested.prettierignoredirectories’ ignored patterns, and none of the 8 Tauri apps’frontend-format-checktargets regress.
Out of scope
Section titled “Out of scope”- Adding
format/format:checkscripts to individualpackage.jsonfiles — that isT-076AandT-9FH9. - Wiring per-project
fmt-checkmoon tasks — that is tasks 6-8 of M-3MGB (the Layer B aspects). - Rust formatting (
cargo fmt) — already gated via.moon/tasks/rust.ymland unaffected by this task. - The conformance guard rejecting mutating
lint/format:checkscripts — that is task 11 of M-3MGB.
Dependencies
Section titled “Dependencies”T-076AandT-9FH9land theformat/format:checkscripts this task’s reformat and hook build on.
Depends on
Section titled “Depends on”T-076A-the-script-vocabulary-lands-in-packages-apps-and-sites, T-9FH9-the-script-vocabulary-lands-across-solutions