@workit-dev/opencode 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.
Files changed (2) hide show
  1. package/dist/plugin.js +328 -296
  2. package/package.json +2 -2
package/dist/plugin.js CHANGED
@@ -183,8 +183,8 @@ function define(plugin) {
183
183
 
184
184
  // packages/workit-core/src/core.ts
185
185
  import { spawnSync as spawnSync21 } from "node:child_process";
186
- import { existsSync as existsSync10, realpathSync as realpathSync7 } from "node:fs";
187
- import path32 from "node:path";
186
+ import { existsSync as existsSync11, realpathSync as realpathSync8 } from "node:fs";
187
+ import path33 from "node:path";
188
188
 
189
189
  // packages/workit-core/src/core/task-contract.ts
190
190
  import { createHash as createHash3, randomUUID } from "node:crypto";
@@ -16677,12 +16677,11 @@ function checkVerdictsOnce(cwd, branch, ledgerRows) {
16677
16677
  }
16678
16678
  return reasons;
16679
16679
  };
16680
- const retired = new Set;
16680
+ const voided = verdictVoids(rows, { chained: true });
16681
+ const retired = new Set(voided.keys());
16681
16682
  for (const row of rows)
16682
- if (row.type === "verdict" && row.supersedes && !row.supersedeIgnored && trustReasons(cwd, row).length === 0)
16683
+ if (row.type === "verdict" && row.supersedes && !row.supersedeIgnored && !voided.has(row.id) && trustReasons(cwd, row).length === 0)
16683
16684
  retired.add(row.supersedes);
16684
- for (const id of verdictVoids(rows, { chained: true }).keys())
16685
- retired.add(id);
16686
16685
  const byKind = new Map;
16687
16686
  for (const row of rows.toSorted(byRank))
16688
16687
  if (isLiveVerdict(row, retired) && scope(row)) {
@@ -18475,31 +18474,75 @@ var exportDigest = (bundle) => sha256({
18475
18474
  });
18476
18475
  // packages/workit-core/src/core/route-intent.ts
18477
18476
  import { spawnSync as spawnSync16 } from "node:child_process";
18478
- import { existsSync as existsSync8 } from "node:fs";
18479
- import path27 from "node:path";
18477
+ import { existsSync as existsSync9 } from "node:fs";
18478
+ import path28 from "node:path";
18480
18479
 
18481
18480
  // packages/workit-core/src/hooks/raw-git.ts
18482
18481
  import { spawnSync as spawnSync15 } from "node:child_process";
18483
18482
  import { createHash as createHash16 } from "node:crypto";
18484
18483
  import fs19 from "node:fs";
18485
- import os6 from "node:os";
18486
- import path26 from "node:path";
18484
+ import os7 from "node:os";
18485
+ import path27 from "node:path";
18487
18486
 
18488
18487
  // packages/workit-core/src/autonomy.ts
18488
+ import os6 from "node:os";
18489
+ import path25 from "node:path";
18490
+
18491
+ // packages/workit-core/src/core/eval-world.ts
18492
+ import { existsSync as existsSync8, realpathSync as realpathSync5 } from "node:fs";
18489
18493
  import os5 from "node:os";
18490
18494
  import path24 from "node:path";
18495
+ var EVAL_WORLD_ENV = "WORKIT_EVAL_WORLD";
18496
+ var EVAL_WORLD_MARKER = ".workit-eval-world";
18497
+ var inside2 = (dir, file) => {
18498
+ const rel = path24.relative(dir, file);
18499
+ return !rel.startsWith("..") && !path24.isAbsolute(rel);
18500
+ };
18501
+ var evalWorldEntry = (cwd) => {
18502
+ const raw = process.env[EVAL_WORLD_ENV];
18503
+ if (!raw || !path24.isAbsolute(raw))
18504
+ return null;
18505
+ try {
18506
+ const world = realpathSync5(raw);
18507
+ if (!inside2(realpathSync5(os5.tmpdir()), world) || !inside2(world, realpathSync5(cwd)) || !existsSync8(path24.join(world, EVAL_WORLD_MARKER)))
18508
+ return null;
18509
+ return loadWorkspacesFrom(path24.join(world, "config"))[0] ?? null;
18510
+ } catch {
18511
+ return null;
18512
+ }
18513
+ };
18514
+
18515
+ // packages/workit-core/src/autonomy.ts
18491
18516
  var accountHome2 = () => {
18492
18517
  try {
18493
- return os5.userInfo().homedir;
18518
+ return os6.userInfo().homedir;
18494
18519
  } catch {
18495
- return os5.homedir();
18520
+ return os6.homedir();
18496
18521
  }
18497
18522
  };
18498
18523
  var grantsHome = { resolve: accountHome2 };
18499
18524
  var grantsDir = () => configDir({ HOME: grantsHome.resolve() });
18525
+ var benchWorld = (cwd) => {
18526
+ const entry = evalWorldEntry(cwd);
18527
+ if (!entry)
18528
+ return null;
18529
+ const { grants } = configuredGrants(entry);
18530
+ const lowered = {};
18531
+ for (const kind of GRANT_KINDS) {
18532
+ const value = grants[kind];
18533
+ if (value !== undefined && raises(kind, value, DEFAULT_GRANTS[kind]))
18534
+ lowered[kind] = value;
18535
+ }
18536
+ return {
18537
+ name: entry.name,
18538
+ glob: entry.glob,
18539
+ ...entry.defaultEndpoint ? { defaultEndpoint: entry.defaultEndpoint } : {},
18540
+ autonomy: lowered
18541
+ };
18542
+ };
18500
18543
  var grantsOverride = () => {
18501
- const configured = path24.resolve(resolveConfigDir());
18502
- return configured === path24.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 ${path24.join(grantsDir(), "workspaces.json")}, so the D4 defaults apply until grants are set there`;
18544
+ const configured = path25.resolve(resolveConfigDir());
18545
+ return configured === path25.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 ${path25.join(grantsDir(), "workspaces.json")}, so the D4 defaults apply until grants are set there`;
18503
18546
  };
18504
18547
  var GRANT_KINDS = ["push", "pr", "merge", "release", "rerun"];
18505
18548
  var DEFAULT_GRANTS = Object.freeze({
@@ -18664,11 +18707,12 @@ function capAt(named, where, by, why, main = false) {
18664
18707
  };
18665
18708
  }
18666
18709
  function resolveAutonomy(cwd, target) {
18667
- const override = grantsOverride();
18710
+ const world = benchWorld(cwd);
18711
+ const override = world ? null : grantsOverride();
18668
18712
  if (override)
18669
18713
  return { ...autonomyOf(null), note: override };
18670
18714
  const name = process.env.WORKIT_WORKSPACE_NAME?.trim() || undefined;
18671
- let autonomy = autonomyOf(resolveWorkspaceFrom(cwd, grantsDir(), name));
18715
+ let autonomy = autonomyOf(resolveWorkspaceFrom(cwd, grantsDir(), name) ?? world);
18672
18716
  if (name)
18673
18717
  autonomy = capAt(autonomy, cwd, `WORKIT_WORKSPACE_NAME=${name}`, "a name never raises grants");
18674
18718
  const above = checkoutsAbove(cwd);
@@ -18756,7 +18800,7 @@ var raises = (kind, current, next) => {
18756
18800
  // packages/workit-core/src/hooks/session-marker.ts
18757
18801
  import { createHash as createHash15 } from "node:crypto";
18758
18802
  import fs18 from "node:fs";
18759
- import path25 from "node:path";
18803
+ import path26 from "node:path";
18760
18804
  var sessionMarkerFile = (input, session, store) => {
18761
18805
  let dir = store;
18762
18806
  if (dir === undefined) {
@@ -18766,7 +18810,7 @@ var sessionMarkerFile = (input, session, store) => {
18766
18810
  dir = location.dir;
18767
18811
  }
18768
18812
  const name = createHash15("sha256").update(`${input.host}\x00${session}`).digest("hex").slice(0, 32);
18769
- return path25.join(dir, "hooks", `skills-${name}.json`);
18813
+ return path26.join(dir, "hooks", `skills-${name}.json`);
18770
18814
  };
18771
18815
  var list2 = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
18772
18816
  var EMPTY = {
@@ -18801,7 +18845,7 @@ var parseMarker = (text) => {
18801
18845
  };
18802
18846
  var readSessionMarker = (file) => parseMarker(readRaw(file));
18803
18847
  var writeAtomic = (file, marker) => {
18804
- fs18.mkdirSync(path25.dirname(file), { recursive: true });
18848
+ fs18.mkdirSync(path26.dirname(file), { recursive: true });
18805
18849
  const temp = `${file}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
18806
18850
  try {
18807
18851
  fs18.writeFileSync(temp, JSON.stringify(marker));
@@ -19364,14 +19408,14 @@ var GIT_CONFIG_ENV = /^(?:GIT_(?:CONFIG\w*|DIR|COMMON_DIR|WORK_TREE|SSH|SSH_COMM
19364
19408
  var ASSIGNMENT = /^([A-Za-z_]\w*)=([\s\S]*)$/;
19365
19409
  var MAX_DEPTH = 4;
19366
19410
  var MAX_EXPANSIONS = 16;
19367
- var isAbsolute = (value) => path26.isAbsolute(value) || /^[A-Za-z]:[\\/]/.test(value) || value.startsWith("\\\\");
19411
+ var isAbsolute = (value) => path27.isAbsolute(value) || /^[A-Za-z]:[\\/]/.test(value) || value.startsWith("\\\\");
19368
19412
  var HERE = /^(?:\$PWD|\$\{PWD\}|\$\(\s*pwd\s*\)|`pwd`|\$\(\s*git\s+rev-parse\s+--show-toplevel\s*\))(?=$|[\\/])/;
19369
19413
  var joinDir = (base, raw) => {
19370
19414
  const next = raw.replace(HERE, ".");
19371
19415
  if (base === undefined || /[$`*?]/.test(next) || next === "-")
19372
19416
  return;
19373
- const expanded = next === "~" || next.startsWith("~/") ? path26.join(os6.homedir(), next.slice(1)) : next;
19374
- return base === null || isAbsolute(expanded) ? expanded : path26.join(base, expanded);
19417
+ const expanded = next === "~" || next.startsWith("~/") ? path27.join(os7.homedir(), next.slice(1)) : next;
19418
+ return base === null || isAbsolute(expanded) ? expanded : path27.join(base, expanded);
19375
19419
  };
19376
19420
  var rebase = (base, inner) => inner === null ? base : inner === undefined ? undefined : joinDir(base, inner);
19377
19421
  var cdTarget = (words) => {
@@ -19772,7 +19816,7 @@ function walk2(command, dialect, depth, seen, inherited = {}) {
19772
19816
  }
19773
19817
  if (CD.has(name)) {
19774
19818
  const target = cdTarget(words);
19775
- dir = target === null ? os6.homedir() : joinDir(dir, target);
19819
+ dir = target === null ? os7.homedir() : joinDir(dir, target);
19776
19820
  } else if (PUSHD.has(name)) {
19777
19821
  const target = cdTarget(words);
19778
19822
  stack.push(dir);
@@ -20293,17 +20337,17 @@ var headSha2 = (repo) => {
20293
20337
  if (!git || git.reftable)
20294
20338
  return null;
20295
20339
  try {
20296
- const head = fs19.readFileSync(path26.join(git.gitDir, "HEAD"), "utf8").trim();
20340
+ const head = fs19.readFileSync(path27.join(git.gitDir, "HEAD"), "utf8").trim();
20297
20341
  if (/^[0-9a-f]{40,64}$/.test(head))
20298
20342
  return head;
20299
20343
  const ref = /^ref: (refs\/.+)$/.exec(head)?.[1];
20300
20344
  if (!ref)
20301
20345
  return null;
20302
- const common = path26.dirname(repo.location.dir);
20346
+ const common = path27.dirname(repo.location.dir);
20303
20347
  try {
20304
- return fs19.readFileSync(path26.join(common, ref), "utf8").trim() || null;
20348
+ return fs19.readFileSync(path27.join(common, ref), "utf8").trim() || null;
20305
20349
  } catch {}
20306
- const packed = fs19.readFileSync(path26.join(common, "packed-refs"), "utf8");
20350
+ const packed = fs19.readFileSync(path27.join(common, "packed-refs"), "utf8");
20307
20351
  return new RegExp(`^([0-9a-f]{40,64}) ${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`, "m").exec(packed)?.[1] ?? null;
20308
20352
  } catch {
20309
20353
  return null;
@@ -20396,7 +20440,7 @@ var expandGitAliases = (root, invocation, cache = new Map, depth = 0) => {
20396
20440
  const sub = invocation.args[0];
20397
20441
  if (invocation.tool !== "git" || invocation.dir === undefined || !sub || sub.startsWith("-") || GIT_COMMANDS.has(sub) || depth >= MAX_DEPTH)
20398
20442
  return [invocation];
20399
- const dir = path26.resolve(root, invocation.dir ?? ".");
20443
+ const dir = path27.resolve(root, invocation.dir ?? ".");
20400
20444
  if (!fs19.existsSync(dir))
20401
20445
  return [invocation];
20402
20446
  const config = gitConfig(dir, invocation, cache);
@@ -20419,11 +20463,11 @@ var expandGitAliases = (root, invocation, cache = new Map, depth = 0) => {
20419
20463
  var normalizedUrl = (url, dir) => {
20420
20464
  const trimmed = url.trim();
20421
20465
  if (/^file:\/\//i.test(trimmed))
20422
- return path26.resolve(dir, trimmed.slice(7)).replace(/\/+$/, "").replace(/\.git$/, "");
20466
+ return path27.resolve(dir, trimmed.slice(7)).replace(/\/+$/, "").replace(/\.git$/, "");
20423
20467
  const scheme = /^[a-z][a-z0-9+.-]*:\/\//i.exec(trimmed);
20424
20468
  const scp = !scheme && /^(?:[^@/\\]+@)?[^/\\:]{2,}:/.test(trimmed);
20425
20469
  if (!scheme && !scp)
20426
- return path26.resolve(dir, trimmed).replace(/\/+$/, "").replace(/\.git$/, "");
20470
+ return path27.resolve(dir, trimmed).replace(/\/+$/, "").replace(/\.git$/, "");
20427
20471
  const value = scheme ? trimmed.slice(scheme[0].length).replace(/^[^@/]*@/, "").replace(/^([^/:]+):\d+(?=\/)/, "$1") : trimmed.replace(/^[^@/]*@/, "").replace(":", "/");
20428
20472
  return value.toLowerCase().replace(/\/{2,}/g, "/").replace(/^www\./, "").replace(/\/+$/, "").replace(/\.git$/, "");
20429
20473
  };
@@ -20651,7 +20695,7 @@ var actionsIn = (cwd, command, dialect, cache = new Map, all = false) => {
20651
20695
  const out = [];
20652
20696
  const repos = new Map;
20653
20697
  const repoFor = (relative) => {
20654
- const dir = path26.resolve(cwd, relative ?? ".");
20698
+ const dir = path27.resolve(cwd, relative ?? ".");
20655
20699
  if (!repos.has(dir)) {
20656
20700
  const repo = repoAt(dir);
20657
20701
  const workit = repo !== null && isWorkitWorkspace(repo);
@@ -20671,7 +20715,7 @@ var actionsIn = (cwd, command, dialect, cache = new Map, all = false) => {
20671
20715
  continue;
20672
20716
  const action = rawAction(invocation);
20673
20717
  const at = !action ? null : repoFor(invocation.dir) ?? (all && invocation.tool !== "git" && explicitRepo(invocation.tool === "gh", "repo" in action && action.repo || "", invocation.env ?? {}) ? {
20674
- repo: { dir: path26.resolve(cwd, invocation.dir ?? "."), branch: null },
20718
+ repo: { dir: path27.resolve(cwd, invocation.dir ?? "."), branch: null },
20675
20719
  workit: false
20676
20720
  } : null);
20677
20721
  if (action && at)
@@ -20808,9 +20852,9 @@ var grantRefusal = (action, repo, invocation, cache) => {
20808
20852
  return null;
20809
20853
  };
20810
20854
  var localTag = (repo, name) => {
20811
- const common = path26.dirname(repo.location.dir);
20855
+ const common = path27.dirname(repo.location.dir);
20812
20856
  try {
20813
- return fs19.existsSync(path26.join(common, "refs/tags", name)) || fs19.readFileSync(path26.join(common, "packed-refs"), "utf8").includes(` refs/tags/${name}
20857
+ return fs19.existsSync(path27.join(common, "refs/tags", name)) || fs19.readFileSync(path27.join(common, "packed-refs"), "utf8").includes(` refs/tags/${name}
20814
20858
  `);
20815
20859
  } catch {
20816
20860
  return false;
@@ -20829,7 +20873,7 @@ var analysisDenial = (error) => ({
20829
20873
  unblock: SPLIT_IT
20830
20874
  });
20831
20875
  var MARKER_TTL_SECONDS = 3600;
20832
- var markerFile = (repo, session, key) => path26.join(repo.location.dir, "hooks", `commit-${createHash16("sha256").update(`${session}\x00${key}`).digest("hex").slice(0, 32)}.json`);
20876
+ var markerFile = (repo, session, key) => path27.join(repo.location.dir, "hooks", `commit-${createHash16("sha256").update(`${session}\x00${key}`).digest("hex").slice(0, 32)}.json`);
20833
20877
  var callKey = (toolUseId, command) => toolUseId ?? `cmd:${createHash16("sha256").update(command).digest("hex")}`;
20834
20878
  function noteRawCommit(input, command, key) {
20835
20879
  try {
@@ -20840,7 +20884,7 @@ function noteRawCommit(input, command, key) {
20840
20884
  if (action.kind !== "commit")
20841
20885
  continue;
20842
20886
  const file = markerFile(repo, input.session.id, key);
20843
- fs19.mkdirSync(path26.dirname(file), { recursive: true });
20887
+ fs19.mkdirSync(path27.dirname(file), { recursive: true });
20844
20888
  fs19.writeFileSync(file, `${JSON.stringify({ head: headSha2(repo), at })}
20845
20889
  `);
20846
20890
  }
@@ -21069,8 +21113,8 @@ var judgedDir = (root, dir) => {
21069
21113
  return null;
21070
21114
  if (dir === null)
21071
21115
  return root;
21072
- const resolved = path27.resolve(root, dir);
21073
- return existsSync8(resolved) && inWorkitWorkspace(resolved) ? resolved : null;
21116
+ const resolved = path28.resolve(root, dir);
21117
+ return existsSync9(resolved) && inWorkitWorkspace(resolved) ? resolved : null;
21074
21118
  };
21075
21119
  var shellBranchPolicyViolation = (root, command, dialect = "posix") => {
21076
21120
  let judged = false;
@@ -21091,7 +21135,7 @@ var shellBranchPolicyViolation = (root, command, dialect = "posix") => {
21091
21135
  return judged ? { ok: true } : null;
21092
21136
  };
21093
21137
  // packages/workit-core/src/core/task-engine.ts
21094
- import { realpathSync as realpathSync6 } from "node:fs";
21138
+ import { realpathSync as realpathSync7 } from "node:fs";
21095
21139
 
21096
21140
  // packages/workit-core/src/core/policy-resolver.ts
21097
21141
  function resolvePolicy(input) {
@@ -21340,12 +21384,12 @@ var judgeInputSummary = (raw) => {
21340
21384
  };
21341
21385
 
21342
21386
  // packages/workit-core/src/core/task-view.ts
21343
- import { realpathSync as realpathSync5 } from "node:fs";
21387
+ import { realpathSync as realpathSync6 } from "node:fs";
21344
21388
  var environment = () => [];
21345
21389
  var sameSession2 = (value, context) => typeof value === "object" && value !== null && value.kind === "host" && value.host === context.caller.host && value.handle === context.caller.actor;
21346
21390
  function contextRootError(store, context) {
21347
21391
  try {
21348
- realpathSync5(context.root);
21392
+ realpathSync6(context.root);
21349
21393
  const root = checkoutRootOf(context.root);
21350
21394
  if (root !== store.root && !sameDirectoryIdentity(root, store.root))
21351
21395
  return failure2("invalid_input", "operation context root does not match the task store root");
@@ -22815,7 +22859,7 @@ class WorkitCore {
22815
22859
  if (view.task.workspaceId !== view.workspace.id)
22816
22860
  return failure2("invalid_input", "task and workspace bindings are invalid");
22817
22861
  try {
22818
- if (realpathSync6(view.workspace.root) !== this.store.root)
22862
+ if (realpathSync7(view.workspace.root) !== this.store.root)
22819
22863
  return failure2("invalid_input", "task view root does not match the task store");
22820
22864
  } catch {
22821
22865
  return failure2("invalid_input", "task view root cannot be resolved");
@@ -23066,8 +23110,8 @@ class WorkitCore {
23066
23110
  }
23067
23111
  // packages/workit-core/src/core/repo-context.ts
23068
23112
  import { spawnSync as spawnSync17 } from "node:child_process";
23069
- import { existsSync as existsSync9, readFileSync as readFileSync8, readdirSync as readdirSync3 } from "node:fs";
23070
- import path28 from "node:path";
23113
+ import { existsSync as existsSync10, readFileSync as readFileSync8, readdirSync as readdirSync3 } from "node:fs";
23114
+ import path29 from "node:path";
23071
23115
  var isSafeContextRange = (value) => value.length <= 4096 && (() => {
23072
23116
  try {
23073
23117
  gitRevisionParts(value);
@@ -23211,13 +23255,13 @@ var findPrTemplate = (cwd) => {
23211
23255
  for (const rel of PR_TEMPLATE_FILES) {
23212
23256
  const parts = rel.split("/");
23213
23257
  const base = parts[parts.length - 1];
23214
- const dir = parts.length > 1 ? path28.join(cwd, ...parts.slice(0, -1)) : cwd;
23258
+ const dir = parts.length > 1 ? path29.join(cwd, ...parts.slice(0, -1)) : cwd;
23215
23259
  const actual = probeCaseInsensitive(dir, base);
23216
23260
  if (actual)
23217
23261
  return [...parts.slice(0, -1), actual].join("/");
23218
23262
  }
23219
23263
  for (const rel of PR_TEMPLATE_DIRS) {
23220
- const only = singleMarkdown(path28.join(cwd, ...rel.split("/")));
23264
+ const only = singleMarkdown(path29.join(cwd, ...rel.split("/")));
23221
23265
  if (only)
23222
23266
  return `${rel}/${only}`;
23223
23267
  }
@@ -23247,8 +23291,8 @@ var diffStatForRange = (cwd, range) => {
23247
23291
  return runGit(cwd, ["diff", "--stat", "--"]).stdout;
23248
23292
  };
23249
23293
  var packageScripts = (cwd, keys) => {
23250
- const pkgPath = path28.join(cwd, "package.json");
23251
- if (!existsSync9(pkgPath))
23294
+ const pkgPath = path29.join(cwd, "package.json");
23295
+ if (!existsSync10(pkgPath))
23252
23296
  return [];
23253
23297
  try {
23254
23298
  const pkg = JSON.parse(readFileSync8(pkgPath, "utf8"));
@@ -23273,9 +23317,9 @@ var documentationFiles = (cwd) => {
23273
23317
  if (entry.isDirectory()) {
23274
23318
  if (excluded.has(entry.name))
23275
23319
  continue;
23276
- walk(path28.join(dir, entry.name), depth + 1);
23320
+ walk(path29.join(dir, entry.name), depth + 1);
23277
23321
  } else if (entry.isFile() && (entry.name === "README.md" || entry.name.endsWith(".md"))) {
23278
- matches.push("./" + path28.relative(cwd, path28.join(dir, entry.name)).replaceAll("\\", "/"));
23322
+ matches.push("./" + path29.relative(cwd, path29.join(dir, entry.name)).replaceAll("\\", "/"));
23279
23323
  }
23280
23324
  }
23281
23325
  };
@@ -23283,7 +23327,7 @@ var documentationFiles = (cwd) => {
23283
23327
  return matches.toSorted().slice(0, 200);
23284
23328
  };
23285
23329
  var readTrimmed2 = (file, maxLines) => {
23286
- if (!existsSync9(file))
23330
+ if (!existsSync10(file))
23287
23331
  return "";
23288
23332
  const lines = readFileSync8(file, "utf8").split(`
23289
23333
  `);
@@ -23291,7 +23335,7 @@ var readTrimmed2 = (file, maxLines) => {
23291
23335
  `);
23292
23336
  };
23293
23337
  function prReadyContext(root, range) {
23294
- const cwd = path28.resolve(repoRoot(root));
23338
+ const cwd = path29.resolve(repoRoot(root));
23295
23339
  if (range !== undefined && !isResolvableContextRange(cwd, range))
23296
23340
  return invalidRange(cwd);
23297
23341
  let stdout = "";
@@ -23349,7 +23393,7 @@ ${status.stderr}` : "");
23349
23393
  stdout += `template_path: ${template}
23350
23394
 
23351
23395
  `;
23352
- stdout += readTrimmed2(path28.join(cwd, template), 220);
23396
+ stdout += readTrimmed2(path29.join(cwd, template), 220);
23353
23397
  } else {
23354
23398
  stdout += `template_path: none
23355
23399
 
@@ -23359,7 +23403,7 @@ ${status.stderr}` : "");
23359
23403
  stdout += `
23360
23404
  `;
23361
23405
  stdout += printSection("Recent Validation Signals");
23362
- if (existsSync9(path28.join(cwd, "package.json"))) {
23406
+ if (existsSync10(path29.join(cwd, "package.json"))) {
23363
23407
  stdout += `package.json detected. Common scripts:
23364
23408
  `;
23365
23409
  const found = packageScripts(cwd, ["lint", "format:check", "test", "build"]);
@@ -23368,7 +23412,7 @@ ${status.stderr}` : "");
23368
23412
  `) + `
23369
23413
  `;
23370
23414
  }
23371
- if (existsSync9(path28.join(cwd, "Cargo.toml")) || existsSync9(path28.join(cwd, "src-tauri/Cargo.toml"))) {
23415
+ if (existsSync10(path29.join(cwd, "Cargo.toml")) || existsSync10(path29.join(cwd, "src-tauri/Cargo.toml"))) {
23372
23416
  stdout += `Rust project detected.
23373
23417
  `;
23374
23418
  }
@@ -23401,7 +23445,7 @@ var CHANGELOG_RULES = `- Use an [Unreleased] section.
23401
23445
  - Apply with the host-native editor, preserving the repository changelog conventions.
23402
23446
  - If Unreleased already has duplicate category headings, normalize_only first.`;
23403
23447
  function changelogContext(root, range) {
23404
- const cwd = path28.resolve(repoRoot(root));
23448
+ const cwd = path29.resolve(repoRoot(root));
23405
23449
  if (range !== undefined && !isResolvableContextRange(cwd, range))
23406
23450
  return invalidRange(cwd);
23407
23451
  const resolvedRange = rangeArgOrDefault(range, cwd);
@@ -23419,8 +23463,8 @@ function changelogContext(root, range) {
23419
23463
  stdout += CHANGELOG_RULES + `
23420
23464
  `;
23421
23465
  stdout += printSection("Existing CHANGELOG.md");
23422
- const changelogPath = path28.join(cwd, "CHANGELOG.md");
23423
- if (existsSync9(changelogPath)) {
23466
+ const changelogPath = path29.join(cwd, "CHANGELOG.md");
23467
+ if (existsSync10(changelogPath)) {
23424
23468
  stdout += readTrimmed2(changelogPath, 260) + `
23425
23469
  `;
23426
23470
  } else {
@@ -23439,7 +23483,7 @@ function changelogContext(root, range) {
23439
23483
  return { stdout, stderr: "", exitCode: 0, cwd };
23440
23484
  }
23441
23485
  function docsRefreshContext(root, range) {
23442
- const cwd = path28.resolve(repoRoot(root));
23486
+ const cwd = path29.resolve(repoRoot(root));
23443
23487
  if (range !== undefined && !isResolvableContextRange(cwd, range))
23444
23488
  return invalidRange(cwd);
23445
23489
  const resolvedRange = rangeArgOrDefault(range, cwd);
@@ -23461,8 +23505,8 @@ function docsRefreshContext(root, range) {
23461
23505
  `) + `
23462
23506
  `;
23463
23507
  stdout += printSection("README Preview");
23464
- const readme = path28.join(cwd, "README.md");
23465
- if (existsSync9(readme)) {
23508
+ const readme = path29.join(cwd, "README.md");
23509
+ if (existsSync10(readme)) {
23466
23510
  stdout += readTrimmed2(readme, 220) + `
23467
23511
  `;
23468
23512
  } else {
@@ -23470,8 +23514,8 @@ function docsRefreshContext(root, range) {
23470
23514
  `;
23471
23515
  }
23472
23516
  stdout += printSection("Package Scripts");
23473
- const pkgPath = path28.join(cwd, "package.json");
23474
- if (existsSync9(pkgPath)) {
23517
+ const pkgPath = path29.join(cwd, "package.json");
23518
+ if (existsSync10(pkgPath)) {
23475
23519
  try {
23476
23520
  const pkg = JSON.parse(readFileSync8(pkgPath, "utf8"));
23477
23521
  stdout += JSON.stringify({ name: pkg.name, version: pkg.version, scripts: pkg.scripts }, null, 2) + `
@@ -23484,7 +23528,7 @@ function docsRefreshContext(root, range) {
23484
23528
  return { stdout, stderr: "", exitCode: 0, cwd };
23485
23529
  }
23486
23530
  function releaseNotesContext(root, rangeOrTag) {
23487
- const cwd = path28.resolve(repoRoot(root));
23531
+ const cwd = path29.resolve(repoRoot(root));
23488
23532
  if (!rangeOrTag) {
23489
23533
  return {
23490
23534
  stdout: "",
@@ -23527,7 +23571,7 @@ function releaseNotesContext(root, rangeOrTag) {
23527
23571
  `;
23528
23572
  stdout += printSection("Existing Release Files");
23529
23573
  for (const rel of ["CHANGELOG.md", "RELEASE_NOTES.md", ".github/releases.md"]) {
23530
- if (existsSync9(path28.join(cwd, rel)))
23574
+ if (existsSync10(path29.join(cwd, rel)))
23531
23575
  stdout += rel + `
23532
23576
  `;
23533
23577
  }
@@ -23559,7 +23603,7 @@ import { spawnSync as spawnSync19 } from "node:child_process";
23559
23603
 
23560
23604
  // packages/workit-core/src/core/pr-create.ts
23561
23605
  import fs20 from "node:fs";
23562
- import path29 from "node:path";
23606
+ import path30 from "node:path";
23563
23607
  import { spawnSync as spawnSync18 } from "node:child_process";
23564
23608
  import { pathToFileURL } from "node:url";
23565
23609
  // packages/workit-core/src/forge/pr-body.ts
@@ -23580,11 +23624,11 @@ var LOCAL = bounded(20000);
23580
23624
  var NETWORK = bounded(60000);
23581
23625
  function whichOnPath(tool) {
23582
23626
  const names = process.platform === "win32" ? [tool, `${tool}.exe`, `${tool}.cmd`] : [tool];
23583
- for (const dir of (process.env.PATH ?? "").split(path29.delimiter)) {
23627
+ for (const dir of (process.env.PATH ?? "").split(path30.delimiter)) {
23584
23628
  if (!dir)
23585
23629
  continue;
23586
23630
  for (const name of names) {
23587
- const candidate = path29.join(dir, name);
23631
+ const candidate = path30.join(dir, name);
23588
23632
  try {
23589
23633
  fs20.accessSync(candidate, fs20.constants.X_OK);
23590
23634
  return candidate;
@@ -23606,7 +23650,7 @@ var pushRemote = (cwd) => {
23606
23650
  };
23607
23651
  var safePushUrl = (remote) => {
23608
23652
  const raw = remote.trim();
23609
- if (path29.isAbsolute(raw))
23653
+ if (path30.isAbsolute(raw))
23610
23654
  return pathToFileURL(raw).href;
23611
23655
  if (!raw.includes("://")) {
23612
23656
  const scp = /^(?:([^@\s]+)@)?([^:]+):(.+)$/u.exec(raw);
@@ -23738,7 +23782,7 @@ var fetchGitLabIssueBody = async (ref, root, deps = {}) => {
23738
23782
 
23739
23783
  // packages/workit-core/src/core/youtrack.ts
23740
23784
  import fs22 from "node:fs";
23741
- import path31 from "node:path";
23785
+ import path32 from "node:path";
23742
23786
 
23743
23787
  // packages/workit-core/src/core/templates.ts
23744
23788
  var repoRoot2 = assetRoot();
@@ -23753,7 +23797,7 @@ import { spawnSync as spawnSync20 } from "node:child_process";
23753
23797
 
23754
23798
  // packages/workit-core/src/forge/exec.ts
23755
23799
  import fs21 from "node:fs";
23756
- import path30 from "node:path";
23800
+ import path31 from "node:path";
23757
23801
 
23758
23802
  // packages/workit-core/src/forge/redact.ts
23759
23803
  var KEY = String.raw`[A-Za-z0-9_.-]*?(?:token|secret|password|passwd|pwd|api[_-]?key|access[_-]?key|account[_-]?key|private[_-]?key|client[_-]?secret|credentials?|authorization|cookie|signature)[A-Za-z0-9_.-]*`;
@@ -23768,11 +23812,11 @@ var failure3 = (code, error, unblock) => ({ ok: false, code, error, ...unblock ?
23768
23812
  // packages/workit-core/src/forge/exec.ts
23769
23813
  var MAX_BUFFER2 = 64 * 1024 * 1024;
23770
23814
  function findExecutable(bin, env) {
23771
- const dirs = (env.PATH ?? env.Path ?? "").split(path30.delimiter).filter(Boolean);
23815
+ const dirs = (env.PATH ?? env.Path ?? "").split(path31.delimiter).filter(Boolean);
23772
23816
  const exts = process.platform === "win32" ? [".exe"] : [""];
23773
23817
  for (const dir of dirs)
23774
23818
  for (const ext of exts) {
23775
- const candidate = path30.join(dir, `${bin}${ext}`);
23819
+ const candidate = path31.join(dir, `${bin}${ext}`);
23776
23820
  try {
23777
23821
  const stat = fs21.statSync(candidate);
23778
23822
  if (stat.isFile())
@@ -23884,7 +23928,7 @@ function ytrackReadiness(run, host) {
23884
23928
 
23885
23929
  // packages/workit-core/src/core/youtrack.ts
23886
23930
  var ISSUE_RE = /^[A-Z]+-\d+$/;
23887
- var youTrackReadOnlyConfigPath = () => process.env.WORKIT_YOUTRACK_CONFIG ?? path31.join(resolveConfigDir(), "youtrack.json");
23931
+ var youTrackReadOnlyConfigPath = () => process.env.WORKIT_YOUTRACK_CONFIG ?? path32.join(resolveConfigDir(), "youtrack.json");
23888
23932
  var readYouTrackContextConfig = () => {
23889
23933
  const cfgPath = youTrackReadOnlyConfigPath();
23890
23934
  if (!fs22.existsSync(cfgPath))
@@ -24258,22 +24302,22 @@ function resolveGitRevision(root, value) {
24258
24302
  }
24259
24303
  }
24260
24304
  function resolveInside(root, candidate) {
24261
- const base = realpathSync7(root);
24262
- const target = path32.resolve(base, candidate);
24263
- if (target !== base && !target.startsWith(base + path32.sep)) {
24305
+ const base = realpathSync8(root);
24306
+ const target = path33.resolve(base, candidate);
24307
+ if (target !== base && !target.startsWith(base + path33.sep)) {
24264
24308
  throw new Error("path must stay inside repository root");
24265
24309
  }
24266
24310
  let ancestor = target;
24267
- while (!existsSync10(ancestor))
24268
- ancestor = path32.dirname(ancestor);
24269
- const canonicalAncestor = realpathSync7(ancestor);
24270
- if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base + path32.sep)) {
24311
+ while (!existsSync11(ancestor))
24312
+ ancestor = path33.dirname(ancestor);
24313
+ const canonicalAncestor = realpathSync8(ancestor);
24314
+ if (canonicalAncestor !== base && !canonicalAncestor.startsWith(base + path33.sep)) {
24271
24315
  throw new Error("path must stay inside repository root");
24272
24316
  }
24273
24317
  return target;
24274
24318
  }
24275
24319
  function run2(root, executable, args, env = {}) {
24276
- const cwd = realpathSync7(root);
24320
+ const cwd = realpathSync8(root);
24277
24321
  const result = spawnSync21(executable, args, {
24278
24322
  cwd,
24279
24323
  encoding: "utf8",
@@ -24328,7 +24372,7 @@ var capabilitiesFor = (descriptor, observed = {}) => descriptor.capabilities.map
24328
24372
  };
24329
24373
  });
24330
24374
  // packages/workit-core/src/hooks/context.ts
24331
- import path33 from "node:path";
24375
+ import path34 from "node:path";
24332
24376
  var MIGRATION_PENDING_NOTE = "workit migration pending — run `workit task status`";
24333
24377
  var migrationPending = (result) => !result.ok && result.code === "needs_input" && (result.error ?? "").startsWith(MIGRATION_PENDING);
24334
24378
  var boundTo = (entry, session) => entry.sessions.some((item) => item.host === session.host && item.handle === session.handle);
@@ -24416,7 +24460,7 @@ function entryCompactContext(store, entry, session, context) {
24416
24460
  current: () => recentSignal(store.root)
24417
24461
  };
24418
24462
  const observed = task?.data.evidence.some(isObservedCheck) ?? false;
24419
- const files = (task?.data.decisions ?? []).flatMap((decision) => decision.data.binding.contentRefs.flatMap((ref) => ref.kind === "file" ? [path33.resolve(store.root, ref.path)] : []));
24463
+ const files = (task?.data.decisions ?? []).flatMap((decision) => decision.data.binding.contentRefs.flatMap((ref) => ref.kind === "file" ? [path34.resolve(store.root, ref.path)] : []));
24420
24464
  const observedFiles = filesKey(files);
24421
24465
  const compact = compactContext(store, context, entry?.id ?? null, freshness, origin && { origin: origin.origin, taskId: origin.entry.id });
24422
24466
  if (!compact.ok || !compact.data)
@@ -24515,8 +24559,8 @@ var isAllowedWorkitCommand = (command) => {
24515
24559
  };
24516
24560
  // packages/workit-core/src/core/heavy-rules.ts
24517
24561
  import fs23 from "node:fs";
24518
- import os7 from "node:os";
24519
- import path34 from "node:path";
24562
+ import os8 from "node:os";
24563
+ import path35 from "node:path";
24520
24564
  var EMPTY2 = () => ({ deny: [], allow: [] });
24521
24565
  var readText3 = (file) => {
24522
24566
  try {
@@ -24557,23 +24601,23 @@ function parseJsonc(text) {
24557
24601
  return JSON.parse(out.replace(/,(\s*[}\]])/gu, "$1"));
24558
24602
  }
24559
24603
  function gitTop(cwd) {
24560
- for (let dir = path34.resolve(cwd);; dir = path34.dirname(dir)) {
24561
- if (fs23.existsSync(path34.join(dir, ".git")))
24604
+ for (let dir = path35.resolve(cwd);; dir = path35.dirname(dir)) {
24605
+ if (fs23.existsSync(path35.join(dir, ".git")))
24562
24606
  return dir;
24563
- if (path34.dirname(dir) === dir)
24607
+ if (path35.dirname(dir) === dir)
24564
24608
  return null;
24565
24609
  }
24566
24610
  }
24567
24611
  var projectDirs = (cwd) => {
24568
24612
  const top = gitTop(cwd);
24569
24613
  const dirs = [];
24570
- for (let dir = path34.resolve(cwd);; dir = path34.dirname(dir)) {
24614
+ for (let dir = path35.resolve(cwd);; dir = path35.dirname(dir)) {
24571
24615
  dirs.push(dir);
24572
- if (!top || dir === top || path34.dirname(dir) === dir)
24616
+ if (!top || dir === top || path35.dirname(dir) === dir)
24573
24617
  return dirs;
24574
24618
  }
24575
24619
  };
24576
- var homeOf = (env) => env.HOME || os7.homedir();
24620
+ var homeOf = (env) => env.HOME || os8.homedir();
24577
24621
  var CLAUDE_MANAGED = {
24578
24622
  linux: "/etc/claude-code/managed-settings.json",
24579
24623
  darwin: "/Library/Application Support/ClaudeCode/managed-settings.json",
@@ -24581,12 +24625,12 @@ var CLAUDE_MANAGED = {
24581
24625
  };
24582
24626
  function claudeSettingsFiles(cwd, env, platform = process.platform) {
24583
24627
  const project = env.CLAUDE_PROJECT_DIR || gitTop(cwd) || cwd;
24584
- const user = env.CLAUDE_CONFIG_DIR || path34.join(homeOf(env), ".claude");
24628
+ const user = env.CLAUDE_CONFIG_DIR || path35.join(homeOf(env), ".claude");
24585
24629
  return [
24586
24630
  ...CLAUDE_MANAGED[platform] ? [CLAUDE_MANAGED[platform]] : [],
24587
- path34.join(user, "settings.json"),
24588
- path34.join(project, ".claude", "settings.json"),
24589
- path34.join(project, ".claude", "settings.local.json")
24631
+ path35.join(user, "settings.json"),
24632
+ path35.join(project, ".claude", "settings.json"),
24633
+ path35.join(project, ".claude", "settings.local.json")
24590
24634
  ];
24591
24635
  }
24592
24636
  var bashPattern = (entry) => {
@@ -24676,10 +24720,10 @@ var opencodeConfig = (value, rules) => {
24676
24720
  function opencodeRules(cwd, env = process.env) {
24677
24721
  const rules = EMPTY2();
24678
24722
  try {
24679
- const config = env.XDG_CONFIG_HOME || path34.join(homeOf(env), ".config");
24723
+ const config = env.XDG_CONFIG_HOME || path35.join(homeOf(env), ".config");
24680
24724
  const files = [
24681
- ...OPENCODE_NAMES.map((name) => path34.join(config, "opencode", name)),
24682
- ...projectDirs(cwd).flatMap((dir) => OPENCODE_NAMES.flatMap((name) => [path34.join(dir, name), path34.join(dir, ".opencode", name)])),
24725
+ ...OPENCODE_NAMES.map((name) => path35.join(config, "opencode", name)),
24726
+ ...projectDirs(cwd).flatMap((dir) => OPENCODE_NAMES.flatMap((name) => [path35.join(dir, name), path35.join(dir, ".opencode", name)])),
24683
24727
  ...env.OPENCODE_CONFIG ? [env.OPENCODE_CONFIG] : []
24684
24728
  ];
24685
24729
  for (const file of files) {
@@ -24723,9 +24767,9 @@ var codexRule = (body) => {
24723
24767
  function codexRules(cwd, env = process.env) {
24724
24768
  const rules = EMPTY2();
24725
24769
  try {
24726
- const home = env.CODEX_HOME || path34.join(homeOf(env), ".codex");
24770
+ const home = env.CODEX_HOME || path35.join(homeOf(env), ".codex");
24727
24771
  const top = gitTop(cwd) ?? cwd;
24728
- for (const dir of [path34.join(home, "rules"), path34.join(top, ".codex", "rules")]) {
24772
+ for (const dir of [path35.join(home, "rules"), path35.join(top, ".codex", "rules")]) {
24729
24773
  let files;
24730
24774
  try {
24731
24775
  files = fs23.readdirSync(dir).filter((name) => name.endsWith(".rules"));
@@ -24735,7 +24779,7 @@ function codexRules(cwd, env = process.env) {
24735
24779
  return "unreadable";
24736
24780
  }
24737
24781
  for (const name of files) {
24738
- const text = readText3(path34.join(dir, name)) ?? "";
24782
+ const text = readText3(path35.join(dir, name)) ?? "";
24739
24783
  for (const part of text.split(/\bprefix_rule\s*\(/u).slice(1)) {
24740
24784
  const rule = codexRule(part);
24741
24785
  if (!rule)
@@ -24754,8 +24798,8 @@ function cursorRules(cwd, env = process.env) {
24754
24798
  try {
24755
24799
  const top = gitTop(cwd) ?? cwd;
24756
24800
  for (const file of [
24757
- path34.join(homeOf(env), ".cursor", "cli-config.json"),
24758
- path34.join(top, ".cursor", "cli.json")
24801
+ path35.join(homeOf(env), ".cursor", "cli-config.json"),
24802
+ path35.join(top, ".cursor", "cli.json")
24759
24803
  ]) {
24760
24804
  const text = readText3(file);
24761
24805
  if (text === null)
@@ -24830,10 +24874,10 @@ function wrapAllowed(read, words, command, options = {}) {
24830
24874
 
24831
24875
  // packages/workit-core/src/core/heavy.ts
24832
24876
  import fs24 from "node:fs";
24833
- import path35 from "node:path";
24877
+ import path36 from "node:path";
24834
24878
  var stateDir2 = (env, platform = process.platform) => stateDir(env, platform);
24835
24879
  var HEAVY_COMMANDS_FILE = "heavy-commands.json";
24836
- var heavyCommandsFile = (env) => path35.join(stateDir2(env), HEAVY_COMMANDS_FILE);
24880
+ var heavyCommandsFile = (env) => path36.join(stateDir2(env), HEAVY_COMMANDS_FILE);
24837
24881
  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;
24838
24882
  var INFO_FLAGS = new Set(["--version", "-v", "-V", "--help", "-h", "help", "version"]);
24839
24883
  var WATCH_FLAG = /^(?:--watch(?:All)?(?:=.*)?|-w|--serve)$/u;
@@ -25108,7 +25152,7 @@ function machinePatterns(env) {
25108
25152
  return isRecord5(value) ? stringList(value.patterns) : [];
25109
25153
  }
25110
25154
  function repoPatterns(cwd) {
25111
- return repoHeavyCommands(gitTop(cwd) ?? path35.resolve(cwd));
25155
+ return repoHeavyCommands(gitTop(cwd) ?? path36.resolve(cwd));
25112
25156
  }
25113
25157
  function heavyLines(lines, options) {
25114
25158
  const found = [];
@@ -25186,12 +25230,12 @@ function heavyPlan(command, options) {
25186
25230
  }
25187
25231
  function workitOnPath2(env = process.env) {
25188
25232
  const names = process.platform === "win32" ? ["workit.exe", "workit.cmd", "workit"] : ["workit"];
25189
- for (const dir of (env.PATH ?? "").split(path35.delimiter))
25233
+ for (const dir of (env.PATH ?? "").split(path36.delimiter))
25190
25234
  for (const name of names) {
25191
25235
  if (!dir)
25192
25236
  continue;
25193
25237
  try {
25194
- fs24.accessSync(path35.join(dir, name), fs24.constants.X_OK);
25238
+ fs24.accessSync(path36.join(dir, name), fs24.constants.X_OK);
25195
25239
  return true;
25196
25240
  } catch {}
25197
25241
  }
@@ -25209,7 +25253,7 @@ function leaseRewrite(command) {
25209
25253
 
25210
25254
  // packages/workit-core/src/core/heavy-words.ts
25211
25255
  import fs25 from "node:fs";
25212
- import path36 from "node:path";
25256
+ import path37 from "node:path";
25213
25257
  var HEAVY_WORDS = new Set(("npm npx pnpm pnpx yarn bun bunx deno corepack make gmake docker podman nerdctl " + "python python3 py uv poetry pdm pipenv hatch rye bundle rake nx " + "jest vitest mocha ava tap karma jasmine nyc c8 tsc vue-tsc svelte-check eslint stylelint " + "tslint webpack webpack-cli rollup parcel tsup vite next nuxt nuxi astro ng react-scripts " + "playwright cypress wdio testcafe turbo lerna sonar-scanner sonarless sonarless-mcp go " + "golangci-lint gotestsum staticcheck cargo mvn mvnw gradle gradlew ant sbt bazel bazelisk " + "buck2 dotnet msbuild pytest py.test tox nox mypy pyright pylint coverage maturin pip pip3 " + "rspec rails phpunit pest phpstan psalm composer mix swift xcodebuild flutter dart pod cmake " + "ninja meson ctest scons docker-compose buildah earthly").split(" "));
25214
25258
  var wordsOf = (command) => command.split(/[\s;&|()<>`'"]+/u).map((word) => (word.split(/[\\/]/u).at(-1) ?? "").toLowerCase().replace(/\.(?:exe|cmd|bat)$/u, "")).filter(Boolean);
25215
25259
  var stateDir3 = (env) => stateDir(env);
@@ -25222,15 +25266,15 @@ var readJson2 = (file) => {
25222
25266
  };
25223
25267
  var patternWords = (cwd, env) => {
25224
25268
  const patterns = [];
25225
- const machine = readJson2(path36.join(stateDir3(env), "heavy-commands.json"));
25269
+ const machine = readJson2(path37.join(stateDir3(env), "heavy-commands.json"));
25226
25270
  if (Array.isArray(machine?.patterns))
25227
25271
  patterns.push(...machine.patterns);
25228
- for (let dir = path36.resolve(cwd);; dir = path36.dirname(dir)) {
25229
- if (fs25.existsSync(path36.join(dir, ".git"))) {
25272
+ for (let dir = path37.resolve(cwd);; dir = path37.dirname(dir)) {
25273
+ if (fs25.existsSync(path37.join(dir, ".git"))) {
25230
25274
  patterns.push(...repoHeavyCommands(dir));
25231
25275
  break;
25232
25276
  }
25233
- if (path36.dirname(dir) === dir)
25277
+ if (path37.dirname(dir) === dir)
25234
25278
  break;
25235
25279
  }
25236
25280
  const words = new Set;
@@ -25293,16 +25337,16 @@ function heavyGate(cwd, command, options) {
25293
25337
  }
25294
25338
  }
25295
25339
  // packages/workit-core/src/hooks/write-gate.ts
25296
- import { existsSync as existsSync11, realpathSync as realpathSync8, statSync as statSync4 } from "node:fs";
25297
- import os9 from "node:os";
25298
- import path38 from "node:path";
25340
+ import { existsSync as existsSync12, realpathSync as realpathSync9, statSync as statSync4 } from "node:fs";
25341
+ import os10 from "node:os";
25342
+ import path39 from "node:path";
25299
25343
 
25300
25344
  // packages/workit-core/src/core/live-session.ts
25301
25345
  import { spawnSync as spawnSync22 } from "node:child_process";
25302
25346
  import { createHash as createHash17 } from "node:crypto";
25303
25347
  import fs26 from "node:fs";
25304
- import os8 from "node:os";
25305
- import path37 from "node:path";
25348
+ import os9 from "node:os";
25349
+ import path38 from "node:path";
25306
25350
  var LIVE_SESSION_TTL_MS = 15 * 60000;
25307
25351
  var HEARTBEAT_EVERY_MS = 30000;
25308
25352
  var liveProbe = {
@@ -25376,15 +25420,15 @@ var liveOwner = (input, transport, env = process.env) => {
25376
25420
  };
25377
25421
  };
25378
25422
  var checkoutOf = (target) => {
25379
- let dir = path37.resolve(target);
25380
- while (!fs26.existsSync(dir) && path37.dirname(dir) !== dir)
25381
- dir = path37.dirname(dir);
25423
+ let dir = path38.resolve(target);
25424
+ while (!fs26.existsSync(dir) && path38.dirname(dir) !== dir)
25425
+ dir = path38.dirname(dir);
25382
25426
  if (fs26.existsSync(dir) && !fs26.statSync(dir).isDirectory())
25383
- dir = path37.dirname(dir);
25384
- const parts = dir.split(path37.sep);
25427
+ dir = path38.dirname(dir);
25428
+ const parts = dir.split(path38.sep);
25385
25429
  const dotGit = parts.lastIndexOf(".git");
25386
25430
  if (dotGit > 0)
25387
- dir = parts.slice(0, dotGit).join(path37.sep) || path37.sep;
25431
+ dir = parts.slice(0, dotGit).join(path38.sep) || path38.sep;
25388
25432
  const location = resolveStore(dir);
25389
25433
  if (location instanceof Error || !location.shared || !location.top)
25390
25434
  return null;
@@ -25394,9 +25438,9 @@ var checkoutOf = (target) => {
25394
25438
  } catch {}
25395
25439
  return top;
25396
25440
  };
25397
- var markerFile2 = (top) => path37.join(resolveStateDir(), "live-sessions", `${createHash17("sha256").update(checkoutKey(top)).digest("hex").slice(0, 32)}.json`);
25441
+ var markerFile2 = (top) => path38.join(resolveStateDir(), "live-sessions", `${createHash17("sha256").update(checkoutKey(top)).digest("hex").slice(0, 32)}.json`);
25398
25442
  var checkoutKey = (top, platform = process.platform) => {
25399
- let key = path37.resolve(top);
25443
+ let key = path38.resolve(top);
25400
25444
  try {
25401
25445
  key = fs26.realpathSync.native(key);
25402
25446
  } catch {}
@@ -25427,7 +25471,7 @@ var isLive = (marker, deps) => {
25427
25471
  const age = ageOf2(marker, deps.now ?? new Date);
25428
25472
  if (age > (deps.ttlMs ?? LIVE_SESSION_TTL_MS))
25429
25473
  return false;
25430
- if (marker.machine !== (deps.machine ?? os8.hostname()) || marker.pid === null)
25474
+ if (marker.machine !== (deps.machine ?? os9.hostname()) || marker.pid === null)
25431
25475
  return true;
25432
25476
  if (!(deps.alive ?? processAlive)(marker.pid))
25433
25477
  return false;
@@ -25456,7 +25500,7 @@ var liveConflict = (target, owner, deps = {}) => {
25456
25500
  const marker = readMarker(file);
25457
25501
  if (!marker || sameLead(marker, owner) || !isLive(marker, deps))
25458
25502
  return null;
25459
- if (sameOwner(marker, owner, deps.machine ?? os8.hostname()))
25503
+ if (sameOwner(marker, owner, deps.machine ?? os9.hostname()))
25460
25504
  return null;
25461
25505
  return { marker, file, ageMs: ageOf2(marker, deps.now ?? new Date), checkout };
25462
25506
  } catch {
@@ -25470,7 +25514,7 @@ var claimLiveSession = (target, owner, deps = {}) => {
25470
25514
  return;
25471
25515
  const file = markerFile2(checkout);
25472
25516
  const now = deps.now ?? new Date;
25473
- const machine = deps.machine ?? os8.hostname();
25517
+ const machine = deps.machine ?? os9.hostname();
25474
25518
  const current = readMarker(file);
25475
25519
  if (current) {
25476
25520
  const age = ageOf2(current, now);
@@ -25491,7 +25535,7 @@ var claimLiveSession = (target, owner, deps = {}) => {
25491
25535
  checkout,
25492
25536
  heartbeatAt: now.toISOString()
25493
25537
  };
25494
- fs26.mkdirSync(path37.dirname(file), { recursive: true });
25538
+ fs26.mkdirSync(path38.dirname(file), { recursive: true });
25495
25539
  const temp = `${file}.${process.pid}.tmp`;
25496
25540
  fs26.writeFileSync(temp, JSON.stringify(marker));
25497
25541
  fs26.renameSync(temp, file);
@@ -25503,22 +25547,22 @@ var NONE3 = { kind: "none" };
25503
25547
  var CASE_INSENSITIVE = process.platform === "darwin" || process.platform === "win32";
25504
25548
  var canonical3 = (file) => {
25505
25549
  let rest = "";
25506
- for (let dir = path38.resolve(file);; dir = path38.dirname(dir)) {
25550
+ for (let dir = path39.resolve(file);; dir = path39.dirname(dir)) {
25507
25551
  try {
25508
- return path38.join(realpathSync8.native(dir), rest);
25552
+ return path39.join(realpathSync9.native(dir), rest);
25509
25553
  } catch {
25510
- if (path38.dirname(dir) === dir)
25511
- return path38.resolve(file);
25512
- rest = rest ? path38.join(path38.basename(dir), rest) : path38.basename(dir);
25554
+ if (path39.dirname(dir) === dir)
25555
+ return path39.resolve(file);
25556
+ rest = rest ? path39.join(path39.basename(dir), rest) : path39.basename(dir);
25513
25557
  }
25514
25558
  }
25515
25559
  };
25516
25560
  var exempt = (cwd, root, file, plans) => {
25517
25561
  const fold = (value) => CASE_INSENSITIVE ? value.toLowerCase() : value;
25518
- const relative = path38.relative(fold(canonical3(root)), fold(canonical3(path38.resolve(cwd, file))));
25519
- if (relative.startsWith("..") || path38.isAbsolute(relative))
25562
+ const relative = path39.relative(fold(canonical3(root)), fold(canonical3(path39.resolve(cwd, file))));
25563
+ if (relative.startsWith("..") || path39.isAbsolute(relative))
25520
25564
  return true;
25521
- const posix = relative.split(path38.sep).join("/");
25565
+ const posix = relative.split(path39.sep).join("/");
25522
25566
  const segments = posix.split("/");
25523
25567
  return /\.mdx?$/i.test(posix) || segments[0] === "docs" || segments.includes("plans") || [...plans].some((plan) => fold(plan) === posix);
25524
25568
  };
@@ -25869,10 +25913,10 @@ var linkSources = (args, at) => {
25869
25913
  const sources = names.filter((name, index) => into >= 0 ? name !== dest : index < names.length - 1 || names.length === 1);
25870
25914
  const target = dest === undefined ? null : at(dest);
25871
25915
  const symbolic = args.some((arg) => /^-[a-zA-Z]*s|^--symbolic$/.test(arg));
25872
- const base = target === null ? null : into >= 0 || sources.length > 1 || existsSync11(target) || /[\\/]$/.test(dest ?? "") ? target : path38.dirname(target);
25916
+ const base = target === null ? null : into >= 0 || sources.length > 1 || existsSync12(target) || /[\\/]$/.test(dest ?? "") ? target : path39.dirname(target);
25873
25917
  return sources.flatMap((source) => {
25874
- if (symbolic && base !== null && !path38.isAbsolute(homeExpanded(source)))
25875
- return [path38.resolve(base, source)];
25918
+ if (symbolic && base !== null && !path39.isAbsolute(homeExpanded(source)))
25919
+ return [path39.resolve(base, source)];
25876
25920
  const resolved = at(source);
25877
25921
  return resolved ? [resolved] : [];
25878
25922
  });
@@ -25901,7 +25945,7 @@ var shellWrites = (command, depth = 0) => {
25901
25945
  return { writes: true, targets: unknown ? null : targets };
25902
25946
  };
25903
25947
  var cache3 = new Map;
25904
- var planKeyOf = (root, plans) => [...plans].map((file) => fileSignature(path38.resolve(root, file)) ?? "-").join("\x00");
25948
+ var planKeyOf = (root, plans) => [...plans].map((file) => fileSignature(path39.resolve(root, file)) ?? "-").join("\x00");
25905
25949
  var gateFor = (cwd) => {
25906
25950
  const store = new TaskStore(cwd);
25907
25951
  const listed = store.listTaskIndex();
@@ -25981,13 +26025,13 @@ var gitMutationDirs = (cwd, command, dialect) => {
25981
26025
  return [];
25982
26026
  if (sub === "stash" && ["list", "show"].includes(rest[0] ?? ""))
25983
26027
  return [];
25984
- return [path38.resolve(cwd, invocation.dir ?? ".")];
26028
+ return [path39.resolve(cwd, invocation.dir ?? ".")];
25985
26029
  });
25986
26030
  };
25987
26031
  var CD2 = new Set(["cd", "chdir", "set-location", "sl"]);
25988
26032
  var PUSHD2 = new Set(["pushd", "push-location"]);
25989
26033
  var POPD2 = new Set(["popd", "pop-location"]);
25990
- var UNKNOWN_DIR = path38.resolve(path38.parse(process.cwd()).root, ".workit-unknown-dir");
26034
+ var UNKNOWN_DIR = path39.resolve(path39.parse(process.cwd()).root, ".workit-unknown-dir");
25991
26035
  var cdInto = (dir, words, strict = false, vars = new Map) => {
25992
26036
  const lost = strict ? UNKNOWN_DIR : undefined;
25993
26037
  const found = words.slice(1).find((word) => !word.startsWith("-") || word === "-");
@@ -25997,7 +26041,7 @@ var cdInto = (dir, words, strict = false, vars = new Map) => {
25997
26041
  return lost;
25998
26042
  if (dir === undefined)
25999
26043
  return lost;
26000
- return target === undefined ? os9.homedir() : path38.resolve(dir, target);
26044
+ return target === undefined ? os10.homedir() : path39.resolve(dir, target);
26001
26045
  };
26002
26046
  var quoteWord2 = (word) => /^[\w@%+=:,./-]+$/.test(word) ? word : `'${word.replaceAll("'", "'\\''")}'`;
26003
26047
  var expandVars = (text, vars) => vars.size === 0 || !text.includes("$") ? text : text.replace(/\$(?:(\w+)|\{(\w+)\})/g, (whole, bare, braced) => {
@@ -26131,7 +26175,7 @@ var untrustedVars = (segments) => {
26131
26175
  }
26132
26176
  return { all, names };
26133
26177
  };
26134
- var UNKNOWN_VAR = path38.resolve(path38.parse(process.cwd()).root, ".workit-unknown-var");
26178
+ var UNKNOWN_VAR = path39.resolve(path39.parse(process.cwd()).root, ".workit-unknown-var");
26135
26179
  var REFERENCE = /\$\{(\w+)[^}]*\}|\$(\w+)|\$\([^)]*\)?|`[^`]*`?/g;
26136
26180
  var unresolvedRefs = (text) => [
26137
26181
  ...new Set([...text.matchAll(REFERENCE)].map((match) => {
@@ -26141,7 +26185,7 @@ var unresolvedRefs = (text) => [
26141
26185
  ];
26142
26186
  var unknownVarTarget = (text) => {
26143
26187
  const refs = unresolvedRefs(text);
26144
- return path38.join(UNKNOWN_VAR, (refs.length > 0 ? refs : [text]).map(encodeURIComponent).join("+"));
26188
+ return path39.join(UNKNOWN_VAR, (refs.length > 0 ? refs : [text]).map(encodeURIComponent).join("+"));
26145
26189
  };
26146
26190
  var applyOperator = (value, operator) => {
26147
26191
  if (operator === "")
@@ -26199,18 +26243,18 @@ var mktempPath = (value, dir) => {
26199
26243
  template = arg;
26200
26244
  }
26201
26245
  if (base === null && (temp || template === undefined))
26202
- base = os9.tmpdir();
26246
+ base = os10.tmpdir();
26203
26247
  const name = homeExpanded(template ?? "tmp.XXXXXXXXXX");
26204
- if (path38.isAbsolute(name))
26248
+ if (path39.isAbsolute(name))
26205
26249
  return name;
26206
26250
  const from = base === null ? dir : homeExpanded(base);
26207
- if (from === undefined || !path38.isAbsolute(from) && dir === undefined)
26251
+ if (from === undefined || !path39.isAbsolute(from) && dir === undefined)
26208
26252
  return null;
26209
- return path38.resolve(dir ?? from, from, name);
26253
+ return path39.resolve(dir ?? from, from, name);
26210
26254
  };
26211
26255
  var homeExpanded = (file) => {
26212
26256
  const match = /^(?:~|\$HOME|\$\{HOME\})(?=\/|$)/.exec(file);
26213
- return match ? (process.env.HOME || os9.homedir()) + file.slice(match[0].length) : file;
26257
+ return match ? (process.env.HOME || os10.homedir()) + file.slice(match[0].length) : file;
26214
26258
  };
26215
26259
  var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherited = new Map) => {
26216
26260
  const targets = [];
@@ -26226,9 +26270,9 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
26226
26270
  const home = homeExpanded(text);
26227
26271
  if (strict && unresolvedRefs(home).length > 0)
26228
26272
  return [unknownVarTarget(home)];
26229
- if (path38.isAbsolute(home))
26273
+ if (path39.isAbsolute(home))
26230
26274
  return [home];
26231
- return base === undefined ? [] : [path38.resolve(base, home)];
26275
+ return base === undefined ? [] : [path39.resolve(base, home)];
26232
26276
  });
26233
26277
  const at = (file) => {
26234
26278
  const all = atAll(file);
@@ -26370,7 +26414,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
26370
26414
  const here = segment.unanalyzable ? DIR_TARGET : `${OPAQUE_TARGET}${encodeURIComponent(runner?.split(/[\\/]/).at(-1) ?? "a command")}`;
26371
26415
  for (const file of opaque ?? [])
26372
26416
  for (const resolved of atAll(file))
26373
- targets.push(file === "." ? path38.join(resolved, here) : resolved);
26417
+ targets.push(file === "." ? path39.join(resolved, here) : resolved);
26374
26418
  const ln = words.findIndex((word) => /^ln$/i.test(word.split(/[\\/]/).at(-1) ?? ""));
26375
26419
  if (ln >= 0 && words.slice(0, ln).every((word) => PREFIXES2.has(word)))
26376
26420
  targets.push(...linkSources(words.slice(ln + 1), at));
@@ -26381,7 +26425,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
26381
26425
  const edits = editsOf(body);
26382
26426
  if (edits === null) {
26383
26427
  if (dir !== undefined)
26384
- targets.push(path38.join(dir, DIR_TARGET));
26428
+ targets.push(path39.join(dir, DIR_TARGET));
26385
26429
  } else
26386
26430
  for (const file of edits)
26387
26431
  targets.push(...atAll(file));
@@ -26389,7 +26433,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
26389
26433
  for (const invocation of workitInvocations(body.map(quoteWord2).join(" "), "posix")) {
26390
26434
  const { at: runsIn, args } = workitCwd(dir, invocation, atAll);
26391
26435
  if (args[0] === "git" && MUTATING_WORKIT_GIT.has(args[1] ?? "") && !inert(args.slice(2), ""))
26392
- targets.push(...runsIn.map((runs) => path38.join(runs, DIR_TARGET)));
26436
+ targets.push(...runsIn.map((runs) => path39.join(runs, DIR_TARGET)));
26393
26437
  }
26394
26438
  }
26395
26439
  return targets;
@@ -26410,7 +26454,7 @@ var shellMutationTargets = (cwd, command, dialect = "posix", strict = false) =>
26410
26454
  try {
26411
26455
  return [
26412
26456
  ...segmentTargets(cwd, command, dialect, 0, strict),
26413
- ...gitMutationDirs(cwd, command, dialect).map((dir) => path38.join(dir, DIR_TARGET))
26457
+ ...gitMutationDirs(cwd, command, dialect).map((dir) => path39.join(dir, DIR_TARGET))
26414
26458
  ];
26415
26459
  } catch {
26416
26460
  return [];
@@ -26447,7 +26491,7 @@ var liveDeny = ({ marker, checkout, ageMs, file }) => {
26447
26491
  var guarded = (targets) => {
26448
26492
  const seen = new Set;
26449
26493
  return targets.filter((target) => {
26450
- const dir = path38.dirname(target);
26494
+ const dir = path39.dirname(target);
26451
26495
  if (seen.has(dir))
26452
26496
  return false;
26453
26497
  seen.add(dir);
@@ -26468,7 +26512,7 @@ var claimAll = (owner, targets, deps) => {
26468
26512
  for (const target of guarded(targets))
26469
26513
  claimLiveSession(target, owner, deps);
26470
26514
  };
26471
- var liveTargets = (cwd, paths) => paths?.length ? paths.map((file) => path38.resolve(cwd, file)) : [path38.join(cwd, DIR_TARGET)];
26515
+ var liveTargets = (cwd, paths) => paths?.length ? paths.map((file) => path39.resolve(cwd, file)) : [path39.join(cwd, DIR_TARGET)];
26472
26516
  var issuedTarget = (cwd, targets) => {
26473
26517
  const state = resolveStateDir();
26474
26518
  const found = targets.find((target) => underIssued(state, cwd, homeExpanded(target), process.platform, canonical3));
@@ -26476,7 +26520,7 @@ var issuedTarget = (cwd, targets) => {
26476
26520
  };
26477
26521
  var underIssued = (state, cwd, target, platform = process.platform, real = (file) => file) => {
26478
26522
  const win = platform === "win32";
26479
- const p = win ? path38.win32 : path38.posix;
26523
+ const p = win ? path39.win32 : path39.posix;
26480
26524
  const fold = (value) => win || platform === "darwin" ? value.toLowerCase() : value;
26481
26525
  const named = win ? target.replace(/^\/([a-zA-Z])(?=\/|$)/, "$1:") : target;
26482
26526
  const relative = p.relative(fold(real(p.resolve(state))), fold(real(p.resolve(cwd, named))));
@@ -26570,10 +26614,10 @@ import { spawnSync as spawnSync23 } from "node:child_process";
26570
26614
 
26571
26615
  // packages/workit-core/src/ci-waiter.ts
26572
26616
  import fs27 from "node:fs";
26573
- import path39 from "node:path";
26617
+ import path40 from "node:path";
26574
26618
  var waiterFile = (cwd, pr) => {
26575
26619
  const common = gitCommonDir(cwd);
26576
- return common ? path39.join(common, "workit", "ci-waits", `pr-${pr}.json`) : null;
26620
+ return common ? path40.join(common, "workit", "ci-waits", `pr-${pr}.json`) : null;
26577
26621
  };
26578
26622
  var pidAlive2 = (pid) => {
26579
26623
  if (!Number.isSafeInteger(pid) || pid <= 0)
@@ -26914,40 +26958,37 @@ var SKILL_HOST = {
26914
26958
  };
26915
26959
  var PROMPT_INTENTS = [
26916
26960
  [
26917
- "workit-debug",
26918
- /\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
26919
- ],
26920
- [
26921
- "workit-continue",
26922
- /\b(pick up where|where (?:were|did) we|resume (?:the|this|my|our|work|where)|hand ?off)\b/i
26961
+ "debug",
26962
+ /\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
26923
26963
  ],
26924
26964
  [
26925
- "workit-review",
26926
- /\b(blast radius|code review|review (?:the|this|my|PR|pr|#\d+|branch|diff|changes))\b/i
26965
+ "continue",
26966
+ /\b(pick up where|where (were|did) we|resume (the|this|my|our|work|where)|hand ?off)\b/i
26927
26967
  ],
26928
26968
  [
26929
- "workit-ship",
26930
- /\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
26969
+ "review",
26970
+ /\b(blast radius|code review|review (the|this|my|PR|pr|#\d+|branch|diff|changes))\b/i
26931
26971
  ],
26932
- ["workit-bdd", /\b(BDD|TDD|acceptance criteria|Given\/When\/Then)(?![\w/])/],
26933
- ["workit-test-audit", /\b(test audit|audit the tests|tautolog\w*|weak tests)\b/i],
26934
- ["workit-deslop", /\b(deslop|slop|dead code)\b/i],
26935
26972
  [
26936
- "workit-fanout",
26937
- /\b(fan(?: |-)?out|parallelize|parallel agents|agent swarm|swarm of agents)\b/i
26973
+ "ship",
26974
+ /\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
26938
26975
  ],
26939
- ["workit-verify-app", /\b(verify the app|smoke test|prove it works)\b/i],
26940
- ["workit-retro", /\b((?:a|the) retro(?![-\w]|\.\w)|retrospective)/i],
26941
- ["workit-architecture", /\b(deepen (?:the )?modules|architecture (?:review|pass|audit))\b/i],
26976
+ ["bdd", /\b(BDD|TDD|acceptance criteria|Given\/When\/Then)(?![\w/])/],
26977
+ ["test-audit", /\b(test audit|audit the tests|tautolog\w*|weak tests)\b/i],
26978
+ ["deslop", /\b(deslop|slop|dead code)\b/i],
26979
+ ["fanout", /\b(fan( |-)?out|parallelize|parallel agents|agent swarm|swarm of agents)\b/i],
26980
+ ["verify-app", /\b(verify the app|smoke test|prove it works)\b/i],
26981
+ ["retro", /\b((a|the) retro(?![-\w]|\.\w)|retrospective)/i],
26982
+ ["architecture", /\b(deepen (the )?modules|architecture (review|pass|audit))\b/i],
26942
26983
  [
26943
- "workit-shape",
26944
- /\b(brainstorm\w*|grill me|should we|let'?s plan|plan (?:out|how|the|a|for)|(?:write|draft) (?:a|the) spec)\b/i
26984
+ "shape",
26985
+ /\b(brainstorm\w*|grill me|should we|let'?s plan|plan (out|how|the|a|for)|(write|draft) (a|the) spec)\b/i
26945
26986
  ],
26946
26987
  [
26947
- "workit-implement",
26948
- /\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
26988
+ "implement",
26989
+ /\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
26949
26990
  ]
26950
- ];
26991
+ ].map(([name, pattern]) => [`workit-${name}`, pattern]);
26951
26992
  var workitSkillOf = (name) => {
26952
26993
  const bare = name.trim().replace(/^\//, "").toLowerCase();
26953
26994
  const alias = WORKIT_SKILL_ALIASES[bare];
@@ -26956,10 +26997,13 @@ var workitSkillOf = (name) => {
26956
26997
  const skill = bare.replace(/^workit:/, "workit-");
26957
26998
  return WORKIT_METHOD_SKILLS.includes(skill) ? skill : null;
26958
26999
  };
27000
+ var QUOTED = /```[\s\S]*?```|["`“][^"`”\n]*["`”]|\B'[^'\n]*'\B/g;
27001
+ var COMPLAINT = /\b(why \w+ you|you keep|stop \w+ing)\b.*?(?=\b(and|but)\b|[?.,;\n]|$)/gi;
26959
27002
  var promptTrigger = (prompt) => {
26960
- const text = prompt.replace(/```[\s\S]*?```/g, " ").slice(0, 4000);
27003
+ let asking = false;
27004
+ const text = prompt.slice(0, 4000).replace(QUOTED, " ").replace(COMPLAINT, (clause) => (asking ||= /ask|quest/i.test(clause), " "));
26961
27005
  for (const [skill, pattern] of PROMPT_INTENTS) {
26962
- const match = pattern.exec(text);
27006
+ const match = !(asking && skill === "workit-shape") && pattern.exec(text);
26963
27007
  if (match)
26964
27008
  return { skill, trigger: match[1] ?? match[0] };
26965
27009
  }
@@ -26975,19 +27019,7 @@ var loadedSkills = (cwd, session) => {
26975
27019
  loaded.add(row.skill);
26976
27020
  return loaded;
26977
27021
  };
26978
- var READERS = new Set([
26979
- "cat",
26980
- "sed",
26981
- "head",
26982
- "tail",
26983
- "less",
26984
- "more",
26985
- "bat",
26986
- "nl",
26987
- "get-content",
26988
- "gc",
26989
- "type"
26990
- ]);
27022
+ var READERS = new Set("cat sed head tail less more bat nl get-content gc type".split(" "));
26991
27023
  function recordSkillLoad(input, name, via) {
26992
27024
  try {
26993
27025
  const skill = workitSkillOf(name);
@@ -27025,9 +27057,9 @@ var nudgeOnce = (input, session, skill, line) => {
27025
27057
  writeSessionMarker(file, { ...marker, nudged: [...marker.nudged, skill] });
27026
27058
  return line;
27027
27059
  };
27028
- 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.`;
27060
+ 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.`}`;
27029
27061
  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;
27030
- var relayedMessage = (prompt) => /^\s*(?:Another Claude session sent a message\b|<agent-message\s+from=|\[SYSTEM NOTIFICATION\b|<task-notification>)/.test(prompt);
27062
+ var relayedMessage = (prompt) => /^\s*(Another Claude session sent a message\b|<agent-message\s+from=|\[SYSTEM NOTIFICATION\b|<task-notification>)/.test(prompt);
27031
27063
  function promptNudge(input, prompt) {
27032
27064
  try {
27033
27065
  const session = input.session.id;
@@ -27046,7 +27078,7 @@ function promptNudge(input, prompt) {
27046
27078
  return null;
27047
27079
  }
27048
27080
  }
27049
- var WORKIT_DELIVERY = /^(?:pr (?:create|merge)|ci wait|git push)\b/;
27081
+ var WORKIT_DELIVERY = /^(pr (create|merge)|ci wait|git push)\b/;
27050
27082
  var runsWorkitDelivery = (command, dialect) => workitInvocations(command, dialect).some((args) => !args.some((arg) => arg === "--help" || arg === "-h" || arg === "--dry-run") && WORKIT_DELIVERY.test(args.join(" ")));
27051
27083
  var isDeliveryCommand = (cwd, command, dialect = "posix") => rawDelivery(cwd, command, dialect) || runsWorkitDelivery(command, dialect) && inWorkitWorkspace(cwd);
27052
27084
  function shipNudge(input, command) {
@@ -27096,7 +27128,7 @@ var WRITE_TOOLS = new Set([
27096
27128
  ]);
27097
27129
  // packages/workit-core/src/hooks/standing.ts
27098
27130
  import fs28 from "node:fs";
27099
- import path40 from "node:path";
27131
+ import path41 from "node:path";
27100
27132
 
27101
27133
  // packages/workit-core/src/hooks/hosts/claude-code.ts
27102
27134
  var CLAUDE_CODE_DESCRIPTOR = {
@@ -27596,7 +27628,7 @@ var workitRole = (descriptor, agentType) => {
27596
27628
 
27597
27629
  // packages/workit-core/src/hooks/standing.ts
27598
27630
  var readPlans = (store) => {
27599
- const dir = path40.join(store, "fanouts");
27631
+ const dir = path41.join(store, "fanouts");
27600
27632
  let names;
27601
27633
  try {
27602
27634
  names = fs28.readdirSync(dir).filter((name) => name.endsWith(".json"));
@@ -27606,7 +27638,7 @@ var readPlans = (store) => {
27606
27638
  const plans = [];
27607
27639
  for (const name of names) {
27608
27640
  try {
27609
- const raw = JSON.parse(fs28.readFileSync(path40.join(dir, name), "utf8"));
27641
+ const raw = JSON.parse(fs28.readFileSync(path41.join(dir, name), "utf8"));
27610
27642
  if (typeof raw.name !== "string" || !Array.isArray(raw.slices))
27611
27643
  continue;
27612
27644
  const texts = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string" && item !== "") : [];
@@ -27880,11 +27912,11 @@ var PROCESS_START = performance.timeOrigin;
27880
27912
  // packages/workit-core/src/hooks/run.ts
27881
27913
  if (false) {}
27882
27914
  // packages/workit-opencode/src/shared/init-apply.ts
27883
- import path45 from "node:path";
27915
+ import path46 from "node:path";
27884
27916
 
27885
27917
  // packages/workit-core/src/core/gitignore.ts
27886
- import { existsSync as existsSync12, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "node:fs";
27887
- import path41 from "node:path";
27918
+ import { existsSync as existsSync13, readFileSync as readFileSync9, writeFileSync as writeFileSync4 } from "node:fs";
27919
+ import path42 from "node:path";
27888
27920
  var GITIGNORE_ENTRIES = [
27889
27921
  "# workit: SDD working state (never commit)",
27890
27922
  "docs/*/sdd/",
@@ -27904,8 +27936,8 @@ var GITIGNORE_ENTRIES = [
27904
27936
  var ensureProjectGitignore = (workspaceRoot, confirmed) => {
27905
27937
  if (!confirmed)
27906
27938
  return { ok: false, error: "confirmed: true required" };
27907
- const file = path41.join(workspaceRoot, ".gitignore");
27908
- const existing = existsSync12(file) ? readFileSync9(file, "utf8") : "";
27939
+ const file = path42.join(workspaceRoot, ".gitignore");
27940
+ const existing = existsSync13(file) ? readFileSync9(file, "utf8") : "";
27909
27941
  const existingLines = new Set(existing.split(`
27910
27942
  `).map((l) => l.trim()).filter(Boolean));
27911
27943
  const added = [];
@@ -27924,33 +27956,33 @@ var ensureProjectGitignore = (workspaceRoot, confirmed) => {
27924
27956
  ` : "") + append.join(`
27925
27957
  `) + `
27926
27958
  `, "utf8");
27927
- } else if (!existsSync12(file)) {
27959
+ } else if (!existsSync13(file)) {
27928
27960
  writeFileSync4(file, "", "utf8");
27929
27961
  }
27930
27962
  return { ok: true, path: file, added };
27931
27963
  };
27932
27964
 
27933
27965
  // packages/workit-core/src/core/hygiene.ts
27934
- import { existsSync as existsSync13, readFileSync as readFileSync10, readdirSync as readdirSync4, writeFileSync as writeFileSync5 } from "node:fs";
27935
- import path42 from "node:path";
27966
+ import { existsSync as existsSync14, readFileSync as readFileSync10, readdirSync as readdirSync4, writeFileSync as writeFileSync5 } from "node:fs";
27967
+ import path43 from "node:path";
27936
27968
  var repoRoot3 = assetRoot();
27937
- var templatesDir = () => path42.join(repoRoot3, "templates", "hygiene");
27969
+ var templatesDir = () => path43.join(repoRoot3, "templates", "hygiene");
27938
27970
  var packageJson = (root) => {
27939
- if (!existsSync13(path42.join(root, "package.json")))
27971
+ if (!existsSync14(path43.join(root, "package.json")))
27940
27972
  return null;
27941
27973
  try {
27942
- return JSON.parse(readFileSync10(path42.join(root, "package.json"), "utf8"));
27974
+ return JSON.parse(readFileSync10(path43.join(root, "package.json"), "utf8"));
27943
27975
  } catch {
27944
27976
  return null;
27945
27977
  }
27946
27978
  };
27947
27979
  var isOpenSource = (root) => {
27948
- if (existsSync13(path42.join(root, "LICENSE")))
27980
+ if (existsSync14(path43.join(root, "LICENSE")))
27949
27981
  return true;
27950
27982
  const pkg = packageJson(root);
27951
27983
  if (pkg && !pkg.private)
27952
27984
  return true;
27953
- return path42.basename(root) === "workit";
27985
+ return path43.basename(root) === "workit";
27954
27986
  };
27955
27987
  var licenseHolder = (root) => {
27956
27988
  const pkg = packageJson(root);
@@ -27973,13 +28005,13 @@ var planHygieneFiles = (root, opts = {}) => {
27973
28005
  files.push("LICENSE", "CONTRIBUTING.md");
27974
28006
  const planned = [];
27975
28007
  for (const file of files) {
27976
- if (existsSync13(path42.join(root, file)))
28008
+ if (existsSync14(path43.join(root, file)))
27977
28009
  continue;
27978
- const tpl = path42.join(templatesDir(), file);
27979
- if (!existsSync13(tpl))
28010
+ const tpl = path43.join(templatesDir(), file);
28011
+ if (!existsSync14(tpl))
27980
28012
  continue;
27981
- const content = readFileSync10(tpl, "utf8").replace(/<PROJECT>/g, path42.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
27982
- planned.push({ path: path42.join(root, file), content });
28013
+ const content = readFileSync10(tpl, "utf8").replace(/<PROJECT>/g, path43.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
28014
+ planned.push({ path: path43.join(root, file), content });
27983
28015
  }
27984
28016
  return planned;
27985
28017
  };
@@ -27989,19 +28021,19 @@ var ensureHygieneFiles = (root, opts) => {
27989
28021
  const created = [];
27990
28022
  for (const planned of planHygieneFiles(root, opts)) {
27991
28023
  writeFileSync5(planned.path, planned.content, "utf8");
27992
- created.push(path42.basename(planned.path));
28024
+ created.push(path43.basename(planned.path));
27993
28025
  }
27994
28026
  return { ok: true, created };
27995
28027
  };
27996
28028
 
27997
28029
  // packages/workit-core/src/core/init.ts
27998
28030
  import fs29 from "node:fs";
27999
- import path44 from "node:path";
28031
+ import path45 from "node:path";
28000
28032
  import { spawnSync as spawnSync24 } from "node:child_process";
28001
28033
 
28002
28034
  // packages/workit-core/src/core/workspace-branch-policy.ts
28003
28035
  import { mkdirSync as mkdirSync4, readFileSync as readFileSync11, renameSync as renameSync3, rmSync as rmSync2, writeFileSync as writeFileSync6 } from "node:fs";
28004
- import path43 from "node:path";
28036
+ import path44 from "node:path";
28005
28037
  import { isDeepStrictEqual } from "node:util";
28006
28038
  var readFileSafe = (p) => {
28007
28039
  try {
@@ -28012,7 +28044,7 @@ var readFileSafe = (p) => {
28012
28044
  };
28013
28045
  function applyWorkspaceBranchPolicy(opts) {
28014
28046
  const { workspace_root, env = process.env } = opts;
28015
- const dir = path43.join(env.WORKIT_CONFIG ?? configDir2());
28047
+ const dir = path44.join(env.WORKIT_CONFIG ?? configDir2());
28016
28048
  const {
28017
28049
  status,
28018
28050
  path: wsPath,
@@ -28024,7 +28056,7 @@ function applyWorkspaceBranchPolicy(opts) {
28024
28056
  if (status === "malformed" || status === "invalid")
28025
28057
  return { ok: false, error: workspacesError ?? `invalid workspaces.json: ${wsPath}` };
28026
28058
  const detection = detectBranchPolicy(workspace_root);
28027
- const name = String(env.WORKIT_BP_NAME ?? path43.basename(workspace_root));
28059
+ const name = String(env.WORKIT_BP_NAME ?? path44.basename(workspace_root));
28028
28060
  const integration = env.WORKIT_BP_INTEGRATION ?? detection.integration;
28029
28061
  const policy = {
28030
28062
  preset: detection.preset,
@@ -28073,7 +28105,7 @@ function applyWorkspaceBranchPolicy(opts) {
28073
28105
  ok: false,
28074
28106
  error: `workspaces.json changed while applying the branch policy: ${wsPath}`
28075
28107
  };
28076
- mkdirSync4(path43.dirname(wsPath), { recursive: true });
28108
+ mkdirSync4(path44.dirname(wsPath), { recursive: true });
28077
28109
  const tmp = `${wsPath}.${process.pid}.tmp`;
28078
28110
  try {
28079
28111
  writeFileSync6(tmp, JSON.stringify({ ...document, workspaces: next }, null, 2) + `
@@ -28173,7 +28205,7 @@ function initApplyData(action, env = process.env) {
28173
28205
  fs29.mkdirSync(dir, { recursive: true });
28174
28206
  switch (action) {
28175
28207
  case "youtrack_json": {
28176
- const out = path44.join(dir, "youtrack.json");
28208
+ const out = path45.join(dir, "youtrack.json");
28177
28209
  fs29.writeFileSync(out, JSON.stringify(youtrackJsonContent(), null, 2) + `
28178
28210
  `, "utf8");
28179
28211
  return { action, ok: true, path: out };
@@ -28187,10 +28219,10 @@ function initApplyData(action, env = process.env) {
28187
28219
  };
28188
28220
  }
28189
28221
  case "youtrack_scaffold": {
28190
- const jsonOut = path44.join(dir, "youtrack.json");
28222
+ const jsonOut = path45.join(dir, "youtrack.json");
28191
28223
  fs29.writeFileSync(jsonOut, JSON.stringify(youtrackJsonContent(), null, 2) + `
28192
28224
  `, "utf8");
28193
- const configPath = path44.resolve(jsonOut);
28225
+ const configPath = path45.resolve(jsonOut);
28194
28226
  const cfg = readJson3(configPath) ?? {};
28195
28227
  const base = String(cfg.baseUrl ?? "").replace(/\/+$/, "");
28196
28228
  const meeting = String(cfg.meetingIssue ?? "");
@@ -28226,10 +28258,10 @@ function initApplyData(action, env = process.env) {
28226
28258
  };
28227
28259
  }
28228
28260
  case "vcs_scaffold": {
28229
- const jsonOut = path44.join(dir, "vcs.json");
28261
+ const jsonOut = path45.join(dir, "vcs.json");
28230
28262
  fs29.writeFileSync(jsonOut, JSON.stringify(vcsJsonContent(), null, 2) + `
28231
28263
  `, "utf8");
28232
- const configPath = path44.resolve(jsonOut);
28264
+ const configPath = path45.resolve(jsonOut);
28233
28265
  const prev = process.env.WORKIT_VCS_CONFIG;
28234
28266
  process.env.WORKIT_VCS_CONFIG = configPath;
28235
28267
  try {
@@ -28348,7 +28380,7 @@ var executeInitApply = (args, directory, runtime) => {
28348
28380
  protectedNames: args.branch_policy_protected
28349
28381
  }, current);
28350
28382
  writeConfig(next);
28351
- return output(ok({ action: "config", path: path45.join(configDir2(), "config.json"), ...next }));
28383
+ return output(ok({ action: "config", path: path46.join(configDir2(), "config.json"), ...next }));
28352
28384
  }
28353
28385
  const env = Object.fromEntries(Object.entries({
28354
28386
  WORKIT_YT_BASE_URL: args.base_url,
@@ -28364,15 +28396,15 @@ var executeInitApply = (args, directory, runtime) => {
28364
28396
  };
28365
28397
 
28366
28398
  // packages/workit-opencode/src/shared/session.ts
28367
- import { realpathSync as realpathSync9 } from "node:fs";
28368
- import path46 from "node:path";
28399
+ import { realpathSync as realpathSync10 } from "node:fs";
28400
+ import path47 from "node:path";
28369
28401
  var sameWorkspace = (expected, observed) => {
28370
28402
  if (typeof observed !== "string" || !observed)
28371
28403
  return false;
28372
28404
  try {
28373
- return realpathSync9(expected) === realpathSync9(observed);
28405
+ return realpathSync10(expected) === realpathSync10(observed);
28374
28406
  } catch {
28375
- return path46.resolve(expected) === path46.resolve(observed);
28407
+ return path47.resolve(expected) === path47.resolve(observed);
28376
28408
  }
28377
28409
  };
28378
28410
 
@@ -28443,8 +28475,8 @@ var workitFamilyOf = (toolName) => {
28443
28475
  };
28444
28476
 
28445
28477
  // packages/workit-opencode/src/tools/context.ts
28446
- import { realpathSync as realpathSync10 } from "node:fs";
28447
- import path47 from "node:path";
28478
+ import { realpathSync as realpathSync11 } from "node:fs";
28479
+ import path48 from "node:path";
28448
28480
  var createContextTool = () => ({
28449
28481
  description: "Read Git, pull request, YouTrack, issue, changelog, release, or affected-file context.",
28450
28482
  execute: async (args, context) => {
@@ -28454,7 +28486,7 @@ var createContextTool = () => ({
28454
28486
  let root;
28455
28487
  try {
28456
28488
  const cwd = parsed.data.cwd;
28457
- root = realpathSync10(cwd ? path47.resolve(context.directory, cwd) : context.directory);
28489
+ root = realpathSync11(cwd ? path48.resolve(context.directory, cwd) : context.directory);
28458
28490
  } catch {
28459
28491
  return JSON.stringify(failure2("invalid_input", "context target directory cannot be resolved"), null, 2);
28460
28492
  }
@@ -28487,7 +28519,7 @@ var workerCoordinatorFor = (task, worker) => {
28487
28519
  import { spawnSync as spawnSync28 } from "node:child_process";
28488
28520
  import { createHash as createHash19 } from "node:crypto";
28489
28521
  import fs31 from "node:fs";
28490
- import path50 from "node:path";
28522
+ import path51 from "node:path";
28491
28523
 
28492
28524
  // packages/workit-core/src/fanout-landed.ts
28493
28525
  import { spawnSync as spawnSync25 } from "node:child_process";
@@ -28717,12 +28749,12 @@ var NOTICE_TTL_MS = 7 * 86400000;
28717
28749
  import { spawnSync as spawnSync27 } from "node:child_process";
28718
28750
  import { createHash as createHash18, randomBytes as randomBytes4 } from "node:crypto";
28719
28751
  import fs30 from "node:fs";
28720
- import path49 from "node:path";
28752
+ import path50 from "node:path";
28721
28753
 
28722
28754
  // packages/workit-core/src/git/ops.ts
28723
28755
  import { spawnSync as spawnSync26 } from "node:child_process";
28724
- import { copyFileSync as copyFileSync2, existsSync as existsSync14, readdirSync as readdirSync5, readFileSync as readFileSync12, rmSync as rmSync3 } from "node:fs";
28725
- import path48 from "node:path";
28756
+ import { copyFileSync as copyFileSync2, existsSync as existsSync15, readdirSync as readdirSync5, readFileSync as readFileSync12, rmSync as rmSync3 } from "node:fs";
28757
+ import path49 from "node:path";
28726
28758
  var COMMIT_TIMEOUT_MS = 10 * 60000;
28727
28759
  var git5 = (cwd, args, options = {}) => {
28728
28760
  const result = spawnSync26("git", args, {
@@ -28755,18 +28787,18 @@ function operationInProgress(cwd) {
28755
28787
  if (!run.ok)
28756
28788
  return null;
28757
28789
  const found = run.stdout.split(`
28758
- `).map((line) => path48.resolve(cwd, line.trim()));
28790
+ `).map((line) => path49.resolve(cwd, line.trim()));
28759
28791
  const conflicted = () => git5(cwd, ["ls-files", "-u"]).stdout.trim() !== "";
28760
28792
  for (const [index, [, operation]] of markers.entries()) {
28761
28793
  const marker = found[index];
28762
- if (!marker || !existsSync14(marker))
28794
+ if (!marker || !existsSync15(marker))
28763
28795
  continue;
28764
- if (index === 1 && existsSync14(path48.join(marker, "applying")))
28796
+ if (index === 1 && existsSync15(path49.join(marker, "applying")))
28765
28797
  return { operation: "am", commitAllowed: false, branch: null };
28766
- if (index === 0 && existsSync14(path48.join(marker, "amend")) && !conflicted()) {
28798
+ if (index === 0 && existsSync15(path49.join(marker, "amend")) && !conflicted()) {
28767
28799
  let headName = "";
28768
28800
  try {
28769
- headName = readFileSync12(path48.join(marker, "head-name"), "utf8").trim();
28801
+ headName = readFileSync12(path49.join(marker, "head-name"), "utf8").trim();
28770
28802
  } catch {}
28771
28803
  const branch = headName.startsWith("refs/heads/") ? headName.slice("refs/heads/".length) : null;
28772
28804
  return { operation, commitAllowed: branch !== null, branch };
@@ -28894,7 +28926,7 @@ function rebaseInProgress(dir) {
28894
28926
  }
28895
28927
  var scratchDir = (cwd) => {
28896
28928
  const dir = stacksDir(cwd);
28897
- return dir.ok ? path49.join(dir.data, "worktrees") : null;
28929
+ return dir.ok ? path50.join(dir.data, "worktrees") : null;
28898
28930
  };
28899
28931
  function gitRestack(cwd, input) {
28900
28932
  const owner = worktreeOf(cwd, input.branch);
@@ -28909,7 +28941,7 @@ function gitRestack(cwd, input) {
28909
28941
  error: "no store root"
28910
28942
  };
28911
28943
  fs30.mkdirSync(scratch, { recursive: true });
28912
- dir = path49.join(scratch, `${input.branch.replace(/[^A-Za-z0-9._-]+/gu, "_").slice(0, 40)}-${randomBytes4(4).toString("hex")}`);
28944
+ dir = path50.join(scratch, `${input.branch.replace(/[^A-Za-z0-9._-]+/gu, "_").slice(0, 40)}-${randomBytes4(4).toString("hex")}`);
28913
28945
  const added = gitRun4(cwd, ["worktree", "add", "-q", dir, input.branch], GIT_TIMEOUTS.worktree);
28914
28946
  if (!added.ok)
28915
28947
  return {
@@ -28968,7 +29000,7 @@ function stacksDir(cwd) {
28968
29000
  const root = storeRoot(cwd);
28969
29001
  if (!root.ok)
28970
29002
  return stackFail(root.code, root.error, root.unblock);
28971
- return { ok: true, data: path49.join(root.value.root, "stacks") };
29003
+ return { ok: true, data: path50.join(root.value.root, "stacks") };
28972
29004
  }
28973
29005
  var HEARTBEAT_STALE_MS = 2 * 60000;
28974
29006
  var SETTLED_BY_RESTACK = new Set(["checks_pending", "behind_base_required"]);
@@ -29115,7 +29147,7 @@ function fanoutsDir(cwd) {
29115
29147
  const root = storeRoot(cwd);
29116
29148
  if (!root.ok)
29117
29149
  return fanoutFail(root.code, root.error, root.unblock);
29118
- return { ok: true, data: path50.join(root.value.root, "fanouts") };
29150
+ return { ok: true, data: path51.join(root.value.root, "fanouts") };
29119
29151
  }
29120
29152
  function parseStored(raw) {
29121
29153
  if (!isRecord7(raw) || typeof raw.name !== "string" || typeof raw.trunk !== "string")
@@ -29183,7 +29215,7 @@ function readFanout(cwd, name) {
29183
29215
  const dir = fanoutsDir(cwd);
29184
29216
  if (!dir.ok)
29185
29217
  return dir;
29186
- const file = path50.join(dir.data, stackFileName(name));
29218
+ const file = path51.join(dir.data, stackFileName(name));
29187
29219
  let parsed = null;
29188
29220
  try {
29189
29221
  parsed = parseStored(JSON.parse(fs31.readFileSync(file, "utf8")));
@@ -29208,7 +29240,7 @@ function listFanouts(cwd) {
29208
29240
  for (const entry of names) {
29209
29241
  let parsed = null;
29210
29242
  try {
29211
- parsed = parseStored(JSON.parse(fs31.readFileSync(path50.join(dir.data, entry), "utf8")));
29243
+ parsed = parseStored(JSON.parse(fs31.readFileSync(path51.join(dir.data, entry), "utf8")));
29212
29244
  } catch {
29213
29245
  parsed = null;
29214
29246
  }
@@ -30053,7 +30085,7 @@ var childTaskMissing = (store, input) => {
30053
30085
  var childDenial = (identity) => `OpenCode child session has no validated Workit worker: as ${identity} it may only inspect the task summary (workit_task action "inspect") or record evidence or findings (workit_evidence/workit_finding action "record") on an existing task; for anything else the lead assigns it a worker with workit_worker before launching it`;
30054
30086
 
30055
30087
  // packages/workit-opencode/src/v2/shell.ts
30056
- import path51 from "node:path";
30088
+ import path52 from "node:path";
30057
30089
 
30058
30090
  // packages/workit-core/src/hooks/repeat-failure.ts
30059
30091
  import { createHash as createHash20 } from "node:crypto";
@@ -30116,7 +30148,7 @@ var commandOf = (input) => {
30116
30148
  };
30117
30149
  var hookInput = (root, sessionID, id, shell) => ({
30118
30150
  host: "opencode",
30119
- cwd: shell.workdir ? path51.resolve(root, shell.workdir) : root,
30151
+ cwd: shell.workdir ? path52.resolve(root, shell.workdir) : root,
30120
30152
  session: { id: sessionID, agentId: null, agentType: null, parentId: null },
30121
30153
  permissionMode: null,
30122
30154
  transcriptPath: null,
@@ -30391,38 +30423,38 @@ var createStopControl = (root, port) => {
30391
30423
  };
30392
30424
 
30393
30425
  // packages/workit-opencode/src/v2/registry.ts
30394
- import { existsSync as existsSync16, readFileSync as readFileSync13 } from "node:fs";
30395
- import path53 from "node:path";
30426
+ import { existsSync as existsSync17, readFileSync as readFileSync13 } from "node:fs";
30427
+ import path54 from "node:path";
30396
30428
 
30397
30429
  // packages/workit-opencode/src/shared/assets.ts
30398
- import { existsSync as existsSync15, realpathSync as realpathSync11 } from "node:fs";
30399
- import path52 from "node:path";
30430
+ import { existsSync as existsSync16, realpathSync as realpathSync12 } from "node:fs";
30431
+ import path53 from "node:path";
30400
30432
  import { fileURLToPath as fileURLToPath2 } from "node:url";
30401
30433
  var moduleDir = () => {
30402
30434
  try {
30403
- return realpathSync11(path52.dirname(fileURLToPath2(import.meta.url)));
30435
+ return realpathSync12(path53.dirname(fileURLToPath2(import.meta.url)));
30404
30436
  } catch {
30405
- return path52.dirname(fileURLToPath2(import.meta.url));
30437
+ return path53.dirname(fileURLToPath2(import.meta.url));
30406
30438
  }
30407
30439
  };
30408
30440
  var packageRoot2 = () => {
30409
30441
  const dir = moduleDir();
30410
30442
  for (const candidate of [
30411
- path52.resolve(dir, ".."),
30412
- path52.resolve(dir, "..", ".."),
30413
- path52.resolve(dir, "..", "..", "..")
30443
+ path53.resolve(dir, ".."),
30444
+ path53.resolve(dir, "..", ".."),
30445
+ path53.resolve(dir, "..", "..", "..")
30414
30446
  ]) {
30415
- if (existsSync15(path52.join(candidate, "package.json")))
30447
+ if (existsSync16(path53.join(candidate, "package.json")))
30416
30448
  return candidate;
30417
30449
  }
30418
- return path52.resolve(dir, "..");
30450
+ return path53.resolve(dir, "..");
30419
30451
  };
30420
30452
  var skillsRoot = () => {
30421
30453
  const root = packageRoot2();
30422
- const canonical = path52.resolve(root, "..", "workit-core", "skills");
30423
- if (existsSync15(path52.join(root, "src")) && existsSync15(canonical))
30454
+ const canonical = path53.resolve(root, "..", "workit-core", "skills");
30455
+ if (existsSync16(path53.join(root, "src")) && existsSync16(canonical))
30424
30456
  return canonical;
30425
- return path52.join(root, "assets", "skills");
30457
+ return path53.join(root, "assets", "skills");
30426
30458
  };
30427
30459
 
30428
30460
  // packages/workit-opencode/src/v2/registry.ts
@@ -30446,15 +30478,15 @@ var parseFrontmatter = (markdown) => {
30446
30478
  };
30447
30479
  var registerSkills = async (ctx) => {
30448
30480
  const skillsDir = skillsRoot();
30449
- if (!existsSync16(skillsDir))
30481
+ if (!existsSync17(skillsDir))
30450
30482
  return new Set;
30451
30483
  const listed = await ctx.skill.list().catch(() => ({ data: [] }));
30452
- const own = (skill) => typeof skill.path === "string" && path53.resolve(skill.path).startsWith(skillsDir + path53.sep);
30484
+ const own = (skill) => typeof skill.path === "string" && path54.resolve(skill.path).startsWith(skillsDir + path54.sep);
30453
30485
  const userSkills = new Set((listed?.data ?? []).filter((skill) => !own(skill)).map((skill) => skill.id));
30454
30486
  const packaged = new Map;
30455
30487
  for (const id of WORKIT_METHOD_SKILLS) {
30456
- const file = path53.join(skillsDir, id, "SKILL.md");
30457
- if (!userSkills.has(id) && existsSync16(file))
30488
+ const file = path54.join(skillsDir, id, "SKILL.md");
30489
+ if (!userSkills.has(id) && existsSync17(file))
30458
30490
  packaged.set(id, file);
30459
30491
  }
30460
30492
  await ctx.skill.transform((editor) => {
@@ -30500,39 +30532,39 @@ var registerCommands = async (ctx, registeredSkills) => {
30500
30532
  };
30501
30533
 
30502
30534
  // packages/workit-opencode/src/stale-sources.ts
30503
- import { existsSync as existsSync17, readdirSync as readdirSync6 } from "node:fs";
30504
- import path54 from "node:path";
30535
+ import { existsSync as existsSync18, readdirSync as readdirSync6 } from "node:fs";
30536
+ import path55 from "node:path";
30505
30537
  import { fileURLToPath as fileURLToPath3 } from "node:url";
30506
30538
  var typescriptFiles = (directory) => {
30507
- if (!existsSync17(directory))
30539
+ if (!existsSync18(directory))
30508
30540
  return [];
30509
30541
  return readdirSync6(directory, { withFileTypes: true }).flatMap((entry) => {
30510
- const file = path54.join(directory, entry.name);
30542
+ const file = path55.join(directory, entry.name);
30511
30543
  return entry.isDirectory() ? typescriptFiles(file) : entry.isFile() && file.endsWith(".ts") ? [file] : [];
30512
30544
  });
30513
30545
  };
30514
30546
  var pluginSourceFiles = [
30515
30547
  ...new Set([
30516
30548
  fileURLToPath3(import.meta.url),
30517
- ...typescriptFiles(path54.join(packageRoot2(), "src")),
30518
- path54.join(packageRoot2(), "..", "workit-core", "src", "core.ts"),
30519
- ...typescriptFiles(path54.join(packageRoot2(), "..", "workit-core", "src", "core"))
30549
+ ...typescriptFiles(path55.join(packageRoot2(), "src")),
30550
+ path55.join(packageRoot2(), "..", "workit-core", "src", "core.ts"),
30551
+ ...typescriptFiles(path55.join(packageRoot2(), "..", "workit-core", "src", "core"))
30520
30552
  ])
30521
- ].filter((file) => existsSync17(file)).toSorted();
30553
+ ].filter((file) => existsSync18(file)).toSorted();
30522
30554
 
30523
30555
  // packages/workit-core/src/core/cli-locate.ts
30524
- import { closeSync as closeSync2, existsSync as existsSync18, openSync as openSync2, readSync } from "node:fs";
30525
- import path55 from "node:path";
30556
+ import { closeSync as closeSync2, existsSync as existsSync19, openSync as openSync2, readSync } from "node:fs";
30557
+ import path56 from "node:path";
30526
30558
  var LAUNCHER_MARKER = "workit-owned-launcher";
30527
30559
  var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
30528
30560
  var installRoot = (env, platform = process.platform) => {
30529
30561
  if (env.WORKIT_INSTALL_ROOT)
30530
30562
  return env.WORKIT_INSTALL_ROOT;
30531
30563
  const data = dataDir(env, platform);
30532
- return platform === "win32" ? path55.join(data, "install") : data;
30564
+ return platform === "win32" ? path56.join(data, "install") : data;
30533
30565
  };
30534
- var ownedLauncherPath = (env, platform = process.platform) => path55.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
30535
- var ownedCurrentEntry = (env, platform = process.platform) => path55.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
30566
+ var ownedLauncherPath = (env, platform = process.platform) => path56.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
30567
+ var ownedCurrentEntry = (env, platform = process.platform) => path56.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
30536
30568
  var head = (file) => {
30537
30569
  let fd;
30538
30570
  try {
@@ -30550,7 +30582,7 @@ var head = (file) => {
30550
30582
  var locateWorkitCli = (options = {}) => {
30551
30583
  const env = options.env ?? process.env;
30552
30584
  const platform = options.platform ?? process.platform;
30553
- const exists = options.exists ?? existsSync18;
30585
+ const exists = options.exists ?? existsSync19;
30554
30586
  const read = options.read ?? head;
30555
30587
  const node = options.node ?? process.execPath;
30556
30588
  const launcher = ownedLauncherPath(env, platform);
@@ -30559,7 +30591,7 @@ var locateWorkitCli = (options = {}) => {
30559
30591
  source: "owned-launcher",
30560
30592
  command: launcher,
30561
30593
  args: [],
30562
- binDir: path55.dirname(launcher)
30594
+ binDir: path56.dirname(launcher)
30563
30595
  };
30564
30596
  const current = ownedCurrentEntry(env, platform);
30565
30597
  if (exists(current))
@@ -30588,7 +30620,7 @@ var workitCliEnv = (located, env = process.env, platform = process.platform) =>
30588
30620
  if (located.binDir) {
30589
30621
  const key = pathKey(env);
30590
30622
  const delimiter = platform === "win32" ? ";" : ":";
30591
- const same = (dir) => platform === "win32" ? path55.win32.normalize(dir).toLowerCase() === path55.win32.normalize(located.binDir).toLowerCase() : path55.posix.normalize(dir) === path55.posix.normalize(located.binDir);
30623
+ const same = (dir) => platform === "win32" ? path56.win32.normalize(dir).toLowerCase() === path56.win32.normalize(located.binDir).toLowerCase() : path56.posix.normalize(dir) === path56.posix.normalize(located.binDir);
30592
30624
  const rest = (env[key] ?? "").split(delimiter).filter((dir) => dir && !same(dir));
30593
30625
  patch[key] = [located.binDir, ...rest].join(delimiter);
30594
30626
  }