@sabaiway/agent-workflow-kit 16.1.0 → 18.0.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/CHANGELOG.md +75 -0
- package/README.md +3 -3
- package/SKILL.md +1 -1
- package/capability.json +1 -1
- package/package.json +1 -1
- package/references/advisor-writers.md +3 -4
- package/references/contracts.md +10 -3
- package/references/modes/agents.md +8 -6
- package/references/modes/gates.md +1 -1
- package/references/modes/hook.md +7 -7
- package/references/modes/recommendations.md +3 -3
- package/references/modes/state-block-guard.md +4 -0
- package/references/modes/upgrade.md +1 -1
- package/tools/apply-danger-check.mjs +35 -27
- package/tools/cheap-agents-read.mjs +8 -3
- package/tools/cheap-agents.mjs +62 -74
- package/tools/distribution-files/scripts.mjs +6 -2
- package/tools/ensure-configs.mjs +2 -2
- package/tools/ensure-executor.mjs +4 -4
- package/tools/gate-hook.mjs +25 -55
- package/tools/recommendations.mjs +109 -213
- package/tools/state-block-hook.mjs +6 -6
- package/tools/write-lanes.mjs +12 -15
|
@@ -96,7 +96,7 @@ export const assertDirSafe = (absPath, relPath, fs) => {
|
|
|
96
96
|
return { absent: false };
|
|
97
97
|
};
|
|
98
98
|
|
|
99
|
-
// Per-template placement plan: place | already-current | re-derive
|
|
99
|
+
// Per-template placement plan: place | already-current | re-derive (every differing kit file).
|
|
100
100
|
export const planPlacement = (templates, projectDir, deps = {}) => {
|
|
101
101
|
const fs = readFsDeps(deps);
|
|
102
102
|
return templates.map((template) => {
|
|
@@ -109,11 +109,16 @@ export const planPlacement = (templates, projectDir, deps = {}) => {
|
|
|
109
109
|
}
|
|
110
110
|
const existing = fs.readFile(abs, UTF8);
|
|
111
111
|
if (existing === template.content) return { ...template, rel, abs, action: 'already-current' };
|
|
112
|
-
|
|
113
|
-
return { ...template, rel, abs, action: 'customized-preserved', existing };
|
|
112
|
+
return { ...template, rel, abs, action: 're-derive', existing };
|
|
114
113
|
});
|
|
115
114
|
};
|
|
116
115
|
|
|
116
|
+
// The component is accepted when a kit agent path of the given names holds a regular file, never followed.
|
|
117
|
+
export const agentsAccepted = (projectDir, names, deps = {}) => {
|
|
118
|
+
const fs = readFsDeps(deps);
|
|
119
|
+
return names.some((name) => lstatNoFollow(join(projectDir, AGENTS_DIR, name), fs)?.isFile() === true);
|
|
120
|
+
};
|
|
121
|
+
|
|
117
122
|
// ── the executor vehicle's readiness (the subagent carrier's one instrument) ──────────
|
|
118
123
|
|
|
119
124
|
export const EXECUTOR_VEHICLE = 'executor.md';
|
package/tools/cheap-agents.mjs
CHANGED
|
@@ -7,31 +7,32 @@
|
|
|
7
7
|
// only for a bounded execution, authoring, or write-capable routine slice the orchestrator verifies, never for read-only work, and it
|
|
8
8
|
// never commits. `surveyExecutorVehicle` is that vehicle's readiness, for the subagent carrier.
|
|
9
9
|
//
|
|
10
|
-
// The family's second `.claude/` writer, the velocity-profile.mjs discipline
|
|
10
|
+
// The family's second `.claude/` writer, the velocity-profile.mjs discipline:
|
|
11
11
|
// • preview-then-mutate — `--dry-run` is the DEFAULT and writes nothing; `--apply` writes;
|
|
12
12
|
// • deployment-gated — `--apply` STOPs unless docs/ai/.workflow-version equals the lineage
|
|
13
13
|
// head (a dry-run stays usable whatever the stamp says; an unreadable orchestration config
|
|
14
14
|
// STOPs both, since the derived lenses it names cannot be known);
|
|
15
|
-
// • symlink-safe — a symlinked project root, `.claude`, `.claude/agents` or
|
|
16
|
-
// STOP, in a dry-run too,
|
|
17
|
-
// •
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
15
|
+
// • symlink-safe — a symlinked project root, `.claude`, `.claude/agents` or any non-regular or
|
|
16
|
+
// unreadable kit agent file is a STOP naming it, in a dry-run too, nothing written;
|
|
17
|
+
// • every kit agent file is written current with no question: an absent one is placed, one whose
|
|
18
|
+
// bytes differ is written with the body the kit writes for it (the executor's and the bundled
|
|
19
|
+
// review lens's derived from docs/ai/vehicles.json), no copy kept; an identical file is
|
|
20
|
+
// `already current` (idempotent re-run). A vehicle of your own goes in
|
|
21
|
+
// .claude/agents/<name>.local.md with a `name:` of its own; no kit tool writes it;
|
|
22
|
+
// • writes ONLY under .claude/agents/, each write contained and atomic — never settings.json /
|
|
23
|
+
// settings.local.json, never commits.
|
|
23
24
|
//
|
|
24
25
|
// Claude-Code-specific (like velocity): .claude/agents/ is a Claude Code surface; other agent
|
|
25
26
|
// hosts ignore it. In a HIDDEN-mode deployment, run the hide-footprint reconcile after apply so
|
|
26
27
|
// the placed files stay out of `git status` (the registry already carries /.claude/agents/); the
|
|
27
|
-
// apply
|
|
28
|
+
// report of an apply that placed the component reminds you.
|
|
28
29
|
//
|
|
29
|
-
// Exit codes: 0 done / dry-run
|
|
30
|
-
//
|
|
31
|
-
//
|
|
30
|
+
// Exit codes: 0 done / dry-run; 1 precondition STOP (stamp, a link or unreadable kit agent file,
|
|
31
|
+
// missing bundle, an unreadable orchestration config or docs/ai/vehicles.json — their derived
|
|
32
|
+
// bodies cannot be known); 2 usage.
|
|
32
33
|
// Dependency-free, Node >= 22. No side effects on import.
|
|
33
34
|
|
|
34
|
-
import { mkdirSync
|
|
35
|
+
import { mkdirSync } from 'node:fs';
|
|
35
36
|
import { join, resolve } from 'node:path';
|
|
36
37
|
import { fileURLToPath } from 'node:url';
|
|
37
38
|
import { isDirectRun } from './direct-run.mjs';
|
|
@@ -50,13 +51,13 @@ import {
|
|
|
50
51
|
CLAUDE_DIR,
|
|
51
52
|
WORKFLOW_STAMP,
|
|
52
53
|
EXPECTED_WORKFLOW_VERSION,
|
|
53
|
-
UTF8,
|
|
54
54
|
CHEAP_AGENTS_STAMP,
|
|
55
55
|
CHEAP_AGENTS_SYMLINK,
|
|
56
56
|
CHEAP_AGENTS_BUNDLE,
|
|
57
57
|
CHEAP_AGENTS_CONFIG,
|
|
58
58
|
CHEAP_AGENTS_VEHICLES,
|
|
59
59
|
EXECUTOR_VEHICLE,
|
|
60
|
+
REVIEW_LENS_VEHICLE,
|
|
60
61
|
executorTemplate,
|
|
61
62
|
reviewLensTemplate,
|
|
62
63
|
makeCheapAgentsError,
|
|
@@ -65,6 +66,7 @@ import {
|
|
|
65
66
|
readStamp,
|
|
66
67
|
assertDirSafe,
|
|
67
68
|
planPlacement,
|
|
69
|
+
agentsAccepted,
|
|
68
70
|
} from './cheap-agents-read.mjs';
|
|
69
71
|
|
|
70
72
|
export {
|
|
@@ -84,6 +86,7 @@ export {
|
|
|
84
86
|
makeCheapAgentsError,
|
|
85
87
|
readBundledAgents,
|
|
86
88
|
planPlacement,
|
|
89
|
+
agentsAccepted,
|
|
87
90
|
surveyExecutorVehicle,
|
|
88
91
|
EXECUTOR_VEHICLE,
|
|
89
92
|
EXECUTOR_VEHICLE_REL,
|
|
@@ -99,7 +102,7 @@ const EXIT_USAGE = 2;
|
|
|
99
102
|
// never silent).
|
|
100
103
|
export const FALLBACK_LENS_ADDITIONAL_ONLY = 'review-lens is an ADDITIONAL read-only review opinion, not a replacement for your plan or diff review recipe.';
|
|
101
104
|
|
|
102
|
-
const USAGE = `usage: cheap-agents [--dry-run | --apply] [--
|
|
105
|
+
const USAGE = `usage: cheap-agents [--dry-run | --apply] [--cwd <dir>] [--help]
|
|
103
106
|
|
|
104
107
|
Places the bundled subagent definitions into the project's ${AGENTS_DIR}/. Four vehicles grant NO
|
|
105
108
|
shell: three ride a cheap model (haiku/low) for mechanical work — extraction sweeps, changelog
|
|
@@ -109,19 +112,15 @@ authoring, or write-capable routine slice the orchestrator verifies, never for r
|
|
|
109
112
|
it never commits.
|
|
110
113
|
Default is --dry-run (a preview; writes nothing). --apply writes.
|
|
111
114
|
Configured derived review lenses are planned and placed beside the bundled vehicles.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
${AGENTS_DIR}/executor.md and no other file.`;
|
|
115
|
+
Every kit agent file is written current with no question: an absent one is placed, one whose bytes
|
|
116
|
+
differ is written on --apply with the body the kit writes for it, no copy kept. The executor's model
|
|
117
|
+
and effort come from docs/ai/vehicles.json, the review lens's from its review-lens section there
|
|
118
|
+
(opus and high by default). A link or an unreadable file at a kit agent path stops the run naming it,
|
|
119
|
+
nothing written. A vehicle of your own goes in ${AGENTS_DIR}/<name>.local.md with a name: of its own.`;
|
|
118
120
|
|
|
119
121
|
export const fail = (exitCode, message) => Object.assign(new Error(message), { exitCode });
|
|
120
122
|
|
|
121
|
-
const writeFsDeps = (deps = {}) => ({
|
|
122
|
-
mkdir: deps.mkdir ?? mkdirSync,
|
|
123
|
-
writeFile: deps.writeFile ?? writeFileSync,
|
|
124
|
-
});
|
|
123
|
+
const writeFsDeps = (deps = {}) => ({ mkdir: deps.mkdir ?? mkdirSync });
|
|
125
124
|
|
|
126
125
|
const refuseSymlinkedRoot = (projectDir, deps) => {
|
|
127
126
|
const root = resolve(projectDir);
|
|
@@ -134,12 +133,11 @@ const refuseSymlinkedRoot = (projectDir, deps) => {
|
|
|
134
133
|
if (stat.isSymbolicLink()) throw makeCheapAgentsError(CHEAP_AGENTS_SYMLINK, `the project root ${root} is a symlink — refusing to write through it`);
|
|
135
134
|
};
|
|
136
135
|
|
|
137
|
-
|
|
138
|
-
export const preflightCheapAgents = ({ cwd, derived = [], alone = false }, deps = {}) => {
|
|
136
|
+
export const preflightCheapAgents = ({ cwd, derived = [] }, deps = {}) => {
|
|
139
137
|
const fs = readFsDeps(deps);
|
|
140
138
|
const projectDir = cwd ?? process.cwd();
|
|
141
139
|
refuseSymlinkedRoot(projectDir, deps);
|
|
142
|
-
const templatesByName = new Map(
|
|
140
|
+
const templatesByName = new Map(readBundledAgents(deps).map((template) => [template.name, template]));
|
|
143
141
|
for (const template of derived) templatesByName.set(template.name, template);
|
|
144
142
|
const templates = [...templatesByName.values()];
|
|
145
143
|
const stamp = readStamp(join(projectDir, WORKFLOW_STAMP), fs);
|
|
@@ -181,21 +179,22 @@ const configuredDerivedTemplates = (cwd, deps) => {
|
|
|
181
179
|
return [...templates.values()];
|
|
182
180
|
};
|
|
183
181
|
|
|
184
|
-
|
|
185
|
-
|
|
182
|
+
// The kit agent file names, read from the bundle and the orchestration config, never from a plan.
|
|
183
|
+
export const kitAgentNames = (cwd, deps = {}) =>
|
|
184
|
+
[...new Set([...readBundledAgents(deps), ...configuredDerivedTemplates(cwd, deps)].map(({ name }) => name))];
|
|
185
|
+
|
|
186
|
+
export const applyCheapAgentsCommand = (root) =>
|
|
187
|
+
`node ${shellQuoteArg(fileURLToPath(import.meta.url))} --apply --cwd ${shellQuoteArg(root)}`;
|
|
186
188
|
|
|
187
189
|
// ── the writer ────────────────────────────────────────────────────────────────────────
|
|
188
190
|
|
|
189
|
-
|
|
190
|
-
export const writeCheapAgents = ({ cwd, dryRun = true, executorOnly = false } = {}, deps = {}) => {
|
|
191
|
+
export const writeCheapAgents = ({ cwd, dryRun = true } = {}, deps = {}) => {
|
|
191
192
|
const fs = writeFsDeps(deps);
|
|
192
193
|
const projectDir = cwd ?? process.cwd();
|
|
193
194
|
refuseSymlinkedRoot(projectDir, deps);
|
|
194
195
|
const { posture, lensPosture } = loadPosturesOrStop(projectDir, deps);
|
|
195
|
-
const derived =
|
|
196
|
-
|
|
197
|
-
];
|
|
198
|
-
const preflight = { executorOnly, ...preflightCheapAgents({ cwd: projectDir, derived, alone: executorOnly }, deps) };
|
|
196
|
+
const derived = [executorTemplate(posture, deps), reviewLensTemplate(lensPosture, deps), ...configuredDerivedTemplates(projectDir, deps)];
|
|
197
|
+
const preflight = preflightCheapAgents({ cwd: projectDir, derived }, deps);
|
|
199
198
|
if (dryRun) return { wrote: false, dryRun: true, posture, lensPosture, ...preflight };
|
|
200
199
|
|
|
201
200
|
if (!preflight.stampOk) {
|
|
@@ -204,35 +203,28 @@ export const writeCheapAgents = ({ cwd, dryRun = true, executorOnly = false } =
|
|
|
204
203
|
`not a deployed agent-workflow project at lineage ${EXPECTED_WORKFLOW_VERSION} (found ${preflight.stamp ?? 'none'}) — run init/upgrade first`,
|
|
205
204
|
);
|
|
206
205
|
}
|
|
206
|
+
const accepted = agentsAccepted(projectDir, preflight.plan.map((item) => item.name), deps);
|
|
207
207
|
const toWrite = preflight.plan.filter((item) => item.action === 'place' || item.action === 're-derive');
|
|
208
208
|
if (toWrite.length > 0) fs.mkdir(join(preflight.projectDir, AGENTS_DIR), { recursive: true });
|
|
209
209
|
for (const item of toWrite) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
});
|
|
214
|
-
} else fs.writeFile(item.abs, item.content, UTF8);
|
|
210
|
+
writeContainedFileAtomic(preflight.projectDir, item.abs, item.content, deps, {
|
|
211
|
+
label: item.rel, stop: (message) => makeCheapAgentsError(CHEAP_AGENTS_SYMLINK, message),
|
|
212
|
+
});
|
|
215
213
|
}
|
|
216
|
-
return { wrote: toWrite.length > 0, dryRun: false, posture, lensPosture, ...preflight };
|
|
214
|
+
return { wrote: toWrite.length > 0, dryRun: false, accepted, posture, lensPosture, ...preflight };
|
|
217
215
|
};
|
|
218
216
|
|
|
219
217
|
// ── report ────────────────────────────────────────────────────────────────────────────
|
|
220
218
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
'customized-preserved': 'customized — preserved (delete the file to reseed from the bundle)',
|
|
225
|
-
};
|
|
226
|
-
const LENS_REDERIVE_LABEL = 're-derived — the earlier body was replaced; set its model and effort in docs/ai/vehicles.json';
|
|
227
|
-
// The executor's re-derive line is the distribution-files composer's, over the state `derived`.
|
|
219
|
+
// A differing file's line is the distribution-files composer's: the state `derived` for the two
|
|
220
|
+
// bodies derived from the vehicle settings, `agent` for every other kit agent file.
|
|
221
|
+
const DERIVED_FROM_SETTINGS = new Set([EXECUTOR_VEHICLE, REVIEW_LENS_VEHICLE]);
|
|
228
222
|
const rowLine = (item, dryRun) => {
|
|
229
|
-
if (item.action === 're-derive'
|
|
230
|
-
|
|
223
|
+
if (item.action === 're-derive') {
|
|
224
|
+
const state = DERIVED_FROM_SETTINGS.has(item.name) ? 'derived' : 'agent';
|
|
225
|
+
return fileLine({ rel: item.rel, name: item.name, state }, dryRun ? undefined : 'written', dryRun);
|
|
231
226
|
}
|
|
232
|
-
|
|
233
|
-
: dryRun && item.action === 're-derive' ? 'would re-derive'
|
|
234
|
-
: item.action === 're-derive' ? LENS_REDERIVE_LABEL : ACTION_LABEL[item.action];
|
|
235
|
-
return `${item.rel}: ${verb}`;
|
|
227
|
+
return `${item.rel}: ${item.action === 'already-current' ? 'already current' : dryRun ? 'would place' : 'place'}`;
|
|
236
228
|
};
|
|
237
229
|
|
|
238
230
|
export const formatResult = (result) => {
|
|
@@ -246,25 +238,22 @@ export const formatResult = (result) => {
|
|
|
246
238
|
if (!result.stampOk) {
|
|
247
239
|
lines.push(`note: no current deployment stamp found (${result.stamp ?? 'none'}) — --apply will refuse until init/upgrade runs.`);
|
|
248
240
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
)
|
|
256
|
-
|
|
257
|
-
lines.push(`executor posture: model=${safeLine(posture.model)} effort=${safeLine(posture.effort)} fallback=${safeLine(posture.fallback)} (source: ${safeLine(posture.source)}) — set in docs/ai/vehicles.json`);
|
|
258
|
-
if (!result.executorOnly) {
|
|
259
|
-
lines.push(`review-lens posture: model=${safeLine(lensPosture.model)} effort=${safeLine(lensPosture.effort)} (source: ${safeLine(lensPosture.source)}) — set in docs/ai/vehicles.json`);
|
|
260
|
-
}
|
|
241
|
+
const readOnlyCount = result.plan.filter((item) => item.name !== EXECUTOR_VEHICLE).length;
|
|
242
|
+
lines.push(
|
|
243
|
+
`${readOnlyCount} vehicles are Claude Code subagents with READ-ONLY tools and NO shell as the kit writes them — so a fan-out on the shipped templates can never turn into a wave of approval prompts.`,
|
|
244
|
+
`three of those ride the cheap lane (model: haiku, effort: low) for mechanical work; ${FALLBACK_LENS_ADDITIONAL_ONLY}`,
|
|
245
|
+
'executor is the one FULL-TOOL vehicle: dispatched only for a bounded execution, authoring, or write-capable routine slice the orchestrator verifies, never for read-only work, and it never commits.',
|
|
246
|
+
`executor posture: model=${safeLine(posture.model)} effort=${safeLine(posture.effort)} fallback=${safeLine(posture.fallback)} (source: ${safeLine(posture.source)}) — set in docs/ai/vehicles.json`,
|
|
247
|
+
`review-lens posture: model=${safeLine(lensPosture.model)} effort=${safeLine(lensPosture.effort)} (source: ${safeLine(lensPosture.source)}) — set in docs/ai/vehicles.json`,
|
|
248
|
+
);
|
|
261
249
|
// A preview must print the EXACT command that applies it. The advisor renders this dry-run as an
|
|
262
250
|
// item's one-liner, and that flow's contract is "run the printed command, no improvisation" — a
|
|
263
251
|
// bare "re-run with --apply" would leave the caller to reconstruct --cwd and its quoting.
|
|
264
252
|
if (result.dryRun && result.plan.some((item) => item.action === 'place' || item.action === 're-derive')) {
|
|
265
|
-
lines.push(`to apply, run exactly: ${applyCheapAgentsCommand(result.projectDir
|
|
253
|
+
lines.push(`to apply, run exactly: ${applyCheapAgentsCommand(result.projectDir)}`);
|
|
266
254
|
}
|
|
267
|
-
|
|
255
|
+
// Over a placed component the known-footprint registry already hides every kit agent file.
|
|
256
|
+
if (!result.dryRun && result.wrote && !result.accepted) {
|
|
268
257
|
lines.push('hidden-mode note: if this deployment is hidden, run the hide-footprint reconcile so the placed files stay out of `git status`.');
|
|
269
258
|
}
|
|
270
259
|
return lines.join('\n');
|
|
@@ -273,13 +262,12 @@ export const formatResult = (result) => {
|
|
|
273
262
|
// ── CLI ───────────────────────────────────────────────────────────────────────────────
|
|
274
263
|
|
|
275
264
|
export const parseArgs = (argv) => {
|
|
276
|
-
const opts = { dryRunFlag: false, apply: false,
|
|
265
|
+
const opts = { dryRunFlag: false, apply: false, cwd: undefined, help: false };
|
|
277
266
|
for (let i = 0; i < argv.length; i += 1) {
|
|
278
267
|
const arg = argv[i];
|
|
279
268
|
if (arg === '--help' || arg === '-h') opts.help = true;
|
|
280
269
|
else if (arg === '--dry-run') opts.dryRunFlag = true;
|
|
281
270
|
else if (arg === '--apply') opts.apply = true;
|
|
282
|
-
else if (arg === '--executor') opts.executorOnly = true;
|
|
283
271
|
else if (arg === '--cwd') {
|
|
284
272
|
i += 1;
|
|
285
273
|
if (argv[i] === undefined || argv[i].startsWith('-')) throw fail(EXIT_USAGE, '--cwd needs a directory argument');
|
|
@@ -289,7 +277,7 @@ export const parseArgs = (argv) => {
|
|
|
289
277
|
}
|
|
290
278
|
}
|
|
291
279
|
if (opts.dryRunFlag && opts.apply) throw fail(EXIT_USAGE, '--dry-run and --apply cannot be used together');
|
|
292
|
-
return { help: opts.help, dryRun: !opts.apply,
|
|
280
|
+
return { help: opts.help, dryRun: !opts.apply, cwd: opts.cwd };
|
|
293
281
|
};
|
|
294
282
|
|
|
295
283
|
export const main = (argv = process.argv.slice(2), deps = {}) => {
|
|
@@ -301,7 +289,7 @@ export const main = (argv = process.argv.slice(2), deps = {}) => {
|
|
|
301
289
|
log(USAGE);
|
|
302
290
|
return EXIT_OK;
|
|
303
291
|
}
|
|
304
|
-
const result = writeCheapAgents({ cwd: args.cwd ?? process.cwd(), dryRun: args.dryRun
|
|
292
|
+
const result = writeCheapAgents({ cwd: args.cwd ?? process.cwd(), dryRun: args.dryRun }, deps);
|
|
305
293
|
log(formatResult(result));
|
|
306
294
|
return EXIT_OK;
|
|
307
295
|
} catch (err) {
|
|
@@ -25,6 +25,8 @@ const BUNDLED = ['references', 'scripts'];
|
|
|
25
25
|
export const SCRIPT_CHANNEL = 'a script or suite of your own under its own name in scripts/, or a config the script reads';
|
|
26
26
|
export const LOCAL_HOOK_CHANNEL = 'the local hook file scripts/pre-commit.local, which the commit hook runs first';
|
|
27
27
|
export const VEHICLE_CHANNEL = VEHICLES_REL;
|
|
28
|
+
export const AGENT_CHANNEL = '.claude/agents/<name>.local.md with a name: of its own';
|
|
29
|
+
export const HOOK_CHANNEL = '.claude/hooks/<name>.local.mjs';
|
|
28
30
|
// The family files memory copies on Node evidence alone, accepted or not (the suite derives them).
|
|
29
31
|
export const SEED_NAMES = Object.freeze(['_expect-shim.mjs', 'archive-decisions.mjs', 'archive-decisions.test.mjs', 'markdown-blocks.mjs']);
|
|
30
32
|
const ROTATOR = 'archive-decisions.mjs';
|
|
@@ -80,9 +82,11 @@ const survey = ({ cwd, kitRoot, deps, read, lstat }) => {
|
|
|
80
82
|
// A fate is `written`, `stood` (an absent file that appeared with the bundled body), `refused` (its
|
|
81
83
|
// write failed), or none: the run stopped before it, or, dry, would write it. The spec layer's pair
|
|
82
84
|
// lines are these too, through the module's index.
|
|
83
|
-
const VERBS = { prior: ['refreshed', 'refreshed to the bundled one'], custom: ['replaced', 'replaced by the bundled body'], absent: ['placed', 'placed from the bundled scripts'], derived: ['written', 'written with that body'] };
|
|
84
|
-
const HEADS = { prior: 'matches a body an earlier release shipped', custom: 'differs from every body this kit knows it shipped', absent: 'absent', derived: 'differs from the body derived from the vehicle settings' };
|
|
85
|
+
const VERBS = { prior: ['refreshed', 'refreshed to the bundled one'], custom: ['replaced', 'replaced by the bundled body'], absent: ['placed', 'placed from the bundled scripts'], derived: ['written', 'written with that body'], agent: ['written', 'written with that body'], hook: ['written', 'written with that body'] };
|
|
86
|
+
const HEADS = { prior: 'matches a body an earlier release shipped', custom: 'differs from every body this kit knows it shipped', absent: 'absent', derived: 'differs from the body derived from the vehicle settings', agent: 'differs from the body the kit writes for it', hook: 'differs from the body the kit writes for it' };
|
|
85
87
|
const channelOf = (f) => (f.state === 'derived' ? `; its model and effort are set in ${VEHICLE_CHANNEL}`
|
|
88
|
+
: f.state === 'agent' ? `; a vehicle of your own goes in ${AGENT_CHANNEL}`
|
|
89
|
+
: f.state === 'hook' ? `; a hook of your own goes in ${HOOK_CHANNEL}`
|
|
86
90
|
: f.state === 'custom' ? `; an edit meant to last goes in ${f.name === INSTALLER_SET[0] ? LOCAL_HOOK_CHANNEL : SCRIPT_CHANNEL}` : '');
|
|
87
91
|
export const fileLine = (f, fate, dryRun) => {
|
|
88
92
|
if (fate === 'stood') return `${f.rel}: appeared while this run was placing it — the bundled body stands, nothing written`;
|
package/tools/ensure-configs.mjs
CHANGED
|
@@ -89,8 +89,8 @@ exists; and the navigator index — a GENERATED artifact, regenerated
|
|
|
89
89
|
whenever it is missing or stale; where a module the project's hook loads is not the bundled one,
|
|
90
90
|
the project's own checker judges the navigator and a write it rejects is put back byte for byte.
|
|
91
91
|
The executor ensure writes nothing: a placed .claude/agents/executor.md whose bytes differ from the
|
|
92
|
-
body derived from docs/ai/vehicles.json is pending
|
|
93
|
-
writes the derived body
|
|
92
|
+
body derived from docs/ai/vehicles.json is pending and an absent one is not placed here — the
|
|
93
|
+
advisor's agents item writes the derived body.
|
|
94
94
|
A fifth writes too: once a kit script outside the seed names stands in scripts/, the enforcement-script
|
|
95
95
|
ensure writes every kit script that is not the bundled body, the hook installer and its two suites
|
|
96
96
|
first, with no question and no copy kept: a body a release shipped is refreshed, an edited one replaced
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// ensure-executor.mjs — the EIGHTH upgrade ensure, fifth in the fixed order right after `vehicles`:
|
|
2
2
|
// the placed executor vehicle (.claude/agents/executor.md) judged against the body derived from
|
|
3
|
-
// docs/ai/vehicles.json. It never writes:
|
|
4
|
-
//
|
|
3
|
+
// docs/ai/vehicles.json. It never writes: a vehicle not placed and a placed body that differs
|
|
4
|
+
// (`pending`) are each written by the advisor's `agents` item.
|
|
5
5
|
//
|
|
6
6
|
// The state table, in the order the cells are proven:
|
|
7
7
|
// | cell | .claude, .claude/agents | placed path | docs/ai/vehicles.json | answer | read before answering |
|
|
@@ -48,7 +48,7 @@ export const ensureExecutor = ({ cwd, kitRoot, deps = {} }) => {
|
|
|
48
48
|
return loud('wrong-node-kind', `${EXECUTOR_VEHICLE_REL}: exists but is ${probe.wrongKind} — nothing was read or written; resolve it by hand, then re-run`);
|
|
49
49
|
}
|
|
50
50
|
if (!probe.present) {
|
|
51
|
-
return ok('not-placed', [`${EXECUTOR_VEHICLE_REL}: not placed — the agents
|
|
51
|
+
return ok('not-placed', [`${EXECUTOR_VEHICLE_REL}: not placed — nothing written; the advisor's agents item places it`]);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
const { posture, reason } = readExecutorPosture(cwd, deps);
|
|
@@ -66,5 +66,5 @@ export const ensureExecutor = ({ cwd, kitRoot, deps = {} }) => {
|
|
|
66
66
|
if (!executorBodyDiffers(cwd, bundleDeps)) {
|
|
67
67
|
return ok('already-current', [`${EXECUTOR_VEHICLE_REL}: the body derived from ${VEHICLES_REL} (model=${posture.model}, effort=${posture.effort}, source ${posture.source}) — nothing written`]);
|
|
68
68
|
}
|
|
69
|
-
return ok('pending', [`${EXECUTOR_VEHICLE_REL}: differs from the body derived from ${VEHICLES_REL} — nothing written; the advisor's
|
|
69
|
+
return ok('pending', [`${EXECUTOR_VEHICLE_REL}: differs from the body derived from ${VEHICLES_REL} — nothing written; the advisor's agents item writes the derived body`]);
|
|
70
70
|
};
|
package/tools/gate-hook.mjs
CHANGED
|
@@ -23,20 +23,17 @@
|
|
|
23
23
|
// is a STOP with ZERO writes, never a merge-through-clobber;
|
|
24
24
|
// • place-then-wire ORDER — the hook file is placed BEFORE settings are wired (a
|
|
25
25
|
// wired-but-missing hook would error on every Bash call);
|
|
26
|
-
// •
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
// diverged file is REPORTED, never unwired by `--apply`. A diverged hook is never clobbered
|
|
31
|
-
// except by `--apply --reseed`, the one consented replacement: it writes the bundled bytes in
|
|
32
|
-
// place over a placed hook and wires the entry only while it is wired in neither file;
|
|
26
|
+
// • the kit's hook file is written current: placed create-only when absent, a differing one
|
|
27
|
+
// written with the bundled body in place (no copy kept), an identical one `already current`;
|
|
28
|
+
// the entry is wired only while it is wired in neither settings file, so over a wired hook the
|
|
29
|
+
// apply writes only the file. Every printed recovery of a stale hook is `gate-hook --apply`;
|
|
33
30
|
// • never writes settings.local.json; never commits.
|
|
34
31
|
//
|
|
35
32
|
// The `--read-lane` flag is a SEPARATE operation (AD-055 Part II): it enables the opt-in read-only
|
|
36
33
|
// compound lane in docs/ai/lanes.json after a currency check, and never touches settings or
|
|
37
34
|
// gates.json — see the read-lane writer section below.
|
|
38
35
|
//
|
|
39
|
-
// Exit codes: 0 done / dry-run
|
|
36
|
+
// Exit codes: 0 done / dry-run; 1 precondition
|
|
40
37
|
// STOP; 2 usage. Dependency-free beyond the kit's own internal exports, Node >= 22. No side
|
|
41
38
|
// effects on import.
|
|
42
39
|
|
|
@@ -56,6 +53,7 @@ import {
|
|
|
56
53
|
} from './velocity-profile.mjs';
|
|
57
54
|
import { assertDocsAiDeployment, writeDocsAiFileAtomic } from './atomic-write.mjs';
|
|
58
55
|
import { isDirectRun } from './direct-run.mjs';
|
|
56
|
+
import { fileLine } from './distribution-files/index.mjs';
|
|
59
57
|
import { shellQuoteArg } from './review-state.mjs';
|
|
60
58
|
|
|
61
59
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
@@ -100,7 +98,6 @@ const TARGET_CURRENT = 'already-current';
|
|
|
100
98
|
const TARGET_DIVERGED = 'diverged';
|
|
101
99
|
|
|
102
100
|
const USAGE = `usage: gate-hook [--dry-run | --apply] [--cwd <dir>] [--help]
|
|
103
|
-
gate-hook --reseed [--dry-run | --apply] [--cwd <dir>] (replace a placed hook with the bundle)
|
|
104
101
|
gate-hook --read-lane [--dry-run | --apply] [--cwd <dir>] (enable the opt-in read-only compound lane)
|
|
105
102
|
|
|
106
103
|
Places the bundled PreToolUse gate-approval hook to ${HOOK_FILE_REL} and wires ONE
|
|
@@ -109,15 +106,14 @@ nothing). --apply writes. The hook auto-approves byte-exact declared gate cmds
|
|
|
109
106
|
(docs/ai/gates.json, project root) and asks on seeded-read-only commands carrying the
|
|
110
107
|
documented runtime residual.
|
|
111
108
|
|
|
112
|
-
--
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
an absent hook (--apply places it) and a symlinked or non-regular one.
|
|
109
|
+
--apply places an absent hook file, writes a differing one with the bundled body in place, leaves
|
|
110
|
+
a current one, and wires the entry only while it is wired in neither settings file. A symlinked or
|
|
111
|
+
non-regular hook file is refused.
|
|
116
112
|
|
|
117
113
|
--read-lane enables the opt-in read-only COMPOUND lane in ${LANES_REL} ("${READ_LANE_KEY}": true) — the
|
|
118
114
|
hook then auto-approves compounds of the seeded read-only core carrying zero shell metaprogramming.
|
|
119
115
|
--apply --read-lane verifies the PLACED hook is the CURRENT bundle first (a pre-1.48 hook never reads
|
|
120
|
-
${LANES_REL}) and refuses otherwise, naming the
|
|
116
|
+
${LANES_REL}) and refuses otherwise, naming the route that writes it (gate-hook --apply --cwd <dir>).
|
|
121
117
|
Never touches ${SETTINGS_FILE} or docs/ai/gates.json.
|
|
122
118
|
|
|
123
119
|
Never writes ${SETTINGS_LOCAL_FILE}; never commits.`;
|
|
@@ -268,7 +264,7 @@ export const mergeHookEntry = (base) => {
|
|
|
268
264
|
return { ...root, hooks: { ...hooks, [PRE_TOOL_USE_EVENT]: [...entries, buildHookSettingsEntry()] } };
|
|
269
265
|
};
|
|
270
266
|
|
|
271
|
-
export const preflightGateHook = ({ cwd
|
|
267
|
+
export const preflightGateHook = ({ cwd }, deps = {}) => {
|
|
272
268
|
const fs = fsDeps(deps);
|
|
273
269
|
const projectDir = resolve(cwd ?? deps.cwd ?? process.cwd());
|
|
274
270
|
const bundleContent = readBundledHook(deps);
|
|
@@ -277,12 +273,6 @@ export const preflightGateHook = ({ cwd, reseed = false }, deps = {}) => {
|
|
|
277
273
|
assertDirSafe(join(projectDir, CLAUDE_DIR), CLAUDE_DIR, fs);
|
|
278
274
|
assertDirSafe(join(projectDir, HOOKS_DIR), HOOKS_DIR, fs);
|
|
279
275
|
const target = planTarget(join(projectDir, HOOK_FILE_REL), HOOK_FILE_REL, bundleContent, fs);
|
|
280
|
-
if (reseed && target.action === TARGET_PLACE) {
|
|
281
|
-
throw makeGateHookError(
|
|
282
|
-
GATE_HOOK_STALE,
|
|
283
|
-
`${HOOK_FILE_REL} is not placed — --reseed replaces a placed hook; place it with: ${applyGateHookCommand(projectDir)}`,
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
276
|
assertSettingsWritable(join(projectDir, SETTINGS_FILE), fs);
|
|
287
277
|
const projectSettings = readSettingsFile(join(projectDir, SETTINGS_FILE), { ...deps, cwd: projectDir });
|
|
288
278
|
const localSettings = readSettingsFile(join(projectDir, SETTINGS_LOCAL_FILE), { ...deps, cwd: projectDir });
|
|
@@ -301,17 +291,6 @@ export const preflightGateHook = ({ cwd, reseed = false }, deps = {}) => {
|
|
|
301
291
|
|
|
302
292
|
const wiredInProject = isHookWired(projectSettings.data);
|
|
303
293
|
const wiredInLocal = isHookWired(localSettings.data);
|
|
304
|
-
// Diverged target + our entry NOT wired anywhere = STOP on BOTH dry-run and apply: applying
|
|
305
|
-
// would wire an unknown script as a PreToolUse hook — exactly what consent must not slide
|
|
306
|
-
// past. (Diverged + already wired is the user's own standing state: report-only, below.) Under
|
|
307
|
-
// --reseed this is exactly the state the reseed replaces before it wires.
|
|
308
|
-
if (!reseed && target.action === TARGET_DIVERGED && !wiredInProject && !wiredInLocal) {
|
|
309
|
-
throw makeGateHookError(
|
|
310
|
-
GATE_HOOK_DIVERGED,
|
|
311
|
-
`${HOOK_FILE_REL} exists with DIFFERENT content and is not wired — refusing to wire an unknown script as a PreToolUse hook; reseed it from the bundle: ${applyReseedCommand(projectDir)}`,
|
|
312
|
-
);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
294
|
return { projectDir, bundleContent, stamp, stampOk, target, projectSettings, localSettings, wiredInProject, wiredInLocal };
|
|
316
295
|
};
|
|
317
296
|
|
|
@@ -320,13 +299,13 @@ export const preflightGateHook = ({ cwd, reseed = false }, deps = {}) => {
|
|
|
320
299
|
export const formatJson = (data, eol) =>
|
|
321
300
|
`${JSON.stringify(data, null, SETTINGS_JSON_INDENT).replace(JSON_NEWLINE_PATTERN, eol)}${eol}`;
|
|
322
301
|
|
|
323
|
-
export const writeGateHook = ({ cwd, dryRun = true
|
|
302
|
+
export const writeGateHook = ({ cwd, dryRun = true } = {}, deps = {}) => {
|
|
324
303
|
const fs = fsDeps(deps);
|
|
325
|
-
const preflight = preflightGateHook({ cwd: cwd ?? deps.cwd ?? process.cwd()
|
|
304
|
+
const preflight = preflightGateHook({ cwd: cwd ?? deps.cwd ?? process.cwd() }, deps);
|
|
326
305
|
const placePlanned = preflight.target.action === TARGET_PLACE;
|
|
327
|
-
const
|
|
306
|
+
const replacePlanned = preflight.target.action === TARGET_DIVERGED;
|
|
328
307
|
const wirePlanned = !preflight.wiredInProject && !preflight.wiredInLocal;
|
|
329
|
-
const base = { placePlanned,
|
|
308
|
+
const base = { placePlanned, replacePlanned, wirePlanned, ...preflight };
|
|
330
309
|
if (dryRun) return { wrote: false, dryRun: true, ...base };
|
|
331
310
|
|
|
332
311
|
if (!preflight.stampOk) {
|
|
@@ -342,7 +321,7 @@ export const writeGateHook = ({ cwd, dryRun = true, reseed = false } = {}, deps
|
|
|
342
321
|
fs.mkdir(join(preflight.projectDir, HOOKS_DIR), { recursive: true });
|
|
343
322
|
writeHookFile(hookAbs, HOOK_FILE_REL, preflight.bundleContent, true, fs);
|
|
344
323
|
}
|
|
345
|
-
if (
|
|
324
|
+
if (replacePlanned) writeHookFile(hookAbs, HOOK_FILE_REL, preflight.bundleContent, false, fs); // in place: the inode stays
|
|
346
325
|
if (wirePlanned) {
|
|
347
326
|
// Re-verify the target no-follow immediately BEFORE wiring: preflight read it earlier, and an
|
|
348
327
|
// external process could have swapped it (or slipped a symlink in) between preflight and now.
|
|
@@ -362,7 +341,7 @@ export const writeGateHook = ({ cwd, dryRun = true, reseed = false } = {}, deps
|
|
|
362
341
|
UTF8,
|
|
363
342
|
);
|
|
364
343
|
}
|
|
365
|
-
return { wrote: placePlanned ||
|
|
344
|
+
return { wrote: placePlanned || replacePlanned || wirePlanned, dryRun: false, ...base };
|
|
366
345
|
};
|
|
367
346
|
|
|
368
347
|
// ── the read-lane writer (--read-lane; AD-055 Part II, Decisions 5/9) ──────────────────
|
|
@@ -372,7 +351,7 @@ export const writeGateHook = ({ cwd, dryRun = true, reseed = false } = {}, deps
|
|
|
372
351
|
// merge-preserve, symlink/non-regular refusal, malformed-JSON fail-closed, atomic), PLUS a CURRENCY
|
|
373
352
|
// CHECK (Decisions 9): --apply refuses unless the PLACED hook is byte-identical to the current
|
|
374
353
|
// bundle — enabling a lane a pre-1.48 hook can never read would be a silent no-op the user paid
|
|
375
|
-
// consent for. The refusal names the
|
|
354
|
+
// consent for. The refusal names `gate-hook --apply`, which writes the hook current.
|
|
376
355
|
|
|
377
356
|
const laneStop = (message) => makeGateHookError(GATE_HOOK_LANE, message);
|
|
378
357
|
|
|
@@ -411,7 +390,6 @@ const preflightLaneTarget = (absPath, deps) => {
|
|
|
411
390
|
};
|
|
412
391
|
|
|
413
392
|
export const applyGateHookCommand = (root) => `node ${q(GATE_HOOK_TOOL)} --apply --cwd ${q(root)}`;
|
|
414
|
-
export const applyReseedCommand = (root) => `node ${q(GATE_HOOK_TOOL)} --apply --reseed --cwd ${q(root)}`;
|
|
415
393
|
export const applyReadLaneCommand = (root) => `node ${q(GATE_HOOK_TOOL)} --read-lane --cwd ${q(root)} --apply`;
|
|
416
394
|
|
|
417
395
|
// The currency check (Decisions 9): the PLACED hook must be byte-identical to the current bundle,
|
|
@@ -434,7 +412,7 @@ const checkHookCurrency = (root, bundleContent, fs) => {
|
|
|
434
412
|
return {
|
|
435
413
|
current: false,
|
|
436
414
|
reason: `${HOOK_FILE_REL} is not the current bundle`,
|
|
437
|
-
refusal: `${HOOK_FILE_REL} is NOT the current bundle — enabling the read-lane now would be a silent no-op (a pre-1.48 hook never reads ${LANES_REL}).
|
|
415
|
+
refusal: `${HOOK_FILE_REL} is NOT the current bundle — enabling the read-lane now would be a silent no-op (a pre-1.48 hook never reads ${LANES_REL}). Write it current, then re-run with --read-lane:\n ${applyGateHookCommand(root)}`,
|
|
438
416
|
};
|
|
439
417
|
}
|
|
440
418
|
return { current: true, reason: 'the placed hook is the current bundle' };
|
|
@@ -513,7 +491,7 @@ export const formatReadLaneResult = (result) => {
|
|
|
513
491
|
lines.push(
|
|
514
492
|
result.currency.current
|
|
515
493
|
? ' hook currency: current — the lane will fire once enabled.'
|
|
516
|
-
: ` hook currency: STALE — ${result.currency.reason}; --apply will REFUSE until
|
|
494
|
+
: ` hook currency: STALE — ${result.currency.reason}; --apply will REFUSE until the hook is written current (${applyGateHookCommand(result.root)}).`,
|
|
517
495
|
);
|
|
518
496
|
if (!result.wired) {
|
|
519
497
|
lines.push(` hook wiring: NOT wired into ${SETTINGS_FILE}; --apply will REFUSE until you wire it (${applyGateHookCommand(result.root)}).`);
|
|
@@ -534,8 +512,7 @@ const TRUST_POSTURE_LINE =
|
|
|
534
512
|
const formatTargetLine = (result) => {
|
|
535
513
|
if (result.target.action === TARGET_PLACE) return ` - ${HOOK_FILE_REL}: ${result.dryRun ? 'would place' : 'placed'}`;
|
|
536
514
|
if (result.target.action === TARGET_CURRENT) return ` - ${HOOK_FILE_REL}: already current`;
|
|
537
|
-
|
|
538
|
-
return ` - ${HOOK_FILE_REL}: diverged from the bundle — preserved, never clobbered (already wired; reseed it from the bundle: ${applyReseedCommand(result.projectDir)})`;
|
|
515
|
+
return ` - ${fileLine({ rel: HOOK_FILE_REL, state: 'hook' }, result.dryRun ? undefined : 'written', result.dryRun)}`;
|
|
539
516
|
};
|
|
540
517
|
|
|
541
518
|
const formatSettingsLine = (result) => {
|
|
@@ -544,14 +521,9 @@ const formatSettingsLine = (result) => {
|
|
|
544
521
|
return ` - ${SETTINGS_FILE}: ${result.dryRun ? 'would wire' : 'wired'} the ${PRE_TOOL_USE_EVENT} "${HOOK_MATCHER}" entry`;
|
|
545
522
|
};
|
|
546
523
|
|
|
547
|
-
const RESEED_CURRENT_LINE = 'nothing to change: the placed hook is current';
|
|
548
|
-
|
|
549
524
|
export const formatResult = (result) => {
|
|
550
|
-
if (result.reseed && !result.reseedPlanned && !result.wirePlanned) return RESEED_CURRENT_LINE;
|
|
551
525
|
const lines = [
|
|
552
|
-
result.dryRun
|
|
553
|
-
? `agent-workflow gate hook — DRY RUN (no changes; re-run with --apply${result.reseed ? ' --reseed' : ''})`
|
|
554
|
-
: 'agent-workflow gate hook — APPLY',
|
|
526
|
+
result.dryRun ? 'agent-workflow gate hook — DRY RUN (no changes; re-run with --apply)' : 'agent-workflow gate hook — APPLY',
|
|
555
527
|
formatTargetLine(result),
|
|
556
528
|
formatSettingsLine(result),
|
|
557
529
|
TRUST_POSTURE_LINE,
|
|
@@ -569,14 +541,13 @@ export const formatResult = (result) => {
|
|
|
569
541
|
// ── CLI ───────────────────────────────────────────────────────────────────────────────
|
|
570
542
|
|
|
571
543
|
export const parseArgs = (argv) => {
|
|
572
|
-
const opts = { dryRunFlag: false, apply: false, cwd: undefined, help: false, readLane: false
|
|
544
|
+
const opts = { dryRunFlag: false, apply: false, cwd: undefined, help: false, readLane: false };
|
|
573
545
|
for (let i = 0; i < argv.length; i += 1) {
|
|
574
546
|
const arg = argv[i];
|
|
575
547
|
if (arg === '--help' || arg === '-h') opts.help = true;
|
|
576
548
|
else if (arg === '--dry-run') opts.dryRunFlag = true;
|
|
577
549
|
else if (arg === '--apply') opts.apply = true;
|
|
578
550
|
else if (arg === '--read-lane') opts.readLane = true;
|
|
579
|
-
else if (arg === '--reseed') opts.reseed = true;
|
|
580
551
|
else if (arg === '--cwd') {
|
|
581
552
|
i += 1;
|
|
582
553
|
if (argv[i] === undefined || argv[i].startsWith('-')) throw fail(EXIT_USAGE, '--cwd needs a directory argument');
|
|
@@ -586,8 +557,7 @@ export const parseArgs = (argv) => {
|
|
|
586
557
|
}
|
|
587
558
|
}
|
|
588
559
|
if (opts.dryRunFlag && opts.apply) throw fail(EXIT_USAGE, '--dry-run and --apply cannot be used together');
|
|
589
|
-
|
|
590
|
-
return { help: opts.help, dryRun: !opts.apply, cwd: opts.cwd, readLane: opts.readLane, reseed: opts.reseed };
|
|
560
|
+
return { help: opts.help, dryRun: !opts.apply, cwd: opts.cwd, readLane: opts.readLane };
|
|
591
561
|
};
|
|
592
562
|
|
|
593
563
|
export const main = (argv = process.argv.slice(2), deps = {}) => {
|
|
@@ -604,7 +574,7 @@ export const main = (argv = process.argv.slice(2), deps = {}) => {
|
|
|
604
574
|
log(formatReadLaneResult(laneResult));
|
|
605
575
|
return EXIT_OK;
|
|
606
576
|
}
|
|
607
|
-
const result = writeGateHook({ cwd: args.cwd ?? deps.cwd ?? process.cwd(), dryRun: args.dryRun
|
|
577
|
+
const result = writeGateHook({ cwd: args.cwd ?? deps.cwd ?? process.cwd(), dryRun: args.dryRun }, deps);
|
|
608
578
|
log(formatResult(result));
|
|
609
579
|
return EXIT_OK;
|
|
610
580
|
} catch (err) {
|