fix(cli): revert detect-squad-dir to zero-dependency bootstrap#756
Merged
bradygaster merged 9 commits intodevfrom Apr 2, 2026
Merged
fix(cli): revert detect-squad-dir to zero-dependency bootstrap#756bradygaster merged 9 commits intodevfrom
bradygaster merged 9 commits intodevfrom
Conversation
The StorageProvider refactor (26047dc) incorrectly converted this bootstrap utility from raw node:fs to FSStorageProvider. This file detects .squad/ directories before the SDK is loaded and must not depend on @bradygaster/squad-sdk. Adds a regression guard test to prevent future re-conversion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…dency creep Prevents future sweeping refactors from converting zero-dependency bootstrap utilities (like detect-squad-dir.ts) to use SDK imports. These files run before the SDK is loaded and must stay Node.js-only. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Agent history changes belong on dev, not in feature PRs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds 4 verified zero-dependency bootstrap files to the protected list (errors.ts, gh-cli.ts, output.ts, history-split.ts). Adds Sweeping Refactor Rules section and SDK/CLI package boundary guidance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…written) Tasks completed: - Task 0: PRE-CHECK: recorded decisions.md (334KB) and inbox (4 files) - Task 1: DECISIONS ARCHIVE: triggered Tier 2 (>=50KB), archived 7 entries older than 7 days - Task 2: DECISION INBOX: merged 4 inbox entries to decisions.md, deleted inbox files - Task 3: ORCHESTRATION LOG: wrote 5 agent logs (EECOM, Procedures, Flight, FIDO, EECOM-changeset) - Task 4: SESSION LOG: wrote detect-squad-dir-fix session log - Task 5: CROSS-AGENT: appended team update to 4 agent history.md files - Task 6: HISTORY SUMMARIZATION: checked—4 files exceed 15KB (EECOM 28.8KB, FIDO 23.3KB, Flight 23.7KB, Procedures 19.6KB). Deferred detailed archiving. - Task 7: GIT COMMIT: staged .squad/ changes (15 files), now committing - Task 8: HEALTH REPORT: decisions.md reduced from 334KB via Tier 2 purge; inbox count 0 (merged and cleared) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a CLI startup regression by restoring detect-squad-dir.ts to a true zero-dependency bootstrap utility (Node built-ins only), and adds a regression test + updated contributor guidance to prevent future refactors from reintroducing SDK dependencies.
Changes:
- Reverted
packages/squad-cli/src/cli/core/detect-squad-dir.tsto usenode:fsdirectly instead ofFSStorageProvider. - Added
test/detect-squad-dir-zero-deps.test.tsto enforce “no SDK imports/requires” and “must use node:fs”. - Documented a “Protected Files — Zero External Dependencies” list in
.github/copilot-instructions.md, plus added a changeset.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
packages/squad-cli/src/cli/core/detect-squad-dir.ts |
Removes SDK dependency and restores raw node:fs usage for bootstrap safety. |
test/detect-squad-dir-zero-deps.test.ts |
Adds a regression guard to prevent reintroducing external deps into the bootstrap file. |
.github/copilot-instructions.md |
Documents protected bootstrap files and refactor rules to avoid repeating the regression. |
.changeset/fix-detect-squad-dir-zero-deps.md |
Records a patch-level release note for the CLI fix. |
…ification - Widen test regex to catch subpath imports (@bradygaster/squad-sdk/*) - Fix test filename reference in copilot-instructions.md - Clarify core/ contains a mix of bootstrap and SDK-dependent modules Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Agent state (history, decisions, logs) should not be in feature PR diffs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Bug
detect-squad-dir.tsline 5 —the requested module @bradygaster/squad-sdk does not provide an export named FSStorageProviderReported on the
insiderbranch; same code exists ondev.Root Cause
Commit
26047dc5(feat(storage): add StorageProvider abstraction layer) swept the codebase converting rawnode:fscalls toFSStorageProvider. It incorrectly converteddetect-squad-dir.ts, a bootstrap utility whose JSDoc explicitly says "zero dependencies". This file runs to detect.squad/directories before the SDK is loaded — it must only use Node built-ins.Fix
detect-squad-dir.tsto use rawnode:fs(fs.statSync,fs.readFileSync,fs.existsSync)import { FSStorageProvider }andconst storage = new FSStorageProvider()Regression Guard
Added
test/detect-squad-dir-zero-deps.test.tswith three assertions:@bradygaster/squad-sdk@bradygaster/squad-sdknode:fsThis prevents future sweeping refactors from accidentally converting the file again.
Verification
npm run build✅vitest run test/worktree.test.ts— 9/9 pass ✅vitest run test/detect-squad-dir-zero-deps.test.ts— 3/3 pass ✅