@narumitw/pi-starship 0.55.0 → 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 (101) hide show
  1. package/README.md +21 -36
  2. package/dist/chunks/{chunk-UX6PBXVK.js → chunk-JO5PH6FN.js} +28 -110
  3. package/dist/chunks/chunk-JO5PH6FN.js.map +7 -0
  4. package/dist/chunks/{chunk-P4XMFSQW.js → chunk-YWY5RIDQ.js} +3 -7
  5. package/dist/chunks/chunk-YWY5RIDQ.js.map +7 -0
  6. package/dist/chunks/{chunk-EOGXAMTA.js → chunk-ZQZSXXPI.js} +1 -1
  7. package/dist/chunks/chunk-ZQZSXXPI.js.map +7 -0
  8. package/dist/chunks/{cloud-BKHYWCTA.js → cloud-C4VU3TX3.js} +7 -14
  9. package/dist/chunks/cloud-C4VU3TX3.js.map +7 -0
  10. package/dist/chunks/{commands-53ZO2JUK.js → commands-ATILSUVK.js} +13 -42
  11. package/dist/chunks/commands-ATILSUVK.js.map +7 -0
  12. package/dist/chunks/{deployment-RKKOEQQ2.js → deployment-FMNTYRBW.js} +6 -21
  13. package/dist/chunks/deployment-FMNTYRBW.js.map +7 -0
  14. package/dist/chunks/{development-BERD42HW.js → development-OUYXDPBS.js} +4 -8
  15. package/dist/chunks/development-OUYXDPBS.js.map +7 -0
  16. package/dist/chunks/{execution-42JTEY3N.js → execution-HJOGLMWD.js} +3 -3
  17. package/dist/chunks/execution-HJOGLMWD.js.map +7 -0
  18. package/dist/chunks/{languages-RMP6DW7H.js → languages-WXMF4GOF.js} +6 -22
  19. package/dist/chunks/languages-WXMF4GOF.js.map +7 -0
  20. package/dist/chunks/{package-LG5H7BBM.js → package-YXRZQAOV.js} +5 -14
  21. package/dist/chunks/package-YXRZQAOV.js.map +7 -0
  22. package/dist/index.ts +38 -53
  23. package/dist/index.ts.map +2 -2
  24. package/package.json +60 -61
  25. package/skills/configuring-pi-starship/references/runtime-and-security.md +5 -1
  26. package/skills/configuring-pi-starship/scripts/apply.mjs +43 -47
  27. package/skills/configuring-pi-starship/scripts/config-path.mjs +3 -3
  28. package/skills/configuring-pi-starship/scripts/script-support.mjs +6 -6
  29. package/skills/configuring-pi-starship/scripts/validate.mjs +18 -18
  30. package/src/command-configuration.ts +267 -286
  31. package/src/command-contract.ts +6 -6
  32. package/src/command-inspector.ts +27 -27
  33. package/src/command-preset-picker.ts +45 -50
  34. package/src/command-preview.ts +153 -166
  35. package/src/commands.ts +588 -618
  36. package/src/config.ts +580 -660
  37. package/src/effective-config.ts +46 -48
  38. package/src/format/formatter.ts +211 -227
  39. package/src/format/style.ts +205 -216
  40. package/src/modules/activity.ts +74 -74
  41. package/src/modules/brand.ts +9 -9
  42. package/src/modules/cache.ts +18 -18
  43. package/src/modules/catalog.ts +79 -83
  44. package/src/modules/cloud.ts +54 -54
  45. package/src/modules/context.ts +27 -27
  46. package/src/modules/cost.ts +23 -23
  47. package/src/modules/deployment.ts +45 -45
  48. package/src/modules/development.ts +80 -81
  49. package/src/modules/directory.ts +89 -113
  50. package/src/modules/display.ts +9 -9
  51. package/src/modules/execution.ts +62 -69
  52. package/src/modules/extension-status.ts +59 -64
  53. package/src/modules/fill.ts +10 -10
  54. package/src/modules/git/branch.ts +26 -26
  55. package/src/modules/git/commit.ts +21 -23
  56. package/src/modules/git/metrics.ts +22 -22
  57. package/src/modules/git/runtime.ts +299 -334
  58. package/src/modules/git/state.ts +17 -17
  59. package/src/modules/git/status.ts +77 -79
  60. package/src/modules/git/worktree.ts +10 -12
  61. package/src/modules/github-pr.ts +20 -20
  62. package/src/modules/helpers.ts +3 -3
  63. package/src/modules/index.ts +21 -21
  64. package/src/modules/inspection.ts +101 -108
  65. package/src/modules/languages.ts +52 -59
  66. package/src/modules/model.ts +57 -67
  67. package/src/modules/package.ts +12 -12
  68. package/src/modules/provider.ts +22 -24
  69. package/src/modules/render.ts +124 -140
  70. package/src/modules/thinking.ts +27 -26
  71. package/src/modules/time.ts +10 -13
  72. package/src/modules/tokens.ts +13 -13
  73. package/src/modules/truncation.ts +14 -17
  74. package/src/modules/turn.ts +9 -9
  75. package/src/modules/types.ts +125 -132
  76. package/src/modules/workspace-helpers.ts +4 -7
  77. package/src/pi-starship.ts +567 -571
  78. package/src/presets/catalog.ts +113 -113
  79. package/src/runtime/cloud.ts +122 -150
  80. package/src/runtime/command.ts +106 -108
  81. package/src/runtime/deployment.ts +150 -179
  82. package/src/runtime/development.ts +107 -124
  83. package/src/runtime/execution.ts +110 -124
  84. package/src/runtime/github-pr.ts +223 -252
  85. package/src/runtime/helpers.ts +186 -199
  86. package/src/runtime/languages.ts +149 -180
  87. package/src/runtime/package.ts +74 -87
  88. package/src/runtime/refresh-controller.ts +82 -86
  89. package/src/runtime/types.ts +38 -38
  90. package/src/runtime/workspace.ts +108 -116
  91. package/src/usage.ts +40 -40
  92. package/dist/chunks/chunk-EOGXAMTA.js.map +0 -7
  93. package/dist/chunks/chunk-P4XMFSQW.js.map +0 -7
  94. package/dist/chunks/chunk-UX6PBXVK.js.map +0 -7
  95. package/dist/chunks/cloud-BKHYWCTA.js.map +0 -7
  96. package/dist/chunks/commands-53ZO2JUK.js.map +0 -7
  97. package/dist/chunks/deployment-RKKOEQQ2.js.map +0 -7
  98. package/dist/chunks/development-BERD42HW.js.map +0 -7
  99. package/dist/chunks/execution-42JTEY3N.js.map +0 -7
  100. package/dist/chunks/languages-RMP6DW7H.js.map +0 -7
  101. package/dist/chunks/package-LG5H7BBM.js.map +0 -7
