@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,13 +1,13 @@
1
1
  import { defineModule } from "./types.js";
2
2
 
3
3
  export const brandModule = defineModule({
4
- name: "brand",
5
- variables: ["symbol"],
6
- defaults: {
7
- format: "[ $symbol ]($style)",
8
- symbol: "π",
9
- style: "bold white",
10
- disabled: false,
11
- },
12
- values: () => ({}),
4
+ name: "brand",
5
+ variables: ["symbol"],
6
+ defaults: {
7
+ format: "[ $symbol ]($style)",
8
+ symbol: "π",
9
+ style: "bold white",
10
+ disabled: false,
11
+ },
12
+ values: () => ({}),
13
13
  });
@@ -2,22 +2,22 @@ import { formatCount } from "./helpers.js";
2
2
  import { defineModule } from "./types.js";
3
3
 
4
4
  export const cacheModule = defineModule({
5
- name: "cache",
6
- variables: ["symbol", "rate", "read", "write"],
7
- defaults: {
8
- format: "[$symbol (CH$rate )]($style)",
9
- symbol: "📦",
10
- style: "bold green",
11
- disabled: true,
12
- },
13
- values: ({ runtime }) => {
14
- const { cacheRead, cacheWrite, latestCacheHitRate } = runtime.tokenTotals;
15
- if (cacheRead === 0 && cacheWrite === 0) return undefined;
16
- const rate = latestCacheHitRate === undefined ? "" : `${latestCacheHitRate.toFixed(1)}%`;
17
- return {
18
- rate,
19
- read: cacheRead > 0 ? formatCount(cacheRead) : "",
20
- write: cacheWrite > 0 ? formatCount(cacheWrite) : "",
21
- };
22
- },
5
+ name: "cache",
6
+ variables: ["symbol", "rate", "read", "write"],
7
+ defaults: {
8
+ format: "[$symbol (CH$rate )]($style)",
9
+ symbol: "📦",
10
+ style: "bold green",
11
+ disabled: true,
12
+ },
13
+ values: ({ runtime }) => {
14
+ const { cacheRead, cacheWrite, latestCacheHitRate } = runtime.tokenTotals;
15
+ if (cacheRead === 0 && cacheWrite === 0) return undefined;
16
+ const rate = latestCacheHitRate === undefined ? "" : `${latestCacheHitRate.toFixed(1)}%`;
17
+ return {
18
+ rate,
19
+ read: cacheRead > 0 ? formatCount(cacheRead) : "",
20
+ write: cacheWrite > 0 ? formatCount(cacheWrite) : "",
21
+ };
22
+ },
23
23
  });
@@ -28,97 +28,93 @@ import { turnModule } from "./turn.js";
28
28
  import type { ModuleDefinition } from "./types.js";
29
29
 
30
30
  const MODULE_IMPLEMENTATIONS = [
31
- brandModule,
32
- providerModule,
33
- modelModule,
34
- thinkingModule,
35
- directoryModule,
36
- gitWorktreeModule,
37
- gitBranchModule,
38
- githubPrModule,
39
- gitCommitModule,
40
- gitStateModule,
41
- gitMetricsModule,
42
- gitStatusModule,
43
- packageModule,
44
- ...languageModules,
45
- ...developmentModules,
46
- ...deploymentModules,
47
- ...cloudModules,
48
- ...executionModules,
49
- activityModule,
50
- contextModule,
51
- tokensModule,
52
- cacheModule,
53
- costModule,
54
- timeModule,
55
- turnModule,
56
- fillModule,
57
- // Keep arbitrary third-party statuses after the native modules.
58
- extensionStatusModule,
31
+ brandModule,
32
+ providerModule,
33
+ modelModule,
34
+ thinkingModule,
35
+ directoryModule,
36
+ gitWorktreeModule,
37
+ gitBranchModule,
38
+ githubPrModule,
39
+ gitCommitModule,
40
+ gitStateModule,
41
+ gitMetricsModule,
42
+ gitStatusModule,
43
+ packageModule,
44
+ ...languageModules,
45
+ ...developmentModules,
46
+ ...deploymentModules,
47
+ ...cloudModules,
48
+ ...executionModules,
49
+ activityModule,
50
+ contextModule,
51
+ tokensModule,
52
+ cacheModule,
53
+ costModule,
54
+ timeModule,
55
+ turnModule,
56
+ fillModule,
57
+ // Keep arbitrary third-party statuses after the native modules.
58
+ extensionStatusModule,
59
59
  ] as const satisfies readonly ModuleDefinition<string>[];
