codebyplan 1.13.46 → 1.13.49

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 (134) hide show
  1. package/dist/cli.js +33 -13
  2. package/package.json +1 -1
  3. package/templates/agents/cbp-cc-executor.md +0 -1
  4. package/templates/agents/cbp-database-agent.md +0 -1
  5. package/templates/agents/cbp-e2e-maestro.md +0 -1
  6. package/templates/agents/cbp-e2e-playwright.md +0 -1
  7. package/templates/agents/cbp-e2e-tauri.md +0 -1
  8. package/templates/agents/cbp-e2e-vscode.md +0 -1
  9. package/templates/agents/cbp-e2e-xcuitest.md +0 -1
  10. package/templates/agents/cbp-improve-claude.md +0 -1
  11. package/templates/agents/cbp-improve-round.md +0 -1
  12. package/templates/agents/cbp-map-architecture.md +0 -1
  13. package/templates/agents/cbp-mechanical-edits.md +0 -1
  14. package/templates/agents/cbp-research.md +0 -1
  15. package/templates/agents/cbp-round-executor.md +7 -1
  16. package/templates/agents/cbp-security-agent.md +0 -1
  17. package/templates/agents/cbp-stripe-agent.md +173 -0
  18. package/templates/agents/cbp-task-check.md +0 -1
  19. package/templates/agents/cbp-task-planner.md +0 -1
  20. package/templates/agents/cbp-testing-qa-agent.md +0 -1
  21. package/templates/hooks/cbp-auto-test-hooks.sh +0 -1
  22. package/templates/hooks/cbp-canonical-templates-nudge.sh +0 -1
  23. package/templates/hooks/cbp-context-window-notify.sh +0 -1
  24. package/templates/hooks/cbp-e2e-spec-patterns.sh +0 -1
  25. package/templates/hooks/cbp-lint-format-on-edit.sh +0 -1
  26. package/templates/hooks/cbp-maestro-yaml-validate.sh +0 -1
  27. package/templates/hooks/cbp-mcp-caller-worktree-inject.sh +0 -1
  28. package/templates/hooks/cbp-mcp-migration-guard.sh +0 -1
  29. package/templates/hooks/cbp-mcp-round-sync.sh +0 -1
  30. package/templates/hooks/cbp-plugin-dispatch.sh +0 -1
  31. package/templates/hooks/cbp-pre-commit-quality-gate.sh +0 -1
  32. package/templates/hooks/cbp-session-start-hook.sh +0 -1
  33. package/templates/hooks/cbp-statusline.mjs +0 -1
  34. package/templates/hooks/cbp-statusline.py +0 -1
  35. package/templates/hooks/cbp-statusline.sh +0 -1
  36. package/templates/hooks/cbp-subagent-statusline.mjs +0 -1
  37. package/templates/hooks/cbp-subagent-statusline.py +0 -1
  38. package/templates/hooks/cbp-subagent-statusline.sh +0 -1
  39. package/templates/hooks/cbp-test-coverage-gate.sh +0 -1
  40. package/templates/hooks/cbp-test-hooks.sh +0 -1
  41. package/templates/hooks/validate-context-usage.sh +0 -1
  42. package/templates/hooks/validate-git-commit.sh +57 -9
  43. package/templates/hooks/validate-git-stash-deny.sh +0 -1
  44. package/templates/hooks/validate-structure-lengths.sh +0 -1
  45. package/templates/hooks/validate-structure-lib.sh +17 -1
  46. package/templates/hooks/validate-structure-patterns.sh +0 -1
  47. package/templates/hooks/validate-structure-scope.sh +43 -11
  48. package/templates/hooks/validate-structure-smoke.sh +0 -1
  49. package/templates/hooks/validate-structure-templates.sh +0 -1
  50. package/templates/hooks/validate-structure.sh +0 -1
  51. package/templates/hooks/verify-parity.sh +0 -1
  52. package/templates/rules/agent-claim-verification.md +0 -1
  53. package/templates/rules/architecture-map.md +0 -4
  54. package/templates/rules/cbp-operating-gotchas.md +0 -4
  55. package/templates/rules/context-file-loading.md +0 -1
  56. package/templates/rules/e2e-mandatory.md +0 -4
  57. package/templates/rules/parallel-waves.md +0 -1
  58. package/templates/rules/scope-vocabulary.md +14 -10
  59. package/templates/rules/supabase-branch-lifecycle.md +0 -1
  60. package/templates/rules/todo-backend.md +0 -1
  61. package/templates/settings.project.base.json +13 -0
  62. package/templates/skills/cbp-build-cc-agent/SKILL.md +2 -3
  63. package/templates/skills/cbp-build-cc-agent/reference/cbp-quality.md +6 -8
  64. package/templates/skills/cbp-build-cc-agent/scripts/validate-agent.sh +10 -1
  65. package/templates/skills/cbp-build-cc-claude-file/SKILL.md +0 -1
  66. package/templates/skills/cbp-build-cc-claude-file/scripts/validate-claude-file.sh +0 -1
  67. package/templates/skills/cbp-build-cc-mode/SKILL.md +0 -1
  68. package/templates/skills/cbp-build-cc-rule/SKILL.md +18 -8
  69. package/templates/skills/cbp-build-cc-rule/scripts/validate-rule.sh +4 -5
  70. package/templates/skills/cbp-build-cc-settings/SKILL.md +0 -1
  71. package/templates/skills/cbp-build-cc-settings/reference/cbp-conventions.md +0 -4
  72. package/templates/skills/cbp-build-cc-settings/scripts/validate-settings.sh +0 -1
  73. package/templates/skills/cbp-build-cc-skill/SKILL.md +0 -1
  74. package/templates/skills/cbp-build-cc-skill/reference/cbp-quality.md +6 -8
  75. package/templates/skills/cbp-build-cc-skill/scripts/validate-skill.sh +10 -2
  76. package/templates/skills/cbp-checkpoint-check/SKILL.md +0 -1
  77. package/templates/skills/cbp-checkpoint-complete/SKILL.md +0 -1
  78. package/templates/skills/cbp-checkpoint-create/SKILL.md +10 -11
  79. package/templates/skills/cbp-checkpoint-end/SKILL.md +0 -1
  80. package/templates/skills/cbp-checkpoint-plan/SKILL.md +0 -1
  81. package/templates/skills/cbp-checkpoint-plan/reference/alternative-comparison-template.md +0 -4
  82. package/templates/skills/cbp-checkpoint-plan/reference/dep-decision-rubric.md +0 -4
  83. package/templates/skills/cbp-checkpoint-plan/reference/e2e-discovery-probe.md +0 -4
  84. package/templates/skills/cbp-checkpoint-plan/reference/gap-analysis-playbook.md +0 -4
  85. package/templates/skills/cbp-checkpoint-start/SKILL.md +0 -1
  86. package/templates/skills/cbp-checkpoint-update/SKILL.md +0 -1
  87. package/templates/skills/cbp-frontend-a11y/SKILL.md +0 -1
  88. package/templates/skills/cbp-frontend-design/SKILL.md +0 -1
  89. package/templates/skills/cbp-frontend-ui/SKILL.md +0 -1
  90. package/templates/skills/cbp-frontend-ux/SKILL.md +0 -1
  91. package/templates/skills/cbp-git-branch-feat-create/SKILL.md +0 -1
  92. package/templates/skills/cbp-git-commit/SKILL.md +0 -1
  93. package/templates/skills/cbp-git-worktree-create/SKILL.md +0 -1
  94. package/templates/skills/cbp-git-worktree-remove/SKILL.md +0 -1
  95. package/templates/skills/cbp-map-architecture/SKILL.md +0 -1
  96. package/templates/skills/cbp-merge-main/SKILL.md +0 -1
  97. package/templates/skills/cbp-refresh-arch-map/SKILL.md +0 -1
  98. package/templates/skills/cbp-round-check/SKILL.md +0 -1
  99. package/templates/skills/cbp-round-complete/SKILL.md +0 -1
  100. package/templates/skills/cbp-round-end/SKILL.md +0 -1
  101. package/templates/skills/cbp-round-execute/SKILL.md +9 -2
  102. package/templates/skills/cbp-round-execute/reference/inline-fallback.md +0 -4
  103. package/templates/skills/cbp-round-input/SKILL.md +0 -1
  104. package/templates/skills/cbp-round-start/SKILL.md +0 -1
  105. package/templates/skills/cbp-round-update/SKILL.md +0 -1
  106. package/templates/skills/cbp-session-end/SKILL.md +0 -1
  107. package/templates/skills/cbp-session-start/SKILL.md +0 -1
  108. package/templates/skills/cbp-session-start/qa-regression.md +0 -1
  109. package/templates/skills/cbp-setup-e2e/SKILL.md +0 -1
  110. package/templates/skills/cbp-setup-eslint/SKILL.md +0 -1
  111. package/templates/skills/cbp-ship/SKILL.md +0 -1
  112. package/templates/skills/cbp-ship-configure/SKILL.md +0 -1
  113. package/templates/skills/cbp-ship-main/SKILL.md +0 -1
  114. package/templates/skills/cbp-stripe/SKILL.md +116 -0
  115. package/templates/skills/cbp-stripe/reference/billing.md +106 -0
  116. package/templates/skills/cbp-stripe/reference/connect.md +105 -0
  117. package/templates/skills/cbp-stripe/reference/payments.md +107 -0
  118. package/templates/skills/cbp-stripe/reference/security.md +117 -0
  119. package/templates/skills/cbp-stripe/reference/stripe-mcp-setup.md +59 -0
  120. package/templates/skills/cbp-stripe/reference/tax.md +96 -0
  121. package/templates/skills/cbp-stripe/reference/treasury.md +87 -0
  122. package/templates/skills/cbp-supabase-branch-check/SKILL.md +0 -1
  123. package/templates/skills/cbp-supabase-branch-check/reference/dag-steps.md +0 -4
  124. package/templates/skills/cbp-supabase-migrate/SKILL.md +0 -1
  125. package/templates/skills/cbp-supabase-setup/SKILL.md +0 -1
  126. package/templates/skills/cbp-task-check/SKILL.md +0 -1
  127. package/templates/skills/cbp-task-complete/SKILL.md +0 -1
  128. package/templates/skills/cbp-task-create/SKILL.md +0 -1
  129. package/templates/skills/cbp-task-start/SKILL.md +0 -1
  130. package/templates/skills/cbp-task-testing/SKILL.md +0 -1
  131. package/templates/skills/cbp-todo/SKILL.md +0 -1
  132. package/templates/skills/cbp-todo/qa-regression.md +0 -1
  133. package/templates/skills/supabase/SKILL.md +0 -1
  134. package/templates/skills/supabase-postgres-best-practices/SKILL.md +0 -1
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # @hook: PreToolUse Bash
4
3
  # Hook: PreToolUse for Bash (git commit commands)
