@sixb/cli 0.0.1
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/LICENSE +21 -0
- package/README.md +275 -0
- package/dist/commands/access-token-utils.d.ts +9 -0
- package/dist/commands/access-token-utils.d.ts.map +1 -0
- package/dist/commands/api.d.ts +13 -0
- package/dist/commands/api.d.ts.map +1 -0
- package/dist/commands/app.d.ts +9 -0
- package/dist/commands/app.d.ts.map +1 -0
- package/dist/commands/atlas.d.ts +9 -0
- package/dist/commands/atlas.d.ts.map +1 -0
- package/dist/commands/auth.d.ts +8 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/build.d.ts +6 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/check.d.ts +5 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/db-migrate.d.ts +5 -0
- package/dist/commands/db-migrate.d.ts.map +1 -0
- package/dist/commands/dev.d.ts +12 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/lake-check.d.ts +5 -0
- package/dist/commands/lake-check.d.ts.map +1 -0
- package/dist/commands/lake-cleanup.d.ts +16 -0
- package/dist/commands/lake-cleanup.d.ts.map +1 -0
- package/dist/commands/orchestrator.d.ts +6 -0
- package/dist/commands/orchestrator.d.ts.map +1 -0
- package/dist/commands/rules.d.ts +6 -0
- package/dist/commands/rules.d.ts.map +1 -0
- package/dist/commands/scheduler.d.ts +6 -0
- package/dist/commands/scheduler.d.ts.map +1 -0
- package/dist/commands/service-account.d.ts +14 -0
- package/dist/commands/service-account.d.ts.map +1 -0
- package/dist/commands/token.d.ts +14 -0
- package/dist/commands/token.d.ts.map +1 -0
- package/dist/commands/typegen.d.ts +5 -0
- package/dist/commands/typegen.d.ts.map +1 -0
- package/dist/commands/worker-group.d.ts +8 -0
- package/dist/commands/worker-group.d.ts.map +1 -0
- package/dist/commands/worker.d.ts +8 -0
- package/dist/commands/worker.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/lib/api-client.d.ts +26 -0
- package/dist/lib/api-client.d.ts.map +1 -0
- package/dist/lib/browser-topology.d.ts +62 -0
- package/dist/lib/browser-topology.d.ts.map +1 -0
- package/dist/lib/errors.d.ts +19 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/health.d.ts +25 -0
- package/dist/lib/health.d.ts.map +1 -0
- package/dist/lib/loadSixb.d.ts +49 -0
- package/dist/lib/loadSixb.d.ts.map +1 -0
- package/dist/lib/production-roles.d.ts +65 -0
- package/dist/lib/production-roles.d.ts.map +1 -0
- package/dist/lib/production.d.ts +29 -0
- package/dist/lib/production.d.ts.map +1 -0
- package/dist/lib/public-origin.d.ts +17 -0
- package/dist/lib/public-origin.d.ts.map +1 -0
- package/dist/lib/runtime.d.ts +76 -0
- package/dist/lib/runtime.d.ts.map +1 -0
- package/dist/lib/shareable-providers.d.ts +20 -0
- package/dist/lib/shareable-providers.d.ts.map +1 -0
- package/dist/lib/storage-migration.d.ts +40 -0
- package/dist/lib/storage-migration.d.ts.map +1 -0
- package/dist/lib/typegen.d.ts +5 -0
- package/dist/lib/typegen.d.ts.map +1 -0
- package/dist/lib/worker-registry.d.ts +30 -0
- package/dist/lib/worker-registry.d.ts.map +1 -0
- package/dist/tsconfig.json +5 -0
- package/dist/ui/index.d.ts +164 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/package.json +68 -0
- package/src/commands/access-token-utils.ts +63 -0
- package/src/commands/api.tsx +111 -0
- package/src/commands/app.tsx +91 -0
- package/src/commands/atlas.tsx +75 -0
- package/src/commands/auth.tsx +96 -0
- package/src/commands/build.tsx +90 -0
- package/src/commands/check.tsx +58 -0
- package/src/commands/db-migrate.tsx +27 -0
- package/src/commands/dev.tsx +141 -0
- package/src/commands/init.tsx +18 -0
- package/src/commands/lake-check.tsx +20 -0
- package/src/commands/lake-cleanup.tsx +63 -0
- package/src/commands/orchestrator.tsx +87 -0
- package/src/commands/rules.tsx +81 -0
- package/src/commands/scheduler.tsx +77 -0
- package/src/commands/service-account.tsx +304 -0
- package/src/commands/token.tsx +143 -0
- package/src/commands/typegen.tsx +18 -0
- package/src/commands/worker-group.tsx +120 -0
- package/src/commands/worker.tsx +96 -0
- package/src/index.tsx +390 -0
- package/src/lib/api-client.ts +132 -0
- package/src/lib/browser-topology.ts +292 -0
- package/src/lib/errors.ts +40 -0
- package/src/lib/health.ts +138 -0
- package/src/lib/loadSixb.ts +175 -0
- package/src/lib/production-roles.ts +48 -0
- package/src/lib/production.ts +104 -0
- package/src/lib/public-origin.ts +46 -0
- package/src/lib/runtime.ts +346 -0
- package/src/lib/shareable-providers.ts +67 -0
- package/src/lib/storage-migration.ts +120 -0
- package/src/lib/typegen.ts +12 -0
- package/src/lib/worker-registry.ts +191 -0
- package/src/ui/index.tsx +953 -0
package/src/ui/index.tsx
ADDED
|
@@ -0,0 +1,953 @@
|
|
|
1
|
+
import { Box, render, Text } from "ink"
|
|
2
|
+
import type React from "react"
|
|
3
|
+
import { useEffect, useMemo, useState } from "react"
|
|
4
|
+
import { errorMessage, errorRemediation } from "../lib/errors"
|
|
5
|
+
|
|
6
|
+
// ─── Primitives ──────────────────────────────────────────────────────────────
|
|
7
|
+
|
|
8
|
+
export async function renderStatic(view: React.ReactNode) {
|
|
9
|
+
const app = render(<Box flexDirection="column">{view}</Box>, { exitOnCtrlC: false })
|
|
10
|
+
// Let ink paint, then tear down explicitly. useApp().exit() + waitUntilExit()
|
|
11
|
+
// stopped resolving in ink v6, which caused callers (e.g. `sixb worker`) to
|
|
12
|
+
// hang and never reach their `process.exit(1)`, masking failures with exit 0.
|
|
13
|
+
await new Promise<void>((resolve) => setImmediate(resolve))
|
|
14
|
+
app.unmount()
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function renderPersistent(view: React.ReactNode) {
|
|
18
|
+
return render(view, { exitOnCtrlC: false })
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Renders a caught failure the one way the CLI renders failures, so a remediation carried on
|
|
23
|
+
* the error reaches the terminal without each caller remembering to pass it through.
|
|
24
|
+
*/
|
|
25
|
+
export async function renderCliError(
|
|
26
|
+
error: unknown,
|
|
27
|
+
options: { readonly title?: string; readonly details?: readonly string[] } = {}
|
|
28
|
+
): Promise<void> {
|
|
29
|
+
await renderStatic(
|
|
30
|
+
<ErrorView
|
|
31
|
+
{...(options.title ? { title: options.title } : {})}
|
|
32
|
+
message={errorMessage(error)}
|
|
33
|
+
{...(errorRemediation(error) ? { remediation: errorRemediation(error) } : {})}
|
|
34
|
+
{...(options.details ? { details: options.details } : {})}
|
|
35
|
+
/>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function SectionTitle({ children }: { children: React.ReactNode }) {
|
|
40
|
+
return (
|
|
41
|
+
<Text color="cyan" bold>
|
|
42
|
+
{children}
|
|
43
|
+
</Text>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function Spacer() {
|
|
48
|
+
return <Text> </Text>
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function padLabel(label: string, width: number) {
|
|
52
|
+
if (label.length >= width) return `${label} `
|
|
53
|
+
return label.padEnd(width, " ")
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type KeyValueItem = { label: string; value: string }
|
|
57
|
+
|
|
58
|
+
function isUrl(value: string): boolean {
|
|
59
|
+
return /^(https?|wss?):\/\//.test(value)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function KeyValueList({
|
|
63
|
+
items,
|
|
64
|
+
labelWidth,
|
|
65
|
+
}: {
|
|
66
|
+
items: readonly KeyValueItem[]
|
|
67
|
+
labelWidth?: number
|
|
68
|
+
}) {
|
|
69
|
+
const resolvedWidth = Math.max(labelWidth ?? 0, ...items.map((item) => item.label.length))
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Box flexDirection="column">
|
|
73
|
+
{items.map((item) => (
|
|
74
|
+
<Text key={`${item.label}:${item.value}`}>
|
|
75
|
+
<Text dimColor>{padLabel(item.label, resolvedWidth + 2)}</Text>
|
|
76
|
+
<Text color={isUrl(item.value) ? "cyan" : undefined}>{item.value}</Text>
|
|
77
|
+
</Text>
|
|
78
|
+
))}
|
|
79
|
+
</Box>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function Table({
|
|
84
|
+
headers,
|
|
85
|
+
rows,
|
|
86
|
+
}: {
|
|
87
|
+
headers: readonly string[]
|
|
88
|
+
rows: readonly (readonly string[])[]
|
|
89
|
+
}) {
|
|
90
|
+
const widths = headers.map((header, index) =>
|
|
91
|
+
Math.max(header.length, ...rows.map((row) => row[index]?.length ?? 0))
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return (
|
|
95
|
+
<Box flexDirection="column">
|
|
96
|
+
<Text>
|
|
97
|
+
{headers.map((header, index) => (
|
|
98
|
+
<Text key={`${index}:${header}`} bold>
|
|
99
|
+
{padLabel(header, widths[index] ?? header.length)}
|
|
100
|
+
{index === headers.length - 1 ? "" : " "}
|
|
101
|
+
</Text>
|
|
102
|
+
))}
|
|
103
|
+
</Text>
|
|
104
|
+
<Text dimColor>{widths.map((width) => "-".repeat(width)).join(" ")}</Text>
|
|
105
|
+
{rows.map((row, rowIndex) => (
|
|
106
|
+
<Text key={`${rowIndex}:${row.join(":")}`}>
|
|
107
|
+
{row.map((value, index) => (
|
|
108
|
+
<Text key={`${index}:${value}`}>
|
|
109
|
+
{padLabel(value, widths[index] ?? value.length)}
|
|
110
|
+
{index === row.length - 1 ? "" : " "}
|
|
111
|
+
</Text>
|
|
112
|
+
))}
|
|
113
|
+
</Text>
|
|
114
|
+
))}
|
|
115
|
+
</Box>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function Panel({
|
|
120
|
+
title,
|
|
121
|
+
meta,
|
|
122
|
+
borderColor = "gray",
|
|
123
|
+
children,
|
|
124
|
+
}: {
|
|
125
|
+
title: string
|
|
126
|
+
meta?: React.ReactNode
|
|
127
|
+
borderColor?: string
|
|
128
|
+
children: React.ReactNode
|
|
129
|
+
}) {
|
|
130
|
+
return (
|
|
131
|
+
<Box flexDirection="column" borderStyle="round" borderColor={borderColor} paddingX={1}>
|
|
132
|
+
<Box justifyContent="space-between">
|
|
133
|
+
<Text bold>{title}</Text>
|
|
134
|
+
{meta ? <Box>{meta}</Box> : null}
|
|
135
|
+
</Box>
|
|
136
|
+
<Spacer />
|
|
137
|
+
{children}
|
|
138
|
+
</Box>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function KeyValueResultView({
|
|
143
|
+
title,
|
|
144
|
+
subtitle,
|
|
145
|
+
items,
|
|
146
|
+
titleColor = "green",
|
|
147
|
+
message,
|
|
148
|
+
}: {
|
|
149
|
+
title: string
|
|
150
|
+
subtitle?: string
|
|
151
|
+
items: readonly KeyValueItem[]
|
|
152
|
+
titleColor?: string
|
|
153
|
+
message?: string
|
|
154
|
+
}) {
|
|
155
|
+
return (
|
|
156
|
+
<Box flexDirection="column">
|
|
157
|
+
<Text color={titleColor} bold>
|
|
158
|
+
{title}
|
|
159
|
+
</Text>
|
|
160
|
+
{subtitle ? <Text dimColor>{subtitle}</Text> : null}
|
|
161
|
+
<Spacer />
|
|
162
|
+
<KeyValueList items={items} />
|
|
163
|
+
{message ? (
|
|
164
|
+
<>
|
|
165
|
+
<Spacer />
|
|
166
|
+
<Text dimColor>{message}</Text>
|
|
167
|
+
</>
|
|
168
|
+
) : null}
|
|
169
|
+
</Box>
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export function TableResultView({
|
|
174
|
+
title,
|
|
175
|
+
subtitle,
|
|
176
|
+
headers,
|
|
177
|
+
rows,
|
|
178
|
+
emptyMessage,
|
|
179
|
+
}: {
|
|
180
|
+
title: string
|
|
181
|
+
subtitle?: string
|
|
182
|
+
headers: readonly string[]
|
|
183
|
+
rows: readonly (readonly string[])[]
|
|
184
|
+
emptyMessage: string
|
|
185
|
+
}) {
|
|
186
|
+
return (
|
|
187
|
+
<Box flexDirection="column">
|
|
188
|
+
<Text color="green" bold>
|
|
189
|
+
{title}
|
|
190
|
+
</Text>
|
|
191
|
+
{subtitle ? <Text dimColor>{subtitle}</Text> : null}
|
|
192
|
+
<Spacer />
|
|
193
|
+
{rows.length > 0 ? (
|
|
194
|
+
<Table headers={headers} rows={rows} />
|
|
195
|
+
) : (
|
|
196
|
+
<Text dimColor>{emptyMessage}</Text>
|
|
197
|
+
)}
|
|
198
|
+
</Box>
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function SecretResultView({
|
|
203
|
+
title,
|
|
204
|
+
subtitle,
|
|
205
|
+
items,
|
|
206
|
+
secretLabel = "Token",
|
|
207
|
+
secret,
|
|
208
|
+
message = "Store this token now. Sixb will not show it again.",
|
|
209
|
+
}: {
|
|
210
|
+
title: string
|
|
211
|
+
subtitle?: string
|
|
212
|
+
items: readonly KeyValueItem[]
|
|
213
|
+
secretLabel?: string
|
|
214
|
+
secret: string
|
|
215
|
+
message?: string
|
|
216
|
+
}) {
|
|
217
|
+
return (
|
|
218
|
+
<Box flexDirection="column">
|
|
219
|
+
<Text color="green" bold>
|
|
220
|
+
{title}
|
|
221
|
+
</Text>
|
|
222
|
+
{subtitle ? <Text dimColor>{subtitle}</Text> : null}
|
|
223
|
+
<Spacer />
|
|
224
|
+
<KeyValueList items={items} />
|
|
225
|
+
<Spacer />
|
|
226
|
+
<Panel title={secretLabel} borderColor="yellow">
|
|
227
|
+
<Text>{secret}</Text>
|
|
228
|
+
</Panel>
|
|
229
|
+
{message ? (
|
|
230
|
+
<>
|
|
231
|
+
<Spacer />
|
|
232
|
+
<Text dimColor>{message}</Text>
|
|
233
|
+
</>
|
|
234
|
+
) : null}
|
|
235
|
+
</Box>
|
|
236
|
+
)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function ServicePanel({ name, items }: { name: string; items: KeyValueItem[] }) {
|
|
240
|
+
return (
|
|
241
|
+
<Box flexDirection="column">
|
|
242
|
+
<Text bold>{name}</Text>
|
|
243
|
+
<KeyValueList items={items} labelWidth={10} />
|
|
244
|
+
</Box>
|
|
245
|
+
)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* What the role did to the storage schema at startup, worded the same way by every
|
|
250
|
+
* role. Absent when there was nothing to report, so a runtime without migrators does
|
|
251
|
+
* not grow a panel that says nothing.
|
|
252
|
+
*/
|
|
253
|
+
function StoragePanel({ summary }: { summary?: string | null }) {
|
|
254
|
+
if (!summary) return null
|
|
255
|
+
|
|
256
|
+
return (
|
|
257
|
+
<>
|
|
258
|
+
<Spacer />
|
|
259
|
+
<ServicePanel name="Storage" items={[{ label: "Schema", value: summary }]} />
|
|
260
|
+
</>
|
|
261
|
+
)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function BulletList({ items, dim = false }: { items: readonly string[]; dim?: boolean }) {
|
|
265
|
+
return (
|
|
266
|
+
<Box flexDirection="column">
|
|
267
|
+
{items.map((item, index) => (
|
|
268
|
+
<Text key={`${index}:${item}`} dimColor={dim}>
|
|
269
|
+
- {item}
|
|
270
|
+
</Text>
|
|
271
|
+
))}
|
|
272
|
+
</Box>
|
|
273
|
+
)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function Spinner({ label }: { label: string }) {
|
|
277
|
+
const frames = useMemo(() => ["|", "/", "-", "\\"], [])
|
|
278
|
+
const [index, setIndex] = useState(0)
|
|
279
|
+
|
|
280
|
+
useEffect(() => {
|
|
281
|
+
const timer = setInterval(() => {
|
|
282
|
+
setIndex((current) => (current + 1) % frames.length)
|
|
283
|
+
}, 80)
|
|
284
|
+
|
|
285
|
+
return () => clearInterval(timer)
|
|
286
|
+
}, [frames.length])
|
|
287
|
+
|
|
288
|
+
return (
|
|
289
|
+
<Text>
|
|
290
|
+
<Text color="cyan">{frames[index]}</Text> {label}
|
|
291
|
+
</Text>
|
|
292
|
+
)
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// ─── Views ───────────────────────────────────────────────────────────────────
|
|
296
|
+
|
|
297
|
+
export function LoadingView({
|
|
298
|
+
title,
|
|
299
|
+
subtitle,
|
|
300
|
+
status,
|
|
301
|
+
}: {
|
|
302
|
+
title: string
|
|
303
|
+
subtitle?: string
|
|
304
|
+
status: string
|
|
305
|
+
}) {
|
|
306
|
+
return (
|
|
307
|
+
<Box flexDirection="column">
|
|
308
|
+
<Text color="green" bold>
|
|
309
|
+
{title}
|
|
310
|
+
</Text>
|
|
311
|
+
{subtitle ? <Text dimColor>{subtitle}</Text> : null}
|
|
312
|
+
<Spacer />
|
|
313
|
+
<Text dimColor>Booting services</Text>
|
|
314
|
+
<Spinner label={status} />
|
|
315
|
+
</Box>
|
|
316
|
+
)
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export function HelpView({ errorMessage }: { errorMessage?: string }) {
|
|
320
|
+
return (
|
|
321
|
+
<Box flexDirection="column">
|
|
322
|
+
<Text color="cyan" bold>
|
|
323
|
+
sixb
|
|
324
|
+
</Text>
|
|
325
|
+
<Text dimColor>Real-time digital twin framework</Text>
|
|
326
|
+
{errorMessage ? (
|
|
327
|
+
<>
|
|
328
|
+
<Spacer />
|
|
329
|
+
<Text color="red">{errorMessage}</Text>
|
|
330
|
+
</>
|
|
331
|
+
) : null}
|
|
332
|
+
<Spacer />
|
|
333
|
+
<SectionTitle>Usage</SectionTitle>
|
|
334
|
+
<Text> sixb {"<command>"} [options]</Text>
|
|
335
|
+
<Spacer />
|
|
336
|
+
<SectionTitle>Commands</SectionTitle>
|
|
337
|
+
<KeyValueList
|
|
338
|
+
labelWidth={22}
|
|
339
|
+
items={[
|
|
340
|
+
{ label: "dev", value: "Start local development (server + built-in UI + app)" },
|
|
341
|
+
{ label: "api", value: "Start production API/docs/WebSocket server" },
|
|
342
|
+
{ label: "atlas", value: "Start production Atlas UI server" },
|
|
343
|
+
{ label: "app", value: "Start production custom app server" },
|
|
344
|
+
{ label: "auth status", value: "Check API token authentication" },
|
|
345
|
+
{ label: "token list", value: "List personal access tokens" },
|
|
346
|
+
{ label: "token create", value: "Create a personal access token" },
|
|
347
|
+
{ label: "token revoke <id>", value: "Revoke a personal access token" },
|
|
348
|
+
{ label: "service-account list", value: "List service accounts" },
|
|
349
|
+
{ label: "service-account create", value: "Create a service account" },
|
|
350
|
+
{ label: "service-account disable", value: "Disable a service account" },
|
|
351
|
+
{
|
|
352
|
+
label: "service-account token",
|
|
353
|
+
value: "List, create, or revoke service-account tokens",
|
|
354
|
+
},
|
|
355
|
+
{ label: "scheduler", value: "Start production scheduler event producer" },
|
|
356
|
+
{ label: "orchestrator", value: "Start production event-to-queue dispatcher" },
|
|
357
|
+
{ label: "rules", value: "Start production rules runtime" },
|
|
358
|
+
{
|
|
359
|
+
label: "worker <type>",
|
|
360
|
+
value:
|
|
361
|
+
"Start production queue worker: sync, action, agent, pipeline, projection, workflow",
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
label: "worker-group [types...]",
|
|
365
|
+
value: "Co-host multiple queue workers in one process (constrained resources)",
|
|
366
|
+
},
|
|
367
|
+
{ label: "check", value: "Validate project configuration and health" },
|
|
368
|
+
{ label: "typegen", value: "Generate ontology types for client query inference" },
|
|
369
|
+
{ label: "build", value: "Build runtime and production UI/app assets" },
|
|
370
|
+
{ label: "db migrate", value: "Run adapter-owned database migrations ahead of a role" },
|
|
371
|
+
{ label: "lake check", value: "Check lake dataset definitions for drift" },
|
|
372
|
+
{ label: "lake cleanup", value: "Run lake storage maintenance cleanup" },
|
|
373
|
+
{ label: "init [dir]", value: "Initialize sixb project in directory" },
|
|
374
|
+
{ label: "create <name>", value: "Create a new sixb project" },
|
|
375
|
+
]}
|
|
376
|
+
/>
|
|
377
|
+
<Spacer />
|
|
378
|
+
<SectionTitle>Options</SectionTitle>
|
|
379
|
+
<KeyValueList
|
|
380
|
+
labelWidth={22}
|
|
381
|
+
items={[
|
|
382
|
+
{ label: "--entry <path>", value: "Entry file (default: sixb.config.ts)" },
|
|
383
|
+
{
|
|
384
|
+
label: "--no-migrate",
|
|
385
|
+
value: "Start a role without migrating storage (or SIXB_SKIP_MIGRATION=1)",
|
|
386
|
+
},
|
|
387
|
+
{ label: "--port <port>", value: "Role port; dev uses Atlas base port" },
|
|
388
|
+
{
|
|
389
|
+
label: "--host <host>",
|
|
390
|
+
value: "Bind host (dev: 127.0.0.1, production roles: 0.0.0.0)",
|
|
391
|
+
},
|
|
392
|
+
{ label: "--api-port <port>", value: "API port (default: Atlas port + 2)" },
|
|
393
|
+
{ label: "--api-host <host>", value: "API bind host (default: --host)" },
|
|
394
|
+
{ label: "--api-public-origin <origin>", value: "Public API origin" },
|
|
395
|
+
{ label: "--atlas-public-origin <origin>", value: "Public Atlas origin" },
|
|
396
|
+
{ label: "--app-public-origin <origin>", value: "Public custom app origin" },
|
|
397
|
+
{ label: "--api-url <url>", value: "API origin for auth/token commands" },
|
|
398
|
+
{ label: "--token <token>", value: "API token for auth/token commands" },
|
|
399
|
+
{ label: "--name <name>", value: "Token or service-account name" },
|
|
400
|
+
{ label: "--description <text>", value: "Service-account description" },
|
|
401
|
+
{ label: "--expires-in <duration>", value: "Token lifetime, e.g. 30d or 1y" },
|
|
402
|
+
{ label: "--expires-at <iso>", value: "Token expiration timestamp" },
|
|
403
|
+
{ label: "--group <id>", value: "Assignable token group; may repeat" },
|
|
404
|
+
{ label: "--json", value: "Print JSON for auth/token commands" },
|
|
405
|
+
{ label: "--outdir <path>", value: "Build output directory" },
|
|
406
|
+
{ label: "--dry-run", value: "Preview lake cleanup without changing storage" },
|
|
407
|
+
{ label: "--expire-older-than <interval>", value: "Lake snapshot expiration window" },
|
|
408
|
+
{ label: "--delete-older-than <interval>", value: "Lake file deletion window" },
|
|
409
|
+
{ label: "--help", value: "Show this help message" },
|
|
410
|
+
{ label: "--version", value: "Show version" },
|
|
411
|
+
]}
|
|
412
|
+
/>
|
|
413
|
+
<Spacer />
|
|
414
|
+
<SectionTitle>Examples</SectionTitle>
|
|
415
|
+
<BulletList
|
|
416
|
+
dim
|
|
417
|
+
items={[
|
|
418
|
+
"sixb dev",
|
|
419
|
+
"sixb build",
|
|
420
|
+
"sixb api",
|
|
421
|
+
"SIXB_API_URL=http://localhost:3002 SIXB_API_TOKEN=sixb_pat_... sixb token list",
|
|
422
|
+
"sixb token create --name 'Local CLI' --expires-in 90d",
|
|
423
|
+
"sixb service-account create --id svc_sandbox --name 'Sandbox agent' --group agents",
|
|
424
|
+
"sixb service-account token create svc_sandbox --name 'Sandbox token' --expires-in 30d",
|
|
425
|
+
"sixb auth status",
|
|
426
|
+
"sixb atlas",
|
|
427
|
+
"sixb app",
|
|
428
|
+
"sixb scheduler",
|
|
429
|
+
"sixb orchestrator",
|
|
430
|
+
"sixb rules",
|
|
431
|
+
"sixb worker pipeline",
|
|
432
|
+
"sixb worker workflow",
|
|
433
|
+
"sixb worker-group sync pipeline projection",
|
|
434
|
+
"sixb dev --entry examples/mac-os/sixb.config.ts --port 8080",
|
|
435
|
+
"sixb check",
|
|
436
|
+
"sixb typegen",
|
|
437
|
+
"sixb db migrate",
|
|
438
|
+
"sixb lake check",
|
|
439
|
+
"sixb lake cleanup --dry-run",
|
|
440
|
+
"sixb create my-project",
|
|
441
|
+
]}
|
|
442
|
+
/>
|
|
443
|
+
</Box>
|
|
444
|
+
)
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
export function VersionView({ version }: { version: string }) {
|
|
448
|
+
return <Text>{version}</Text>
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
export function ErrorView({
|
|
452
|
+
title = "Error",
|
|
453
|
+
message,
|
|
454
|
+
remediation,
|
|
455
|
+
details = [],
|
|
456
|
+
}: {
|
|
457
|
+
title?: string
|
|
458
|
+
message: string
|
|
459
|
+
/** What to do next. Rendered apart from the diagnosis, not appended to it. */
|
|
460
|
+
remediation?: string
|
|
461
|
+
details?: readonly string[]
|
|
462
|
+
}) {
|
|
463
|
+
return (
|
|
464
|
+
<Box flexDirection="column">
|
|
465
|
+
<Text color="red" bold>
|
|
466
|
+
{title}
|
|
467
|
+
</Text>
|
|
468
|
+
<Spacer />
|
|
469
|
+
<Panel title="Failure" borderColor="red">
|
|
470
|
+
<Text>{message}</Text>
|
|
471
|
+
</Panel>
|
|
472
|
+
{remediation ? (
|
|
473
|
+
<>
|
|
474
|
+
<Spacer />
|
|
475
|
+
<SectionTitle>Try this</SectionTitle>
|
|
476
|
+
<Text>{remediation}</Text>
|
|
477
|
+
</>
|
|
478
|
+
) : null}
|
|
479
|
+
{details.length > 0 ? (
|
|
480
|
+
<>
|
|
481
|
+
<Spacer />
|
|
482
|
+
<SectionTitle>Details</SectionTitle>
|
|
483
|
+
<BulletList items={details} />
|
|
484
|
+
</>
|
|
485
|
+
) : null}
|
|
486
|
+
</Box>
|
|
487
|
+
)
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export function DevView({
|
|
491
|
+
name,
|
|
492
|
+
apiUrl,
|
|
493
|
+
apiDocsUrl,
|
|
494
|
+
wsUrl,
|
|
495
|
+
uiUrl,
|
|
496
|
+
uiStatus,
|
|
497
|
+
appUrl,
|
|
498
|
+
mqttUrl,
|
|
499
|
+
warnings = [],
|
|
500
|
+
}: {
|
|
501
|
+
name: string
|
|
502
|
+
apiUrl: string
|
|
503
|
+
apiDocsUrl: string
|
|
504
|
+
wsUrl: string
|
|
505
|
+
uiUrl: string | null
|
|
506
|
+
uiStatus: string | null
|
|
507
|
+
appUrl?: string | null
|
|
508
|
+
mqttUrl: string | null
|
|
509
|
+
warnings?: readonly string[]
|
|
510
|
+
}) {
|
|
511
|
+
const serverItems: KeyValueItem[] = [
|
|
512
|
+
{ label: "API", value: apiUrl },
|
|
513
|
+
{ label: "API docs", value: apiDocsUrl },
|
|
514
|
+
{ label: "Events", value: wsUrl },
|
|
515
|
+
]
|
|
516
|
+
if (uiUrl) {
|
|
517
|
+
serverItems.push({ label: "Atlas UI", value: uiUrl })
|
|
518
|
+
} else if (uiStatus) {
|
|
519
|
+
serverItems.push({ label: "Atlas UI", value: uiStatus })
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
return (
|
|
523
|
+
<Box flexDirection="column">
|
|
524
|
+
<Text bold>sixb dev</Text>
|
|
525
|
+
<Text dimColor>{name}</Text>
|
|
526
|
+
<Spacer />
|
|
527
|
+
<ServicePanel name="Server" items={serverItems} />
|
|
528
|
+
{appUrl ? (
|
|
529
|
+
<>
|
|
530
|
+
<Spacer />
|
|
531
|
+
<ServicePanel name="Custom app" items={[{ label: "URL", value: appUrl }]} />
|
|
532
|
+
</>
|
|
533
|
+
) : null}
|
|
534
|
+
{mqttUrl ? (
|
|
535
|
+
<>
|
|
536
|
+
<Spacer />
|
|
537
|
+
<ServicePanel name="MQTT" items={[{ label: "Broker", value: mqttUrl }]} />
|
|
538
|
+
</>
|
|
539
|
+
) : null}
|
|
540
|
+
{warnings.length > 0 ? (
|
|
541
|
+
<>
|
|
542
|
+
<Spacer />
|
|
543
|
+
<Text color="yellow" bold>
|
|
544
|
+
Warnings
|
|
545
|
+
</Text>
|
|
546
|
+
<BulletList items={warnings} />
|
|
547
|
+
</>
|
|
548
|
+
) : null}
|
|
549
|
+
<Spacer />
|
|
550
|
+
<Text dimColor>ctrl+c to stop</Text>
|
|
551
|
+
</Box>
|
|
552
|
+
)
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
export function StartView({
|
|
556
|
+
name,
|
|
557
|
+
apiUrl,
|
|
558
|
+
apiDocsUrl,
|
|
559
|
+
wsUrl,
|
|
560
|
+
uiUrl,
|
|
561
|
+
uiStatus,
|
|
562
|
+
appUrl,
|
|
563
|
+
warnings = [],
|
|
564
|
+
}: {
|
|
565
|
+
name: string
|
|
566
|
+
apiUrl: string
|
|
567
|
+
apiDocsUrl: string
|
|
568
|
+
wsUrl: string
|
|
569
|
+
uiUrl: string | null
|
|
570
|
+
uiStatus?: string | null
|
|
571
|
+
appUrl?: string | null
|
|
572
|
+
warnings?: readonly string[]
|
|
573
|
+
}) {
|
|
574
|
+
const serverItems: KeyValueItem[] = [
|
|
575
|
+
{ label: "API", value: apiUrl },
|
|
576
|
+
{ label: "API docs", value: apiDocsUrl },
|
|
577
|
+
{ label: "Events", value: wsUrl },
|
|
578
|
+
]
|
|
579
|
+
if (uiUrl) {
|
|
580
|
+
serverItems.push({ label: "Atlas UI", value: uiUrl })
|
|
581
|
+
} else if (uiStatus) {
|
|
582
|
+
serverItems.push({ label: "Atlas UI", value: uiStatus })
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
return (
|
|
586
|
+
<Box flexDirection="column">
|
|
587
|
+
<Text color="green" bold>
|
|
588
|
+
Sixb started
|
|
589
|
+
</Text>
|
|
590
|
+
<Text dimColor>{name}</Text>
|
|
591
|
+
<Spacer />
|
|
592
|
+
<ServicePanel name="Server" items={serverItems} />
|
|
593
|
+
{appUrl ? (
|
|
594
|
+
<>
|
|
595
|
+
<Spacer />
|
|
596
|
+
<ServicePanel name="Custom app" items={[{ label: "URL", value: appUrl }]} />
|
|
597
|
+
</>
|
|
598
|
+
) : null}
|
|
599
|
+
{warnings.length > 0 ? (
|
|
600
|
+
<>
|
|
601
|
+
<Spacer />
|
|
602
|
+
<SectionTitle>Warnings</SectionTitle>
|
|
603
|
+
<BulletList items={warnings} />
|
|
604
|
+
</>
|
|
605
|
+
) : null}
|
|
606
|
+
<Spacer />
|
|
607
|
+
<Text dimColor>Press Ctrl+C to stop</Text>
|
|
608
|
+
</Box>
|
|
609
|
+
)
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
export function WorkerView({
|
|
613
|
+
name,
|
|
614
|
+
workerId,
|
|
615
|
+
storage,
|
|
616
|
+
warnings = [],
|
|
617
|
+
}: {
|
|
618
|
+
name: string
|
|
619
|
+
workerId: string
|
|
620
|
+
storage?: string | null
|
|
621
|
+
warnings?: readonly string[]
|
|
622
|
+
}) {
|
|
623
|
+
return (
|
|
624
|
+
<Box flexDirection="column">
|
|
625
|
+
<Text color="green" bold>
|
|
626
|
+
Sixb worker started
|
|
627
|
+
</Text>
|
|
628
|
+
<Text dimColor>{name}</Text>
|
|
629
|
+
<Spacer />
|
|
630
|
+
<ServicePanel name="Worker" items={[{ label: "ID", value: workerId }]} />
|
|
631
|
+
<StoragePanel summary={storage} />
|
|
632
|
+
{warnings.length > 0 ? (
|
|
633
|
+
<>
|
|
634
|
+
<Spacer />
|
|
635
|
+
<SectionTitle>Warnings</SectionTitle>
|
|
636
|
+
<BulletList items={warnings} />
|
|
637
|
+
</>
|
|
638
|
+
) : null}
|
|
639
|
+
<Spacer />
|
|
640
|
+
<Text dimColor>Press Ctrl+C to stop</Text>
|
|
641
|
+
</Box>
|
|
642
|
+
)
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export function WorkerGroupView({
|
|
646
|
+
name,
|
|
647
|
+
workerTypes,
|
|
648
|
+
storage,
|
|
649
|
+
warnings = [],
|
|
650
|
+
}: {
|
|
651
|
+
name: string
|
|
652
|
+
workerTypes: readonly string[]
|
|
653
|
+
storage?: string | null
|
|
654
|
+
warnings?: readonly string[]
|
|
655
|
+
}) {
|
|
656
|
+
return (
|
|
657
|
+
<Box flexDirection="column">
|
|
658
|
+
<Text color="green" bold>
|
|
659
|
+
Sixb worker group started
|
|
660
|
+
</Text>
|
|
661
|
+
<Text dimColor>{name}</Text>
|
|
662
|
+
<Spacer />
|
|
663
|
+
<ServicePanel
|
|
664
|
+
name="Workers"
|
|
665
|
+
items={workerTypes.map((workerType) => ({ label: workerType, value: "running" }))}
|
|
666
|
+
/>
|
|
667
|
+
<StoragePanel summary={storage} />
|
|
668
|
+
{warnings.length > 0 ? (
|
|
669
|
+
<>
|
|
670
|
+
<Spacer />
|
|
671
|
+
<SectionTitle>Warnings</SectionTitle>
|
|
672
|
+
<BulletList items={warnings} />
|
|
673
|
+
</>
|
|
674
|
+
) : null}
|
|
675
|
+
<Spacer />
|
|
676
|
+
<Text dimColor>Press Ctrl+C to stop</Text>
|
|
677
|
+
</Box>
|
|
678
|
+
)
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
export function RoleView({
|
|
682
|
+
title,
|
|
683
|
+
name,
|
|
684
|
+
serviceName,
|
|
685
|
+
items,
|
|
686
|
+
storage,
|
|
687
|
+
warnings = [],
|
|
688
|
+
}: {
|
|
689
|
+
title: string
|
|
690
|
+
name: string
|
|
691
|
+
serviceName: string
|
|
692
|
+
items: KeyValueItem[]
|
|
693
|
+
storage?: string | null
|
|
694
|
+
warnings?: readonly string[]
|
|
695
|
+
}) {
|
|
696
|
+
return (
|
|
697
|
+
<Box flexDirection="column">
|
|
698
|
+
<Text color="green" bold>
|
|
699
|
+
{title}
|
|
700
|
+
</Text>
|
|
701
|
+
<Text dimColor>{name}</Text>
|
|
702
|
+
<Spacer />
|
|
703
|
+
<ServicePanel name={serviceName} items={items} />
|
|
704
|
+
<StoragePanel summary={storage} />
|
|
705
|
+
{warnings.length > 0 ? (
|
|
706
|
+
<>
|
|
707
|
+
<Spacer />
|
|
708
|
+
<SectionTitle>Warnings</SectionTitle>
|
|
709
|
+
<BulletList items={warnings} />
|
|
710
|
+
</>
|
|
711
|
+
) : null}
|
|
712
|
+
<Spacer />
|
|
713
|
+
<Text dimColor>Press Ctrl+C to stop</Text>
|
|
714
|
+
</Box>
|
|
715
|
+
)
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
export function CheckView({
|
|
719
|
+
projectId,
|
|
720
|
+
storage,
|
|
721
|
+
timeseries,
|
|
722
|
+
broker,
|
|
723
|
+
queues,
|
|
724
|
+
projectValidation,
|
|
725
|
+
ontology,
|
|
726
|
+
warnings,
|
|
727
|
+
}: {
|
|
728
|
+
projectId: string
|
|
729
|
+
storage: { ok: boolean; message?: string }
|
|
730
|
+
timeseries: { ok: boolean; message?: string }
|
|
731
|
+
broker: { ok: boolean; message?: string }
|
|
732
|
+
queues: { ok: boolean; message?: string }
|
|
733
|
+
projectValidation?: { ok: boolean; message?: string }
|
|
734
|
+
ontology?: { enabled: boolean; source: string; errors: number; warnings: number }
|
|
735
|
+
warnings: readonly string[]
|
|
736
|
+
}) {
|
|
737
|
+
const validation = projectValidation ?? { ok: true, message: "ok" }
|
|
738
|
+
const ontologyOk = (ontology?.errors ?? 0) === 0
|
|
739
|
+
const allOk = [storage, timeseries, broker, queues, validation].every((row) => row.ok)
|
|
740
|
+
const healthy = allOk && ontologyOk
|
|
741
|
+
|
|
742
|
+
// The message wins when there is one, pass or fail: a probe that succeeded still says which
|
|
743
|
+
// provider answered and whether its schema is current.
|
|
744
|
+
function statusText(row: { ok: boolean; message?: string }): string {
|
|
745
|
+
return row.message ?? (row.ok ? "ok" : "failed")
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
function statusColor(ok: boolean): string {
|
|
749
|
+
return ok ? "green" : "red"
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
return (
|
|
753
|
+
<Box flexDirection="column">
|
|
754
|
+
<Text color={healthy ? "green" : "red"} bold>
|
|
755
|
+
{healthy ? "Sixb is healthy" : "Sixb has issues"}
|
|
756
|
+
</Text>
|
|
757
|
+
<Text dimColor>{projectId}</Text>
|
|
758
|
+
<Spacer />
|
|
759
|
+
<SectionTitle>Providers</SectionTitle>
|
|
760
|
+
<Box flexDirection="column">
|
|
761
|
+
<Text>
|
|
762
|
+
<Text dimColor>{padLabel("Storage", 14)}</Text>
|
|
763
|
+
<Text color={statusColor(storage.ok)}>{statusText(storage)}</Text>
|
|
764
|
+
</Text>
|
|
765
|
+
<Text>
|
|
766
|
+
<Text dimColor>{padLabel("Timeseries", 14)}</Text>
|
|
767
|
+
<Text color={statusColor(timeseries.ok)}>{statusText(timeseries)}</Text>
|
|
768
|
+
</Text>
|
|
769
|
+
<Text>
|
|
770
|
+
<Text dimColor>{padLabel("Broker", 14)}</Text>
|
|
771
|
+
<Text color={statusColor(broker.ok)}>{statusText(broker)}</Text>
|
|
772
|
+
</Text>
|
|
773
|
+
<Text>
|
|
774
|
+
<Text dimColor>{padLabel("Queues", 14)}</Text>
|
|
775
|
+
<Text color={statusColor(queues.ok)}>{statusText(queues)}</Text>
|
|
776
|
+
</Text>
|
|
777
|
+
<Text>
|
|
778
|
+
<Text dimColor>{padLabel("Project", 14)}</Text>
|
|
779
|
+
<Text color={statusColor(validation.ok)}>{statusText(validation)}</Text>
|
|
780
|
+
</Text>
|
|
781
|
+
</Box>
|
|
782
|
+
{ontology ? (
|
|
783
|
+
<>
|
|
784
|
+
<Spacer />
|
|
785
|
+
<SectionTitle>Ontology</SectionTitle>
|
|
786
|
+
<KeyValueList
|
|
787
|
+
items={[
|
|
788
|
+
{ label: "Source", value: ontology.source },
|
|
789
|
+
{ label: "Errors", value: String(ontology.errors) },
|
|
790
|
+
{ label: "Warnings", value: String(ontology.warnings) },
|
|
791
|
+
]}
|
|
792
|
+
/>
|
|
793
|
+
</>
|
|
794
|
+
) : null}
|
|
795
|
+
{warnings.length > 0 ? (
|
|
796
|
+
<>
|
|
797
|
+
<Spacer />
|
|
798
|
+
<SectionTitle>Warnings</SectionTitle>
|
|
799
|
+
<BulletList items={warnings} />
|
|
800
|
+
</>
|
|
801
|
+
) : null}
|
|
802
|
+
</Box>
|
|
803
|
+
)
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
export function BuildView({ entry, outdir }: { entry: string; outdir: string }) {
|
|
807
|
+
return (
|
|
808
|
+
<Box flexDirection="column">
|
|
809
|
+
<Text color="green" bold>
|
|
810
|
+
Built
|
|
811
|
+
</Text>
|
|
812
|
+
<Spacer />
|
|
813
|
+
<KeyValueList
|
|
814
|
+
items={[
|
|
815
|
+
{ label: "Entry", value: entry },
|
|
816
|
+
{ label: "Output", value: outdir },
|
|
817
|
+
]}
|
|
818
|
+
/>
|
|
819
|
+
</Box>
|
|
820
|
+
)
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
export function TypegenView({
|
|
824
|
+
path,
|
|
825
|
+
objectTypes,
|
|
826
|
+
skipped,
|
|
827
|
+
written,
|
|
828
|
+
}: {
|
|
829
|
+
path: string
|
|
830
|
+
objectTypes: number
|
|
831
|
+
skipped: boolean
|
|
832
|
+
written: boolean
|
|
833
|
+
}) {
|
|
834
|
+
return (
|
|
835
|
+
<Box flexDirection="column">
|
|
836
|
+
<Text color="green" bold>
|
|
837
|
+
Ontology types {skipped ? "skipped" : written ? "generated" : "current"}
|
|
838
|
+
</Text>
|
|
839
|
+
<Spacer />
|
|
840
|
+
<KeyValueList
|
|
841
|
+
items={[
|
|
842
|
+
{ label: "Output", value: path },
|
|
843
|
+
{ label: "Object types", value: String(objectTypes) },
|
|
844
|
+
]}
|
|
845
|
+
/>
|
|
846
|
+
</Box>
|
|
847
|
+
)
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
export function DbMigrateView({
|
|
851
|
+
projectId,
|
|
852
|
+
status,
|
|
853
|
+
applied = [],
|
|
854
|
+
}: {
|
|
855
|
+
projectId: string
|
|
856
|
+
status: "migrated" | "current" | "skipped"
|
|
857
|
+
/** Migration step ids this run applied, named so the output can be checked. */
|
|
858
|
+
applied?: readonly string[]
|
|
859
|
+
}) {
|
|
860
|
+
return (
|
|
861
|
+
<Box flexDirection="column">
|
|
862
|
+
<Text color="green" bold>
|
|
863
|
+
Database migrations complete
|
|
864
|
+
</Text>
|
|
865
|
+
<Text dimColor>{projectId}</Text>
|
|
866
|
+
<Spacer />
|
|
867
|
+
<KeyValueList items={[{ label: "Storage", value: status }]} />
|
|
868
|
+
{applied.length > 0 ? (
|
|
869
|
+
<>
|
|
870
|
+
<Spacer />
|
|
871
|
+
<SectionTitle>Applied</SectionTitle>
|
|
872
|
+
<BulletList items={applied} />
|
|
873
|
+
</>
|
|
874
|
+
) : null}
|
|
875
|
+
</Box>
|
|
876
|
+
)
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
export function LakeCheckView({ projectId, status }: { projectId: string; status: "ok" }) {
|
|
880
|
+
return (
|
|
881
|
+
<Box flexDirection="column">
|
|
882
|
+
<Text color="green" bold>
|
|
883
|
+
Lake definitions compatible
|
|
884
|
+
</Text>
|
|
885
|
+
<Text dimColor>{projectId}</Text>
|
|
886
|
+
<Spacer />
|
|
887
|
+
<KeyValueList items={[{ label: "Lake", value: status }]} />
|
|
888
|
+
</Box>
|
|
889
|
+
)
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
export interface LakeCleanupReport {
|
|
893
|
+
readonly dryRun: boolean
|
|
894
|
+
readonly expireOlderThan: string
|
|
895
|
+
readonly deleteOlderThan: string
|
|
896
|
+
readonly snapshots: number
|
|
897
|
+
readonly oldFiles: number
|
|
898
|
+
readonly orphanedFiles: number
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
export function LakeCleanupView({
|
|
902
|
+
projectId,
|
|
903
|
+
report,
|
|
904
|
+
}: {
|
|
905
|
+
projectId: string
|
|
906
|
+
report: LakeCleanupReport
|
|
907
|
+
}) {
|
|
908
|
+
return (
|
|
909
|
+
<Box flexDirection="column">
|
|
910
|
+
<Text color="green" bold>
|
|
911
|
+
{report.dryRun ? "Lake cleanup dry run complete" : "Lake cleanup complete"}
|
|
912
|
+
</Text>
|
|
913
|
+
<Text dimColor>{projectId}</Text>
|
|
914
|
+
<Spacer />
|
|
915
|
+
<KeyValueList
|
|
916
|
+
items={[
|
|
917
|
+
{ label: "Dry run", value: String(report.dryRun) },
|
|
918
|
+
{ label: "Expire older than", value: report.expireOlderThan },
|
|
919
|
+
{ label: "Delete older than", value: report.deleteOlderThan },
|
|
920
|
+
{ label: "Snapshots", value: String(report.snapshots) },
|
|
921
|
+
{ label: "Old files", value: String(report.oldFiles) },
|
|
922
|
+
{ label: "Orphaned files", value: String(report.orphanedFiles) },
|
|
923
|
+
]}
|
|
924
|
+
/>
|
|
925
|
+
</Box>
|
|
926
|
+
)
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
export function InitView({
|
|
930
|
+
name,
|
|
931
|
+
targetDir,
|
|
932
|
+
files,
|
|
933
|
+
}: {
|
|
934
|
+
name: string
|
|
935
|
+
targetDir: string
|
|
936
|
+
files: string[]
|
|
937
|
+
}) {
|
|
938
|
+
return (
|
|
939
|
+
<Box flexDirection="column">
|
|
940
|
+
<Text color="green" bold>
|
|
941
|
+
Sixb created
|
|
942
|
+
</Text>
|
|
943
|
+
<Text dimColor>{name}</Text>
|
|
944
|
+
<Text dimColor>{targetDir}</Text>
|
|
945
|
+
<Spacer />
|
|
946
|
+
<SectionTitle>Files</SectionTitle>
|
|
947
|
+
<BulletList items={files} />
|
|
948
|
+
<Spacer />
|
|
949
|
+
<SectionTitle>Next steps</SectionTitle>
|
|
950
|
+
<BulletList dim items={[`cd ${name}`, "bun install", "sixb dev"]} />
|
|
951
|
+
</Box>
|
|
952
|
+
)
|
|
953
|
+
}
|