@workit-dev/codex 1.7.3 → 1.7.4

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workit",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -31293,6 +31293,7 @@ var COMPOUND2 = new RegExp(String.raw`^\s*cd\s+(${DIR})\s*&&\s*(workit(?:\s[\s\S
31293
31293
  var GLOBALS_FIRST = new RegExp(String.raw`^(\s*workit)((?:\s+(?:--json|--cwd(?:=|\s+)(?:${DIR})))+)\s+([a-z][a-z-]*)(?=\s|$)`, "u");
31294
31294
  var VERBS = new Set(WORKIT_ALLOWED_VERBS);
31295
31295
  var FILTERS = new Set(["tail", "head", "grep"]);
31296
+ var NPX = new RegExp(String.raw`^(\s*(?:cd\s+(?:${DIR})\s*&&\s*)?)npx(?:\s+(?:-y|--yes))*\s+@workit-dev\/cli(?:@[\w.-]+)?(?=\s|$)`, "u");
31296
31297
 
31297
31298
  // packages/workit-core/src/hooks/model-limit.ts
31298
31299
  var MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
@@ -20985,8 +20985,51 @@ import path32 from "node:path";
20985
20985
  // packages/workit-core/src/approvals/store.ts
20986
20986
  var REQUEST_TTL_MS = 30 * 60000;
20987
20987
  var GRANT_TTL_MS = 15 * 60000;
20988
+ var ID_PATTERN = /^ap_[a-z2-7]{8}$/u;
20989
+ var isApprovalId = (word) => ID_PATTERN.test(word);
20988
20990
  var ASKING_HOSTS = new Set(["claude_code", "pi"]);
20989
20991
 
20992
+ // packages/workit-core/src/approvals/call.ts
20993
+ var isWorkitWord2 = (word) => /^(?:.*[\\/])?workit(?:-cli)?$/u.test(word);
20994
+ var verbIndex = (words, start) => {
20995
+ let at = start;
20996
+ for (;; ) {
20997
+ const word = words[at];
20998
+ if (word === "--json")
20999
+ at += 1;
21000
+ else if (word === "--cwd" || word === "--session")
21001
+ at += 2;
21002
+ else if (word?.startsWith("--cwd="))
21003
+ at += 1;
21004
+ else
21005
+ return at;
21006
+ }
21007
+ };
21008
+ var approveCallIn = (command, dialect = "posix") => {
21009
+ const segments = segmentsOf(command, dialect);
21010
+ for (const segment of segments) {
21011
+ if (segment.unanalyzable)
21012
+ continue;
21013
+ const start = segment.words.findIndex(isWorkitWord2);
21014
+ if (start < 0)
21015
+ continue;
21016
+ const at = verbIndex(segment.words, start + 1);
21017
+ if (segment.words[at] !== "approve")
21018
+ continue;
21019
+ const args = segment.words.slice(at + 1);
21020
+ const ids = args.filter(isApprovalId);
21021
+ const plain = segments.length === 1 && start === 0 && segment.words[0] === "workit" && at === 1 && !segment.redirects.length && !segment.subs?.length && !segment.stdin?.length && !segment.expands?.length && !segment.group;
21022
+ if (plain)
21023
+ return ids.length > 0 && ids.length === args.length ? { plain: true, ids } : null;
21024
+ return {
21025
+ plain: false,
21026
+ fix: `workit approve ${ids.length ? ids.join(" ") : "<id>…"}`
21027
+ };
21028
+ }
21029
+ return null;
21030
+ };
21031
+ var approveCallDeny = (fix) => `Run \`${fix}\` as its own call: no chain, pipe, substitution, leading cd, env prefix or redirect around it, so the host can show the request and record the user's answer.`;
21032
+
20990
21033
  // packages/workit-core/src/hooks/hosts/claude-code.ts