@@ -1,93 +1,88 @@
1
1
  import { defineModule } from "./types.js";
2
2
 
3
3
  export const extensionStatusModule = defineModule({
4
- name: "extension_status",
5
- variables: ["symbol", "statuses", "count"],
6
- defaults: {
7
- format: "[$statuses]($style)",
8
- symbol: "",
9
- style: "dimmed white",
10
- disabled: false,
11
- },
12
- values: ({ runtime, extensionStatus }) => {
13
- const statuses = [...runtime.extensionStatuses.entries()]
14
- .filter(([key, value]) => key !== "starship" && value.trim())
15
- .map(([key, value]) => formatExtensionStatus(key, value, extensionStatus.icons))
16
- .slice(0, extensionStatus.maxStatuses);
17
- if (statuses.length === 0) return undefined;
18
- return {
19
- statuses: statuses.join(extensionStatus.separator),
20
- count: `${statuses.length}`,
21
- };
22
- },
4
+ name: "extension_status",
5
+ variables: ["symbol", "statuses", "count"],
6
+ defaults: {
7
+ format: "[$statuses]($style)",
8
+ symbol: "",
9
+ style: "dimmed white",
10
+ disabled: false,
11
+ },
12
+ values: ({ runtime, extensionStatus }) => {
13
+ const statuses = [...runtime.extensionStatuses.entries()]
14
+ .filter(([key, value]) => key !== "starship" && value.trim())
15
+ .map(([key, value]) => formatExtensionStatus(key, value, extensionStatus.icons))
16
+ .slice(0, extensionStatus.maxStatuses);
17
+ if (statuses.length === 0) return undefined;
18
+ return {
19
+ statuses: statuses.join(extensionStatus.separator),
20
+ count: `${statuses.length}`,
21
+ };
22
+ },
23
23
  });
24
24
 
