@narumitw/pi-starship 0.55.1 → 0.56.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 (106) hide show
  1. package/README.md +2 -0
  2. package/dist/chunks/{chunk-UX6PBXVK.js → chunk-SD7TUSSU.js} +113 -113
  3. package/dist/chunks/chunk-SD7TUSSU.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-MJCAK6JL.js} +18 -42
  11. package/dist/chunks/commands-MJCAK6JL.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 +20 -55
  23. package/dist/index.ts.map +2 -2
  24. package/package.json +60 -61
  25. package/skills/configuring-pi-starship/SKILL.md +18 -4
  26. package/skills/configuring-pi-starship/references/configuration.md +70 -2
  27. package/skills/configuring-pi-starship/references/module-catalog.md +21 -0
  28. package/skills/configuring-pi-starship/references/modules.md +2 -0
  29. package/skills/configuring-pi-starship/scripts/apply.mjs +48 -47
  30. package/skills/configuring-pi-starship/scripts/backup.mjs +118 -0
  31. package/skills/configuring-pi-starship/scripts/config-path.mjs +3 -3
  32. package/skills/configuring-pi-starship/scripts/script-support.mjs +6 -6
  33. package/skills/configuring-pi-starship/scripts/validate.mjs +18 -18
  34. package/src/command-configuration.ts +267 -286
  35. package/src/command-contract.ts +6 -6
  36. package/src/command-inspector.ts +27 -27
  37. package/src/command-preset-picker.ts +45 -50
  38. package/src/command-preview.ts +153 -166
  39. package/src/commands.ts +590 -618
  40. package/src/config.ts +635 -660
  41. package/src/effective-config.ts +49 -48
  42. package/src/format/formatter.ts +211 -227
  43. package/src/format/style.ts +205 -216
  44. package/src/modules/activity.ts +74 -74
  45. package/src/modules/brand.ts +9 -9
  46. package/src/modules/cache.ts +18 -18
  47. package/src/modules/catalog.ts +79 -83
  48. package/src/modules/cloud.ts +54 -54
  49. package/src/modules/context.ts +27 -27
  50. package/src/modules/cost.ts +23 -23
  51. package/src/modules/deployment.ts +45 -45
  52. package/src/modules/development.ts +80 -81
  53. package/src/modules/directory.ts +89 -113
  54. package/src/modules/display.ts +9 -9
  55. package/src/modules/execution.ts +62 -69
  56. package/src/modules/extension-status.ts +59 -64
  57. package/src/modules/fill.ts +10 -10
  58. package/src/modules/git/branch.ts +26 -26
  59. package/src/modules/git/commit.ts +21 -23
  60. package/src/modules/git/metrics.ts +22 -22
  61. package/src/modules/git/runtime.ts +299 -334
  62. package/src/modules/git/state.ts +17 -17
  63. package/src/modules/git/status.ts +77 -79
  64. package/src/modules/git/worktree.ts +10 -12
  65. package/src/modules/github-pr.ts +20 -20
  66. package/src/modules/helpers.ts +3 -3
  67. package/src/modules/index.ts +21 -21
  68. package/src/modules/inspection.ts +105 -108
  69. package/src/modules/languages.ts +52 -59
  70. package/src/modules/model.ts +61 -67
  71. package/src/modules/package.ts +12 -12
  72. package/src/modules/provider.ts +25 -24
  73. package/src/modules/render.ts +131 -141
  74. package/src/modules/style-rules.ts +21 -0
  75. package/src/modules/thinking.ts +31 -26
  76. package/src/modules/time.ts +10 -13
  77. package/src/modules/tokens.ts +13 -13
  78. package/src/modules/truncation.ts +14 -17
  79. package/src/modules/turn.ts +9 -9
  80. package/src/modules/types.ts +133 -132
  81. package/src/modules/workspace-helpers.ts +4 -7
  82. package/src/pi-starship.ts +567 -603
  83. package/src/presets/catalog.ts +113 -113
  84. package/src/runtime/cloud.ts +122 -150
  85. package/src/runtime/command.ts +106 -108
  86. package/src/runtime/deployment.ts +150 -179
  87. package/src/runtime/development.ts +107 -124
  88. package/src/runtime/execution.ts +110 -124
  89. package/src/runtime/github-pr.ts +223 -252
  90. package/src/runtime/helpers.ts +186 -199
  91. package/src/runtime/languages.ts +149 -180
  92. package/src/runtime/package.ts +74 -87
  93. package/src/runtime/refresh-controller.ts +82 -86
  94. package/src/runtime/types.ts +38 -38
  95. package/src/runtime/workspace.ts +108 -116
  96. package/src/usage.ts +40 -40
  97. package/dist/chunks/chunk-EOGXAMTA.js.map +0 -7
  98. package/dist/chunks/chunk-P4XMFSQW.js.map +0 -7
  99. package/dist/chunks/chunk-UX6PBXVK.js.map +0 -7
  100. package/dist/chunks/cloud-BKHYWCTA.js.map +0 -7
  101. package/dist/chunks/commands-53ZO2JUK.js.map +0 -7
  102. package/dist/chunks/deployment-RKKOEQQ2.js.map +0 -7
  103. package/dist/chunks/development-BERD42HW.js.map +0 -7
  104. package/dist/chunks/execution-42JTEY3N.js.map +0 -7
  105. package/dist/chunks/languages-RMP6DW7H.js.map +0 -7
  106. package/dist/chunks/package-LG5H7BBM.js.map +0 -7
