@workit-dev/pi 2.16.1 → 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,
|
|
@@ -31336,14 +31344,15 @@ ${subagentStartText({ ...input, cwd: "" }, descriptor, event)}`;
|
|
|
31336
31344
|
const judge = event.agentType.endsWith("reviewer") ? "reviewer" : "verifier";
|
|
31337
31345
|
const pick = judge === "verifier" ? ", --kind live when you drove the real surface" : "";
|
|
31338
31346
|
const branch = judgeBranch(cwd);
|
|
31347
|
+
const at = currentBranch(cwd) === null ? null : worktreeTop(cwd) ?? null;
|
|
31339
31348
|
const checks = judgeChecksLine(cwd);
|
|
31340
31349
|
const checksText = checks ? ` ${checks}` : "";
|
|
31341
31350
|
if (descriptor.host === "codex_cli" || descriptor.host === "codex_desktop")
|
|
31342
|
-
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}`;
|
|
31343
31352
|
const token = session ? recordIssuedSession(cwd, session, own) : null;
|
|
31344
31353
|
if (session && !token)
|
|
31345
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.`;
|
|
31346
|
-
const line = verdictCommand({ branch, judge, session: own, token });
|
|
31355
|
+
const line = verdictCommand({ branch, judge, session: own, token, cwd: at });
|
|
31347
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}`;
|
|
31348
31357
|
};
|
|
31349
31358
|
var PRE_TOOL = new Set(["shell.pre", "write.pre", "tool.pre"]);
|
|
@@ -31444,12 +31453,12 @@ function decide(input, deps) {
|
|
|
31444
31453
|
if (input.host === "claude_code")
|
|
31445
31454
|
return {
|
|
31446
31455
|
kind: "ask",
|
|
31447
|
-
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(" ")}\`).`
|
|
31448
31457
|
};
|
|
31449
31458
|
if (canDeny && ["cursor", "codex_cli", "codex_desktop", "pi"].includes(input.host))
|
|
31450
31459
|
return {
|
|
31451
31460
|
kind: "deny",
|
|
31452
|
-
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(" ")}\`).`,
|
|
31453
31462
|
unblock: null
|
|
31454
31463
|
};
|
|
31455
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
|
|