@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/git/state.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { defineModule } from "../types.js";
|
|
2
2
|
|
|
3
3
|
export const gitStateModule = defineModule({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
name: "git_state",
|
|
5
|
+
variables: ["symbol", "state", "progress_current", "progress_total"],
|
|
6
|
+
defaults: {
|
|
7
|
+
format: "[ ($state( $progress_current/$progress_total)) ]($style)",
|
|
8
|
+
symbol: "",
|
|
9
|
+
style: "bold yellow",
|
|
10
|
+
disabled: false,
|
|
11
|
+
},
|
|
12
|
+
values: ({ runtime }) => {
|
|
13
|
+
const state = runtime.gitState;
|
|
14
|
+
if (!state) return undefined;
|
|
15
|
+
return {
|
|
16
|
+
state: state.state,
|
|
17
|
+
progress_current: state.progressCurrent?.toString() ?? "",
|
|
18
|
+
progress_total: state.progressTotal?.toString() ?? "",
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
21
|
});
|
|
@@ -2,86 +2,84 @@ import { formatCount } from "../helpers.js";
|
|
|
2
2
|
import { defineModule } from "../types.js";
|
|
3
3
|
|
|
4
4
|
export const gitStatusModule = defineModule({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return allStatus || values.ahead_behind ? { ...values, all_status: allStatus } : undefined;
|
|
82
|
-
},
|
|
5
|
+
name: "git_status",
|
|
6
|
+
variables: [
|
|
7
|
+
"symbol",
|
|
8
|
+
"all_status",
|
|
9
|
+
"ahead_behind",
|
|
10
|
+
"ahead",
|
|
11
|
+
"behind",
|
|
12
|
+
"up_to_date",
|
|
13
|
+
"diverged",
|
|
14
|
+
"conflicted",
|
|
15
|
+
"stashed",
|
|
16
|
+
"deleted",
|
|
17
|
+
"renamed",
|
|
18
|
+
"modified",
|
|
19
|
+
"typechanged",
|
|
20
|
+
"staged",
|
|
21
|
+
"untracked",
|
|
22
|
+
"worktree_added",
|
|
23
|
+
"worktree_deleted",
|
|
24
|
+
"worktree_modified",
|
|
25
|
+
"worktree_typechanged",
|
|
26
|
+
"index_added",
|
|
27
|
+
"index_deleted",
|
|
28
|
+
"index_modified",
|
|
29
|
+
"index_typechanged",
|
|
30
|
+
],
|
|
31
|
+
defaults: {
|
|
32
|
+
format: "[$all_status( $ahead_behind) ]($style)",
|
|
33
|
+
symbol: "",
|
|
34
|
+
style: "red bold",
|
|
35
|
+
disabled: false,
|
|
36
|
+
},
|
|
37
|
+
values: ({ runtime }) => {
|
|
38
|
+
if (!runtime.gitBranch || !runtime.gitStatus) return undefined;
|
|
39
|
+
const status = runtime.gitStatus;
|
|
40
|
+
const ahead = count("⇡", status.ahead);
|
|
41
|
+
const behind = count("⇣", status.behind);
|
|
42
|
+
const diverged =
|
|
43
|
+
status.ahead > 0 && status.behind > 0 ? `⇕⇡${formatCount(status.ahead)}⇣${formatCount(status.behind)}` : "";
|
|
44
|
+
const values = {
|
|
45
|
+
ahead,
|
|
46
|
+
behind,
|
|
47
|
+
up_to_date: "",
|
|
48
|
+
diverged,
|
|
49
|
+
ahead_behind: diverged || ahead || behind,
|
|
50
|
+
conflicted: count("=", status.conflicted),
|
|
51
|
+
stashed: count("$", status.stashed),
|
|
52
|
+
deleted: count("✘", status.deleted),
|
|
53
|
+
renamed: count("»", status.renamed),
|
|
54
|
+
modified: count("!", status.modified),
|
|
55
|
+
typechanged: count("T", status.typechanged),
|
|
56
|
+
staged: count("+", status.staged),
|
|
57
|
+
untracked: count("?", status.untracked),
|
|
58
|
+
worktree_added: count("A", status.worktreeAdded),
|
|
59
|
+
worktree_deleted: count("D", status.worktreeDeleted),
|
|
60
|
+
worktree_modified: count("M", status.worktreeModified),
|
|
61
|
+
worktree_typechanged: count("T", status.worktreeTypechanged),
|
|
62
|
+
index_added: count("A", status.indexAdded),
|
|
63
|
+
index_deleted: count("D", status.indexDeleted),
|
|
64
|
+
index_modified: count("M", status.indexModified),
|
|
65
|
+
index_typechanged: count("T", status.indexTypechanged),
|
|
66
|
+
};
|
|
67
|
+
const allStatus = [
|
|
68
|
+
values.conflicted,
|
|
69
|
+
values.stashed,
|
|
70
|
+
values.deleted,
|
|
71
|
+
values.renamed,
|
|
72
|
+
values.modified,
|
|
73
|
+
values.typechanged,
|
|
74
|
+
values.staged,
|
|
75
|
+
values.untracked,
|
|
76
|
+
]
|
|
77
|
+
.filter(Boolean)
|
|
78
|
+
.join(" ");
|
|
79
|
+
return allStatus || values.ahead_behind ? { ...values, all_status: allStatus } : undefined;
|
|
80
|
+
},
|
|
83
81
|
});
|
|
84
82
|
|
|
85
83
|
function count(symbol: string, value: number): string {
|
|
86
|
-
|
|
84
|
+
return value > 0 ? `${symbol}${formatCount(value)}` : "";
|
|
87
85
|
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { defineModule } from "../types.js";
|
|
2
2
|
|
|
3
3
|
export const gitWorktreeModule = defineModule({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
? { name: runtime.gitWorktree.name, path: runtime.gitWorktree.path }
|
|
15
|
-
: undefined,
|
|
4
|
+
name: "git_worktree",
|
|
5
|
+
variables: ["symbol", "name", "path"],
|
|
6
|
+
defaults: {
|
|
7
|
+
format: "[ $symbol $name ]($style)",
|
|
8
|
+
symbol: "🌳",
|
|
9
|
+
style: "cyan bold",
|
|
10
|
+
disabled: false,
|
|
11
|
+
},
|
|
12
|
+
values: ({ runtime }) =>
|
|
13
|
+
runtime.gitWorktree ? { name: runtime.gitWorktree.name, path: runtime.gitWorktree.path } : undefined,
|
|
16
14
|
});
|
package/src/modules/github-pr.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { defineModule } from "./types.js";
|
|
2
2
|
|
|
3
3
|
export const githubPrModule = defineModule({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
name: "github_pr",
|
|
5
|
+
variables: ["symbol", "number", "link", "state", "checks", "review", "status"],
|
|
6
|
+
defaults: {
|
|
7
|
+
format: "[ $symbol$link( · $status) ]($style)",
|
|
8
|
+
symbol: "PR ",
|
|
9
|
+
style: "bold blue",
|
|
10
|
+
disabled: false,
|
|
11
|
+
},
|
|
12
|
+
values: ({ runtime }) => {
|
|
13
|
+
const snapshot = runtime.githubPr;
|
|
14
|
+
if (!snapshot) return undefined;
|
|
15
|
+
return {
|
|
16
|
+
number: snapshot.number,
|
|
17
|
+
link: snapshot.link,
|
|
18
|
+
state: snapshot.state,
|
|
19
|
+
checks: snapshot.checks,
|
|
20
|
+
review: snapshot.review,
|
|
21
|
+
status: snapshot.status,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
24
|
});
|
package/src/modules/helpers.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function formatCount(value: number): string {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
if (value < 1000) return `${value}`;
|
|
3
|
+
if (value < 1_000_000) return `${(value / 1000).toFixed(value < 10_000 ? 1 : 0)}k`;
|
|
4
|
+
return `${(value / 1_000_000).toFixed(1)}m`;
|
|
5
5
|
}
|
package/src/modules/index.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
export {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
type CatalogModuleDefinition,
|
|
3
|
+
MODULE_DEFINITIONS,
|
|
4
|
+
MODULE_NAMES,
|
|
5
|
+
type ModuleName,
|
|
6
6
|
} from "./catalog.js";
|
|
7
7
|
export { formatExtensionStatus } from "./extension-status.js";
|
|
8
8
|
export { formatCount } from "./helpers.js";
|
|
9
9
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
inspectStatuslineModules,
|
|
11
|
+
inspectUnavailableModules,
|
|
12
|
+
type ModuleInspection,
|
|
13
|
+
type ModuleInspectionState,
|
|
14
|
+
type StatuslineInspection,
|
|
15
15
|
} from "./inspection.js";
|
|
16
16
|
export { shortenModel } from "./model.js";
|
|
17
17
|
export { reachableModuleRequirements, renderStatusline } from "./render.js";
|
|
18
18
|
export type {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
GitBranchSnapshot,
|
|
20
|
+
GitCommitSnapshot,
|
|
21
|
+
GithubPrSnapshot,
|
|
22
|
+
GithubPrState,
|
|
23
|
+
GitMetricsSnapshot,
|
|
24
|
+
GitSnapshot,
|
|
25
|
+
GitStateSnapshot,
|
|
26
|
+
GitStatusSnapshot,
|
|
27
|
+
GitWorktreeSnapshot,
|
|
28
|
+
RenderedStatusline,
|
|
29
|
+
StarshipRuntimeSnapshot,
|
|
30
|
+
WorkspaceSnapshot,
|
|
31
31
|
} from "./types.js";
|
|
@@ -5,134 +5,127 @@ import { MODULE_DEFINITIONS, type ModuleName } from "./catalog.js";
|
|
|
5
5
|
import { reachableModuleRequirements, renderStatusline } from "./render.js";
|
|
6
6
|
import type { StarshipRuntimeSnapshot } from "./types.js";
|
|
7
7
|
|
|
8
|
-
export type ModuleInspectionState =
|
|
9
|
-
| "Showing"
|
|
10
|
-
| "Empty"
|
|
11
|
-
| "Disabled"
|
|
12
|
-
| "Not in format"
|
|
13
|
-
| "Unavailable";
|
|
8
|
+
export type ModuleInspectionState = "Showing" | "Empty" | "Disabled" | "Not in format" | "Unavailable";
|
|
14
9
|
|
|
15
10
|
export interface ModuleInspection {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
name: ModuleName;
|
|
12
|
+
description: string;
|
|
13
|
+
state: ModuleInspectionState;
|
|
14
|
+
preview: string;
|
|
15
|
+
variables: readonly string[];
|
|
16
|
+
styleFields: readonly string[];
|
|
17
|
+
displayRules: readonly string[];
|
|
18
|
+
rootReferenced: boolean;
|
|
19
|
+
reachable: boolean;
|
|
20
|
+
reason: string;
|
|
26
21
|
}
|
|
27
22
|
|
|
28
23
|
export interface StatuslineInspection {
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
modules: readonly ModuleInspection[];
|
|
25
|
+
showing: readonly ModuleInspection[];
|
|
31
26
|
}
|
|
32
27
|
|
|
33
28
|
export function inspectStatuslineModules(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
config: StarshipConfig,
|
|
30
|
+
runtime: StarshipRuntimeSnapshot,
|
|
31
|
+
width = 80,
|
|
37
32
|
): StatuslineInspection {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
showing: modules.filter((module) => module.state === "Showing"),
|
|
67
|
-
};
|
|
33
|
+
const rendered = renderStatusline(config, runtime, width);
|
|
34
|
+
const requirements = reachableModuleRequirements(config);
|
|
35
|
+
const rootVariables = formatVariables(config.formatAst);
|
|
36
|
+
const includeAll = rootVariables.has("all");
|
|
37
|
+
const modules = MODULE_DEFINITIONS.map((definition): ModuleInspection => {
|
|
38
|
+
const module = config.modules[definition.name];
|
|
39
|
+
const reachable = requirements.has(definition.name);
|
|
40
|
+
const preview = plainPreview(rendered.modules[definition.name].map((chunk) => chunk.text).join(""));
|
|
41
|
+
const state = module.disabled
|
|
42
|
+
? "Disabled"
|
|
43
|
+
: !reachable
|
|
44
|
+
? "Not in format"
|
|
45
|
+
: preview.length > 0
|
|
46
|
+
? "Showing"
|
|
47
|
+
: "Empty";
|
|
48
|
+
return moduleInspection(
|
|
49
|
+
config,
|
|
50
|
+
definition,
|
|
51
|
+
state,
|
|
52
|
+
preview,
|
|
53
|
+
includeAll || rootVariables.has(definition.name),
|
|
54
|
+
reachable,
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
modules,
|
|
59
|
+
showing: modules.filter((module) => module.state === "Showing"),
|
|
60
|
+
};
|
|
68
61
|
}
|
|
69
62
|
|
|
70
63
|
export function inspectUnavailableModules(config: StarshipConfig): StatuslineInspection {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
64
|
+
const requirements = reachableModuleRequirements(config);
|
|
65
|
+
const rootVariables = formatVariables(config.formatAst);
|
|
66
|
+
const includeAll = rootVariables.has("all");
|
|
67
|
+
return {
|
|
68
|
+
modules: MODULE_DEFINITIONS.map((definition) => {
|
|
69
|
+
const module = config.modules[definition.name];
|
|
70
|
+
const reachable = requirements.has(definition.name);
|
|
71
|
+
const state = module.disabled ? "Disabled" : reachable ? "Unavailable" : "Not in format";
|
|
72
|
+
return moduleInspection(
|
|
73
|
+
config,
|
|
74
|
+
definition,
|
|
75
|
+
state,
|
|
76
|
+
"",
|
|
77
|
+
includeAll || rootVariables.has(definition.name),
|
|
78
|
+
reachable,
|
|
79
|
+
);
|
|
80
|
+
}),
|
|
81
|
+
showing: [],
|
|
82
|
+
};
|
|
90
83
|
}
|
|
91
84
|
|
|
92
85
|
function moduleInspection(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
86
|
+
config: StarshipConfig,
|
|
87
|
+
definition: (typeof MODULE_DEFINITIONS)[number],
|
|
88
|
+
state: ModuleInspectionState,
|
|
89
|
+
preview: string,
|
|
90
|
+
rootReferenced: boolean,
|
|
91
|
+
reachable: boolean,
|
|
99
92
|
): ModuleInspection {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
93
|
+
const module = config.modules[definition.name];
|
|
94
|
+
return {
|
|
95
|
+
name: definition.name,
|
|
96
|
+
description: definition.description,
|
|
97
|
+
state,
|
|
98
|
+
preview,
|
|
99
|
+
variables: [...definition.variables],
|
|
100
|
+
styleFields: ["style", ...Object.keys(module.styles)],
|
|
101
|
+
displayRules: module.display.map(
|
|
102
|
+
(rule) => `${rule.threshold}: ${rule.hidden ? "hidden" : rule.style || "unstyled"}`,
|
|
103
|
+
),
|
|
104
|
+
rootReferenced,
|
|
105
|
+
reachable,
|
|
106
|
+
reason: inspectionReason(state),
|
|
107
|
+
};
|
|
115
108
|
}
|
|
116
109
|
|
|
117
110
|
function inspectionReason(state: ModuleInspectionState): string {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
111
|
+
switch (state) {
|
|
112
|
+
case "Showing":
|
|
113
|
+
return "Rendered in the current footer.";
|
|
114
|
+
case "Empty":
|
|
115
|
+
return "Referenced by the root format, but the current snapshot produced no output.";
|
|
116
|
+
case "Disabled":
|
|
117
|
+
return "Disabled by this module's configuration.";
|
|
118
|
+
case "Not in format":
|
|
119
|
+
return "Not referenced by the root format or $all.";
|
|
120
|
+
case "Unavailable":
|
|
121
|
+
return "Current footer inspection is unavailable; no collector failure was inferred.";
|
|
122
|
+
}
|
|
130
123
|
}
|
|
131
124
|
|
|
132
125
|
function plainPreview(value: string): string {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
126
|
+
return Array.from(stripVTControlCharacters(value), (character) => {
|
|
127
|
+
const codePoint = character.codePointAt(0) ?? 0;
|
|
128
|
+
if (character === "\n") return character;
|
|
129
|
+
return codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f) ? " " : character;
|
|
130
|
+
}).join("");
|
|
138
131
|
}
|