@@ -2,86 +2,79 @@ import { defineModule, type ModuleDefinition } from "./types.js";
2
2
  import { workspaceModuleValues } from "./workspace-helpers.js";
3
3
 
4
4
  const detectionOptions = {
5
- version_format: { kind: "string", default: "v$raw" },
6
- detect_files: { kind: "string-array", default: [], allowNegative: true },
7
- detect_extensions: { kind: "string-array", default: [], allowNegative: true },
8
- detect_folders: { kind: "string-array", default: [], allowNegative: true },
5
+ version_format: { kind: "string", default: "v$raw" },
6
+ detect_files: { kind: "string-array", default: [], allowNegative: true },
7
+ detect_extensions: { kind: "string-array", default: [], allowNegative: true },
8
+ detect_folders: { kind: "string-array", default: [], allowNegative: true },
9
9
  } as const;
10
10
 
11
11
  function languageModule<const Name extends string>(definition: {
12
- name: Name;
13
- variables: readonly string[];
14
- format: string;
15
- symbol: string;
16
- style: string;
12
+ name: Name;
13
+ variables: readonly string[];
14
+ format: string;
15
+ symbol: string;
16
+ style: string;
17
17
  }): ModuleDefinition<Name> {
18
- return defineModule({
19
- name: definition.name,
20
- variables: ["symbol", ...definition.variables],
21
- defaults: {
22
- format: definition.format,
23
- symbol: definition.symbol,
24
- style: definition.style,
25
- disabled: false,
26
- },
27
- options: detectionOptions,
28
- values: (context) => workspaceModuleValues(definition.name, context),
29
- });
18
+ return defineModule({
19
+ name: definition.name,
20
+ variables: ["symbol", ...definition.variables],
21
+ defaults: {
22
+ format: definition.format,
23
+ symbol: definition.symbol,
24
+ style: definition.style,
25
+ disabled: false,
26
+ },
27
+ options: detectionOptions,
28
+ values: (context) => workspaceModuleValues(definition.name, context),
29
+ });
30
30
  }
31
31
 
32
32
  export const nodejsModule = languageModule({
33
- name: "nodejs",
34
- variables: ["version", "engines_version"],
35
- format: "via [$symbol($version )]($style)",
36
- symbol: " ",
37
- style: "bold green",
33
+ name: "nodejs",
34
+ variables: ["version", "engines_version"],
35
+ format: "via [$symbol($version )]($style)",
36
+ symbol: " ",
37
+ style: "bold green",
38
38
  });
39
39
 
40
40
  export const pythonModule = languageModule({
41
- name: "python",
42
- variables: ["version", "virtualenv", "pyenv_prefix"],
43
- format: "via [$symbol$pyenv_prefix($version )(\\($virtualenv\\) )]($style)",
44
- symbol: " ",
45
- style: "yellow bold",
41
+ name: "python",
42
+ variables: ["version", "virtualenv", "pyenv_prefix"],
43
+ format: "via [$symbol$pyenv_prefix($version )(\\($virtualenv\\) )]($style)",
44
+ symbol: " ",
45
+ style: "yellow bold",
46
46
  });
