@narumitw/pi-starship 0.55.1 → 0.56.0

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 (106) hide show
  1. package/README.md +2 -0
  2. package/dist/chunks/{chunk-UX6PBXVK.js → chunk-SD7TUSSU.js} +113 -113
  3. package/dist/chunks/chunk-SD7TUSSU.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-MJCAK6JL.js} +18 -42
  11. package/dist/chunks/commands-MJCAK6JL.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 +20 -55
  23. package/dist/index.ts.map +2 -2
  24. package/package.json +60 -61
  25. package/skills/configuring-pi-starship/SKILL.md +18 -4
  26. package/skills/configuring-pi-starship/references/configuration.md +70 -2
  27. package/skills/configuring-pi-starship/references/module-catalog.md +21 -0
  28. package/skills/configuring-pi-starship/references/modules.md +2 -0
  29. package/skills/configuring-pi-starship/scripts/apply.mjs +48 -47
  30. package/skills/configuring-pi-starship/scripts/backup.mjs +118 -0
  31. package/skills/configuring-pi-starship/scripts/config-path.mjs +3 -3
  32. package/skills/configuring-pi-starship/scripts/script-support.mjs +6 -6
  33. package/skills/configuring-pi-starship/scripts/validate.mjs +18 -18
  34. package/src/command-configuration.ts +267 -286
  35. package/src/command-contract.ts +6 -6
  36. package/src/command-inspector.ts +27 -27
  37. package/src/command-preset-picker.ts +45 -50
  38. package/src/command-preview.ts +153 -166
  39. package/src/commands.ts +590 -618
  40. package/src/config.ts +635 -660
  41. package/src/effective-config.ts +49 -48
  42. package/src/format/formatter.ts +211 -227
  43. package/src/format/style.ts +205 -216
  44. package/src/modules/activity.ts +74 -74
  45. package/src/modules/brand.ts +9 -9
  46. package/src/modules/cache.ts +18 -18
  47. package/src/modules/catalog.ts +79 -83
  48. package/src/modules/cloud.ts +54 -54
  49. package/src/modules/context.ts +27 -27
  50. package/src/modules/cost.ts +23 -23
  51. package/src/modules/deployment.ts +45 -45
  52. package/src/modules/development.ts +80 -81
  53. package/src/modules/directory.ts +89 -113
  54. package/src/modules/display.ts +9 -9
  55. package/src/modules/execution.ts +62 -69
  56. package/src/modules/extension-status.ts +59 -64
  57. package/src/modules/fill.ts +10 -10
  58. package/src/modules/git/branch.ts +26 -26
  59. package/src/modules/git/commit.ts +21 -23
  60. package/src/modules/git/metrics.ts +22 -22
  61. package/src/modules/git/runtime.ts +299 -334
  62. package/src/modules/git/state.ts +17 -17
  63. package/src/modules/git/status.ts +77 -79
  64. package/src/modules/git/worktree.ts +10 -12
  65. package/src/modules/github-pr.ts +20 -20
  66. package/src/modules/helpers.ts +3 -3
  67. package/src/modules/index.ts +21 -21
  68. package/src/modules/inspection.ts +105 -108
  69. package/src/modules/languages.ts +52 -59
  70. package/src/modules/model.ts +61 -67
  71. package/src/modules/package.ts +12 -12
  72. package/src/modules/provider.ts +25 -24
  73. package/src/modules/render.ts +131 -141
  74. package/src/modules/style-rules.ts +21 -0
  75. package/src/modules/thinking.ts +31 -26
  76. package/src/modules/time.ts +10 -13
  77. package/src/modules/tokens.ts +13 -13
  78. package/src/modules/truncation.ts +14 -17
  79. package/src/modules/turn.ts +9 -9
  80. package/src/modules/types.ts +133 -132
  81. package/src/modules/workspace-helpers.ts +4 -7
  82. package/src/pi-starship.ts +567 -603
  83. package/src/presets/catalog.ts +113 -113
  84. package/src/runtime/cloud.ts +122 -150
  85. package/src/runtime/command.ts +106 -108
  86. package/src/runtime/deployment.ts +150 -179
  87. package/src/runtime/development.ts +107 -124
  88. package/src/runtime/execution.ts +110 -124
  89. package/src/runtime/github-pr.ts +223 -252
  90. package/src/runtime/helpers.ts +186 -199
  91. package/src/runtime/languages.ts +149 -180
  92. package/src/runtime/package.ts +74 -87
  93. package/src/runtime/refresh-controller.ts +82 -86
  94. package/src/runtime/types.ts +38 -38
  95. package/src/runtime/workspace.ts +108 -116
  96. package/src/usage.ts +40 -40
  97. package/dist/chunks/chunk-EOGXAMTA.js.map +0 -7
  98. package/dist/chunks/chunk-P4XMFSQW.js.map +0 -7
  99. package/dist/chunks/chunk-UX6PBXVK.js.map +0 -7
  100. package/dist/chunks/cloud-BKHYWCTA.js.map +0 -7
  101. package/dist/chunks/commands-53ZO2JUK.js.map +0 -7
  102. package/dist/chunks/deployment-RKKOEQQ2.js.map +0 -7
  103. package/dist/chunks/development-BERD42HW.js.map +0 -7
  104. package/dist/chunks/execution-42JTEY3N.js.map +0 -7
  105. package/dist/chunks/languages-RMP6DW7H.js.map +0 -7
  106. 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,131 @@ 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
