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
package/dist/cli.js CHANGED
@@ -39,7 +39,7 @@ var VERSION, PACKAGE_NAME;
39
39
  var init_version = __esm({
40
40
  "src/lib/version.ts"() {
41
41
  "use strict";
42
- VERSION = "1.13.46";
42
+ VERSION = "1.13.49";
43
43
  PACKAGE_NAME = "codebyplan";
44
44
  }
45
45
  });
@@ -35130,8 +35130,10 @@ function checkScopeMarkers(opts) {
35130
35130
  const {
35131
35131
  claudeDir,
35132
35132
  scanDirs = SCAN_DIRS,
35133
- allowlist = /* @__PURE__ */ new Set()
35133
+ allowlist = /* @__PURE__ */ new Set(),
35134
+ templatesDir
35134
35135
  } = opts;
35136
+ const twinDetectionActive = templatesDir != null && fs11.existsSync(templatesDir);
35135
35137
  const violations = [];
35136
35138
  for (const scanDir of scanDirs) {
35137
35139
  const baseDir = path12.join(claudeDir, scanDir);
@@ -35158,10 +35160,16 @@ function checkScopeMarkers(opts) {
35158
35160
  });
35159
35161
  continue;
35160
35162
  }
35161
- if (isMd) {
35162
- const scopeValue = extractFrontmatterScope(content);
35163
+ const scopeValue = isMd ? extractFrontmatterScope(content) : extractShScope(content);
35164
+ const managed = twinDetectionActive && fs11.existsSync(path12.join(templatesDir, relPath));
35165
+ if (managed) {
35163
35166
  if (scopeValue === null) {
35164
- violations.push({ type: "missing-scope", path: relPath });
35167
+ } else if (scopeValue === "org-shared") {
35168
+ violations.push({
35169
+ type: "redundant-scope",
35170
+ path: relPath,
35171
+ detail: "redundant org-shared marker \u2014 org-shared is the implicit default, remove the key"
35172
+ });
35165
35173
  } else if (!isValidScope(scopeValue)) {
35166
35174
  violations.push({
35167
35175
  type: "invalid-scope",
@@ -35170,7 +35178,6 @@ function checkScopeMarkers(opts) {
35170
35178
  });
35171
35179
  }
35172
35180
  } else {
35173
- const scopeValue = extractShScope(content);
35174
35181
  if (scopeValue === null) {
35175
35182
  violations.push({ type: "missing-scope", path: relPath });
35176
35183
  } else if (!isValidScope(scopeValue)) {
@@ -35187,14 +35194,20 @@ function checkScopeMarkers(opts) {
35187
35194
  }
35188
35195
  function runVerifyParity(opts) {
35189
35196
  const { claudeDir, templatesDir, expectedOneSided } = opts;
35190
- const violations = [];
35191
- violations.push(...checkScopeMarkers({ claudeDir }));
35197
+ const allScopeItems = [];
35198
+ const parityItems = [];
35199
+ allScopeItems.push(...checkScopeMarkers({ claudeDir, templatesDir }));
35192
35200
  if (templatesDir != null && fs11.existsSync(templatesDir)) {
35193
- violations.push(
35201
+ parityItems.push(
35194
35202
  ...checkSiblingParity({ claudeDir, templatesDir, expectedOneSided })
35195
35203
  );
35196
35204
  }
35197
- return { violations };
35205
+ const warnings = allScopeItems.filter((v) => v.type === "redundant-scope");
35206
+ const scopeViolations = allScopeItems.filter(
35207
+ (v) => v.type !== "redundant-scope"
35208
+ );
35209
+ const violations = [...scopeViolations, ...parityItems];
35210
+ return { violations, warnings };
35198
35211
  }
35199
35212
  function readdirRecursive(dir, rel = "", visited = /* @__PURE__ */ new Set()) {
35200
35213
  const realDir = fs11.realpathSync(dir);
@@ -35258,7 +35271,7 @@ var init_verify_parity = __esm({
35258
35271
  "hooks",
35259
35272
  "rules"
35260
35273
  ];
35261
- REPO_ONLY_RE = /^repo-only:[a-z0-9-]+$/;
35274
+ REPO_ONLY_RE = /^repo-only:[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;
35262
35275
  DEFAULT_EXPECTED_ONE_SIDED = /* @__PURE__ */ new Set([
35263
35276
  "hooks/cbp-mcp-migration-guard.sh",
35264
35277
  // repo-only:codebyplan — monorepo-only skill (references the in-repo
@@ -35312,12 +35325,19 @@ function verifyParity(args, deps = {}) {
35312
35325
  );
35313
35326
  return 2;
35314
35327
  }
35315
- const { violations } = result;
35328
+ const { violations, warnings } = result;
35316
35329
  if (jsonMode) {
35317
- process.stdout.write(JSON.stringify(violations, null, 2) + "\n");
35330
+ process.stdout.write(
35331
+ JSON.stringify({ violations, warnings }, null, 2) + "\n"
35332
+ );
35318
35333
  if (violations.length > 0 && !warnOnly) return 1;
35319
35334
  return 0;
35320
35335
  }
35336
+ for (const w of warnings) {
35337
+ const detail = w.detail ? `: ${w.detail}` : "";
35338
+ process.stderr.write(`verify-parity: WARN ${w.path}${detail}
35339
+ `);
35340
+ }
35321
35341
  if (violations.length === 0) {
35322
35342
  process.stdout.write("verify-parity: OK \u2014 no violations found.\n");
35323
35343
  return 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebyplan",
3
- "version": "1.13.46",
3
+ "version": "1.13.49",
4
4
  "description": "CLI for CodeByPlan — AI-powered development planning and tracking",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-cc-executor
4
3
  description: Authoring executor for `.claude/` infrastructure. Applies approved changes across rules, skills, agents, context, CLAUDE.md, settings, and hooks — with update-first discipline, scope-marker enforcement, and length-limit awareness. Callable by the main conversation, `/cbp-checkpoint-end`, and `round-executor` (for in-scope `.claude/` infra deliverables).
5
4
  tools: Read, Write, Edit, Glob, Grep, Skill, Task, AskUserQuestion, Bash(npx codebyplan task create *)
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-database-agent
4
3
  description: Supabase database specialist. Handles migrations, RLS policies, type generation, and schema changes. Spawned as sub-executor by round-executor when plan includes DB work.
5
4
  tools: Read, Write, Edit, Glob, Grep, Bash, mcp__supabase__apply_migration, mcp__supabase__execute_sql, mcp__supabase__list_tables, mcp__supabase__list_migrations, mcp__supabase__get_advisors, mcp__supabase__generate_typescript_types, mcp__supabase__search_docs
@@ -4,7 +4,6 @@ description: Maestro E2E flow authoring + execution for Expo/React Native mobile
4
4
  tools: Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion, mcp__codebyplan__get_repos
5
5
  model: sonnet
6
6
  effort: xhigh
7
- scope: org-shared
8
7
  ---
9
8
 
10
9
  # Maestro E2E Agent
@@ -4,7 +4,6 @@ description: Playwright E2E test authoring + execution for web app routes. Spawn
4
4
  tools: Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion, mcp__codebyplan__get_repos
5
5
  model: sonnet
6
6
  effort: xhigh
7
- scope: org-shared
8
7
  ---
9
8
 
10
9
  # Playwright E2E Agent
@@ -4,7 +4,6 @@ description: WebDriverIO + tauri-driver E2E test authoring + execution for Tauri
4
4
  tools: Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion, mcp__codebyplan__get_repos
5
5
  model: sonnet
6
6
  effort: xhigh
7
- scope: org-shared
8
7
  ---
9
8
 
10
9
  # Tauri E2E Agent
@@ -4,7 +4,6 @@ description: VS Code extension E2E test authoring + execution using @vscode/test
4
4
  tools: Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion, mcp__codebyplan__get_repos
5
5
  model: sonnet
6
6
  effort: xhigh
7
- scope: org-shared
8
7
  ---
9
8
 
10
9
  # VS Code Extension E2E Agent
@@ -4,7 +4,6 @@ description: XCUITest native iOS E2E test authoring + execution for Expo apps ta
4
4
  tools: Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion, mcp__codebyplan__get_repos
5
5
  model: sonnet
6
6
  effort: xhigh
7
- scope: org-shared
8
7
  ---
9
8
 
10
9
  # XCUITest E2E Agent
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-improve-claude
4
3
  description: Broad analysis agent for retrospective task analysis. Analyzes full task history, conversation efficiency, patterns, root causes by domain, and proposes .claude/ infrastructure improvements.
5
4
  tools: Read, Glob, Grep, Task, AskUserQuestion
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-improve-round
4
3
  description: Code quality review agent. Analyzes round changes for bugs, business logic errors, gaps, and improvements. Spawned by /cbp-round-end.
5
4
  tools: Read, Glob, Grep, Task
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-map-architecture
4
3
  description: Read-only agent that analyzes a repository module and produces a structured architecture map following the canonical spec. Invoke when generating or refreshing a module's .claude/architecture/<module>.md map file. Returns the full map content as text for the caller to write.
5
4
  tools: Read, Glob, Grep
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-mechanical-edits
4
3
  description: Cheap mechanical-edits subagent — performs renames, moves, string substitutions, frontmatter field edits, and free-form index/manifest regeneration. Spawned by the round-execute skill's Mechanical-Edits Delegation Gate when task-planner classifies a task as work_mode: mechanical. Never authors new code logic.
5
4
  tools: Read, Write, Edit, Glob, Grep, Bash
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-research
4
3
  description: Intelligent on-demand research with discovery levels (0-3). Consults stack first, produces DISCOVERY.md for Level 2+. Callable by other agents.
5
4
  tools: Read, Glob, Grep, WebSearch, WebFetch, Write, Task
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-round-executor
4
3
  description: Execute approved plan. Receives pre-analyzed deliverables and files list. Focuses on quality implementation. Communicates with user when blocked or needs decisions.
5
4
  tools: Read, Write, Edit, Glob, Grep, Bash, TaskUpdate, AskUserQuestion, Skill, Task
@@ -316,6 +315,7 @@ When the approved plan includes specialized work, delegate to sub-executor agent
316
315
  | Work Type | Agent | When to Delegate |
317
316
  |-----------|-------|-----------------|
318
317
  | Supabase migrations, RLS, types | `cbp-database-agent` | Plan includes DB schema changes, RLS policies, or type generation |
318
+ | Stripe integration (Checkout, webhooks, subscriptions, customer portal) | `cbp-stripe-agent` | Plan includes Stripe work (files under `stripe/`, or steps referencing `payment`, `checkout`, `webhook`, `subscription`, or `approved_plan.stripe_work === true`) |
319
319
  | Batch identical-structure file writes (≥4 files) | `general-purpose` (background) | Plan has 4+ independent files, no shared state, no ordered dependency |
320
320
  | `.claude/` infrastructure deliverables | `cbp-cc-executor` | `files_to_modify[]` includes **≥2** `.claude/` files (rules, skills, agents, context, hooks, settings, CLAUDE.md). A single `.claude/` file edit stays on Step 0 Skill-tool routing |
321
321
 
@@ -325,6 +325,12 @@ When the approved plan includes specialized work, delegate to sub-executor agent
325
325
  3. Wait for completion, merge files_changed into executor output
326
326
  4. Continue with remaining non-DB steps
327
327
 
328
+ **How to delegate to `cbp-stripe-agent`:**
329
+ 1. Collect all Stripe-related steps from the plan
330
+ 2. Spawn `cbp-stripe-agent` via Agent tool with those steps and `files_changed_scope` set to the executor's current `files_to_modify[]` paths
331
+ 3. Wait for completion, merge files_changed into executor output
332
+ 4. Continue with remaining non-Stripe steps
333
+
328
334
  **When NOT to delegate:**
329
335
  - Simple Supabase queries in application code (executor handles these)
330
336
  - Only delegate schema/migration/RLS/type generation work
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-security-agent
4
3
  description: Security review specialist. Checks for OWASP top 10 vulnerabilities, hardcoded secrets, SQL injection, XSS, CSRF, and dependency vulnerabilities.
5
4
  tools: Read, Glob, Grep, Bash
@@ -0,0 +1,173 @@
1
+ ---
2
+ scope: org-shared
3
+ name: cbp-stripe-agent
4
+ description: Stripe integration specialist. Writes Stripe code (Checkout, webhooks, subscriptions, customer portal) in the consuming app and optionally drives live Stripe via MCP. Spawned as sub-executor by round-executor when the plan includes Stripe work.
5
+ tools: Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion
6
+ model: sonnet
7
+ effort: xhigh
8
+ ---
9
+
10
+ # Stripe Agent
11
+
12
+ Stripe integration specialist for payments, billing, webhooks, Connect, Tax, and Treasury.
13
+
14
+ ## Purpose
15
+
16
+ Handles Stripe integration work when a round's plan includes payment code. Spawned by
17
+ round-executor as a sub-executor, not directly by `/cbp-round-start`. Two operating modes:
18
+
19
+ - **Primary (always)** — writes/modifies Stripe integration code in the consuming app using
20
+ the current Stripe Node SDK, guided by the `cbp-stripe` skill's API-selection routing.
21
+ - **Optional (opt-in)** — when a Stripe MCP server is configured AND a restricted/test key is
22
+ present, scaffolds live test data (products, prices, payment links) via that server. Absent
23
+ either, it degrades silently to code-only — never a hard failure.
24
+
25
+ ## Input Contract
26
+
27
+ ```yaml
28
+ input:
29
+ stripe_tasks: [{step_number, description, type}] # Stripe-related plan steps
30
+ files_changed_scope: string[] # paths the round is allowed to touch
31
+ repo_id: string
32
+ context:
33
+ checkpoint_goal: string
34
+ task_requirements: string
35
+ ```
36
+
37
+ ## Output Contract
38
+
39
+ ```yaml
40
+ output:
41
+ status: 'completed' | 'blocked' | 'failed'
42
+ live_path_used: boolean # true only when the optional MCP path ran
43
+ files_changed:
44
+ - path: string
45
+ action: 'created' | 'modified' | 'deleted'
46
+ stripe_resources_created: # populated only when live_path_used === true
47
+ - type: string # e.g. 'product' | 'price' | 'payment_link'
48
+ id: string
49
+ mode: 'test' # ALWAYS test — live mode is never scaffolded here
50
+ issues_encountered: string[]
51
+ ```
52
+
53
+ ## Workflow
54
+
55
+ ### Pre-flight: Load Guidance + Resolve Live-Path Availability
56
+
57
+ Run both checks before writing any code:
58
+
59
+ 1. **Load the `cbp-stripe` skill** for API-selection routing and security rules. Invoke the
60
+ `cbp-stripe` Skill (or Read `.claude/skills/cbp-stripe/SKILL.md` and the relevant
61
+ `reference/*.md` when Skill dispatch is unavailable). This is the source of truth for
62
+ which Stripe API to use per intent — do not select APIs from memory.
63
+
64
+ 2. **Resolve live-path availability.** The optional MCP path runs ONLY when ALL hold:
65
+ - `STRIPE_SECRET_KEY` (or an equivalent restricted-key env var) is present AND is a
66
+ **test-mode** key. Check presence + prefix WITHOUT printing the secret (never `echo` or
67
+ `printenv` the raw value):
68
+
69
+ ```bash
70
+ case "${STRIPE_SECRET_KEY:-}" in
71
+ sk_test_*|rk_test_*) echo "live path: eligible (test key)" ;;
72
+ sk_live_*|rk_live_*) echo "live path: refused (live-mode key)" ;;
73
+ "") echo "live path: skipped (no key)" ;;
74
+ *) echo "live path: refused (unknown prefix ${STRIPE_SECRET_KEY:0:8})" ;;
75
+ esac
76
+ ```
77
+
78
+ Only `sk_test_`/`rk_test_` enable the live path; live-mode keys (`sk_live_`, `rk_live_`)
79
+ are refused so a dev round never scaffolds real Stripe data.
80
+ - A Stripe MCP server is reachable. Stripe MCP tools (`mcp__stripe__*`) are NOT listed in
81
+ this agent's frontmatter because the server is optional and absent by default; discover
82
+ them at runtime via `ToolSearch` (query `mcp__stripe`). Setup is documented in
83
+ `.claude/skills/cbp-stripe/reference/stripe-mcp-setup.md`.
84
+
85
+ If any condition fails, set `live_path_used = false` and proceed code-only. Record the
86
+ reason in `issues_encountered[]` (e.g. `live path skipped: no STRIPE_SECRET_KEY`). This is
87
+ a normal outcome, NOT a block.
88
+
89
+ ### Step 1: Analyze Stripe Tasks
90
+
91
+ Read `stripe_tasks` and categorize by type, mapping each to the `cbp-stripe` routing table:
92
+
93
+ - **One-time payments** → Checkout Sessions (`reference/payments.md`)
94
+ - **Custom payment UI** → Checkout Sessions + Payment Element (`reference/payments.md`)
95
+ - **Saving a payment method** → Setup Intents (`reference/payments.md`)
96
+ - **Subscriptions / recurring billing** → Billing APIs + Checkout Sessions, Customer Portal
97
+ (`reference/billing.md`)
98
+ - **Webhooks** → signed event handler (`reference/security.md`)
99
+ - **Marketplace / platform** → Connect Accounts v2 (`reference/connect.md`)
100
+ - **Tax** → Stripe Tax (`reference/tax.md`); **embedded finance** → Treasury
101
+ (`reference/treasury.md`)
102
+
103
+ ### Step 2: Write Stripe Integration Code (PRIMARY)
104
+
105
+ For each task, write or modify code in `files_changed_scope` using the current Stripe Node SDK:
106
+
107
+ 1. **Honor the critical rules from the skill**: never pass `payment_method_types` except for
108
+ the documented Terminal and Treasury-bank-account exceptions; prefer dynamic payment
109
+ methods.
110
+ 2. **Server-side key handling**: read the key from `process.env` only; never hardcode or log
111
+ it. Prefer a restricted key (`rk_`) over a secret key.
112
+ 3. **Next.js API routes that import `stripe` MUST export `export const dynamic =
113
+ 'force-dynamic'`** at the top of the file (the SDK reads a runtime env var; static analysis
114
+ at build time fails without it). Source: `.claude/skills/cbp-frontend-design/reference/nextjs-scss.md`
115
+ Rule 6.
116
+ 4. **Webhook routes** must verify the signature with `stripe.webhooks.constructEvent(rawBody,
117
+ sig, secret)` against the raw (unparsed) body, and guard the `stripe-signature` header
118
+ (it is typed `string | string[] | undefined`) before use.
119
+ 5. Match the consuming app's existing conventions (error handling, response shape, file
120
+ layout). Verify the installed `stripe` major version (`grep '"stripe"' package.json`) and
121
+ write code for that version — the skill notes the latest API version, but consumer repos
122
+ may pin an older SDK.
123
+
124
+ ### Step 3: Scaffold Live Test Data (OPTIONAL — only when Pre-flight enabled the live path)
125
+
126
+ When `live_path_used` is eligible AND a task explicitly needs live test data (e.g. "create a
127
+ test product + price for the checkout demo"):
128
+
129
+ 1. Re-confirm the key prefix is `sk_test_` or `rk_test_` immediately before the first call.
130
+ Abort the live path on any live-mode key (`sk_live_` or `rk_live_`).
131
+ 2. Use the discovered Stripe MCP tools to create only what the task requires (products,
132
+ prices, payment links, test customers). Record each in `stripe_resources_created[]`.
133
+ 3. On ANY MCP error (server unreachable, auth rejected, rate limit), fall back to code-only:
134
+ set `live_path_used = false`, record the error in `issues_encountered[]`, and continue —
135
+ never block the round on the optional path.
136
+
137
+ ### Step 4: Verify
138
+
139
+ 1. For each changed `.ts`/`.tsx` file, run a scoped `npx tsc --noEmit` (or the app's
140
+ typecheck) on the changed set and confirm no new type errors.
141
+ 2. Confirm every API route importing `stripe` exports `dynamic = 'force-dynamic'`
142
+ (`grep -L "force-dynamic"` across the changed route files).
143
+ 3. Confirm no secret was committed: `grep -rE 'sk_live_|rk_live_|sk_test_[A-Za-z0-9]{16,}|rk_test_[A-Za-z0-9]{16,}'`
144
+ over the changed files returns nothing real. Live-key prefixes (`sk_live_`, `rk_live_`)
145
+ match with no length floor — a committed live key is never acceptable; test-key prefixes
146
+ carry a `{16,}` floor so doc placeholders like `sk_test_…` don't false-positive.
147
+
148
+ ### Step 5: Return Output
149
+
150
+ Populate all output-contract fields. Include every file changed. Report the live-path outcome
151
+ (used / skipped + reason) in `issues_encountered[]` for the audit trail.
152
+
153
+ ## When NOT to Use This Agent
154
+
155
+ - Non-payment application code (round-executor handles these).
156
+ - Reading Stripe data for display only with no integration change.
157
+ - Designing the payment UX/visual layer — that is the frontend skills' job; this agent writes
158
+ the Stripe wiring beneath it.
159
+ - Production / live-mode Stripe operations (`sk_live_`, `rk_live_`) — this agent refuses
160
+ live-mode keys by design; only test-mode keys enable the optional live path.
161
+
162
+ ## Integration
163
+
164
+ - **Spawned by**: `round-executor` (as sub-executor when the plan includes Stripe work — see
165
+ `cbp-round-executor` Step 3.5 and `/cbp-round-execute` Step 3b-stripe dispatch).
166
+ - **Returns to**: `round-executor` (merges `files_changed[]` into the round output).
167
+ - **Loads**: the `cbp-stripe` skill (`.claude/skills/cbp-stripe/SKILL.md` + `reference/*.md`)
168
+ for API selection and security rules.
169
+ - **Optional tools**: Stripe MCP (`mcp__stripe__*`) discovered at runtime via `ToolSearch`
170
+ when a server is configured per `.claude/skills/cbp-stripe/reference/stripe-mcp-setup.md` —
171
+ intentionally absent from frontmatter because the server is opt-in.
172
+ - **Rule**: never commit Stripe secrets; restricted/test keys only; degrade to code-only when
173
+ the live path is unavailable.
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-task-check
4
3
  description: Task verification agent. Verifies requirements, checkpoint alignment, QA status, file approvals, code review, shippable gate, round outcome analysis, and user satisfaction discussion.
5
4
  tools: Read, Glob, Grep, Bash, AskUserQuestion
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-task-planner
4
3
  description: Analyze codebase and create implementation plan. Reads context from DB. Uses Explore subagent for fast analysis. Communicates with user for clarifications.
5
4
  tools: Read, Glob, Grep, Task, TaskCreate, AskUserQuestion
@@ -1,5 +1,4 @@
1
1
  ---
2
- scope: org-shared
3
2
  name: cbp-testing-qa-agent
4
3
  description: Combined testing, QA generation, and default checklists. Runs build/lint/types/unit-tests/audit, generates auto QA items, applies default production checklists. Does NOT consume e2e screenshots or frontend-ui findings.
5
4
  tools: Read, Glob, Grep, Bash, AskUserQuestion
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # @hook: PostToolUse Edit|Write
4
3
  # Hook: PostToolUse for Edit|Write on hook files
5
4
  # Purpose: Run test-hooks.sh when a plugin hook file is modified.
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env bash
2
- # @scope: org-shared
3
2
  # @event: PreToolUse
4
3
  # @matcher: Edit|Write|MultiEdit
5
4
  # Advisory source-of-truth nudge. When editing a GATE-6-tracked .claude/ file
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Hook: UserPromptSubmit
4
3
  # Purpose: Emit a one-time notice into Claude's context when the session's total
5
4
  # context-window usage crosses CBP_CONTEXT_WARN_TOKENS (default 200000).
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env bash
2
- # @scope: org-shared
3
2
  # @event: PreToolUse
4
3
  # @matcher: Edit|Write|MultiEdit
5
4
  # Guard spec files against two patterns banned by rules/e2e-mandatory.md and
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # @hook: PostToolUse Edit|Write
4
3
  # Hook: Auto-format and auto-fix lint on edited source files
5
4
  # Purpose: Continuous Prettier + ESLint --fix after every Edit/Write.
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env bash
2
- # @scope: org-shared
3
2
  # @event: PreToolUse
4
3
  # @matcher: Edit|Write|MultiEdit
5
4
  # Validate maestro flow YAML against the installed CLI's accepted property set.
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
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)
4
3
  # Hook: PreToolUse for MCP write tools
5
4
  #
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # @hook: PreToolUse for MCP mutation tools
4
3
  # Hook: PreToolUse for MCP mutation tools
5
4
  # Purpose: Warn once per session if a legacy .codebyplan.json exists at repo root (post-CHK-120).
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Hook: PostToolUse mcp__codebyplan__complete_round
4
3
  # Purpose: After complete_round succeeds, delegate git-diff drift merge,
5
4
  # staging-status flip, and web-UI flag sync to the codebyplan CLI.
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Hook: universal plugin-script dispatcher
4
3
  # Purpose: Resolve a plugin-shipped hook/statusLine script path with auto-detect fallback.
5
4
  # Workaround: ${CLAUDE_PLUGIN_ROOT} is set in the plugin's own hook context but may not
@@ -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: Block git commits that violate greenfield-lint-zero-warnings,
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Hook: SessionStart
4
3
  # Purpose: Hydrate .codebyplan/state/ via `codebyplan sync` and ensure the
5
4
  # per-worktree watch daemon is running. Hook-safe: all errors
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- // @scope: org-shared
3
2
  // @hook: NOT-A-HOOK (statusLine renderer, invoked via the cbp-statusline.sh dispatcher)
4
3
  // Claude Code Status Line — node renderer (ESM; .mjs forces ESM regardless of the
5
4
  // host repo's package.json "type", so the script is portable into any consumer).
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env python3
2
- # @scope: org-shared
3
2
  # @hook: NOT-A-HOOK (statusLine renderer, invoked via the cbp-statusline.sh dispatcher)
4
3
  # Claude Code Status Line — python renderer.
5
4
  # Byte-identical output to the bash renderer in cbp-statusline.sh and the node
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # @hook: NOT-A-HOOK (statusLine renderer, invoked by settings.json statusLine.command)
4
3
  # Claude Code Status Line — multi-runtime dispatcher + bash renderer
5
4
  # Purpose: Renders up to 6 structured lines of Claude Code status from stdin JSON.
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- // @scope: org-shared
3
2
  // @hook: NOT-A-HOOK (subagentStatusLine renderer, invoked via the cbp-subagent-statusline.sh dispatcher)
4
3
  // Claude Code Subagent Status Line — node renderer (ESM; .mjs forces ESM regardless
5
4
  // of the host repo's package.json "type"). Byte-identical output to the bash renderer
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env python3
2
- # @scope: org-shared
3
2
  # @hook: NOT-A-HOOK (subagentStatusLine renderer, invoked via the cbp-subagent-statusline.sh dispatcher)
4
3
  # Claude Code Subagent Status Line — python renderer. Byte-identical output to the
5
4
  # bash renderer in cbp-subagent-statusline.sh and the node renderer in
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Portability: bash 3.2+ (macOS default /bin/bash). UTF-8 multibyte chars in
4
3
  # user-controlled fields are byte-iterated under 3.2 (over-counts visible width
5
4
  # for non-ASCII content); acceptable safe-direction approximation — and the node
@@ -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: Block git commits when new source files lack test companions
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # @hook: NOT-A-HOOK (test suite for plugin hooks; invoked by cbp-auto-test-hooks.sh)
4
3
  # Purpose: Test suite for plugin's shipped hooks. Invoked by cbp-auto-test-hooks.sh whenever a
5
4
  # plugin hook file is edited. Not a PreToolUse/PostToolUse/Notification hook itself —
@@ -1,5 +1,4 @@
1
1
  #!/bin/bash
2
- # @scope: org-shared
3
2
  # Hook Helper: Context file usage validation for validate-structure.sh
4
3
  # Purpose: Ensure context files are referenced by at least one agent or skill
5
4
  # Sourced by validate-structure.sh - not run directly