pi-odd-worktree 3.6.0 → 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.
- package/README.md +1 -1
- package/lib/bash-activity.js +97 -2
- package/lib/file-card.js +29 -12
- package/lib/skill-odd-card.js +33 -8
- package/package.json +1 -1
- package/tools/bash-activity.test.js +228 -4
- package/tools/file-card.test.js +172 -15
- package/tools/skill-odd-card.test.js +45 -3
package/README.md
CHANGED
|
@@ -73,7 +73,7 @@ The full rules of each step, including every refusal, are in [Create, list, move
|
|
|
73
73
|
- **The issues rail is checkout-scoped and optional.** When a Gentle Shell has `gentle-shell-bridge` installed and draws its rail, a `GITHUB` rail section lists the open issues of this checkout's repository assigned to you — that one repository, not every issue across every repository you touch — seven at a time, with `and N more issues` for the rest and a pull-request mark on the issues that already have one. A click opens that issue in the `/issues` panel on `Assigned`, not in a browser: the click first proves the number belongs to this checkout, so a row left over from another checkout — or a checkout whose repository cannot be proven — opens nothing instead of guessing, and `/issues`' own `o` key is still the browser. The overflow row opens `/issues` with no number. While the rail's cache holds this repository, `/issues` paints its first frame from it and reads one tab at mount instead of three, the other two reading the first time you open them; the cache outlives both the session and the process — one document under `$XDG_CACHE_HOME/odd-worktree/` — so a warm checkout's first read is already a delta. A frame never waits on `gh`, and neither does a session start: the `gh` gate is dispatched, never awaited, so no child process and no network call sits on opening or switching a session. While the section is drawn it re-reads on its own 20 s timer, keeps no timer while hidden and stops the moment it is no longer drawn, and a `bash` command that mutates an issue or a pull request forces one read behind a 5 s cap; a failed refresh keeps the rows and marks them `stale` rather than emptying the list. Without `gh` on `PATH` neither the section nor `/issues` exists at all — the command is never registered and the section is never added to the rail — and every other surface keeps working. With no bridge the section simply never appears; the one thing you get is a single warning naming the install command, in a primary session only. See [the rail section](docs/reference.md#the-github-rail-section).
|
|
74
74
|
- **Cards follow your shell.** Tool and warp cards use the card style Gentle Shell publishes, and a click expands that card only. See [card style](docs/reference.md#card-style-follows-your-shell).
|
|
75
75
|
- **Tool headings can name the activity.** With `activity` chosen on the `Card tags` line, a bash card whose heading shows the whole command is headed with the family its command names (mark and word) instead of `$`, and a `grep`, `find` or `ls` card is headed `⌕ exploring` instead of its own glyph and name, while a `read` — which runs no shell command — keeps the host's own card, colour and width; a bash command the classifier cannot name, or a heading that hides part of it, keeps the host's `$`. See [the cards the `activity` design paints](docs/reference.md#the-cards-the-activity-design-paints).
|
|
76
|
-
- **File calls on a skill or an ODD are cards too.** While `Card tags` answers with `activity` for the tool being painted, a `read`, `edit` or `write` call whose path names a skill (anything below a `skills` folder) or an ODD (anything below an `odd` folder) heads as that file, with the tool, the path and a read's line range; its Markdown body — the whole document when expanded, the first rows when collapsed — is drawn by Pi's own renderer in the theme's Markdown roles
|
|
76
|
+
- **File calls on a skill or an ODD are cards too.** While `Card tags` answers with `activity` for the tool being painted, a `read`, `edit` or `write` call whose path names a skill (anything below a `skills` folder) or an ODD (anything below an `odd` folder) heads as that file, with the tool, the path and a read's line range; its Markdown body — the whole document when expanded, the first rows when collapsed — is drawn by Pi's own renderer in the theme's Markdown roles — for an `edit`, the fragment it leaves behind, never its diff, and a call that leaves no fragment falls back to its own rows. Any other file call, and every call while that line answers anything else, is the host's own row. See [the file cards](docs/reference.md#the-file-cards).
|
|
77
77
|
- **Background-job tools are cards too.** While `Card tags` answers with `activity` for the tool being painted, `bash_background`, `monitor`, `job_stop` and `job_list` are drawn in the shell's own card style instead of Pi's plain box. Any other answer leaves Pi's box untouched. See [the jobs card](docs/reference.md#the-jobs-card).
|
|
78
78
|
- **`edit` and `write` cannot land in the principal checkout's default branch.** A write whose path is inside the principal checkout of the session's repository, while that checkout is on the default branch, is refused with one line pointing at `worktree_list` and `worktree_create`. Paths outside the repository, anything under the OS temp directories, other repositories and linked worktrees are never blocked. See [the guard](docs/reference.md#the-edit-and-write-guard).
|
|
79
79
|
- **`bash` cannot leave the principal checkout's default branch.** A `git worktree add` or `git worktree list` is refused in any cwd and pointed at `worktree_create` and `worktree_list`; in the principal checkout, a switch that would leave the branch it is on is refused while that branch is the repository's default, and creating a branch is not blocked. See [the guards](docs/reference.md#the-bash-guards).
|
package/lib/bash-activity.js
CHANGED
|
@@ -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
|
-
|
|
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 ===
|
|
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/lib/file-card.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// `read`/`edit`/`write` heading in `extensions/quiet-tools.ts`, read read-only, L3),
|
|
10
10
|
// split so classification and drawing never share a decision: `lib/skill-odd-card.js`
|
|
11
11
|
// says WHICH card a path wears and which call shape it states (the file's name, the
|
|
12
|
-
// range only a read asked for, the Markdown document
|
|
12
|
+
// range only a read asked for, the Markdown document a read, a write or an edit draws);
|
|
13
13
|
// this module only dresses that answer.
|
|
14
14
|
//
|
|
15
15
|
// What the card never decides:
|
|
@@ -206,9 +206,24 @@ function resultText(result) {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
/**
|
|
209
|
-
* What
|
|
210
|
-
*
|
|
211
|
-
*
|
|
209
|
+
* What a result states as its body. A write states the document its call carried, because
|
|
210
|
+
* its result only reports how many bytes landed. An edit states the fragment its call left
|
|
211
|
+
* behind, which is the same source its Markdown document is drawn from: a host that cannot
|
|
212
|
+
* draw the document falls back to that fragment rather than to the diff, so the card answers
|
|
213
|
+
* one question either way. Every other call states what its result reported, and a FAILED
|
|
214
|
+
* call of any of them still states its error.
|
|
215
|
+
*/
|
|
216
|
+
function resultBody(tool, args, result, failed, document) {
|
|
217
|
+
if (failed) return fileResultText(tool, result);
|
|
218
|
+
if (tool === WRITE_TOOL) return writtenContent(args);
|
|
219
|
+
if (tool === EDIT_TOOL && document !== undefined) return document;
|
|
220
|
+
return fileResultText(tool, result);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* What one result states as rows: an edit's DIFF (the change the host carries) when the
|
|
225
|
+
* call leaves no Markdown fragment to draw; every other call is the text the result
|
|
226
|
+
* reported — and a write's or an edit's document comes from its call, not from here.
|
|
212
227
|
*/
|
|
213
228
|
function fileResultText(tool, result) {
|
|
214
229
|
const value = asObject(result);
|
|
@@ -599,9 +614,10 @@ function fileResultSlot(tool, inherited, seams, shell) {
|
|
|
599
614
|
const expanded = optionFlag(options, ctx, 'expanded');
|
|
600
615
|
const tone = cardTone(failed, partial);
|
|
601
616
|
// A write states the document its call carried; its result says how many bytes
|
|
602
|
-
// landed, which is no body at all.
|
|
603
|
-
//
|
|
604
|
-
const
|
|
617
|
+
// landed, which is no body at all. An edit states the fragment its call left, and
|
|
618
|
+
// its diff is the body only when that fragment is nothing.
|
|
619
|
+
const document = markdownDocumentSource(tool, args, resultText(result), { expanded: true, isError: failed });
|
|
620
|
+
const text = resultBody(tool, args, result, failed, document);
|
|
605
621
|
// One frame: from here on the call above is a heading and this card closes it.
|
|
606
622
|
markCardResult(ctx.state);
|
|
607
623
|
return floatRows(tone, paint, width, (inner) => {
|
|
@@ -609,11 +625,12 @@ function fileResultSlot(tool, inherited, seams, shell) {
|
|
|
609
625
|
// repaints the rows it decides.
|
|
610
626
|
const rows = fileResultRows({
|
|
611
627
|
text,
|
|
612
|
-
// A read draws the text it read
|
|
613
|
-
// edit
|
|
614
|
-
//
|
|
615
|
-
// its first rows (S4), the expanded
|
|
616
|
-
|
|
628
|
+
// A read draws the text it read, a write the content its call carries and an
|
|
629
|
+
// edit the fragment it leaves; the rows of the three are the diff or the
|
|
630
|
+
// result only when there is no document. The document is asked for whatever
|
|
631
|
+
// the expansion — the collapsed card shows its first rows (S4), the expanded
|
|
632
|
+
// one the whole of it.
|
|
633
|
+
markdown: document,
|
|
617
634
|
expanded,
|
|
618
635
|
failed,
|
|
619
636
|
content: seams.content(),
|
package/lib/skill-odd-card.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// T1 (S1): the file a `read`/`edit`/`write` call names — a skill or an ODD artifact —
|
|
3
3
|
// as the card identity that call heads with. Pure classification and the two call
|
|
4
4
|
// shapes a file card states: the line range only a read asked for, and the Markdown
|
|
5
|
-
// document
|
|
5
|
+
// document a read, a write or an edit draws.
|
|
6
6
|
//
|
|
7
7
|
// The classification is about path components, never substrings: `skills` and `odd`
|
|
8
8
|
// are folder names, so `lib/skillset/notes.md` and `docs/oddity.md` are ordinary
|
|
@@ -147,24 +147,48 @@ function fileCardLineRange(tool, args) {
|
|
|
147
147
|
return limit === undefined ? `:${start}` : `:${start}-${start + limit - 1}`;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
+
/**
|
|
151
|
+
* The Markdown fragment an `edit` call leaves behind, or undefined when it leaves no text.
|
|
152
|
+
*
|
|
153
|
+
* An edit states its answer as the text it produced, never as the change it made: the
|
|
154
|
+
* harness hands one `edits` array over (one entry per replacement, a legacy top-level
|
|
155
|
+
* pair folded into it), so those entries are read in their OWN order and joined with one
|
|
156
|
+
* newline — two replacements read as the two paragraphs they leave. A call that states
|
|
157
|
+
* no array is the legacy flat pair, whose one `newText` is the fragment. `oldText` is
|
|
158
|
+
* never read, because it names exactly what this document must not show.
|
|
159
|
+
*
|
|
160
|
+
* An entry that states no string is skipped rather than stringified, and a fragment that
|
|
161
|
+
* holds no non-whitespace text is no fragment at all: a pure deletion leaves nothing to
|
|
162
|
+
* draw, and the caller keeps the rows it already has instead of an invented placeholder.
|
|
163
|
+
*/
|
|
164
|
+
function editedFragment(args) {
|
|
165
|
+
const call = args !== null && typeof args === 'object' ? args : undefined;
|
|
166
|
+
const entries = Array.isArray(call?.edits) ? call.edits : undefined;
|
|
167
|
+
const stated = entries === undefined ? [call?.newText] : entries.map((entry) => entry?.newText);
|
|
168
|
+
const fragment = stated.filter((text) => typeof text === 'string').join('\n');
|
|
169
|
+
return fragment.trim().length > 0 ? fragment : undefined;
|
|
170
|
+
}
|
|
171
|
+
|
|
150
172
|
/**
|
|
151
173
|
* The Markdown document a call draws instead of its result rows, or undefined when the
|
|
152
174
|
* call draws rows.
|
|
153
175
|
*
|
|
154
176
|
* Markdown is the shape a document is written in, not a property of where it lives: an
|
|
155
|
-
* expanded read of any `.md` file,
|
|
156
|
-
* whatever folder holds them. Everything else keeps its rows — a
|
|
157
|
-
* because the preview is the first rows of the file; a failed call,
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
177
|
+
* expanded read of any `.md` file, an expanded write to one, and an expanded edit of one,
|
|
178
|
+
* render as a document whatever folder holds them. Everything else keeps its rows — a
|
|
179
|
+
* collapsed card, because the preview is the first rows of the file; a failed call,
|
|
180
|
+
* because its rows are the error; a pure deletion, whose `editedFragment` is undefined
|
|
181
|
+
* and whose rows are therefore the diff; and every non-Markdown file. A write draws the
|
|
182
|
+
* content it wrote and an edit the fragment it left, both carried by the call, which the
|
|
183
|
+
* result neither echoes nor states.
|
|
161
184
|
*/
|
|
162
185
|
function markdownDocumentSource(tool, args, resultText, options) {
|
|
163
186
|
const settings = options !== null && typeof options === 'object' ? options : {};
|
|
164
187
|
if (settings.expanded !== true || settings.isError === true) return undefined;
|
|
165
|
-
if (tool !== 'read' && tool !== 'write') return undefined;
|
|
188
|
+
if (tool !== 'read' && tool !== 'write' && tool !== 'edit') return undefined;
|
|
166
189
|
const call = args !== null && typeof args === 'object' ? args : undefined;
|
|
167
190
|
if (!isMarkdownFile(call?.path)) return undefined;
|
|
191
|
+
if (tool === 'edit') return editedFragment(call);
|
|
168
192
|
const source = tool === 'write' ? call?.content : resultText;
|
|
169
193
|
return typeof source === 'string' && source.trim().length > 0 ? source : undefined;
|
|
170
194
|
}
|
|
@@ -179,5 +203,6 @@ module.exports = {
|
|
|
179
203
|
fileCardSkillPath,
|
|
180
204
|
isMarkdownFile,
|
|
181
205
|
fileCardLineRange,
|
|
206
|
+
editedFragment,
|
|
182
207
|
markdownDocumentSource,
|
|
183
208
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-odd-worktree",
|
|
3
|
-
"version": "3.6.
|
|
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
|
|
531
|
-
// the plain GET form is a query
|
|
532
|
-
//
|
|
533
|
-
test('a gh api call that writes names
|
|
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.
|
package/tools/file-card.test.js
CHANGED
|
@@ -1146,21 +1146,178 @@ test('a failed call and a non-Markdown file keep their plain rows (S8)', () => {
|
|
|
1146
1146
|
assert.deepEqual(json.slice(0, -1).map(bodyText), ['{"a":1}'], 'a non-Markdown file is drawn as it is');
|
|
1147
1147
|
});
|
|
1148
1148
|
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
const
|
|
1163
|
-
|
|
1149
|
+
// ---- S1/S2/S3/S4/S5/S6: an edit states the fragment it leaves, drawn as a document ----
|
|
1150
|
+
|
|
1151
|
+
// The two shapes an `edit` call arrives in: the `edits` array the harness folds a legacy
|
|
1152
|
+
// pair into (one entry per replacement), and the flat top-level pair itself.
|
|
1153
|
+
const EDITS = [{ oldText: '# Old heading', newText: '# Handoff\n\nBody text' }, { oldText: 'x', newText: '```\nconst a = 1;\n```' }];
|
|
1154
|
+
const FRAGMENT = ['# Handoff', '', 'Body text', '```', 'const a = 1;', '```'].join('\n');
|
|
1155
|
+
// The host's own rows for that call: a hunk header, the removed lines and the added ones.
|
|
1156
|
+
const EDIT_DIFF = ['@@ -2,3 +2,3 @@', '-# Old heading', '-removed line', '+# Handoff', '+Body text'].join('\n');
|
|
1157
|
+
const editResult = () => textResult('Edited', { details: { diff: EDIT_DIFF } });
|
|
1158
|
+
|
|
1159
|
+
test('an edit of a Markdown skill or ODD artifact draws the fragment it leaves (S1)', () => {
|
|
1160
|
+
const resolver = documentResolver();
|
|
1161
|
+
const rows = resultRows(resolver, 'edit', { path: ODD, edits: EDITS }, editResult(), { expanded: true, isPartial: false }, taggedTheme, 60);
|
|
1162
|
+
const body = rows.slice(0, -1).join('\n');
|
|
1163
|
+
// The fragment is a document, drawn in the renderer's own roles.
|
|
1164
|
+
assert.equal(body.includes('<mdHeading>Handoff</mdHeading>'), true, `the fragment's heading is drawn as a heading: ${body}`);
|
|
1165
|
+
assert.equal(body.includes('<mdCodeBlock>const a = 1;</mdCodeBlock>'), true, 'so is its fenced block');
|
|
1166
|
+
// None of the host's diff rows are left: no hunk header, no gutter, no `+`/`-` marker,
|
|
1167
|
+
// and no line the edit removed.
|
|
1168
|
+
const text = unpaint(body);
|
|
1169
|
+
assert.equal(text.includes('@@'), false, 'no hunk header');
|
|
1170
|
+
assert.equal(text.includes('removed line'), false, 'a line the edit removed is never shown');
|
|
1171
|
+
assert.equal(text.includes('-# Old heading'), false, 'no removed marker');
|
|
1172
|
+
assert.equal(text.includes('+# Handoff'), false, 'no added marker');
|
|
1173
|
+
assert.doesNotMatch(text, /^\s*\d+ │/mu, 'no line-number gutter');
|
|
1174
|
+
// A host diff that carries a gutter row of its own reaches the body no more than the
|
|
1175
|
+
// rest of it does: no digit ever stands beside the diff's own bar.
|
|
1176
|
+
const gutted = resultRows(
|
|
1177
|
+
resolver,
|
|
1178
|
+
'edit',
|
|
1179
|
+
{ path: ODD, edits: EDITS },
|
|
1180
|
+
textResult('Edited', { details: { diff: ['@@ -1,1 +1,1 @@', ' 12 │ -old line', ' 12 │ +new line'].join('\n') } }),
|
|
1181
|
+
{ expanded: true, isPartial: false },
|
|
1182
|
+
taggedTheme,
|
|
1183
|
+
60,
|
|
1184
|
+
);
|
|
1185
|
+
assert.doesNotMatch(unpaint(gutted.slice(0, -1).join('\n')), /\d+\s*│|│\s*\d+/u, 'a gutter row is never drawn');
|
|
1186
|
+
// The same rows a read of the resulting text draws, exactly.
|
|
1187
|
+
const read = resultRows(resolver, 'read', { path: ODD }, textResult(FRAGMENT), { expanded: true, isPartial: false }, taggedTheme, 60);
|
|
1188
|
+
assert.deepEqual(rows, read, 'the fragment is drawn exactly as a read of it is');
|
|
1189
|
+
|
|
1190
|
+
// The legacy flat shape is the same call, so it draws the same fragment.
|
|
1191
|
+
const flat = resultRows(
|
|
1192
|
+
resolver,
|
|
1193
|
+
'edit',
|
|
1194
|
+
{ path: ODD, oldText: '# Old heading', newText: FRAGMENT },
|
|
1195
|
+
editResult(),
|
|
1196
|
+
{ expanded: true, isPartial: false },
|
|
1197
|
+
taggedTheme,
|
|
1198
|
+
60,
|
|
1199
|
+
);
|
|
1200
|
+
assert.deepEqual(flat, rows, 'either call shape states the same fragment');
|
|
1201
|
+
|
|
1202
|
+
// A skill's Markdown file is the same card: the claim is the identity, not the tool. The
|
|
1203
|
+
// rows must be the ones a read of that same fragment on that same skill path draws, so a
|
|
1204
|
+
// skill card that fell back to its raw source, or to the diff, cannot pass.
|
|
1205
|
+
const skillEdit = resultRows(resolver, 'edit', { path: SKILL, edits: EDITS }, editResult(), { expanded: true, isPartial: false }, taggedTheme, 60);
|
|
1206
|
+
const skillRead = resultRows(resolver, 'read', { path: SKILL }, textResult(FRAGMENT), { expanded: true, isPartial: false }, taggedTheme, 60);
|
|
1207
|
+
assert.deepEqual(skillEdit, skillRead, 'a skill edit draws exactly a read of its fragment');
|
|
1208
|
+
const skillBody = skillEdit.slice(0, -1).join('\n');
|
|
1209
|
+
const skillText = unpaint(skillBody);
|
|
1210
|
+
assert.equal(skillBody.includes('<mdHeading>Handoff</mdHeading>'), true, 'in the renderer\'s own roles');
|
|
1211
|
+
assert.equal(skillBody.includes('<mdCodeBlock>const a = 1;</mdCodeBlock>'), true, 'fenced block included');
|
|
1212
|
+
assert.equal(skillText.includes('@@'), false, 'and never the diff');
|
|
1213
|
+
assert.equal(skillText.includes('-# Old heading'), false, 'no removed marker');
|
|
1214
|
+
assert.equal(skillText.includes('+# Handoff'), false, 'no added marker');
|
|
1215
|
+
assert.doesNotMatch(skillText, /\d+\s*│|│\s*\d+/u, 'no line-number gutter');
|
|
1216
|
+
});
|
|
1217
|
+
|
|
1218
|
+
// The array is the whole source when it is present: only an ABSENT or non-array `edits`
|
|
1219
|
+
// falls back to the legacy pair, so a pair beside an empty array states nothing.
|
|
1220
|
+
test('an `edits` array, even an empty one, is the whole source (S2)', () => {
|
|
1221
|
+
const resolver = documentResolver();
|
|
1222
|
+
const args = { path: ODD, edits: [], newText: '# Competing legacy text' };
|
|
1223
|
+
const rows = resultRows(resolver, 'edit', args, editResult(), { expanded: true, isPartial: false }, taggedTheme, 60);
|
|
1224
|
+
assert.deepEqual(rows.slice(0, -1).map(bodyText), EDIT_DIFF.split('\n'), 'the diff rows, not the legacy fragment beside the array');
|
|
1225
|
+
assert.equal(rows.slice(0, -1).join('\n').includes('Competing legacy text'), false, 'the pair is not drawn at all');
|
|
1226
|
+
});
|
|
1227
|
+
|
|
1228
|
+
test('a pure deletion keeps the edit\'s rows, with no invented placeholder (S3)', () => {
|
|
1229
|
+
const resolver = documentResolver();
|
|
1230
|
+
// Longer than the preview budget, so the collapsed and the expanded case draw different
|
|
1231
|
+
// amounts of the same diff.
|
|
1232
|
+
const lines = ['@@ -1,4 +1,0 @@', '-# Design', '-Body text', '-More body', '-Last body'];
|
|
1233
|
+
const result = textResult('Edited', { details: { diff: lines.join('\n') } });
|
|
1234
|
+
for (const edits of [[{ oldText: '# Design\nBody text', newText: '' }], [{ oldText: 'a', newText: ' \n ' }]]) {
|
|
1235
|
+
const collapsed = resultRows(resolver, 'edit', { path: ODD, edits }, result, { isPartial: false }, taggedTheme, 60);
|
|
1236
|
+
assert.deepEqual(collapsed.slice(0, -1).map(bodyText), lines.slice(0, PREVIEW_ROWS), 'collapsed: the first rows of the diff, capped as any body is');
|
|
1237
|
+
const expanded = resultRows(resolver, 'edit', { path: ODD, edits }, result, { expanded: true, isPartial: false }, taggedTheme, 60);
|
|
1238
|
+
assert.deepEqual(expanded.slice(0, -1).map(bodyText), lines, 'expanded: the whole diff, row for row, never a document');
|
|
1239
|
+
assert.equal(bodyPaint(expanded.slice(0, -1).join('\n')).includes('<mdHeading>'), false, 'and none of it is drawn as Markdown');
|
|
1240
|
+
}
|
|
1241
|
+
// A result that carries no diff is its own text, exactly as before.
|
|
1242
|
+
const plain = resultRows(resolver, 'edit', { path: ODD, edits: [{ newText: '' }] }, textResult('Edited 2 lines'), { isPartial: false }, plainTheme, 60);
|
|
1243
|
+
assert.deepEqual(plain.slice(0, -1).map(bodyText), ['Edited 2 lines'], 'no wording is invented for the deleted fragment');
|
|
1244
|
+
});
|
|
1245
|
+
|
|
1246
|
+
test('a failed edit keeps its error rows, and no other path becomes a document (S4)', () => {
|
|
1247
|
+
const resolver = documentResolver();
|
|
1248
|
+
const failed = resultRows(resolver, 'edit', { path: ODD, edits: EDITS }, textResult('ENOENT: no such file', { isError: true }), { expanded: true, isPartial: false }, taggedTheme, 60);
|
|
1249
|
+
assert.deepEqual(failed.slice(0, -1).map(bodyText), ['ENOENT: no such file'], 'exactly the error, with no body row of its own');
|
|
1250
|
+
const failedBody = failed.slice(0, -1).join('\n');
|
|
1251
|
+
assert.equal(failedBody.includes('<mdHeading>'), false, 'a failed edit is never a document');
|
|
1252
|
+
assert.match(failed[0], /^<error>│/u, 'and it wears the error role');
|
|
1253
|
+
|
|
1254
|
+
// A non-Markdown ODD artifact keeps its diff.
|
|
1255
|
+
const json = resultRows(resolver, 'edit', { path: 'odd/tasks/data.json', edits: [{ newText: '## Handoff' }] }, editResult(), { isPartial: false }, plainTheme, 60);
|
|
1256
|
+
assert.deepEqual(json.slice(0, -1).map(bodyText), ['@@ -2,3 +2,3 @@', '-# Old heading', '-removed line'], 'a non-Markdown path keeps its diff rows');
|
|
1257
|
+
|
|
1258
|
+
// A path with no skill or ODD identity is no row of this card at all: the chain keeps it.
|
|
1259
|
+
const forwarded = resolver('edit', () => HOST_EDIT)
|
|
1260
|
+
.renderResult(editResult(), { isPartial: false }, plainTheme, { args: { path: 'docs/notes.md', edits: EDITS } })
|
|
1261
|
+
.render(60);
|
|
1262
|
+
assert.deepEqual(forwarded, ['host edit result'], 'an ordinary Markdown file is the chain\'s row');
|
|
1263
|
+
});
|
|
1264
|
+
|
|
1265
|
+
test('without a Markdown renderer the edit body is the same fragment, never the diff (S6)', () => {
|
|
1266
|
+
const drawsNothing = class { render() { return []; } invalidate() {} };
|
|
1267
|
+
const throws = class { render() { throw new Error('renderer exploded'); } invalidate() {} };
|
|
1268
|
+
const cases = [['no renderer', null], ['a renderer that throws', throws], ['a renderer that draws nothing', drawsNothing]];
|
|
1269
|
+
// The fragment's own lines are all such a host can draw: its first PREVIEW_ROWS collapsed,
|
|
1270
|
+
// every one of them expanded. Asserted exactly, so a dropped heading or fence row fails.
|
|
1271
|
+
const lines = FRAGMENT.split('\n');
|
|
1272
|
+
for (const [label, markdownClass] of cases) {
|
|
1273
|
+
const resolver = fileResolver({ markdownClass });
|
|
1274
|
+
const args = { path: ODD, edits: EDITS };
|
|
1275
|
+
for (const options of [{ isPartial: false }, { expanded: true, isPartial: false }]) {
|
|
1276
|
+
const rows = resultRows(resolver, 'edit', args, editResult(), options, taggedTheme, 60);
|
|
1277
|
+
const expected = options.expanded === true ? lines : lines.slice(0, PREVIEW_ROWS);
|
|
1278
|
+
assert.deepEqual(rows.slice(0, -1).map(bodyText), expected, `${label}: every fragment row it draws, in order`);
|
|
1279
|
+
assert.match(unpaint(rows.at(-1)), /^╰.*╯$/u, `${label}: and its own closing rule`);
|
|
1280
|
+
assert.equal(bodyPaint(rows.slice(0, -1).join('\n')).includes('<mdHeading>'), false, `${label}: as plain source, in no Markdown role`);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
});
|
|
1284
|
+
|
|
1285
|
+
test('a collapsed edit previews the fragment exactly like a write of it (S5)', () => {
|
|
1286
|
+
const resolver = documentResolver();
|
|
1287
|
+
const args = { path: ODD, edits: [{ newText: DOCUMENT }] };
|
|
1288
|
+
const collapsed = resultRows(resolver, 'edit', args, editResult(), { isPartial: false }, taggedTheme, 60);
|
|
1289
|
+
const write = resultRows(resolver, 'write', { path: ODD, content: DOCUMENT }, textResult('Wrote 42 bytes'), { isPartial: false }, taggedTheme, 60);
|
|
1290
|
+
assert.equal(collapsed.length, PREVIEW_ROWS + 1, 'three preview rows and the closing rule');
|
|
1291
|
+
assert.deepEqual(collapsed.slice(0, PREVIEW_ROWS), write.slice(0, PREVIEW_ROWS), 'the same preview a write of the document draws');
|
|
1292
|
+
const preview = collapsed.slice(0, PREVIEW_ROWS).join('\n');
|
|
1293
|
+
assert.equal(preview.includes('<mdHeading>Design</mdHeading>'), true, `the preview starts at the fragment's top: ${preview}`);
|
|
1294
|
+
assert.equal(preview.includes('<mdCodeBlock>const a = 1;</mdCodeBlock>'), false, 'the preview stops at its budget');
|
|
1295
|
+
|
|
1296
|
+
// Expanded, all of it: exactly the rows a write of the same document draws, so a row
|
|
1297
|
+
// dropped from the middle cannot pass, and every drawn row of the document is there.
|
|
1298
|
+
const expanded = resultRows(resolver, 'edit', args, editResult(), { expanded: true, isPartial: false }, taggedTheme, 60);
|
|
1299
|
+
const expandedWrite = resultRows(resolver, 'write', { path: ODD, content: DOCUMENT }, textResult('Wrote 42 bytes'), { expanded: true, isPartial: false }, taggedTheme, 60);
|
|
1300
|
+
assert.deepEqual(expanded, expandedWrite, 'expanding an edit is the whole document, row for row');
|
|
1301
|
+
assert.ok(expanded.length > PREVIEW_ROWS + 1, 'and it is more than the collapsed preview draws');
|
|
1302
|
+
assert.equal(unpaint(expanded.slice(0, -1).join('\n')).includes('@@'), false, 'and no diff row anywhere');
|
|
1303
|
+
|
|
1304
|
+
// `minimal` draws the call alone: the heading above it is still the call's, and the
|
|
1305
|
+
// result is its closing rule with no body under it.
|
|
1306
|
+
globalThis[CARD_CONTENT_SLOT] = 'minimal';
|
|
1307
|
+
try {
|
|
1308
|
+
const call = callRows(resolver, 'edit', args, taggedTheme, 60);
|
|
1309
|
+
assert.equal(call.length, 1, 'the call is its one heading row at either level');
|
|
1310
|
+
assert.match(unpaint(call[0]), /📑 odd/u, 'and it still heads as the ODD artifact');
|
|
1311
|
+
assert.match(unpaint(call[0]), /edit/u, 'naming the tool');
|
|
1312
|
+
assert.match(unpaint(call[0]), /cards-skill-odd\.md/u, 'and the file');
|
|
1313
|
+
const minimal = resultRows(resolver, 'edit', args, editResult(), { isPartial: false }, taggedTheme, 60);
|
|
1314
|
+
assert.equal(minimal.length, 1, 'the closing rule alone');
|
|
1315
|
+
assert.match(unpaint(minimal[0]), /^╰.*╯$/u, 'with no body above it');
|
|
1316
|
+
assert.doesNotMatch(unpaint(minimal[0]), /Design|quoted|```/u, 'and nothing of the document on it');
|
|
1317
|
+
assertFramed(minimal, 60);
|
|
1318
|
+
} finally {
|
|
1319
|
+
delete globalThis[CARD_CONTENT_SLOT];
|
|
1320
|
+
}
|
|
1164
1321
|
});
|
|
1165
1322
|
|
|
1166
1323
|
test('a failed result keeps its error rows and the error tone', () => {
|
|
@@ -14,6 +14,7 @@ const {
|
|
|
14
14
|
FILE_CARD_IDENTITY,
|
|
15
15
|
ODD_FILE_CARD,
|
|
16
16
|
SKILL_FILE_CARD,
|
|
17
|
+
editedFragment,
|
|
17
18
|
fileCardIdentity,
|
|
18
19
|
fileCardLineRange,
|
|
19
20
|
fileCardName,
|
|
@@ -175,19 +176,31 @@ test('a read names the line range it asked for, and no other tool states one', (
|
|
|
175
176
|
assert.equal(fileCardLineRange('read', undefined), undefined);
|
|
176
177
|
});
|
|
177
178
|
|
|
179
|
+
// The fragment source itself, as the one answer both the document and its plain fallback
|
|
180
|
+
// are drawn from.
|
|
181
|
+
test('the fragment an edit leaves is every `newText` it states, and nothing else', () => {
|
|
182
|
+
assert.equal(editedFragment({ edits: [{ newText: 'a' }, { newText: 'b' }] }), 'a\nb');
|
|
183
|
+
assert.equal(editedFragment({ newText: 'a' }), 'a');
|
|
184
|
+
assert.equal(editedFragment({ edits: [{ oldText: 'gone', newText: '' }] }), undefined);
|
|
185
|
+
assert.equal(editedFragment(undefined), undefined);
|
|
186
|
+
});
|
|
187
|
+
|
|
178
188
|
// A Markdown document is drawn as a document only when expanded and successful; a read
|
|
179
|
-
// draws what it returned, a write what its call carried,
|
|
180
|
-
|
|
189
|
+
// draws what it returned, a write what its call carried, an edit the fragment it leaves
|
|
190
|
+
// behind, and nothing to draw keeps the rows.
|
|
191
|
+
test('an expanded, successful read, write or edit of a Markdown file draws a document', () => {
|
|
181
192
|
const markdown = '## Handoff\n\nBody.';
|
|
182
193
|
const draw = (tool, args, result, options = {}) =>
|
|
183
194
|
markdownDocumentSource(tool, args, result, { expanded: true, ...options });
|
|
184
195
|
assert.equal(draw('read', { path: 'docs/a.md' }, markdown), markdown);
|
|
185
196
|
assert.equal(draw('write', { path: 'docs/a.md', content: markdown }, 'Successfully wrote 20 bytes'), markdown);
|
|
197
|
+
// An edit's document is the text it leaves behind, never what it removed or its diff.
|
|
198
|
+
assert.equal(draw('edit', { path: 'docs/a.md', oldText: 'a', newText: markdown }, 'Applied'), markdown);
|
|
186
199
|
// Collapsed, failed, non-Markdown and every other tool keep their rows.
|
|
187
200
|
assert.equal(draw('read', { path: 'docs/a.md' }, markdown, { expanded: false }), undefined);
|
|
188
201
|
assert.equal(draw('read', { path: 'docs/a.md' }, markdown, { isError: true }), undefined);
|
|
189
202
|
assert.equal(draw('write', { path: 'docs/a.md', content: markdown }, 'ok', { isError: true }), undefined);
|
|
190
|
-
assert.equal(draw('edit', { path: 'docs/a.md', oldText: 'a', newText: markdown }, 'Applied'), undefined);
|
|
203
|
+
assert.equal(draw('edit', { path: 'docs/a.md', oldText: 'a', newText: markdown }, 'Applied', { isError: true }), undefined);
|
|
191
204
|
assert.equal(draw('grep', { path: 'docs/a.md' }, markdown), undefined);
|
|
192
205
|
assert.equal(draw('read', { path: 'docs/a.txt' }, markdown), undefined);
|
|
193
206
|
assert.equal(draw('write', { path: 'lib/x.ts', content: markdown }, 'ok'), undefined);
|
|
@@ -198,3 +211,32 @@ test('only an expanded, successful read or write of a Markdown file draws a docu
|
|
|
198
211
|
assert.equal(draw('write', { path: 'docs/a.md' }, 'Successfully wrote 0 bytes'), undefined);
|
|
199
212
|
assert.equal(draw('read', undefined, markdown), undefined);
|
|
200
213
|
});
|
|
214
|
+
|
|
215
|
+
// An edit's document is the fragment its call leaves behind: every `newText` it states, in
|
|
216
|
+
// the call's own order, and nothing it removed.
|
|
217
|
+
test('an edit draws the fragment it leaves behind, in either call shape', () => {
|
|
218
|
+
const draw = (args, options = {}) => markdownDocumentSource('edit', args, 'Applied', { expanded: true, ...options });
|
|
219
|
+
// The shape the harness hands over: one `edits` array, joined in its own order.
|
|
220
|
+
assert.equal(
|
|
221
|
+
draw({ path: 'odd/a.md', edits: [{ oldText: 'one', newText: '# One' }, { oldText: 'two', newText: '## Two' }] }),
|
|
222
|
+
'# One\n## Two',
|
|
223
|
+
);
|
|
224
|
+
assert.equal(draw({ path: 'odd/a.md', edits: [{ newText: 'b' }, { newText: 'a' }] }), 'b\na', 'the array order, never a sort');
|
|
225
|
+
// The legacy flat shape: the one pair at the top level.
|
|
226
|
+
assert.equal(draw({ path: 'odd/a.md', oldText: 'one', newText: '# One' }), '# One');
|
|
227
|
+
assert.equal(draw({ path: 'odd/a.md', edits: 'not an array', newText: '# One' }), '# One', 'an `edits` that is not an array is the flat shape');
|
|
228
|
+
// An entry that states no string is skipped, never stringified: the fragment is text.
|
|
229
|
+
assert.equal(
|
|
230
|
+
draw({ path: 'odd/a.md', edits: [{ newText: 7 }, null, 'text', { newText: '# One' }, {}, { newText: ['x'] }] }),
|
|
231
|
+
'# One',
|
|
232
|
+
);
|
|
233
|
+
// A pure deletion leaves no fragment, so there is no document and the rows stay.
|
|
234
|
+
assert.equal(draw({ path: 'odd/a.md', edits: [{ oldText: '# Gone', newText: '' }] }), undefined);
|
|
235
|
+
assert.equal(draw({ path: 'odd/a.md', edits: [{ oldText: '# Gone', newText: ' \n ' }] }), undefined);
|
|
236
|
+
assert.equal(draw({ path: 'odd/a.md', oldText: '# Gone' }), undefined, 'no newText states nothing');
|
|
237
|
+
// A collapsed or failed edit, and a path that is no Markdown, keep their rows too.
|
|
238
|
+
assert.equal(draw({ path: 'odd/a.md', edits: [{ newText: '# One' }] }, { expanded: false }), undefined);
|
|
239
|
+
assert.equal(draw({ path: 'odd/a.json', edits: [{ newText: '# One' }] }), undefined);
|
|
240
|
+
// Nothing to read is no document, and no throw either.
|
|
241
|
+
assert.equal(draw(undefined), undefined);
|
|
242
|
+
});
|