@narumitw/pi-starship 0.66.0 → 0.67.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 (27) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +4 -2
  3. package/dist/chunks/{chunk-BOMYDCT7.ts → chunk-URY35OTN.ts} +3 -3
  4. package/dist/chunks/{chunk-CUXPMKBQ.ts → chunk-VK26JO5L.ts} +16 -3
  5. package/dist/chunks/chunk-VK26JO5L.ts.map +7 -0
  6. package/dist/chunks/{chunk-UZJIMIWL.ts → chunk-WZ2FWJHK.ts} +2 -2
  7. package/dist/chunks/{command-configuration-menu-N3SP6R3I.ts → command-configuration-menu-3MMJJX4D.ts} +3 -3
  8. package/dist/chunks/{command-settings-chat-4NLO3RDC.ts → command-settings-chat-NB6YCNUD.ts} +4 -4
  9. package/dist/chunks/{commands-MSJ67CTR.ts → commands-HT6MGWJV.ts} +6 -6
  10. package/dist/index.ts +68 -30
  11. package/dist/index.ts.map +2 -2
  12. package/package.json +1 -1
  13. package/skills/configure-pi-starship/SKILL.md +3 -1
  14. package/skills/configure-pi-starship/references/configuration.md +81 -14
  15. package/skills/configure-pi-starship/references/module-catalog.md +5 -3
  16. package/skills/configure-pi-starship/references/modules.md +4 -1
  17. package/src/config.ts +2 -1
  18. package/src/modules/extension-status.ts +3 -2
  19. package/src/modules/inspection.ts +3 -2
  20. package/src/modules/render.ts +78 -31
  21. package/src/root-references.ts +15 -0
  22. package/dist/chunks/chunk-CUXPMKBQ.ts.map +0 -7
  23. /package/dist/chunks/{chunk-BOMYDCT7.ts.map → chunk-URY35OTN.ts.map} +0 -0
  24. /package/dist/chunks/{chunk-UZJIMIWL.ts.map → chunk-WZ2FWJHK.ts.map} +0 -0
  25. /package/dist/chunks/{command-configuration-menu-N3SP6R3I.ts.map → command-configuration-menu-3MMJJX4D.ts.map} +0 -0
  26. /package/dist/chunks/{command-settings-chat-4NLO3RDC.ts.map → command-settings-chat-NB6YCNUD.ts.map} +0 -0
  27. /package/dist/chunks/{commands-MSJ67CTR.ts.map → commands-HT6MGWJV.ts.map} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  saveAsProfile,
8
8
  showHistory,
9
9
  showProfiles
10
- } from "./chunk-BOMYDCT7.ts";
10
+ } from "./chunk-URY35OTN.ts";
11
11
  import {
12
12
  STARSHIP_PRESETS,
13
13
  configurationPresentation,
@@ -15,7 +15,7 @@ import {
15
15
  presetForDocument,
16
16
  reloadConfiguration,
17
17
  showPreviewActionMenu
18
- } from "./chunk-UZJIMIWL.ts";
18
+ } from "./chunk-WZ2FWJHK.ts";
19
19
  import {
20
20
  STARSHIP_SUBCOMMANDS,
21
21
  completeStarshipArguments
@@ -27,7 +27,7 @@ import {
27
27
  nativeFooterConfig,
28
28
  readConfigDocumentSnapshot,
29
29
  validateConfigDocument
30
- } from "./chunk-CUXPMKBQ.ts";
30
+ } from "./chunk-VK26JO5L.ts";
31
31
  import "./chunk-IYDZ3R2T.ts";
32
32
  import "./chunk-KP33I6BR.ts";
33
33
 
@@ -515,13 +515,13 @@ async function showMainMenu(ctx, options) {
515
515
  },
