@workit-dev/pi 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/workit.js CHANGED
@@ -27971,7 +27971,7 @@ var writePaths = (input) => {
27971
27971
  };
27972
27972
  // packages/workit-core/src/hooks/standing.ts
27973
27973
  import fs30 from "node:fs";
27974
- import path46 from "node:path";
27974
+ import path48 from "node:path";
27975
27975
 
27976
27976
  // packages/workit-core/src/approvals/store.ts
27977
27977
  import { createHash as createHash19, randomBytes as randomBytes4 } from "node:crypto";
@@ -28187,10 +28187,70 @@ var approveCallIn = (command, dialect = "posix") => {
28187
28187
  };
28188
28188
  var approveCallDeny = (fix) => `Run \`${fix}\` as its own call: no chain, pipe, substitution, leading cd, env prefix or redirect around it, so the host can show the request and record the user's answer.`;
28189
28189
 
28190
- // packages/workit-core/src/approvals/youtrack-ask.ts
28190
+ // packages/workit-core/src/approvals/inline.ts
28191
+ import path46 from "node:path";
28192
+
28193
+ // packages/workit-core/src/approvals/release-notes-ask.ts
28191
28194
  import { createHash as createHash20 } from "node:crypto";
28192
- import { readFileSync as readFileSync14, realpathSync as realpathSync11 } from "node:fs";
28195
+ import { existsSync as existsSync15, readFileSync as readFileSync14 } from "node:fs";
28193
28196
  import path44 from "node:path";
28197
+ var sha2563 = (data) => createHash20("sha256").update(data).digest("hex");
28198
+ var isReleaseNotesApprove = (words) => words[0] === "notes" && words[1] === "approve";
28199
+ var versionOf = (args) => {
28200
+ const positionals = [];
28201
+ for (let index = 0;index < args.length; index += 1) {
28202
+ const arg = args[index] ?? "";
28203
+ if (arg === "--json")
28204
+ continue;
28205
+ if (arg === "--track")
28206
+ index += 1;
28207
+ else if (!arg.startsWith("--track=")) {
28208
+ if (arg.startsWith("-"))
28209
+ return null;
28210
+ positionals.push(arg);
28211
+ }
28212
+ }
28213
+ const [version] = positionals;
28214
+ return positionals.length === 1 && version && /^[\w@%+.:/-]+$/u.test(version) && !version.includes("..") ? version : null;
28215
+ };
28216
+ var releaseNotesAsk = (args, draft) => {
28217
+ const version = versionOf(args);
28218
+ if (!version)
28219
+ return null;
28220
+ const action = `workit release notes approve ${version}`;
28221
+ return {
28222
+ kind: "release-notes",
28223
+ action,
28224
+ text: `Yes approves the release notes of ${version} (${draft.path}); finish publishes exactly this text:
28225
+
28226
+ ${draft.notes.trimEnd()}`,
28227
+ argvHash: sha2563(canonicalJson(args)),
28228
+ contentHash: sha2563(canonicalJson({ args, notes: sha2563(draft.notes) }))
28229
+ };
28230
+ };
28231
+ var releaseNotesAskAt = (args, cwd) => {
28232
+ const version = versionOf(args);
28233
+ const common = version ? gitCommonDir(cwd) : null;
28234
+ if (!version || !common)
28235
+ return null;
28236
+ const dir = path44.join(common, "workit", "release-notes");
28237
+ for (const file of [
28238
+ path44.join(dir, "packages", `${version.replaceAll("/", "%2F")}.md`),
28239
+ path44.join(dir, `${version}.md`)
28240
+ ])
28241
+ if (existsSync15(file))
28242
+ try {
28243
+ return releaseNotesAsk(args, { path: file, notes: readFileSync14(file, "utf8") });
28244
+ } catch {
28245
+ return null;
28246
+ }
28247
+ return null;
28248
+ };
28249
+
28250
+ // packages/workit-core/src/approvals/youtrack-ask.ts
28251
+ import { createHash as createHash21 } from "node:crypto";
28252
+ import { readFileSync as readFileSync15, realpathSync as realpathSync11 } from "node:fs";
28253
+ import path45 from "node:path";
28194
28254
  var TIME = "markdown file minutes text date";
