Skip to content

Commit 36bdc2e

Browse files
committed
cp dines
1 parent f5d415d commit 36bdc2e

20 files changed

Lines changed: 108 additions & 112 deletions

src/commands/blueprint/list.tsx

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ const DEFAULT_PAGE_SIZE = 10;
2626

2727
type OperationType = "create_devbox" | "delete" | null;
2828

29+
// Local interface for blueprint data used in this component
30+
interface BlueprintListItem {
31+
id: string;
32+
name?: string;
33+
status?: string;
34+
create_time_ms?: number;
35+
[key: string]: unknown;
36+
}
37+
2938
const ListBlueprintsUI = ({
3039
onBack,
3140
onExit,
@@ -76,34 +85,29 @@ const ListBlueprintsUI = ({
7685
const fetchPage = React.useCallback(
7786
async (params: { limit: number; startingAt?: string }) => {
7887
const client = getClient();
79-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
80-
const pageBlueprints: any[] = [];
88+
const pageBlueprints: BlueprintListItem[] = [];
8189

8290
// Build query params
83-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
84-
const queryParams: any = {
91+
const queryParams: Record<string, unknown> = {
8592
limit: params.limit,
8693
};
8794
if (params.startingAt) {
8895
queryParams.starting_after = params.startingAt;
8996
}
9097

9198
// Fetch ONE page only
92-
let page = (await client.blueprints.list(
99+
const page = (await client.blueprints.list(
93100
queryParams,
94-
)) as BlueprintsCursorIDPage<{ id: string }>;
101+
)) as unknown as BlueprintsCursorIDPage<BlueprintListItem>;
95102

96103
// Extract data and create defensive copies
97104
if (page.blueprints && Array.isArray(page.blueprints)) {
98-
page.blueprints.forEach((b: any) => {
105+
page.blueprints.forEach((b: BlueprintListItem) => {
99106
pageBlueprints.push({
100107
id: b.id,
101108
name: b.name,
102109
status: b.status,
103110
create_time_ms: b.create_time_ms,
104-
dockerfile_setup: b.dockerfile_setup
105-
? { ...b.dockerfile_setup }
106-
: undefined,
107111
});
108112
});
109113
}
@@ -114,9 +118,6 @@ const ListBlueprintsUI = ({
114118
totalCount: page.total_count || pageBlueprints.length,
115119
};
116120

117-
// Help GC
118-
page = null as any;
119-
120121
return result;
121122
},
122123
[],
@@ -137,7 +138,7 @@ const ListBlueprintsUI = ({
137138
} = useCursorPagination({
138139
fetchPage,
139140
pageSize: PAGE_SIZE,
140-
getItemId: (blueprint: any) => blueprint.id,
141+
getItemId: (blueprint: BlueprintListItem) => blueprint.id,
141142
pollInterval: 2000,
142143
pollingEnabled: !showPopup && !showCreateDevbox && !executingOperation,
143144
deps: [PAGE_SIZE],
@@ -150,8 +151,12 @@ const ListBlueprintsUI = ({
150151
key: "statusIcon",
151152
label: "",
152153
width: statusIconWidth,
153-
render: (blueprint: any, index: number, isSelected: boolean) => {
154-
const statusDisplay = getStatusDisplay(blueprint.status);
154+
render: (
155+
blueprint: BlueprintListItem,
156+
_index: number,
157+
isSelected: boolean,
158+
) => {
159+
const statusDisplay = getStatusDisplay(blueprint.status || "");
155160
const statusColor =
156161
statusDisplay.color === colors.textDim
157162
? colors.info
@@ -173,7 +178,11 @@ const ListBlueprintsUI = ({
173178
key: "id",
174179
label: "ID",
175180
width: idWidth + 1,
176-
render: (blueprint: any, index: number, isSelected: boolean) => {
181+
render: (
182+
blueprint: BlueprintListItem,
183+
_index: number,
184+
isSelected: boolean,
185+
) => {
177186
const value = blueprint.id;
178187
const width = Math.max(1, idWidth + 1);
179188
const truncated = value.slice(0, Math.max(1, width - 1));
@@ -195,8 +204,12 @@ const ListBlueprintsUI = ({
195204
key: "statusText",
196205
label: "Status",
197206
width: statusTextWidth,
198-
render: (blueprint: any, index: number, isSelected: boolean) => {
199-
const statusDisplay = getStatusDisplay(blueprint.status);
207+
render: (
208+
blueprint: BlueprintListItem,
209+
_index: number,
210+
isSelected: boolean,
211+
) => {
212+
const statusDisplay = getStatusDisplay(blueprint.status || "");
200213
const statusColor =
201214
statusDisplay.color === colors.textDim
202215
? colors.info
@@ -220,27 +233,16 @@ const ListBlueprintsUI = ({
220233
createTextColumn(
221234
"name",
222235
"Name",
223-
(blueprint: any) => blueprint.name || "(unnamed)",
236+
(blueprint: BlueprintListItem) => blueprint.name || "(unnamed)",
224237
{
225238
width: nameWidth,
226239
},
227240
),
228-
createTextColumn(
229-
"description",
230-
"Description",
231-
(blueprint: any) => blueprint.dockerfile_setup?.description || "",
232-
{
233-
width: descriptionWidth,
234-
color: colors.textDim,
235-
dimColor: false,
236-
bold: false,
237-
visible: showDescription,
238-
},
239-
),
241+
// Description column removed - not available in API
240242
createTextColumn(
241243
"created",
242244
"Created",
243-
(blueprint: any) =>
245+
(blueprint: BlueprintListItem) =>
244246
blueprint.create_time_ms
245247
? formatTimeAgo(blueprint.create_time_ms)
246248
: "",
@@ -264,7 +266,9 @@ const ListBlueprintsUI = ({
264266
);
265267

266268
// Helper function to generate operations based on selected blueprint
267-
const getOperationsForBlueprint = (blueprint: any): Operation[] => {
269+
const getOperationsForBlueprint = (
270+
blueprint: BlueprintListItem,
271+
): Operation[] => {
268272
const operations: Operation[] = [];
269273

270274
if (
@@ -653,7 +657,7 @@ const ListBlueprintsUI = ({
653657
{!showPopup && (
654658
<Table
655659
data={blueprints}
656-
keyExtractor={(blueprint: any) => blueprint.id}
660+
keyExtractor={(blueprint: BlueprintListItem) => blueprint.id}
657661
selectedIndex={selectedIndex}
658662
title={`blueprints[${totalCount}]`}
659663
columns={blueprintColumns}

src/commands/config.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from "react";
22
import { render, Box, Text, useInput, useApp } from "ink";
33
import figures from "figures";
4-
import chalk from "chalk";
54
import {
65
setThemePreference,
76
getThemePreference,

src/commands/devbox/list.tsx

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { useViewportHeight } from "../../hooks/useViewportHeight.js";
2020
import { useExitOnCtrlC } from "../../hooks/useExitOnCtrlC.js";
2121
import { useCursorPagination } from "../../hooks/useCursorPagination.js";
2222
import { colors } from "../../utils/theme.js";
23-
import { useDevboxStore } from "../../store/devboxStore.js";
23+
import { useDevboxStore, type Devbox } from "../../store/devboxStore.js";
2424

2525
interface ListOptions {
2626
status?: string;
@@ -75,12 +75,10 @@ const ListDevboxesUI = ({
7575
const fetchPage = React.useCallback(
7676
async (params: { limit: number; startingAt?: string }) => {
7777
const client = getClient();
78-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
79-
const pageDevboxes: any[] = [];
78+
const pageDevboxes: Devbox[] = [];
8079

8180
// Build query params
82-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
83-
const queryParams: any = {
81+
const queryParams: Record<string, unknown> = {
8482
limit: params.limit,
8583
};
8684
if (params.startingAt) {
@@ -94,16 +92,14 @@ const ListDevboxesUI = ({
9492
}
9593

9694
// Fetch ONE page only
97-
let page = (await client.devboxes.list(queryParams)) as DevboxesCursorIDPage<{
98-
id: string;
99-
}>;
95+
const page = (await client.devboxes.list(queryParams)) as unknown as DevboxesCursorIDPage<Devbox>;
10096

10197
// Extract data and create defensive copies
10298
if (page.devboxes && Array.isArray(page.devboxes)) {
103-
page.devboxes.forEach((d: any) => {
104-
const plain: any = {};
99+
page.devboxes.forEach((d: Devbox) => {
100+
const plain: Record<string, unknown> = {};
105101
for (const key in d) {
106-
const value = d[key];
102+
const value = (d as unknown as Record<string, unknown>)[key];
107103
if (value === null || value === undefined) {
108104
plain[key] = value;
109105
} else if (Array.isArray(value)) {
@@ -114,7 +110,7 @@ const ListDevboxesUI = ({
114110
plain[key] = value;
115111
}
116112
}
117-
pageDevboxes.push(plain);
113+
pageDevboxes.push(plain as Devbox);
118114
});
119115
}
120116

@@ -124,9 +120,6 @@ const ListDevboxesUI = ({
124120
totalCount: page.total_count || pageDevboxes.length,
125121
};
126122

127-
// Help GC
128-
page = null as any;
129-
130123
return result;
131124
},
132125
[status, submittedSearchQuery],
@@ -147,7 +140,7 @@ const ListDevboxesUI = ({
147140
} = useCursorPagination({
148141
fetchPage,
149142
pageSize: PAGE_SIZE,
150-
getItemId: (devbox: any) => devbox.id,
143+
getItemId: (devbox: Devbox) => devbox.id,
151144
pollInterval: 2000,
152145
pollingEnabled: !showDetails && !showCreate && !showActions && !showPopup && !searchMode,
153146
deps: [status, submittedSearchQuery, PAGE_SIZE],
@@ -223,7 +216,7 @@ const ListDevboxesUI = ({
223216
createTextColumn(
224217
"name",
225218
"Name",
226-
(devbox: any) => {
219+
(devbox: Devbox) => {
227220
const name = String(devbox?.name || devbox?.id || "");
228221
const safeMax = Math.min(nameWidth || 15, ABSOLUTE_MAX_NAME);
229222
return name.length > safeMax
@@ -238,7 +231,7 @@ const ListDevboxesUI = ({
238231
createTextColumn(
239232
"id",
240233
"ID",
241-
(devbox: any) => {
234+
(devbox: Devbox) => {
242235
const id = String(devbox?.id || "");
243236
const safeMax = Math.min(idWidth || 26, ABSOLUTE_MAX_ID);
244237
return id.length > safeMax
@@ -255,7 +248,7 @@ const ListDevboxesUI = ({
255248
createTextColumn(
256249
"status",
257250
"Status",
258-
(devbox: any) => {
251+
(devbox: Devbox) => {
259252
const statusDisplay = getStatusDisplay(devbox?.status);
260253
const text = String(statusDisplay?.text || "-");
261254
return text.length > 20 ? text.substring(0, 17) + "..." : text;
@@ -268,7 +261,7 @@ const ListDevboxesUI = ({
268261
createTextColumn(
269262
"created",
270263
"Created",
271-
(devbox: any) => {
264+
(devbox: Devbox) => {
272265
const time = formatTimeAgo(devbox?.create_time_ms || Date.now());
273266
const text = String(time || "-");
274267
return text.length > 25 ? text.substring(0, 22) + "..." : text;
@@ -286,7 +279,7 @@ const ListDevboxesUI = ({
286279
createTextColumn(
287280
"source",
288281
"Source",
289-
(devbox: any) => {
282+
(devbox: Devbox) => {
290283
if (devbox?.blueprint_id) {
291284
const bpId = String(devbox.blueprint_id);
292285
const truncated = bpId.slice(0, 16);
@@ -309,7 +302,7 @@ const ListDevboxesUI = ({
309302
createTextColumn(
310303
"capabilities",
311304
"Capabilities",
312-
(devbox: any) => {
305+
(devbox: Devbox) => {
313306
const caps = [];
314307
if (devbox?.entitlements?.network_enabled) caps.push("net");
315308
if (devbox?.entitlements?.gpu_enabled) caps.push("gpu");
@@ -668,7 +661,7 @@ const ListDevboxesUI = ({
668661
{!showPopup && (
669662
<Table
670663
data={devboxes}
671-
keyExtractor={(devbox: any) => devbox.id}
664+
keyExtractor={(devbox: Devbox) => devbox.id}
672665
selectedIndex={selectedIndex}
673666
title="devboxes"
674667
columns={tableColumns}

src/commands/mcp-install.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function getRliPath(): string {
3232
const cmd = platform() === "win32" ? "where rli" : "which rli";
3333
const path = execSync(cmd, { encoding: "utf-8" }).trim().split("\n")[0];
3434
return path;
35-
} catch (error) {
35+
} catch {
3636
// If rli not found in PATH, just use 'rli' and hope it works
3737
return "rli";
3838
}
@@ -57,7 +57,7 @@ export async function installMcpConfig() {
5757
if (!config.mcpServers) {
5858
config.mcpServers = {};
5959
}
60-
} catch (error) {
60+
} catch {
6161
console.error(
6262
"❌ Error: Claude config file exists but is not valid JSON",
6363
);

0 commit comments

Comments
 (0)