60
60
 
61
61
  export type ModuleName = (typeof MODULE_IMPLEMENTATIONS)[number]["name"];
62
62
 
63
63
  const MODULE_DESCRIPTIONS = {
64
- activity: "Current Pi activity, extension UI wait, or most recently completed tool.",
65
- aws: "Active AWS profile and region.",
66
- azure: "Active Azure subscription and optional username.",
67
- brand: "pi-starship brand mark.",
68
- bun: "Bun version detected in the current workspace.",
69
- cache: "Prompt-cache usage and latest cache hit rate.",
70
- conda: "Active Conda environment.",
71
- container: "Current container or remote development environment.",
72
- context: "Current model context-window usage.",
73
- cost: "Reported estimated session cost or subscription state.",
74
- deno: "Deno version detected in the current workspace.",
75
- directory: "Current working directory.",
76
- direnv: "Current direnv loading and permission state.",
77
- docker_context: "Active Docker context.",
78
- extension_status: "Statuses published through Pi's extension-neutral status map.",
79
- fill: "Flexible spacing that aligns content within the footer width.",
80
- gcloud: "Active Google Cloud project, account, and region.",
81
- git_branch: "Current Git branch and upstream identity.",
82
- git_commit: "Current Git commit hash or tag.",
83
- git_metrics: "Added and deleted lines in the current Git worktree.",
84
- git_state: "Current Git operation such as merge, rebase, or cherry-pick.",
85
- git_status: "Current Git worktree and index status summary.",
86
- git_worktree: "Current linked Git worktree identity.",
87
- github_pr: "Current branch's GitHub pull request state, checks, and review.",
88
- golang: "Go version detected in the current workspace.",
89
- guix_shell: "Current Guix shell state.",
90
- hostname: "Current host name, normally shown for remote sessions.",
91
- kubernetes: "Active Kubernetes context, namespace, cluster, and user.",
92
- mise: "Current mise configuration health.",
93
- model: "Current Pi model.",
94
- nix_shell: "Current Nix shell state, name, and nesting level.",
95
- nodejs: "Node.js version detected in the current workspace.",
96
- openstack: "Active OpenStack cloud and project.",
97
- os: "Current operating system identity.",
98
- package: "Current workspace package version and manifest source.",
99
- pixi: "Active Pixi environment and project.",
100
- provider: "Current Pi model provider.",
101
- python: "Python version, virtual environment, and pyenv state.",
102
- rust: "Rust toolchain detected in the current workspace.",
103
- terraform: "Active Terraform workspace and version.",
104
- thinking: "Current Pi thinking level or streaming state.",
105
- time: "Current local time.",
106
- tokens: "Session input and output token totals.",
107
- turn: "Current user-turn count.",
108
- username: "Current user identity when configured to display.",
64
+ activity: "Current Pi activity, extension UI wait, or most recently completed tool.",
65
+ aws: "Active AWS profile and region.",
66
+ azure: "Active Azure subscription and optional username.",
67
+ brand: "pi-starship brand mark.",
68
+ bun: "Bun version detected in the current workspace.",
69
+ cache: "Prompt-cache usage and latest cache hit rate.",
70
+ conda: "Active Conda environment.",
71
+ container: "Current container or remote development environment.",
72
+ context: "Current model context-window usage.",
73
+ cost: "Reported estimated session cost or subscription state.",
74
+ deno: "Deno version detected in the current workspace.",
75
+ directory: "Current working directory.",
76
+ direnv: "Current direnv loading and permission state.",
77
+ docker_context: "Active Docker context.",
78
+ extension_status: "Statuses published through Pi's extension-neutral status map.",
79
+ fill: "Flexible spacing that aligns content within the footer width.",
80
+ gcloud: "Active Google Cloud project, account, and region.",
81
+ git_branch: "Current Git branch and upstream identity.",
82
+ git_commit: "Current Git commit hash or tag.",
83
+ git_metrics: "Added and deleted lines in the current Git worktree.",
84
+ git_state: "Current Git operation such as merge, rebase, or cherry-pick.",
85
+ git_status: "Current Git worktree and index status summary.",
86
+ git_worktree: "Current linked Git worktree identity.",
87
+ github_pr: "Current branch's GitHub pull request state, checks, and review.",
88
+ golang: "Go version detected in the current workspace.",
89
+ guix_shell: "Current Guix shell state.",
90
+ hostname: "Current host name, normally shown for remote sessions.",
91
+ kubernetes: "Active Kubernetes context, namespace, cluster, and user.",
92
+ mise: "Current mise configuration health.",
93
+ model: "Current Pi model.",
94
+ nix_shell: "Current Nix shell state, name, and nesting level.",
95
+ nodejs: "Node.js version detected in the current workspace.",
96
+ openstack: "Active OpenStack cloud and project.",
97
+ os: "Current operating system identity.",
98
+ package: "Current workspace package version and manifest source.",
99
+ pixi: "Active Pixi environment and project.",
100
+ provider: "Current Pi model provider.",
101
+ python: "Python version, virtual environment, and pyenv state.",
102
+ rust: "Rust toolchain detected in the current workspace.",
103
+ terraform: "Active Terraform workspace and version.",
104
+ thinking: "Current Pi thinking level or streaming state.",
105
+ time: "Current local time.",
106
+ tokens: "Session input and output token totals.",
107
+ turn: "Current user-turn count.",
108
+ username: "Current user identity when configured to display.",
109
109
  } as const satisfies Record<ModuleName, string>;
