Skip to content

refactor: nuclear-review pass — setup.ts split, helper dedup, boundary hardening#64

Merged
arzafran merged 1 commit into
mainfrom
refactor/nuclear-review-followup
Jun 19, 2026
Merged

refactor: nuclear-review pass — setup.ts split, helper dedup, boundary hardening#64
arzafran merged 1 commit into
mainfrom
refactor/nuclear-review-followup

Conversation

@arzafran

Copy link
Copy Markdown
Member

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 ~/.claude path 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

  • setup.ts 1005 → 685 lines. Display layer → install-display.ts, help/rollback → install-cmds.ts. Deleted the runMigrateOnly stub (its work was already done by main). Removed the buildInstallPlan/installConfigFiles plan-vs-reality split, then collapsed the now-redundant removeLightIncompatibleFiles into installConfigFiles — light installs prune through one path, not two.
  • Canonical helpers in platform.tsCLAUDE_DIR/claudePath(), isoNow(), localDatetime() — replace 20+ bespoke join(homedir(), ".claude") derivations and 5 inlined timestamp idioms across scripts/hooks. post-failure.ts now uses readState/writeState; statusline.ts routes through colors.ts, so NO_COLOR is finally honoured in the status line.
  • Boundary hardening. readSrcManifest validates via a new SrcManifestRecordSchema (the manifest lives in ~/.claude — in scope for the Shai-Hulud threat model); auditHooks consumes the schema-validated hooks block; audit-hooks.ts reads settings.json through canonical readJsonOrNull. mergeSettings is now output-free — it returns MergeAccounting | null and the caller prints via printMergeAccounting.
  • @biomejs/biome 2.4.16 → 2.5.0 (+ biome.json $schema). The stricter ruleset surfaced and removed a dead test helper + unused import.

Test Plan

  • bun run typecheck clean
  • bun test — 614 pass (1 pre-existing env-dependent failure: teamKnowledgeAwareness reads the local knowledge cache; fails identically on main)
  • bun run lint exit 0 · bun run lint:skills 0/0 · bun run schemas:check in sync
  • Installer --dry-run output byte-identical vs main (setup.ts restructure is behaviour-preserving)
  • light-profile + install-e2e suites green (light install still prunes every full-only target through the single remaining path)

…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.
@arzafran arzafran merged commit f84cee7 into main Jun 19, 2026
15 checks passed
@arzafran arzafran deleted the refactor/nuclear-review-followup branch June 19, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant