@workit-dev/codex 2.10.0 → 2.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex-plugin/plugin.json +1 -1
- package/dist/launch-mcp.js +28 -73
- package/dist/{workit-hook-a6kefgqh.js → workit-hook-3e2eetcr.js} +219 -83
- package/dist/workit-hook-btkg30rw.js +44 -0
- package/dist/workit-hook-vmvv43m0.js +10 -0
- package/dist/workit-hook.js +5 -2
- package/package.json +3 -3
- package/skills/workit-verify-app/SKILL.md +8 -6
- package/skills/workit-verify-app/references/template.md +2 -1
package/dist/launch-mcp.js
CHANGED
|
@@ -30511,7 +30511,9 @@ var WORKIT_ALLOWED_VERBS = [
|
|
|
30511
30511
|
"verify-delivery",
|
|
30512
30512
|
"policy",
|
|
30513
30513
|
"doctor",
|
|
30514
|
-
"help"
|
|
30514
|
+
"help",
|
|
30515
|
+
"ps",
|
|
30516
|
+
"stop"
|
|
30515
30517
|
];
|
|
30516
30518
|
var WORKIT_USER_ONLY = [
|
|
30517
30519
|
["release", "notes", "approve"],
|
|
@@ -30649,6 +30651,31 @@ var NPM_INSTALL = new Set([
|
|
|
30649
30651
|
var NPM_RUN = new Set(["run", "run-script", "rum", "urn"]);
|
|
30650
30652
|
var NPM_TEST = new Set(["test", "t", "tst"]);
|
|
30651
30653
|
var EXEC = new Set(["exec", "x", "dlx"]);
|
|
30654
|
+
var NUXT = sub("dev", "preview", "start");
|
|
30655
|
+
var WEBPACK = sub("serve", "s", "server");
|
|
30656
|
+
var SERVER_TOOLS = {
|
|
30657
|
+
ng: sub("serve", "s"),
|
|
30658
|
+
next: sub("dev", "start"),
|
|
30659
|
+
nuxt: NUXT,
|
|
30660
|
+
nuxi: NUXT,
|
|
30661
|
+
astro: sub("dev", "preview"),
|
|
30662
|
+
"react-scripts": sub("start"),
|
|
30663
|
+
webpack: WEBPACK,
|
|
30664
|
+
"webpack-cli": WEBPACK,
|
|
30665
|
+
storybook: sub("dev", "start"),
|
|
30666
|
+
rails: sub("server", "s"),
|
|
30667
|
+
mix: sub("phx.server")
|
|
30668
|
+
};
|
|
30669
|
+
var COMPOSE_VALUES = new Set([
|
|
30670
|
+
"-f",
|
|
30671
|
+
"--file",
|
|
30672
|
+
"-p",
|
|
30673
|
+
"-H",
|
|
30674
|
+
"--host",
|
|
30675
|
+
"--context",
|
|
30676
|
+
"-c",
|
|
30677
|
+
"--config"
|
|
30678
|
+
]);
|
|
30652
30679
|
|
|
30653
30680
|
// packages/workit-core/src/core/heavy-words.ts
|
|
30654
30681
|
var HEAVY_WORDS = new Set(("npm npx pnpm pnpx yarn bun bunx deno corepack make gmake docker podman nerdctl " + "python python3 py uv poetry pdm pipenv hatch rye bundle rake nx " + "jest vitest mocha ava tap karma jasmine nyc c8 tsc vue-tsc svelte-check eslint stylelint " + "tslint webpack webpack-cli rollup parcel tsup vite next nuxt nuxi astro ng react-scripts " + "playwright cypress wdio testcafe turbo lerna sonar-scanner sonarless sonarless-mcp go " + "golangci-lint gotestsum staticcheck cargo mvn mvnw gradle gradlew ant sbt bazel bazelisk " + "buck2 dotnet msbuild pytest py.test tox nox mypy pyright pylint coverage maturin pip pip3 " + "rspec rails phpunit pest phpstan psalm composer mix swift xcodebuild flutter dart pod cmake " + "ninja meson ctest scons docker-compose buildah earthly").split(" "));
|
|
@@ -31517,78 +31544,6 @@ var MUTATING_REMOTE = new Set([
|
|
|
31517
31544
|
"set-branches",
|
|
31518
31545
|
"prune"
|
|
31519
31546
|
]);
|
|
31520
|
-
var GIT_VERBS = {
|
|
31521
|
-
log: "@d@l|@d @l",
|
|
31522
|
-
show: "@d@l|@d @l",
|
|
31523
|
-
diff: "@d|@d cached staged merge-base no-index",
|
|
31524
|
-
"diff-tree": "@drtcm|@d root stdin no-commit-id",
|
|
31525
|
-
"diff-index": "@dm|@d cached merge-base",
|
|
31526
|
-
status: "sbu?zv|short branch porcelain? long untracked-files? ignored? ignore-submodules? show-stash ahead-behind no-ahead-behind renames no-renames find-renames? column? no-column null verbose",
|
|
31527
|
-
"rev-parse": "q|verify short? abbrev-ref? symbolic symbolic-full-name show-toplevel show-prefix git-dir git-common-dir absolute-git-dir is-inside-work-tree is-inside-git-dir is-bare-repository show-cdup quiet all branches? tags? remotes? since= until= default= path-format= sq-quote",
|
|
31528
|
-
"rev-list": "@l|@l count objects? left-only right-only",
|
|
31529
|
-
"ls-files": "cdmoiskuvtzfx:X:|cached deleted modified others ignored stage unmerged killed directory no-empty-directory exclude-standard exclude= exclude-from= full-name abbrev? error-unmatch with-tree= eol deduplicate format= recurse-submodules sparse",
|
|
31530
|
-
"ls-tree": "rdtlz|long name-only name-status object-only full-name full-tree abbrev? format=",
|
|
31531
|
-
"cat-file": "tsepz|batch? batch-check? batch-all-objects follow-symlinks unordered buffer allow-unknown-type mailmap use-mailmap",
|
|
31532
|
-
blame: "L:lstfnepwbcM?C?|porcelain line-porcelain incremental root show-stats show-name show-number show-email abbrev= reverse= first-parent date= ignore-rev= ignore-revs-file= minimal contents=",
|
|
31533
|
-
describe: "|tags all long abbrev= contains always dirty? broken? match= exclude= first-parent exact-match candidates= debug",
|
|
31534
|
-
"merge-base": "a|all octopus independent is-ancestor fork-point",
|
|
31535
|
-
"for-each-ref": "|count= sort= format= color? shell perl python tcl points-at= merged? no-merged? contains? no-contains? ignore-case omit-empty exclude=",
|
|
31536
|
-
shortlog: "@lsnec|@l summary numbered email committer group= format=",
|
|
31537
|
-
"show-ref": "dsq|head verify heads tags branches hash? abbrev? quiet dereference exists",
|
|
31538
|
-
"name-rev": "|tags refs= exclude= all annotate-stdin name-only no-undefined always",
|
|
31539
|
-
grep: "aiIvnhHcEGFPlLzoWqwe:A:B:C:m:f:|cached untracked no-index no-exclude-standard exclude-standard recurse-submodules text ignore-case word-regexp invert-match line-number column count full-name extended-regexp basic-regexp fixed-strings perl-regexp files-with-matches name-only files-without-match null only-matching heading break show-function function-context max-depth= threads= and or not all-match quiet after-context= before-context= context= max-count= color? no-color",
|
|
31540
|
-
"format-patch": "@do:nNks|@d stdout output-directory= numbered no-numbered start-number= subject-prefix= root cover-letter thread? signoff attach? inline? suffix= base=",
|
|
31541
|
-
reflog: "@l|@l all expire= expire-unreachable= rewrite updateref stale-fix dry-run verbose",
|
|
31542
|
-
"count-objects": "vH|verbose human-readable",
|
|
31543
|
-
"check-ignore": "qvnz|quiet verbose stdin non-matching no-index",
|
|
31544
|
-
var: "l|",
|
|
31545
|
-
version: "|build-options",
|
|
31546
|
-
"ls-remote": "htbq|heads tags branches refs quiet exit-code get-url symref sort=",
|
|
31547
|
-
remote: "v|verbose",
|
|
31548
|
-
config: "lz|get get-all get-regexp list local name-only null type= default=",
|
|
31549
|
-
worktree: "fdqvzb:B:|force detach lock reason= orphan no-checkout checkout quiet track no-track guess-remote porcelain expire= verbose",
|
|
31550
|
-
branch: "dDmMcCfvraliu:|delete move copy force list all remotes verbose contains? merged? no-merged? points-at= show-current set-upstream-to= unset-upstream track? no-track sort= format= color? column? ignore-case create-reflog",
|
|
31551
|
-
tag: "lam:dfF:n?|list annotate message= file= delete force sort= format= contains? merged? no-merged? points-at= column? create-reflog ignore-case",
|
|
31552
|
-
init: "+qb:|quiet bare initial-branch= object-format= ref-format= shared? separate-git-dir=",
|
|
31553
|
-
add: "+AunNvf|all update intent-to-add force dry-run verbose ignore-errors ignore-removal no-all renormalize chmod= sparse",
|
|
31554
|
-
commit: "+m:aqsnF:C:ouv|message= all amend no-edit allow-empty allow-empty-message author= date= signoff no-verify quiet file= reuse-message= fixup= squash= only include dry-run no-gpg-sign untracked-files? cleanup= reset-author verbose",
|
|
31555
|
-
checkout: "+b:B:fqm|detach force orphan= quiet track? no-track merge ours theirs",
|
|
31556
|
-
switch: "+c:C:dfqm|create= force-create= detach discard-changes force orphan= quiet track? no-track merge",
|
|
31557
|
-
restore: "+s:SWq|source= staged worktree ours theirs merge quiet overlay no-overlay",
|
|
31558
|
-
reset: "+qN|soft mixed hard merge keep quiet no-refresh",
|
|
31559
|
-
rm: "+rfnq|cached force dry-run quiet ignore-unmatch",
|
|
31560
|
-
mv: "+fnkv|force dry-run verbose",
|
|
31561
|
-
merge: "+m:qvnX:|no-ff ff ff-only squash no-squash commit no-commit message= no-edit abort continue quit allow-unrelated-histories stat no-stat quiet verbose no-verify signoff strategy-option=",
|
|
31562
|
-
stash: "+m:ukqa|message= include-untracked keep-index quiet all index staged",
|
|
31563
|
-
apply: "+p:C:R3qv|check stat numstat summary index cached 3way reverse reject allow-empty exclude= include= verbose quiet whitespace= recount",
|
|
31564
|
-
am: "+skq3|signoff keep 3way quiet abort continue skip quit whitespace= reject",
|
|
31565
|
-
fetch: "+fqvptn|all depth= deepen= shallow-since= unshallow tags no-tags prune force quiet verbose dry-run update-shallow refmap=",
|
|
31566
|
-
clone: "+nqlsb:o:|bare no-checkout depth= branch= origin= single-branch no-single-branch no-tags quiet shared local no-local filter= separate-git-dir=",
|
|
31567
|
-
"cherry-pick": "+nm:sxX:|no-commit mainline= signoff abort continue skip quit allow-empty keep-redundant-commits ff strategy-option=",
|
|
31568
|
-
revert: "+nm:sX:|no-commit mainline= signoff abort continue skip quit strategy-option= no-edit",
|
|
31569
|
-
rebase: "+qvfnX:|onto= root abort continue skip quit keep-base no-ff force-rebase autosquash no-autosquash autostash no-autostash update-refs signoff quiet verbose stat no-stat committer-date-is-author-date reset-author-date rebase-merges? no-rebase-merges empty= strategy-option= apply merge",
|
|
31570
|
-
clean: "+dfnqxXe:|dry-run force quiet exclude=",
|
|
31571
|
-
bisect: "+|term-old= term-new= no-checkout first-parent"
|
|
31572
|
-
};
|
|
31573
|
-
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`;
|
|
31574
|
-
var JUDGE_VERBS = {
|
|
31575
|
-
check: true,
|
|
31576
|
-
dir: true,
|
|
31577
|
-
help: true,
|
|
31578
|
-
"test-audit": true,
|
|
31579
|
-
ledger: ["verdict", "list", "check", "ruling", "show"],
|
|
31580
|
-
finding: ["record", "list"],
|
|
31581
|
-
pr: ["status"],
|
|
31582
|
-
ci: ["wait", "logs"],
|
|
31583
|
-
fanout: ["status", "brief"],
|
|
31584
|
-
models: ["show"],
|
|
31585
|
-
lock: ["status"],
|
|
31586
|
-
lease: ["status"],
|
|
31587
|
-
grant: ["show"],
|
|
31588
|
-
task: ["show", "list"],
|
|
31589
|
-
doctor: ["--json"]
|
|
31590
|
-
};
|
|
31591
|
-
var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
|
|
31592
31547
|
|
|
31593
31548
|
// packages/workit-core/src/hooks/standing.ts
|
|
31594
31549
|
var DESCRIPTORS = {
|
|
@@ -24,6 +24,9 @@ import {
|
|
|
24
24
|
readStandingSeen2,
|
|
25
25
|
writeStandingSeen2
|
|
26
26
|
} from "./workit-hook-jy7y0gdx.js";
|
|
27
|
+
import {
|
|
28
|
+
takeProcNotice2
|
|
29
|
+
} from "./workit-hook-btkg30rw.js";
|
|
27
30
|
import {
|
|
28
31
|
recordHookRun2
|
|
29
32
|
} from "./workit-hook-w7w0fe4v.js";
|
|
@@ -17234,7 +17237,7 @@ function workitCheckTail(words) {
|
|
|
17234
17237
|
} else if (!/^workit(?:\.exe|\.cmd)?$/.test(commandName(words[0])))
|
|
17235
17238
|
return null;
|
|
17236
17239
|
const { rest: args, cwd } = skipWorkitGlobals(words.slice(at + 1));
|
|
17237
|
-
if (args[0] !== "check" && !(args[0] === "lock" && args[1] === "run"))
|
|
17240
|
+
if (args[0] !== "check" && args[0] !== "run" && !(args[0] === "lock" && args[1] === "run"))
|
|
17238
17241
|
return null;
|
|
17239
17242
|
const split = args.indexOf("--");
|
|
17240
17243
|
const tail = split < 0 ? [] : args.slice(split + 1);
|
|
@@ -18616,7 +18619,9 @@ var WORKIT_ALLOWED_VERBS = [
|
|
|
18616
18619
|
"verify-delivery",
|
|
18617
18620
|
"policy",
|
|
18618
18621
|
"doctor",
|
|
18619
|
-
"help"
|
|
18622
|
+
"help",
|
|
18623
|
+
"ps",
|
|
18624
|
+
"stop"
|
|
18620
18625
|
];
|
|
18621
18626
|
var WORKIT_BYPASS_FLAGS = ["--unverified", "--overwrite-unintegrated"];
|
|
18622
18627
|
var WORKIT_USER_ONLY = [
|
|
@@ -19290,6 +19295,95 @@ function builtIn(words, depth = 0) {
|
|
|
19290
19295
|
const command = words.slice(1).find((word) => !word.startsWith("-") && !word.startsWith("+") || rule.has(word));
|
|
19291
19296
|
return command !== undefined && rule.has(command) ? label() : null;
|
|
19292
19297
|
}
|
|
19298
|
+
var SERVER_SCRIPT = /(?:^|[:_.-])(?:dev|serve|start|storybook)(?:$|[:_.-])/iu;
|
|
19299
|
+
var serverScript = (script = "") => SERVER_SCRIPT.test(script) && !HEAVY_SCRIPT.test(script);
|
|
19300
|
+
var NUXT = sub("dev", "preview", "start");
|
|
19301
|
+
var WEBPACK = sub("serve", "s", "server");
|
|
19302
|
+
var SERVER_TOOLS = {
|
|
19303
|
+
ng: sub("serve", "s"),
|
|
19304
|
+
next: sub("dev", "start"),
|
|
19305
|
+
nuxt: NUXT,
|
|
19306
|
+
nuxi: NUXT,
|
|
19307
|
+
astro: sub("dev", "preview"),
|
|
19308
|
+
"react-scripts": sub("start"),
|
|
19309
|
+
webpack: WEBPACK,
|
|
19310
|
+
"webpack-cli": WEBPACK,
|
|
19311
|
+
storybook: sub("dev", "start"),
|
|
19312
|
+
rails: sub("server", "s"),
|
|
19313
|
+
mix: sub("phx.server")
|
|
19314
|
+
};
|
|
19315
|
+
var COMPOSE_VALUES = new Set([
|
|
19316
|
+
"-f",
|
|
19317
|
+
"--file",
|
|
19318
|
+
"-p",
|
|
19319
|
+
"-H",
|
|
19320
|
+
"--host",
|
|
19321
|
+
"--context",
|
|
19322
|
+
"-c",
|
|
19323
|
+
"--config"
|
|
19324
|
+
]);
|
|
19325
|
+
function serverBuiltIn(words, depth = 0) {
|
|
19326
|
+
const name = baseName2(words[0]);
|
|
19327
|
+
if (depth > 6 || WORKIT.test(name) || words.some((word) => /^(?:-h|--help|--version)$/u.test(word)))
|
|
19328
|
+
return null;
|
|
19329
|
+
const compose = /^(?:docker|podman|nerdctl|docker-compose)$/u.test(name);
|
|
19330
|
+
const at = positional2(words, 1, compose ? COMPOSE_VALUES : PM_VALUES);
|
|
19331
|
+
const command = words[at];
|
|
19332
|
+
const yes = words.slice(0, 3).join(" ");
|
|
19333
|
+
const inner = (from) => serverBuiltIn(words.slice(from), depth + 1);
|
|
19334
|
+
const up = (from) => words[from] === "up" && !words.some((word) => /^(?:-d|--detach|--wait)$/u.test(word));
|
|
19335
|
+
if (name === "npx" || name === "bunx" || name === "pnpx")
|
|
19336
|
+
return inner(at);
|
|
19337
|
+
if (name === "corepack")
|
|
19338
|
+
return inner(1);
|
|
19339
|
+
if (command === undefined)
|
|
19340
|
+
return name === "vite" ? yes : null;
|
|
19341
|
+
if (name === "npm" || name === "pnpm" || name === "yarn" || name === "bun" || name === "deno") {
|
|
19342
|
+
if (EXEC.has(command))
|
|
19343
|
+
return inner(positional2(words, at + 1));
|
|
19344
|
+
if (command === "start")
|
|
19345
|
+
return yes;
|
|
19346
|
+
if (name === "yarn" && command === "workspace")
|
|
19347
|
+
return serverScript(words[at + 2]) ? yes : inner(at + 2);
|
|
19348
|
+
if (NPM_RUN.has(command) || name === "deno" && command === "task") {
|
|
19349
|
+
if (serverScript(words[positional2(words, at + 1)]))
|
|
19350
|
+
return yes;
|
|
19351
|
+
return name === "bun" && command !== "task" ? inner(positional2(words, at + 1)) : null;
|
|
19352
|
+
}
|
|
19353
|
+
if (name === "npm" || name === "deno")
|
|
19354
|
+
return null;
|
|
19355
|
+
return serverScript(command) ? yes : inner(at);
|
|
19356
|
+
}
|
|
19357
|
+
if (PYTHONS.test(name)) {
|
|
19358
|
+
const m = words.indexOf("-m");
|
|
19359
|
+
if (words[m + 1] === "http.server" || command.endsWith("manage.py")) {
|
|
19360
|
+
return m > 0 || words[at + 1] === "runserver" ? yes : null;
|
|
19361
|
+
}
|
|
19362
|
+
return m > 0 && words[m + 1] ? inner(m + 1) : null;
|
|
19363
|
+
}
|
|
19364
|
+
if (["uv", "poetry", "pdm", "pipenv", "hatch", "rye", "bundle"].includes(name))
|
|
19365
|
+
return command === "run" || command === "exec" ? inner(positional2(words, at + 1)) : null;
|
|
19366
|
+
if (name === "make" || name === "gmake")
|
|
19367
|
+
return words.slice(1).some((word) => !/^-|=/u.test(word) && serverScript(word)) ? yes : null;
|
|
19368
|
+
if (name === "nx")
|
|
19369
|
+
return serverScript(command === "run" ? words[at + 1]?.split(":")[1] : command) ? yes : null;
|
|
19370
|
+
if (name === "docker-compose")
|
|
19371
|
+
return up(at) ? yes : null;
|
|
19372
|
+
if (compose)
|
|
19373
|
+
return command === "compose" && up(positional2(words, at + 1, COMPOSE_VALUES)) ? yes : null;
|
|
19374
|
+
if (name === "vite")
|
|
19375
|
+
return command === "build" || command === "optimize" ? null : yes;
|
|
19376
|
+
const rule = SERVER_TOOLS[name];
|
|
19377
|
+
return rule && rule !== "any" && rule.has(command) ? yes : null;
|
|
19378
|
+
}
|
|
19379
|
+
function serverCommand(command, dialect = "posix") {
|
|
19380
|
+
for (const line of linesOf(command, dialect) ?? []) {
|
|
19381
|
+
const reason = serverBuiltIn(line);
|
|
19382
|
+
if (reason)
|
|
19383
|
+
return { line, reason };
|
|
19384
|
+
}
|
|
19385
|
+
return null;
|
|
19386
|
+
}
|
|
19293
19387
|
var globWord = (word) => new RegExp(`^${word.replace(/[.+?^${}()|[\]\\]/gu, "\\$&").replaceAll("*", ".*")}$`, "u");
|
|
19294
19388
|
function parsePattern(pattern) {
|
|
19295
19389
|
const words = pattern.trim().split(/\s+/u).filter(Boolean);
|
|
@@ -19386,6 +19480,28 @@ function heavyPlan(command, options) {
|
|
|
19386
19480
|
unblock: parts[0] ?? null
|
|
19387
19481
|
};
|
|
19388
19482
|
}
|
|
19483
|
+
function serverPlan(command, options) {
|
|
19484
|
+
const dialect = options.dialect ?? "posix";
|
|
19485
|
+
if (dialect !== "posix" || !gitTop(options.cwd))
|
|
19486
|
+
return { kind: "none" };
|
|
19487
|
+
const found = serverCommand(command, dialect);
|
|
19488
|
+
if (!found)
|
|
19489
|
+
return { kind: "none" };
|
|
19490
|
+
const simple = simpleCommand(command, dialect, 0, true);
|
|
19491
|
+
const single = simple && serverBuiltIn(simple);
|
|
19492
|
+
if (options.rules !== null && !wrapAllowed(options.rules, single ? (linesOf(command, dialect) ?? []).flat() : found.line, single ? command : found.line.join(" "), options).ok)
|
|
19493
|
+
return { kind: "passthrough", note: "" };
|
|
19494
|
+
if (single) {
|
|
19495
|
+
const rewrite = leaseRewrite(command)?.replace("workit check --heavy --", "workit run --bg --");
|
|
19496
|
+
return rewrite ? { kind: "rewrite", command: rewrite, reason: single, server: true } : { kind: "none" };
|
|
19497
|
+
}
|
|
19498
|
+
const start = `workit run --bg -- ${found.line.map(quoteWord).join(" ")}`;
|
|
19499
|
+
return {
|
|
19500
|
+
kind: "split",
|
|
19501
|
+
reason: `dev_server: \`${command.trim()}\` chains a dev server (${found.reason}) with other commands. Start it alone, now: \`${start}\`; then run the other parts as their own commands.`,
|
|
19502
|
+
unblock: start
|
|
19503
|
+
};
|
|
19504
|
+
}
|
|
19389
19505
|
function workitOnPath(env = process.env) {
|
|
19390
19506
|
const names = process.platform === "win32" ? ["workit.exe", "workit.cmd", "workit"] : ["workit"];
|
|
19391
19507
|
for (const dir of (env.PATH ?? "").split(path27.delimiter))
|
|
@@ -19434,21 +19550,26 @@ function heavyGate(cwd, command, options) {
|
|
|
19434
19550
|
const single = dialect === "posix" ? simpleCommand(command, dialect, 0, true) : null;
|
|
19435
19551
|
if (single && lightCommand(single, cwd))
|
|
19436
19552
|
return { kind: "none" };
|
|
19437
|
-
|
|
19553
|
+
const plan = {
|
|
19438
19554
|
cwd,
|
|
19439
19555
|
env,
|
|
19440
19556
|
dialect,
|
|
19441
19557
|
rules: rulesFor(options.host, cwd, env),
|
|
19442
19558
|
bypass: options.permissionMode === "bypassPermissions"
|
|
19443
|
-
}
|
|
19559
|
+
};
|
|
19560
|
+
const server = serverPlan(command, plan);
|
|
19561
|
+
if (server.kind === "rewrite")
|
|
19562
|
+
return server;
|
|
19563
|
+
const heavy = heavyPlan(command, plan);
|
|
19564
|
+
return heavy.kind === "none" ? server : heavy;
|
|
19444
19565
|
} catch {
|
|
19445
19566
|
return { kind: "none" };
|
|
19446
19567
|
}
|
|
19447
19568
|
}
|
|
19448
|
-
var rewriteNote = (plan) => `workit: this heavy command (${plan.reason}) runs under the machine-wide heavy-check lease as \`${plan.command}\`: it waits while another heavy check holds the lease (\`workit lock status\` shows who). Run heavy commands that way yourself; \`workit help lock\` explains the lease.`;
|
|
19569
|
+
var rewriteNote = (plan) => plan.server ? `workit: this dev server (${plan.reason}) runs in the background as \`${plan.command}\`, owned by this session; \`workit stop <id>\` stops it when your work is done.` : `workit: this heavy command (${plan.reason}) runs under the machine-wide heavy-check lease as \`${plan.command}\`: it waits while another heavy check holds the lease (\`workit lock status\` shows who). Run heavy commands that way yourself; \`workit help lock\` explains the lease.`;
|
|
19449
19570
|
var heavyDenial = (original, plan) => ({
|
|
19450
19571
|
kind: "deny",
|
|
19451
|
-
reason: `heavy_command: \`${original.trim()}\` is heavy (${plan.reason}) and must run under the machine-wide heavy-check lease, so parallel agents cannot exhaust this machine's memory and CPU. Run exactly: ${plan.command}`,
|
|
19572
|
+
reason: plan.server ? `dev_server: \`${original.trim()}\` starts a dev server (${plan.reason}), which never returns. Start it in the background, owned by this session; run exactly: ${plan.command}` : `heavy_command: \`${original.trim()}\` is heavy (${plan.reason}) and must run under the machine-wide heavy-check lease, so parallel agents cannot exhaust this machine's memory and CPU. Run exactly: ${plan.command}`,
|
|
19452
19573
|
unblock: plan.command
|
|
19453
19574
|
});
|
|
19454
19575
|
var splitDenial = (plan) => ({
|
|
@@ -19994,8 +20115,10 @@ var opaqueWrites = (input, scriptOf = (index) => input[index], fed) => {
|
|
|
19994
20115
|
return curlOutputs(args);
|
|
19995
20116
|
if (name === "perl")
|
|
19996
20117
|
return inline(/^-[a-zA-Z]*[eE]$/);
|
|
20118
|
+
if (name.startsWith("python") && args.some((arg, at) => arg === "-m" && args[at + 1] !== "json.tool"))
|
|
20119
|
+
return [".", ...args.flatMap(pathsIn)];
|
|
19997
20120
|
if (/^(?:python[\d.]*|node|bun|deno|ruby|php)$/.test(name))
|
|
19998
|
-
return inline(/^-[a-zA-Z]*[
|
|
20121
|
+
return inline(/^-[a-zA-Z]*[cep]$|^--(?:eval|print)$/);
|
|
19999
20122
|
return shellScript2(words) === null ? null : ["."];
|
|
20000
20123
|
};
|
|
20001
20124
|
var CURL_LONG = [
|
|
@@ -20728,7 +20851,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
|
|
|
20728
20851
|
shells.push(...read(named));
|
|
20729
20852
|
shells.push(...preloads.flatMap(read));
|
|
20730
20853
|
} else if (INTERPRETERS.test(verb)) {
|
|
20731
|
-
const code = args.findIndex((arg) => /^-[a-zA-Z]*[
|
|
20854
|
+
const code = args.findIndex((arg) => /^-[a-zA-Z]*[cep]$|^--(?:eval|print)$/.test(arg));
|
|
20732
20855
|
if (code >= 0)
|
|
20733
20856
|
others.push(...expansions(args[code + 1] ?? "", vars, loops));
|
|
20734
20857
|
others.push(...named === undefined ? [...segment.stdin ?? [], ...inputs.flatMap(read), ...piped] : read(named), ...preloads.flatMap(read));
|
|
@@ -22552,50 +22675,38 @@ var shown = (target) => {
|
|
|
22552
22675
|
const named = /^\.workit-(?:live-target$|runs-)/.test(path32.basename(target)) ? path32.dirname(target) : target;
|
|
22553
22676
|
return path32.sep === "\\" ? named.replaceAll("/", "\\") : named;
|
|
22554
22677
|
};
|
|
22555
|
-
var
|
|
22556
|
-
|
|
22557
|
-
|
|
22558
|
-
|
|
22559
|
-
|
|
22560
|
-
|
|
22561
|
-
|
|
22562
|
-
};
|
|
22563
|
-
var outsideDeny = (input, worktree, target) => {
|
|
22678
|
+
var runFrom = (dir, command) => `cd ${dir} && ${command.replace(/^\s*cd\s+\S+\s*(?:&&|;)\s*/, "")}`;
|
|
22679
|
+
var deny2 = (what, unblock) => ({
|
|
22680
|
+
kind: "deny",
|
|
22681
|
+
reason: `${what}.
|
|
22682
|
+
${unblock}`,
|
|
22683
|
+
unblock
|
|
22684
|
+
});
|
|
22685
|
+
var unboundDeny = (input, target) => deny2(`workit worktree confinement: implementer ${input.session.agentId} is not working in a Workit worktree yet, and ${shown(target)} is outside every one`, "Why: work only in your brief's worktree (`workit fanout worktree create <slice>`); with none, tell the lead.");
|
|
22686
|
+
var outsideDeny = (input, worktree, target, command) => {
|
|
22564
22687
|
const runner = runnerAt(target);
|
|
22565
|
-
|
|
22566
|
-
return {
|
|
22567
|
-
kind: "deny",
|
|
22568
|
-
reason: `workit worktree confinement: implementer ${input.session.agentId} is bound to the worktree ${worktree}, and ${runner === null ? `${shown(target)} is` : `\`${runner}\` runs in ${shown(target)},`} outside it. ${unblock}`,
|
|
22569
|
-
unblock
|
|
22570
|
-
};
|
|
22571
|
-
};
|
|
22572
|
-
var unknownDirDeny = (input, worktree) => {
|
|
22573
|
-
const wt = worktree ?? "<worktree>";
|
|
22574
|
-
const unblock = `Workit cannot resolve \`cd -\`, \`cd "$X"\` or \`popd\`: write by absolute path, \`git -C ${wt}\` or \`workit <verb> --cwd ${wt}\`.`;
|
|
22575
|
-
return {
|
|
22576
|
-
kind: "deny",
|
|
22577
|
-
reason: `workit worktree confinement: implementer ${input.session.agentId} writes after an unknown directory change. ${unblock}`,
|
|
22578
|
-
unblock
|
|
22579
|
-
};
|
|
22688
|
+
return deny2(`workit worktree confinement: implementer ${input.session.agentId} is bound to the worktree ${worktree}, and ${runner === null ? `${shown(target)} is` : `\`${runner}\` runs in ${shown(target)},`} outside it`, runner !== null && command ? `Retry as: ${runFrom(worktree, command)}` : `Why: edit only under ${worktree}, git one verb per call (\`workit git --cwd ${worktree} commit -m … -- <paths>\`); the rest is a follow-up.`);
|
|
22580
22689
|
};
|
|
22690
|
+
var unknownDirDeny = (input, worktree) => deny2(`workit worktree confinement: implementer ${input.session.agentId} writes after a directory change Workit cannot resolve (\`cd -\`, \`cd "$X"\`, \`popd\`)`, `Why: write by absolute path, \`git -C ${worktree ?? "<worktree>"}\` or \`workit <verb> --cwd\`.`);
|
|
22691
|
+
var refsOf = (targets) => [
|
|
22692
|
+
...new Set(targets.flatMap((target) => path32.relative(UNKNOWN_VAR, path32.resolve(target)).split(path32.sep)[0].split("+").filter(Boolean).map(decodeURIComponent)))
|
|
22693
|
+
];
|
|
22581
22694
|
var literalForm = (command, refs) => {
|
|
22582
22695
|
let text = command;
|
|
22583
|
-
for (const ref of refs) {
|
|
22696
|
+
for (const ref of refs.filter((one) => /^[$`]/.test(one))) {
|
|
22584
22697
|
const placeholder = `<absolute path of ${ref}>`;
|
|
22585
22698
|
const name = /^\$(\w+)$/.exec(ref)?.[1];
|
|
22586
22699
|
text = name ? text.replace(new RegExp(`\\$\\{${name}[^}]*\\}|\\$${name}(?!\\w)`, "g"), placeholder) : text.replaceAll(ref, placeholder);
|
|
22587
22700
|
}
|
|
22588
22701
|
return text.length > 600 ? `${text.slice(0, 600)}…` : text;
|
|
22589
22702
|
};
|
|
22590
|
-
var unknownVarDeny = (input,
|
|
22591
|
-
const refs =
|
|
22592
|
-
...new Set(targets.flatMap((target) => path32.relative(UNKNOWN_VAR, path32.resolve(target)).split(path32.sep)[0].split("+").filter(Boolean).map(decodeURIComponent)))
|
|
22593
|
-
];
|
|
22703
|
+
var unknownVarDeny = (input, targets, command) => {
|
|
22704
|
+
const refs = refsOf(targets);
|
|
22594
22705
|
let text = command ?? "";
|
|
22595
22706
|
const first = [];
|
|
22596
22707
|
const named = refs.map((ref) => {
|
|
22597
22708
|
const name = /^\$(\w+)$/.exec(ref)?.[1];
|
|
22598
|
-
const set = name ? new RegExp(`(^|[\\s;&|(])${name}=("?)(\\$\\([^()]*\\)|\`[^\`]*\`)\\2[ \\t]*(?:&&|;|\\n)
|
|
22709
|
+
const set = name ? new RegExp(`(^|[\\s;&|(])${name}=("?)(\\$\\([^()]*\\)|\`[^\`]*\`)\\2[ \\t]*(?:&&|;|\\n|$)[ \\t]*`).exec(text) : null;
|
|
22599
22710
|
const sub = set?.[3] ?? (/^(?:\$\(|`)/.test(ref) ? ref : null);
|
|
22600
22711
|
if (sub === null)
|
|
22601
22712
|
return ref;
|
|
@@ -22604,15 +22715,8 @@ var unknownVarDeny = (input, worktree, targets, command) => {
|
|
|
22604
22715
|
first.push(`Run \`${sub.slice(sub.startsWith("`") ? 1 : 2, -1).trim()}\` first, then`);
|
|
22605
22716
|
return sub === ref ? ref : `${ref} (set by \`${sub}\`)`;
|
|
22606
22717
|
});
|
|
22607
|
-
const
|
|
22608
|
-
|
|
22609
|
-
const retry = command === undefined || literal === command ? "" : ` ${first.length ? `${first.join(" ")} retry` : "Retry"} as: \`${literal}\`.`;
|
|
22610
|
-
const unblock = `Spell the path out instead of ${refs.join(", ")}: Workit follows only \`NAME=<literal>\`, \`$(mktemp …)\`, \`$(pwd)\`, \`$PWD\` after a literal \`cd\` and a \`for\` over literal words.${retry} Write under ${wt} or a temp dir.`;
|
|
22611
|
-
return {
|
|
22612
|
-
kind: "deny",
|
|
22613
|
-
reason: `workit worktree confinement: implementer ${input.session.agentId} writes to a path built from ${named.join(", ")}, which Workit cannot resolve, so it cannot tell whether the write stays in its worktree. ${unblock}`,
|
|
22614
|
-
unblock
|
|
22615
|
-
};
|
|
22718
|
+
const literal = literalForm(text, refs);
|
|
22719
|
+
return deny2(`workit worktree confinement: implementer ${input.session.agentId} writes to a path built from ${named.join(", ")}, which Workit cannot resolve`, command === undefined || literal === command ? `Why: spell the path out; Workit follows only \`NAME=<literal>\`, \`$(pwd)\` and literal \`for\` words.` : first.length ? `${first.join(" ")} retry as: \`${literal}\`` : `Retry as: ${literal}`);
|
|
22616
22720
|
};
|
|
22617
22721
|
function confineImplementer(input, targets, command) {
|
|
22618
22722
|
try {
|
|
@@ -22620,7 +22724,7 @@ function confineImplementer(input, targets, command) {
|
|
|
22620
22724
|
return NONE5;
|
|
22621
22725
|
const unresolved = targets.filter((target) => within(path32.resolve(target), UNKNOWN_VAR));
|
|
22622
22726
|
if (unresolved.length > 0)
|
|
22623
|
-
return unknownVarDeny(input,
|
|
22727
|
+
return unknownVarDeny(input, unresolved, command);
|
|
22624
22728
|
if (targets.some((target) => within(path32.resolve(target), UNKNOWN_DIR)))
|
|
22625
22729
|
return unknownDirDeny(input, boundWorktree(input));
|
|
22626
22730
|
const bindings = canonical5(bindingDir());
|
|
@@ -22640,7 +22744,7 @@ function confineImplementer(input, targets, command) {
|
|
|
22640
22744
|
}
|
|
22641
22745
|
const root = canonical5(worktree);
|
|
22642
22746
|
const outside = judged.find(({ real }) => !within(real, root) || within(real, bindings));
|
|
22643
|
-
return outside ? outsideDeny(input, worktree, outside.named) : NONE5;
|
|
22747
|
+
return outside ? outsideDeny(input, worktree, outside.named, command) : NONE5;
|
|
22644
22748
|
} catch {
|
|
22645
22749
|
return NONE5;
|
|
22646
22750
|
}
|
|
@@ -22705,14 +22809,7 @@ var leadOwnedWorkit = (args) => !args.includes("--help") && args.some((_, start)
|
|
|
22705
22809
|
const [verb, sub] = skipWorkitGlobals(args.slice(start)).rest;
|
|
22706
22810
|
return verb === "fanout" && /^(?:plan|worktree)$/.test(sub ?? "");
|
|
22707
22811
|
});
|
|
22708
|
-
var leadOwnedDeny = (input, command) => {
|
|
22709
|
-
const unblock = "Worktrees, branches other than your own, refs, tags, remotes, git config, the shared stash and the fan-out plan belong to the lead: report what you need changed as a follow-up instead.";
|
|
22710
|
-
return {
|
|
22711
|
-
kind: "deny",
|
|
22712
|
-
reason: `workit worktree confinement: implementer ${input.session.agentId} may not run \`${command.slice(0, 160)}\`. ${unblock}`,
|
|
22713
|
-
unblock
|
|
22714
|
-
};
|
|
22715
|
-
};
|
|
22812
|
+
var leadOwnedDeny = (input, command) => deny2(`workit worktree confinement: implementer ${input.session.agentId} may not run \`${command.slice(0, 160)}\``, "Why: worktrees, other branches, refs, remotes, git config, the stash and the fan-out plan belong to the lead: a follow-up.");
|
|
22716
22813
|
function confineImplementerShell(input, command, dialect = "posix") {
|
|
22717
22814
|
try {
|
|
22718
22815
|
if (!input.session.agentId || hostIsolated(input.cwd, input.session.agentId))
|
|
@@ -22722,6 +22819,9 @@ function confineImplementerShell(input, command, dialect = "posix") {
|
|
|
22722
22819
|
} catch {}
|
|
22723
22820
|
return confineImplementer(input, shellMutationTargets(input.cwd, command, dialect, true), command);
|
|
22724
22821
|
}
|
|
22822
|
+
var LITERAL_SET = /^\s*([A-Za-z_]\w*)=(['"]?)((?:[\w@%+=:./\\-]|(?<=[^\s:=])~)*)\2[ \t]*(?:;|&&|\n)\s*/;
|
|
22823
|
+
var SPELLED = /^(?:[A-Za-z]|wt|wd|dir|repo|root|base|sha|ref|branch|file|out|scratch|worktree|WT|WD|DIR|REPO|ROOT|BASE|SHA|REF|BRANCH|FILE|OUT|SCRATCH|WORKTREE)$/;
|
|
22824
|
+
var ENV_READ = /^(?:GIT_|LD_|DYLD_|NODE_|PYTHON|PERL|RUBY|BASH|EPOCH|(?:ENV|IFS|CDPATH|PS\d|PWD|OLDPWD|REPLY|OPTARG|OPTIND|MAPFILE|S?RANDOM|SECONDS|LINENO|E?UID|PPID|_|HOSTNAME|HISTCMD)$)/;
|
|
22725
22825
|
var SCRATCH = ".workit-scratch";
|
|
22726
22826
|
var SHELL_NAMES = /^(?:sh|bash|zsh|dash|ksh|mksh|ash)$/;
|
|
22727
22827
|
var INTERPRETERS2 = /^(?:python[\d.]*|node|bun|deno|ruby|perl|php)$/;
|
|
@@ -22839,7 +22939,8 @@ var GIT_VERBS = {
|
|
|
22839
22939
|
var: "l|",
|
|
22840
22940
|
version: "|build-options",
|
|
22841
22941
|
"ls-remote": "htbq|heads tags branches refs quiet exit-code get-url symref sort=",
|
|
22842
|
-
remote: "v|verbose",
|
|
22942
|
+
remote: "v|verbose push all",
|
|
22943
|
+
"range-diff": "@d|@d creation-factor= no-dual-color left-only right-only",
|
|
22843
22944
|
config: "lz|get get-all get-regexp list local name-only null type= default=",
|
|
22844
22945
|
worktree: "fdqvzb:B:|force detach lock reason= orphan no-checkout checkout quiet track no-track guess-remote porcelain expire= verbose",
|
|
22845
22946
|
branch: "dDmMcCfvraliu:|delete move copy force list all remotes verbose contains? merged? no-merged? points-at= show-current set-upstream-to= unset-upstream track? no-track sort= format= color? column? ignore-case create-reflog",
|
|
@@ -22925,7 +23026,7 @@ var gitKind = (args, local = () => true) => {
|
|
|
22925
23026
|
case "worktree":
|
|
22926
23027
|
return first === "list" ? "read" : /^(?:add|remove)$/.test(first) ? "write" : null;
|
|
22927
23028
|
case "remote":
|
|
22928
|
-
return !first || first === "show" && named.length === 2 && local(second, true) ? "read" : null;
|
|
23029
|
+
return !first || first === "get-url" || first === "show" && named.length === 2 && local(second, true) ? "read" : null;
|
|
22929
23030
|
case "ls-remote":
|
|
22930
23031
|
return local(first || "origin", true) ? "read" : null;
|
|
22931
23032
|
case "bisect":
|
|
@@ -22942,7 +23043,6 @@ var gitKind = (args, local = () => true) => {
|
|
|
22942
23043
|
}
|
|
22943
23044
|
return GIT_VERBS[verb].startsWith("+") ? "write" : "read";
|
|
22944
23045
|
};
|
|
22945
|
-
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`;
|
|
22946
23046
|
var remoteIn = (dir, name, repo) => {
|
|
22947
23047
|
const shared = path32.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo, false)?.[1] : undefined;
|
|
22948
23048
|
if (!shared)
|
|
@@ -22985,14 +23085,12 @@ var judgeGit = (command, repo, cwd, depth = 0) => {
|
|
|
22985
23085
|
why ??= `\`${word}\` is not allowed`;
|
|
22986
23086
|
let index = start < 0 ? words.length : start + 1;
|
|
22987
23087
|
let dir = "";
|
|
22988
|
-
let unlocked = lead.includes("GIT_OPTIONAL_LOCKS=0");
|
|
22989
23088
|
for (;!why && words[index]?.startsWith("-") && words[index] !== "--version"; index++) {
|
|
22990
23089
|
const word = words[index];
|
|
22991
23090
|
const flag = /^--(git-dir|work-tree)(?:=([\s\S]*))?$/.exec(word);
|
|
22992
23091
|
const value = flag?.[2] ?? (/^(?:-C|--git-dir|--work-tree)$/.test(word) ? words[++index] : "");
|
|
22993
23092
|
if (word === "-C")
|
|
22994
23093
|
dir = value;
|
|
22995
|
-
unlocked ||= word === "--no-optional-locks";
|
|
22996
23094
|
if (flag ? !literalIn(value, repo) : !/^(?:-C|-P|--no-pager|--no-optional-locks)$/.test(word))
|
|
22997
23095
|
why = `\`${word}\` is not allowed`;
|
|
22998
23096
|
}
|
|
@@ -23004,11 +23102,6 @@ var judgeGit = (command, repo, cwd, depth = 0) => {
|
|
|
23004
23102
|
const fetches = args[0] === "fetch" && plainFetch(args.slice(1)) && home && (home.workit || commonDir(home.root) === repo) && !words.some((word) => /^--[gw]/.test(word));
|
|
23005
23103
|
if (!fetches && !gitKind(args, local))
|
|
23006
23104
|
why = `\`git ${args.slice(0, 2).join(" ")}\` is not allowed`;
|
|
23007
|
-
else if (args[0] === "status" && !unlocked) {
|
|
23008
|
-
const dirs = path32.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo) : null;
|
|
23009
|
-
if (!dirs?.length || !dirs.every((gitDir) => inScratch(gitDir, repo)))
|
|
23010
|
-
why = "`git status` refreshes the index outside scratch: add --no-optional-locks";
|
|
23011
|
-
}
|
|
23012
23105
|
}
|
|
23013
23106
|
const shell = /^(?:grep|egrep|rg|echo|printf|cat)$/.test(name) ? -1 : words.findIndex((word) => /^(?:sh|bash|zsh|dash|ksh|mksh|ash)$/.test(path32.basename(word)));
|
|
23014
23107
|
const scripts = [
|
|
@@ -23074,7 +23167,6 @@ var workitCalls = (command, depth = 0, aliases = new Map) => depth > 4 ? [] : co
|
|
|
23074
23167
|
at++;
|
|
23075
23168
|
return [words.slice(at + 1)];
|
|
23076
23169
|
});
|
|
23077
|
-
var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
|
|
23078
23170
|
var judgeRefusal = (command, fed, depth = 0) => {
|
|
23079
23171
|
let moved = false;
|
|
23080
23172
|
for (const segment of segmentsOf(command)) {
|
|
@@ -23096,6 +23188,9 @@ var judgeRefusal = (command, fed, depth = 0) => {
|
|
|
23096
23188
|
moved = true;
|
|
23097
23189
|
if (name === "eval" || (name === "source" || name === ".") && FED.test(args[0] ?? ""))
|
|
23098
23190
|
return unseen;
|
|
23191
|
+
const set = words.find((word) => /^(?:NODE_OPTIONS|PYTHON(?:STARTUP|PATH|HOME)|PERL5(?:OPT|LIB)|RUBY(?:OPT|LIB)|LD_\w+|DYLD_\w+|REPLY|OPTARG|OPTIND|MAPFILE|READLINE_\w+|S?RANDOM|SECONDS|LINENO|E?UID|PPID|OLDPWD|_|HOSTNAME|HISTCMD|EPOCH\w*)=/.test(word));
|
|
23192
|
+
if (set)
|
|
23193
|
+
return `\`${set.slice(0, 80)}\` sets a loader or shell-set name`;
|
|
23099
23194
|
if (SHELL_NAMES.test(name)) {
|
|
23100
23195
|
let operand;
|
|
23101
23196
|
let stdin = false;
|
|
@@ -23142,7 +23237,7 @@ var judgeRefusal = (command, fed, depth = 0) => {
|
|
|
23142
23237
|
for (const args of workitCalls(command)) {
|
|
23143
23238
|
const call = judgeVerbRefused(args);
|
|
23144
23239
|
if (call)
|
|
23145
|
-
return `\`${call}\` is not a judge's job: a judge runs only
|
|
23240
|
+
return `\`${call}\` is not a judge's job: a judge runs only read-only workit verbs`;
|
|
23146
23241
|
}
|
|
23147
23242
|
return null;
|
|
23148
23243
|
};
|
|
@@ -23164,20 +23259,31 @@ var substitutingHeredoc = (command) => {
|
|
|
23164
23259
|
}
|
|
23165
23260
|
return false;
|
|
23166
23261
|
};
|
|
23167
|
-
var judgeDeny = (input, what, target) => {
|
|
23262
|
+
var judgeDeny = (input, what, target, retry) => {
|
|
23168
23263
|
const role = input.session.agentType?.endsWith("reviewer") ? "reviewer" : "verifier";
|
|
23169
23264
|
const root = checkoutOf2(input.cwd)?.root;
|
|
23170
23265
|
const candidate = target ? checkoutOf2(target)?.root : undefined;
|
|
23171
|
-
const
|
|
23172
|
-
const scratch = root ? `${path32.join(root, SCRATCH)}${
|
|
23173
|
-
const
|
|
23266
|
+
const other = root && candidate && candidate !== root && commonDir(candidate) === commonDir(root) ? path32.join(candidate, SCRATCH) : undefined;
|
|
23267
|
+
const scratch = root ? `${path32.join(root, SCRATCH)}${other ? ` or ${other}` : ""}` : `${SCRATCH}/ at the root of the checkout you judge`;
|
|
23268
|
+
const call = root ? retry?.((other ?? path32.join(root, SCRATCH)).replaceAll("\\", "/")) : null;
|
|
23269
|
+
const unblock = call ? `Retry as: ${call}` : "Why: write only there (mkdir -p it); a fix the candidate needs is a finding (`workit finding record`).";
|
|
23174
23270
|
return {
|
|
23175
23271
|
kind: "deny",
|
|
23176
|
-
reason: `workit scratch confinement: ${role} ${input.session.agentId} may write only in its scratch dir ${scratch}, and ${what}.
|
|
23272
|
+
reason: `workit scratch confinement: ${role} ${input.session.agentId} may write only in its scratch dir ${scratch}, and ${what}.
|
|
23273
|
+
${unblock}`,
|
|
23177
23274
|
unblock
|
|
23178
23275
|
};
|
|
23179
23276
|
};
|
|
23180
|
-
|
|
23277
|
+
var movedInto = (command, cwd, target, dir) => {
|
|
23278
|
+
for (const { words, redirects } of segmentsOf(command))
|
|
23279
|
+
for (const word of [...redirects, ...path32.basename(words[0] ?? "") === "tee" ? words : []])
|
|
23280
|
+
if (path32.resolve(cwd, word) === path32.resolve(cwd, target)) {
|
|
23281
|
+
const moved = command.replace(new RegExp(`((?:>>?\\|?|\\btee(?:\\s+-a)?)\\s*)(['"]?)${word.replace(/[$()*+.?[\\\]^{|}]/g, "\\$&")}\\2(?![^\\s;&|)])`), (_, lead) => `${lead}${dir}/${path32.basename(word)}`);
|
|
23282
|
+
return moved === command ? null : moved;
|
|
23283
|
+
}
|
|
23284
|
+
return null;
|
|
23285
|
+
};
|
|
23286
|
+
function confineJudge(input, targets, placeholders = placeholdersOf(targets), command) {
|
|
23181
23287
|
try {
|
|
23182
23288
|
if (!input.session.agentId)
|
|
23183
23289
|
return NONE5;
|
|
@@ -23190,7 +23296,10 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
|
|
|
23190
23296
|
for (const target of targets) {
|
|
23191
23297
|
const resolved = path32.resolve(target);
|
|
23192
23298
|
if (within(resolved, UNKNOWN_VAR) || within(resolved, UNKNOWN_DIR))
|
|
23193
|
-
return judgeDeny(input, "it writes to a path Workit cannot resolve
|
|
23299
|
+
return judgeDeny(input, "it writes to a path Workit cannot resolve", undefined, () => {
|
|
23300
|
+
const literal = command && literalForm(command, refsOf([target]));
|
|
23301
|
+
return literal === command ? null : literal;
|
|
23302
|
+
});
|
|
23194
23303
|
const real = canonical5(target);
|
|
23195
23304
|
const runsGit = placeholders.has(target) && /^\.workit-(?:runs-git|live-target)$/.test(path32.basename(target));
|
|
23196
23305
|
const gitDirs = runsGit ? gitDirsAt(path32.dirname(real), repo) : [];
|
|
@@ -23199,17 +23308,43 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
|
|
|
23199
23308
|
if (runsGit ? gitDirs.length > 0 ? gitDirs.every(scratch) : scratch(real) : scratch(real) && !inGitDir(real))
|
|
23200
23309
|
continue;
|
|
23201
23310
|
const runner = runnerAt(target);
|
|
23202
|
-
return judgeDeny(input, runner === null ? `${shown(target)} is outside it` : `\`${runner}\` runs in ${shown(target)}, outside it`, target);
|
|
23311
|
+
return judgeDeny(input, runner === null ? `${shown(target)} is outside it` : `\`${runner}\` runs in ${shown(target)}, outside it`, target, (dir) => !command || runsGit ? null : runner === null ? movedInto(command, input.cwd, target, dir) : runFrom(dir, command));
|
|
23203
23312
|
}
|
|
23204
23313
|
return NONE5;
|
|
23205
23314
|
} catch {
|
|
23206
23315
|
return NONE5;
|
|
23207
23316
|
}
|
|
23208
23317
|
}
|
|
23318
|
+
var spelledIn = (text, name, value) => text.replace(new RegExp(`\\$(?:${name}(?!\\w)|\\{${name}\\})`, "g"), () => value);
|
|
23319
|
+
var variableRefusal = (command) => {
|
|
23320
|
+
let rest = command;
|
|
23321
|
+
const sets = [];
|
|
23322
|
+
for (let set;set = LITERAL_SET.exec(rest); rest = rest.slice(set[0].length))
|
|
23323
|
+
sets.push([set[1], set[3]]);
|
|
23324
|
+
const loop = /^\s*for\s+(\w+)\s+in\s+([\w@%+=:./ \t-]*?)\s*[;\n]\s*do\s([\s\S]*?);?\s*done\s*$/.exec(rest);
|
|
23325
|
+
for (const name of [...sets.map(([one]) => one), ...loop ? [loop[1]] : []])
|
|
23326
|
+
if (new RegExp(`\\$(?:${name}(?!\\w)|\\{${name}(?![\\w}])|\\{${name}\\})(?![\\s/";&|)]|$)`).test(rest))
|
|
23327
|
+
return { why: `\`$${name}\` has a modifier, subscript or suffix Workit does not spell in` };
|
|
23328
|
+
const odd = [...sets.map(([one]) => one), ...loop ? [loop[1]] : []].find((name) => !SPELLED.test(name) || process.env[name] !== undefined || ENV_READ.test(name));
|
|
23329
|
+
const used = sets.filter(([name]) => name === odd || new RegExp(`\\$\\{?${name}(?!\\w)`).test(rest));
|
|
23330
|
+
if (used.length)
|
|
23331
|
+
return {
|
|
23332
|
+
why: odd ? `\`${odd}=\` sets a name the shell, zsh or git reads itself` : `\`$${used[0][0]}\` is a path from a variable, which Workit does not follow for a judge`,
|
|
23333
|
+
retry: used.reduce((text, [name, value]) => spelledIn(text, name, value), rest)
|
|
23334
|
+
};
|
|
23335
|
+
const items = loop?.[2].split(/\s+/).filter(Boolean) ?? [];
|
|
23336
|
+
return loop && (loop[1] === odd || new RegExp(`\\$\\{?${loop[1]}(?!\\w)`).test(loop[3])) ? {
|
|
23337
|
+
why: `\`$${loop[1]}\` is a loop variable, which Workit does not follow for a judge`,
|
|
23338
|
+
retry: items.length > 16 ? undefined : items.map((item) => spelledIn(loop[3].trim(), loop[1], item)).join("; ")
|
|
23339
|
+
} : null;
|
|
23340
|
+
};
|
|
23209
23341
|
function confineJudgeShell(input, command, dialect = "posix") {
|
|
23210
23342
|
try {
|
|
23211
23343
|
if (!input.session.agentId)
|
|
23212
23344
|
return NONE5;
|
|
23345
|
+
const variable = dialect === "posix" ? variableRefusal(command) : null;
|
|
23346
|
+
if (variable)
|
|
23347
|
+
return judgeDeny(input, variable.why, undefined, () => variable.retry);
|
|
23213
23348
|
const fed = [];
|
|
23214
23349
|
let refused;
|
|
23215
23350
|
try {
|
|
@@ -23221,8 +23356,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
|
|
|
23221
23356
|
const judged = checkoutOf2(input.cwd);
|
|
23222
23357
|
try {
|
|
23223
23358
|
const why = judgeGit(command, judged ? commonDir(judged.root) : null, /\b(?:cd|chdir|pushd|popd)\b/.test(command) ? null : input.cwd);
|
|
23224
|
-
|
|
23225
|
-
refused = `${why}: ${JUDGE_GIT}`;
|
|
23359
|
+
refused = why;
|
|
23226
23360
|
} catch {
|
|
23227
23361
|
refused = "Workit cannot read this command: split it into simpler ones";
|
|
23228
23362
|
}
|
|
@@ -23230,7 +23364,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
|
|
|
23230
23364
|
if (refused)
|
|
23231
23365
|
return judgeDeny(input, refused);
|
|
23232
23366
|
if (dialect === "posix" && substitutingHeredoc(command.replaceAll("\\\n", "")))
|
|
23233
|
-
return judgeDeny(input, "an unquoted heredoc runs the `$(…)` or backtick command in its body: quote the delimiter (<<'EOF')");
|
|
23367
|
+
return judgeDeny(input, "an unquoted heredoc runs the `$(…)` or backtick command in its body: quote the delimiter (<<'EOF')", undefined, () => command.replace(/<<(-?)[ \t]*(\w+)/g, "<<$1'$2'"));
|
|
23234
23368
|
let git = [];
|
|
23235
23369
|
try {
|
|
23236
23370
|
git = rawInvocations(command, dialect).flatMap(({ tool, dir, args }) => tool === "git" && (args[0] === "push" || leadOwnedGit(args) || gitKind(args) === "write" && !/^(?:init|clone)$/.test(args[0]) && !(args[0] === "fetch" && plainFetch(args.slice(1)))) ? [
|
|
@@ -23241,7 +23375,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
|
|
|
23241
23375
|
shellMutationTargets(input.cwd, command, dialect, true),
|
|
23242
23376
|
...fed.map((body) => shellMutationTargets(input.cwd, body, "posix", true))
|
|
23243
23377
|
];
|
|
23244
|
-
return confineJudge(input, [...lists.flat(), ...git], new Set([...git, ...lists.flatMap((list) => [...placeholdersOf(list)])]));
|
|
23378
|
+
return confineJudge(input, [...lists.flat(), ...git], new Set([...git, ...lists.flatMap((list) => [...placeholdersOf(list)])]), command);
|
|
23245
23379
|
} catch {
|
|
23246
23380
|
return NONE5;
|
|
23247
23381
|
}
|
|
@@ -24327,9 +24461,11 @@ var ytrackGate = (cwd, command, dialect, ask) => {
|
|
|
24327
24461
|
const run = calls.length ? ` Run ${calls.join(", then ")} instead, each as its own plain call: it asks the user first.` : "";
|
|
24328
24462
|
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.` : "";
|
|
24329
24463
|
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." : "";
|
|
24464
|
+
const retry = writes.find((write) => write.workit)?.workit ?? (rerun ? writes.find((write) => write.gap === NOT_PLAIN.gap)?.command : undefined);
|
|
24330
24465
|
return {
|
|
24331
24466
|
kind: "deny",
|
|
24332
|
-
reason: `${why}${run}${user}${rerun}
|
|
24467
|
+
reason: `${why}${run}${user}${rerun}${retry ? `
|
|
24468
|
+
Retry as: ${retry}` : ""}`,
|
|
24333
24469
|
unblock: writes[0]?.workit ?? null
|
|
24334
24470
|
};
|
|
24335
24471
|
};
|
|
@@ -24395,7 +24531,7 @@ function handleHook(input, deps) {
|
|
|
24395
24531
|
const decision = decide(input, deps);
|
|
24396
24532
|
if (deps.descriptor.transport !== "hook-process" || !PRE_TOOL.has(input.event.kind) || decision.kind === "deny" || decision.kind === "ask")
|
|
24397
24533
|
return decision;
|
|
24398
|
-
const delta = [standingDelta(input), deps.budget?.line(input) ?? null].filter(Boolean).join(`
|
|
24534
|
+
const delta = [standingDelta(input), takeProcNotice2(input.session.id), deps.budget?.line(input) ?? null].filter(Boolean).join(`
|
|
24399
24535
|
`) || null;
|
|
24400
24536
|
if (!delta)
|
|
24401
24537
|
return decision;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
stateDir3
|
|
4
|
+
} from "./workit-hook-7jv519ep.js";
|
|
5
|
+
|
|
6
|
+
// packages/workit-core/src/hooks/server-gate.ts
|
|
7
|
+
import fs from "node:fs";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
var procNoticeFile2 = (env, session) => path.join(stateDir3(env), "procs", "notices", `${session.replace(/[^A-Za-z0-9_.@+-]/gu, "-").slice(0, 120) || "none"}.json`);
|
|
10
|
+
var mb = (bytes) => `${Math.round(Number(bytes) / 1048576)} MB`;
|
|
11
|
+
function takeProcNotice2(session, env = process.env) {
|
|
12
|
+
if (!session)
|
|
13
|
+
return null;
|
|
14
|
+
const file = procNoticeFile2(env, session);
|
|
15
|
+
const taken = `${file}.${process.pid}.taken`;
|
|
16
|
+
try {
|
|
17
|
+
fs.renameSync(file, taken);
|
|
18
|
+
} catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const { notices } = JSON.parse(fs.readFileSync(taken, "utf8"));
|
|
23
|
+
const lines = (Array.isArray(notices) ? notices : []).flatMap((notice) => {
|
|
24
|
+
if (!notice || typeof notice !== "object")
|
|
25
|
+
return [];
|
|
26
|
+
const { id, cmd, cwd, rssBytes, ceilingBytes } = notice;
|
|
27
|
+
if (typeof id !== "string")
|
|
28
|
+
return [];
|
|
29
|
+
return [
|
|
30
|
+
`- ${id} \`${String(cmd)}\` in ${String(cwd)}: ${mb(rssBytes)} (ceiling ${mb(ceilingBytes)}). Restart it: \`workit run --bg --restart ${id}\`, or \`workit stop ${id}\`.`
|
|
31
|
+
];
|
|
32
|
+
});
|
|
33
|
+
return lines.length ? ["Workit: a background process you started is past the memory ceiling:", ...lines].join(`
|
|
34
|
+
`) : null;
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
} finally {
|
|
38
|
+
try {
|
|
39
|
+
fs.rmSync(taken, { force: true });
|
|
40
|
+
} catch {}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { procNoticeFile2, takeProcNotice2 };
|
package/dist/workit-hook.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// packages/workit-codex/hooks/launcher.ts
|
|
4
|
-
import { readFileSync } from "node:fs";
|
|
4
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
var foundNode = process.env.WORKIT_HOOK_NODE_VERSION || process.versions.node;
|
|
@@ -37,6 +37,7 @@ useOwnedWorkitCli();
|
|
|
37
37
|
var { maybeHeavy, stateDir } = await import("./workit-hook-1xk8mx4h.js");
|
|
38
38
|
var { configDir } = await import("./workit-hook-z09frbdk.js");
|
|
39
39
|
var { standingPending } = await import("./workit-hook-mk64s4fk.js");
|
|
40
|
+
var { procNoticeFile } = await import("./workit-hook-vmvv43m0.js");
|
|
40
41
|
var { recordHookRun } = await import("./workit-hook-zyj0kzc5.js");
|
|
41
42
|
var { observeHookBudget } = await import("./workit-hook-3g6cv3hd.js");
|
|
42
43
|
var { hasTaskStore, mayReach } = await import("./workit-hook-7dwf87hc.js");
|
|
@@ -70,6 +71,8 @@ var quietEvent = () => {
|
|
|
70
71
|
return null;
|
|
71
72
|
if (event === "PreToolUse" && typeof value.session_id === "string" && standingPending(value.cwd, value.session_id, typeof value.agent_id === "string" && value.agent_id.trim() ? value.agent_id : null))
|
|
72
73
|
return null;
|
|
74
|
+
if (event === "PreToolUse" && typeof value.session_id === "string" && value.session_id && existsSync(procNoticeFile(process.env, value.session_id)))
|
|
75
|
+
return null;
|
|
73
76
|
const tool = value.tool_name.toLowerCase();
|
|
74
77
|
if (event === "PreToolUse" && WRITE_TOOLS.has(tool.replace(/[_-]/g, "")))
|
|
75
78
|
return null;
|
|
@@ -98,7 +101,7 @@ if (quiet) {
|
|
|
98
101
|
`);
|
|
99
102
|
} else {
|
|
100
103
|
try {
|
|
101
|
-
const { runCodexHook } = await import("./workit-hook-
|
|
104
|
+
const { runCodexHook } = await import("./workit-hook-3e2eetcr.js");
|
|
102
105
|
await runCodexHook([payload]);
|
|
103
106
|
} catch (error) {
|
|
104
107
|
const { answerRuntimeFailure } = await import("./workit-hook-9k8dtngs.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/codex",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit Codex CLI/desktop plugin — shared MCP transport, hooks, method skills, and verifier/reviewer/implementer agents",
|
|
6
6
|
"keywords": [
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"build": "bun scripts/build.ts"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@workit-dev/core": "^2.
|
|
45
|
-
"@workit-dev/mcp": "^2.
|
|
44
|
+
"@workit-dev/core": "^2.11.1",
|
|
45
|
+
"@workit-dev/mcp": "^2.11.1"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=24"
|
|
@@ -22,7 +22,8 @@ way a user would.
|
|
|
22
22
|
already has a project skills directory, use it:
|
|
23
23
|
- **Launch:** one command, its ready signal (log line, port, exit 0), a timeout.
|
|
24
24
|
Builds, installs and e2e suites run under the heavy-check lease
|
|
25
|
-
(`workit check --heavy -- <cmd>`)
|
|
25
|
+
(`workit check --heavy -- <cmd>`). A dev server starts in the background
|
|
26
|
+
through `workit run --bg -- <cmd>`, which prints its id, port and log.
|
|
26
27
|
- **Doctor:** each precondition and its fix (deps, env vars, ports, services).
|
|
27
28
|
- **Drive:** how to exercise it: CLI invocations, `curl` against routes, a
|
|
28
29
|
browser tool for UI, with fixture data.
|
|
@@ -31,7 +32,7 @@ way a user would.
|
|
|
31
32
|
agent-browser, with a screenshot or console/network observation; an API
|
|
32
33
|
with a real call, response quoted. The report carries the observation.
|
|
33
34
|
App not runnable? Say so plainly, never claim success.
|
|
34
|
-
- **Cleanup:** stop
|
|
35
|
+
- **Cleanup:** `workit stop <id>` for each server it started, remove temp data.
|
|
35
36
|
- **Feature map:** feature, how to drive it, expected observation.
|
|
36
37
|
3. **Prove it end-to-end once:** launch, drive one feature, capture evidence,
|
|
37
38
|
clean up. Fix the skill until that run is clean. A generated skill that was
|
|
@@ -56,10 +57,11 @@ report `clean`, `changed` (what) or `blocked` (why).
|
|
|
56
57
|
|
|
57
58
|
Bad: "Verify by running the tests." (that is not the real surface)
|
|
58
59
|
|
|
59
|
-
Good: "Launch `bun run dev` (ready: `listening on :5173`,
|
|
60
|
-
`curl -s localhost:5173/api/health` returned `{"ok":true}`;
|
|
61
|
-
/settings at .workit-scratch/settings.png. Evidence:
|
|
62
|
-
`workit check --name verify-web -- bun scripts/smoke.ts` exit 0.
|
|
60
|
+
Good: "Launch `workit run --bg -- bun run dev` (ready: `listening on :5173`,
|
|
61
|
+
30 s). Drive: `curl -s localhost:5173/api/health` returned `{"ok":true}`;
|
|
62
|
+
screenshot of /settings at .workit-scratch/settings.png. Evidence:
|
|
63
|
+
`workit check --name verify-web -- bun scripts/smoke.ts` exit 0. Cleanup:
|
|
64
|
+
`workit stop p1abc2def3`."
|
|
63
65
|
|
|
64
66
|
## Check
|
|
65
67
|
|
|
@@ -14,6 +14,7 @@ description: Launch, drive and observe <app> on its real surface (<cli|web|api>)
|
|
|
14
14
|
|
|
15
15
|
## Launch
|
|
16
16
|
`<command>` - ready when `<log line | port open | exit 0>`, timeout <n> s.
|
|
17
|
+
A server: `workit run --bg -- <command>` (prints its id, port and log).
|
|
17
18
|
|
|
18
19
|
## Doctor
|
|
19
20
|
| Precondition | Check | Fix |
|
|
@@ -34,7 +35,7 @@ UI: also report a console or network observation. API: quote the real response.
|
|
|
34
35
|
If the app cannot be run, say so plainly instead of claiming success.
|
|
35
36
|
|
|
36
37
|
## Cleanup
|
|
37
|
-
|
|
38
|
+
`workit stop <id>` for each server Launch started; remove `<tmp dir>`.
|
|
38
39
|
|
|
39
40
|
## Feature map
|
|
40
41
|
| Feature | Drive | Expect |
|