@open-agent-toolkit/cli 0.0.42 → 0.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/assets/agents/oat-phase-implementer.md +230 -0
  2. package/assets/agents/oat-reviewer.md +3 -3
  3. package/assets/docs/cli-utilities/configuration.md +15 -3
  4. package/assets/docs/docs-tooling/add-docs-to-a-repo.md +12 -1
  5. package/assets/docs/docs-tooling/commands.md +4 -0
  6. package/assets/docs/reference/cli-reference.md +17 -14
  7. package/assets/docs/reference/oat-directory-structure.md +17 -17
  8. package/assets/docs/workflows/projects/artifacts.md +34 -0
  9. package/assets/docs/workflows/projects/implementation-execution.md +161 -0
  10. package/assets/docs/workflows/projects/lifecycle.md +22 -29
  11. package/assets/docs/workflows/projects/reviews.md +4 -2
  12. package/assets/docs/workflows/skills/index.md +0 -1
  13. package/assets/public-package-versions.json +4 -4
  14. package/assets/skills/oat-docs-bootstrap/SKILL.md +11 -3
  15. package/assets/skills/oat-doctor/SKILL.md +3 -3
  16. package/assets/skills/oat-project-implement/SKILL.md +368 -126
  17. package/assets/skills/oat-project-import-plan/SKILL.md +2 -3
  18. package/assets/skills/oat-project-next/SKILL.md +11 -12
  19. package/assets/skills/oat-project-plan/SKILL.md +23 -5
  20. package/assets/skills/oat-project-plan-writing/SKILL.md +2 -2
  21. package/assets/skills/oat-project-progress/SKILL.md +29 -35
  22. package/assets/skills/oat-project-quick-start/SKILL.md +14 -3
  23. package/assets/skills/oat-project-review-provide/SKILL.md +24 -2
  24. package/assets/skills/oat-project-review-receive/SKILL.md +5 -1
  25. package/assets/skills/oat-worktree-bootstrap-auto/SKILL.md +2 -2
  26. package/assets/templates/docs-app-fuma/docs/index.md +2 -0
  27. package/assets/templates/implementation.md +8 -3
  28. package/assets/templates/plan.md +24 -3
  29. package/assets/templates/state.md +1 -1
  30. package/dist/commands/config/index.d.ts.map +1 -1
  31. package/dist/commands/config/index.js +17 -4
  32. package/dist/commands/docs/index-generate/index.d.ts +1 -0
  33. package/dist/commands/docs/index-generate/index.d.ts.map +1 -1
  34. package/dist/commands/docs/index-generate/index.js +8 -1
  35. package/dist/commands/docs/init/index.d.ts.map +1 -1
  36. package/dist/commands/docs/init/index.js +46 -0
  37. package/dist/commands/docs/init/resolve-options.d.ts +2 -0
  38. package/dist/commands/docs/init/resolve-options.d.ts.map +1 -1
  39. package/dist/commands/docs/init/resolve-options.js +1 -0
  40. package/dist/commands/docs/init/root-package.d.ts +23 -0
  41. package/dist/commands/docs/init/root-package.d.ts.map +1 -0
  42. package/dist/commands/docs/init/root-package.js +226 -0
  43. package/dist/commands/init/tools/index.js +1 -1
  44. package/dist/commands/init/tools/shared/skill-manifest.d.ts +2 -2
  45. package/dist/commands/init/tools/shared/skill-manifest.d.ts.map +1 -1
  46. package/dist/commands/init/tools/shared/skill-manifest.js +1 -1
  47. package/dist/commands/project/index.d.ts.map +1 -1
  48. package/dist/commands/project/index.js +3 -1
  49. package/dist/commands/project/set-mode/index.d.ts +0 -6
  50. package/dist/commands/project/set-mode/index.d.ts.map +1 -1
  51. package/dist/commands/project/set-mode/index.js +16 -96
  52. package/dist/commands/project/validate-plan/index.d.ts +3 -0
  53. package/dist/commands/project/validate-plan/index.d.ts.map +1 -0
  54. package/dist/commands/project/validate-plan/index.js +44 -0
  55. package/dist/commands/project/validate-plan/validate-plan.d.ts +20 -0
  56. package/dist/commands/project/validate-plan/validate-plan.d.ts.map +1 -0
  57. package/dist/commands/project/validate-plan/validate-plan.js +77 -0
  58. package/dist/commands/tools/update/index.d.ts +4 -0
  59. package/dist/commands/tools/update/index.d.ts.map +1 -1
  60. package/dist/commands/tools/update/index.js +17 -1
  61. package/dist/commands/tools/update/update-tools.d.ts +1 -0
  62. package/dist/commands/tools/update/update-tools.d.ts.map +1 -1
  63. package/dist/commands/tools/update/update-tools.js +80 -1
  64. package/dist/config/oat-config.d.ts +1 -0
  65. package/dist/config/oat-config.d.ts.map +1 -1
  66. package/dist/config/oat-config.js +3 -0
  67. package/dist/config/resolve.d.ts.map +1 -1
  68. package/dist/config/resolve.js +9 -0
  69. package/package.json +2 -2
  70. package/assets/skills/oat-project-subagent-implement/SKILL.md +0 -549
  71. package/assets/skills/oat-project-subagent-implement/examples/pattern-hill-checkpoint.md +0 -110
  72. package/assets/skills/oat-project-subagent-implement/examples/pattern-parallel-phases.md +0 -118
  73. package/assets/skills/oat-project-subagent-implement/scripts/dispatch.sh +0 -133
  74. package/assets/skills/oat-project-subagent-implement/scripts/reconcile.sh +0 -182
  75. package/assets/skills/oat-project-subagent-implement/scripts/review-gate.sh +0 -187
  76. package/assets/skills/oat-project-subagent-implement/tests/fixtures/sample-plan.md +0 -234
  77. package/assets/skills/oat-project-subagent-implement/tests/test-dry-run.sh +0 -126
  78. package/assets/skills/oat-project-subagent-implement/tests/test-hill-checkpoint.sh +0 -127
  79. package/assets/skills/oat-project-subagent-implement/tests/test-reconcile.sh +0 -254
  80. package/assets/skills/oat-project-subagent-implement/tests/test-review-gate.sh +0 -220
