@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.
- package/README.md +21 -36
- package/dist/chunks/{chunk-UX6PBXVK.js → chunk-JO5PH6FN.js} +28 -110
- package/dist/chunks/chunk-JO5PH6FN.js.map +7 -0
- package/dist/chunks/{chunk-P4XMFSQW.js → chunk-YWY5RIDQ.js} +3 -7
- package/dist/chunks/chunk-YWY5RIDQ.js.map +7 -0
- package/dist/chunks/{chunk-EOGXAMTA.js → chunk-ZQZSXXPI.js} +1 -1
- package/dist/chunks/chunk-ZQZSXXPI.js.map +7 -0
- package/dist/chunks/{cloud-BKHYWCTA.js → cloud-C4VU3TX3.js} +7 -14
- package/dist/chunks/cloud-C4VU3TX3.js.map +7 -0
- package/dist/chunks/{commands-53ZO2JUK.js → commands-ATILSUVK.js} +13 -42
- package/dist/chunks/commands-ATILSUVK.js.map +7 -0
- package/dist/chunks/{deployment-RKKOEQQ2.js → deployment-FMNTYRBW.js} +6 -21
- package/dist/chunks/deployment-FMNTYRBW.js.map +7 -0
- package/dist/chunks/{development-BERD42HW.js → development-OUYXDPBS.js} +4 -8
- package/dist/chunks/development-OUYXDPBS.js.map +7 -0
- package/dist/chunks/{execution-42JTEY3N.js → execution-HJOGLMWD.js} +3 -3
- package/dist/chunks/execution-HJOGLMWD.js.map +7 -0
- package/dist/chunks/{languages-RMP6DW7H.js → languages-WXMF4GOF.js} +6 -22
- package/dist/chunks/languages-WXMF4GOF.js.map +7 -0
- package/dist/chunks/{package-LG5H7BBM.js → package-YXRZQAOV.js} +5 -14
- package/dist/chunks/package-YXRZQAOV.js.map +7 -0
- package/dist/index.ts +38 -53
- package/dist/index.ts.map +2 -2
- package/package.json +60 -61
- package/skills/configuring-pi-starship/references/runtime-and-security.md +5 -1
- package/skills/configuring-pi-starship/scripts/apply.mjs +43 -47
- package/skills/configuring-pi-starship/scripts/config-path.mjs +3 -3
- package/skills/configuring-pi-starship/scripts/script-support.mjs +6 -6
- package/skills/configuring-pi-starship/scripts/validate.mjs +18 -18
- package/src/command-configuration.ts +267 -286
- package/src/command-contract.ts +6 -6
- package/src/command-inspector.ts +27 -27
- package/src/command-preset-picker.ts +45 -50
- package/src/command-preview.ts +153 -166
- package/src/commands.ts +588 -618
- package/src/config.ts +580 -660
- package/src/effective-config.ts +46 -48
- package/src/format/formatter.ts +211 -227
- package/src/format/style.ts +205 -216
- package/src/modules/activity.ts +74 -74
- package/src/modules/brand.ts +9 -9
- package/src/modules/cache.ts +18 -18
- package/src/modules/catalog.ts +79 -83
- package/src/modules/cloud.ts +54 -54
- package/src/modules/context.ts +27 -27
- package/src/modules/cost.ts +23 -23
- package/src/modules/deployment.ts +45 -45
- package/src/modules/development.ts +80 -81
- package/src/modules/directory.ts +89 -113
- package/src/modules/display.ts +9 -9
- package/src/modules/execution.ts +62 -69
- package/src/modules/extension-status.ts +59 -64
- package/src/modules/fill.ts +10 -10
- package/src/modules/git/branch.ts +26 -26
- package/src/modules/git/commit.ts +21 -23
- package/src/modules/git/metrics.ts +22 -22
- package/src/modules/git/runtime.ts +299 -334
- package/src/modules/git/state.ts +17 -17
- package/src/modules/git/status.ts +77 -79
- package/src/modules/git/worktree.ts +10 -12
- package/src/modules/github-pr.ts +20 -20
- package/src/modules/helpers.ts +3 -3
- package/src/modules/index.ts +21 -21
- package/src/modules/inspection.ts +101 -108
- package/src/modules/languages.ts +52 -59
- package/src/modules/model.ts +57 -67
- package/src/modules/package.ts +12 -12
- package/src/modules/provider.ts +22 -24
- package/src/modules/render.ts +124 -140
- package/src/modules/thinking.ts +27 -26
- package/src/modules/time.ts +10 -13
- package/src/modules/tokens.ts +13 -13
- package/src/modules/truncation.ts +14 -17
- package/src/modules/turn.ts +9 -9
- package/src/modules/types.ts +125 -132
- package/src/modules/workspace-helpers.ts +4 -7
- package/src/pi-starship.ts +567 -571
- package/src/presets/catalog.ts +113 -113
- package/src/runtime/cloud.ts +122 -150
- package/src/runtime/command.ts +106 -108
- package/src/runtime/deployment.ts +150 -179
- package/src/runtime/development.ts +107 -124
- package/src/runtime/execution.ts +110 -124
- package/src/runtime/github-pr.ts +223 -252
- package/src/runtime/helpers.ts +186 -199
- package/src/runtime/languages.ts +149 -180
- package/src/runtime/package.ts +74 -87
- package/src/runtime/refresh-controller.ts +82 -86
- package/src/runtime/types.ts +38 -38
- package/src/runtime/workspace.ts +108 -116
- package/src/usage.ts +40 -40
- package/dist/chunks/chunk-EOGXAMTA.js.map +0 -7
- package/dist/chunks/chunk-P4XMFSQW.js.map +0 -7
- package/dist/chunks/chunk-UX6PBXVK.js.map +0 -7
- package/dist/chunks/cloud-BKHYWCTA.js.map +0 -7
- package/dist/chunks/commands-53ZO2JUK.js.map +0 -7
- package/dist/chunks/deployment-RKKOEQQ2.js.map +0 -7
- package/dist/chunks/development-BERD42HW.js.map +0 -7
- package/dist/chunks/execution-42JTEY3N.js.map +0 -7
- package/dist/chunks/languages-RMP6DW7H.js.map +0 -7
- package/dist/chunks/package-LG5H7BBM.js.map +0 -7
package/src/modules/thinking.ts
CHANGED
|
@@ -2,36 +2,37 @@ import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
|
|
|
2
2
|
import { defineModule } from "./types.js";
|
|
3
3
|
|
|
4
4
|
const THINKING_LEVELS = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
"off",
|
|
6
|
+
"minimal",
|
|
7
|
+
"low",
|
|
8
|
+
"medium",
|
|
9
|
+
"high",
|
|
10
|
+
"xhigh",
|
|
11
|
+
"max",
|
|
12
12
|
] as const satisfies readonly ThinkingLevel[];
|
|
13
13
|
|
|
14
14
|
function thinkingLevelOf(value: string): ThinkingLevel | undefined {
|
|
15
|
-
|
|
15
|
+
return THINKING_LEVELS.find((level) => level === value);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export const thinkingModule = defineModule({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
name: "thinking",
|
|
20
|
+
variables: ["symbol", "level"],
|
|
21
|
+
defaults: {
|
|
22
|
+
format: "[$symbol $level ]($style)",
|
|
23
|
+
symbol: "🧠",
|
|
24
|
+
style: "bold purple",
|
|
25
|
+
disabled: false,
|
|
26
|
+
},
|
|
27
|
+
styleDefaults: Object.fromEntries(THINKING_LEVELS.map((level) => [`style_${level}`, ""])) as Record<
|
|
28
|
+
`style_${ThinkingLevel}`,
|
|
29
|
+
string
|
|
30
|
+
>,
|
|
31
|
+
fallbackStyle: true,
|
|
32
|
+
styleVariables: ["style"],
|
|
33
|
+
resolveStyleVariables: ({ runtime, styles, style }) => {
|
|
34
|
+
const level = thinkingLevelOf(runtime.thinkingLevel);
|
|
35
|
+
return { style: (level && styles[`style_${level}`]) || style };
|
|
36
|
+
},
|
|
37
|
+
values: ({ runtime }) => ({ level: runtime.thinkingLevel }),
|
|
37
38
|
});
|
package/src/modules/time.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { defineModule } from "./types.js";
|
|
2
2
|
|
|
3
3
|
export const timeModule = defineModule({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
13
|
});
|
|
14
14
|
|
|
15
15
|
function formatTime(now: Date): string {
|
|
16
|
-
|
|
17
|
-
.getMinutes()
|
|
18
|
-
.toString()
|
|
19
|
-
.padStart(2, "0")}`;
|
|
16
|
+
return `${now.getHours().toString().padStart(2, "0")}:${now.getMinutes().toString().padStart(2, "0")}`;
|
|
20
17
|
}
|
package/src/modules/tokens.ts
CHANGED
|
@@ -2,17 +2,17 @@ import { formatCount } from "./helpers.js";
|
|
|
2
2
|
import { defineModule } from "./types.js";
|
|
3
3
|
|
|
4
4
|
export const tokensModule = defineModule({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
18
|
});
|
|
@@ -3,35 +3,32 @@ import { sep } from "node:path";
|
|
|
3
3
|
const graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
4
4
|
|
|
5
5
|
export function graphemes(value: string): string[] {
|
|
6
|
-
|
|
6
|
+
return [...graphemeSegmenter.segment(value)].map(({ segment }) => segment);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function firstGrapheme(value: string): string {
|
|
10
|
-
|
|
10
|
+
return graphemes(value)[0] ?? "";
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export function truncateLeadingGraphemes(value: string, length: number, symbol: string): string {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
18
|
}
|
|
19
19
|
|
|
20
20
|
export function toSlashPath(value: string): string {
|
|
21
|
-
|
|
21
|
+
return sep === "\\" ? value.replaceAll("\\", "/") : value;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export function truncatePathComponents(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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 };
|
|
24
|
+
export function truncatePathComponents(value: string, length: number): { value: string; truncated: boolean } {
|
|
25
|
+
if (length <= 0) return { value, truncated: false };
|
|
26
|
+
const normalized = toSlashPath(value);
|
|
27
|
+
const components = normalized.split("/").filter((component) => component.length > 0);
|
|
28
|
+
if (components.length <= length) return { value: normalized, truncated: false };
|
|
29
|
+
return { value: components.slice(-length).join("/"), truncated: true };
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
export function useNativePathSeparator(value: string): string {
|
|
36
|
-
|
|
33
|
+
return sep === "/" ? value : value.replaceAll("/", sep);
|
|
37
34
|
}
|
package/src/modules/turn.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { defineModule } from "./types.js";
|
|
2
2
|
|
|
3
3
|
export const turnModule = defineModule({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
13
|
});
|
package/src/modules/types.ts
CHANGED
|
@@ -2,191 +2,184 @@ import type { UIPromptKind } from "@earendil-works/pi-coding-agent";
|
|
|
2
2
|
import type { StyledChunk } from "../format/style.js";
|
|
3
3
|
|
|
4
4
|
export interface GitBranchSnapshot {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
name: string;
|
|
6
|
+
remoteName?: string;
|
|
7
|
+
remoteBranch?: string;
|
|
8
|
+
detached: boolean;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export interface GitCommitSnapshot {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
hash: string;
|
|
13
|
+
tag?: string;
|
|
14
|
+
detached: boolean;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
export interface GitStateSnapshot {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
state: string;
|
|
19
|
+
progressCurrent?: number;
|
|
20
|
+
progressTotal?: number;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface GitMetricsSnapshot {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
added: number;
|
|
25
|
+
deleted: number;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export interface GitStatusSnapshot {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
29
|
+
ahead: number;
|
|
30
|
+
behind: number;
|
|
31
|
+
stashed: number;
|
|
32
|
+
conflicted: number;
|
|
33
|
+
deleted: number;
|
|
34
|
+
renamed: number;
|
|
35
|
+
modified: number;
|
|
36
|
+
staged: number;
|
|
37
|
+
typechanged: number;
|
|
38
|
+
untracked: number;
|
|
39
|
+
worktreeAdded: number;
|
|
40
|
+
worktreeDeleted: number;
|
|
41
|
+
worktreeModified: number;
|
|
42
|
+
worktreeTypechanged: number;
|
|
43
|
+
indexAdded: number;
|
|
44
|
+
indexDeleted: number;
|
|
45
|
+
indexModified: number;
|
|
46
|
+
indexTypechanged: number;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export interface GitWorktreeSnapshot {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
name: string;
|
|
51
|
+
path: string;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export type GithubPrState = "open" | "draft" | "merged" | "closed";
|
|
55
55
|
|
|
56
56
|
export interface GithubPrSnapshot {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
57
|
+
readonly number: string;
|
|
58
|
+
readonly link: string;
|
|
59
|
+
readonly state: GithubPrState;
|
|
60
|
+
readonly checks: string;
|
|
61
|
+
readonly review: string;
|
|
62
|
+
readonly status: string;
|
|
63
|
+
readonly expiresAt?: number;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export interface GitSnapshot {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
root?: string;
|
|
68
|
+
branch?: GitBranchSnapshot;
|
|
69
|
+
commit?: GitCommitSnapshot;
|
|
70
|
+
state?: GitStateSnapshot;
|
|
71
|
+
metrics?: GitMetricsSnapshot;
|
|
72
|
+
status: GitStatusSnapshot;
|
|
73
|
+
worktree?: GitWorktreeSnapshot;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
export interface WorkspaceSnapshot {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
modules: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
78
|
+
styleSelectors?: Readonly<Record<string, string>>;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
export interface StarshipRuntimeSnapshot {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
82
|
+
cwd: string;
|
|
83
|
+
homeDir?: string;
|
|
84
|
+
gitRoot?: string;
|
|
85
|
+
model?: { provider: string; id: string };
|
|
86
|
+
thinkingLevel: string;
|
|
87
|
+
turnCount: number;
|
|
88
|
+
activeTools: ReadonlyMap<string, number>;
|
|
89
|
+
isStreaming: boolean;
|
|
90
|
+
uiPrompt?: { kind: UIPromptKind; title?: string };
|
|
91
|
+
lastCompletedTool?: string;
|
|
92
|
+
contextUsage?: {
|
|
93
|
+
percent?: number | null;
|
|
94
|
+
tokens?: number | null;
|
|
95
|
+
contextWindow?: number | null;
|
|
96
|
+
};
|
|
97
|
+
tokenTotals: {
|
|
98
|
+
input: number;
|
|
99
|
+
output: number;
|
|
100
|
+
cacheRead: number;
|
|
101
|
+
cacheWrite: number;
|
|
102
|
+
cost: number;
|
|
103
|
+
latestCacheHitRate?: number;
|
|
104
|
+
};
|
|
105
|
+
usingSubscription: boolean;
|
|
106
|
+
gitBranch: string | null;
|
|
107
|
+
gitBranchDetails?: GitBranchSnapshot;
|
|
108
|
+
gitCommit?: GitCommitSnapshot;
|
|
109
|
+
gitState?: GitStateSnapshot;
|
|
110
|
+
gitMetrics?: GitMetricsSnapshot;
|
|
111
|
+
gitStatus?: GitStatusSnapshot;
|
|
112
|
+
gitWorktree?: GitWorktreeSnapshot;
|
|
113
|
+
githubPr?: GithubPrSnapshot;
|
|
114
|
+
extensionStatuses: ReadonlyMap<string, string>;
|
|
115
|
+
now: Date;
|
|
116
|
+
workspace?: WorkspaceSnapshot;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
export interface ExtensionStatusPresentation {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
separator: string;
|
|
121
|
+
maxStatuses: number;
|
|
122
|
+
icons: Readonly<Record<string, string>>;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
export type ModuleOptionValue =
|
|
126
|
-
| string
|
|
127
|
-
| boolean
|
|
128
|
-
| number
|
|
129
|
-
| readonly string[]
|
|
130
|
-
| Readonly<Record<string, string>>;
|
|
125
|
+
export type ModuleOptionValue = string | boolean | number | readonly string[] | Readonly<Record<string, string>>;
|
|
131
126
|
|
|
132
127
|
export interface ModuleValueContext {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
128
|
+
runtime: StarshipRuntimeSnapshot;
|
|
129
|
+
symbol: string;
|
|
130
|
+
options: Readonly<Record<string, ModuleOptionValue>>;
|
|
131
|
+
extensionStatus: ExtensionStatusPresentation;
|
|
137
132
|
}
|
|
138
133
|
|
|
139
134
|
export type ModuleOptionSchema =
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
135
|
+
| { kind: "string"; default: string; allowEmpty?: boolean }
|
|
136
|
+
| { kind: "string-enum"; default: string; values: readonly string[] }
|
|
137
|
+
| { kind: "boolean"; default: boolean }
|
|
138
|
+
| { kind: "integer"; default: number; minimum: number; maximum: number }
|
|
139
|
+
| { kind: "string-array"; default: readonly string[]; allowNegative?: boolean }
|
|
140
|
+
| { kind: "string-map"; default: Readonly<Record<string, string>> };
|
|
146
141
|
|
|
147
142
|
export interface ModuleDisplayConfig {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
143
|
+
threshold: number;
|
|
144
|
+
style: string;
|
|
145
|
+
hidden: boolean;
|
|
151
146
|
}
|
|
152
147
|
|
|
153
148
|
export interface ModuleDefaults {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
149
|
+
format: string;
|
|
150
|
+
symbol: string;
|
|
151
|
+
style: string;
|
|
152
|
+
disabled: boolean;
|
|
158
153
|
}
|
|
159
154
|
|
|
160
155
|
export interface ModuleStyleContext {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
156
|
+
runtime: StarshipRuntimeSnapshot;
|
|
157
|
+
values: Readonly<Record<string, string>>;
|
|
158
|
+
style: string;
|
|
159
|
+
styles: Readonly<Record<string, string>>;
|
|
160
|
+
display: readonly ModuleDisplayConfig[];
|
|
166
161
|
}
|
|
167
162
|
|
|
168
163
|
export interface ModuleDefinition<Name extends string> {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
164
|
+
name: Name;
|
|
165
|
+
variables: readonly string[];
|
|
166
|
+
defaults: ModuleDefaults;
|
|
167
|
+
styleDefaults?: Readonly<Record<string, string>>;
|
|
168
|
+
fallbackStyle?: boolean;
|
|
169
|
+
displayDefaults?: readonly ModuleDisplayConfig[];
|
|
170
|
+
styleVariables?: readonly string[];
|
|
171
|
+
resolveStyleVariables?(context: ModuleStyleContext): Readonly<Record<string, string>> | undefined;
|
|
172
|
+
options?: Readonly<Record<string, ModuleOptionSchema>>;
|
|
173
|
+
layout?: "fill";
|
|
174
|
+
values(context: ModuleValueContext): Record<string, string> | undefined;
|
|
180
175
|
}
|
|
181
176
|
|
|
182
|
-
export function defineModule<const Name extends string>(
|
|
183
|
-
|
|
184
|
-
): ModuleDefinition<Name> {
|
|
185
|
-
return definition;
|
|
177
|
+
export function defineModule<const Name extends string>(definition: ModuleDefinition<Name>): ModuleDefinition<Name> {
|
|
178
|
+
return definition;
|
|
186
179
|
}
|
|
187
180
|
|
|
188
181
|
export interface RenderedStatusline<Name extends string = string> {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
182
|
+
ansi: string;
|
|
183
|
+
chunks: StyledChunk[];
|
|
184
|
+
modules: Record<Name, StyledChunk[]>;
|
|
192
185
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import type { ModuleValueContext } from "./types.js";
|
|
2
2
|
|
|
3
|
-
export function workspaceModuleValues(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const values = context.runtime.workspace?.modules[name];
|
|
8
|
-
if (!values) return undefined;
|
|
9
|
-
return { ...values };
|
|
3
|
+
export function workspaceModuleValues(name: string, context: ModuleValueContext): Record<string, string> | undefined {
|
|
4
|
+
const values = context.runtime.workspace?.modules[name];
|
|
5
|
+
if (!values) return undefined;
|
|
6
|
+
return { ...values };
|
|
10
7
|
}
|