@workit-dev/opencode 2.25.0 → 2.25.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 +211 -96
  2. package/package.json +2 -2
package/dist/plugin.js CHANGED
@@ -28058,6 +28058,58 @@ var linkSources = (args, at) => {
28058
28058
  return resolved ? [resolved] : [];
28059
28059
  });
28060
28060
  };
28061
+ var commandName2 = (word) => (word.split(/[\\/]/).at(-1) ?? "").toLowerCase();
28062
+ var fedRuns = (words, fed) => {
28063
+ const run = words.slice(Math.max(0, words.findIndex((word) => word === "xargs" || !PREFIXES2.has(word))));
28064
+ const name = commandName2(run[0] ?? "");
28065
+ if (name === "xargs")
28066
+ return xargsCommands(run, fed);
28067
+ if (name !== "parallel")
28068
+ return [run];
28069
+ return parallelCommands(fed === undefined || run.includes(":::") ? run : [...run, ":::", ...fed.split(`
28070
+ `).filter(Boolean)]);
28071
+ };
28072
+ var windowsScript = (input, stdin) => {
28073
+ const words = input.slice(Math.max(0, input.findIndex((word) => !PREFIXES2.has(word))));
28074
+ const name = commandName2(words[0] ?? "").replace(/\.exe$/, "");
28075
+ if (name === "cmd")
28076
+ return cmdScript(words);
28077
+ return name === "pwsh" || name === "powershell" ? powershellScript(words, stdin) : null;
28078
+ };
28079
+ var WINDOWS_LINK_TYPE = /^(?:symboliclink|junction|hardlink)$/i;
28080
+ var linkReach = (verb, args, at, atAll) => {
28081
+ const all = (files) => files.flatMap((file) => atAll(file));
28082
+ const names = operands(args);
28083
+ if (verb === "mount" || verb === "bindfs")
28084
+ return all(names);
28085
+ if (verb === "ln" || verb === "cp" && args.some((arg) => /^-[a-zA-Z]*[ls]|^--(?:link|symbolic-link)$/.test(arg)))
28086
+ return [...linkSources(args, at), ...all(names.length < 2 ? names : names.slice(0, -1))];
28087
+ if (verb === "install") {
28088
+ const flag = args.findIndex((arg) => arg.startsWith("-l"));
28089
+ if (flag < 0)
28090
+ return [];
28091
+ const rest = operands(args.filter((_, index) => index !== flag && (args[flag] !== "-l" || index !== flag + 1)));
28092
+ return all(rest.slice(0, -1));
28093
+ }
28094
+ if (verb === "rsync") {
28095
+ const dest = names.at(-1);
28096
+ return args.flatMap((arg, index) => {
28097
+ const match = /^--link-dest(?:=(.*))?$/s.exec(arg);
28098
+ const dir = match ? match[1] ?? args[index + 1] : undefined;
28099
+ if (!dir)
28100
+ return [];
28101
+ return [...atAll(dir), ...dest && !path42.isAbsolute(dir) ? atAll(path42.join(dest, dir)) : []];
28102
+ });
28103
+ }
28104
+ if (verb === "mklink")
28105
+ return all(args.filter((arg) => !/^\/[dhj]$/i.test(arg)));
28106
+ if ((verb === "new-item" || verb === "ni") && args.some((arg) => WINDOWS_LINK_TYPE.test(arg.replace(/^-[\w-]+:/, ""))))
28107
+ return all(args.flatMap((arg) => {
28108
+ const value = arg.startsWith("-") ? /^-[\w-]+:(.+)$/s.exec(arg)?.[1] : arg;
28109
+ return value && !WINDOWS_LINK_TYPE.test(value) ? [value] : [];
28110
+ }));
28111
+ return [];
28112
+ };
28061
28113
  var shellWrites = (command, depth = 0) => {
28062
28114
  const targets = [];
28063
28115
  let unknown = false;
@@ -28165,6 +28217,7 @@ var recording = (make) => {
28165
28217
  };
28166
28218
  var OPAQUE_TARGET = ".workit-runs-";
28167
28219
  var UNRESOLVED_TARGET = ".workit-unresolved-target";
28220
+ var LINK_SOURCE = ".workit-link-source";
28168
28221
  var OVERRIDE = "WORKIT_LIVE_SESSION=override";
28169
28222
  var inert = (args, sub) => args.some((arg) => arg === "--help" || arg === "-h" || arg === "--dry-run" || DRY_N.has(sub) && /^-[a-zA-Z]*n[a-zA-Z]*$/.test(arg) && !arg.startsWith("--"));
28170
28223
  var gitMutationDirs = (cwd, command, dialect) => {
@@ -28566,6 +28619,10 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
28566
28619
  if (inner !== null && dir !== undefined)
28567
28620
  for (const runIn of workitRunDir(dir, words, atAll))
28568
28621
  targets.push(...segmentTargets(runIn, inner, "posix", depth + 1, strict, runIn === dir ? vars : unPwd()));
28622
+ const windows = strict && depth < 4 ? windowsScript(words, segment.stdin?.join(`
28623
+ `)) : null;
28624
+ if (windows !== null && dir !== undefined)
28625
+ targets.push(...segmentTargets(dir, windows, "powershell", depth + 1, strict, vars));
28569
28626
  const bare = strict === "registry" && depth < 4 ? unwrapped(words) : null;
28570
28627
  if (bare?.length && dir !== undefined)
28571
28628
  targets.push(...segmentTargets(dir, bare.flatMap((word) => expansions(word, vars, loops)).map(quoteWord2).join(" "), "posix", depth + 1, strict, vars));
@@ -28641,9 +28698,11 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
28641
28698
  if (/^(?:n?vim?|ex|ed|emacs)$/.test(verb) && (segment.stdin || inputs.length > 0 || feeder || args.some((arg, index) => /^(?:-[a-zA-Z]*[se]|--(?:batch|eval|script))$/.test(arg) || /^(?:-c|--cmd)$/.test(arg) && !inertEdit(args[index + 1] ?? "") || arg.startsWith("+") && !inertEdit(arg.slice(1) || "1"))))
28642
28699
  for (const file of operands(args))
28643
28700
  targets.push(...atAll(file));
28644
- if (verb === "cp" && args.some((arg) => /^-[a-zA-Z]*l|^--link$/.test(arg)))
28645
- for (const file of operands(args).slice(0, -1))
28646
- targets.push(...atAll(file));
28701
+ const feed = fed === undefined && !piped.length ? undefined : [fed, ...piped].join(`
28702
+ `);
28703
+ for (const [linker = "", ...rest] of fedRuns(words, feed))
28704
+ for (const source of linkReach(commandName2(linker), rest, at, atAll))
28705
+ targets.push(path42.join(source, LINK_SOURCE));
28647
28706
  }
28648
28707
  if (strict && dir !== undefined) {
28649
28708
  const runIn = dir;
@@ -28839,19 +28898,42 @@ var hardLinked = (file, state, configs, inodes) => {
28839
28898
  return;
28840
28899
  }
28841
28900
  };
28901
+ var inRepoLedger = (file) => [...file.matchAll(/[\\/]workit[\\/]ledger(?=[\\/]|$)/g)].some(({ index }) => {
28902
+ const gitDir = file.slice(0, index);
28903
+ return /(?:^|[\\/])\.git$/.test(gitDir) || existsSync16(path42.join(gitDir, "HEAD")) && existsSync16(path42.join(gitDir, "objects"));
28904
+ });
28905
+ var holdsGuarded = (cwd, source, state, configs) => {
28906
+ const real = canonical5(source);
28907
+ const below = (parent, child) => {
28908
+ const rel = path42.relative(parent, child);
28909
+ return rel === "" || !rel.startsWith("..") && !path42.isAbsolute(rel);
28910
+ };
28911
+ const holds = (file) => below(real, canonical5(file));
28912
+ const inState = path42.relative(canonical5(state), real).split(path42.sep);
28913
+ const ledgers = ["ledger", "workit/ledger", ".git/workit/ledger"].map((rel) => path42.join(real, rel)).filter((dir) => existsSync16(dir) && inRepoLedger(dir));
28914
+ const own = ledgerPath(cwd);
28915
+ return holds(state) || below(canonical5(state), real) && inState[0] === "folders" && inState.length <= 2 || configs.some(holds) || ledgers.length > 0 || own.ok && existsSync16(own.value) && holds(path42.dirname(own.value));
28916
+ };
28842
28917
  var registryTarget = (cwd, targets) => {
28843
28918
  const state = resolveStateDir();
28844
28919
  const configs = configDirs();
28845
28920
  const inodes = {};
28846
28921
  for (const target of targets) {
28847
28922
  const file = homeExpanded(target);
28923
+ if (path42.basename(file) === LINK_SOURCE) {
28924
+ const source = path42.dirname(path42.resolve(cwd, file));
28925
+ const reached = registryTarget(cwd, [source])?.registry ?? (holdsGuarded(cwd, source, state, configs) ? "holds" : null);
28926
+ if (reached)
28927
+ return { file: target, registry: reached };
28928
+ continue;
28929
+ }
28848
28930
  if (realPath(path42.resolve(cwd, file)) === null)
28849
28931
  return { file: target, registry: "link" };
28850
28932
  const glob = globbed(cwd, file, state, configs)[0];
28851
28933
  const viaGlob = glob === undefined ? null : registryTarget(cwd, [glob]);
28852
28934
  if (viaGlob)
28853
28935
  return { file: target, registry: viaGlob.registry };
28854
- const registry = hardLinked(path42.resolve(cwd, file), state, configs, inodes) ?? underRegistry(state, cwd, file, process.platform, canonical5) ?? (/[\\/]\.git[\\/]workit[\\/]ledger(?:[\\/]|$)/.test(canonical5(path42.resolve(cwd, file))) ? "ledger" : null) ?? (configs.some((dir) => underConfig(dir, cwd, file, process.platform, canonical5)) ? "grants" : null);
28936
+ const registry = hardLinked(path42.resolve(cwd, file), state, configs, inodes) ?? underRegistry(state, cwd, file, process.platform, canonical5) ?? (inRepoLedger(canonical5(path42.resolve(cwd, file))) ? "ledger" : null) ?? (configs.some((dir) => underConfig(dir, cwd, file, process.platform, canonical5)) ? "grants" : null);
28855
28937
  if (registry)
28856
28938
  return { file: target, registry };
28857
28939
  }
@@ -28878,6 +28960,7 @@ var underConfig = (dir, cwd, target, platform = process.platform, real = (file)
28878
28960
  const parts = partsUnder(dir, cwd, target, platform, real);
28879
28961
  return parts?.length === 1 && ["", ...CONFIG_FILES, DIR_TARGET, UNRESOLVED_TARGET].includes(parts[0]);
28880
28962
  };
28963
+ var windowsSlashed = (command, platform = process.platform) => platform === "win32" && command.includes("\\") ? command.replace(/[^\s'"|;&<>()]*\\[^\s'"|;&<>()]*/g, (word) => word.replaceAll("\\", "/")) : null;
28881
28964
  var unquotedWindowsRegistry = (command, platform = process.platform) => {
28882
28965
  if (platform !== "win32" || !command.includes("\\"))
28883
28966
  return null;
@@ -28886,28 +28969,36 @@ var unquotedWindowsRegistry = (command, platform = process.platform) => {
28886
28969
  const state = flat(resolveStateDir());
28887
28970
  const configs = configDirs().map(flat);
28888
28971
  const folders = `${state}/folders/`;
28889
- const ledger = (at) => at.includes(`${state}/verdicts`) || /\/\.git\/workit\/ledger(?:[/\s'"]|$)/.test(at) || at.split(folders).slice(1).some((rest) => /^[^/\s]+\/ledger(?:[/\s'"]|$)/.test(rest));
28890
- const registry = text.includes(`${state}/issued`) ? "issued" : text.includes(`${state}/approvals`) ? "approvals" : ledger(text) ? "ledger" : configs.some((dir) => text.includes(dir)) ? "grants" : null;
28891
- if (!registry)
28972
+ const ledger = (at, named = false) => at.includes(`${state}/verdicts`) || (named ? inRepoLedger(at) : /\/workit\/ledger(?:[/\s'"]|$)/.test(at)) || at.split(folders).slice(1).some((rest) => /^[^/\s]+\/ledger(?:[/\s'"]|$)/.test(rest));
28973
+ const present = ["issued", "approvals", "ledger", "grants"].filter((kind) => kind === "ledger" ? ledger(text) : kind === "grants" ? configs.some((dir) => text.includes(dir)) : text.includes(`${state}/${kind}`));
28974
+ if (!present.length)
28892
28975
  return null;
28893
- const spans = command.replace(/[^\s'"|;&<>()]*\\[^\s'"|;&<>()]*/g, (word) => word.replaceAll("\\", "/"));
28976
+ const spans = windowsSlashed(command, platform) ?? command;
28894
28977
  const writes = shellWrites(spans);
28978
+ if (!writes.writes)
28979
+ return null;
28895
28980
  const moved = [
28896
28981
  "",
28897
28982
  ...[...spans.matchAll(/(?:^|[;&|(]\s*)(?:cd|pushd|chdir)\s+([^\s;&|)]+)/g)].map((match) => `${match[1]}/`)
28898
28983
  ];
28899
- const named = (target) => moved.some((dir) => {
28984
+ const named = (registry, target) => moved.some((dir) => {
28900
28985
  const at = flat(/^(?:[a-z]:)?\//i.test(target) ? target : dir + target).replace(/\/\.?\//g, "/");
28901
- return registry === "grants" ? configs.some((cfg) => [cfg, `${cfg}/`, ...CONFIG_FILES.map((name) => `${cfg}/${name}`)].includes(at)) : registry === "ledger" ? ledger(at) : at.includes(`${state}/${registry}`);
28986
+ return registry === "grants" ? configs.some((cfg) => [cfg, `${cfg}/`, ...CONFIG_FILES.map((name) => `${cfg}/${name}`)].includes(at)) : registry === "ledger" ? ledger(at, true) : at.includes(`${state}/${registry}`);
28902
28987
  });
28903
- return writes.writes && (writes.targets === null || writes.targets.some(named)) ? registry : null;
28988
+ return present.find((registry) => writes.targets === null || writes.targets.some((target) => named(registry, target))) ?? null;
28904
28989
  };
28990
+ var LINK_UNBLOCK = "Never link or bind-mount Workit's state, config or ledgers: a write through the link would land in them. Read the file in place.";
28905
28991
  var REGISTRY_DENY = {
28906
28992
  link: {
28907
28993
  label: "registry guard",
28908
28994
  what: "a symlink chain Workit could not resolve (over 40 links), which may reach a guarded path",
28909
28995
  unblock: "Write to the file's real path."
28910
28996
  },
28997
+ holds: {
28998
+ label: "registry guard",
28999
+ what: "Workit's state, its config or a repository ledger",
29000
+ unblock: LINK_UNBLOCK
29001
+ },
28911
29002
  issued: {
28912
29003
  label: "issued-registry guard",
28913
29004
  what: "Workit's issued-session state",
@@ -28931,6 +29022,12 @@ var REGISTRY_DENY = {
28931
29022
  };
28932
29023
  var registryDeny = ({ file, registry }) => {
28933
29024
  const { label, what, unblock } = REGISTRY_DENY[registry];
29025
+ if (path42.basename(file) === LINK_SOURCE)
29026
+ return {
29027
+ kind: "deny",
29028
+ reason: `workit ${label}: this command links or mounts ${path42.dirname(file)}, which is or holds ${what}. ${LINK_UNBLOCK}`,
29029
+ unblock: LINK_UNBLOCK
29030
+ };
28934
29031
  if (path42.basename(file) === UNRESOLVED_TARGET)
28935
29032
  return {
28936
29033
  kind: "deny",
@@ -28962,7 +29059,8 @@ function writeGate(cwd, paths, owner, deps) {
28962
29059
  function shellGate(cwd, command, owner, dialect = "posix", deps) {
28963
29060
  try {
28964
29061
  const windows = unquotedWindowsRegistry(command);
28965
- const forged = registryTarget(cwd, shellMutationTargets(cwd, command, dialect, "registry")) ?? (windows ? { file: `the ${windows} registry`, registry: windows } : null);
29062
+ const slashed = dialect === "posix" ? windowsSlashed(command) : null;
29063
+ const forged = registryTarget(cwd, shellMutationTargets(cwd, command, dialect, "registry")) ?? (slashed === null ? null : registryTarget(cwd, shellMutationTargets(cwd, slashed, dialect, "registry"))) ?? (windows ? { file: `the ${windows} registry`, registry: windows } : null);
28966
29064
  if (forged)
28967
29065
  return registryDeny(forged);
28968
29066
  } catch {
@@ -29101,6 +29199,26 @@ function currentJudgment(cwd) {
29101
29199
  }
29102
29200
  }
29103
29201
 
29202
+ // packages/workit-core/src/core/verdict-set.ts
29203
+ import path44 from "node:path";
29204
+ var SET_TTL_MS = 7 * 86400000;
29205
+ var SET_VOID = "verdict.set.voided";
29206
+ var setStorePath = () => path44.join(resolveStateDir(), "verdicts", "sets", "ledger.jsonl");
29207
+ function gateStands(cwd, gate, rows, now = Date.now()) {
29208
+ const id = typeof gate.verdictId === "string" ? gate.verdictId : null;
29209
+ if (id !== null && verdictVoids(rows).has(id))
29210
+ return false;
29211
+ if (gate.via !== "set")
29212
+ return true;
29213
+ const until = typeof gate.expires === "string" ? Date.parse(gate.expires) : Date.parse(gate.at) + SET_TTL_MS;
29214
+ if (!(until > now))
29215
+ return false;
29216
+ if (id === null)
29217
+ return true;
29218
+ const read = readLedgerAt(cwd, setStorePath(), { integrity: true });
29219
+ return read.ok && !read.value.rows.some((row) => row.type === SET_VOID && row.target === id && row.integrity === "verified");
29220
+ }
29221
+
29104
29222
  // packages/workit-core/src/hooks/stop.ts
29105
29223
  var NONE4 = { kind: "none" };
29106
29224
  var QUESTION = /[??؟](?=[\s*_`"')\]>]*(?:\s|$))|¿/;
@@ -29214,7 +29332,7 @@ var unverified = (cwd, branch, all, descriptor, verification, head) => {
29214
29332
  const check = checkVerdicts(cwd, branch, all);
29215
29333
  if (check.accepted.accepted || check.accepted.reasons.includes("failing_verdict"))
29216
29334
  return null;
29217
- if (all.some((row) => row.type === "pr.gate" && row.branch === branch && row.head === check.head))
29335
+ if (all.some((row) => row.type === "pr.gate" && row.branch === branch && row.head === check.head && gateStands(cwd, row, all)))
29218
29336
  return null;
29219
29337
  const judgment = currentJudgment(cwd);
29220
29338
  const high = judgment?.riskTier === "high";
@@ -29543,7 +29661,7 @@ var WRITE_TOOLS = new Set([
29543
29661
  ]);
29544
29662
  // packages/workit-core/src/hooks/standing.ts
29545
29663
  import fs30 from "node:fs";
29546
- import path44 from "node:path";
29664
+ import path45 from "node:path";
29547
29665
 
29548
29666
  // packages/workit-core/src/approvals/store.ts
29549
29667
  var REQUEST_TTL_MS = 30 * 60000;
@@ -30058,7 +30176,7 @@ var workitRole = (descriptor, agentType) => {
30058
30176
 
30059
30177
  // packages/workit-core/src/hooks/standing.ts
30060
30178
  var readPlans = (store) => {
30061
- const dir = path44.join(store, "fanouts");
30179
+ const dir = path45.join(store, "fanouts");
30062
30180
  let names;
30063
30181
  try {
30064
30182
  names = fs30.readdirSync(dir).filter((name) => name.endsWith(".json"));
@@ -30068,7 +30186,7 @@ var readPlans = (store) => {
30068
30186
  const plans = [];
30069
30187
  for (const name of names) {
30070
30188
  try {
30071
- const raw = JSON.parse(fs30.readFileSync(path44.join(dir, name), "utf8"));
30189
+ const raw = JSON.parse(fs30.readFileSync(path45.join(dir, name), "utf8"));
30072
30190
  if (typeof raw.name !== "string" || !Array.isArray(raw.slices))
30073
30191
  continue;
30074
30192
  const texts = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string" && item !== "") : [];
@@ -30387,8 +30505,8 @@ var UNLISTED = new Set(["description", "prompt"]);
30387
30505
 
30388
30506
  // packages/workit-core/src/hooks/server-gate.ts
30389
30507
  import fs31 from "node:fs";
30390
- import path45 from "node:path";
30391
- var procNoticeFile = (env, session) => path45.join(stateDir(env), "procs", "notices", `${session.replace(/[^A-Za-z0-9_.@+-]/gu, "-").slice(0, 120) || "none"}.json`);
30508
+ import path46 from "node:path";
30509
+ var procNoticeFile = (env, session) => path46.join(stateDir(env), "procs", "notices", `${session.replace(/[^A-Za-z0-9_.@+-]/gu, "-").slice(0, 120) || "none"}.json`);
30392
30510
  var mb = (bytes) => `${Math.round(Number(bytes) / 1048576)} MB`;
30393
30511
  function takeProcNotice(session, env = process.env) {
30394
30512
  if (!session)
@@ -30426,21 +30544,21 @@ function takeProcNotice(session, env = process.env) {
30426
30544
  // packages/workit-core/src/hooks/teardown.ts
30427
30545
  import { spawn } from "node:child_process";
30428
30546
  import fs32 from "node:fs";
30429
- import path47 from "node:path";
30547
+ import path48 from "node:path";
30430
30548
 
30431
30549
  // packages/workit-core/src/core/cli-locate.ts
30432
30550
  import { closeSync as closeSync3, existsSync as existsSync17, openSync as openSync3, readSync } from "node:fs";
30433
- import path46 from "node:path";
30551
+ import path47 from "node:path";
30434
30552
  var LAUNCHER_MARKER = "workit-owned-launcher";
30435
30553
  var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
30436
30554
  var installRoot = (env, platform = process.platform) => {
30437
30555
  if (env.WORKIT_INSTALL_ROOT)
30438
30556
  return env.WORKIT_INSTALL_ROOT;
30439
30557
  const data = dataDir(env, platform);
30440
- return platform === "win32" ? path46.join(data, "install") : data;
30558
+ return platform === "win32" ? path47.join(data, "install") : data;
30441
30559
  };
30442
- var ownedLauncherPath = (env, platform = process.platform) => path46.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
30443
- var ownedCurrentEntry = (env, platform = process.platform) => path46.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
30560
+ var ownedLauncherPath = (env, platform = process.platform) => path47.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
30561
+ var ownedCurrentEntry = (env, platform = process.platform) => path47.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
30444
30562
  var head = (file) => {
30445
30563
  let fd;
30446
30564
  try {
@@ -30467,7 +30585,7 @@ var locateWorkitCli = (options = {}) => {
30467
30585
  source: "owned-launcher",
30468
30586
  command: launcher,
30469
30587
  args: [],
30470
- binDir: path46.dirname(launcher)
30588
+ binDir: path47.dirname(launcher)
30471
30589
  };
30472
30590
  const current = ownedCurrentEntry(env, platform);
30473
30591
  if (exists(current))
@@ -30496,7 +30614,7 @@ var workitCliEnv = (located, env = process.env, platform = process.platform) =>
30496
30614
  if (located.binDir) {
30497
30615
  const key = pathKey(env);
30498
30616
  const delimiter = platform === "win32" ? ";" : ":";
30499
- const same = (dir) => platform === "win32" ? path46.win32.normalize(dir).toLowerCase() === path46.win32.normalize(located.binDir).toLowerCase() : path46.posix.normalize(dir) === path46.posix.normalize(located.binDir);
30617
+ const same = (dir) => platform === "win32" ? path47.win32.normalize(dir).toLowerCase() === path47.win32.normalize(located.binDir).toLowerCase() : path47.posix.normalize(dir) === path47.posix.normalize(located.binDir);
30500
30618
  const rest = (env[key] ?? "").split(delimiter).filter((dir) => dir && !same(dir));
30501
30619
  patch[key] = [located.binDir, ...rest].join(delimiter);
30502
30620
  }
@@ -30520,9 +30638,9 @@ var ENDS = {
30520
30638
  };
30521
30639
  var SAFE_SESSION = /^[\w.@+][\w.:@/+-]{0,127}$/u;
30522
30640
  var HOST_SESSION_VARS2 = ["OPENCODE_SESSION_ID", "PI_SESSION_ID", "CODEX_THREAD_ID"];
30523
- var teardownDir = (env) => path47.join(stateDir(env), "procs");
30524
- var teardownLog = (env) => path47.join(teardownDir(env), "teardown.log");
30525
- var reapStamp = (env) => path47.join(teardownDir(env), "reap-at-start.stamp");
30641
+ var teardownDir = (env) => path48.join(stateDir(env), "procs");
30642
+ var teardownLog = (env) => path48.join(teardownDir(env), "teardown.log");
30643
+ var reapStamp = (env) => path48.join(teardownDir(env), "reap-at-start.stamp");
30526
30644
  function spawnDetached(request) {
30527
30645
  try {
30528
30646
  const shell = process.platform === "win32" && !/\.exe$/iu.test(request.command);
@@ -30549,7 +30667,7 @@ var teardownDeps = {
30549
30667
  var openLog = (env, args) => {
30550
30668
  try {
30551
30669
  const file = teardownLog(env);
30552
- fs32.mkdirSync(path47.dirname(file), { recursive: true });
30670
+ fs32.mkdirSync(path48.dirname(file), { recursive: true });
30553
30671
  let size = 0;
30554
30672
  try {
30555
30673
  size = fs32.statSync(file).size;
@@ -30634,7 +30752,7 @@ function reapAtStart(_cwd, env = process.env) {
30634
30752
  try {
30635
30753
  if (fresh(stamp, now))
30636
30754
  return false;
30637
- fs32.mkdirSync(path47.dirname(stamp), { recursive: true });
30755
+ fs32.mkdirSync(path48.dirname(stamp), { recursive: true });
30638
30756
  if (!claim2(lock, now))
30639
30757
  return false;
30640
30758
  } catch {
@@ -31340,11 +31458,11 @@ var PROCESS_START = performance.timeOrigin;
31340
31458
  // packages/workit-core/src/hooks/run.ts
31341
31459
  if (false) {}
31342
31460
  // packages/workit-opencode/src/shared/init-apply.ts
31343
- import path52 from "node:path";
31461
+ import path53 from "node:path";
31344
31462
 
31345
31463
  // packages/workit-core/src/core/gitignore.ts
31346
31464
  import { existsSync as existsSync18, readFileSync as readFileSync13, writeFileSync as writeFileSync6 } from "node:fs";
31347
- import path48 from "node:path";
31465
+ import path49 from "node:path";
31348
31466
  var GITIGNORE_ENTRIES = [
31349
31467
  "# workit: SDD working state (never commit)",
31350
31468
  "docs/*/sdd/",
@@ -31364,7 +31482,7 @@ var GITIGNORE_ENTRIES = [
31364
31482
  var ensureProjectGitignore = (workspaceRoot, confirmed) => {
31365
31483
  if (!confirmed)
31366
31484
  return { ok: false, error: "confirmed: true required" };
31367
- const file = path48.join(workspaceRoot, ".gitignore");
31485
+ const file = path49.join(workspaceRoot, ".gitignore");
31368
31486
  const existing = existsSync18(file) ? readFileSync13(file, "utf8") : "";
31369
31487
  const existingLines = new Set(existing.split(`
31370
31488
  `).map((l) => l.trim()).filter(Boolean));
@@ -31392,25 +31510,25 @@ var ensureProjectGitignore = (workspaceRoot, confirmed) => {
31392
31510
 
31393
31511
  // packages/workit-core/src/core/hygiene.ts
31394
31512
  import { existsSync as existsSync19, readFileSync as readFileSync14, readdirSync as readdirSync6, writeFileSync as writeFileSync7 } from "node:fs";
31395
- import path49 from "node:path";
31513
+ import path50 from "node:path";
31396
31514
  var repoRoot3 = assetRoot();
31397
- var templatesDir = () => path49.join(repoRoot3, "templates", "hygiene");
31515
+ var templatesDir = () => path50.join(repoRoot3, "templates", "hygiene");
31398
31516
  var packageJson2 = (root) => {
31399
- if (!existsSync19(path49.join(root, "package.json")))
31517
+ if (!existsSync19(path50.join(root, "package.json")))
31400
31518
  return null;
31401
31519
  try {
31402
- return JSON.parse(readFileSync14(path49.join(root, "package.json"), "utf8"));
31520
+ return JSON.parse(readFileSync14(path50.join(root, "package.json"), "utf8"));
31403
31521
  } catch {
31404
31522
  return null;
31405
31523
  }
31406
31524
  };
31407
31525
  var isOpenSource = (root) => {
31408
- if (existsSync19(path49.join(root, "LICENSE")))
31526
+ if (existsSync19(path50.join(root, "LICENSE")))
31409
31527
  return true;
31410
31528
  const pkg = packageJson2(root);
31411
31529
  if (pkg && !pkg.private)
31412
31530
  return true;
31413
- return path49.basename(root) === "workit";
31531
+ return path50.basename(root) === "workit";
31414
31532
  };
31415
31533
  var licenseHolder = (root) => {
31416
31534
  const pkg = packageJson2(root);
@@ -31433,13 +31551,13 @@ var planHygieneFiles = (root, opts = {}) => {
31433
31551
  files.push("LICENSE", "CONTRIBUTING.md");
31434
31552
  const planned = [];
31435
31553
  for (const file of files) {
31436
- if (existsSync19(path49.join(root, file)))
31554
+ if (existsSync19(path50.join(root, file)))
31437
31555
  continue;
31438
- const tpl = path49.join(templatesDir(), file);
31556
+ const tpl = path50.join(templatesDir(), file);
31439
31557
  if (!existsSync19(tpl))
31440
31558
  continue;
31441
- const content = readFileSync14(tpl, "utf8").replace(/<PROJECT>/g, path49.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
31442
- planned.push({ path: path49.join(root, file), content });
31559
+ const content = readFileSync14(tpl, "utf8").replace(/<PROJECT>/g, path50.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
31560
+ planned.push({ path: path50.join(root, file), content });
31443
31561
  }
31444
31562
  return planned;
31445
31563
  };
@@ -31449,19 +31567,19 @@ var ensureHygieneFiles = (root, opts) => {
31449
31567
  const created = [];
31450
31568
  for (const planned of planHygieneFiles(root, opts)) {
31451
31569
  writeFileSync7(planned.path, planned.content, "utf8");
31452
- created.push(path49.basename(planned.path));
31570
+ created.push(path50.basename(planned.path));
31453
31571
  }
31454
31572
  return { ok: true, created };
31455
31573
  };
31456
31574
 
31457
31575
  // packages/workit-core/src/core/init.ts
31458
31576
  import fs33 from "node:fs";
31459
- import path51 from "node:path";
31577
+ import path52 from "node:path";
31460
31578
  import { spawnSync as spawnSync25 } from "node:child_process";
31461
31579
 
31462
31580
  // packages/workit-core/src/core/workspace-branch-policy.ts
31463
31581
  import { mkdirSync as mkdirSync6, readFileSync as readFileSync15, renameSync as renameSync5, rmSync as rmSync3, writeFileSync as writeFileSync8 } from "node:fs";
31464
- import path50 from "node:path";
31582
+ import path51 from "node:path";
31465
31583
  import { isDeepStrictEqual } from "node:util";
31466
31584
  var readFileSafe = (p) => {
31467
31585
  try {
@@ -31472,7 +31590,7 @@ var readFileSafe = (p) => {
31472
31590
  };
31473
31591
  function applyWorkspaceBranchPolicy(opts) {
31474
31592
  const { workspace_root, env = process.env } = opts;
31475
- const dir = path50.join(env.WORKIT_CONFIG ?? configDir2());
31593
+ const dir = path51.join(env.WORKIT_CONFIG ?? configDir2());
31476
31594
  const {
31477
31595
  status,
31478
31596
  path: wsPath,
@@ -31484,7 +31602,7 @@ function applyWorkspaceBranchPolicy(opts) {
31484
31602
  if (status === "malformed" || status === "invalid")
31485
31603
  return { ok: false, error: workspacesError ?? `invalid workspaces.json: ${wsPath}` };
31486
31604
  const detection = detectBranchPolicy(workspace_root);
31487
- const name = String(env.WORKIT_BP_NAME ?? path50.basename(workspace_root));
31605
+ const name = String(env.WORKIT_BP_NAME ?? path51.basename(workspace_root));
31488
31606
  const integration = env.WORKIT_BP_INTEGRATION ?? detection.integration;
31489
31607
  const policy = {
31490
31608
  preset: detection.preset,
@@ -31533,7 +31651,7 @@ function applyWorkspaceBranchPolicy(opts) {
31533
31651
  ok: false,
31534
31652
  error: `workspaces.json changed while applying the branch policy: ${wsPath}`
31535
31653
  };
31536
- mkdirSync6(path50.dirname(wsPath), { recursive: true });
31654
+ mkdirSync6(path51.dirname(wsPath), { recursive: true });
31537
31655
  const tmp = `${wsPath}.${process.pid}.tmp`;
31538
31656
  try {
31539
31657
  writeFileSync8(tmp, JSON.stringify({ ...document, workspaces: next }, null, 2) + `
@@ -31633,7 +31751,7 @@ function initApplyData(action, env = process.env) {
31633
31751
  fs33.mkdirSync(dir, { recursive: true });
31634
31752
  switch (action) {
31635
31753
  case "youtrack_json": {
31636
- const out = path51.join(dir, "youtrack.json");
31754
+ const out = path52.join(dir, "youtrack.json");
31637
31755
  fs33.writeFileSync(out, JSON.stringify(youtrackJsonContent(), null, 2) + `
31638
31756
  `, "utf8");
31639
31757
  return { action, ok: true, path: out };
@@ -31647,10 +31765,10 @@ function initApplyData(action, env = process.env) {
31647
31765
  };
31648
31766
  }
31649
31767
  case "youtrack_scaffold": {
31650
- const jsonOut = path51.join(dir, "youtrack.json");
31768
+ const jsonOut = path52.join(dir, "youtrack.json");
31651
31769
  fs33.writeFileSync(jsonOut, JSON.stringify(youtrackJsonContent(), null, 2) + `
31652
31770
  `, "utf8");
31653
- const configPath = path51.resolve(jsonOut);
31771
+ const configPath = path52.resolve(jsonOut);
31654
31772
  const cfg = readJson3(configPath) ?? {};
31655
31773
  const base = String(cfg.baseUrl ?? "").replace(/\/+$/, "");
31656
31774
  const meeting = String(cfg.meetingIssue ?? "");
@@ -31686,10 +31804,10 @@ function initApplyData(action, env = process.env) {
31686
31804
  };
31687
31805
  }
31688
31806
  case "vcs_scaffold": {
31689
- const jsonOut = path51.join(dir, "vcs.json");
31807
+ const jsonOut = path52.join(dir, "vcs.json");
31690
31808
  fs33.writeFileSync(jsonOut, JSON.stringify(vcsJsonContent(), null, 2) + `
31691
31809
  `, "utf8");
31692
- const configPath = path51.resolve(jsonOut);
31810
+ const configPath = path52.resolve(jsonOut);
31693
31811
  const prev = process.env.WORKIT_VCS_CONFIG;
31694
31812
  process.env.WORKIT_VCS_CONFIG = configPath;
31695
31813
  try {
@@ -31808,7 +31926,7 @@ var executeInitApply = (args, directory, runtime) => {
31808
31926
  protectedNames: args.branch_policy_protected
31809
31927
  }, current);
31810
31928
  writeConfig(next);
31811
- return output(ok({ action: "config", path: path52.join(configDir2(), "config.json"), ...next }));
31929
+ return output(ok({ action: "config", path: path53.join(configDir2(), "config.json"), ...next }));
31812
31930
  }
31813
31931
  const env = Object.fromEntries(Object.entries({
31814
31932
  WORKIT_YT_BASE_URL: args.base_url,
@@ -31825,14 +31943,14 @@ var executeInitApply = (args, directory, runtime) => {
31825
31943
 
31826
31944
  // packages/workit-opencode/src/shared/session.ts
31827
31945
  import { realpathSync as realpathSync12 } from "node:fs";
31828
- import path53 from "node:path";
31946
+ import path54 from "node:path";
31829
31947
  var sameWorkspace = (expected, observed) => {
31830
31948
  if (typeof observed !== "string" || !observed)
31831
31949
  return false;
31832
31950
  try {
31833
31951
  return realpathSync12(expected) === realpathSync12(observed);
31834
31952
  } catch {
31835
- return path53.resolve(expected) === path53.resolve(observed);
31953
+ return path54.resolve(expected) === path54.resolve(observed);
31836
31954
  }
31837
31955
  };
31838
31956
 
@@ -31904,7 +32022,7 @@ var workitFamilyOf = (toolName) => {
31904
32022
 
31905
32023
  // packages/workit-opencode/src/tools/context.ts
31906
32024
  import { realpathSync as realpathSync13 } from "node:fs";
31907
- import path54 from "node:path";
32025
+ import path55 from "node:path";
31908
32026
  var createContextTool = () => ({
31909
32027
  description: "Read Git, pull request, YouTrack, issue, changelog, release, or affected-file context.",
31910
32028
  execute: async (args, context) => {
@@ -31914,7 +32032,7 @@ var createContextTool = () => ({
31914
32032
  let root;
31915
32033
  try {
31916
32034
  const cwd = parsed.data.cwd;
31917
- root = realpathSync13(cwd ? path54.resolve(context.directory, cwd) : context.directory);
32035
+ root = realpathSync13(cwd ? path55.resolve(context.directory, cwd) : context.directory);
31918
32036
  } catch {
31919
32037
  return JSON.stringify(failure2("invalid_input", "context target directory cannot be resolved"), null, 2);
31920
32038
  }
@@ -31947,7 +32065,7 @@ var workerCoordinatorFor = (task, worker) => {
31947
32065
  import { spawnSync as spawnSync29 } from "node:child_process";
31948
32066
  import { createHash as createHash21 } from "node:crypto";
31949
32067
  import fs35 from "node:fs";
31950
- import path57 from "node:path";
32068
+ import path58 from "node:path";
31951
32069
 
31952
32070
  // packages/workit-core/src/fanout-landed.ts
31953
32071
  import { spawnSync as spawnSync26 } from "node:child_process";
@@ -32181,7 +32299,7 @@ var NOTICE_TTL_MS = 7 * 86400000;
32181
32299
  import { spawnSync as spawnSync28 } from "node:child_process";
32182
32300
  import { createHash as createHash20, randomBytes as randomBytes4 } from "node:crypto";
32183
32301
  import fs34 from "node:fs";
32184
- import path56 from "node:path";
32302
+ import path57 from "node:path";
32185
32303
 
32186
32304
  // packages/workit-core/src/git/ops.ts
32187
32305
  import { spawnSync as spawnSync27 } from "node:child_process";
@@ -32194,7 +32312,7 @@ import {
32194
32312
  rmSync as rmSync4,
32195
32313
  writeFileSync as writeFileSync9
32196
32314
  } from "node:fs";
32197
- import path55 from "node:path";
32315
+ import path56 from "node:path";
32198
32316
  var COMMIT_TIMEOUT_MS = 10 * 60000;
32199
32317
  var git5 = (cwd, args, options = {}) => {
32200
32318
  const result = spawnSync27("git", args, {
@@ -32227,18 +32345,18 @@ function operationInProgress(cwd) {
32227
32345
  if (!run.ok)
32228
32346
  return null;
32229
32347
  const found = run.stdout.split(`
32230
- `).map((line) => path55.resolve(cwd, line.trim()));
32348
+ `).map((line) => path56.resolve(cwd, line.trim()));
32231
32349
  const conflicted = () => git5(cwd, ["ls-files", "-u"]).stdout.trim() !== "";
32232
32350
  for (const [index, [, operation]] of markers.entries()) {
32233
32351
  const marker = found[index];
32234
32352
  if (!marker || !existsSync20(marker))
32235
32353
  continue;
32236
- if (index === 1 && existsSync20(path55.join(marker, "applying")))
32354
+ if (index === 1 && existsSync20(path56.join(marker, "applying")))
32237
32355
  return { operation: "am", commitAllowed: false, branch: null };
32238
- if (index === 0 && existsSync20(path55.join(marker, "amend")) && !conflicted()) {
32356
+ if (index === 0 && existsSync20(path56.join(marker, "amend")) && !conflicted()) {
32239
32357
  let headName = "";
32240
32358
  try {
32241
- headName = readFileSync16(path55.join(marker, "head-name"), "utf8").trim();
32359
+ headName = readFileSync16(path56.join(marker, "head-name"), "utf8").trim();
32242
32360
  } catch {}
32243
32361
  const branch = headName.startsWith("refs/heads/") ? headName.slice("refs/heads/".length) : null;
32244
32362
  return { operation, commitAllowed: branch !== null, branch };
@@ -32286,9 +32404,6 @@ function pushPreflight(cwd, options = {}) {
32286
32404
  });
32287
32405
  }
32288
32406
 
32289
- // packages/workit-core/src/core/verdict-set.ts
32290
- var SET_TTL_MS = 7 * 86400000;
32291
-
32292
32407
  // packages/workit-core/src/forge/report.ts
32293
32408
  var GITLAB_MERGEABLE = new Set(["mergeable"]);
32294
32409
  var GITHUB_MERGEABLE = new Set(["clean", "unstable", "has_hooks"]);
@@ -32369,7 +32484,7 @@ function rebaseInProgress(dir) {
32369
32484
  }
32370
32485
  var scratchDir = (cwd) => {
32371
32486
  const dir = stacksDir(cwd);
32372
- return dir.ok ? path56.join(dir.data, "worktrees") : null;
32487
+ return dir.ok ? path57.join(dir.data, "worktrees") : null;
32373
32488
  };
32374
32489
  function gitRestack(cwd, input) {
32375
32490
  const owner = worktreeOf(cwd, input.branch);
@@ -32384,7 +32499,7 @@ function gitRestack(cwd, input) {
32384
32499
  error: "no store root"
32385
32500
  };
32386
32501
  fs34.mkdirSync(scratch, { recursive: true });
32387
- dir = path56.join(scratch, `${input.branch.replace(/[^A-Za-z0-9._-]+/gu, "_").slice(0, 40)}-${randomBytes4(4).toString("hex")}`);
32502
+ dir = path57.join(scratch, `${input.branch.replace(/[^A-Za-z0-9._-]+/gu, "_").slice(0, 40)}-${randomBytes4(4).toString("hex")}`);
32388
32503
  const added = gitRun4(cwd, ["worktree", "add", "-q", dir, input.branch], GIT_TIMEOUTS.worktree);
32389
32504
  if (!added.ok)
32390
32505
  return {
@@ -32443,7 +32558,7 @@ function stacksDir(cwd) {
32443
32558
  const root = storeRoot(cwd);
32444
32559
  if (!root.ok)
32445
32560
  return stackFail(root.code, root.error, root.unblock);
32446
- return { ok: true, data: path56.join(root.value.root, "stacks") };
32561
+ return { ok: true, data: path57.join(root.value.root, "stacks") };
32447
32562
  }
32448
32563
  var HEARTBEAT_STALE_MS = 2 * 60000;
32449
32564
  var SETTLED_BY_RESTACK = new Set(["checks_pending", "behind_base_required"]);
@@ -32590,7 +32705,7 @@ function fanoutsDir(cwd) {
32590
32705
  const root = storeRoot(cwd);
32591
32706
  if (!root.ok)
32592
32707
  return fanoutFail(root.code, root.error, root.unblock);
32593
- return { ok: true, data: path57.join(root.value.root, "fanouts") };
32708
+ return { ok: true, data: path58.join(root.value.root, "fanouts") };
32594
32709
  }
32595
32710
  function parseStored(raw) {
32596
32711
  if (!isRecord9(raw) || typeof raw.name !== "string" || typeof raw.trunk !== "string")
@@ -32658,7 +32773,7 @@ function readFanout(cwd, name) {
32658
32773
  const dir = fanoutsDir(cwd);
32659
32774
  if (!dir.ok)
32660
32775
  return dir;
32661
- const file = path57.join(dir.data, stackFileName(name));
32776
+ const file = path58.join(dir.data, stackFileName(name));
32662
32777
  let parsed = null;
32663
32778
  try {
32664
32779
  parsed = parseStored(JSON.parse(fs35.readFileSync(file, "utf8")));
@@ -32683,7 +32798,7 @@ function listFanouts(cwd) {
32683
32798
  for (const entry of names) {
32684
32799
  let parsed = null;
32685
32800
  try {
32686
- parsed = parseStored(JSON.parse(fs35.readFileSync(path57.join(dir.data, entry), "utf8")));
32801
+ parsed = parseStored(JSON.parse(fs35.readFileSync(path58.join(dir.data, entry), "utf8")));
32687
32802
  } catch {
32688
32803
  parsed = null;
32689
32804
  }
@@ -33574,7 +33689,7 @@ var childTaskMissing = (store, input) => {
33574
33689
  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`;
33575
33690
 
33576
33691
  // packages/workit-opencode/src/v2/shell.ts
33577
- import path58 from "node:path";
33692
+ import path59 from "node:path";
33578
33693
 
33579
33694
  // packages/workit-core/src/hooks/repeat-failure.ts
33580
33695
  import { createHash as createHash22 } from "node:crypto";
@@ -33637,7 +33752,7 @@ var commandOf = (input) => {
33637
33752
  };
33638
33753
  var hookInput = (root, sessionID, id, shell) => ({
33639
33754
  host: "opencode",
33640
- cwd: shell.workdir ? path58.resolve(root, shell.workdir) : root,
33755
+ cwd: shell.workdir ? path59.resolve(root, shell.workdir) : root,
33641
33756
  session: { id: sessionID, agentId: null, agentType: null, parentId: null },
33642
33757
  permissionMode: null,
33643
33758
  transcriptPath: null,
@@ -34161,37 +34276,37 @@ var createStopControl = (root, port) => {
34161
34276
 
34162
34277
  // packages/workit-opencode/src/v2/registry.ts
34163
34278
  import { existsSync as existsSync22, readFileSync as readFileSync17 } from "node:fs";
34164
- import path60 from "node:path";
34279
+ import path61 from "node:path";
34165
34280
 
34166
34281
  // packages/workit-opencode/src/shared/assets.ts
34167
34282
  import { existsSync as existsSync21, realpathSync as realpathSync14 } from "node:fs";
34168
- import path59 from "node:path";
34283
+ import path60 from "node:path";
34169
34284
  import { fileURLToPath as fileURLToPath2 } from "node:url";
34170
34285
  var moduleDir = () => {
34171
34286
  try {
34172
- return realpathSync14(path59.dirname(fileURLToPath2(import.meta.url)));
34287
+ return realpathSync14(path60.dirname(fileURLToPath2(import.meta.url)));
34173
34288
  } catch {
34174
- return path59.dirname(fileURLToPath2(import.meta.url));
34289
+ return path60.dirname(fileURLToPath2(import.meta.url));
34175
34290
  }
34176
34291
  };
34177
34292
  var packageRoot2 = () => {
34178
34293
  const dir = moduleDir();
34179
34294
  for (const candidate of [
34180
- path59.resolve(dir, ".."),
34181
- path59.resolve(dir, "..", ".."),
34182
- path59.resolve(dir, "..", "..", "..")
34295
+ path60.resolve(dir, ".."),
34296
+ path60.resolve(dir, "..", ".."),
34297
+ path60.resolve(dir, "..", "..", "..")
34183
34298
  ]) {
34184
- if (existsSync21(path59.join(candidate, "package.json")))
34299
+ if (existsSync21(path60.join(candidate, "package.json")))
34185
34300
  return candidate;
34186
34301
  }
34187
- return path59.resolve(dir, "..");
34302
+ return path60.resolve(dir, "..");
34188
34303
  };
34189
34304
  var skillsRoot = () => {
34190
34305
  const root = packageRoot2();
34191
- const canonical = path59.resolve(root, "..", "workit-core", "skills");
34192
- if (existsSync21(path59.join(root, "src")) && existsSync21(canonical))
34306
+ const canonical = path60.resolve(root, "..", "workit-core", "skills");
34307
+ if (existsSync21(path60.join(root, "src")) && existsSync21(canonical))
34193
34308
  return canonical;
34194
- return path59.join(root, "assets", "skills");
34309
+ return path60.join(root, "assets", "skills");
34195
34310
  };
34196
34311
 
34197
34312
  // packages/workit-opencode/src/v2/registry.ts
@@ -34218,11 +34333,11 @@ var registerSkills = async (ctx) => {
34218
34333
  if (!existsSync22(skillsDir))
34219
34334
  return new Set;
34220
34335
  const listed = await ctx.skill.list().catch(() => ({ data: [] }));
34221
- const own = (skill) => typeof skill.path === "string" && path60.resolve(skill.path).startsWith(skillsDir + path60.sep);
34336
+ const own = (skill) => typeof skill.path === "string" && path61.resolve(skill.path).startsWith(skillsDir + path61.sep);
34222
34337
  const userSkills = new Set((listed?.data ?? []).filter((skill) => !own(skill)).map((skill) => skill.id));
34223
34338
  const packaged = new Map;
34224
34339
  for (const id of WORKIT_METHOD_SKILLS) {
34225
- const file = path60.join(skillsDir, id, "SKILL.md");
34340
+ const file = path61.join(skillsDir, id, "SKILL.md");
34226
34341
  if (!userSkills.has(id) && existsSync22(file))
34227
34342
  packaged.set(id, file);
34228
34343
  }
@@ -34270,22 +34385,22 @@ var registerCommands = async (ctx, registeredSkills) => {
34270
34385
 
34271
34386
  // packages/workit-opencode/src/stale-sources.ts
34272
34387
  import { existsSync as existsSync23, readdirSync as readdirSync8 } from "node:fs";
34273
- import path61 from "node:path";
34388
+ import path62 from "node:path";
34274
34389
  import { fileURLToPath as fileURLToPath3 } from "node:url";
34275
34390
  var typescriptFiles = (directory) => {
34276
34391
  if (!existsSync23(directory))
34277
34392
  return [];
34278
34393
  return readdirSync8(directory, { withFileTypes: true }).flatMap((entry) => {
34279
- const file = path61.join(directory, entry.name);
34394
+ const file = path62.join(directory, entry.name);
34280
34395
  return entry.isDirectory() ? typescriptFiles(file) : entry.isFile() && file.endsWith(".ts") ? [file] : [];
34281
34396
  });
34282
34397
  };
34283
34398
  var pluginSourceFiles = [
34284
34399
  ...new Set([
34285
34400
  fileURLToPath3(import.meta.url),
34286
- ...typescriptFiles(path61.join(packageRoot2(), "src")),
34287
- path61.join(packageRoot2(), "..", "workit-core", "src", "core.ts"),
34288
- ...typescriptFiles(path61.join(packageRoot2(), "..", "workit-core", "src", "core"))
34401
+ ...typescriptFiles(path62.join(packageRoot2(), "src")),
34402
+ path62.join(packageRoot2(), "..", "workit-core", "src", "core.ts"),
34403
+ ...typescriptFiles(path62.join(packageRoot2(), "..", "workit-core", "src", "core"))
34289
34404
  ])
34290
34405
  ].filter((file) => existsSync23(file)).toSorted();
34291
34406
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/opencode",
3
- "version": "2.25.0",
3
+ "version": "2.25.1",
4
4
  "private": false,
5
5
  "description": "Workit OpenCode plugin — native tools, adaptive policy, and sixteen method skills",
6
6
  "keywords": [
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@opencode/plugin": "2.3.2",
44
- "@workit-dev/core": "^2.25.0"
44
+ "@workit-dev/core": "^2.25.1"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=24"