@narumitw/pi-starship 0.55.1 → 0.55.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.
Files changed (99) hide show
  1. package/dist/chunks/{chunk-UX6PBXVK.js → chunk-JO5PH6FN.js} +28 -110
  2. package/dist/chunks/chunk-JO5PH6FN.js.map +7 -0
  3. package/dist/chunks/{chunk-P4XMFSQW.js → chunk-YWY5RIDQ.js} +3 -7
  4. package/dist/chunks/chunk-YWY5RIDQ.js.map +7 -0
  5. package/dist/chunks/{chunk-EOGXAMTA.js → chunk-ZQZSXXPI.js} +1 -1
  6. package/dist/chunks/chunk-ZQZSXXPI.js.map +7 -0
  7. package/dist/chunks/{cloud-BKHYWCTA.js → cloud-C4VU3TX3.js} +7 -14
  8. package/dist/chunks/cloud-C4VU3TX3.js.map +7 -0
  9. package/dist/chunks/{commands-53ZO2JUK.js → commands-ATILSUVK.js} +13 -42
  10. package/dist/chunks/commands-ATILSUVK.js.map +7 -0
  11. package/dist/chunks/{deployment-RKKOEQQ2.js → deployment-FMNTYRBW.js} +6 -21
  12. package/dist/chunks/deployment-FMNTYRBW.js.map +7 -0
  13. package/dist/chunks/{development-BERD42HW.js → development-OUYXDPBS.js} +4 -8
  14. package/dist/chunks/development-OUYXDPBS.js.map +7 -0
  15. package/dist/chunks/{execution-42JTEY3N.js → execution-HJOGLMWD.js} +3 -3
  16. package/dist/chunks/execution-HJOGLMWD.js.map +7 -0
  17. package/dist/chunks/{languages-RMP6DW7H.js → languages-WXMF4GOF.js} +6 -22
  18. package/dist/chunks/languages-WXMF4GOF.js.map +7 -0
  19. package/dist/chunks/{package-LG5H7BBM.js → package-YXRZQAOV.js} +5 -14
  20. package/dist/chunks/package-YXRZQAOV.js.map +7 -0
  21. package/dist/index.ts +20 -55
  22. package/dist/index.ts.map +2 -2
  23. package/package.json +60 -61
  24. package/skills/configuring-pi-starship/scripts/apply.mjs +43 -47
  25. package/skills/configuring-pi-starship/scripts/config-path.mjs +3 -3
  26. package/skills/configuring-pi-starship/scripts/script-support.mjs +6 -6
  27. package/skills/configuring-pi-starship/scripts/validate.mjs +18 -18
  28. package/src/command-configuration.ts +267 -286
  29. package/src/command-contract.ts +6 -6
  30. package/src/command-inspector.ts +27 -27
  31. package/src/command-preset-picker.ts +45 -50
  32. package/src/command-preview.ts +153 -166
  33. package/src/commands.ts +588 -618
  34. package/src/config.ts +580 -660
  35. package/src/effective-config.ts +46 -48
  36. package/src/format/formatter.ts +211 -227
  37. package/src/format/style.ts +205 -216
  38. package/src/modules/activity.ts +74 -74
  39. package/src/modules/brand.ts +9 -9
  40. package/src/modules/cache.ts +18 -18
  41. package/src/modules/catalog.ts +79 -83
  42. package/src/modules/cloud.ts +54 -54
  43. package/src/modules/context.ts +27 -27
  44. package/src/modules/cost.ts +23 -23
  45. package/src/modules/deployment.ts +45 -45
  46. package/src/modules/development.ts +80 -81
  47. package/src/modules/directory.ts +89 -113
  48. package/src/modules/display.ts +9 -9
  49. package/src/modules/execution.ts +62 -69
  50. package/src/modules/extension-status.ts +59 -64
  51. package/src/modules/fill.ts +10 -10
  52. package/src/modules/git/branch.ts +26 -26
  53. package/src/modules/git/commit.ts +21 -23
  54. package/src/modules/git/metrics.ts +22 -22
  55. package/src/modules/git/runtime.ts +299 -334
  56. package/src/modules/git/state.ts +17 -17
  57. package/src/modules/git/status.ts +77 -79
  58. package/src/modules/git/worktree.ts +10 -12
  59. package/src/modules/github-pr.ts +20 -20
  60. package/src/modules/helpers.ts +3 -3
  61. package/src/modules/index.ts +21 -21
  62. package/src/modules/inspection.ts +101 -108
  63. package/src/modules/languages.ts +52 -59
  64. package/src/modules/model.ts +57 -67
  65. package/src/modules/package.ts +12 -12
  66. package/src/modules/provider.ts +22 -24
  67. package/src/modules/render.ts +124 -140
  68. package/src/modules/thinking.ts +27 -26
  69. package/src/modules/time.ts +10 -13
  70. package/src/modules/tokens.ts +13 -13
  71. package/src/modules/truncation.ts +14 -17
  72. package/src/modules/turn.ts +9 -9
  73. package/src/modules/types.ts +125 -132
  74. package/src/modules/workspace-helpers.ts +4 -7
  75. package/src/pi-starship.ts +567 -603
  76. package/src/presets/catalog.ts +113 -113
  77. package/src/runtime/cloud.ts +122 -150
  78. package/src/runtime/command.ts +106 -108
  79. package/src/runtime/deployment.ts +150 -179
  80. package/src/runtime/development.ts +107 -124
  81. package/src/runtime/execution.ts +110 -124
  82. package/src/runtime/github-pr.ts +223 -252
  83. package/src/runtime/helpers.ts +186 -199
  84. package/src/runtime/languages.ts +149 -180
  85. package/src/runtime/package.ts +74 -87
  86. package/src/runtime/refresh-controller.ts +82 -86
  87. package/src/runtime/types.ts +38 -38
  88. package/src/runtime/workspace.ts +108 -116
  89. package/src/usage.ts +40 -40
  90. package/dist/chunks/chunk-EOGXAMTA.js.map +0 -7
  91. package/dist/chunks/chunk-P4XMFSQW.js.map +0 -7
  92. package/dist/chunks/chunk-UX6PBXVK.js.map +0 -7
  93. package/dist/chunks/cloud-BKHYWCTA.js.map +0 -7
  94. package/dist/chunks/commands-53ZO2JUK.js.map +0 -7
  95. package/dist/chunks/deployment-RKKOEQQ2.js.map +0 -7
  96. package/dist/chunks/development-BERD42HW.js.map +0 -7
  97. package/dist/chunks/execution-42JTEY3N.js.map +0 -7
  98. package/dist/chunks/languages-RMP6DW7H.js.map +0 -7
  99. package/dist/chunks/package-LG5H7BBM.js.map +0 -7
