@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,98 @@
|
|
|
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: 24
|
|
7
|
+
# do_not_edit_directly: update via `caws init --agent-surface claude-code`
|
|
8
|
+
#
|
|
9
|
+
# CAWS Secret Scanner for Claude Code
|
|
10
|
+
#
|
|
11
|
+
# Advisory-only: emits a hookSpecificOutput warning when a tool call
|
|
12
|
+
# touches files or directories that commonly contain secrets (.env*,
|
|
13
|
+
# *.pem, *.key, SSH keys, cloud-provider config dirs, etc.).
|
|
14
|
+
#
|
|
15
|
+
# Does NOT block. The agent is responsible for redacting sensitive
|
|
16
|
+
# values from its response. Promoted from Sterling per
|
|
17
|
+
# CAWS-HOOK-PACK-PROMOTE-001.
|
|
18
|
+
|
|
19
|
+
set -euo pipefail
|
|
20
|
+
|
|
21
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
22
|
+
# shellcheck source=lib/parse-input.sh
|
|
23
|
+
source "$SCRIPT_DIR/lib/parse-input.sh"
|
|
24
|
+
parse_hook_input
|
|
25
|
+
|
|
26
|
+
FILE_PATH="$HOOK_FILE_PATH"
|
|
27
|
+
|
|
28
|
+
if [[ -z "$FILE_PATH" ]]; then
|
|
29
|
+
exit 0
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Get just the filename for pattern matching
|
|
33
|
+
FILENAME=$(basename "$FILE_PATH")
|
|
34
|
+
|
|
35
|
+
# Files that commonly contain secrets
|
|
36
|
+
SECRET_FILE_PATTERNS=(
|
|
37
|
+
'.env'
|
|
38
|
+
'.env.local'
|
|
39
|
+
'.env.production'
|
|
40
|
+
'.env.development'
|
|
41
|
+
'.env.*'
|
|
42
|
+
'credentials.json'
|
|
43
|
+
'service-account.json'
|
|
44
|
+
'secrets.yaml'
|
|
45
|
+
'secrets.yml'
|
|
46
|
+
'secrets.json'
|
|
47
|
+
'.netrc'
|
|
48
|
+
'.npmrc'
|
|
49
|
+
'.pypirc'
|
|
50
|
+
'id_rsa'
|
|
51
|
+
'id_ed25519'
|
|
52
|
+
'id_ecdsa'
|
|
53
|
+
'*.pem'
|
|
54
|
+
'*.key'
|
|
55
|
+
'*.p12'
|
|
56
|
+
'*.pfx'
|
|
57
|
+
'htpasswd'
|
|
58
|
+
'shadow'
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# Directories that commonly contain secrets
|
|
62
|
+
SECRET_DIRS=(
|
|
63
|
+
'.ssh'
|
|
64
|
+
'.aws'
|
|
65
|
+
'.azure'
|
|
66
|
+
'.gcloud'
|
|
67
|
+
'.kube'
|
|
68
|
+
'.gnupg'
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# Check if file matches secret patterns
|
|
72
|
+
for pattern in "${SECRET_FILE_PATTERNS[@]}"; do
|
|
73
|
+
if [[ "$FILENAME" == $pattern ]]; then
|
|
74
|
+
echo '{
|
|
75
|
+
"hookSpecificOutput": {
|
|
76
|
+
"hookEventName": "PreToolUse",
|
|
77
|
+
"additionalContext": "WARNING: This file may contain secrets. Do not include sensitive values in your response. If you need to reference credentials, use placeholders like <API_KEY> instead of actual values."
|
|
78
|
+
}
|
|
79
|
+
}'
|
|
80
|
+
exit 0
|
|
81
|
+
fi
|
|
82
|
+
done
|
|
83
|
+
|
|
84
|
+
# Check if file is in a sensitive directory
|
|
85
|
+
for dir in "${SECRET_DIRS[@]}"; do
|
|
86
|
+
if [[ "$FILE_PATH" == *"/$dir/"* ]] || [[ "$FILE_PATH" == *"/$dir" ]]; then
|
|
87
|
+
echo '{
|
|
88
|
+
"hookSpecificOutput": {
|
|
89
|
+
"hookEventName": "PreToolUse",
|
|
90
|
+
"additionalContext": "WARNING: This file is in a sensitive directory that may contain secrets. Do not include any sensitive values in your response."
|
|
91
|
+
}
|
|
92
|
+
}'
|
|
93
|
+
exit 0
|
|
94
|
+
fi
|
|
95
|
+
done
|
|
96
|
+
|
|
97
|
+
# Allow the read
|
|
98
|
+
exit 0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# CAWS-MANAGED-HOOK
|
|
3
3
|
# hook_pack: claude-code
|
|
4
|
-
# hook_pack_version:
|
|
4
|
+
# hook_pack_version: 11
|
|
5
5
|
# caws_min_major: 11
|
|
6
6
|
# lineage_refs: 8,11,12,16
|
|
7
7
|
# do_not_edit_directly: update via `caws init --agent-surface claude-code`
|
|
@@ -130,15 +130,20 @@ if [[ "$WORK_DIR" =~ \/\.caws\/worktrees\/([^/]+)$ ]]; then
|
|
|
130
130
|
WORKTREE_NAME="${BASH_REMATCH[1]}"
|
|
131
131
|
fi
|
|
132
132
|
|
|
133
|
+
# CAWS-LITE-MODE-RETIREMENT-001: lite mode (scope.json without specs/)
|
|
134
|
+
# was removed in pack v8. v11 projects only have .caws/specs/; lite-mode
|
|
135
|
+
# .caws/scope.json is a v10 artifact. Consumers with a legacy
|
|
136
|
+
# .caws/scope.json get a doctor finding (not a hook branch).
|
|
133
137
|
if [[ -d "$WORK_DIR/.caws/specs" ]]; then
|
|
134
|
-
SCOPE_FILE="$WORK_DIR/.caws/scope.json"
|
|
135
138
|
SPECS_BASE="$WORK_DIR"
|
|
136
139
|
else
|
|
137
|
-
SCOPE_FILE="$PROJECT_DIR/.caws/scope.json"
|
|
138
140
|
SPECS_BASE="$PROJECT_DIR"
|
|
139
141
|
fi
|
|
140
142
|
|
|
141
|
-
|
|
143
|
+
# No specs directory means no v11 governance to enforce. Pre-v8 this
|
|
144
|
+
# branch would fall through to the lite-mode scope.json path; v8+ it
|
|
145
|
+
# is a clean no-op.
|
|
146
|
+
if [[ ! -d "$SPECS_BASE/.caws/specs" ]]; then
|
|
142
147
|
exit 0
|
|
143
148
|
fi
|
|
144
149
|
|
|
@@ -159,73 +164,50 @@ for prefix in "${ALLOW_PREFIXES[@]}"; do
|
|
|
159
164
|
fi
|
|
160
165
|
done
|
|
161
166
|
|
|
162
|
-
# Lite mode
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
var path = require('path');
|
|
168
|
-
try {
|
|
169
|
-
var scope = JSON.parse(fs.readFileSync('$SCOPE_FILE', 'utf8'));
|
|
170
|
-
var filePath = '$REL_PATH';
|
|
171
|
-
var dirs = scope.allowedDirectories || [];
|
|
172
|
-
var banned = scope.bannedPatterns || {};
|
|
173
|
-
|
|
174
|
-
var basename = path.basename(filePath);
|
|
175
|
-
var bannedFiles = banned.files || [];
|
|
176
|
-
for (var i = 0; i < bannedFiles.length; i++) {
|
|
177
|
-
var regex = new RegExp(bannedFiles[i].replace(/\\*/g, '.*').replace(/\\?/g, '.'));
|
|
178
|
-
if (regex.test(basename)) {
|
|
179
|
-
console.log('banned:' + bannedFiles[i]);
|
|
180
|
-
process.exit(0);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
var bannedDocs = banned.docs || [];
|
|
185
|
-
for (var i = 0; i < bannedDocs.length; i++) {
|
|
186
|
-
var regex = new RegExp(bannedDocs[i].replace(/\\*/g, '.*').replace(/\\?/g, '.'));
|
|
187
|
-
if (regex.test(basename)) {
|
|
188
|
-
console.log('banned:' + bannedDocs[i]);
|
|
189
|
-
process.exit(0);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
167
|
+
# CAWS-LITE-MODE-RETIREMENT-001: the v10 "Lite mode" branch
|
|
168
|
+
# (`.caws/scope.json` without `.caws/specs/`) was removed in pack v8.
|
|
169
|
+
# A consumer upgrading from v10 with a legacy `.caws/scope.json` on
|
|
170
|
+
# disk now gets a doctor finding instead — the hook no longer has a
|
|
171
|
+
# silent fallback behavior that disagrees with `caws doctor`.
|
|
192
172
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
var found = false;
|
|
196
|
-
for (var i = 0; i < dirs.length; i++) {
|
|
197
|
-
var d = dirs[i].replace(/\\/$/, '');
|
|
198
|
-
if (normalized.startsWith(d + '/') || normalized === d) { found = true; break; }
|
|
199
|
-
}
|
|
200
|
-
if (!found) {
|
|
201
|
-
console.log('not_allowed');
|
|
202
|
-
process.exit(0);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
console.log('allowed');
|
|
206
|
-
} catch (error) {
|
|
207
|
-
console.log('error:' + error.message);
|
|
208
|
-
}
|
|
209
|
-
" 2>&1)
|
|
210
|
-
|
|
211
|
-
if [[ "$LITE_CHECK" == banned:* ]]; then
|
|
212
|
-
PATTERN="${LITE_CHECK#banned:}"
|
|
213
|
-
emit_scope_progression "This file matches banned pattern '$PATTERN' in .caws/scope.json."
|
|
214
|
-
exit 0
|
|
215
|
-
fi
|
|
216
|
-
|
|
217
|
-
if [[ "$LITE_CHECK" == "not_allowed" ]]; then
|
|
218
|
-
emit_scope_progression "This file is outside the allowed directories in .caws/scope.json."
|
|
219
|
-
exit 0
|
|
220
|
-
fi
|
|
173
|
+
# Full mode: per-feature specs under .caws/specs/ (v11-shape aware)
|
|
174
|
+
SPECS_DIR="$SPECS_BASE/.caws/specs"
|
|
221
175
|
|
|
176
|
+
# CAWS-SCOPE-STRIKE-SOURCE-UNIFY-001: delegate to `caws scope check`
|
|
177
|
+
# (the kernel-backed authority) before falling back to the inline node
|
|
178
|
+
# block below. This guarantees the hook's ADMIT/REFUSE decision matches
|
|
179
|
+
# what `caws scope show <path>` would report — the spec's invariant 1.
|
|
180
|
+
#
|
|
181
|
+
# Why it matters: when the kernel says ADMIT for a path, this hook exits
|
|
182
|
+
# 0 immediately without invoking `emit_scope_progression`. That means
|
|
183
|
+
# strikes do NOT increment, even if the path was previously rejected by
|
|
184
|
+
# an earlier scope decision (e.g., before a `scope.in` amendment landed).
|
|
185
|
+
# This auto-invalidates stale strike state by treating the current
|
|
186
|
+
# kernel decision as the only authority — the spec's invariant 2 and A1.
|
|
187
|
+
#
|
|
188
|
+
# Fall-through to the inline node block happens when:
|
|
189
|
+
# (a) `caws` is not on PATH (e.g. a non-global install during early
|
|
190
|
+
# bootstrap), OR
|
|
191
|
+
# (b) `caws scope check` exits non-zero AND we need the inline node
|
|
192
|
+
# logic to compute the structured diagnostic (out_of_scope vs
|
|
193
|
+
# not_in_scope, the union/authoritative mode label, the
|
|
194
|
+
# offending pattern) for emit_scope_progression's user-facing
|
|
195
|
+
# message. The inline node block is the SAME logic the kernel
|
|
196
|
+
# runs, evaluated on the same YAML — so they must agree on
|
|
197
|
+
# REFUSE shape too.
|
|
198
|
+
if command -v caws >/dev/null 2>&1; then
|
|
199
|
+
if caws scope check "$REL_PATH" >/dev/null 2>&1; then
|
|
200
|
+
# Kernel-authoritative ADMIT. Skip strike counter entirely.
|
|
222
201
|
exit 0
|
|
223
202
|
fi
|
|
203
|
+
# Kernel-authoritative REFUSE. The exact diagnostic still comes from
|
|
204
|
+
# the inline node block below (it parses scope.out vs scope.in miss
|
|
205
|
+
# vs union vs authoritative, all data the kernel knows but doesn't
|
|
206
|
+
# expose via `caws scope check`'s exit code). Future work: have
|
|
207
|
+
# `caws scope check --explain` emit the structured detail so the
|
|
208
|
+
# fallback inline node block can be deleted entirely.
|
|
224
209
|
fi
|
|
225
210
|
|
|
226
|
-
# Full mode: per-feature specs under .caws/specs/ (v11-shape aware)
|
|
227
|
-
SPECS_DIR="$SPECS_BASE/.caws/specs"
|
|
228
|
-
|
|
229
211
|
if command -v node >/dev/null 2>&1; then
|
|
230
212
|
SCOPE_CHECK=$(node -e "
|
|
231
213
|
var yaml = require('js-yaml');
|