diff options
| author | Jesse Vincent <jesse@primeradiant.com> | 2026-09-18 17:28:09 -0700 |
|---|---|---|
| committer | Jesse Vincent <jesse@primeradiant.com> | 2026-09-18 17:28:09 -0700 |
| commit | cffb7c95b64524cd59ddb4d1c9d2c2675482315e (patch) | |
| tree | 38263673a455cdf894f19301aa284009d7edb1d8 /tests | |
| parent | 835c5f951cce3e169b755218a9d8f26b5854f0d5 (diff) | |
Plans as directories, and a boundary check before each next planplan-directories
A plan is a directory: 00-header.md plus one NN-<task>.md per task. The
brief for task N is the header plus that file; sdd-workspace, task-brief,
review-package, task-start and task-done take a file or a directory.
Before starting the next plan in a set, executors run
scripts/plan-boundary, which names every identifier the plan consumes
from earlier plans that the code as built does not contain, in the next
plan and in every later plan's Plan Set entry, and fix the plan until it
prints clean. Measured: the directory form executes the same as the file
form (inline 9/9, SDD 6/6, same cost) and plans at the same volume; the
gate kept a five-plan set consistent with the code 2/2 against a planted
cross-plan naming conflict, where a per-ruling duty managed 0/2.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/claude-code/run-skill-tests.sh | 1 | ||||
| -rwxr-xr-x | tests/claude-code/test-plan-directories.sh | 79 |
2 files changed, 80 insertions, 0 deletions
diff --git a/tests/claude-code/run-skill-tests.sh b/tests/claude-code/run-skill-tests.sh index 97bce6d..e41c968 100755 --- a/tests/claude-code/run-skill-tests.sh +++ b/tests/claude-code/run-skill-tests.sh @@ -77,6 +77,7 @@ tests=( "test-worktree-path-policy.sh" "test-sdd-workspace.sh" "test-executing-plans-scripts.sh" + "test-plan-directories.sh" "test-subagent-driven-development.sh" ) diff --git a/tests/claude-code/test-plan-directories.sh b/tests/claude-code/test-plan-directories.sh new file mode 100755 index 0000000..d4ee8ae --- /dev/null +++ b/tests/claude-code/test-plan-directories.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash +# Tests for plan directories: task-brief assembles the header and one task +# file; sdd-workspace names the workspace after the directory; plan-boundary +# flags a name the next plan consumes that the code does not have, checks the +# later plans' attributed names too, and reports clean once the plan is fixed. +set -euo pipefail +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)" +SDD="$REPO_ROOT/skills/subagent-driven-development/scripts" +EP="$REPO_ROOT/skills/executing-plans/scripts" +FAILURES=0; TEST_ROOT="" +pass() { echo " [PASS] $1"; } +fail() { echo " [FAIL] $1"; FAILURES=$((FAILURES + 1)); } +cleanup() { if [[ -n "$TEST_ROOT" && -d "$TEST_ROOT" ]]; then rm -r -- "$TEST_ROOT"; fi; } +main() { + echo "=== Test: plan directories ===" + TEST_ROOT="$(mktemp -d)"; trap cleanup EXIT + git init -q -b main "$TEST_ROOT/repo"; local repo; repo="$(cd "$TEST_ROOT/repo" && git rev-parse --show-toplevel)" + local git_id=(-c user.email=t@example.com -c user.name=t -c commit.gpgsign=false) + mkdir -p "$repo/plans/1-engine" "$repo/plans/2-terminal" "$repo/plans/3-effects" "$repo/pkg" + cat > "$repo/plans/1-engine/00-header.md" <<'MD' +# Engine Plan +**Goal:** the engine. +## Plan Set +1. `plans/1-engine` — engine. Consumes nothing. +2. `plans/2-terminal` — terminal. Consumes from plan 1: `NewGame`, `Advance`. +3. `plans/3-effects` — effects. Consumes from plan 1: `Advance`; from plan 2: `Canvas`. +MD + cat > "$repo/plans/1-engine/01-core.md" <<'MD' +### Task 1: Core +**Interfaces:** +- Consumes: nothing. +- Produces: `NewGame() *Game`, `(g *Game) Advance(dt)`. +- [ ] **Step 1:** write it. +MD + for d in 2-terminal 3-effects; do cp "$repo/plans/1-engine/00-header.md" "$repo/plans/$d/00-header.md"; done + cat > "$repo/plans/2-terminal/01-app.md" <<'MD' +### Task 1: App +**Interfaces:** +- Consumes: `NewGame`, `Advance` (plan 1). +- Produces: `Canvas`. +MD + cat > "$repo/plans/3-effects/01-fx.md" <<'MD' +### Task 1: FX +**Interfaces:** +- Consumes: `Advance` (plan 1), `Canvas` (plan 2). +- Produces: `World`. +MD + # the engine as built calls it Tick, not Advance + printf 'package pkg\ntype Game struct{}\nfunc NewGame() *Game { return &Game{} }\nfunc (g *Game) Tick(dt int) {}\n' > "$repo/pkg/game.go" + (cd "$repo" && git add -A && git "${git_id[@]}" commit -q -m "engine") + + local out + out="$(cd "$repo" && "$SDD/task-brief" plans/2-terminal 1 "$TEST_ROOT/brief.md")" + if grep -q '^# Engine Plan' "$TEST_ROOT/brief.md" && grep -q '^### Task 1: App' "$TEST_ROOT/brief.md" && ! grep -q 'Task 1: FX' "$TEST_ROOT/brief.md"; then + pass "task-brief on a directory writes the header plus the one task file" + else fail "task-brief on a directory writes the header plus the one task file: $out"; fi + + out="$(cd "$repo" && "$SDD/sdd-workspace" plans/2-terminal)" + if [[ "$out" == */.superpowers/sdd/2-terminal ]]; then pass "sdd-workspace names the workspace after the plan directory"; else fail "sdd-workspace names the workspace after the plan directory: $out"; fi + + local rc=0 + out="$(cd "$repo" && "$EP/plan-boundary" plans/2-terminal 2>&1)" || rc=$? + if [[ "$rc" -eq 1 && "$out" == *"missing in code: Advance (consumed by 2-terminal)"* ]]; then + pass "plan-boundary flags a consumed name the code does not have" + else fail "plan-boundary flags a consumed name the code does not have (rc=$rc): $out"; fi + if [[ "$out" == *"missing in code: Advance (consumed by 3-effects (from plans before 2-terminal))"* && "$out" != *"Canvas"* ]]; then + pass "plan-boundary checks later plans' names from completed plans only" + else fail "plan-boundary checks later plans' names from completed plans only: $out"; fi + if [[ "$out" != *"NewGame"* ]]; then pass "plan-boundary accepts a consumed name the code has"; else fail "plan-boundary accepts a consumed name the code has"; fi + + (cd "$repo" && perl -pi -e 's/Advance/Tick/g' plans/*/00-header.md plans/2-terminal/01-app.md plans/3-effects/01-fx.md) + rc=0; out="$(cd "$repo" && "$EP/plan-boundary" plans/2-terminal 2>&1)" || rc=$? + if [[ "$rc" -eq 0 && "$out" == boundary:\ clean* ]]; then pass "plan-boundary reports clean once the plans match the code"; else fail "plan-boundary reports clean once the plans match the code (rc=$rc): $out"; fi + + echo + if [[ "$FAILURES" -eq 0 ]]; then echo "PASS"; else echo "FAIL ($FAILURES)"; exit 1; fi +} +main "$@" |
