@workit-dev/codex 1.4.2 → 1.5.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.
@@ -15298,12 +15298,11 @@ function checkVerdictsOnce(cwd, branch, ledgerRows) {
15298
15298
  }
15299
15299
  return reasons;
15300
15300
  };
15301
- const retired = new Set;
15301
+ const voided = verdictVoids(rows, { chained: true });
15302
+ const retired = new Set(voided.keys());
15302
15303
  for (const row of rows)
15303
- if (row.type === "verdict" && row.supersedes && !row.supersedeIgnored && trustReasons(cwd, row).length === 0)
15304
+ if (row.type === "verdict" && row.supersedes && !row.supersedeIgnored && !voided.has(row.id) && trustReasons(cwd, row).length === 0)
15304
15305
  retired.add(row.supersedes);
15305
- for (const id of verdictVoids(rows, { chained: true }).keys())
15306
- retired.add(id);
15307
15306
  const byKind = new Map;
15308
15307
  for (const row of rows.toSorted(byRank))
15309
15308
  if (isLiveVerdict(row, retired) && scope(row)) {
@@ -16635,31 +16634,75 @@ var seedTurnContext = (input, descriptor, text = turnContextText(input, descript
16635
16634
  };
16636
16635
  // packages/workit-core/src/core/route-intent.ts
16637
16636
  import { spawnSync as spawnSync13 } from "node:child_process";
16638
- import { existsSync as existsSync8 } from "node:fs";
16639
- import path23 from "node:path";
16637
+ import { existsSync as existsSync9 } from "node:fs";
16638
+ import path24 from "node:path";
16640
16639
 
16641
16640
  // packages/workit-core/src/hooks/raw-git.ts
16642
16641
  import { spawnSync as spawnSync12 } from "node:child_process";
16643
16642
  import { createHash as createHash15 } from "node:crypto";
16644
16643
  import fs16 from "node:fs";
16645
- import os5 from "node:os";
16646
- import path22 from "node:path";
16644
+ import os6 from "node:os";
16645
+ import path23 from "node:path";
16647
16646
 
16648
16647
  // packages/workit-core/src/autonomy.ts
16648
+ import os5 from "node:os";
16649
+ import path21 from "node:path";
16650
+
16651
+ // packages/workit-core/src/core/eval-world.ts
16652
+ import { existsSync as existsSync8, realpathSync as realpathSync6 } from "node:fs";
16649
16653
  import os4 from "node:os";
16650
16654
  import path20 from "node:path";
16655
+ var EVAL_WORLD_ENV = "WORKIT_EVAL_WORLD";
16656
+ var EVAL_WORLD_MARKER = ".workit-eval-world";
16657
+ var inside2 = (dir, file) => {
16658
+ const rel = path20.relative(dir, file);
16659
+ return !rel.startsWith("..") && !path20.isAbsolute(rel);
16660
+ };
16661
+ var evalWorldEntry = (cwd) => {
16662
+ const raw = process.env[EVAL_WORLD_ENV];
16663
+ if (!raw || !path20.isAbsolute(raw))
16664
+ return null;
16665
+ try {
16666
+ const world = realpathSync6(raw);
16667
+ if (!inside2(realpathSync6(os4.tmpdir()), world) || !inside2(world, realpathSync6(cwd)) || !existsSync8(path20.join(world, EVAL_WORLD_MARKER)))
16668
+ return null;
16669
+ return loadWorkspacesFrom(path20.join(world, "config"))[0] ?? null;
16670
+ } catch {
16671
+ return null;
16672
+ }
16673
+ };
16674
+
16675
+ // packages/workit-core/src/autonomy.ts
16651
16676
  var accountHome2 = () => {
16652
16677
  try {
16653
- return os4.userInfo().homedir;
16678
+ return os5.userInfo().homedir;
16654
16679
  } catch {
16655
- return os4.homedir();
16680
+ return os5.homedir();
16656
16681
  }
16657
16682
  };
16658
16683
  var grantsHome = { resolve: accountHome2 };
16659
16684
  var grantsDir = () => configDir({ HOME: grantsHome.resolve() });
16685
+ var benchWorld = (cwd) => {
16686
+ const entry = evalWorldEntry(cwd);
16687
+ if (!entry)
16688
+ return null;
16689
+ const { grants } = configuredGrants(entry);
16690
+ const lowered = {};
16691
+ for (const kind of GRANT_KINDS) {
16692
+ const value = grants[kind];
16693
+ if (value !== undefined && raises(kind, value, DEFAULT_GRANTS[kind]))
16694
+ lowered[kind] = value;
16695
+ }
16696
+ return {
16697
+ name: entry.name,
16698
+ glob: entry.glob,
16699
+ ...entry.defaultEndpoint ? { defaultEndpoint: entry.defaultEndpoint } : {},
16700
+ autonomy: lowered
16701
+ };
16702
+ };
16660
16703
  var grantsOverride = () => {
16661
- const configured = path20.resolve(resolveConfigDir());
16662
- return configured === path20.resolve(grantsDir()) ? null : `the config directory is redirected to ${configured} (WORKIT_CONFIG, WORKIT_CONFIG_DIR or XDG_CONFIG_HOME), but that override does not apply to grants: grants are read only from ${path20.join(grantsDir(), "workspaces.json")}, so the D4 defaults apply until grants are set there`;
16704
+ const configured = path21.resolve(resolveConfigDir());
16705
+ return configured === path21.resolve(grantsDir()) ? null : `the config directory is redirected to ${configured} (WORKIT_CONFIG, WORKIT_CONFIG_DIR or XDG_CONFIG_HOME), but that override does not apply to grants: grants are read only from ${path21.join(grantsDir(), "workspaces.json")}, so the D4 defaults apply until grants are set there`;
16663
16706
  };
16664
16707
  var GRANT_KINDS = ["push", "pr", "merge", "release", "rerun"];
16665
16708
  var DEFAULT_GRANTS = Object.freeze({
@@ -16824,11 +16867,12 @@ function capAt(named, where, by, why, main = false) {
16824
16867
  };
16825
16868
  }
16826
16869
  function resolveAutonomy(cwd, target) {
16827
- const override = grantsOverride();
16870
+ const world = benchWorld(cwd);
16871
+ const override = world ? null : grantsOverride();
16828
16872
  if (override)
16829
16873
  return { ...autonomyOf(null), note: override };
16830
16874
  const name = process.env.WORKIT_WORKSPACE_NAME?.trim() || undefined;
16831
- let autonomy = autonomyOf(resolveWorkspaceFrom(cwd, grantsDir(), name));
16875
+ let autonomy = autonomyOf(resolveWorkspaceFrom(cwd, grantsDir(), name) ?? world);
16832
16876
  if (name)
16833
16877
  autonomy = capAt(autonomy, cwd, `WORKIT_WORKSPACE_NAME=${name}`, "a name never raises grants");
16834
16878
  const above = checkoutsAbove(cwd);
@@ -16916,7 +16960,7 @@ var raises = (kind, current, next) => {
16916
16960
  // packages/workit-core/src/hooks/session-marker.ts
16917
16961
  import { createHash as createHash14 } from "node:crypto";
16918
16962
  import fs15 from "node:fs";
16919
- import path21 from "node:path";
16963
+ import path22 from "node:path";
16920
16964
  var sessionMarkerFile = (input, session, store) => {
16921
16965
  let dir = store;
16922
16966
  if (dir === undefined) {
@@ -16926,7 +16970,7 @@ var sessionMarkerFile = (input, session, store) => {
16926
16970
  dir = location.dir;
16927
16971
  }
16928
16972
  const name = createHash14("sha256").update(`${input.host}\x00${session}`).digest("hex").slice(0, 32);
16929
- return path21.join(dir, "hooks", `skills-${name}.json`);
16973
+ return path22.join(dir, "hooks", `skills-${name}.json`);
16930
16974
  };
16931
16975
  var list = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
16932
16976
  var EMPTY = {
@@ -16961,7 +17005,7 @@ var parseMarker = (text) => {
16961
17005
  };
16962
17006
  var readSessionMarker = (file) => parseMarker(readRaw(file));
16963
17007
  var writeAtomic = (file, marker) => {
16964
- fs15.mkdirSync(path21.dirname(file), { recursive: true });
17008
+ fs15.mkdirSync(path22.dirname(file), { recursive: true });
16965
17009
  const temp = `${file}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
16966
17010
  try {
16967
17011
  fs15.writeFileSync(temp, JSON.stringify(marker));
@@ -17546,14 +17590,14 @@ var GIT_CONFIG_ENV = /^(?:GIT_(?:CONFIG\w*|DIR|COMMON_DIR|WORK_TREE|SSH|SSH_COMM
17546
17590
  var ASSIGNMENT = /^([A-Za-z_]\w*)=([\s\S]*)$/;
17547
17591
  var MAX_DEPTH = 4;
17548
17592
  var MAX_EXPANSIONS = 16;
17549
- var isAbsolute = (value) => path22.isAbsolute(value) || /^[A-Za-z]:[\\/]/.test(value) || value.startsWith("\\\\");
17593
+ var isAbsolute = (value) => path23.isAbsolute(value) || /^[A-Za-z]:[\\/]/.test(value) || value.startsWith("\\\\");
17550
17594
  var HERE = /^(?:\$PWD|\$\{PWD\}|\$\(\s*pwd\s*\)|`pwd`|\$\(\s*git\s+rev-parse\s+--show-toplevel\s*\))(?=$|[\\/])/;
17551
17595
  var joinDir = (base, raw) => {
17552
17596
  const next = raw.replace(HERE, ".");
17553
17597
  if (base === undefined || /[$`*?]/.test(next) || next === "-")
17554
17598
  return;
17555
- const expanded = next === "~" || next.startsWith("~/") ? path22.join(os5.homedir(), next.slice(1)) : next;
17556
- return base === null || isAbsolute(expanded) ? expanded : path22.join(base, expanded);
17599
+ const expanded = next === "~" || next.startsWith("~/") ? path23.join(os6.homedir(), next.slice(1)) : next;
17600
+ return base === null || isAbsolute(expanded) ? expanded : path23.join(base, expanded);
17557
17601
  };
17558
17602
  var rebase = (base, inner) => inner === null ? base : inner === undefined ? undefined : joinDir(base, inner);
17559
17603
  var cdTarget = (words) => {
@@ -17954,7 +17998,7 @@ function walk2(command, dialect, depth, seen, inherited = {}) {
17954
17998
  }
17955
17999
  if (CD.has(name)) {
17956
18000
  const target = cdTarget(words);
17957
- dir = target === null ? os5.homedir() : joinDir(dir, target);
18001
+ dir = target === null ? os6.homedir() : joinDir(dir, target);
17958
18002
  } else if (PUSHD.has(name)) {
17959
18003
  const target = cdTarget(words);
17960
18004
  stack.push(dir);
@@ -18475,17 +18519,17 @@ var headSha2 = (repo) => {
18475
18519
  if (!git || git.reftable)
18476
18520
  return null;
18477
18521
  try {
18478
- const head = fs16.readFileSync(path22.join(git.gitDir, "HEAD"), "utf8").trim();
18522
+ const head = fs16.readFileSync(path23.join(git.gitDir, "HEAD"), "utf8").trim();
18479
18523
  if (/^[0-9a-f]{40,64}$/.test(head))
18480
18524
  return head;
18481
18525
  const ref = /^ref: (refs\/.+)$/.exec(head)?.[1];
18482
18526
  if (!ref)
18483
18527
  return null;
18484
- const common = path22.dirname(repo.location.dir);
18528
+ const common = path23.dirname(repo.location.dir);
18485
18529
  try {
18486
- return fs16.readFileSync(path22.join(common, ref), "utf8").trim() || null;
18530
+ return fs16.readFileSync(path23.join(common, ref), "utf8").trim() || null;
18487
18531
  } catch {}
18488
- const packed = fs16.readFileSync(path22.join(common, "packed-refs"), "utf8");
18532
+ const packed = fs16.readFileSync(path23.join(common, "packed-refs"), "utf8");
18489
18533
  return new RegExp(`^([0-9a-f]{40,64}) ${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`, "m").exec(packed)?.[1] ?? null;
18490
18534
  } catch {
18491
18535
  return null;
@@ -18578,7 +18622,7 @@ var expandGitAliases = (root, invocation, cache = new Map, depth = 0) => {
18578
18622
  const sub = invocation.args[0];
18579
18623
  if (invocation.tool !== "git" || invocation.dir === undefined || !sub || sub.startsWith("-") || GIT_COMMANDS.has(sub) || depth >= MAX_DEPTH)
18580
18624
  return [invocation];
18581
- const dir = path22.resolve(root, invocation.dir ?? ".");
18625
+ const dir = path23.resolve(root, invocation.dir ?? ".");
18582
18626
  if (!fs16.existsSync(dir))
18583
18627
  return [invocation];
18584
18628
  const config = gitConfig(dir, invocation, cache);
@@ -18601,11 +18645,11 @@ var expandGitAliases = (root, invocation, cache = new Map, depth = 0) => {
18601
18645
  var normalizedUrl = (url, dir) => {
18602
18646
  const trimmed = url.trim();
18603
18647
  if (/^file:\/\//i.test(trimmed))
18604
- return path22.resolve(dir, trimmed.slice(7)).replace(/\/+$/, "").replace(/\.git$/, "");
18648
+ return path23.resolve(dir, trimmed.slice(7)).replace(/\/+$/, "").replace(/\.git$/, "");
18605
18649
  const scheme = /^[a-z][a-z0-9+.-]*:\/\//i.exec(trimmed);
18606
18650
  const scp = !scheme && /^(?:[^@/\\]+@)?[^/\\:]{2,}:/.test(trimmed);
18607
18651
  if (!scheme && !scp)
18608
- return path22.resolve(dir, trimmed).replace(/\/+$/, "").replace(/\.git$/, "");
18652
+ return path23.resolve(dir, trimmed).replace(/\/+$/, "").replace(/\.git$/, "");
18609
18653
  const value = scheme ? trimmed.slice(scheme[0].length).replace(/^[^@/]*@/, "").replace(/^([^/:]+):\d+(?=\/)/, "$1") : trimmed.replace(/^[^@/]*@/, "").replace(":", "/");
18610
18654
  return value.toLowerCase().replace(/\/{2,}/g, "/").replace(/^www\./, "").replace(/\/+$/, "").replace(/\.git$/, "");
18611
18655
  };
@@ -18833,7 +18877,7 @@ var actionsIn = (cwd, command, dialect, cache = new Map, all = false) => {
18833
18877
  const out = [];
18834
18878
  const repos = new Map;
18835
18879
  const repoFor = (relative) => {
18836
- const dir = path22.resolve(cwd, relative ?? ".");
18880
+ const dir = path23.resolve(cwd, relative ?? ".");
18837
18881
  if (!repos.has(dir)) {
18838
18882
  const repo = repoAt(dir);
18839
18883
  const workit = repo !== null && isWorkitWorkspace(repo);
@@ -18853,7 +18897,7 @@ var actionsIn = (cwd, command, dialect, cache = new Map, all = false) => {
18853
18897
  continue;
18854
18898
  const action = rawAction(invocation);
18855
18899
  const at = !action ? null : repoFor(invocation.dir) ?? (all && invocation.tool !== "git" && explicitRepo(invocation.tool === "gh", "repo" in action && action.repo || "", invocation.env ?? {}) ? {
18856
- repo: { dir: path22.resolve(cwd, invocation.dir ?? "."), branch: null },
18900
+ repo: { dir: path23.resolve(cwd, invocation.dir ?? "."), branch: null },
18857
18901
  workit: false
18858
18902
  } : null);
18859
18903
  if (action && at)
@@ -18990,9 +19034,9 @@ var grantRefusal = (action, repo, invocation, cache) => {
18990
19034
  return null;
18991
19035
  };
18992
19036
  var localTag = (repo, name) => {
18993
- const common = path22.dirname(repo.location.dir);
19037
+ const common = path23.dirname(repo.location.dir);
18994
19038
  try {
18995
- return fs16.existsSync(path22.join(common, "refs/tags", name)) || fs16.readFileSync(path22.join(common, "packed-refs"), "utf8").includes(` refs/tags/${name}
19039
+ return fs16.existsSync(path23.join(common, "refs/tags", name)) || fs16.readFileSync(path23.join(common, "packed-refs"), "utf8").includes(` refs/tags/${name}
18996
19040
  `);
18997
19041
  } catch {
18998
19042
  return false;
@@ -19012,7 +19056,7 @@ var analysisDenial = (error) => ({
19012
19056
  });
19013
19057
  var NEXT_COMMAND = "next";
19014
19058
  var MARKER_TTL_SECONDS = 3600;
19015
- var markerFile = (repo, session, key) => path22.join(repo.location.dir, "hooks", `commit-${createHash15("sha256").update(`${session}\x00${key}`).digest("hex").slice(0, 32)}.json`);
19059
+ var markerFile = (repo, session, key) => path23.join(repo.location.dir, "hooks", `commit-${createHash15("sha256").update(`${session}\x00${key}`).digest("hex").slice(0, 32)}.json`);
19016
19060
  var callKey = (toolUseId, command) => toolUseId ?? `cmd:${createHash15("sha256").update(command).digest("hex")}`;
19017
19061
  function noteRawCommit(input, command, key) {
19018
19062
  try {
@@ -19023,7 +19067,7 @@ function noteRawCommit(input, command, key) {
19023
19067
  if (action.kind !== "commit")
19024
19068
  continue;
19025
19069
  const file = markerFile(repo, input.session.id, key);
19026
- fs16.mkdirSync(path22.dirname(file), { recursive: true });
19070
+ fs16.mkdirSync(path23.dirname(file), { recursive: true });
19027
19071
  fs16.writeFileSync(file, `${JSON.stringify({ head: headSha2(repo), at })}
19028
19072
  `);
19029
19073
  }
@@ -19264,8 +19308,8 @@ var judgedDir = (root, dir) => {
19264
19308
  return null;
19265
19309
  if (dir === null)
19266
19310
  return root;
19267
- const resolved = path23.resolve(root, dir);
19268
- return existsSync8(resolved) && inWorkitWorkspace(resolved) ? resolved : null;
19311
+ const resolved = path24.resolve(root, dir);
19312
+ return existsSync9(resolved) && inWorkitWorkspace(resolved) ? resolved : null;
19269
19313
  };
19270
19314
  var shellBranchPolicyViolation = (root, command, dialect = "posix") => {
19271
19315
  let judged = false;
@@ -19385,8 +19429,8 @@ var userOnlyWorkitCall = (command, dialect = "posix") => {
19385
19429
  };
19386
19430
  // packages/workit-core/src/core/heavy-rules.ts
19387
19431
  import fs17 from "node:fs";
19388
- import os6 from "node:os";
19389
- import path24 from "node:path";
19432
+ import os7 from "node:os";
19433
+ import path25 from "node:path";
19390
19434
  var EMPTY2 = () => ({ deny: [], allow: [] });
19391
19435
  var readText3 = (file) => {
19392
19436
  try {
@@ -19427,23 +19471,23 @@ function parseJsonc(text) {
19427
19471
  return JSON.parse(out.replace(/,(\s*[}\]])/gu, "$1"));
19428
19472
  }
19429
19473
  function gitTop(cwd) {
19430
- for (let dir = path24.resolve(cwd);; dir = path24.dirname(dir)) {
19431
- if (fs17.existsSync(path24.join(dir, ".git")))
19474
+ for (let dir = path25.resolve(cwd);; dir = path25.dirname(dir)) {
19475
+ if (fs17.existsSync(path25.join(dir, ".git")))
19432
19476
  return dir;
19433
- if (path24.dirname(dir) === dir)
19477
+ if (path25.dirname(dir) === dir)
19434
19478
  return null;
19435
19479
  }
19436
19480
  }
19437
19481
  var projectDirs = (cwd) => {
19438
19482
  const top = gitTop(cwd);
19439
19483
  const dirs = [];
19440
- for (let dir = path24.resolve(cwd);; dir = path24.dirname(dir)) {
19484
+ for (let dir = path25.resolve(cwd);; dir = path25.dirname(dir)) {
19441
19485
  dirs.push(dir);
19442
- if (!top || dir === top || path24.dirname(dir) === dir)
19486
+ if (!top || dir === top || path25.dirname(dir) === dir)
19443
19487
  return dirs;
19444
19488
  }
19445
19489
  };
19446
- var homeOf = (env) => env.HOME || os6.homedir();
19490
+ var homeOf = (env) => env.HOME || os7.homedir();
19447
19491
  var CLAUDE_MANAGED = {
19448
19492
  linux: "/etc/claude-code/managed-settings.json",
19449
19493
  darwin: "/Library/Application Support/ClaudeCode/managed-settings.json",
@@ -19451,12 +19495,12 @@ var CLAUDE_MANAGED = {
19451
19495
  };
19452
19496
  function claudeSettingsFiles(cwd, env, platform = process.platform) {
19453
19497
  const project = env.CLAUDE_PROJECT_DIR || gitTop(cwd) || cwd;
19454
- const user = env.CLAUDE_CONFIG_DIR || path24.join(homeOf(env), ".claude");
19498
+ const user = env.CLAUDE_CONFIG_DIR || path25.join(homeOf(env), ".claude");
19455
19499
  return [
19456
19500
  ...CLAUDE_MANAGED[platform] ? [CLAUDE_MANAGED[platform]] : [],
19457
- path24.join(user, "settings.json"),
19458
- path24.join(project, ".claude", "settings.json"),
19459
- path24.join(project, ".claude", "settings.local.json")
19501
+ path25.join(user, "settings.json"),
19502
+ path25.join(project, ".claude", "settings.json"),
19503
+ path25.join(project, ".claude", "settings.local.json")
19460
19504
  ];
19461
19505
  }
19462
19506
  var bashPattern = (entry) => {
@@ -19546,10 +19590,10 @@ var opencodeConfig = (value, rules) => {
19546
19590
  function opencodeRules(cwd, env = process.env) {
19547
19591
  const rules = EMPTY2();
19548
19592
  try {
19549
- const config = env.XDG_CONFIG_HOME || path24.join(homeOf(env), ".config");
19593
+ const config = env.XDG_CONFIG_HOME || path25.join(homeOf(env), ".config");
19550
19594
  const files = [
19551
- ...OPENCODE_NAMES.map((name) => path24.join(config, "opencode", name)),
19552
- ...projectDirs(cwd).flatMap((dir) => OPENCODE_NAMES.flatMap((name) => [path24.join(dir, name), path24.join(dir, ".opencode", name)])),
19595
+ ...OPENCODE_NAMES.map((name) => path25.join(config, "opencode", name)),
19596
+ ...projectDirs(cwd).flatMap((dir) => OPENCODE_NAMES.flatMap((name) => [path25.join(dir, name), path25.join(dir, ".opencode", name)])),
19553
19597
  ...env.OPENCODE_CONFIG ? [env.OPENCODE_CONFIG] : []
19554
19598
  ];
19555
19599
  for (const file of files) {
@@ -19593,9 +19637,9 @@ var codexRule = (body) => {
19593
19637
  function codexRules(cwd, env = process.env) {
19594
19638
  const rules = EMPTY2();
19595
19639
  try {
19596
- const home = env.CODEX_HOME || path24.join(homeOf(env), ".codex");
19640
+ const home = env.CODEX_HOME || path25.join(homeOf(env), ".codex");
19597
19641
  const top = gitTop(cwd) ?? cwd;
19598
- for (const dir of [path24.join(home, "rules"), path24.join(top, ".codex", "rules")]) {
19642
+ for (const dir of [path25.join(home, "rules"), path25.join(top, ".codex", "rules")]) {
19599
19643
  let files;
19600
19644
  try {
19601
19645
  files = fs17.readdirSync(dir).filter((name) => name.endsWith(".rules"));
@@ -19605,7 +19649,7 @@ function codexRules(cwd, env = process.env) {
19605
19649
  return "unreadable";
19606
19650
  }
19607
19651
  for (const name of files) {
19608
- const text = readText3(path24.join(dir, name)) ?? "";
19652
+ const text = readText3(path25.join(dir, name)) ?? "";
19609
19653
  for (const part of text.split(/\bprefix_rule\s*\(/u).slice(1)) {
19610
19654
  const rule = codexRule(part);
19611
19655
  if (!rule)
@@ -19624,8 +19668,8 @@ function cursorRules(cwd, env = process.env) {
19624
19668
  try {
19625
19669
  const top = gitTop(cwd) ?? cwd;
19626
19670
  for (const file of [
19627
- path24.join(homeOf(env), ".cursor", "cli-config.json"),
19628
- path24.join(top, ".cursor", "cli.json")
19671
+ path25.join(homeOf(env), ".cursor", "cli-config.json"),
19672
+ path25.join(top, ".cursor", "cli.json")
19629
19673
  ]) {
19630
19674
  const text = readText3(file);
19631
19675
  if (text === null)
@@ -19700,10 +19744,10 @@ function wrapAllowed(read, words, command, options = {}) {
19700
19744
 
19701
19745
  // packages/workit-core/src/core/heavy.ts
19702
19746
  import fs18 from "node:fs";
19703
- import path25 from "node:path";
19747
+ import path26 from "node:path";
19704
19748
  var stateDir = (env, platform = process.platform) => stateDir3(env, platform);
19705
19749
  var HEAVY_COMMANDS_FILE = "heavy-commands.json";
19706
- var heavyCommandsFile = (env) => path25.join(stateDir(env), HEAVY_COMMANDS_FILE);
19750
+ var heavyCommandsFile = (env) => path26.join(stateDir(env), HEAVY_COMMANDS_FILE);
19707
19751
  var HEAVY_SCRIPT = /^(?:test|tests|t|tst|unit|integration|e2e|coverage|cov|lint|eslint|typecheck|type-check|types|tsc|check|verify|validate|build|compile|bundle|ci|sonar|cypress|playwright|jest|vitest|mocha|bench|benchmark|all)(?:$|[:_.-])/iu;
19708
19752
  var INFO_FLAGS = new Set(["--version", "-v", "-V", "--help", "-h", "help", "version"]);
19709
19753
  var WATCH_FLAG = /^(?:--watch(?:All)?(?:=.*)?|-w|--serve)$/u;
@@ -19978,7 +20022,7 @@ function machinePatterns(env) {
19978
20022
  return isRecord4(value) ? stringList(value.patterns) : [];
19979
20023
  }
19980
20024
  function repoPatterns(cwd) {
19981
- return repoHeavyCommands(gitTop(cwd) ?? path25.resolve(cwd));
20025
+ return repoHeavyCommands(gitTop(cwd) ?? path26.resolve(cwd));
19982
20026
  }
19983
20027
  function heavyLines(lines, options) {
19984
20028
  const found = [];
@@ -20056,12 +20100,12 @@ function heavyPlan(command, options) {
20056
20100
  }
20057
20101
  function workitOnPath(env = process.env) {
20058
20102
  const names = process.platform === "win32" ? ["workit.exe", "workit.cmd", "workit"] : ["workit"];
20059
- for (const dir of (env.PATH ?? "").split(path25.delimiter))
20103
+ for (const dir of (env.PATH ?? "").split(path26.delimiter))
20060
20104
  for (const name of names) {
20061
20105
  if (!dir)
20062
20106
  continue;
20063
20107
  try {
20064
- fs18.accessSync(path25.join(dir, name), fs18.constants.X_OK);
20108
+ fs18.accessSync(path26.join(dir, name), fs18.constants.X_OK);
20065
20109
  return true;
20066
20110
  } catch {}
20067
20111
  }
@@ -20125,16 +20169,16 @@ var splitDenial = (plan) => ({
20125
20169
  unblock: plan.unblock
20126
20170
  });
20127
20171
  // packages/workit-core/src/hooks/write-gate.ts
20128
- import { existsSync as existsSync9, realpathSync as realpathSync6, statSync as statSync3 } from "node:fs";
20129
- import os8 from "node:os";
20130
- import path27 from "node:path";
20172
+ import { existsSync as existsSync10, realpathSync as realpathSync7, statSync as statSync3 } from "node:fs";
20173
+ import os9 from "node:os";
20174
+ import path28 from "node:path";
20131
20175
 
20132
20176
  // packages/workit-core/src/core/live-session.ts
20133
20177
  import { spawnSync as spawnSync14 } from "node:child_process";
20134
20178
  import { createHash as createHash16 } from "node:crypto";
20135
20179
  import fs19 from "node:fs";
20136
- import os7 from "node:os";
20137
- import path26 from "node:path";
20180
+ import os8 from "node:os";
20181
+ import path27 from "node:path";
20138
20182
  var LIVE_SESSION_TTL_MS = 15 * 60000;
20139
20183
  var HEARTBEAT_EVERY_MS = 30000;
20140
20184
  var liveProbe = {
@@ -20208,15 +20252,15 @@ var liveOwner = (input, transport, env = process.env) => {
20208
20252
  };
20209
20253
  };
20210
20254
  var checkoutOf = (target) => {
20211
- let dir = path26.resolve(target);
20212
- while (!fs19.existsSync(dir) && path26.dirname(dir) !== dir)
20213
- dir = path26.dirname(dir);
20255
+ let dir = path27.resolve(target);
20256
+ while (!fs19.existsSync(dir) && path27.dirname(dir) !== dir)
20257
+ dir = path27.dirname(dir);
20214
20258
  if (fs19.existsSync(dir) && !fs19.statSync(dir).isDirectory())
20215
- dir = path26.dirname(dir);
20216
- const parts = dir.split(path26.sep);
20259
+ dir = path27.dirname(dir);
20260
+ const parts = dir.split(path27.sep);
20217
20261
  const dotGit = parts.lastIndexOf(".git");
20218
20262
  if (dotGit > 0)
20219
- dir = parts.slice(0, dotGit).join(path26.sep) || path26.sep;
20263
+ dir = parts.slice(0, dotGit).join(path27.sep) || path27.sep;
20220
20264
  const location = resolveStore(dir);
20221
20265
  if (location instanceof Error || !location.shared || !location.top)
20222
20266
  return null;
@@ -20226,9 +20270,9 @@ var checkoutOf = (target) => {
20226
20270
  } catch {}
20227
20271
  return top;
20228
20272
  };
20229
- var markerFile2 = (top) => path26.join(resolveStateDir(), "live-sessions", `${createHash16("sha256").update(checkoutKey(top)).digest("hex").slice(0, 32)}.json`);
20273
+ var markerFile2 = (top) => path27.join(resolveStateDir(), "live-sessions", `${createHash16("sha256").update(checkoutKey(top)).digest("hex").slice(0, 32)}.json`);
20230
20274
  var checkoutKey = (top, platform = process.platform) => {
20231
- let key = path26.resolve(top);
20275
+ let key = path27.resolve(top);
20232
20276
  try {
20233
20277
  key = fs19.realpathSync.native(key);
20234
20278
  } catch {}
@@ -20259,7 +20303,7 @@ var isLive = (marker, deps) => {
20259
20303
  const age = ageOf2(marker, deps.now ?? new Date);
20260
20304
  if (age > (deps.ttlMs ?? LIVE_SESSION_TTL_MS))
20261
20305
  return false;
20262
- if (marker.machine !== (deps.machine ?? os7.hostname()) || marker.pid === null)
20306
+ if (marker.machine !== (deps.machine ?? os8.hostname()) || marker.pid === null)
20263
20307
  return true;
20264
20308
  if (!(deps.alive ?? processAlive)(marker.pid))
20265
20309
  return false;
@@ -20288,7 +20332,7 @@ var liveConflict = (target, owner, deps = {}) => {
20288
20332
  const marker = readMarker(file);
20289
20333
  if (!marker || sameLead(marker, owner) || !isLive(marker, deps))
20290
20334
  return null;
20291
- if (sameOwner(marker, owner, deps.machine ?? os7.hostname()))
20335
+ if (sameOwner(marker, owner, deps.machine ?? os8.hostname()))
20292
20336
  return null;
20293
20337
  return { marker, file, ageMs: ageOf2(marker, deps.now ?? new Date), checkout };
20294
20338
  } catch {
@@ -20302,7 +20346,7 @@ var claimLiveSession = (target, owner, deps = {}) => {
20302
20346
  return;
20303
20347
  const file = markerFile2(checkout);
20304
20348
  const now = deps.now ?? new Date;
20305
- const machine = deps.machine ?? os7.hostname();
20349
+ const machine = deps.machine ?? os8.hostname();
20306
20350
  const current = readMarker(file);
20307
20351
  if (current) {
20308
20352
  const age = ageOf2(current, now);
@@ -20323,7 +20367,7 @@ var claimLiveSession = (target, owner, deps = {}) => {
20323
20367
  checkout,
20324
20368
  heartbeatAt: now.toISOString()
20325
20369
  };
20326
- fs19.mkdirSync(path26.dirname(file), { recursive: true });
20370
+ fs19.mkdirSync(path27.dirname(file), { recursive: true });
20327
20371
  const temp = `${file}.${process.pid}.tmp`;
20328
20372
  fs19.writeFileSync(temp, JSON.stringify(marker));
20329
20373
  fs19.renameSync(temp, file);
@@ -20335,22 +20379,22 @@ var NONE3 = { kind: "none" };
20335
20379
  var CASE_INSENSITIVE = process.platform === "darwin" || process.platform === "win32";
20336
20380
  var canonical3 = (file) => {
20337
20381
  let rest = "";
20338
- for (let dir = path27.resolve(file);; dir = path27.dirname(dir)) {
20382
+ for (let dir = path28.resolve(file);; dir = path28.dirname(dir)) {
20339
20383
  try {
20340
- return path27.join(realpathSync6.native(dir), rest);
20384
+ return path28.join(realpathSync7.native(dir), rest);
20341
20385
  } catch {
20342
- if (path27.dirname(dir) === dir)
20343
- return path27.resolve(file);
20344
- rest = rest ? path27.join(path27.basename(dir), rest) : path27.basename(dir);
20386
+ if (path28.dirname(dir) === dir)
20387
+ return path28.resolve(file);
20388
+ rest = rest ? path28.join(path28.basename(dir), rest) : path28.basename(dir);
20345
20389
  }
20346
20390
  }
20347
20391
  };
20348
20392
  var exempt = (cwd, root, file, plans) => {
20349
20393
  const fold = (value) => CASE_INSENSITIVE ? value.toLowerCase() : value;
20350
- const relative = path27.relative(fold(canonical3(root)), fold(canonical3(path27.resolve(cwd, file))));
20351
- if (relative.startsWith("..") || path27.isAbsolute(relative))
20394
+ const relative = path28.relative(fold(canonical3(root)), fold(canonical3(path28.resolve(cwd, file))));
20395
+ if (relative.startsWith("..") || path28.isAbsolute(relative))
20352
20396
  return true;
20353
- const posix = relative.split(path27.sep).join("/");
20397
+ const posix = relative.split(path28.sep).join("/");
20354
20398
  const segments = posix.split("/");
20355
20399
  return /\.mdx?$/i.test(posix) || segments[0] === "docs" || segments.includes("plans") || [...plans].some((plan) => fold(plan) === posix);
20356
20400
  };
@@ -20701,10 +20745,10 @@ var linkSources = (args, at) => {
20701
20745
  const sources = names.filter((name, index) => into >= 0 ? name !== dest : index < names.length - 1 || names.length === 1);
20702
20746
  const target = dest === undefined ? null : at(dest);
20703
20747
  const symbolic = args.some((arg) => /^-[a-zA-Z]*s|^--symbolic$/.test(arg));
20704
- const base = target === null ? null : into >= 0 || sources.length > 1 || existsSync9(target) || /[\\/]$/.test(dest ?? "") ? target : path27.dirname(target);
20748
+ const base = target === null ? null : into >= 0 || sources.length > 1 || existsSync10(target) || /[\\/]$/.test(dest ?? "") ? target : path28.dirname(target);
20705
20749
  return sources.flatMap((source) => {
20706
- if (symbolic && base !== null && !path27.isAbsolute(homeExpanded(source)))
20707
- return [path27.resolve(base, source)];
20750
+ if (symbolic && base !== null && !path28.isAbsolute(homeExpanded(source)))
20751
+ return [path28.resolve(base, source)];
20708
20752
  const resolved = at(source);
20709
20753
  return resolved ? [resolved] : [];
20710
20754
  });
@@ -20733,7 +20777,7 @@ var shellWrites = (command, depth = 0) => {
20733
20777
  return { writes: true, targets: unknown ? null : targets };
20734
20778
  };
20735
20779
  var cache2 = new Map;
20736
- var planKeyOf = (root, plans) => [...plans].map((file) => fileSignature(path27.resolve(root, file)) ?? "-").join("\x00");
20780
+ var planKeyOf = (root, plans) => [...plans].map((file) => fileSignature(path28.resolve(root, file)) ?? "-").join("\x00");
20737
20781
  var gateFor = (cwd) => {
20738
20782
  const store = new TaskStore(cwd);
20739
20783
  const listed = store.listTaskIndex();
@@ -20813,13 +20857,13 @@ var gitMutationDirs = (cwd, command, dialect) => {
20813
20857
  return [];
20814
20858
  if (sub === "stash" && ["list", "show"].includes(rest[0] ?? ""))
20815
20859
  return [];
20816
- return [path27.resolve(cwd, invocation.dir ?? ".")];
20860
+ return [path28.resolve(cwd, invocation.dir ?? ".")];
20817
20861
  });
20818
20862
  };
20819
20863
  var CD2 = new Set(["cd", "chdir", "set-location", "sl"]);
20820
20864
  var PUSHD2 = new Set(["pushd", "push-location"]);
20821
20865
  var POPD2 = new Set(["popd", "pop-location"]);
20822
- var UNKNOWN_DIR = path27.resolve(path27.parse(process.cwd()).root, ".workit-unknown-dir");
20866
+ var UNKNOWN_DIR = path28.resolve(path28.parse(process.cwd()).root, ".workit-unknown-dir");
20823
20867
  var cdInto = (dir, words, strict = false, vars = new Map) => {
20824
20868
  const lost = strict ? UNKNOWN_DIR : undefined;
20825
20869
  const found = words.slice(1).find((word) => !word.startsWith("-") || word === "-");
@@ -20829,7 +20873,7 @@ var cdInto = (dir, words, strict = false, vars = new Map) => {
20829
20873
  return lost;
20830
20874
  if (dir === undefined)
20831
20875
  return lost;
20832
- return target === undefined ? os8.homedir() : path27.resolve(dir, target);
20876
+ return target === undefined ? os9.homedir() : path28.resolve(dir, target);
20833
20877
  };
20834
20878
  var quoteWord2 = (word) => /^[\w@%+=:,./-]+$/.test(word) ? word : `'${word.replaceAll("'", "'\\''")}'`;
20835
20879
  var expandVars = (text, vars) => vars.size === 0 || !text.includes("$") ? text : text.replace(/\$(?:(\w+)|\{(\w+)\})/g, (whole, bare, braced) => {
@@ -20963,7 +21007,7 @@ var untrustedVars = (segments) => {
20963
21007
  }
20964
21008
  return { all, names };
20965
21009
  };
20966
- var UNKNOWN_VAR = path27.resolve(path27.parse(process.cwd()).root, ".workit-unknown-var");
21010
+ var UNKNOWN_VAR = path28.resolve(path28.parse(process.cwd()).root, ".workit-unknown-var");
20967
21011
  var REFERENCE = /\$\{(\w+)[^}]*\}|\$(\w+)|\$\([^)]*\)?|`[^`]*`?/g;
20968
21012
  var unresolvedRefs = (text) => [
20969
21013
  ...new Set([...text.matchAll(REFERENCE)].map((match) => {
@@ -20973,7 +21017,7 @@ var unresolvedRefs = (text) => [
20973
21017
  ];
20974
21018
  var unknownVarTarget = (text) => {
20975
21019
  const refs = unresolvedRefs(text);
20976
- return path27.join(UNKNOWN_VAR, (refs.length > 0 ? refs : [text]).map(encodeURIComponent).join("+"));
21020
+ return path28.join(UNKNOWN_VAR, (refs.length > 0 ? refs : [text]).map(encodeURIComponent).join("+"));
20977
21021
  };
20978
21022
  var applyOperator = (value, operator) => {
20979
21023
  if (operator === "")
@@ -21031,18 +21075,18 @@ var mktempPath = (value, dir) => {
21031
21075
  template = arg;
21032
21076
  }
21033
21077
  if (base === null && (temp || template === undefined))
21034
- base = os8.tmpdir();
21078
+ base = os9.tmpdir();
21035
21079
  const name = homeExpanded(template ?? "tmp.XXXXXXXXXX");
21036
- if (path27.isAbsolute(name))
21080
+ if (path28.isAbsolute(name))
21037
21081
  return name;
21038
21082
  const from = base === null ? dir : homeExpanded(base);
21039
- if (from === undefined || !path27.isAbsolute(from) && dir === undefined)
21083
+ if (from === undefined || !path28.isAbsolute(from) && dir === undefined)
21040
21084
  return null;
21041
- return path27.resolve(dir ?? from, from, name);
21085
+ return path28.resolve(dir ?? from, from, name);
21042
21086
  };
21043
21087
  var homeExpanded = (file) => {
21044
21088
  const match = /^(?:~|\$HOME|\$\{HOME\})(?=\/|$)/.exec(file);
21045
- return match ? (process.env.HOME || os8.homedir()) + file.slice(match[0].length) : file;
21089
+ return match ? (process.env.HOME || os9.homedir()) + file.slice(match[0].length) : file;
21046
21090
  };
21047
21091
  var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherited = new Map) => {
21048
21092
  const targets = [];
@@ -21058,9 +21102,9 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
21058
21102
  const home = homeExpanded(text);
21059
21103
  if (strict && unresolvedRefs(home).length > 0)
21060
21104
  return [unknownVarTarget(home)];
21061
- if (path27.isAbsolute(home))
21105
+ if (path28.isAbsolute(home))
21062
21106
  return [home];
21063
- return base === undefined ? [] : [path27.resolve(base, home)];
21107
+ return base === undefined ? [] : [path28.resolve(base, home)];
21064
21108
  });
21065
21109
  const at = (file) => {
21066
21110
  const all = atAll(file);
@@ -21202,7 +21246,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
21202
21246
  const here = segment.unanalyzable ? DIR_TARGET : `${OPAQUE_TARGET}${encodeURIComponent(runner?.split(/[\\/]/).at(-1) ?? "a command")}`;
21203
21247
  for (const file of opaque ?? [])
21204
21248
  for (const resolved of atAll(file))
21205
- targets.push(file === "." ? path27.join(resolved, here) : resolved);
21249
+ targets.push(file === "." ? path28.join(resolved, here) : resolved);
21206
21250
  const ln = words.findIndex((word) => /^ln$/i.test(word.split(/[\\/]/).at(-1) ?? ""));
21207
21251
  if (ln >= 0 && words.slice(0, ln).every((word) => PREFIXES2.has(word)))
21208
21252
  targets.push(...linkSources(words.slice(ln + 1), at));
@@ -21213,7 +21257,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
21213
21257
  const edits = editsOf(body);
21214
21258
  if (edits === null) {
21215
21259
  if (dir !== undefined)
21216
- targets.push(path27.join(dir, DIR_TARGET));
21260
+ targets.push(path28.join(dir, DIR_TARGET));
21217
21261
  } else
21218
21262
  for (const file of edits)
21219
21263
  targets.push(...atAll(file));
@@ -21221,7 +21265,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
21221
21265
  for (const invocation of workitInvocations(body.map(quoteWord2).join(" "), "posix")) {
21222
21266
  const { at: runsIn, args } = workitCwd(dir, invocation, atAll);
21223
21267
  if (args[0] === "git" && MUTATING_WORKIT_GIT.has(args[1] ?? "") && !inert(args.slice(2), ""))
21224
- targets.push(...runsIn.map((runs) => path27.join(runs, DIR_TARGET)));
21268
+ targets.push(...runsIn.map((runs) => path28.join(runs, DIR_TARGET)));
21225
21269
  }
21226
21270
  }
21227
21271
  return targets;
@@ -21242,7 +21286,7 @@ var shellMutationTargets = (cwd, command, dialect = "posix", strict = false) =>
21242
21286
  try {
21243
21287
  return [
21244
21288
  ...segmentTargets(cwd, command, dialect, 0, strict),
21245
- ...gitMutationDirs(cwd, command, dialect).map((dir) => path27.join(dir, DIR_TARGET))
21289
+ ...gitMutationDirs(cwd, command, dialect).map((dir) => path28.join(dir, DIR_TARGET))
21246
21290
  ];
21247
21291
  } catch {
21248
21292
  return [];
@@ -21279,7 +21323,7 @@ var liveDeny = ({ marker, checkout, ageMs, file }) => {
21279
21323
  var guarded = (targets) => {
21280
21324
  const seen = new Set;
21281
21325
  return targets.filter((target) => {
21282
- const dir = path27.dirname(target);
21326
+ const dir = path28.dirname(target);
21283
21327
  if (seen.has(dir))
21284
21328
  return false;
21285
21329
  seen.add(dir);
@@ -21300,7 +21344,7 @@ var claimAll = (owner, targets, deps) => {
21300
21344
  for (const target of guarded(targets))
21301
21345
  claimLiveSession(target, owner, deps);
21302
21346
  };
21303
- var liveTargets = (cwd, paths) => paths?.length ? paths.map((file) => path27.resolve(cwd, file)) : [path27.join(cwd, DIR_TARGET)];
21347
+ var liveTargets = (cwd, paths) => paths?.length ? paths.map((file) => path28.resolve(cwd, file)) : [path28.join(cwd, DIR_TARGET)];
21304
21348
  var issuedTarget = (cwd, targets) => {
21305
21349
  const state = resolveStateDir();
21306
21350
  const found = targets.find((target) => underIssued(state, cwd, homeExpanded(target), process.platform, canonical3));
@@ -21308,7 +21352,7 @@ var issuedTarget = (cwd, targets) => {
21308
21352
  };
21309
21353
  var underIssued = (state, cwd, target, platform = process.platform, real = (file) => file) => {
21310
21354
  const win = platform === "win32";
21311
- const p = win ? path27.win32 : path27.posix;
21355
+ const p = win ? path28.win32 : path28.posix;
21312
21356
  const fold = (value) => win || platform === "darwin" ? value.toLowerCase() : value;
21313
21357
  const named = win ? target.replace(/^\/([a-zA-Z])(?=\/|$)/, "$1:") : target;
21314
21358
  const relative = p.relative(fold(real(p.resolve(state))), fold(real(p.resolve(cwd, named))));
@@ -21402,10 +21446,10 @@ import { spawnSync as spawnSync15 } from "node:child_process";
21402
21446
 
21403
21447
  // packages/workit-core/src/ci-waiter.ts
21404
21448
  import fs20 from "node:fs";
21405
- import path28 from "node:path";
21449
+ import path29 from "node:path";
21406
21450
  var waiterFile = (cwd, pr) => {
21407
21451
  const common = gitCommonDir(cwd);
21408
- return common ? path28.join(common, "workit", "ci-waits", `pr-${pr}.json`) : null;
21452
+ return common ? path29.join(common, "workit", "ci-waits", `pr-${pr}.json`) : null;
21409
21453
  };
21410
21454
  var pidAlive2 = (pid) => {
21411
21455
  if (!Number.isSafeInteger(pid) || pid <= 0)
@@ -21744,40 +21788,37 @@ var SKILL_HOST = {
21744
21788
  };
21745
21789
  var PROMPT_INTENTS = [
21746
21790
  [
21747
- "workit-debug",
21748
- /\b(flaky|regressed|(?:is|introduced) a regression|regression (?:in|after|since|from)|(?:is|are|got|looks) broken|debug (?:this|it|the|why)|fix (?:the|this|a) bug)\b/i
21791
+ "debug",
21792
+ /\b(flaky|regressed|(is|introduced) a regression|regression (in|after|since|from)|(is|are|got|looks) broken|debug (this|it|the|why)|fix (the|this|a) bug)\b/i
21749
21793
  ],
21750
21794
  [
21751
- "workit-continue",
21752
- /\b(pick up where|where (?:were|did) we|resume (?:the|this|my|our|work|where)|hand ?off)\b/i
21795
+ "continue",
21796
+ /\b(pick up where|where (were|did) we|resume (the|this|my|our|work|where)|hand ?off)\b/i
21753
21797
  ],
21754
21798
  [
21755
- "workit-review",
21756
- /\b(blast radius|code review|review (?:the|this|my|PR|pr|#\d+|branch|diff|changes))\b/i
21799
+ "review",
21800
+ /\b(blast radius|code review|review (the|this|my|PR|pr|#\d+|branch|diff|changes))\b/i
21757
21801
  ],
21758
21802
  [
21759
- "workit-ship",
21760
- /\b(ship (?:it|this|the)|babysit|open (?:a|the) (?:PR|pr|MR|mr)(?=\s*$|\s+(?:for|to|on|with|and|against|into|from|after|once)\b|[.!,;])|merge (?:the|this|my) (?:PR|pr|MR|mr|branch)|(?:get|until|make) CI (?:is )?green)\b/i
21803
+ "ship",
21804
+ /\b(ship (it|this|the)|babysit|open (a|the) (PR|pr|MR|mr)(?=\s*$|\s+(for|to|on|with|and|against|into|from|after|once)\b|[.!,;])|merge (the|this|my) (PR|pr|MR|mr|branch)|(get|until|make) CI (is )?green)\b/i
21761
21805
  ],
21762
- ["workit-bdd", /\b(BDD|TDD|acceptance criteria|Given\/When\/Then)(?![\w/])/],
21763
- ["workit-test-audit", /\b(test audit|audit the tests|tautolog\w*|weak tests)\b/i],
21764
- ["workit-deslop", /\b(deslop|slop|dead code)\b/i],
21806
+ ["bdd", /\b(BDD|TDD|acceptance criteria|Given\/When\/Then)(?![\w/])/],
21807
+ ["test-audit", /\b(test audit|audit the tests|tautolog\w*|weak tests)\b/i],
21808
+ ["deslop", /\b(deslop|slop|dead code)\b/i],
21809
+ ["fanout", /\b(fan( |-)?out|parallelize|parallel agents|agent swarm|swarm of agents)\b/i],
21810
+ ["verify-app", /\b(verify the app|smoke test|prove it works)\b/i],
21811
+ ["retro", /\b((a|the) retro(?![-\w]|\.\w)|retrospective)/i],
21812
+ ["architecture", /\b(deepen (the )?modules|architecture (review|pass|audit))\b/i],
21765
21813
  [
21766
- "workit-fanout",
21767
- /\b(fan(?: |-)?out|parallelize|parallel agents|agent swarm|swarm of agents)\b/i
21814
+ "shape",
21815
+ /\b(brainstorm\w*|grill me|should we|let'?s plan|plan (out|how|the|a|for)|(write|draft) (a|the) spec)\b/i
21768
21816
  ],
21769
- ["workit-verify-app", /\b(verify the app|smoke test|prove it works)\b/i],
21770
- ["workit-retro", /\b((?:a|the) retro(?![-\w]|\.\w)|retrospective)/i],
21771
- ["workit-architecture", /\b(deepen (?:the )?modules|architecture (?:review|pass|audit))\b/i],
21772
21817
  [
21773
- "workit-shape",
21774
- /\b(brainstorm\w*|grill me|should we|let'?s plan|plan (?:out|how|the|a|for)|(?:write|draft) (?:a|the) spec)\b/i
21775
- ],
21776
- [
21777
- "workit-implement",
21778
- /\b(implement (?:the|this|a|it)|add (?:a|the) feature|build (?:a|an|the) (?:new )?(?:feature|command|verb|page|endpoint|component|cli|tool))\b/i
21818
+ "implement",
21819
+ /\b(implement (the|this|a|it)|add (a|the) feature|build (a|an|the) (new )?(feature|command|verb|page|endpoint|component|cli|tool))\b/i
21779
21820
  ]
21780
- ];
21821
+ ].map(([name, pattern]) => [`workit-${name}`, pattern]);
21781
21822
  var workitSkillOf = (name) => {
21782
21823
  const bare = name.trim().replace(/^\//, "").toLowerCase();
21783
21824
  const alias = WORKIT_SKILL_ALIASES[bare];
@@ -21786,10 +21827,13 @@ var workitSkillOf = (name) => {
21786
21827
  const skill = bare.replace(/^workit:/, "workit-");
21787
21828
  return WORKIT_METHOD_SKILLS.includes(skill) ? skill : null;
21788
21829
  };
21830
+ var QUOTED = /```[\s\S]*?```|["`“][^"`”\n]*["`”]|\B'[^'\n]*'\B/g;
21831
+ var COMPLAINT = /\b(why \w+ you|you keep|stop \w+ing)\b.*?(?=\b(and|but)\b|[?.,;\n]|$)/gi;
21789
21832
  var promptTrigger = (prompt) => {
21790
- const text = prompt.replace(/```[\s\S]*?```/g, " ").slice(0, 4000);
21833
+ let asking = false;
21834
+ const text = prompt.slice(0, 4000).replace(QUOTED, " ").replace(COMPLAINT, (clause) => (asking ||= /ask|quest/i.test(clause), " "));
21791
21835
  for (const [skill, pattern] of PROMPT_INTENTS) {
21792
- const match = pattern.exec(text);
21836
+ const match = !(asking && skill === "workit-shape") && pattern.exec(text);
21793
21837
  if (match)
21794
21838
  return { skill, trigger: match[1] ?? match[0] };
21795
21839
  }
@@ -21807,24 +21851,12 @@ var loadedSkills = (cwd, session) => {
21807
21851
  };
21808
21852
  var SKILL_FILE = /(?:^|[\\/])(workit-[a-z-]+)[\\/]SKILL\.md$/;
21809
21853
  var skillFileIn = (file) => SKILL_FILE.exec(file)?.[1] ?? null;
21810
- var READERS = new Set([
21811
- "cat",
21812
- "sed",
21813
- "head",
21814
- "tail",
21815
- "less",
21816
- "more",
21817
- "bat",
21818
- "nl",
21819
- "get-content",
21820
- "gc",
21821
- "type"
21822
- ]);
21854
+ var READERS = new Set("cat sed head tail less more bat nl get-content gc type".split(" "));
21823
21855
  var skillReadIn = (command, dialect = "posix") => {
21824
21856
  for (const { words } of segmentsOf(command, dialect)) {
21825
21857
  if (!READERS.has((words[0]?.split(/[\\/]/).at(-1) ?? "").toLowerCase()))
21826
21858
  continue;
21827
- if (words.some((word) => /^(?:-i(?:\.\w+)?|--in-place(?:=.*)?)$/.test(word)))
21859
+ if (words.some((word) => /^(-i(\.\w+)?|--in-place(=.*)?)$/.test(word)))
21828
21860
  continue;
21829
21861
  for (const word of words.slice(1)) {
21830
21862
  const skill = skillFileIn(word);
@@ -21871,9 +21903,9 @@ var nudgeOnce = (input, session, skill, line) => {
21871
21903
  writeSessionMarker(file, { ...marker, nudged: [...marker.nudged, skill] });
21872
21904
  return line;
21873
21905
  };
21874
- var nudgeText = (input, skill, why) => USER_INVOKED.has(skill) ? `Workit: ${why} looks like ${skill} work, which the user starts; offer it (/${skill.replace(/^workit-/, "wk-")}) rather than loading it.` : `Workit: ${why} looks like ${skill} work; if it is, ${skillLoadWording(SKILL_HOST[input.host], skill)} first.`;
21906
+ var nudgeText = (input, skill, why) => `Workit: ${why} looks like ${skill} work${USER_INVOKED.has(skill) ? `, which the user starts; offer it (/${skill.replace(/^workit-/, "wk-")}) rather than loading it.` : `; if it is, ${skillLoadWording(SKILL_HOST[input.host], skill)} first.`}`;
21875
21907
  var promptLoads = (prompt) => /^\s*\/(?:skill:)?([\w:-]+)/.exec(prompt)?.[1] ?? /^\s*<skill name="([\w:-]+)"/.exec(prompt)?.[1] ?? /^\s*Load the (workit-[a-z-]+) skill with the skill tool\b/.exec(prompt)?.[1] ?? null;
21876
- var relayedMessage = (prompt) => /^\s*(?:Another Claude session sent a message\b|<agent-message\s+from=|\[SYSTEM NOTIFICATION\b|<task-notification>)/.test(prompt);
21908
+ var relayedMessage = (prompt) => /^\s*(Another Claude session sent a message\b|<agent-message\s+from=|\[SYSTEM NOTIFICATION\b|<task-notification>)/.test(prompt);
21877
21909
  function promptNudge(input, prompt) {
21878
21910
  try {
21879
21911
  const session = input.session.id;
@@ -21892,7 +21924,7 @@ function promptNudge(input, prompt) {
21892
21924
  return null;
21893
21925
  }
21894
21926
  }
21895
- var WORKIT_DELIVERY = /^(?:pr (?:create|merge)|ci wait|git push)\b/;
21927
+ var WORKIT_DELIVERY = /^(pr (create|merge)|ci wait|git push)\b/;
21896
21928
  var runsWorkitDelivery = (command, dialect) => workitInvocations(command, dialect).some((args) => !args.some((arg) => arg === "--help" || arg === "-h" || arg === "--dry-run") && WORKIT_DELIVERY.test(args.join(" ")));
21897
21929
  var isDeliveryCommand = (cwd, command, dialect = "posix") => rawDelivery(cwd, command, dialect) || runsWorkitDelivery(command, dialect) && inWorkitWorkspace(cwd);
21898
21930
  function shipNudge(input, command) {
@@ -21919,16 +21951,16 @@ ${line}` };
21919
21951
  return decision;
21920
21952
  };
21921
21953
  // packages/workit-core/src/hooks/hosts/fields.ts
21922
- import { existsSync as existsSync10, realpathSync as realpathSync7, statSync as statSync4 } from "node:fs";
21923
- import path29 from "node:path";
21954
+ import { existsSync as existsSync11, realpathSync as realpathSync8, statSync as statSync4 } from "node:fs";
21955
+ import path30 from "node:path";
21924
21956
  var isRecord5 = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
21925
21957
  var nonEmpty2 = (value) => typeof value === "string" && value.trim() !== "";
21926
21958
  var optionalText = (value) => typeof value === "string" ? value : null;
21927
21959
  var existingDirectory = (value) => {
21928
- if (!nonEmpty2(value) || !path29.isAbsolute(value) || !existsSync10(value))
21960
+ if (!nonEmpty2(value) || !path30.isAbsolute(value) || !existsSync11(value))
21929
21961
  return null;
21930
21962
  try {
21931
- return statSync4(value).isDirectory() ? realpathSync7(value) : null;
21963
+ return statSync4(value).isDirectory() ? realpathSync8(value) : null;
21932
21964
  } catch {
21933
21965
  return null;
21934
21966
  }
@@ -21993,7 +22025,7 @@ var writeTargets = (input) => {
21993
22025
  };
21994
22026
  // packages/workit-core/src/hooks/standing.ts
21995
22027
  import fs22 from "node:fs";
21996
- import path31 from "node:path";
22028
+ import path32 from "node:path";
21997
22029
 
21998
22030
  // packages/workit-core/src/hooks/hosts/claude-code.ts
21999
22031
  var CLAUDE_CODE_DESCRIPTOR = {
@@ -22628,40 +22660,40 @@ function neededChecks(lane, configured) {
22628
22660
  // packages/workit-core/src/hooks/worktree-confine.ts
22629
22661
  import { createHash as createHash17 } from "node:crypto";
22630
22662
  import fs21 from "node:fs";
22631
- import path30 from "node:path";
22663
+ import path31 from "node:path";
22632
22664
  var FANOUT_TOKEN_FILE = "workit-fanout-token";
22633
22665
  var NONE5 = { kind: "none" };
22634
22666
  var CASE_INSENSITIVE2 = process.platform === "darwin" || process.platform === "win32";
22635
22667
  var canonical4 = (file) => {
22636
22668
  let rest = "";
22637
- for (let dir = path30.resolve(file);; dir = path30.dirname(dir)) {
22669
+ for (let dir = path31.resolve(file);; dir = path31.dirname(dir)) {
22638
22670
  try {
22639
- return path30.join(fs21.realpathSync.native(dir), rest);
22671
+ return path31.join(fs21.realpathSync.native(dir), rest);
22640
22672
  } catch {
22641
- if (path30.dirname(dir) === dir)
22642
- return path30.resolve(file);
22643
- rest = rest ? path30.join(path30.basename(dir), rest) : path30.basename(dir);
22673
+ if (path31.dirname(dir) === dir)
22674
+ return path31.resolve(file);
22675
+ rest = rest ? path31.join(path31.basename(dir), rest) : path31.basename(dir);
22644
22676
  }
22645
22677
  }
22646
22678
  };
22647
22679
  var within = (child, parent) => {
22648
22680
  const fold = (value) => CASE_INSENSITIVE2 ? value.toLowerCase() : value;
22649
- const relative = path30.relative(fold(parent), fold(child));
22650
- return relative === "" || !relative.startsWith("..") && !path30.isAbsolute(relative);
22681
+ const relative = path31.relative(fold(parent), fold(child));
22682
+ return relative === "" || !relative.startsWith("..") && !path31.isAbsolute(relative);
22651
22683
  };
22652
22684
  var checkoutOf2 = (file) => {
22653
- for (let dir = canonical4(file);; dir = path30.dirname(dir)) {
22654
- const dotGit = path30.join(dir, ".git");
22685
+ for (let dir = canonical4(file);; dir = path31.dirname(dir)) {
22686
+ const dotGit = path31.join(dir, ".git");
22655
22687
  if (fs21.existsSync(dotGit)) {
22656
22688
  if (!fs21.statSync(dotGit).isFile())
22657
22689
  return { root: dir, workit: false };
22658
22690
  const admin = /^gitdir:\s*(.+)$/mu.exec(fs21.readFileSync(dotGit, "utf8"))?.[1]?.trim();
22659
22691
  return {
22660
22692
  root: dir,
22661
- workit: Boolean(admin) && fs21.existsSync(path30.join(path30.resolve(dir, admin), FANOUT_TOKEN_FILE))
22693
+ workit: Boolean(admin) && fs21.existsSync(path31.join(path31.resolve(dir, admin), FANOUT_TOKEN_FILE))
22662
22694
  };
22663
22695
  }
22664
- if (path30.dirname(dir) === dir)
22696
+ if (path31.dirname(dir) === dir)
22665
22697
  return null;
22666
22698
  }
22667
22699
  };
@@ -22673,8 +22705,8 @@ var workitWorktreeOf = (file) => {
22673
22705
  return null;
22674
22706
  }
22675
22707
  };
22676
- var bindingDir = () => path30.join(resolveStateDir(), "worktree-bind");
22677
- var bindingFile = (session, agentId) => path30.join(bindingDir(), `${createHash17("sha256").update(`${session}\x00${agentId}`).digest("hex").slice(0, 32)}.json`);
22708
+ var bindingDir = () => path31.join(resolveStateDir(), "worktree-bind");
22709
+ var bindingFile = (session, agentId) => path31.join(bindingDir(), `${createHash17("sha256").update(`${session}\x00${agentId}`).digest("hex").slice(0, 32)}.json`);
22678
22710
  var readBinding = (file) => {
22679
22711
  try {
22680
22712
  const value = JSON.parse(fs21.readFileSync(file, "utf8"));
@@ -22699,7 +22731,7 @@ var bind = (input, worktree) => {
22699
22731
  agentId,
22700
22732
  at: new Date().toISOString()
22701
22733
  };
22702
- fs21.mkdirSync(path30.dirname(file), { recursive: true });
22734
+ fs21.mkdirSync(path31.dirname(file), { recursive: true });
22703
22735
  fs21.writeFileSync(file, JSON.stringify(binding));
22704
22736
  try {
22705
22737
  if (inWorkitWorkspace(input.cwd))
@@ -22718,31 +22750,31 @@ var hostIsolated = (cwd, agentId) => {
22718
22750
  const checkout = checkoutOf2(cwd);
22719
22751
  if (!checkout)
22720
22752
  return false;
22721
- const dotGit = path30.join(checkout.root, ".git");
22753
+ const dotGit = path31.join(checkout.root, ".git");
22722
22754
  if (!fs21.statSync(dotGit).isFile())
22723
22755
  return false;
22724
22756
  const admin = /^gitdir:\s*(.+)$/mu.exec(fs21.readFileSync(dotGit, "utf8"))?.[1]?.trim();
22725
22757
  if (!admin)
22726
22758
  return false;
22727
- const adminDir = path30.resolve(checkout.root, admin);
22728
- const back = fs21.readFileSync(path30.join(adminDir, "gitdir"), "utf8").trim();
22729
- if (path30.relative(canonical4(path30.resolve(adminDir, back)), canonical4(dotGit)) !== "")
22759
+ const adminDir = path31.resolve(checkout.root, admin);
22760
+ const back = fs21.readFileSync(path31.join(adminDir, "gitdir"), "utf8").trim();
22761
+ if (path31.relative(canonical4(path31.resolve(adminDir, back)), canonical4(dotGit)) !== "")
22730
22762
  return false;
22731
- const common = path30.join(adminDir, "commondir");
22732
- const gitDir = fs21.existsSync(common) ? path30.resolve(adminDir, fs21.readFileSync(common, "utf8").trim()) : adminDir;
22733
- const expected = path30.join(path30.dirname(canonical4(gitDir)), ".claude", "worktrees", `agent-${agentId}`);
22734
- return path30.relative(canonical4(expected), checkout.root) === "";
22763
+ const common = path31.join(adminDir, "commondir");
22764
+ const gitDir = fs21.existsSync(common) ? path31.resolve(adminDir, fs21.readFileSync(common, "utf8").trim()) : adminDir;
22765
+ const expected = path31.join(path31.dirname(canonical4(gitDir)), ".claude", "worktrees", `agent-${agentId}`);
22766
+ return path31.relative(canonical4(expected), checkout.root) === "";
22735
22767
  } catch {
22736
22768
  return false;
22737
22769
  }
22738
22770
  };
22739
22771
  var runnerAt = (target) => {
22740
- const base = path30.basename(target);
22772
+ const base = path31.basename(target);
22741
22773
  return base.startsWith(OPAQUE_TARGET) ? decodeURIComponent(base.slice(OPAQUE_TARGET.length)) : null;
22742
22774
  };
22743
22775
  var shown = (target) => {
22744
- const named = /^\.workit-(?:live-target$|runs-)/.test(path30.basename(target)) ? path30.dirname(target) : target;
22745
- return path30.sep === "\\" ? named.replaceAll("/", "\\") : named;
22776
+ const named = /^\.workit-(?:live-target$|runs-)/.test(path31.basename(target)) ? path31.dirname(target) : target;
22777
+ return path31.sep === "\\" ? named.replaceAll("/", "\\") : named;
22746
22778
  };
22747
22779
  var unboundDeny = (input, target) => {
22748
22780
  const unblock = "Work only in the worktree your brief names, which the lead made with `workit fanout worktree create <slice>`: edit files under it and run one verb per call against it (`workit git --cwd <worktree> commit -m … -- <paths>`, `workit check --cwd <worktree> <name>`). If your brief names no worktree, stop and report that to the lead.";
@@ -22781,7 +22813,7 @@ var literalForm = (command, refs) => {
22781
22813
  };
22782
22814
  var unknownVarDeny = (input, worktree, targets, command) => {
22783
22815
  const refs = [
22784
- ...new Set(targets.flatMap((target) => path30.relative(UNKNOWN_VAR, path30.resolve(target)).split(path30.sep)[0].split("+").filter(Boolean).map(decodeURIComponent)))
22816
+ ...new Set(targets.flatMap((target) => path31.relative(UNKNOWN_VAR, path31.resolve(target)).split(path31.sep)[0].split("+").filter(Boolean).map(decodeURIComponent)))
22785
22817
  ];
22786
22818
  let text = command ?? "";
22787
22819
  const first = [];
@@ -22810,10 +22842,10 @@ function confineImplementer(input, targets, command) {
22810
22842
  try {
22811
22843
  if (!input.session.agentId || hostIsolated(input.cwd, input.session.agentId))
22812
22844
  return NONE5;
22813
- const unresolved = targets.filter((target) => within(path30.resolve(target), UNKNOWN_VAR));
22845
+ const unresolved = targets.filter((target) => within(path31.resolve(target), UNKNOWN_VAR));
22814
22846
  if (unresolved.length > 0)
22815
22847
  return unknownVarDeny(input, boundWorktree(input), unresolved, command);
22816
- if (targets.some((target) => within(path30.resolve(target), UNKNOWN_DIR)))
22848
+ if (targets.some((target) => within(path31.resolve(target), UNKNOWN_DIR)))
22817
22849
  return unknownDirDeny(input, boundWorktree(input));
22818
22850
  const bindings = canonical4(bindingDir());
22819
22851
  const judged = targets.map((named) => ({ named, real: canonical4(named) })).filter(({ real }) => within(real, bindings) || checkoutOf2(real) !== null);
@@ -22923,16 +22955,16 @@ var RUNS = /^(?:sh|bash|zsh|dash|ksh|mksh|ash|python[\d.]*|node|bun|deno|ruby|pe
22923
22955
  var INLINE = /^-[a-zA-Z]*[ceEpm]$|^--(?:eval|print|test|version|help)$|^-[hvV]$/;
22924
22956
  var VALUED = /^-[WXIrC]$|^--(?:require|import|loader|conditions|input-type)$/;
22925
22957
  var commonDir = (root) => {
22926
- const dotGit = path30.join(root, ".git");
22958
+ const dotGit = path31.join(root, ".git");
22927
22959
  if (!fs21.statSync(dotGit).isFile())
22928
22960
  return canonical4(dotGit);
22929
- const admin = path30.resolve(root, /^gitdir:\s*(.+)$/mu.exec(fs21.readFileSync(dotGit, "utf8"))?.[1]?.trim() ?? "");
22930
- const common = path30.join(admin, "commondir");
22931
- return canonical4(fs21.existsSync(common) ? path30.resolve(admin, fs21.readFileSync(common, "utf8").trim()) : admin);
22961
+ const admin = path31.resolve(root, /^gitdir:\s*(.+)$/mu.exec(fs21.readFileSync(dotGit, "utf8"))?.[1]?.trim() ?? "");
22962
+ const common = path31.join(admin, "commondir");
22963
+ return canonical4(fs21.existsSync(common) ? path31.resolve(admin, fs21.readFileSync(common, "utf8").trim()) : admin);
22932
22964
  };
22933
22965
  var inScratch = (real, repo) => {
22934
22966
  const checkout = checkoutOf2(real);
22935
- return checkout !== null && within(real, path30.join(checkout.root, SCRATCH)) && (repo === null || commonDir(checkout.root) === repo);
22967
+ return checkout !== null && within(real, path31.join(checkout.root, SCRATCH)) && (repo === null || commonDir(checkout.root) === repo);
22936
22968
  };
22937
22969
  var JUDGE_VERBS = {
22938
22970
  check: true,
@@ -22961,7 +22993,7 @@ var judgeVerbRefused = (args) => {
22961
22993
  var CLI_RUNNERS = /^(?:npx|bunx|pnpx|npm|pnpm|yarn|bun|node|nodejs|deno|tsx|ts-node)$/;
22962
22994
  var CLI_ENTRY = /(?:^|[=\\/])(?:workit(?:\.(?:exe|cmd|[cm]?js))?|@workit-dev\/cli(?:@\S*)?)$|(?:workit-cli|@workit-dev[\\/]cli)[\\/](?:src[\\/](?:index|main)|dist[\\/]index)\.[cm]?[jt]sx?$/;
22963
22995
  var workitCalls = (command, depth = 0, aliases = new Map) => depth > 4 ? [] : commandLines(command).flatMap((words) => {
22964
- const name = path30.basename(words[0] ?? "").toLowerCase();
22996
+ const name = path31.basename(words[0] ?? "").toLowerCase();
22965
22997
  if (name === "alias")
22966
22998
  return words.flatMap((word) => {
22967
22999
  const set = /^([\w-]+)=(.*)$/s.exec(word);
@@ -22991,11 +23023,11 @@ var judgeRefusal = (command, fed, depth = 0) => {
22991
23023
  return why;
22992
23024
  }
22993
23025
  const { words } = segment;
22994
- const runs = (word = "") => RUNS.test(path30.basename(word).toLowerCase());
23026
+ const runs = (word = "") => RUNS.test(path31.basename(word).toLowerCase());
22995
23027
  let at = 0;
22996
23028
  while (at < words.length && (LEADS.test(words[at]) || /^-\w$/.test(words[at - 1] ?? "") && !runs(words[at])))
22997
23029
  at++;
22998
- const name = path30.basename(words[at] ?? "").toLowerCase();
23030
+ const name = path31.basename(words[at] ?? "").toLowerCase();
22999
23031
  const args = words.slice(at + 1);
23000
23032
  const unseen = `\`${words.join(" ").slice(0, 80)}\` runs a script Workit cannot read (piped, on stdin, a process substitution or eval): write the case to a file in ${SCRATCH} and dispatch it from a test instead`;
23001
23033
  if (/^(?:cd|chdir|pushd|popd)$/.test(name))
@@ -23073,7 +23105,7 @@ var substitutingHeredoc = (command) => {
23073
23105
  var judgeDeny = (input, what) => {
23074
23106
  const role = input.session.agentType?.endsWith("reviewer") ? "reviewer" : "verifier";
23075
23107
  const root = checkoutOf2(input.cwd)?.root;
23076
- const scratch = root ? path30.join(root, SCRATCH) : `${SCRATCH}/ at the root of the checkout you judge`;
23108
+ const scratch = root ? path31.join(root, SCRATCH) : `${SCRATCH}/ at the root of the checkout you judge`;
23077
23109
  const unblock = `Write only under ${scratch} (mkdir -p it): put a generated case in a file there with a quoted heredoc (<<'EOF') and never run it in the shell. Reads, \`workit check\` and \`workit ledger verdict|finding\` stay allowed; a change the candidate needs is a finding, not an edit.`;
23078
23110
  return {
23079
23111
  kind: "deny",
@@ -23088,7 +23120,7 @@ function confineJudge(input, targets) {
23088
23120
  const judged = checkoutOf2(input.cwd);
23089
23121
  const repo = judged ? commonDir(judged.root) : null;
23090
23122
  for (const target of targets) {
23091
- const resolved = path30.resolve(target);
23123
+ const resolved = path31.resolve(target);
23092
23124
  if (within(resolved, UNKNOWN_VAR) || within(resolved, UNKNOWN_DIR))
23093
23125
  return judgeDeny(input, "it writes to a path Workit cannot resolve (a variable, a command substitution or `cd -`): spell the path out");
23094
23126
  if (inScratch(canonical4(target), repo))
@@ -23119,7 +23151,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
23119
23151
  let git = [];
23120
23152
  try {
23121
23153
  git = rawInvocations(command, dialect).flatMap(({ tool, dir, args }) => tool === "git" && (args[0] === "push" || leadOwnedGit(args)) ? [
23122
- path30.join(dir === undefined ? UNKNOWN_DIR : path30.resolve(input.cwd, dir ?? "."), `${OPAQUE_TARGET}git`)
23154
+ path31.join(dir === undefined ? UNKNOWN_DIR : path31.resolve(input.cwd, dir ?? "."), `${OPAQUE_TARGET}git`)
23123
23155
  ] : []);
23124
23156
  } catch {}
23125
23157
  return confineJudge(input, [
@@ -23164,7 +23196,7 @@ var judgeChecksLine = (cwd) => {
23164
23196
 
23165
23197
  // packages/workit-core/src/hooks/standing.ts
23166
23198
  var readPlans = (store) => {
23167
- const dir = path31.join(store, "fanouts");
23199
+ const dir = path32.join(store, "fanouts");
23168
23200
  let names;
23169
23201
  try {
23170
23202
  names = fs22.readdirSync(dir).filter((name) => name.endsWith(".json"));
@@ -23174,7 +23206,7 @@ var readPlans = (store) => {
23174
23206
  const plans = [];
23175
23207
  for (const name of names) {
23176
23208
  try {
23177
- const raw = JSON.parse(fs22.readFileSync(path31.join(dir, name), "utf8"));
23209
+ const raw = JSON.parse(fs22.readFileSync(path32.join(dir, name), "utf8"));
23178
23210
  if (typeof raw.name !== "string" || !Array.isArray(raw.slices))
23179
23211
  continue;
23180
23212
  const texts = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string" && item !== "") : [];
@@ -23317,7 +23349,7 @@ var cwdRewrite = (command) => {
23317
23349
  const rest = match?.[2];
23318
23350
  if (!dir || !rest || dir.startsWith("-"))
23319
23351
  return null;
23320
- if (/[&;<>`\n]/u.test(rest.replaceAll("2>&1", "").replaceAll(/'[^']*'|"(?:[^"\\]|\\.)*"/gu, "")))
23352
+ if (/[&;<>`\n]/u.test(rest.replaceAll("2>&1", "").replaceAll(/'[^']*'|"([^"\\]|\\.)*"/gu, "")))
23321
23353
  return null;
23322
23354
  const segments = segmentsOf(rest);
23323
23355
  const [head, ...filters] = segments;
@@ -23330,8 +23362,10 @@ var cwdRewrite = (command) => {
23330
23362
  if (!filters.every((s) => FILTERS.has(s.words[0] ?? "") && stdinOnly(s.words)))
23331
23363
  return null;
23332
23364
  const at = head.words.indexOf("--cwd");
23333
- if (at >= 0)
23334
- return head.words[at + 1] === dir.replace(/^(['"])(.*)\1$/u, "$2") ? rest : null;
23365
+ if (at >= 0) {
23366
+ const bare = dir.replace(/^(['"])(.*)\1$/u, "$2");
23367
+ return bare[0] === "/" && head.words[at + 1] === bare ? rest : null;
23368
+ }
23335
23369
  if (head.words.some((w) => w.startsWith("--cwd=")))
23336
23370
  return null;
23337
23371
  const args = rest.slice("workit".length).trimStart();
@@ -23351,7 +23385,7 @@ var verbFirst = (command) => {
23351
23385
  return null;
23352
23386
  return `${lead} ${verb}${globals}${command.slice(whole.length)}`;
23353
23387
  };
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;
23388
+ 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
23389
  var cdWorkitSplit = (command) => {
23356
23390
  const match = COMPOUND2.exec(command);
23357
23391
  const dir = match?.[1];
@@ -23373,8 +23407,8 @@ var cdWorkitSplit = (command) => {
23373
23407
 
23374
23408
  // packages/workit-core/src/hooks/model-limit.ts
23375
23409
  import { closeSync as closeSync2, openSync as openSync2, readdirSync as readdirSync3, readSync, statSync as statSync5 } from "node:fs";
23376
- import os9 from "node:os";
23377
- import path32 from "node:path";
23410
+ import os10 from "node:os";
23411
+ import path33 from "node:path";
23378
23412
  var MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
23379
23413
  var WEEKDAYS = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
23380
23414
  var TIME_WORD = String.raw`(?:\d|(?:in|at|on|later|tomorrow|soon)\b|(?:${[...WEEKDAYS, ...MONTHS].join("|")})[a-z]*\b)`;
@@ -23572,17 +23606,17 @@ var firstPrompt = (file) => {
23572
23606
  var claudeProjectSlug = (cwd) => cwd.replace(/[^A-Za-z0-9]/gu, "-");
23573
23607
  var listDir = (dir) => {
23574
23608
  try {
23575
- return readdirSync3(dir).map((name) => path32.join(dir, name));
23609
+ return readdirSync3(dir).map((name) => path33.join(dir, name));
23576
23610
  } catch {
23577
23611
  return [];
23578
23612
  }
23579
23613
  };
23580
23614
  var SCAN_MS = 30 * 60000;
23581
23615
  var scanClaudeTranscripts = (cwd, env, now = new Date) => {
23582
- const projects = path32.join(env.CLAUDE_CONFIG_DIR || path32.join(env.HOME || os9.homedir(), ".claude"), "projects");
23583
- const project = path32.join(projects, claudeProjectSlug(cwd));
23616
+ const projects = path33.join(env.CLAUDE_CONFIG_DIR || path33.join(env.HOME || os10.homedir(), ".claude"), "projects");
23617
+ const project = path33.join(projects, claudeProjectSlug(cwd));
23584
23618
  const notes = [];
23585
- const files = listDir(project).flatMap((entry) => entry.endsWith(".jsonl") ? [{ file: entry, worker: false }] : listDir(path32.join(entry, "subagents")).filter((file) => file.endsWith(".jsonl")).map((file) => ({ file, worker: true })));
23619
+ const files = listDir(project).flatMap((entry) => entry.endsWith(".jsonl") ? [{ file: entry, worker: false }] : listDir(path33.join(entry, "subagents")).filter((file) => file.endsWith(".jsonl")).map((file) => ({ file, worker: true })));
23586
23620
  for (const { file, worker } of files)
23587
23621
  try {
23588
23622
  const stat = statSync5(file);
@@ -23597,7 +23631,7 @@ var scanClaudeTranscripts = (cwd, env, now = new Date) => {
23597
23631
  if (!seen)
23598
23632
  continue;
23599
23633
  notes.push(worker ? redispatchNote(seen, {
23600
- label: `worker ${path32.basename(file, ".jsonl")}`,
23634
+ label: `worker ${path33.basename(file, ".jsonl")}`,
23601
23635
  prompt: firstPrompt(file)
23602
23636
  }, now) : `Workit: this session hit a usage limit (${seen.reason}); ${seen.key} is marked exhausted until ${shortTime(seen.until)}. Claude Code runs only Anthropic models: Workit cannot switch this session, so continue on another host or after the reset.`);
23603
23637
  } catch {}
@@ -23982,7 +24016,7 @@ var dispatchHook = (adapter, raw, env = process.env) => {
23982
24016
  };
23983
24017
  // packages/workit-core/src/hooks/deadline.ts
23984
24018
  import { appendFileSync, mkdirSync as mkdirSync4 } from "node:fs";
23985
- import path33 from "node:path";
24019
+ import path34 from "node:path";
23986
24020
  var HOOK_SKIP_TEXT = "workit context skipped: host under load";
23987
24021
  var HOOK_DEADLINE_MS = 8000;
23988
24022
  var HOST_DEADLINES = {
@@ -24000,7 +24034,7 @@ var hookDeadlineMs = (env, host = "", native) => {
24000
24034
  const row = HOST_DEADLINES[host];
24001
24035
  return override(env) ?? (row ? native === undefined ? Math.min(...Object.values(row)) : row[native] ?? row[""] : HOOK_DEADLINE_MS);
24002
24036
  };
24003
- var skipsFile = (stateDir) => path33.join(stateDir, HOOK_SKIPS_FILE);
24037
+ var skipsFile = (stateDir) => path34.join(stateDir, HOOK_SKIPS_FILE);
24004
24038
  var recordHookSkip = (skip, stateDir = resolveStateDir()) => {
24005
24039
  try {
24006
24040
  mkdirSync4(stateDir, { recursive: true });