5
4
  # Purpose: Prevent Claude attribution in git commits
@@ -33,21 +32,70 @@ block() {
33
32
  exit 2
34
33
  }
35
34
 
36
- # Check for Claude attribution patterns
37
- # Case-insensitive check for various patterns
35
+ # ---------------------------------------------------------------------------
36
+ # Isolate the commit MESSAGE from the rest of the command.
37
+ #
38
+ # The broad "claude/anthropic" word-check below targets attribution that may
39
+ # land in the commit *message* — NOT benign mentions elsewhere in the command
40
+ # (narration echoes, a `.claude/CLAUDE.md` path argument, a piped subcommand).
41
+ # Scanning the whole command false-positives on those (e.g. an `echo` that
42
+ # says the word "claude", or `git commit .claude/CLAUDE.md -m "..."`). So we
43
+ # extract just the message text:
44
+ # (a) heredoc bodies — the `-m "$(cat <<'EOF' ... EOF)"` pattern
45
+ # (b) -m/--message args — quoted "..." or '...'
46
+ # If no message can be isolated (editor commit, `-F file`), fall back to the
47
+ # whole command so attribution protection is never silently dropped.
48
+ #
49
+ # The specific checks further down (generated-with / co-authored-by / emoji /
50
+ # --author) still scan the WHOLE command — those patterns are precise enough
51
+ # that catching them anywhere is correct, and they backstop this extraction.
52
+ # ---------------------------------------------------------------------------
53
+ extract_commit_message() {
54
+ local cmd="$1"
55
+ local out="" delim margs
38
56
 
39
- # Check for "Claude" mentions (but allow CLAUDE.md files and .claude/ folder paths)
40
- # First, remove CLAUDE.md filenames and .claude(/path|word-end) BSD-compatible word-boundary via [[:>:]]
41
- # Word-boundary allows ".claude folder" / ".claude rules" / ".claude/" all as legit folder references
42
- COMMAND_WITHOUT_FILES=$(echo "$COMMAND" \
57
+ # (a) Heredoc body. Detect the delimiter (supports <<EOF, <<'EOF', <<-EOF),
58
+ # then print the lines strictly between the opener and its closing line.
59
+ # Each pipeline ends in sed/awk (exit 0) so a no-match grep cannot trip
60
+ # `set -e` via the command substitution.
61
+ delim=$(printf '%s\n' "$cmd" \
62
+ | grep -oE "<<-?[[:space:]]*'?[A-Za-z_][A-Za-z0-9_]*'?" \
63
+ | head -n1 \
64
+ | sed -E "s/^<<-?[[:space:]]*//; s/'//g")
65
+ if [ -n "$delim" ]; then
66
+ out=$(printf '%s\n' "$cmd" | awk -v d="$delim" '
67
+ start==0 { if (index($0, "<<") && index($0, d)) { start=1 } ; next }
68
+ start==1 { s=$0; sub(/^[ \t]+/,"",s); sub(/[ \t]+$/,"",s); if (s==d) {start=2; next} print }
69
+ ')
70
+ fi
71
+
72
+ # (b) Quoted -m / --message argument values.
73
+ margs=$(printf '%s\n' "$cmd" \
74
+ | grep -oE -- "(-m|--message)[[:space:]]+(\"[^\"]*\"|'[^']*')" \
75
+ | sed -E "s/^(-m|--message)[[:space:]]+//; s/^[\"']//; s/[\"']$//")
76
+
77
+ printf '%s\n%s\n' "$out" "$margs"
78
+ }
79
+
80
+ MESSAGE=$(extract_commit_message "$COMMAND")
81
+ # Fall back to scanning the whole command when no message could be isolated.
82
+ if [ -z "$(printf '%s' "$MESSAGE" | tr -d '[:space:]')" ]; then
83
+ MESSAGE="$COMMAND"
84
+ fi
85
+
86
+ # Check for Claude attribution in the MESSAGE (case-insensitive).
87
+ # Allow legitimate CLAUDE.md filenames and .claude/ folder paths that may
88
+ # legitimately appear inside a commit message (e.g. a commit *about* them).
89
+ # BSD-compatible word-boundary via [[:>:]].
90
+ MESSAGE_WITHOUT_FILES=$(echo "$MESSAGE" \
43
91
  | sed -E 's/CLAUDE(\.[a-z]+)?\.md//gi' \
44
92
  | sed -E 's/\.claude(\/[a-zA-Z0-9_./-]*|[[:>:]])//gi' \
45
93
  | sed -E 's/\$\{CLAUDE[A-Z_]*\}//g' \
46
94
  | sed -E 's/claude-plugin[a-zA-Z0-9_./-]*//gi' \
47
95
  | sed -E 's/codebyplan-claude[a-zA-Z0-9_./-]*//gi' \
48
96
  | sed -E 's/@codebyplan\/claude[a-zA-Z0-9_./-]*//gi')
49
- if echo "$COMMAND_WITHOUT_FILES" | grep -qiE 'claude|anthropic'; then
50
- block "BLOCKED: Git commit contains Claude/Anthropic attribution. Remove any mention of Claude from the commit message. Author should only be: midevyou <midevyosauhing@gmail.com>"
97
+ if echo "$MESSAGE_WITHOUT_FILES" | grep -qiE 'claude|anthropic'; then
98
+ block "BLOCKED: Git commit message contains Claude/Anthropic attribution. Remove any mention of Claude from the commit message. Author should only be: midevyou <midevyosauhing@gmail.com>"
51
99
  fi
52
100
 
53
101
  # Check for "Generated with" patterns
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Hook: PreToolUse Bash
4
3
  # Purpose: Deny any `git stash` command. Git stash is banned per the
5
4
  # feedback_no-git-stash auto-memory entry. Alternatives:
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Hook Helper: File-length enforcement for validate-structure.sh
4
3
  # Two-tier policy: warn at recommended → stderr notice; block at hard cap (~2× warn) → exit 2
5
4
  # Sourced by validate-structure.sh — not run directly.
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Hook Helper Library: Shared primitives for validate-structure-*.sh
4
3
  # Purpose: Block/warn formatters, path-matching, content extraction,
5
4
  # frontmatter / scope-marker detection, line counting.
@@ -102,3 +101,20 @@ has_yaml_field() {
102
101
  has_scope_comment() {
103
102
  [ -f "$1" ] && head -5 "$1" 2>/dev/null | grep -q "^# @scope:"
104
103
  }
104
+
105
+ # has_template_twin <rel_path_under_claude>
106
+ # Returns 0 when the codebyplan package ships a template twin for this .claude file
107
+ # (i.e. the file is package-MANAGED — org-shared is its implicit default and a
108
+ # scope marker is NOT required). <rel_path_under_claude> is the path beneath
109
+ # .claude/ (e.g. "rules/foo.md", "skills/x/SKILL.md").
110
+ # Monorepo: $REPO_ROOT/packages/codebyplan-package/templates/<rel>
111
+ # Consumer: $REPO_ROOT/node_modules/codebyplan/templates/<rel>
112
+ # Returns non-zero when no twin is found — including when no templates dir is
113
+ # resolvable at all. Callers treat a non-zero result as "user-created", which is
114
+ # the conservative fallback: a scope marker is then required (legacy behavior).
115
+ has_template_twin() {
116
+ local rel="$1"
117
+ [ -f "$REPO_ROOT/packages/codebyplan-package/templates/$rel" ] && return 0
118
+ [ -f "$REPO_ROOT/node_modules/codebyplan/templates/$rel" ] && return 0
119
+ return 1
120
+ }
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Hook Helper: Pattern validation for validate-structure.sh
4
3
  # Purpose: Validate file paths against structure patterns
5
4
  # Sourced by validate-structure.sh - not run directly
@@ -1,31 +1,63 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Hook Helper: Scope marker validation for validate-structure.sh
4
- # Purpose: Ensure all .claude/ files have a scope marker for structural classification
3
+ # Purpose: Enforce scope markers on USER-CREATED .claude/ files only. Files the
4
+ # codebyplan package distributes (a template twin exists) are MANAGED:
5
+ # org-shared is the implicit default, so no marker is required and an
6
+ # explicit 'org-shared' marker is redundant (warned, non-blocking).
7
+ # A file with no template twin is user-created and must declare a marker.
5
8
  # Sourced by validate-structure.sh - not run directly
6
9
  #
7
- # Expects: $REL_PATH, $FILE_PATH, $EXT, warn(), match_path(),
8
- # has_yaml_frontmatter(), has_yaml_field(), has_scope_comment() (from validate-structure-lib.sh)
10
+ # Expects: $REL_PATH, $FILE_PATH, $EXT, $REPO_ROOT, warn(), match_path(),
11
+ # has_yaml_frontmatter(), has_yaml_field(), has_scope_comment(),
12
+ # has_template_twin() (from validate-structure-lib.sh)
9
13
 
10
14
  # Only check .claude/ files
11
15
  if ! match_path '^/\.claude/'; then
12
16
  return 0 2>/dev/null || true
13
17
  fi
14
18
 
19
+ # Path beneath .claude/ — used for template-twin (managed) detection.
20
+ _scope_rel="${REL_PATH#/.claude/}"
21
+
22
+ # Managed = the codebyplan package ships a template twin for this file. When no
23
+ # twin is found (or no templates dir is resolvable) the file is user-created and
24
+ # a marker is required — the conservative fallback that preserves legacy behavior.
25
+ if has_template_twin "$_scope_rel"; then
26
+ _scope_managed=1
27
+ else
28
+ _scope_managed=0
29
+ fi
30
+
31
+ _valid_scope_re='^(org-shared|project-shared|repo-only:[a-z0-9]([a-z0-9-]*[a-z0-9])?)$'
32
+
15
33
  case "$EXT" in
16
34
  md)
17
- if has_yaml_frontmatter "$FILE_PATH"; then
18
- if ! has_yaml_field "$FILE_PATH" scope; then
19
- warn "Missing scope: in frontmatter. Add 'scope: org-shared' / 'scope: project-shared' / 'scope: repo-only:<name>' for structural classification. See rules/scope-vocabulary.md."
35
+ if has_yaml_frontmatter "$FILE_PATH" && has_yaml_field "$FILE_PATH" scope 50; then
36
+ _scope_val=$(head -50 "$FILE_PATH" 2>/dev/null | grep -E '^scope:' | head -1 \
37
+ | sed -E 's/^scope:[[:space:]]*//; s/[[:space:]]*#.*$//; s/[[:space:]]*$//')
38
+ if [ "$_scope_managed" = "1" ] && [ "$_scope_val" = "org-shared" ]; then
39
+ warn "Redundant 'scope: org-shared' on a package-managed file — org-shared is the implicit default; remove the key. See rules/scope-vocabulary.md."
40
+ elif ! [[ "$_scope_val" =~ $_valid_scope_re ]]; then
41
+ warn "Invalid scope value '$_scope_val'. Use org-shared / project-shared / repo-only:<name>. See rules/scope-vocabulary.md."
20
42
  fi
21
- else
22
- warn "Missing frontmatter with scope:. Add YAML frontmatter with 'scope: org-shared' / 'scope: project-shared' / 'scope: repo-only:<name>'. See rules/scope-vocabulary.md."
43
+ elif [ "$_scope_managed" = "0" ]; then
44
+ warn "Missing scope: in frontmatter. A user-created .claude/ file must declare 'scope: project-shared' or 'scope: repo-only:<name>' (package-managed files default to org-shared). See rules/scope-vocabulary.md."
23
45
  fi
46
+ # managed + no marker → org-shared implied, no warning.
24
47
  ;;
25
48
  sh)
26
- if ! has_scope_comment "$FILE_PATH"; then
27
- warn "Missing # @scope: comment. Add '# @scope: org-shared' / '# @scope: project-shared' / '# @scope: repo-only:<name>' after shebang. See rules/scope-vocabulary.md."
49
+ if has_scope_comment "$FILE_PATH"; then
50
+ _scope_val=$(head -5 "$FILE_PATH" 2>/dev/null | grep -E '^# @scope:' | head -1 \
51
+ | sed -E 's/^# @scope:[[:space:]]*//; s/[[:space:]]*#.*$//; s/[[:space:]]*$//')
52
+ if [ "$_scope_managed" = "1" ] && [ "$_scope_val" = "org-shared" ]; then
53
+ warn "Redundant '# @scope: org-shared' on a package-managed hook — org-shared is the implicit default; remove the comment. See rules/scope-vocabulary.md."
54
+ elif ! [[ "$_scope_val" =~ $_valid_scope_re ]]; then
55
+ warn "Invalid @scope value '$_scope_val'. Use org-shared / project-shared / repo-only:<name>. See rules/scope-vocabulary.md."
56
+ fi
57
+ elif [ "$_scope_managed" = "0" ]; then
58
+ warn "Missing # @scope: comment. A user-created .claude/ hook must declare '# @scope: project-shared' or '# @scope: repo-only:<name>' (package-managed hooks default to org-shared). See rules/scope-vocabulary.md."
28
59
  fi
60
+ # managed + no marker → org-shared implied, no warning.
29
61
  ;;
30
62
  json)