110
110
 
111
111
  export type CatalogModuleDefinition<Name extends string = ModuleName> = ModuleDefinition<Name> & {
112
- readonly description: string;
112
+ readonly description: string;
113
113
  };
114
114
 
115
- export const MODULE_DEFINITIONS: readonly CatalogModuleDefinition[] = MODULE_IMPLEMENTATIONS.map(
116
- (definition) => ({
117
- ...definition,
118
- description: MODULE_DESCRIPTIONS[definition.name],
119
- }),
120
- );
115
+ export const MODULE_DEFINITIONS: readonly CatalogModuleDefinition[] = MODULE_IMPLEMENTATIONS.map((definition) => ({
116
+ ...definition,
117
+ description: MODULE_DESCRIPTIONS[definition.name],
118
+ }));
121
119
 
122
- export const MODULE_NAMES: readonly ModuleName[] = MODULE_IMPLEMENTATIONS.map(
123
- (definition) => definition.name,
124
- );
120
+ export const MODULE_NAMES: readonly ModuleName[] = MODULE_IMPLEMENTATIONS.map((definition) => definition.name);
@@ -2,73 +2,73 @@ import { defineModule, type ModuleDefinition, type ModuleOptionSchema } from "./
2
2
  import { workspaceModuleValues } from "./workspace-helpers.js";
3
3
 
4
4
  function cloudModule<const Name extends string>(definition: {
5
- name: Name;
6
- variables: readonly string[];
7
- format: string;
8
- symbol: string;
9
- style: string;
10
- options: Readonly<Record<string, ModuleOptionSchema>>;
5
+ name: Name;
6
+ variables: readonly string[];
7
+ format: string;
8
+ symbol: string;
9
+ style: string;
10
+ options: Readonly<Record<string, ModuleOptionSchema>>;
11
11
  }): ModuleDefinition<Name> {
12
- return defineModule({
13
- name: definition.name,
14
- variables: ["symbol", ...definition.variables],
15
- defaults: {
16
- format: definition.format,
17
- symbol: definition.symbol,
18
- style: definition.style,
19
- disabled: false,
20
- },
21
- options: definition.options,
22
- values: (context) => workspaceModuleValues(definition.name, context),
23
- });
12
+ return defineModule({
13
+ name: definition.name,
14
+ variables: ["symbol", ...definition.variables],
15
+ defaults: {
16
+ format: definition.format,
17
+ symbol: definition.symbol,
18
+ style: definition.style,
19
+ disabled: false,
20
+ },
21
+ options: definition.options,
22
+ values: (context) => workspaceModuleValues(definition.name, context),
23
+ });
24
24
  }
25
25
 
