@narumitw/pi-starship 0.62.0 → 0.63.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.
Files changed (30) hide show
  1. package/README.md +10 -9
  2. package/dist/chunks/{chunk-HPZTMIZS.ts → chunk-63R6R5DH.ts} +41 -8
  3. package/dist/chunks/chunk-63R6R5DH.ts.map +7 -0
  4. package/dist/chunks/{chunk-PWTSHSP3.ts → chunk-A65IOGL6.ts} +6 -7
  5. package/dist/chunks/chunk-A65IOGL6.ts.map +7 -0
  6. package/dist/chunks/{chunk-43VIENBN.ts → chunk-Y24TJYG6.ts} +7 -7
  7. package/dist/chunks/{chunk-43VIENBN.ts.map → chunk-Y24TJYG6.ts.map} +2 -2
  8. package/dist/chunks/{command-configuration-menu-S2LXCOJG.ts → command-configuration-menu-YOLN2SPR.ts} +3 -3
  9. package/dist/chunks/{command-settings-chat-O34BEU4X.ts → command-settings-chat-5AHP3JGV.ts} +162 -79
  10. package/dist/chunks/command-settings-chat-5AHP3JGV.ts.map +7 -0
  11. package/dist/chunks/{commands-ZYIJVIEJ.ts → commands-IOG2PL67.ts} +23 -19
  12. package/dist/chunks/commands-IOG2PL67.ts.map +7 -0
  13. package/dist/index.ts +114 -58
  14. package/dist/index.ts.map +3 -3
  15. package/package.json +1 -1
  16. package/skills/configure-pi-starship/SKILL.md +3 -1
  17. package/skills/configure-pi-starship/references/configuration.md +14 -12
  18. package/src/command-commit.ts +41 -7
  19. package/src/command-configuration.ts +6 -10
  20. package/src/command-settings-chat.ts +2 -44
  21. package/src/commands.ts +22 -26
  22. package/src/config.ts +6 -6
  23. package/src/pi-starship.ts +154 -88
  24. package/src/settings-chat-transcript.ts +54 -2
  25. package/src/settings-chat-ui.ts +150 -50
  26. package/dist/chunks/chunk-HPZTMIZS.ts.map +0 -7
  27. package/dist/chunks/chunk-PWTSHSP3.ts.map +0 -7
  28. package/dist/chunks/command-settings-chat-O34BEU4X.ts.map +0 -7
  29. package/dist/chunks/commands-ZYIJVIEJ.ts.map +0 -7
  30. /package/dist/chunks/{command-configuration-menu-S2LXCOJG.ts.map → command-configuration-menu-YOLN2SPR.ts.map} +0 -0
package/dist/index.ts CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  directoryAlternateFormat,
11
11
  loadStarshipConfig,
12
12
  settingsFilePath
13
- } from "./chunks/chunk-PWTSHSP3.ts";
13
+ } from "./chunks/chunk-A65IOGL6.ts";
14
14
  import "./chunks/chunk-IYDZ3R2T.ts";
