refactor: nuclear-review pass — setup.ts split, helper dedup, boundary hardening#64
Merged
Merged
Conversation
…y hardening Whole-codebase maintainability audit and the fixes it surfaced. - setup.ts 1005→685 lines: display layer extracted to install-display.ts, help/rollback to install-cmds.ts; runMigrateOnly stub deleted; the buildInstallPlan/installConfigFiles plan-vs-reality split removed; the redundant removeLightIncompatibleFiles pass collapsed into installConfigFiles (one prune path for light, not two). - platform.ts canonical helpers (CLAUDE_DIR/claudePath, isoNow, localDatetime) replace 20+ bespoke ~/.claude derivations and 5 inlined timestamp idioms across scripts/hooks; post-failure.ts uses readState/writeState; statusline.ts routes through colors.ts so NO_COLOR is honoured. - Boundary hardening: SrcManifestRecordSchema for readSrcManifest; auditHooks consumes the schema-validated hooks block; audit-hooks.ts reads settings.json through the canonical readJsonOrNull; mergeSettings is output-free (returns MergeAccounting | null, caller prints via printMergeAccounting). - @biomejs/biome 2.4.16 → 2.5.0 (+ biome.json $schema). Installer dry-run output byte-identical; full suite green.
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 free
to 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.
What this does
A whole-codebase maintainability audit (
/nuclear-review) plus the fixes it surfaced, reworked to their end-state (/zero-tech-debt). No behaviour changes — the installer produces byte-identical output and the full suite stays green. The win is structural: the one file over the 1k-line cap is split up, a pile of copy-pasted~/.claudepath and timestamp code collapses into shared helpers, two JSON boundaries now validate through the project's own zod-first pattern, and a redundant second prune pass on light installs is gone.Summary
install-display.ts, help/rollback →install-cmds.ts. Deleted therunMigrateOnlystub (its work was already done bymain). Removed thebuildInstallPlan/installConfigFilesplan-vs-reality split, then collapsed the now-redundantremoveLightIncompatibleFilesintoinstallConfigFiles— light installs prune through one path, not two.platform.ts—CLAUDE_DIR/claudePath(),isoNow(),localDatetime()— replace 20+ bespokejoin(homedir(), ".claude")derivations and 5 inlined timestamp idioms across scripts/hooks.post-failure.tsnow usesreadState/writeState;statusline.tsroutes throughcolors.ts, soNO_COLORis finally honoured in the status line.readSrcManifestvalidates via a newSrcManifestRecordSchema(the manifest lives in~/.claude— in scope for the Shai-Hulud threat model);auditHooksconsumes the schema-validated hooks block;audit-hooks.tsreadssettings.jsonthrough canonicalreadJsonOrNull.mergeSettingsis now output-free — it returnsMergeAccounting | nulland the caller prints viaprintMergeAccounting.@biomejs/biome2.4.16 → 2.5.0 (+biome.json$schema). The stricter ruleset surfaced and removed a dead test helper + unused import.Test Plan
bun run typecheckcleanbun test— 614 pass (1 pre-existing env-dependent failure:teamKnowledgeAwarenessreads the local knowledge cache; fails identically onmain)bun run lintexit 0 ·bun run lint:skills0/0 ·bun run schemas:checkin sync--dry-runoutput byte-identical vsmain(setup.ts restructure is behaviour-preserving)light-profile+install-e2esuites green (light install still prunes every full-only target through the single remaining path)