25
25
  export function formatExtensionStatus(
26
- key: string,
27
- value: string,
28
- configuredIcons: Readonly<Record<string, string>>,
26
+ key: string,
27
+ value: string,
28
+ configuredIcons: Readonly<Record<string, string>>,
29
29
  ): string {
30
- const status = splitExtensionStatusIcon(stripExtensionStatusPrefix(key, value));
31
- const icon = extensionStatusIcon(key, status.icon, configuredIcons);
32
- const text = simplifyExtensionStatusText(status.text);
33
- return icon ? `${icon} ${text}` : text;
30
+ const status = splitExtensionStatusIcon(stripExtensionStatusPrefix(key, value));
31
+ const icon = extensionStatusIcon(key, status.icon, configuredIcons);
32
+ const text = simplifyExtensionStatusText(status.text);
33
+ return icon ? `${icon} ${text}` : text;
34
34
  }
35
35
 
36
36
  function extensionStatusIcon(
37
- key: string,
38
- leadingIcon: string | undefined,
39
- configuredIcons: Readonly<Record<string, string>>,
37
+ key: string,
38
+ leadingIcon: string | undefined,
39
+ configuredIcons: Readonly<Record<string, string>>,
40
40
  ): string {
41
- if (Object.hasOwn(configuredIcons, key)) return configuredIcons[key] ?? "";
42
- const namespaceIcon = configuredNamespaceIcon(key, configuredIcons);
43
- if (namespaceIcon !== undefined) return namespaceIcon;
44
- const fallbackIcon = Object.hasOwn(configuredIcons, "fallback")
45
- ? configuredIcons.fallback
46
- : undefined;
47
- return leadingIcon ?? fallbackIcon ?? "🔌";
41
+ if (Object.hasOwn(configuredIcons, key)) return configuredIcons[key] ?? "";
42
+ const namespaceIcon = configuredNamespaceIcon(key, configuredIcons);
43
+ if (namespaceIcon !== undefined) return namespaceIcon;
44
+ const fallbackIcon = Object.hasOwn(configuredIcons, "fallback") ? configuredIcons.fallback : undefined;
45
+ return leadingIcon ?? fallbackIcon ?? "🔌";
48
46
  }
49
47
 
