@workit-dev/pi 2.16.0 → 2.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/workit.js
CHANGED
|
@@ -8435,6 +8435,9 @@ function resolveRef(cwd, ref) {
|
|
|
8435
8435
|
function originHeadRef(cwd) {
|
|
8436
8436
|
return line(git(cwd, ["symbolic-ref", "-q", "--short", "refs/remotes/origin/HEAD"]));
|
|
8437
8437
|
}
|
|
8438
|
+
function worktreeTop(cwd) {
|
|
8439
|
+
return gitDirs(cwd)?.top ?? null;
|
|
8440
|
+
}
|
|
8438
8441
|
function ownChangeDrift(cwd, range) {
|
|
8439
8442
|
const before = diffRaw(cwd, range.fromFork, range.from);
|
|
8440
8443
|
const after = diffRaw(cwd, range.toFork, range.to);
|
|
@@ -11114,10 +11117,12 @@ function judgeBranch(cwd) {
|
|
|
11114
11117
|
const branch = currentBranch(cwd);
|
|
11115
11118
|
return branch && !isProtectedTarget(cwd, branch) ? branch : null;
|
|
11116
11119
|
}
|
|
11120
|
+
var shellQuote = (value) => /^[\w@%+=:,./-]+$/u.test(value) ? value : `'${value.replaceAll("'", `'\\''`)}'`;
|
|
11117
11121
|
function verdictCommand(options) {
|
|
11118
11122
|
const kind = options.judge === "verifier" ? "<live|unit>" : options.judge === "reviewer" ? "review" : "<live|unit|review>";
|
|
11119
11123
|
return [
|
|
11120
11124
|
"workit ledger verdict <verified|failed|blocked>",
|
|
11125
|
+
options.cwd ? `--cwd ${shellQuote(options.cwd)}` : null,
|
|
11121
11126
|
`--kind ${kind}`,
|
|
11122
11127
|
`--branch ${options.branch ?? "<branch>"}`,
|
|
11123
11128
|
options.session ? `--session ${options.session}` : null,
|
|
@@ -20693,9 +20698,9 @@ var autocorrected = (name, config) => {
|
|
|
20693
20698
|
}
|
|
20694
20699
|
return tie ? null : best;
|
|
20695
20700
|
};
|
|
20696
|
-
var
|
|
20701
|
+
var shellQuote2 = (word) => `'${word.replaceAll("'", "'\\''")}'`;
|
|
20697
20702
|
var positional = (script, args) => {
|
|
20698
|
-
const word = (arg) => /^[\w./@+:=-]+$/.test(arg) ? arg :
|
|
20703
|
+
const word = (arg) => /^[\w./@+:=-]+$/.test(arg) ? arg : shellQuote2(arg);
|
|
20699
20704
|
return script.replace(/\$\{?([1-9])\}?/g, (_, n) => word(args[Number(n) - 1] ?? "")).replace(/\$\{?[@*]\}?/g, args.map(word).join(" "));
|
|
20700
20705
|
};
|
|
20701
20706
|
var expandGitAliases = (root, invocation, cache = new Map, depth = 0) => {
|
|
@@ -20712,7 +20717,7 @@ var expandGitAliases = (root, invocation, cache = new Map, depth = 0) => {
|
|
|
20712
20717
|
return corrected ? [{ ...invocation, args: [corrected, ...invocation.args.slice(1)] }] : [invocation];
|
|
20713
20718
|
}
|
|
20714
20719
|
const rest = invocation.args.slice(1);
|
|
20715
|
-
const expanded = alias.startsWith("!") ? rawInvocations([positional(alias.slice(1), rest), ...rest.map(
|
|
20720
|
+
const expanded = alias.startsWith("!") ? rawInvocations([positional(alias.slice(1), rest), ...rest.map(shellQuote2)].join(" ")).map((inner) => ({
|
|
20716
20721
|
...inner,
|
|
20717
20722
|
dir: rebase(invocation.dir, inner.dir),
|
|
20718
20723
|
...inner.tool === "git" && (invocation.config || inner.config) ? { config: [...invocation.config ?? [], ...inner.config ?? []] } : {},
|
|
@@ -21039,7 +21044,7 @@ var policyDeclared = () => {
|
|
|
21039
21044
|
return false;
|
|
21040
21045
|
}
|
|
21041
21046
|
};
|
|
21042
|
-
var word = (text) => /^[\w./@%+:,=-]+$/u.test(text) ? text :
|
|
21047
|
+
var word = (text) => /^[\w./@%+:,=-]+$/u.test(text) ? text : shellQuote2(text);
|
|
21043
21048
|
var HEREDOC = /^cat <<(['"])(\w+)\1\n([\s\S]*)\n\2\n?$/u;
|
|
21044
21049
|
var messageOf = (segment, index) => {
|
|
21045
21050
|
const text = segment.words[index];
|
|
@@ -21123,7 +21128,7 @@ var cdCommitCall = (input, command, target, repo) => {
|
|
|
21123
21128
|
}
|
|
21124
21129
|
return [
|
|
21125
21130
|
`workit git --cwd ${word(target)} commit`,
|
|
21126
|
-
...messages.map((message) => `-m ${
|
|
21131
|
+
...messages.map((message) => `-m ${shellQuote2(message)}`),
|
|
21127
21132
|
...allowEmpty ? ["--allow-empty"] : [],
|
|
21128
21133
|
all ? "--all" : `-- ${[...new Set(paths)].map(word).join(" ")}`
|
|
21129
21134
|
].join(" ");
|
|
@@ -24983,6 +24988,7 @@ var workitBypassFlag = (command, dialect = "posix") => {
|
|
|
24983
24988
|
}
|
|
24984
24989
|
return null;
|
|
24985
24990
|
};
|
|
24991
|
+
var helpOnly = (call, needle) => call.length > needle.length && needle.every((word, index) => call[index] === word) && call.slice(needle.length).every((word) => word === "--help" || word === "-h");
|
|
24986
24992
|
var userOnlyWorkitCall = (command, dialect = "posix") => {
|
|
24987
24993
|
if (!mayRunUserOnly(command))
|
|
24988
24994
|
return null;
|
|
@@ -25009,7 +25015,7 @@ var userOnlyWorkitCall = (command, dialect = "posix") => {
|
|
|
25009
25015
|
}
|
|
25010
25016
|
const call = args.slice(at);
|
|
25011
25017
|
const found = WORKIT_USER_ONLY.find((needle) => call[0] === needle[0] && hasWordsInOrder(call, needle));
|
|
25012
|
-
if (found)
|
|
25018
|
+
if (found && !helpOnly(call, found))
|
|
25013
25019
|
return [...found];
|
|
25014
25020
|
}
|
|
25015
25021
|
return null;
|
|
@@ -28558,6 +28564,8 @@ var cwdOf = (globals) => {
|
|
|
28558
28564
|
return cwd;
|
|
28559
28565
|
};
|
|
28560
28566
|
var inlineCallCwd = (call, base) => call.cwd ? path46.resolve(base, call.cwd) : base;
|
|
28567
|
+
var isReadFilter = (segment) => (segment.words[0] === "tail" || segment.words[0] === "head") && segment.words.slice(1).every((word) => /^(?:-[nc]|-[nc]?\d+|\+?\d+)$/u.test(word)) && !segment.redirects.length && !segment.subs?.length && !segment.stdin?.length && !segment.inputs?.length && !segment.expands?.length && !segment.group && !segment.unanalyzable;
|
|
28568
|
+
var onlyFiltersAfter = (segments) => segments[0]?.pipe === true && segments.slice(1).every((segment, index, rest) => isReadFilter(segment) && (index === rest.length - 1 ? !segment.pipe : segment.pipe));
|
|
28561
28569
|
var inlineCallIn = (command, dialect = "posix") => {
|
|
28562
28570
|
if (!/\bworkit\b/u.test(command))
|
|
28563
28571
|
return null;
|
|
@@ -28576,7 +28584,7 @@ var inlineCallIn = (command, dialect = "posix") => {
|
|
|
28576
28584
|
const call = words.slice(at);
|
|
28577
28585
|
if (!asked(call))
|
|
28578
28586
|
continue;
|
|
28579
|
-
const plain = segments.length === 1 && start === 0 && words[0] === "workit" && !segment.redirects.length && !segment.subs?.length && !segment.stdin?.length && !segment.expands?.length && !segment.group;
|
|
28587
|
+
const plain = (segments.length === 1 || segment === segments[0] && onlyFiltersAfter(segments)) && start === 0 && words[0] === "workit" && !segment.redirects.length && !segment.subs?.length && !segment.stdin?.length && !segment.expands?.length && !segment.group;
|
|
28580
28588
|
if (plain)
|
|
28581
28589
|
return {
|
|
28582
28590
|
plain: true,
|
|
@@ -30705,16 +30713,18 @@ var openLog = (env, args) => {
|
|
|
30705
30713
|
return null;
|
|
30706
30714
|
}
|
|
30707
30715
|
};
|
|
30708
|
-
function runCli(args, env
|
|
30716
|
+
function runCli(args, env) {
|
|
30709
30717
|
let log = null;
|
|
30710
30718
|
try {
|
|
30711
30719
|
const cli = locateWorkitCli({ env });
|
|
30720
|
+
const cwd = teardownDir(env);
|
|
30721
|
+
fs32.mkdirSync(cwd, { recursive: true });
|
|
30712
30722
|
log = openLog(env, args);
|
|
30713
30723
|
const started = teardownDeps.spawn({
|
|
30714
30724
|
command: cli.command,
|
|
30715
30725
|
args: [...cli.args, ...args],
|
|
30716
30726
|
env,
|
|
30717
|
-
cwd
|
|
30727
|
+
cwd,
|
|
30718
30728
|
log
|
|
30719
30729
|
});
|
|
30720
30730
|
if (!started && log !== null)
|
|
@@ -30740,7 +30750,7 @@ function endSession(end, env = process.env) {
|
|
|
30740
30750
|
const child = { ...env, WORKIT_SESSION_ID: session, WORKIT_HOST: end.host };
|
|
30741
30751
|
for (const key of HOST_SESSION_VARS2)
|
|
30742
30752
|
delete child[key];
|
|
30743
|
-
return runCli(["stop", "--session", session, "--reason", "session-end"], child
|
|
30753
|
+
return runCli(["stop", "--session", session, "--reason", "session-end"], child);
|
|
30744
30754
|
}
|
|
30745
30755
|
var claim2 = (file, now) => {
|
|
30746
30756
|
for (let attempt = 0;attempt < 2; attempt += 1)
|
|
@@ -30768,7 +30778,7 @@ var fresh = (stamp, now) => {
|
|
|
30768
30778
|
return false;
|
|
30769
30779
|
}
|
|
30770
30780
|
};
|
|
30771
|
-
function reapAtStart(
|
|
30781
|
+
function reapAtStart(_cwd, env = process.env) {
|
|
30772
30782
|
const stamp = reapStamp(env);
|
|
30773
30783
|
const lock = `${stamp}.claim`;
|
|
30774
30784
|
const now = teardownDeps.now();
|
|
@@ -30785,7 +30795,7 @@ function reapAtStart(cwd, env = process.env) {
|
|
|
30785
30795
|
try {
|
|
30786
30796
|
if (fresh(stamp, now))
|
|
30787
30797
|
return false;
|
|
30788
|
-
started = runCli(["stop", "--orphans", "--reason", "session-start"], env
|
|
30798
|
+
started = runCli(["stop", "--orphans", "--reason", "session-start"], env);
|
|
30789
30799
|
if (started) {
|
|
30790
30800
|
const temp = `${stamp}.${process.pid}`;
|
|
30791
30801
|
fs32.writeFileSync(temp, String(now), { mode: 384 });
|
|
@@ -31334,14 +31344,15 @@ ${subagentStartText({ ...input, cwd: "" }, descriptor, event)}`;
|
|
|
31334
31344
|
const judge = event.agentType.endsWith("reviewer") ? "reviewer" : "verifier";
|
|
31335
31345
|
const pick = judge === "verifier" ? ", --kind live when you drove the real surface" : "";
|
|
31336
31346
|
const branch = judgeBranch(cwd);
|
|
31347
|
+
const at = currentBranch(cwd) === null ? null : worktreeTop(cwd) ?? null;
|
|
31337
31348
|
const checks = judgeChecksLine(cwd);
|
|
31338
31349
|
const checksText = checks ? ` ${checks}` : "";
|
|
31339
31350
|
if (descriptor.host === "codex_cli" || descriptor.host === "codex_desktop")
|
|
31340
|
-
return `${readOnly} Its shell already acts as its own Workit session, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${verdictCommand({ branch, judge })}\`.${JUDGE_CWD} Add no session or token option to it, and never set WORKIT_SESSION_ID by hand.${checksText}`;
|
|
31351
|
+
return `${readOnly} Its shell already acts as its own Workit session, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${verdictCommand({ branch, judge, cwd: at })}\`.${JUDGE_CWD} Add no session or token option to it, and never set WORKIT_SESSION_ID by hand.${checksText}`;
|
|
31341
31352
|
const token = session ? recordIssuedSession(cwd, session, own) : null;
|
|
31342
31353
|
if (session && !token)
|
|
31343
31354
|
return `${readOnly} ${own} was already issued to an earlier subagent, so no token is handed out again and a verdict under it would be refused (unbound_session). Record no verdict as ${own}: spawn a fresh verifier or reviewer, which gets its own session and token.`;
|
|
31344
|
-
const line = verdictCommand({ branch, judge, session: own, token });
|
|
31355
|
+
const line = verdictCommand({ branch, judge, session: own, token, cwd: at });
|
|
31345
31356
|
return `${readOnly} Its own Workit session is ${own}, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${line}\`.${JUDGE_CWD}${token ? " The token is this subagent's alone: never write it into a report, a file or a commit. --token needs a workit CLI at least as new as this plugin; if the CLI answers that --token is an unknown option, update the workit CLI (workit upgrade --cli) and record again." : ""}${checksText}`;
|
|
31346
31357
|
};
|
|
31347
31358
|
var PRE_TOOL = new Set(["shell.pre", "write.pre", "tool.pre"]);
|
|
@@ -31442,12 +31453,12 @@ function decide(input, deps) {
|
|
|
31442
31453
|
if (input.host === "claude_code")
|
|
31443
31454
|
return {
|
|
31444
31455
|
kind: "ask",
|
|
31445
|
-
reason: `Only the user runs \`workit ${userOnly.join(" ")}\`: the user decides this call.`
|
|
31456
|
+
reason: `Only the user runs \`workit ${userOnly.join(" ")}\`: the user decides this call (its help: \`workit help ${userOnly.join(" ")}\`).`
|
|
31446
31457
|
};
|
|
31447
31458
|
if (canDeny && ["cursor", "codex_cli", "codex_desktop", "pi"].includes(input.host))
|
|
31448
31459
|
return {
|
|
31449
31460
|
kind: "deny",
|
|
31450
|
-
reason: `Only the user runs \`workit ${userOnly.join(" ")}\`: run it in your own terminal.`,
|
|
31461
|
+
reason: `Only the user runs \`workit ${userOnly.join(" ")}\`: run it in your own terminal (its help: \`workit help ${userOnly.join(" ")}\`).`,
|
|
31451
31462
|
unblock: null
|
|
31452
31463
|
};
|
|
31453
31464
|
}
|
package/package.json
CHANGED
|
@@ -31,7 +31,7 @@ denial, a review comment that needs a product decision, a required update
|
|
|
31
31
|
that repeats because the base keeps moving, or after 3 failed fix attempts on
|
|
32
32
|
the same check. Fix round and recheck both failed: the decider agent (read the `workit-fanout` skill's SKILL.md and follow it).
|
|
33
33
|
|
|
34
|
-
1. **Open.** Last before the PR, if `workit grant show` has `changelog: update|create`:
|
|
34
|
+
1. **Open.** Last before the PR, if `workit grant show` has `changelog: update|create`: pass the Unreleased entry as `workit pr create … --changelog "<Section>: <entry>"` (it commits and pushes it); with `docs: when-user-facing` fix only docs the diff made false (`references/changelog.md`).
|
|
35
35
|
Full local check (`workit check ci` when `.workit/checks.json` has a `ci` group), push once: `workit git push`, then `workit pr template` and fill the template it prints: every heading, each `<!-- -->` replaced (Workit's: `references/pr-body.md`).
|
|
36
36
|
`workit pr create --title "<title>" --body-file <f|->` refuses a body that leaves a repo template (or `prTemplate: workit`) unfilled; add `--issue <#n|ID>` (`--refs`: no close; `workit pr edit`).
|
|
37
37
|
YouTrack issue work: `workit youtrack …` (`--help`; the `ytrack` skill for the rest). A draft that needs the user's yes (YouTrack text, release notes, a PR body they asked to review): paste it whole in chat before asking, never only its path, and again after every edit (the verb prints the diff and the new text).
|
|
@@ -17,19 +17,23 @@ belongs to). Otherwise:
|
|
|
17
17
|
do, not with internals: "Added: `workit pr create --no-changelog <reason>`
|
|
18
18
|
skips the changelog check with a recorded reason", not "refactor gate
|
|
19
19
|
module".
|
|
20
|
-
2.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
2. Open the PR with the entry in the same call:
|
|
21
|
+
`workit pr create … --changelog "<Section>: <entry>"` (sections: Added,
|
|
22
|
+
Changed, Deprecated, Removed, Fixed, Security). It merges the bullet into
|
|
23
|
+
`## [Unreleased]` of the right file (creating a missing Keep a Changelog
|
|
24
|
+
file), commits it with a subject commitlint accepts, pushes and opens the
|
|
25
|
+
PR. Never clobber CHANGELOG.md: never rewrite, reorder or delete an
|
|
25
26
|
existing entry, and never hand-edit released sections.
|
|
26
|
-
3.
|
|
27
|
-
|
|
27
|
+
3. With no PR to open yet, apply it alone with
|
|
28
|
+
`workit changelog apply --entries '{"Added": ["…"]}'` (`--path <file>` when
|
|
29
|
+
it is not the root CHANGELOG.md), then commit it
|
|
30
|
+
(`workit git commit -m "<message>" -- <file>`) with the change and push.
|
|
28
31
|
|
|
29
32
|
`workit pr create` refuses a user-facing PR without a new Unreleased bullet
|
|
30
|
-
(`changelog_required`)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
(`changelog_required`); its `Retry as:` line is your call plus
|
|
34
|
+
`--changelog "<Section>: <what users can now do>"`: fill in the entry and run
|
|
35
|
+
it. When the PR truly needs no entry, pass `--no-changelog "<why>"`: the
|
|
36
|
+
reason is written into the PR body.
|
|
33
37
|
|
|
34
38
|
## Docs (`docs: when-user-facing`)
|
|
35
39
|
|