@narumitw/pi-starship 0.55.1 → 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 (99) hide show
  1. package/dist/chunks/{chunk-UX6PBXVK.js → chunk-JO5PH6FN.js} +28 -110
  2. package/dist/chunks/chunk-JO5PH6FN.js.map +7 -0
  3. package/dist/chunks/{chunk-P4XMFSQW.js → chunk-YWY5RIDQ.js} +3 -7
  4. package/dist/chunks/chunk-YWY5RIDQ.js.map +7 -0
  5. package/dist/chunks/{chunk-EOGXAMTA.js → chunk-ZQZSXXPI.js} +1 -1
  6. package/dist/chunks/chunk-ZQZSXXPI.js.map +7 -0
  7. package/dist/chunks/{cloud-BKHYWCTA.js → cloud-C4VU3TX3.js} +7 -14
  8. package/dist/chunks/cloud-C4VU3TX3.js.map +7 -0
  9. package/dist/chunks/{commands-53ZO2JUK.js → commands-ATILSUVK.js} +13 -42
  10. package/dist/chunks/commands-ATILSUVK.js.map +7 -0
  11. package/dist/chunks/{deployment-RKKOEQQ2.js → deployment-FMNTYRBW.js} +6 -21
  12. package/dist/chunks/deployment-FMNTYRBW.js.map +7 -0
  13. package/dist/chunks/{development-BERD42HW.js → development-OUYXDPBS.js} +4 -8
  14. package/dist/chunks/development-OUYXDPBS.js.map +7 -0
  15. package/dist/chunks/{execution-42JTEY3N.js → execution-HJOGLMWD.js} +3 -3
  16. package/dist/chunks/execution-HJOGLMWD.js.map +7 -0
  17. package/dist/chunks/{languages-RMP6DW7H.js → languages-WXMF4GOF.js} +6 -22
  18. package/dist/chunks/languages-WXMF4GOF.js.map +7 -0
  19. package/dist/chunks/{package-LG5H7BBM.js → package-YXRZQAOV.js} +5 -14
  20. package/dist/chunks/package-YXRZQAOV.js.map +7 -0
  21. package/dist/index.ts +20 -55
  22. package/dist/index.ts.map +2 -2
  23. package/package.json +60 -61
  24. package/skills/configuring-pi-starship/scripts/apply.mjs +43 -47
  25. package/skills/configuring-pi-starship/scripts/config-path.mjs +3 -3
  26. package/skills/configuring-pi-starship/scripts/script-support.mjs +6 -6
  27. package/skills/configuring-pi-starship/scripts/validate.mjs +18 -18
  28. package/src/command-configuration.ts +267 -286
  29. package/src/command-contract.ts +6 -6
  30. package/src/command-inspector.ts +27 -27
  31. package/src/command-preset-picker.ts +45 -50
  32. package/src/command-preview.ts +153 -166
  33. package/src/commands.ts +588 -618
  34. package/src/config.ts +580 -660
  35. package/src/effective-config.ts +46 -48
  36. package/src/format/formatter.ts +211 -227
  37. package/src/format/style.ts +205 -216
  38. package/src/modules/activity.ts +74 -74
  39. package/src/modules/brand.ts +9 -9
  40. package/src/modules/cache.ts +18 -18
  41. package/src/modules/catalog.ts +79 -83
  42. package/src/modules/cloud.ts +54 -54
  43. package/src/modules/context.ts +27 -27
  44. package/src/modules/cost.ts +23 -23
  45. package/src/modules/deployment.ts +45 -45
  46. package/src/modules/development.ts +80 -81
  47. package/src/modules/directory.ts +89 -113
  48. package/src/modules/display.ts +9 -9
  49. package/src/modules/execution.ts +62 -69
  50. package/src/modules/extension-status.ts +59 -64
  51. package/src/modules/fill.ts +10 -10
  52. package/src/modules/git/branch.ts +26 -26
  53. package/src/modules/git/commit.ts +21 -23
  54. package/src/modules/git/metrics.ts +22 -22
  55. package/src/modules/git/runtime.ts +299 -334
  56. package/src/modules/git/state.ts +17 -17
  57. package/src/modules/git/status.ts +77 -79
  58. package/src/modules/git/worktree.ts +10 -12
  59. package/src/modules/github-pr.ts +20 -20
  60. package/src/modules/helpers.ts +3 -3
  61. package/src/modules/index.ts +21 -21
  62. package/src/modules/inspection.ts +101 -108
  63. package/src/modules/languages.ts +52 -59
  64. package/src/modules/model.ts +57 -67
  65. package/src/modules/package.ts +12 -12
  66. package/src/modules/provider.ts +22 -24
  67. package/src/modules/render.ts +124 -140
  68. package/src/modules/thinking.ts +27 -26
  69. package/src/modules/time.ts +10 -13
  70. package/src/modules/tokens.ts +13 -13
  71. package/src/modules/truncation.ts +14 -17
  72. package/src/modules/turn.ts +9 -9
  73. package/src/modules/types.ts +125 -132
  74. package/src/modules/workspace-helpers.ts +4 -7
  75. package/src/pi-starship.ts +567 -603
  76. package/src/presets/catalog.ts +113 -113
  77. package/src/runtime/cloud.ts +122 -150
  78. package/src/runtime/command.ts +106 -108
  79. package/src/runtime/deployment.ts +150 -179
  80. package/src/runtime/development.ts +107 -124
  81. package/src/runtime/execution.ts +110 -124
  82. package/src/runtime/github-pr.ts +223 -252
  83. package/src/runtime/helpers.ts +186 -199
  84. package/src/runtime/languages.ts +149 -180
  85. package/src/runtime/package.ts +74 -87
  86. package/src/runtime/refresh-controller.ts +82 -86
  87. package/src/runtime/types.ts +38 -38
  88. package/src/runtime/workspace.ts +108 -116
  89. package/src/usage.ts +40 -40
  90. package/dist/chunks/chunk-EOGXAMTA.js.map +0 -7
  91. package/dist/chunks/chunk-P4XMFSQW.js.map +0 -7
  92. package/dist/chunks/chunk-UX6PBXVK.js.map +0 -7
  93. package/dist/chunks/cloud-BKHYWCTA.js.map +0 -7
  94. package/dist/chunks/commands-53ZO2JUK.js.map +0 -7
  95. package/dist/chunks/deployment-RKKOEQQ2.js.map +0 -7
  96. package/dist/chunks/development-BERD42HW.js.map +0 -7
  97. package/dist/chunks/execution-42JTEY3N.js.map +0 -7
  98. package/dist/chunks/languages-RMP6DW7H.js.map +0 -7
  99. package/dist/chunks/package-LG5H7BBM.js.map +0 -7
