@workit-dev/pi 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/dist/worker.js
CHANGED
|
@@ -9783,78 +9783,6 @@ var MUTATING_REMOTE = new Set([
|
|
|
9783
9783
|
"set-branches",
|
|
9784
9784
|
"prune"
|
|
9785
9785
|
]);
|
|
9786
|
-
var GIT_VERBS = {
|
|
9787
|
-
log: "@d@l|@d @l",
|
|
9788
|
-
show: "@d@l|@d @l",
|
|
9789
|
-
diff: "@d|@d cached staged merge-base no-index",
|
|
9790
|
-
"diff-tree": "@drtcm|@d root stdin no-commit-id",
|
|
9791
|
-
"diff-index": "@dm|@d cached merge-base",
|
|
9792
|
-
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",
|
|
9793
|
-
"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",
|
|
9794
|
-
"rev-list": "@l|@l count objects? left-only right-only",
|
|
9795
|
-
"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",
|
|
9796
|
-
"ls-tree": "rdtlz|long name-only name-status object-only full-name full-tree abbrev? format=",
|
|
9797
|
-
"cat-file": "tsepz|batch? batch-check? batch-all-objects follow-symlinks unordered buffer allow-unknown-type mailmap use-mailmap",
|
|
9798
|
-
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=",
|
|
9799
|
-
describe: "|tags all long abbrev= contains always dirty? broken? match= exclude= first-parent exact-match candidates= debug",
|
|
9800
|
-
"merge-base": "a|all octopus independent is-ancestor fork-point",
|
|
9801
|
-
"for-each-ref": "|count= sort= format= color? shell perl python tcl points-at= merged? no-merged? contains? no-contains? ignore-case omit-empty exclude=",
|
|
9802
|
-
shortlog: "@lsnec|@l summary numbered email committer group= format=",
|
|
9803
|
-
"show-ref": "dsq|head verify heads tags branches hash? abbrev? quiet dereference exists",
|
|
9804
|
-
"name-rev": "|tags refs= exclude= all annotate-stdin name-only no-undefined always",
|
|
9805
|
-
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",
|
|
9806
|
-
"format-patch": "@do:nNks|@d stdout output-directory= numbered no-numbered start-number= subject-prefix= root cover-letter thread? signoff attach? inline? suffix= base=",
|
|
9807
|
-
reflog: "@l|@l all expire= expire-unreachable= rewrite updateref stale-fix dry-run verbose",
|
|
9808
|
-
"count-objects": "vH|verbose human-readable",
|
|
9809
|
-
"check-ignore": "qvnz|quiet verbose stdin non-matching no-index",
|
|
9810
|
-
var: "l|",
|
|
9811
|
-
version: "|build-options",
|
|
9812
|
-
"ls-remote": "htbq|heads tags branches refs quiet exit-code get-url symref sort=",
|
|
9813
|
-
remote: "v|verbose",
|
|
9814
|
-
config: "lz|get get-all get-regexp list local name-only null type= default=",
|
|
9815
|
-
worktree: "fdqvzb:B:|force detach lock reason= orphan no-checkout checkout quiet track no-track guess-remote porcelain expire= verbose",
|
|
9816
|
-
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",
|
|
9817
|
-
tag: "lam:dfF:n?|list annotate message= file= delete force sort= format= contains? merged? no-merged? points-at= column? create-reflog ignore-case",
|
|
9818
|
-
init: "+qb:|quiet bare initial-branch= object-format= ref-format= shared? separate-git-dir=",
|
|
9819
|
-
add: "+AunNvf|all update intent-to-add force dry-run verbose ignore-errors ignore-removal no-all renormalize chmod= sparse",
|
|
9820
|
-
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",
|
|
9821
|
-
checkout: "+b:B:fqm|detach force orphan= quiet track? no-track merge ours theirs",
|
|
9822
|
-
switch: "+c:C:dfqm|create= force-create= detach discard-changes force orphan= quiet track? no-track merge",
|
|
9823
|
-
restore: "+s:SWq|source= staged worktree ours theirs merge quiet overlay no-overlay",
|
|
9824
|
-
reset: "+qN|soft mixed hard merge keep quiet no-refresh",
|
|
9825
|
-
rm: "+rfnq|cached force dry-run quiet ignore-unmatch",
|
|
9826
|
-
mv: "+fnkv|force dry-run verbose",
|
|
9827
|
-
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=",
|
|
9828
|
-
stash: "+m:ukqa|message= include-untracked keep-index quiet all index staged",
|
|
9829
|
-
apply: "+p:C:R3qv|check stat numstat summary index cached 3way reverse reject allow-empty exclude= include= verbose quiet whitespace= recount",
|
|
9830
|
-
am: "+skq3|signoff keep 3way quiet abort continue skip quit whitespace= reject",
|
|
9831
|
-
fetch: "+fqvptn|all depth= deepen= shallow-since= unshallow tags no-tags prune force quiet verbose dry-run update-shallow refmap=",
|
|
9832
|
-
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=",
|
|
9833
|
-
"cherry-pick": "+nm:sxX:|no-commit mainline= signoff abort continue skip quit allow-empty keep-redundant-commits ff strategy-option=",
|
|
9834
|
-
revert: "+nm:sX:|no-commit mainline= signoff abort continue skip quit strategy-option= no-edit",
|
|
9835
|
-
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",
|
|
9836
|
-
clean: "+dfnqxXe:|dry-run force quiet exclude=",
|
|
9837
|
-
bisect: "+|term-old= term-new= no-checkout first-parent"
|
|
9838
|
-
};
|
|
9839
|
-
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`;
|
|
9840
|
-
var JUDGE_VERBS = {
|
|
9841
|
-
check: true,
|
|
9842
|
-
dir: true,
|
|
9843
|
-
help: true,
|
|
9844
|
-
"test-audit": true,
|
|
9845
|
-
ledger: ["verdict", "list", "check", "ruling", "show"],
|
|
9846
|
-
finding: ["record", "list"],
|
|
9847
|
-
pr: ["status"],
|
|
9848
|
-
ci: ["wait", "logs"],
|
|
9849
|
-
fanout: ["status", "brief"],
|
|
9850
|
-
models: ["show"],
|
|
9851
|
-
lock: ["status"],
|
|
9852
|
-
lease: ["status"],
|
|
9853
|
-
grant: ["show"],
|
|
9854
|
-
task: ["show", "list"],
|
|
9855
|
-
doctor: ["--json"]
|
|
9856
|
-
};
|
|
9857
|
-
var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
|
|
9858
9786
|
|
|
9859
9787
|
// packages/workit-core/src/hooks/steering.ts
|
|
9860
9788
|
var ROLES = {
|
package/dist/workit.js
CHANGED
|
@@ -20151,7 +20151,7 @@ function workitCheckTail(words) {
|
|
|
20151
20151
|
} else if (!/^workit(?:\.exe|\.cmd)?$/.test(commandName(words[0])))
|
|
20152
20152
|
return null;
|
|
20153
20153
|
const { rest: args, cwd } = skipWorkitGlobals(words.slice(at + 1));
|
|
20154
|
-
if (args[0] !== "check" && !(args[0] === "lock" && args[1] === "run"))
|
|
20154
|
+
if (args[0] !== "check" && args[0] !== "run" && !(args[0] === "lock" && args[1] === "run"))
|
|
20155
20155
|
return null;
|
|
20156
20156
|
const split = args.indexOf("--");
|
|
20157
20157
|
const tail = split < 0 ? [] : args.slice(split + 1);
|
|
@@ -24894,7 +24894,9 @@ var WORKIT_ALLOWED_VERBS = [
|
|
|
24894
24894
|
"verify-delivery",
|
|
24895
24895
|
"policy",
|
|
24896
24896
|
"doctor",
|
|
24897
|
-
"help"
|
|
24897
|
+
"help",
|
|
24898
|
+
"ps",
|
|
24899
|
+
"stop"
|
|
24898
24900
|
];
|
|
24899
24901
|
var WORKIT_BYPASS_FLAGS = ["--unverified", "--overwrite-unintegrated"];
|
|
24900
24902
|
var WORKIT_USER_ONLY = [
|
|
@@ -25568,6 +25570,95 @@ function builtIn(words, depth = 0) {
|
|
|
25568
25570
|
const command = words.slice(1).find((word) => !word.startsWith("-") && !word.startsWith("+") || rule.has(word));
|
|
25569
25571
|
return command !== undefined && rule.has(command) ? label() : null;
|
|
25570
25572
|
}
|
|
25573
|
+
var SERVER_SCRIPT = /(?:^|[:_.-])(?:dev|serve|start|storybook)(?:$|[:_.-])/iu;
|
|
25574
|
+
var serverScript = (script = "") => SERVER_SCRIPT.test(script) && !HEAVY_SCRIPT.test(script);
|
|
25575
|
+
var NUXT = sub("dev", "preview", "start");
|
|
25576
|
+
var WEBPACK = sub("serve", "s", "server");
|
|
25577
|
+
var SERVER_TOOLS = {
|
|
25578
|
+
ng: sub("serve", "s"),
|
|
25579
|
+
next: sub("dev", "start"),
|
|
25580
|
+
nuxt: NUXT,
|
|
25581
|
+
nuxi: NUXT,
|
|
25582
|
+
astro: sub("dev", "preview"),
|
|
25583
|
+
"react-scripts": sub("start"),
|
|
25584
|
+
webpack: WEBPACK,
|
|
25585
|
+
"webpack-cli": WEBPACK,
|
|
25586
|
+
storybook: sub("dev", "start"),
|
|
25587
|
+
rails: sub("server", "s"),
|
|
25588
|
+
mix: sub("phx.server")
|
|
25589
|
+
};
|
|
25590
|
+
var COMPOSE_VALUES = new Set([
|
|
25591
|
+
"-f",
|
|
25592
|
+
"--file",
|
|
25593
|
+
"-p",
|
|
25594
|
+
"-H",
|
|
25595
|
+
"--host",
|
|
25596
|
+
"--context",
|
|
25597
|
+
"-c",
|
|
25598
|
+
"--config"
|
|
25599
|
+
]);
|
|
25600
|
+
function serverBuiltIn(words, depth = 0) {
|
|
25601
|
+
const name = baseName2(words[0]);
|
|
25602
|
+
if (depth > 6 || WORKIT.test(name) || words.some((word) => /^(?:-h|--help|--version)$/u.test(word)))
|
|
25603
|
+
return null;
|
|
25604
|
+
const compose = /^(?:docker|podman|nerdctl|docker-compose)$/u.test(name);
|
|
25605
|
+
const at = positional2(words, 1, compose ? COMPOSE_VALUES : PM_VALUES);
|
|
25606
|
+
const command = words[at];
|
|
25607
|
+
const yes = words.slice(0, 3).join(" ");
|
|
25608
|
+
const inner = (from) => serverBuiltIn(words.slice(from), depth + 1);
|
|
25609
|
+
const up = (from) => words[from] === "up" && !words.some((word) => /^(?:-d|--detach|--wait)$/u.test(word));
|
|
25610
|
+
if (name === "npx" || name === "bunx" || name === "pnpx")
|
|
25611
|
+
return inner(at);
|
|
25612
|
+
if (name === "corepack")
|
|
25613
|
+
return inner(1);
|
|
25614
|
+
if (command === undefined)
|
|
25615
|
+
return name === "vite" ? yes : null;
|
|
25616
|
+
if (name === "npm" || name === "pnpm" || name === "yarn" || name === "bun" || name === "deno") {
|
|
25617
|
+
if (EXEC.has(command))
|
|
25618
|
+
return inner(positional2(words, at + 1));
|
|
25619
|
+
if (command === "start")
|
|
25620
|
+
return yes;
|
|
25621
|
+
if (name === "yarn" && command === "workspace")
|
|
25622
|
+
return serverScript(words[at + 2]) ? yes : inner(at + 2);
|
|
25623
|
+
if (NPM_RUN.has(command) || name === "deno" && command === "task") {
|
|
25624
|
+
if (serverScript(words[positional2(words, at + 1)]))
|
|
25625
|
+
return yes;
|
|
25626
|
+
return name === "bun" && command !== "task" ? inner(positional2(words, at + 1)) : null;
|
|
25627
|
+
}
|
|
25628
|
+
if (name === "npm" || name === "deno")
|
|
25629
|
+
return null;
|
|
25630
|
+
return serverScript(command) ? yes : inner(at);
|
|
25631
|
+
}
|
|
25632
|
+
if (PYTHONS.test(name)) {
|
|
25633
|
+
const m = words.indexOf("-m");
|
|
25634
|
+
if (words[m + 1] === "http.server" || command.endsWith("manage.py")) {
|
|
25635
|
+
return m > 0 || words[at + 1] === "runserver" ? yes : null;
|
|
25636
|
+
}
|
|
25637
|
+
return m > 0 && words[m + 1] ? inner(m + 1) : null;
|
|
25638
|
+
}
|
|
25639
|
+
if (["uv", "poetry", "pdm", "pipenv", "hatch", "rye", "bundle"].includes(name))
|
|
25640
|
+
return command === "run" || command === "exec" ? inner(positional2(words, at + 1)) : null;
|
|
25641
|
+
if (name === "make" || name === "gmake")
|
|
25642
|
+
return words.slice(1).some((word) => !/^-|=/u.test(word) && serverScript(word)) ? yes : null;
|
|
25643
|
+
if (name === "nx")
|
|
25644
|
+
return serverScript(command === "run" ? words[at + 1]?.split(":")[1] : command) ? yes : null;
|
|
25645
|
+
if (name === "docker-compose")
|
|
25646
|
+
return up(at) ? yes : null;
|
|
25647
|
+
if (compose)
|
|
25648
|
+
return command === "compose" && up(positional2(words, at + 1, COMPOSE_VALUES)) ? yes : null;
|
|
25649
|
+
if (name === "vite")
|
|
25650
|
+
return command === "build" || command === "optimize" ? null : yes;
|
|
25651
|
+
const rule = SERVER_TOOLS[name];
|
|
25652
|
+
return rule && rule !== "any" && rule.has(command) ? yes : null;
|
|
25653
|
+
}
|
|
25654
|
+
function serverCommand(command, dialect = "posix") {
|
|
25655
|
+
for (const line of linesOf(command, dialect) ?? []) {
|
|
25656
|
+
const reason = serverBuiltIn(line);
|
|
25657
|
+
if (reason)
|
|
25658
|
+
return { line, reason };
|
|
25659
|
+
}
|
|
25660
|
+
return null;
|
|
25661
|
+
}
|
|
25571
25662
|
var globWord = (word) => new RegExp(`^${word.replace(/[.+?^${}()|[\]\\]/gu, "\\$&").replaceAll("*", ".*")}$`, "u");
|
|
25572
25663
|
function parsePattern(pattern) {
|
|
25573
25664
|
const words = pattern.trim().split(/\s+/u).filter(Boolean);
|
|
@@ -25664,6 +25755,28 @@ function heavyPlan(command, options) {
|
|
|
25664
25755
|
unblock: parts[0] ?? null
|
|
25665
25756
|
};
|
|
25666
25757
|
}
|
|
25758
|
+
function serverPlan(command, options) {
|
|
25759
|
+
const dialect = options.dialect ?? "posix";
|
|
25760
|
+
if (dialect !== "posix" || !gitTop(options.cwd))
|
|
25761
|
+
return { kind: "none" };
|
|
25762
|
+
const found = serverCommand(command, dialect);
|
|
25763
|
+
if (!found)
|
|
25764
|
+
return { kind: "none" };
|
|
25765
|
+
const simple = simpleCommand(command, dialect, 0, true);
|
|
25766
|
+
const single = simple && serverBuiltIn(simple);
|
|
25767
|
+
if (options.rules !== null && !wrapAllowed(options.rules, single ? (linesOf(command, dialect) ?? []).flat() : found.line, single ? command : found.line.join(" "), options).ok)
|
|
25768
|
+
return { kind: "passthrough", note: "" };
|
|
25769
|
+
if (single) {
|
|
25770
|
+
const rewrite = leaseRewrite(command)?.replace("workit check --heavy --", "workit run --bg --");
|
|
25771
|
+
return rewrite ? { kind: "rewrite", command: rewrite, reason: single, server: true } : { kind: "none" };
|
|
25772
|
+
}
|
|
25773
|
+
const start = `workit run --bg -- ${found.line.map(quoteWord).join(" ")}`;
|
|
25774
|
+
return {
|
|
25775
|
+
kind: "split",
|
|
25776
|
+
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.`,
|
|
25777
|
+
unblock: start
|
|
25778
|
+
};
|
|
25779
|
+
}
|
|
25667
25780
|
function workitOnPath2(env = process.env) {
|
|
25668
25781
|
const names = process.platform === "win32" ? ["workit.exe", "workit.cmd", "workit"] : ["workit"];
|
|
25669
25782
|
for (const dir of (env.PATH ?? "").split(path38.delimiter))
|
|
@@ -25761,21 +25874,26 @@ function heavyGate(cwd, command, options) {
|
|
|
25761
25874
|
const single = dialect === "posix" ? simpleCommand(command, dialect, 0, true) : null;
|
|
25762
25875
|
if (single && lightCommand(single, cwd))
|
|
25763
25876
|
return { kind: "none" };
|
|
25764
|
-
|
|
25877
|
+
const plan = {
|
|
25765
25878
|
cwd,
|
|
25766
25879
|
env,
|
|
25767
25880
|
dialect,
|
|
25768
25881
|
rules: rulesFor(options.host, cwd, env),
|
|
25769
25882
|
bypass: options.permissionMode === "bypassPermissions"
|
|
25770
|
-
}
|
|
25883
|
+
};
|
|
25884
|
+
const server = serverPlan(command, plan);
|
|
25885
|
+
if (server.kind === "rewrite")
|
|
25886
|
+
return server;
|
|
25887
|
+
const heavy = heavyPlan(command, plan);
|
|
25888
|
+
return heavy.kind === "none" ? server : heavy;
|
|
25771
25889
|
} catch {
|
|
25772
25890
|
return { kind: "none" };
|
|
25773
25891
|
}
|
|
25774
25892
|
}
|
|
25775
|
-
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.`;
|
|
25893
|
+
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.`;
|
|
25776
25894
|
var heavyDenial = (original, plan) => ({
|
|
25777
25895
|
kind: "deny",
|
|
25778
|
-
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}`,
|
|
25896
|
+
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}`,
|
|
25779
25897
|
unblock: plan.command
|
|
25780
25898
|
});
|
|
25781
25899
|
var splitDenial = (plan) => ({
|
|
@@ -26321,8 +26439,10 @@ var opaqueWrites = (input, scriptOf = (index) => input[index], fed) => {
|
|
|
26321
26439
|
return curlOutputs(args);
|
|
26322
26440
|
if (name === "perl")
|
|
26323
26441
|
return inline(/^-[a-zA-Z]*[eE]$/);
|
|
26442
|
+
if (name.startsWith("python") && args.some((arg, at) => arg === "-m" && args[at + 1] !== "json.tool"))
|
|
26443
|
+
return [".", ...args.flatMap(pathsIn)];
|
|
26324
26444
|
if (/^(?:python[\d.]*|node|bun|deno|ruby|php)$/.test(name))
|
|
26325
|
-
return inline(/^-[a-zA-Z]*[
|
|
26445
|
+
return inline(/^-[a-zA-Z]*[cep]$|^--(?:eval|print)$/);
|
|
26326
26446
|
return shellScript2(words) === null ? null : ["."];
|
|
26327
26447
|
};
|
|
26328
26448
|
var CURL_LONG = [
|
|
@@ -27055,7 +27175,7 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
|
|
|
27055
27175
|
shells.push(...read(named));
|
|
27056
27176
|
shells.push(...preloads.flatMap(read));
|
|
27057
27177
|
} else if (INTERPRETERS.test(verb)) {
|
|
27058
|
-
const code = args.findIndex((arg) => /^-[a-zA-Z]*[
|
|
27178
|
+
const code = args.findIndex((arg) => /^-[a-zA-Z]*[cep]$|^--(?:eval|print)$/.test(arg));
|
|
27059
27179
|
if (code >= 0)
|
|
27060
27180
|
others.push(...expansions(args[code + 1] ?? "", vars, loops));
|
|
27061
27181
|
others.push(...named === undefined ? [...segment.stdin ?? [], ...inputs.flatMap(read), ...piped] : read(named), ...preloads.flatMap(read));
|
|
@@ -29053,50 +29173,38 @@ var shown = (target) => {
|
|
|
29053
29173
|
const named = /^\.workit-(?:live-target$|runs-)/.test(path47.basename(target)) ? path47.dirname(target) : target;
|
|
29054
29174
|
return path47.sep === "\\" ? named.replaceAll("/", "\\") : named;
|
|
29055
29175
|
};
|
|
29056
|
-
var
|
|
29057
|
-
|
|
29058
|
-
|
|
29059
|
-
|
|
29060
|
-
|
|
29061
|
-
|
|
29062
|
-
|
|
29063
|
-
};
|
|
29064
|
-
var outsideDeny = (input, worktree, target) => {
|
|
29176
|
+
var runFrom = (dir, command) => `cd ${dir} && ${command.replace(/^\s*cd\s+\S+\s*(?:&&|;)\s*/, "")}`;
|
|
29177
|
+
var deny2 = (what, unblock) => ({
|
|
29178
|
+
kind: "deny",
|
|
29179
|
+
reason: `${what}.
|
|
29180
|
+
${unblock}`,
|
|
29181
|
+
unblock
|
|
29182
|
+
});
|
|
29183
|
+
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.");
|
|
29184
|
+
var outsideDeny = (input, worktree, target, command) => {
|
|
29065
29185
|
const runner = runnerAt(target);
|
|
29066
|
-
|
|
29067
|
-
return {
|
|
29068
|
-
kind: "deny",
|
|
29069
|
-
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}`,
|
|
29070
|
-
unblock
|
|
29071
|
-
};
|
|
29072
|
-
};
|
|
29073
|
-
var unknownDirDeny = (input, worktree) => {
|
|
29074
|
-
const wt = worktree ?? "<worktree>";
|
|
29075
|
-
const unblock = `Workit cannot resolve \`cd -\`, \`cd "$X"\` or \`popd\`: write by absolute path, \`git -C ${wt}\` or \`workit <verb> --cwd ${wt}\`.`;
|
|
29076
|
-
return {
|
|
29077
|
-
kind: "deny",
|
|
29078
|
-
reason: `workit worktree confinement: implementer ${input.session.agentId} writes after an unknown directory change. ${unblock}`,
|
|
29079
|
-
unblock
|
|
29080
|
-
};
|
|
29186
|
+
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.`);
|
|
29081
29187
|
};
|
|
29188
|
+
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\`.`);
|
|
29189
|
+
var refsOf = (targets) => [
|
|
29190
|
+
...new Set(targets.flatMap((target) => path47.relative(UNKNOWN_VAR, path47.resolve(target)).split(path47.sep)[0].split("+").filter(Boolean).map(decodeURIComponent)))
|
|
29191
|
+
];
|
|
29082
29192
|
var literalForm = (command, refs) => {
|
|
29083
29193
|
let text = command;
|
|
29084
|
-
for (const ref of refs) {
|
|
29194
|
+
for (const ref of refs.filter((one) => /^[$`]/.test(one))) {
|
|
29085
29195
|
const placeholder = `<absolute path of ${ref}>`;
|
|
29086
29196
|
const name = /^\$(\w+)$/.exec(ref)?.[1];
|
|
29087
29197
|
text = name ? text.replace(new RegExp(`\\$\\{${name}[^}]*\\}|\\$${name}(?!\\w)`, "g"), placeholder) : text.replaceAll(ref, placeholder);
|
|
29088
29198
|
}
|
|
29089
29199
|
return text.length > 600 ? `${text.slice(0, 600)}…` : text;
|
|
29090
29200
|
};
|
|
29091
|
-
var unknownVarDeny = (input,
|
|
29092
|
-
const refs =
|
|
29093
|
-
...new Set(targets.flatMap((target) => path47.relative(UNKNOWN_VAR, path47.resolve(target)).split(path47.sep)[0].split("+").filter(Boolean).map(decodeURIComponent)))
|
|
29094
|
-
];
|
|
29201
|
+
var unknownVarDeny = (input, targets, command) => {
|
|
29202
|
+
const refs = refsOf(targets);
|
|
29095
29203
|
let text = command ?? "";
|
|
29096
29204
|
const first = [];
|
|
29097
29205
|
const named = refs.map((ref) => {
|
|
29098
29206
|
const name = /^\$(\w+)$/.exec(ref)?.[1];
|
|
29099
|
-
const set = name ? new RegExp(`(^|[\\s;&|(])${name}=("?)(\\$\\([^()]*\\)|\`[^\`]*\`)\\2[ \\t]*(?:&&|;|\\n)
|
|
29207
|
+
const set = name ? new RegExp(`(^|[\\s;&|(])${name}=("?)(\\$\\([^()]*\\)|\`[^\`]*\`)\\2[ \\t]*(?:&&|;|\\n|$)[ \\t]*`).exec(text) : null;
|
|
29100
29208
|
const sub = set?.[3] ?? (/^(?:\$\(|`)/.test(ref) ? ref : null);
|
|
29101
29209
|
if (sub === null)
|
|
29102
29210
|
return ref;
|
|
@@ -29105,15 +29213,8 @@ var unknownVarDeny = (input, worktree, targets, command) => {
|
|
|
29105
29213
|
first.push(`Run \`${sub.slice(sub.startsWith("`") ? 1 : 2, -1).trim()}\` first, then`);
|
|
29106
29214
|
return sub === ref ? ref : `${ref} (set by \`${sub}\`)`;
|
|
29107
29215
|
});
|
|
29108
|
-
const
|
|
29109
|
-
|
|
29110
|
-
const retry = command === undefined || literal === command ? "" : ` ${first.length ? `${first.join(" ")} retry` : "Retry"} as: \`${literal}\`.`;
|
|
29111
|
-
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.`;
|
|
29112
|
-
return {
|
|
29113
|
-
kind: "deny",
|
|
29114
|
-
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}`,
|
|
29115
|
-
unblock
|
|
29116
|
-
};
|
|
29216
|
+
const literal = literalForm(text, refs);
|
|
29217
|
+
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}`);
|
|
29117
29218
|
};
|
|
29118
29219
|
function confineImplementer(input, targets, command) {
|
|
29119
29220
|
try {
|
|
@@ -29121,7 +29222,7 @@ function confineImplementer(input, targets, command) {
|
|
|
29121
29222
|
return NONE5;
|
|
29122
29223
|
const unresolved = targets.filter((target) => within(path47.resolve(target), UNKNOWN_VAR));
|
|
29123
29224
|
if (unresolved.length > 0)
|
|
29124
|
-
return unknownVarDeny(input,
|
|
29225
|
+
return unknownVarDeny(input, unresolved, command);
|
|
29125
29226
|
if (targets.some((target) => within(path47.resolve(target), UNKNOWN_DIR)))
|
|
29126
29227
|
return unknownDirDeny(input, boundWorktree(input));
|
|
29127
29228
|
const bindings = canonical5(bindingDir());
|
|
@@ -29141,7 +29242,7 @@ function confineImplementer(input, targets, command) {
|
|
|
29141
29242
|
}
|
|
29142
29243
|
const root = canonical5(worktree);
|
|
29143
29244
|
const outside = judged.find(({ real }) => !within(real, root) || within(real, bindings));
|
|
29144
|
-
return outside ? outsideDeny(input, worktree, outside.named) : NONE5;
|
|
29245
|
+
return outside ? outsideDeny(input, worktree, outside.named, command) : NONE5;
|
|
29145
29246
|
} catch {
|
|
29146
29247
|
return NONE5;
|
|
29147
29248
|
}
|
|
@@ -29206,14 +29307,7 @@ var leadOwnedWorkit = (args) => !args.includes("--help") && args.some((_, start)
|
|
|
29206
29307
|
const [verb, sub] = skipWorkitGlobals(args.slice(start)).rest;
|
|
29207
29308
|
return verb === "fanout" && /^(?:plan|worktree)$/.test(sub ?? "");
|
|
29208
29309
|
});
|
|
29209
|
-
var leadOwnedDeny = (input, command) => {
|
|
29210
|
-
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.";
|
|
29211
|
-
return {
|
|
29212
|
-
kind: "deny",
|
|
29213
|
-
reason: `workit worktree confinement: implementer ${input.session.agentId} may not run \`${command.slice(0, 160)}\`. ${unblock}`,
|
|
29214
|
-
unblock
|
|
29215
|
-
};
|
|
29216
|
-
};
|
|
29310
|
+
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.");
|
|
29217
29311
|
function confineImplementerShell(input, command, dialect = "posix") {
|
|
29218
29312
|
try {
|
|
29219
29313
|
if (!input.session.agentId || hostIsolated(input.cwd, input.session.agentId))
|
|
@@ -29223,6 +29317,9 @@ function confineImplementerShell(input, command, dialect = "posix") {
|
|
|
29223
29317
|
} catch {}
|
|
29224
29318
|
return confineImplementer(input, shellMutationTargets(input.cwd, command, dialect, true), command);
|
|
29225
29319
|
}
|
|
29320
|
+
var LITERAL_SET = /^\s*([A-Za-z_]\w*)=(['"]?)((?:[\w@%+=:./\\-]|(?<=[^\s:=])~)*)\2[ \t]*(?:;|&&|\n)\s*/;
|
|
29321
|
+
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)$/;
|
|
29322
|
+
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)$)/;
|
|
29226
29323
|
var SCRATCH = ".workit-scratch";
|
|
29227
29324
|
var SHELL_NAMES = /^(?:sh|bash|zsh|dash|ksh|mksh|ash)$/;
|
|
29228
29325
|
var INTERPRETERS2 = /^(?:python[\d.]*|node|bun|deno|ruby|perl|php)$/;
|
|
@@ -29340,7 +29437,8 @@ var GIT_VERBS = {
|
|
|
29340
29437
|
var: "l|",
|
|
29341
29438
|
version: "|build-options",
|
|
29342
29439
|
"ls-remote": "htbq|heads tags branches refs quiet exit-code get-url symref sort=",
|
|
29343
|
-
remote: "v|verbose",
|
|
29440
|
+
remote: "v|verbose push all",
|
|
29441
|
+
"range-diff": "@d|@d creation-factor= no-dual-color left-only right-only",
|
|
29344
29442
|
config: "lz|get get-all get-regexp list local name-only null type= default=",
|
|
29345
29443
|
worktree: "fdqvzb:B:|force detach lock reason= orphan no-checkout checkout quiet track no-track guess-remote porcelain expire= verbose",
|
|
29346
29444
|
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",
|
|
@@ -29426,7 +29524,7 @@ var gitKind = (args, local = () => true) => {
|
|
|
29426
29524
|
case "worktree":
|
|
29427
29525
|
return first === "list" ? "read" : /^(?:add|remove)$/.test(first) ? "write" : null;
|
|
29428
29526
|
case "remote":
|
|
29429
|
-
return !first || first === "show" && named.length === 2 && local(second, true) ? "read" : null;
|
|
29527
|
+
return !first || first === "get-url" || first === "show" && named.length === 2 && local(second, true) ? "read" : null;
|
|
29430
29528
|
case "ls-remote":
|
|
29431
29529
|
return local(first || "origin", true) ? "read" : null;
|
|
29432
29530
|
case "bisect":
|
|
@@ -29443,7 +29541,6 @@ var gitKind = (args, local = () => true) => {
|
|
|
29443
29541
|
}
|
|
29444
29542
|
return GIT_VERBS[verb].startsWith("+") ? "write" : "read";
|
|
29445
29543
|
};
|
|
29446
|
-
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`;
|
|
29447
29544
|
var remoteIn = (dir, name, repo) => {
|
|
29448
29545
|
const shared = path47.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo, false)?.[1] : undefined;
|
|
29449
29546
|
if (!shared)
|
|
@@ -29486,14 +29583,12 @@ var judgeGit = (command, repo, cwd, depth = 0) => {
|
|
|
29486
29583
|
why ??= `\`${word}\` is not allowed`;
|
|
29487
29584
|
let index = start < 0 ? words.length : start + 1;
|
|
29488
29585
|
let dir = "";
|
|
29489
|
-
let unlocked = lead.includes("GIT_OPTIONAL_LOCKS=0");
|
|
29490
29586
|
for (;!why && words[index]?.startsWith("-") && words[index] !== "--version"; index++) {
|
|
29491
29587
|
const word = words[index];
|
|
29492
29588
|
const flag = /^--(git-dir|work-tree)(?:=([\s\S]*))?$/.exec(word);
|
|
29493
29589
|
const value = flag?.[2] ?? (/^(?:-C|--git-dir|--work-tree)$/.test(word) ? words[++index] : "");
|
|
29494
29590
|
if (word === "-C")
|
|
29495
29591
|
dir = value;
|
|
29496
|
-
unlocked ||= word === "--no-optional-locks";
|
|
29497
29592
|
if (flag ? !literalIn(value, repo) : !/^(?:-C|-P|--no-pager|--no-optional-locks)$/.test(word))
|
|
29498
29593
|
why = `\`${word}\` is not allowed`;
|
|
29499
29594
|
}
|
|
@@ -29505,11 +29600,6 @@ var judgeGit = (command, repo, cwd, depth = 0) => {
|
|
|
29505
29600
|
const fetches = args[0] === "fetch" && plainFetch(args.slice(1)) && home && (home.workit || commonDir(home.root) === repo) && !words.some((word) => /^--[gw]/.test(word));
|
|
29506
29601
|
if (!fetches && !gitKind(args, local))
|
|
29507
29602
|
why = `\`git ${args.slice(0, 2).join(" ")}\` is not allowed`;
|
|
29508
|
-
else if (args[0] === "status" && !unlocked) {
|
|
29509
|
-
const dirs = path47.isAbsolute(dir) ? gitDirsAt(canonical5(dir), repo) : null;
|
|
29510
|
-
if (!dirs?.length || !dirs.every((gitDir) => inScratch(gitDir, repo)))
|
|
29511
|
-
why = "`git status` refreshes the index outside scratch: add --no-optional-locks";
|
|
29512
|
-
}
|
|
29513
29603
|
}
|
|
29514
29604
|
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)));
|
|
29515
29605
|
const scripts = [
|
|
@@ -29575,7 +29665,6 @@ var workitCalls = (command, depth = 0, aliases = new Map) => depth > 4 ? [] : co
|
|
|
29575
29665
|
at++;
|
|
29576
29666
|
return [words.slice(at + 1)];
|
|
29577
29667
|
});
|
|
29578
|
-
var JUDGE_JOB = Object.entries(JUDGE_VERBS).map(([verb, subs]) => `workit ${verb}${subs === true ? "" : ` ${subs.join("|")}`}`).join(", ");
|
|
29579
29668
|
var judgeRefusal = (command, fed, depth = 0) => {
|
|
29580
29669
|
let moved = false;
|
|
29581
29670
|
for (const segment of segmentsOf(command)) {
|
|
@@ -29597,6 +29686,9 @@ var judgeRefusal = (command, fed, depth = 0) => {
|
|
|
29597
29686
|
moved = true;
|
|
29598
29687
|
if (name === "eval" || (name === "source" || name === ".") && FED.test(args[0] ?? ""))
|
|
29599
29688
|
return unseen;
|
|
29689
|
+
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));
|
|
29690
|
+
if (set)
|
|
29691
|
+
return `\`${set.slice(0, 80)}\` sets a loader or shell-set name`;
|
|
29600
29692
|
if (SHELL_NAMES.test(name)) {
|
|
29601
29693
|
let operand;
|
|
29602
29694
|
let stdin = false;
|
|
@@ -29643,7 +29735,7 @@ var judgeRefusal = (command, fed, depth = 0) => {
|
|
|
29643
29735
|
for (const args of workitCalls(command)) {
|
|
29644
29736
|
const call = judgeVerbRefused(args);
|
|
29645
29737
|
if (call)
|
|
29646
|
-
return `\`${call}\` is not a judge's job: a judge runs only
|
|
29738
|
+
return `\`${call}\` is not a judge's job: a judge runs only read-only workit verbs`;
|
|
29647
29739
|
}
|
|
29648
29740
|
return null;
|
|
29649
29741
|
};
|
|
@@ -29665,20 +29757,31 @@ var substitutingHeredoc = (command) => {
|
|
|
29665
29757
|
}
|
|
29666
29758
|
return false;
|
|
29667
29759
|
};
|
|
29668
|
-
var judgeDeny = (input, what, target) => {
|
|
29760
|
+
var judgeDeny = (input, what, target, retry) => {
|
|
29669
29761
|
const role = input.session.agentType?.endsWith("reviewer") ? "reviewer" : "verifier";
|
|
29670
29762
|
const root = checkoutOf2(input.cwd)?.root;
|
|
29671
29763
|
const candidate = target ? checkoutOf2(target)?.root : undefined;
|
|
29672
|
-
const
|
|
29673
|
-
const scratch = root ? `${path47.join(root, SCRATCH)}${
|
|
29674
|
-
const
|
|
29764
|
+
const other = root && candidate && candidate !== root && commonDir(candidate) === commonDir(root) ? path47.join(candidate, SCRATCH) : undefined;
|
|
29765
|
+
const scratch = root ? `${path47.join(root, SCRATCH)}${other ? ` or ${other}` : ""}` : `${SCRATCH}/ at the root of the checkout you judge`;
|
|
29766
|
+
const call = root ? retry?.((other ?? path47.join(root, SCRATCH)).replaceAll("\\", "/")) : null;
|
|
29767
|
+
const unblock = call ? `Retry as: ${call}` : "Why: write only there (mkdir -p it); a fix the candidate needs is a finding (`workit finding record`).";
|
|
29675
29768
|
return {
|
|
29676
29769
|
kind: "deny",
|
|
29677
|
-
reason: `workit scratch confinement: ${role} ${input.session.agentId} may write only in its scratch dir ${scratch}, and ${what}.
|
|
29770
|
+
reason: `workit scratch confinement: ${role} ${input.session.agentId} may write only in its scratch dir ${scratch}, and ${what}.
|
|
29771
|
+
${unblock}`,
|
|
29678
29772
|
unblock
|
|
29679
29773
|
};
|
|
29680
29774
|
};
|
|
29681
|
-
|
|
29775
|
+
var movedInto = (command, cwd, target, dir) => {
|
|
29776
|
+
for (const { words, redirects } of segmentsOf(command))
|
|
29777
|
+
for (const word of [...redirects, ...path47.basename(words[0] ?? "") === "tee" ? words : []])
|
|
29778
|
+
if (path47.resolve(cwd, word) === path47.resolve(cwd, target)) {
|
|
29779
|
+
const moved = command.replace(new RegExp(`((?:>>?\\|?|\\btee(?:\\s+-a)?)\\s*)(['"]?)${word.replace(/[$()*+.?[\\\]^{|}]/g, "\\$&")}\\2(?![^\\s;&|)])`), (_, lead) => `${lead}${dir}/${path47.basename(word)}`);
|
|
29780
|
+
return moved === command ? null : moved;
|
|
29781
|
+
}
|
|
29782
|
+
return null;
|
|
29783
|
+
};
|
|
29784
|
+
function confineJudge(input, targets, placeholders = placeholdersOf(targets), command) {
|
|
29682
29785
|
try {
|
|
29683
29786
|
if (!input.session.agentId)
|
|
29684
29787
|
return NONE5;
|
|
@@ -29691,7 +29794,10 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
|
|
|
29691
29794
|
for (const target of targets) {
|
|
29692
29795
|
const resolved = path47.resolve(target);
|
|
29693
29796
|
if (within(resolved, UNKNOWN_VAR) || within(resolved, UNKNOWN_DIR))
|
|
29694
|
-
return judgeDeny(input, "it writes to a path Workit cannot resolve
|
|
29797
|
+
return judgeDeny(input, "it writes to a path Workit cannot resolve", undefined, () => {
|
|
29798
|
+
const literal = command && literalForm(command, refsOf([target]));
|
|
29799
|
+
return literal === command ? null : literal;
|
|
29800
|
+
});
|
|
29695
29801
|
const real = canonical5(target);
|
|
29696
29802
|
const runsGit = placeholders.has(target) && /^\.workit-(?:runs-git|live-target)$/.test(path47.basename(target));
|
|
29697
29803
|
const gitDirs = runsGit ? gitDirsAt(path47.dirname(real), repo) : [];
|
|
@@ -29700,17 +29806,43 @@ function confineJudge(input, targets, placeholders = placeholdersOf(targets)) {
|
|
|
29700
29806
|
if (runsGit ? gitDirs.length > 0 ? gitDirs.every(scratch) : scratch(real) : scratch(real) && !inGitDir(real))
|
|
29701
29807
|
continue;
|
|
29702
29808
|
const runner = runnerAt(target);
|
|
29703
|
-
return judgeDeny(input, runner === null ? `${shown(target)} is outside it` : `\`${runner}\` runs in ${shown(target)}, outside it`, target);
|
|
29809
|
+
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));
|
|
29704
29810
|
}
|
|
29705
29811
|
return NONE5;
|
|
29706
29812
|
} catch {
|
|
29707
29813
|
return NONE5;
|
|
29708
29814
|
}
|
|
29709
29815
|
}
|
|
29816
|
+
var spelledIn = (text, name, value) => text.replace(new RegExp(`\\$(?:${name}(?!\\w)|\\{${name}\\})`, "g"), () => value);
|
|
29817
|
+
var variableRefusal = (command) => {
|
|
29818
|
+
let rest = command;
|
|
29819
|
+
const sets = [];
|
|
29820
|
+
for (let set;set = LITERAL_SET.exec(rest); rest = rest.slice(set[0].length))
|
|
29821
|
+
sets.push([set[1], set[3]]);
|
|
29822
|
+
const loop = /^\s*for\s+(\w+)\s+in\s+([\w@%+=:./ \t-]*?)\s*[;\n]\s*do\s([\s\S]*?);?\s*done\s*$/.exec(rest);
|
|
29823
|
+
for (const name of [...sets.map(([one]) => one), ...loop ? [loop[1]] : []])
|
|
29824
|
+
if (new RegExp(`\\$(?:${name}(?!\\w)|\\{${name}(?![\\w}])|\\{${name}\\})(?![\\s/";&|)]|$)`).test(rest))
|
|
29825
|
+
return { why: `\`$${name}\` has a modifier, subscript or suffix Workit does not spell in` };
|
|
29826
|
+
const odd = [...sets.map(([one]) => one), ...loop ? [loop[1]] : []].find((name) => !SPELLED.test(name) || process.env[name] !== undefined || ENV_READ.test(name));
|
|
29827
|
+
const used = sets.filter(([name]) => name === odd || new RegExp(`\\$\\{?${name}(?!\\w)`).test(rest));
|
|
29828
|
+
if (used.length)
|
|
29829
|
+
return {
|
|
29830
|
+
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`,
|
|
29831
|
+
retry: used.reduce((text, [name, value]) => spelledIn(text, name, value), rest)
|
|
29832
|
+
};
|
|
29833
|
+
const items = loop?.[2].split(/\s+/).filter(Boolean) ?? [];
|
|
29834
|
+
return loop && (loop[1] === odd || new RegExp(`\\$\\{?${loop[1]}(?!\\w)`).test(loop[3])) ? {
|
|
29835
|
+
why: `\`$${loop[1]}\` is a loop variable, which Workit does not follow for a judge`,
|
|
29836
|
+
retry: items.length > 16 ? undefined : items.map((item) => spelledIn(loop[3].trim(), loop[1], item)).join("; ")
|
|
29837
|
+
} : null;
|
|
29838
|
+
};
|
|
29710
29839
|
function confineJudgeShell(input, command, dialect = "posix") {
|
|
29711
29840
|
try {
|
|
29712
29841
|
if (!input.session.agentId)
|
|
29713
29842
|
return NONE5;
|
|
29843
|
+
const variable = dialect === "posix" ? variableRefusal(command) : null;
|
|
29844
|
+
if (variable)
|
|
29845
|
+
return judgeDeny(input, variable.why, undefined, () => variable.retry);
|
|
29714
29846
|
const fed = [];
|
|
29715
29847
|
let refused;
|
|
29716
29848
|
try {
|
|
@@ -29722,8 +29854,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
|
|
|
29722
29854
|
const judged = checkoutOf2(input.cwd);
|
|
29723
29855
|
try {
|
|
29724
29856
|
const why = judgeGit(command, judged ? commonDir(judged.root) : null, /\b(?:cd|chdir|pushd|popd)\b/.test(command) ? null : input.cwd);
|
|
29725
|
-
|
|
29726
|
-
refused = `${why}: ${JUDGE_GIT}`;
|
|
29857
|
+
refused = why;
|
|
29727
29858
|
} catch {
|
|
29728
29859
|
refused = "Workit cannot read this command: split it into simpler ones";
|
|
29729
29860
|
}
|
|
@@ -29731,7 +29862,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
|
|
|
29731
29862
|
if (refused)
|
|
29732
29863
|
return judgeDeny(input, refused);
|
|
29733
29864
|
if (dialect === "posix" && substitutingHeredoc(command.replaceAll("\\\n", "")))
|
|
29734
|
-
return judgeDeny(input, "an unquoted heredoc runs the `$(…)` or backtick command in its body: quote the delimiter (<<'EOF')");
|
|
29865
|
+
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'"));
|
|
29735
29866
|
let git = [];
|
|
29736
29867
|
try {
|
|
29737
29868
|
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)))) ? [
|
|
@@ -29742,7 +29873,7 @@ function confineJudgeShell(input, command, dialect = "posix") {
|
|
|
29742
29873
|
shellMutationTargets(input.cwd, command, dialect, true),
|
|
29743
29874
|
...fed.map((body) => shellMutationTargets(input.cwd, body, "posix", true))
|
|
29744
29875
|
];
|
|
29745
|
-
return confineJudge(input, [...lists.flat(), ...git], new Set([...git, ...lists.flatMap((list) => [...placeholdersOf(list)])]));
|
|
29876
|
+
return confineJudge(input, [...lists.flat(), ...git], new Set([...git, ...lists.flatMap((list) => [...placeholdersOf(list)])]), command);
|
|
29746
29877
|
} catch {
|
|
29747
29878
|
return NONE5;
|
|
29748
29879
|
}
|
|
@@ -30348,6 +30479,44 @@ var spawnDecision = (descriptor, cwd, tool, permissionMode = null) => {
|
|
|
30348
30479
|
return agentModelDecision(cwd, checked.input, { change: checked.change, permissionMode });
|
|
30349
30480
|
};
|
|
30350
30481
|
|
|
30482
|
+
// packages/workit-core/src/hooks/server-gate.ts
|
|
30483
|
+
import fs31 from "node:fs";
|
|
30484
|
+
import path50 from "node:path";
|
|
30485
|
+
var procNoticeFile = (env, session) => path50.join(stateDir(env), "procs", "notices", `${session.replace(/[^A-Za-z0-9_.@+-]/gu, "-").slice(0, 120) || "none"}.json`);
|
|
30486
|
+
var mb = (bytes) => `${Math.round(Number(bytes) / 1048576)} MB`;
|
|
30487
|
+
function takeProcNotice(session, env = process.env) {
|
|
30488
|
+
if (!session)
|
|
30489
|
+
return null;
|
|
30490
|
+
const file = procNoticeFile(env, session);
|
|
30491
|
+
const taken = `${file}.${process.pid}.taken`;
|
|
30492
|
+
try {
|
|
30493
|
+
fs31.renameSync(file, taken);
|
|
30494
|
+
} catch {
|
|
30495
|
+
return null;
|
|
30496
|
+
}
|
|
30497
|
+
try {
|
|
30498
|
+
const { notices } = JSON.parse(fs31.readFileSync(taken, "utf8"));
|
|
30499
|
+
const lines = (Array.isArray(notices) ? notices : []).flatMap((notice) => {
|
|
30500
|
+
if (!notice || typeof notice !== "object")
|
|
30501
|
+
return [];
|
|
30502
|
+
const { id, cmd, cwd, rssBytes, ceilingBytes } = notice;
|
|
30503
|
+
if (typeof id !== "string")
|
|
30504
|
+
return [];
|
|
30505
|
+
return [
|
|
30506
|
+
`- ${id} \`${String(cmd)}\` in ${String(cwd)}: ${mb(rssBytes)} (ceiling ${mb(ceilingBytes)}). Restart it: \`workit run --bg --restart ${id}\`, or \`workit stop ${id}\`.`
|
|
30507
|
+
];
|
|
30508
|
+
});
|
|
30509
|
+
return lines.length ? ["Workit: a background process you started is past the memory ceiling:", ...lines].join(`
|
|
30510
|
+
`) : null;
|
|
30511
|
+
} catch {
|
|
30512
|
+
return null;
|
|
30513
|
+
} finally {
|
|
30514
|
+
try {
|
|
30515
|
+
fs31.rmSync(taken, { force: true });
|
|
30516
|
+
} catch {}
|
|
30517
|
+
}
|
|
30518
|
+
}
|
|
30519
|
+
|
|
30351
30520
|
// packages/workit-core/src/hooks/ytrack-word.ts
|
|
30352
30521
|
var YTRACK_WORD = /ytrack(?![\w/-]|\.(?!exe|cmd))/i;
|
|
30353
30522
|
var namesYtrack = (text) => {
|
|
@@ -30828,9 +30997,11 @@ var ytrackGate = (cwd, command, dialect, ask) => {
|
|
|
30828
30997
|
const run = calls.length ? ` Run ${calls.join(", then ")} instead, each as its own plain call: it asks the user first.` : "";
|
|
30829
30998
|
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.` : "";
|
|
30830
30999
|
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." : "";
|
|
31000
|
+
const retry = writes.find((write) => write.workit)?.workit ?? (rerun ? writes.find((write) => write.gap === NOT_PLAIN.gap)?.command : undefined);
|
|
30831
31001
|
return {
|
|
30832
31002
|
kind: "deny",
|
|
30833
|
-
reason: `${why}${run}${user}${rerun}
|
|
31003
|
+
reason: `${why}${run}${user}${rerun}${retry ? `
|
|
31004
|
+
Retry as: ${retry}` : ""}`,
|
|
30834
31005
|
unblock: writes[0]?.workit ?? null
|
|
30835
31006
|
};
|
|
30836
31007
|
};
|
|
@@ -30896,7 +31067,7 @@ function handleHook(input, deps) {
|
|
|
30896
31067
|
const decision = decide(input, deps);
|
|
30897
31068
|
if (deps.descriptor.transport !== "hook-process" || !PRE_TOOL.has(input.event.kind) || decision.kind === "deny" || decision.kind === "ask")
|
|
30898
31069
|
return decision;
|
|
30899
|
-
const delta = [standingDelta(input), deps.budget?.line(input) ?? null].filter(Boolean).join(`
|
|
31070
|
+
const delta = [standingDelta(input), takeProcNotice(input.session.id), deps.budget?.line(input) ?? null].filter(Boolean).join(`
|
|
30900
31071
|
`) || null;
|
|
30901
31072
|
if (!delta)
|
|
30902
31073
|
return decision;
|
|
@@ -31126,11 +31297,11 @@ var modelKey = (model) => {
|
|
|
31126
31297
|
|
|
31127
31298
|
// packages/workit-core/src/hooks/budget-signal.ts
|
|
31128
31299
|
import { createHash as createHash23 } from "node:crypto";
|
|
31129
|
-
import
|
|
31130
|
-
import
|
|
31300
|
+
import fs32 from "node:fs";
|
|
31301
|
+
import path51 from "node:path";
|
|
31131
31302
|
var hash2 = (text) => createHash23("sha256").update(text).digest("hex").slice(0, 32);
|
|
31132
|
-
var budgetDir = (store) =>
|
|
31133
|
-
var agentBase = (store, session, agentId) =>
|
|
31303
|
+
var budgetDir = (store) => path51.join(store, "budget");
|
|
31304
|
+
var agentBase = (store, session, agentId) => path51.join(budgetDir(store), hash2(`${session}\x00${agentId ?? ""}`));
|
|
31134
31305
|
var spawnBudget = (prompt) => {
|
|
31135
31306
|
const found = /^TIMEBOX:[^\n]*?\b(\d+)\s+tool calls\b/mu.exec(prompt);
|
|
31136
31307
|
const n = found ? Number(found[1]) : NaN;
|
|
@@ -31138,7 +31309,7 @@ var spawnBudget = (prompt) => {
|
|
|
31138
31309
|
};
|
|
31139
31310
|
var readBudget = (file) => {
|
|
31140
31311
|
try {
|
|
31141
|
-
const { limit, told } = JSON.parse(
|
|
31312
|
+
const { limit, told } = JSON.parse(fs32.readFileSync(file, "utf8"));
|
|
31142
31313
|
return typeof limit === "number" && limit > 0 ? { limit, told: Number(told) || 0 } : null;
|
|
31143
31314
|
} catch {
|
|
31144
31315
|
return null;
|
|
@@ -31146,16 +31317,16 @@ var readBudget = (file) => {
|
|
|
31146
31317
|
};
|
|
31147
31318
|
var startBudget = (store, session, agentId, n) => {
|
|
31148
31319
|
const dir = budgetDir(store);
|
|
31149
|
-
|
|
31320
|
+
fs32.mkdirSync(dir, { recursive: true });
|
|
31150
31321
|
const cutoff = Date.now() - 604800000;
|
|
31151
|
-
for (const name of
|
|
31322
|
+
for (const name of fs32.readdirSync(dir))
|
|
31152
31323
|
try {
|
|
31153
|
-
if (
|
|
31154
|
-
|
|
31324
|
+
if (fs32.statSync(path51.join(dir, name)).mtimeMs < cutoff)
|
|
31325
|
+
fs32.rmSync(path51.join(dir, name));
|
|
31155
31326
|
} catch {}
|
|
31156
31327
|
const base = agentBase(store, session, agentId);
|
|
31157
|
-
|
|
31158
|
-
|
|
31328
|
+
fs32.writeFileSync(`${base}.json`, JSON.stringify({ limit: n, told: 0 }));
|
|
31329
|
+
fs32.rmSync(`${base}.calls`, { force: true });
|
|
31159
31330
|
};
|
|
31160
31331
|
var bindBudget = (cwd, session, agentId, prompt) => {
|
|
31161
31332
|
try {
|
|
@@ -31178,8 +31349,8 @@ var tickBudget = (cwd, session, agentId) => {
|
|
|
31178
31349
|
const budget = readBudget(`${base}.json`);
|
|
31179
31350
|
if (!budget)
|
|
31180
31351
|
return false;
|
|
31181
|
-
|
|
31182
|
-
return
|
|
31352
|
+
fs32.appendFileSync(`${base}.calls`, ".");
|
|
31353
|
+
return fs32.statSync(`${base}.calls`).size >= budget.limit * (budget.told + 1);
|
|
31183
31354
|
} catch {
|
|
31184
31355
|
return false;
|
|
31185
31356
|
}
|
|
@@ -31191,14 +31362,14 @@ var reachedOf = (cwd, session, agentId) => {
|
|
|
31191
31362
|
const budget = base && readBudget(`${base}.json`);
|
|
31192
31363
|
if (!budget)
|
|
31193
31364
|
return null;
|
|
31194
|
-
return { base, budget, reached: Math.floor(
|
|
31365
|
+
return { base, budget, reached: Math.floor(fs32.statSync(`${base}.calls`).size / budget.limit) };
|
|
31195
31366
|
};
|
|
31196
31367
|
var budgetLine = (cwd, session, agentId) => {
|
|
31197
31368
|
try {
|
|
31198
31369
|
const at = reachedOf(cwd, session, agentId);
|
|
31199
31370
|
if (!at || at.reached <= at.budget.told)
|
|
31200
31371
|
return null;
|
|
31201
|
-
|
|
31372
|
+
fs32.writeFileSync(`${at.base}.json`, JSON.stringify({ ...at.budget, told: at.reached }));
|
|
31202
31373
|
return lineFor(at.budget.limit * at.reached);
|
|
31203
31374
|
} catch {
|
|
31204
31375
|
return null;
|
|
@@ -31606,12 +31777,12 @@ var skillPromptNudge = (prompt, ctx) => process.env.WORKIT_PI_WORKER_SESSION ? n
|
|
|
31606
31777
|
// packages/workit-pi/src/launches.ts
|
|
31607
31778
|
import { mkdirSync as mkdirSync7, readFileSync as readFileSync16, readdirSync as readdirSync8, rmSync as rmSync4, writeFileSync as writeFileSync6 } from "node:fs";
|
|
31608
31779
|
import os12 from "node:os";
|
|
31609
|
-
import
|
|
31780
|
+
import path52 from "node:path";
|
|
31610
31781
|
var launchDir = (root) => {
|
|
31611
31782
|
const location = resolveStore(root);
|
|
31612
|
-
return location instanceof Error ? null :
|
|
31783
|
+
return location instanceof Error ? null : path52.join(location.dir, "pi-launches");
|
|
31613
31784
|
};
|
|
31614
|
-
var fileFor = (dir, workerId) =>
|
|
31785
|
+
var fileFor = (dir, workerId) => path52.join(dir, `${workerId.replace(/[^A-Za-z0-9-]/g, "_")}.json`);
|
|
31615
31786
|
var recordLaunch = (root, attempt) => {
|
|
31616
31787
|
const dir = launchDir(root);
|
|
31617
31788
|
if (!dir)
|
|
@@ -31657,7 +31828,7 @@ var abandonedLaunches = (root) => {
|
|
|
31657
31828
|
const found = [];
|
|
31658
31829
|
for (const name of names) {
|
|
31659
31830
|
try {
|
|
31660
|
-
const attempt = JSON.parse(readFileSync16(
|
|
31831
|
+
const attempt = JSON.parse(readFileSync16(path52.join(dir, name), "utf8"));
|
|
31661
31832
|
if (typeof attempt.workerId === "string" && typeof attempt.session === "string") {
|
|
31662
31833
|
if (!alive(attempt))
|
|
31663
31834
|
found.push(attempt);
|
|
@@ -31670,17 +31841,17 @@ var cancelHint = (workerId) => `cancel it first: workit_worker {"action":"cancel
|
|
|
31670
31841
|
|
|
31671
31842
|
// packages/workit-core/src/core/cli-locate.ts
|
|
31672
31843
|
import { closeSync as closeSync4, existsSync as existsSync16, openSync as openSync4, readSync as readSync2 } from "node:fs";
|
|
31673
|
-
import
|
|
31844
|
+
import path53 from "node:path";
|
|
31674
31845
|
var LAUNCHER_MARKER = "workit-owned-launcher";
|
|
31675
31846
|
var CLI_PACKAGE_PATH = ["node_modules", "@workit-dev", "cli"];
|
|
31676
31847
|
var installRoot = (env, platform = process.platform) => {
|
|
31677
31848
|
if (env.WORKIT_INSTALL_ROOT)
|
|
31678
31849
|
return env.WORKIT_INSTALL_ROOT;
|
|
31679
31850
|
const data = dataDir(env, platform);
|
|
31680
|
-
return platform === "win32" ?
|
|
31851
|
+
return platform === "win32" ? path53.join(data, "install") : data;
|
|
31681
31852
|
};
|
|
31682
|
-
var ownedLauncherPath = (env, platform = process.platform) =>
|
|
31683
|
-
var ownedCurrentEntry = (env, platform = process.platform) =>
|
|
31853
|
+
var ownedLauncherPath = (env, platform = process.platform) => path53.join(installRoot(env, platform), "bin", platform === "win32" ? "workit.cmd" : "workit");
|
|
31854
|
+
var ownedCurrentEntry = (env, platform = process.platform) => path53.join(installRoot(env, platform), "current", ...CLI_PACKAGE_PATH, "dist", "index.js");
|
|
31684
31855
|
var head = (file) => {
|
|
31685
31856
|
let fd;
|
|
31686
31857
|
try {
|
|
@@ -31707,7 +31878,7 @@ var locateWorkitCli = (options = {}) => {
|
|
|
31707
31878
|
source: "owned-launcher",
|
|
31708
31879
|
command: launcher,
|
|
31709
31880
|
args: [],
|
|
31710
|
-
binDir:
|
|
31881
|
+
binDir: path53.dirname(launcher)
|
|
31711
31882
|
};
|
|
31712
31883
|
const current = ownedCurrentEntry(env, platform);
|
|
31713
31884
|
if (exists(current))
|
|
@@ -31736,7 +31907,7 @@ var workitCliEnv = (located, env = process.env, platform = process.platform) =>
|
|
|
31736
31907
|
if (located.binDir) {
|
|
31737
31908
|
const key = pathKey(env);
|
|
31738
31909
|
const delimiter = platform === "win32" ? ";" : ":";
|
|
31739
|
-
const same = (dir) => platform === "win32" ?
|
|
31910
|
+
const same = (dir) => platform === "win32" ? path53.win32.normalize(dir).toLowerCase() === path53.win32.normalize(located.binDir).toLowerCase() : path53.posix.normalize(dir) === path53.posix.normalize(located.binDir);
|
|
31740
31911
|
const rest = (env[key] ?? "").split(delimiter).filter((dir) => dir && !same(dir));
|
|
31741
31912
|
patch[key] = [located.binDir, ...rest].join(delimiter);
|
|
31742
31913
|
}
|
|
@@ -32607,6 +32778,14 @@ function extension(pi) {
|
|
|
32607
32778
|
sessions.delete(ctx.sessionManager.getSessionId());
|
|
32608
32779
|
reconcileLostWorkers(ctx);
|
|
32609
32780
|
});
|
|
32781
|
+
const procNotice = (ctx) => {
|
|
32782
|
+
if (!ctx.isProjectTrusted())
|
|
32783
|
+
return null;
|
|
32784
|
+
const worker = process.env.WORKIT_PI_WORKER_SESSION && process.env.WORKIT_SESSION_ID?.trim();
|
|
32785
|
+
const own = takeProcNotice(ctx.sessionManager.getSessionId());
|
|
32786
|
+
return [worker ? takeProcNotice(worker) : null, own].filter(Boolean).join(`
|
|
32787
|
+
`) || null;
|
|
32788
|
+
};
|
|
32610
32789
|
pi.on("model_select", (event, ctx) => noteModelSelect(event, ctx));
|
|
32611
32790
|
pi.on("before_agent_start", (event, ctx) => {
|
|
32612
32791
|
if (event.messageType !== "user")
|
|
@@ -32633,6 +32812,11 @@ ${offer}` : ""}`;
|
|
|
32633
32812
|
if (contract && !firstTurn)
|
|
32634
32813
|
content = content ? `${contract}
|
|
32635
32814
|
${content}` : contract;
|
|
32815
|
+
const notice = procNotice(ctx);
|
|
32816
|
+
if (notice)
|
|
32817
|
+
content = content ? `${content}
|
|
32818
|
+
|
|
32819
|
+
${notice}` : notice;
|
|
32636
32820
|
if (content)
|
|
32637
32821
|
return { message: contextMessage(ctx, nudge ? `${content}
|
|
32638
32822
|
|
|
@@ -32684,7 +32868,7 @@ ${nudge}` : content) };
|
|
|
32684
32868
|
const observed = observeResult(event, ctx);
|
|
32685
32869
|
let standing = null;
|
|
32686
32870
|
try {
|
|
32687
|
-
standing = [standingNotice(ctx), budgetNotice(ctx)].filter(Boolean).join(`
|
|
32871
|
+
standing = [standingNotice(ctx), procNotice(ctx), budgetNotice(ctx)].filter(Boolean).join(`
|
|
32688
32872
|
`) || null;
|
|
32689
32873
|
} catch {}
|
|
32690
32874
|
if (!standing)
|
package/package.json
CHANGED
|
@@ -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 |
|