31
63
  # JSON can't have frontmatter — skip
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Smoke runner for validate-structure-*.sh + validate-structure-lib.sh
4
3
  # Iterates fixtures under __test-fixtures__/validate-structure/{good,bad}/
5
4
  # Each test case maps a fixture file → simulated rel path inside .claude/
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Hook Helper: Template/context suggestion for validate-structure.sh
4
3
  # Purpose: Map file locations to applicable templates or context files
5
4
  # Sourced by validate-structure.sh - not run directly
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # @hook: PreToolUse Edit|Write
4
3
  # Hook: PreToolUse for Edit|Write
5
4
  # Purpose: Validate file paths against structure patterns
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env bash
2
- # @scope: org-shared
3
2
  # @event: SessionStart
4
3
  # Scope + sibling-parity sweep at session start. Calls `codebyplan claude verify-parity --warn-only`.
5
4
  # Fires ONLY in the templates source monorepo (self-guards on templates/ presence); no-op for consumers.
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: agent-claim-verification
4
3
  description: Subagents must cite the source file (path:line) or vendor docs before asserting that any JSON key, schema field, env-var name, or external API shape exists.
5
4
  paths:
@@ -1,7 +1,3 @@
1
- ---
2
- scope: org-shared
3
- ---
4
-
5
1
  # Architecture Map
