@workit-dev/pi 2.4.4 → 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/worker.js +12 -1
- package/dist/workit.js +417 -104
- package/package.json +1 -1
- package/skills/workit-ship/references/release.md +4 -3
package/dist/worker.js
CHANGED
|
@@ -9172,6 +9172,17 @@ import path14 from "node:path";
|
|
|
9172
9172
|
var REQUEST_TTL_MS = 30 * 60000;
|
|
9173
9173
|
var GRANT_TTL_MS = 15 * 60000;
|
|
9174
9174
|
var ASKING_HOSTS = new Set(["claude_code", "pi"]);
|
|
9175
|
+
var INLINE_ASK_TTL_MS = 2 * 60000;
|
|
9176
|
+
|
|
9177
|
+
// packages/workit-core/src/approvals/youtrack-ask.ts
|
|
9178
|
+
var TIME = "markdown file minutes text date";
|
|
9179
|
+
var FLAGS = {
|
|
9180
|
+
note: TIME,
|
|
9181
|
+
time: TIME,
|
|
9182
|
+
meeting: TIME,
|
|
9183
|
+
update: `${TIME} attach state command`,
|
|
9184
|
+
create: "project summary description file attach command"
|
|
9185
|
+
};
|
|
9175
9186
|
|
|
9176
9187
|
// packages/workit-core/src/hooks/hosts/fields.ts
|
|
9177
9188
|
var SHELLS2 = new Set(["sh", "bash", "zsh", "dash", "pwsh", "powershell", "cmd"]);
|
|
@@ -9302,7 +9313,7 @@ var CONTEXT_EVENTS = new Set([
|
|
|
9302
9313
|
"PreToolUse",
|
|
9303
9314
|
"PostToolUse"
|
|
9304
9315
|
]);
|
|
9305
|
-
var ASKING_MODES = new Set(["default", "acceptEdits", "plan"]);
|
|
9316
|
+
var ASKING_MODES = new Set(["default", "acceptEdits", "plan", "auto"]);
|
|
9306
9317
|
|
|
9307
9318
|
// packages/workit-core/src/hooks/hosts/codex.ts
|
|
9308
9319
|
var CODEX_DESCRIPTOR = {
|
package/dist/workit.js
CHANGED
|
@@ -27971,11 +27971,11 @@ var writePaths = (input) => {
|
|
|
27971
27971
|
};
|
|
27972
27972
|
// packages/workit-core/src/hooks/standing.ts
|
|
27973
27973
|
import fs30 from "node:fs";
|
|
27974
|
-
import
|
|
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";
|
|
27978
|
-
import { mkdirSync as mkdirSync6, readdirSync as readdirSync6, readFileSync as readFileSync13 } from "node:fs";
|
|
27978
|
+
import { mkdirSync as mkdirSync6, readdirSync as readdirSync6, readFileSync as readFileSync13, rmSync as rmSync3 } from "node:fs";
|
|
27979
27979
|
import path43 from "node:path";
|
|
27980
27980
|
var REQUEST_TTL_MS = 30 * 60000;
|
|
27981
27981
|
var GRANT_TTL_MS = 15 * 60000;
|
|
@@ -28006,6 +28006,13 @@ var write = (file, value) => {
|
|
|
28006
28006
|
`);
|
|
28007
28007
|
};
|
|
28008
28008
|
var live = (expires, now) => Date.parse(expires) > now.getTime();
|
|
28009
|
+
var names2 = (part) => {
|
|
28010
|
+
try {
|
|
28011
|
+
return readdirSync6(dirOf(part)).filter((name) => name.endsWith(".json"));
|
|
28012
|
+
} catch {
|
|
28013
|
+
return [];
|
|
28014
|
+
}
|
|
28015
|
+
};
|
|
28009
28016
|
var later = (now, ms) => new Date(now.getTime() + ms).toISOString();
|
|
28010
28017
|
var readApprovalRequest = (id) => {
|
|
28011
28018
|
if (!isApprovalId(id))
|
|
@@ -28037,12 +28044,21 @@ var liveApprovalRequest = (id, now = new Date) => {
|
|
|
28037
28044
|
};
|
|
28038
28045
|
return { ok: true, request };
|
|
28039
28046
|
};
|
|
28040
|
-
var
|
|
28047
|
+
var SHOWN_LINES = 60;
|
|
28048
|
+
var shownText = (text, indent = " ") => {
|
|
28049
|
+
const lines = text.trimEnd().split(/\r?\n/u);
|
|
28050
|
+
const more = lines.length - SHOWN_LINES;
|
|
28051
|
+
if (more > 0)
|
|
28052
|
+
lines.splice(SHOWN_LINES, more, `… ${more} more lines`);
|
|
28053
|
+
return lines.map((line) => indent + line);
|
|
28054
|
+
};
|
|
28055
|
+
var subjectLines = (subject) => Object.entries(subject).flatMap(([key, value]) => typeof value === "string" && value.includes(`
|
|
28056
|
+
`) ? [` ${key}:`, ...shownText(value)] : [` ${key}: ${typeof value === "string" ? value : JSON.stringify(value)}`]);
|
|
28041
28057
|
var renderApprovalRequest = (request) => [
|
|
28042
28058
|
`${request.id} (${request.kind}): ${request.action}`,
|
|
28043
28059
|
` target: ${Object.entries(request.target).map(([key, value]) => `${key} ${value}`).join(", ")}`,
|
|
28044
28060
|
` effect: ${request.effect}`,
|
|
28045
|
-
|
|
28061
|
+
...subjectLines(request.subject),
|
|
28046
28062
|
` hash: ${request.hash.slice(0, 12)} expires: ${request.expires}`
|
|
28047
28063
|
].join(`
|
|
28048
28064
|
`);
|
|
@@ -28104,6 +28120,31 @@ var recordApprovalRejected = (input, now = new Date) => {
|
|
|
28104
28120
|
write(fileOf("rejected", input.id), { ...input, at: now.toISOString() });
|
|
28105
28121
|
};
|
|
28106
28122
|
var ASKING_HOSTS = new Set(["claude_code", "pi"]);
|
|
28123
|
+
var INLINE_ASK_TTL_MS = 2 * 60000;
|
|
28124
|
+
var INLINE_TICKET_ENV = "WORKIT_APPROVAL_TICKET";
|
|
28125
|
+
var namesTicket = (text) => /WORKIT_APPROVAL_(?:TICKET|UNASKED)/u.test(text.replace(/['"\\]/gu, ""));
|
|
28126
|
+
var TICKET_DENY = "Only the host's prompt adds an approval ticket.";
|
|
28127
|
+
var dropInline = (drop) => {
|
|
28128
|
+
for (const name of names2("inline")) {
|
|
28129
|
+
const file = path43.join(dirOf("inline"), name);
|
|
28130
|
+
const row = readJson3(file);
|
|
28131
|
+
if (!row || drop(row))
|
|
28132
|
+
rmSync3(file, { force: true });
|
|
28133
|
+
}
|
|
28134
|
+
};
|
|
28135
|
+
var sha = (text) => createHash19("sha256").update(text).digest("hex");
|
|
28136
|
+
var recordInlineAsk = (input, now = new Date, ttlMs = INLINE_ASK_TTL_MS) => {
|
|
28137
|
+
dropInline((row) => row.argvHash === input.argvHash && row.contentHash === input.contentHash);
|
|
28138
|
+
const ticket = randomBytes4(24).toString("base64url");
|
|
28139
|
+
const asked = {
|
|
28140
|
+
...input,
|
|
28141
|
+
ticketHash: sha(ticket),
|
|
28142
|
+
at: now.toISOString(),
|
|
28143
|
+
expires: later(now, ttlMs)
|
|
28144
|
+
};
|
|
28145
|
+
write(fileOf("inline", asked.ticketHash), asked);
|
|
28146
|
+
return { ticket, asked };
|
|
28147
|
+
};
|
|
28107
28148
|
|
|
28108
28149
|
// packages/workit-core/src/approvals/call.ts
|
|
28109
28150
|
var isWorkitWord2 = (word) => /^(?:.*[\\/])?workit(?:-cli)?$/u.test(word);
|
|
@@ -28146,6 +28187,228 @@ var approveCallIn = (command, dialect = "posix") => {
|
|
|
28146
28187
|
};
|
|
28147
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.`;
|
|
28148
28189
|
|
|
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
|
|
28194
|
+
import { createHash as createHash20 } from "node:crypto";
|
|
28195
|
+
import { existsSync as existsSync15, readFileSync as readFileSync14 } from "node:fs";
|
|
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";
|
|
28254
|
+
var TIME = "markdown file minutes text date";
|
|
28255
|
+
var FLAGS = {
|
|
28256
|
+
note: TIME,
|
|
28257
|
+
time: TIME,
|
|
28258
|
+
meeting: TIME,
|
|
28259
|
+
update: `${TIME} attach state command`,
|
|
28260
|
+
create: "project summary description file attach command"
|
|
28261
|
+
};
|
|
28262
|
+
var isYouTrackWriteVerb = (word) => Object.hasOwn(FLAGS, word ?? "");
|
|
28263
|
+
var sha2564 = (data) => createHash21("sha256").update(data).digest("hex");
|
|
28264
|
+
var youTrackAsk = (args, cwd, load = readFileSync15) => {
|
|
28265
|
+
const [verb = "", ...rest] = args;
|
|
28266
|
+
if (!isYouTrackWriteVerb(verb))
|
|
28267
|
+
return null;
|
|
28268
|
+
const known = FLAGS[verb]?.split(" ") ?? [];
|
|
28269
|
+
const values = {};
|
|
28270
|
+
const attach = [];
|
|
28271
|
+
const positionals = [];
|
|
28272
|
+
for (let index = 0;index < rest.length; index += 1) {
|
|
28273
|
+
const arg = rest[index] ?? "";
|
|
28274
|
+
if (arg === "--") {
|
|
28275
|
+
positionals.push(...rest.slice(index + 1));
|
|
28276
|
+
break;
|
|
28277
|
+
}
|
|
28278
|
+
if (arg === "--json")
|
|
28279
|
+
continue;
|
|
28280
|
+
if (!arg.startsWith("--")) {
|
|
28281
|
+
positionals.push(arg);
|
|
28282
|
+
continue;
|
|
28283
|
+
}
|
|
28284
|
+
const eq = arg.indexOf("=");
|
|
28285
|
+
const name = arg.slice(2, eq < 0 ? undefined : eq);
|
|
28286
|
+
const value = eq >= 0 ? arg.slice(eq + 1) : rest[++index];
|
|
28287
|
+
if (!known.includes(name) || !value || eq < 0 && value.startsWith("--"))
|
|
28288
|
+
return null;
|
|
28289
|
+
if (name === "attach")
|
|
28290
|
+
attach.push(value);
|
|
28291
|
+
else
|
|
28292
|
+
values[name] = value;
|
|
28293
|
+
}
|
|
28294
|
+
const files = [];
|
|
28295
|
+
const read = (file) => {
|
|
28296
|
+
try {
|
|
28297
|
+
const named = path45.resolve(cwd, file);
|
|
28298
|
+
const content = load(named);
|
|
28299
|
+
files.push([realpathSync11(named), sha2564(content)]);
|
|
28300
|
+
return content;
|
|
28301
|
+
} catch {
|
|
28302
|
+
return null;
|
|
28303
|
+
}
|
|
28304
|
+
};
|
|
28305
|
+
const fromFile = values.file === undefined ? undefined : read(values.file);
|
|
28306
|
+
if (fromFile === null)
|
|
28307
|
+
return null;
|
|
28308
|
+
const lines = [];
|
|
28309
|
+
const text = fromFile?.toString("utf8") ?? values.markdown ?? values.description;
|
|
28310
|
+
const [target, extra] = positionals;
|
|
28311
|
+
let action = `workit youtrack ${verb} ${target}`;
|
|
28312
|
+
if (verb === "create") {
|
|
28313
|
+
if (!values.project || !values.summary?.trim() || target !== undefined)
|
|
28314
|
+
return null;
|
|
28315
|
+
action = `workit youtrack create --project ${values.project}`;
|
|
28316
|
+
lines.push(`new ${values.project} issue: ${values.summary.trim()}`);
|
|
28317
|
+
if (text !== undefined)
|
|
28318
|
+
lines.push("description:", ...shownText(text));
|
|
28319
|
+
} else {
|
|
28320
|
+
if (!target || !/^[A-Z][A-Z0-9_]*-\d+$/u.test(target) || extra !== undefined)
|
|
28321
|
+
return null;
|
|
28322
|
+
if (text !== undefined)
|
|
28323
|
+
lines.push("comment:", ...shownText(text));
|
|
28324
|
+
if (values.minutes)
|
|
28325
|
+
lines.push(`time: ${values.minutes}m on ${values.date ?? "today"}${values.text === undefined ? "" : ` ("${values.text}")`}`);
|
|
28326
|
+
if (values.state)
|
|
28327
|
+
lines.push(`state: ${values.state}`);
|
|
28328
|
+
}
|
|
28329
|
+
if (values.command)
|
|
28330
|
+
lines.push(`command: ${values.command}`);
|
|
28331
|
+
for (const file of attach) {
|
|
28332
|
+
const content = read(file);
|
|
28333
|
+
if (!content)
|
|
28334
|
+
return null;
|
|
28335
|
+
lines.push(`attach: ${path45.basename(file)} (${content.length} bytes)`);
|
|
28336
|
+
}
|
|
28337
|
+
if (!lines.length)
|
|
28338
|
+
return null;
|
|
28339
|
+
return {
|
|
28340
|
+
kind: "youtrack-write",
|
|
28341
|
+
action,
|
|
28342
|
+
text: [`Yes runs ${action} once:`, ...lines].join(`
|
|
28343
|
+
`),
|
|
28344
|
+
argvHash: sha2564(canonicalJson(args)),
|
|
28345
|
+
contentHash: sha2564(canonicalJson({ args, files }))
|
|
28346
|
+
};
|
|
28347
|
+
};
|
|
28348
|
+
|
|
28349
|
+
// packages/workit-core/src/approvals/inline.ts
|
|
28350
|
+
var isReleaseNotesCall = (words) => words[0] === "release" && isReleaseNotesApprove(words.slice(1));
|
|
28351
|
+
var asked = (words) => words[0] === "youtrack" && isYouTrackWriteVerb(words[1]) || isReleaseNotesCall(words);
|
|
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;
|
|
28373
|
+
var inlineCallIn = (command, dialect = "posix") => {
|
|
28374
|
+
if (!/\bworkit\b/u.test(command))
|
|
28375
|
+
return null;
|
|
28376
|
+
const segments = segmentsOf(command, dialect);
|
|
28377
|
+
for (const segment of segments) {
|
|
28378
|
+
if (segment.unanalyzable)
|
|
28379
|
+
continue;
|
|
28380
|
+
const { words } = segment;
|
|
28381
|
+
const script = (words[0] ?? "").endsWith("sh") ? words.find((word) => /\bworkit\s+(?:youtrack|release\s+notes\s+approve)\s/u.test(word)) : undefined;
|
|
28382
|
+
if (script)
|
|
28383
|
+
return { plain: false, fix: script.trim() };
|
|
28384
|
+
const start = words.findIndex(isWorkitWord2);
|
|
28385
|
+
if (start < 0)
|
|
28386
|
+
continue;
|
|
28387
|
+
const at = verbIndex(words, start + 1);
|
|
28388
|
+
const call = words.slice(at);
|
|
28389
|
+
if (!asked(call))
|
|
28390
|
+
continue;
|
|
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;
|
|
28392
|
+
if (plain)
|
|
28393
|
+
return {
|
|
28394
|
+
plain: true,
|
|
28395
|
+
words: routed(call, words.slice(1, at)),
|
|
28396
|
+
cwd: cwdOf(words.slice(1, at))
|
|
28397
|
+
};
|
|
28398
|
+
return {
|
|
28399
|
+
plain: false,
|
|
28400
|
+
fix: `workit ${call.map(quote2).join(" ")}`
|
|
28401
|
+
};
|
|
28402
|
+
}
|
|
28403
|
+
return null;
|
|
28404
|
+
};
|
|
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
|
+
};
|
|
28410
|
+
var inlineCallDeny = (fix) => `Run \`${fix}\` as its own call so the host can ask the user.`;
|
|
28411
|
+
|
|
28149
28412
|
// packages/workit-core/src/hooks/hosts/claude-code.ts
|
|
28150
28413
|
var CLAUDE_CODE_DESCRIPTOR = {
|
|
28151
28414
|
host: "claude_code",
|
|
@@ -28253,7 +28516,7 @@ var CONTEXT_EVENTS = new Set([
|
|
|
28253
28516
|
"PreToolUse",
|
|
28254
28517
|
"PostToolUse"
|
|
28255
28518
|
]);
|
|
28256
|
-
var ASKING_MODES = new Set(["default", "acceptEdits", "plan"]);
|
|
28519
|
+
var ASKING_MODES = new Set(["default", "acceptEdits", "plan", "auto"]);
|
|
28257
28520
|
|
|
28258
28521
|
// packages/workit-core/src/hooks/hosts/codex.ts
|
|
28259
28522
|
var CODEX_DESCRIPTOR = {
|
|
@@ -28619,37 +28882,37 @@ function neededChecks(lane, configured) {
|
|
|
28619
28882
|
}
|
|
28620
28883
|
|
|
28621
28884
|
// packages/workit-core/src/hooks/worktree-confine.ts
|
|
28622
|
-
import { createHash as
|
|
28885
|
+
import { createHash as createHash22 } from "node:crypto";
|
|
28623
28886
|
import fs29 from "node:fs";
|
|
28624
|
-
import
|
|
28887
|
+
import path47 from "node:path";
|
|
28625
28888
|
var FANOUT_TOKEN_FILE = "workit-fanout-token";
|
|
28626
28889
|
var NONE5 = { kind: "none" };
|
|
28627
28890
|
var CASE_INSENSITIVE2 = process.platform === "darwin" || process.platform === "win32";
|
|
28628
28891
|
var realOf = (file) => {
|
|
28629
28892
|
let rest = "";
|
|
28630
|
-
for (let dir = file;; dir =
|
|
28893
|
+
for (let dir = file;; dir = path47.dirname(dir)) {
|
|
28631
28894
|
try {
|
|
28632
|
-
return
|
|
28895
|
+
return path47.join(fs29.realpathSync.native(dir), rest);
|
|
28633
28896
|
} catch {
|
|
28634
|
-
if (
|
|
28897
|
+
if (path47.dirname(dir) === dir)
|
|
28635
28898
|
return file;
|
|
28636
|
-
rest = rest ?
|
|
28899
|
+
rest = rest ? path47.join(path47.basename(dir), rest) : path47.basename(dir);
|
|
28637
28900
|
}
|
|
28638
28901
|
}
|
|
28639
28902
|
};
|
|
28640
28903
|
var canonical5 = (file, hops = { chain: 40, total: 1000 }) => {
|
|
28641
|
-
const start =
|
|
28642
|
-
const { root } =
|
|
28904
|
+
const start = path47.isAbsolute(file) ? file : `${process.cwd()}${path47.sep}${file}`;
|
|
28905
|
+
const { root } = path47.parse(start);
|
|
28643
28906
|
let at = root;
|
|
28644
28907
|
let missing = false;
|
|
28645
28908
|
for (const part of start.slice(root.length).split(/[\\/]+/)) {
|
|
28646
28909
|
if (part === "" || part === ".")
|
|
28647
28910
|
continue;
|
|
28648
28911
|
if (part === "..") {
|
|
28649
|
-
at =
|
|
28912
|
+
at = path47.dirname(at);
|
|
28650
28913
|
continue;
|
|
28651
28914
|
}
|
|
28652
|
-
const next =
|
|
28915
|
+
const next = path47.join(at, part);
|
|
28653
28916
|
let link = null;
|
|
28654
28917
|
if (!missing)
|
|
28655
28918
|
try {
|
|
@@ -28661,25 +28924,25 @@ var canonical5 = (file, hops = { chain: 40, total: 1000 }) => {
|
|
|
28661
28924
|
at = next;
|
|
28662
28925
|
hops.chain = 40;
|
|
28663
28926
|
} else if (hops.chain-- > 0 && hops.total-- > 0)
|
|
28664
|
-
at = canonical5(
|
|
28927
|
+
at = canonical5(path47.isAbsolute(link) ? link : `${at}${path47.sep}${link}`, hops);
|
|
28665
28928
|
else
|
|
28666
|
-
return
|
|
28929
|
+
return path47.resolve(file);
|
|
28667
28930
|
}
|
|
28668
28931
|
return realOf(at);
|
|
28669
28932
|
};
|
|
28670
28933
|
var within = (child, parent) => {
|
|
28671
28934
|
const fold = (value) => CASE_INSENSITIVE2 ? value.toLowerCase() : value;
|
|
28672
|
-
const relative =
|
|
28673
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
28935
|
+
const relative = path47.relative(fold(parent), fold(child));
|
|
28936
|
+
return relative === "" || !relative.startsWith("..") && !path47.isAbsolute(relative);
|
|
28674
28937
|
};
|
|
28675
28938
|
var checkoutOf2 = (file) => {
|
|
28676
|
-
for (let dir = canonical5(file);; dir =
|
|
28677
|
-
const dotGit =
|
|
28939
|
+
for (let dir = canonical5(file);; dir = path47.dirname(dir)) {
|
|
28940
|
+
const dotGit = path47.join(dir, ".git");
|
|
28678
28941
|
if (fs29.existsSync(dotGit)) {
|
|
28679
28942
|
const admin = fs29.statSync(dotGit).isFile() ? gitDirsAt(dir, null, false)?.[0] : undefined;
|
|
28680
|
-
return { root: dir, workit: !!admin && fs29.existsSync(
|
|
28943
|
+
return { root: dir, workit: !!admin && fs29.existsSync(path47.join(admin, FANOUT_TOKEN_FILE)) };
|
|
28681
28944
|
}
|
|
28682
|
-
if (
|
|
28945
|
+
if (path47.dirname(dir) === dir)
|
|
28683
28946
|
return null;
|
|
28684
28947
|
}
|
|
28685
28948
|
};
|
|
@@ -28691,8 +28954,8 @@ var workitWorktreeOf = (file) => {
|
|
|
28691
28954
|
return null;
|
|
28692
28955
|
}
|
|
28693
28956
|
};
|
|
28694
|
-
var bindingDir = () =>
|
|
28695
|
-
var bindingFile = (session, agentId) =>
|
|
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`);
|
|
28696
28959
|
var readBinding = (file) => {
|
|
28697
28960
|
try {
|
|
28698
28961
|
const value = JSON.parse(fs29.readFileSync(file, "utf8"));
|
|
@@ -28717,7 +28980,7 @@ var bind = (input, worktree) => {
|
|
|
28717
28980
|
agentId,
|
|
28718
28981
|
at: new Date().toISOString()
|
|
28719
28982
|
};
|
|
28720
|
-
fs29.mkdirSync(
|
|
28983
|
+
fs29.mkdirSync(path47.dirname(file), { recursive: true });
|
|
28721
28984
|
fs29.writeFileSync(file, JSON.stringify(binding));
|
|
28722
28985
|
try {
|
|
28723
28986
|
if (inWorkitWorkspace(input.cwd))
|
|
@@ -28736,26 +28999,26 @@ var hostIsolated = (cwd, agentId) => {
|
|
|
28736
28999
|
const checkout = checkoutOf2(cwd);
|
|
28737
29000
|
if (!checkout)
|
|
28738
29001
|
return false;
|
|
28739
|
-
const dotGit =
|
|
29002
|
+
const dotGit = path47.join(checkout.root, ".git");
|
|
28740
29003
|
if (!fs29.statSync(dotGit).isFile())
|
|
28741
29004
|
return false;
|
|
28742
29005
|
const [adminDir, gitDir] = gitDirsAt(checkout.root, null, false) ?? [];
|
|
28743
|
-
const back = fs29.readFileSync(
|
|
28744
|
-
if (
|
|
29006
|
+
const back = fs29.readFileSync(path47.join(adminDir, "gitdir"), "utf8").trim();
|
|
29007
|
+
if (path47.relative(canonical5(path47.resolve(adminDir, back)), canonical5(dotGit)) !== "")
|
|
28745
29008
|
return false;
|
|
28746
|
-
const expected =
|
|
28747
|
-
return
|
|
29009
|
+
const expected = path47.join(path47.dirname(gitDir), ".claude", "worktrees", `agent-${agentId}`);
|
|
29010
|
+
return path47.relative(canonical5(expected), checkout.root) === "";
|
|
28748
29011
|
} catch {
|
|
28749
29012
|
return false;
|
|
28750
29013
|
}
|
|
28751
29014
|
};
|
|
28752
29015
|
var runnerAt = (target) => {
|
|
28753
|
-
const base =
|
|
29016
|
+
const base = path47.basename(target);
|
|
28754
29017
|
return base.startsWith(OPAQUE_TARGET) ? decodeURIComponent(base.slice(OPAQUE_TARGET.length)) : null;
|
|
28755
29018
|
};
|
|
28756
29019
|
var shown = (target) => {
|
|
28757
|
-
const named = /^\.workit-(?:live-target$|runs-)/.test(
|
|
28758
|
-
return
|
|
29020
|
+
const named = /^\.workit-(?:live-target$|runs-)/.test(path47.basename(target)) ? path47.dirname(target) : target;
|
|
29021
|
+
return path47.sep === "\\" ? named.replaceAll("/", "\\") : named;
|
|
28759
29022
|
};
|
|
28760
29023
|
var unboundDeny = (input, target) => {
|
|
28761
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.";
|
|
@@ -28794,7 +29057,7 @@ var literalForm = (command, refs) => {
|
|
|
28794
29057
|
};
|
|
28795
29058
|
var unknownVarDeny = (input, worktree, targets, command) => {
|
|
28796
29059
|
const refs = [
|
|
28797
|
-
...new Set(targets.flatMap((target) =>
|
|
29060
|
+
...new Set(targets.flatMap((target) => path47.relative(UNKNOWN_VAR, path47.resolve(target)).split(path47.sep)[0].split("+").filter(Boolean).map(decodeURIComponent)))
|
|
28798
29061
|
];
|
|
28799
29062
|
let text = command ?? "";
|
|
28800
29063
|
const first = [];
|
|
@@ -28823,10 +29086,10 @@ function confineImplementer(input, targets, command) {
|
|
|
28823
29086
|
try {
|
|
28824
29087
|
if (!input.session.agentId || hostIsolated(input.cwd, input.session.agentId))
|
|
28825
29088
|
return NONE5;
|
|
28826
|
-
const unresolved = targets.filter((target) => within(
|
|
29089
|
+
const unresolved = targets.filter((target) => within(path47.resolve(target), UNKNOWN_VAR));
|
|
28827
29090
|
if (unresolved.length > 0)
|
|
28828
29091
|
return unknownVarDeny(input, boundWorktree(input), unresolved, command);
|
|
28829
|
-
if (targets.some((target) => within(
|
|
29092
|
+
if (targets.some((target) => within(path47.resolve(target), UNKNOWN_DIR)))
|
|
28830
29093
|
return unknownDirDeny(input, boundWorktree(input));
|
|
28831
29094
|
const bindings = canonical5(bindingDir());
|
|
28832
29095
|
const judged = targets.map((named) => ({ named, real: canonical5(named) })).filter(({ real }) => within(real, bindings) || checkoutOf2(real) !== null);
|
|
@@ -28937,10 +29200,10 @@ var INLINE = /^-[a-zA-Z]*[ceEpm]$|^--(?:eval|print|test|version|help)$|^-[hvV]$/
|
|
|
28937
29200
|
var VALUED = /^-[WXIrC]$|^--(?:require|import|loader|conditions|input-type)$/;
|
|
28938
29201
|
var commonDir = (root) => gitDirsAt(root, null, false)?.[1] ?? "";
|
|
28939
29202
|
var inScratch = (real, repo) => {
|
|
28940
|
-
for (let dir = real;
|
|
28941
|
-
if (
|
|
29203
|
+
for (let dir = real;path47.dirname(dir) !== dir; dir = path47.dirname(dir)) {
|
|
29204
|
+
if (path47.basename(dir) !== SCRATCH)
|
|
28942
29205
|
continue;
|
|
28943
|
-
const root =
|
|
29206
|
+
const root = path47.dirname(dir);
|
|
28944
29207
|
if (checkoutOf2(root)?.root === root && (repo === null || commonDir(root) === repo))
|
|
28945
29208
|
return true;
|
|
28946
29209
|
}
|
|
@@ -28949,7 +29212,7 @@ var inScratch = (real, repo) => {
|
|
|
28949
29212
|
var inGitDir = (real) => real.split(/[\\/]/).includes(".git");
|
|
28950
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)$/;
|
|
28951
29214
|
var literalIn = (value, repo, checkout = false) => {
|
|
28952
|
-
if (/[$`]/.test(value) || !
|
|
29215
|
+
if (/[$`]/.test(value) || !path47.isAbsolute(value))
|
|
28953
29216
|
return false;
|
|
28954
29217
|
const real = canonical5(value);
|
|
28955
29218
|
const root = checkout ? checkoutOf2(real)?.root : undefined;
|
|
@@ -28970,8 +29233,8 @@ var configEntries = (text) => {
|
|
|
28970
29233
|
return entries;
|
|
28971
29234
|
};
|
|
28972
29235
|
function gitDirsAt(dir, repo, scan = true) {
|
|
28973
|
-
for (let at = dir;; at =
|
|
28974
|
-
const dotGit =
|
|
29236
|
+
for (let at = dir;; at = path47.dirname(at)) {
|
|
29237
|
+
const dotGit = path47.join(at, ".git");
|
|
28975
29238
|
let gitDir = null;
|
|
28976
29239
|
try {
|
|
28977
29240
|
if (fs29.statSync(dotGit).isDirectory())
|
|
@@ -28980,19 +29243,19 @@ function gitDirsAt(dir, repo, scan = true) {
|
|
|
28980
29243
|
const named = /^gitdir:\s*(.+?)\s*$/mu.exec(fs29.readFileSync(dotGit, "utf8"))?.[1];
|
|
28981
29244
|
if (!named)
|
|
28982
29245
|
return null;
|
|
28983
|
-
gitDir = canonical5(
|
|
29246
|
+
gitDir = canonical5(path47.resolve(at, named));
|
|
28984
29247
|
}
|
|
28985
29248
|
} catch (error) {
|
|
28986
29249
|
if (error.code !== "ENOENT")
|
|
28987
29250
|
return null;
|
|
28988
|
-
if (["HEAD", "objects", "refs"].every((name) => fs29.existsSync(
|
|
29251
|
+
if (["HEAD", "objects", "refs"].every((name) => fs29.existsSync(path47.join(at, name))))
|
|
28989
29252
|
gitDir = canonical5(at);
|
|
28990
29253
|
}
|
|
28991
29254
|
if (gitDir !== null) {
|
|
28992
|
-
const common =
|
|
28993
|
-
const shared = fs29.existsSync(common) ? canonical5(
|
|
29255
|
+
const common = path47.join(gitDir, "commondir");
|
|
29256
|
+
const shared = fs29.existsSync(common) ? canonical5(path47.resolve(gitDir, fs29.readFileSync(common, "utf8").trim())) : gitDir;
|
|
28994
29257
|
const dirs = [gitDir, shared];
|
|
28995
|
-
for (const config of scan ? new Set([
|
|
29258
|
+
for (const config of scan ? new Set([path47.join(gitDir, "config"), path47.join(shared, "config")]) : []) {
|
|
28996
29259
|
let text = "";
|
|
28997
29260
|
try {
|
|
28998
29261
|
text = fs29.readFileSync(config, "utf8");
|
|
@@ -29001,14 +29264,14 @@ function gitDirsAt(dir, repo, scan = true) {
|
|
|
29001
29264
|
}
|
|
29002
29265
|
for (const [key, value] of configEntries(text)) {
|
|
29003
29266
|
if (key === "core.worktree")
|
|
29004
|
-
dirs.push(canonical5(
|
|
29267
|
+
dirs.push(canonical5(path47.resolve(gitDir, value)));
|
|
29005
29268
|
else if (/^remote\..*\.url$/.test(key) ? !literalIn(value, repo, true) : !SAFE_KEY.test(key))
|
|
29006
29269
|
return null;
|
|
29007
29270
|
}
|
|
29008
29271
|
}
|
|
29009
29272
|
return dirs;
|
|
29010
29273
|
}
|
|
29011
|
-
if (
|
|
29274
|
+
if (path47.dirname(at) === at)
|
|
29012
29275
|
return [];
|
|
29013
29276
|
}
|
|
29014
29277
|
}
|
|
@@ -29148,10 +29411,10 @@ var gitKind = (args, local = () => true) => {
|
|
|
29148
29411
|
};
|
|
29149
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`;
|
|
29150
29413
|
var remoteIn = (dir, name, repo) => {
|
|
29151
|
-
const shared =
|
|
29414
|
+
const shared = path47.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo, false)?.[1] : undefined;
|
|
29152
29415
|
if (!shared)
|
|
29153
29416
|
return false;
|
|
29154
|
-
const url = configEntries(fs29.readFileSync(
|
|
29417
|
+
const url = configEntries(fs29.readFileSync(path47.join(shared, "config"), "utf8")).find(([key]) => key === `remote.${name}.url`.toLowerCase())?.[1];
|
|
29155
29418
|
return url !== undefined && literalIn(url, repo, true);
|
|
29156
29419
|
};
|
|
29157
29420
|
var judgeGit = (command, repo, depth = 0) => {
|
|
@@ -29165,7 +29428,7 @@ var judgeGit = (command, repo, depth = 0) => {
|
|
|
29165
29428
|
const lead = [];
|
|
29166
29429
|
while (/^\w+\+?=/.test(words[at] ?? ""))
|
|
29167
29430
|
lead.push(words[at++]);
|
|
29168
|
-
const name =
|
|
29431
|
+
const name = path47.basename(words[at] ?? "");
|
|
29169
29432
|
let start = words.findIndex((word) => /(?:^|[\\/])git(?:\.exe)?(?:=|$)/.test(word));
|
|
29170
29433
|
if (start > at) {
|
|
29171
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] ?? ""))
|
|
@@ -29176,7 +29439,7 @@ var judgeGit = (command, repo, depth = 0) => {
|
|
|
29176
29439
|
if (start >= 0 && words[start].includes("="))
|
|
29177
29440
|
why = "git is redefined";
|
|
29178
29441
|
const run = words[start] ?? "";
|
|
29179
|
-
if (run.includes("/") && (!
|
|
29442
|
+
if (run.includes("/") && (!path47.isAbsolute(run) || literalIn(run, repo, true)))
|
|
29180
29443
|
why ??= `\`${run}\` is not the system git`;
|
|
29181
29444
|
if (segment.expands?.includes(at) && name !== "[" || /\{[^}]*,/.test(words[at] ?? ""))
|
|
29182
29445
|
why = "the command's name is expanded by the shell";
|
|
@@ -29206,12 +29469,12 @@ var judgeGit = (command, repo, depth = 0) => {
|
|
|
29206
29469
|
if (!gitKind(args, local))
|
|
29207
29470
|
why = `\`git ${args.slice(0, 2).join(" ")}\` is not allowed`;
|
|
29208
29471
|
else if (args[0] === "status" && !unlocked) {
|
|
29209
|
-
const dirs =
|
|
29472
|
+
const dirs = path47.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo) : null;
|
|
29210
29473
|
if (!dirs?.length || !dirs.every((gitDir) => inScratch(gitDir, repo)))
|
|
29211
29474
|
why = "`git status` refreshes the index outside scratch: add --no-optional-locks";
|
|
29212
29475
|
}
|
|
29213
29476
|
}
|
|
29214
|
-
const shell = /^(?:grep|egrep|rg|echo|printf|cat)$/.test(name) ? -1 : words.findIndex((word) => /^(?:sh|bash|zsh|dash|ksh|mksh|ash)$/.test(
|
|
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)));
|
|
29215
29478
|
const scripts = [
|
|
29216
29479
|
...words.filter((_, after) => shell >= 0 && after > shell && /^-[a-zA-Z]*c[a-zA-Z]*$/.test(words[after - 1])),
|
|
29217
29480
|
...shell < 0 ? [] : segment.stdin ?? []
|
|
@@ -29252,7 +29515,7 @@ var judgeVerbRefused = (args) => {
|
|
|
29252
29515
|
var CLI_RUNNERS = /^(?:npx|bunx|pnpx|npm|pnpm|yarn|bun|node|nodejs|deno|tsx|ts-node)$/;
|
|
29253
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?$/;
|
|
29254
29517
|
var workitCalls = (command, depth = 0, aliases = new Map) => depth > 4 ? [] : commandLines(command).flatMap((words) => {
|
|
29255
|
-
const name =
|
|
29518
|
+
const name = path47.basename(words[0] ?? "").toLowerCase();
|
|
29256
29519
|
if (name === "alias")
|
|
29257
29520
|
return words.flatMap((word) => {
|
|
29258
29521
|
const set = /^([\w-]+)=(.*)$/s.exec(word);
|
|
@@ -29282,11 +29545,11 @@ var judgeRefusal = (command, fed, depth = 0) => {
|
|
|
29282
29545
|
return why;
|
|
29283
29546
|
}
|
|
29284
29547
|
const { words } = segment;
|
|
29285
|
-
const runs = (word = "") => RUNS.test(
|
|
29548
|
+
const runs = (word = "") => RUNS.test(path47.basename(word).toLowerCase());
|
|
29286
29549
|
let at = 0;
|
|
29287
29550
|
while (at < words.length && (LEADS.test(words[at]) || /^-\w$/.test(words[at - 1] ?? "") && !runs(words[at])))
|
|
29288
29551
|
at++;
|
|
29289
|
-
const name =
|
|
29552
|
+
const name = path47.basename(words[at] ?? "").toLowerCase();
|
|
29290
29553
|
const args = words.slice(at + 1);
|
|
29291
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`;
|
|
29292
29555
|
if (/^(?:cd|chdir|pushd|popd)$/.test(name))
|
|
@@ -29365,8 +29628,8 @@ var judgeDeny = (input, what, target) => {
|
|
|
29365
29628
|
const role = input.session.agentType?.endsWith("reviewer") ? "reviewer" : "verifier";
|
|
29366
29629
|
const root = checkoutOf2(input.cwd)?.root;
|
|
29367
29630
|
const candidate = target ? checkoutOf2(target)?.root : undefined;
|
|
29368
|
-
const also = root && candidate && candidate !== root && commonDir(candidate) === commonDir(root) ? ` or ${
|
|
29369
|
-
const scratch = root ? `${
|
|
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`;
|
|
29370
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.`;
|
|
29371
29634
|
return {
|
|
29372
29635
|
kind: "deny",
|
|
@@ -29381,12 +29644,12 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
|
|
|
29381
29644
|
const judged = checkoutOf2(input.cwd);
|
|
29382
29645
|
const repo = judged ? commonDir(judged.root) : null;
|
|
29383
29646
|
for (const target of targets) {
|
|
29384
|
-
const resolved =
|
|
29647
|
+
const resolved = path47.resolve(target);
|
|
29385
29648
|
if (within(resolved, UNKNOWN_VAR) || within(resolved, UNKNOWN_DIR))
|
|
29386
29649
|
return judgeDeny(input, "it writes to a path Workit cannot resolve (a variable, a command substitution or `cd -`): spell the path out");
|
|
29387
29650
|
const real = canonical5(target);
|
|
29388
|
-
const runsGit = placeholders.has(target) && /^\.workit-(?:runs-git|live-target)$/.test(
|
|
29389
|
-
const gitDirs = runsGit ? gitDirsAt(
|
|
29651
|
+
const runsGit = placeholders.has(target) && /^\.workit-(?:runs-git|live-target)$/.test(path47.basename(target));
|
|
29652
|
+
const gitDirs = runsGit ? gitDirsAt(path47.dirname(real), repo) : [];
|
|
29390
29653
|
if (gitDirs === null)
|
|
29391
29654
|
return judgeDeny(input, `git in ${shown(target)} uses a git dir or config Workit cannot check`);
|
|
29392
29655
|
if (runsGit ? gitDirs.length > 0 ? gitDirs.every((dir) => inScratch(dir, repo)) : inScratch(real, repo) : inScratch(real, repo) && !inGitDir(real))
|
|
@@ -29427,7 +29690,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
|
|
|
29427
29690
|
let git = [];
|
|
29428
29691
|
try {
|
|
29429
29692
|
git = rawInvocations(command, dialect).flatMap(({ tool, dir, args }) => tool === "git" && (args[0] === "push" || leadOwnedGit(args) || gitKind(args) === "write" && !/^(?:init|clone)$/.test(args[0])) ? [
|
|
29430
|
-
|
|
29693
|
+
path47.join(dir === undefined ? UNKNOWN_DIR : path47.resolve(input.cwd, dir ?? "."), `${OPAQUE_TARGET}git`)
|
|
29431
29694
|
] : []);
|
|
29432
29695
|
} catch {}
|
|
29433
29696
|
const lists = [
|
|
@@ -29472,7 +29735,7 @@ var judgeChecksLine = (cwd) => {
|
|
|
29472
29735
|
|
|
29473
29736
|
// packages/workit-core/src/hooks/standing.ts
|
|
29474
29737
|
var readPlans = (store) => {
|
|
29475
|
-
const dir =
|
|
29738
|
+
const dir = path48.join(store, "fanouts");
|
|
29476
29739
|
let names;
|
|
29477
29740
|
try {
|
|
29478
29741
|
names = fs30.readdirSync(dir).filter((name) => name.endsWith(".json"));
|
|
@@ -29482,7 +29745,7 @@ var readPlans = (store) => {
|
|
|
29482
29745
|
const plans = [];
|
|
29483
29746
|
for (const name of names) {
|
|
29484
29747
|
try {
|
|
29485
|
-
const raw = JSON.parse(fs30.readFileSync(
|
|
29748
|
+
const raw = JSON.parse(fs30.readFileSync(path48.join(dir, name), "utf8"));
|
|
29486
29749
|
if (typeof raw.name !== "string" || !Array.isArray(raw.slices))
|
|
29487
29750
|
continue;
|
|
29488
29751
|
const texts = (value) => Array.isArray(value) ? value.filter((item) => typeof item === "string" && item !== "") : [];
|
|
@@ -29693,7 +29956,7 @@ var cdWorkitSplit = (command) => {
|
|
|
29693
29956
|
// packages/workit-core/src/hooks/model-limit.ts
|
|
29694
29957
|
import { closeSync as closeSync3, openSync as openSync3, readdirSync as readdirSync7, readSync, statSync as statSync5 } from "node:fs";
|
|
29695
29958
|
import os10 from "node:os";
|
|
29696
|
-
import
|
|
29959
|
+
import path49 from "node:path";
|
|
29697
29960
|
var MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
|
|
29698
29961
|
var WEEKDAYS = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];
|
|
29699
29962
|
var TIME_WORD = String.raw`(?:\d|(?:in|at|on|later|tomorrow|soon)\b|(?:${[...WEEKDAYS, ...MONTHS].join("|")})[a-z]*\b)`;
|
|
@@ -29891,17 +30154,17 @@ var firstPrompt = (file) => {
|
|
|
29891
30154
|
var claudeProjectSlug = (cwd) => cwd.replace(/[^A-Za-z0-9]/gu, "-");
|
|
29892
30155
|
var listDir = (dir) => {
|
|
29893
30156
|
try {
|
|
29894
|
-
return readdirSync7(dir).map((name) =>
|
|
30157
|
+
return readdirSync7(dir).map((name) => path49.join(dir, name));
|
|
29895
30158
|
} catch {
|
|
29896
30159
|
return [];
|
|
29897
30160
|
}
|
|
29898
30161
|
};
|
|
29899
30162
|
var SCAN_MS = 30 * 60000;
|
|
29900
30163
|
var scanClaudeTranscripts = (cwd, env, now = new Date) => {
|
|
29901
|
-
const projects =
|
|
29902
|
-
const project =
|
|
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));
|
|
29903
30166
|
const notes = [];
|
|
29904
|
-
const files = listDir(project).flatMap((entry) => entry.endsWith(".jsonl") ? [{ file: entry, worker: false }] : listDir(
|
|
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 })));
|
|
29905
30168
|
for (const { file, worker } of files)
|
|
29906
30169
|
try {
|
|
29907
30170
|
const stat = statSync5(file);
|
|
@@ -29916,7 +30179,7 @@ var scanClaudeTranscripts = (cwd, env, now = new Date) => {
|
|
|
29916
30179
|
if (!seen)
|
|
29917
30180
|
continue;
|
|
29918
30181
|
notes.push(worker ? redispatchNote(seen, {
|
|
29919
|
-
label: `worker ${
|
|
30182
|
+
label: `worker ${path49.basename(file, ".jsonl")}`,
|
|
29920
30183
|
prompt: firstPrompt(file)
|
|
29921
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.`);
|
|
29922
30185
|
} catch {}
|
|
@@ -30049,7 +30312,7 @@ var namesYtrack = (text) => {
|
|
|
30049
30312
|
|
|
30050
30313
|
// packages/workit-core/src/hooks/ytrack-guard.ts
|
|
30051
30314
|
var name2 = (word = "") => (word.split(/[\\/]/).at(-1) ?? "").toLowerCase().replace(/\.(?:exe|cmd)$|@.*$/g, "");
|
|
30052
|
-
var
|
|
30315
|
+
var quote3 = (word) => /^[\w@%+=:,./-]+$/.test(word) ? word : `'${word.replaceAll("'", `'\\''`)}'`;
|
|
30053
30316
|
var minutesOf = (text = "") => {
|
|
30054
30317
|
if (/^\d+$/.test(text.trim()))
|
|
30055
30318
|
return Number(text) > 0 ? Number(text) : null;
|
|
@@ -30141,7 +30404,7 @@ var combine = (effects) => {
|
|
|
30141
30404
|
delete out.attach;
|
|
30142
30405
|
return out;
|
|
30143
30406
|
};
|
|
30144
|
-
var pair = (flag, value) => value.startsWith("-") ? `${flag}=${
|
|
30407
|
+
var pair = (flag, value) => value.startsWith("-") ? `${flag}=${quote3(value)}` : `${flag} ${quote3(value)}`;
|
|
30145
30408
|
var mapWrite = (verb, args) => {
|
|
30146
30409
|
const values = {};
|
|
30147
30410
|
const attach = [];
|
|
@@ -30340,12 +30603,18 @@ var SHELLS3 = /^(?:sh|bash|zsh|dash|ksh|ash|mksh|yash|fish)$/;
|
|
|
30340
30603
|
var MAX_DEPTH2 = 4;
|
|
30341
30604
|
var READ = new Map;
|
|
30342
30605
|
var NOT_PLAIN = gap("a ytrack call that is not a plain command of its own (a wrapper, loop, substitution or script around it can change or repeat it)");
|
|
30343
|
-
var
|
|
30606
|
+
var timeOnly = (effect) => effect?.minutes !== undefined && Object.keys(effect).every((key) => /^(?:issue|minutes|text|date)$/u.test(key));
|
|
30607
|
+
var ungrant = (write) => write.workit ? {
|
|
30608
|
+
command: write.command,
|
|
30609
|
+
...NOT_PLAIN,
|
|
30610
|
+
...timeOnly(write.effect) ? { hint: write.workit } : {}
|
|
30611
|
+
} : write;
|
|
30612
|
+
var hinted = (write) => write.hint ? { command: write.command, workit: write.hint } : write;
|
|
30344
30613
|
var ytrackArgs = (line, found, depth, names, plain) => {
|
|
30345
30614
|
const inner = (script) => void found.push(...ytrackWrites(script, "posix", depth + 1, plain));
|
|
30346
30615
|
const tail = workitCheckTail(line);
|
|
30347
30616
|
if (tail) {
|
|
30348
|
-
inner("script" in tail ? tail.script : tail.argv.map(
|
|
30617
|
+
inner("script" in tail ? tail.script : tail.argv.map(quote3).join(" "));
|
|
30349
30618
|
return true;
|
|
30350
30619
|
}
|
|
30351
30620
|
const flag = SHELLS3.test(name2(line[0])) ? line.findIndex((word, index) => index > 0 && /^-[a-zA-Z]*c[a-zA-Z]*$/.test(word)) : -1;
|
|
@@ -30375,7 +30644,7 @@ var ytrackArgs = (line, found, depth, names, plain) => {
|
|
|
30375
30644
|
const argv = [...alias ?? [], ...line.slice(at + 1)];
|
|
30376
30645
|
const write = classify2(argv);
|
|
30377
30646
|
if (write) {
|
|
30378
|
-
const one = { command: ["ytrack", ...argv].map(
|
|
30647
|
+
const one = { command: ["ytrack", ...argv].map(quote3).join(" "), ...write };
|
|
30379
30648
|
found.push(plain ? one : ungrant(one));
|
|
30380
30649
|
}
|
|
30381
30650
|
return true;
|
|
@@ -30474,6 +30743,7 @@ var ytrackWrites = (command, dialect = "posix", depth = 0, plain = true) => {
|
|
|
30474
30743
|
found = [];
|
|
30475
30744
|
for (const line of commandLines(command, dialect))
|
|
30476
30745
|
ytrackArgs(line, found, depth, aliases(command), false);
|
|
30746
|
+
found = found.map(hinted);
|
|
30477
30747
|
}
|
|
30478
30748
|
READ.set(key, found);
|
|
30479
30749
|
if (READ.size > 64)
|
|
@@ -30481,6 +30751,8 @@ var ytrackWrites = (command, dialect = "posix", depth = 0, plain = true) => {
|
|
|
30481
30751
|
return found;
|
|
30482
30752
|
};
|
|
30483
30753
|
var ytrackGate = (cwd, command, dialect, ask) => {
|
|
30754
|
+
if (namesTicket(command))
|
|
30755
|
+
return { kind: "deny", reason: TICKET_DENY, unblock: null };
|
|
30484
30756
|
let writes;
|
|
30485
30757
|
try {
|
|
30486
30758
|
const merged = new Map;
|
|
@@ -30508,8 +30780,8 @@ var ytrackGate = (cwd, command, dialect, ask) => {
|
|
|
30508
30780
|
reason: `${bare.join(", ")} writes to YouTrack: the user decides this call (#780).`
|
|
30509
30781
|
};
|
|
30510
30782
|
const why = `A raw ytrack write posts to YouTrack without the user's yes (#780).`;
|
|
30511
|
-
const run = calls.length ? ` Run ${calls.join(", then ")} instead
|
|
30512
|
-
const user = bare.length ? ` For ${bare.join(", ")}, the user decides: ask the user, and if they agree they run it in their own terminal.` : "";
|
|
30783
|
+
const run = calls.length ? ` Run ${calls.join(", then ")} instead, each as its own plain call: it asks the user first.` : "";
|
|
30784
|
+
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.` : "";
|
|
30513
30785
|
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." : "";
|
|
30514
30786
|
return {
|
|
30515
30787
|
kind: "deny",
|
|
@@ -30727,6 +30999,8 @@ function decide(input, deps) {
|
|
|
30727
30999
|
case "write.pre": {
|
|
30728
31000
|
if (!usable2(descriptor.events["write.pre"].support))
|
|
30729
31001
|
return NONE6;
|
|
31002
|
+
if (event.text && namesTicket(event.text))
|
|
31003
|
+
return { kind: "deny", reason: TICKET_DENY, unblock: null };
|
|
30730
31004
|
const role = agentRole(input, descriptor);
|
|
30731
31005
|
if (role) {
|
|
30732
31006
|
const targets = liveTargets(input.cwd, event.paths);
|
|
@@ -30805,12 +31079,12 @@ var modelKey = (model) => {
|
|
|
30805
31079
|
};
|
|
30806
31080
|
|
|
30807
31081
|
// packages/workit-core/src/hooks/budget-signal.ts
|
|
30808
|
-
import { createHash as
|
|
31082
|
+
import { createHash as createHash23 } from "node:crypto";
|
|
30809
31083
|
import fs31 from "node:fs";
|
|
30810
|
-
import
|
|
30811
|
-
var hash2 = (text) =>
|
|
30812
|
-
var budgetDir = (store) =>
|
|
30813
|
-
var agentBase = (store, session, 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 ?? ""}`));
|
|
30814
31088
|
var spawnBudget = (prompt) => {
|
|
30815
31089
|
const found = /^TIMEBOX:[^\n]*?\b(\d+)\s+tool calls\b/mu.exec(prompt);
|
|
30816
31090
|
const n = found ? Number(found[1]) : NaN;
|
|
@@ -30830,8 +31104,8 @@ var startBudget = (store, session, agentId, n) => {
|
|
|
30830
31104
|
const cutoff = Date.now() - 604800000;
|
|
30831
31105
|
for (const name of fs31.readdirSync(dir))
|
|
30832
31106
|
try {
|
|
30833
|
-
if (fs31.statSync(
|
|
30834
|
-
fs31.rmSync(
|
|
31107
|
+
if (fs31.statSync(path50.join(dir, name)).mtimeMs < cutoff)
|
|
31108
|
+
fs31.rmSync(path50.join(dir, name));
|
|
30835
31109
|
} catch {}
|
|
30836
31110
|
const base = agentBase(store, session, agentId);
|
|
30837
31111
|
fs31.writeFileSync(`${base}.json`, JSON.stringify({ limit: n, told: 0 }));
|
|
@@ -30970,11 +31244,11 @@ var unfinishedTaskOffer2 = (ctx) => {
|
|
|
30970
31244
|
};
|
|
30971
31245
|
|
|
30972
31246
|
// packages/workit-core/src/hooks/repeat-failure.ts
|
|
30973
|
-
import { createHash as
|
|
31247
|
+
import { createHash as createHash24 } from "node:crypto";
|
|
30974
31248
|
var SAME_CALL_FAILED = "Same call failed twice:";
|
|
30975
31249
|
var MAX_SESSIONS = 256;
|
|
30976
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";
|
|
30977
|
-
var hashOf = (call) =>
|
|
31251
|
+
var hashOf = (call) => createHash24("sha256").update(call).digest("hex").slice(0, 32);
|
|
30978
31252
|
var record2 = (memo, sessionId, call, failed, next) => {
|
|
30979
31253
|
const previous = memo.get(sessionId);
|
|
30980
31254
|
memo.delete(sessionId);
|
|
@@ -31167,6 +31441,33 @@ ${shown.join(`
|
|
|
31167
31441
|
};
|
|
31168
31442
|
}
|
|
31169
31443
|
};
|
|
31444
|
+
var askInline = async (call, command, event, ctx) => {
|
|
31445
|
+
try {
|
|
31446
|
+
const ask = inlineAskFor(call.words, inlineCallCwd(call, ctx.cwd));
|
|
31447
|
+
if (!ask)
|
|
31448
|
+
return;
|
|
31449
|
+
const choice = await ctx.ui.select(ask.text, [APPROVE, REJECT]);
|
|
31450
|
+
const nothing = ask.kind === "release-notes" ? "nothing was approved" : "nothing was posted";
|
|
31451
|
+
if (choice !== APPROVE)
|
|
31452
|
+
return {
|
|
31453
|
+
block: true,
|
|
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}.`
|
|
31455
|
+
};
|
|
31456
|
+
const { ticket } = recordInlineAsk({
|
|
31457
|
+
kind: ask.kind,
|
|
31458
|
+
argvHash: ask.argvHash,
|
|
31459
|
+
contentHash: ask.contentHash,
|
|
31460
|
+
host: "pi",
|
|
31461
|
+
session: ctx.sessionManager?.getSessionId() || null,
|
|
31462
|
+
agent: null,
|
|
31463
|
+
toolUseId: event.toolCallId ?? null
|
|
31464
|
+
});
|
|
31465
|
+
event.input.command = `${INLINE_TICKET_ENV}=${ticket} ${command}`;
|
|
31466
|
+
return;
|
|
31467
|
+
} catch (error) {
|
|
31468
|
+
return { block: true, reason: `Workit could not record the approval: ${String(error)}` };
|
|
31469
|
+
}
|
|
31470
|
+
};
|
|
31170
31471
|
var enforceToolPolicy = (event, ctx) => {
|
|
31171
31472
|
const gate = (hookEvent) => {
|
|
31172
31473
|
const decision = handleHook(hookInput(ctx, hookEvent), {
|
|
@@ -31184,6 +31485,17 @@ var enforceToolPolicy = (event, ctx) => {
|
|
|
31184
31485
|
return { block: true, reason: approveCallDeny(approve.fix) };
|
|
31185
31486
|
if (approve?.plain && ctx.mode === "tui" && ctx.hasUI)
|
|
31186
31487
|
return approveInDialog(approve.ids, event, ctx);
|
|
31488
|
+
const inline = typeof command === "string" ? inlineCallIn(command) : null;
|
|
31489
|
+
if (inline && !inline.plain)
|
|
31490
|
+
return { block: true, reason: inlineCallDeny(inline.fix) };
|
|
31491
|
+
if (inline?.plain && ctx.mode === "tui" && ctx.hasUI) {
|
|
31492
|
+
const gated = isReleaseNotesCall(inline.words) && inlineAskFor(inline.words, inlineCallCwd(inline, ctx.cwd)) ? undefined : gate({
|
|
31493
|
+
kind: "shell.pre",
|
|
31494
|
+
command,
|
|
31495
|
+
toolUseId: event.toolCallId ?? null
|
|
31496
|
+
});
|
|
31497
|
+
return gated ?? askInline(inline, command, event, ctx);
|
|
31498
|
+
}
|
|
31187
31499
|
return typeof command === "string" ? gate({
|
|
31188
31500
|
kind: "shell.pre",
|
|
31189
31501
|
command,
|
|
@@ -31205,7 +31517,8 @@ var enforceToolPolicy = (event, ctx) => {
|
|
|
31205
31517
|
kind: "write.pre",
|
|
31206
31518
|
tool: event.toolName,
|
|
31207
31519
|
paths: writePaths(event.input),
|
|
31208
|
-
toolUseId: null
|
|
31520
|
+
toolUseId: null,
|
|
31521
|
+
text: JSON.stringify(event.input ?? {})
|
|
31209
31522
|
});
|
|
31210
31523
|
};
|
|
31211
31524
|
var observeToolResult = (event, ctx) => {
|
|
@@ -31245,14 +31558,14 @@ var observeToolResult = (event, ctx) => {
|
|
|
31245
31558
|
var skillPromptNudge = (prompt, ctx) => process.env.WORKIT_PI_WORKER_SESSION ? null : promptNudge(hookInput(ctx, { kind: "context.turn", prompt }), prompt);
|
|
31246
31559
|
|
|
31247
31560
|
// packages/workit-pi/src/launches.ts
|
|
31248
|
-
import { mkdirSync as mkdirSync7, readFileSync as
|
|
31561
|
+
import { mkdirSync as mkdirSync7, readFileSync as readFileSync16, readdirSync as readdirSync8, rmSync as rmSync4, writeFileSync as writeFileSync6 } from "node:fs";
|
|
31249
31562
|
import os11 from "node:os";
|
|
31250
|
-
import
|
|
31563
|
+
import path51 from "node:path";
|
|
31251
31564
|
var launchDir = (root) => {
|
|
31252
31565
|
const location = resolveStore(root);
|
|
31253
|
-
return location instanceof Error ? null :
|
|
31566
|
+
return location instanceof Error ? null : path51.join(location.dir, "pi-launches");
|
|
31254
31567
|
};
|
|
31255
|
-
var fileFor = (dir, workerId) =>
|
|
31568
|
+
var fileFor = (dir, workerId) => path51.join(dir, `${workerId.replace(/[^A-Za-z0-9-]/g, "_")}.json`);
|
|
31256
31569
|
var recordLaunch = (root, attempt) => {
|
|
31257
31570
|
const dir = launchDir(root);
|
|
31258
31571
|
if (!dir)
|
|
@@ -31273,7 +31586,7 @@ var recordLaunch = (root, attempt) => {
|
|
|
31273
31586
|
var clearLaunch = (root, workerId) => {
|
|
31274
31587
|
const dir = launchDir(root);
|
|
31275
31588
|
if (dir)
|
|
31276
|
-
|
|
31589
|
+
rmSync4(fileFor(dir, workerId), { force: true });
|
|
31277
31590
|
};
|
|
31278
31591
|
var alive = (attempt) => {
|
|
31279
31592
|
if (attempt.host !== os11.hostname())
|
|
@@ -31298,7 +31611,7 @@ var abandonedLaunches = (root) => {
|
|
|
31298
31611
|
const found = [];
|
|
31299
31612
|
for (const name of names) {
|
|
31300
31613
|
try {
|
|
31301
|
-
const attempt = JSON.parse(
|
|
31614
|
+
const attempt = JSON.parse(readFileSync16(path51.join(dir, name), "utf8"));
|
|
31302
31615
|
if (typeof attempt.workerId === "string" && typeof attempt.session === "string") {
|
|
31303
31616
|
if (!alive(attempt))
|
|
31304
31617
|
found.push(attempt);
|
|
@@ -31310,18 +31623,18 @@ var abandonedLaunches = (root) => {
|
|
|
31310
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"}')`;
|
|
31311
31624
|
|
|
31312
31625
|
// packages/workit-core/src/core/cli-locate.ts
|
|
31313
|
-
import { closeSync as closeSync4, existsSync as
|
|
31314
|
-
import
|
|
31626
|
+
import { closeSync as closeSync4, existsSync as existsSync16, openSync as openSync4, readSync as readSync2 } from "node:fs";
|
|
31627
|
+
import path52 from "node:path";
|
|
31315
31628
|
var LAUNCHER_MARKER = "workit-owned-launcher";
|
|
31316
31629
|
var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
|
|
31317
31630
|
var installRoot = (env, platform = process.platform) => {
|
|
31318
31631
|
if (env.WORKIT_INSTALL_ROOT)
|
|
31319
31632
|
return env.WORKIT_INSTALL_ROOT;
|
|
31320
31633
|
const data = dataDir(env, platform);
|
|
31321
|
-
return platform === "win32" ?
|
|
31634
|
+
return platform === "win32" ? path52.join(data, "install") : data;
|
|
31322
31635
|
};
|
|
31323
|
-
var ownedLauncherPath = (env, platform = process.platform) =>
|
|
31324
|
-
var ownedCurrentEntry = (env, platform = process.platform) =>
|
|
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");
|
|
31325
31638
|
var head = (file) => {
|
|
31326
31639
|
let fd;
|
|
31327
31640
|
try {
|
|
@@ -31339,7 +31652,7 @@ var head = (file) => {
|
|
|
31339
31652
|
var locateWorkitCli = (options = {}) => {
|
|
31340
31653
|
const env = options.env ?? process.env;
|
|
31341
31654
|
const platform = options.platform ?? process.platform;
|
|
31342
|
-
const exists = options.exists ??
|
|
31655
|
+
const exists = options.exists ?? existsSync16;
|
|
31343
31656
|
const read = options.read ?? head;
|
|
31344
31657
|
const node = options.node ?? process.execPath;
|
|
31345
31658
|
const launcher = ownedLauncherPath(env, platform);
|
|
@@ -31348,7 +31661,7 @@ var locateWorkitCli = (options = {}) => {
|
|
|
31348
31661
|
source: "owned-launcher",
|
|
31349
31662
|
command: launcher,
|
|
31350
31663
|
args: [],
|
|
31351
|
-
binDir:
|
|
31664
|
+
binDir: path52.dirname(launcher)
|
|
31352
31665
|
};
|
|
31353
31666
|
const current = ownedCurrentEntry(env, platform);
|
|
31354
31667
|
if (exists(current))
|
|
@@ -31377,7 +31690,7 @@ var workitCliEnv = (located, env = process.env, platform = process.platform) =>
|
|
|
31377
31690
|
if (located.binDir) {
|
|
31378
31691
|
const key = pathKey(env);
|
|
31379
31692
|
const delimiter = platform === "win32" ? ";" : ":";
|
|
31380
|
-
const same = (dir) => platform === "win32" ?
|
|
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);
|
|
31381
31694
|
const rest = (env[key] ?? "").split(delimiter).filter((dir) => dir && !same(dir));
|
|
31382
31695
|
patch[key] = [located.binDir, ...rest].join(delimiter);
|
|
31383
31696
|
}
|
package/package.json
CHANGED
|
@@ -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
|
|
27
|
-
|
|
28
|
-
|
|
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.
|