516
516
  actions: {
517
517
  "settings-chat": async () => {
518
- const { showSettingsAgentChat } = await import("./command-settings-chat-4NLO3RDC.ts");
518
+ const { showSettingsAgentChat } = await import("./command-settings-chat-NB6YCNUD.ts");
519
519
  if (!isCurrentOwner(owner)) return { kind: "close" };
520
520
  await showSettingsAgentChat(ctx, options, owner);
521
521
  return { kind: "close" };
522
522
  },
523
523
  configuration: async () => {
524
- const { showConfigurationMenu } = await import("./command-configuration-menu-N3SP6R3I.ts");
524
+ const { showConfigurationMenu } = await import("./command-configuration-menu-3MMJJX4D.ts");
525
525
  if (!isCurrentOwner(owner)) return { kind: "close" };
526
526
  let selected;
527
527
  while (isCurrentOwner(owner)) {
@@ -1024,4 +1024,4 @@ export {
1024
1024
  registerStarshipCommand,
1025
1025
  reviewAndApply
1026
1026
  };
1027
- //# sourceMappingURL=commands-MSJ67CTR.ts.map
1027
+ //# sourceMappingURL=commands-HT6MGWJV.ts.map
package/dist/index.ts CHANGED
@@ -8,9 +8,11 @@ import {
8
8
  MODULE_NAMES,
9
9
  activePalette,
10
10
  directoryAlternateFormat,
11
+ extensionStatusKey,
11
12
  loadStarshipConfig,
13
+ referencesModule,
12
14
  settingsFilePath
13
- } from "./chunks/chunk-CUXPMKBQ.ts";
15
+ } from "./chunks/chunk-VK26JO5L.ts";
14
16
  import "./chunks/chunk-IYDZ3R2T.ts";
15
17
  import {
16
18
  PRIVATE_STYLE_SELECTOR
@@ -473,6 +475,15 @@ function resolveStyleRule(rules, selectors, context) {
473
475
  // src/modules/render.ts
474
476
  function renderStatusline(config, runtime, width = 80, trueColor = true, themeColors) {
475
477
  const palette = activePalette(config);
478
+ const explicitModules = formatVariables(config.formatAst);
479
+ const statusReferences = new Map(
480
+ [...explicitModules].flatMap((reference) => {
481
+ const key = extensionStatusKey(reference);
482
+ return key === void 0 ? [] : [[reference, key]];
483
+ })
484
+ );
485
+ const selectedKeys = new Set(statusReferences.values());
486
+ const statusChunks = /* @__PURE__ */ new Map();
476
487
  const modules = {};
477
488
  const layoutModules = {};
478
489
  for (const name of MODULE_NAMES) {
@@ -483,40 +494,42 @@ function renderStatusline(config, runtime, width = 80, trueColor = true, themeCo
483
494
  const name = definition.name;
484
495
  const module = config.modules[name];
485
496
  const context = valueContext(config, name, runtime, palette);
486
- const values = definition.values(context);
487
- if (!values) continue;
488
- const styleContext = {
489
- runtime,
490
- style: module.style,
491
- styles: module.styles,
492
- display: module.display,
493
- options: context.options
494
- };
495
- const baseStyleVariables = definition.resolveStyleVariables ? definition.resolveStyleVariables(styleContext) : { style: module.style };
496
- if (!baseStyleVariables) continue;
497
- const ruleStyle = definition.styleRuleSelectors ? resolveStyleRule(module.styleRules, definition.styleRuleSelectors, styleContext) : void 0;
498
- const styleVariables = ruleStyle === void 0 ? baseStyleVariables : { ...baseStyleVariables, style: ruleStyle };
499
- const contentValues = Object.fromEntries(
500
- definition.variables.flatMap(
501
- (variable) => Object.hasOwn(values, variable) ? [[variable, values[variable]]] : []
502
- )
503
- );
504
- const alternate = definition.resolveFormat?.(context, values);
505
- const rendered = renderModule(
506
- alternate === void 0 ? module : { ...module, formatAst: parseFormat(alternate) },
507
- contentValues,
508
- styleVariables,
509
- palette
510
- );
497
+ if (name === "extension_status" && statusReferences.size > 0) {
498
+ const statuses = context.runtime.extensionStatuses;
499
+ for (const [reference, key] of statusReferences) {
500
+ const value = statuses.get(key);
501
+ const selected = new Map(value === void 0 ? [] : [[key, value]]);
502
+ statusChunks.set(
503
+ reference,
504
+ renderDefinition(
505
+ definition,
506
+ module,
507
+ { ...context, runtime: { ...context.runtime, extensionStatuses: selected } },
508
+ runtime
509
+ ) ?? []
510
+ );
511
+ }
512
+ context.runtime = {
513
+ ...context.runtime,
514
+ extensionStatuses: new Map([...statuses].filter(([key]) => !selectedKeys.has(key)))
515
+ };
516
+ }
517
+ const rendered = renderDefinition(definition, module, context, runtime);
518
+ if (!rendered) continue;
511
519
  modules[name] = rendered;
512
520
  layoutModules[name] = definition.layout === "fill" && !module.disabled ? [{ type: "fill", pattern: rendered }] : rendered;
513
521
  }
514
- const explicitModules = formatVariables(config.formatAst);
515
522
  const all = MODULE_NAMES.flatMap(
516
523
  (name) => explicitModules.has(name) || config.modules[name].disabled ? [] : layoutModules[name]
517
524
  );
518
525
  const rootVariables = { all };
519
526
  for (const name of MODULE_NAMES) rootVariables[name] = layoutModules[name];
527
+ for (const [reference, rendered] of statusChunks) rootVariables[reference] = rendered;
528
+ if (statusReferences.size > 0) {
529
+ modules.extension_status = [...explicitModules].flatMap(
530
+ (reference) => reference === "extension_status" || reference === "all" && !explicitModules.has("extension_status") ? modules.extension_status : statusChunks.get(reference) ?? []
531
+ );
532
+ }
520
533
  const layout = renderFormat(config.formatAst, { variables: rootVariables, palette });
521
534
  const chunks = resolveFillLayout(layout, width);
522
535
  return {
@@ -525,6 +538,31 @@ function renderStatusline(config, runtime, width = 80, trueColor = true, themeCo
525
538
  modules
526
539
  };
527
540
  }
541
+ function renderDefinition(definition, module, context, runtime) {
542
+ const values = definition.values(context);
543
+ if (!values) return void 0;
544
+ const styleContext = {
545
+ runtime,
546
+ style: module.style,
547
+ styles: module.styles,
548
+ display: module.display,
549
+ options: context.options
550
+ };
551
+ const baseStyleVariables = definition.resolveStyleVariables ? definition.resolveStyleVariables(styleContext) : { style: module.style };
552
+ if (!baseStyleVariables) return void 0;
553
+ const ruleStyle = definition.styleRuleSelectors ? resolveStyleRule(module.styleRules, definition.styleRuleSelectors, styleContext) : void 0;
554
+ const styleVariables = ruleStyle === void 0 ? baseStyleVariables : { ...baseStyleVariables, style: ruleStyle };
555
+ const contentValues = Object.fromEntries(
556
+ definition.variables.flatMap((variable) => Object.hasOwn(values, variable) ? [[variable, values[variable]]] : [])
557
+ );
558
+ const alternate = definition.resolveFormat?.(context, values);
559
+ return renderModule(
560
+ alternate === void 0 ? module : { ...module, formatAst: parseFormat(alternate) },
561
+ contentValues,
562
+ styleVariables,
563
+ context.palette
564
+ );
565
+ }
528
566
  function valueContext(config, name, runtime, palette) {
529
567
  return {
530
568
  runtime: runtimeForDisplay(name, runtime),
@@ -609,7 +647,7 @@ function reachableModuleRequirements(config) {
609
647
  const requirements = /* @__PURE__ */ new Map();
610
648
  for (const definition of MODULE_DEFINITIONS) {
611
649
  if (config.modules[definition.name].disabled) continue;
612
- if (!includeAll && !rootVariables.has(definition.name)) continue;
650
+ if (!includeAll && !referencesModule(rootVariables, definition.name)) continue;
613
651
  const variables = formatVariables(config.modules[definition.name].formatAst);
614
652
  if (definition.name === "directory") {
615
653
  const alternate = directoryAlternateFormat(config.modules.directory.options, config.modules.directory.styles);
@@ -691,7 +729,7 @@ function inspectStatuslineModules(config, runtime, width = 80) {
691
729
  definition,
692
730
  state,
693
731
  preview,
694
- includeAll || rootVariables.has(definition.name),
732
+ includeAll || referencesModule(rootVariables, definition.name),
695
733
  reachable
696
734
  );
697
735
  });
@@ -1243,7 +1281,7 @@ var MAX_TIMER_DELAY_MS = 2147483647;
1243
1281
  var starshipCommandsPromise;
1244
1282
  function loadStarshipCommands() {
1245
1283
  if (!starshipCommandsPromise) {
1246
- starshipCommandsPromise = import("./chunks/commands-MSJ67CTR.ts").catch((error) => {
1284
+ starshipCommandsPromise = import("./chunks/commands-HT6MGWJV.ts").catch((error) => {
1247
1285
  starshipCommandsPromise = void 0;
1248
1286
  throw error;
1249
1287
  });