47
47
 
48
48
  export const rustModule = languageModule({
49
- name: "rust",
50
- variables: ["version", "numver", "toolchain"],
51
- format: "via [$symbol($version )]($style)",
52
- symbol: " ",
53
- style: "bold red",
49
+ name: "rust",
50
+ variables: ["version", "numver", "toolchain"],
51
+ format: "via [$symbol($version )]($style)",
52
+ symbol: " ",
53
+ style: "bold red",
54
54
  });
55
55
 
56
56
  export const golangModule = languageModule({
57
- name: "golang",
58
- variables: ["version", "mod_version"],
59
- format: "via [$symbol($version )]($style)",
60
- symbol: " ",
61
- style: "bold cyan",
57
+ name: "golang",
58
+ variables: ["version", "mod_version"],
59
+ format: "via [$symbol($version )]($style)",
60
+ symbol: " ",
61
+ style: "bold cyan",
62
62
  });
63
63
 
64
64
  export const bunModule = languageModule({
65
- name: "bun",
66
- variables: ["version"],
67
- format: "via [$symbol($version )]($style)",
68
- symbol: "🍞 ",
69
- style: "bold red",
65
+ name: "bun",
66
+ variables: ["version"],
67
+ format: "via [$symbol($version )]($style)",
68
+ symbol: "🍞 ",
69
+ style: "bold red",
70
70
  });
71
71
 
72
72
  export const denoModule = languageModule({
73
- name: "deno",
74
- variables: ["version"],
75
- format: "via [$symbol($version )]($style)",
76
- symbol: "🦕 ",
77
- style: "green bold",
73
+ name: "deno",
74
+ variables: ["version"],
75
+ format: "via [$symbol($version )]($style)",
76
+ symbol: "🦕 ",
77
+ style: "green bold",
78
78
  });
79
79
 
80
- export const languageModules = [
81
- nodejsModule,
82
- pythonModule,
83
- rustModule,
84
- golangModule,
85
- bunModule,
86
- denoModule,
87
- ] as const;
80
+ export const languageModules = [nodejsModule, pythonModule, rustModule, golangModule, bunModule, denoModule] as const;
@@ -6,80 +6,74 @@ type TruncationDirection = (typeof TRUNCATION_DIRECTIONS)[number];
6
6
  const graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
7
7
 
