Skip to content

fix: audit template dirs, sync package templates, expand tests (#461)#462

Merged
bradygaster merged 4 commits intobradygaster:devfrom
diberry:squad/461-template-sync-audit
Mar 20, 2026
Merged

fix: audit template dirs, sync package templates, expand tests (#461)#462
bradygaster merged 4 commits intobradygaster:devfrom
diberry:squad/461-template-sync-audit

Conversation

@diberry
Copy link
Copy Markdown
Collaborator

@diberry diberry commented Mar 19, 2026

Closes #461 — squad obo dina
Working as Fenster (Core Dev)

What changed

  • Audit: Scanned all 5 template directories, identified every duplicated file
  • Fix casting-policy.json (4 locations): Added Futurama universe (capacity 12) to allowlist and capacity map
  • Fix squad.agent.md (5 locations): Updated universe count from 31 → 15 to match actual policy
  • New test file: \ est/template-sync.test.ts\ with 14 tests covering all locations
  • Build-time sync script: \scripts/sync-templates.mjs\ — copies .squad-templates/ to all target dirs automatically

Build-time template sync

Added \scripts/sync-templates.mjs\ that reads every file from .squad-templates/\ and copies them to:

  • \ emplates/\ (root mirror)
  • \packages/squad-cli/templates/\ (CLI package)
  • \packages/squad-sdk/templates/\ (SDK package)
  • .github/agents/squad.agent.md\ (special case for squad.agent.md only)

The script is wired into the build pipeline via \prebuild\ — runs automatically before every
pm run build. Can also be run standalone:
pm run sync-templates.

Handles subdirectories recursively, creates missing parent dirs in targets, and logs each synced file. Initial run caught 6 files that had drifted between directories.

Template directory audit results

File Locations
squad.agent.md .squad-templates, templates, .github/agents, squad-cli, squad-sdk
casting-policy.json .squad-templates, templates, squad-cli, squad-sdk
casting-reference.md Does not exist in any dir (consistent)
30+ other template files .squad-templates, templates, squad-cli, squad-sdk

Test coverage

  • All 5 squad.agent.md locations: universe count parity
  • All 4 casting-policy.json locations: byte-for-byte content parity
  • Cross-file: policy universe count == agent md stated count
  • Policy integrity: allowlist ↔ capacity map consistency
  • casting-reference.md: consistent existence/absence check
  • Uses \import.meta.url\ root resolution, anchored regex

@diberry
Copy link
Copy Markdown
Collaborator Author

diberry commented Mar 19, 2026

Ready for review — conditional on your decision on #461 — squad obo dina

What's in this PR

  1. Template sync script (scripts/sync-templates.mjs) — single source (.squad-templates/) propagates to templates/, packages/squad-cli/templates/, packages/squad-sdk/templates/, and squad.agent.md to .github/agents/. Wired into prebuild so it runs automatically before every build. Dynamic file discovery — no hardcoded list.

  2. 125 parity tests (test/template-sync.test.ts) — 106 byte-for-byte equality checks (35 files x 3 mirrors + 1 .github/agents), 6 universe count checks, 6 casting policy structural checks, 5 semantic cross-checks, 1 script execution smoke test, 1 source guard. All dynamically generated from the actual file tree.

  3. Synced files — all template dirs now match .squad-templates/ as source of truth.

Depends on #461

See the architecture recommendation on #461. This PR implements option 1 (single source + build copy + parity tests). If you prefer a different approach, let us know and we'll adjust.

Reviewed by

  • 🏗️ Keaton (Lead) — ✅ APPROVE
  • 🧪 Hockney (Tester) — ✅ APPROVE (after one revision round expanding test coverage)

Copilot AI added 4 commits March 20, 2026 02:28
…gaster#461)

- Add Futurama (capacity 12) to all 4 casting-policy.json files
- Fix universe count from 31 to 15 in all 5 squad.agent.md copies
- Create test/template-sync.test.ts with 14 tests covering:
  - All 5 squad.agent.md locations (universe count parity)
  - All 4 casting-policy.json locations (content parity)
  - casting-reference.md consistency check
  - Cross-file validation (policy count matches agent md count)
- Use import.meta.url-based root resolution (not process.cwd())
- Anchored regex for universe count extraction

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds scripts/sync-templates.mjs that copies .squad-templates/ to all
target directories (templates/, packages/squad-cli/templates/,
packages/squad-sdk/templates/, .github/agents/). Wired into prebuild
so sync runs automatically before every build.

Also syncs files that had drifted between template directories.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Dynamic enumeration: enumerate all 36 files in .squad-templates/ at runtime,
  assert byte-for-byte parity across all 3 mirror targets (+ .github/agents/
  for squad.agent.md). Generates 109 test cases dynamically.
- Script execution: run node scripts/sync-templates.mjs, verify exit code 0.
- Negative guard: .github/agents/ contains only squad.agent.md.
- Remove dead casting-reference.md tests (file does not exist in .squad-templates/).
- Retain universe-count and casting-policy semantic checks.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bradygaster bradygaster force-pushed the squad/461-template-sync-audit branch from de68118 to 02cb888 Compare March 20, 2026 09:35
@bradygaster bradygaster merged commit cb47637 into bradygaster:dev Mar 20, 2026
2 checks passed
chrislomonico pushed a commit to clomonico/squad that referenced this pull request Mar 26, 2026
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.

test: audit all template directories for duplicated files and add sync tests

3 participants