@pipelex/sdk 0.23.0 → 0.25.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/dist/artifacts.d.ts +4 -1
- package/dist/artifacts.js +6 -1
- package/dist/artifacts.js.map +1 -1
- package/dist/client.d.ts +7 -13
- package/dist/client.js +15 -16
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +30 -5
- package/dist/errors.js +9 -5
- package/dist/errors.js.map +1 -1
- package/dist/hooks/check-core.d.ts +97 -8
- package/dist/hooks/check-core.js +164 -15
- package/dist/hooks/check-core.js.map +1 -1
- package/dist/hooks/claude-mthds-check.d.ts +9 -1
- package/dist/hooks/claude-mthds-check.js +48 -31
- package/dist/hooks/claude-mthds-check.js.map +1 -1
- package/dist/hooks/patch-envelope.d.ts +66 -0
- package/dist/hooks/patch-envelope.js +127 -0
- package/dist/hooks/patch-envelope.js.map +1 -0
- package/dist/hooks/shell-script.d.ts +92 -0
- package/dist/hooks/shell-script.js +1304 -0
- package/dist/hooks/shell-script.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/product-models.d.ts +1 -9
- package/dist/product-models.js +1 -1
- package/dist/runs.d.ts +10 -1
- package/dist/runs.js +17 -1
- package/dist/runs.js.map +1 -1
- package/dist/timers.d.ts +11 -0
- package/dist/timers.js +14 -0
- package/dist/timers.js.map +1 -0
- package/dist/upload-grant.d.ts +38 -15
- package/dist/upload-grant.js +200 -67
- package/dist/upload-grant.js.map +1 -1
- package/dist/upload.js +9 -2
- package/dist/upload.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/architecture.md +4 -4
- package/docs/artifact-download.md +1 -1
- package/docs/hook-bundle.md +88 -0
- package/docs/input-preparation.md +14 -8
- package/package.json +2 -2
|
@@ -58,16 +58,105 @@ export type HookPlatform = "claude" | "codex" | "vibe";
|
|
|
58
58
|
* which also passed silently on unparseable input).
|
|
59
59
|
*/
|
|
60
60
|
export declare function extractMthdsFilePath(stdinJson: string): string | null;
|
|
61
|
+
/** A `.mthds` file a Codex patch leaves on disk. */
|
|
62
|
+
export interface CodexMthdsTarget {
|
|
63
|
+
/** The file's absolute path. */
|
|
64
|
+
path: string;
|
|
65
|
+
/** The path as the patch wrote it. */
|
|
66
|
+
writtenAs: string;
|
|
67
|
+
/**
|
|
68
|
+
* The lines each envelope's last section writing the file adds, as the
|
|
69
|
+
* patch command read them through the shell's quoting, less any line an
|
|
70
|
+
* expansion makes unknown. A shell script may hold several envelopes, in
|
|
71
|
+
* branches, so any one may be the one that ran.
|
|
72
|
+
*/
|
|
73
|
+
addedLines: string[][];
|
|
74
|
+
/** Some section of the patch deletes the file or moves it away. */
|
|
75
|
+
removedByPatch: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* What the file's content must show before it is checked (see
|
|
78
|
+
* `selectCodexTargets`). `carried`: it carries the patch's added lines,
|
|
79
|
+
* because a shell patch named it by a relative path, which the hook resolved
|
|
80
|
+
* through its reading of the script, or by an absolute path that no patch
|
|
81
|
+
* command in the script reads. `unrefuted`: it does not lack lines the patch
|
|
82
|
+
* added, because a shell patch command reads its absolute path, but the
|
|
83
|
+
* script may not have reached that command. `null` for the `apply_patch`
|
|
84
|
+
* tool, whose patch was applied where its paths say.
|
|
85
|
+
*/
|
|
86
|
+
confirm: "carried" | "unrefuted" | null;
|
|
87
|
+
}
|
|
88
|
+
/** What a Codex PostToolUse payload says about the `.mthds` files it wrote. */
|
|
89
|
+
export interface CodexMthdsTargets {
|
|
90
|
+
/** Whether the patch ran through the shell (`tool_name: "Bash"`). */
|
|
91
|
+
fromShell: boolean;
|
|
92
|
+
/** The files the patch leaves on disk, in the order the patch names them. */
|
|
93
|
+
targets: CodexMthdsTarget[];
|
|
94
|
+
/** Relative paths from a shell patch whose directory the script does not tell. */
|
|
95
|
+
unplaced: string[];
|
|
96
|
+
}
|
|
61
97
|
/**
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* envelope rides
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* the
|
|
98
|
+
* The `.mthds` files a Codex PostToolUse payload's patch leaves on disk.
|
|
99
|
+
*
|
|
100
|
+
* The patch envelope rides in `tool_input.command`, and its sections are
|
|
101
|
+
* applied in order, so a file the patch moves or deletes is not a target,
|
|
102
|
+
* unless another envelope of a shell script leaves it (see `patchTargets`). Relative paths resolve against the session directory, the
|
|
103
|
+
* payload's `cwd` when it is absolute and `processCwd` otherwise, since Codex
|
|
104
|
+
* starts the hook in that same directory.
|
|
105
|
+
*
|
|
106
|
+
* With `tool_name: "Bash"`, the command is a shell script that runs the patch,
|
|
107
|
+
* and a relative path is relative to wherever the script had moved when the
|
|
108
|
+
* patch ran. Each section is placed by the patch command reading its header
|
|
109
|
+
* (see `readShellScript`): a relative path under a known directory resolves
|
|
110
|
+
* against it, one under an unknown directory, in text no patch command reads,
|
|
111
|
+
* or anywhere in a script that could not be read, is listed as unplaced
|
|
112
|
+
* rather than guessed, and a header no command holds is dropped. An absolute
|
|
113
|
+
* path resolves wherever it sits, and is confirmed: like a relative one in
|
|
114
|
+
* text no patch command reads, and against the patch's added lines otherwise,
|
|
115
|
+
* since the reading follows every branch and function body whether or not
|
|
116
|
+
* the script ran it. Any other `tool_name` is the `apply_patch` tool's, whose
|
|
117
|
+
* paths are relative to the session directory.
|
|
118
|
+
*/
|
|
119
|
+
export declare function extractCodexMthdsTargets(stdinJson: string, processCwd: string): CodexMthdsTargets;
|
|
120
|
+
/**
|
|
121
|
+
* Which of a Codex patch's targets the hook checks, and which relative paths
|
|
122
|
+
* of a shell patch it could not check. `readFile` returns a file's content,
|
|
123
|
+
* or null when there is no file to read.
|
|
124
|
+
*
|
|
125
|
+
* A `carried` target is checked only when its file carries the added lines
|
|
126
|
+
* of some section that wrote it (see `carriesAddedLines`), since a file in
|
|
127
|
+
* another directory than the one the script wrote to almost never does, and
|
|
128
|
+
* neither does a file the script never patched. An `unrefuted` one is checked
|
|
129
|
+
* unless every section that wrote it added lines its file lacks, which is
|
|
130
|
+
* the evidence that the script did not run the patch; a section that adds no
|
|
131
|
+
* line refutes nothing. When a relative path's file fails, or when no file
|
|
132
|
+
* exists where it resolves, the path joins the unplaced ones as unchecked,
|
|
133
|
+
* unless the patch itself removed the missing file. An absolute path that
|
|
134
|
+
* fails was not patched by this script, so it is dropped without a note. Any
|
|
135
|
+
* other target is checked when its file exists.
|
|
136
|
+
*
|
|
137
|
+
* The files are returned as paths: each stage reads its file again when its
|
|
138
|
+
* turn comes, so a file changed while an earlier one was checked is never
|
|
139
|
+
* overwritten with the content read here.
|
|
140
|
+
*/
|
|
141
|
+
export declare function selectCodexTargets(extracted: CodexMthdsTargets, readFile: (path: string) => string | null): {
|
|
142
|
+
targets: string[];
|
|
143
|
+
unchecked: string[];
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Whether `content` carries `addedLines` in order, the evidence that a patch
|
|
147
|
+
* adding them wrote it. Each line is compared with its trailing whitespace
|
|
148
|
+
* trimmed, and blank lines are skipped on both sides. Only added lines count,
|
|
149
|
+
* because they are the only ones the patch program writes verbatim: it
|
|
150
|
+
* matches context lines loosely. A section that adds no line, a pure
|
|
151
|
+
* deletion or a bare rename, leaves no evidence, so it is never carried.
|
|
152
|
+
*/
|
|
153
|
+
export declare function carriesAddedLines(content: string, addedLines: readonly string[]): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* The non-blocking note naming the relative paths of a shell patch that the
|
|
156
|
+
* hook could not check. Without it, the agent would read the hook's silence
|
|
157
|
+
* as a clean check.
|
|
69
158
|
*/
|
|
70
|
-
export declare function
|
|
159
|
+
export declare function uncheckedShellPatchNote(paths: readonly string[]): HookOutcome;
|
|
71
160
|
/**
|
|
72
161
|
* Extract the edited `.mthds` path from a Mistral Vibe stable `post_tool`
|
|
73
162
|
* payload, plus the cwd to resolve it against. Only successful tool calls
|
package/dist/hooks/check-core.js
CHANGED
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
* - validate valid + pending `PipeSignature`s → non-blocking additionalContext
|
|
15
15
|
* - any stage unavailable → fail-open (the other stages' verdicts stand)
|
|
16
16
|
*/
|
|
17
|
+
import { isAbsolute as isAbsolutePath, resolve as resolvePath } from "node:path";
|
|
18
|
+
import { patchTargets, readPatchSections } from "./patch-envelope.js";
|
|
19
|
+
import { linesAsRead, readShellScript } from "./shell-script.js";
|
|
17
20
|
function parseJsonOrNull(stdinJson) {
|
|
18
21
|
try {
|
|
19
22
|
return JSON.parse(stdinJson);
|
|
@@ -36,28 +39,174 @@ export function extractMthdsFilePath(stdinJson) {
|
|
|
36
39
|
}
|
|
37
40
|
return filePath;
|
|
38
41
|
}
|
|
42
|
+
/** Prefix of the key of a path whose directory is unknown; no resolved path starts with it. */
|
|
43
|
+
const UNPLACED_KEY = "\0";
|
|
39
44
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* envelope rides
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* the
|
|
45
|
+
* The `.mthds` files a Codex PostToolUse payload's patch leaves on disk.
|
|
46
|
+
*
|
|
47
|
+
* The patch envelope rides in `tool_input.command`, and its sections are
|
|
48
|
+
* applied in order, so a file the patch moves or deletes is not a target,
|
|
49
|
+
* unless another envelope of a shell script leaves it (see `patchTargets`). Relative paths resolve against the session directory, the
|
|
50
|
+
* payload's `cwd` when it is absolute and `processCwd` otherwise, since Codex
|
|
51
|
+
* starts the hook in that same directory.
|
|
52
|
+
*
|
|
53
|
+
* With `tool_name: "Bash"`, the command is a shell script that runs the patch,
|
|
54
|
+
* and a relative path is relative to wherever the script had moved when the
|
|
55
|
+
* patch ran. Each section is placed by the patch command reading its header
|
|
56
|
+
* (see `readShellScript`): a relative path under a known directory resolves
|
|
57
|
+
* against it, one under an unknown directory, in text no patch command reads,
|
|
58
|
+
* or anywhere in a script that could not be read, is listed as unplaced
|
|
59
|
+
* rather than guessed, and a header no command holds is dropped. An absolute
|
|
60
|
+
* path resolves wherever it sits, and is confirmed: like a relative one in
|
|
61
|
+
* text no patch command reads, and against the patch's added lines otherwise,
|
|
62
|
+
* since the reading follows every branch and function body whether or not
|
|
63
|
+
* the script ran it. Any other `tool_name` is the `apply_patch` tool's, whose
|
|
64
|
+
* paths are relative to the session directory.
|
|
47
65
|
*/
|
|
48
|
-
export function
|
|
66
|
+
export function extractCodexMthdsTargets(stdinJson, processCwd) {
|
|
49
67
|
const parsed = parseJsonOrNull(stdinJson);
|
|
68
|
+
const fromShell = parsed?.tool_name === "Bash";
|
|
50
69
|
const command = parsed?.tool_input?.command;
|
|
51
70
|
if (typeof command !== "string") {
|
|
52
|
-
return [];
|
|
71
|
+
return { fromShell, targets: [], unplaced: [] };
|
|
53
72
|
}
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
let
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
const sessionDir = typeof parsed?.cwd === "string" && isAbsolutePath(parsed.cwd) ? parsed.cwd : processCwd;
|
|
74
|
+
let sections = readPatchSections(command);
|
|
75
|
+
let directoryOf = () => sessionDir;
|
|
76
|
+
let readByPatch = () => true;
|
|
77
|
+
let addedLinesOf = (section) => section.addedLines;
|
|
78
|
+
if (fromShell) {
|
|
79
|
+
const reading = readShellScript(command, sessionDir);
|
|
80
|
+
if (reading === "unparsed") {
|
|
81
|
+
directoryOf = () => null;
|
|
82
|
+
readByPatch = () => false;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
const placements = new Map(sections.map((section) => [section, reading.directoryAt(section.offset)]));
|
|
86
|
+
sections = sections.filter((section) => placements.get(section).kind !== "outside");
|
|
87
|
+
directoryOf = (section) => {
|
|
88
|
+
const placement = placements.get(section);
|
|
89
|
+
return placement.kind === "directory" ? placement.path : null;
|
|
90
|
+
};
|
|
91
|
+
readByPatch = (section) => placements.get(section).kind !== "unread";
|
|
92
|
+
addedLinesOf = (section) => linesAsRead(section.addedLines, reading.quotingAt(section.offset));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const keyOf = (path, section) => {
|
|
96
|
+
if (isAbsolutePath(path)) {
|
|
97
|
+
return resolvePath(path);
|
|
98
|
+
}
|
|
99
|
+
const directory = directoryOf(section);
|
|
100
|
+
return directory === null ? UNPLACED_KEY + path : resolvePath(directory, path);
|
|
101
|
+
};
|
|
102
|
+
const targets = [];
|
|
103
|
+
const unplaced = [];
|
|
104
|
+
for (const file of patchTargets(sections, keyOf)) {
|
|
105
|
+
if (!file.key.startsWith(UNPLACED_KEY)) {
|
|
106
|
+
targets.push({
|
|
107
|
+
path: file.key,
|
|
108
|
+
writtenAs: file.path,
|
|
109
|
+
addedLines: file.sections.map(addedLinesOf),
|
|
110
|
+
removedByPatch: file.removedByPatch,
|
|
111
|
+
confirm: !fromShell
|
|
112
|
+
? null
|
|
113
|
+
: !isAbsolutePath(file.path) || !file.sections.some(readByPatch)
|
|
114
|
+
? "carried"
|
|
115
|
+
: "unrefuted",
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
else if (!unplaced.includes(file.path)) {
|
|
119
|
+
unplaced.push(file.path);
|
|
120
|
+
}
|
|
59
121
|
}
|
|
60
|
-
return
|
|
122
|
+
return { fromShell, targets, unplaced };
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Which of a Codex patch's targets the hook checks, and which relative paths
|
|
126
|
+
* of a shell patch it could not check. `readFile` returns a file's content,
|
|
127
|
+
* or null when there is no file to read.
|
|
128
|
+
*
|
|
129
|
+
* A `carried` target is checked only when its file carries the added lines
|
|
130
|
+
* of some section that wrote it (see `carriesAddedLines`), since a file in
|
|
131
|
+
* another directory than the one the script wrote to almost never does, and
|
|
132
|
+
* neither does a file the script never patched. An `unrefuted` one is checked
|
|
133
|
+
* unless every section that wrote it added lines its file lacks, which is
|
|
134
|
+
* the evidence that the script did not run the patch; a section that adds no
|
|
135
|
+
* line refutes nothing. When a relative path's file fails, or when no file
|
|
136
|
+
* exists where it resolves, the path joins the unplaced ones as unchecked,
|
|
137
|
+
* unless the patch itself removed the missing file. An absolute path that
|
|
138
|
+
* fails was not patched by this script, so it is dropped without a note. Any
|
|
139
|
+
* other target is checked when its file exists.
|
|
140
|
+
*
|
|
141
|
+
* The files are returned as paths: each stage reads its file again when its
|
|
142
|
+
* turn comes, so a file changed while an earlier one was checked is never
|
|
143
|
+
* overwritten with the content read here.
|
|
144
|
+
*/
|
|
145
|
+
export function selectCodexTargets(extracted, readFile) {
|
|
146
|
+
const targets = [];
|
|
147
|
+
const unchecked = [...extracted.unplaced];
|
|
148
|
+
for (const target of extracted.targets) {
|
|
149
|
+
const content = readFile(target.path);
|
|
150
|
+
const confirmed = content !== null &&
|
|
151
|
+
(target.confirm === null ||
|
|
152
|
+
target.addedLines.some((addedLines) => carriesAddedLines(content, addedLines) ||
|
|
153
|
+
(target.confirm === "unrefuted" && comparedLines(addedLines).length === 0)));
|
|
154
|
+
if (confirmed) {
|
|
155
|
+
targets.push(target.path);
|
|
156
|
+
}
|
|
157
|
+
else if (target.confirm === "carried" &&
|
|
158
|
+
!isAbsolutePath(target.writtenAs) &&
|
|
159
|
+
(content !== null || !target.removedByPatch) &&
|
|
160
|
+
!unchecked.includes(target.writtenAs)) {
|
|
161
|
+
unchecked.push(target.writtenAs);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return { targets, unchecked };
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Whether `content` carries `addedLines` in order, the evidence that a patch
|
|
168
|
+
* adding them wrote it. Each line is compared with its trailing whitespace
|
|
169
|
+
* trimmed, and blank lines are skipped on both sides. Only added lines count,
|
|
170
|
+
* because they are the only ones the patch program writes verbatim: it
|
|
171
|
+
* matches context lines loosely. A section that adds no line, a pure
|
|
172
|
+
* deletion or a bare rename, leaves no evidence, so it is never carried.
|
|
173
|
+
*/
|
|
174
|
+
export function carriesAddedLines(content, addedLines) {
|
|
175
|
+
const wanted = comparedLines(addedLines);
|
|
176
|
+
if (wanted.length === 0) {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
let next = 0;
|
|
180
|
+
for (const line of content.split("\n")) {
|
|
181
|
+
if (line.trimEnd() === wanted[next]) {
|
|
182
|
+
next++;
|
|
183
|
+
if (next === wanted.length) {
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
/** The added lines a file is compared on: trailing whitespace trimmed, blank lines skipped. */
|
|
191
|
+
function comparedLines(addedLines) {
|
|
192
|
+
return addedLines.map((line) => line.trimEnd()).filter((line) => line !== "");
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The non-blocking note naming the relative paths of a shell patch that the
|
|
196
|
+
* hook could not check. Without it, the agent would read the hook's silence
|
|
197
|
+
* as a clean check.
|
|
198
|
+
*/
|
|
199
|
+
export function uncheckedShellPatchNote(paths) {
|
|
200
|
+
const named = paths.map((path) => `\`${path}\``);
|
|
201
|
+
const list = named.length === 1 ? named[0] : `${named.slice(0, -1).join(", ")} and ${named.at(-1)}`;
|
|
202
|
+
const context = named.length === 1
|
|
203
|
+
? `The .mthds hook did not check ${list}: it could not confirm which file this shell ` +
|
|
204
|
+
"command patched. Name the file by its absolute path, or edit it with the apply_patch " +
|
|
205
|
+
"tool, and the hook will check it."
|
|
206
|
+
: `The .mthds hook did not check ${list}: it could not confirm which files this shell ` +
|
|
207
|
+
"command patched. Name the files by their absolute paths, or edit them with the " +
|
|
208
|
+
"apply_patch tool, and the hook will check them.";
|
|
209
|
+
return { kind: "context", context: truncate(context) };
|
|
61
210
|
}
|
|
62
211
|
/**
|
|
63
212
|
* Extract the edited `.mthds` path from a Mistral Vibe stable `post_tool`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-core.js","sourceRoot":"","sources":["../../src/hooks/check-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;A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tool_status` gate, path resolved against `cwd`).
|
|
18
18
|
*
|
|
19
|
+
* A Codex patch run through the shell (`tool_name: "Bash"`) is placed by
|
|
20
|
+
* following the script's working directory. A file it names by a relative
|
|
21
|
+
* path, or by an absolute one no patch command reads, is checked only when it
|
|
22
|
+
* carries the patch's added lines, and one named by another absolute path
|
|
23
|
+
* only when it does not lack them. The relative paths it could not check are
|
|
24
|
+
* named in one non-blocking note, which a block from another file outranks
|
|
25
|
+
* (see docs/hook-bundle.md).
|
|
26
|
+
*
|
|
19
27
|
* Failure posture (fail-open, per the networked-hook plan):
|
|
20
28
|
* - no `.mthds` in the payload / unparseable stdin → pass silently
|
|
21
|
-
* - WASM engine fails to load →
|
|
29
|
+
* - WASM engine fails to load → no file is checked; the note above is still sent
|
|
22
30
|
* - validate unavailable (no `PIPELEX_API_KEY`, network error, timeout, any
|
|
23
31
|
* non-2xx, bundle-gather overflow) → the local lint/format verdicts already
|
|
24
32
|
* applied; the validate stage passes silently
|
|
@@ -16,9 +16,17 @@
|
|
|
16
16
|
* files — outcomes are merged, any block wins); Vibe reads the stable
|
|
17
17
|
* `post_tool` payload (`tool_status` gate, path resolved against `cwd`).
|
|
18
18
|
*
|
|
19
|
+
* A Codex patch run through the shell (`tool_name: "Bash"`) is placed by
|
|
20
|
+
* following the script's working directory. A file it names by a relative
|
|
21
|
+
* path, or by an absolute one no patch command reads, is checked only when it
|
|
22
|
+
* carries the patch's added lines, and one named by another absolute path
|
|
23
|
+
* only when it does not lack them. The relative paths it could not check are
|
|
24
|
+
* named in one non-blocking note, which a block from another file outranks
|
|
25
|
+
* (see docs/hook-bundle.md).
|
|
26
|
+
*
|
|
19
27
|
* Failure posture (fail-open, per the networked-hook plan):
|
|
20
28
|
* - no `.mthds` in the payload / unparseable stdin → pass silently
|
|
21
|
-
* - WASM engine fails to load →
|
|
29
|
+
* - WASM engine fails to load → no file is checked; the note above is still sent
|
|
22
30
|
* - validate unavailable (no `PIPELEX_API_KEY`, network error, timeout, any
|
|
23
31
|
* non-2xx, bundle-gather overflow) → the local lint/format verdicts already
|
|
24
32
|
* applied; the validate stage passes silently
|
|
@@ -26,9 +34,9 @@
|
|
|
26
34
|
* The hook always exits 0; a block/deny is expressed on stdout, never via the
|
|
27
35
|
* exit code.
|
|
28
36
|
*/
|
|
29
|
-
import {
|
|
37
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
30
38
|
import { resolve as resolvePath } from "node:path";
|
|
31
|
-
import { decideAfterLint, decideAfterValidate, encodeOutcome,
|
|
39
|
+
import { decideAfterLint, decideAfterValidate, encodeOutcome, extractCodexMthdsTargets, extractMthdsFilePath, extractVibeMthdsFilePath, mergeOutcomes, selectCodexTargets, uncheckedShellPatchNote, } from "./check-core.js";
|
|
32
40
|
import { gatherBundle } from "./bundle-gather.js";
|
|
33
41
|
import { createHookClient } from "./validate-client.js";
|
|
34
42
|
/** Per-request ceiling on the one network call — well under the hook's overall timeout. */
|
|
@@ -51,7 +59,19 @@ function parsePlatform(argv) {
|
|
|
51
59
|
}
|
|
52
60
|
return "claude";
|
|
53
61
|
}
|
|
54
|
-
/**
|
|
62
|
+
/** A file's content, or null when there is no file to read. */
|
|
63
|
+
function readFileOrNull(filePath) {
|
|
64
|
+
try {
|
|
65
|
+
return readFileSync(filePath, "utf-8");
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The edited `.mthds` files to check, per platform, and the relative paths of
|
|
73
|
+
* a Codex shell patch the hook could not check.
|
|
74
|
+
*/
|
|
55
75
|
function resolveTargets(platform, stdinJson) {
|
|
56
76
|
let candidates;
|
|
57
77
|
switch (platform) {
|
|
@@ -60,10 +80,8 @@ function resolveTargets(platform, stdinJson) {
|
|
|
60
80
|
candidates = filePath ? [filePath] : [];
|
|
61
81
|
break;
|
|
62
82
|
}
|
|
63
|
-
case "codex":
|
|
64
|
-
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
83
|
+
case "codex":
|
|
84
|
+
return selectCodexTargets(extractCodexMthdsTargets(stdinJson, process.cwd()), readFileOrNull);
|
|
67
85
|
case "vibe": {
|
|
68
86
|
const extracted = extractVibeMthdsFilePath(stdinJson);
|
|
69
87
|
candidates = extracted
|
|
@@ -72,9 +90,7 @@ function resolveTargets(platform, stdinJson) {
|
|
|
72
90
|
break;
|
|
73
91
|
}
|
|
74
92
|
}
|
|
75
|
-
|
|
76
|
-
// paths that may not survive the patch; Claude edits can race a delete).
|
|
77
|
-
return candidates.filter((filePath) => existsSync(filePath));
|
|
93
|
+
return { targets: candidates, unchecked: [] };
|
|
78
94
|
}
|
|
79
95
|
/**
|
|
80
96
|
* Load the WASM engine. The one-line "deprecated parameters" warning the
|
|
@@ -154,14 +170,16 @@ function emit(outcome, platform) {
|
|
|
154
170
|
function warn(message) {
|
|
155
171
|
writeFileSync(2, `[mthds-hook] ${message}\n`);
|
|
156
172
|
}
|
|
157
|
-
/**
|
|
173
|
+
/**
|
|
174
|
+
* The full pipeline on one edited file: lint → format write-back → validate.
|
|
175
|
+
* The file is read here, when its turn comes, and no await separates the read
|
|
176
|
+
* from the write-back, so an edit made while an earlier file was validated is
|
|
177
|
+
* never overwritten with older content.
|
|
178
|
+
*/
|
|
158
179
|
async function checkOneFile(engine, filePath) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
catch {
|
|
164
|
-
return { kind: "pass" }; // file gone since the existence check — nothing to gate
|
|
180
|
+
const content = readFileOrNull(filePath);
|
|
181
|
+
if (content === null) {
|
|
182
|
+
return { kind: "pass" }; // a deleted file has nothing to check (an edit can race a delete)
|
|
165
183
|
}
|
|
166
184
|
// Stage 1 — local lint
|
|
167
185
|
const lintStage = {
|
|
@@ -188,20 +206,19 @@ async function checkOneFile(engine, filePath) {
|
|
|
188
206
|
}
|
|
189
207
|
async function main() {
|
|
190
208
|
const platform = parsePlatform(process.argv.slice(2));
|
|
191
|
-
const
|
|
192
|
-
if (filePaths.length === 0) {
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
let engine;
|
|
196
|
-
try {
|
|
197
|
-
engine = await loadEngine();
|
|
198
|
-
}
|
|
199
|
-
catch {
|
|
200
|
-
return; // engine unavailable — whole hook fails open
|
|
201
|
-
}
|
|
209
|
+
const { targets, unchecked } = resolveTargets(platform, await readStdin());
|
|
202
210
|
const outcomes = [];
|
|
203
|
-
|
|
204
|
-
|
|
211
|
+
if (targets.length > 0) {
|
|
212
|
+
// An engine that cannot load fails the checks open, and only them: the note needs none.
|
|
213
|
+
const engine = await loadEngine().catch(() => null);
|
|
214
|
+
if (engine) {
|
|
215
|
+
for (const target of targets) {
|
|
216
|
+
outcomes.push(await checkOneFile(engine, target));
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (unchecked.length > 0) {
|
|
221
|
+
outcomes.push(uncheckedShellPatchNote(unchecked));
|
|
205
222
|
}
|
|
206
223
|
emit(mergeOutcomes(outcomes), platform);
|
|
207
224
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-mthds-check.js","sourceRoot":"","sources":["../../src/hooks/claude-mthds-check.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"claude-mthds-check.js","sourceRoot":"","sources":["../../src/hooks/claude-mthds-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,aAAa,EACb,kBAAkB,EAClB,uBAAuB,GAKxB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE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AAkE;IAClE,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACjE,IAAI,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAC;AAC7C,CAAC,CAAC;KACD,OAAO,CAAC,GAAG,EAAE;IACZ,0EAA0E;IAC1E,sEAAsE;IACtE,6BAA6B;IAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reader of Codex's `apply_patch` envelope, as sections rather than bare
|
|
3
|
+
* header lines.
|
|
4
|
+
*
|
|
5
|
+
* A patch is `*** Begin Patch`, then one section per file, then `*** End
|
|
6
|
+
* Patch`. A section opens with `*** Add File: <path>`, `*** Update File:
|
|
7
|
+
* <path>` (optionally followed by `*** Move to: <path>`) or `*** Delete File:
|
|
8
|
+
* <path>`, and holds the lines under it until the next header. Its `+` lines
|
|
9
|
+
* are the lines the patch adds, which Codex writes to the file verbatim.
|
|
10
|
+
*
|
|
11
|
+
* The text read may be the patch alone (the `apply_patch` tool) or a whole
|
|
12
|
+
* shell script with the patch inside it (Codex's `Bash` tool), so the reader
|
|
13
|
+
* keeps each section's offset for the caller to place it in the script.
|
|
14
|
+
*/
|
|
15
|
+
/** One file's section of a patch. */
|
|
16
|
+
export interface PatchSection {
|
|
17
|
+
kind: "add" | "update" | "delete";
|
|
18
|
+
/** The path as the header wrote it, trimmed. */
|
|
19
|
+
path: string;
|
|
20
|
+
/** The destination of an `Update File` section's `Move to`, or null. */
|
|
21
|
+
moveTo: string | null;
|
|
22
|
+
/** Offset of the section's header line in the text read. */
|
|
23
|
+
offset: number;
|
|
24
|
+
/**
|
|
25
|
+
* How many `*** Begin Patch` and `*** End Patch` lines precede the section:
|
|
26
|
+
* the sections of one envelope share it, and no others do, since an envelope
|
|
27
|
+
* ends on its `End Patch` line even when its `Begin Patch` does not start a
|
|
28
|
+
* line, as in `apply_patch '*** Begin Patch`.
|
|
29
|
+
*/
|
|
30
|
+
envelope: number;
|
|
31
|
+
/** The section's `+` lines, marker stripped, otherwise as written. */
|
|
32
|
+
addedLines: string[];
|
|
33
|
+
}
|
|
34
|
+
/** A file the patch leaves on disk. */
|
|
35
|
+
export interface SurvivingFile {
|
|
36
|
+
/** The caller's key for the file. */
|
|
37
|
+
key: string;
|
|
38
|
+
/** The path as the first section leaving the file named it: its own, or its `Move to`. */
|
|
39
|
+
path: string;
|
|
40
|
+
/** Each envelope's last section that leaves the file on disk. */
|
|
41
|
+
sections: PatchSection[];
|
|
42
|
+
/** Some section deletes the file or moves it away, so its absence may be the patch's doing. */
|
|
43
|
+
removedByPatch: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Every section of every patch envelope in `text`, in order. The recognised
|
|
47
|
+
* headers are anchored at the start of a line, as the `pipelex-plugins`
|
|
48
|
+
* wrapper's pre-filter reads them; a `Move to` counts only inside an `Update
|
|
49
|
+
* File` section, and a `Begin Patch` or `End Patch` line closes the section
|
|
50
|
+
* before it and starts a new envelope, so script lines after a patch are not
|
|
51
|
+
* read as its content, and the patches of a script stay apart.
|
|
52
|
+
*/
|
|
53
|
+
export declare function readPatchSections(text: string): PatchSection[];
|
|
54
|
+
/**
|
|
55
|
+
* The `.mthds` files that survive the sections. Within one envelope the
|
|
56
|
+
* sections apply in order and in one directory: an added or updated file
|
|
57
|
+
* becomes a target, a moved file stops being one and its destination becomes
|
|
58
|
+
* one, and a deleted file stops being one. The envelopes of a shell script
|
|
59
|
+
* may run in other directories, in branches, or not at all, so across them a
|
|
60
|
+
* file survives when any envelope leaves it, and a delete in one never hides
|
|
61
|
+
* another's edit. Two paths name the same file when `keyOf` gives them the
|
|
62
|
+
* same key, which lets the caller compare paths resolved against the
|
|
63
|
+
* directory each section was applied in; by default the paths are compared
|
|
64
|
+
* as written.
|
|
65
|
+
*/
|
|
66
|
+
export declare function patchTargets(sections: readonly PatchSection[], keyOf?: (path: string, section: PatchSection) => string): SurvivingFile[];
|