8
8
  export const modelModule = defineModule({
9
- name: "model",
10
- variables: ["symbol", "model"],
11
- defaults: {
12
- format: "[$symbol $model ]($style)",
13
- symbol: "🤖",
14
- style: "bold blue",
15
- disabled: false,
16
- },
17
- options: {
18
- truncation_length: { kind: "integer", default: 0, minimum: 0, maximum: 1000 },
19
- truncation_symbol: { kind: "string", default: "…" },
20
- truncation_direction: {
21
- kind: "string-enum",
22
- default: "end",
23
- values: TRUNCATION_DIRECTIONS,
24
- },
25
- model_aliases: { kind: "string-map", default: {} },
26
- },
27
- values: ({ runtime, options }) => {
28
- if (!runtime.model) return undefined;
29
- const length = typeof options.truncation_length === "number" ? options.truncation_length : 0;
30
- const symbol = typeof options.truncation_symbol === "string" ? options.truncation_symbol : "…";
31
- const direction = isTruncationDirection(options.truncation_direction)
32
- ? options.truncation_direction
33
- : "end";
34
- const aliases = options.model_aliases;
35
- const aliasMap =
36
- aliases && typeof aliases === "object" && !Array.isArray(aliases)
37
- ? (aliases as Readonly<Record<string, string>>)
38
- : undefined;
39
- const alias =
40
- aliasMap && Object.hasOwn(aliasMap, runtime.model.id)
41
- ? aliasMap[runtime.model.id]
42
- : undefined;
43
- return {
44
- model: truncateModel(alias ?? shortenModel(runtime.model.id), length, symbol, direction),
45
- };
46
- },
9
+ name: "model",
10
+ variables: ["symbol", "model"],
11
+ defaults: {
12
+ format: "[$symbol $model ]($style)",
13
+ symbol: "🤖",
14
+ style: "bold blue",
15
+ disabled: false,
16
+ },
17
+ styleRuleSelectors: {
18
+ provider: ({ runtime }) => runtime.model?.provider,
19
+ model: ({ runtime }) => runtime.model?.id,
20
+ },
21
+ options: {
22
+ truncation_length: { kind: "integer", default: 0, minimum: 0, maximum: 1000 },
23
+ truncation_symbol: { kind: "string", default: "…" },
24
+ truncation_direction: {
25
+ kind: "string-enum",
26
+ default: "end",
27
+ values: TRUNCATION_DIRECTIONS,
28
+ },
29
+ model_aliases: { kind: "string-map", default: {} },
30
+ },
31
+ values: ({ runtime, options }) => {
32
+ if (!runtime.model) return undefined;
33
+ const length = typeof options.truncation_length === "number" ? options.truncation_length : 0;
34
+ const symbol = typeof options.truncation_symbol === "string" ? options.truncation_symbol : "…";
35
+ const direction = isTruncationDirection(options.truncation_direction) ? options.truncation_direction : "end";
36
+ const aliases = options.model_aliases;
37
+ const aliasMap =
38
+ aliases && typeof aliases === "object" && !Array.isArray(aliases)
39
+ ? (aliases as Readonly<Record<string, string>>)
40
+ : undefined;
41
+ const alias = aliasMap && Object.hasOwn(aliasMap, runtime.model.id) ? aliasMap[runtime.model.id] : undefined;
42
+ return {
43
+ model: truncateModel(alias ?? shortenModel(runtime.model.id), length, symbol, direction),
44
+ };
45
+ },
47
46
  });
48
47
 