26
26
  export const awsModule = cloudModule({
27
- name: "aws",
28
- variables: ["profile", "region"],
29
- format: "on [$symbol($profile )(\\($region\\) )]($style)",
30
- symbol: "☁️ ",
31
- style: "bold yellow",
32
- options: {
33
- profile_aliases: { kind: "string-map", default: {} },
34
- region_aliases: { kind: "string-map", default: {} },
35
- },
27
+ name: "aws",
28
+ variables: ["profile", "region"],
29
+ format: "on [$symbol($profile )(\\($region\\) )]($style)",
30
+ symbol: "☁️ ",
31
+ style: "bold yellow",
32
+ options: {
33
+ profile_aliases: { kind: "string-map", default: {} },
34
+ region_aliases: { kind: "string-map", default: {} },
35
+ },
36
36
  });
37
37
 
38
38
  export const gcloudModule = cloudModule({
39
- name: "gcloud",
40
- variables: ["active", "account", "domain", "project", "region"],
41
- format: "on [$symbol$project]($style) ",
42
- symbol: "☁️ ",
43
- style: "bold blue",
44
- options: {
45
- project_aliases: { kind: "string-map", default: {} },
46
- region_aliases: { kind: "string-map", default: {} },
47
- },
39
+ name: "gcloud",
40
+ variables: ["active", "account", "domain", "project", "region"],
41
+ format: "on [$symbol$project]($style) ",
42
+ symbol: "☁️ ",
43
+ style: "bold blue",
44
+ options: {
45
+ project_aliases: { kind: "string-map", default: {} },
46
+ region_aliases: { kind: "string-map", default: {} },
47
+ },
48
48
  });
49
49
 
50
50
  export const azureModule = cloudModule({
51
- name: "azure",
52
- variables: ["subscription", "username"],
53
- format: "on [$symbol$subscription]($style) ",
54
- symbol: "󰠅 ",
55
- style: "blue bold",
56
- options: {
57
- subscription_aliases: { kind: "string-map", default: {} },
58
- show_username: { kind: "boolean", default: false },
59
- },
51
+ name: "azure",
52
+ variables: ["subscription", "username"],
53
+ format: "on [$symbol$subscription]($style) ",
54
+ symbol: "󰠅 ",
55
+ style: "blue bold",
56
+ options: {
57
+ subscription_aliases: { kind: "string-map", default: {} },
58
+ show_username: { kind: "boolean", default: false },
59
+ },
60
60
  });
61
61
 
62
62
  export const openstackModule = cloudModule({
63
- name: "openstack",
64
- variables: ["cloud", "project"],
65
- format: "on [$symbol$cloud( \\($project\\))]($style) ",
66
- symbol: "☁️ ",
67
- style: "bold yellow",
68
- options: {
69
- cloud_aliases: { kind: "string-map", default: {} },
70
- project_aliases: { kind: "string-map", default: {} },
71
- },
63
+ name: "openstack",
64
+ variables: ["cloud", "project"],
65
+ format: "on [$symbol$cloud( \\($project\\))]($style) ",
66
+ symbol: "☁️ ",
67
+ style: "bold yellow",
68
+ options: {
69
+ cloud_aliases: { kind: "string-map", default: {} },
70
+ project_aliases: { kind: "string-map", default: {} },
71
+ },
72
72
  });
73
73
 
74
74
  export const cloudModules = [awsModule, gcloudModule, azureModule, openstackModule] as const;
@@ -3,31 +3,31 @@ import { formatCount } from "./helpers.js";
3
3
  import { defineModule } from "./types.js";
4
4
 
