@space-lens/cli 0.2.1 → 0.2.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 +13 -71
- package/dist/{model-BUAl_aPJ.mjs → assets/model-D5_IMhZA.js} +41 -1
- package/dist/{scanner-BwSuW3ks.mjs → assets/scanner-DiwQ0w5N.js} +2 -1
- package/dist/cli.mjs +4118 -28
- package/dist/index.mjs +1 -2
- package/package.json +13 -14
- package/dist/cli-config-AZ8GhaEx.mjs +0 -41
- package/dist/cli.d.mts +0 -1
- package/dist/index.d.mts +0 -113
- package/dist/ui-BKn7TAnJ.mjs +0 -223
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { a as formatBytes, i as createScanViewModel, n as createCleanViewModel, o as getSelectedEntries, r as createInitialTuiState, t as applyTuiAction } from "./model-
|
|
2
|
-
import { a as parseSortMode, i as parsePresetList, n as SORT_MODES, r as normalizeCliConfig, t as PRESETS } from "./cli-config-AZ8GhaEx.mjs";
|
|
1
|
+
import { a as formatBytes, c as SORT_MODES, d as parseSortMode, i as createScanViewModel, l as normalizeCliConfig, n as createCleanViewModel, o as getSelectedEntries, r as createInitialTuiState, s as PRESETS, t as applyTuiAction, u as parsePresetList } from "./assets/model-D5_IMhZA.js";
|
|
3
2
|
export { PRESETS, SORT_MODES, applyTuiAction, createCleanViewModel, createInitialTuiState, createScanViewModel, formatBytes, getSelectedEntries, normalizeCliConfig, parsePresetList, parseSortMode };
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@space-lens/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "0.2.2",
|
|
5
|
+
"description": "Solid-based Uniview TUI for Space Lens scanning and cleanup.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/HuakunShen/space-lens",
|
|
8
|
+
"url": "git+https://github.com/HuakunShen/space-lens.git",
|
|
9
9
|
"directory": "apps/tui"
|
|
10
10
|
},
|
|
11
11
|
"bin": {
|
|
12
12
|
"spacelens": "dist/cli.mjs"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
|
-
"
|
|
15
|
+
"node": ">=20"
|
|
16
16
|
},
|
|
17
17
|
"exports": {
|
|
18
18
|
".": "./dist/index.mjs",
|
|
@@ -27,28 +27,27 @@
|
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
|
-
"build": "
|
|
31
|
-
"dev": "
|
|
30
|
+
"build": "vite build --config vite.config.ts",
|
|
31
|
+
"dev": "vite-node src/cli.ts",
|
|
32
32
|
"lint": "tsc --noEmit",
|
|
33
|
-
"test": "node --import tsx --test \"src/**/*.test.ts\"",
|
|
33
|
+
"test": "vitest run src/ui.test.tsx && node --import tsx --test \"src/**/*.test.ts\"",
|
|
34
34
|
"typecheck": "tsc --noEmit"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@effect/cli": "^0.75.2",
|
|
38
|
-
"@effect/platform": "^0.96.1",
|
|
39
38
|
"@effect/platform-node": "^0.107.0",
|
|
40
|
-
"@
|
|
41
|
-
"@effect/printer-ansi": "^0.49.0",
|
|
42
|
-
"@effect/typeclass": "^0.40.0",
|
|
43
|
-
"@opentui/core": "^0.4.1",
|
|
39
|
+
"@uniview/tui-solid": "0.0.4",
|
|
44
40
|
"effect": "^3.21.3",
|
|
41
|
+
"solid-js": "^1.9.14",
|
|
45
42
|
"space-lens": "^0.2.0",
|
|
46
43
|
"web-tree-sitter": "0.25.10"
|
|
47
44
|
},
|
|
48
45
|
"devDependencies": {
|
|
49
46
|
"@types/node": "^25.9.3",
|
|
50
|
-
"tsdown": "^0.22.2",
|
|
51
47
|
"tsx": "^4.22.4",
|
|
52
|
-
"typescript": "^6.0.3"
|
|
48
|
+
"typescript": "^6.0.3",
|
|
49
|
+
"vite": "^8.1.5",
|
|
50
|
+
"vite-node": "^6.0.0",
|
|
51
|
+
"vitest": "^4.0.18"
|
|
53
52
|
}
|
|
54
53
|
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
//#region src/cli-config.ts
|
|
2
|
-
const PRESETS = [
|
|
3
|
-
"node",
|
|
4
|
-
"rust",
|
|
5
|
-
"gitignored"
|
|
6
|
-
];
|
|
7
|
-
const SORT_MODES = ["size", "path"];
|
|
8
|
-
function normalizeCliConfig(raw) {
|
|
9
|
-
return {
|
|
10
|
-
paths: raw.paths.length > 0 ? [...raw.paths] : ["."],
|
|
11
|
-
presets: parsePresetList(raw.presets),
|
|
12
|
-
ignoreHidden: raw.ignoreHidden,
|
|
13
|
-
sort: parseSortMode(raw.sort)
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
function parsePresetList(raw) {
|
|
17
|
-
const seen = /* @__PURE__ */ new Set();
|
|
18
|
-
const presets = [];
|
|
19
|
-
for (const value of raw) for (const token of value.split(",")) {
|
|
20
|
-
const preset = token.trim();
|
|
21
|
-
if (preset.length === 0) continue;
|
|
22
|
-
if (!isPreset(preset)) throw new Error(`Unknown preset "${preset}". Use node, rust, or gitignored.`);
|
|
23
|
-
if (!seen.has(preset)) {
|
|
24
|
-
seen.add(preset);
|
|
25
|
-
presets.push(preset);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return presets;
|
|
29
|
-
}
|
|
30
|
-
function parseSortMode(raw) {
|
|
31
|
-
if (!isSortMode(raw)) throw new Error(`Unknown sort mode "${raw}". Use size or path.`);
|
|
32
|
-
return raw;
|
|
33
|
-
}
|
|
34
|
-
function isPreset(value) {
|
|
35
|
-
return PRESETS.includes(value);
|
|
36
|
-
}
|
|
37
|
-
function isSortMode(value) {
|
|
38
|
-
return SORT_MODES.includes(value);
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
41
|
-
export { parseSortMode as a, parsePresetList as i, SORT_MODES as n, normalizeCliConfig as r, PRESETS as t };
|
package/dist/cli.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|
package/dist/index.d.mts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
//#region src/model.d.ts
|
|
2
|
-
type Preset = 'node' | 'rust' | 'gitignored';
|
|
3
|
-
type SortMode = 'size' | 'path';
|
|
4
|
-
type TuiMode = 'scan' | 'clean';
|
|
5
|
-
interface CliOptions {
|
|
6
|
-
paths: string[];
|
|
7
|
-
presets: Preset[];
|
|
8
|
-
ignoreHidden: boolean;
|
|
9
|
-
sort: SortMode;
|
|
10
|
-
}
|
|
11
|
-
interface PlanEntry {
|
|
12
|
-
path: string;
|
|
13
|
-
size: number;
|
|
14
|
-
preset: string;
|
|
15
|
-
reason: string;
|
|
16
|
-
}
|
|
17
|
-
interface PlanLike {
|
|
18
|
-
entries: PlanEntry[];
|
|
19
|
-
totalSize: number;
|
|
20
|
-
errors: string[];
|
|
21
|
-
}
|
|
22
|
-
interface ViewRow extends PlanEntry {
|
|
23
|
-
index: number;
|
|
24
|
-
sizeLabel: string;
|
|
25
|
-
selected: boolean;
|
|
26
|
-
active: boolean;
|
|
27
|
-
}
|
|
28
|
-
interface DirectoryNode {
|
|
29
|
-
name: string;
|
|
30
|
-
path: string;
|
|
31
|
-
size: number;
|
|
32
|
-
children: DirectoryNode[];
|
|
33
|
-
depth: number;
|
|
34
|
-
ignored: boolean;
|
|
35
|
-
collapsed: boolean;
|
|
36
|
-
}
|
|
37
|
-
interface TreeRow {
|
|
38
|
-
index: number;
|
|
39
|
-
label: string;
|
|
40
|
-
path: string;
|
|
41
|
-
size: number;
|
|
42
|
-
sizeLabel: string;
|
|
43
|
-
depth: number;
|
|
44
|
-
ignored: boolean;
|
|
45
|
-
collapsed: boolean;
|
|
46
|
-
active: boolean;
|
|
47
|
-
}
|
|
48
|
-
interface CleanViewModel {
|
|
49
|
-
title: string;
|
|
50
|
-
summary: string;
|
|
51
|
-
rows: ViewRow[];
|
|
52
|
-
cursor: number;
|
|
53
|
-
errors: string[];
|
|
54
|
-
}
|
|
55
|
-
interface ScanViewModel {
|
|
56
|
-
title: string;
|
|
57
|
-
summary: string;
|
|
58
|
-
rows: TreeRow[];
|
|
59
|
-
cursor: number;
|
|
60
|
-
}
|
|
61
|
-
interface TuiState {
|
|
62
|
-
mode: TuiMode;
|
|
63
|
-
scanCursor: number;
|
|
64
|
-
cleanCursor: number;
|
|
65
|
-
selectedPaths: Set<string>;
|
|
66
|
-
confirmExecute: boolean;
|
|
67
|
-
status: string;
|
|
68
|
-
}
|
|
69
|
-
type TuiAction = {
|
|
70
|
-
type: 'switch-mode';
|
|
71
|
-
} | {
|
|
72
|
-
type: 'move';
|
|
73
|
-
delta: number;
|
|
74
|
-
rowCount: number;
|
|
75
|
-
} | {
|
|
76
|
-
type: 'toggle-selected';
|
|
77
|
-
path: string;
|
|
78
|
-
} | {
|
|
79
|
-
type: 'toggle-all';
|
|
80
|
-
paths: string[];
|
|
81
|
-
} | {
|
|
82
|
-
type: 'request-execute';
|
|
83
|
-
} | {
|
|
84
|
-
type: 'cancel-execute';
|
|
85
|
-
} | {
|
|
86
|
-
type: 'set-status';
|
|
87
|
-
status: string;
|
|
88
|
-
} | {
|
|
89
|
-
type: 'clear-selection';
|
|
90
|
-
};
|
|
91
|
-
declare function createInitialTuiState(): TuiState;
|
|
92
|
-
declare function createCleanViewModel(plan: PlanLike, options: Pick<CliOptions, 'sort'> & {
|
|
93
|
-
state: TuiState;
|
|
94
|
-
}): CleanViewModel;
|
|
95
|
-
declare function createScanViewModel(trees: DirectoryNode[], state: TuiState): ScanViewModel;
|
|
96
|
-
declare function applyTuiAction(state: TuiState, action: TuiAction): void;
|
|
97
|
-
declare function getSelectedEntries(state: Pick<TuiState, 'selectedPaths'>, entries: PlanEntry[]): PlanEntry[];
|
|
98
|
-
declare function formatBytes(input: number): string;
|
|
99
|
-
//#endregion
|
|
100
|
-
//#region src/cli-config.d.ts
|
|
101
|
-
declare const PRESETS: readonly ["node", "rust", "gitignored"];
|
|
102
|
-
declare const SORT_MODES: readonly ["size", "path"];
|
|
103
|
-
interface RawCliConfig {
|
|
104
|
-
readonly paths: readonly string[];
|
|
105
|
-
readonly presets: readonly string[];
|
|
106
|
-
readonly ignoreHidden: boolean;
|
|
107
|
-
readonly sort: string;
|
|
108
|
-
}
|
|
109
|
-
declare function normalizeCliConfig(raw: RawCliConfig): CliOptions;
|
|
110
|
-
declare function parsePresetList(raw: readonly string[]): Preset[];
|
|
111
|
-
declare function parseSortMode(raw: string): SortMode;
|
|
112
|
-
//#endregion
|
|
113
|
-
export { type CleanViewModel, type CliOptions, type DirectoryNode, PRESETS, type PlanEntry, type PlanLike, type Preset, SORT_MODES, type ScanViewModel, type SortMode, type TreeRow, type TuiAction, type TuiMode, type TuiState, type ViewRow, applyTuiAction, createCleanViewModel, createInitialTuiState, createScanViewModel, formatBytes, getSelectedEntries, normalizeCliConfig, parsePresetList, parseSortMode };
|
package/dist/ui-BKn7TAnJ.mjs
DELETED
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { a as formatBytes, i as createScanViewModel, n as createCleanViewModel, o as getSelectedEntries, r as createInitialTuiState, t as applyTuiAction } from "./model-BUAl_aPJ.mjs";
|
|
2
|
-
import { Box, ScrollBox, Text, createCliRenderer } from "@opentui/core";
|
|
3
|
-
//#region src/ui.ts
|
|
4
|
-
async function runTui(options) {
|
|
5
|
-
let data = options.initialData;
|
|
6
|
-
let executing = false;
|
|
7
|
-
const state = createInitialTuiState();
|
|
8
|
-
const renderer = await createCliRenderer({
|
|
9
|
-
exitOnCtrlC: true,
|
|
10
|
-
clearOnShutdown: true,
|
|
11
|
-
screenMode: "alternate-screen"
|
|
12
|
-
});
|
|
13
|
-
const render = () => {
|
|
14
|
-
clearRoot();
|
|
15
|
-
const scanView = createScanViewModel(data.scanTrees, state);
|
|
16
|
-
const cleanView = createCleanViewModel(data.plan, {
|
|
17
|
-
sort: options.sort,
|
|
18
|
-
state
|
|
19
|
-
});
|
|
20
|
-
const selected = getSelectedEntries(state, data.plan.entries);
|
|
21
|
-
const activeMode = state.mode === "scan" ? "SCAN" : "CLEAN";
|
|
22
|
-
renderer.root.add(Box({
|
|
23
|
-
flexDirection: "column",
|
|
24
|
-
gap: 1,
|
|
25
|
-
padding: 1,
|
|
26
|
-
width: "100%",
|
|
27
|
-
height: "100%"
|
|
28
|
-
}, Text({
|
|
29
|
-
content: `Space Lens | ${activeMode} | tab switch | j/k move | q quit`,
|
|
30
|
-
fg: "#7dd3fc",
|
|
31
|
-
height: 1,
|
|
32
|
-
truncate: true
|
|
33
|
-
}), Text({
|
|
34
|
-
content: state.mode === "scan" ? `${scanView.summary} | tree view` : `${cleanView.summary} | space select | a all | x delete`,
|
|
35
|
-
fg: "#d1d5db",
|
|
36
|
-
height: 1,
|
|
37
|
-
truncate: true
|
|
38
|
-
}), Text({
|
|
39
|
-
content: statusLine(selected, state.confirmExecute, executing, state.status),
|
|
40
|
-
fg: state.confirmExecute ? "#fca5a5" : "#9ca3af",
|
|
41
|
-
height: 1,
|
|
42
|
-
truncate: true
|
|
43
|
-
}), state.mode === "scan" ? renderScanPane(scanView.rows) : renderCleanPane(cleanView.rows, selected.length, state.confirmExecute), ...errorLines(cleanView.errors)));
|
|
44
|
-
};
|
|
45
|
-
const executeSelected = async () => {
|
|
46
|
-
const selected = getSelectedEntries(state, data.plan.entries);
|
|
47
|
-
if (selected.length === 0) {
|
|
48
|
-
applyTuiAction(state, {
|
|
49
|
-
type: "set-status",
|
|
50
|
-
status: "Nothing selected."
|
|
51
|
-
});
|
|
52
|
-
render();
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
executing = true;
|
|
56
|
-
applyTuiAction(state, {
|
|
57
|
-
type: "set-status",
|
|
58
|
-
status: `Removing ${selected.length} selected paths...`
|
|
59
|
-
});
|
|
60
|
-
render();
|
|
61
|
-
try {
|
|
62
|
-
const outcome = options.executeEntries(selected);
|
|
63
|
-
data = options.refreshData();
|
|
64
|
-
applyTuiAction(state, { type: "clear-selection" });
|
|
65
|
-
applyTuiAction(state, {
|
|
66
|
-
type: "set-status",
|
|
67
|
-
status: removalStatus(outcome)
|
|
68
|
-
});
|
|
69
|
-
} catch (error) {
|
|
70
|
-
applyTuiAction(state, {
|
|
71
|
-
type: "set-status",
|
|
72
|
-
status: `Delete failed: ${error instanceof Error ? error.message : String(error)}`
|
|
73
|
-
});
|
|
74
|
-
} finally {
|
|
75
|
-
executing = false;
|
|
76
|
-
render();
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
const handleInput = (sequence) => {
|
|
80
|
-
if (sequence === "") return false;
|
|
81
|
-
if (executing) return true;
|
|
82
|
-
const scanRows = createScanViewModel(data.scanTrees, state).rows.length;
|
|
83
|
-
const cleanRows = createCleanViewModel(data.plan, {
|
|
84
|
-
sort: options.sort,
|
|
85
|
-
state
|
|
86
|
-
}).rows;
|
|
87
|
-
if (!handleSequence(sequence, cleanRows)) return false;
|
|
88
|
-
if (sequence === "\r" || sequence === "\n") {
|
|
89
|
-
if (state.confirmExecute) {
|
|
90
|
-
executeSelected();
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (sequence === "j" || sequence === "\x1B[B") applyTuiAction(state, {
|
|
95
|
-
type: "move",
|
|
96
|
-
delta: 1,
|
|
97
|
-
rowCount: state.mode === "scan" ? scanRows : cleanRows.length
|
|
98
|
-
});
|
|
99
|
-
else if (sequence === "k" || sequence === "\x1B[A") applyTuiAction(state, {
|
|
100
|
-
type: "move",
|
|
101
|
-
delta: -1,
|
|
102
|
-
rowCount: state.mode === "scan" ? scanRows : cleanRows.length
|
|
103
|
-
});
|
|
104
|
-
render();
|
|
105
|
-
return true;
|
|
106
|
-
};
|
|
107
|
-
const handleSequence = (sequence, cleanRows) => {
|
|
108
|
-
switch (sequence) {
|
|
109
|
-
case "q":
|
|
110
|
-
renderer.destroy();
|
|
111
|
-
return true;
|
|
112
|
-
case " ":
|
|
113
|
-
applyTuiAction(state, { type: "switch-mode" });
|
|
114
|
-
return true;
|
|
115
|
-
case "j":
|
|
116
|
-
case "k":
|
|
117
|
-
case "\x1B[A":
|
|
118
|
-
case "\x1B[B": return true;
|
|
119
|
-
case " ":
|
|
120
|
-
if (state.mode === "clean") {
|
|
121
|
-
const active = cleanRows[state.cleanCursor];
|
|
122
|
-
if (active) applyTuiAction(state, {
|
|
123
|
-
type: "toggle-selected",
|
|
124
|
-
path: active.path
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
return true;
|
|
128
|
-
case "a":
|
|
129
|
-
if (state.mode === "clean") applyTuiAction(state, {
|
|
130
|
-
type: "toggle-all",
|
|
131
|
-
paths: cleanRows.map((row) => row.path)
|
|
132
|
-
});
|
|
133
|
-
return true;
|
|
134
|
-
case "x":
|
|
135
|
-
if (state.mode === "clean") applyTuiAction(state, { type: "request-execute" });
|
|
136
|
-
return true;
|
|
137
|
-
case "\r":
|
|
138
|
-
case "\n": return true;
|
|
139
|
-
case "\x1B":
|
|
140
|
-
applyTuiAction(state, { type: "cancel-execute" });
|
|
141
|
-
return true;
|
|
142
|
-
default: return false;
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
const clearRoot = () => {
|
|
146
|
-
for (const child of [...renderer.root.getChildren()]) renderer.root.remove(child.id);
|
|
147
|
-
};
|
|
148
|
-
renderer.addInputHandler(handleInput);
|
|
149
|
-
render();
|
|
150
|
-
}
|
|
151
|
-
function renderScanPane(rows) {
|
|
152
|
-
return ScrollBox({
|
|
153
|
-
border: true,
|
|
154
|
-
borderStyle: "rounded",
|
|
155
|
-
borderColor: "#374151",
|
|
156
|
-
flexGrow: 1,
|
|
157
|
-
padding: 1,
|
|
158
|
-
scrollY: true,
|
|
159
|
-
title: "scan tree"
|
|
160
|
-
}, ...rows.map((row) => Text({
|
|
161
|
-
content: `${row.active ? ">" : " "} ${row.sizeLabel.padEnd(24, " ")} ${row.label}`,
|
|
162
|
-
fg: row.active ? "#bfdbfe" : row.ignored ? "#fde68a" : "#e5e7eb",
|
|
163
|
-
height: 1,
|
|
164
|
-
truncate: true
|
|
165
|
-
})), ...emptyState(rows.length, "No scan results."));
|
|
166
|
-
}
|
|
167
|
-
function renderCleanPane(rows, selectedCount, confirmExecute) {
|
|
168
|
-
return ScrollBox({
|
|
169
|
-
border: true,
|
|
170
|
-
borderStyle: "rounded",
|
|
171
|
-
borderColor: confirmExecute ? "#991b1b" : "#374151",
|
|
172
|
-
flexGrow: 1,
|
|
173
|
-
padding: 1,
|
|
174
|
-
scrollY: true,
|
|
175
|
-
title: selectedCount > 0 ? `cleanup candidates (${selectedCount} selected)` : "cleanup candidates"
|
|
176
|
-
}, ...rows.map((row) => Text({
|
|
177
|
-
content: `${row.active ? ">" : " "} ${row.selected ? "[x]" : "[ ]"} ${row.sizeLabel.padEnd(24, " ")} ${row.preset.padEnd(10, " ")} ${row.path} ${row.reason}`,
|
|
178
|
-
fg: row.active ? "#bfdbfe" : colorForPreset(row.preset),
|
|
179
|
-
height: 1,
|
|
180
|
-
truncate: true
|
|
181
|
-
})), ...emptyState(rows.length, "No cleanup candidates found."));
|
|
182
|
-
}
|
|
183
|
-
function statusLine(selected, confirmExecute, executing, status) {
|
|
184
|
-
if (executing) return status;
|
|
185
|
-
if (confirmExecute) {
|
|
186
|
-
const size = selected.reduce((total, entry) => total + entry.size, 0);
|
|
187
|
-
return `Confirm delete ${selected.length} paths (${formatBytes(size)}): press enter to execute, esc to cancel.`;
|
|
188
|
-
}
|
|
189
|
-
if (status) return status;
|
|
190
|
-
return "Scan mode shows disk tree. Clean mode lets you select candidates and execute deletion.";
|
|
191
|
-
}
|
|
192
|
-
function removalStatus(outcome) {
|
|
193
|
-
const base = `Removed ${outcome.removed.length} paths, ${formatBytes(outcome.bytesRemoved)}.`;
|
|
194
|
-
if (outcome.errors.length === 0) return base;
|
|
195
|
-
return `${base} ${outcome.errors.length} errors.`;
|
|
196
|
-
}
|
|
197
|
-
function colorForPreset(preset) {
|
|
198
|
-
switch (preset) {
|
|
199
|
-
case "node": return "#86efac";
|
|
200
|
-
case "rust": return "#fca5a5";
|
|
201
|
-
case "gitignored": return "#fde68a";
|
|
202
|
-
default: return "#e5e7eb";
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
function emptyState(rows, message) {
|
|
206
|
-
if (rows > 0) return [];
|
|
207
|
-
return [Text({
|
|
208
|
-
content: message,
|
|
209
|
-
fg: "#9ca3af",
|
|
210
|
-
height: 1
|
|
211
|
-
})];
|
|
212
|
-
}
|
|
213
|
-
function errorLines(errors) {
|
|
214
|
-
if (errors.length === 0) return [];
|
|
215
|
-
return [Text({
|
|
216
|
-
content: `Warnings: ${errors.join("; ")}`,
|
|
217
|
-
fg: "#fbbf24",
|
|
218
|
-
height: 1,
|
|
219
|
-
truncate: true
|
|
220
|
-
})];
|
|
221
|
-
}
|
|
222
|
-
//#endregion
|
|
223
|
-
export { runTui };
|