20991
21034
  var CLAUDE_CODE_DESCRIPTOR = {
20992
21035
  host: "claude_code",
@@ -22352,6 +22395,15 @@ var verbFirst = (command) => {
22352
22395
  return null;
22353
22396
  return `${lead} ${verb}${globals}${command.slice(whole.length)}`;
22354
22397
  };
22398
+ var NPX = new RegExp(String.raw`^(\s*(?:cd\s+(?:${DIR})\s*&&\s*)?)npx(?:\s+(?:-y|--yes))*\s+@workit-dev\/cli(?:@[\w.-]+)?(?=\s|$)`, "u");
22399
+ var npxWorkit = (command) => {
22400
+ const match = NPX.exec(command);
22401
+ if (!match)
22402
+ return null;
22403
+ const call = `${match[1]}workit${command.slice(match[0].length)}`;
22404
+ const left = segmentsOf(call).some((s) => s.unanalyzable || s.words.some((w) => /^(npx|@workit-dev\/cli(@\S*)?)$/u.test(w)));
22405
+ return left ? null : cwdRewrite(call) ?? verbFirst(call) ?? call;
22406
+ };
22355
22407
  var MUTATING_GIT2 = /^git( -\S+| -[Cc] \S+)* (commit|push|add|switch|checkout|merge|rebase|reset|cherry-pick|revert|branch .*(-[dDmM]|--delete|--move)\b|tag (?!-l\b|--list)|stash(?! (list|show)\b))/u;
22356
22408
  var cdWorkitSplit = (command) => {
22357
22409
  const match = COMPOUND2.exec(command);
@@ -22818,6 +22870,28 @@ function decide(input, deps) {
22818
22870
  return withContextLine(text ? { kind: "context", text } : NONE6, promptNudge(input, event.prompt));
22819
22871
  }
22820
22872
  case "shell.pre": {
22873
+ const npx = npxWorkit(event.command);
22874
+ if (npx && workitOnPath()) {
22875
+ const canDeny = usable2(descriptor.shellPolicy.deny);
22876
+ const approve = approveCallIn(npx, event.dialect);
22877
+ if (approve && canDeny && (input.host === "claude_code" || input.host === "pi")) {
22878
+ const fix = approve.plain ? `workit approve ${approve.ids.join(" ")}` : approve.fix;
22879
+ return { kind: "deny", reason: approveCallDeny(fix), unblock: fix };
22880
+ }
22881
+ const plain = decide({ ...input, event: { ...event, command: npx } }, deps);
22882
+ if (plain.kind !== "none" && plain.kind !== "context")
22883
+ return plain;
22884
+ if (usable2(descriptor.shellPolicy.rewrite))
22885
+ return {
22886
+ kind: "rewrite",
22887
+ command: npx,
22888
+ input: event.toolInput ? { ...event.toolInput, command: npx } : null,
22889
+ text: plain.kind === "context" ? plain.text : null
22890
+ };
22891
+ if (canDeny)
22892
+ return { kind: "deny", reason: `Run \`${npx}\`: workit is on PATH.`, unblock: npx };
22893
+ return plain;
22894
+ }
22821
22895
  const skillRead = skillReadIn(event.command, event.dialect);
22822
22896
  if (skillRead)
22823
22897
  recordSkillLoad(input, skillRead, "read");
@@ -84,7 +84,7 @@ if (quiet) {
84
84
  `);
85
85
  } else {
86
86
  try {
87
- const { runCodexHook } = await import("./workit-hook-qym3cwad.js");
87
+ const { runCodexHook } = await import("./workit-hook-p1md1gwa.js");
88
88
  await runCodexHook([payload]);
89
89
  } catch (error) {
90
90
  const { answerRuntimeFailure } = await import("./workit-hook-ehy7rps6.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/codex",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
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.7.3",
45
- "@workit-dev/mcp": "^1.7.3"
44
+ "@workit-dev/core": "^1.7.4",
45
+ "@workit-dev/mcp": "^1.7.4"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=24"