codebyplan 1.13.45 → 1.13.48
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.
- package/dist/cli.js +33 -13
- package/package.json +1 -1
- package/templates/agents/cbp-cc-executor.md +0 -1
- package/templates/agents/cbp-database-agent.md +0 -1
- package/templates/agents/cbp-e2e-maestro.md +0 -1
- package/templates/agents/cbp-e2e-playwright.md +0 -1
- package/templates/agents/cbp-e2e-tauri.md +0 -1
- package/templates/agents/cbp-e2e-vscode.md +0 -1
- package/templates/agents/cbp-e2e-xcuitest.md +0 -1
- package/templates/agents/cbp-improve-claude.md +0 -1
- package/templates/agents/cbp-improve-round.md +0 -1
- package/templates/agents/cbp-map-architecture.md +0 -1
- package/templates/agents/cbp-mechanical-edits.md +0 -1
- package/templates/agents/cbp-research.md +0 -1
- package/templates/agents/cbp-round-executor.md +0 -1
- package/templates/agents/cbp-security-agent.md +0 -1
- package/templates/agents/cbp-task-check.md +0 -1
- package/templates/agents/cbp-task-planner.md +0 -1
- package/templates/agents/cbp-testing-qa-agent.md +0 -1
- package/templates/github-workflows/publish.yml +3 -5
- package/templates/hooks/cbp-auto-test-hooks.sh +0 -1
- package/templates/hooks/cbp-canonical-templates-nudge.sh +0 -1
- package/templates/hooks/cbp-context-window-notify.sh +0 -1
- package/templates/hooks/cbp-e2e-spec-patterns.sh +0 -1
- package/templates/hooks/cbp-lint-format-on-edit.sh +0 -1
- package/templates/hooks/cbp-maestro-yaml-validate.sh +0 -1
- package/templates/hooks/cbp-mcp-caller-worktree-inject.sh +0 -1
- package/templates/hooks/cbp-mcp-migration-guard.sh +0 -1
- package/templates/hooks/cbp-mcp-round-sync.sh +0 -1
- package/templates/hooks/cbp-plugin-dispatch.sh +0 -1
- package/templates/hooks/cbp-pre-commit-quality-gate.sh +0 -1
- package/templates/hooks/cbp-session-start-hook.sh +0 -1
- package/templates/hooks/cbp-statusline.mjs +0 -1
- package/templates/hooks/cbp-statusline.py +0 -1
- package/templates/hooks/cbp-statusline.sh +0 -1
- package/templates/hooks/cbp-subagent-statusline.mjs +0 -1
- package/templates/hooks/cbp-subagent-statusline.py +0 -1
- package/templates/hooks/cbp-subagent-statusline.sh +0 -1
- package/templates/hooks/cbp-test-coverage-gate.sh +0 -1
- package/templates/hooks/cbp-test-hooks.sh +0 -1
- package/templates/hooks/validate-context-usage.sh +0 -1
- package/templates/hooks/validate-git-commit.sh +57 -9
- package/templates/hooks/validate-git-stash-deny.sh +0 -1
- package/templates/hooks/validate-structure-lengths.sh +0 -1
- package/templates/hooks/validate-structure-lib.sh +17 -1
- package/templates/hooks/validate-structure-patterns.sh +0 -1
- package/templates/hooks/validate-structure-scope.sh +43 -11
- package/templates/hooks/validate-structure-smoke.sh +0 -1
- package/templates/hooks/validate-structure-templates.sh +0 -1
- package/templates/hooks/validate-structure.sh +0 -1
- package/templates/hooks/verify-parity.sh +0 -1
- package/templates/rules/agent-claim-verification.md +0 -1
- package/templates/rules/architecture-map.md +0 -4
- package/templates/rules/cbp-operating-gotchas.md +0 -4
- package/templates/rules/context-file-loading.md +0 -1
- package/templates/rules/e2e-mandatory.md +0 -4
- package/templates/rules/parallel-waves.md +0 -1
- package/templates/rules/scope-vocabulary.md +14 -10
- package/templates/rules/supabase-branch-lifecycle.md +0 -1
- package/templates/rules/todo-backend.md +0 -1
- package/templates/skills/cbp-build-cc-agent/SKILL.md +2 -3
- package/templates/skills/cbp-build-cc-agent/reference/cbp-quality.md +6 -8
- package/templates/skills/cbp-build-cc-agent/scripts/validate-agent.sh +10 -1
- package/templates/skills/cbp-build-cc-claude-file/SKILL.md +0 -1
- package/templates/skills/cbp-build-cc-claude-file/scripts/validate-claude-file.sh +0 -1
- package/templates/skills/cbp-build-cc-mode/SKILL.md +0 -1
- package/templates/skills/cbp-build-cc-rule/SKILL.md +18 -8
- package/templates/skills/cbp-build-cc-rule/scripts/validate-rule.sh +4 -5
- package/templates/skills/cbp-build-cc-settings/SKILL.md +0 -1
- package/templates/skills/cbp-build-cc-settings/reference/cbp-conventions.md +0 -4
- package/templates/skills/cbp-build-cc-settings/scripts/validate-settings.sh +0 -1
- package/templates/skills/cbp-build-cc-skill/SKILL.md +0 -1
- package/templates/skills/cbp-build-cc-skill/reference/cbp-quality.md +6 -8
- package/templates/skills/cbp-build-cc-skill/scripts/validate-skill.sh +10 -2
- package/templates/skills/cbp-checkpoint-check/SKILL.md +0 -1
- package/templates/skills/cbp-checkpoint-complete/SKILL.md +0 -1
- package/templates/skills/cbp-checkpoint-create/SKILL.md +10 -11
- package/templates/skills/cbp-checkpoint-end/SKILL.md +0 -1
- package/templates/skills/cbp-checkpoint-plan/SKILL.md +0 -1
- package/templates/skills/cbp-checkpoint-plan/reference/alternative-comparison-template.md +0 -4
- package/templates/skills/cbp-checkpoint-plan/reference/dep-decision-rubric.md +0 -4
- package/templates/skills/cbp-checkpoint-plan/reference/e2e-discovery-probe.md +0 -4
- package/templates/skills/cbp-checkpoint-plan/reference/gap-analysis-playbook.md +0 -4
- package/templates/skills/cbp-checkpoint-start/SKILL.md +0 -1
- package/templates/skills/cbp-checkpoint-update/SKILL.md +0 -1
- package/templates/skills/cbp-frontend-a11y/SKILL.md +0 -1
- package/templates/skills/cbp-frontend-design/SKILL.md +0 -1
- package/templates/skills/cbp-frontend-ui/SKILL.md +0 -1
- package/templates/skills/cbp-frontend-ux/SKILL.md +0 -1
- package/templates/skills/cbp-git-branch-feat-create/SKILL.md +0 -1
- package/templates/skills/cbp-git-commit/SKILL.md +0 -1
- package/templates/skills/cbp-git-worktree-create/SKILL.md +0 -1
- package/templates/skills/cbp-git-worktree-remove/SKILL.md +0 -1
- package/templates/skills/cbp-map-architecture/SKILL.md +0 -1
- package/templates/skills/cbp-merge-main/SKILL.md +0 -1
- package/templates/skills/cbp-refresh-arch-map/SKILL.md +0 -1
- package/templates/skills/cbp-round-check/SKILL.md +0 -1
- package/templates/skills/cbp-round-complete/SKILL.md +0 -1
- package/templates/skills/cbp-round-end/SKILL.md +0 -1
- package/templates/skills/cbp-round-execute/SKILL.md +0 -1
- package/templates/skills/cbp-round-execute/reference/inline-fallback.md +0 -4
- package/templates/skills/cbp-round-input/SKILL.md +0 -1
- package/templates/skills/cbp-round-start/SKILL.md +0 -1
- package/templates/skills/cbp-round-update/SKILL.md +0 -1
- package/templates/skills/cbp-session-end/SKILL.md +0 -1
- package/templates/skills/cbp-session-start/SKILL.md +0 -1
- package/templates/skills/cbp-session-start/qa-regression.md +0 -1
- package/templates/skills/cbp-setup-e2e/SKILL.md +0 -1
- package/templates/skills/cbp-setup-eslint/SKILL.md +0 -1
- package/templates/skills/cbp-ship/SKILL.md +0 -1
- package/templates/skills/cbp-ship-configure/SKILL.md +0 -1
- package/templates/skills/cbp-ship-main/SKILL.md +0 -1
- package/templates/skills/cbp-supabase-branch-check/SKILL.md +0 -1
- package/templates/skills/cbp-supabase-branch-check/reference/dag-steps.md +0 -4
- package/templates/skills/cbp-supabase-migrate/SKILL.md +0 -1
- package/templates/skills/cbp-supabase-setup/SKILL.md +0 -1
- package/templates/skills/cbp-task-check/SKILL.md +0 -1
- package/templates/skills/cbp-task-complete/SKILL.md +0 -1
- package/templates/skills/cbp-task-create/SKILL.md +0 -1
- package/templates/skills/cbp-task-start/SKILL.md +0 -1
- package/templates/skills/cbp-task-testing/SKILL.md +0 -1
- package/templates/skills/cbp-todo/SKILL.md +0 -1
- package/templates/skills/cbp-todo/qa-regression.md +0 -1
- package/templates/skills/supabase/SKILL.md +0 -1
- 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.
|
|
42
|
+
VERSION = "1.13.48";
|
|
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
|
-
|
|
35162
|
-
|
|
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
|
-
|
|
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
|
|
35191
|
-
|
|
35197
|
+
const allScopeItems = [];
|
|
35198
|
+
const parityItems = [];
|
|
35199
|
+
allScopeItems.push(...checkScopeMarkers({ claudeDir, templatesDir }));
|
|
35192
35200
|
if (templatesDir != null && fs11.existsSync(templatesDir)) {
|
|
35193
|
-
|
|
35201
|
+
parityItems.push(
|
|
35194
35202
|
...checkSiblingParity({ claudeDir, templatesDir, expectedOneSided })
|
|
35195
35203
|
);
|
|
35196
35204
|
}
|
|
35197
|
-
|
|
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(
|
|
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,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
|
|
@@ -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-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-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
|
|
@@ -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
|
|
@@ -93,8 +93,7 @@ jobs:
|
|
|
93
93
|
case "$VERSION" in
|
|
94
94
|
*-*)
|
|
95
95
|
# Prerelease — check if this exact version already exists on npm.
|
|
96
|
-
EXACT_OUT=$(npm view "codebyplan@${VERSION}" version 2>&1)
|
|
97
|
-
EXACT_EXIT=$?
|
|
96
|
+
EXACT_OUT=$(npm view "codebyplan@${VERSION}" version 2>&1) && EXACT_EXIT=0 || EXACT_EXIT=$?
|
|
98
97
|
if [ "$EXACT_EXIT" -eq 0 ]; then
|
|
99
98
|
echo "VERSION=${VERSION} already published — skipping (exact-version guard)."
|
|
100
99
|
echo "should_publish=false" >> "$GITHUB_OUTPUT"
|
|
@@ -134,8 +133,7 @@ jobs:
|
|
|
134
133
|
# Stable on main: compare committed version against the npm registry.
|
|
135
134
|
# Distinguish "never published" (E404 → first publish) from a transient
|
|
136
135
|
# registry/network error (abort rather than blindly publish).
|
|
137
|
-
NPM_OUT=$(npm view codebyplan version 2>&1)
|
|
138
|
-
NPM_EXIT=$?
|
|
136
|
+
NPM_OUT=$(npm view codebyplan version 2>&1) && NPM_EXIT=0 || NPM_EXIT=$?
|
|
139
137
|
if [ "$NPM_EXIT" -ne 0 ]; then
|
|
140
138
|
if echo "$NPM_OUT" | grep -q "E404"; then
|
|
141
139
|
echo "Package not yet published — first publish."
|
|
@@ -147,7 +145,7 @@ jobs:
|
|
|
147
145
|
fi
|
|
148
146
|
# Extract the first semver-looking line so a registry deprecation/advisory
|
|
149
147
|
# notice in NPM_OUT cannot corrupt the sort -V comparison below.
|
|
150
|
-
PUBLISHED=$(printf '%s\n' "$NPM_OUT" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+' | head -n1)
|
|
148
|
+
PUBLISHED=$(printf '%s\n' "$NPM_OUT" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+' | head -n1) || true
|
|
151
149
|
|
|
152
150
|
# sort -V: version-aware sort. If VERSION sorts AFTER PUBLISHED, it is greater.
|
|
153
151
|
GREATER=$(printf '%s\n%s\n' "$PUBLISHED" "$VERSION" | sort -V | tail -n1)
|
|
@@ -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
|
#!/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
|
#!/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: 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: 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
|
-
#
|
|
37
|
-
#
|
|
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
|
-
#
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
|
|
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 "$
|
|
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 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
|
+
}
|