+ styleRuleSelectors: readonly string[];
18
+ styleRuleCount: number;
19
+ displayRules: readonly string[];
20
+ rootReferenced: boolean;
21
+ reachable: boolean;
22
+ reason: string;
26
23
  }
27
24
 
28
25
  export interface StatuslineInspection {
29
- modules: readonly ModuleInspection[];
30
- showing: readonly ModuleInspection[];
26
+ modules: readonly ModuleInspection[];
27
+ showing: readonly ModuleInspection[];
31
28
  }
32
29
 
33
30
  export function inspectStatuslineModules(
34
- config: StarshipConfig,
35
- runtime: StarshipRuntimeSnapshot,
36
- width = 80,
31
+ config: StarshipConfig,
32
+ runtime: StarshipRuntimeSnapshot,
33
+ width = 80,
37
34
  ): 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
- };
35
+ const rendered = renderStatusline(config, runtime, width);
36
+ const requirements = reachableModuleRequirements(config);
37
+ const rootVariables = formatVariables(config.formatAst);
38
+ const includeAll = rootVariables.has("all");
39
+ const modules = MODULE_DEFINITIONS.map((definition): ModuleInspection => {
40
+ const module = config.modules[definition.name];
41
+ const reachable = requirements.has(definition.name);
42
+ const preview = plainPreview(rendered.modules[definition.name].map((chunk) => chunk.text).join(""));
43
+ const state = module.disabled
44
+ ? "Disabled"
45
+ : !reachable
46
+ ? "Not in format"
47
+ : preview.length > 0
48
+ ? "Showing"
49
+ : "Empty";
50
+ return moduleInspection(
51
+ config,
52
+ definition,
53
+ state,
54
+ preview,
55
+ includeAll || rootVariables.has(definition.name),
56
+ reachable,
57
+ );
58
+ });
59
+ return {
60
+ modules,
61
+ showing: modules.filter((module) => module.state === "Showing"),
62
+ };
68
63
  }
69
64
 
70
65
  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
- };
66
+ const requirements = reachableModuleRequirements(config);
67
+ const rootVariables = formatVariables(config.formatAst);
68
+ const includeAll = rootVariables.has("all");
69
+ return {
70
+ modules: MODULE_DEFINITIONS.map((definition) => {
71
+ const module = config.modules[definition.name];
72
+ const reachable = requirements.has(definition.name);
73
+ const state = module.disabled ? "Disabled" : reachable ? "Unavailable" : "Not in format";
74
+ return moduleInspection(
75
+ config,
76
+ definition,
77
+ state,
78
+ "",
79
+ includeAll || rootVariables.has(definition.name),
80
+ reachable,
81
+ );
82
+ }),
83
+ showing: [],
84
+ };
90
85
  }
91
86
 
92
87
  function moduleInspection(
93
- config: StarshipConfig,
94
- definition: (typeof MODULE_DEFINITIONS)[number],
95
- state: ModuleInspectionState,
96
- preview: string,
97
- rootReferenced: boolean,
98
- reachable: boolean,
88
+ config: StarshipConfig,
89
+ definition: (typeof MODULE_DEFINITIONS)[number],
90
+ state: ModuleInspectionState,
91
+ preview: string,
92
+ rootReferenced: boolean,
93
+ reachable: boolean,
99
94
  ): 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
- };
95
+ const module = config.modules[definition.name];
96
+ return {
97
+ name: definition.name,
98
+ description: definition.description,
99
+ state,
100
+ preview,
101
+ variables: [...definition.variables],
102
+ styleFields: ["style", ...Object.keys(module.styles)],
103
+ styleRuleSelectors: Object.keys(definition.styleRuleSelectors ?? {}),
104
+ styleRuleCount: module.styleRules.length,
105
+ displayRules: module.display.map(
106
+ (rule) => `${rule.threshold}: ${rule.hidden ? "hidden" : rule.style || "unstyled"}`,
107
+ ),
108
+ rootReferenced,
109
+ reachable,
110
+ reason: inspectionReason(state),
111
+ };
115
112
  }
116
113
 
117
114
  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
- }
115
+ switch (state) {
116
+ case "Showing":
117
+ return "Rendered in the current footer.";
118
+ case "Empty":
119
+ return "Referenced by the root format, but the current snapshot produced no output.";
120
+ case "Disabled":
121
+ return "Disabled by this module's configuration.";
122
+ case "Not in format":
123
+ return "Not referenced by the root format or $all.";
124
+ case "Unavailable":
125
+ return "Current footer inspection is unavailable; no collector failure was inferred.";
126
+ }
130
127
  }
131
128
 
132
129
  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("");
130
+ return Array.from(stripVTControlCharacters(value), (character) => {
131
+ const codePoint = character.codePointAt(0) ?? 0;
132
+ if (character === "\n") return character;
133
+ return codePoint <= 0x1f || (codePoint >= 0x7f && codePoint <= 0x9f) ? " " : character;
134
+ }).join("");
138
135
  }