codebyplan 1.13.62 → 1.13.64

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 (47) hide show
  1. package/dist/cli.js +1108 -2061
  2. package/package.json +1 -1
  3. package/templates/agents/cbp-e2e-playwright.md +10 -10
  4. package/templates/hooks/cbp-mcp-round-sync.sh +4 -15
  5. package/templates/hooks/cbp-skill-context-guard.sh +33 -13
  6. package/templates/hooks/cbp-test-hooks.sh +85 -0
  7. package/templates/hooks/hooks.json +0 -9
  8. package/templates/rules/architecture-map.md +6 -0
  9. package/templates/rules/cbp-operating-gotchas.md +13 -1
  10. package/templates/rules/e2e-mandatory.md +5 -0
  11. package/templates/rules/model-invocation-convention.md +1 -1
  12. package/templates/rules/scope-vocabulary.md +5 -0
  13. package/templates/rules/supabase-branch-lifecycle.md +2 -2
  14. package/templates/rules/task-routing-recommendation.md +1 -1
  15. package/templates/rules/todo-backend.md +11 -8
  16. package/templates/settings.project.base.json +9 -12
  17. package/templates/skills/cbp-build-cc-agent/SKILL.md +3 -0
  18. package/templates/skills/cbp-build-cc-agent/reference/frontmatter-fields.md +31 -0
  19. package/templates/skills/cbp-build-cc-agent/reference/permission-modes.md +6 -0
  20. package/templates/skills/cbp-build-cc-agent/templates/agent.md +1 -0
  21. package/templates/skills/cbp-build-cc-settings/reference/cbp-permission-policy.md +11 -4
  22. package/templates/skills/cbp-build-cc-skill/SKILL.md +1 -0
  23. package/templates/skills/cbp-build-cc-skill/reference/frontmatter-fields.md +14 -0
  24. package/templates/skills/cbp-build-cc-skill/templates/skill.md +1 -0
  25. package/templates/skills/cbp-checkpoint-create/SKILL.md +12 -22
  26. package/templates/skills/cbp-checkpoint-end/SKILL.md +37 -0
  27. package/templates/skills/cbp-checkpoint-plan/SKILL.md +10 -8
  28. package/templates/skills/cbp-checkpoint-start/SKILL.md +27 -19
  29. package/templates/skills/cbp-checkpoint-update/SKILL.md +1 -1
  30. package/templates/skills/cbp-clear-prep/SKILL.md +1 -1
  31. package/templates/skills/cbp-finalize/SKILL.md +2 -2
  32. package/templates/skills/cbp-finalize/reference/checkpoint-done-branching.md +1 -1
  33. package/templates/skills/cbp-finalize/reference/next-step-heuristic.md +1 -1
  34. package/templates/skills/cbp-round-complete/SKILL.md +3 -24
  35. package/templates/skills/cbp-round-plan/SKILL.md +1 -1
  36. package/templates/skills/cbp-session-end/SKILL.md +40 -30
  37. package/templates/skills/cbp-session-start/SKILL.md +7 -7
  38. package/templates/skills/cbp-session-start/qa-regression.md +32 -25
  39. package/templates/skills/cbp-standalone-task-complete/SKILL.md +2 -5
  40. package/templates/skills/cbp-standalone-task-create/SKILL.md +5 -13
  41. package/templates/skills/cbp-standalone-task-start/SKILL.md +10 -10
  42. package/templates/skills/cbp-task-create/SKILL.md +1 -1
  43. package/templates/skills/cbp-task-start/SKILL.md +10 -10
  44. package/templates/skills/cbp-todo/SKILL.md +23 -38
  45. package/templates/skills/cbp-todo/qa-regression.md +21 -27
  46. package/templates/skills/cbp-verify/reference/round-scope.md +1 -2
  47. package/templates/hooks/cbp-mcp-caller-worktree-inject.sh +0 -78