5
5
  export const contextModule = defineModule({
6
- name: "context",
7
- variables: ["symbol", "percentage", "tokens", "window"],
8
- defaults: {
9
- format: "[$symbol ctx $percentage ]($style)",
10
- symbol: "🪟",
11
- style: "none",
12
- disabled: false,
13
- },
14
- displayDefaults: [
15
- { threshold: 0, style: "bold green", hidden: true },
16
- { threshold: 30, style: "bold green", hidden: false },
17
- { threshold: 60, style: "bold yellow", hidden: false },
18
- { threshold: 80, style: "bold red", hidden: false },
19
- ],
20
- styleVariables: ["style"],
21
- resolveStyleVariables: ({ runtime, display }) => {
22
- const style = resolveDisplayStyle(display, runtime.contextUsage?.percent);
23
- return style === undefined ? undefined : { style };
24
- },
25
- values: ({ runtime }) => {
26
- const percent = runtime.contextUsage?.percent;
27
- return {
28
- percentage: percent === null || percent === undefined ? "?" : `${percent.toFixed(1)}%`,
29
- tokens: formatCount(runtime.contextUsage?.tokens ?? 0),
30
- window: formatCount(runtime.contextUsage?.contextWindow ?? 0),
31
- };
32
- },
6
+ name: "context",
7
+ variables: ["symbol", "percentage", "tokens", "window"],
8
+ defaults: {
9
+ format: "[$symbol ctx $percentage ]($style)",
10
+ symbol: "🪟",
11
+ style: "none",
12
+ disabled: false,
13
+ },
14
+ displayDefaults: [
15
+ { threshold: 0, style: "bold green", hidden: true },
16
+ { threshold: 30, style: "bold green", hidden: false },
17
+ { threshold: 60, style: "bold yellow", hidden: false },
18
+ { threshold: 80, style: "bold red", hidden: false },
19
+ ],
20
+ styleVariables: ["style"],
21
+ resolveStyleVariables: ({ runtime, display }) => {
22
+ const style = resolveDisplayStyle(display, runtime.contextUsage?.percent);
23
+ return style === undefined ? undefined : { style };
24
+ },
25
+ values: ({ runtime }) => {
26
+ const percent = runtime.contextUsage?.percent;
27
+ return {
28
+ percentage: percent === null || percent === undefined ? "?" : `${percent.toFixed(1)}%`,
29
+ tokens: formatCount(runtime.contextUsage?.tokens ?? 0),
30
+ window: formatCount(runtime.contextUsage?.contextWindow ?? 0),
31
+ };
32
+ },
33
33
  });
@@ -2,30 +2,30 @@ import { resolveDisplayStyle } from "./display.js";
2
2
  import { defineModule } from "./types.js";
3
3
 
4
4
  export const costModule = defineModule({
5
- name: "cost",
6
- variables: ["symbol", "cost", "subscription"],
7
- defaults: {
8
- format: "[ $symbol \\$$cost( $subscription) ]($style)",
9
- symbol: "💸",
10
- style: "none",
11
- disabled: false,
12
- },
13
- displayDefaults: [
14
- { threshold: 0, style: "bold green", hidden: true },
15
- { threshold: 1, style: "bold yellow", hidden: false },
16
- { threshold: 5, style: "bold red", hidden: false },
17
- ],
18
- styleVariables: ["style"],
19
- resolveStyleVariables: ({ runtime, display }) => {
20
- const style = resolveDisplayStyle(display, runtime.tokenTotals.cost);
21
- return style === undefined ? undefined : { style };
22
- },
23
- values: ({ runtime }) => ({
24
- cost: formatCost(runtime.tokenTotals.cost),
25
- subscription: runtime.usingSubscription ? "(sub)" : "",
26
- }),
5
+ name: "cost",
6
+ variables: ["symbol", "cost", "subscription"],
7
+ defaults: {
8
+ format: "[ $symbol \\$$cost( $subscription) ]($style)",
9
+ symbol: "💸",
10
+ style: "none",
11
+ disabled: false,
12
+ },
13
+ displayDefaults: [
14
+ { threshold: 0, style: "bold green", hidden: true },
15
+ { threshold: 1, style: "bold yellow", hidden: false },
16
+ { threshold: 5, style: "bold red", hidden: false },
17
+ ],
18
+ styleVariables: ["style"],
19
+ resolveStyleVariables: ({ runtime, display }) => {
20
+ const style = resolveDisplayStyle(display, runtime.tokenTotals.cost);
21
+ return style === undefined ? undefined : { style };
22
+ },
23
+ values: ({ runtime }) => ({
24
+ cost: formatCost(runtime.tokenTotals.cost),
25
+ subscription: runtime.usingSubscription ? "(sub)" : "",
26
+ }),
27
27
  });
28
28
 
29
29
  function formatCost(value: number): string {
30
- return value.toFixed(value >= 1 ? 2 : 3);
30
+ return value.toFixed(value >= 1 ? 2 : 3);
31
31
  }
@@ -2,60 +2,60 @@ import { defineModule } from "./types.js";
2
2
  import { workspaceModuleValues } from "./workspace-helpers.js";
