@narumitw/pi-starship 0.49.2 → 0.49.3

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 (84) hide show
  1. package/README.md +6 -4
  2. package/dist/chunks/chunk-CKNSOLSW.ts +10 -0
  3. package/dist/chunks/chunk-CKNSOLSW.ts.map +7 -0
  4. package/dist/chunks/chunk-G2GG2V6Q.ts +218 -0
  5. package/dist/chunks/chunk-G2GG2V6Q.ts.map +7 -0
  6. package/dist/chunks/chunk-Q6DLIM7H.ts +2492 -0
  7. package/dist/chunks/chunk-Q6DLIM7H.ts.map +7 -0
  8. package/dist/chunks/cloud-JBSZWTB6.ts +142 -0
  9. package/dist/chunks/cloud-JBSZWTB6.ts.map +7 -0
  10. package/dist/chunks/commands-BSQZ2R4M.ts +757 -0
  11. package/dist/chunks/commands-BSQZ2R4M.ts.map +7 -0
  12. package/dist/chunks/deployment-ZNYM4B6W.ts +172 -0
  13. package/dist/chunks/deployment-ZNYM4B6W.ts.map +7 -0
  14. package/dist/chunks/development-TNWZ5SRC.ts +132 -0
  15. package/dist/chunks/development-TNWZ5SRC.ts.map +7 -0
  16. package/dist/chunks/execution-QHAP4U33.ts +132 -0
  17. package/dist/chunks/execution-QHAP4U33.ts.map +7 -0
  18. package/dist/chunks/languages-DPWDCH6Q.ts +184 -0
  19. package/dist/chunks/languages-DPWDCH6Q.ts.map +7 -0
  20. package/dist/chunks/package-MXN2YFLX.ts +104 -0
  21. package/dist/chunks/package-MXN2YFLX.ts.map +7 -0
  22. package/dist/pi-starship.ts +1350 -0
  23. package/dist/pi-starship.ts.map +7 -0
  24. package/package.json +9 -5
  25. package/src/index.ts +1 -1
  26. package/src/command-contract.ts +0 -13
  27. package/src/command-inspector.ts +0 -198
  28. package/src/command-preview.ts +0 -206
  29. package/src/commands.ts +0 -575
  30. package/src/config.ts +0 -794
  31. package/src/format/formatter.ts +0 -275
  32. package/src/format/style.ts +0 -278
  33. package/src/modules/activity.ts +0 -38
  34. package/src/modules/brand.ts +0 -13
  35. package/src/modules/cache.ts +0 -23
  36. package/src/modules/catalog.ts +0 -124
  37. package/src/modules/cloud.ts +0 -74
  38. package/src/modules/context.ts +0 -33
  39. package/src/modules/cost.ts +0 -31
  40. package/src/modules/deployment.ts +0 -61
  41. package/src/modules/development.ts +0 -112
  42. package/src/modules/directory.ts +0 -151
  43. package/src/modules/display.ts +0 -14
  44. package/src/modules/execution.ts +0 -84
  45. package/src/modules/extension-status.ts +0 -93
  46. package/src/modules/fill.ts +0 -14
  47. package/src/modules/git/branch.ts +0 -31
  48. package/src/modules/git/commit.ts +0 -29
  49. package/src/modules/git/metrics.ts +0 -26
  50. package/src/modules/git/runtime.ts +0 -415
  51. package/src/modules/git/state.ts +0 -21
  52. package/src/modules/git/status.ts +0 -87
  53. package/src/modules/git/worktree.ts +0 -16
  54. package/src/modules/github-pr.ts +0 -24
  55. package/src/modules/helpers.ts +0 -5
  56. package/src/modules/index.ts +0 -31
  57. package/src/modules/inspection.ts +0 -138
  58. package/src/modules/languages.ts +0 -87
  59. package/src/modules/model.ts +0 -85
  60. package/src/modules/package.ts +0 -17
  61. package/src/modules/provider.ts +0 -13
  62. package/src/modules/render.ts +0 -166
  63. package/src/modules/terminal.ts +0 -60
  64. package/src/modules/thinking.ts +0 -13
  65. package/src/modules/time.ts +0 -20
  66. package/src/modules/tokens.ts +0 -18
  67. package/src/modules/truncation.ts +0 -37
  68. package/src/modules/turn.ts +0 -13
  69. package/src/modules/types.ts +0 -189
  70. package/src/modules/workspace-helpers.ts +0 -10
  71. package/src/pi-starship.ts +0 -609
  72. package/src/runtime/cloud.ts +0 -166
  73. package/src/runtime/command.ts +0 -123
  74. package/src/runtime/deployment.ts +0 -201
  75. package/src/runtime/development.ts +0 -153
  76. package/src/runtime/execution.ts +0 -151
  77. package/src/runtime/github-pr.ts +0 -332
  78. package/src/runtime/helpers.ts +0 -274
  79. package/src/runtime/languages.ts +0 -205
  80. package/src/runtime/package.ts +0 -112
  81. package/src/runtime/refresh-controller.ts +0 -107
  82. package/src/runtime/types.ts +0 -63
  83. package/src/runtime/workspace.ts +0 -147
  84. package/src/usage.ts +0 -53
