@workit-dev/codex 1.3.0 → 1.4.1

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.3.0",
3
+ "version": "1.4.1",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -23317,20 +23317,23 @@ var cwdRewrite = (command) => {
23317
23317
  const rest = match?.[2];
23318
23318
  if (!dir || !rest || dir.startsWith("-"))
23319
23319
  return null;
23320
- if (/[&;<>`\n]/u.test(rest.replaceAll("2>&1", "")))
23320
+ if (/[&;<>`\n]/u.test(rest.replaceAll("2>&1", "").replaceAll(/'[^']*'|"(?:[^"\\]|\\.)*"/gu, "")))
23321
23321
  return null;
23322
23322
  const segments = segmentsOf(rest);
23323
23323
  const [head, ...filters] = segments;
23324
23324
  if (!head || head.words[0] !== "workit")
23325
23325
  return null;
23326
- if (head.words.some((w) => w === "--cwd" || w.startsWith("--cwd=")))
23327
- return null;
23328
23326
  if (!segments.every(clean))
23329
23327
  return null;
23330
23328
  if (!segments.slice(0, -1).every((s) => s.pipe))
23331
23329
  return null;
23332
23330
  if (!filters.every((s) => FILTERS.has(s.words[0] ?? "") && stdinOnly(s.words)))
23333
23331
  return null;
23332
+ const at = head.words.indexOf("--cwd");
23333
+ if (at >= 0)
23334
+ return head.words[at + 1] === dir.replace(/^(['"])(.*)\1$/u, "$2") ? rest : null;
23335
+ if (head.words.some((w) => w.startsWith("--cwd=")))
23336
+ return null;
23334
23337
  const args = rest.slice("workit".length).trimStart();
23335
23338
  const verb = VERB_FIRST.exec(args);
23336
23339
  if (!verb?.[2] || !VERBS.has(verb[2]))
@@ -23348,6 +23351,25 @@ var verbFirst = (command) => {
23348
23351
  return null;
23349
23352
  return `${lead} ${verb}${globals}${command.slice(whole.length)}`;
23350
23353
  };
23354
+ 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;
23355
+ var cdWorkitSplit = (command) => {
23356
+ const match = COMPOUND2.exec(command);
23357
+ const dir = match?.[1];
23358
+ const rest = match?.[2];
23359
+ if (!dir || !rest || cwdRewrite(command) !== null)
23360
+ return null;
23361
+ const whole = segmentsOf(rest);
23362
+ const boundary = (head) => segmentsOf(head).every((s, at) => s.words.join("\x00") === whole[at]?.words.join("\x00"));
23363
+ for (const op of rest.matchAll(/\|\||;/gu)) {
23364
+ const head = rest.slice(0, op.index).trimEnd();
23365
+ const call = cwdRewrite(`cd ${dir} && ${head}`);
23366
+ if (!call || !boundary(head))
23367
+ continue;
23368
+ const next = segmentsOf(rest.slice(op.index + op[0].length))[0];
23369
+ return next && MUTATING_GIT2.test(next.words.join(" ")) ? call : null;
23370
+ }
23371
+ return null;
23372
+ };
23351
23373
 
23352
23374
  // packages/workit-core/src/hooks/model-limit.ts
23353
23375
  import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync3, readSync, statSync as statSync5 } from "node:fs";
@@ -23798,6 +23820,13 @@ function decide(input, deps) {
23798
23820
  const policy = canDeny ? shellPolicy(input.cwd, event.command, event.dialect) : NONE6;
23799
23821
  if (policy.kind !== "none")
23800
23822
  return policy;
23823
+ const split = canDeny ? cdWorkitSplit(event.command) : null;
23824
+ if (split)
23825
+ return {
23826
+ kind: "deny",
23827
+ reason: `Run one workit verb per call, with no raw-git fallback: \`${split}\`. If it fails, fix what its error names; do not retry with raw git.`,
23828
+ unblock: null
23829
+ };
23801
23830
  const postTool = usable2(descriptor.events["shell.post"].support);
23802
23831
  if (!postTool)
23803
23832
  settlePendingCommit(input);
@@ -84,7 +84,7 @@ if (quiet) {
84
84
  `);
85
85
  } else {
86
86
  try {
87
- const { runCodexHook } = await import("./workit-hook-sc4ng8c7.js");
87
+ const { runCodexHook } = await import("./workit-hook-5xd3wfr8.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.3.0",
3
+ "version": "1.4.1",
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.3.0",
45
- "@workit-dev/mcp": "^1.3.0"
44
+ "@workit-dev/core": "^1.4.1",
45
+ "@workit-dev/mcp": "^1.4.1"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=24"