specpipe 1.0.1 → 1.0.2

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 (46) hide show
  1. package/README.md +111 -311
  2. package/package.json +2 -1
  3. package/src/cli.js +16 -6
  4. package/src/commands/diff.js +1 -1
  5. package/src/commands/init-agents.js +40 -20
  6. package/src/commands/init-global.js +88 -33
  7. package/src/commands/init-interactive.js +71 -0
  8. package/src/commands/init.js +61 -22
  9. package/src/commands/remove.js +159 -49
  10. package/src/commands/upgrade.js +21 -56
  11. package/src/lib/agent-guards.js +34 -78
  12. package/src/lib/agent-install.js +38 -25
  13. package/src/lib/agents.js +53 -11
  14. package/src/lib/claude-global.js +50 -77
  15. package/src/lib/hooks.js +203 -0
  16. package/src/lib/installer.js +73 -61
  17. package/src/lib/reconcile.js +13 -8
  18. package/templates/{.claude/hooks → hooks}/file-guard.js +26 -21
  19. package/templates/hooks/specpipe-read-guard.sh +94 -21
  20. package/templates/hooks/specpipe-shell-guard.sh +121 -29
  21. package/templates/rules/specpipe-rules.md +77 -0
  22. package/templates/skills/sp-build/SKILL.md +101 -1
  23. package/templates/skills/sp-build-behavior-matrix/SKILL.md +876 -0
  24. package/templates/skills/sp-challenge/SKILL.md +34 -0
  25. package/templates/skills/sp-challenge-behavior-matrix/SKILL.md +289 -0
  26. package/templates/skills/sp-explore/SKILL.md +132 -0
  27. package/templates/skills/sp-explore-behavior-matrix/SKILL.md +862 -0
  28. package/templates/skills/sp-fix/SKILL.md +73 -1
  29. package/templates/skills/sp-fix-behavior-matrix/SKILL.md +338 -0
  30. package/templates/skills/sp-investigate/SKILL.md +70 -0
  31. package/templates/skills/sp-investigate-behavior-matrix/SKILL.md +718 -0
  32. package/templates/skills/sp-plan/SKILL.md +90 -0
  33. package/templates/skills/sp-plan-behavior-matrix/SKILL.md +1037 -0
  34. package/templates/skills/sp-review/SKILL.md +29 -3
  35. package/templates/skills/sp-review-behavior-matrix/SKILL.md +294 -0
  36. package/templates/.claude/CLAUDE.md +0 -79
  37. package/templates/.claude/hooks/path-guard.sh +0 -118
  38. package/templates/.claude/hooks/self-review.sh +0 -27
  39. package/templates/.claude/hooks/sensitive-guard.sh +0 -227
  40. package/templates/.claude/settings.json +0 -68
  41. package/templates/docs/WORKFLOW.md +0 -325
  42. package/templates/docs/specs/.gitkeep +0 -0
  43. package/templates/rules/specpipe-guards.md +0 -40
  44. package/templates/scripts/test-hooks.sh +0 -66
  45. /package/templates/{.claude/hooks → hooks}/comment-guard.js +0 -0
  46. /package/templates/{.claude/hooks → hooks}/glob-guard.js +0 -0
@@ -1,66 +0,0 @@
1
- #!/usr/bin/env bash
2
- # test-hooks.sh — Hook unit tests
3
- # Usage: bash scripts/test-hooks.sh [--filter PATTERN]
4
- # Exit: 0 = all pass, 1 = failures
5
-
6
- set -uo pipefail
7
-
8
- FILTER=""
9
- while [[ $# -gt 0 ]]; do
10
- case "$1" in
11
- --filter) FILTER="${2:-}"; shift 2 ;;
12
- *) FILTER="$1"; shift ;;
13
- esac
14
- done
15
-
16
- HOOKS_DIR="$(cd "$(dirname "$0")/../.claude/hooks" && pwd)"
17
- PASS=0; FAIL=0
18
-
19
- # Encode a string as a JSON string literal using node
20
- json_str() { node -e "process.stdout.write(JSON.stringify(process.argv[1]))" -- "$1"; }
21
-
22
- bash_payload() { printf '{"tool_name":"Bash","tool_input":{"command":%s}}' "$(json_str "$1")"; }
23
-
24
- run() {
25
- local name="$1" hook="$2" payload="$3" expected_exit="$4"
26
- if [[ -n "$FILTER" && "$name" != *"$FILTER"* ]]; then return 0; fi
27
- local actual_exit=0
28
- printf '%s' "$payload" | bash "$HOOKS_DIR/$hook" >/dev/null 2>&1 || actual_exit=$?
29
- if [[ "$actual_exit" == "$expected_exit" ]]; then
30
- echo "[PASS] $name"
31
- PASS=$((PASS + 1))
32
- else
33
- echo "[FAIL] $name (expected exit $expected_exit, got $actual_exit)"
34
- FAIL=$((FAIL + 1))
35
- fi
36
- }
37
-
38
- # ── path-guard.sh ──────────────────────────────────────────────────────────────
39
-
40
- # Should BLOCK: reading/listing blocked dirs
41
- run "pg: ls dist/" path-guard.sh "$(bash_payload 'ls dist/')" 2
42
- run "pg: cat dist/file" path-guard.sh "$(bash_payload 'cat dist/bundle.js')" 2
43
- run "pg: find dist" path-guard.sh "$(bash_payload 'find dist/ -name "*.js"')" 2
44
- run "pg: head dist file" path-guard.sh "$(bash_payload 'head -20 dist/server.js')" 2
45
- run "pg: ls node_modules" path-guard.sh "$(bash_payload 'ls node_modules/')" 2
46
- run "pg: cat node_modules" path-guard.sh "$(bash_payload 'cat node_modules/lodash/index.js')" 2
47
- run "pg: ls build/" path-guard.sh "$(bash_payload 'ls build/')" 2
48
- run "pg: wc dist file" path-guard.sh "$(bash_payload 'wc -l dist/bundle.js')" 2
49
-
50
- # Should ALLOW: existence/permission checks and variable assignments (no file content read)
51
- # Regression: dist/ path as intermediate component in binary check — path-guard.sh:55 blocked this
52
- run "pg: allow -x binary check" \
53
- path-guard.sh \
54
- "$(bash_payload 'B=~/.claude/skills/gstack/browse/dist/browse
55
- if [ -x "$B" ]; then echo "READY: $B"; else echo "NEEDS_SETUP"; fi')" \
56
- 0
57
- run "pg: allow -f check" path-guard.sh "$(bash_payload '[ -f /usr/local/dist/bin/tool ] && echo ok')" 0
58
- run "pg: allow path assign" path-guard.sh "$(bash_payload 'TOOL=~/.claude/dist/mytool; "$TOOL" --version')" 0
59
- run "pg: allow git command" path-guard.sh "$(bash_payload 'git rev-parse --show-toplevel')" 0
60
- run "pg: allow empty" path-guard.sh '{}' 0
61
-
62
- # ── End ───────────────────────────────────────────────────────────────────────
63
-
64
- echo ""
65
- echo "Results: $PASS passed, $FAIL failed"
66
- [[ "$FAIL" -eq 0 ]]