15
15
  import {
16
16
  PRIVATE_STYLE_SELECTOR
@@ -1208,7 +1208,7 @@ var MAX_TIMER_DELAY_MS = 2147483647;
1208
1208
  var starshipCommandsPromise;
1209
1209
  function loadStarshipCommands() {
1210
1210
  if (!starshipCommandsPromise) {
1211
- starshipCommandsPromise = import("./chunks/commands-ZYIJVIEJ.ts").catch((error) => {
1211
+ starshipCommandsPromise = import("./chunks/commands-IOG2PL67.ts").catch((error) => {
1212
1212
  starshipCommandsPromise = void 0;
1213
1213
  throw error;
1214
1214
  });
@@ -1230,6 +1230,9 @@ function piStarship(pi, options = {}) {
1230
1230
  let chatCleanup;
1231
1231
  let sessionOwner;
1232
1232
  let activeTarget;
1233
+ let footerContext;
1234
+ let disposeFooter;
1235
+ let footerCollecting = false;
1233
1236
  let eventDebounceTimer;
1234
1237
  let githubPrRefreshTimer;
1235
1238
  let githubPrExpiryTimer;
@@ -1291,15 +1294,15 @@ function piStarship(pi, options = {}) {
1291
1294
  clearTimeout(eventDebounceTimer);
1292
1295
  eventDebounceTimer = void 0;
1293
1296
  };
1294
- const isActiveTarget = (target) => activeTarget?.cwd === target.cwd && activeTarget.generation === target.generation && activeTarget.sessionManager === target.sessionManager && target.generation === sessionGeneration;
1297
+ const isActiveTarget = (target) => activeTarget === target && target.generation === sessionGeneration;
1295
1298
  const requestRefresh = (target, reason = "event") => {
1296
- if (!loaded || !isActiveTarget(target)) return;
1299
+ if (!loaded || isNativeFooter(loaded) || !isActiveTarget(target)) return;
1297
1300
  gitController.request({ cwd: target.cwd, config: loaded.config });
1298
1301
  workspaceController.request(workspaceInput(target.cwd, loaded.config, reason, runtime.workspace));
1299
1302
  };
1300
1303
  const scheduleRefresh = (ctx) => {
1301
1304
  const target = activeTarget;
1302
- if (!target || target.cwd !== ctx.cwd || target.sessionManager !== ctx.sessionManager) {
1305
+ if (!loaded || isNativeFooter(loaded) || !target || target.cwd !== ctx.cwd || target.sessionManager !== ctx.sessionManager) {
1303
1306
  return;
1304
1307
  }
1305
1308
  clearDebounce();
@@ -1309,7 +1312,7 @@ function piStarship(pi, options = {}) {
1309
1312
  }, EVENT_DEBOUNCE_MS);
1310
1313
  };
1311
1314
  function restartLocalControllers(target) {
1312
- if (!isActiveTarget(target)) return;
1315
+ if (!loaded || isNativeFooter(loaded) || !isActiveTarget(target)) return;
1313
1316
  gitController.start(target.generation);
1314
1317
  workspaceController.start(target.generation);
1315
1318
  }
@@ -1325,7 +1328,7 @@ function piStarship(pi, options = {}) {
1325
1328
  runtime.githubPr = void 0;
1326
1329
  }
1327
1330
  function githubPrReachable() {
1328
- return Boolean(loaded && reachableModuleRequirements(loaded.config).has("github_pr"));
1331
+ return Boolean(loaded && !isNativeFooter(loaded) && reachableModuleRequirements(loaded.config).has("github_pr"));
1329
1332
  }
1330
1333
  function startGithubPr(target) {
1331
1334
  if (!isActiveTarget(target)) return false;
@@ -1365,14 +1368,14 @@ function piStarship(pi, options = {}) {
1365
1368
  );
1366
1369
  githubPrExpiryTimer.unref?.();
1367
1370
  }
1368
- const installFooter = (ctx) => {
1369
- const generation = ++sessionGeneration;
1370
- commandInFlight = void 0;
1371
- sessionOwner = ctx.sessionManager;
1372
- previewLoaded = void 0;
1373
- menuController.abort(new DOMException("Starship session context replaced", "AbortError"));
1374
- menuController = new AbortController();
1375
- const target = { cwd: ctx.cwd, generation, sessionManager: ctx.sessionManager };
1371
+ const releaseFooter = () => {
1372
+ const context = footerContext;
1373
+ footerContext = void 0;
1374
+ const dispose = disposeFooter;
1375
+ disposeFooter = void 0;
1376
+ footerCollecting = false;
1377
+ dispose?.();
1378
+ activeTarget = void 0;
1376
1379
  clearDebounce();
1377
1380
  gitController.stop();
1378
1381
  workspaceController.stop();
@@ -1383,12 +1386,30 @@ function piStarship(pi, options = {}) {
1383
1386
  runtime.renderPreview = void 0;
1384
1387
  runtime.inspect = void 0;
1385
1388
  runtime.footerWidth = void 0;
1386
- activeTarget = ctx.mode === "tui" ? target : void 0;
1387
- ctx.ui.setStatus("starship", void 0);
1388
- if (!activeTarget || !loaded) return;
1389
- gitController.start(generation);
1390
- workspaceController.start(generation);
1391
- startGithubPr(target);
1389
+ context?.ui.setFooter(void 0);
1390
+ };
1391
+ const syncFooter = (ctx) => {
1392
+ const current = previewLoaded ?? loaded;
1393
+ if (ctx.mode !== "tui" || !current || isNativeFooter(current)) {
1394
+ releaseFooter();
1395
+ return;
1396
+ }
1397
+ const collect = Boolean(loaded && !isNativeFooter(loaded));
1398
+ if (activeTarget && footerCollecting === collect) return;
1399
+ if (activeTarget) releaseFooter();
1400
+ footerCollecting = collect;
1401
+ const target = {
1402
+ cwd: ctx.cwd,
1403
+ generation: sessionGeneration,
1404
+ sessionManager: ctx.sessionManager
1405
+ };
1406
+ activeTarget = target;
1407
+ footerContext = ctx;
1408
+ if (collect) {
1409
+ gitController.start(target.generation);
1410
+ workspaceController.start(target.generation);
1411
+ startGithubPr(target);
1412
+ }
1392
1413
  ctx.ui.setFooter((tui, theme, footerData) => {
1393
1414
  runtime.requestRender = () => tui.requestRender();
1394
1415
  runtime.renderPreview = (preview, width) => {
@@ -1398,9 +1419,13 @@ function piStarship(pi, options = {}) {
1398
1419
  width
1399
1420
  );
1400
1421
  };
1401
- runtime.inspect = (current) => inspectStatuslineModules(current.config, runtimeSnapshot(ctx, footerData, runtime), runtime.footerWidth ?? 80);
1422
+ runtime.inspect = (current2) => inspectStatuslineModules(current2.config, runtimeSnapshot(ctx, footerData, runtime), runtime.footerWidth ?? 80);
1402
1423
  const unsubscribe = footerData.onBranchChange(() => {
1403
1424
  if (!isActiveTarget(target)) return;
1425
+ if (!collect) {
1426
+ tui.requestRender();
1427
+ return;
1428
+ }
1404
1429
  runtime.git = void 0;
1405
1430
  restartLocalControllers(target);
1406
1431
  clearDebounce();
@@ -1410,7 +1435,7 @@ function piStarship(pi, options = {}) {
1410
1435
  tui.requestRender();
1411
1436
  });
1412
1437
  let lastRender;
1413
- const timer = setInterval(() => {
1438
+ const timer = collect ? setInterval(() => {
1414
1439
  if (!isActiveTarget(target)) return;
1415
1440
  clearDebounce();
1416
1441
  requestRefresh(target, "periodic");
@@ -1435,40 +1460,43 @@ function piStarship(pi, options = {}) {
1435
1460
  const previousLines = lastRender.lines;
1436
1461
  if (lines.length !== previousLines.length || lines.some((line, index) => line !== previousLines[index]))
1437
1462
  tui.requestRender();
1438
- }, REFRESH_INTERVAL_MS);
1463
+ }, REFRESH_INTERVAL_MS) : void 0;
1439
1464
  let disposed = false;
1465
+ const dispose = () => {
1466
+ if (disposed) return;
1467
+ disposed = true;
1468
+ unsubscribe();
1469
+ clearInterval(timer);
1470
+ if (isActiveTarget(target)) {
1471
+ activeTarget = void 0;
1472
+ footerCollecting = false;
1473
+ clearDebounce();
1474
+ gitController.stop();
1475
+ workspaceController.stop();
1476
+ stopGithubPr();
1477
+ runtime.git = void 0;
1478
+ runtime.workspace = void 0;
1479
+ runtime.requestRender = void 0;
1480
+ runtime.renderPreview = void 0;
1481
+ runtime.inspect = void 0;
1482
+ runtime.footerWidth = void 0;
1483
+ }
1484
+ };
1485
+ disposeFooter = dispose;
1440
1486
  return {
1441
- dispose() {
1442
- if (disposed) return;
1443
- disposed = true;
1444
- unsubscribe();
1445
- clearInterval(timer);
1446
- if (isActiveTarget(target)) {
1447
- activeTarget = void 0;
1448
- clearDebounce();
1449
- gitController.stop();
1450
- workspaceController.stop();
1451
- stopGithubPr();
1452
- runtime.git = void 0;
1453
- runtime.workspace = void 0;
1454
- runtime.requestRender = void 0;
1455
- runtime.renderPreview = void 0;
1456
- runtime.inspect = void 0;
1457
- runtime.footerWidth = void 0;
1458
- }
1459
- },
1487
+ dispose,
1460
1488
  invalidate() {
1461
1489
  },
1462
1490
  render(width) {
1463
1491
  runtime.footerWidth = width;
1464
- const current = previewLoaded ?? loaded;
1465
- if (!current) return [];
1492
+ const current2 = previewLoaded ?? loaded;
1493
+ if (!current2) return [];
1466
1494
  const snapshot = runtimeSnapshot(ctx, footerData, runtime);
1467
1495
  const lines = wrapFormattedStatusline(
1468
- renderStatusline(current.config, snapshot, width, getCapabilities2().trueColor, theme.colors).ansi,
1496
+ renderStatusline(current2.config, snapshot, width, getCapabilities2().trueColor, theme.colors).ansi,
1469
1497
  width
1470
1498
  );
1471
- lastRender = { snapshot, lines, config: current.config, width };
1499
+ lastRender = { snapshot, lines, config: current2.config, width };
1472
1500
  return lines;
1473
1501
  }
1474
1502
  };
@@ -1476,6 +1504,17 @@ function piStarship(pi, options = {}) {
1476
1504
  requestRefresh(target, "initial");
1477
1505
  requestGithubPr(target);
1478
1506
  };
1507
+ const installFooter = (ctx) => {
1508
+ releaseFooter();
1509
+ sessionGeneration += 1;
1510
+ commandInFlight = void 0;
1511
+ sessionOwner = ctx.sessionManager;
1512
+ previewLoaded = void 0;
1513
+ menuController.abort(new DOMException("Starship session context replaced", "AbortError"));
1514
+ menuController = new AbortController();
1515
+ ctx.ui.setStatus("starship", void 0);
1516
+ syncFooter(ctx);
1517
+ };
1479
1518
  const configPath = settingsFilePath(getAgentDir());
1480
1519
  const commandOptions = {
1481
1520
  settingsPath: configPath,
@@ -1505,8 +1544,10 @@ function piStarship(pi, options = {}) {
1505
1544
  previewLoaded = void 0;
1506
1545
  loaded = next;
1507
1546
  loadedRevision += 1;
1547
+ const previousTarget = activeTarget;
1548
+ syncFooter(ctx);
1508
1549
  const target = activeTarget;
1509
- if (target) {
1550
+ if (target && target === previousTarget) {
1510
1551
  restartLocalControllers(target);
1511
1552
  startGithubPr(target);
1512
1553
  requestRefresh(target);
@@ -1517,10 +1558,29 @@ function piStarship(pi, options = {}) {
1517
1558
  preview(next, ctx) {
1518
1559
  if (sessionOwner !== ctx.sessionManager) return;
1519
1560
  previewLoaded = next;
1561
+ syncFooter(ctx);
1520
1562
  refresh();
1521
1563
  },
1522
- renderPreview(preview, width) {
1523
- return runtime.renderPreview?.(preview, width) ?? ["Live preview is unavailable until the footer is ready."];
1564
+ renderPreview(preview, width, ctx) {
1565
+ if (isNativeFooter(preview)) return ["Pi built-in footer"];
1566
+ if (runtime.renderPreview) return runtime.renderPreview(preview, width);
1567
+ return wrapFormattedStatusline(
1568
+ renderStatusline(
1569
+ preview.config,
1570
+ runtimeSnapshot(
1571
+ ctx,
1572
+ {
1573
+ getGitBranch: () => null,
1574
+ getExtensionStatuses: () => /* @__PURE__ */ new Map()
1575
+ },
1576
+ runtime
1577
+ ),
1578
+ width,
1579
+ getCapabilities2().trueColor,
1580
+ ctx.ui.theme.colors
1581
+ ).ansi,
1582
+ width
1583
+ );
1524
1584
  }
1525
1585
  };
1526
1586
  pi.registerCommand("starship", {
@@ -1568,13 +1628,7 @@ function piStarship(pi, options = {}) {
1568
1628
  previewLoaded = void 0;
1569
1629
  sessionGeneration += 1;
1570
1630
  menuController.abort(new DOMException("Starship session shut down", "AbortError"));
1571
- activeTarget = void 0;
1572
- clearDebounce();
1573
- gitController.stop();
1574
- workspaceController.stop();
1575
- stopGithubPr();
1576
- runtime.git = void 0;
1577
- runtime.workspace = void 0;
1631
+ releaseFooter();
1578
1632
  runtime.activeTools.clear();
1579
1633
  runtime.isStreaming = false;
1580
1634
  runtime.uiPrompt = void 0;
@@ -1583,7 +1637,6 @@ function piStarship(pi, options = {}) {
1583
1637
  runtime.renderPreview = void 0;
1584
1638
  runtime.inspect = void 0;
1585
1639
  runtime.footerWidth = void 0;
1586
- ctx.ui.setFooter(void 0);
1587
1640
  ctx.ui.setStatus("starship", void 0);
1588
1641
  const cleanup = chatCleanup;
1589
1642
  chatCleanup = void 0;
@@ -1636,6 +1689,9 @@ function piStarship(pi, options = {}) {
1636
1689
  refresh();
1637
1690
  });
1638
1691
  }
1692
+ function isNativeFooter(loaded) {
1693
+ return loaded.rawDocument === void 0 && loaded.diagnostics.length === 0;
1694
+ }
1639
1695
  function workspaceInput(cwd, config, reason, previous) {
1640
1696
  return {
1641
1697
  cwd,