@workit-dev/codex 1.0.3 → 1.1.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workit",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "Adaptive engineering workflow rails for Codex",
5
5
  "author": {
6
6
  "name": "BrainerVirus"
@@ -21195,6 +21195,7 @@ var DOC_EXT = /\.(?:md|mdx|markdown|rst|adoc)$/iu;
21195
21195
  var DOC_NAMES = /^(?:license|licence|notice|authors|changelog|changes|contributors)$/iu;
21196
21196
  var INSTRUCTIONS = /(?:^|\/)(?:AGENTS|CLAUDE|GEMINI|SKILL)\.md$|(?:^|\/)(?:skills|agents|commands|rules|prompts)\/[^/]+/iu;
21197
21197
  var TEST_PATH = /(?:^|\/)(?:test|tests|__tests__)\/|\.(?:test|spec)\.[^/]+$|_test\.[^/]+$/iu;
21198
+ var plural = (count, noun) => `${count} ${noun}${count === 1 ? "" : "s"}`;
21198
21199
  var basename = (file) => file.slice(file.lastIndexOf("/") + 1);
21199
21200
  var isDoc = (file) => !INSTRUCTIONS.test(file) && (DOC_EXT.test(file) || DOC_NAMES.test(basename(file)));
21200
21201
  function kindOf(file) {
@@ -21253,6 +21254,8 @@ function computeLane(input) {
21253
21254
  const behavior = kinds.filter((entry) => entry.kind === "behavior" || entry.kind === "test" || entry.kind === "lockfile");
21254
21255
  const lines = behavior.filter((entry) => entry.kind !== "lockfile").reduce((sum, entry) => sum + entry.file.added + entry.file.deleted, 0);
21255
21256
  const opaque = behavior.filter((entry) => entry.kind === "lockfile" || entry.file.binary);
21257
+ const diffLines = input.files.reduce((sum, file) => sum + file.added + file.deleted, 0);
21258
+ const counted = diffLines === lines && input.files.length === behavior.length ? "" : ` counted (the whole diff is ${plural(diffLines, "line")} in ${plural(input.files.length, "file")}; docs, comments, formatting, generated copies and lockfile lines are not counted)`;
21256
21259
  const result = (lane, reasons) => ({
21257
21260
  lane,
21258
21261
  reasons,
@@ -21272,9 +21275,9 @@ function computeLane(input) {
21272
21275
  input.files.length ? "only docs, comments, formatting or generated copies changed" : "no changes"
21273
21276
  ]);
21274
21277
  if (lines >= fullMinLines)
21275
- return result("full", [`large diff: ${lines} lines (≥ ${fullMinLines})`]);
21278
+ return result("full", [`large diff: ${lines} lines (≥ ${fullMinLines})${counted}`]);
21276
21279
  if (lines > selfMaxLines)
21277
- return result("focused", [`${lines} lines changed (> ${selfMaxLines})`]);
21280
+ return result("focused", [`${lines} lines changed (> ${selfMaxLines})${counted}`]);
21278
21281
  if (behavior.length > selfMaxFiles)
21279
21282
  return result("focused", [`${behavior.length} behavior files changed (> ${selfMaxFiles})`]);
21280
21283
  if (opaque.length)
@@ -21282,7 +21285,7 @@ function computeLane(input) {
21282
21285
  `a lockfile or binary changed: ${opaque.slice(0, 3).map((entry) => entry.file.path).join(", ")}${opaque.length > 3 ? ", …" : ""}`
21283
21286
  ]);
21284
21287
  return result("self", [
21285
- `small change: ${lines} line${lines === 1 ? "" : "s"} in ${behavior.length} file${behavior.length === 1 ? "" : "s"}, no risk path`
21288
+ `small change: ${plural(lines, "line")} in ${plural(behavior.length, "file")}${counted}, no risk path`
21286
21289
  ]);
21287
21290
  }
21288
21291
  function untrackedStat(cwd, file) {
@@ -14142,6 +14142,7 @@ var DOC_EXT = /\.(?:md|mdx|markdown|rst|adoc)$/iu;
14142
14142
  var DOC_NAMES = /^(?:license|licence|notice|authors|changelog|changes|contributors)$/iu;
14143
14143
  var INSTRUCTIONS = /(?:^|\/)(?:AGENTS|CLAUDE|GEMINI|SKILL)\.md$|(?:^|\/)(?:skills|agents|commands|rules|prompts)\/[^/]+/iu;
14144
14144
  var TEST_PATH = /(?:^|\/)(?:test|tests|__tests__)\/|\.(?:test|spec)\.[^/]+$|_test\.[^/]+$/iu;
14145
+ var plural = (count, noun) => `${count} ${noun}${count === 1 ? "" : "s"}`;
14145
14146
  var basename = (file) => file.slice(file.lastIndexOf("/") + 1);
14146
14147
  var isDoc = (file) => !INSTRUCTIONS.test(file) && (DOC_EXT.test(file) || DOC_NAMES.test(basename(file)));
14147
14148
  function kindOf(file) {
@@ -14200,6 +14201,8 @@ function computeLane(input) {
14200
14201
  const behavior = kinds.filter((entry) => entry.kind === "behavior" || entry.kind === "test" || entry.kind === "lockfile");
14201
14202
  const lines = behavior.filter((entry) => entry.kind !== "lockfile").reduce((sum, entry) => sum + entry.file.added + entry.file.deleted, 0);
14202
14203
  const opaque = behavior.filter((entry) => entry.kind === "lockfile" || entry.file.binary);
14204
+ const diffLines = input.files.reduce((sum, file) => sum + file.added + file.deleted, 0);
14205
+ const counted = diffLines === lines && input.files.length === behavior.length ? "" : ` counted (the whole diff is ${plural(diffLines, "line")} in ${plural(input.files.length, "file")}; docs, comments, formatting, generated copies and lockfile lines are not counted)`;
14203
14206
  const result = (lane, reasons) => ({
14204
14207
  lane,
14205
14208
  reasons,
@@ -14219,9 +14222,9 @@ function computeLane(input) {
14219
14222
  input.files.length ? "only docs, comments, formatting or generated copies changed" : "no changes"
14220
14223
  ]);
14221
14224
  if (lines >= fullMinLines)
14222
- return result("full", [`large diff: ${lines} lines (≥ ${fullMinLines})`]);
14225
+ return result("full", [`large diff: ${lines} lines (≥ ${fullMinLines})${counted}`]);
14223
14226
  if (lines > selfMaxLines)
14224
- return result("focused", [`${lines} lines changed (> ${selfMaxLines})`]);
14227
+ return result("focused", [`${lines} lines changed (> ${selfMaxLines})${counted}`]);
14225
14228
  if (behavior.length > selfMaxFiles)
14226
14229
  return result("focused", [`${behavior.length} behavior files changed (> ${selfMaxFiles})`]);
14227
14230
  if (opaque.length)
@@ -14229,7 +14232,7 @@ function computeLane(input) {
14229
14232
  `a lockfile or binary changed: ${opaque.slice(0, 3).map((entry) => entry.file.path).join(", ")}${opaque.length > 3 ? ", …" : ""}`
14230
14233
  ]);
14231
14234
  return result("self", [
14232
- `small change: ${lines} line${lines === 1 ? "" : "s"} in ${behavior.length} file${behavior.length === 1 ? "" : "s"}, no risk path`
14235
+ `small change: ${plural(lines, "line")} in ${plural(behavior.length, "file")}${counted}, no risk path`
14233
14236
  ]);
14234
14237
  }
14235
14238
  function untrackedStat(cwd, file) {
@@ -22721,36 +22724,54 @@ var DESCRIPTORS = {
22721
22724
  pi: PI_DESCRIPTOR
22722
22725
  };
22723
22726
  var workerOfLead = (input) => input.session.agentType === null || workitRole(DESCRIPTORS[input.host], input.session.agentType) !== null;
22724
- var worksFor = (plan, input, branch) => {
22727
+ var worksFor = (plan, input, branches) => {
22725
22728
  const session = input.session.id;
22726
22729
  if (plan.leads.includes(session) && !input.session.agentId)
22727
- return false;
22730
+ return null;
22731
+ if (branches.some((branch) => plan.branches.includes(branch)))
22732
+ return "slice";
22728
22733
  const lead = leadOf2(input);
22729
22734
  if (lead && plan.leads.includes(lead) && workerOfLead(input))
22730
- return true;
22731
- if (plan.leads.some((each) => session.startsWith(`${each}-w-`)))
22732
- return true;
22733
- const current = branch();
22734
- return current !== null && plan.branches.includes(current);
22735
+ return "lead";
22736
+ return plan.leads.some((each) => session.startsWith(`${each}-w-`)) ? "lead" : null;
22737
+ };
22738
+ var agentBranches = (input, rows) => {
22739
+ const { id, agentId } = input.session;
22740
+ const bound = agentId ? rows.findLast((row) => row.type === "worktree.bound" && row.actor.session === id && row.actor.agentId === agentId && typeof row.worktree === "string")?.worktree : undefined;
22741
+ const dirs = typeof bound === "string" ? [input.cwd, bound] : [input.cwd];
22742
+ return dirs.map((dir) => currentBranch(dir)).filter((branch) => !!branch);
22735
22743
  };
22736
22744
  var standingFor = (input, store, rev) => {
22737
22745
  const orders = new Map;
22738
22746
  const ledger = readLedger(input.cwd);
22739
22747
  const rows = ledger.ok ? ledger.value.rows : [];
22740
- let branch;
22741
- const lazyBranch = () => branch === undefined ? branch = currentBranch(input.cwd) : branch;
22742
- for (const plan of readPlans(store))
22743
- if (worksFor(plan, input, lazyBranch))
22744
- for (const row of activeStanding(rows, plan.name, plan.leads.length ? plan.leads : null))
22745
- orders.set(row.id, row);
22746
- return { rev, orders, rows };
22748
+ const branches = agentBranches(input, rows);
22749
+ const matched = readPlans(store).map((plan) => ({
22750
+ plan,
22751
+ how: worksFor(plan, input, branches)
22752
+ }));
22753
+ const tied = matched.some(({ how }) => how === "slice");
22754
+ const plans = matched.filter(({ how }) => tied ? how === "slice" : how !== null);
22755
+ for (const { plan } of plans)
22756
+ for (const row of activeStanding(rows, plan.name, plan.leads.length ? plan.leads : null))
22757
+ orders.set(row.id, row);
22758
+ return {
22759
+ rev,
22760
+ orders,
22761
+ rows,
22762
+ fanouts: new Set(plans.map(({ plan }) => plan.name))
22763
+ };
22747
22764
  };
22748
22765
  var located = (input) => {
22749
22766
  const store = input.session.id ? gitStoreDir2(input.cwd) : null;
22750
22767
  const rev = store ? readStandingRev2(store) : null;
22751
22768
  if (!store || rev === null)
22752
22769
  return null;
22753
- return { store, rev, file: standingSeenFile2(store, input.session.id, input.session.agentId) };
22770
+ return {
22771
+ store,
22772
+ rev,
22773
+ file: standingSeenFile2(store, input.session.id, input.session.agentId)
22774
+ };
22754
22775
  };
22755
22776
  var seedStanding = (input) => {
22756
22777
  try {
@@ -22758,7 +22779,10 @@ var seedStanding = (input) => {
22758
22779
  if (!where)
22759
22780
  return;
22760
22781
  const now = standingFor(input, where.store, where.rev);
22761
- writeStandingSeen2(where.file, { rev: where.rev, ids: [...now.orders.keys()] });
22782
+ writeStandingSeen2(where.file, {
22783
+ rev: where.rev,
22784
+ ids: [...now.orders.keys()]
22785
+ });
22762
22786
  } catch {}
22763
22787
  };
22764
22788
  var fanoutOf = (row) => typeof row.fanout === "string" ? row.fanout : "?";
@@ -22766,7 +22790,7 @@ var changedSince = (now, ids) => {
22766
22790
  const known = new Set(ids);
22767
22791
  const added = [...now.orders.values()].filter((row) => !known.has(row.id));
22768
22792
  const byId = new Map(now.rows.map((row) => [row.id, row]));
22769
- const dropped = ids.filter((id) => !now.orders.has(id)).map((id) => byId.get(id)).filter((row) => row !== undefined);
22793
+ const dropped = ids.filter((id) => !now.orders.has(id)).map((id) => byId.get(id)).filter((row) => row !== undefined && now.fanouts.has(fanoutOf(row)));
22770
22794
  if (!added.length && !dropped.length)
22771
22795
  return null;
22772
22796
  const fanouts = [...new Set([...added, ...dropped].map(fanoutOf))].join(", ");
@@ -22789,7 +22813,10 @@ var standingDelta = (input) => {
22789
22813
  if (seen.rev === where.rev)
22790
22814
  return null;
22791
22815
  const now = standingFor(input, where.store, where.rev);
22792
- writeStandingSeen2(where.file, { rev: where.rev, ids: [...now.orders.keys()] });
22816
+ writeStandingSeen2(where.file, {
22817
+ rev: where.rev,
22818
+ ids: [...now.orders.keys()]
22819
+ });
22793
22820
  return changedSince(now, seen.ids);
22794
22821
  } catch {
22795
22822
  return null;
@@ -84,7 +84,7 @@ if (quiet) {
84
84
  `);
85
85
  } else {
86
86
  try {
87
- const { runCodexHook } = await import("./workit-hook-2hj7pbaj.js");
87
+ const { runCodexHook } = await import("./workit-hook-p3rqtsq1.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.0.3",
3
+ "version": "1.1.0",
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.0.3",
45
- "@workit-dev/mcp": "^1.0.3"
44
+ "@workit-dev/core": "^1.1.0",
45
+ "@workit-dev/mcp": "^1.1.0"
46
46
  },
47
47
  "engines": {
48
48
  "node": ">=24"
@@ -41,7 +41,7 @@ the same check. Fix round and recheck both failed: a decider (read the `workit-f
41
41
  and the stop point unless merge is granted.
42
42
  3. **Conflicts or a required rebase.** Rewrite only a branch this session or
43
43
  its stack created (yours in `workit ledger list --type commit.recorded` or
44
- `workit stack status`): rebase onto the base, `workit git push
44
+ `workit stack status`): `workit git rebase`, then `workit git push
45
45
  --force-with-lease` (`workit stack sync` in a stack). Anyone else's branch:
46
46
  report that a rebase is needed and stop.
47
47
  4. **Review threads** (`workit pr threads`). Check each claim in the code; fix