@@ -1,60 +0,0 @@
1
- export function sanitizeTerminalText(value: string): string {
2
- let result = "";
3
- for (let index = 0; index < value.length; ) {
4
- const codePoint = value.codePointAt(index) ?? 0;
5
- const character = String.fromCodePoint(codePoint);
6
- if (codePoint === 0x1b || codePoint === 0x9b || codePoint === 0x9d) {
7
- index = skipTerminalEscape(value, index, codePoint);
8
- continue;
9
- }
10
- if (
11
- codePoint <= 0x1f ||
12
- (codePoint >= 0x7f && codePoint <= 0x9f) ||
13
- codePoint === 0x2028 ||
14
- codePoint === 0x2029
15
- ) {
16
- if (
17
- codePoint === 0x09 ||
18
- codePoint === 0x0a ||
19
- codePoint === 0x0d ||
20
- codePoint === 0x85 ||
21
- codePoint === 0x2028 ||
22
- codePoint === 0x2029
23
- ) {
24
- result += " ";
25
- }
26
- index += character.length;
27
- continue;
28
- }
29
- result += character;
30
- index += character.length;
31
- }
32
- return result;
33
- }
34
-
35
- function skipTerminalEscape(value: string, start: number, codePoint: number): number {
36
- let index = start + 1;
37
- const next = value.charCodeAt(index);
38
- const isOsc = codePoint === 0x9d || (codePoint === 0x1b && next === 0x5d);
39
- if (isOsc) {
40
- if (codePoint === 0x1b) index += 1;
41
- while (index < value.length) {
42
- const current = value.charCodeAt(index);
43
- if (current === 0x07 || current === 0x9c) return index + 1;
44
- if (current === 0x1b && value.charCodeAt(index + 1) === 0x5c) return index + 2;
45
- index += 1;
46
- }
47
- return index;
48
- }
49
- const isCsi = codePoint === 0x9b || (codePoint === 0x1b && next === 0x5b);
50
- if (isCsi) {
51
- if (codePoint === 0x1b) index += 1;
52
- while (index < value.length) {
53
- const current = value.charCodeAt(index);
54
- index += 1;
55
- if (current >= 0x40 && current <= 0x7e) break;
56
- }
57
- return index;
58
- }
59
- return Math.min(value.length, start + (codePoint === 0x1b ? 2 : 1));
60
- }
@@ -1,13 +0,0 @@
1
- import { defineModule } from "./types.js";
2
-
3
- export const thinkingModule = defineModule({
4
- name: "thinking",
5
- variables: ["symbol", "level"],
6
- defaults: {
7
- format: "[$symbol $level ]($style)",
8
- symbol: "🧠",
9
- style: "bold purple",
10
- disabled: false,
11
- },
12
- values: ({ runtime }) => ({ level: runtime.thinkingLevel }),
13
- });
@@ -1,20 +0,0 @@
1
- import { defineModule } from "./types.js";
2
-
3
- export const timeModule = defineModule({
4
- name: "time",
5
- variables: ["symbol", "time"],
6
- defaults: {
7
- format: "[$symbol $time ]($style)",
8
- symbol: "🕒",
9
- style: "bold yellow",
10
- disabled: false,
11
- },
12
- values: ({ runtime }) => ({ time: formatTime(runtime.now) }),
13
- });
14
-
15
- function formatTime(now: Date): string {
16
- return `${now.getHours().toString().padStart(2, "0")}:${now
17
- .getMinutes()
18
- .toString()
19
- .padStart(2, "0")}`;
20
- }
@@ -1,18 +0,0 @@
1
- import { formatCount } from "./helpers.js";
2
- import { defineModule } from "./types.js";
3
-
4
- export const tokensModule = defineModule({
5
- name: "tokens",
6
- variables: ["symbol", "input", "output", "total"],
7
- defaults: {
8
- format: "[$symbol ↑$input ↓$output ]($style)",
9
- symbol: "🔢",
10
- style: "bold cyan",
11
- disabled: false,
12
- },
13
- values: ({ runtime }) => ({
14
- input: formatCount(runtime.tokenTotals.input),
15
- output: formatCount(runtime.tokenTotals.output),
16
- total: formatCount(runtime.tokenTotals.input + runtime.tokenTotals.output),
17
- }),
18
- });
@@ -1,37 +0,0 @@
1
- import { sep } from "node:path";
2
-
3
- const graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
4
-
5
- export function graphemes(value: string): string[] {
6
- return [...graphemeSegmenter.segment(value)].map(({ segment }) => segment);
7
- }
8
-
9
- export function firstGrapheme(value: string): string {
10
- return graphemes(value)[0] ?? "";
11
- }
12
-
13
- export function truncateLeadingGraphemes(value: string, length: number, symbol: string): string {
14
- if (length <= 0) return value;
15
- const parts = graphemes(value);
16
- if (parts.length <= length) return value;
17
- return `${parts.slice(0, length).join("")}${firstGrapheme(symbol)}`;
18
- }
19
-
20
- export function toSlashPath(value: string): string {
21
- return sep === "\\" ? value.replaceAll("\\", "/") : value;
22
- }
23
-
24
- export function truncatePathComponents(
25
- value: string,
26
- length: number,
27
- ): { value: string; truncated: boolean } {
28
- if (length <= 0) return { value, truncated: false };
29
- const normalized = toSlashPath(value);
30
- const components = normalized.split("/").filter((component) => component.length > 0);
31
- if (components.length <= length) return { value: normalized, truncated: false };
32
- return { value: components.slice(-length).join("/"), truncated: true };
33
- }
34
-
35
- export function useNativePathSeparator(value: string): string {
36
- return sep === "/" ? value : value.replaceAll("/", sep);
37
- }
@@ -1,13 +0,0 @@
1
- import { defineModule } from "./types.js";
2
-
3
- export const turnModule = defineModule({
4
- name: "turn",
5
- variables: ["symbol", "count"],
6
- defaults: {
7
- format: "[$symbol #$count ]($style)",
8
- symbol: "🔁",
9
- style: "bold purple",
10
- disabled: false,
11
- },
12
- values: ({ runtime }) => ({ count: `${runtime.turnCount}` }),
13
- });
@@ -1,189 +0,0 @@
1
- import type { StyledChunk } from "../format/style.js";
2
-
3
- export interface GitBranchSnapshot {
4
- name: string;
5
- remoteName?: string;
6
- remoteBranch?: string;
7
- detached: boolean;
8
- }
9
-
10
- export interface GitCommitSnapshot {
11
- hash: string;
12
- tag?: string;
13
- detached: boolean;
14
- }
15
-
16
- export interface GitStateSnapshot {
17
- state: string;
18
- progressCurrent?: number;
19
- progressTotal?: number;
20
- }
21
-
22
- export interface GitMetricsSnapshot {
23
- added: number;
24
- deleted: number;
25
- }
26
-
27
- export interface GitStatusSnapshot {
28
- ahead: number;
29
- behind: number;
30
- stashed: number;
31
- conflicted: number;
32
- deleted: number;
33
- renamed: number;
34
- modified: number;
35
- staged: number;
36
- typechanged: number;
37
- untracked: number;
38
- worktreeAdded: number;
39
- worktreeDeleted: number;
40
- worktreeModified: number;
41
- worktreeTypechanged: number;
42
- indexAdded: number;
43
- indexDeleted: number;
44
- indexModified: number;
45
- indexTypechanged: number;
46
- }
47
-
48
- export interface GitWorktreeSnapshot {
49
- name: string;
50
- path: string;
51
- }
52
-
53
- export type GithubPrState = "open" | "draft" | "merged" | "closed";
54
-
55
- export interface GithubPrSnapshot {
56
- readonly number: string;
57
- readonly link: string;
58
- readonly state: GithubPrState;
59
- readonly checks: string;
60
- readonly review: string;
61
- readonly status: string;
62
- readonly expiresAt?: number;
63
- }
64
-
65
- export interface GitSnapshot {
66
- root?: string;
67
- branch?: GitBranchSnapshot;
68
- commit?: GitCommitSnapshot;
69
- state?: GitStateSnapshot;
70
- metrics?: GitMetricsSnapshot;
71
- status: GitStatusSnapshot;
72
- worktree?: GitWorktreeSnapshot;
73
- }
74
-
75
- export interface WorkspaceSnapshot {
76
- modules: Readonly<Record<string, Readonly<Record<string, string>>>>;
77
- styleSelectors?: Readonly<Record<string, string>>;
78
- }
79
-
80
- export interface StarshipRuntimeSnapshot {
81
- cwd: string;
82
- homeDir?: string;
83
- gitRoot?: string;
84
- model?: { provider: string; id: string };
85
- thinkingLevel: string;
86
- turnCount: number;
87
- activeTools: ReadonlyMap<string, number>;
88
- isStreaming: boolean;
89
- lastCompletedTool?: string;
90
- contextUsage?: {
91
- percent?: number | null;
92
- tokens?: number | null;
93
- contextWindow?: number | null;
94
- };
95
- tokenTotals: {
96
- input: number;
97
- output: number;
98
- cacheRead: number;
99
- cacheWrite: number;
100
- cost: number;
101
- latestCacheHitRate?: number;
102
- };
103
- usingSubscription: boolean;
104
- gitBranch: string | null;
105
- gitBranchDetails?: GitBranchSnapshot;
106
- gitCommit?: GitCommitSnapshot;
107
- gitState?: GitStateSnapshot;
108
- gitMetrics?: GitMetricsSnapshot;
109
- gitStatus?: GitStatusSnapshot;
110
- gitWorktree?: GitWorktreeSnapshot;
111
- githubPr?: GithubPrSnapshot;
112
- extensionStatuses: ReadonlyMap<string, string>;
113
- now: Date;
114
- workspace?: WorkspaceSnapshot;
115
- }
116
-
117
- export interface ExtensionStatusPresentation {
118
- separator: string;
119
- maxStatuses: number;
120
- icons: Readonly<Record<string, string>>;
121
- }
122
-
123
- export type ModuleOptionValue =
124
- | string
125
- | boolean
126
- | number
127
- | readonly string[]
128
- | Readonly<Record<string, string>>;
129
-
130
- export interface ModuleValueContext {
131
- runtime: StarshipRuntimeSnapshot;
132
- symbol: string;
133
- options: Readonly<Record<string, ModuleOptionValue>>;
134
- extensionStatus: ExtensionStatusPresentation;
135
- }
136
-
137
- export type ModuleOptionSchema =
138
- | { kind: "string"; default: string; allowEmpty?: boolean }
139
- | { kind: "string-enum"; default: string; values: readonly string[] }
140
- | { kind: "boolean"; default: boolean }
141
- | { kind: "integer"; default: number; minimum: number; maximum: number }
142
- | { kind: "string-array"; default: readonly string[]; allowNegative?: boolean }
143
- | { kind: "string-map"; default: Readonly<Record<string, string>> };
144
-
145
- export interface ModuleDisplayConfig {
146
- threshold: number;
147
- style: string;
148
- hidden: boolean;
149
- }
150
-
151
- export interface ModuleDefaults {
152
- format: string;
153
- symbol: string;
154
- style: string;
155
- disabled: boolean;
156
- }
157
-
158
- export interface ModuleStyleContext {
159
- runtime: StarshipRuntimeSnapshot;
160
- values: Readonly<Record<string, string>>;
161
- style: string;
162
- styles: Readonly<Record<string, string>>;
163
- display: readonly ModuleDisplayConfig[];
164
- }
165
-
166
- export interface ModuleDefinition<Name extends string> {
167
- name: Name;
168
- variables: readonly string[];
169
- defaults: ModuleDefaults;
170
- styleDefaults?: Readonly<Record<string, string>>;
171
- displayDefaults?: readonly ModuleDisplayConfig[];
172
- styleVariables?: readonly string[];
173
- resolveStyleVariables?(context: ModuleStyleContext): Readonly<Record<string, string>> | undefined;
174
- options?: Readonly<Record<string, ModuleOptionSchema>>;
175
- layout?: "fill";
176
- values(context: ModuleValueContext): Record<string, string> | undefined;
177
- }
178
-
179
- export function defineModule<const Name extends string>(
180
- definition: ModuleDefinition<Name>,
181
- ): ModuleDefinition<Name> {
182
- return definition;
183
- }
184
-
185
- export interface RenderedStatusline<Name extends string = string> {
186
- ansi: string;
187
- chunks: StyledChunk[];
188
- modules: Record<Name, StyledChunk[]>;
189
- }
@@ -1,10 +0,0 @@
1
- import type { ModuleValueContext } from "./types.js";
2
-
3
- export function workspaceModuleValues(
4
- name: string,
5
- context: ModuleValueContext,
6
- ): Record<string, string> | undefined {
7
- const values = context.runtime.workspace?.modules[name];
8
- if (!values) return undefined;
9
- return { ...values };
10
- }