@workit-dev/codex 1.14.1 → 1.14.3
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/launch-mcp.js
CHANGED
|
@@ -16937,11 +16937,13 @@ function fastGit(root) {
|
|
|
16937
16937
|
}
|
|
16938
16938
|
function resolveStore(root) {
|
|
16939
16939
|
root = path9.resolve(root);
|
|
16940
|
-
let
|
|
16940
|
+
let stat = null;
|
|
16941
16941
|
try {
|
|
16942
|
-
|
|
16942
|
+
stat = fs5.statSync(root);
|
|
16943
16943
|
} catch {}
|
|
16944
|
-
if (!
|
|
16944
|
+
if (!stat)
|
|
16945
|
+
return new Error(`cannot locate the workit store: ${root} does not exist (removed while workit ran?); nothing is recorded under a missing directory`);
|
|
16946
|
+
if (!stat.isDirectory())
|
|
16945
16947
|
return { dir: path9.join(root, ".workit"), shared: false, top: null };
|
|
16946
16948
|
const fast = fastGit(root);
|
|
16947
16949
|
if (fast?.kind === "none")
|
|
@@ -21699,7 +21701,7 @@ function cleanRebase(cwd, range) {
|
|
|
21699
21701
|
function storeRoot(cwd) {
|
|
21700
21702
|
const location = resolveStore(path20.resolve(cwd));
|
|
21701
21703
|
if (location instanceof Error)
|
|
21702
|
-
return err("unavailable", location.message.replace(/; fix the repository.*$/u, ""), "fix the repository (git status should work here) or run from a non-git directory");
|
|
21704
|
+
return err("unavailable", location.message.replace(/; fix the repository.*$/u, ""), / does not exist /u.test(location.message) ? "run workit from a directory that exists" : "fix the repository (git status should work here) or run from a non-git directory");
|
|
21703
21705
|
return { ok: true, value: { root: location.dir, shared: location.shared } };
|
|
21704
21706
|
}
|
|
21705
21707
|
function ledgerPath(cwd) {
|
|
@@ -21900,7 +21902,7 @@ var sealed = (row, id, at, previous) => {
|
|
|
21900
21902
|
` };
|
|
21901
21903
|
};
|
|
21902
21904
|
function appendRaw(cwd, row, options) {
|
|
21903
|
-
const file = ledgerPath(cwd);
|
|
21905
|
+
const file = options.store ? { ok: true, value: path20.join(options.store.root, "ledger", "ledger.jsonl") } : ledgerPath(cwd);
|
|
21904
21906
|
if (!file.ok)
|
|
21905
21907
|
return file;
|
|
21906
21908
|
const id = newId2();
|
|
@@ -30477,6 +30479,18 @@ var WORKIT_ALLOWED_VERBS = [
|
|
|
30477
30479
|
"doctor",
|
|
30478
30480
|
"help"
|
|
30479
30481
|
];
|
|
30482
|
+
var WORKIT_USER_ONLY = [
|
|
30483
|
+
["release", "notes", "approve"],
|
|
30484
|
+
["grant", "set"],
|
|
30485
|
+
["grant", "raise"],
|
|
30486
|
+
["ledger", "void"],
|
|
30487
|
+
["approve"],
|
|
30488
|
+
["setup"],
|
|
30489
|
+
["uninstall"],
|
|
30490
|
+
["install"],
|
|
30491
|
+
["workspace", "seal"]
|
|
30492
|
+
];
|
|
30493
|
+
var USER_ONLY_WORD = new RegExp(`\\b(?:${[...new Set(WORKIT_USER_ONLY.map((words) => words[0]))].join("|")})\\b`);
|
|
30480
30494
|
var ALLOWED = new Set(WORKIT_ALLOWED_VERBS);
|
|
30481
30495
|
// packages/workit-core/src/core/heavy.ts
|
|
30482
30496
|
var INFO_FLAGS = new Set(["--version", "-v", "-V", "--help", "-h", "help", "version"]);
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
userHome2,
|
|
4
|
+
configDir2,
|
|
5
|
+
stateDir3
|
|
6
|
+
} from "./workit-hook-7jv519ep.js";
|
|
7
|
+
|
|
8
|
+
// packages/workit-core/src/hooks/write-reach.ts
|
|
9
|
+
import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
10
|
+
import os from "node:os";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
var hasTaskStore = (cwd) => {
|
|
13
|
+
try {
|
|
14
|
+
for (let dir = path.resolve(cwd);; dir = path.dirname(dir)) {
|
|
15
|
+
const dotGit = path.join(dir, ".git");
|
|
16
|
+
if (existsSync(dotGit)) {
|
|
17
|
+
let gitDir = dotGit;
|
|
18
|
+
if (statSync(dotGit).isFile()) {
|
|
19
|
+
const target = /^gitdir:\s*(.+)$/m.exec(readFileSync(dotGit, "utf8"))?.[1]?.trim();
|
|
20
|
+
if (!target)
|
|
21
|
+
return true;
|
|
22
|
+
gitDir = path.resolve(dir, target);
|
|
23
|
+
const common = path.join(gitDir, "commondir");
|
|
24
|
+
if (existsSync(common))
|
|
25
|
+
gitDir = path.resolve(gitDir, readFileSync(common, "utf8").trim());
|
|
26
|
+
}
|
|
27
|
+
const store = path.join(gitDir, "workit");
|
|
28
|
+
return existsSync(path.join(store, "tasks")) || existsSync(path.join(store, "task-index.json"));
|
|
29
|
+
}
|
|
30
|
+
if (existsSync(path.join(dir, ".workit")))
|
|
31
|
+
return true;
|
|
32
|
+
if (path.dirname(dir) === dir)
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
} catch {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var reachTests = (dirs) => {
|
|
40
|
+
const fold = (value) => dirs.fold ? value.toLowerCase() : value;
|
|
41
|
+
const canon = (file) => {
|
|
42
|
+
let rest = "";
|
|
43
|
+
for (let dir = path.resolve(file);; dir = path.dirname(dir)) {
|
|
44
|
+
try {
|
|
45
|
+
return fold(path.join(realpathSync.native(dir), rest));
|
|
46
|
+
} catch {
|
|
47
|
+
if (path.dirname(dir) === dir)
|
|
48
|
+
return fold(path.resolve(file));
|
|
49
|
+
rest = rest ? path.join(path.basename(dir), rest) : path.basename(dir);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const within = (parent, child) => {
|
|
54
|
+
const rel = path.relative(parent, child);
|
|
55
|
+
return rel === "" || !rel.startsWith("..") && !path.isAbsolute(rel);
|
|
56
|
+
};
|
|
57
|
+
const state = canon(dirs.state);
|
|
58
|
+
const configs = dirs.configs.map(canon);
|
|
59
|
+
const at = (file) => configs.some((dir) => within(dir, file)) || within(state, file) && /^(?:issued[^\\/]*|approvals)(?:[\\/]|$)/.test(path.relative(state, file));
|
|
60
|
+
const above = (file) => within(file, state) || configs.some((dir) => within(file, dir));
|
|
61
|
+
const linked = (file) => {
|
|
62
|
+
try {
|
|
63
|
+
const stat = statSync(file, { throwIfNoEntry: false });
|
|
64
|
+
return Boolean(stat?.isFile() && stat.nlink > 1);
|
|
65
|
+
} catch {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
return { canon, at, above, linked };
|
|
70
|
+
};
|
|
71
|
+
var mayReachWith = (text, cwd, dirs) => {
|
|
72
|
+
const { canon, at, above, linked } = reachTests(dirs);
|
|
73
|
+
const here = canon(cwd);
|
|
74
|
+
if (at(here) || above(here))
|
|
75
|
+
return true;
|
|
76
|
+
const BREAKS = /[\s;&|()<>=:,]/;
|
|
77
|
+
if ([dirs.state, ...dirs.configs].some((dir) => BREAKS.test(dir)) && /[/~]/.test(text))
|
|
78
|
+
return true;
|
|
79
|
+
const joined = text.replace(/\\\r?\n/g, "");
|
|
80
|
+
const bare = joined.replace(/['"\\]/g, "");
|
|
81
|
+
if (/\$['"]/.test(joined) || /~[\w+-]|\$\{(?:!|\w+[^\w}])|\bpopd\b/.test(bare) || /(?:^|[\s;&|(])(?:cd|pushd|chdir)(?:\s+-\S*)*\s*(?:$|[;&|)\n$`])/.test(bare) || dirs.env.CDPATH !== undefined && /\b(?:cd|pushd)\b/.test(bare))
|
|
82
|
+
return true;
|
|
83
|
+
const bound = (name) => new RegExp(`(?:^|[^\\w$])${name}=|\\bfor\\s+${name}\\b|\\bread\\b[^;&|\\n]*\\b${name}\\b`).test(bare);
|
|
84
|
+
const expanded = bare.replace(/\$\{([A-Za-z_]\w*)\}|\$([A-Za-z_]\w*)/g, (all, braced, plain) => {
|
|
85
|
+
const name = braced ?? plain ?? "";
|
|
86
|
+
return /^(?:OLD)?PWD$/.test(name) || bound(name) ? all : dirs.env[name] ?? "";
|
|
87
|
+
});
|
|
88
|
+
const words = expanded.split(/[\s;&|()<>=:,]+/).filter(Boolean);
|
|
89
|
+
if (words.length > 64)
|
|
90
|
+
return true;
|
|
91
|
+
const home = dirs.env.HOME || dirs.home;
|
|
92
|
+
const literal = (word) => {
|
|
93
|
+
const cut = word.split(/[$`*?[{]/)[0] ?? "";
|
|
94
|
+
return cut === "~" || cut.startsWith("~/") ? home + cut.slice(1) : cut;
|
|
95
|
+
};
|
|
96
|
+
const bases = [path.resolve(cwd)];
|
|
97
|
+
for (let index = 0;index < words.length; index++) {
|
|
98
|
+
if (!/^(?:cd|pushd|chdir)$/.test(words[index] ?? ""))
|
|
99
|
+
continue;
|
|
100
|
+
let next = index + 1;
|
|
101
|
+
while (words[next]?.startsWith("-"))
|
|
102
|
+
next++;
|
|
103
|
+
const target = literal(words[next] ?? "");
|
|
104
|
+
bases.push(...bases.map((base) => path.resolve(base, target)));
|
|
105
|
+
if (bases.length > 8)
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
const globby = /[$`*?[{]/.test(expanded);
|
|
109
|
+
const seen = new Set;
|
|
110
|
+
for (const word of words) {
|
|
111
|
+
const forms = [word];
|
|
112
|
+
if (word.startsWith("-"))
|
|
113
|
+
for (let from = 1;from < word.length; from++)
|
|
114
|
+
forms.push(word.slice(from));
|
|
115
|
+
for (const form of forms)
|
|
116
|
+
for (const base of bases) {
|
|
117
|
+
const file = canon(path.resolve(base, literal(form)));
|
|
118
|
+
if (seen.has(file))
|
|
119
|
+
continue;
|
|
120
|
+
seen.add(file);
|
|
121
|
+
if (at(file) || linked(file))
|
|
122
|
+
return true;
|
|
123
|
+
if (globby && (above(file) || above(path.dirname(file))))
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return false;
|
|
128
|
+
};
|
|
129
|
+
var guardedDirs = (env, paths) => {
|
|
130
|
+
let account = null;
|
|
131
|
+
try {
|
|
132
|
+
account = os.userInfo().homedir;
|
|
133
|
+
} catch {}
|
|
134
|
+
return {
|
|
135
|
+
state: paths.stateDir(env),
|
|
136
|
+
configs: [
|
|
137
|
+
paths.configDir(env),
|
|
138
|
+
paths.configDir({}),
|
|
139
|
+
...account ? [paths.configDir({ HOME: account, USERPROFILE: account })] : []
|
|
140
|
+
],
|
|
141
|
+
home: paths.userHome(env),
|
|
142
|
+
env,
|
|
143
|
+
fold: process.platform === "darwin" || process.platform === "win32"
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
var reachDirs = (env = process.env) => guardedDirs(env, { configDir: configDir2, stateDir: stateDir3, userHome: userHome2 });
|
|
147
|
+
var mayReach = (text, cwd) => mayReachWith(text, cwd, reachDirs());
|
|
148
|
+
export {
|
|
149
|
+
hasTaskStore,
|
|
150
|
+
mayReach
|
|
151
|
+
};
|
|
@@ -9352,11 +9352,13 @@ function fastGit(root) {
|
|
|
9352
9352
|
}
|
|
9353
9353
|
function resolveStore(root) {
|
|
9354
9354
|
root = path8.resolve(root);
|
|
9355
|
-
let
|
|
9355
|
+
let stat = null;
|
|
9356
9356
|
try {
|
|
9357
|
-
|
|
9357
|
+
stat = fs4.statSync(root);
|
|
9358
9358
|
} catch {}
|
|
9359
|
-
if (!
|
|
9359
|
+
if (!stat)
|
|
9360
|
+
return new Error(`cannot locate the workit store: ${root} does not exist (removed while workit ran?); nothing is recorded under a missing directory`);
|
|
9361
|
+
if (!stat.isDirectory())
|
|
9360
9362
|
return { dir: path8.join(root, ".workit"), shared: false, top: null };
|
|
9361
9363
|
const fast = fastGit(root);
|
|
9362
9364
|
if (fast?.kind === "none")
|
|
@@ -13392,7 +13394,7 @@ function cleanRebase(cwd, range) {
|
|
|
13392
13394
|
function storeRoot(cwd) {
|
|
13393
13395
|
const location = resolveStore(path16.resolve(cwd));
|
|
13394
13396
|
if (location instanceof Error)
|
|
13395
|
-
return err("unavailable", location.message.replace(/; fix the repository.*$/u, ""), "fix the repository (git status should work here) or run from a non-git directory");
|
|
13397
|
+
return err("unavailable", location.message.replace(/; fix the repository.*$/u, ""), / does not exist /u.test(location.message) ? "run workit from a directory that exists" : "fix the repository (git status should work here) or run from a non-git directory");
|
|
13396
13398
|
return { ok: true, value: { root: location.dir, shared: location.shared } };
|
|
13397
13399
|
}
|
|
13398
13400
|
function ledgerPath(cwd) {
|
|
@@ -13593,7 +13595,7 @@ var sealed = (row, id, at, previous) => {
|
|
|
13593
13595
|
` };
|
|
13594
13596
|
};
|
|
13595
13597
|
function appendRaw(cwd, row, options) {
|
|
13596
|
-
const file = ledgerPath(cwd);
|
|
13598
|
+
const file = options.store ? { ok: true, value: path16.join(options.store.root, "ledger", "ledger.jsonl") } : ledgerPath(cwd);
|
|
13597
13599
|
if (!file.ok)
|
|
13598
13600
|
return file;
|
|
13599
13601
|
const id = newId2();
|
|
@@ -18495,8 +18497,18 @@ var WORKIT_USER_ONLY = [
|
|
|
18495
18497
|
["grant", "set"],
|
|
18496
18498
|
["grant", "raise"],
|
|
18497
18499
|
["ledger", "void"],
|
|
18498
|
-
["approve"]
|
|
18500
|
+
["approve"],
|
|
18501
|
+
["setup"],
|
|
18502
|
+
["uninstall"],
|
|
18503
|
+
["install"],
|
|
18504
|
+
["workspace", "seal"]
|
|
18499
18505
|
];
|
|
18506
|
+
var USER_ONLY_WORD = new RegExp(`\\b(?:${[...new Set(WORKIT_USER_ONLY.map((words) => words[0]))].join("|")})\\b`);
|
|
18507
|
+
var mayRunUserOnly = (text) => {
|
|
18508
|
+
const joined = text.replace(/\\\r?\n/g, "");
|
|
18509
|
+
const bare = joined.replace(/['"\\]/g, "");
|
|
18510
|
+
return [bare, bare.replace(/`/g, "")].some((all) => /\bworkit\b/.test(all) && (USER_ONLY_WORD.test(all) || /\$['"]/.test(joined)));
|
|
18511
|
+
};
|
|
18500
18512
|
var ALLOWED = new Set(WORKIT_ALLOWED_VERBS);
|
|
18501
18513
|
var hasWordsInOrder = (words, needle) => {
|
|
18502
18514
|
let at = 0;
|
|
@@ -18529,6 +18541,8 @@ var workitBypassFlag = (command, dialect = "posix") => {
|
|
|
18529
18541
|
return null;
|
|
18530
18542
|
};
|
|
18531
18543
|
var userOnlyWorkitCall = (command, dialect = "posix") => {
|
|
18544
|
+
if (!mayRunUserOnly(command))
|
|
18545
|
+
return null;
|
|
18532
18546
|
for (const segment of segmentsOf(command, dialect)) {
|
|
18533
18547
|
if (segment.unanalyzable)
|
|
18534
18548
|
continue;
|
package/dist/workit-hook.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// packages/workit-codex/hooks/launcher.ts
|
|
4
|
-
import { readFileSync
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
var foundNode = process.env.WORKIT_HOOK_NODE_VERSION || process.versions.node;
|
|
@@ -39,11 +39,18 @@ var { configDir } = await import("./workit-hook-z09frbdk.js");
|
|
|
39
39
|
var { standingPending } = await import("./workit-hook-mk64s4fk.js");
|
|
40
40
|
var { recordHookRun } = await import("./workit-hook-zyj0kzc5.js");
|
|
41
41
|
var { observeHookBudget } = await import("./workit-hook-3g6cv3hd.js");
|
|
42
|
+
var { hasTaskStore, mayReach } = await import("./workit-hook-8da7z381.js");
|
|
42
43
|
var YTRACK_WORD = /ytrack(?![\w/-]|\.(?!exe|cmd))/i;
|
|
43
44
|
var namesYtrack = (text) => {
|
|
44
45
|
const bare = text.replace(/['"\\]/g, "");
|
|
45
46
|
return YTRACK_WORD.test(bare) || YTRACK_WORD.test(bare.replace(/`/g, ""));
|
|
46
47
|
};
|
|
48
|
+
var USER_ONLY_WORD = /\b(?:release|grant|ledger|approve|setup|uninstall|install|workspace)\b/;
|
|
49
|
+
var mayRunUserOnly = (text) => {
|
|
50
|
+
const joined = text.replace(/\\\r?\n/g, "");
|
|
51
|
+
const bare = joined.replace(/['"\\]/g, "");
|
|
52
|
+
return [bare, bare.replace(/`/g, "")].some((all) => /\bworkit\b/.test(all) && (USER_ONLY_WORD.test(all) || /\$['"]/.test(joined)));
|
|
53
|
+
};
|
|
47
54
|
var payload = "";
|
|
48
55
|
for await (const chunk of process.stdin)
|
|
49
56
|
payload += String(chunk);
|
|
@@ -77,19 +84,8 @@ var quietEvent = () => {
|
|
|
77
84
|
return null;
|
|
78
85
|
if (event === "PostToolUse")
|
|
79
86
|
return /\bcommit\b/.test(text) ? null : event;
|
|
80
|
-
const writes =
|
|
81
|
-
|
|
82
|
-
try {
|
|
83
|
-
const stat = statSync(file, { throwIfNoEntry: false });
|
|
84
|
-
if (stat?.isFile() && stat.nlink > 1)
|
|
85
|
-
return true;
|
|
86
|
-
const real = stat ? realpathSync(file) : path.join(realpathSync(path.dirname(file)), path.basename(file));
|
|
87
|
-
return real !== file && guarded(real);
|
|
88
|
-
} catch {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
}));
|
|
92
|
-
return /\b(?:git|gh|glab|node|tsx|ts-node|bash|sh|zsh|dash|ksh|ruby|perl|php|source)\b|(?:^|[;&|(\n])\s*(?:\w+=\S*\s+)*(?:(?:time|exec|sudo|nice|nohup|env|command|builtin|timeout|stdbuf|if|then|do|while|until|!)\s+(?:-\S+\s+|\d\S*\s+)*)*(?:\.\s+\S|\.{0,2}\/)/.test(text) || guarded(text) || namesYtrack(text) || writes || maybeHeavy(text, value.cwd) ? null : event;
|
|
87
|
+
const writes = /\b(?:git|gh|glab)\b|>|\b(?:tee|touch|mkdir|rm|rmdir|mv|cp|truncate|install|ln|patch|dd|sed|perl|set-content|add-content|out-file|new-item|ni|remove-item|del|copy-item|move-item)\b/i.test(text.replace(/\d*>&(?:\d+|-)(?![^\s;&|()<>])|[\d&]*>>?\s*\/dev\/(?:null|stdout|stderr|tty)(?![^\s;&|()<>])/g, " "));
|
|
88
|
+
return /\b(?:git|gh|glab|node|tsx|ts-node|bash|sh|zsh|dash|ksh|ruby|perl|php|source)\b|(?:^|[;&|(\n])\s*(?:\w+=\S*\s+)*(?:(?:time|exec|sudo|nice|nohup|env|command|builtin|timeout|stdbuf|if|then|do|while|until|!)\s+(?:-\S+\s+|\d\S*\s+)*)*(?:\.\s+\S|\.{0,2}\/)/.test(text) || guarded(text) || namesYtrack(text) || mayRunUserOnly(text) || writes && (process.platform === "win32" || hasTaskStore(value.cwd)) || mayReach(text, value.cwd) || maybeHeavy(text, value.cwd) ? null : event;
|
|
93
89
|
} catch {
|
|
94
90
|
return null;
|
|
95
91
|
}
|
|
@@ -102,7 +98,7 @@ if (quiet) {
|
|
|
102
98
|
`);
|
|
103
99
|
} else {
|
|
104
100
|
try {
|
|
105
|
-
const { runCodexHook } = await import("./workit-hook-
|
|
101
|
+
const { runCodexHook } = await import("./workit-hook-gta6gwg4.js");
|
|
106
102
|
await runCodexHook([payload]);
|
|
107
103
|
} catch (error) {
|
|
108
104
|
const { answerRuntimeFailure } = await import("./workit-hook-9k8dtngs.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/codex",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.3",
|
|
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": [
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"build": "bun scripts/build.ts"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@workit-dev/core": "^1.14.
|
|
45
|
-
"@workit-dev/mcp": "^1.14.
|
|
44
|
+
"@workit-dev/core": "^1.14.3",
|
|
45
|
+
"@workit-dev/mcp": "^1.14.3"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=24"
|