Skip to content

refactor: extract preflight-check helpers into testable module - #23

Closed
TerminalGravity wants to merge 1 commit into
mainfrom
refactor/extract-preflight-helpers
Closed

refactor: extract preflight-check helpers into testable module#23
TerminalGravity wants to merge 1 commit into
mainfrom
refactor/extract-preflight-helpers

Conversation

@TerminalGravity

Copy link
Copy Markdown
Collaborator

Extracts the 5 core pure functions from preflight-check.ts into src/lib/preflight-helpers.ts so they can be unit tested without mocking the MCP server.

Changes:

  • New src/lib/preflight-helpers.ts with: extractFilePaths, detectAmbiguity, estimateComplexity, classifyRisk, splitSubtasks
  • preflight-check.ts updated to import from helpers (no behavior change)
  • 22 new tests in tests/lib/preflight-helpers.test.ts
  • Test count: 43 → 65, all passing

Lays groundwork for #7 (unified preflight_check) by making the core logic independently testable.

- Extract extractFilePaths, detectAmbiguity, estimateComplexity,
  classifyRisk, splitSubtasks into src/lib/preflight-helpers.ts
- Update preflight-check.ts to import from helpers module
- Add 22 tests covering all extracted helper functions
- All 65 tests passing (up from 43)
@TerminalGravity

Copy link
Copy Markdown
Collaborator Author

🚧 Needs rebase on #17 before merge.

Good refactor direction — extracting pure functions for testability is the right call. But the extractFilePaths in preflight-helpers.ts is the old naive version. PR #17 adds false-positive filtering (FALSE_POSITIVE_PATHS set, version-number regex, CODE_EXTENSIONS check) that this extracted version is missing.

Please rebase on #17 so the extracted helper includes the filtering logic. Otherwise we regress on path extraction quality.

Rest of the extraction looks clean — detectAmbiguity, estimateComplexity, classifyRisk, splitSubtasks are all well-structured.

@TerminalGravity

Copy link
Copy Markdown
Collaborator Author

Superseded by #29 which includes these changes plus the dotfile bug fix and additional tests. Closing in favor of that PR.

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