@paths.design/caws-cli 11.0.0 → 11.1.0
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/README.md +2 -2
- package/dist/index.js +2 -2
- package/dist/init/harness-detect.d.ts +18 -0
- package/dist/init/harness-detect.d.ts.map +1 -0
- package/dist/init/harness-detect.js +90 -0
- package/dist/init/harness-detect.js.map +1 -0
- package/dist/init/hook-install.d.ts +53 -0
- package/dist/init/hook-install.d.ts.map +1 -0
- package/dist/init/hook-install.js +421 -0
- package/dist/init/hook-install.js.map +1 -0
- package/dist/init/hook-packs/manifest-claude-code.d.ts +4 -0
- package/dist/init/hook-packs/manifest-claude-code.d.ts.map +1 -0
- package/dist/init/hook-packs/manifest-claude-code.js +190 -0
- package/dist/init/hook-packs/manifest-claude-code.js.map +1 -0
- package/dist/init/hook-packs/register.d.ts +19 -0
- package/dist/init/hook-packs/register.d.ts.map +1 -0
- package/dist/init/hook-packs/register.js +37 -0
- package/dist/init/hook-packs/register.js.map +1 -0
- package/dist/init/hook-packs/types.d.ts +123 -0
- package/dist/init/hook-packs/types.d.ts.map +1 -0
- package/dist/init/hook-packs/types.js +29 -0
- package/dist/init/hook-packs/types.js.map +1 -0
- package/dist/shell/commands/gates.d.ts.map +1 -1
- package/dist/shell/commands/gates.js +28 -1
- package/dist/shell/commands/gates.js.map +1 -1
- package/dist/shell/commands/init.d.ts +9 -0
- package/dist/shell/commands/init.d.ts.map +1 -1
- package/dist/shell/commands/init.js +131 -27
- package/dist/shell/commands/init.js.map +1 -1
- package/dist/shell/commands/specs.d.ts +41 -0
- package/dist/shell/commands/specs.d.ts.map +1 -0
- package/dist/shell/commands/specs.js +264 -0
- package/dist/shell/commands/specs.js.map +1 -0
- package/dist/shell/commands/worktree.d.ts +38 -0
- package/dist/shell/commands/worktree.d.ts.map +1 -0
- package/dist/shell/commands/worktree.js +286 -0
- package/dist/shell/commands/worktree.js.map +1 -0
- package/dist/shell/gates/disposition.d.ts.map +1 -1
- package/dist/shell/gates/disposition.js +33 -3
- package/dist/shell/gates/disposition.js.map +1 -1
- package/dist/shell/gates/local-evaluators/budget-limit.d.ts +24 -0
- package/dist/shell/gates/local-evaluators/budget-limit.d.ts.map +1 -0
- package/dist/shell/gates/local-evaluators/budget-limit.js +67 -0
- package/dist/shell/gates/local-evaluators/budget-limit.js.map +1 -0
- package/dist/shell/gates/local-evaluators/diff-helpers.d.ts +25 -0
- package/dist/shell/gates/local-evaluators/diff-helpers.d.ts.map +1 -0
- package/dist/shell/gates/local-evaluators/diff-helpers.js +74 -0
- package/dist/shell/gates/local-evaluators/diff-helpers.js.map +1 -0
- package/dist/shell/gates/local-evaluators/index.d.ts +28 -0
- package/dist/shell/gates/local-evaluators/index.d.ts.map +1 -0
- package/dist/shell/gates/local-evaluators/index.js +67 -0
- package/dist/shell/gates/local-evaluators/index.js.map +1 -0
- package/dist/shell/gates/local-evaluators/scope-boundary.d.ts +23 -0
- package/dist/shell/gates/local-evaluators/scope-boundary.d.ts.map +1 -0
- package/dist/shell/gates/local-evaluators/scope-boundary.js +67 -0
- package/dist/shell/gates/local-evaluators/scope-boundary.js.map +1 -0
- package/dist/shell/gates/local-evaluators/spec-completeness.d.ts +12 -0
- package/dist/shell/gates/local-evaluators/spec-completeness.d.ts.map +1 -0
- package/dist/shell/gates/local-evaluators/spec-completeness.js +73 -0
- package/dist/shell/gates/local-evaluators/spec-completeness.js.map +1 -0
- package/dist/shell/index.d.ts +4 -0
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +13 -1
- package/dist/shell/index.js.map +1 -1
- package/dist/shell/register.d.ts.map +1 -1
- package/dist/shell/register.js +192 -2
- package/dist/shell/register.js.map +1 -1
- package/dist/shell/render/init-hook-pack.d.ts +16 -0
- package/dist/shell/render/init-hook-pack.d.ts.map +1 -0
- package/dist/shell/render/init-hook-pack.js +206 -0
- package/dist/shell/render/init-hook-pack.js.map +1 -0
- package/dist/store/atomic-write.d.ts +20 -2
- package/dist/store/atomic-write.d.ts.map +1 -1
- package/dist/store/atomic-write.js +44 -2
- package/dist/store/atomic-write.js.map +1 -1
- package/dist/store/lifecycle-lock.d.ts +34 -0
- package/dist/store/lifecycle-lock.d.ts.map +1 -0
- package/dist/store/lifecycle-lock.js +168 -0
- package/dist/store/lifecycle-lock.js.map +1 -0
- package/dist/store/lifecycle-transaction.d.ts +79 -0
- package/dist/store/lifecycle-transaction.d.ts.map +1 -0
- package/dist/store/lifecycle-transaction.js +319 -0
- package/dist/store/lifecycle-transaction.js.map +1 -0
- package/dist/store/rules.d.ts +16 -0
- package/dist/store/rules.d.ts.map +1 -1
- package/dist/store/rules.js +17 -0
- package/dist/store/rules.js.map +1 -1
- package/dist/store/specs-writer.d.ts +61 -0
- package/dist/store/specs-writer.d.ts.map +1 -0
- package/dist/store/specs-writer.js +506 -0
- package/dist/store/specs-writer.js.map +1 -0
- package/dist/store/worktrees-writer.d.ts +77 -0
- package/dist/store/worktrees-writer.d.ts.map +1 -0
- package/dist/store/worktrees-writer.js +674 -0
- package/dist/store/worktrees-writer.js.map +1 -0
- package/dist/store/yaml-patch.d.ts +7 -0
- package/dist/store/yaml-patch.d.ts.map +1 -0
- package/dist/store/yaml-patch.js +250 -0
- package/dist/store/yaml-patch.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Claude Code hook pack manifest.
|
|
3
|
+
//
|
|
4
|
+
// Installs the v11-shape Claude Code hook plane into a repo. Activation
|
|
5
|
+
// requires a session restart in Claude Code: hook registration is read at
|
|
6
|
+
// session start, so installing mid-session does not affect the current
|
|
7
|
+
// session's tool calls.
|
|
8
|
+
//
|
|
9
|
+
// Lineage entries this pack covers — see
|
|
10
|
+
// packages/caws-cli/docs-status/failure-lineage.md:
|
|
11
|
+
// Entry 1 — git init catastrophic deletion (block-dangerous + classify_command)
|
|
12
|
+
// Entry 4 — worktree cross-contamination, inherited-dirty-state (worktree-guard)
|
|
13
|
+
// Entry 6 — stash-and-destroy (worktree-guard)
|
|
14
|
+
// Entry 8 — scope violations, union-mode interference (scope-guard)
|
|
15
|
+
// Entry 11 — ownership claim, CAWSFIX-31/32 (worktree-guard, session-caws-status)
|
|
16
|
+
// Entry 12 — unbound = no authority (scope-guard fail-closed)
|
|
17
|
+
// Entry 13 — working-spec.yaml baseline clobber (worktree-write-guard)
|
|
18
|
+
// Entry 16 — adjudicator overstep / role partitioning (the pack itself)
|
|
19
|
+
// Entry 17 — git --bare init bypass + danger latch (classify_command + block-dangerous + reset-danger-latch)
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.CLAUDE_CODE_PACK = exports.CLAUDE_CODE_PACK_VERSION = void 0;
|
|
22
|
+
// Pack version bumps when managed file contents change in a way that
|
|
23
|
+
// existing installs should pick up via the managed_old_version → auto-
|
|
24
|
+
// update path. Version 2 ships the strike-level diagnostic triage,
|
|
25
|
+
// activation-banner wording fix, settings.json "why we don't write it"
|
|
26
|
+
// note, and tightened ask/block semantics in block-dangerous.
|
|
27
|
+
exports.CLAUDE_CODE_PACK_VERSION = 2;
|
|
28
|
+
exports.CLAUDE_CODE_PACK = {
|
|
29
|
+
id: 'claude-code',
|
|
30
|
+
targetSurface: 'claude-code',
|
|
31
|
+
packVersion: exports.CLAUDE_CODE_PACK_VERSION,
|
|
32
|
+
cawsMinMajor: 11,
|
|
33
|
+
summary: 'v11-shape Claude Code hook pack: scope, worktree, dangerous-command, ' +
|
|
34
|
+
'and session lifecycle guards.',
|
|
35
|
+
activation: 'restart_required',
|
|
36
|
+
lifecycleEvents: ['pre_bash', 'pre_write', 'pre_edit', 'session_start', 'stop'],
|
|
37
|
+
stateModel: {
|
|
38
|
+
reads: [
|
|
39
|
+
'.caws/specs/*.yaml',
|
|
40
|
+
'.caws/worktrees.json',
|
|
41
|
+
'.caws/agents.json',
|
|
42
|
+
'.caws/policy.yaml',
|
|
43
|
+
'package.json',
|
|
44
|
+
],
|
|
45
|
+
writes: [
|
|
46
|
+
'.claude/logs/audit.log',
|
|
47
|
+
'.claude/logs/session-*.log',
|
|
48
|
+
'.claude/hooks/state/danger-latch-*.json',
|
|
49
|
+
'.claude/hooks/state/guard-strikes-*.json',
|
|
50
|
+
'tmp/<session-id>/',
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
lineageRefs: [1, 4, 6, 8, 11, 12, 13, 16, 17],
|
|
54
|
+
// Installed files. Order is deterministic (used by tests and by the
|
|
55
|
+
// install reporter). destPath is relative to repo root.
|
|
56
|
+
// sourcePath is relative to the pack root
|
|
57
|
+
// (packages/caws-cli/templates/hook-packs/claude-code/).
|
|
58
|
+
installedFiles: [
|
|
59
|
+
// -- Scope and worktree guards (v11-shape) --
|
|
60
|
+
{
|
|
61
|
+
destPath: '.claude/hooks/scope-guard.sh',
|
|
62
|
+
sourcePath: 'scope-guard.sh',
|
|
63
|
+
executable: true,
|
|
64
|
+
managed: true,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
destPath: '.claude/hooks/worktree-guard.sh',
|
|
68
|
+
sourcePath: 'worktree-guard.sh',
|
|
69
|
+
executable: true,
|
|
70
|
+
managed: true,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
destPath: '.claude/hooks/worktree-write-guard.sh',
|
|
74
|
+
sourcePath: 'worktree-write-guard.sh',
|
|
75
|
+
executable: true,
|
|
76
|
+
managed: true,
|
|
77
|
+
},
|
|
78
|
+
// -- Entry 17 dangerous-command hardening (preserved verbatim) --
|
|
79
|
+
{
|
|
80
|
+
destPath: '.claude/hooks/block-dangerous.sh',
|
|
81
|
+
sourcePath: 'block-dangerous.sh',
|
|
82
|
+
executable: true,
|
|
83
|
+
managed: true,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
destPath: '.claude/hooks/classify_command.py',
|
|
87
|
+
sourcePath: 'classify_command.py',
|
|
88
|
+
executable: true,
|
|
89
|
+
managed: true,
|
|
90
|
+
},
|
|
91
|
+
// -- Human-authorized escape hatches (preserved) --
|
|
92
|
+
{
|
|
93
|
+
destPath: '.claude/hooks/reset-strikes.sh',
|
|
94
|
+
sourcePath: 'reset-strikes.sh',
|
|
95
|
+
executable: true,
|
|
96
|
+
managed: true,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
destPath: '.claude/hooks/reset-danger-latch.sh',
|
|
100
|
+
sourcePath: 'reset-danger-latch.sh',
|
|
101
|
+
executable: true,
|
|
102
|
+
managed: true,
|
|
103
|
+
},
|
|
104
|
+
// -- Strike counter shared library (sourced by scope-guard) --
|
|
105
|
+
{
|
|
106
|
+
destPath: '.claude/hooks/guard-strikes.sh',
|
|
107
|
+
sourcePath: 'guard-strikes.sh',
|
|
108
|
+
executable: true,
|
|
109
|
+
managed: true,
|
|
110
|
+
},
|
|
111
|
+
// -- Session lifecycle and logging --
|
|
112
|
+
{
|
|
113
|
+
destPath: '.claude/hooks/session-caws-status.sh',
|
|
114
|
+
sourcePath: 'session-caws-status.sh',
|
|
115
|
+
executable: true,
|
|
116
|
+
managed: true,
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
destPath: '.claude/hooks/session-log.sh',
|
|
120
|
+
sourcePath: 'session-log.sh',
|
|
121
|
+
executable: true,
|
|
122
|
+
managed: true,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
destPath: '.claude/hooks/audit.sh',
|
|
126
|
+
sourcePath: 'audit.sh',
|
|
127
|
+
executable: true,
|
|
128
|
+
managed: true,
|
|
129
|
+
},
|
|
130
|
+
// -- Shared libraries sourced by every hook script --
|
|
131
|
+
{
|
|
132
|
+
destPath: '.claude/hooks/runtime-paths.sh',
|
|
133
|
+
sourcePath: 'runtime-paths.sh',
|
|
134
|
+
executable: false,
|
|
135
|
+
managed: true,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
destPath: '.claude/hooks/lib/parse-input.sh',
|
|
139
|
+
sourcePath: 'lib/parse-input.sh',
|
|
140
|
+
executable: false,
|
|
141
|
+
managed: true,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
destPath: '.claude/hooks/lib/run-handlers.sh',
|
|
145
|
+
sourcePath: 'lib/run-handlers.sh',
|
|
146
|
+
executable: false,
|
|
147
|
+
managed: true,
|
|
148
|
+
},
|
|
149
|
+
// -- Dispatch entrypoints invoked from .claude/settings.json --
|
|
150
|
+
{
|
|
151
|
+
destPath: '.claude/hooks/dispatch/pre_tool_use.sh',
|
|
152
|
+
sourcePath: 'dispatch/pre_tool_use.sh',
|
|
153
|
+
executable: true,
|
|
154
|
+
managed: true,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
destPath: '.claude/hooks/dispatch/post_tool_use.sh',
|
|
158
|
+
sourcePath: 'dispatch/post_tool_use.sh',
|
|
159
|
+
executable: true,
|
|
160
|
+
managed: true,
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
destPath: '.claude/hooks/dispatch/session_start.sh',
|
|
164
|
+
sourcePath: 'dispatch/session_start.sh',
|
|
165
|
+
executable: true,
|
|
166
|
+
managed: true,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
destPath: '.claude/hooks/dispatch/stop.sh',
|
|
170
|
+
sourcePath: 'dispatch/stop.sh',
|
|
171
|
+
executable: true,
|
|
172
|
+
managed: true,
|
|
173
|
+
},
|
|
174
|
+
// NOTE: .claude/settings.json is NOT a managed pack file. It often
|
|
175
|
+
// carries user-authored `permissions` and `env` blocks that the pack
|
|
176
|
+
// should not touch. Install emits explicit instructions for the
|
|
177
|
+
// user to wire the four dispatch entrypoints into their existing
|
|
178
|
+
// settings.json (or to create one from the canonical snippet in
|
|
179
|
+
// CLAUDE.md if absent). This avoids JSON-merge complexity and
|
|
180
|
+
// preserves user-owned settings.
|
|
181
|
+
// -- Doctrine landing for hook editors --
|
|
182
|
+
{
|
|
183
|
+
destPath: '.claude/hooks/CLAUDE.md',
|
|
184
|
+
sourcePath: 'CLAUDE.md',
|
|
185
|
+
executable: false,
|
|
186
|
+
managed: true,
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
//# sourceMappingURL=manifest-claude-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-claude-code.js","sourceRoot":"","sources":["../../../src/init/hook-packs/manifest-claude-code.ts"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,EAAE;AACF,wEAAwE;AACxE,0EAA0E;AAC1E,uEAAuE;AACvE,wBAAwB;AACxB,EAAE;AACF,yCAAyC;AACzC,oDAAoD;AACpD,mFAAmF;AACnF,oFAAoF;AACpF,kDAAkD;AAClD,uEAAuE;AACvE,oFAAoF;AACpF,gEAAgE;AAChE,yEAAyE;AACzE,0EAA0E;AAC1E,+GAA+G;;;AAI/G,qEAAqE;AACrE,uEAAuE;AACvE,mEAAmE;AACnE,uEAAuE;AACvE,8DAA8D;AACjD,QAAA,wBAAwB,GAAG,CAAC,CAAC;AAE7B,QAAA,gBAAgB,GAAe;IAC1C,EAAE,EAAE,aAAa;IACjB,aAAa,EAAE,aAAa;IAC5B,WAAW,EAAE,gCAAwB;IACrC,YAAY,EAAE,EAAE;IAChB,OAAO,EACL,uEAAuE;QACvE,+BAA+B;IACjC,UAAU,EAAE,kBAAkB;IAC9B,eAAe,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,CAAC;IAC/E,UAAU,EAAE;QACV,KAAK,EAAE;YACL,oBAAoB;YACpB,sBAAsB;YACtB,mBAAmB;YACnB,mBAAmB;YACnB,cAAc;SACf;QACD,MAAM,EAAE;YACN,wBAAwB;YACxB,4BAA4B;YAC5B,yCAAyC;YACzC,0CAA0C;YAC1C,mBAAmB;SACpB;KACF;IACD,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,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@@
|
|
|
1
|
+
import type { AgentSurface, HookPackV1 } from './types';
|
|
2
|
+
export type PackResolution = {
|
|
3
|
+
readonly kind: 'pack';
|
|
4
|
+
readonly pack: HookPackV1;
|
|
5
|
+
} | {
|
|
6
|
+
readonly kind: 'none';
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: 'declared_not_implemented';
|
|
9
|
+
readonly surface: Exclude<AgentSurface, 'none'>;
|
|
10
|
+
};
|
|
11
|
+
/** Resolve a requested surface to a pack manifest. */
|
|
12
|
+
export declare function resolveHookPack(surface: AgentSurface): PackResolution;
|
|
13
|
+
/** Full list of surfaces this CLI version recognizes (for help text and
|
|
14
|
+
* validation). */
|
|
15
|
+
export declare const KNOWN_SURFACES: readonly AgentSurface[];
|
|
16
|
+
/** Surfaces that have a fully-implemented pack in this CLI version. */
|
|
17
|
+
export declare const IMPLEMENTED_SURFACES: readonly AgentSurface[];
|
|
18
|
+
export declare function isKnownSurface(value: string): value is AgentSurface;
|
|
19
|
+
//# sourceMappingURL=register.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../src/init/hook-packs/register.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGxD,MAAM,MAAM,cAAc,GACtB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IACE,QAAQ,CAAC,IAAI,EAAE,0BAA0B,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;CACjD,CAAC;AAEN,sDAAsD;AACtD,wBAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,cAAc,CASrE;AAED;mBACmB;AACnB,eAAO,MAAM,cAAc,EAAE,SAAS,YAAY,EAKjD,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,oBAAoB,EAAE,SAAS,YAAY,EAAoB,CAAC;AAE7E,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,YAAY,CAEnE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Pack registry. Maps `--agent-surface <id>` to a `HookPackV1` manifest.
|
|
3
|
+
//
|
|
4
|
+
// v11.1 ships only the `claude-code` pack. `cursor` and `windsurf` are
|
|
5
|
+
// recognized as values but resolution returns a "declared but not
|
|
6
|
+
// implemented" diagnostic — the abstraction is in place so adding a
|
|
7
|
+
// new pack is purely additive (drop a manifest, register it here).
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.IMPLEMENTED_SURFACES = exports.KNOWN_SURFACES = void 0;
|
|
10
|
+
exports.resolveHookPack = resolveHookPack;
|
|
11
|
+
exports.isKnownSurface = isKnownSurface;
|
|
12
|
+
const manifest_claude_code_1 = require("./manifest-claude-code");
|
|
13
|
+
/** Resolve a requested surface to a pack manifest. */
|
|
14
|
+
function resolveHookPack(surface) {
|
|
15
|
+
if (surface === 'none') {
|
|
16
|
+
return { kind: 'none' };
|
|
17
|
+
}
|
|
18
|
+
if (surface === 'claude-code') {
|
|
19
|
+
return { kind: 'pack', pack: manifest_claude_code_1.CLAUDE_CODE_PACK };
|
|
20
|
+
}
|
|
21
|
+
// cursor / windsurf: recognized but not yet implemented.
|
|
22
|
+
return { kind: 'declared_not_implemented', surface };
|
|
23
|
+
}
|
|
24
|
+
/** Full list of surfaces this CLI version recognizes (for help text and
|
|
25
|
+
* validation). */
|
|
26
|
+
exports.KNOWN_SURFACES = [
|
|
27
|
+
'claude-code',
|
|
28
|
+
'cursor',
|
|
29
|
+
'windsurf',
|
|
30
|
+
'none',
|
|
31
|
+
];
|
|
32
|
+
/** Surfaces that have a fully-implemented pack in this CLI version. */
|
|
33
|
+
exports.IMPLEMENTED_SURFACES = ['claude-code'];
|
|
34
|
+
function isKnownSurface(value) {
|
|
35
|
+
return exports.KNOWN_SURFACES.includes(value);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../src/init/hook-packs/register.ts"],"names":[],"mappings":";AAAA,yEAAyE;AACzE,EAAE;AACF,uEAAuE;AACvE,kEAAkE;AAClE,oEAAoE;AACpE,mEAAmE;;;AAcnE,0CASC;AAcD,wCAEC;AApCD,iEAA0D;AAU1D,sDAAsD;AACtD,SAAgB,eAAe,CAAC,OAAqB;IACnD,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACvB,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC1B,CAAC;IACD,IAAI,OAAO,KAAK,aAAa,EAAE,CAAC;QAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,uCAAgB,EAAE,CAAC;IAClD,CAAC;IACD,yDAAyD;IACzD,OAAO,EAAE,IAAI,EAAE,0BAA0B,EAAE,OAAO,EAAE,CAAC;AACvD,CAAC;AAED;mBACmB;AACN,QAAA,cAAc,GAA4B;IACrD,aAAa;IACb,QAAQ;IACR,UAAU;IACV,MAAM;CACP,CAAC;AAEF,uEAAuE;AAC1D,QAAA,oBAAoB,GAA4B,CAAC,aAAa,CAAC,CAAC;AAE7E,SAAgB,cAAc,CAAC,KAAa;IAC1C,OAAQ,sBAAoC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/** Supported agent harnesses. v11.1 implements claude-code only. */
|
|
2
|
+
export type AgentSurface = 'claude-code' | 'cursor' | 'windsurf' | 'none';
|
|
3
|
+
/** Lifecycle interception points a pack may register on a harness. */
|
|
4
|
+
export type LifecycleEvent = 'pre_bash' | 'pre_write' | 'pre_edit' | 'session_start' | 'stop';
|
|
5
|
+
/** A single file the pack installs, relative to the repo root. */
|
|
6
|
+
export interface HookPackFile {
|
|
7
|
+
/** Destination path relative to repo root (e.g., `.claude/hooks/scope-guard.sh`). */
|
|
8
|
+
readonly destPath: string;
|
|
9
|
+
/** Source path within the templates tree, relative to the pack root
|
|
10
|
+
* (e.g., `scope-guard.sh`). */
|
|
11
|
+
readonly sourcePath: string;
|
|
12
|
+
/** When true, the installed file must be executable (chmod +x). */
|
|
13
|
+
readonly executable: boolean;
|
|
14
|
+
/** When true, this file gets a managed header prepended/verified.
|
|
15
|
+
* Set false for non-script auxiliary files where a comment marker
|
|
16
|
+
* is not appropriate (e.g., a state directory placeholder). */
|
|
17
|
+
readonly managed: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** State surfaces the pack reads from / writes to. Informational; used
|
|
20
|
+
* by docs and by future drift detection. */
|
|
21
|
+
export interface HookPackStateModel {
|
|
22
|
+
/** Files/dirs the pack reads (relative to repo root). */
|
|
23
|
+
readonly reads: readonly string[];
|
|
24
|
+
/** Files/dirs the pack writes (relative to repo root). */
|
|
25
|
+
readonly writes: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
/** The pack manifest. */
|
|
28
|
+
export interface HookPackV1 {
|
|
29
|
+
/** Pack identifier, stable across versions (e.g., "claude-code"). */
|
|
30
|
+
readonly id: string;
|
|
31
|
+
/** The harness this pack targets. */
|
|
32
|
+
readonly targetSurface: Exclude<AgentSurface, 'none'>;
|
|
33
|
+
/** Pack version. Bumps when managed file contents change in a way
|
|
34
|
+
* that requires an update on re-install. */
|
|
35
|
+
readonly packVersion: number;
|
|
36
|
+
/** Minimum CAWS major version this pack is compatible with. */
|
|
37
|
+
readonly cawsMinMajor: number;
|
|
38
|
+
/** Lifecycle events this pack registers on the harness. */
|
|
39
|
+
readonly lifecycleEvents: readonly LifecycleEvent[];
|
|
40
|
+
/** Files installed by this pack, in deterministic order. */
|
|
41
|
+
readonly installedFiles: readonly HookPackFile[];
|
|
42
|
+
/** State surfaces (read/write paths). */
|
|
43
|
+
readonly stateModel: HookPackStateModel;
|
|
44
|
+
/** Failure-lineage entry numbers this pack covers. */
|
|
45
|
+
readonly lineageRefs: readonly number[];
|
|
46
|
+
/** Human-readable summary for init output. One short sentence. */
|
|
47
|
+
readonly summary: string;
|
|
48
|
+
/** Activation contract: whether installed hooks take effect in the
|
|
49
|
+
* current harness session, or require a restart. */
|
|
50
|
+
readonly activation: 'immediate' | 'restart_required' | 'unknown';
|
|
51
|
+
}
|
|
52
|
+
/** Managed-file header fields. Used by install for parse/emit. */
|
|
53
|
+
export interface ManagedHeader {
|
|
54
|
+
readonly hookPack: string;
|
|
55
|
+
readonly hookPackVersion: number;
|
|
56
|
+
readonly cawsMinMajor: number;
|
|
57
|
+
readonly lineageRefs: readonly number[];
|
|
58
|
+
}
|
|
59
|
+
/** Outcome of evaluating an installed-file path against the local filesystem
|
|
60
|
+
* during install. */
|
|
61
|
+
export type InstallFileState =
|
|
62
|
+
/** No file at destPath; safe to create. */
|
|
63
|
+
{
|
|
64
|
+
readonly kind: 'absent';
|
|
65
|
+
}
|
|
66
|
+
/** Managed file at destPath matching this pack/version and unchanged
|
|
67
|
+
* from bundled content. Safe to no-op. */
|
|
68
|
+
| {
|
|
69
|
+
readonly kind: 'managed_clean';
|
|
70
|
+
readonly header: ManagedHeader;
|
|
71
|
+
}
|
|
72
|
+
/** Managed file at destPath matching this pack but at an older version.
|
|
73
|
+
* Safe to update under update policy. */
|
|
74
|
+
| {
|
|
75
|
+
readonly kind: 'managed_old_version';
|
|
76
|
+
readonly header: ManagedHeader;
|
|
77
|
+
readonly currentVersion: number;
|
|
78
|
+
}
|
|
79
|
+
/** Managed file at destPath matching this pack/version but content
|
|
80
|
+
* differs from bundled. Refuses without --adopt or --overwrite. */
|
|
81
|
+
| {
|
|
82
|
+
readonly kind: 'managed_drift';
|
|
83
|
+
readonly header: ManagedHeader;
|
|
84
|
+
}
|
|
85
|
+
/** File at destPath without a managed header. Refuses without
|
|
86
|
+
* --adopt or --overwrite. */
|
|
87
|
+
| {
|
|
88
|
+
readonly kind: 'unmanaged_collision';
|
|
89
|
+
};
|
|
90
|
+
/** Aggregate outcome of an install operation. */
|
|
91
|
+
export type HookPackInstallOutcome =
|
|
92
|
+
/** Pack was installed for the first time (or new files added to an
|
|
93
|
+
* existing pack install). */
|
|
94
|
+
'installed'
|
|
95
|
+
/** Pack files all present at correct version and content; no changes. */
|
|
96
|
+
| 'already_installed'
|
|
97
|
+
/** Pack files updated from an older version. */
|
|
98
|
+
| 'updated'
|
|
99
|
+
/** Caller explicitly chose `--agent-surface none`. No pack installed. */
|
|
100
|
+
| 'skipped_explicit_none'
|
|
101
|
+
/** No harness detected, non-interactive mode. No pack installed, warning
|
|
102
|
+
* emitted. */
|
|
103
|
+
| 'skipped_ambiguous';
|
|
104
|
+
/** Per-file install action recorded for reporting. */
|
|
105
|
+
export interface HookPackFileAction {
|
|
106
|
+
readonly destPath: string;
|
|
107
|
+
readonly action: 'created' | 'updated' | 'unchanged' | 'refused';
|
|
108
|
+
/** When action === 'refused', the reason. */
|
|
109
|
+
readonly refusalReason?: 'unmanaged_collision' | 'managed_drift';
|
|
110
|
+
}
|
|
111
|
+
/** Result of installing a pack into a repo. */
|
|
112
|
+
export interface HookPackInstallResult {
|
|
113
|
+
readonly outcome: HookPackInstallOutcome;
|
|
114
|
+
/** The pack that was (or would have been) installed. Null when
|
|
115
|
+
* outcome is 'skipped_explicit_none' or 'skipped_ambiguous'. */
|
|
116
|
+
readonly pack: HookPackV1 | null;
|
|
117
|
+
/** Per-file actions. */
|
|
118
|
+
readonly actions: readonly HookPackFileAction[];
|
|
119
|
+
/** Whether the harness requires a session restart for hooks to take
|
|
120
|
+
* effect. Drives the activation banner. */
|
|
121
|
+
readonly activation: 'immediate' | 'restart_required' | 'unknown' | 'not_applicable';
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=types.d.ts.map
|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b,mBAAmB,CAAC;AAExB,sDAAsD;AACtD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;IACjE,6CAA6C;IAC7C,QAAQ,CAAC,aAAa,CAAC,EACnB,qBAAqB,GACrB,eAAe,CAAC;CACrB;AAED,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC;qEACiE;IACjE,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACjC,wBAAwB;IACxB,QAAQ,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAChD;gDAC4C;IAC5C,QAAQ,CAAC,UAAU,EAAE,WAAW,GAAG,kBAAkB,GAAG,SAAS,GAAG,gBAAgB,CAAC;CACtF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// HookPackV1 — manifest model for harness-specific hook packs installed by
|
|
3
|
+
// `caws init --agent-surface <name>`.
|
|
4
|
+
//
|
|
5
|
+
// A hook pack is the **runtime adapter** that projects CAWS authority into
|
|
6
|
+
// an agent harness's lifecycle (Claude Code, Cursor, Windsurf, etc.).
|
|
7
|
+
// The kernel/store/shell trinity owns canonical state. The pack interposes
|
|
8
|
+
// at pre-Edit/Write/Bash, where the kernel cannot reach (it runs downstream
|
|
9
|
+
// of the agent's tool call).
|
|
10
|
+
//
|
|
11
|
+
// Every file installed by a pack carries a CAWS-MANAGED-HOOK header:
|
|
12
|
+
//
|
|
13
|
+
// # CAWS-MANAGED-HOOK
|
|
14
|
+
// # hook_pack: <id>
|
|
15
|
+
// # hook_pack_version: <pack_version>
|
|
16
|
+
// # caws_min_major: <caws_min_major>
|
|
17
|
+
// # lineage_refs: <comma-separated lineage entry numbers>
|
|
18
|
+
// # do_not_edit_directly: update via `caws init --agent-surface <id>`
|
|
19
|
+
//
|
|
20
|
+
// The marker is what install/update uses to distinguish managed files
|
|
21
|
+
// (safe to rewrite under explicit policy) from local user files (refused
|
|
22
|
+
// without --adopt/--overwrite).
|
|
23
|
+
//
|
|
24
|
+
// Lineage: every pack must declare which failure-lineage entries it covers
|
|
25
|
+
// (packages/caws-cli/docs-status/failure-lineage.md). Removing or weakening
|
|
26
|
+
// a pack file requires naming the entry and identifying the replacement
|
|
27
|
+
// mechanism.
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/init/hook-packs/types.ts"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,sCAAsC;AACtC,EAAE;AACF,2EAA2E;AAC3E,sEAAsE;AACtE,2EAA2E;AAC3E,4EAA4E;AAC5E,6BAA6B;AAC7B,EAAE;AACF,qEAAqE;AACrE,EAAE;AACF,wBAAwB;AACxB,sBAAsB;AACtB,wCAAwC;AACxC,uCAAuC;AACvC,4DAA4D;AAC5D,wEAAwE;AACxE,EAAE;AACF,sEAAsE;AACtE,yEAAyE;AACzE,gCAAgC;AAChC,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,wEAAwE;AACxE,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gates.d.ts","sourceRoot":"","sources":["../../../src/shell/commands/gates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gates.d.ts","sourceRoot":"","sources":["../../../src/shell/commands/gates.ts"],"names":[],"mappings":"AA2CA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,gCAAgC,CAAC;AAMxC,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,yDAAyD;IACzD,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,CAAC,EAAE,kBAAkB,CAAC;IACrC,oDAAoD;IACpD,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AA6CD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,sBAAsB,EAC/B,IAAI,GAAE,sBAA2B,GAChC,MAAM,CA6JR"}
|
|
@@ -28,6 +28,7 @@ const resolve_session_1 = require("../session/resolve-session");
|
|
|
28
28
|
const actor_1 = require("../session/actor");
|
|
29
29
|
const rules_1 = require("../rules");
|
|
30
30
|
const disposition_1 = require("../gates/disposition");
|
|
31
|
+
const local_evaluators_1 = require("../gates/local-evaluators");
|
|
31
32
|
const quality_gates_adapter_1 = require("../gates/quality-gates-adapter");
|
|
32
33
|
const waiver_filter_1 = require("../gates/waiver-filter");
|
|
33
34
|
const MAX_EVENT_VIOLATIONS = 100;
|
|
@@ -135,6 +136,32 @@ function runGatesRunCommand(request, opts = {}) {
|
|
|
135
136
|
return 2;
|
|
136
137
|
}
|
|
137
138
|
const report = reportResult.value;
|
|
139
|
+
// 5b. Local CAWS policy evaluators. These produce violations under
|
|
140
|
+
// canonical policy gate IDs (budget_limit, scope_boundary,
|
|
141
|
+
// spec_completeness) that the subprocess does not emit. Locating
|
|
142
|
+
// them in caws-cli (not in the generic quality-gates subprocess)
|
|
143
|
+
// keeps quality-gates decoupled from spec/policy authority.
|
|
144
|
+
//
|
|
145
|
+
// The active spec must exist and be loadable. If it isn't,
|
|
146
|
+
// refuse the run with a typed diagnostic — running gates against
|
|
147
|
+
// a missing or unparseable spec is a category error.
|
|
148
|
+
const activeSpec = snapshot.specs.find((s) => s.id === request.specId);
|
|
149
|
+
if (activeSpec === undefined) {
|
|
150
|
+
err(`caws gates run: spec ${request.specId} not found in .caws/specs/. ` +
|
|
151
|
+
`Either the id is wrong, or the spec failed to load (run \`caws doctor\` for details).`);
|
|
152
|
+
err(`(rule: ${rules_1.SHELL_RULES.GATES_POLICY_REQUIRED})`);
|
|
153
|
+
return 2;
|
|
154
|
+
}
|
|
155
|
+
const localResult = (0, local_evaluators_1.runLocalEvaluators)({
|
|
156
|
+
spec: activeSpec,
|
|
157
|
+
policy,
|
|
158
|
+
repoRoot,
|
|
159
|
+
nowIso: now.toISOString(),
|
|
160
|
+
});
|
|
161
|
+
const mergedReport = {
|
|
162
|
+
...report,
|
|
163
|
+
violations: [...report.violations, ...localResult.violations],
|
|
164
|
+
};
|
|
138
165
|
// 6a. Load + apply waivers BEFORE disposition.
|
|
139
166
|
// Waivers do NOT mutate policy.gates[gate].mode. They remove
|
|
140
167
|
// authorized-exception violations from the report so blocking is
|
|
@@ -145,7 +172,7 @@ function runGatesRunCommand(request, opts = {}) {
|
|
|
145
172
|
err((0, diagnostic_1.renderDiagnostics)(waiversLoad.diagnostics, { showData }));
|
|
146
173
|
}
|
|
147
174
|
const waiverFilter = (0, waiver_filter_1.filterWaivedViolations)({
|
|
148
|
-
report,
|
|
175
|
+
report: mergedReport,
|
|
149
176
|
waivers: waiversLoad.waivers,
|
|
150
177
|
specId: request.specId,
|
|
151
178
|
now,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gates.js","sourceRoot":"","sources":["../../../src/shell/commands/gates.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,EAAE;AACF,YAAY;AACZ,4BAA4B;AAC5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AE;gBAC1D,CAAC,CAAC,EAAE,CAAC;SACR,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,IAAA,mBAAW,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,GAAG,CAAC,6DAA6D,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC;YAC/E,GAAG,CAAC,IAAA,8BAAiB,EAAC,MAAM,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;YACpD,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,oBAAoB;IACpB,GAAG,CAAC,IAAA,sBAAc,EAAC,iBAAiB,CAAC,CAAC,CAAC;IAEvC,iCAAiC;IACjC,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import type { AgentSurface } from '../../init/hook-packs/types';
|
|
1
2
|
export interface InitCommandOptions {
|
|
2
3
|
readonly cwd?: string;
|
|
3
4
|
readonly out?: (line: string) => void;
|
|
4
5
|
readonly err?: (line: string) => void;
|
|
5
6
|
readonly showData?: boolean;
|
|
7
|
+
/** Selected agent harness. When undefined, the command attempts
|
|
8
|
+
* filesystem detection. */
|
|
9
|
+
readonly agentSurface?: AgentSurface;
|
|
10
|
+
/** When true, overwrite drifted/unmanaged files at managed pack paths. */
|
|
11
|
+
readonly overwrite?: boolean;
|
|
12
|
+
/** When true, leave drifted/unmanaged files in place; do not enforce
|
|
13
|
+
* pack contents at those paths. */
|
|
14
|
+
readonly adopt?: boolean;
|
|
6
15
|
}
|
|
7
16
|
export declare function runInitCommand(opts?: InitCommandOptions): number;
|
|
8
17
|
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/shell/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/shell/commands/init.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EACV,YAAY,EAEb,MAAM,6BAA6B,CAAC;AAUrC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B;gCAC4B;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,0EAA0E;IAC1E,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B;wCACoC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AA0ED,wBAAgB,cAAc,CAAC,IAAI,GAAE,kBAAuB,GAAG,MAAM,CAoGpE"}
|