28195
28255
  var FLAGS = {
28196
28256
  note: TIME,
@@ -28200,8 +28260,8 @@ var FLAGS = {
28200
28260
  create: "project summary description file attach command"
28201
28261
  };
28202
28262
  var isYouTrackWriteVerb = (word) => Object.hasOwn(FLAGS, word ?? "");
28203
- var sha2563 = (data) => createHash20("sha256").update(data).digest("hex");
28204
- var youTrackAsk = (args, cwd, load = readFileSync14) => {
28263
+ var sha2564 = (data) => createHash21("sha256").update(data).digest("hex");
28264
+ var youTrackAsk = (args, cwd, load = readFileSync15) => {
28205
28265
  const [verb = "", ...rest] = args;
28206
28266
  if (!isYouTrackWriteVerb(verb))
28207
28267
  return null;
@@ -28234,9 +28294,9 @@ var youTrackAsk = (args, cwd, load = readFileSync14) => {
28234
28294
  const files = [];
28235
28295
  const read = (file) => {
28236
28296
  try {
28237
- const named = path44.resolve(cwd, file);
28297
+ const named = path45.resolve(cwd, file);
28238
28298
  const content = load(named);
28239
- files.push([realpathSync11(named), sha2563(content)]);
28299
+ files.push([realpathSync11(named), sha2564(content)]);
28240
28300
  return content;
28241
28301
  } catch {
28242
28302
  return null;
@@ -28272,7 +28332,7 @@ var youTrackAsk = (args, cwd, load = readFileSync14) => {
28272
28332
  const content = read(file);
28273
28333
  if (!content)
28274
28334
  return null;
28275
- lines.push(`attach: ${path44.basename(file)} (${content.length} bytes)`);
28335
+ lines.push(`attach: ${path45.basename(file)} (${content.length} bytes)`);
28276
28336
  }
28277
28337
  if (!lines.length)
28278
28338
  return null;
@@ -28281,14 +28341,35 @@ var youTrackAsk = (args, cwd, load = readFileSync14) => {
28281
28341
  action,
28282
28342
  text: [`Yes runs ${action} once:`, ...lines].join(`
28283
28343
  `),
28284
- argvHash: sha2563(canonicalJson(args)),
28285
- contentHash: sha2563(canonicalJson({ args, files }))
28344
+ argvHash: sha2564(canonicalJson(args)),
28345
+ contentHash: sha2564(canonicalJson({ args, files }))
28286
28346
  };
28287
28347
  };
28288
28348
 
28289
28349
  // packages/workit-core/src/approvals/inline.ts
28290
- var asked = (words) => words[0] === "youtrack" && isYouTrackWriteVerb(words[1]);
28350
+ var isReleaseNotesCall = (words) => words[0] === "release" && isReleaseNotesApprove(words.slice(1));
28351
+ var asked = (words) => words[0] === "youtrack" && isYouTrackWriteVerb(words[1]) || isReleaseNotesCall(words);
28291
28352
  var quote2 = (word) => /^[\w@%+=:,./-]+$/u.test(word) ? word : `'${word.replaceAll("'", `'\\''`)}'`;
28353
+ var routed = (call, globals) => {
28354
+ if (!globals.includes("--json") || call.slice(1).includes("--json"))
28355
+ return call;
28356
+ const end = call.indexOf("--");
28357
+ return end < 0 ? [...call, "--json"] : [...call.slice(0, end), "--json", ...call.slice(end)];
28358
+ };
28359
+ var cwdOf = (globals) => {
28360
+ let cwd = null;
28361
+ for (let index = 0;index < globals.length; index += 1) {
28362
+ const word = globals[index] ?? "";
28363
+ if (word === "--cwd")
28364
+ cwd = globals[++index] ?? null;
28365
+ else if (word.startsWith("--cwd="))
28366
+ cwd = word.slice("--cwd=".length);
28367
+ else if (word === "--session")
28368
+ index += 1;
28369
+ }
28370
+ return cwd;
28371
+ };
28372
+ var inlineCallCwd = (call, base) => call.cwd ? path46.resolve(base, call.cwd) : base;
28292
28373
  var inlineCallIn = (command, dialect = "posix") => {
28293
28374
  if (!/\bworkit\b/u.test(command))
28294
28375
  return null;
@@ -28297,7 +28378,7 @@ var inlineCallIn = (command, dialect = "posix") => {
28297
28378
  if (segment.unanalyzable)
28298
28379
  continue;
28299
28380
  const { words } = segment;
28300
- const script = (words[0] ?? "").endsWith("sh") ? words.find((word) => /\bworkit\s+youtrack\s/u.test(word)) : undefined;
28381
+ const script = (words[0] ?? "").endsWith("sh") ? words.find((word) => /\bworkit\s+(?:youtrack|release\s+notes\s+approve)\s/u.test(word)) : undefined;
28301
28382
  if (script)
28302
28383
  return { plain: false, fix: script.trim() };
28303
28384
  const start = words.findIndex(isWorkitWord2);
@@ -28307,9 +28388,13 @@ var inlineCallIn = (command, dialect = "posix") => {
28307
28388
  const call = words.slice(at);
28308
28389
  if (!asked(call))
28309
28390
  continue;
28310
- const plain = segments.length === 1 && start === 0 && words[0] === "workit" && at === 1 && !segment.redirects.length && !segment.subs?.length && !segment.stdin?.length && !segment.expands?.length && !segment.group;
28391
+ const plain = segments.length === 1 && start === 0 && words[0] === "workit" && !segment.redirects.length && !segment.subs?.length && !segment.stdin?.length && !segment.expands?.length && !segment.group;
28311
28392
  if (plain)
28312
- return { plain: true, words: call };
28393
+ return {
28394
+ plain: true,
28395
+ words: routed(call, words.slice(1, at)),
28396
+ cwd: cwdOf(words.slice(1, at))
28397
+ };
28313
28398
  return {
28314
28399
  plain: false,
28315
28400
  fix: `workit ${call.map(quote2).join(" ")}`
@@ -28317,7 +28402,11 @@ var inlineCallIn = (command, dialect = "posix") => {
28317
28402
  }
28318
28403
  return null;
28319
28404
  };
28320
- var inlineAskFor = (words, cwd) => asked(words) && youTrackWritesMode(cwd) !== "auto" ? youTrackAsk(words.slice(1), cwd) : null;
28405
+ var inlineAskFor = (words, cwd) => {
28406
+ if (isReleaseNotesCall(words))
28407
+ return releaseNotesAskAt(words.slice(3), cwd);
28408
+ return asked(words) && youTrackWritesMode(cwd) !== "auto" ? youTrackAsk(words.slice(1), cwd) : null;
28409
+ };
28321
28410
  var inlineCallDeny = (fix) => `Run \`${fix}\` as its own call so the host can ask the user.`;
28322
28411
 
28323
28412
  // packages/workit-core/src/hooks/hosts/claude-code.ts
@@ -28793,37 +28882,37 @@ function neededChecks(lane, configured) {
28793
28882
  }
28794
28883
 
28795
28884
  // packages/workit-core/src/hooks/worktree-confine.ts
28796
- import { createHash as createHash21 } from "node:crypto";
28885
+ import { createHash as createHash22 } from "node:crypto";
28797
28886
  import fs29 from "node:fs";
28798
- import path45 from "node:path";
28887
+ import path47 from "node:path";
28799
28888
  var FANOUT_TOKEN_FILE = "workit-fanout-token";
28800
28889
  var NONE5 = { kind: "none" };
28801
28890
  var CASE_INSENSITIVE2 = process.platform === "darwin" || process.platform === "win32";
28802
28891
  var realOf = (file) => {
28803
28892
  let rest = "";
28804
- for (let dir = file;; dir = path45.dirname(dir)) {
28893
+ for (let dir = file;; dir = path47.dirname(dir)) {
28805
28894
  try {
28806
- return path45.join(fs29.realpathSync.native(dir), rest);
28895
+ return path47.join(fs29.realpathSync.native(dir), rest);
28807
28896
  } catch {
28808
- if (path45.dirname(dir) === dir)
28897
+ if (path47.dirname(dir) === dir)
28809
28898
  return file;
28810
- rest = rest ? path45.join(path45.basename(dir), rest) : path45.basename(dir);
28899
+ rest = rest ? path47.join(path47.basename(dir), rest) : path47.basename(dir);
28811
28900
  }
28812
28901
  }
28813
28902
  };
28814
28903
  var canonical5 = (file, hops = { chain: 40, total: 1000 }) => {
28815
- const start = path45.isAbsolute(file) ? file : `${process.cwd()}${path45.sep}${file}`;
28816
- const { root } = path45.parse(start);
28904
+ const start = path47.isAbsolute(file) ? file : `${process.cwd()}${path47.sep}${file}`;
28905
+ const { root } = path47.parse(start);
28817
28906
  let at = root;
28818
28907
  let missing = false;
28819
28908
  for (const part of start.slice(root.length).split(/[\\/]+/)) {
28820
28909
  if (part === "" || part === ".")
28821
28910
  continue;
28822
28911
  if (part === "..") {
28823
- at = path45.dirname(at);
28912
+ at = path47.dirname(at);
28824
28913
  continue;
28825
28914
  }
28826
- const next = path45.join(at, part);
28915
+ const next = path47.join(at, part);
28827
28916
  let link = null;
28828
28917
  if (!missing)
28829
28918
  try {
@@ -28835,25 +28924,25 @@ var canonical5 = (file, hops = { chain: 40, total: 1000 }) => {
28835
28924
  at = next;
28836
28925
  hops.chain = 40;
28837
28926
  } else if (hops.chain-- > 0 && hops.total-- > 0)
28838
- at = canonical5(path45.isAbsolute(link) ? link : `${at}${path45.sep}${link}`, hops);
28927
+ at = canonical5(path47.isAbsolute(link) ? link : `${at}${path47.sep}${link}`, hops);
28839
28928
  else
28840
- return path45.resolve(file);
28929
+ return path47.resolve(file);
28841
28930
  }
28842
28931
  return realOf(at);
28843
28932
  };
28844
28933
  var within = (child, parent) => {
28845
28934
  const fold = (value) => CASE_INSENSITIVE2 ? value.toLowerCase() : value;
28846
- const relative = path45.relative(fold(parent), fold(child));
28847
- return relative === "" || !relative.startsWith("..") && !path45.isAbsolute(relative);
28935
+ const relative = path47.relative(fold(parent), fold(child));
28936
+ return relative === "" || !relative.startsWith("..") && !path47.isAbsolute(relative);
28848
28937
  };
28849
28938
  var checkoutOf2 = (file) => {
28850
- for (let dir = canonical5(file);; dir = path45.dirname(dir)) {
28851
- const dotGit = path45.join(dir, ".git");
28939
+ for (let dir = canonical5(file);; dir = path47.dirname(dir)) {
28940
+ const dotGit = path47.join(dir, ".git");
28852
28941
  if (fs29.existsSync(dotGit)) {
28853
28942
  const admin = fs29.statSync(dotGit).isFile() ? gitDirsAt(dir, null, false)?.[0] : undefined;
28854
- return { root: dir, workit: !!admin && fs29.existsSync(path45.join(admin, FANOUT_TOKEN_FILE)) };
28943
+ return { root: dir, workit: !!admin && fs29.existsSync(path47.join(admin, FANOUT_TOKEN_FILE)) };
28855
28944
  }
28856
- if (path45.dirname(dir) === dir)
28945
+ if (path47.dirname(dir) === dir)
28857
28946
  return null;
28858
28947
  }
28859
28948
  };
@@ -28865,8 +28954,8 @@ var workitWorktreeOf = (file) => {
28865
28954
  return null;
28866
28955
  }
28867
28956
  };
28868
- var bindingDir = () => path45.join(resolveStateDir(), "worktree-bind");
28869
- var bindingFile = (session, agentId) => path45.join(bindingDir(), `${createHash21("sha256").update(`${session}\x00${agentId}`).digest("hex").slice(0, 32)}.json`);
28957
+ var bindingDir = () => path47.join(resolveStateDir(), "worktree-bind");
28958
+ var bindingFile = (session, agentId) => path47.join(bindingDir(), `${createHash22("sha256").update(`${session}\x00${agentId}`).digest("hex").slice(0, 32)}.json`);
28870
28959
  var readBinding = (file) => {
28871
28960
  try {
28872
28961
  const value = JSON.parse(fs29.readFileSync(file, "utf8"));
@@ -28891,7 +28980,7 @@ var bind = (input, worktree) => {
28891
28980
  agentId,
28892
28981
  at: new Date().toISOString()
28893
28982
  };
28894
- fs29.mkdirSync(path45.dirname(file), { recursive: true });
28983
+ fs29.mkdirSync(path47.dirname(file), { recursive: true });
28895
28984
  fs29.writeFileSync(file, JSON.stringify(binding));
28896
28985
  try {
28897
28986
  if (inWorkitWorkspace(input.cwd))
@@ -28910,26 +28999,26 @@ var hostIsolated = (cwd, agentId) => {
28910
28999
  const checkout = checkoutOf2(cwd);
28911
29000
  if (!checkout)
28912
29001
  return false;
28913
- const dotGit = path45.join(checkout.root, ".git");
29002
+ const dotGit = path47.join(checkout.root, ".git");
28914
29003
  if (!fs29.statSync(dotGit).isFile())
28915
29004
  return false;
28916
29005
  const [adminDir, gitDir] = gitDirsAt(checkout.root, null, false) ?? [];
28917
- const back = fs29.readFileSync(path45.join(adminDir, "gitdir"), "utf8").trim();
28918
- if (path45.relative(canonical5(path45.resolve(adminDir, back)), canonical5(dotGit)) !== "")
29006
+ const back = fs29.readFileSync(path47.join(adminDir, "gitdir"), "utf8").trim();
29007
+ if (path47.relative(canonical5(path47.resolve(adminDir, back)), canonical5(dotGit)) !== "")
28919
29008
  return false;
28920
- const expected = path45.join(path45.dirname(gitDir), ".claude", "worktrees", `agent-${agentId}`);
28921
- return path45.relative(canonical5(expected), checkout.root) === "";
29009
+ const expected = path47.join(path47.dirname(gitDir), ".claude", "worktrees", `agent-${agentId}`);
29010
+ return path47.relative(canonical5(expected), checkout.root) === "";
28922
29011
  } catch {
28923
29012
  return false;
28924
29013
  }
28925
29014
  };
28926
29015
  var runnerAt = (target) => {
28927
- const base = path45.basename(target);
29016
+ const base = path47.basename(target);
28928
29017
  return base.startsWith(OPAQUE_TARGET) ? decodeURIComponent(base.slice(OPAQUE_TARGET.length)) : null;
28929
29018
  };
28930
29019
  var shown = (target) => {
28931
- const named = /^\.workit-(?:live-target$|runs-)/.test(path45.basename(target)) ? path45.dirname(target) : target;
28932
- return path45.sep === "\\" ? named.replaceAll("/", "\\") : named;
29020
+ const named = /^\.workit-(?:live-target$|runs-)/.test(path47.basename(target)) ? path47.dirname(target) : target;
29021
+ return path47.sep === "\\" ? named.replaceAll("/", "\\") : named;
28933
29022
  };
28934
29023
  var unboundDeny = (input, target) => {
28935
29024
  const unblock = "Work only in the worktree your brief names, which the lead made with `workit fanout worktree create <slice>`: edit files under it and run one verb per call against it (`workit git --cwd <worktree> commit -m … -- <paths>`, `workit check --cwd <worktree> <name>`). If your brief names no worktree, stop and report that to the lead.";
@@ -28968,7 +29057,7 @@ var literalForm = (command, refs) => {
28968
29057
  };
28969
29058
  var unknownVarDeny = (input, worktree, targets, command) => {
28970
29059
  const refs = [
28971
- ...new Set(targets.flatMap((target) => path45.relative(UNKNOWN_VAR, path45.resolve(target)).split(path45.sep)[0].split("+").filter(Boolean).map(decodeURIComponent)))
29060
+ ...new Set(targets.flatMap((target) => path47.relative(UNKNOWN_VAR, path47.resolve(target)).split(path47.sep)[0].split("+").filter(Boolean).map(decodeURIComponent)))
28972
29061
  ];
28973
29062
  let text = command ?? "";
28974
29063
  const first = [];
@@ -28997,10 +29086,10 @@ function confineImplementer(input, targets, command) {
28997
29086
  try {
28998
29087
  if (!input.session.agentId || hostIsolated(input.cwd, input.session.agentId))
28999
29088
  return NONE5;
29000
- const unresolved = targets.filter((target) => within(path45.resolve(target), UNKNOWN_VAR));
29089
+ const unresolved = targets.filter((target) => within(path47.resolve(target), UNKNOWN_VAR));
29001
29090
  if (unresolved.length > 0)
29002
29091
  return unknownVarDeny(input, boundWorktree(input), unresolved, command);
29003
- if (targets.some((target) => within(path45.resolve(target), UNKNOWN_DIR)))
29092
+ if (targets.some((target) => within(path47.resolve(target), UNKNOWN_DIR)))
29004
29093
  return unknownDirDeny(input, boundWorktree(input));
29005
29094
  const bindings = canonical5(bindingDir());
29006
29095
  const judged = targets.map((named) => ({ named, real: canonical5(named) })).filter(({ real }) => within(real, bindings) || checkoutOf2(real) !== null);
@@ -29111,10 +29200,10 @@ var INLINE = /^-[a-zA-Z]*[ceEpm]$|^--(?:eval|print|test|version|help)$|^-[hvV]$/
29111
29200
  var VALUED = /^-[WXIrC]$|^--(?:require|import|loader|conditions|input-type)$/;
29112
29201
  var commonDir = (root) => gitDirsAt(root, null, false)?.[1] ?? "";
29113
29202
  var inScratch = (real, repo) => {
29114
- for (let dir = real;path45.dirname(dir) !== dir; dir = path45.dirname(dir)) {
29115
- if (path45.basename(dir) !== SCRATCH)
29203
+ for (let dir = real;path47.dirname(dir) !== dir; dir = path47.dirname(dir)) {
29204
+ if (path47.basename(dir) !== SCRATCH)
29116
29205
  continue;
29117
- const root = path45.dirname(dir);
29206
+ const root = path47.dirname(dir);
29118
29207
  if (checkoutOf2(root)?.root === root && (repo === null || commonDir(root) === repo))
29119
29208
  return true;
29120
29209
  }
@@ -29123,7 +29212,7 @@ var inScratch = (real, repo) => {
29123
29212
  var inGitDir = (real) => real.split(/[\\/]/).includes(".git");
29124
29213
  var SAFE_KEY = /^(?:core\.(?:repositoryformatversion|filemode|bare|logallrefupdates|ignorecase|precomposeunicode|symlinks)|user\..*|init\.defaultbranch|commit\.gpgsign|extensions\.(?:objectformat|refstorage)|branch\..*\.(?:remote|merge)|remote\..*\.fetch)$/;
29125
29214
  var literalIn = (value, repo, checkout = false) => {
29126
- if (/[$`]/.test(value) || !path45.isAbsolute(value))
29215
+ if (/[$`]/.test(value) || !path47.isAbsolute(value))
29127
29216
  return false;
29128
29217
  const real = canonical5(value);
29129
29218
  const root = checkout ? checkoutOf2(real)?.root : undefined;
@@ -29144,8 +29233,8 @@ var configEntries = (text) => {
29144
29233
  return entries;
29145
29234
  };
29146
29235
  function gitDirsAt(dir, repo, scan = true) {
29147
- for (let at = dir;; at = path45.dirname(at)) {
29148
- const dotGit = path45.join(at, ".git");
29236
+ for (let at = dir;; at = path47.dirname(at)) {
29237
+ const dotGit = path47.join(at, ".git");
29149
29238
  let gitDir = null;
29150
29239
  try {
29151
29240
  if (fs29.statSync(dotGit).isDirectory())
@@ -29154,19 +29243,19 @@ function gitDirsAt(dir, repo, scan = true) {
29154
29243
  const named = /^gitdir:\s*(.+?)\s*$/mu.exec(fs29.readFileSync(dotGit, "utf8"))?.[1];
29155
29244
  if (!named)
29156
29245
  return null;
29157
- gitDir = canonical5(path45.resolve(at, named));
29246
+ gitDir = canonical5(path47.resolve(at, named));
29158
29247
  }
29159
29248
  } catch (error) {
29160
29249
  if (error.code !== "ENOENT")
29161
29250
  return null;
29162
- if (["HEAD", "objects", "refs"].every((name) => fs29.existsSync(path45.join(at, name))))
29251
+ if (["HEAD", "objects", "refs"].every((name) => fs29.existsSync(path47.join(at, name))))
29163
29252
  gitDir = canonical5(at);
29164
29253
  }
29165
29254
  if (gitDir !== null) {
29166
- const common = path45.join(gitDir, "commondir");
29167
- const shared = fs29.existsSync(common) ? canonical5(path45.resolve(gitDir, fs29.readFileSync(common, "utf8").trim())) : gitDir;
29255
+ const common = path47.join(gitDir, "commondir");
29256
+ const shared = fs29.existsSync(common) ? canonical5(path47.resolve(gitDir, fs29.readFileSync(common, "utf8").trim())) : gitDir;
29168
29257
  const dirs = [gitDir, shared];
29169
- for (const config of scan ? new Set([path45.join(gitDir, "config"), path45.join(shared, "config")]) : []) {
29258
+ for (const config of scan ? new Set([path47.join(gitDir, "config"), path47.join(shared, "config")]) : []) {
29170
29259
  let text = "";
29171
29260
  try {
29172
29261
  text = fs29.readFileSync(config, "utf8");
@@ -29175,14 +29264,14 @@ function gitDirsAt(dir, repo, scan = true) {
29175
29264
  }
29176
29265
  for (const [key, value] of configEntries(text)) {
29177
29266
  if (key === "core.worktree")
29178
- dirs.push(canonical5(path45.resolve(gitDir, value)));
29267
+ dirs.push(canonical5(path47.resolve(gitDir, value)));
29179
29268
  else if (/^remote\..*\.url$/.test(key) ? !literalIn(value, repo, true) : !SAFE_KEY.test(key))
29180
29269
  return null;
29181
29270
  }
29182
29271
  }
29183
29272
  return dirs;
29184
29273
  }
29185
- if (path45.dirname(at) === at)
29274
+ if (path47.dirname(at) === at)
29186
29275
  return [];
29187
29276
  }
29188
29277
  }
@@ -29322,10 +29411,10 @@ var gitKind = (args, local = () => true) => {
29322
29411
  };
29323
29412
  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`;
29324
29413
  var remoteIn = (dir, name, repo) => {
29325
- const shared = path45.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo, false)?.[1] : undefined;
29414
+ const shared = path47.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo, false)?.[1] : undefined;
29326
29415
  if (!shared)
29327
29416
  return false;
29328
- const url = configEntries(fs29.readFileSync(path45.join(shared, "config"), "utf8")).find(([key]) => key === `remote.${name}.url`.toLowerCase())?.[1];
29417
+ const url = configEntries(fs29.readFileSync(path47.join(shared, "config"), "utf8")).find(([key]) => key === `remote.${name}.url`.toLowerCase())?.[1];
29329
29418
  return url !== undefined && literalIn(url, repo, true);
29330
29419
  };
29331
29420
  var judgeGit = (command, repo, depth = 0) => {
@@ -29339,7 +29428,7 @@ var judgeGit = (command, repo, depth = 0) => {
29339
29428
  const lead = [];
29340
29429
  while (/^\w+\+?=/.test(words[at] ?? ""))
29341
29430
  lead.push(words[at++]);
29342
- const name = path45.basename(words[at] ?? "");
29431
+ const name = path47.basename(words[at] ?? "");
29343
29432
  let start = words.findIndex((word) => /(?:^|[\\/])git(?:\.exe)?(?:=|$)/.test(word));
29344
29433
  if (start > at) {
29345
29434
  if (/^(?:grep|egrep|rg|echo|printf|ls|wc|head|tail|cat|which|type|test|\[|cd|mkdir)$/.test(name) || name === "command" && /^-[vV]$/.test(words[at + 1] ?? ""))
@@ -29350,7 +29439,7 @@ var judgeGit = (command, repo, depth = 0) => {
29350
29439
  if (start >= 0 && words[start].includes("="))
29351
29440
  why = "git is redefined";
29352
29441
  const run = words[start] ?? "";
29353
- if (run.includes("/") && (!path45.isAbsolute(run) || literalIn(run, repo, true)))
29442
+ if (run.includes("/") && (!path47.isAbsolute(run) || literalIn(run, repo, true)))
29354
29443
  why ??= `\`${run}\` is not the system git`;
29355
29444
  if (segment.expands?.includes(at) && name !== "[" || /\{[^}]*,/.test(words[at] ?? ""))
29356
29445
  why = "the command's name is expanded by the shell";
@@ -29380,12 +29469,12 @@ var judgeGit = (command, repo, depth = 0) => {
29380
29469
  if (!gitKind(args, local))
29381
29470
  why = `\`git ${args.slice(0, 2).join(" ")}\` is not allowed`;
29382
29471
  else if (args[0] === "status" && !unlocked) {
29383
- const dirs = path45.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo) : null;
29472
+ const dirs = path47.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo) : null;
29384
29473
  if (!dirs?.length || !dirs.every((gitDir) => inScratch(gitDir, repo)))
29385
29474
  why = "`git status` refreshes the index outside scratch: add --no-optional-locks";
29386
29475
  }
29387
29476
  }
29388
- const shell = /^(?:grep|egrep|rg|echo|printf|cat)$/.test(name) ? -1 : words.findIndex((word) => /^(?:sh|bash|zsh|dash|ksh|mksh|ash)$/.test(path45.basename(word)));
29477
+ const shell = /^(?:grep|egrep|rg|echo|printf|cat)$/.test(name) ? -1 : words.findIndex((word) => /^(?:sh|bash|zsh|dash|ksh|mksh|ash)$/.test(path47.basename(word)));
29389
29478
  const scripts = [
29390
29479
  ...words.filter((_, after) => shell >= 0 && after > shell && /^-[a-zA-Z]*c[a-zA-Z]*$/.test(words[after - 1])),
29391
29480
  ...shell < 0 ? [] : segment.stdin ?? []
@@ -29426,7 +29515,7 @@ var judgeVerbRefused = (args) => {
29426
29515
  var CLI_RUNNERS = /^(?:npx|bunx|pnpx|npm|pnpm|yarn|bun|node|nodejs|deno|tsx|ts-node)$/;
29427
29516
  var CLI_ENTRY = /(?:^|[=\\/])(?:workit(?:\.(?:exe|cmd|[cm]?js))?|@workit-dev\/cli(?:@\S*)?)$|(?:workit-cli|@workit-dev[\\/]cli)[\\/](?:src[\\/](?:index|main)|dist[\\/]index)\.[cm]?[jt]sx?$/;
29428
29517
  var workitCalls = (command, depth = 0, aliases = new Map) => depth > 4 ? [] : commandLines(command).flatMap((words) => {
29429
- const name = path45.basename(words[0] ?? "").toLowerCase();
29518
+ const name = path47.basename(words[0] ?? "").toLowerCase();
29430
29519
  if (name === "alias")
29431
29520
  return words.flatMap((word) => {
29432
29521
  const set = /^([\w-]+)=(.*)$/s.exec(word);
@@ -29456,11 +29545,11 @@ var judgeRefusal = (command, fed, depth = 0) => {
29456
29545
  return why;
29457
29546
  }
29458
29547
  const { words } = segment;
29459
- const runs = (word = "") => RUNS.test(path45.basename(word).toLowerCase());
29548
+ const runs = (word = "") => RUNS.test(path47.basename(word).toLowerCase());
29460
29549
  let at = 0;
29461
29550
  while (at < words.length && (LEADS.test(words[at]) || /^-\w$/.test(words[at - 1] ?? "") && !runs(words[at])))
29462
29551
  at++;
29463
- const name = path45.basename(words[at] ?? "").toLowerCase();
29552
+ const name = path47.basename(words[at] ?? "").toLowerCase();
29464
29553
  const args = words.slice(at + 1);
29465
29554
  const unseen = `\`${words.join(" ").slice(0, 80)}\` runs a script Workit cannot read (piped, on stdin, a process substitution or eval): write the case to a file in ${SCRATCH} and dispatch it from a test instead`;
29466
29555
  if (/^(?:cd|chdir|pushd|popd)$/.test(name))
@@ -29539,8 +29628,8 @@ var judgeDeny = (input, what, target) => {
29539
29628
  const role = input.session.agentType?.endsWith("reviewer") ? "reviewer" : "verifier";
29540
29629
  const root = checkoutOf2(input.cwd)?.root;
29541
29630
  const candidate = target ? checkoutOf2(target)?.root : undefined;
29542
- const also = root && candidate && candidate !== root && commonDir(candidate) === commonDir(root) ? ` or ${path45.join(candidate, SCRATCH)}` : "";
29543
- const scratch = root ? `${path45.join(root, SCRATCH)}${also}` : `${SCRATCH}/ at the root of the checkout you judge`;
29631
+ const also = root && candidate && candidate !== root && commonDir(candidate) === commonDir(root) ? ` or ${path47.join(candidate, SCRATCH)}` : "";
29632
+ const scratch = root ? `${path47.join(root, SCRATCH)}${also}` : `${SCRATCH}/ at the root of the checkout you judge`;
29544
29633
  const unblock = `Write only under ${scratch} (mkdir -p it): put a generated case in a file there with a quoted heredoc (<<'EOF') and never run it in the shell. Reads, \`workit check\` and \`workit ledger verdict|finding\` stay allowed; a change the candidate needs is a finding, not an edit.`;
29545
29634
  return {
29546
29635
  kind: "deny",
@@ -29555,12 +29644,12 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
29555
29644
  const judged = checkoutOf2(input.cwd);
29556
29645
  const repo = judged ? commonDir(judged.root) : null;
29557
29646
  for (const target of targets) {
29558
- const resolved = path45.resolve(target);
29647
+ const resolved = path47.resolve(target);
29559
29648
  if (within(resolved, UNKNOWN_VAR) || within(resolved, UNKNOWN_DIR))
29560
29649
  return judgeDeny(input, "it writes to a path Workit cannot resolve (a variable, a command substitution or `cd -`): spell the path out");
29561
29650
  const real = canonical5(target);
29562
- const runsGit = placeholders.has(target) && /^\.workit-(?:runs-git|live-target)$/.test(path45.basename(target));
29563
- const gitDirs = runsGit ? gitDirsAt(path45.dirname(real), repo) : [];
29651
+ const runsGit = placeholders.has(target) && /^\.workit-(?:runs-git|live-target)$/.test(path47.basename(target));
29652
+ const gitDirs = runsGit ? gitDirsAt(path47.dirname(real), repo) : [];
29564
29653
  if (gitDirs === null)
29565
29654
  return judgeDeny(input, `git in ${shown(target)} uses a git dir or config Workit cannot check`);
29566
29655
  if (runsGit ? gitDirs.length > 0 ? gitDirs.every((dir) => inScratch(dir, repo)) : inScratch(real, repo) : inScratch(real, repo) && !inGitDir(real))
@@ -29601,7 +29690,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
29601
29690
  let git = [];
29602
29691
  try {
29603
29692
  git = rawInvocations(command, dialect).flatMap(({ tool, dir, args }) => tool === "git" && (args[0] === "push" || leadOwnedGit(args) || gitKind(args) === "write" && !/^(?:init|clone)$/.test(args[0])) ? [
29604
- path45.join(dir === undefined ? UNKNOWN_DIR : path45.resolve(input.cwd, dir ?? "."), `${OPAQUE_TARGET}git`)
29693
+ path47.join(dir === undefined ? UNKNOWN_DIR : path47.resolve(input.cwd, dir ?? "."), `${OPAQUE_TARGET}git`)
29605
29694
  ] : []);
29606
29695
  } catch {}
29607
29696
  const lists = [
@@ -29646,7 +29735,7 @@ var judgeChecksLine = (cwd) => {
29646
29735
 
29647
29736
  // packages/workit-core/src/hooks/standing.ts
29648
29737
  var readPlans = (store) => {
29649
- const dir = path46.join(store, "fanouts");
29738
+ const dir = path48.join(store, "fanouts");
29650
29739
  let names;
29651
29740
  try {
29652
29741
  names = fs30.readdirSync(dir).filter((name) => name.endsWith(".json"));
@@ -29656,7 +29745,7 @@ var readPlans = (store) => {
29656
29745
  const plans = [];
29657
29746
  for (const name of names) {
29658
29747
  try {
29659
- const raw = JSON.parse(fs30.readFileSync(path46.join(dir, name), "utf8"));
29748
+ const raw = JSON.parse(fs30.readFileSync(path48.join(dir, name), "utf8"));
29660
29749
  if (typeof raw.name !== "string" || !Array.isArray(raw.slices))
29661
29750
  continue;
29662
29751
  const texts = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string" && item !== "") : [];
@@ -29867,7 +29956,7 @@ var cdWorkitSplit = (command) => {
29867
29956
  // packages/workit-core/src/hooks/model-limit.ts
29868
29957
  import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync7, readSync, statSync as statSync5 } from "node:fs";
29869
29958
  import os10 from "node:os";
29870
- import path47 from "node:path";
29959
+ import path49 from "node:path";
29871
29960
  var MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
29872
29961
  var WEEKDAYS = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
29873
29962
  var TIME_WORD = String.raw`(?:\d|(?:in|at|on|later|tomorrow|soon)\b|(?:${[...WEEKDAYS, ...MONTHS].join("|")})[a-z]*\b)`;
@@ -30065,17 +30154,17 @@ var firstPrompt = (file) => {
30065
30154
  var claudeProjectSlug = (cwd) => cwd.replace(/[^A-Za-z0-9]/gu, "-");
30066
30155
  var listDir = (dir) => {
30067
30156
  try {
30068
- return readdirSync7(dir).map((name) => path47.join(dir, name));
30157
+ return readdirSync7(dir).map((name) => path49.join(dir, name));
30069
30158
  } catch {
30070
30159
  return [];
30071
30160
  }
30072
30161
  };
30073
30162
  var SCAN_MS = 30 * 60000;
30074
30163
  var scanClaudeTranscripts = (cwd, env, now = new Date) => {
30075
- const projects = path47.join(env.CLAUDE_CONFIG_DIR || path47.join(env.HOME || os10.homedir(), ".claude"), "projects");
30076
- const project = path47.join(projects, claudeProjectSlug(cwd));
30164
+ const projects = path49.join(env.CLAUDE_CONFIG_DIR || path49.join(env.HOME || os10.homedir(), ".claude"), "projects");
30165
+ const project = path49.join(projects, claudeProjectSlug(cwd));
30077
30166
  const notes = [];
30078
- const files = listDir(project).flatMap((entry) => entry.endsWith(".jsonl") ? [{ file: entry, worker: false }] : listDir(path47.join(entry, "subagents")).filter((file) => file.endsWith(".jsonl")).map((file) => ({ file, worker: true })));
30167
+ const files = listDir(project).flatMap((entry) => entry.endsWith(".jsonl") ? [{ file: entry, worker: false }] : listDir(path49.join(entry, "subagents")).filter((file) => file.endsWith(".jsonl")).map((file) => ({ file, worker: true })));
30079
30168
  for (const { file, worker } of files)
30080
30169
  try {
30081
30170
  const stat = statSync5(file);
@@ -30090,7 +30179,7 @@ var scanClaudeTranscripts = (cwd, env, now = new Date) => {
30090
30179
  if (!seen)
30091
30180
  continue;
30092
30181
  notes.push(worker ? redispatchNote(seen, {
30093
- label: `worker ${path47.basename(file, ".jsonl")}`,
30182
+ label: `worker ${path49.basename(file, ".jsonl")}`,
30094
30183
  prompt: firstPrompt(file)
30095
30184
  }, now) : `Workit: this session hit a usage limit (${seen.reason}); ${seen.key} is marked exhausted until ${shortTime(seen.until)}. Claude Code runs only Anthropic models: Workit cannot switch this session, so continue on another host or after the reset.`);
30096
30185
  } catch {}
@@ -30990,12 +31079,12 @@ var modelKey = (model) => {
30990
31079
  };
30991
31080
 
30992
31081
  // packages/workit-core/src/hooks/budget-signal.ts
30993
- import { createHash as createHash22 } from "node:crypto";
31082
+ import { createHash as createHash23 } from "node:crypto";
30994
31083
  import fs31 from "node:fs";
30995
- import path48 from "node:path";
30996
- var hash2 = (text) => createHash22("sha256").update(text).digest("hex").slice(0, 32);
30997
- var budgetDir = (store) => path48.join(store, "budget");
30998
- var agentBase = (store, session, agentId) => path48.join(budgetDir(store), hash2(`${session}\x00${agentId ?? ""}`));
31084
+ import path50 from "node:path";
31085
+ var hash2 = (text) => createHash23("sha256").update(text).digest("hex").slice(0, 32);
31086
+ var budgetDir = (store) => path50.join(store, "budget");
31087
+ var agentBase = (store, session, agentId) => path50.join(budgetDir(store), hash2(`${session}\x00${agentId ?? ""}`));
30999
31088
  var spawnBudget = (prompt) => {
31000
31089
  const found = /^TIMEBOX:[^\n]*?\b(\d+)\s+tool calls\b/mu.exec(prompt);
31001
31090
  const n = found ? Number(found[1]) : NaN;
@@ -31015,8 +31104,8 @@ var startBudget = (store, session, agentId, n) => {
31015
31104
  const cutoff = Date.now() - 604800000;
31016
31105
  for (const name of fs31.readdirSync(dir))
31017
31106
  try {
31018
- if (fs31.statSync(path48.join(dir, name)).mtimeMs < cutoff)
31019
- fs31.rmSync(path48.join(dir, name));
31107
+ if (fs31.statSync(path50.join(dir, name)).mtimeMs < cutoff)
31108
+ fs31.rmSync(path50.join(dir, name));
31020
31109
  } catch {}
31021
31110
  const base = agentBase(store, session, agentId);
31022
31111
  fs31.writeFileSync(`${base}.json`, JSON.stringify({ limit: n, told: 0 }));
@@ -31155,11 +31244,11 @@ var unfinishedTaskOffer2 = (ctx) => {
31155
31244
  };
31156
31245
 
31157
31246
  // packages/workit-core/src/hooks/repeat-failure.ts
31158
- import { createHash as createHash23 } from "node:crypto";
31247
+ import { createHash as createHash24 } from "node:crypto";
31159
31248
  var SAME_CALL_FAILED = "Same call failed twice:";
31160
31249
  var MAX_SESSIONS = 256;
31161
31250
  var stable = (value) => JSON.stringify(value, (_key, entry) => entry && typeof entry === "object" && !Array.isArray(entry) ? Object.fromEntries(Object.entries(entry).toSorted(([a], [b]) => a.localeCompare(b))) : entry) ?? "null";
31162
- var hashOf = (call) => createHash23("sha256").update(call).digest("hex").slice(0, 32);
31251
+ var hashOf = (call) => createHash24("sha256").update(call).digest("hex").slice(0, 32);
31163
31252
  var record2 = (memo, sessionId, call, failed, next) => {
31164
31253
  const previous = memo.get(sessionId);
31165
31254
  memo.delete(sessionId);
@@ -31352,16 +31441,17 @@ ${shown.join(`
31352
31441
  };
31353
31442
  }
31354
31443
  };
31355
- var askInline = async (words, command, event, ctx) => {
31444
+ var askInline = async (call, command, event, ctx) => {
31356
31445
  try {
31357
- const ask = inlineAskFor(words, ctx.cwd);
31446
+ const ask = inlineAskFor(call.words, inlineCallCwd(call, ctx.cwd));
31358
31447
  if (!ask)
31359
31448
  return;
31360
31449
  const choice = await ctx.ui.select(ask.text, [APPROVE, REJECT]);
31450
+ const nothing = ask.kind === "release-notes" ? "nothing was approved" : "nothing was posted";
31361
31451
  if (choice !== APPROVE)
31362
31452
  return {
31363
31453
  block: true,
31364
- reason: choice === REJECT ? `The user rejected ${ask.action}: nothing was posted. Do not retry it; report that it was not approved.` : `The user dismissed the dialog for ${ask.action}: nothing was posted.`
31454
+ reason: choice === REJECT ? `The user rejected ${ask.action}: ${nothing}. Do not retry it; report that it was not approved.` : `The user dismissed the dialog for ${ask.action}: ${nothing}.`
31365
31455
  };
31366
31456
  const { ticket } = recordInlineAsk({
31367
31457
  kind: ask.kind,
@@ -31399,12 +31489,12 @@ var enforceToolPolicy = (event, ctx) => {
31399
31489
  if (inline && !inline.plain)
31400
31490
  return { block: true, reason: inlineCallDeny(inline.fix) };
31401
31491
  if (inline?.plain && ctx.mode === "tui" && ctx.hasUI) {
31402
- const gated = gate({
31492
+ const gated = isReleaseNotesCall(inline.words) && inlineAskFor(inline.words, inlineCallCwd(inline, ctx.cwd)) ? undefined : gate({
31403
31493
  kind: "shell.pre",
31404
31494
  command,
31405
31495
  toolUseId: event.toolCallId ?? null
31406
31496
  });
31407
- return gated ?? askInline(inline.words, command, event, ctx);
31497
+ return gated ?? askInline(inline, command, event, ctx);
31408
31498
  }
31409
31499
  return typeof command === "string" ? gate({
31410
31500
  kind: "shell.pre",
@@ -31468,14 +31558,14 @@ var observeToolResult = (event, ctx) => {
31468
31558
  var skillPromptNudge = (prompt, ctx) => process.env.WORKIT_PI_WORKER_SESSION ? null : promptNudge(hookInput(ctx, { kind: "context.turn", prompt }), prompt);
31469
31559
 
31470
31560
  // packages/workit-pi/src/launches.ts
31471
- import { mkdirSync as mkdirSync7, readFileSync as readFileSync15, readdirSync as readdirSync8, rmSync as rmSync4, writeFileSync as writeFileSync6 } from "node:fs";
31561
+ import { mkdirSync as mkdirSync7, readFileSync as readFileSync16, readdirSync as readdirSync8, rmSync as rmSync4, writeFileSync as writeFileSync6 } from "node:fs";
31472
31562
  import os11 from "node:os";
31473
- import path49 from "node:path";
31563
+ import path51 from "node:path";
31474
31564
  var launchDir = (root) => {
31475
31565
  const location = resolveStore(root);
31476
- return location instanceof Error ? null : path49.join(location.dir, "pi-launches");
31566
+ return location instanceof Error ? null : path51.join(location.dir, "pi-launches");
31477
31567
  };
31478
- var fileFor = (dir, workerId) => path49.join(dir, `${workerId.replace(/[^A-Za-z0-9-]/g, "_")}.json`);
31568
+ var fileFor = (dir, workerId) => path51.join(dir, `${workerId.replace(/[^A-Za-z0-9-]/g, "_")}.json`);
31479
31569
  var recordLaunch = (root, attempt) => {
31480
31570
  const dir = launchDir(root);
31481
31571
  if (!dir)
@@ -31521,7 +31611,7 @@ var abandonedLaunches = (root) => {
31521
31611
  const found = [];
31522
31612
  for (const name of names) {
31523
31613
  try {
31524
- const attempt = JSON.parse(readFileSync15(path49.join(dir, name), "utf8"));
31614
+ const attempt = JSON.parse(readFileSync16(path51.join(dir, name), "utf8"));
31525
31615
  if (typeof attempt.workerId === "string" && typeof attempt.session === "string") {
31526
31616
  if (!alive(attempt))
31527
31617
  found.push(attempt);
@@ -31533,18 +31623,18 @@ var abandonedLaunches = (root) => {
31533
31623
  var cancelHint = (workerId) => `cancel it first: workit_worker {"action":"cancel","workerId":"${workerId}","reason":"launch outcome unknown"} (CLI: workit worker cancel --payload '{"workerId":"${workerId}","reason":"launch outcome unknown"}')`;
31534
31624
 
31535
31625
  // packages/workit-core/src/core/cli-locate.ts
31536
- import { closeSync as closeSync4, existsSync as existsSync15, openSync as openSync4, readSync as readSync2 } from "node:fs";
31537
- import path50 from "node:path";
31626
+ import { closeSync as closeSync4, existsSync as existsSync16, openSync as openSync4, readSync as readSync2 } from "node:fs";
31627
+ import path52 from "node:path";
31538
31628
  var LAUNCHER_MARKER = "workit-owned-launcher";
31539
31629
  var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
31540
31630
  var installRoot = (env, platform = process.platform) => {
31541
31631
  if (env.WORKIT_INSTALL_ROOT)
31542
31632
  return env.WORKIT_INSTALL_ROOT;
31543
31633
  const data = dataDir(env, platform);
31544
- return platform === "win32" ? path50.join(data, "install") : data;
31634
+ return platform === "win32" ? path52.join(data, "install") : data;
31545
31635
  };
31546
- var ownedLauncherPath = (env, platform = process.platform) => path50.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
31547
- var ownedCurrentEntry = (env, platform = process.platform) => path50.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
31636
+ var ownedLauncherPath = (env, platform = process.platform) => path52.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
31637
+ var ownedCurrentEntry = (env, platform = process.platform) => path52.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
31548
31638
  var head = (file) => {
31549
31639
  let fd;
31550
31640
  try {
@@ -31562,7 +31652,7 @@ var head = (file) => {
31562
31652
  var locateWorkitCli = (options = {}) => {
31563
31653
  const env = options.env ?? process.env;
31564
31654
  const platform = options.platform ?? process.platform;
31565
- const exists = options.exists ?? existsSync15;
31655
+ const exists = options.exists ?? existsSync16;
31566
31656
  const read = options.read ?? head;
31567
31657
  const node = options.node ?? process.execPath;
31568
31658
  const launcher = ownedLauncherPath(env, platform);
@@ -31571,7 +31661,7 @@ var locateWorkitCli = (options = {}) => {
31571
31661
  source: "owned-launcher",
31572
31662
  command: launcher,
31573
31663
  args: [],
31574
- binDir: path50.dirname(launcher)
31664
+ binDir: path52.dirname(launcher)
31575
31665
  };
31576
31666
  const current = ownedCurrentEntry(env, platform);
31577
31667
  if (exists(current))
@@ -31600,7 +31690,7 @@ var workitCliEnv = (located, env = process.env, platform = process.platform) =>
31600
31690
  if (located.binDir) {
31601
31691
  const key = pathKey(env);
31602
31692
  const delimiter = platform === "win32" ? ";" : ":";
31603
- const same = (dir) => platform === "win32" ? path50.win32.normalize(dir).toLowerCase() === path50.win32.normalize(located.binDir).toLowerCase() : path50.posix.normalize(dir) === path50.posix.normalize(located.binDir);
31693
+ const same = (dir) => platform === "win32" ? path52.win32.normalize(dir).toLowerCase() === path52.win32.normalize(located.binDir).toLowerCase() : path52.posix.normalize(dir) === path52.posix.normalize(located.binDir);
31604
31694
  const rest = (env[key] ?? "").split(delimiter).filter((dir) => dir && !same(dir));
31605
31695
  patch[key] = [located.binDir, ...rest].join(delimiter);
31606
31696
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/pi",
3
- "version": "2.5.0",
3
+ "version": "2.6.0",
4
4
  "description": "Workit native extension for Pi — tools, method skills, and session continuity",
5
5
  "keywords": [
6
6
  "agentic-coding",
@@ -23,9 +23,10 @@
23
23
  get, from the user's pointers, in their words, not commit subjects.
24
24
  Rerunning draft keeps them. Under `review`, finish refuses
25
25
  (`release_notes_unapproved`) until the user approves: show the user the
26
- draft and stop. They run `workit release notes approve <version>` in
27
- their own terminal; never run it for them. Edit the draft after approval
28
- only when they ask, then they approve again.
26
+ full draft in chat, then run `workit release notes approve <version>`
27
+ as its own call: Claude Code and Pi ask the user on it. If refused, ask
28
+ the user to run the command it names in their terminal. Edit the draft
29
+ after approval only when they ask, then they approve again.
29
30
  4. Interrupted (a conflict, a failed push, no forge release yet): fix the
30
31
  cause and rerun the `resume` command it printed. Steps already done are
31
32
  skipped, never repeated.