6
2
 
7
3
  When `.claude/architecture/` exists in this repo, per-module map files may be present.
@@ -1,7 +1,3 @@
1
- ---
2
- scope: org-shared
3
- ---
4
-
5
1
  # CBP Operating Gotchas
6
2
 
7
3
  Cross-repo traps in the CodeByPlan tooling surface (CLI, MCP, git, host platform) that
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  paths:
4
3
  - ".claude/context/**/*"
5
4
  - ".claude/agents/**/*"
@@ -1,7 +1,3 @@
1
- ---
2
- scope: org-shared
3
- ---
4
-
5
1
  # E2E Mandatory Run Contract
6
2
 
7
3
  E2E is **opt-out, not opt-in**. Whenever a framework configured in `.codebyplan/e2e.json`
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: parallel-waves
4
3
  description: Wave schema, invariants, and proximity-split algorithm for cbp-task-planner Phase 5.6 wave decomposition.
5
4
  paths:
@@ -1,10 +1,15 @@
1
- ---
2
- scope: org-shared
3
- ---
4
-
5
1
  # Scope Vocabulary
6
2
 
7
- Canonical scope-marker enum for `.claude/` files. Every CBP-managed agent, skill, rule, and hook script must declare exactly one `scope:` value from the enum below. The marker is enforced by four validators (cross-linked at the bottom of this file).
3
+ Canonical scope-marker enum for `.claude/` files. The marker classifies a structural file's distribution scope but it is **required only on user-created files**, not on the assets the `codebyplan` package distributes.
4
+
5
+ ## When is a `scope:` marker required?
6
+
7
+ A `.claude/` structural file (a rule, an agent, a `SKILL.md`, or a `hooks/*.sh`) is one of two kinds:
8
+
9
+ - **Package-managed** — the `codebyplan` package ships a **template twin** for it (`packages/codebyplan-package/templates/<rel>` in the monorepo, or `node_modules/codebyplan/templates/<rel>` in a consumer repo). Managed files are **`org-shared` by definition** — `org-shared` is the implicit, **markerless** default. A managed file needs **no** `scope:` marker; an explicit `scope: org-shared` on it is **redundant** and validators emit a non-blocking warning to remove it.
10
+ - **User-created** — no template twin exists. These are repo- or project-local additions the package never distributes, so they **must** declare a `scope:` marker (`project-shared` or `repo-only:<name>`; `org-shared` is also accepted but unusual for a non-distributed file).
11
+
12
+ **Conservative fallback**: when no templates directory is resolvable at all (e.g. `codebyplan` is not installed), twin detection is inactive and every structural file is treated as user-created — a marker is required. Enforcement is never silently dropped.
8
13
 
