@workit-dev/pi 2.17.1 → 2.18.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/workit.js CHANGED
@@ -25787,7 +25787,7 @@ function heavyPlan(command, options) {
25787
25787
  };
25788
25788
  }
25789
25789
  if (single) {
25790
- const rewrite = leaseRewrite(command);
25790
+ const rewrite = leaseRewrite(command.trim().replace(TAIL_FILTER, ""));
25791
25791
  return rewrite ? { kind: "rewrite", command: rewrite, reason: single.reason } : { kind: "none" };
25792
25792
  }
25793
25793
  const parts = heavy.map((match) => leaseCommand(match.line));
@@ -25832,6 +25832,7 @@ function workitOnPath2(env = process.env) {
25832
25832
  }
25833
25833
  return false;
25834
25834
  }
25835
+ var TAIL_FILTER = /(?:\s+2>&1)?\s*\|\s*(?:tail|head)(?:\s+[\w=.+-]+)*\s*$/u;
25835
25836
  var ASSIGNMENTS = /^\s*((?:[A-Za-z_]\w*=(?:'[^']*'|"(?:[^"\\]|\\.)*"|[^\s'"])*\s+)*)/u;
25836
25837
  function leaseRewrite(command) {
25837
25838
  const text = command.trim();
@@ -31327,6 +31328,96 @@ Retry as: ${retry}` : ""}`,
31327
31328
  };
31328
31329
  };
31329
31330
 
31331
+ // packages/workit-core/src/hooks/exit-pipe.ts
31332
+ var EXIT_VERBS = [
31333
+ ["ci", "wait"],
31334
+ ["check"],
31335
+ ["pr", "merge"],
31336
+ ["release"],
31337
+ ["verify-delivery"]
31338
+ ];
31339
+ var base2 = (word = "") => word.split(/[\\/]/u).at(-1) ?? "";
31340
+ var quote4 = (word) => /^[\w@%+=:,./-]+$/u.test(word) ? word : `'${word.replaceAll("'", `'\\''`)}'`;
31341
+ var verbPath = (words) => {
31342
+ const path = [];
31343
+ for (let at = 0;at < words.length && path.length < 2; at += 1) {
31344
+ const word = words[at];
31345
+ if (word === "--")
31346
+ break;
31347
+ if (word === "--cwd")
31348
+ at += 1;
31349
+ else if (!word.startsWith("-"))
31350
+ path.push(word);
31351
+ }
31352
+ return path;
31353
+ };
31354
+ var exitCall = (words) => {
31355
+ let at = 0;
31356
+ while (at < words.length && /^[A-Za-z_]\w*=/u.test(words[at]))
31357
+ at += 1;
31358
+ if (!/^workit(?:-cli)?$/u.test(base2(words[at])))
31359
+ return null;
31360
+ const path = verbPath(words.slice(at + 1));
31361
+ return EXIT_VERBS.some((verb) => verb.every((word, index) => path[index] === word)) ? words.slice(at) : null;
31362
+ };
31363
+ var setsPipefail = (words) => words[0] === "set" && words.some((word, at) => word === "pipefail" && /^-[a-z]*o$/u.test(words[at - 1] ?? ""));
31364
+ var retryOf = ({ call, dir }) => {
31365
+ const at = call[1]?.startsWith("-") ? 1 : 2;
31366
+ const words = dir && !call.includes("--cwd") ? [...call.slice(0, at), "--cwd", dir, ...call.slice(at)] : call;
31367
+ return ["workit", ...words.slice(1)].map(quote4).join(" ");
31368
+ };
31369
+ function exitPipeGate(command, dialect = "posix") {
31370
+ if (!/\bworkit/u.test(command) || !/\b(?:tail|head)\b/u.test(command))
31371
+ return null;
31372
+ const subshellPiped = /\)\s*(?:\d*>&?\d*\s*)*\|(?!\|)/u.test(command);
31373
+ const groups = [];
31374
+ let carry = null;
31375
+ let pipefail = false;
31376
+ let dir = null;
31377
+ for (const segment of segmentsOf(command, dialect)) {
31378
+ if (segment.unanalyzable)
31379
+ return null;
31380
+ let words = segment.words;
31381
+ let closes = segment.group === "close";
31382
+ if (segment.group === "open") {
31383
+ groups.push(null);
31384
+ continue;
31385
+ }
31386
+ if (words[0] === "{") {
31387
+ groups.push(null);
31388
+ words = words.slice(1);
31389
+ } else if (words[0] === "}") {
31390
+ closes = true;
31391
+ words = words.slice(1);
31392
+ }
31393
+ if (closes) {
31394
+ const inner = groups.pop() ?? null;
31395
+ const piped = segment.pipe === true || segment.group === "close" && subshellPiped;
31396
+ carry = piped ? inner ?? carry : null;
31397
+ continue;
31398
+ }
31399
+ if (setsPipefail(words))
31400
+ pipefail = true;
31401
+ const filter = base2(words[0]);
31402
+ if (carry && !pipefail && (filter === "tail" || filter === "head")) {
31403
+ const retry = retryOf(carry);
31404
+ return {
31405
+ kind: "deny",
31406
+ reason: `workit exit-pipe: piping \`workit ${verbPath(carry.call.slice(1)).join(" ")}\` into ${filter} hides its exit code.
31407
+ Retry as: ${retry}`,
31408
+ unblock: retry
31409
+ };
31410
+ }
31411
+ const call = exitCall(words);
31412
+ const found = call ? { call, dir } : null;
31413
+ if (found && groups.length)
31414
+ groups[groups.length - 1] = found;
31415
+ carry = segment.pipe ? found ?? carry : null;
31416
+ dir = words.length === 2 && words[0] === "cd" && !segment.expands?.length ? words[1] : null;
31417
+ }
31418
+ return null;
31419
+ }
31420
+
31330
31421
  // packages/workit-core/src/hooks/handle.ts