@@ -1,21 +1,21 @@
1
1
  import { defineModule } from "../types.js";
2
2
 
3
3
  export const gitStateModule = defineModule({
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
- },
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
- 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
44
- ? `⇕⇡${formatCount(status.ahead)}⇣${formatCount(status.behind)}`
45
- : "";
46
- const values = {
47
- ahead,
48
- behind,
49
- up_to_date: "",
50
- diverged,
51
- ahead_behind: diverged || ahead || behind,
52
- conflicted: count("=", status.conflicted),
53
- stashed: count("$", status.stashed),
54
- deleted: count("✘", status.deleted),
55
- renamed: count("»", status.renamed),
56
- modified: count("!", status.modified),
57
- typechanged: count("T", status.typechanged),
58
- staged: count("+", status.staged),
59
- untracked: count("?", status.untracked),
60
- worktree_added: count("A", status.worktreeAdded),
61
- worktree_deleted: count("D", status.worktreeDeleted),
62
- worktree_modified: count("M", status.worktreeModified),
63
- worktree_typechanged: count("T", status.worktreeTypechanged),
64
- index_added: count("A", status.indexAdded),
65
- index_deleted: count("D", status.indexDeleted),
66
- index_modified: count("M", status.indexModified),
67
- index_typechanged: count("T", status.indexTypechanged),
68
- };
69
- const allStatus = [
70
- values.conflicted,
71
- values.stashed,
72
- values.deleted,
73
- values.renamed,
74
- values.modified,
75
- values.typechanged,
76
- values.staged,
77
- values.untracked,
78
- ]
79
- .filter(Boolean)
80
- .join(" ");
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
- return value > 0 ? `${symbol}${formatCount(value)}` : "";
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
- 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
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
  });
@@ -1,24 +1,24 @@
1
1
  import { defineModule } from "./types.js";
2
2
 
3
3
  export const githubPrModule = defineModule({
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
- },
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
  });
