@workit-dev/opencode 2.10.0 → 2.11.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.
@@ -22,7 +22,8 @@ way a user would.
22
22
  already has a project skills directory, use it:
23
23
  - **Launch:** one command, its ready signal (log line, port, exit 0), a timeout.
24
24
  Builds, installs and e2e suites run under the heavy-check lease
25
- (`workit check --heavy -- <cmd>`); a long-running server does not.
25
+ (`workit check --heavy -- <cmd>`). A dev server starts in the background
26
+ through `workit run --bg -- <cmd>`, which prints its id, port and log.
26
27
  - **Doctor:** each precondition and its fix (deps, env vars, ports, services).
27
28
  - **Drive:** how to exercise it: CLI invocations, `curl` against routes, a
28
29
  browser tool for UI, with fixture data.
@@ -31,7 +32,7 @@ way a user would.
31
32
  agent-browser, with a screenshot or console/network observation; an API
32
33
  with a real call, response quoted. The report carries the observation.
33
34
  App not runnable? Say so plainly, never claim success.
34
- - **Cleanup:** stop processes, remove temp data.
35
+ - **Cleanup:** `workit stop <id>` for each server it started, remove temp data.
35
36
  - **Feature map:** feature, how to drive it, expected observation.
36
37
  3. **Prove it end-to-end once:** launch, drive one feature, capture evidence,
37
38
  clean up. Fix the skill until that run is clean. A generated skill that was
@@ -56,10 +57,11 @@ report `clean`, `changed` (what) or `blocked` (why).
56
57
 
57
58
  Bad: "Verify by running the tests." (that is not the real surface)
58
59
 
59
- Good: "Launch `bun run dev` (ready: `listening on :5173`, 30 s). Drive:
60
- `curl -s localhost:5173/api/health` returned `{"ok":true}`; screenshot of
61
- /settings at .workit-scratch/settings.png. Evidence:
62
- `workit check --name verify-web -- bun scripts/smoke.ts` exit 0."
60
+ Good: "Launch `workit run --bg -- bun run dev` (ready: `listening on :5173`,
61
+ 30 s). Drive: `curl -s localhost:5173/api/health` returned `{"ok":true}`;
62
+ screenshot of /settings at .workit-scratch/settings.png. Evidence:
63
+ `workit check --name verify-web -- bun scripts/smoke.ts` exit 0. Cleanup:
64
+ `workit stop p1abc2def3`."
63
65
 
64
66
  ## Check
65
67
 
@@ -14,6 +14,7 @@ description: Launch, drive and observe <app> on its real surface (<cli|web|api>)
14
14
 
15
15
  ## Launch
16
16
  `<command>` - ready when `<log line | port open | exit 0>`, timeout <n> s.
17
+ A server: `workit run --bg -- <command>` (prints its id, port and log).
17
18
 
18
19
  ## Doctor
19
20
  | Precondition | Check | Fix |
@@ -34,7 +35,7 @@ UI: also report a console or network observation. API: quote the real response.
34
35
  If the app cannot be run, say so plainly instead of claiming success.
35
36
 
36
37
  ## Cleanup
37
- `<command>` (stop servers, remove `<tmp dir>`).
38
+ `workit stop <id>` for each server Launch started; remove `<tmp dir>`.
38
39
 
39
40
  ## Feature map
40
41
  | Feature | Drive | Expect |
package/dist/plugin.js CHANGED
@@ -20278,7 +20278,7 @@ function workitCheckTail(words) {
20278
20278
  } else if (!/^workit(?:\.exe|\.cmd)?$/.test(commandName(words[0])))
20279
20279
  return null;
20280
20280
  const { rest: args, cwd } = skipWorkitGlobals(words.slice(at + 1));
20281
- if (args[0] !== "check" && !(args[0] === "lock" && args[1] === "run"))
20281
+ if (args[0] !== "check" && args[0] !== "run" && !(args[0] === "lock" && args[1] === "run"))
20282
20282
  return null;
20283
20283
  const split = args.indexOf("--");
20284
20284
  const tail = split < 0 ? [] : args.slice(split + 1);
@@ -24990,7 +24990,9 @@ var WORKIT_ALLOWED_VERBS = [
24990
24990
  "verify-delivery",
24991
24991
  "policy",
24992
24992
  "doctor",
24993
- "help"
24993
+ "help",
24994
+ "ps",
24995
+ "stop"
24994
24996
  ];
24995
24997
  var WORKIT_BYPASS_FLAGS = ["--unverified", "--overwrite-unintegrated"];