@@ -15,15 +15,7 @@ function completeStarshipArguments(prefix) {
15
15
 
16
16
  // src/config.ts
17
17
  import { randomUUID } from "node:crypto";
18
- import {
19
- existsSync,
20
- lstatSync,
21
- mkdirSync,
22
- readFileSync,
23
- renameSync,
24
- rmSync,
25
- writeFileSync
26
- } from "node:fs";
18
+ import { existsSync, lstatSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
27
19
  import { createRequire } from "node:module";
28
20
  import { dirname, join } from "node:path";
29
21
 
@@ -401,9 +393,7 @@ function renderNodes(nodes, options, inheritedStyle) {
401
393
  }
402
394
  break;
403
395
  case "group": {
404
- const styleString = node.style.map(
405
- (part) => part.type === "text" ? part.value : ownValue(options.styleVariables, part.name) ?? ""
406
- ).join("");
396
+ const styleString = node.style.map((part) => part.type === "text" ? part.value : ownValue(options.styleVariables, part.name) ?? "").join("");
407
397
  const style = parseStyle(styleString, options.palette);
408
398
  const rendered = renderNodes(node.children, options, style);
409
399
  if (node.children.length === 0) chunks.push({ text: "", style });
@@ -929,10 +919,7 @@ var directoryModule = defineModule({
929
919
  for (const [from, to] of Object.entries(substitutions)) {
930
920
  if (from) path = path.replaceAll(from, to);
931
921
  }
932
- const componentResult = truncatePathComponents(
933
- path,
934
- numberOption(options, "truncation_length", 3)
935
- );
922
+ const componentResult = truncatePathComponents(path, numberOption(options, "truncation_length", 3));
936
923
  path = componentResult.value;
937
924
  truncated ||= componentResult.truncated;
938
925
  if (truncated) {
@@ -1069,12 +1056,7 @@ var usernameModule = defineModule({
1069
1056
  },
1070
1057
  values: (context) => workspaceModuleValues("username", context)
1071
1058
  });
1072
- var executionModules = [
1073
- osModule,
1074
- containerModule,
1075
- hostnameModule,
1076
- usernameModule
1077
- ];
1059
+ var executionModules = [osModule, containerModule, hostnameModule, usernameModule];
1078
1060
 
1079
1061
  // src/modules/extension-status.ts
1080
1062
  var extensionStatusModule = defineModule({
@@ -1435,14 +1417,7 @@ var denoModule = languageModule({
1435
1417
  symbol: "\u{1F995} ",
1436
1418
  style: "green bold"
1437
1419
  });
1438
- var languageModules = [
1439
- nodejsModule,
1440
- pythonModule,
1441
- rustModule,
1442
- golangModule,
1443
- bunModule,
1444
- denoModule
1445
- ];
1420
+ var languageModules = [nodejsModule, pythonModule, rustModule, golangModule, bunModule, denoModule];
1446
1421
 
1447
1422
  // src/modules/model.ts
1448
1423
  import { sanitizeTerminalText as sanitizeTerminalText3 } from "@narumitw/pi-tui-kit/terminal-text";
@@ -1568,9 +1543,7 @@ var thinkingModule = defineModule({
1568
1543
  style: "bold purple",
1569
1544
  disabled: false
1570
1545
  },
1571
- styleDefaults: Object.fromEntries(
1572
- THINKING_LEVELS.map((level) => [`style_${level}`, ""])
1573
- ),
1546
+ styleDefaults: Object.fromEntries(THINKING_LEVELS.map((level) => [`style_${level}`, ""])),
1574
1547
  fallbackStyle: true,
1575
1548
  styleVariables: ["style"],
1576
1549
  resolveStyleVariables: ({ runtime, styles, style }) => {
@@ -1704,15 +1677,11 @@ var MODULE_DESCRIPTIONS = {
1704
1677
  turn: "Current user-turn count.",
1705
1678
  username: "Current user identity when configured to display."
1706
1679
  };
1707
- var MODULE_DEFINITIONS = MODULE_IMPLEMENTATIONS.map(
1708
- (definition) => ({
1709
- ...definition,
1710
- description: MODULE_DESCRIPTIONS[definition.name]
1711
- })
1712
- );
1713
- var MODULE_NAMES = MODULE_IMPLEMENTATIONS.map(
1714
- (definition) => definition.name
1715
- );
1680
+ var MODULE_DEFINITIONS = MODULE_IMPLEMENTATIONS.map((definition) => ({
1681
+ ...definition,
1682
+ description: MODULE_DESCRIPTIONS[definition.name]
1683
+ }));
1684
+ var MODULE_NAMES = MODULE_IMPLEMENTATIONS.map((definition) => definition.name);
1716
1685
 
1717
1686
  // src/config.ts
1718
1687
  var CONFIG_FILE_NAME = "pi-starship.toml";
@@ -1739,10 +1708,7 @@ var BUILT_IN_MODULES = Object.fromEntries(
1739
1708
  styles: { ...styleDefaults },
1740
1709
  display: structuredClone(displayDefaults ?? []),
1741
1710
  options: Object.fromEntries(
1742
- Object.entries(options ?? {}).map(([key, schema]) => [
1743
- key,
1744
- cloneOptionValue(schema.default)
1745
- ])
1711
+ Object.entries(options ?? {}).map(([key, schema]) => [key, cloneOptionValue(schema.default)])
1746
1712
  )
1747
1713
  }
1748
1714
  ])
@@ -1828,9 +1794,7 @@ function normalizeConfig(value) {
1828
1794
  config.formatAst = parseFormat(value.format);
1829
1795
  config.format = value.format;
1830
1796
  } catch (error) {
1831
- diagnostics.push(
1832
- diagnostic("warning", "format", `Invalid format; using built-in: ${formatError(error)}`)
1833
- );
1797
+ diagnostics.push(diagnostic("warning", "format", `Invalid format; using built-in: ${formatError(error)}`));
1834
1798
  }
1835
1799
  }
1836
1800
  }
@@ -1866,9 +1830,7 @@ function normalizeConfig(value) {
1866
1830
  else {
1867
1831
  config.palette = value.palette;
1868
1832
  if (!Object.hasOwn(config.palettes, value.palette)) {
1869
- diagnostics.push(
1870
- diagnostic("warning", "palette", `Unknown palette ${JSON.stringify(value.palette)}`)
1871
- );
1833
+ diagnostics.push(diagnostic("warning", "palette", `Unknown palette ${JSON.stringify(value.palette)}`));
1872
1834
  }
1873
1835
  }
1874
1836
  }
@@ -1881,24 +1843,14 @@ function normalizeConfig(value) {
1881
1843
  }
1882
1844
  normalizeModule(name, moduleValue, config, diagnostics);
1883
1845
  }
1884
- validateFormatVariables(
1885
- config.formatAst,
1886
- /* @__PURE__ */ new Set([...MODULE_NAMES, "all"]),
1887
- "format",
1888
- diagnostics
1889
- );
1846
+ validateFormatVariables(config.formatAst, /* @__PURE__ */ new Set([...MODULE_NAMES, "all"]), "format", diagnostics);
1890
1847
  validateStyleVariables(config.formatAst, /* @__PURE__ */ new Set(), "format", diagnostics);
1891
1848
  const palette = activePalette(config);
1892
1849
  validateLiteralStyles(config.formatAst, palette, "format", diagnostics);
1893
1850
  for (const definition of MODULE_DEFINITIONS) {
1894
1851
  const name = definition.name;
1895
1852
  const module = config.modules[name];
1896
- validateFormatVariables(
1897
- module.formatAst,
1898
- new Set(MODULE_CONTENT_VARIABLES[name]),
1899
- `${name}.format`,
1900
- diagnostics
1901
- );
1853
+ validateFormatVariables(module.formatAst, new Set(MODULE_CONTENT_VARIABLES[name]), `${name}.format`, diagnostics);
1902
1854
  validateStyleVariables(
1903
1855
  module.formatAst,
1904
1856
  new Set(definition.styleVariables ?? ["style"]),
@@ -1939,19 +1891,14 @@ function normalizeModule(name, value, config, diagnostics) {
1939
1891
  }
1940
1892
  const module = config.modules[name];
1941
1893
  if (value.format !== void 0) {
1942
- if (typeof value.format !== "string")
1943
- diagnostics.push(typeDiagnostic(`${name}.format`, "string"));
1894
+ if (typeof value.format !== "string") diagnostics.push(typeDiagnostic(`${name}.format`, "string"));
1944
1895
  else {
1945
1896
  try {
1946
1897
  module.formatAst = parseFormat(value.format);
1947
1898
  module.format = value.format;
1948
1899
  } catch (error) {
1949
1900
  diagnostics.push(
1950
- diagnostic(
1951
- "warning",
1952
- `${name}.format`,
1953
- `Invalid format; using module default: ${formatError(error)}`
1954
- )
1901
+ diagnostic("warning", `${name}.format`, `Invalid format; using module default: ${formatError(error)}`)
1955
1902
  );
1956
1903
  }
1957
1904
  }
@@ -2007,11 +1954,7 @@ function normalizeModule(name, value, config, diagnostics) {
2007
1954
  if (value.max_statuses !== void 0) {
2008
1955
  if (typeof value.max_statuses !== "number" || !Number.isInteger(value.max_statuses) || value.max_statuses < 0 || value.max_statuses > 100) {
2009
1956
  diagnostics.push(
2010
- diagnostic(
2011
- "warning",
2012
- "extension_status.max_statuses",
2013
- "Expected an integer from 0 through 100"
2014
- )
1957
+ diagnostic("warning", "extension_status.max_statuses", "Expected an integer from 0 through 100")
2015
1958
  );
2016
1959
  } else config.extensionStatus.maxStatuses = value.max_statuses;
2017
1960
  }
@@ -2057,10 +2000,7 @@ function atomicRestoreConfigDocument(settingsPath, rawDocument, overrides = {})
2057
2000
  atomicWriteConfigDocument(settingsPath, rawDocument, overrides);
2058
2001
  }
2059
2002
  function removeConfigDocumentIfMatches(settingsPath, expectedRawDocument, expectedIdentity, overrides = {}) {
2060
- const quarantinePath = join(
2061
- dirname(settingsPath),
2062
- `.${CONFIG_FILE_NAME}.${randomUUID()}.rollback`
2063
- );
2003
+ const quarantinePath = join(dirname(settingsPath), `.${CONFIG_FILE_NAME}.${randomUUID()}.rollback`);
2064
2004
  const before = lstatSync(settingsPath);
2065
2005
  if (before.dev !== expectedIdentity.dev || before.ino !== expectedIdentity.ino) {
2066
2006
  throw new Error("Starship settings changed concurrently; the newer file was preserved");
@@ -2129,11 +2069,7 @@ function validateFormatVariables(ast, allowed, path, diagnostics) {
2129
2069
  for (const variable of formatVariables(ast)) {
2130
2070
  if (allowed.has(variable)) continue;
2131
2071
  diagnostics.push(
2132
- diagnostic(
2133
- "warning",
2134
- path,
2135
- `Unknown variable ${JSON.stringify(variable)} in ${path} was ignored`
2136
- )
2072
+ diagnostic("warning", path, `Unknown variable ${JSON.stringify(variable)} in ${path} was ignored`)
2137
2073
  );
2138
2074
  }
2139
2075
  }
@@ -2141,11 +2077,7 @@ function validateStyleVariables(ast, allowed, path, diagnostics) {
2141
2077
  for (const variable of styleVariables(ast)) {
2142
2078
  if (allowed.has(variable)) continue;
2143
2079
  diagnostics.push(
2144
- diagnostic(
2145
- "warning",
2146
- path,
2147
- `Unknown style variable ${JSON.stringify(variable)} in ${path} was ignored`
2148
- )
2080
+ diagnostic("warning", path, `Unknown style variable ${JSON.stringify(variable)} in ${path} was ignored`)
2149
2081
  );
2150
2082
  }
2151
2083
  }
@@ -2153,11 +2085,7 @@ function validateModuleStyleField(name, field, module, palette, diagnostics) {
2153
2085
  const style = field === "style" ? module.style : module.styles[field];
2154
2086
  if (style === void 0 || isValidStyle(style, palette)) return;
2155
2087
  diagnostics.push(
2156
- diagnostic(
2157
- "warning",
2158
- `${name}.${field}`,
2159
- `Invalid style ${JSON.stringify(style)}; using the module default`
2160
- )
2088
+ diagnostic("warning", `${name}.${field}`, `Invalid style ${JSON.stringify(style)}; using the module default`)
2161
2089
  );
2162
2090
  if (field === "style") module.style = BUILT_IN_CONFIG.modules[name].style;
2163
2091
  else {
@@ -2188,9 +2116,7 @@ function normalizeDisplay(name, value, defaults, palette, diagnostics) {
2188
2116
  valid = false;
2189
2117
  }
2190
2118
  if (typeof entry.style !== "string" || !isValidStyle(entry.style, palette)) {
2191
- diagnostics.push(
2192
- diagnostic("warning", `${path}.style`, "Expected a valid Starship style string")
2193
- );
2119
+ diagnostics.push(diagnostic("warning", `${path}.style`, "Expected a valid Starship style string"));
2194
2120
  valid = false;
2195
2121
  }
2196
2122
  if (typeof entry.hidden !== "boolean") {
@@ -2206,9 +2132,7 @@ function normalizeDisplay(name, value, defaults, palette, diagnostics) {
2206
2132
  }
2207
2133
  }
2208
2134
  if (result.length > 0) return result;
2209
- diagnostics.push(
2210
- diagnostic("warning", `${name}.display`, "Expected at least one valid entry; using defaults")
2211
- );
2135
+ diagnostics.push(diagnostic("warning", `${name}.display`, "Expected at least one valid entry; using defaults"));
2212
2136
  return defaults.map((entry) => ({ ...entry }));
2213
2137
  }
2214
2138
  function validateLiteralStyles(ast, palette, path, diagnostics) {
@@ -2217,11 +2141,7 @@ function validateLiteralStyles(ast, palette, path, diagnostics) {
2217
2141
  const style = node.style.map((part) => part.type === "text" ? part.value : "").join("");
2218
2142
  if (!isValidStyle(style, palette)) {
2219
2143
  diagnostics.push(
2220
- diagnostic(
2221
- "warning",
2222
- path,
2223
- `Invalid literal style ${JSON.stringify(style)}; rendered unstyled`
2224
- )
2144
+ diagnostic("warning", path, `Invalid literal style ${JSON.stringify(style)}; rendered unstyled`)
2225
2145
  );
2226
2146
  }
2227
2147
  }
@@ -2448,9 +2368,7 @@ function inspectStatuslineModules(config, runtime, width = 80) {
2448
2368
  const modules = MODULE_DEFINITIONS.map((definition) => {
2449
2369
  const module = config.modules[definition.name];
2450
2370
  const reachable = requirements.has(definition.name);
2451
- const preview = plainPreview(
2452
- rendered.modules[definition.name].map((chunk) => chunk.text).join("")
2453
- );
2371
+ const preview = plainPreview(rendered.modules[definition.name].map((chunk) => chunk.text).join(""));
2454
2372
  const state = module.disabled ? "Disabled" : !reachable ? "Not in format" : preview.length > 0 ? "Showing" : "Empty";
2455
2373
  return moduleInspection(
2456
2374
  config,
@@ -2542,4 +2460,4 @@ export {
2542
2460
  inspectStatuslineModules,
2543
2461
  inspectUnavailableModules
2544
2462
  };
2545
- //# sourceMappingURL=chunk-UX6PBXVK.js.map
2463
+ //# sourceMappingURL=chunk-JO5PH6FN.js.map