pi-odd-worktree 3.0.0 β†’ 3.1.0

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.
@@ -25,7 +25,7 @@ const {
25
25
  fileResultRows,
26
26
  } = require('../lib/file-card.js');
27
27
  const { createFileCardResolver, registerFileCard } = require('../lib/file-card-resolver.js');
28
- // The design this package registers on the bridge's `Card tools` line: the card's one
28
+ // The design this package registers on the bridge's `Card tags` line: the card's one
29
29
  // switch is that line's answer for the tool being drawn, so the card is only painted
30
30
  // for a tool the line actually covers.
31
31
  const { toolsActivityDesign } = require('../lib/bash-design.js');
@@ -564,7 +564,7 @@ test('a foreign, hostile or unreadable bridge never hides the card', () => {
564
564
  assert.match(draw(), /πŸ“‘ odd/u, 'an unknown kind keeps the card');
565
565
  });
566
566
 
567
- test('S1: a write is covered by the Card tools line, so its file card paints and `default` restores the host row', () => {
567
+ test('S1: a write is covered by the Card tags line, so its file card paints and `default` restores the host row', () => {
568
568
  // A bridge answers from the design's own `tools` list, exactly as it resolves
569
569
  // coverage: a tool the line does not name is `not-covered`, which is the host's own
570
570
  // card. `write` is declared on that line so the file card can be asked about it.
@@ -573,15 +573,15 @@ test('S1: a write is covered by the Card tools line, so its file card paints and
573
573
  publishBridge((tool) => (design.tools.includes(tool) ? { kind: 'design', design } : { kind: 'not-covered' }), asked);
574
574
  const resolver = fileResolver();
575
575
  for (const tool of ['read', 'write']) {
576
- assert.equal(design.tools.includes(tool), true, `${tool} is covered by the Card tools line`);
576
+ assert.equal(design.tools.includes(tool), true, `${tool} is covered by the Card tags line`);
577
577
  const row = callRow(resolver, tool, { path: ODD, content: '# x\n' }, plainTheme);
578
578
  assert.match(unpaint(row), /πŸ“‘ odd/u, `${tool}: the file card paints its heading`);
579
579
  assert.match(unpaint(row), new RegExp(`${tool} cards-skill-odd\\.md`, 'u'), `${tool}: and names the call`);
580
580
  }
581
- // A tool the line does not cover is still the host's row: a write is declared, but
582
- // nothing else is.
583
- const edit = resolver('edit', () => HOST).renderCall({ path: ODD }, plainTheme, { isPartial: false }).render(60);
584
- assert.deepEqual(forwardedText(edit), ['host read call'], 'an uncovered tool keeps the host card');
581
+ // S3: `edit` is on the line too, scoped to the paths this card claims, so an edit of an
582
+ // ODD artifact wears the file card where no unscoped line could have covered it before.
583
+ const edit = callRow(resolver, 'edit', { path: ODD, oldText: 'a', newText: 'b' }, plainTheme);
584
+ assert.match(unpaint(edit), /πŸ“‘ odd/u, 'an edit of an ODD artifact is this card\'s row now');
585
585
  assert.deepEqual(asked, ['read', 'write', 'edit'], 'each paint asked about the tool it draws');
586
586
 
587
587
  // `default` is the bridge's `native`: the host draws every row again.
@@ -593,6 +593,99 @@ test('S1: a write is covered by the Card tools line, so its file card paints and
593
593
  );
594
594
  });
595
595
 
596
+ // ---- S3/S4/S8: the scoped claim, and the call's arguments that make it answer ----
597
+
598
+ /**
599
+ * The bridge's own resolution (gentle-shell-bridge 0.9.0), reduced to what this design declares: a
600
+ * tool no line names is `not-covered`; a scope that declines the call, and a call that arrives with
601
+ * no arguments at all, are `native`; everything else is the design.
602
+ */
603
+ function scopedBridge(design, asked) {
604
+ return {
605
+ schema: 'gentle-shell-bridge/api',
606
+ version: 1,
607
+ VERSION: '0.9.0',
608
+ registerToolDesign: () => () => {},
609
+ resolveToolDesignSelection(tool, args) {
610
+ if (asked !== undefined) asked.push([tool, args]);
611
+ if (!design.tools.includes(tool)) return { kind: 'not-covered' };
612
+ const scopes = design.scopes === null || typeof design.scopes !== 'object' ? {} : design.scopes;
613
+ const scope = Object.hasOwn(scopes, tool) ? scopes[tool] : undefined;
614
+ if (scope === undefined) return { kind: 'design', design };
615
+ if (args === undefined) return { kind: 'native' };
616
+ return scope.matches({ tool, args }) === true ? { kind: 'design', design } : { kind: 'native' };
617
+ },
618
+ };
619
+ }
620
+
621
+ function publishScoped(design, asked) {
622
+ const api = scopedBridge(design, asked);
623
+ globalThis[BRIDGE_API_SLOT] = api;
624
+ return api;
625
+ }
626
+
627
+ test('S4: the gate asks the bridge with the call\'s own arguments', () => {
628
+ const asked = [];
629
+ publishScoped(toolsActivityDesign(), asked);
630
+ const resolver = fileResolver();
631
+ const callArgs = { path: SKILL, offset: 1, limit: 10 };
632
+ assert.match(unpaint(callRow(resolver, 'read', callArgs, plainTheme)), /β–€ skill/u, 'the read card paints');
633
+ const resultArgs = { path: ODD, oldText: 'a', newText: 'b' };
634
+ resolver('edit', () => HOST).renderResult(textResult('ok'), { isPartial: false }, plainTheme, { args: resultArgs }).render(60);
635
+ assert.deepEqual(asked.map(([tool]) => tool), ['read', 'edit'], 'one question per painted tool');
636
+ // A scope is only answerable with the call in hand, so the SAME object the host holds travels
637
+ // with the question β€” the call's for the call half, the one the result half carries for its own.
638
+ assert.equal(asked[0][1], callArgs, 'the call half passes the arguments, by reference');
639
+ assert.equal(asked[1][1], resultArgs, 'the result half passes the ones it holds');
640
+ });
641
+
642
+ test('S3: a scoped claim paints a write and an edit of a skill or an ODD artifact, and only those', () => {
643
+ publishScoped(toolsActivityDesign());
644
+ const resolver = fileResolver();
645
+ const cases = [
646
+ [SKILL, { content: '# x\n' }, /β–€ skill/u, /one\/SKILL\.md/u],
647
+ [ODD, { oldText: 'a', newText: 'b' }, /πŸ“‘ odd/u, /cards-skill-odd\.md/u],
648
+ ['odd/work/plan.md', { content: '# x\n' }, /πŸ“‘ odd/u, /plan\.md/u],
649
+ ['a/skills/b/references/deep/x.md', { oldText: 'a', newText: 'b' }, /β–€ skill/u, /b\/references\/deep\/x\.md/u],
650
+ ];
651
+ for (const [path, extra, identity, name] of cases) {
652
+ for (const tool of ['write', 'edit']) {
653
+ const row = callRow(resolver, tool, { path, ...extra }, plainTheme);
654
+ const text = unpaint(row);
655
+ assert.match(text, identity, `${tool} of ${path} wears its identity`);
656
+ assert.match(text, name, `${tool} of ${path} names its file`);
657
+ assert.ok(text.includes(tool), `${tool} of ${path} names the tool`);
658
+ }
659
+ }
660
+ // A path the scope does not claim is no file card's row, so the chain keeps it.
661
+ for (const path of ['src/app.ts', 'lib/skillset/notes.md', 'docs/oddity.md', 'notes/SKILL.md']) {
662
+ for (const tool of ['write', 'edit']) {
663
+ assert.deepEqual(
664
+ forwardedText(resolver(tool, () => HOST).renderCall({ path }, plainTheme, { isPartial: false }).render(60)),
665
+ ['host read call'],
666
+ `${tool} of ${path}`,
667
+ );
668
+ }
669
+ }
670
+ });
671
+
672
+ test('S8: read keeps the claim it had, so its card is the scoped line\'s own rows unchanged', () => {
673
+ const draw = (design) => {
674
+ publishScoped(design);
675
+ const resolver = fileResolver();
676
+ return {
677
+ call: callRows(resolver, 'read', { path: SKILL, offset: 1, limit: 10 }, plainTheme),
678
+ result: resultRows(resolver, 'read', { path: SKILL }, textResult('# Design'), { isPartial: false }, plainTheme, 60),
679
+ };
680
+ };
681
+ const scoped = toolsActivityDesign();
682
+ // The registration an older bridge takes, and the one this card has always been painted by.
683
+ const legacy = toolsActivityDesign({ scopes: false });
684
+ assert.equal(Object.hasOwn(scoped.scopes, 'read'), false, 'read is claimed for every call, never scoped');
685
+ assert.deepEqual(draw(scoped), draw(legacy), 'the same call and result rows, byte for byte');
686
+ assert.match(unpaint(draw(scoped).call[0]), /β–€ skill/u, 'and the card still paints its heading');
687
+ });
688
+
596
689
  // ---- the host's own outer box, reproduced for every row this card hands back ----
597
690
 
598
691
  test('a forwarded read call draws the host box\'s own blank rows around its rows', () => {
@@ -120,7 +120,8 @@ function mountHost({ rows = 40 } = {}) {
120
120
  const tui = {
121
121
  terminal: { rows },
122
122
  stopped: false,
123
- stop() { tui.stopped = true; events.push('stop'); },
123
+ stops: [],
124
+ stop(options) { tui.stopped = true; events.push('stop'); tui.stops.push(options); },
124
125
  start() { tui.stopped = false; events.push('start'); },
125
126
  // Pi records the request even while stopped: `requestRender(true)` resets the
126
127
  // written-frame state at once and defers only the paint, which is how the
@@ -594,6 +595,8 @@ describe('the preview and the editor (S12, S14)', () => {
594
595
  assert.equal(host.tui.stopped, false);
595
596
  assert.deepEqual(host.events, ['render:force', 'stop', 'start', 'render:force'],
596
597
  'stop arrives after the settle, and the resume repaint is the second forced one');
598
+ assert.deepEqual(host.tui.stops, [{ preserveScreen: true }],
599
+ 'the suspend preserves the screen: a bare stop stamps the whole alt-screen frame into scrollback');
597
600
  assert.deepEqual(host.renders, [
598
601
  { force: true, stopped: false },
599
602
  { force: true, stopped: false },
@@ -848,7 +848,8 @@ describe('keys (S4)', () => {
848
848
  assert.ok(!bodyText(rows).includes('util.ts'), 'every group starts collapsed');
849
849
  assert.match(selectedRow(rows), /brand-new\.ts/);
850
850
  // S38 replaces S24's "a click folds it without focusing it": the click parks
851
- // the cursor on the group row AND folds it, so `space`/`enter` have the row.
851
+ // the cursor on the group row AND folds it, so `space` has the row (S43 leaves
852
+ // `enter` to insert, and only the Tab marks on a group row).
852
853
  assert.deepEqual(view.handleMouse(mouse({ y: BODY_TOP })), { handled: true, render: true });
853
854
  rows = rowsOf(view);
854
855
  assert.ok(bodyText(rows).includes('cursor.ts'), 'the click opened the folder');
@@ -1231,16 +1232,29 @@ describe('every row of tree and ext takes the cursor (S38)', () => {
1231
1232
  view.handleInput('home');
1232
1233
  assert.equal(selectedName(rowsOf(view)), 'src');
1233
1234
  const before = rowsOf(view);
1235
+ assert.ok(bodyText(before).includes('a.ts'), 'the folder holding the focused file is open (S30)');
1234
1236
  const renders = calls.render;
1235
1237
  view.handleInput('tab');
1236
1238
  assert.deepEqual(rowsOf(view), before, 'tab changes nothing on a group row');
1237
1239
  assert.equal(calls.render, renders, 'so it repaints nothing');
1238
1240
  assert.ok(!bodyText(rowsOf(view)).includes(SELECTION_MARK), 'and it never marks the group');
1241
+ // S43: enter is only the insert key. With no Tab mark it sends nothing, keeps the
1242
+ // panel open and leaves the group exactly as it found it β€” never a fold.
1239
1243
  view.handleInput('enter');
1240
1244
  assert.deepEqual(calls.insert, [], 'enter on a group row inserts nothing');
1241
1245
  assert.equal(calls.close, 0, 'and leaves the panel open');
1242
- // S10 still holds: enter on a group row toggles that group.
1243
- assert.ok(!bodyText(rowsOf(view)).includes('a.ts'), 'enter folded the focused folder');
1246
+ const after = rowsOf(view);
1247
+ assert.deepEqual(after, before, 'enter folds nothing and repaints nothing else');
1248
+ assert.ok(bodyText(after).includes('a.ts'), 'the folder under the cursor is still open');
1249
+ // S43: with a Tab mark the same row sends the marks alone, once, and closes.
1250
+ view.handleInput('down');
1251
+ assert.equal(selectedName(rowsOf(view)), 'a.ts');
1252
+ view.handleInput('tab');
1253
+ view.handleInput('home');
1254
+ assert.equal(selectedName(rowsOf(view)), 'src', 'the cursor is back on the group row');
1255
+ view.handleInput('enter');
1256
+ assert.deepEqual(calls.insert, [['src/a.ts']], 'the Tab selection alone is the payload');
1257
+ assert.equal(calls.close, 1, 'and the panel closes');
1244
1258
  });
1245
1259
 
1246
1260
  test('the preview settles on a group row and the panel stays live', async () => {
@@ -1333,11 +1347,15 @@ describe('every row of tree and ext takes the cursor (S38)', () => {
1333
1347
  assert.ok(bodyText(rows).includes('a.ts'), 'the files paint again');
1334
1348
  view.handleInput('down');
1335
1349
  assert.equal(selectedName(rowsOf(view)), 'a.ts', 'and one step down reaches the first file');
1336
- // S10 still holds: enter on a group row folds it as well, and never inserts.
1350
+ // S43 supersedes S10's "enter also folds": the fold keys are space, shift+space
1351
+ // and the click, so enter on this group row changes nothing and stays open.
1337
1352
  view.handleInput('up');
1338
1353
  view.handleInput('enter');
1339
- assert.ok(!bodyText(rowsOf(view)).includes('a.ts'), 'enter folded the folder from the group row');
1354
+ rows = rowsOf(view);
1355
+ assert.ok(bodyText(rows).includes('a.ts'), 'enter leaves the folder under the cursor open');
1356
+ assert.equal(selectedName(rows), 'src', 'and the group row keeps the cursor');
1340
1357
  assert.deepEqual(calls.insert, [], 'a group row never inserts');
1358
+ assert.equal(calls.close, 0, 'and the panel stays open');
1341
1359
  });
1342
1360
  });
1343
1361
 
@@ -1190,6 +1190,32 @@ describe('fork scope (S5)', () => {
1190
1190
  assert.ok(gh.calls.every((call) => call.scoped === false), 'no GH_REPO is injected');
1191
1191
  });
1192
1192
 
1193
+ // gh's `no git remotes` answer is a STATE of the checkout, not a `gh` failure:
1194
+ // there is nothing to resolve from. `reportedRepoName` says which one it is, so
1195
+ // a caller that draws states never has to parse gh's sentence.
1196
+ test('reportedRepoName distinguishes a checkout with no remote from a gh failure', async () => {
1197
+ const checkout = makeCheckout({ remotes: [] });
1198
+ const noRemote = github();
1199
+ ghIssues.setGhRunner(async (bin, argv, opts) => {
1200
+ if (argv[0] === 'repo' && argv[1] === 'view') {
1201
+ return { status: 1, stdout: '', stderr: 'no git remotes found', error: null };
1202
+ }
1203
+ return noRemote.runner(bin, argv, opts);
1204
+ });
1205
+
1206
+ const unresolved = await ghIssues.reportedRepoName({ cwd: checkout, scope: null });
1207
+ assert.equal(unresolved.ok, false);
1208
+ assert.equal(unresolved.noRemote, true, 'the caller can tell this state apart');
1209
+ assert.match(String(unresolved.error), /cannot resolve the repository/, 'and the failure sentence is unchanged');
1210
+
1211
+ const broken = makeCheckout({ remotes: [['origin', 'myfork/project']] });
1212
+ ghIssues.setGhRunner(async () => ({ status: 1, stdout: '', stderr: 'gh: Not logged in', error: null }));
1213
+ const failed = await ghIssues.reportedRepoName({ cwd: broken, scope: null });
1214
+ assert.equal(failed.ok, false);
1215
+ assert.notEqual(failed.noRemote, true, 'a gh failure is never reported as a missing remote');
1216
+ assert.match(String(failed.error), /Not logged in/);
1217
+ });
1218
+
1193
1219
  // A cached scope must never outlive a changed remote: the same owner/name on
1194
1220
  // a different account is a different repository, and a write would land there.
1195
1221
  test('a changed checkout remote is picked up before the next read and the next write', async () => {
@@ -191,12 +191,14 @@ const stubTui = {
191
191
  function makeHostTui(rows = 24) {
192
192
  const paints = [];
193
193
  const lifecycle = [];
194
+ const stops = [];
194
195
  return {
195
196
  paints,
196
197
  lifecycle,
198
+ stops,
197
199
  tui: {
198
200
  terminal: { rows },
199
- stop: () => lifecycle.push('stop'),
201
+ stop: (options) => { lifecycle.push('stop'); stops.push(options); },
200
202
  start: () => lifecycle.push('start'),
201
203
  requestRender: (force) => { lifecycle.push('render'); paints.push(force === true); },
202
204
  },
@@ -1202,6 +1204,8 @@ describe('/issues actions (S3,S4)', () => {
1202
1204
  assert.ok(!gitCalls[0].argv.join(' ').includes('xdg-open'), 'never an invented opener');
1203
1205
  assert.deepEqual(run.host.lifecycle, ['stop', 'start', 'render'],
1204
1206
  'the TUI is suspended for the browser open and taken back afterwards');
1207
+ assert.deepEqual(run.host.stops, [{ preserveScreen: true }],
1208
+ 'the suspend preserves the screen: a bare stop stamps the whole alt-screen frame into scrollback');
1205
1209
  assert.deepEqual(run.host.paints, [true], 'the terminal is forced to repaint on resume');
1206
1210
  });
1207
1211
 
@@ -1595,6 +1595,46 @@ test('S12 (T11): a session outside a repository paints one short dim line, and t
1595
1595
  'the command notice keeps its own wording');
1596
1596
  });
1597
1597
 
1598
+ // A checkout that IS a repository but has no remote at all is the same kind of
1599
+ // state one step further in: gh cannot name a repository because there is
1600
+ // nothing to resolve from, so the rail says it in one short gray line β€” never
1601
+ // gh's long failure sentence in the red tone β€” and it reads nothing.
1602
+ // The boundary of that state: ONLY gh's no-remote refusal becomes the gray line.
1603
+ // Every other failure keeps today's long error row, and an unknown wording
1604
+ // degrades to it instead of being read as "nothing to do here".
1605
+ for (const [stderr, label, tone] of [
1606
+ ['no git remotes found\nrun git remote add origin <url> first', 'not a GitHub repository', 'dim'],
1607
+ ['NO GIT REMOTES found', 'not a GitHub repository', 'dim'],
1608
+ ['gh: Not logged in', 'cannot resolve the repository: gh: Not logged in', 'error'],
1609
+ ['no remotes configured for this checkout',
1610
+ 'cannot resolve the repository: no remotes configured for this checkout', 'error'],
1611
+ ['', 'cannot resolve the repository: gh exited with status 1', 'error'],
1612
+ ]) {
1613
+ test(`S12 (T11) parity: gh's ${JSON.stringify(stderr.split('\n')[0])} paints ${tone}`, async () => {
1614
+ const checkout = makeCheckout([]);
1615
+ const { registered } = installBridge();
1616
+ const loaded = await loadExtension({});
1617
+ ghIssues = require(path.join(LIB_DIR, 'gh-issues.js'));
1618
+ const calls = [];
1619
+ ghIssues.setGhRunner(async (bin, argv) => {
1620
+ calls.push({ bin, argv: argv.slice() });
1621
+ if (argv[0] === 'repo') return { status: 1, stdout: '', stderr, error: null };
1622
+ if (argv[0] === 'api' && argv[1] === 'user') return okJson('{"login":"me"}');
1623
+ assert.fail(`unexpected issue read: ${argv.join(' ')}`);
1624
+ });
1625
+
1626
+ const ctx = { cwd: checkout, ui: { notify: () => {} } };
1627
+ await fireSessionStart(loaded.hooks, ctx);
1628
+ assert.equal(registered.length, 1);
1629
+ const section = registered[0];
1630
+ const rows = await waitForRows(section, ctx);
1631
+
1632
+ assert.deepEqual(rows, [{ label, tone }], 'one row, in the role this failure earns');
1633
+ assert.equal(section.meta(ctx), undefined, 'and no count');
1634
+ assert.equal(graphqlCalls(calls).length, 0, 'and no issue read at all');
1635
+ });
1636
+ }
1637
+
1598
1638
  // S13 (T11, corrected): without the `gh` CLI the rail section is NEVER ADDED β€”
1599
1639
  // "/issues nunca se carga ni nunca se agrega a sidebar github sidebar". The decision
1600
1640
  // is a LOCAL presence answer (a PATH walk; the module answers `ghCliPresent`, no
@@ -13,7 +13,7 @@
13
13
  // worktree↔issue association.
14
14
  //
15
15
  // The bash activity is not a preference here: it is a design on gentle-shell-bridge's
16
- // own `Card tools` line, so the shipped surface is exactly four commands, two tools, one
16
+ // own `Card tags` line, so the shipped surface is exactly four commands, two tools, one
17
17
  // sidebar section, one tools design and the one `Cards` row group the two file-card
18
18
  // switches carry.
19
19
  //
@@ -23,7 +23,7 @@ const { test, describe, after } = require('node:test');
23
23
  const assert = require('node:assert/strict');
24
24
  const fs = require('node:fs');
25
25
  const path = require('node:path');
26
- const { LIB_DIR, loadExtension, stubbedSource } = require('./fixtures/load-extension.js');
26
+ const { BRIDGE_SLOT, LIB_DIR, defaultBridge, loadExtension, stubbedSource } = require('./fixtures/load-extension.js');
27
27
 
28
28
  const ROOT = path.resolve(__dirname, '..');
29
29
  const PKG = JSON.parse(fs.readFileSync(path.join(ROOT, 'package.json'), 'utf8'));
@@ -72,8 +72,8 @@ describe('manifest', () => {
72
72
  // classifier and the one design registered on the bridge. The file cards add
73
73
  // their own four modules β€” a classifier, the card, its resolver and the document
74
74
  // body Pi's Markdown draws β€” and own no preference at all (S1): they are gated by
75
- // the bridge's `Card tools` line, which is the bridge's, not ours.
76
- for (const kept of ['gh-issues.js', 'issue-preview.js', 'issues-view.js', 'warp-selector-view.js', 'odd-view.js', 'worktree-git.js', 'worktree-registry.js', 'worktree-session-guard.js', 'bash-activity.js', 'bash-design.js', 'bash-frame.js', 'skill-odd-card.js', 'file-card.js', 'file-card-resolver.js', 'file-card-markdown.js']) {
75
+ // the bridge's `Card tags` line, which is the bridge's, not ours.
76
+ for (const kept of ['gh-issues.js', 'issue-preview.js', 'issues-view.js', 'warp-selector-view.js', 'odd-view.js', 'worktree-git.js', 'worktree-registry.js', 'worktree-session-guard.js', 'bash-activity.js', 'bash-design.js', 'bash-frame.js', 'diff-design.js', 'skill-odd-card.js', 'file-card.js', 'file-card-resolver.js', 'file-card-markdown.js']) {
77
77
  assert.ok(shipped.includes(kept), `lib/${kept} is shipped`);
78
78
  }
79
79
  for (const gone of ['card-files-mode.js', 'cards-customize.js']) {
@@ -106,7 +106,7 @@ describe('registration', () => {
106
106
  }
107
107
 
108
108
  // S1: the two file-card switches and their document are gone, and the extension
109
- // names neither. The file card is gated by the bridge's own `Card tools` line.
109
+ // names neither. The file card is gated by the bridge's own `Card tags` line.
110
110
  assert.equal(source.includes('registerCardsCustomize'), false, 'no row provider is registered for a switch');
111
111
  assert.equal(source.includes('card-files'), false, 'the extension never names their document');
112
112
  const modules = fs.readdirSync(lib).filter((entry) => entry.endsWith('.js'));
@@ -137,6 +137,26 @@ describe('registration', () => {
137
137
  }
138
138
  });
139
139
 
140
+ test('both Card rows are registered once each, observed through the bridge\'s own object', async () => {
141
+ // S2/S6: what a caller observes is the REGISTRATION, not a spelling in the source. A bridge
142
+ // that publishes the release both lines need sees one design per line, each with its own id and
143
+ // label, and nothing else β€” so a second registration, a renamed id or a third row fails here.
144
+ const bridge = defaultBridge();
145
+ bridge.api.VERSION = '0.9.0';
146
+ const previous = globalThis[BRIDGE_SLOT];
147
+ globalThis[BRIDGE_SLOT] = bridge.api;
148
+ try {
149
+ await loadExtension({});
150
+ assert.deepEqual(
151
+ bridge.designs.map((design) => [design.line, design.id, design.label]),
152
+ [['tags', 'odd-worktree.bash-activity', 'activity'], ['diff', 'odd-worktree.diff', 'color']],
153
+ 'one design per line, once each',
154
+ );
155
+ } finally {
156
+ globalThis[BRIDGE_SLOT] = previous;
157
+ }
158
+ });
159
+
140
160
  test('the file cards register through one hook call and own no preference (T2)', async () => {
141
161
  // S1/S7: the card is drawn through the host's `registerToolRenderer`, and the ONE switch
142
162
  // it obeys is the bridge's own line, asked through the published reader on every paint.