@paths.design/caws-cli 11.1.7 → 11.1.8
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/index.js +55 -58
- package/dist/init/hook-packs/manifest-claude-code.d.ts +1 -1
- package/dist/init/hook-packs/manifest-claude-code.d.ts.map +1 -1
- package/dist/init/hook-packs/manifest-claude-code.js +260 -2
- package/dist/init/hook-packs/manifest-claude-code.js.map +1 -1
- package/dist/shell/binding/resolve-binding.d.ts.map +1 -1
- package/dist/shell/binding/resolve-binding.js +105 -1
- package/dist/shell/binding/resolve-binding.js.map +1 -1
- package/dist/shell/binding/types.d.ts +47 -3
- package/dist/shell/binding/types.d.ts.map +1 -1
- package/dist/shell/command-metadata.d.ts +93 -0
- package/dist/shell/command-metadata.d.ts.map +1 -0
- package/dist/shell/command-metadata.js +687 -0
- package/dist/shell/command-metadata.js.map +1 -0
- package/dist/shell/commands/agents.d.ts +1 -2
- package/dist/shell/commands/agents.d.ts.map +1 -1
- package/dist/shell/commands/claim.d.ts +16 -0
- package/dist/shell/commands/claim.d.ts.map +1 -1
- package/dist/shell/commands/claim.js +85 -26
- package/dist/shell/commands/claim.js.map +1 -1
- package/dist/shell/commands/events.d.ts +106 -0
- package/dist/shell/commands/events.d.ts.map +1 -0
- package/dist/shell/commands/events.js +510 -0
- package/dist/shell/commands/events.js.map +1 -0
- package/dist/shell/commands/gates.d.ts +2 -2
- package/dist/shell/commands/gates.d.ts.map +1 -1
- package/dist/shell/commands/gates.js +106 -25
- package/dist/shell/commands/gates.js.map +1 -1
- package/dist/shell/commands/init.d.ts.map +1 -1
- package/dist/shell/commands/init.js +26 -0
- package/dist/shell/commands/init.js.map +1 -1
- package/dist/shell/commands/prepush.d.ts +26 -0
- package/dist/shell/commands/prepush.d.ts.map +1 -0
- package/dist/shell/commands/prepush.js +373 -0
- package/dist/shell/commands/prepush.js.map +1 -0
- package/dist/shell/commands/scope.d.ts.map +1 -1
- package/dist/shell/commands/scope.js +31 -1
- package/dist/shell/commands/scope.js.map +1 -1
- package/dist/shell/commands/specs.d.ts +44 -3
- package/dist/shell/commands/specs.d.ts.map +1 -1
- package/dist/shell/commands/specs.js +411 -15
- package/dist/shell/commands/specs.js.map +1 -1
- package/dist/shell/commands/worktree.d.ts.map +1 -1
- package/dist/shell/commands/worktree.js +51 -1
- package/dist/shell/commands/worktree.js.map +1 -1
- package/dist/shell/gates/disposition.d.ts.map +1 -1
- package/dist/shell/gates/disposition.js +43 -2
- package/dist/shell/gates/disposition.js.map +1 -1
- package/dist/shell/index.d.ts +10 -4
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +22 -2
- package/dist/shell/index.js.map +1 -1
- package/dist/shell/legacy-command-map.js +832 -0
- package/dist/shell/push-range/classify-range.d.ts +99 -0
- package/dist/shell/push-range/classify-range.d.ts.map +1 -0
- package/dist/shell/push-range/classify-range.js +155 -0
- package/dist/shell/push-range/classify-range.js.map +1 -0
- package/dist/shell/push-range/scope-match.d.ts +13 -0
- package/dist/shell/push-range/scope-match.d.ts.map +1 -0
- package/dist/shell/push-range/scope-match.js +53 -0
- package/dist/shell/push-range/scope-match.js.map +1 -0
- package/dist/shell/register.d.ts.map +1 -1
- package/dist/shell/register.js +263 -228
- package/dist/shell/register.js.map +1 -1
- package/dist/shell/registered-command-groups.js +48 -0
- package/dist/shell/rules.d.ts +19 -0
- package/dist/shell/rules.d.ts.map +1 -1
- package/dist/shell/rules.js +27 -0
- package/dist/shell/rules.js.map +1 -1
- package/dist/shell/session/resolve-session.d.ts +29 -1
- package/dist/shell/session/resolve-session.d.ts.map +1 -1
- package/dist/shell/session/resolve-session.js +817 -11
- package/dist/shell/session/resolve-session.js.map +1 -1
- package/dist/shell/session/types.d.ts +127 -1
- package/dist/shell/session/types.d.ts.map +1 -1
- package/dist/shell/session/types.js +10 -4
- package/dist/shell/session/types.js.map +1 -1
- package/dist/store/doctor-snapshot.d.ts.map +1 -1
- package/dist/store/doctor-snapshot.js +26 -0
- package/dist/store/doctor-snapshot.js.map +1 -1
- package/dist/store/events-migration.d.ts +207 -0
- package/dist/store/events-migration.d.ts.map +1 -0
- package/dist/store/events-migration.js +358 -0
- package/dist/store/events-migration.js.map +1 -0
- package/dist/store/events-store.d.ts +47 -1
- package/dist/store/events-store.d.ts.map +1 -1
- package/dist/store/events-store.js +278 -0
- package/dist/store/events-store.js.map +1 -1
- package/dist/store/git-autocommit.d.ts +46 -0
- package/dist/store/git-autocommit.d.ts.map +1 -0
- package/dist/store/git-autocommit.js +198 -0
- package/dist/store/git-autocommit.js.map +1 -0
- package/dist/store/index.d.ts +4 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +7 -1
- package/dist/store/index.js.map +1 -1
- package/dist/store/leases-store.d.ts.map +1 -1
- package/dist/store/leases-store.js +58 -0
- package/dist/store/leases-store.js.map +1 -1
- package/dist/store/rules.d.ts +53 -0
- package/dist/store/rules.d.ts.map +1 -1
- package/dist/store/rules.js +54 -0
- package/dist/store/rules.js.map +1 -1
- package/dist/store/specs-migration.d.ts +128 -0
- package/dist/store/specs-migration.d.ts.map +1 -0
- package/dist/store/specs-migration.js +481 -0
- package/dist/store/specs-migration.js.map +1 -0
- package/dist/store/specs-store.d.ts.map +1 -1
- package/dist/store/specs-store.js +14 -2
- package/dist/store/specs-store.js.map +1 -1
- package/dist/store/specs-writer.d.ts +130 -3
- package/dist/store/specs-writer.d.ts.map +1 -1
- package/dist/store/specs-writer.js +941 -102
- package/dist/store/specs-writer.js.map +1 -1
- package/dist/store/types.d.ts +6 -0
- package/dist/store/types.d.ts.map +1 -1
- package/dist/store/waivers-store.d.ts.map +1 -1
- package/dist/store/waivers-store.js +8 -1
- package/dist/store/waivers-store.js.map +1 -1
- package/dist/store/worktrees-writer.d.ts +28 -0
- package/dist/store/worktrees-writer.d.ts.map +1 -1
- package/dist/store/worktrees-writer.js +110 -12
- package/dist/store/worktrees-writer.js.map +1 -1
- package/package.json +5 -2
- package/templates/hook-packs/claude-code/CLAUDE.md +7 -1
- package/templates/hook-packs/claude-code/agent-heartbeat.sh +1 -1
- package/templates/hook-packs/claude-code/agent-register.sh +1 -1
- package/templates/hook-packs/claude-code/agent-stop.sh +1 -1
- package/templates/hook-packs/claude-code/audit.sh +1 -1
- package/templates/hook-packs/claude-code/block-dangerous.sh +1 -1
- package/templates/hook-packs/claude-code/classify_command.py +1 -1
- package/templates/hook-packs/claude-code/cwd-guard.sh +30 -0
- package/templates/hook-packs/claude-code/dispatch/post_tool_use.sh +15 -4
- package/templates/hook-packs/claude-code/dispatch/pre_tool_use.sh +10 -2
- package/templates/hook-packs/claude-code/dispatch/session_start.sh +1 -1
- package/templates/hook-packs/claude-code/dispatch/stop.sh +2 -2
- package/templates/hook-packs/claude-code/duplicate-export-check.sh +156 -0
- package/templates/hook-packs/claude-code/god-object-check.sh +102 -0
- package/templates/hook-packs/claude-code/guard-strikes.sh +1 -1
- package/templates/hook-packs/claude-code/lib/parse-input.sh +115 -1
- package/templates/hook-packs/claude-code/lib/run-handlers.sh +1 -1
- package/templates/hook-packs/claude-code/loc-delta-check.sh +91 -0
- package/templates/hook-packs/claude-code/naming-check.sh +128 -0
- package/templates/hook-packs/claude-code/plan-transcript-finalize.sh +59 -0
- package/templates/hook-packs/claude-code/plan-transcript-snapshot.sh +86 -0
- package/templates/hook-packs/claude-code/protected-paths.sh +59 -0
- package/templates/hook-packs/claude-code/quiet-merge.sh +68 -0
- package/templates/hook-packs/claude-code/reset-danger-latch.sh +1 -1
- package/templates/hook-packs/claude-code/reset-strikes.sh +1 -1
- package/templates/hook-packs/claude-code/runtime-paths.sh +1 -1
- package/templates/hook-packs/claude-code/scan-secrets.sh +98 -0
- package/templates/hook-packs/claude-code/scope-guard.sh +47 -65
- package/templates/hook-packs/claude-code/session-caws-status.sh +1 -1
- package/templates/hook-packs/claude-code/session-log.sh +1 -1
- package/templates/hook-packs/claude-code/session_log_renderer.py +956 -0
- package/templates/hook-packs/claude-code/shortcut-language-check.sh +147 -0
- package/templates/hook-packs/claude-code/worktree-guard.sh +1 -1
- package/templates/hook-packs/claude-code/worktree-write-guard.sh +1 -1
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CAWS-MANAGED-HOOK
|
|
3
|
+
# hook_pack: claude-code
|
|
4
|
+
# hook_pack_version: 11
|
|
5
|
+
# caws_min_major: 11
|
|
6
|
+
# lineage_refs: 29
|
|
7
|
+
# do_not_edit_directly: update via `caws init --agent-surface claude-code`
|
|
8
|
+
#
|
|
9
|
+
# CAWS Shortcut-Language Progressive Check (QG-HOOKS-EXTRACT-001)
|
|
10
|
+
#
|
|
11
|
+
# PostToolUse hook firing on Write/Edit. Flags "shortcut" / incomplete-work
|
|
12
|
+
# language in committed-bound source — the edit-time analogue of the
|
|
13
|
+
# quality-gates `todo_detection` gate
|
|
14
|
+
# (packages/quality-gates/todo-analyzer.mjs + check-placeholders.mjs). It
|
|
15
|
+
# re-implements the practical intent in self-contained bash: catch the agent
|
|
16
|
+
# leaving a TODO/FIXME/placeholder/"not implemented" stub in a NON-test source
|
|
17
|
+
# file.
|
|
18
|
+
#
|
|
19
|
+
# Unlike the other three advisory hooks, this one escalates via the existing
|
|
20
|
+
# progressive-strike mechanism (guard-strikes.sh):
|
|
21
|
+
# strike 1 -> warn (allow)
|
|
22
|
+
# strike 2 -> ask (permission prompt)
|
|
23
|
+
# strike 3 -> block
|
|
24
|
+
# Rationale: TODO/placeholder language in committed code is the CLAUDE.md
|
|
25
|
+
# "No fake implementations" rule; repeated offenses in a session warrant
|
|
26
|
+
# escalation, matching how scope-guard treats repeated scope violations.
|
|
27
|
+
#
|
|
28
|
+
# Test files (*.test.* / *.spec.*) are NOT strike-eligible: TODO/placeholder
|
|
29
|
+
# language in tests is routine (describing pending cases, fixture stubs).
|
|
30
|
+
#
|
|
31
|
+
# Patterns (case-insensitive) — only the high-signal subset of the
|
|
32
|
+
# todo-analyzer engine, kept to single-file grep for hook-time speed:
|
|
33
|
+
# \bTODO\b \bFIXME\b \bXXX\b \bHACK\b \bTBD\b
|
|
34
|
+
# "not implemented" "implement later" "coming soon" "placeholder"
|
|
35
|
+
# stub-return shapes: return null;? // TODO ; throw new Error("not implemented")
|
|
36
|
+
#
|
|
37
|
+
# env: none (strike count fixed at 3 via guard-strikes.sh).
|
|
38
|
+
|
|
39
|
+
set -uo pipefail
|
|
40
|
+
|
|
41
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
42
|
+
# shellcheck source=lib/parse-input.sh
|
|
43
|
+
source "$SCRIPT_DIR/lib/parse-input.sh" 2>/dev/null || exit 0
|
|
44
|
+
parse_hook_input || exit 0
|
|
45
|
+
# shellcheck source=guard-strikes.sh
|
|
46
|
+
source "$SCRIPT_DIR/guard-strikes.sh" 2>/dev/null || exit 0
|
|
47
|
+
|
|
48
|
+
FILE_PATH="$HOOK_FILE_PATH"
|
|
49
|
+
TOOL_NAME="$HOOK_TOOL_NAME"
|
|
50
|
+
|
|
51
|
+
case "$TOOL_NAME" in
|
|
52
|
+
Write | Edit) ;;
|
|
53
|
+
*) exit 0 ;;
|
|
54
|
+
esac
|
|
55
|
+
|
|
56
|
+
[[ -z "$FILE_PATH" ]] && exit 0
|
|
57
|
+
|
|
58
|
+
# Skip generated / vendored / build output.
|
|
59
|
+
case "$FILE_PATH" in
|
|
60
|
+
*/node_modules/* | */dist/* | */build/* | */coverage/* | */.next/* | */out/* | */vendor/*)
|
|
61
|
+
exit 0
|
|
62
|
+
;;
|
|
63
|
+
esac
|
|
64
|
+
|
|
65
|
+
# Skip non-source artifacts: markdown/docs and lockfiles routinely contain
|
|
66
|
+
# the word "placeholder"/"TODO" as prose. The hook targets code.
|
|
67
|
+
case "$(basename "$FILE_PATH")" in
|
|
68
|
+
*.md | *.markdown | *.txt | *.lock | *-lock.json | package-lock.json | *.min.js | *.bundle.js | *.map)
|
|
69
|
+
exit 0
|
|
70
|
+
;;
|
|
71
|
+
esac
|
|
72
|
+
|
|
73
|
+
# Test files are exempt from strikes (TODO/placeholder is routine in specs).
|
|
74
|
+
case "$FILE_PATH" in
|
|
75
|
+
*.test.* | *.spec.* | */tests/* | */__tests__/* | */test/* | */fixtures/*)
|
|
76
|
+
exit 0
|
|
77
|
+
;;
|
|
78
|
+
esac
|
|
79
|
+
|
|
80
|
+
# The content to scan: prefer the tool payload (works on untracked files and
|
|
81
|
+
# is exactly what the agent just wrote). Write -> .content; Edit -> .new_string.
|
|
82
|
+
CONTENT=""
|
|
83
|
+
if [[ -n "${HOOK_TOOL_INPUT_JSON:-}" ]] && command -v jq >/dev/null 2>&1; then
|
|
84
|
+
CONTENT=$(printf '%s' "$HOOK_TOOL_INPUT_JSON" | jq -r '.content // .new_string // empty' 2>/dev/null || printf '')
|
|
85
|
+
fi
|
|
86
|
+
# Fallback: read the file from disk if the payload had no content field.
|
|
87
|
+
if [[ -z "$CONTENT" ]] && [[ -f "$FILE_PATH" ]]; then
|
|
88
|
+
CONTENT=$(cat "$FILE_PATH" 2>/dev/null || printf '')
|
|
89
|
+
fi
|
|
90
|
+
[[ -z "$CONTENT" ]] && exit 0
|
|
91
|
+
|
|
92
|
+
# Match the high-signal patterns. grep -nE on the content via a here-string;
|
|
93
|
+
# -i case-insensitive. Word-boundary keywords first, then phrases, then
|
|
94
|
+
# stub-return shapes.
|
|
95
|
+
MATCH=""
|
|
96
|
+
PATTERN_DESC=""
|
|
97
|
+
|
|
98
|
+
# 1. Keyword markers (word-boundary).
|
|
99
|
+
if hit=$(printf '%s' "$CONTENT" | grep -nE '\b(TODO|FIXME|XXX|HACK|TBD)\b' 2>/dev/null | head -1); then
|
|
100
|
+
if [[ -n "$hit" ]]; then
|
|
101
|
+
MATCH="$hit"
|
|
102
|
+
PATTERN_DESC="incomplete-work marker (TODO/FIXME/XXX/HACK/TBD)"
|
|
103
|
+
fi
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
# 2. Placeholder / not-implemented phrases.
|
|
107
|
+
if [[ -z "$MATCH" ]]; then
|
|
108
|
+
if hit=$(printf '%s' "$CONTENT" | grep -niE 'not implemented|implement later|coming soon|placeholder' 2>/dev/null | head -1); then
|
|
109
|
+
if [[ -n "$hit" ]]; then
|
|
110
|
+
MATCH="$hit"
|
|
111
|
+
PATTERN_DESC="placeholder / not-implemented language"
|
|
112
|
+
fi
|
|
113
|
+
fi
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
# 3. Stub-return shapes (throw new Error("not implemented") is caught above;
|
|
117
|
+
# catch the bare "return null; // TODO" combo and an explicit stub throw).
|
|
118
|
+
if [[ -z "$MATCH" ]]; then
|
|
119
|
+
if hit=$(printf '%s' "$CONTENT" | grep -niE 'throw new Error\(["'"'"']not implemented' 2>/dev/null | head -1); then
|
|
120
|
+
if [[ -n "$hit" ]]; then
|
|
121
|
+
MATCH="$hit"
|
|
122
|
+
PATTERN_DESC="explicit not-implemented stub throw"
|
|
123
|
+
fi
|
|
124
|
+
fi
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
[[ -z "$MATCH" ]] && exit 0
|
|
128
|
+
|
|
129
|
+
# Trim the matched line for the message (strip leading whitespace, cap length).
|
|
130
|
+
LINE_TEXT=$(printf '%s' "$MATCH" | sed 's/^[0-9]*://; s/^[[:space:]]*//' | cut -c1-120)
|
|
131
|
+
|
|
132
|
+
BASE="Shortcut-language advisory in ${FILE_PATH}: ${PATTERN_DESC} — \"${LINE_TEXT}\". CAWS doctrine (\"No fake implementations\") asks for complete code in committed source, not TODO/placeholder stubs."
|
|
133
|
+
MSG1="${BASE} (strike 1 of 3 — advisory.)"
|
|
134
|
+
MSG2="${BASE} (strike 2 of 3 — please resolve before continuing.)"
|
|
135
|
+
MSG3="${BASE} (strike 3 — blocked. Replace the placeholder/stub with a real implementation, or move the work to a tracked spec.)"
|
|
136
|
+
|
|
137
|
+
guard_enforce_progressive_strikes \
|
|
138
|
+
"${HOOK_SESSION_ID:-unknown}" \
|
|
139
|
+
"shortcut_language" \
|
|
140
|
+
"${HOOK_CWD:-}" \
|
|
141
|
+
"$MSG1" "$MSG2" "$MSG3"
|
|
142
|
+
|
|
143
|
+
# guard_enforce_progressive_strikes emits the decision JSON. For strikes 1/2
|
|
144
|
+
# it is an allow/ask (exit 0). For strike 3 it emits a block decision; exit 0
|
|
145
|
+
# is correct for PostToolUse (the tool already ran) — the block decision in
|
|
146
|
+
# the JSON is what Claude Code honors.
|
|
147
|
+
exit 0
|