9
14
  ## Enum values
10
15
 
@@ -57,9 +62,8 @@ Used by `.sh` hook scripts and `.sh` tooling under `.claude/`. Place the marker
57
62
 
58
63
  ## Enforcement
59
64
 
60
- Four validators enforce this enum. A file missing the marker (or carrying a non-enum value) fails validation:
65
+ `codebyplan claude verify-parity` is the **central enforcer** of the rule above; the other validators are twin-aware helpers. A marker is required only on user-created (no-twin) files; a redundant `org-shared` marker on a managed (twin) file is a non-blocking warning; a present-but-non-enum value always fails:
61
66
 
62
- - `.claude/hooks/validate-structure-scope.sh` — warns when a `.claude/` file being edited (PreToolUse `Edit|Write`) lacks a scope marker; sourced by `validate-structure.sh`; it is NOT a session-start sweep.
63
- - `codebyplan claude verify-parity` — sweeps all `.claude/{rules,skills,agents,hooks}` for missing/non-enum scope markers AND runs the sibling-parity check against `templates/`; invoked automatically at session start via `.claude/hooks/verify-parity.sh` (monorepo only); run manually with `--json` for CI.
64
- - `.claude/skills/cbp-build-cc-agent/scripts/validate-agent.sh` — blocks agent authoring when `scope:` is absent.
65
- - `.claude/skills/cbp-build-cc-skill/scripts/validate-skill.sh` — blocks skill authoring when `scope:` is absent.
67
+ - `codebyplan claude verify-parity` — sweeps `.claude/{rules,skills,agents,hooks}`. For each structural file it checks the template twin: a no-twin file missing a marker is a **`missing-scope`** error; a managed file carrying `org-shared` is a **`redundant-scope`** warning (surfaced in `warnings`, never raises the exit code); any present non-enum value is an **`invalid-scope`** error. It also runs the sibling-parity check against `templates/`. Invoked automatically at session start via `.claude/hooks/verify-parity.sh` (monorepo only); run manually with `--json` (emits `{ violations, warnings }`) for CI.
68
+ - `.claude/hooks/validate-structure-scope.sh` — PreToolUse `Edit|Write` helper (sourced by `validate-structure.sh`, NOT a session-start sweep). Warns when a **user-created** `.claude/` file being edited lacks a marker, and warns on a redundant `org-shared` marker when the file is package-managed. Uses `has_template_twin` (in `validate-structure-lib.sh`) for managed detection.
69
+ - `.claude/skills/cbp-build-cc-agent/scripts/validate-agent.sh`, `.../cbp-build-cc-skill/scripts/validate-skill.sh`, `.../cbp-build-cc-rule/scripts/validate-rule.sh` — authoring validators. `scope:` is **optional** at authoring time; these scripts only reject a present-but-non-enum value. The user-created requirement is enforced centrally by `verify-parity`.
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  description: Supabase preview-branch lifecycle mirrors the git feat-branch lifecycle
4
3
  paths:
5
4
  - "supabase/migrations/**"
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  paths:
4
3
  - "apps/todo-worker/**"
5
4
  - "packages/mcp-tools/src/**"
@@ -68,6 +68,18 @@
68
68
  "mcp__codebyplan__delete_session_log",
69
69
  "mcp__codebyplan__delete_worktree",
70
70
  "mcp__codebyplan__release_assignment",
71
+ "mcp__stripe__create_customer",
72
+ "mcp__stripe__create_product",
73
+ "mcp__stripe__create_price",
74
+ "mcp__stripe__create_payment_link",
75
+ "mcp__stripe__create_invoice",
76
+ "mcp__stripe__create_subscription",
77
+ "mcp__stripe__update_subscription",
78
+ "mcp__stripe__create_refund",
79
+ "mcp__stripe__list_customers",
80
+ "mcp__stripe__list_products",
81
+ "mcp__stripe__list_prices",
82
+ "mcp__stripe__list_invoices",
71
83
  "Bash(codebyplan setup:*)",
72
84
  "Bash(npx codebyplan setup:*)",
73
85
  "Bash(codebyplan create-org:*)",
@@ -127,6 +139,7 @@
127
139
  "Skill(cbp-ship-configure)",
128
140
  "Skill(cbp-standalone-task-check)",
129
141
  "Skill(cbp-standalone-task-testing)",
142
+ "Skill(cbp-stripe)",
130
143
  "Skill(cbp-supabase-branch-check)",
131
144
  "Skill(cbp-supabase-migrate)",
132
145
  "Skill(cbp-supabase-setup)",
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-build-cc-agent
4
3
  description: Build a Claude Code subagent at .claude/agents/{name}.md (flat form, per the official sub-agents spec) following the official sub-agents spec (frontmatter, tools, model, hooks, skills preload, permission modes, isolation).
5
4
  argument-hint: "[agent-name] [--scope=project|user] [--isolation=worktree]"
@@ -49,7 +48,7 @@ Default: `project`. Pass `--scope=user` to override. Use folder form `{scope-pat
49
48
 
50
49
  Read `${CLAUDE_SKILL_DIR}/templates/agent.md` for the canonical frontmatter set. Fill only fields that matter for the agent; leave the rest out (every field except `name` and `description` is optional).
51
50
 
52
- CBP adds a required `scope:` frontmatter marker (structural classification; not read by Claude Code). Values: `org-shared` | `project-shared` | `repo-only:<repo-name>`. Length hook warns at 400 lines, blocks at 800. Quality details in [reference/cbp-quality.md](reference/cbp-quality.md).
51
+ CBP adds a `scope:` frontmatter marker (structural classification; not read by Claude Code). Values: `org-shared` | `project-shared` | `repo-only:<repo-name>`. It is **required only on user-created agents** — a package-managed agent (template twin under `templates/agents/`) is `org-shared` by default and needs no marker. Length hook warns at 400 lines, blocks at 800. Quality details in [reference/cbp-quality.md](reference/cbp-quality.md).
53
52
 
54
53
  ### Step 4 — Gather required fields
55
54
 
@@ -111,7 +110,7 @@ bash "${CLAUDE_SKILL_DIR}/scripts/validate-agent.sh" "{scope-path}/{name}.md"
111
110
 
112
111
  (Pass `{scope-path}/{name}/AGENT.md` instead if folder form was chosen.)
113
112
 
114
- It checks: name format, frontmatter parses, required fields present (`name`, `description`, `scope`), tool names are valid, model alias is recognised.
113
+ It checks: name format, frontmatter parses, required fields present (`name`, `description`), the `scope:` value is a valid enum when present (the key itself is optional — required only on user-created agents, enforced centrally by `codebyplan claude verify-parity`), tool names are valid, model alias is recognised.
115
114
 
116
115
  ### Step 8 — Surface to the user
117
116
 
@@ -1,7 +1,3 @@
1
- ---
2
- scope: org-shared
3
- ---
4
-
5
1
  # Agent Authoring Quality
6
2
 
7
3
  Quality expectations and structure for `/.claude/agents/{name}.md` files. This file adds CBP-specific constraints on top of the official Claude Code sub-agents spec.
@@ -10,13 +6,15 @@ Quality expectations and structure for `/.claude/agents/{name}.md` files. This f
10
6
 
11
7
  CBP uses the flat form `.claude/agents/{name}.md` — the default per the official Claude Code sub-agents spec. All 12 existing CBP agents use this layout. Folder form `.claude/agents/{name}/AGENT.md` is optional and only appropriate when the agent bundles supporting files (context, examples, scripts) next to the definition.
12
8
 
13
- ## Required CBP Frontmatter
9
+ ## CBP Frontmatter — the `scope:` marker
10
+
11
+ `scope:` is a CBP structural marker (not read by Claude Code itself). It is **required only on user-created agents** — ones the `codebyplan` package does NOT distribute. A package-managed agent (one that has a template twin under `templates/agents/`) is `org-shared` by default and needs **no** marker; an explicit `scope: org-shared` on it is redundant. See `rules/scope-vocabulary.md`.
14
12
 
15
- Every agent MUST have `scope:` in addition to the Claude Code native fields:
13
+ For a user-created agent, add a marker alongside the Claude Code native fields:
16
14
 
17
15
  ```yaml
