pi-odd-worktree 3.11.2 → 3.12.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-odd-worktree",
3
- "version": "3.11.2",
3
+ "version": "3.12.0",
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",
@@ -488,6 +488,64 @@ describe('/odd', () => {
488
488
  await commands.get('odd').handler('nope', makeCtx(makeRepo()));
489
489
  assert.deepEqual(notifications, [['error', 'Unknown option "nope". Use /odd.']]);
490
490
  });
491
+
492
+ // S6 (T4): ONE optional target. An absolute `odd/tasks/*.md` and a bare ODD
493
+ // name that the scan knows are opened instead of refused; every other shape
494
+ // keeps the sentence above, verbatim. There is no overlay here (the ctx offers
495
+ // no `custom`), so an accepted target is observable as the absence of that
496
+ // sentence and the degraded menu's own one muted line.
497
+ test('an absolute target directly under odd/tasks is accepted', async () => {
498
+ const repo = makeRepo();
499
+ const target = path.join(repo, 'odd', 'tasks', 'feature.md');
500
+ fs.mkdirSync(path.dirname(target), { recursive: true });
501
+ fs.writeFileSync(target, '# Feature\n');
502
+ notifications.length = 0;
503
+ await commands.get('odd').handler(target, makeCtx(repo));
504
+ assert.deepEqual(notifications, [
505
+ ['info', 'odd: 1 document(s) under odd/tasks/ (the viewer needs an interactive session)'],
506
+ ]);
507
+ });
508
+
509
+ test('a bare ODD name that exists is accepted', async () => {
510
+ const repo = makeRepo();
511
+ fs.mkdirSync(path.join(repo, 'odd', 'tasks'), { recursive: true });
512
+ fs.writeFileSync(path.join(repo, 'odd', 'tasks', 'feature.md'), '# Feature\n');
513
+ notifications.length = 0;
514
+ await commands.get('odd').handler('feature', makeCtx(repo));
515
+ assert.deepEqual(notifications, [
516
+ ['info', 'odd: 1 document(s) under odd/tasks/ (the viewer needs an interactive session)'],
517
+ ]);
518
+ });
519
+
520
+ test('every shape that is not a target keeps the refusal verbatim', async () => {
521
+ const repo = makeRepo();
522
+ const tasks = path.join(repo, 'odd', 'tasks');
523
+ fs.mkdirSync(path.join(tasks, 'nested'), { recursive: true });
524
+ fs.writeFileSync(path.join(tasks, 'feature.md'), '# Feature\n');
525
+ fs.writeFileSync(path.join(tasks, 'nested', 'deep.md'), '# Deep\n');
526
+ fs.writeFileSync(path.join(tasks, 'notes.txt'), 'notes\n');
527
+ fs.writeFileSync(path.join(tasks, '.hidden.md'), '# Hidden\n');
528
+ const refused = [
529
+ // a flag is never a target
530
+ '--nope',
531
+ // a name the scan does not know
532
+ 'missing-odd',
533
+ // relative, nested, another extension, a dotfile, a missing document
534
+ 'odd/tasks/feature.md',
535
+ path.join(tasks, 'nested', 'deep.md'),
536
+ path.join(tasks, 'notes.txt'),
537
+ path.join(tasks, '.hidden.md'),
538
+ path.join(tasks, 'absent.md'),
539
+ // a real `.md` outside an `odd/tasks` directory
540
+ path.join(repo, 'README.md'),
541
+ path.join(repo, 'odd', 'README.md'),
542
+ ];
543
+ for (const raw of refused) {
544
+ notifications.length = 0;
545
+ await commands.get('odd').handler(raw, makeCtx(repo));
546
+ assert.deepEqual(notifications, [['error', `Unknown option "${raw}". Use /odd.`]], raw);
547
+ }
548
+ });
491
549
  });
492
550
 
493
551
  // ---------------------------------------------------------------------------
@@ -1935,7 +1935,13 @@ describe('/issues opens from the rail cache (S8/T4)', () => {
1935
1935
  schema: 'gentle-shell-bridge/api',
1936
1936
  version: 1,
1937
1937
  registerRows: () => {},
1938
- registerSection: (section) => { registered.push(section); return () => {}; },
1938
+ // T5 of odd-rail-section: the bridge carries TWO sections now, so this double
1939
+ // records the `GITHUB` one it is about. Every registration still receives a
1940
+ // disposer, so the `ODD` rail registers alongside rather than being refused.
1941
+ registerSection: (section) => {
1942
+ if (section && section.id === 'odd-worktree.issues') registered.push(section);
1943
+ return () => {};
1944
+ },
1939
1945
  createStore: () => ({}),
1940
1946
  requestRepaint: () => {},
1941
1947
  };
@@ -2560,7 +2566,12 @@ describe('/issues reflects a self-assignment on the panel and the rail (S21/T17)
2560
2566
  schema: 'gentle-shell-bridge/api',
2561
2567
  version: 1,
2562
2568
  registerRows: () => {},
2563
- registerSection: (section) => { registered.push(section); return () => {}; },
2569
+ // T5 of odd-rail-section: record the `GITHUB` section this case is about; the
2570
+ // `ODD` rail registers on the same double and is simply not what is read here.
2571
+ registerSection: (section) => {
2572
+ if (section && section.id === 'odd-worktree.issues') registered.push(section);
2573
+ return () => {};
2574
+ },
2564
2575
  createStore: () => ({}),
2565
2576
  requestRepaint: () => {},
2566
2577
  };
@@ -287,7 +287,13 @@ function installBridge() {
287
287
  schema: 'gentle-shell-bridge/api',
288
288
  version: 1,
289
289
  registerRows: () => {},
290
- registerSection: (section) => { registered.push(section); return () => {}; },
290
+ // T5 of odd-rail-section: the bridge carries TWO sections now, so this double
291
+ // records the `GITHUB` one it is about. Every registration still receives a
292
+ // disposer, so the `ODD` rail registers alongside rather than being refused.
293
+ registerSection: (section) => {
294
+ if (section && section.id === 'odd-worktree.issues') registered.push(section);
295
+ return () => {};
296
+ },
291
297
  createStore: () => ({}),
292
298
  requestRepaint: () => { repaints.push(1); },
293
299
  };
@@ -1477,8 +1477,17 @@ function installBridge() {
1477
1477
  version: 1,
1478
1478
  registerRows: () => {},
1479
1479
  registerSection: (section) => {
1480
- registered.push(section);
1481
- return () => { released.push(section); };
1480
+ // T5 of odd-rail-section: the bridge now carries TWO sidebar sections — this
1481
+ // package's `GITHUB` one and its `ODD` one — so a double that recorded every
1482
+ // registration would answer "two sections" to a suite that asserts exactly one
1483
+ // and would hand back the ODD rail wherever it reads the recorded section.
1484
+ // Only what this suite is about is recorded; every registration still receives
1485
+ // its own disposer, so the ODD rail registers and unregisters alongside.
1486
+ if (section && section.id === 'odd-worktree.issues') {
1487
+ registered.push(section);
1488
+ return () => { if (section && section.id === 'odd-worktree.issues') released.push(section); };
1489
+ }
1490
+ return () => {};
1482
1491
  },
1483
1492
  createStore: () => ({}),
1484
1493
  requestRepaint: () => { repaints.push(1); },