Repository navigation
feat: ship ralph-instructions.md template and install pipeline (#1314) - #1576
Conversation
Add canonical template for the squad watch --execute escape hatch, wire it into init and upgrade, and add focused tests proving install/idempotency/ non-overwrite behavior. Changes: - .squad-templates/ralph-instructions.md: canonical source with contract docs, trust implications, and placeholder guidance - packages/squad-cli/templates/, packages/squad-sdk/templates/, templates/: synced copies via sync-templates.mjs - packages/squad-cli/src/cli/core/templates.ts: TEMPLATE_MANIFEST entry (overwriteOnUpgrade: false, destination matches execute.ts existsSync path) - packages/squad-cli/src/cli/core/upgrade.ts: ensureUserOwnedTemplates() — iterates TEMPLATE_MANIFEST user-owned entries, installs any missing; called from runEnsureChecks (upgrade and already-current paths) - packages/squad-cli/src/cli/core/init.ts: calls ensureUserOwnedTemplates after sdkInitSquad so ralph-instructions.md is installed on fresh init - test/cli/init-upgrade-parity.test.ts: 3 tests (install on init, preserve on upgrade, install-if-missing on upgrade) - test/cli/watch-capabilities.test.ts: 1 test asserting existsSync uses the correct .squad/ralph-instructions.md path from teamRoot - .changeset/feat-1314-ralph-instructions-template.md: patch changeset Closes #1314 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🛫 PR Readiness Check
PR Scope: 📦🔧 Mixed (product + infrastructure)
|
| Status | Check | Details |
|---|---|---|
| ❌ | Single commit | 2 commits — consider squashing before review |
| ✅ | Not in draft | Ready for review |
| ✅ | Branch up to date | Up to date with dev |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | Changeset file found |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ✅ | No merge conflicts | No merge conflicts |
| ❌ | Copilot threads resolved | 2 unresolved Copilot thread(s) — fix and resolve before merging |
| ✅ | CI passing | All checks passing |
Files Changed (15 files, +421 −9)
| File | +/− |
|---|---|
.changeset/feat-1314-ralph-instructions-template.md |
+28 −0 |
.squad-templates/ralph-instructions.md |
+67 −0 |
docs/src/content/docs/features/consult-mode.md |
+1 −1 |
docs/src/content/docs/features/squad-rc.md |
+2 −2 |
docs/src/content/docs/features/vscode.md |
+1 −1 |
docs/src/content/docs/reference/cli.md |
+1 −1 |
packages/squad-cli/src/cli/core/init.ts |
+13 −1 |
packages/squad-cli/src/cli/core/templates.ts |
+9 −0 |
packages/squad-cli/src/cli/core/upgrade.ts |
+39 −0 |
packages/squad-cli/templates/ralph-instructions.md |
+67 −0 |
packages/squad-sdk/templates/ralph-instructions.md |
+67 −0 |
templates/ralph-instructions.md |
+67 −0 |
test/cli/init-upgrade-parity.test.ts |
+37 −0 |
test/cli/watch-capabilities.test.ts |
+20 −0 |
test/docs-build.test.ts |
+2 −3 |
Total: +421 −9
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
🟠 Impact Analysis — PR #1576Risk tier: 🟠 HIGH 📊 Summary
🎯 Risk Factors
📦 Modules Affecteddocs (4 files)
root (2 files)
squad-cli (4 files)
squad-sdk (1 file)
templates (1 file)
tests (3 files)
This report is generated automatically for every PR. See #733 for details. |
🏗️ Architectural Review
Automated architectural review — informational only. |
There was a problem hiding this comment.
Pull request overview
This PR promotes the previously-undocumented .squad/ralph-instructions.md escape hatch used by squad watch --execute into a shipped, user-customizable template that is installed during init/upgrade without overwriting local modifications.
Changes:
- Add a canonical
ralph-instructions.mdtemplate (synced across.squad-templates/,templates/, CLI templates, and SDK templates). - Register the template as a user-owned
TEMPLATE_MANIFESTentry and ensure init/upgrade install it only when missing. - Add regression tests covering init/upgrade parity and the
execute.tslookup path behavior, plus a changeset for the CLI package.
Show a summary per file
| File | Description |
|---|---|
test/cli/watch-capabilities.test.ts |
Adds a regression test asserting .squad/ralph-instructions.md lookup behavior in buildAgentPrompt. |
test/cli/init-upgrade-parity.test.ts |
Adds init/upgrade parity tests for installing and preserving .squad/ralph-instructions.md. |
templates/ralph-instructions.md |
Adds root template mirror for Ralph instructions contract + customization guidance. |
packages/squad-sdk/templates/ralph-instructions.md |
Adds SDK template mirror for Ralph instructions. |
packages/squad-cli/templates/ralph-instructions.md |
Adds CLI template source for Ralph instructions. |
packages/squad-cli/src/cli/core/upgrade.ts |
Adds ensureUserOwnedTemplates and wires it into upgrade ensure checks. |
packages/squad-cli/src/cli/core/templates.ts |
Registers ralph-instructions.md as a user-owned template in TEMPLATE_MANIFEST. |
packages/squad-cli/src/cli/core/init.ts |
Ensures user-owned templates are installed after sdkInitSquad() during init. |
.squad-templates/ralph-instructions.md |
Adds canonical source template for sync pipeline. |
.changeset/feat-1314-ralph-instructions-template.md |
Adds changeset for @bradygaster/squad-cli (patch). |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 2
- Review effort level: Lite
| // Install user-owned template files that are not yet present on disk. | ||
| // These were not created by sdkInitSquad (which owns ceremonies.md, routing.md, etc. | ||
| // via the SDK templates path). ensureUserOwnedTemplates reads TEMPLATE_MANIFEST | ||
| // entries with overwriteOnUpgrade: false and copies each one only if absent. |
| it('checks .squad/ralph-instructions.md inside teamRoot', () => { | ||
| // Verify that existsSync is called with the correct path so that the | ||
| // TEMPLATE_MANIFEST destination ('ralph-instructions.md' under .squad/) | ||
| // matches the lookup in execute.ts. | ||
| mockFsExistsSync.mockImplementation((p: unknown) => { | ||
| return typeof p === 'string' && p.endsWith('.squad/ralph-instructions.md'); | ||
| }); | ||
| const issues: ExecutableWorkItem[] = [ | ||
| { number: 1, title: 'Task', labels: [{ name: 'squad' }], assignees: [] }, | ||
| ]; | ||
| const prompt = buildAgentPrompt(issues, '/some/repo'); | ||
| expect(mockFsExistsSync).toHaveBeenCalledWith( | ||
| expect.stringContaining('.squad/ralph-instructions.md'), | ||
| ); | ||
| // Path must be constructed from teamRoot, not a global path | ||
| const [calledPath] = mockFsExistsSync.mock.calls[0] as [string]; | ||
| expect(calledPath).toContain('/some/repo'); | ||
| expect(prompt).toContain('Ralph, Go!'); | ||
| }); |
… WS-B/WS-D - consult-mode.md: ../guide/personal-squad.md → ../features/team-setup.md - squad-rc.md: self-referential ./remote-control.md → ./squad-rc.md (×2) - vscode.md: ../guide/shell.md → ../reference/cli.md - reference/cli.md: ../features/remote-control.md → ../features/squad-rc.md - test/docs-build.test.ts: remove personal-squad, shell from EXPECTED_GUIDES; choosing-your-path → choose-your-interface in EXPECTED_GET_STARTED; remove remote-control from EXPECTED_FEATURES These 3 tests were failing on origin/dev before this PR branch diverged. WS-B (cbd8aa3) deleted guide/personal-squad.md, guide/shell.md, and features/remote-control.md but did not update all cross-links or test expectations. WS-D (ec8498c) deleted choosing-your-path.md but test was not updated. Pre-existing baseline confirmed on origin/dev. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CI Failure Follow-Up — EECOMDiagnosisThe 3 failing tests are pre-existing on Root cause: docs restructure PRs WS-B ( Failing Tests (pre-existing)
Fix Applied (commit
|
Working as EECOM (Core Dev)
Summary
Closes #1314
Promotes the undocumented
.squad/ralph-instructions.mdescape hatch insquad watch --executeto a first-class documented feature by shipping a canonical template with contract docs, wiring it into the init/upgrade pipeline, and adding focused regression tests.What Changed
Template (
packages/squad-cli/templates/ralph-instructions.md)Canonical source lives in
.squad-templates/and is synced to CLI, SDK, and root mirror viasync-templates.mjs. Documents:TEMPLATE_MANIFEST entry (
templates.ts)Destination matches the
existsSync(path.join(teamRoot, '.squad', 'ralph-instructions.md'))lookup inexecute.ts.Install pipeline (
upgrade.ts+init.ts)New
ensureUserOwnedTemplates(dest, templatesDir)function inupgrade.ts:overwriteOnUpgrade: falserunEnsureChecks→ both upgrade and already-current paths get itinit.tsaftersdkInitSquad()for fresh installsTests
test/cli/init-upgrade-parity.test.tstest/cli/watch-capabilities.test.ts.squad/ralph-instructions.mdpath from teamRootValidation Evidence
All 63 tests pass (61 existing + 4 new).
Changeset
.changeset/feat-1314-ralph-instructions-template.md— patch for@bradygaster/squad-cliDesign Review Compliance
navigation.tsor any docs pagecore/zero-dep files unchanged)sync-templates.mjs(existing tooling)