@@ -1,254 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Test: Parallel worktree execution and reconciliation
3
- #
4
- # Validates that reconcile.sh correctly merges two non-conflicting unit
5
- # branches into an orchestration branch in deterministic order.
6
- #
7
- # Creates a temporary git repo with simulated parallel unit branches,
8
- # then runs reconcile.sh to merge them.
9
- #
10
- # Usage: bash tests/test-reconcile.sh
11
-
12
- set -euo pipefail
13
-
14
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
15
- SKILL_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
16
- PASS=0
17
- FAIL=0
18
-
19
- assert_contains() {
20
- local label="$1" output="$2" expected="$3"
21
- if echo "$output" | grep -qF -- "$expected"; then
22
- echo " PASS: $label"
23
- PASS=$((PASS + 1))
24
- else
25
- echo " FAIL: $label — expected to contain: $expected"
26
- FAIL=$((FAIL + 1))
27
- fi
28
- }
29
-
30
- # ─── Setup Temporary Git Repo ──────────────────────────────────────────────
31
- TMPDIR=$(mktemp -d)
32
- trap 'rm -rf "$TMPDIR"' EXIT
33
-
34
- cd "$TMPDIR"
35
- git init -b orchestration-branch
36
- git config user.email "test@test.com"
37
- git config user.name "Test"
38
-
39
- # Create initial commit on orchestration branch
40
- echo '{ "name": "test-project" }' > package.json
41
- cat > .npmrc <<'NPMRC'
42
- # placeholder
43
- NPMRC
44
- git add .
45
- git commit -m "initial commit"
46
-
47
- # ─── Create Unit Branch p01 (non-conflicting files) ───────────────────────
48
- git checkout -b "project/p01"
49
- mkdir -p src/models
50
- echo 'export const User = { id: 1, name: "test" };' > src/models/user.ts
51
- echo 'test("user", () => {});' > src/models/user.test.ts
52
- git add .
53
- git commit -m "feat(p01-t01): create user model"
54
-
55
- echo 'export const Settings = { key: "theme" };' > src/models/settings.ts
56
- git add .
57
- git commit -m "feat(p01-t02): create settings model"
58
-
59
- # ─── Create Unit Branch p02 (non-conflicting files) ───────────────────────
60
- git checkout orchestration-branch
61
- git checkout -b "project/p02"
62
- mkdir -p src/routes
63
- echo 'export const userRoute = "/api/user";' > src/routes/user.ts
64
- echo 'test("user route", () => {});' > src/routes/user.test.ts
65
- git add .
66
- git commit -m "feat(p02-t01): create user API endpoint"
67
-
68
- echo 'export const settingsRoute = "/api/settings";' > src/routes/settings.ts
69
- git add .
70
- git commit -m "feat(p02-t02): create settings API endpoint"
71
-
72
- # ─── Return to orchestration branch ───────────────────────────────────────
73
- git checkout orchestration-branch
74
-
75
- echo "=== Test: Reconcile Two Non-Conflicting Unit Branches ==="
76
- echo ""
77
-
78
- # ─── Run Reconcile ────────────────────────────────────────────────────────
79
- # Note: reconcile.sh runs pnpm test/lint/type-check for integration verification.
80
- # In this test repo those commands don't exist, so they'll "fail" but
81
- # the merge itself should succeed. We override by creating stub scripts.
82
- cat > run-checks.sh <<'STUB'
83
- #!/bin/bash
84
- exit 0
85
- STUB
86
- chmod +x run-checks.sh
87
-
88
- # Create package.json with stub test/lint/type-check scripts
89
- cat > package.json <<'PKG'
90
- {
91
- "name": "test-project",
92
- "scripts": {
93
- "test": "exit 0",
94
- "lint": "exit 0",
95
- "type-check": "exit 0"
96
- }
97
- }
98
- PKG
99
- git add .
100
- git commit -m "chore: add stub scripts for integration verification"
101
-
102
- # Capture reconcile output (need to handle pnpm not being in PATH for stubs)
103
- # Override pnpm with a shim
104
- mkdir -p "$TMPDIR/bin"
105
- cat > "$TMPDIR/bin/pnpm" <<'SHIM'
106
- #!/bin/bash
107
- exit 0
108
- SHIM
109
- chmod +x "$TMPDIR/bin/pnpm"
110
- export PATH="$TMPDIR/bin:$PATH"
111
-
112
- RECONCILE_OUTPUT=$(bash "$SKILL_DIR/scripts/reconcile.sh" orchestration-branch "project/p01" "project/p02" 2>&1)
113
-
114
- echo "$RECONCILE_OUTPUT"
115
- echo ""
116
-
117
- # ─── Assertions ───────────────────────────────────────────────────────────
118
- echo "--- Assertions ---"
119
- assert_contains "has reconcile_manifest marker" "$RECONCILE_OUTPUT" "--- reconcile_manifest ---"
120
- assert_contains "orchestration_branch correct" "$RECONCILE_OUTPUT" "orchestration_branch: orchestration-branch"
121
- assert_contains "unit_count is 2" "$RECONCILE_OUTPUT" "unit_count: 2"
122
- assert_contains "p01 merged first (order 1)" "$RECONCILE_OUTPUT" "order: 1"
123
- assert_contains "p02 merged second (order 2)" "$RECONCILE_OUTPUT" "order: 2"
124
- assert_contains "p01 result clean" "$RECONCILE_OUTPUT" "result: clean"
125
- assert_contains "merged count is 2" "$RECONCILE_OUTPUT" "merged: 2"
126
- assert_contains "conflicts is 0" "$RECONCILE_OUTPUT" "conflicts: 0"
127
- assert_contains "reverted is 0" "$RECONCILE_OUTPUT" "reverted: 0"
128
-
129
- # Verify files exist on orchestration branch after merge
130
- git checkout orchestration-branch 2>/dev/null
131
- if [[ -f src/models/user.ts && -f src/routes/user.ts ]]; then
132
- echo " PASS: both unit files present after reconciliation"
133
- PASS=$((PASS + 1))
134
- else
135
- echo " FAIL: missing files after reconciliation"
136
- FAIL=$((FAIL + 1))
137
- fi
138
-
139
- # Verify deterministic ordering (p01 before p02)
140
- MERGE_LOG=$(git log --oneline --all | head -20)
141
- if echo "$MERGE_LOG" | grep -q "merge(p01)"; then
142
- echo " PASS: p01 merge commit present"
143
- PASS=$((PASS + 1))
144
- else
145
- echo " FAIL: p01 merge commit not found"
146
- FAIL=$((FAIL + 1))
147
- fi
148
-
149
- if echo "$MERGE_LOG" | grep -q "merge(p02)"; then
150
- echo " PASS: p02 merge commit present"
151
- PASS=$((PASS + 1))
152
- else
153
- echo " FAIL: p02 merge commit not found"
154
- FAIL=$((FAIL + 1))
155
- fi
156
-
157
- # ─── Test 2: Failing Integration Rollback ─────────────────────────────
158
- echo ""
159
- echo "=== Test 2: Failing Integration Rollback ==="
160
- echo ""
161
-
162
- # Create a fresh temp repo for the rollback test
163
- TMPDIR2=$(mktemp -d)
164
- SHIMDIR2=$(mktemp -d)
165
- # Update trap to clean both
166
- trap 'rm -rf "$TMPDIR" "$TMPDIR2" "$SHIMDIR2"' EXIT
167
-
168
- cd "$TMPDIR2"
169
- git init -b orchestration-branch
170
- git config user.email "test@test.com"
171
- git config user.name "Test"
172
-
173
- # Initial commit
174
- echo '{ "name": "rollback-test" }' > package.json
175
- git add .
176
- git commit -m "initial commit"
177
-
178
- # Record the initial HEAD (should match post-rollback)
179
- INITIAL_SHA=$(git rev-parse HEAD)
180
-
181
- # Create a unit branch with a new file
182
- git checkout -b "project/p01"
183
- echo 'export const Broken = true;' > broken-feature.ts
184
- git add .
185
- git commit -m "feat(p01): add broken feature"
186
- git checkout orchestration-branch
187
-
188
- # Create pnpm shim OUTSIDE git repo that fails on 'test'
189
- mkdir -p "$SHIMDIR2/bin"
190
- cat > "$SHIMDIR2/bin/pnpm" <<'SHIM'
191
- #!/bin/bash
192
- case "$1" in
193
- test) exit 1 ;;
194
- *) exit 0 ;;
195
- esac
196
- SHIM
197
- chmod +x "$SHIMDIR2/bin/pnpm"
198
- export PATH="$SHIMDIR2/bin:$PATH"
199
-
200
- ROLLBACK_OUTPUT=$(bash "$SKILL_DIR/scripts/reconcile.sh" orchestration-branch "project/p01" 2>&1)
201
-
202
- echo "$ROLLBACK_OUTPUT"
203
- echo ""
204
- echo "--- Assertions ---"
205
-
206
- # The merge should be reverted
207
- assert_contains "result is reverted" "$ROLLBACK_OUTPUT" "result: reverted"
208
- assert_contains "integration verdict fail" "$ROLLBACK_OUTPUT" "verdict: fail"
209
- assert_contains "reverted count is 1" "$ROLLBACK_OUTPUT" "reverted: 1"
210
- assert_contains "merged count is 0" "$ROLLBACK_OUTPUT" "merged: 0"
211
-
212
- # The merged file should NOT exist after rollback
213
- if [[ ! -f "$TMPDIR2/broken-feature.ts" ]]; then
214
- echo " PASS: merged file absent after rollback"
215
- PASS=$((PASS + 1))
216
- else
217
- echo " FAIL: merged file still present after rollback"
218
- FAIL=$((FAIL + 1))
219
- fi
220
-
221
- # HEAD should match pre-merge state
222
- POST_ROLLBACK_SHA=$(git rev-parse HEAD)
223
- if [[ "$POST_ROLLBACK_SHA" == "$INITIAL_SHA" ]]; then
224
- echo " PASS: HEAD matches pre-merge SHA after rollback"
225
- PASS=$((PASS + 1))
226
- else
227
- echo " FAIL: HEAD ($POST_ROLLBACK_SHA) does not match pre-merge ($INITIAL_SHA)"
228
- FAIL=$((FAIL + 1))
229
- fi
230
-
231
- # Verify file content integrity: package.json should have original content
232
- ROLLBACK_PKG=$(cat "$TMPDIR2/package.json")
233
- if [[ "$ROLLBACK_PKG" == '{ "name": "rollback-test" }' ]]; then
234
- echo " PASS: package.json content restored after rollback"
235
- PASS=$((PASS + 1))
236
- else
237
- echo " FAIL: package.json content differs after rollback: $ROLLBACK_PKG"
238
- FAIL=$((FAIL + 1))
239
- fi
240
-
241
- # Restore PATH for subsequent tests
242
- export PATH="${PATH#$SHIMDIR2/bin:}"
243
-
244
- echo ""
245
- echo "=== Results ==="
246
- echo "Passed: $PASS"
247
- echo "Failed: $FAIL"
248
-
249
- if [[ $FAIL -gt 0 ]]; then
250
- echo "OVERALL: FAIL"
251
- exit 1
252
- else
253
- echo "OVERALL: PASS"
254
- fi
@@ -1,220 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Test: Autonomous review gate blocks failed units
3
- #
4
- # Validates that review-gate.sh correctly:
5
- # 1. Passes units with clean state
6
- # 2. Fails units with failing tests (spec compliance)
7
- # 3. Fails units with lint errors (code quality)
8
- # 4. Produces correct verdicts and fix-loop hints
9
- #
10
- # Usage: bash tests/test-review-gate.sh
11
-
12
- set -euo pipefail
13
-
14
- SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
15
- SKILL_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
16
- PASS=0
17
- FAIL=0
18
-
19
- assert_contains() {
20
- local label="$1" output="$2" expected="$3"
21
- if echo "$output" | grep -qF -- "$expected"; then
22
- echo " PASS: $label"
23
- PASS=$((PASS + 1))
24
- else
25
- echo " FAIL: $label — expected to contain: $expected"
26
- FAIL=$((FAIL + 1))
27
- fi
28
- }
29
-
30
- assert_not_contains() {
31
- local label="$1" output="$2" unexpected="$3"
32
- if echo "$output" | grep -qF -- "$unexpected"; then
33
- echo " FAIL: $label — should NOT contain: $unexpected"
34
- FAIL=$((FAIL + 1))
35
- else
36
- echo " PASS: $label"
37
- PASS=$((PASS + 1))
38
- fi
39
- }
40
-
41
- # ─── Setup Temporary Git Repo ──────────────────────────────────────────────
42
- TMPDIR=$(mktemp -d)
43
- SHIMDIR=$(mktemp -d)
44
- trap 'rm -rf "$TMPDIR" "$SHIMDIR"' EXIT
45
-
46
- cd "$TMPDIR"
47
- git init -b test-branch
48
- git config user.email "test@test.com"
49
- git config user.name "Test"
50
-
51
- echo '{ "name": "test" }' > package.json
52
- git add .
53
- git commit -m "initial"
54
-
55
- # ─── Test 1: Passing Unit (clean state) ───────────────────────────────────
56
- echo "=== Test 1: Passing Unit (all checks pass) ==="
57
- echo ""
58
-
59
- # Create pnpm shim OUTSIDE the git repo so git status stays clean
60
- mkdir -p "$SHIMDIR/bin"
61
- cat > "$SHIMDIR/bin/pnpm" <<'SHIM'
62
- #!/bin/bash
63
- exit 0
64
- SHIM
65
- chmod +x "$SHIMDIR/bin/pnpm"
66
- export PATH="$SHIMDIR/bin:$PATH"
67
-
68
- PASS_OUTPUT=$(bash "$SKILL_DIR/scripts/review-gate.sh" "test-branch" "$TMPDIR" --retry-limit 2 2>&1)
69
-
70
- echo "--- Output ---"
71
- echo "$PASS_OUTPUT" | head -20
72
- echo ""
73
- echo "--- Assertions ---"
74
- assert_contains "spec verdict pass" "$PASS_OUTPUT" "spec_verdict: pass"
75
- assert_contains "quality verdict pass" "$PASS_OUTPUT" "quality_verdict: pass"
76
- assert_contains "overall pass" "$PASS_OUTPUT" "overall: pass"
77
- assert_contains "eligible for merge" "$PASS_OUTPUT" "disposition: eligible_for_merge"
78
- assert_contains "finalize action" "$PASS_OUTPUT" "action: finalize"
79
-
80
- echo ""
81
-
82
- # ─── Test 2: Failing Tests (spec compliance failure) ──────────────────────
83
- echo "=== Test 2: Failing Tests (spec compliance failure) ==="
84
- echo ""
85
-
86
- # Override pnpm test to fail
87
- cat > "$SHIMDIR/bin/pnpm" <<'SHIM'
88
- #!/bin/bash
89
- case "$1" in
90
- test) exit 1 ;;
91
- *) exit 0 ;;
92
- esac
93
- SHIM
94
- chmod +x "$SHIMDIR/bin/pnpm"
95
-
96
- FAIL_TEST_OUTPUT=$(bash "$SKILL_DIR/scripts/review-gate.sh" "test-branch" "$TMPDIR" --retry-limit 2 2>&1)
97
-
98
- echo "--- Output ---"
99
- echo "$FAIL_TEST_OUTPUT" | head -20
100
- echo ""
101
- echo "--- Assertions ---"
102
- assert_contains "tests fail" "$FAIL_TEST_OUTPUT" "tests: fail"
103
- assert_contains "spec verdict fail" "$FAIL_TEST_OUTPUT" "spec_verdict: fail"
104
- assert_contains "overall fail" "$FAIL_TEST_OUTPUT" "overall: fail"
105
- assert_contains "needs fix or exclude" "$FAIL_TEST_OUTPUT" "disposition: needs_fix_or_exclude"
106
- assert_contains "retry action (under limit)" "$FAIL_TEST_OUTPUT" "action: retry"
107
- assert_contains "next retry count" "$FAIL_TEST_OUTPUT" "next_retry_count: 1"
108
- # Code quality stage should NOT run when spec fails
109
- assert_not_contains "quality stage skipped" "$FAIL_TEST_OUTPUT" "quality_verdict: pass"
110
-
111
- echo ""
112
-
113
- # ─── Test 3: Lint Failure (code quality failure) ──────────────────────────
114
- echo "=== Test 3: Lint Failure (code quality failure, spec passes) ==="
115
- echo ""
116
-
117
- # Override pnpm lint to fail, but test passes
118
- cat > "$SHIMDIR/bin/pnpm" <<'SHIM'
119
- #!/bin/bash
120
- case "$1" in
121
- lint) exit 1 ;;
122
- *) exit 0 ;;
123
- esac
124
- SHIM
125
- chmod +x "$SHIMDIR/bin/pnpm"
126
-
127
- FAIL_LINT_OUTPUT=$(bash "$SKILL_DIR/scripts/review-gate.sh" "test-branch" "$TMPDIR" --retry-limit 2 2>&1)
128
-
129
- echo "--- Output ---"
130
- echo "$FAIL_LINT_OUTPUT" | head -25
131
- echo ""
132
- echo "--- Assertions ---"
133
- assert_contains "spec verdict pass" "$FAIL_LINT_OUTPUT" "spec_verdict: pass"
134
- assert_contains "lint fail" "$FAIL_LINT_OUTPUT" "lint: fail"
135
- assert_contains "quality verdict fail" "$FAIL_LINT_OUTPUT" "quality_verdict: fail"
136
- assert_contains "overall fail" "$FAIL_LINT_OUTPUT" "overall: fail"
137
- assert_contains "retry action (under limit)" "$FAIL_LINT_OUTPUT" "action: retry"
138
-
139
- echo ""
140
-
141
- # ─── Test 4: Uncommitted Changes (git clean failure) ─────────────────────
142
- echo "=== Test 4: Uncommitted Changes (git clean failure) ==="
143
- echo ""
144
-
145
- # Restore passing pnpm but leave uncommitted file
146
- cat > "$SHIMDIR/bin/pnpm" <<'SHIM'
147
- #!/bin/bash
148
- exit 0
149
- SHIM
150
- chmod +x "$SHIMDIR/bin/pnpm"
151
-
152
- echo "dirty" > "$TMPDIR/uncommitted.txt"
153
-
154
- DIRTY_OUTPUT=$(bash "$SKILL_DIR/scripts/review-gate.sh" "test-branch" "$TMPDIR" --retry-limit 2 2>&1)
155
-
156
- echo "--- Output ---"
157
- echo "$DIRTY_OUTPUT" | head -20
158
- echo ""
159
- echo "--- Assertions ---"
160
- assert_contains "git clean fail" "$DIRTY_OUTPUT" "git_clean: fail"
161
- assert_contains "spec verdict fail" "$DIRTY_OUTPUT" "spec_verdict: fail"
162
- assert_contains "overall fail" "$DIRTY_OUTPUT" "overall: fail"
163
-
164
- # Clean up
165
- rm -f "$TMPDIR/uncommitted.txt"
166
-
167
- echo ""
168
-
169
- # ─── Test 5: Retry at limit (dispatch_fix terminal) ──────────────────
170
- echo "=== Test 5: Retry at limit (dispatch_fix terminal) ==="
171
- echo ""
172
-
173
- # Failing pnpm test, retry_count == retry_limit
174
- cat > "$SHIMDIR/bin/pnpm" <<'SHIM'
175
- #!/bin/bash
176
- case "$1" in
177
- test) exit 1 ;;
178
- *) exit 0 ;;
179
- esac
180
- SHIM
181
- chmod +x "$SHIMDIR/bin/pnpm"
182
-
183
- AT_LIMIT_OUTPUT=$(bash "$SKILL_DIR/scripts/review-gate.sh" "test-branch" "$TMPDIR" --retry-limit 2 --retry-count 2 2>&1)
184
-
185
- echo "--- Output ---"
186
- echo "$AT_LIMIT_OUTPUT" | head -25
187
- echo ""
188
- echo "--- Assertions ---"
189
- assert_contains "overall fail" "$AT_LIMIT_OUTPUT" "overall: fail"
190
- assert_contains "retry_count is 2" "$AT_LIMIT_OUTPUT" "retry_count: 2"
191
- assert_contains "dispatch_fix at limit" "$AT_LIMIT_OUTPUT" "action: dispatch_fix"
192
- assert_not_contains "no next_retry_count at limit" "$AT_LIMIT_OUTPUT" "next_retry_count:"
193
-
194
- echo ""
195
-
196
- # ─── Test 6: Retry under limit (retry with next count) ───────────────
197
- echo "=== Test 6: Retry under limit (retry with next count) ==="
198
- echo ""
199
-
200
- UNDER_LIMIT_OUTPUT=$(bash "$SKILL_DIR/scripts/review-gate.sh" "test-branch" "$TMPDIR" --retry-limit 2 --retry-count 1 2>&1)
201
-
202
- echo "--- Output ---"
203
- echo "$UNDER_LIMIT_OUTPUT" | head -25
204
- echo ""
205
- echo "--- Assertions ---"
206
- assert_contains "retry_count is 1" "$UNDER_LIMIT_OUTPUT" "retry_count: 1"
207
- assert_contains "action is retry" "$UNDER_LIMIT_OUTPUT" "action: retry"
208
- assert_contains "next_retry_count is 2" "$UNDER_LIMIT_OUTPUT" "next_retry_count: 2"
209
-
210
- echo ""
211
- echo "=== Results ==="
212
- echo "Passed: $PASS"
213
- echo "Failed: $FAIL"
214
-
215
- if [[ $FAIL -gt 0 ]]; then
216
- echo "OVERALL: FAIL"
217
- exit 1
218
- else
219
- echo "OVERALL: PASS"
220
- fi