@@ -1,5 +1,5 @@
1
1
  export function formatCount(value: number): string {
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`;
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
  }
@@ -1,31 +1,31 @@
1
1
  export {
2
- type CatalogModuleDefinition,
3
- MODULE_DEFINITIONS,
4
- MODULE_NAMES,
5
- type ModuleName,
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
- inspectStatuslineModules,
11
- inspectUnavailableModules,
12
- type ModuleInspection,
13
- type ModuleInspectionState,
14
- type StatuslineInspection,
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
- GitBranchSnapshot,
20
- GitCommitSnapshot,
21
- GithubPrSnapshot,
22
- GithubPrState,
23
- GitMetricsSnapshot,
24
- GitSnapshot,
25
- GitStateSnapshot,
26
- GitStatusSnapshot,
27
- GitWorktreeSnapshot,
28
- RenderedStatusline,
29
- StarshipRuntimeSnapshot,
30
- WorkspaceSnapshot,
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
- name: ModuleName;
17
- description: string;
18
- state: ModuleInspectionState;
19
- preview: string;
20
- variables: readonly string[];
21
- styleFields: readonly string[];
22
- displayRules: readonly string[];
23
- rootReferenced: boolean;
24
- reachable: boolean;
25
- reason: string;
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
- modules: readonly ModuleInspection[];
30
- showing: readonly ModuleInspection[];
24
+ modules: readonly ModuleInspection[];
25
+ showing: readonly ModuleInspection[];
31
26
  }
32
27
 
33
28
  export function inspectStatuslineModules(
34
- config: StarshipConfig,
35
- runtime: StarshipRuntimeSnapshot,
36
- width = 80,
29
+ config: StarshipConfig,
30
+ runtime: StarshipRuntimeSnapshot,
31
+ width = 80,
37
32
  ): StatuslineInspection {
38
- const rendered = renderStatusline(config, runtime, width);
39
- const requirements = reachableModuleRequirements(config);
40
- const rootVariables = formatVariables(config.formatAst);
41
- const includeAll = rootVariables.has("all");
42
- const modules = MODULE_DEFINITIONS.map((definition): ModuleInspection => {
43
- const module = config.modules[definition.name];
44
- const reachable = requirements.has(definition.name);
45
- const preview = plainPreview(
46
- rendered.modules[definition.name].map((chunk) => chunk.text).join(""),
47
- );
48
- const state = module.disabled
49
- ? "Disabled"
50
- : !reachable
51
- ? "Not in format"
52
- : preview.length > 0
53
- ? "Showing"
54
- : "Empty";
55
- return moduleInspection(
56
- config,
57
- definition,
58
- state,
59
- preview,
60
- includeAll || rootVariables.has(definition.name),
61
- reachable,
62
- );
63
- });
64
- return {
65
- modules,
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
- const requirements = reachableModuleRequirements(config);
72
- const rootVariables = formatVariables(config.formatAst);
73
- const includeAll = rootVariables.has("all");
74
- return {
75
- modules: MODULE_DEFINITIONS.map((definition) => {
76
- const module = config.modules[definition.name];
77
- const reachable = requirements.has(definition.name);
78
- const state = module.disabled ? "Disabled" : reachable ? "Unavailable" : "Not in format";
79
- return moduleInspection(
80
- config,
81
- definition,
82
- state,
83
- "",
84
- includeAll || rootVariables.has(definition.name),
85
- reachable,
86
- );
87
- }),
88
- showing: [],
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
- config: StarshipConfig,
94
- definition: (typeof MODULE_DEFINITIONS)[number],
95
- state: ModuleInspectionState,
96
- preview: string,
97
- rootReferenced: boolean,
98
- reachable: boolean,
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
- const module = config.modules[definition.name];
101
- return {
102
- name: definition.name,
103
- description: definition.description,
104
- state,
105
- preview,
106
- variables: [...definition.variables],
107
- styleFields: ["style", ...Object.keys(module.styles)],
108
- displayRules: module.display.map(
109
- (rule) => `${rule.threshold}: ${rule.hidden ? "hidden" : rule.style || "unstyled"}`,
110
- ),
111
- rootReferenced,
112
- reachable,
113
- reason: inspectionReason(state),
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
- switch (state) {
119
- case "Showing":
120
- return "Rendered in the current footer.";
121
- case "Empty":
122
- return "Referenced by the root format, but the current snapshot produced no output.";
123
- case "Disabled":
124
- return "Disabled by this module's configuration.";
125
- case "Not in format":
126
- return "Not referenced by the root format or $all.";
127
- case "Unavailable":
128
- return "Current footer inspection is unavailable; no collector failure was inferred.";
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
- return Array.from(stripVTControlCharacters(value), (character) => {
134
- const codePoint = character.codePointAt(0) ?? 0;
135
- if (character === "\n") return character;
136
- return codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f) ? " " : character;
137
- }).join("");
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
  }