Skip to content

refactor(#1509): split initCommand, doctorCommand, syncCommand and updateCommand to ≤ 200 counted lines; max-lines-per-function ratchet for src/commands - #1561

Merged
admarble merged 8 commits into
mainfrom
feature/1509-refactor-commands-split-initcommand-doctorcommand-
Oct 20, 2026
Merged

admarble merged 8 commits into
mainfrom
feature/1509-refactor-commands-split-initcommand-doctorcommand-

Conversation

@admarble

@admarble admarble commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

AC Result
AC-1 The eslint count is 0.
AC-2 grep -c "src/commands/\*\*" eslint.config.js returns 1.
AC-3 npm run lint is green, and lint:health reports no metric above the baseline.
AC-4 Test lines added: 0.
AC-5 The five command suites pass (20 files, 344 tests), and so does templates.test.ts.
AC-6 functions.over200 is now 7, down from 12. I regenerated the baseline for that.
  • How I split them: the extracted steps are non-exported helpers in the same five files, not new src/commands/<name>/ modules.
  • Why in the same files: the exported function names and mock paths stay the same, so the tests needed no edits and knip sees no new exports.
  • Order and output: call order, output text and exit codes are unchanged.
  • Install scope: the install-scope logic shared by sync and update was not copied anywhere.
  • Ratchet: I appended one block to eslint.config.js, scoped to src/commands/**/*.ts.
  • CHANGELOG: I added one [Unreleased] line under the existing ### Changed heading.

The affected-tests run (npx vitest run --changed origin/main, 26 files) first failed one test:

  • Failure: templates.test.ts keys its write-site registry by enclosing function, so moving the .sequant/settings.reference.md write out of initCommand broke it.
  • Fix: I moved that one writeFile back into initCommand. I re-ran templates.test.ts and the init suites (7 files, 162 tests), which pass. I did not repeat the full affected run after the fix.

I skipped the mutation check for AC-2 and wrote no SEQUANT_MUTATION markers. No test gates AC-2; before the splits, the lint run showed the five over-limit functions. npm run knip doesn't exist in this checkout, so I checked unused exports only through lint; nothing new is exported.

Pre-PR confidence check

  • Weakest part: this is a large move-only diff in doctor.ts and init.ts, and only the existing tests guard the output order. Reviewing with git diff --color-moved is the best check.
  • Coverage gaps: none for the changed files, since all five have existing suites. I added no tests because AC-4 forbids them.

Next step: the orchestrator opens the PR and runs /qa.

Fixes #1509

QA verdict: AC_MET_BUT_NOT_A_PLUS — acceptance criteria met, but not A+. The run broke to this PR for review rather than entering the quality loop; see the QA review comment for improvement notes.

Runner verification (2026-10-20)

After merging main (through #1512), the runner re-ran AC-1..AC-6 verbatim at 2d70570:

  • AC-1: 0
  • AC-2: 1
  • AC-3: green
  • AC-4: 0
  • AC-5: 414 passed (five command suites + templates.test.ts)
  • AC-6: 7
  • Build exit 0.

The baseline records functions.over200 7 (from 12) and over400 2 (from 4).

Control flow traced: every early return in the old init/doctor/sync/update/ready command functions either stays in the command function or became a helper whose result the caller checks.

Fixed from QA: the eslint ratchet comment now allows same-file step functions.


🤖 Generated with Claude Code

… 200 lines; add max-lines-per-function ratchet

Entire-Checkpoint: 8216b87a3c7c
…or the ownership registry

Entire-Checkpoint: 8329b5251dc2
…th main's lower counts

Entire-Checkpoint: 7feea8d4701b
@admarble
admarble merged commit d5395c7 into main Oct 20, 2026
11 of 12 checks passed
@admarble
admarble deleted the feature/1509-refactor-commands-split-initcommand-doctorcommand- branch October 20, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant