wayform 0.3.1 → 0.4.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 +308 -205
- package/dist/build-skill.js +86 -0
- package/dist/build-skill.js.map +1 -0
- package/dist/build.js +188 -0
- package/dist/build.js.map +1 -0
- package/dist/cli.js +6 -1
- package/dist/cli.js.map +1 -1
- package/dist/frontmatter.js.map +1 -1
- package/dist/guard-hook.js +52 -13
- package/dist/guard-hook.js.map +1 -1
- package/dist/hook-clients.js +61 -17
- package/dist/hook-clients.js.map +1 -1
- package/dist/init-configs.js +18 -1
- package/dist/init-configs.js.map +1 -1
- package/dist/init-remote.js +11 -0
- package/dist/init-remote.js.map +1 -1
- package/dist/remote-read.js +15 -4
- package/dist/remote-read.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wayform-build skill, embedded as a string because the npm package ships
|
|
3
|
+
* only dist/. `wayform init --remote` writes it into each wired client's skills dir.
|
|
4
|
+
*/
|
|
5
|
+
import fs from "node:fs";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
export const BUILD_SKILL_NAME = "wayform-build";
|
|
8
|
+
const SKILL_DIRS = {
|
|
9
|
+
claude: ".claude/skills",
|
|
10
|
+
// Cursor reads project skills from .agents/skills, so it shares Codex's copy.
|
|
11
|
+
cursor: ".agents/skills",
|
|
12
|
+
codex: ".agents/skills",
|
|
13
|
+
};
|
|
14
|
+
/** Repo-relative install path of the skill for a client. */
|
|
15
|
+
export function skillPath(client) {
|
|
16
|
+
return `${SKILL_DIRS[client]}/${BUILD_SKILL_NAME}/SKILL.md`;
|
|
17
|
+
}
|
|
18
|
+
export const BUILD_SKILL_MD = `---
|
|
19
|
+
name: wayform-build
|
|
20
|
+
description: Build a Wayform plan end to end with subagents. Use ONLY when asked to build, implement, execute or resume a specific Wayform plan by number (#N), or on /wayform-build. Not for general Wayform questions, memory lookups, or guard/hook behaviour.
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
# Build a Wayform plan
|
|
24
|
+
|
|
25
|
+
You are the orchestrator. Use subagents for this: every checklist task goes to its own subagent, and you
|
|
26
|
+
coordinate, verify and record. The request names a plan number (#N) and usually a project. If no project
|
|
27
|
+
is named, use the project from the Wayform session-start briefing; if there is none, ask which project.
|
|
28
|
+
|
|
29
|
+
## 1. Load and claim the plan
|
|
30
|
+
|
|
31
|
+
- \`read_plan(project, plan="#N")\`.
|
|
32
|
+
- State \`active\`: call \`transition_plan(project, plan="#N", to="building", agent="<your client: claude-code | cursor | codex>")\`.
|
|
33
|
+
- State \`building\`: you are resuming. Skip the transition; unchecked items are what is left.
|
|
34
|
+
- Any other state (draft, shipped, superseded): stop. Say the plan must be approved (active) first.
|
|
35
|
+
|
|
36
|
+
## 2. Split the checklist into tasks
|
|
37
|
+
|
|
38
|
+
- Each unchecked \`- [ ]\` item is a task. Skip checked \`- [x]\` items.
|
|
39
|
+
- Mark each task independent or ordered. A task is ordered when it needs another task's output (a file,
|
|
40
|
+
an interface, a migration). When unsure, treat it as ordered.
|
|
41
|
+
- Show the user the task list and the order in one short message, then continue without waiting.
|
|
42
|
+
|
|
43
|
+
## 3. Run each task in a subagent
|
|
44
|
+
|
|
45
|
+
For each task, in order (independent tasks in parallel: several subagent launches in one message):
|
|
46
|
+
|
|
47
|
+
1. \`task_brief(project, plan="#N", task="<the checklist item text, verbatim>")\`.
|
|
48
|
+
2. Launch one subagent. Its prompt is, in this order:
|
|
49
|
+
- the task brief, **verbatim**;
|
|
50
|
+
- the task text, plus any file or interface an earlier task produced that this one needs;
|
|
51
|
+
- "Do not launch subagents of your own. When done, report the files you changed, the tests you ran and
|
|
52
|
+
their result, and any decision in the brief you could not honour."
|
|
53
|
+
3. Subagents never launch further subagents. Do not ask them to.
|
|
54
|
+
|
|
55
|
+
If a subagent reports it could not honour a decision, do not work around it: stop that task and tell the user
|
|
56
|
+
which decision and why.
|
|
57
|
+
|
|
58
|
+
If a subagent reports that Wayform blocked an action, ask the user whether to go ahead. Only if they explicitly confirm, call guard_allow(project, ticket) with the ticket from the block message and re-run that task.
|
|
59
|
+
|
|
60
|
+
## 4. Verify and record each task
|
|
61
|
+
|
|
62
|
+
- Check the work yourself: run the tests, lint or build the plan names for that item (or the project's
|
|
63
|
+
usual test command). Read the diff. A subagent's "done" is not evidence.
|
|
64
|
+
- Passing: tick that item. \`read_plan\` again; the plan markdown is everything after the first \`---\` line of its output, and
|
|
65
|
+
the header line shows its \`rev\`. Change only that \`- [ ]\` to \`- [x]\`, then
|
|
66
|
+
\`edit_plan(project, plan="#N", body=<that markdown>, base_rev=<rev>)\`. If it reports the plan changed, re-read and retry.
|
|
67
|
+
- Failing: send the subagent (or a new one with the same brief) the failure; at most two retries, then stop
|
|
68
|
+
and report.
|
|
69
|
+
|
|
70
|
+
## 5. Finish
|
|
71
|
+
|
|
72
|
+
- Report to the user: tasks done, tests run and their results, anything skipped or blocked.
|
|
73
|
+
- Do not commit, push or merge unless the user asks.
|
|
74
|
+
- After the work merges: \`transition_plan(project, plan="#N", to="shipped", commit_sha=<merge sha>,
|
|
75
|
+
decisions=[…])\`. Each decision is one self-contained fact with its "because", only the ones this build
|
|
76
|
+
actually settled.
|
|
77
|
+
`;
|
|
78
|
+
/** Write (overwrite) the skill into a repo. Wayform-managed: init refreshes it. */
|
|
79
|
+
export function installBuildSkill(cwd, client) {
|
|
80
|
+
const rel = skillPath(client);
|
|
81
|
+
const file = path.join(cwd, rel);
|
|
82
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
83
|
+
fs.writeFileSync(file, BUILD_SKILL_MD);
|
|
84
|
+
return rel;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=build-skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-skill.js","sourceRoot":"","sources":["../src/build-skill.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAI7B,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEhD,MAAM,UAAU,GAAgC;IAC9C,MAAM,EAAE,gBAAgB;IACxB,8EAA8E;IAC9E,MAAM,EAAE,gBAAgB;IACxB,KAAK,EAAE,gBAAgB;CACxB,CAAC;AAEF,4DAA4D;AAC5D,MAAM,UAAU,SAAS,CAAC,MAAmB;IAC3C,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,gBAAgB,WAAW,CAAC;AAC9D,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2D7B,CAAC;AAEF,mFAAmF;AACnF,MAAM,UAAU,iBAAiB,CAAC,GAAW,EAAE,MAAmB;IAChE,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACjC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACtD,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IACvC,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/build.js
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `wayform build <N>` — launch the user's own coding agent, interactively in
|
|
3
|
+
* their terminal, to build plan #N with the wayform-build skill. No headless
|
|
4
|
+
* runs, no shell: prompt and project are untrusted, so argv arrays only.
|
|
5
|
+
*/
|
|
6
|
+
import { execFileSync, spawn } from "node:child_process";
|
|
7
|
+
import fs from "node:fs";
|
|
8
|
+
import os from "node:os";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { defaultProject, envVar } from "./config.js";
|
|
11
|
+
import { skillPath } from "./build-skill.js";
|
|
12
|
+
import { parseRemoteClients } from "./init-remote.js";
|
|
13
|
+
const USAGE = "Usage: wayform build <N> [--client claude|cursor|codex] [--project <name>]";
|
|
14
|
+
const ORDER = ["claude", "cursor", "codex"];
|
|
15
|
+
export class BuildError extends Error {
|
|
16
|
+
}
|
|
17
|
+
export function parsePlanNumber(raw) {
|
|
18
|
+
const m = /^#?(\d+)$/.exec(raw ?? "");
|
|
19
|
+
const n = m ? Number(m[1]) : 0;
|
|
20
|
+
if (!Number.isSafeInteger(n) || n < 1)
|
|
21
|
+
throw new BuildError(USAGE);
|
|
22
|
+
return n;
|
|
23
|
+
}
|
|
24
|
+
// Byte-identical with the desktop app's Rust build_prompt.
|
|
25
|
+
export function buildPrompt(client, n, project) {
|
|
26
|
+
// Codex invokes a skill from the prompt with `$name` (verified, codex 0.160).
|
|
27
|
+
if (client === "claude")
|
|
28
|
+
return `/wayform-build #${n} in project "${project}"`;
|
|
29
|
+
if (client === "codex")
|
|
30
|
+
return `$wayform-build #${n} in project "${project}"`;
|
|
31
|
+
return `Use the wayform-build skill to build plan #${n} in project "${project}".`;
|
|
32
|
+
}
|
|
33
|
+
/** The command to run for a client, or undefined if its binary is missing. */
|
|
34
|
+
export function buildCommand(client, repoDir, prompt, deps) {
|
|
35
|
+
if (client === "claude") {
|
|
36
|
+
const local = path.join(deps.home, ".claude", "local", "claude");
|
|
37
|
+
const bin = deps.which("claude")
|
|
38
|
+
? "claude"
|
|
39
|
+
: deps.exists(local)
|
|
40
|
+
? local
|
|
41
|
+
: undefined;
|
|
42
|
+
return bin ? { bin, args: [prompt] } : undefined;
|
|
43
|
+
}
|
|
44
|
+
if (client === "cursor") {
|
|
45
|
+
const bin = deps.which("agent")
|
|
46
|
+
? "agent"
|
|
47
|
+
: deps.which("cursor-agent")
|
|
48
|
+
? "cursor-agent"
|
|
49
|
+
: undefined;
|
|
50
|
+
return bin ? { bin, args: ["--workspace", repoDir, prompt] } : undefined;
|
|
51
|
+
}
|
|
52
|
+
return deps.which("codex") ? { bin: "codex", args: [prompt] } : undefined;
|
|
53
|
+
}
|
|
54
|
+
export function planBuild(args, deps) {
|
|
55
|
+
const flags = {};
|
|
56
|
+
const pos = [];
|
|
57
|
+
for (let i = 0; i < args.length; i++) {
|
|
58
|
+
const a = args[i];
|
|
59
|
+
if (a === "--client" || a === "--project") {
|
|
60
|
+
const v = args[++i];
|
|
61
|
+
if (!v || v.startsWith("--"))
|
|
62
|
+
throw new BuildError(USAGE);
|
|
63
|
+
flags[a.slice(2)] = v;
|
|
64
|
+
}
|
|
65
|
+
else if (a.startsWith("--")) {
|
|
66
|
+
throw new BuildError(USAGE); // unknown flag or --flag=value form
|
|
67
|
+
}
|
|
68
|
+
else
|
|
69
|
+
pos.push(a);
|
|
70
|
+
}
|
|
71
|
+
if (pos.length > 1)
|
|
72
|
+
throw new BuildError(USAGE);
|
|
73
|
+
const positional = pos[0];
|
|
74
|
+
const flag = (name) => flags[name];
|
|
75
|
+
const n = parsePlanNumber(positional);
|
|
76
|
+
const repoDir = deps.repoDir(deps.cwd);
|
|
77
|
+
const project = flag("project") ?? envVar("PROJECT") ?? defaultProject(repoDir);
|
|
78
|
+
const has = (c) => deps.exists(path.join(repoDir, skillPath(c)));
|
|
79
|
+
const cmd = (c) => buildCommand(c, repoDir, buildPrompt(c, n, project), deps);
|
|
80
|
+
const plan = (c, notice) => {
|
|
81
|
+
const { bin, args: a } = cmd(c);
|
|
82
|
+
return { bin, args: a, cwd: repoDir, client: c, notice };
|
|
83
|
+
};
|
|
84
|
+
const want = flag("client");
|
|
85
|
+
if (want !== undefined) {
|
|
86
|
+
let c;
|
|
87
|
+
try {
|
|
88
|
+
const [id] = parseRemoteClients(want);
|
|
89
|
+
if (id !== "claude" && id !== "cursor" && id !== "codex") {
|
|
90
|
+
throw new BuildError(`wayform build supports claude, cursor and codex (not ${id}).`);
|
|
91
|
+
}
|
|
92
|
+
c = id;
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
// parseRemoteClients lists every init client; build supports three.
|
|
96
|
+
throw e instanceof BuildError
|
|
97
|
+
? e
|
|
98
|
+
: new BuildError(`Unknown client "${want}". Use: claude, cursor, codex`);
|
|
99
|
+
}
|
|
100
|
+
if (!has(c)) {
|
|
101
|
+
throw new BuildError(`${skillPath(c)} is missing — run \`wayform init --remote\` first.`);
|
|
102
|
+
}
|
|
103
|
+
if (!cmd(c))
|
|
104
|
+
throw new BuildError(`${c} is not installed (not on PATH).`);
|
|
105
|
+
return plan(c);
|
|
106
|
+
}
|
|
107
|
+
const withSkill = ORDER.filter(has);
|
|
108
|
+
const ready = withSkill.filter((c) => cmd(c));
|
|
109
|
+
if (ready.length === 0) {
|
|
110
|
+
// cursor and codex share one path; list it once.
|
|
111
|
+
const missingSkill = [
|
|
112
|
+
...new Set(ORDER.filter((c) => !has(c)).map(skillPath)),
|
|
113
|
+
];
|
|
114
|
+
throw new BuildError(withSkill.length === 0
|
|
115
|
+
? `No wayform-build skill found (missing: ${missingSkill.join(", ")}) — run \`wayform init --remote\` first.`
|
|
116
|
+
: `Skill installed for ${withSkill.join(", ")} but no matching agent is on PATH. Install one of them.`);
|
|
117
|
+
}
|
|
118
|
+
return plan(ready[0], ready.length > 1
|
|
119
|
+
? `Using ${ready[0]} (pass --client to choose).`
|
|
120
|
+
: undefined);
|
|
121
|
+
}
|
|
122
|
+
const defaultDeps = () => ({
|
|
123
|
+
which: (bin) => {
|
|
124
|
+
for (const d of (process.env.PATH ?? "").split(path.delimiter)) {
|
|
125
|
+
const f = path.join(d, bin);
|
|
126
|
+
try {
|
|
127
|
+
fs.accessSync(f, fs.constants.X_OK);
|
|
128
|
+
if (fs.statSync(f).isFile())
|
|
129
|
+
return f;
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
/* keep looking */
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return undefined;
|
|
136
|
+
},
|
|
137
|
+
exists: fs.existsSync,
|
|
138
|
+
spawn: (bin, args, opts) => spawn(bin, args, opts),
|
|
139
|
+
cwd: process.cwd(),
|
|
140
|
+
home: os.homedir(),
|
|
141
|
+
proc: process,
|
|
142
|
+
repoDir: (cwd) => {
|
|
143
|
+
try {
|
|
144
|
+
return execFileSync("git", ["rev-parse", "--show-toplevel"], {
|
|
145
|
+
cwd,
|
|
146
|
+
encoding: "utf8",
|
|
147
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
148
|
+
}).trim();
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
return cwd;
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
});
|
|
155
|
+
export async function runBuild(args, deps = defaultDeps()) {
|
|
156
|
+
const proc = deps.proc;
|
|
157
|
+
let plan;
|
|
158
|
+
try {
|
|
159
|
+
plan = planBuild(args, deps);
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
if (!(e instanceof BuildError))
|
|
163
|
+
throw e;
|
|
164
|
+
console.error(e.message);
|
|
165
|
+
return proc.exit(1);
|
|
166
|
+
}
|
|
167
|
+
if (plan.notice)
|
|
168
|
+
console.error(plan.notice);
|
|
169
|
+
const child = deps.spawn(plan.bin, plan.args, {
|
|
170
|
+
cwd: plan.cwd,
|
|
171
|
+
stdio: "inherit",
|
|
172
|
+
});
|
|
173
|
+
// The interactive agent handles Ctrl-C itself (SIGINT hits the whole
|
|
174
|
+
// foreground group); we must outlive it to relay its exit code.
|
|
175
|
+
proc.on("SIGINT", () => { });
|
|
176
|
+
for (const sig of ["SIGTERM", "SIGHUP"]) {
|
|
177
|
+
proc.on(sig, () => child.kill(sig));
|
|
178
|
+
}
|
|
179
|
+
const code = await new Promise((resolve) => {
|
|
180
|
+
child.on("error", (err) => {
|
|
181
|
+
console.error(`Could not launch ${plan.bin}: ${err.message}`);
|
|
182
|
+
resolve(1);
|
|
183
|
+
});
|
|
184
|
+
child.on("exit", (c, sig) => resolve(c ?? (sig ? 128 + (os.constants.signals[sig] ?? 1) : 1)));
|
|
185
|
+
});
|
|
186
|
+
proc.exit(code);
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,SAAS,EAAoB,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,KAAK,GACT,4EAA4E,CAAC;AAC/E,MAAM,KAAK,GAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AAmC3D,MAAM,OAAO,UAAW,SAAQ,KAAK;CAAG;AAExC,MAAM,UAAU,eAAe,CAAC,GAAuB;IACrD,MAAM,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC;IACtC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;IACnE,OAAO,CAAC,CAAC;AACX,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,WAAW,CACzB,MAAmB,EACnB,CAAS,EACT,OAAe;IAEf,8EAA8E;IAC9E,IAAI,MAA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CAAC,GAAG,EAAE,EAAE;YACxB,OAAO,CAAC,KAAK,CAAC,oBAAoB,IAAI,CAAC,GAAG,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9D,OAAO,CAAC,CAAC,CAAC,CAAC;QACb,CAAC,CAAC,CAAC;QACH,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAC1B,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACjE,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAClB,CAAC"}
|
package/dist/cli.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* wayform stop-review <client> -> Stop no-op (legacy; re-engagement removed)
|
|
11
11
|
* wayform login -> GitHub OAuth; tokens go to the OS keychain
|
|
12
12
|
* wayform init [flags] -> installer (add --remote for hosted members)
|
|
13
|
+
* wayform build <N> [flags] -> launch your agent to build plan #N
|
|
13
14
|
* wayform doctor -> local diagnostics
|
|
14
15
|
* wayform space create [flags] -> print App install URL + allowlist reminder
|
|
15
16
|
*
|
|
@@ -22,6 +23,7 @@ import { runHook } from "./hook.js";
|
|
|
22
23
|
import { runPromptHook } from "./prompt-hook.js";
|
|
23
24
|
import { runGuardHook } from "./guard-hook.js";
|
|
24
25
|
import { runInit } from "./init.js";
|
|
26
|
+
import { runBuild } from "./build.js";
|
|
25
27
|
import { runDoctor } from "./doctor.js";
|
|
26
28
|
import { runSpaceCreate } from "./space-create.js";
|
|
27
29
|
import { runLogin } from "./oauth-login.js";
|
|
@@ -55,6 +57,9 @@ async function main() {
|
|
|
55
57
|
case "init":
|
|
56
58
|
await runInit(rest);
|
|
57
59
|
return;
|
|
60
|
+
case "build":
|
|
61
|
+
await runBuild(rest);
|
|
62
|
+
return;
|
|
58
63
|
case "doctor":
|
|
59
64
|
await runDoctor();
|
|
60
65
|
return;
|
|
@@ -76,7 +81,7 @@ async function main() {
|
|
|
76
81
|
await runServer();
|
|
77
82
|
return;
|
|
78
83
|
default:
|
|
79
|
-
console.error(`Unknown command "${sub}". Use: wayform [hook|prompt-hook|guard|stop-review|init|doctor|login|token|space] …`);
|
|
84
|
+
console.error(`Unknown command "${sub}". Use: wayform [hook|prompt-hook|guard|stop-review|init|build|doctor|login|token|space] …`);
|
|
80
85
|
process.exit(1);
|
|
81
86
|
}
|
|
82
87
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,KAAK,UAAU,IAAI;IACjB,6EAA6E;IAC7E,8EAA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AO;YACV,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;gBACzB,MAAM,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;gBACpC,OAAO;YACT,CAAC;YACD,OAAO,CAAC,KAAK,CACX,+BAA+B,IAAI,CAAC,CAAC,CAAC,qDAAqD,CAC5F,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChB,OAAO;QACT,KAAK,SAAS;YACZ,MAAM,SAAS,EAAE,CAAC;YAClB,OAAO;QACT;YACE,OAAO,CAAC,KAAK,CACX,oBAAoB,GAAG,4FAA4F,CACpH,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/frontmatter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../src/frontmatter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../src/frontmatter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA6CH;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,EAAoB,EAAE,OAAe;IAClE,OAAO,CACL,OAAO;QACP,WAAW,EAAE,CAAC,MAAM,IAAI;QACxB,SAAS,EAAE,CAAC,IAAI,IAAI;QACpB,cAAc,EAAE,CAAC,SAAS,IAAI;QAC9B,OAAO,EAAE,CAAC,EA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L,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC9B,OAAO,GAAG,KAAK,CAAC,CAAC;YACf,CAAC,CAAC,IAAI;YACN,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9D,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,CAAC,EAAyB,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CACpD,CAAC;IAEF,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACnD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACtC,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAG,KAAK,CAAC,IAAkB,IAAI,SAAS;QAC5C,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE;QAClB,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;QACxB,IAAI;QACJ,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5B,CAAC;AACJ,CAAC"}
|
package/dist/guard-hook.js
CHANGED
|
@@ -2,27 +2,36 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* PreToolUse guard hook — the enforcement half of wayform.
|
|
4
4
|
*
|
|
5
|
-
* Claude Code
|
|
5
|
+
* Claude Code, Cursor and Codex run this before mutating tool calls. It
|
|
6
6
|
* summarizes the proposed action, asks the gateway whether it contradicts a
|
|
7
|
-
* live team decision, and emits
|
|
7
|
+
* live team decision, and when it does emits Claude Code's native "ask" — or,
|
|
8
|
+
* on Cursor/Codex (which cannot ask), a deny carrying a per-decision ticket the
|
|
9
|
+
* model redeems via guard_allow after the user confirms.
|
|
8
10
|
*
|
|
9
11
|
* FAIL-OPEN, and more load-bearing here than anywhere else: this sits on the
|
|
10
12
|
* hot path of every edit. Wrong config, offline gateway, slow judge, weird
|
|
11
|
-
* payload — all resolve to the
|
|
12
|
-
* as if no hook existed.
|
|
13
|
+
* payload — all resolve to the client's allow output and exit 0, so the tool
|
|
14
|
+
* runs exactly as if no hook existed.
|
|
13
15
|
*/
|
|
14
16
|
import { loadConfig, defaultProject, envVar } from "./config.js";
|
|
15
17
|
import { remoteGuardCheck } from "./remote-read.js";
|
|
16
|
-
import { resolveClient, renderGuardDecision,
|
|
18
|
+
import { resolveClient, renderGuardDecision, renderGuardAllow, } from "./hook-clients.js";
|
|
17
19
|
import { isMain } from "./is-main.js";
|
|
18
20
|
/**
|
|
19
21
|
* PreToolUse fires on EVERY tool. Guarding reads would put network latency on
|
|
20
22
|
* calls that cannot contradict a decision, so only mutating tools qualify.
|
|
21
23
|
*/
|
|
22
24
|
export const GUARDED_TOOLS = new Set([
|
|
25
|
+
// Claude Code (Bash is shared with Codex)
|
|
23
26
|
"Edit",
|
|
24
27
|
"Write",
|
|
25
28
|
"Bash",
|
|
29
|
+
// Codex
|
|
30
|
+
"apply_patch",
|
|
31
|
+
// Cursor
|
|
32
|
+
"Shell",
|
|
33
|
+
"StrReplace",
|
|
34
|
+
"Delete",
|
|
26
35
|
]);
|
|
27
36
|
/** On unless explicitly disabled; "ask" is already the safe setting. */
|
|
28
37
|
export function guardEnabled(env) {
|
|
@@ -39,17 +48,42 @@ export function summarizeAction(toolName, toolInput) {
|
|
|
39
48
|
return "";
|
|
40
49
|
const input = toolInput;
|
|
41
50
|
const str = (k) => typeof input[k] === "string" ? input[k] : "";
|
|
42
|
-
const path = str("file_path");
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
return "";
|
|
51
|
+
const path = str("file_path") || str("path");
|
|
52
|
+
const keys = ["command", "new_string", "content", "contents", "prompt"];
|
|
53
|
+
const payload = keys.map(str).find(Boolean) ?? "";
|
|
46
54
|
const head = path ? `${toolName} ${path}` : toolName;
|
|
47
|
-
|
|
55
|
+
// A known key present but empty (an Edit that deletes text) keeps the plain
|
|
56
|
+
// summary; only an input with none of them falls back to JSON.
|
|
57
|
+
if (keys.some((k) => typeof input[k] === "string")) {
|
|
58
|
+
if (!path && !payload)
|
|
59
|
+
return "";
|
|
60
|
+
return `${head}: ${payload}`.slice(0, ACTION_CHARS);
|
|
61
|
+
}
|
|
62
|
+
if (path) {
|
|
63
|
+
// A path-only Delete is a whole action; anything else with unknown fields
|
|
64
|
+
// (e.g. Cursor's undocumented Write content key) still gets judged.
|
|
65
|
+
const rest = { ...input };
|
|
66
|
+
delete rest.file_path;
|
|
67
|
+
delete rest.path;
|
|
68
|
+
if (Object.keys(rest).length === 0)
|
|
69
|
+
return head.slice(0, ACTION_CHARS);
|
|
70
|
+
}
|
|
71
|
+
const json = JSON.stringify(input);
|
|
72
|
+
return json === "{}" ? "" : `${head}: ${json}`.slice(0, ACTION_CHARS);
|
|
73
|
+
}
|
|
74
|
+
/** Claude Code sets agent_id only inside a subagent; absent = main agent. */
|
|
75
|
+
export function agentLabel(p) {
|
|
76
|
+
if (typeof p.agent_type === "string" && p.agent_type)
|
|
77
|
+
return p.agent_type;
|
|
78
|
+
if (typeof p.agent_id === "string" && p.agent_id)
|
|
79
|
+
return "subagent";
|
|
80
|
+
return undefined;
|
|
48
81
|
}
|
|
49
82
|
export async function runGuardHook() {
|
|
50
83
|
const client = resolveClient(envVar("HOOK_CLIENT"));
|
|
84
|
+
// Cursor blocks on `{}`, so every fail-open exit goes through here.
|
|
51
85
|
const emitEmpty = () => {
|
|
52
|
-
process.stdout.write(
|
|
86
|
+
process.stdout.write(renderGuardAllow(client));
|
|
53
87
|
process.exit(0);
|
|
54
88
|
};
|
|
55
89
|
try {
|
|
@@ -78,10 +112,15 @@ export async function runGuardHook() {
|
|
|
78
112
|
const cfg = loadConfig();
|
|
79
113
|
// null = gateway unusable. There is no local fallback by design: judging
|
|
80
114
|
// needs the index and the model, both of which live in the gateway.
|
|
81
|
-
const check = await remoteGuardCheck(cfg, project, action
|
|
115
|
+
const check = await remoteGuardCheck(cfg, project, action, {
|
|
116
|
+
agent: agentLabel(payload),
|
|
117
|
+
});
|
|
82
118
|
if (check == null || check.decision !== "ask")
|
|
83
119
|
emitEmpty();
|
|
84
|
-
process.stdout.write(renderGuardDecision(client, "ask", check.reason
|
|
120
|
+
process.stdout.write(renderGuardDecision(client, "ask", check.reason, {
|
|
121
|
+
project,
|
|
122
|
+
ticket: check.ticket,
|
|
123
|
+
}));
|
|
85
124
|
process.exit(0);
|
|
86
125
|
}
|
|
87
126
|
catch {
|
package/dist/guard-hook.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard-hook.js","sourceRoot":"","sources":["../src/guard-hook.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"guard-hook.js","sourceRoot":"","sources":["../src/guard-hook.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,gBAAgB,GAEjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAC;IACxD,0CAA0C;IAC1C,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,aAAa;IACb,SAAS;IACT,OAAO;IACP,YAAY;IACZ,QAA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IAAI,IAAI,KAAK,CAAC,QAAQ,KAAK,KAAK;YAAE,SAAS,EAAE,CAAC;QAE3D,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,mBAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAM,CAAC,MAAM,EAAE;YAChD,OAAO;YACP,MAAM,EAAE,KAAM,CAAC,MAAM;SACtB,CAAC,CACH,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAAC,MAAM,CAAC;QACP,SAAS,EAAE,CAAC;IACd,CAAC;AACH,CAAC;AAED,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAC5B,KAAK,YAAY,EAAE,CAAC;AACtB,CAAC"}
|
package/dist/hook-clients.js
CHANGED
|
@@ -56,24 +56,68 @@ export function renderPromptContext(client, text) {
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* injection; other clients get the empty no-op until their contract is checked.
|
|
63
|
-
*
|
|
64
|
-
* "deny" is never emitted in this phase (spec decision 1): a false positive on
|
|
65
|
-
* ask costs one keystroke, on deny it costs the feature.
|
|
59
|
+
* The guard's fail-open output. Cursor treats any permission-hook output that
|
|
60
|
+
* doesn't match its schema as a BLOCK, so `{}` would stop every guarded call;
|
|
61
|
+
* its allow must be explicit. Everyone else gets the usual empty no-op.
|
|
66
62
|
*/
|
|
67
|
-
export function
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
export function renderGuardAllow(client) {
|
|
64
|
+
return client === "cursor"
|
|
65
|
+
? JSON.stringify({ permission: "allow" })
|
|
66
|
+
: renderEmpty(client);
|
|
67
|
+
}
|
|
68
|
+
/** The block text the model reads on clients that can only deny. */
|
|
69
|
+
export function guardBlockMessage(reason, project, ticket, client) {
|
|
70
|
+
// Codex appends ". Command: …" itself, so its copy drops the final period.
|
|
71
|
+
const end = client === "codex" ? "" : ".";
|
|
72
|
+
return (`Wayform blocked this action: it contradicts a recorded team decision.\n\n${reason}\n\n` +
|
|
73
|
+
`Do not retry it or work around it. Ask the user whether to go ahead anyway ` +
|
|
74
|
+
`(if you are a subagent, stop and report this block, with the ticket, to your orchestrator). ` +
|
|
75
|
+
`Only if the user explicitly confirms: call the Wayform MCP tool ` +
|
|
76
|
+
`guard_allow(project="${project}", ticket="${ticket}"), then retry. The override covers this decision for 10 minutes; a different conflict will ask again${end}`);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* PreToolUse envelope — the one place wayform can stop an action before it
|
|
80
|
+
* happens. Claude Code gets a native "ask". Cursor and Codex cannot ask:
|
|
81
|
+
* Codex parses "ask" but does not support it, and Cursor documents '"ask" is
|
|
82
|
+
* accepted by the schema but not enforced for preToolUse today'
|
|
83
|
+
* (cursor.com/docs/agent/hooks). Both CAN deny with a message the model sees,
|
|
84
|
+
* so they deny with a per-decision ticket the model hands to guard_allow once the
|
|
85
|
+
* user confirms — the ask, routed through the model. Without a ticket (older
|
|
86
|
+
* gateway) a deny would be a dead end, so they allow.
|
|
87
|
+
*/
|
|
88
|
+
export function renderGuardDecision(client, decision, reason, opts = {}) {
|
|
89
|
+
if (decision === "allow")
|
|
90
|
+
return renderGuardAllow(client);
|
|
91
|
+
switch (client) {
|
|
92
|
+
case "claude-code":
|
|
93
|
+
return JSON.stringify({
|
|
94
|
+
hookSpecificOutput: {
|
|
95
|
+
hookEventName: "PreToolUse",
|
|
96
|
+
permissionDecision: "ask",
|
|
97
|
+
permissionDecisionReason: `Wayform — this contradicts a recorded team decision:\n\n${reason}`,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
case "raw":
|
|
101
|
+
return renderEmpty(client);
|
|
102
|
+
case "cursor":
|
|
103
|
+
case "codex": {
|
|
104
|
+
if (!opts.ticket)
|
|
105
|
+
return renderGuardAllow(client);
|
|
106
|
+
const msg = guardBlockMessage(reason, opts.project ?? "", opts.ticket, client);
|
|
107
|
+
return client === "cursor"
|
|
108
|
+
? JSON.stringify({
|
|
109
|
+
permission: "deny",
|
|
110
|
+
user_message: msg,
|
|
111
|
+
agent_message: msg,
|
|
112
|
+
})
|
|
113
|
+
: JSON.stringify({
|
|
114
|
+
hookSpecificOutput: {
|
|
115
|
+
hookEventName: "PreToolUse",
|
|
116
|
+
permissionDecision: "deny",
|
|
117
|
+
permissionDecisionReason: msg,
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
}
|
|
70
121
|
}
|
|
71
|
-
return JSON.stringify({
|
|
72
|
-
hookSpecificOutput: {
|
|
73
|
-
hookEventName: "PreToolUse",
|
|
74
|
-
permissionDecision: "ask",
|
|
75
|
-
permissionDecisionReason: `Wayform — this contradicts a recorded team decision:\n\n${reason}`,
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
122
|
}
|
|
79
123
|
//# sourceMappingURL=hook-clients.js.map
|
package/dist/hook-clients.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hook-clients.js","sourceRoot":"","sources":["../src/hook-clients.ts"],"names":[],"mappings":"AAUA,8EAA8E;AAC9E,MAAM,UAAU,aAAa,CAAC,GAAuB;IACnD,QAAQ,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;QACzC,KAAK,aAAa,CAAC;QACnB,KAAK,aAAa,CAAC;QACnB,KAAK,YAAY;YACf,OAAO,aAAa,CAAC;QACvB,KAAK,KAAK;YACR,OAAO,KAAK,CAAC;QACf,KAAK,OAAO;YACV,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,aAAa,CAAC,MAAkB,EAAE,IAAY;IAC5D,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,KAAK;YACR,iEAAiE;YACjE,OAAO,IAAI,CAAC;QACd,KAAK,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wBAAwB,EAAE,GAAG;qBAC9B;iBACF,CAAC,CAAC;QACT,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/init-configs.js
CHANGED
|
@@ -65,6 +65,17 @@ export function mergeCursorHooks(existing, bin = "wayform") {
|
|
|
65
65
|
hooks.sessionStart = addOnce(asArray(hooks.sessionStart), "hook cursor", {
|
|
66
66
|
command: `${bin} hook cursor`,
|
|
67
67
|
});
|
|
68
|
+
// Guard: replace any earlier `guard cursor` entry (an old matcher, or one
|
|
69
|
+
// from before the allow output was schema-valid) with the current one;
|
|
70
|
+
// foreign entries stay.
|
|
71
|
+
hooks.preToolUse = [
|
|
72
|
+
...asArray(hooks.preToolUse).filter((item) => !JSON.stringify(item).includes("guard cursor")),
|
|
73
|
+
{
|
|
74
|
+
command: `${bin} guard cursor`,
|
|
75
|
+
matcher: "Shell|Write|StrReplace|Edit|Delete",
|
|
76
|
+
timeout: 10,
|
|
77
|
+
},
|
|
78
|
+
];
|
|
68
79
|
// Cursor beforeSubmitPrompt cannot inject; Stop re-engagement retired.
|
|
69
80
|
delete hooks.stop;
|
|
70
81
|
root.hooks = hooks;
|
|
@@ -77,6 +88,11 @@ export function mergeCodexHooks(existing, bin = "wayform") {
|
|
|
77
88
|
matcher: "startup|resume",
|
|
78
89
|
hooks: [{ type: "command", command: `${bin} hook codex` }],
|
|
79
90
|
});
|
|
91
|
+
// apply_patch carries every file edit; Bash every shell command.
|
|
92
|
+
hooks.PreToolUse = addOnce(asArray(hooks.PreToolUse), "guard codex", {
|
|
93
|
+
matcher: "Bash|apply_patch",
|
|
94
|
+
hooks: [{ type: "command", command: `${bin} guard codex`, timeout: 10 }],
|
|
95
|
+
});
|
|
80
96
|
delete hooks.Stop;
|
|
81
97
|
root.hooks = hooks;
|
|
82
98
|
return root;
|
|
@@ -104,8 +120,9 @@ export function mergeCodexHooks(existing, bin = "wayform") {
|
|
|
104
120
|
export function codexHookTrust(merged, hooksJsonAbsPath) {
|
|
105
121
|
const events = [
|
|
106
122
|
["SessionStart", "session_start", true],
|
|
123
|
+
["PreToolUse", "pre_tool_use", true],
|
|
107
124
|
];
|
|
108
|
-
const ours = / (hook|prompt-hook) codex$/;
|
|
125
|
+
const ours = / (hook|prompt-hook|guard) codex$/;
|
|
109
126
|
const out = [];
|
|
110
127
|
const hooks = asObject(merged.hooks);
|
|
111
128
|
for (const [prop, label, keepMatcher] of events) {
|