50
- function configuredNamespaceIcon(
51
- key: string,
52
- configuredIcons: Readonly<Record<string, string>>,
53
- ): string | undefined {
54
- let match: { baseLength: number; icon: string } | undefined;
55
- for (const [selector, icon] of Object.entries(configuredIcons)) {
56
- if (!selector.endsWith(":*")) continue;
57
- const base = selector.slice(0, -2);
58
- if (!base || !key.startsWith(`${base}:`)) continue;
59
- if (!match || base.length > match.baseLength) match = { baseLength: base.length, icon };
60
- }
61
- return match?.icon;
48
+ function configuredNamespaceIcon(key: string, configuredIcons: Readonly<Record<string, string>>): string | undefined {
49
+ let match: { baseLength: number; icon: string } | undefined;
50
+ for (const [selector, icon] of Object.entries(configuredIcons)) {
51
+ if (!selector.endsWith(":*")) continue;
52
+ const base = selector.slice(0, -2);
53
+ if (!base || !key.startsWith(`${base}:`)) continue;
54
+ if (!match || base.length > match.baseLength) match = { baseLength: base.length, icon };
55
+ }
56
+ return match?.icon;
62
57
  }
63
58
 
64
59
  function splitExtensionStatusIcon(value: string): { icon?: string; text: string } {
65
- const trimmed = value.trim();
66
- const [first, ...rest] = trimmed.split(/\s+/u);
67
- if (first && isEmojiOnlyToken(first)) return { icon: first, text: rest.join(" ") };
68
- return { text: trimmed };
60
+ const trimmed = value.trim();
61
+ const [first, ...rest] = trimmed.split(/\s+/u);
62
+ if (first && isEmojiOnlyToken(first)) return { icon: first, text: rest.join(" ") };
63
+ return { text: trimmed };
69
64
  }
70
65
 
71
66
  function isEmojiOnlyToken(value: string): boolean {
72
- return /^(?=.*(?:\p{Extended_Pictographic}|\p{Regional_Indicator}|[0-9#*]\ufe0f?\u20e3))(?:\p{Extended_Pictographic}|\p{Emoji_Modifier}|\p{Regional_Indicator}|\u200d|\ufe0f|[0-9#*]\ufe0f?\u20e3)+$/u.test(
73
- value,
74
- );
67
+ return /^(?=.*(?:\p{Extended_Pictographic}|\p{Regional_Indicator}|[0-9#*]\ufe0f?\u20e3))(?:\p{Extended_Pictographic}|\p{Emoji_Modifier}|\p{Regional_Indicator}|\u200d|\ufe0f|[0-9#*]\ufe0f?\u20e3)+$/u.test(
68
+ value,
69
+ );
75
70
  }
76
71
 
77
72
  function stripExtensionStatusPrefix(key: string, value: string): string {
78
- return value.trim().replace(new RegExp(`^${escapeRegExp(key)}\\s*:\\s*`, "iu"), "");
73
+ return value.trim().replace(new RegExp(`^${escapeRegExp(key)}\\s*:\\s*`, "iu"), "");
79
74
  }
80
75
 
81
76
  function simplifyExtensionStatusText(value: string): string {
82
- return value
83
- .trim()
84
- .replace(/\bready\b/giu, "✓")
85
- .replace(/\bmissing\b/giu, "✗")
86
- .replace(/,\s*/g, " ")
87
- .replace(/\s+\([^)]*\)\s*$/u, "")
88
- .replace(/\s+/gu, " ");
77
+ return value
78
+ .trim()
79
+ .replace(/\bready\b/giu, "✓")
80
+ .replace(/\bmissing\b/giu, "✗")
81
+ .replace(/,\s*/g, " ")
82
+ .replace(/\s+\([^)]*\)\s*$/u, "")
83
+ .replace(/\s+/gu, " ");
89
84
  }
90
85
 
91
86
  function escapeRegExp(value: string): string {
92
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
87
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
93
88
  }
@@ -1,14 +1,14 @@
1
1
  import { defineModule } from "./types.js";
2
2
 
3
3
  export const fillModule = defineModule({
4
- name: "fill",
5
- variables: ["symbol"],
6
- defaults: {
7
- format: "[$symbol]($style)",
8
- symbol: " ",
9
- style: "bold black",
10
- disabled: false,
11
- },
12
- layout: "fill",
13
- values: () => ({}),
4
+ name: "fill",
5
+ variables: ["symbol"],
6
+ defaults: {
7
+ format: "[$symbol]($style)",
8
+ symbol: " ",
9
+ style: "bold black",
10
+ disabled: false,
11
+ },
12
+ layout: "fill",
13
+ values: () => ({}),
14
14
  });
@@ -2,30 +2,30 @@ import { truncateLeadingGraphemes } from "../truncation.js";
2
2
  import { defineModule } from "../types.js";
3
3
 
4
4
  export const gitBranchModule = defineModule({
5
- name: "git_branch",
6
- variables: ["symbol", "branch", "remote_name", "remote_branch"],
7
- defaults: {
8
- format: "[ $symbol $branch ]($style)",
9
- symbol: "🌿",
10
- style: "bold purple",
11
- disabled: false,
12
- },
13
- options: {
14
- // Starship uses i64::MAX as its effective no-truncation default. Zero is the
15
- // equivalent stable TOML representation in pi-starship's bounded integer schema.
16
- truncation_length: { kind: "integer", default: 0, minimum: 0, maximum: 1_000_000 },
17
- truncation_symbol: { kind: "string", default: "…" },
18
- },
19
- values: ({ runtime, options }) => {
20
- const branch = runtime.gitBranchDetails;
21
- const name = branch?.name ?? runtime.gitBranch;
22
- if (!name) return undefined;
23
- const length = typeof options.truncation_length === "number" ? options.truncation_length : 0;
24
- const symbol = typeof options.truncation_symbol === "string" ? options.truncation_symbol : "…";
25
- return {
26
- branch: truncateLeadingGraphemes(name, length, symbol),
27
- remote_name: truncateLeadingGraphemes(branch?.remoteName ?? "", length, symbol),
28
- remote_branch: truncateLeadingGraphemes(branch?.remoteBranch ?? "", length, symbol),
29
- };
30
- },
5
+ name: "git_branch",
6
+ variables: ["symbol", "branch", "remote_name", "remote_branch"],
7
+ defaults: {
8
+ format: "[ $symbol $branch ]($style)",
9
+ symbol: "🌿",
10
+ style: "bold purple",
11
+ disabled: false,
12
+ },
13
+ options: {
14
+ // Starship uses i64::MAX as its effective no-truncation default. Zero is the
15
+ // equivalent stable TOML representation in pi-starship's bounded integer schema.
16
+ truncation_length: { kind: "integer", default: 0, minimum: 0, maximum: 1_000_000 },
17
+ truncation_symbol: { kind: "string", default: "…" },
18
+ },
19
+ values: ({ runtime, options }) => {
20
+ const branch = runtime.gitBranchDetails;
21
+ const name = branch?.name ?? runtime.gitBranch;
22
+ if (!name) return undefined;
23
+ const length = typeof options.truncation_length === "number" ? options.truncation_length : 0;
24
+ const symbol = typeof options.truncation_symbol === "string" ? options.truncation_symbol : "…";
25
+ return {
26
+ branch: truncateLeadingGraphemes(name, length, symbol),
27
+ remote_name: truncateLeadingGraphemes(branch?.remoteName ?? "", length, symbol),
28
+ remote_branch: truncateLeadingGraphemes(branch?.remoteBranch ?? "", length, symbol),
29
+ };
30
+ },
31
31
  });
@@ -3,27 +3,25 @@ import { defineModule } from "../types.js";
3
3
  const DEFAULT_HASH_LENGTH = 7;
4
4
 
5
5
  export const gitCommitModule = defineModule({
6
- name: "git_commit",
7
- variables: ["symbol", "hash", "tag"],
8
- defaults: {
9
- format: "[ ($hash) ]($style)",
10
- symbol: "",
11
- style: "green bold",
12
- disabled: false,
13
- },
14
- options: {
15
- commit_hash_length: { kind: "integer", default: DEFAULT_HASH_LENGTH, minimum: 0, maximum: 64 },
16
- },
17
- values: ({ runtime, options }) => {
18
- const commit = runtime.gitCommit;
19
- if (!commit) return undefined;
20
- const hashLength =
21
- typeof options.commit_hash_length === "number"
22
- ? options.commit_hash_length
23
- : DEFAULT_HASH_LENGTH;
24
- return {
25
- hash: commit.hash.slice(0, hashLength),
26
- tag: commit.tag ? ` 🏷 ${commit.tag}` : "",
27
- };
28
- },
6
+ name: "git_commit",
7
+ variables: ["symbol", "hash", "tag"],
8
+ defaults: {
9
+ format: "[ ($hash) ]($style)",
10
+ symbol: "",
11
+ style: "green bold",
12
+ disabled: false,
13
+ },
14
+ options: {
15
+ commit_hash_length: { kind: "integer", default: DEFAULT_HASH_LENGTH, minimum: 0, maximum: 64 },
16
+ },
17
+ values: ({ runtime, options }) => {
18
+ const commit = runtime.gitCommit;
19
+ if (!commit) return undefined;
20
+ const hashLength =
21
+ typeof options.commit_hash_length === "number" ? options.commit_hash_length : DEFAULT_HASH_LENGTH;
22
+ return {
23
+ hash: commit.hash.slice(0, hashLength),
24
+ tag: commit.tag ? ` 🏷 ${commit.tag}` : "",
25
+ };
26
+ },
29
27
  });
@@ -1,26 +1,26 @@
1
1
  import { defineModule } from "../types.js";
2
2
 
3
3
  export const gitMetricsModule = defineModule({
4
- name: "git_metrics",
5
- variables: ["symbol", "added", "deleted"],
6
- defaults: {
7
- format: "([+$added]($added_style) )([-$deleted]($deleted_style) )",
8
- symbol: "",
9
- style: "none",
10
- disabled: true,
11
- },
12
- styleDefaults: {
13
- added_style: "bold green",
14
- deleted_style: "bold red",
15
- },
16
- styleVariables: ["added_style", "deleted_style"],
17
- resolveStyleVariables: ({ styles }) => styles,
18
- values: ({ runtime }) => {
19
- const metrics = runtime.gitMetrics;
20
- if (!metrics || (metrics.added === 0 && metrics.deleted === 0)) return undefined;
21
- return {
22
- added: metrics.added > 0 ? metrics.added.toString() : "",
23
- deleted: metrics.deleted > 0 ? metrics.deleted.toString() : "",
24
- };
25
- },
4
+ name: "git_metrics",
5
+ variables: ["symbol", "added", "deleted"],
6
+ defaults: {
7
+ format: "([+$added]($added_style) )([-$deleted]($deleted_style) )",
8
+ symbol: "",
9
+ style: "none",
10
+ disabled: true,
11
+ },
12
+ styleDefaults: {
13
+ added_style: "bold green",
14
+ deleted_style: "bold red",
15
+ },
16
+ styleVariables: ["added_style", "deleted_style"],
17
+ resolveStyleVariables: ({ styles }) => styles,
18
+ values: ({ runtime }) => {
19
+ const metrics = runtime.gitMetrics;
20
+ if (!metrics || (metrics.added === 0 && metrics.deleted === 0)) return undefined;
21
+ return {
22
+ added: metrics.added > 0 ? metrics.added.toString() : "",
23
+ deleted: metrics.deleted > 0 ? metrics.deleted.toString() : "",
24
+ };
25
+ },
26
26
  });