18
16
  ---
19
- scope: org-shared # structural marker: org-shared | project-shared | repo-only:<repo-name>
17
+ scope: project-shared # or: repo-only:<repo-name> (user-created agents only)
20
18
  name: agent-name
21
19
  description: One sentence — used for matching. Be specific.
22
20
  tools: Read, Write, Edit, Glob, Grep, Bash
@@ -24,7 +22,7 @@ effort: high
24
22
  ---
25
23
  ```
26
24
 
27
- `scope:` is a CBP structural marker not read by Claude Code itself. Missing `scope:` fails validation (`validate-agent.sh` / `validate-structure-scope.sh`).
25
+ `validate-agent.sh` validates the value when present but does not require the key; `codebyplan claude verify-parity` is the central enforcer of the user-created requirement (and warns on a redundant `org-shared` marker on a managed agent).
28
26
 
29
27
  ## Agent Types
30
28
 
@@ -34,7 +34,16 @@ fm=$(awk '/^---[[:space:]]*$/{n++; next} n==1{print} n==2{exit}' "$FILE")
34
34
  # Required fields
35
35
  grep -qE '^name:[[:space:]]*' <<< "$fm" || err "missing required field: name"
36
36
  grep -qE '^description:[[:space:]]*' <<< "$fm" || err "missing required field: description"
37
- grep -qE '^scope:[[:space:]]*' <<< "$fm" || err "missing CBP required field: scope (org-shared|project-shared|repo-only:<repo-name>)"
37
+
38
+ # CBP scope: OPTIONAL. Required only on user-created assets (no template twin) —
39
+ # enforced centrally by `codebyplan claude verify-parity`. Package-managed agents
40
+ # default to org-shared (markerless). Validate the VALUE only when present.
41
+ if grep -qE '^scope:[[:space:]]*' <<< "$fm"; then
42
+ scope_val=$(grep -E '^scope:' <<< "$fm" | head -1 | sed -E 's/^scope:[[:space:]]*//; s/[[:space:]]*$//')
43
+ if ! [[ "$scope_val" =~ ^(org-shared|project-shared|repo-only:[a-z0-9]([a-z0-9-]*[a-z0-9])?)$ ]]; then
44
+ err "scope value '$scope_val' is not a valid enum value (org-shared|project-shared|repo-only:<slug>)"
45
+ fi
46
+ fi
38
47
 
39
48
  # Name format: kebab-case
40
49
  name=$(grep -E '^name:' <<< "$fm" | head -1 | sed -E 's/^name:[[:space:]]*//; s/[[:space:]]*$//; s/^"(.*)"$/\1/' || true)
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-build-cc-claude-file
4
3
  description: Create or update a CLAUDE.md file at any scope (managed, project, user, local) following the official memory spec — imports (@path), nested discovery, AGENTS.md bridge, comment stripping, and claudeMdExcludes.
5
4
  argument-hint: "[action] [--scope=managed|project|user|local]"
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Validate a CLAUDE.md or CLAUDE.local.md file.
4
3
  # Usage: validate-claude-file.sh <path-to-claude-file>
5
4
  # Exit 0 = valid, exit 1 = invalid (errors printed to stderr).
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-build-cc-mode
4
3
  description: Audit + apply the CHK-109 model/effort convention across every authoring skill and agent under `packages/codebyplan-package/templates/`. Skills set `effort:` only and inherit the session model; agents pin `model:` + `effort:`. Bare invocation audits and reports frontmatter gaps; with a path argument, edits the target file's frontmatter to the convention-decided values.
5
4
  argument-hint: "[path-to-agent-or-skill]"
@@ -1,7 +1,6 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-build-cc-rule
4
- description: Build a path-scoped rule file at .claude/rules/{name}.md following the official memory/rules spec (paths globs, always-loaded vs on-demand, symlinks) plus CBP conventions (required scope field for structural classification (validate-structure-scope.sh), narrow-paths discipline; hook warns at 100 lines, blocks at 200).
3
+ description: Build a path-scoped rule file at .claude/rules/{name}.md following the official memory/rules spec (paths globs, always-loaded vs on-demand, symlinks) plus CBP conventions (scope field for structural classification — required only on user-created rules (validate-structure-scope.sh), narrow-paths discipline; hook warns at 100 lines, blocks at 200).
5
4
  argument-hint: '[name] [--scope=project|user] [--paths="glob,glob"]'
6
5
  allowed-tools: Read, Write, Edit, Glob, Grep
7
6
  effort: xhigh
@@ -76,13 +75,24 @@ paths:
76
75
 
77
76
  Unscoped rules (no `paths:`) belong only on truly universal constraints: git attribution, company secrets policy, file-naming conventions.
78
77
 
79
- ### Step 4 — Required CBP Frontmatter
78
+ ### Step 4 — CBP Frontmatter
80
79
 
81
- Every rule MUST have **both** fields:
80
+ `scope:` is required **only for user-created rules** (no template twin); package-managed rules are `org-shared` by default — omit the marker. `paths:` is recommended for every rule.
81
+
82
+ **User-created rule** (must declare scope):
83
+
84
+ ```yaml
85
+ ---
86
+ scope: project-shared # or: repo-only:<repo-name>
87
+ paths:
88
+ - "apps/*/src/app/api/**/*.ts"
89
+ ---
90
+ ```
91
+
92
+ **Package-managed rule** (template twin exists → org-shared implicit, no marker):
82
93
 
83
94
  ```yaml
