pi-odd-worktree 3.6.1 → 3.6.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.
@@ -93,16 +93,28 @@ const CHECKING_COMMANDS = [
93
93
  /^node\s+\S*(test|check|lint|typecheck)[\w-]*\.m?[jt]s\b/,
94
94
  /^((npx|pnpx|bunx)\s+|(pnpm|yarn)\s+exec\s+)?(vitest|jest|mocha|tsc|pytest)\b/,
95
95
  /^python(3(\.\d+)?)?\s+-m\s+(pytest|unittest)\b/,
96
+ // Every ecosystem names its verification with a subcommand, and that recipe is the check
97
+ // whatever toolchain builds the project. The recipe is a whole argument: `gradle
98
+ // test-fixtures:publish` runs a recipe that only starts with the word `test`.
99
+ /^(mix|dotnet)\s+test(?=\s|$)/,
100
+ /^(gradlew|gradle|mvn|mvnw)\s+test(?=\s|$)/,
96
101
  /^go\s+(test|build|vet)\b/,
97
102
  /^cargo\s+(test|build|check|clippy|nextest)\b/,
98
103
  // `cargo fmt` rewrites code, so only the check form verifies anything.
99
104
  /^cargo\s+fmt\b.*\s--check\b/,
100
105
  /^ruff\s+format\s+--check\b/,
106
+ // `ruff format` rewrites unless told to report, and the runner's form reads the same.
107
+ /^(uv|poetry)\s+run\s+ruff\s+format\s+--check\b/,
101
108
  /^deno\s+(test|check)\b/,
102
109
  /^deno\s+fmt\s+--check\b/,
103
110
  /^deno\s+task\s+(test|typecheck|lint|build|check)\b/,
104
111
  // eslint verifies work whatever write flag it carries, quoted or not.
105
112
  /^((npx|pnpx|bunx)\s+|(pnpm|yarn|npm)\s+(exec|run)\s+)?eslint\b/,
113
+ // A project runner supplies the environment and then hands the segment to the program it
114
+ // names, so a checker behind `uv run`/`poetry run` is the check the bare checker already
115
+ // is. Only a checker is read: `uv run python x.py` names nothing, and `ruff format` is a
116
+ // rewrite no check form covers.
117
+ /^(uv|poetry)\s+run\s+(pytest|vitest|jest|mypy|tsc|eslint)(?=\s|$)/,
106
118
  // Waiting on or reading CI results verifies work; it is not exploration.
107
119
  /^gh\s+pr\s+checks\b/,
108
120
  /^gh\s+run\s+(view|watch|list)\b/,
@@ -121,6 +133,7 @@ const CHECKING_COMMANDS = [
121
133
  // linters beside it only report.
122
134
  const FIXABLE_CHECKING_COMMANDS = [
123
135
  /^ruff\s+check\b/,
136
+ /^(uv|poetry)\s+run\s+ruff\s+check(?=\s|$)/,
124
137
  /^deno\s+lint\b/,
125
138
  /^((npx|pnpx|bunx)\s+)?biome\s+(check|ci|lint)\b/,
126
139
  /^((npx|pnpx|bunx)\s+)?(shellcheck|actionlint|yamllint|hadolint|tflint|mypy|pyright|flake8|pylint)\b/,
@@ -212,6 +225,9 @@ const PREPARING_COMMANDS = [
212
225
  /^uv\s+(pip\s+install|sync|add|init)\b/,
213
226
  /^poetry\s+(install|add)\b/,
214
227
  /^(bundle\s+install|gem\s+install|composer\s+install)\b/,
228
+ // A container image the call builds is one this machine now has, the same build-up a
229
+ // dependency install is; running, pulling or just listing one names nothing here.
230
+ /^docker\s+build\b/,
215
231
  /^(brew|port)\s+install\b/,
216
232
  /^(apt|apt-get|dnf|yum|zypper)\s+(install|add)\b/,
217
233
  /^apk\s+add\b/,
@@ -281,6 +297,9 @@ const VERSIONING_COMMANDS = [
281
297
  /^gh\s+pr\s+checkout\b/,
282
298
  // A stack's local half creates and rebases branches; it publishes nothing.
283
299
  /^gh\s+stack\s+(init|add|rebase)\b/,
300
+ // A package manager's own version bump rewrites the manifest and the tag this machine
301
+ // keeps. The bare form and `--version` only print, and the version probes read them first.
302
+ /^(npm|pnpm|yarn|bun)\s+version\s+[^-\s]/,
284
303
  ];
285
304
 
286
305
  // Remote writes: they create or move something on GitHub, including the label,
@@ -296,6 +315,11 @@ const PUBLISHING_COMMANDS = [
296
315
  // Rerunning or cancelling a CI run moves work on the remote, beside `gh pr` and
297
316
  // `gh workflow`, which already name their own writes.
298
317
  /^gh\s+run\s+(rerun|cancel)\b/,
318
+ // Running a workflow, or enabling and disabling one, moves work on the remote the same
319
+ // way; listing and viewing a workflow are the reads the exploring table names.
320
+ /^gh\s+workflow\s+(run|enable|disable)\b/,
321
+ // A package manager's `publish` uploads the package to a registry.
322
+ /^(npm|pnpm|yarn|bun)\s+publish\b/,
299
323
  ];
300
324
 
301
325
  // `--help` prints a program's usage and stops, so it is a query on any command family.
@@ -389,6 +413,9 @@ const EXPLORING_COMMANDS = [
389
413
  // Version probes: the universal `--version`/`-V`, and each runtime's own `-v`/`version`.
390
414
  /^[\w./+-]+\s+(--version|-V)\s*$/,
391
415
  /^(node|python3?(\.\d+)?|ruby|php|java|npm|pnpm|yarn|bun|deno|rustc|cargo|go|gcc|clang|make|git|docker|uv|pip3?|ffmpeg|jq|nvim|tmux)\s+(-v|version)\s*$/,
416
+ // `npm version --version` asks the tool for its own version and bumps nothing; the form
417
+ // that takes a non-flag argument is the history change the versioning table names.
418
+ /^(npm|pnpm|yarn|bun)\s+version\s+--version\s*$/,
392
419
  // What the shell hands its children, and the state the kernel and the daemons report.
393
420
  /^env\s*$/,
394
421
  /^ss\b(?!.*\s(-\w*K\w*|--kill)\b)/,
@@ -586,7 +613,9 @@ function segmentActivity(segment) {
586
613
  if (isInPlaceEdit(words)) return 'preparing';
587
614
  if (isPreparingSegment(text)) return 'preparing';
588
615
  if (matchesAny(VERSIONING_COMMANDS, text)) return 'versioning';
589
- if (matchesAny(PUBLISHING_COMMANDS, text)) return 'publishing';
616
+ // `gh api` names its write from the words it passes — a method, a field, an input body —
617
+ // so a pattern in the table cannot read it; the plain GET is the read above.
618
+ if (matchesAny(PUBLISHING_COMMANDS, text) || isGhApiWrite(text)) return 'publishing';
590
619
  return undefined;
591
620
  }
592
621
 
@@ -1124,13 +1153,33 @@ function isSeparator(command, i) {
1124
1153
  function findSubstitutionEnd(command, start) {
1125
1154
  let depth = 1;
1126
1155
  let quote;
1156
+ // The heredoc whose header line is still being read: its body begins at the newline that
1157
+ // ends that line. Only the body is data — the header line is still the shell's own text, so
1158
+ // a `)` on it counts and its quotes are read normally.
1159
+ let body;
1127
1160
  for (let i = start; i < command.length; i += 1) {
1161
+ if (body !== undefined && i >= body.newline) {
1162
+ i = body.end - 1;
1163
+ body = undefined;
1164
+ continue;
1165
+ }
1128
1166
  const char = command[i];
1129
1167
  if (quote) {
1130
1168
  if (char === quote) quote = undefined;
1131
1169
  else if (char === '\\' && quote === '"') i += 1;
1132
1170
  } else if (char === '\\') i += 1;
1133
- else if (char === "'" || char === '"') quote = char;
1171
+ else if (char === '<' && command[i + 1] === '<' && command[i + 2] !== '<' && command[i - 1] !== '<') {
1172
+ // A heredoc body is data the shell hands over, never text it acts on: a quote or a
1173
+ // parenthesis inside one cannot close the substitution that wraps it, so the scan
1174
+ // resumes past the body. Without this, one apostrophe in a PR body hid the `)` of the
1175
+ // `$( … )` around it, and the body — backticks and all — stayed in the segment as text
1176
+ // the shell acts on. `<<<` is a herestring, not a header, so both `<` are refused. A
1177
+ // header this reader cannot delimit stays the plain text it is.
1178
+ const end = heredocEnd(command, i);
1179
+ const header = HEREDOC_HEADER.exec(command.slice(i));
1180
+ const newline = header === null ? -1 : command.indexOf('\n', i + header[0].length);
1181
+ if (body === undefined && end !== undefined && header !== null && newline >= 0 && newline < end) body = { newline, end };
1182
+ } else if (char === "'" || char === '"') quote = char;
1134
1183
  else if (char === '(') depth += 1;
1135
1184
  else if (char === ')' && (depth -= 1) === 0) return i;
1136
1185
  }
@@ -1465,6 +1514,52 @@ function isGhApiRead(segment) {
1465
1514
  return !words.slice(2).some((word) => GH_API_WRITE_FLAGS.has(word.split('=')[0] === undefined ? '' : word.split('=')[0]) || /^-[XfF]./.test(word));
1466
1515
  }
1467
1516
 
1517
+ /**
1518
+ * The other half of that reading: the `gh api` call that writes creates or moves something
1519
+ * on the remote, so it publishes. A method the call spells out decides by itself — `-X GET`
1520
+ * is the same query without the flag, quoted or not, and no field riding beside it proves a
1521
+ * payload — while a field or an input body that CARRIES one is the payload a write sends,
1522
+ * glued to its flag (`-fkey=value`) or written after it. A header's value is that header's,
1523
+ * never a flag of its own.
1524
+ */
1525
+ function isGhApiWrite(segment) {
1526
+ const words = shellWords(segment);
1527
+ if (words[0] !== 'gh' || words[1] !== 'api') return false;
1528
+ let method;
1529
+ let payload = false;
1530
+ for (let index = 2; index < words.length; index += 1) {
1531
+ const word = words[index] === undefined ? '' : words[index];
1532
+ const equals = word.indexOf('=');
1533
+ const flag = equals < 0 ? word : word.slice(0, equals);
1534
+ const attached = equals < 0 ? undefined : word.slice(equals + 1);
1535
+ // The method is attached in `-XPOST`/`--method=PUT` and the next word otherwise; the
1536
+ // shell dropped any quoting, so `-X "GET"` and `--method='HEAD'` are the reads they spell.
1537
+ const gluedMethod = /^-X./.exec(word);
1538
+ if (flag === '-X' || flag === '--method' || gluedMethod !== null) {
1539
+ // `-XPOST` and `--method=PUT` carry the value; `-X POST` writes it as the next word.
1540
+ let value = word.slice(2);
1541
+ if (gluedMethod === null) {
1542
+ value = attached === undefined ? words[index + 1] : attached;
1543
+ if (attached === undefined) index += 1;
1544
+ }
1545
+ if (value !== undefined && value !== '') method = value;
1546
+ continue;
1547
+ }
1548
+ // A header's value is not a flag this call passes: `-H "X: -filename"` sends a header.
1549
+ if (flag === '-H' || flag === '--header' || /^-H./.test(word)) {
1550
+ if (attached === undefined && !/^-H./.test(word)) index += 1;
1551
+ continue;
1552
+ }
1553
+ if (!GH_API_WRITE_FLAGS.has(flag) && !/^-[fF]/.test(word)) continue;
1554
+ // A field flag with no value hands the remote no payload at all.
1555
+ const value = attached === undefined ? words[index + 1] : attached;
1556
+ if (attached === undefined) index += 1;
1557
+ if (value !== undefined && value !== '') payload = true;
1558
+ }
1559
+ // A method that reads says so whatever rides beside it; a payload with no method writes.
1560
+ return method === undefined ? payload : !/^(GET|HEAD)$/i.test(method);
1561
+ }
1562
+
1468
1563
  /**
1469
1564
  * `go env` reports the Go configuration, but `-w` stores a value in the env config file
1470
1565
  * and `-u` unsets one: both write, so neither is inspection.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-odd-worktree",
3
- "version": "3.6.1",
3
+ "version": "3.6.2",
4
4
  "description": "Pi package for odd-worktree: the Git worktree tools a Pi session uses (create and list the checkouts the agent works in), the /warp worktree panel, the /odd ODD viewer, and the /issues GitHub issue reader. Needs only Pi and git: no companion app, no extra service.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -172,6 +172,69 @@ test('a verification runner names the checking activity', () => {
172
172
  }
173
173
  });
174
174
 
175
+ // The runners the table did not read yet: each ecosystem names its verification with a
176
+ // subcommand, and that subcommand is the check whatever builds the project.
177
+ test('the remaining ecosystem runners name the checking activity', () => {
178
+ for (const command of [
179
+ 'mix test',
180
+ 'mix test test/app_test.exs',
181
+ 'dotnet test',
182
+ './gradlew test',
183
+ 'gradlew test',
184
+ 'gradle test',
185
+ 'mvn test',
186
+ ]) {
187
+ assert.equal(inferBashActivity(command), 'checking', command);
188
+ }
189
+ // The neighbours beside them build or prepare, and `mix format` rewrites, so none of
190
+ // them is a check.
191
+ for (const command of ['dotnet build', 'gradle build', 'mvn package']) {
192
+ assert.notEqual(inferBashActivity(command), 'checking', command);
193
+ }
194
+ assert.equal(inferBashActivity('mix format'), 'formatting');
195
+ });
196
+
197
+ // A test recipe must be a whole argument: `gradle test-fixtures:publish` runs a recipe whose
198
+ // name merely starts with `test`, and a prefix is not the check.
199
+ test('a recipe whose name starts with test is not the test recipe', () => {
200
+ for (const command of ['gradle test-fixtures:publish', 'mvn test-report:publish', 'mix test-helper', 'dotnet test-tools:run']) {
201
+ assert.equal(inferBashActivity(command), undefined, command);
202
+ }
203
+ });
204
+
205
+ // A project runner hands the segment to the tool it names after supplying the
206
+ // environment, so a checker behind `uv run` or `poetry run` is the check the bare
207
+ // checker already is; a program the tables never called a check still names nothing.
208
+ test('a project runner naming a checker names the checking activity', () => {
209
+ for (const command of [
210
+ 'uv run pytest',
211
+ 'uv run pytest -q tests/',
212
+ 'uv run vitest run',
213
+ 'uv run jest',
214
+ 'uv run ruff check .',
215
+ 'uv run mypy src',
216
+ 'uv run tsc --noEmit',
217
+ 'uv run eslint .',
218
+ 'poetry run pytest',
219
+ 'poetry run mypy .',
220
+ // `ruff format --check` reports, so the wrapped form verifies like the bare one.
221
+ 'uv run ruff format --check .',
222
+ ]) {
223
+ assert.equal(inferBashActivity(command), 'checking', command);
224
+ }
225
+ for (const command of ['uv run python x.py', 'poetry run python x.py', 'uv run ruff format .']) {
226
+ assert.equal(inferBashActivity(command), undefined, command);
227
+ }
228
+ });
229
+
230
+ // The wrapped checker must be a whole argument too: `uv run pytest-deploy` runs a program
231
+ // whose name starts with a checker's, so it names nothing.
232
+ test('a program whose name starts with a checker is not the checker', () => {
233
+ for (const command of ['uv run pytest-deploy', 'poetry run jest-reporter', 'uv run mypy-extensions', 'poetry run tsc-watch']) {
234
+ assert.equal(inferBashActivity(command), undefined, command);
235
+ }
236
+ });
237
+
175
238
  // A monorepo flags the workspace before the script, and every value option's value
176
239
  // must be read as the value it is, or `npm --prefix pkg test` would look like the
177
240
  // script `pkg`.
@@ -390,6 +453,20 @@ test('installations, scaffolding and stored configuration name the preparing act
390
453
  }
391
454
  });
392
455
 
456
+ // A container image the call builds is one this machine now has, the build-up `docker`
457
+ // shares with the installers; running, pulling or just looking at one names nothing.
458
+ test('a container image build prepares the machine', () => {
459
+ for (const command of ['docker build .', 'docker build -t app:dev .', 'docker build --file Dockerfile.dev .']) {
460
+ assert.equal(inferBashActivity(command), 'preparing', command);
461
+ }
462
+ for (const command of ['docker ps', 'docker images', 'docker version']) {
463
+ assert.equal(inferBashActivity(command), 'exploring', command);
464
+ }
465
+ for (const command of ['docker run app:dev', 'docker pull app:dev']) {
466
+ assert.equal(inferBashActivity(command), undefined, command);
467
+ }
468
+ });
469
+
393
470
  // An installer told to report prepares nothing: `cargo install --list` lists what is
394
471
  // already installed and `--dry-run` resolves a tree without writing it, so neither
395
472
  // names an identity — and a report-shaped argument never hides the writing form.
@@ -484,6 +561,39 @@ test('remote writes name the publishing activity', () => {
484
561
  }
485
562
  });
486
563
 
564
+ // A package manager's `version` subcommand does two different things: given a bump or a
565
+ // version it rewrites the manifest and the tag, while the bare form and `--version`
566
+ // only print. Only the rewriting form is local history.
567
+ test('a package version bump names the versioning activity while the printing forms inspect', () => {
568
+ for (const command of [
569
+ 'npm version patch',
570
+ 'npm version minor',
571
+ 'npm version major',
572
+ 'npm version 1.2.3',
573
+ 'npm version patch --no-git-tag-version',
574
+ 'pnpm version patch',
575
+ 'yarn version minor',
576
+ 'bun version 1.2.3',
577
+ ]) {
578
+ assert.equal(inferBashActivity(command), 'versioning', command);
579
+ }
580
+ for (const command of ['npm version', 'pnpm version', 'yarn version', 'bun version', 'npm version --version', 'pnpm version --version']) {
581
+ assert.equal(inferBashActivity(command), 'exploring', command);
582
+ }
583
+ });
584
+
585
+ // Publishing a package uploads it to a registry: a remote write from the package
586
+ // manager's own subcommand position, whatever flags the registry needs. Installing
587
+ // and testing beside it keep the families they already wear.
588
+ test('a package publish names the publishing activity', () => {
589
+ for (const command of ['npm publish', 'pnpm publish', 'yarn publish', 'bun publish', 'npm publish --access public', 'yarn publish --tag next']) {
590
+ assert.equal(inferBashActivity(command), 'publishing', command);
591
+ }
592
+ for (const command of ['npm install', 'npm test']) {
593
+ assert.notEqual(inferBashActivity(command), 'publishing', command);
594
+ }
595
+ });
596
+
487
597
  // Moving between branches, aliasing a command and the rest of the stack subcommands
488
598
  // publish nothing and read nothing, so they name no activity at all; viewing a stack
489
599
  // is inspection.
@@ -527,28 +637,57 @@ test('reading or waiting on CI results names the checking activity', () => {
527
637
  }
528
638
  });
529
639
 
530
- // `gh api` writes whenever it is given a method, a field, or an input body, so only
531
- // the plain GET form is a query — and every writing form is a name this classifier
532
- // will not guess at, which leaves the card generic rather than claiming an identity.
533
- test('a gh api call that writes names nothing while the plain GET inspects', () => {
640
+ // `gh api` writes whenever it is given a writing method, a field, or an input body, so
641
+ // only the plain GET form is a query: the writing forms are the remote write they
642
+ // perform, and the GET the call spells out with `-X` reads nothing either way.
643
+ test('a gh api call that writes names the publishing activity while the plain GET inspects', () => {
534
644
  for (const command of [
535
645
  'gh api repos/owner/name/pulls',
536
646
  'gh api --paginate repos/owner/name/commits',
647
+ 'gh api repos/o/n --jq .state',
537
648
  ]) {
538
649
  assert.equal(inferBashActivity(command), 'exploring', command);
539
650
  }
540
651
  for (const command of [
541
652
  'gh api repos/o/n -X POST',
542
653
  'gh api repos/o/n --method POST',
654
+ 'gh api --method=PUT repos/o/n/merge',
655
+ 'gh api repos/o/n -X DELETE',
543
656
  'gh api repos/o/n/issues -f title=x',
544
657
  'gh api repos/o/n/issues --raw-field title=x',
545
658
  'gh api graphql -F query=@q.graphql',
546
659
  'gh api repos/o/n/issues --input body.json',
660
+ ]) {
661
+ assert.equal(inferBashActivity(command), 'publishing', command);
662
+ }
663
+ });
664
+
665
+ // A `gh api` argument that proves no payload is not a write: a method that reads, spelled
666
+ // with quotes or with an `=`; a field flag with no value; and a header VALUE that merely
667
+ // looks like the `-f` flag. None of them may claim the remote write.
668
+ test('a gh api argument that proves no payload stays unnamed', () => {
669
+ for (const command of [
670
+ 'gh api repos/x/y -X "GET"',
671
+ "gh api repos/x/y --method='HEAD'",
672
+ 'gh api repos/x/y -X GET -f per_page=1',
673
+ 'gh api repos/x/y -H "X-Custom: -filename"',
674
+ 'gh api repos/x/y -f',
547
675
  ]) {
548
676
  assert.equal(inferBashActivity(command), undefined, command);
549
677
  }
550
678
  });
551
679
 
680
+ // Running a workflow, or enabling and disabling one, moves work on the remote; listing
681
+ // and viewing one only reads it.
682
+ test('a workflow run or toggle names the publishing activity', () => {
683
+ for (const command of ['gh workflow run ci.yml', 'gh workflow run ci.yml --ref main', 'gh workflow enable ci.yml', 'gh workflow disable ci.yml']) {
684
+ assert.equal(inferBashActivity(command), 'publishing', command);
685
+ }
686
+ for (const command of ['gh workflow list', 'gh workflow view ci.yml']) {
687
+ assert.equal(inferBashActivity(command), 'exploring', command);
688
+ }
689
+ });
690
+
552
691
  // Metadata probes answer "what is here?" without resolving, building or mutating
553
692
  // anything; `go env` writes its configuration with `-w` and `-u`, so those are no
554
693
  // probe, and the writing form is the build-up the next family names.
@@ -1451,6 +1590,91 @@ test('a quoted heredoc body is data, whatever characters it carries', () => {
1451
1590
  assert.equal(inferBashActivity("git commit -F - <<'MSG' > out.txt\nfix\nMSG"), undefined);
1452
1591
  });
1453
1592
 
1593
+ // A `--body` written from a quoted heredoc hands the program the body as data: the
1594
+ // backticks inside it are the prose the PR carries, never a substitution this reader has
1595
+ // to follow, so the call is the remote write it performs.
1596
+ test('a PR body written from a quoted heredoc names the publishing activity', () => {
1597
+ const command = `gh pr create --base main --head feat/jobs-activity-card --title "feat(cards): draw background-job tools in the active card style" --body "$(cat <<'EOF'\n## What\n- \`bash_background\`, \`monitor\`, \`job_stop\` and \`job_list\` are now drawn on the card.\nEOF\n)" 2>&1 | tail -3`;
1598
+ assert.equal(inferBashActivity(command), 'publishing');
1599
+ });
1600
+
1601
+ // The audit's own real command (a session's `gh pr create` with a 20-line body): the body of
1602
+ // a quoted heredoc nested inside `$( … )` is data, and an apostrophe in it is not the shell's
1603
+ // own quote. The scan that finds the end of a substitution reads quotes but not heredoc
1604
+ // bodies, so an ODD number of body apostrophes left it inside a quote and it never found the
1605
+ // `)` that closes the substitution: the gh segment stayed one piece of text with the body
1606
+ // (backticks and all) still in it, and the hidden-substitution veto made the call generic.
1607
+ test('the audit\'s real PR command names the publishing activity', () => {
1608
+ const command = `cd /home/jona/dev/projects/odd-worktree-worktrees/jobs-activity-card && git push -q origin feat/jobs-activity-card 2>&1 | tail -3; gh pr create --base main --head feat/jobs-activity-card --title "feat(cards): draw background-job tools in the active card style" --body "$(cat <<'EOF'
1609
+ ## What
1610
+
1611
+ \`bash_background\`, \`monitor\`, \`job_stop\` and \`job_list\` are registered with no renderer of their own, so Pi draws them in a plain box and neither \`neon\` nor \`float\` ever reaches them. While the bridge's \`Card tags\` line answers with this package's \`activity\` design for the tool, they are now drawn on the card substrate in the shell's chosen style.
1612
+
1613
+ - Call: the tool's mark and word (\`⧗ background\`, \`◉ monitor\`, \`■ stop\`, \`≡ jobs\`) plus the job's label, else the first line of its command; the whole command when expanded.
1614
+ - Result: the job's own answer, first rows collapsed and everything expanded, closing the frame with the call's duration.
1615
+ - \`minimal\`: the call alone while collapsed; a failure still says why.
1616
+ - Any other answer on \`Card tags\` — \`native\`, \`not-covered\`, \`missing\`, another plugin's design, no bridge, a bridge older than the reader — leaves Pi's own drawing untouched.
1617
+
1618
+ The four tools are declared on the \`tags\` line so the bridge can answer for them; the activity design itself returns their rows exactly as drawn.
1619
+
1620
+ ## Limitation
1621
+
1622
+ The gate is read when a job card is built, not on every paint: these tools have no host renderer to forward to, so a switch made mid-session reaches the next job card.
1623
+
1624
+ ## Tests
1625
+
1626
+ \`node --test tools/*.test.js\` → 2561 pass, 0 fail (2547 before, 14 new).
1627
+
1628
+ \`chore(release): 3.4.0\` is in this PR, as the release commit the tag will be cut from.
1629
+ EOF
1630
+ )" 2>&1 | tail -3`;
1631
+ assert.equal(inferBashActivity(command), 'publishing');
1632
+ // The same call as the card reads it when only the `gh` side is replayed, which is how
1633
+ // the audit found it: one segment, body included.
1634
+ assert.equal(inferBashActivity(command.slice(command.indexOf('gh pr create'))), 'publishing');
1635
+ });
1636
+
1637
+ // `<<<` is a herestring, not a heredoc: its second `<` opens no header, so nothing after it
1638
+ // is a body this reader may skip. Reading it as one ate the `)` that closes the `$( … )`,
1639
+ // left the call unsplit and named the write it only wrapped.
1640
+ test('a herestring is not a heredoc header', () => {
1641
+ const command = 'gh pr create --body "$(cat <<<date)" && ./unclassified.sh\ndate';
1642
+ assert.equal(inferBashActivity(command), undefined);
1643
+ assert.equal(inferBashActivity('gh pr create --body "$(cat <<<date)"'), 'publishing');
1644
+ });
1645
+
1646
+ // A heredoc's header line is still text the shell acts on: the `)` that closes the inner
1647
+ // subshell sits on it, and only the body after the newline is data. Skipping to the body's
1648
+ // end ate that `)` and left the substitution unclosed, so the whole call was named after
1649
+ // the text it could not split.
1650
+ test('a heredoc header line is text the shell acts on', () => {
1651
+ const command = "gh pr create --body \"$( (cat <<'X')\nplain\nX\n)\" && ./unclassified.sh";
1652
+ assert.equal(inferBashActivity(command), undefined);
1653
+ assert.equal(inferBashActivity("gh pr create --body \"$( (cat <<'X')\nplain\nX\n)\""), 'publishing');
1654
+ });
1655
+
1656
+ // The substitution veto is not weakened: a command hidden where this reader cannot follow
1657
+ // it — a backtick in the text the shell acts on, a `<(...)` process substitution, a heredoc
1658
+ // whose delimiter is UNQUOTED and therefore expands its body — still keeps the whole card
1659
+ // generic. A `$(...)` is a different shape: the segmenter DOES follow it, so
1660
+ // `--body "$(git log --oneline -1)"` is read as the `git log` it runs beside the
1661
+ // `gh pr create` write, and names that write.
1662
+ test('a substitution the reader cannot follow still keeps the call generic', () => {
1663
+ for (const command of [
1664
+ 'gh pr create --body "see `date` now"',
1665
+ 'gh pr create --body <(date)',
1666
+ 'gh pr create --title "`git rev-parse HEAD`" --body x',
1667
+ // A real backtick beside a named write still leaves the whole call unnamed.
1668
+ 'git push && cat `ls`',
1669
+ 'echo "a `b` c"',
1670
+ // An unquoted delimiter expands its body, so a substitution there may run anything.
1671
+ "gh pr create --body \"$(cat <<EOF\nsee `date`\nEOF\n)\"",
1672
+ ]) {
1673
+ assert.equal(inferBashActivity(command), undefined, command);
1674
+ }
1675
+ assert.equal(inferBashActivity('gh pr create --body "$(git log --oneline -1)"'), 'publishing');
1676
+ });
1677
+
1454
1678
  // A redirect that only CREATES a file from a read or from text is the build-up the
1455
1679
  // `preparing` family already names for `mkdir`, `touch` and `cp`; it is never a mutation
1456
1680
  // of anything else, so a mutating command beside a redirect stays generic.