@@ -1,78 +0,0 @@
1
- #!/bin/bash
2
- # @hook: PreToolUse mcp__codebyplan__(update_checkpoint|complete_checkpoint|update_task|complete_task|add_round|update_round|complete_round|create_standalone_task|update_standalone_task|complete_standalone_task|add_standalone_round|update_standalone_round|complete_standalone_round|update_standalone_file_change)
3
- # Hook: PreToolUse for MCP write tools
4
- #
5
- # Purpose: Inject caller_worktree_id into MCP mutation tool inputs when the
6
- # field is absent. Reads the worktree.local.json branch-keyed cache
7
- # first (fast path); falls back to `codebyplan resolve-worktree --cache`.
8
- #
9
- # Fail-open: ALL exit paths exit 0. A hook failure must never block a tool call.
10
- # Use explicit guards rather than set -euo pipefail (which would exit
11
- # non-zero on the first failing command before the final exit 0).
12
-
13
- # C0 — require jq; if absent, emit nothing and exit 0 (fail-open).
14
- if ! command -v jq > /dev/null 2>&1; then
15
- exit 0
16
- fi
17
-
18
- # Read stdin once into a variable.
19
- INPUT=$(cat)
20
-
21
- # C6 — if caller_worktree_id is already a non-empty string, do not overwrite.
22
- # (jq '// empty' already maps JSON null to an empty string, so a plain -n test suffices.)
23
- EXISTING=$(echo "$INPUT" | jq -r '.tool_input.caller_worktree_id // empty' 2>/dev/null)
24
- if [ -n "$EXISTING" ]; then
25
- # Already populated — plain allow (exit 0 with no output).
26
- exit 0
27
- fi
28
-
29
- # C5 — resolve worktree id, fast path first.
30
- RESOLVED_WT=""
31
-
32
- # Determine repo root: prefer $CLAUDE_PROJECT_DIR, fall back to PWD.
33
- REPO_ROOT="${CLAUDE_PROJECT_DIR:-$PWD}"
34
- CACHE_FILE="$REPO_ROOT/.codebyplan/worktree.local.json"
35
-
36
- if [ -f "$CACHE_FILE" ]; then
37
- CACHED_WT=$(jq -r '.worktree_id // empty' "$CACHE_FILE" 2>/dev/null)
38
- CACHED_BRANCH=$(jq -r '.branch // empty' "$CACHE_FILE" 2>/dev/null)
39
-
40
- if [ -n "$CACHED_WT" ] && [ "$CACHED_WT" != "null" ] && \
41
- [ -n "$CACHED_BRANCH" ] && [ "$CACHED_BRANCH" != "null" ]; then
42
- # Validate branch matches current git branch.
43
- CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
44
- if [ -n "$CURRENT_BRANCH" ] && [ "$CURRENT_BRANCH" = "$CACHED_BRANCH" ]; then
45
- RESOLVED_WT="$CACHED_WT"
46
- fi
47
- fi
48
- fi
49
-
50
- # Fallback to CLI resolution if cache miss or branch mismatch.
51
- if [ -z "$RESOLVED_WT" ]; then
52
- RESOLVED_WT=$(codebyplan resolve-worktree --cache 2>/dev/null \
53
- || npx --no-install codebyplan resolve-worktree --cache 2>/dev/null \
54
- || true)
55
- fi
56
-
57
- # UUID guard — accept only a canonical UUID (8-4-4-4-12 hex).
58
- UUID_PATTERN='^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$'
59
- if [ -z "$RESOLVED_WT" ] || ! echo "$RESOLVED_WT" | grep -qE "$UUID_PATTERN"; then
60
- # Unresolved or invalid — plain allow, no updatedInput.
61
- exit 0
62
- fi
63
-
64
- # C3 — emit updatedInput as the FULL tool_input with caller_worktree_id added.
65
- # Claude Code's PreToolUse updatedInput REPLACES tool_input wholesale (it is not a
66
- # partial merge), so we must echo back every existing field merged with the new
67
- # caller_worktree_id — otherwise the tool loses round_id/duration_minutes/etc.
68
- echo "$INPUT" | jq \
69
- --arg wt "$RESOLVED_WT" \
70
- '{
71
- hookSpecificOutput: {
72
- hookEventName: "PreToolUse",
73
- permissionDecision: "allow",
74
- updatedInput: (.tool_input + { caller_worktree_id: $wt })
75
- }
76
- }'
77
-
78
- exit 0