84
95
  ---
85
- scope: org-shared # or: project-shared | repo-only:<repo-name>
86
96
  paths:
87
97
  - "apps/*/src/app/api/**/*.ts"
88
98
  ---
@@ -90,7 +100,7 @@ paths:
90
100
 
91
101
  | Field | Purpose |
92
102
  | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
93
- | `scope:` | CBP structural marker — required by validators (`validate-structure-scope.sh`). NOT read by Claude Code. Values: `org-shared` \| `project-shared` \| `repo-only:<name>` |
103
+ | `scope:` | CBP structural marker — NOT read by Claude Code. Required only on **user-created** rules (no template twin); package-managed rules are `org-shared` by default and need no marker. Values: `org-shared` \| `project-shared` \| `repo-only:<name>`. See `rules/scope-vocabulary.md`. |
94
104
  | `paths:` | File globs that trigger rule loading (Claude Code native) |
95
105
 
96
106
  When propagating rules between repos, copy only rules where `scope: org-shared` OR `scope: repo-only:<target>`.
@@ -161,7 +171,7 @@ Run the validator:
161
171
  bash "${CLAUDE_SKILL_DIR}/scripts/validate-rule.sh" "{scope-path}/{name}.md"
162
172
  ```
163
173
 
164
- It checks: YAML frontmatter present, `scope:` field present and valid enum value, H1 heading present and its kebab-case form matches the filename, `paths:` field (warns if absent — unconditional rules burn context on every session), line count (warns at 100, errors at 200).
174
+ It checks: YAML frontmatter present, the `scope:` value is a valid enum when present (the key itself is optional — required only on user-created rules, enforced centrally by `codebyplan claude verify-parity`), H1 heading present and its kebab-case form matches the filename, `paths:` field (warns if absent — unconditional rules burn context on every session), line count (warns at 100, errors at 200).
165
175
 
166
176
  ### Step 9 — Verify loading
167
177
 
@@ -180,7 +190,7 @@ Use the `InstructionsLoaded` hook if you need to debug exactly when and why a ru
180
190
 
181
191
  - Every rule needs an intent — if removing it wouldn't change Claude's behaviour, delete it
182
192
  - Prefer path-scoped over unconditional — context is a finite budget
183
- - Missing `scope:` fails validation (validate-structure-scope.sh warns; validate-agent.sh / validate-skill.sh block); missing `paths:` loads the rule on every file read
193
+ - `scope:` is required only on user-created rules (no template twin); a managed rule is `org-shared` by default — enforced centrally by `codebyplan claude verify-parity` (missing marker = error for user-created files; redundant `org-shared` on a managed file = non-blocking warning); `validate-structure-scope.sh` also warns at edit time; missing `paths:` loads the rule on every file read
184
194
  - Rules are stored in the CBP database; the authoritative copy is in the DB — commit changes you want to keep
185
195
  - Conflicting rules load in both — Claude picks arbitrarily. Remove or merge duplicates
186
196
  - Rules that restate the Claude Code spec add no value — point to the official spec instead
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Validate a Claude Code rule file at .claude/rules/{name}.md.
4
3
  # Usage: validate-rule.sh <path-to-rule-file>
5
4
  # Exit 0 = valid, exit 1 = invalid (errors printed to stderr).
@@ -24,10 +23,10 @@ fi
24
23
  # Extract frontmatter block
25
24
  fm=$(awk '/^---[[:space:]]*$/{n++; next} n==1{print} n==2{exit}' "$FILE")
26
25
 
27
- # scope: field required + must match enum
28
- if ! grep -qE '^scope:[[:space:]]*' <<< "$fm"; then
29
- err "missing CBP required field: scope (org-shared|project-shared|repo-only:<repo-name>)"
30
- else
26
+ # scope: OPTIONAL. Required only on user-created assets (no template twin) —
27
+ # enforced centrally by `codebyplan claude verify-parity`. Package-managed rules
28
+ # default to org-shared (markerless). Validate the VALUE only when present.
29
+ if grep -qE '^scope:[[:space:]]*' <<< "$fm"; then
31
30
  scope_val=$(grep -E '^scope:' <<< "$fm" | head -1 | sed -E 's/^scope:[[:space:]]*//; s/[[:space:]]*$//')
32
31
  if ! [[ "$scope_val" =~ ^(org-shared|project-shared|repo-only:[a-z0-9]([a-z0-9-]*[a-z0-9])?)$ ]]; then
33
32
  err "scope value '$scope_val' is not a valid enum value (org-shared|project-shared|repo-only:<slug>)"
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-build-cc-settings
4
3
  description: Create or update Claude Code settings.json / settings.local.json / managed-settings.json following the official settings spec — scopes, permissions, hooks, sandbox, attribution, plugins, env vars, JSON schema validation.
5
4
  argument-hint: "[action] [--scope=user|project|local|managed]"
@@ -1,7 +1,3 @@
1
- ---
2
- scope: org-shared
3
- ---
4
-
5
1
  # Settings Authoring Conventions
6
2
 
7
3
  Read this before creating or updating `.claude/settings.json` or `.claude/settings.local.json`. This file adds CBP-specific constraints on top of the official Claude Code settings spec.
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Validate a Claude Code settings*.json file.
4
3
  # Usage: validate-settings.sh <path-to-settings-file>
5
4
  # Exit 0 = valid, exit 1 = invalid (errors printed to stderr).
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-build-cc-skill
4
3
  description: Build a Claude Code skill at .claude/skills/{name}/SKILL.md following the official skills spec — frontmatter, supporting files (templates, examples, reference, scripts), invocation control, argument substitution, dynamic context, fork-to-subagent, allowed-tools.
5
4
  argument-hint: "[skill-name] [--scope=project|user] [--fork] [--disable-model-invocation]"