49
- export function truncateModel(
50
- model: string,
51
- length: number,
52
- symbol: string,
53
- direction: TruncationDirection,
54
- ): string {
55
- const safeModel = sanitizeTerminalText(model);
56
- if (length === 0) return safeModel;
57
- const graphemes = [...graphemeSegmenter.segment(safeModel)].map(({ segment }) => segment);
58
- if (graphemes.length <= length) return safeModel;
59
- const safeSymbol = sanitizeTerminalText(symbol);
48
+ export function truncateModel(model: string, length: number, symbol: string, direction: TruncationDirection): string {
49
+ const safeModel = sanitizeTerminalText(model);
50
+ if (length === 0) return safeModel;
51
+ const graphemes = [...graphemeSegmenter.segment(safeModel)].map(({ segment }) => segment);
52
+ if (graphemes.length <= length) return safeModel;
53
+ const safeSymbol = sanitizeTerminalText(symbol);
60
54
 
61
- switch (direction) {
62
- case "start":
63
- return `${safeSymbol}${graphemes.slice(-length).join("")}`;
64
- case "middle": {
65
- const headLength = Math.ceil(length / 2);
66
- const tailLength = Math.floor(length / 2);
67
- const tail = tailLength > 0 ? graphemes.slice(-tailLength).join("") : "";
68
- return `${graphemes.slice(0, headLength).join("")}${safeSymbol}${tail}`;
69
- }
70
- case "end":
71
- return `${graphemes.slice(0, length).join("")}${safeSymbol}`;
72
- }
55
+ switch (direction) {
56
+ case "start":
57
+ return `${safeSymbol}${graphemes.slice(-length).join("")}`;
58
+ case "middle": {
59
+ const headLength = Math.ceil(length / 2);
60
+ const tailLength = Math.floor(length / 2);
61
+ const tail = tailLength > 0 ? graphemes.slice(-tailLength).join("") : "";
62
+ return `${graphemes.slice(0, headLength).join("")}${safeSymbol}${tail}`;
63
+ }
64
+ case "end":
65
+ return `${graphemes.slice(0, length).join("")}${safeSymbol}`;
66
+ }
73
67
  }
74
68
 
75
69
  function isTruncationDirection(value: unknown): value is TruncationDirection {
76
- return TRUNCATION_DIRECTIONS.includes(value as TruncationDirection);
70
+ return TRUNCATION_DIRECTIONS.includes(value as TruncationDirection);
77
71
  }
78
72
 
79
73
  export function shortenModel(model: string): string {
80
- return model
81
- .replace(/^claude-/u, "")
82
- .replace(/^gpt-/u, "gpt ")
83
- .replace(/-20\d{6}$/u, "")
84
- .replace(/-latest$/u, "");
74
+ return model
75
+ .replace(/^claude-/u, "")
76
+ .replace(/^gpt-/u, "gpt ")
77
+ .replace(/-20\d{6}$/u, "")
78
+ .replace(/-latest$/u, "");
85
79
  }
@@ -2,16 +2,16 @@ import { defineModule } from "./types.js";
2
2
  import { workspaceModuleValues } from "./workspace-helpers.js";
3
3
 
4
4
  export const packageModule = defineModule({
5
- name: "package",
6
- variables: ["symbol", "version", "source"],
7
- defaults: {
8
- format: "via [$symbol$version]($style) ",
9
- symbol: "📦 ",
10
- style: "bold 208",
11
- disabled: false,
12
- },
13
- options: {
14
- version_format: { kind: "string", default: "v$raw" },
15
- },
16
- values: (context) => workspaceModuleValues("package", context),
5
+ name: "package",
6
+ variables: ["symbol", "version", "source"],
7
+ defaults: {
8
+ format: "via [$symbol$version]($style) ",
9
+ symbol: "📦 ",
10
+ style: "bold 208",
11
+ disabled: false,
12
+ },
13
+ options: {
14
+ version_format: { kind: "string", default: "v$raw" },
15
+ },
16
+ values: (context) => workspaceModuleValues("package", context),
17
17
  });
@@ -4,28 +4,29 @@ import { defineModule } from "./types.js";
4
4
  const PROVIDER_ALIASES_KEY = "provider_aliases";
5
5
 
6
6
  export const providerModule = defineModule({
7
- name: "provider",
8
- variables: ["symbol", "provider"],
9
- defaults: {
10
- format: "[$symbol $provider ]($style)",
11
- symbol: "🔌",
12
- style: "bold blue",
13
- disabled: false,
14
- },
15
- options: {
16
- [PROVIDER_ALIASES_KEY]: { kind: "string-map", default: {} },
17
- },
18
- values: ({ runtime, options }) => {
19
- if (!runtime.model) return undefined;
20
- const aliases = options[PROVIDER_ALIASES_KEY];
21
- const aliasMap =
22
- aliases && typeof aliases === "object" && !Array.isArray(aliases)
23
- ? (aliases as Readonly<Record<string, string>>)
24
- : undefined;
25
- const alias =
26
- aliasMap && Object.hasOwn(aliasMap, runtime.model.provider)
27
- ? aliasMap[runtime.model.provider]
28
- : undefined;
29
- return { provider: sanitizeTerminalText(alias ?? runtime.model.provider) };
30
- },
7
+ name: "provider",
8
+ variables: ["symbol", "provider"],
9
+ defaults: {
10
+ format: "[$symbol $provider ]($style)",
11
+ symbol: "🔌",
12
+ style: "bold blue",
13
+ disabled: false,
14
+ },
15
+ styleRuleSelectors: {
16
+ provider: ({ runtime }) => runtime.model?.provider,
17
+ },
18
+ options: {
19
+ [PROVIDER_ALIASES_KEY]: { kind: "string-map", default: {} },
20
+ },
21
+ values: ({ runtime, options }) => {
22
+ if (!runtime.model) return undefined;
23
+ const aliases = options[PROVIDER_ALIASES_KEY];
24
+ const aliasMap =
25
+ aliases && typeof aliases === "object" && !Array.isArray(aliases)
26
+ ? (aliases as Readonly<Record<string, string>>)
27
+ : undefined;
28
+ const alias =
29
+ aliasMap && Object.hasOwn(aliasMap, runtime.model.provider) ? aliasMap[runtime.model.provider] : undefined;
30
+ return { provider: sanitizeTerminalText(alias ?? runtime.model.provider) };
31
+ },
31
32
  });