31331
31422
  var usable2 = (value) => value === "native" || value === "partial";
31332
31423
  var NONE6 = { kind: "none" };
@@ -31470,6 +31561,9 @@ function decide(input, deps) {
31470
31561
  const ytrack = canDeny ? ytrackGate(input.cwd, event.command, event.dialect ?? "posix", input.host === "claude_code") : null;
31471
31562
  if (ytrack)
31472
31563
  return ytrack;
31564
+ const piped = canDeny ? exitPipeGate(event.command, event.dialect) : null;
31565
+ if (piped)
31566
+ return piped;
31473
31567
  const split = canDeny ? cdWorkitSplit(event.command) : null;
31474
31568
  if (split)
31475
31569
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/pi",
3
- "version": "2.17.1",
3
+ "version": "2.18.1",
4
4
  "description": "Workit native extension for Pi — tools, method skills, and session continuity",
5
5
  "keywords": [
6
6
  "agentic-coding",
@@ -13,7 +13,7 @@ and report the grant it names. PR creation does not start babysitting (a
13
13
  `green` or `merged` endpoint does), and a babysit request does not authorize
14
14
  merge: Stop at PR-ready (`babysit` `ready`) unless the user, or `merged` on a
15
15
  request that named no endpoint, set merge. `release publish` only if asked.
16
- Release: `workit release start <v>`, commits, `finish` (references/release.md).
16
+ Release: `workit release start <v>`, commits, `finish`; a repo that releases by pushing a tag: `workit release tag v<v>` (references/release.md).
17
17
 
18
18
  **Babysit endpoints.** After opening the PR keep babysitting without asking
19
19
  until CI is green, every thread is resolved and the verification gate is met;
@@ -53,7 +53,7 @@ the same check. Fix round and recheck both failed: the decider agent (read the `
53
53
  with `workit check`, fix the root cause, batch every fix in one push, one focused commit per fix (unrelated hunks in one file: `workit git stage --patch <file>`, then `workit git commit -m "<msg>" --staged`). A tool warning is a finding: fix it in this PR in the right layer, or record the false positive with evidence; pre-existing ones get their own PR.
54
54
  6. **Verified.** The lane in `workit pr status` decides: none, no verdict; self, your `--self` verdict; focused or full (or `verification: self|independent`), one non-author verifier per PR after the last push, never per push (read the `workit-review` skill's SKILL.md and follow it), on Claude Code with the `model` and `effort` of `workit models show --role verifier`. A docs-only push (or test-only under a unit verdict) keeps the verdict (`carried`); `reverify: focused` re-checks only the new diff, reusing green CI; one verdict at a stack's top covers its unchanged lower PRs. Land only when
55
55
  granted: `workit stack land` or `workit pr merge`; `--unverified --reason` if user-asked.
56
- Never pipe a delivery verb through `grep`: read its exit code, or use `--json`.
56
+ Never pipe a delivery verb through `grep`, `tail` or `head`: read its exit code, or use `--json`. Trunk CI after a merge: `workit ci wait --branch <trunk>`.
57
57
  7. **Observe it landed:** `workit verify-delivery pr` or `merge`. After a failed
58
58
  verdict or a check red 3+ times, at any endpoint: offer `/wk-retro` in one
59
59
  line of the final or stop report; never pause the babysit loop for it.
@@ -48,3 +48,11 @@ A workspace `releasePackages` entry, after the workspace release finished:
48
48
  release commit (`--at <ref>`), pushes it, creates its forge release (not
49
49
  Latest; `--latest` only when asked) and verifies it. Notes:
50
50
  `workit release notes draft <name>@<version>`.
51
+
52
+ ## Release by tag (goreleaser and similar)
53
+
54
+ A repo whose workflow releases on a pushed `v<version>` tag: merge the
55
+ changelog roll (`## [<version>]`) by PR, then `workit release tag
56
+ v<version>` (never raw `git tag`). It refuses red CI, an existing tag or a
57
+ missing section, naming the fix; `--wait` (background) watches the release
58
+ workflow. Backfill notes: `workit release notes edit <tag> --from-changelog`.