24996
24998
  var WORKIT_USER_ONLY = [
@@ -25676,6 +25678,95 @@ function builtIn(words, depth = 0) {
25676
25678
  const command = words.slice(1).find((word) => !word.startsWith("-") && !word.startsWith("+") || rule.has(word));
25677
25679
  return command !== undefined && rule.has(command) ? label() : null;
25678
25680
  }
25681
+ var SERVER_SCRIPT = /(?:^|[:_.-])(?:dev|serve|start|storybook)(?:$|[:_.-])/iu;
25682
+ var serverScript = (script = "") => SERVER_SCRIPT.test(script) && !HEAVY_SCRIPT.test(script);
25683
+ var NUXT = sub("dev", "preview", "start");
25684
+ var WEBPACK = sub("serve", "s", "server");
25685
+ var SERVER_TOOLS = {
25686
+ ng: sub("serve", "s"),
25687
+ next: sub("dev", "start"),
25688
+ nuxt: NUXT,
25689
+ nuxi: NUXT,
25690
+ astro: sub("dev", "preview"),
25691
+ "react-scripts": sub("start"),
25692
+ webpack: WEBPACK,
25693
+ "webpack-cli": WEBPACK,
25694
+ storybook: sub("dev", "start"),
25695
+ rails: sub("server", "s"),
25696
+ mix: sub("phx.server")
25697
+ };
25698
+ var COMPOSE_VALUES = new Set([
25699
+ "-f",
25700
+ "--file",
25701
+ "-p",
25702
+ "-H",
25703
+ "--host",
25704
+ "--context",
25705
+ "-c",
25706
+ "--config"
25707
+ ]);
25708
+ function serverBuiltIn(words, depth = 0) {
25709
+ const name = baseName2(words[0]);
25710
+ if (depth > 6 || WORKIT.test(name) || words.some((word) => /^(?:-h|--help|--version)$/u.test(word)))
25711
+ return null;
25712
+ const compose = /^(?:docker|podman|nerdctl|docker-compose)$/u.test(name);
25713
+ const at = positional2(words, 1, compose ? COMPOSE_VALUES : PM_VALUES);
25714
+ const command = words[at];
25715
+ const yes = words.slice(0, 3).join(" ");
25716
+ const inner = (from) => serverBuiltIn(words.slice(from), depth + 1);
25717
+ const up = (from) => words[from] === "up" && !words.some((word) => /^(?:-d|--detach|--wait)$/u.test(word));
25718
+ if (name === "npx" || name === "bunx" || name === "pnpx")
25719
+ return inner(at);
25720
+ if (name === "corepack")
25721
+ return inner(1);
25722
+ if (command === undefined)
25723
+ return name === "vite" ? yes : null;
25724
+ if (name === "npm" || name === "pnpm" || name === "yarn" || name === "bun" || name === "deno") {
25725
+ if (EXEC.has(command))
25726
+ return inner(positional2(words, at + 1));
25727
+ if (command === "start")
25728
+ return yes;
25729
+ if (name === "yarn" && command === "workspace")
25730
+ return serverScript(words[at + 2]) ? yes : inner(at + 2);
25731
+ if (NPM_RUN.has(command) || name === "deno" && command === "task") {
25732
+ if (serverScript(words[positional2(words, at + 1)]))
25733
+ return yes;
25734
+ return name === "bun" && command !== "task" ? inner(positional2(words, at + 1)) : null;
25735
+ }
25736
+ if (name === "npm" || name === "deno")
25737
+ return null;
25738
+ return serverScript(command) ? yes : inner(at);
25739
+ }
25740
+ if (PYTHONS.test(name)) {
25741
+ const m = words.indexOf("-m");
25742
+ if (words[m + 1] === "http.server" || command.endsWith("manage.py")) {
25743
+ return m > 0 || words[at + 1] === "runserver" ? yes : null;
25744
+ }
25745
+ return m > 0 && words[m + 1] ? inner(m + 1) : null;
25746
+ }
25747
+ if (["uv", "poetry", "pdm", "pipenv", "hatch", "rye", "bundle"].includes(name))
25748
+ return command === "run" || command === "exec" ? inner(positional2(words, at + 1)) : null;
25749
+ if (name === "make" || name === "gmake")
25750
+ return words.slice(1).some((word) => !/^-|=/u.test(word) && serverScript(word)) ? yes : null;
25751
+ if (name === "nx")
25752
+ return serverScript(command === "run" ? words[at + 1]?.split(":")[1] : command) ? yes : null;
25753
+ if (name === "docker-compose")
25754
+ return up(at) ? yes : null;
25755
+ if (compose)
25756
+ return command === "compose" && up(positional2(words, at + 1, COMPOSE_VALUES)) ? yes : null;
25757
+ if (name === "vite")
25758
+ return command === "build" || command === "optimize" ? null : yes;
25759
+ const rule = SERVER_TOOLS[name];
25760
+ return rule && rule !== "any" && rule.has(command) ? yes : null;
25761
+ }
25762
+ function serverCommand(command, dialect = "posix") {
25763
+ for (const line of linesOf(command, dialect) ?? []) {
25764
+ const reason = serverBuiltIn(line);
25765
+ if (reason)
25766
+ return { line, reason };
25767
+ }
25768
+ return null;
25769
+ }
25679
25770
  var globWord = (word) => new RegExp(`^${word.replace(/[.+?^${}()|[\]\\]/gu, "\\$&").replaceAll("*", ".*")}$`, "u");
25680
25771
  function parsePattern(pattern) {
25681
25772
  const words = pattern.trim().split(/\s+/u).filter(Boolean);
@@ -25772,6 +25863,28 @@ function heavyPlan(command, options) {
25772
25863
  unblock: parts[0] ?? null
25773
25864
  };
25774
25865
  }
25866
+ function serverPlan(command, options) {
25867
+ const dialect = options.dialect ?? "posix";
25868
+ if (dialect !== "posix" || !gitTop(options.cwd))
25869
+ return { kind: "none" };
25870
+ const found = serverCommand(command, dialect);
25871
+ if (!found)
25872
+ return { kind: "none" };
25873
+ const simple = simpleCommand(command, dialect, 0, true);
25874
+ const single = simple && serverBuiltIn(simple);
25875
+ if (options.rules !== null && !wrapAllowed(options.rules, single ? (linesOf(command, dialect) ?? []).flat() : found.line, single ? command : found.line.join(" "), options).ok)
25876
+ return { kind: "passthrough", note: "" };
25877
+ if (single) {
25878
+ const rewrite = leaseRewrite(command)?.replace("workit check --heavy --", "workit run --bg --");
25879
+ return rewrite ? { kind: "rewrite", command: rewrite, reason: single, server: true } : { kind: "none" };
25880
+ }
25881
+ const start = `workit run --bg -- ${found.line.map(quoteWord).join(" ")}`;
25882
+ return {
25883
+ kind: "split",
25884
+ reason: `dev_server: \`${command.trim()}\` chains a dev server (${found.reason}) with other commands. Start it alone, now: \`${start}\`; then run the other parts as their own commands.`,
25885
+ unblock: start
25886
+ };
25887
+ }
25775
25888
  function workitOnPath2(env = process.env) {
25776
25889
  const names = process.platform === "win32" ? ["workit.exe", "workit.cmd", "workit"] : ["workit"];
25777
25890
  for (const dir of (env.PATH ?? "").split(path38.delimiter))
@@ -25869,13 +25982,18 @@ function heavyGate(cwd, command, options) {
25869
25982
  const single = dialect === "posix" ? simpleCommand(command, dialect, 0, true) : null;
25870
25983
  if (single && lightCommand(single, cwd))
25871
25984
  return { kind: "none" };
25872
- return heavyPlan(command, {
25985
+ const plan = {
25873
25986
  cwd,
25874
25987
  env,
25875
25988
  dialect,
25876
25989
  rules: rulesFor(options.host, cwd, env),
25877
25990
  bypass: options.permissionMode === "bypassPermissions"
25878
- });
25991
+ };
25992
+ const server = serverPlan(command, plan);
25993
+ if (server.kind === "rewrite")
25994
+ return server;
25995
+ const heavy = heavyPlan(command, plan);
25996
+ return heavy.kind === "none" ? server : heavy;
25879
25997
  } catch {
25880
25998
  return { kind: "none" };
25881
25999
  }
@@ -26418,8 +26536,10 @@ var opaqueWrites = (input, scriptOf = (index) => input[index], fed) => {
26418
26536
  return curlOutputs(args);
26419
26537
  if (name === "perl")
26420
26538
  return inline(/^-[a-zA-Z]*[eE]$/);
26539
+ if (name.startsWith("python") && args.some((arg, at) => arg === "-m" && args[at + 1] !== "json.tool"))
26540
+ return [".", ...args.flatMap(pathsIn)];
26421
26541
  if (/^(?:python[\d.]*|node|bun|deno|ruby|php)$/.test(name))
26422
- return inline(/^-[a-zA-Z]*[ce]$|^--eval$|^-p$/);
26542
+ return inline(/^-[a-zA-Z]*[cep]$|^--(?:eval|print)$/);
26423
26543
  return shellScript2(words) === null ? null : ["."];
26424
26544
  };
26425
26545
  var CURL_LONG = [
@@ -27151,7 +27271,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
27151
27271
  shells.push(...read(named));
27152
27272
  shells.push(...preloads.flatMap(read));
27153
27273
  } else if (INTERPRETERS.test(verb)) {
27154
- const code = args.findIndex((arg) => /^-[a-zA-Z]*[ce]$|^--eval$/.test(arg));
27274
+ const code = args.findIndex((arg) => /^-[a-zA-Z]*[cep]$|^--(?:eval|print)$/.test(arg));
27155
27275
  if (code >= 0)
27156
27276
  others.push(...expansions(args[code + 1] ?? "", vars, loops));
27157
27277
  others.push(...named === undefined ? [...segment.stdin ?? [], ...inputs.flatMap(read), ...piped] : read(named), ...preloads.flatMap(read));
@@ -28566,78 +28686,6 @@ var MUTATING_REMOTE = new Set([
28566
28686
  "set-branches",
28567
28687
  "prune"
28568
28688
  ]);
28569
- var GIT_VERBS = {
28570
- log: "@d@l|@d @l",
28571
- show: "@d@l|@d @l",
28572
- diff: "@d|@d cached staged merge-base no-index",
28573
- "diff-tree": "@drtcm|@d root stdin no-commit-id",
28574
- "diff-index": "@dm|@d cached merge-base",
28575
- status: "sbu?zv|short branch porcelain? long untracked-files? ignored? ignore-submodules? show-stash ahead-behind no-ahead-behind renames no-renames find-renames? column? no-column null verbose",
28576
- "rev-parse": "q|verify short? abbrev-ref? symbolic symbolic-full-name show-toplevel show-prefix git-dir git-common-dir absolute-git-dir is-inside-work-tree is-inside-git-dir is-bare-repository show-cdup quiet all branches? tags? remotes? since= until= default= path-format= sq-quote",
28577
- "rev-list": "@l|@l count objects? left-only right-only",
28578
- "ls-files": "cdmoiskuvtzfx:X:|cached deleted modified others ignored stage unmerged killed directory no-empty-directory exclude-standard exclude= exclude-from= full-name abbrev? error-unmatch with-tree= eol deduplicate format= recurse-submodules sparse",
28579
- "ls-tree": "rdtlz|long name-only name-status object-only full-name full-tree abbrev? format=",
28580
- "cat-file": "tsepz|batch? batch-check? batch-all-objects follow-symlinks unordered buffer allow-unknown-type mailmap use-mailmap",
28581
- blame: "L:lstfnepwbcM?C?|porcelain line-porcelain incremental root show-stats show-name show-number show-email abbrev= reverse= first-parent date= ignore-rev= ignore-revs-file= minimal contents=",
28582
- describe: "|tags all long abbrev= contains always dirty? broken? match= exclude= first-parent exact-match candidates= debug",
28583
- "merge-base": "a|all octopus independent is-ancestor fork-point",
28584
- "for-each-ref": "|count= sort= format= color? shell perl python tcl points-at= merged? no-merged? contains? no-contains? ignore-case omit-empty exclude=",
28585
- shortlog: "@lsnec|@l summary numbered email committer group= format=",
28586
- "show-ref": "dsq|head verify heads tags branches hash? abbrev? quiet dereference exists",
28587
- "name-rev": "|tags refs= exclude= all annotate-stdin name-only no-undefined always",
28588
- grep: "aiIvnhHcEGFPlLzoWqwe:A:B:C:m:f:|cached untracked no-index no-exclude-standard exclude-standard recurse-submodules text ignore-case word-regexp invert-match line-number column count full-name extended-regexp basic-regexp fixed-strings perl-regexp files-with-matches name-only files-without-match null only-matching heading break show-function function-context max-depth= threads= and or not all-match quiet after-context= before-context= context= max-count= color? no-color",
28589
- "format-patch": "@do:nNks|@d stdout output-directory= numbered no-numbered start-number= subject-prefix= root cover-letter thread? signoff attach? inline? suffix= base=",
28590
- reflog: "@l|@l all expire= expire-unreachable= rewrite updateref stale-fix dry-run verbose",
28591
- "count-objects": "vH|verbose human-readable",
28592
- "check-ignore": "qvnz|quiet verbose stdin non-matching no-index",
28593
- var: "l|",
28594
- version: "|build-options",
28595
- "ls-remote": "htbq|heads tags branches refs quiet exit-code get-url symref sort=",
28596
- remote: "v|verbose",
28597
- config: "lz|get get-all get-regexp list local name-only null type= default=",
28598
- worktree: "fdqvzb:B:|force detach lock reason= orphan no-checkout checkout quiet track no-track guess-remote porcelain expire= verbose",
28599
- branch: "dDmMcCfvraliu:|delete move copy force list all remotes verbose contains? merged? no-merged? points-at= show-current set-upstream-to= unset-upstream track? no-track sort= format= color? column? ignore-case create-reflog",
28600
- tag: "lam:dfF:n?|list annotate message= file= delete force sort= format= contains? merged? no-merged? points-at= column? create-reflog ignore-case",
28601
- init: "+qb:|quiet bare initial-branch= object-format= ref-format= shared? separate-git-dir=",
28602
- add: "+AunNvf|all update intent-to-add force dry-run verbose ignore-errors ignore-removal no-all renormalize chmod= sparse",
28603
- commit: "+m:aqsnF:C:ouv|message= all amend no-edit allow-empty allow-empty-message author= date= signoff no-verify quiet file= reuse-message= fixup= squash= only include dry-run no-gpg-sign untracked-files? cleanup= reset-author verbose",
28604
- checkout: "+b:B:fqm|detach force orphan= quiet track? no-track merge ours theirs",
28605
- switch: "+c:C:dfqm|create= force-create= detach discard-changes force orphan= quiet track? no-track merge",
28606
- restore: "+s:SWq|source= staged worktree ours theirs merge quiet overlay no-overlay",
28607
- reset: "+qN|soft mixed hard merge keep quiet no-refresh",
28608
- rm: "+rfnq|cached force dry-run quiet ignore-unmatch",
28609
- mv: "+fnkv|force dry-run verbose",
28610
- merge: "+m:qvnX:|no-ff ff ff-only squash no-squash commit no-commit message= no-edit abort continue quit allow-unrelated-histories stat no-stat quiet verbose no-verify signoff strategy-option=",
28611
- stash: "+m:ukqa|message= include-untracked keep-index quiet all index staged",
28612
- apply: "+p:C:R3qv|check stat numstat summary index cached 3way reverse reject allow-empty exclude= include= verbose quiet whitespace= recount",
28613
- am: "+skq3|signoff keep 3way quiet abort continue skip quit whitespace= reject",
28614
- fetch: "+fqvptn|all depth= deepen= shallow-since= unshallow tags no-tags prune force quiet verbose dry-run update-shallow refmap=",
28615
- clone: "+nqlsb:o:|bare no-checkout depth= branch= origin= single-branch no-single-branch no-tags quiet shared local no-local filter= separate-git-dir=",
28616
- "cherry-pick": "+nm:sxX:|no-commit mainline= signoff abort continue skip quit allow-empty keep-redundant-commits ff strategy-option=",
28617
- revert: "+nm:sX:|no-commit mainline= signoff abort continue skip quit strategy-option= no-edit",
28618
- rebase: "+qvfnX:|onto= root abort continue skip quit keep-base no-ff force-rebase autosquash no-autosquash autostash no-autostash update-refs signoff quiet verbose stat no-stat committer-date-is-author-date reset-author-date rebase-merges? no-rebase-merges empty= strategy-option= apply merge",
28619
- clean: "+dfnqxXe:|dry-run force quiet exclude=",
28620
- bisect: "+|term-old= term-new= no-checkout first-parent"
28621
- };
28622
- var JUDGE_GIT = `a judge runs git ${Object.keys(GIT_VERBS).join(" ")} with the options each documents (no abbreviations), writing only in a scratch repo; no -c, no wrapper but timeout, nice, time, command, no env but PAGER=cat, GIT_PAGER=cat, GIT_OPTIONAL_LOCKS=0, LC_*, LANG, TZ; status outside scratch needs --no-optional-locks`;
28623
- var JUDGE_VERBS = {
28624
- check: true,
28625
- dir: true,
28626
- help: true,
28627
- "test-audit": true,
28628
- ledger: ["verdict", "list", "check", "ruling", "show"],
28629
- finding: ["record", "list"],
28630
- pr: ["status"],
28631
- ci: ["wait", "logs"],
28632
- fanout: ["status", "brief"],
28633
- models: ["show"],
28634
- lock: ["status"],
28635
- lease: ["status"],
28636
- grant: ["show"],
28637
- task: ["show", "list"],
28638
- doctor: ["--json"]
28639
- };
28640
- var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
28641
28689
 
28642
28690
  // packages/workit-core/src/hooks/steering.ts
28643
28691
  var ROLES = {
@@ -28980,6 +29028,44 @@ var SCAN_MS = 30 * 60000;
28980
29028
  // packages/workit-core/src/hooks/agent-model.ts
28981
29029
  var UNLISTED = new Set(["description", "prompt"]);
28982
29030
 
29031
+ // packages/workit-core/src/hooks/server-gate.ts
29032
+ import fs30 from "node:fs";
29033
+ import path44 from "node:path";
29034
+ var procNoticeFile = (env, session) => path44.join(stateDir(env), "procs", "notices", `${session.replace(/[^A-Za-z0-9_.@+-]/gu, "-").slice(0, 120) || "none"}.json`);
29035
+ var mb = (bytes) => `${Math.round(Number(bytes) / 1048576)} MB`;
29036
+ function takeProcNotice(session, env = process.env) {
29037
+ if (!session)
29038
+ return null;
29039
+ const file = procNoticeFile(env, session);
29040
+ const taken = `${file}.${process.pid}.taken`;
29041
+ try {
29042
+ fs30.renameSync(file, taken);
29043
+ } catch {
29044
+ return null;
29045
+ }
29046
+ try {
29047
+ const { notices } = JSON.parse(fs30.readFileSync(taken, "utf8"));
29048
+ const lines = (Array.isArray(notices) ? notices : []).flatMap((notice) => {
29049
+ if (!notice || typeof notice !== "object")
29050
+ return [];
29051
+ const { id, cmd, cwd, rssBytes, ceilingBytes } = notice;
29052
+ if (typeof id !== "string")
29053
+ return [];
29054
+ return [
29055
+ `- ${id} \`${String(cmd)}\` in ${String(cwd)}: ${mb(rssBytes)} (ceiling ${mb(ceilingBytes)}). Restart it: \`workit run --bg --restart ${id}\`, or \`workit stop ${id}\`.`
29056
+ ];
29057
+ });
29058
+ return lines.length ? ["Workit: a background process you started is past the memory ceiling:", ...lines].join(`
29059
+ `) : null;
29060
+ } catch {
29061
+ return null;
29062
+ } finally {
29063
+ try {
29064
+ fs30.rmSync(taken, { force: true });
29065
+ } catch {}
29066
+ }
29067
+ }
29068
+
28983
29069
  // packages/workit-core/src/hooks/ytrack-word.ts
28984
29070
  var YTRACK_WORD = /ytrack(?![\w/-]|\.(?!exe|cmd))/i;
28985
29071
  var namesYtrack = (text) => {
@@ -29460,9 +29546,11 @@ var ytrackGate = (cwd, command, dialect, ask) => {
29460
29546
  const run = calls.length ? ` Run ${calls.join(", then ")} instead, each as its own plain call: it asks the user first.` : "";
29461
29547
  const user = bare.length ? ask ? ` For ${bare.join(", ")}, run it as its own plain call: the host asks the user.` : ` For ${bare.join(", ")}, the user decides: ask the user, and if they agree they run it in their own terminal.` : "";
29462
29548
  const rerun = writes.some((write) => write.gap === NOT_PLAIN.gap) ? " To get the named workit youtrack call instead, rerun the ytrack call as one plain command, with no wrapper, loop, substitution or script around it." : "";
29549
+ const retry = writes.find((write) => write.workit)?.workit ?? (rerun ? writes.find((write) => write.gap === NOT_PLAIN.gap)?.command : undefined);
29463
29550
  return {
29464
29551
  kind: "deny",
29465
- reason: `${why}${run}${user}${rerun}`,
29552
+ reason: `${why}${run}${user}${rerun}${retry ? `
29553
+ Retry as: ${retry}` : ""}`,
29466
29554
  unblock: writes[0]?.workit ?? null
29467
29555
  };
29468
29556
  };
@@ -29484,11 +29572,11 @@ var PROCESS_START = performance.timeOrigin;
29484
29572
  // packages/workit-core/src/hooks/run.ts
29485
29573
  if (false) {}
29486
29574
  // packages/workit-opencode/src/shared/init-apply.ts
29487
- import path48 from "node:path";
29575
+ import path49 from "node:path";
29488
29576
 
29489
29577
  // packages/workit-core/src/core/gitignore.ts
29490
29578
  import { existsSync as existsSync15, readFileSync as readFileSync13, writeFileSync as writeFileSync5 } from "node:fs";
29491
- import path44 from "node:path";
29579
+ import path45 from "node:path";
29492
29580
  var GITIGNORE_ENTRIES = [
29493
29581
  "# workit: SDD working state (never commit)",
29494
29582
  "docs/*/sdd/",
@@ -29508,7 +29596,7 @@ var GITIGNORE_ENTRIES = [
29508
29596
  var ensureProjectGitignore = (workspaceRoot, confirmed) => {
29509
29597
  if (!confirmed)
29510
29598
  return { ok: false, error: "confirmed: true required" };
29511
- const file = path44.join(workspaceRoot, ".gitignore");
29599
+ const file = path45.join(workspaceRoot, ".gitignore");
29512
29600
  const existing = existsSync15(file) ? readFileSync13(file, "utf8") : "";
29513
29601
  const existingLines = new Set(existing.split(`
29514
29602
  `).map((l) => l.trim()).filter(Boolean));
@@ -29536,25 +29624,25 @@ var ensureProjectGitignore = (workspaceRoot, confirmed) => {
29536
29624
 
29537
29625
  // packages/workit-core/src/core/hygiene.ts
29538
29626
  import { existsSync as existsSync16, readFileSync as readFileSync14, readdirSync as readdirSync6, writeFileSync as writeFileSync6 } from "node:fs";
29539
- import path45 from "node:path";
29627
+ import path46 from "node:path";
29540
29628
  var repoRoot3 = assetRoot();
29541
- var templatesDir = () => path45.join(repoRoot3, "templates", "hygiene");
29629
+ var templatesDir = () => path46.join(repoRoot3, "templates", "hygiene");
29542
29630
  var packageJson = (root) => {
29543
- if (!existsSync16(path45.join(root, "package.json")))
29631
+ if (!existsSync16(path46.join(root, "package.json")))
29544
29632
  return null;
29545
29633
  try {
29546
- return JSON.parse(readFileSync14(path45.join(root, "package.json"), "utf8"));
29634
+ return JSON.parse(readFileSync14(path46.join(root, "package.json"), "utf8"));
29547
29635
  } catch {
29548
29636
  return null;
29549
29637
  }
29550
29638
  };
29551
29639
  var isOpenSource = (root) => {
29552
- if (existsSync16(path45.join(root, "LICENSE")))
29640
+ if (existsSync16(path46.join(root, "LICENSE")))
29553
29641
  return true;
29554
29642
  const pkg = packageJson(root);
29555
29643
  if (pkg && !pkg.private)
29556
29644
  return true;
29557
- return path45.basename(root) === "workit";
29645
+ return path46.basename(root) === "workit";
29558
29646
  };
29559
29647
  var licenseHolder = (root) => {
29560
29648
  const pkg = packageJson(root);
@@ -29577,13 +29665,13 @@ var planHygieneFiles = (root, opts = {}) => {
29577
29665
  files.push("LICENSE", "CONTRIBUTING.md");
29578
29666
  const planned = [];
29579
29667
  for (const file of files) {
29580
- if (existsSync16(path45.join(root, file)))
29668
+ if (existsSync16(path46.join(root, file)))
29581
29669
  continue;
29582
- const tpl = path45.join(templatesDir(), file);
29670
+ const tpl = path46.join(templatesDir(), file);
29583
29671
  if (!existsSync16(tpl))
29584
29672
  continue;
29585
- const content = readFileSync14(tpl, "utf8").replace(/<PROJECT>/g, path45.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
29586
- planned.push({ path: path45.join(root, file), content });
29673
+ const content = readFileSync14(tpl, "utf8").replace(/<PROJECT>/g, path46.basename(root)).replace(/<YEAR>/g, String(new Date().getFullYear())).replace(/<HOLDER>\s*/g, licenseHolder(root));
29674
+ planned.push({ path: path46.join(root, file), content });
29587
29675
  }
29588
29676
  return planned;
29589
29677
  };
@@ -29593,19 +29681,19 @@ var ensureHygieneFiles = (root, opts) => {
29593
29681
  const created = [];
29594
29682
  for (const planned of planHygieneFiles(root, opts)) {
29595
29683
  writeFileSync6(planned.path, planned.content, "utf8");
29596
- created.push(path45.basename(planned.path));
29684
+ created.push(path46.basename(planned.path));
29597
29685
  }
29598
29686
  return { ok: true, created };
29599
29687
  };
29600
29688
 
29601
29689
  // packages/workit-core/src/core/init.ts
29602
- import fs30 from "node:fs";
29603
- import path47 from "node:path";
29690
+ import fs31 from "node:fs";
29691
+ import path48 from "node:path";
29604
29692
  import { spawnSync as spawnSync25 } from "node:child_process";
29605
29693
 
29606
29694
  // packages/workit-core/src/core/workspace-branch-policy.ts
29607
29695
  import { mkdirSync as mkdirSync5, readFileSync as readFileSync15, renameSync as renameSync4, rmSync as rmSync3, writeFileSync as writeFileSync7 } from "node:fs";
29608
- import path46 from "node:path";
29696
+ import path47 from "node:path";
29609
29697
  import { isDeepStrictEqual } from "node:util";
29610
29698
  var readFileSafe = (p) => {
29611
29699
  try {
@@ -29616,7 +29704,7 @@ var readFileSafe = (p) => {
29616
29704
  };
29617
29705
  function applyWorkspaceBranchPolicy(opts) {
29618
29706
  const { workspace_root, env = process.env } = opts;
29619
- const dir = path46.join(env.WORKIT_CONFIG ?? configDir2());
29707
+ const dir = path47.join(env.WORKIT_CONFIG ?? configDir2());
29620
29708
  const {
29621
29709
  status,
29622
29710
  path: wsPath,
@@ -29628,7 +29716,7 @@ function applyWorkspaceBranchPolicy(opts) {
29628
29716
  if (status === "malformed" || status === "invalid")
29629
29717
  return { ok: false, error: workspacesError ?? `invalid workspaces.json: ${wsPath}` };
29630
29718
  const detection = detectBranchPolicy(workspace_root);
29631
- const name = String(env.WORKIT_BP_NAME ?? path46.basename(workspace_root));
29719
+ const name = String(env.WORKIT_BP_NAME ?? path47.basename(workspace_root));
29632
29720
  const integration = env.WORKIT_BP_INTEGRATION ?? detection.integration;
29633
29721
  const policy = {
29634
29722
  preset: detection.preset,
@@ -29677,7 +29765,7 @@ function applyWorkspaceBranchPolicy(opts) {
29677
29765
  ok: false,
29678
29766
  error: `workspaces.json changed while applying the branch policy: ${wsPath}`
29679
29767
  };
29680
- mkdirSync5(path46.dirname(wsPath), { recursive: true });
29768
+ mkdirSync5(path47.dirname(wsPath), { recursive: true });
29681
29769
  const tmp = `${wsPath}.${process.pid}.tmp`;
29682
29770
  try {
29683
29771
  writeFileSync7(tmp, JSON.stringify({ ...document, workspaces: next }, null, 2) + `
@@ -29711,7 +29799,7 @@ function applyWorkspaceBranchPolicy(opts) {
29711
29799
  // packages/workit-core/src/core/init.ts
29712
29800
  var readJson3 = (p) => {
29713
29801
  try {
29714
- const parsed = JSON.parse(fs30.readFileSync(p, "utf8"));
29802
+ const parsed = JSON.parse(fs31.readFileSync(p, "utf8"));
29715
29803
  return isConfigObject(parsed) ? parsed : null;
29716
29804
  } catch {
29717
29805
  return null;
@@ -29774,11 +29862,11 @@ var vcsJsonContent = () => {
29774
29862
  };
29775
29863
  function initApplyData(action, env = process.env) {
29776
29864
  const dir = String(env.WORKIT_CONFIG ?? configDir2());
29777
- fs30.mkdirSync(dir, { recursive: true });
29865
+ fs31.mkdirSync(dir, { recursive: true });
29778
29866
  switch (action) {
29779
29867
  case "youtrack_json": {
29780
- const out = path47.join(dir, "youtrack.json");
29781
- fs30.writeFileSync(out, JSON.stringify(youtrackJsonContent(), null, 2) + `
29868
+ const out = path48.join(dir, "youtrack.json");
29869
+ fs31.writeFileSync(out, JSON.stringify(youtrackJsonContent(), null, 2) + `
29782
29870
  `, "utf8");
29783
29871
  return { action, ok: true, path: out };
29784
29872
  }
@@ -29791,10 +29879,10 @@ function initApplyData(action, env = process.env) {
29791
29879
  };
29792
29880
  }
29793
29881
  case "youtrack_scaffold": {
29794
- const jsonOut = path47.join(dir, "youtrack.json");
29795
- fs30.writeFileSync(jsonOut, JSON.stringify(youtrackJsonContent(), null, 2) + `
29882
+ const jsonOut = path48.join(dir, "youtrack.json");
29883
+ fs31.writeFileSync(jsonOut, JSON.stringify(youtrackJsonContent(), null, 2) + `
29796
29884
  `, "utf8");
29797
- const configPath = path47.resolve(jsonOut);
29885
+ const configPath = path48.resolve(jsonOut);
29798
29886
  const cfg = readJson3(configPath) ?? {};
29799
29887
  const base = String(cfg.baseUrl ?? "").replace(/\/+$/, "");
29800
29888
  const meeting = String(cfg.meetingIssue ?? "");
@@ -29830,10 +29918,10 @@ function initApplyData(action, env = process.env) {
29830
29918
  };
29831
29919
  }
29832
29920
  case "vcs_scaffold": {
29833
- const jsonOut = path47.join(dir, "vcs.json");
29834
- fs30.writeFileSync(jsonOut, JSON.stringify(vcsJsonContent(), null, 2) + `
29921
+ const jsonOut = path48.join(dir, "vcs.json");
29922
+ fs31.writeFileSync(jsonOut, JSON.stringify(vcsJsonContent(), null, 2) + `
29835
29923
  `, "utf8");
29836
- const configPath = path47.resolve(jsonOut);
29924
+ const configPath = path48.resolve(jsonOut);
29837
29925
  const prev = process.env.WORKIT_VCS_CONFIG;
29838
29926
  process.env.WORKIT_VCS_CONFIG = configPath;
29839
29927
  try {
@@ -29952,7 +30040,7 @@ var executeInitApply = (args, directory, runtime) => {
29952
30040
  protectedNames: args.branch_policy_protected
29953
30041
  }, current);
29954
30042
  writeConfig(next);
29955
- return output(ok({ action: "config", path: path48.join(configDir2(), "config.json"), ...next }));
30043
+ return output(ok({ action: "config", path: path49.join(configDir2(), "config.json"), ...next }));
29956
30044
  }
29957
30045
  const env = Object.fromEntries(Object.entries({
29958
30046
  WORKIT_YT_BASE_URL: args.base_url,
@@ -29969,14 +30057,14 @@ var executeInitApply = (args, directory, runtime) => {
29969
30057
 
29970
30058
  // packages/workit-opencode/src/shared/session.ts
29971
30059
  import { realpathSync as realpathSync11 } from "node:fs";
29972
- import path49 from "node:path";
30060
+ import path50 from "node:path";
29973
30061
  var sameWorkspace = (expected, observed) => {
29974
30062
  if (typeof observed !== "string" || !observed)
29975
30063
  return false;
29976
30064
  try {
29977
30065
  return realpathSync11(expected) === realpathSync11(observed);
29978
30066
  } catch {
29979
- return path49.resolve(expected) === path49.resolve(observed);
30067
+ return path50.resolve(expected) === path50.resolve(observed);
29980
30068
  }
29981
30069
  };
29982
30070
 
@@ -30048,7 +30136,7 @@ var workitFamilyOf = (toolName) => {
30048
30136
 
30049
30137
  // packages/workit-opencode/src/tools/context.ts
30050
30138
  import { realpathSync as realpathSync12 } from "node:fs";
30051
- import path50 from "node:path";
30139
+ import path51 from "node:path";
30052
30140
  var createContextTool = () => ({
30053
30141
  description: "Read Git, pull request, YouTrack, issue, changelog, release, or affected-file context.",
30054
30142
  execute: async (args, context) => {
@@ -30058,7 +30146,7 @@ var createContextTool = () => ({
30058
30146
  let root;
30059
30147
  try {
30060
30148
  const cwd = parsed.data.cwd;
30061
- root = realpathSync12(cwd ? path50.resolve(context.directory, cwd) : context.directory);
30149
+ root = realpathSync12(cwd ? path51.resolve(context.directory, cwd) : context.directory);
30062
30150
  } catch {
30063
30151
  return JSON.stringify(failure2("invalid_input", "context target directory cannot be resolved"), null, 2);
30064
30152
  }
@@ -30090,8 +30178,8 @@ var workerCoordinatorFor = (task, worker) => {
30090
30178
  // packages/workit-core/src/fanout.ts
30091
30179
  import { spawnSync as spawnSync29 } from "node:child_process";
30092
30180
  import { createHash as createHash20 } from "node:crypto";
30093
- import fs32 from "node:fs";
30094
- import path53 from "node:path";
30181
+ import fs33 from "node:fs";
30182
+ import path54 from "node:path";
30095
30183
 
30096
30184
  // packages/workit-core/src/fanout-landed.ts
30097
30185
  import { spawnSync as spawnSync26 } from "node:child_process";
@@ -30324,13 +30412,13 @@ var NOTICE_TTL_MS = 7 * 86400000;
30324
30412
  // packages/workit-core/src/stack.ts
30325
30413
  import { spawnSync as spawnSync28 } from "node:child_process";
30326
30414
  import { createHash as createHash19, randomBytes as randomBytes4 } from "node:crypto";
30327
- import fs31 from "node:fs";
30328
- import path52 from "node:path";
30415
+ import fs32 from "node:fs";
30416
+ import path53 from "node:path";
30329
30417
 
30330
30418
  // packages/workit-core/src/git/ops.ts
30331
30419
  import { spawnSync as spawnSync27 } from "node:child_process";
30332
30420
  import { copyFileSync as copyFileSync2, existsSync as existsSync17, readdirSync as readdirSync7, readFileSync as readFileSync16, rmSync as rmSync4 } from "node:fs";
30333
- import path51 from "node:path";
30421
+ import path52 from "node:path";
30334
30422
  var COMMIT_TIMEOUT_MS = 10 * 60000;
30335
30423
  var git5 = (cwd, args, options = {}) => {
30336
30424
  const result = spawnSync27("git", args, {
@@ -30363,18 +30451,18 @@ function operationInProgress(cwd) {
30363
30451
  if (!run.ok)
30364
30452
  return null;
30365
30453
  const found = run.stdout.split(`
30366
- `).map((line) => path51.resolve(cwd, line.trim()));
30454
+ `).map((line) => path52.resolve(cwd, line.trim()));
30367
30455
  const conflicted = () => git5(cwd, ["ls-files", "-u"]).stdout.trim() !== "";
30368
30456
  for (const [index, [, operation]] of markers.entries()) {
30369
30457
  const marker = found[index];
30370
30458
  if (!marker || !existsSync17(marker))
30371
30459
  continue;
30372
- if (index === 1 && existsSync17(path51.join(marker, "applying")))
30460
+ if (index === 1 && existsSync17(path52.join(marker, "applying")))
30373
30461
  return { operation: "am", commitAllowed: false, branch: null };
30374
- if (index === 0 && existsSync17(path51.join(marker, "amend")) && !conflicted()) {
30462
+ if (index === 0 && existsSync17(path52.join(marker, "amend")) && !conflicted()) {
30375
30463
  let headName = "";
30376
30464
  try {
30377
- headName = readFileSync16(path51.join(marker, "head-name"), "utf8").trim();
30465
+ headName = readFileSync16(path52.join(marker, "head-name"), "utf8").trim();
30378
30466
  } catch {}
30379
30467
  const branch = headName.startsWith("refs/heads/") ? headName.slice("refs/heads/".length) : null;
30380
30468
  return { operation, commitAllowed: branch !== null, branch };
@@ -30487,7 +30575,7 @@ function rebasingBranch2(dir) {
30487
30575
  if (!found.ok)
30488
30576
  continue;
30489
30577
  try {
30490
- return fs31.readFileSync(found.stdout.trim(), "utf8").trim();
30578
+ return fs32.readFileSync(found.stdout.trim(), "utf8").trim();
30491
30579
  } catch {}
30492
30580
  }
30493
30581
  return null;
@@ -30495,14 +30583,14 @@ function rebasingBranch2(dir) {
30495
30583
  function rebaseInProgress(dir) {
30496
30584
  for (const name of ["rebase-merge", "rebase-apply"]) {
30497
30585
  const found = gitRun4(dir, ["rev-parse", "--path-format=absolute", "--git-path", name]);
30498
- if (found.ok && fs31.existsSync(found.stdout.trim()))
30586
+ if (found.ok && fs32.existsSync(found.stdout.trim()))
30499
30587
  return true;
30500
30588
  }
30501
30589
  return false;
30502
30590
  }
30503
30591
  var scratchDir = (cwd) => {
30504
30592
  const dir = stacksDir(cwd);
30505
- return dir.ok ? path52.join(dir.data, "worktrees") : null;
30593
+ return dir.ok ? path53.join(dir.data, "worktrees") : null;
30506
30594
  };
30507
30595
  function gitRestack(cwd, input) {
30508
30596
  const owner = worktreeOf(cwd, input.branch);
@@ -30516,8 +30604,8 @@ function gitRestack(cwd, input) {
30516
30604
  worktree: cwd,
30517
30605
  error: "no store root"
30518
30606
  };
30519
- fs31.mkdirSync(scratch, { recursive: true });
30520
- dir = path52.join(scratch, `${input.branch.replace(/[^A-Za-z0-9._-]+/gu, "_").slice(0, 40)}-${randomBytes4(4).toString("hex")}`);
30607
+ fs32.mkdirSync(scratch, { recursive: true });
30608
+ dir = path53.join(scratch, `${input.branch.replace(/[^A-Za-z0-9._-]+/gu, "_").slice(0, 40)}-${randomBytes4(4).toString("hex")}`);
30521
30609
  const added = gitRun4(cwd, ["worktree", "add", "-q", dir, input.branch], GIT_TIMEOUTS.worktree);
30522
30610
  if (!added.ok)
30523
30611
  return {
@@ -30576,7 +30664,7 @@ function stacksDir(cwd) {
30576
30664
  const root = storeRoot(cwd);
30577
30665
  if (!root.ok)
30578
30666
  return stackFail(root.code, root.error, root.unblock);
30579
- return { ok: true, data: path52.join(root.value.root, "stacks") };
30667
+ return { ok: true, data: path53.join(root.value.root, "stacks") };
30580
30668
  }
30581
30669
  var HEARTBEAT_STALE_MS = 2 * 60000;
30582
30670
  var SETTLED_BY_RESTACK = new Set(["checks_pending", "behind_base_required"]);
@@ -30723,7 +30811,7 @@ function fanoutsDir(cwd) {
30723
30811
  const root = storeRoot(cwd);
30724
30812
  if (!root.ok)
30725
30813
  return fanoutFail(root.code, root.error, root.unblock);
30726
- return { ok: true, data: path53.join(root.value.root, "fanouts") };
30814
+ return { ok: true, data: path54.join(root.value.root, "fanouts") };
30727
30815
  }
30728
30816
  function parseStored(raw) {
30729
30817
  if (!isRecord8(raw) || typeof raw.name !== "string" || typeof raw.trunk !== "string")
@@ -30791,10 +30879,10 @@ function readFanout(cwd, name) {
30791
30879
  const dir = fanoutsDir(cwd);
30792
30880
  if (!dir.ok)
30793
30881
  return dir;
30794
- const file = path53.join(dir.data, stackFileName(name));
30882
+ const file = path54.join(dir.data, stackFileName(name));
30795
30883
  let parsed = null;
30796
30884
  try {
30797
- parsed = parseStored(JSON.parse(fs32.readFileSync(file, "utf8")));
30885
+ parsed = parseStored(JSON.parse(fs33.readFileSync(file, "utf8")));
30798
30886
  } catch (error) {
30799
30887
  if (error.code === "ENOENT")
30800
30888
  return { ok: true, data: null };
@@ -30808,7 +30896,7 @@ function listFanouts(cwd) {
30808
30896
  return dir;
30809
30897
  let names = [];
30810
30898
  try {
30811
- names = fs32.readdirSync(dir.data).filter((entry) => entry.endsWith(".json"));
30899
+ names = fs33.readdirSync(dir.data).filter((entry) => entry.endsWith(".json"));
30812
30900
  } catch {
30813
30901
  return { ok: true, data: [] };
30814
30902
  }
@@ -30816,7 +30904,7 @@ function listFanouts(cwd) {
30816
30904
  for (const entry of names) {
30817
30905
  let parsed = null;
30818
30906
  try {
30819
- parsed = parseStored(JSON.parse(fs32.readFileSync(path53.join(dir.data, entry), "utf8")));
30907
+ parsed = parseStored(JSON.parse(fs33.readFileSync(path54.join(dir.data, entry), "utf8")));
30820
30908
  } catch {
30821
30909
  parsed = null;
30822
30910
  }
@@ -31675,7 +31763,7 @@ var childTaskMissing = (store, input) => {
31675
31763
  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`;
31676
31764
 
31677
31765
  // packages/workit-opencode/src/v2/shell.ts
31678
- import path54 from "node:path";
31766
+ import path55 from "node:path";
31679
31767
 
31680
31768
  // packages/workit-core/src/hooks/repeat-failure.ts
31681
31769
  import { createHash as createHash21 } from "node:crypto";
@@ -31738,7 +31826,7 @@ var commandOf = (input) => {
31738
31826
  };
31739
31827
  var hookInput = (root, sessionID, id, shell) => ({
31740
31828
  host: "opencode",
31741
- cwd: shell.workdir ? path54.resolve(root, shell.workdir) : root,
31829
+ cwd: shell.workdir ? path55.resolve(root, shell.workdir) : root,
31742
31830
  session: { id: sessionID, agentId: null, agentType: null, parentId: null },
31743
31831
  permissionMode: null,
31744
31832
  transcriptPath: null,
@@ -31801,7 +31889,11 @@ var observeShellResult = (root, event, failures = new Map) => {
31801
31889
  if (!result)
31802
31890
  return;
31803
31891
  const repeated = repeatedCliFailure(failures, String(event.sessionID), shell.command, outputText(result.content));
31804
- const extra = [nudge.kind === "context" ? nudge.text : null, repeated].filter((text) => text !== null);
31892
+ const extra = [
31893
+ nudge.kind === "context" ? nudge.text : null,
31894
+ repeated,
31895
+ takeProcNotice(String(event.sessionID))
31896
+ ].filter((text) => text !== null);
31805
31897
  if (extra.length > 0)
31806
31898
  event.result = appendText(result, extra.join(`
31807
31899
 
@@ -32015,37 +32107,37 @@ var createStopControl = (root, port) => {
32015
32107
 
32016
32108
  // packages/workit-opencode/src/v2/registry.ts
32017
32109
  import { existsSync as existsSync19, readFileSync as readFileSync17 } from "node:fs";
32018
- import path56 from "node:path";
32110
+ import path57 from "node:path";
32019
32111
 
32020
32112
  // packages/workit-opencode/src/shared/assets.ts
32021
32113
  import { existsSync as existsSync18, realpathSync as realpathSync13 } from "node:fs";
32022
- import path55 from "node:path";
32114
+ import path56 from "node:path";
32023
32115
  import { fileURLToPath as fileURLToPath2 } from "node:url";
32024
32116
  var moduleDir = () => {
32025
32117
  try {
32026
- return realpathSync13(path55.dirname(fileURLToPath2(import.meta.url)));
32118
+ return realpathSync13(path56.dirname(fileURLToPath2(import.meta.url)));
32027
32119
  } catch {
32028
- return path55.dirname(fileURLToPath2(import.meta.url));
32120
+ return path56.dirname(fileURLToPath2(import.meta.url));
32029
32121
  }
32030
32122
  };
32031
32123
  var packageRoot2 = () => {
32032
32124
  const dir = moduleDir();
32033
32125
  for (const candidate of [
32034
- path55.resolve(dir, ".."),
32035
- path55.resolve(dir, "..", ".."),
32036
- path55.resolve(dir, "..", "..", "..")
32126
+ path56.resolve(dir, ".."),
32127
+ path56.resolve(dir, "..", ".."),
32128
+ path56.resolve(dir, "..", "..", "..")
32037
32129
  ]) {
32038
- if (existsSync18(path55.join(candidate, "package.json")))
32130
+ if (existsSync18(path56.join(candidate, "package.json")))
32039
32131
  return candidate;
32040
32132
  }
32041
- return path55.resolve(dir, "..");
32133
+ return path56.resolve(dir, "..");
32042
32134
  };
32043
32135
  var skillsRoot = () => {
32044
32136
  const root = packageRoot2();
32045
- const canonical = path55.resolve(root, "..", "workit-core", "skills");
32046
- if (existsSync18(path55.join(root, "src")) && existsSync18(canonical))
32137
+ const canonical = path56.resolve(root, "..", "workit-core", "skills");
32138
+ if (existsSync18(path56.join(root, "src")) && existsSync18(canonical))
32047
32139
  return canonical;
32048
- return path55.join(root, "assets", "skills");
32140
+ return path56.join(root, "assets", "skills");
32049
32141
  };
32050
32142
 
32051
32143
  // packages/workit-opencode/src/v2/registry.ts
@@ -32072,11 +32164,11 @@ var registerSkills = async (ctx) => {
32072
32164
  if (!existsSync19(skillsDir))
32073
32165
  return new Set;
32074
32166
  const listed = await ctx.skill.list().catch(() => ({ data: [] }));
32075
- const own = (skill) => typeof skill.path === "string" && path56.resolve(skill.path).startsWith(skillsDir + path56.sep);
32167
+ const own = (skill) => typeof skill.path === "string" && path57.resolve(skill.path).startsWith(skillsDir + path57.sep);
32076
32168
  const userSkills = new Set((listed?.data ?? []).filter((skill) => !own(skill)).map((skill) => skill.id));
32077
32169
  const packaged = new Map;
32078
32170
  for (const id of WORKIT_METHOD_SKILLS) {
32079
- const file = path56.join(skillsDir, id, "SKILL.md");
32171
+ const file = path57.join(skillsDir, id, "SKILL.md");
32080
32172
  if (!userSkills.has(id) && existsSync19(file))
32081
32173
  packaged.set(id, file);
32082
32174
  }
@@ -32124,38 +32216,38 @@ var registerCommands = async (ctx, registeredSkills) => {
32124
32216
 
32125
32217
  // packages/workit-opencode/src/stale-sources.ts
32126
32218
  import { existsSync as existsSync20, readdirSync as readdirSync8 } from "node:fs";
32127
- import path57 from "node:path";
32219
+ import path58 from "node:path";
32128
32220
  import { fileURLToPath as fileURLToPath3 } from "node:url";
32129
32221
  var typescriptFiles = (directory) => {
32130
32222
  if (!existsSync20(directory))
32131
32223
  return [];
32132
32224
  return readdirSync8(directory, { withFileTypes: true }).flatMap((entry) => {
32133
- const file = path57.join(directory, entry.name);
32225
+ const file = path58.join(directory, entry.name);
32134
32226
  return entry.isDirectory() ? typescriptFiles(file) : entry.isFile() && file.endsWith(".ts") ? [file] : [];
32135
32227
  });
32136
32228
  };
32137
32229
  var pluginSourceFiles = [
32138
32230
  ...new Set([
32139
32231
  fileURLToPath3(import.meta.url),
32140
- ...typescriptFiles(path57.join(packageRoot2(), "src")),
32141
- path57.join(packageRoot2(), "..", "workit-core", "src", "core.ts"),
32142
- ...typescriptFiles(path57.join(packageRoot2(), "..", "workit-core", "src", "core"))
32232
+ ...typescriptFiles(path58.join(packageRoot2(), "src")),
32233
+ path58.join(packageRoot2(), "..", "workit-core", "src", "core.ts"),
32234
+ ...typescriptFiles(path58.join(packageRoot2(), "..", "workit-core", "src", "core"))
32143
32235
  ])
32144
32236
  ].filter((file) => existsSync20(file)).toSorted();
32145
32237
 
32146
32238
  // packages/workit-core/src/core/cli-locate.ts
32147
32239
  import { closeSync as closeSync2, existsSync as existsSync21, openSync as openSync2, readSync } from "node:fs";
32148
- import path58 from "node:path";
32240
+ import path59 from "node:path";
32149
32241
  var LAUNCHER_MARKER = "workit-owned-launcher";
32150
32242
  var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
32151
32243
  var installRoot = (env, platform = process.platform) => {
32152
32244
  if (env.WORKIT_INSTALL_ROOT)
32153
32245
  return env.WORKIT_INSTALL_ROOT;
32154
32246
  const data = dataDir(env, platform);
32155
- return platform === "win32" ? path58.join(data, "install") : data;
32247
+ return platform === "win32" ? path59.join(data, "install") : data;
32156
32248
  };
32157
- var ownedLauncherPath = (env, platform = process.platform) => path58.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
32158
- var ownedCurrentEntry = (env, platform = process.platform) => path58.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
32249
+ var ownedLauncherPath = (env, platform = process.platform) => path59.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
32250
+ var ownedCurrentEntry = (env, platform = process.platform) => path59.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
32159
32251
  var head = (file) => {
32160
32252
  let fd;
32161
32253
  try {
@@ -32182,7 +32274,7 @@ var locateWorkitCli = (options = {}) => {
32182
32274
  source: "owned-launcher",
32183
32275
  command: launcher,
32184
32276
  args: [],
32185
- binDir: path58.dirname(launcher)
32277
+ binDir: path59.dirname(launcher)
32186
32278
  };
32187
32279
  const current = ownedCurrentEntry(env, platform);
32188
32280
  if (exists(current))
@@ -32211,7 +32303,7 @@ var workitCliEnv = (located, env = process.env, platform = process.platform) =>
32211
32303
  if (located.binDir) {
32212
32304
  const key = pathKey(env);
32213
32305
  const delimiter = platform === "win32" ? ";" : ":";
32214
- const same = (dir) => platform === "win32" ? path58.win32.normalize(dir).toLowerCase() === path58.win32.normalize(located.binDir).toLowerCase() : path58.posix.normalize(dir) === path58.posix.normalize(located.binDir);
32306
+ const same = (dir) => platform === "win32" ? path59.win32.normalize(dir).toLowerCase() === path59.win32.normalize(located.binDir).toLowerCase() : path59.posix.normalize(dir) === path59.posix.normalize(located.binDir);
32215
32307
  const rest = (env[key] ?? "").split(delimiter).filter((dir) => dir && !same(dir));
32216
32308
  patch[key] = [located.binDir, ...rest].join(delimiter);
32217
32309
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/opencode",
3
- "version": "2.10.0",
3
+ "version": "2.11.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.0.18",
44
- "@workit-dev/core": "^2.10.0"
44
+ "@workit-dev/core": "^2.11.1"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=24"