refactor: extract preflight_check helpers + 20 tests + dotfile bug fix - #29
Closed
TerminalGravity wants to merge 3 commits into
Closed
refactor: extract preflight_check helpers + 20 tests + dotfile bug fix#29TerminalGravity wants to merge 3 commits into
TerminalGravity wants to merge 3 commits into
Conversation
… and contracts The README references .preflight/ config extensively but there were no concrete example files to copy. This adds a ready-to-use examples/.preflight/ directory with annotated config.yml, triage.yml, and contracts/api.yml, plus a README explaining how to use them.
- Add 17 tests covering config loading from .preflight/, env var overrides, caching, malformed YAML handling, and helper functions - Export resetConfig() to clear cached config (needed for tests and potential config hot-reload) - All 60 tests passing
…tests + fix dotfile bug - Extract extractFilePaths, detectAmbiguity, estimateComplexity, splitSubtasks into src/lib/preflight.ts - Add comprehensive test suite (tests/lib/preflight.test.ts) — 20 new tests - Fix bug: extractFilePaths now correctly detects dotfiles (.env, .gitignore) - preflight-check.ts imports from lib instead of inline definitions - All 80 tests pass
TerminalGravity
commented
Feb 27, 2026
TerminalGravity
left a comment
Collaborator
Author
There was a problem hiding this comment.
Clean extraction — the four helpers are well-scoped and the tests are thorough. The dotfile fix in extractFilePaths is a good catch.
One minor thought: estimateComplexity uses the first path segment for directory spread, which works for typical layouts but would undercount monorepo paths like packages/foo/src/bar.ts — might be worth using path.dirname instead of split('/')[0] at some point. Not blocking.
This supersedes #23 and #24 — let's close those once this merges.
Also noticed this PR includes the example configs from #26 (the .preflight/ examples). Was that intentional or a rebase artifact? The examples look great either way.
This was referenced Feb 27, 2026
Collaborator
Author
|
Superseded by newer PRs. |
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
preflight-check.tsintosrc/lib/preflight.tsfor testabilitytests/lib/preflight.test.ts(80 total, all passing)extractFilePathsnow detects dotfiles like.envand.gitignoreWhy
preflight_checkis the most complex tool in the project and had zero direct test coverage. The helper functions were private/inline, making them untestable. This refactor makes them importable and well-tested.Functions extracted
extractFilePathsdetectAmbiguityestimateComplexitysplitSubtasks