@brainervirus/workit-codex 8.19.1 → 8.19.2
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.
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
gateCheckNames,
|
|
8
8
|
checkCommand,
|
|
9
9
|
maybeHeavy
|
|
10
|
-
} from "./workit-hook-
|
|
10
|
+
} from "./workit-hook-kg4dxyfv.js";
|
|
11
11
|
// packages/workit-core/src/hooks/descriptor.ts
|
|
12
12
|
var support = (descriptor, axis) => {
|
|
13
13
|
if (axis.startsWith("event:"))
|
|
@@ -21227,7 +21227,7 @@ var canonical2 = (file) => {
|
|
|
21227
21227
|
let rest = "";
|
|
21228
21228
|
for (let dir = path24.resolve(file);; dir = path24.dirname(dir)) {
|
|
21229
21229
|
try {
|
|
21230
|
-
return path24.join(realpathSync5(dir), rest);
|
|
21230
|
+
return path24.join(realpathSync5.native(dir), rest);
|
|
21231
21231
|
} catch {
|
|
21232
21232
|
if (path24.dirname(dir) === dir)
|
|
21233
21233
|
return path24.resolve(file);
|
|
@@ -21447,18 +21447,26 @@ var CD2 = new Set(["cd", "chdir", "set-location", "sl"]);
|
|
|
21447
21447
|
var PUSHD2 = new Set(["pushd", "push-location"]);
|
|
21448
21448
|
var POPD2 = new Set(["popd", "pop-location"]);
|
|
21449
21449
|
var cdInto = (dir, words) => {
|
|
21450
|
-
const
|
|
21450
|
+
const named = words.slice(1).find((word) => !word.startsWith("-") || word === "-");
|
|
21451
|
+
const target = named === undefined ? undefined : homeExpanded(named);
|
|
21451
21452
|
if (dir === undefined || target === "-" || target && /^~|[$`*?]/.test(target))
|
|
21452
21453
|
return;
|
|
21453
21454
|
return target === undefined ? os9.homedir() : path24.resolve(dir, target);
|
|
21454
21455
|
};
|
|
21455
21456
|
var quoteWord2 = (word) => /^[\w@%+=:,./-]+$/.test(word) ? word : `'${word.replaceAll("'", "'\\''")}'`;
|
|
21457
|
+
var homeExpanded = (file) => {
|
|
21458
|
+
const match = /^(?:~|\$HOME|\$\{HOME\})(?=\/|$)/.exec(file);
|
|
21459
|
+
return match ? (process.env.HOME || os9.homedir()) + file.slice(match[0].length) : file;
|
|
21460
|
+
};
|
|
21456
21461
|
var segmentTargets = (cwd, command, dialect, depth = 0) => {
|
|
21457
21462
|
const targets = [];
|
|
21458
21463
|
let dir = cwd;
|
|
21459
21464
|
let stack = [];
|
|
21460
21465
|
const groups = [];
|
|
21461
|
-
const at = (file) =>
|
|
21466
|
+
const at = (file) => {
|
|
21467
|
+
const home = homeExpanded(file);
|
|
21468
|
+
return path24.isAbsolute(home) ? home : dir === undefined ? null : path24.resolve(dir, home);
|
|
21469
|
+
};
|
|
21462
21470
|
for (const segment of segmentsOf(command, dialect)) {
|
|
21463
21471
|
if (segment.group === "open") {
|
|
21464
21472
|
groups.push({ dir, stack: [...stack] });
|
|
@@ -21563,7 +21571,39 @@ var claimAll = (owner, targets, deps) => {
|
|
|
21563
21571
|
claimLiveSession(target, owner, deps);
|
|
21564
21572
|
};
|
|
21565
21573
|
var liveTargets = (cwd, paths) => paths?.length ? paths.map((file) => path24.resolve(cwd, file)) : [path24.join(cwd, DIR_TARGET)];
|
|
21574
|
+
var issuedTarget = (cwd, targets) => {
|
|
21575
|
+
const state = resolveStateDir();
|
|
21576
|
+
const found = targets.find((target) => underIssued(state, cwd, homeExpanded(target), process.platform, canonical2));
|
|
21577
|
+
return found ?? null;
|
|
21578
|
+
};
|
|
21579
|
+
var underIssued = (state, cwd, target, platform = process.platform, real = (file) => file) => {
|
|
21580
|
+
const win = platform === "win32";
|
|
21581
|
+
const p = win ? path24.win32 : path24.posix;
|
|
21582
|
+
const fold = (value) => win || platform === "darwin" ? value.toLowerCase() : value;
|
|
21583
|
+
const named = win ? target.replace(/^\/([a-zA-Z])(?=\/|$)/, "$1:") : target;
|
|
21584
|
+
const relative = p.relative(fold(real(p.resolve(state))), fold(real(p.resolve(cwd, named))));
|
|
21585
|
+
if (relative.startsWith("..") || p.isAbsolute(relative))
|
|
21586
|
+
return false;
|
|
21587
|
+
return relative.split(p.sep)[0].startsWith("issued");
|
|
21588
|
+
};
|
|
21589
|
+
var unquotedWindowsIssued = (command) => {
|
|
21590
|
+
if (process.platform !== "win32" || !command.includes("\\"))
|
|
21591
|
+
return false;
|
|
21592
|
+
const flat = (value) => value.replaceAll("\\", "/").toLowerCase();
|
|
21593
|
+
return flat(command).includes(`${flat(resolveStateDir())}/issued`) && shellWrites(command).writes;
|
|
21594
|
+
};
|
|
21595
|
+
var issuedDeny = (file) => {
|
|
21596
|
+
const unblock = "Issued ids and tokens are written only by Workit's SubagentStart hook. Run the verifier or reviewer agent so the host issues its own session; never edit the issued registries by hand.";
|
|
21597
|
+
return {
|
|
21598
|
+
kind: "deny",
|
|
21599
|
+
reason: `workit issued-registry guard: ${file} is under Workit's issued-session state. ${unblock}`,
|
|
21600
|
+
unblock
|
|
21601
|
+
};
|
|
21602
|
+
};
|
|
21566
21603
|
function writeGate(cwd, paths, owner, deps) {
|
|
21604
|
+
const forged = paths?.length ? issuedTarget(cwd, paths) : null;
|
|
21605
|
+
if (forged)
|
|
21606
|
+
return issuedDeny(forged);
|
|
21567
21607
|
if (!owner)
|
|
21568
21608
|
return beforeWriteGate(cwd, paths);
|
|
21569
21609
|
const targets = liveTargets(cwd, paths);
|
|
@@ -21576,6 +21616,11 @@ function writeGate(cwd, paths, owner, deps) {
|
|
|
21576
21616
|
return decision;
|
|
21577
21617
|
}
|
|
21578
21618
|
function shellGate(cwd, command, owner, dialect = "posix", deps) {
|
|
21619
|
+
try {
|
|
21620
|
+
const forged = issuedTarget(cwd, segmentTargets(cwd, command, dialect)) ?? (unquotedWindowsIssued(command) ? "the issued registry" : null);
|
|
21621
|
+
if (forged)
|
|
21622
|
+
return issuedDeny(forged);
|
|
21623
|
+
} catch {}
|
|
21579
21624
|
const writes = shellWrites(command);
|
|
21580
21625
|
let targets = [];
|
|
21581
21626
|
if (owner) {
|
|
@@ -290,4 +290,4 @@ function maybeHeavy(command, cwd, env = process.env) {
|
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
-
export { CHECKS_FILE, repoHeavyCommands, loadCheckConfig, matchesNamedCheck, gateCheckNames, checkCommand, maybeHeavy };
|
|
293
|
+
export { CHECKS_FILE, repoHeavyCommands, loadCheckConfig, matchesNamedCheck, gateCheckNames, checkCommand, stateDir, maybeHeavy };
|
package/dist/workit-hook.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
stateDir,
|
|
3
4
|
maybeHeavy
|
|
4
|
-
} from "./workit-hook-
|
|
5
|
+
} from "./workit-hook-kg4dxyfv.js";
|
|
5
6
|
|
|
6
7
|
// packages/workit-codex/hooks/launcher.ts
|
|
7
8
|
var payload = "";
|
|
@@ -9,6 +10,10 @@ for await (const chunk of process.stdin)
|
|
|
9
10
|
payload += String(chunk);
|
|
10
11
|
var SHELL_TOOLS = new Set(["bash", "unified-exec"]);
|
|
11
12
|
var WRITE_TOOLS = new Set(["applypatch", "edit", "write"]);
|
|
13
|
+
var mentionsIssued = (text) => {
|
|
14
|
+
const flat = (value) => value.replaceAll("\\", "/").toLowerCase();
|
|
15
|
+
return /issued/i.test(text) || flat(text).includes(flat(stateDir(process.env)));
|
|
16
|
+
};
|
|
12
17
|
var quietEvent = () => {
|
|
13
18
|
try {
|
|
14
19
|
const value = JSON.parse(payload);
|
|
@@ -29,7 +34,7 @@ var quietEvent = () => {
|
|
|
29
34
|
return null;
|
|
30
35
|
if (event === "PostToolUse")
|
|
31
36
|
return /\bcommit\b/.test(text) ? null : event;
|
|
32
|
-
return /\b(?:git|gh|glab)\b/.test(text) || maybeHeavy(text, value.cwd) ? null : event;
|
|
37
|
+
return /\b(?:git|gh|glab)\b/.test(text) || mentionsIssued(text) || maybeHeavy(text, value.cwd) ? null : event;
|
|
33
38
|
} catch {
|
|
34
39
|
return null;
|
|
35
40
|
}
|
|
@@ -39,6 +44,6 @@ if (quiet)
|
|
|
39
44
|
process.stdout.write(`${JSON.stringify({ hookSpecificOutput: { hookEventName: quiet } })}
|
|
40
45
|
`);
|
|
41
46
|
else {
|
|
42
|
-
const { runCodexHook } = await import("./workit-hook-
|
|
47
|
+
const { runCodexHook } = await import("./workit-hook-00hstm40.js");
|
|
43
48
|
await runCodexHook([payload]);
|
|
44
49
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brainervirus/workit-codex",
|
|
3
|
-
"version": "8.19.
|
|
3
|
+
"version": "8.19.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit Codex CLI/desktop plugin — shared MCP transport, hooks, method skills, and verifier/reviewer/implementer agents",
|
|
6
6
|
"keywords": [
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"build": "bun scripts/build.ts"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@brainervirus/workit-core": "^8.19.
|
|
43
|
-
"@brainervirus/workit-mcp": "^8.19.
|
|
42
|
+
"@brainervirus/workit-core": "^8.19.2",
|
|
43
|
+
"@brainervirus/workit-mcp": "^8.19.2"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=24"
|