3
3
 
4
4
  const directDetection = {
5
- detect_files: { kind: "string-array", default: [] },
6
- detect_extensions: { kind: "string-array", default: [] },
7
- detect_folders: { kind: "string-array", default: [] },
5
+ detect_files: { kind: "string-array", default: [] },
6
+ detect_extensions: { kind: "string-array", default: [] },
7
+ detect_folders: { kind: "string-array", default: [] },
8
8
  } as const;
9
9
 
10
10
  export const dockerContextModule = defineModule({
11
- name: "docker_context",
12
- variables: ["symbol", "context"],
13
- defaults: {
14
- format: "via [$symbol$context]($style) ",
15
- symbol: " ",
16
- style: "blue bold",
17
- disabled: false,
18
- },
19
- options: {
20
- ...directDetection,
21
- only_with_files: { kind: "boolean", default: false },
22
- },
23
- values: (context) => workspaceModuleValues("docker_context", context),
11
+ name: "docker_context",
12
+ variables: ["symbol", "context"],
13
+ defaults: {
14
+ format: "via [$symbol$context]($style) ",
15
+ symbol: " ",
16
+ style: "blue bold",
17
+ disabled: false,
18
+ },
19
+ options: {
20
+ ...directDetection,
21
+ only_with_files: { kind: "boolean", default: false },
22
+ },
23
+ values: (context) => workspaceModuleValues("docker_context", context),
24
24
  });
25
25
 
26
26
  export const kubernetesModule = defineModule({
27
- name: "kubernetes",
28
- variables: ["symbol", "context", "namespace", "cluster", "user"],
29
- defaults: {
30
- format: "on [$symbol$context( \\($namespace\\))]($style) ",
31
- symbol: "☸ ",
32
- style: "cyan bold",
33
- disabled: false,
34
- },
35
- options: {
36
- context_aliases: { kind: "string-map", default: {} },
37
- namespace_aliases: { kind: "string-map", default: {} },
38
- cluster_aliases: { kind: "string-map", default: {} },
39
- user_aliases: { kind: "string-map", default: {} },
40
- max_config_files: { kind: "integer", default: 8, minimum: 1, maximum: 32 },
41
- },
42
- values: (context) => workspaceModuleValues("kubernetes", context),
27
+ name: "kubernetes",
28
+ variables: ["symbol", "context", "namespace", "cluster", "user"],
29
+ defaults: {
30
+ format: "on [$symbol$context( \\($namespace\\))]($style) ",
31
+ symbol: "☸ ",
32
+ style: "cyan bold",
33
+ disabled: false,
34
+ },
35
+ options: {
36
+ context_aliases: { kind: "string-map", default: {} },
37
+ namespace_aliases: { kind: "string-map", default: {} },
38
+ cluster_aliases: { kind: "string-map", default: {} },
39
+ user_aliases: { kind: "string-map", default: {} },
40
+ max_config_files: { kind: "integer", default: 8, minimum: 1, maximum: 32 },
41
+ },
42
+ values: (context) => workspaceModuleValues("kubernetes", context),
43
43
  });
44
44
 
45
45
  export const terraformModule = defineModule({
46
- name: "terraform",
47
- variables: ["symbol", "workspace", "version"],
48
- defaults: {
49
- format: "via [$symbol$workspace]($style) ",
50
- symbol: "💠 ",
51
- style: "bold 105",
52
- disabled: false,
53
- },
54
- options: {
55
- ...directDetection,
56
- version_format: { kind: "string", default: "v$raw" },
57
- },
58
- values: (context) => workspaceModuleValues("terraform", context),
46
+ name: "terraform",
47
+ variables: ["symbol", "workspace", "version"],
48
+ defaults: {
49
+ format: "via [$symbol$workspace]($style) ",
50
+ symbol: "💠 ",
51
+ style: "bold 105",
52
+ disabled: false,
53
+ },
54
+ options: {
55
+ ...directDetection,
56
+ version_format: { kind: "string", default: "v$raw" },
57
+ },
58
+ values: (context) => workspaceModuleValues("terraform", context),
59
59
  });
60
60
 
61
61
  export const deploymentModules = [dockerContextModule, kubernetesModule, terraformModule] as const;