@sixb/cli 0.1.6 → 0.1.7

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 (54) hide show
  1. package/README.md +125 -18
  2. package/dist/commands/init.d.ts +0 -1
  3. package/dist/commands/init.d.ts.map +1 -1
  4. package/dist/commands/login.d.ts +8 -0
  5. package/dist/commands/login.d.ts.map +1 -0
  6. package/dist/commands/logout.d.ts +6 -0
  7. package/dist/commands/logout.d.ts.map +1 -0
  8. package/dist/commands/profile.d.ts +7 -0
  9. package/dist/commands/profile.d.ts.map +1 -0
  10. package/dist/commands/service-account.d.ts +1 -0
  11. package/dist/commands/service-account.d.ts.map +1 -1
  12. package/dist/commands/status.d.ts +8 -0
  13. package/dist/commands/status.d.ts.map +1 -0
  14. package/dist/commands/token.d.ts +1 -0
  15. package/dist/commands/token.d.ts.map +1 -1
  16. package/dist/lib/api-client.d.ts +0 -11
  17. package/dist/lib/api-client.d.ts.map +1 -1
  18. package/dist/lib/command-line.d.ts +176 -0
  19. package/dist/lib/command-line.d.ts.map +1 -0
  20. package/dist/lib/errors.d.ts +6 -0
  21. package/dist/lib/errors.d.ts.map +1 -1
  22. package/dist/lib/instance-command.d.ts +3 -0
  23. package/dist/lib/instance-command.d.ts.map +1 -0
  24. package/dist/lib/loadSixb.d.ts.map +1 -1
  25. package/dist/lib/profile-api-client.d.ts +6 -0
  26. package/dist/lib/profile-api-client.d.ts.map +1 -0
  27. package/dist/lib/profiles.d.ts +34 -0
  28. package/dist/lib/profiles.d.ts.map +1 -0
  29. package/dist/lib/runtime.d.ts.map +1 -1
  30. package/dist/lib/worker-registry.d.ts.map +1 -1
  31. package/dist/ui/index.d.ts +5 -5
  32. package/dist/ui/index.d.ts.map +1 -1
  33. package/package.json +14 -13
  34. package/src/commands/init.tsx +1 -13
  35. package/src/commands/login.tsx +196 -0
  36. package/src/commands/logout.tsx +36 -0
  37. package/src/commands/profile.tsx +101 -0
  38. package/src/commands/service-account.tsx +18 -15
  39. package/src/commands/status.tsx +93 -0
  40. package/src/commands/token.tsx +11 -8
  41. package/src/index.tsx +134 -156
  42. package/src/lib/api-client.ts +4 -65
  43. package/src/lib/command-line.ts +743 -0
  44. package/src/lib/errors.ts +13 -0
  45. package/src/lib/instance-command.ts +80 -0
  46. package/src/lib/loadSixb.ts +0 -2
  47. package/src/lib/profile-api-client.ts +38 -0
  48. package/src/lib/profiles.ts +262 -0
  49. package/src/lib/runtime.ts +7 -1
  50. package/src/lib/worker-registry.ts +7 -1
  51. package/src/ui/index.tsx +39 -140
  52. package/dist/commands/auth.d.ts +0 -8
  53. package/dist/commands/auth.d.ts.map +0 -1
  54. package/src/commands/auth.tsx +0 -96
package/src/lib/errors.ts CHANGED
@@ -6,6 +6,19 @@ export interface SixbCliErrorOptions extends ErrorOptions {
6
6
  readonly remediation?: string
7
7
  }
8
8
 
9
+ /** An HTTP or transport failure returned by the Sixb API. */
10
+ export class SixbApiError extends Error {
11
+ readonly status: number | undefined
12
+ readonly responseBody: unknown
13
+
14
+ constructor(message: string, status: number | undefined, responseBody: unknown) {
15
+ super(message)
16
+ this.name = "SixbApiError"
17
+ this.status = status
18
+ this.responseBody = responseBody
19
+ }
20
+ }
21
+
9
22
  /** A failure the CLI raised itself, as opposed to one it caught from the runtime. */
10
23
  export class SixbCliError extends Error {
11
24
  readonly remediation: string | undefined
@@ -0,0 +1,80 @@
1
+ import { fail, isInstanceCommand, reportError, requestsHelp, runInstanceCli } from "@sixb/cli-core"
2
+ import { resolveProfile } from "./profiles"
3
+
4
+ const CONNECTION_FLAGS = new Set(["api-url", "profile", "token"])
5
+
6
+ export function isLocalInstanceCommand(command: string): boolean {
7
+ return isInstanceCommand(command)
8
+ }
9
+
10
+ export async function runLocalInstanceCommand(args: readonly string[]): Promise<void> {
11
+ try {
12
+ const { commandArgs, apiUrl, profile, token } = extractConnectionOptions(args)
13
+ if (requestsHelp(commandArgs)) {
14
+ await runInstanceCli({ args: commandArgs, mode: { kind: "local", baseUrl: "" } })
15
+ return
16
+ }
17
+ const resolved = await resolveProfile({ apiUrl, profile, token })
18
+ await runInstanceCli({
19
+ args: commandArgs,
20
+ mode: {
21
+ kind: "local",
22
+ baseUrl: resolved.apiUrl,
23
+ ...(resolved.token ? { token: resolved.token } : {}),
24
+ ...(resolved.profile ? { profile: resolved.profile } : {}),
25
+ },
26
+ })
27
+ } catch (error) {
28
+ process.exitCode = reportError(error)
29
+ }
30
+ }
31
+
32
+ function extractConnectionOptions(args: readonly string[]): {
33
+ readonly commandArgs: readonly string[]
34
+ readonly apiUrl?: string
35
+ readonly profile?: string
36
+ readonly token?: string
37
+ } {
38
+ const commandArgs: string[] = []
39
+ const values: Record<string, string | undefined> = {}
40
+
41
+ for (let index = 0; index < args.length; index++) {
42
+ const argument = args[index]
43
+ if (argument === "--") {
44
+ commandArgs.push(...args.slice(index))
45
+ break
46
+ }
47
+ if (!argument?.startsWith("--")) {
48
+ if (argument !== undefined) commandArgs.push(argument)
49
+ continue
50
+ }
51
+
52
+ const equalsIndex = argument.indexOf("=")
53
+ const name = argument.slice(2, equalsIndex < 0 ? undefined : equalsIndex)
54
+ if (!CONNECTION_FLAGS.has(name)) {
55
+ commandArgs.push(argument)
56
+ continue
57
+ }
58
+
59
+ if (values[name] !== undefined) {
60
+ fail(`--${name} may only be provided once.`)
61
+ }
62
+
63
+ const value = equalsIndex < 0 ? args[++index] : argument.slice(equalsIndex + 1)
64
+ if (!value || value.startsWith("--")) {
65
+ fail(`--${name} requires a value.`)
66
+ }
67
+ values[name] = value
68
+ }
69
+
70
+ if (values["api-url"] && values.profile) {
71
+ fail("--api-url and --profile cannot be used together.")
72
+ }
73
+
74
+ return {
75
+ commandArgs,
76
+ ...(values["api-url"] ? { apiUrl: values["api-url"] } : {}),
77
+ ...(values.profile ? { profile: values.profile } : {}),
78
+ ...(values.token ? { token: values.token } : {}),
79
+ }
80
+ }
@@ -78,8 +78,6 @@ function hasDefinitionCatalogs(value: Record<PropertyKey, unknown>): boolean {
78
78
  ]) &&
79
79
  isRecord(definitions.workflows) &&
80
80
  hasMethods(definitions.workflows, ["list", "getById"]) &&
81
- isRecord(definitions.agents) &&
82
- hasMethods(definitions.agents, ["list", "getById"]) &&
83
81
  isRecord(definitions.security) &&
84
82
  hasMethods(definitions.security, [
85
83
  "listGroups",
@@ -0,0 +1,38 @@
1
+ import type { SixbApiClientConfig } from "./api-client"
2
+ import { type ResolveProfileInput, resolveProfile } from "./profiles"
3
+
4
+ export interface ResolveProfileApiClientConfigOptions extends ResolveProfileInput {}
5
+
6
+ export async function resolveProfileApiClientConfig(
7
+ options: ResolveProfileApiClientConfigOptions = {}
8
+ ): Promise<SixbApiClientConfig> {
9
+ const resolved = await resolveProfile(options)
10
+
11
+ return {
12
+ apiUrl: resolved.apiUrl,
13
+ apiUrlSource: formatApiUrlSource(resolved),
14
+ ...(resolved.token
15
+ ? {
16
+ token: resolved.token,
17
+ tokenSource: resolved.tokenSource ?? "profile",
18
+ }
19
+ : {}),
20
+ }
21
+ }
22
+
23
+ function formatApiUrlSource(resolved: Awaited<ReturnType<typeof resolveProfile>>): string {
24
+ switch (resolved.source) {
25
+ case "api-url-flag":
26
+ return "--api-url"
27
+ case "profile-flag":
28
+ return `profile:${resolved.profile}`
29
+ case "environment":
30
+ return "SIXB_API_URL"
31
+ case "profile-environment":
32
+ return `SIXB_PROFILE:${resolved.profile}`
33
+ case "current-profile":
34
+ return `profile:${resolved.profile}`
35
+ case "default":
36
+ return "default"
37
+ }
38
+ }
@@ -0,0 +1,262 @@
1
+ import { randomUUID } from "node:crypto"
2
+ import { chmod, mkdir, readFile, rename, rm, writeFile } from "node:fs/promises"
3
+ import { homedir } from "node:os"
4
+ import { dirname, isAbsolute, join } from "node:path"
5
+ import { normalizeApiUrl } from "./api-client"
6
+
7
+ const CONFIG_DIRECTORY_MODE = 0o700
8
+ const CONFIG_FILE_MODE = 0o600
9
+ const PROFILE_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/
10
+
11
+ export interface SixbProfile {
12
+ readonly apiUrl: string
13
+ readonly projectId: string
14
+ readonly token?: string
15
+ }
16
+
17
+ export interface SixbConfigFile {
18
+ readonly version: 1
19
+ readonly currentProfile?: string
20
+ readonly profiles: Readonly<Record<string, SixbProfile>>
21
+ }
22
+
23
+ export interface ProfileStoreOptions {
24
+ readonly env?: Readonly<Record<string, string | undefined>>
25
+ readonly homeDirectory?: string
26
+ }
27
+
28
+ export interface ResolveProfileInput extends ProfileStoreOptions {
29
+ readonly apiUrl?: string
30
+ readonly token?: string
31
+ readonly profile?: string
32
+ }
33
+
34
+ export interface ResolvedProfile {
35
+ readonly apiUrl: string
36
+ readonly token?: string
37
+ readonly profile?: string
38
+ readonly projectId?: string
39
+ readonly source:
40
+ | "api-url-flag"
41
+ | "profile-flag"
42
+ | "environment"
43
+ | "profile-environment"
44
+ | "current-profile"
45
+ | "default"
46
+ readonly tokenSource?: "--token" | "SIXB_API_TOKEN" | "SIXB_TOKEN" | "profile"
47
+ }
48
+
49
+ export function resolveConfigPath(options: ProfileStoreOptions = {}): string {
50
+ const env = options.env ?? process.env
51
+ const configuredRoot = nonblank(env.XDG_CONFIG_HOME)
52
+ if (configuredRoot && !isAbsolute(configuredRoot)) {
53
+ throw new Error("[SixbCLI] XDG_CONFIG_HOME must be an absolute path.")
54
+ }
55
+ const root = configuredRoot ?? join(options.homeDirectory ?? homedir(), ".config")
56
+ return join(root, "sixb", "config.json")
57
+ }
58
+
59
+ export async function readConfig(options: ProfileStoreOptions = {}): Promise<SixbConfigFile> {
60
+ const path = resolveConfigPath(options)
61
+ let text: string
62
+ try {
63
+ text = await readFile(path, "utf8")
64
+ } catch (error) {
65
+ if (isFileError(error, "ENOENT")) return emptyConfig()
66
+ throw error
67
+ }
68
+
69
+ let value: unknown
70
+ try {
71
+ value = JSON.parse(text)
72
+ } catch {
73
+ throw new Error(`[SixbCLI] Profile config '${path}' is not valid JSON.`)
74
+ }
75
+ return parseConfig(value, path)
76
+ }
77
+
78
+ export async function updateConfig(
79
+ update: (config: SixbConfigFile) => SixbConfigFile,
80
+ options: ProfileStoreOptions = {}
81
+ ): Promise<SixbConfigFile> {
82
+ const path = resolveConfigPath(options)
83
+ const directory = dirname(path)
84
+ const config = parseConfig(update(await readConfig(options)), path)
85
+ const temporary = join(directory, `.config-${process.pid}-${randomUUID()}.tmp`)
86
+
87
+ await mkdir(directory, { recursive: true, mode: CONFIG_DIRECTORY_MODE })
88
+ await chmod(directory, CONFIG_DIRECTORY_MODE)
89
+ try {
90
+ await writeFile(temporary, `${JSON.stringify(config, null, 2)}\n`, {
91
+ encoding: "utf8",
92
+ flag: "wx",
93
+ mode: CONFIG_FILE_MODE,
94
+ })
95
+ await rename(temporary, path)
96
+ await chmod(path, CONFIG_FILE_MODE)
97
+ } catch (error) {
98
+ await rm(temporary, { force: true }).catch(() => {})
99
+ throw error
100
+ }
101
+
102
+ return config
103
+ }
104
+
105
+ export async function resolveProfile(input: ResolveProfileInput = {}): Promise<ResolvedProfile> {
106
+ const env = input.env ?? process.env
107
+ const explicitToken = nonblank(input.token)
108
+ const explicitApiUrl = nonblank(input.apiUrl)
109
+ if (explicitApiUrl) {
110
+ return {
111
+ apiUrl: normalizeApiUrl(explicitApiUrl),
112
+ ...(explicitToken ? { token: explicitToken, tokenSource: "--token" as const } : {}),
113
+ source: "api-url-flag",
114
+ }
115
+ }
116
+
117
+ const config = await readConfig(input)
118
+ const explicitProfile = nonblank(input.profile)
119
+ if (explicitProfile) {
120
+ const stored = requireProfile(config, explicitProfile)
121
+ return resolvedStoredProfile(stored, explicitProfile, "profile-flag", explicitToken)
122
+ }
123
+
124
+ const environmentApiUrl = nonblank(env.SIXB_API_URL) ?? nonblank(env.SIXB_API_PUBLIC_ORIGIN)
125
+ if (environmentApiUrl) {
126
+ const environmentToken = resolveEnvironmentToken(env)
127
+ return {
128
+ apiUrl: normalizeApiUrl(environmentApiUrl),
129
+ ...(explicitToken
130
+ ? { token: explicitToken, tokenSource: "--token" as const }
131
+ : environmentToken),
132
+ source: "environment",
133
+ }
134
+ }
135
+
136
+ const environmentProfile = nonblank(env.SIXB_PROFILE)
137
+ if (environmentProfile) {
138
+ const stored = requireProfile(config, environmentProfile)
139
+ return resolvedStoredProfile(stored, environmentProfile, "profile-environment", explicitToken)
140
+ }
141
+
142
+ if (config.currentProfile) {
143
+ const stored = requireProfile(config, config.currentProfile)
144
+ return resolvedStoredProfile(stored, config.currentProfile, "current-profile", explicitToken)
145
+ }
146
+
147
+ return {
148
+ apiUrl: "http://localhost:3002",
149
+ ...(explicitToken ? { token: explicitToken, tokenSource: "--token" as const } : {}),
150
+ source: "default",
151
+ }
152
+ }
153
+
154
+ export function requireProfile(config: SixbConfigFile, name: string): SixbProfile {
155
+ assertProfileName(name)
156
+ const profile = config.profiles[name]
157
+ if (!profile) throw new Error(`[SixbCLI] Profile '${name}' does not exist.`)
158
+ return profile
159
+ }
160
+
161
+ export function assertProfileName(name: string): void {
162
+ if (!PROFILE_NAME_PATTERN.test(name)) {
163
+ throw new Error(
164
+ "[SixbCLI] Profile names must be 1-64 characters using letters, numbers, '.', '_', or '-'."
165
+ )
166
+ }
167
+ }
168
+
169
+ function resolvedStoredProfile(
170
+ stored: SixbProfile,
171
+ profile: string,
172
+ source: "profile-flag" | "profile-environment" | "current-profile",
173
+ explicitToken: string | undefined
174
+ ): ResolvedProfile {
175
+ return {
176
+ ...stored,
177
+ profile,
178
+ source,
179
+ ...(explicitToken
180
+ ? { token: explicitToken, tokenSource: "--token" }
181
+ : stored.token
182
+ ? { tokenSource: "profile" }
183
+ : {}),
184
+ }
185
+ }
186
+
187
+ function resolveEnvironmentToken(
188
+ env: Readonly<Record<string, string | undefined>>
189
+ ): Pick<ResolvedProfile, "token" | "tokenSource"> {
190
+ const apiToken = nonblank(env.SIXB_API_TOKEN)
191
+ if (apiToken) return { token: apiToken, tokenSource: "SIXB_API_TOKEN" }
192
+ const legacyToken = nonblank(env.SIXB_TOKEN)
193
+ return legacyToken ? { token: legacyToken, tokenSource: "SIXB_TOKEN" } : {}
194
+ }
195
+
196
+ function emptyConfig(): SixbConfigFile {
197
+ return { version: 1, profiles: {} }
198
+ }
199
+
200
+ function parseConfig(value: unknown, path: string): SixbConfigFile {
201
+ const record = asRecord(value)
202
+ if (record.version !== 1 || !isRecord(record.profiles)) {
203
+ throw invalidConfig(path)
204
+ }
205
+
206
+ const profiles: Record<string, SixbProfile> = {}
207
+ for (const [name, rawProfile] of Object.entries(record.profiles)) {
208
+ assertProfileName(name)
209
+ const profile = asRecord(rawProfile)
210
+ const apiUrl = nonblankString(profile.apiUrl)
211
+ const projectId = nonblankString(profile.projectId)
212
+ const token = profile.token === undefined ? undefined : nonblankString(profile.token)
213
+ if (!apiUrl || !projectId || (profile.token !== undefined && !token)) {
214
+ throw invalidConfig(path)
215
+ }
216
+ profiles[name] = {
217
+ apiUrl: normalizeApiUrl(apiUrl),
218
+ projectId,
219
+ ...(token ? { token } : {}),
220
+ }
221
+ }
222
+
223
+ const currentProfile =
224
+ record.currentProfile === undefined ? undefined : nonblankString(record.currentProfile)
225
+ if (
226
+ (record.currentProfile !== undefined && !currentProfile) ||
227
+ (currentProfile && !profiles[currentProfile])
228
+ ) {
229
+ throw invalidConfig(path)
230
+ }
231
+
232
+ return {
233
+ version: 1,
234
+ ...(currentProfile ? { currentProfile } : {}),
235
+ profiles,
236
+ }
237
+ }
238
+
239
+ function invalidConfig(path: string): Error {
240
+ return new Error(`[SixbCLI] Profile config '${path}' has an invalid shape.`)
241
+ }
242
+
243
+ function nonblank(value: string | undefined): string | undefined {
244
+ const trimmed = value?.trim()
245
+ return trimmed ? trimmed : undefined
246
+ }
247
+
248
+ function nonblankString(value: unknown): string | undefined {
249
+ return typeof value === "string" ? nonblank(value) : undefined
250
+ }
251
+
252
+ function asRecord(value: unknown): Record<string, unknown> {
253
+ return isRecord(value) ? value : {}
254
+ }
255
+
256
+ function isRecord(value: unknown): value is Record<string, unknown> {
257
+ return typeof value === "object" && value !== null && !Array.isArray(value)
258
+ }
259
+
260
+ function isFileError(error: unknown, code: string): error is NodeJS.ErrnoException {
261
+ return error instanceof Error && "code" in error && error.code === code
262
+ }
@@ -243,7 +243,13 @@ export async function startSixbRuntime(
243
243
  await actionWorker.start()
244
244
  }
245
245
 
246
- if (sixb.definitions.agents.list().length > 0 && sixb.storage.agents) {
246
+ if (
247
+ (sixb.definitions.models !== undefined ||
248
+ sixb.definitions.workflows
249
+ .list()
250
+ .some((workflow) => workflow.nodes.some((node) => node.type === "agent"))) &&
251
+ sixb.storage.agents
252
+ ) {
247
253
  agentWorker = new AgentWorker(sixb, {
248
254
  apiBaseUrl: requireAgentApiBaseUrl(options.agentApiBaseUrl),
249
255
  concurrency: options.workerConcurrency?.agent,
@@ -200,7 +200,13 @@ export function resolveRegisteredWorkerTypes(sixb: LoadedSixbHost): readonly Wor
200
200
  workerTypes.push("action")
201
201
  }
202
202
 
203
- if (sixb.definitions.agents.list().length > 0 && sixb.storage.agents) {
203
+ if (
204
+ (sixb.definitions.models !== undefined ||
205
+ sixb.definitions.workflows
206
+ .list()
207
+ .some((workflow) => workflow.nodes.some((node) => node.type === "agent"))) &&
208
+ sixb.storage.agents
209
+ ) {
204
210
  workerTypes.push("agent")
205
211
  }
206
212
 
package/src/ui/index.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Box, render, Text } from "ink"
2
2
  import type React from "react"
3
3
  import { useEffect, useMemo, useState } from "react"
4
+ import { CLI_EXAMPLES, type CliHelp, ROOT_HELP } from "../lib/command-line"
4
5
  import { errorMessage, errorRemediation } from "../lib/errors"
5
6
 
6
7
  // ─── Primitives ──────────────────────────────────────────────────────────────
@@ -331,123 +332,50 @@ export function HelpView({ errorMessage }: { errorMessage?: string }) {
331
332
  ) : null}
332
333
  <Spacer />
333
334
  <SectionTitle>Usage</SectionTitle>
334
- <Text> sixb {"<command>"} [options]</Text>
335
+ <Text> {ROOT_HELP.usage}</Text>
335
336
  <Spacer />
336
337
  <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
- />
338
+ <KeyValueList labelWidth={22} items={ROOT_HELP.commands} />
377
339
  <Spacer />
378
340
  <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
- {
396
- label: "--agent-turn-timeout <duration>",
397
- value: "Agent turn wall-clock budget (default: 10m)",
398
- },
399
- {
400
- label: "--concurrency <value>",
401
- value: "Concurrent jobs: count for worker; repeat type=count for dev/worker-group",
402
- },
403
- { label: "--atlas-public-origin <origin>", value: "Public Atlas origin" },
404
- { label: "--app-public-origin <origin>", value: "Public custom app origin" },
405
- { label: "--api-url <url>", value: "API origin for auth/token commands" },
406
- { label: "--token <token>", value: "API token for auth/token commands" },
407
- { label: "--name <name>", value: "Token or service-account name" },
408
- { label: "--description <text>", value: "Service-account description" },
409
- { label: "--expires-in <duration>", value: "Token lifetime, e.g. 30d or 1y" },
410
- { label: "--expires-at <iso>", value: "Token expiration timestamp" },
411
- { label: "--group <id>", value: "Assignable token group; may repeat" },
412
- { label: "--json", value: "Print JSON for auth/token commands" },
413
- { label: "--outdir <path>", value: "Build output directory" },
414
- { label: "--dry-run", value: "Preview lake cleanup without changing storage" },
415
- { label: "--expire-older-than <interval>", value: "Lake snapshot expiration window" },
416
- { label: "--delete-older-than <interval>", value: "Lake file deletion window" },
417
- { label: "--help", value: "Show this help message" },
418
- { label: "--version", value: "Show version" },
419
- ]}
420
- />
341
+ <KeyValueList labelWidth={22} items={ROOT_HELP.options} />
421
342
  <Spacer />
422
343
  <SectionTitle>Examples</SectionTitle>
423
- <BulletList
424
- dim
425
- items={[
426
- "sixb dev",
427
- "sixb build",
428
- "sixb api",
429
- "SIXB_API_URL=http://localhost:3002 SIXB_API_TOKEN=sixb_pat_... sixb token list",
430
- "sixb token create --name 'Local CLI' --expires-in 90d",
431
- "sixb service-account create --id svc_sandbox --name 'Sandbox agent' --group agents",
432
- "sixb service-account token create svc_sandbox --name 'Sandbox token' --expires-in 30d",
433
- "sixb auth status",
434
- "sixb atlas",
435
- "sixb app",
436
- "sixb scheduler",
437
- "sixb orchestrator",
438
- "sixb rules",
439
- "sixb worker pipeline",
440
- "sixb worker agent --concurrency 8",
441
- "sixb worker-group sync agent --concurrency sync=2 --concurrency agent=8",
442
- "sixb dev --entry examples/mac-os/sixb.config.ts --port 8080",
443
- "sixb check",
444
- "sixb typegen",
445
- "sixb db migrate",
446
- "sixb lake check",
447
- "sixb lake cleanup --dry-run",
448
- "sixb create my-project",
449
- ]}
450
- />
344
+ <BulletList dim items={CLI_EXAMPLES} />
345
+ </Box>
346
+ )
347
+ }
348
+
349
+ export function CommandHelpView({ help, errorMessage }: { help: CliHelp; errorMessage?: string }) {
350
+ return (
351
+ <Box flexDirection="column">
352
+ <Text color="cyan" bold>
353
+ {help.path.length > 0 ? help.path.join(" ") : "sixb"}
354
+ </Text>
355
+ <Text dimColor>{help.summary}</Text>
356
+ {errorMessage ? (
357
+ <>
358
+ <Spacer />
359
+ <Text color="red">{errorMessage}</Text>
360
+ </>
361
+ ) : null}
362
+ <Spacer />
363
+ <SectionTitle>Usage</SectionTitle>
364
+ <Text> {help.usage}</Text>
365
+ {help.commands.length > 0 ? (
366
+ <>
367
+ <Spacer />
368
+ <SectionTitle>Commands</SectionTitle>
369
+ <KeyValueList items={help.commands} />
370
+ </>
371
+ ) : null}
372
+ {help.options.length > 0 ? (
373
+ <>
374
+ <Spacer />
375
+ <SectionTitle>Options</SectionTitle>
376
+ <KeyValueList items={help.options} />
377
+ </>
378
+ ) : null}
451
379
  </Box>
452
380
  )
453
381
  }
@@ -890,35 +818,6 @@ export function LakeCleanupView({
890
818
  )
891
819
  }
892
820
 
893
- export function CreateView({
894
- name,
895
- targetDir,
896
- commands,
897
- }: {
898
- name: string
899
- targetDir: string
900
- commands: readonly string[]
901
- }) {
902
- return (
903
- <Box flexDirection="column">
904
- <Text color="cyan" bold>
905
- sixb
906
- </Text>
907
- <Spacer />
908
- <Text>
909
- <Text color="green" bold>
910
- Success!
911
- </Text>{" "}
912
- Created {name}
913
- </Text>
914
- <Text dimColor>{targetDir}</Text>
915
- <Spacer />
916
- <SectionTitle>Next steps</SectionTitle>
917
- <CommandList commands={commands} />
918
- </Box>
919
- )
920
- }
921
-
922
821
  export function InitView({
923
822
  name,
924
823
  targetDir,
@@ -1,8 +0,0 @@
1
- export interface AuthCommandOptions {
2
- readonly action?: string;
3
- readonly apiUrl?: string;
4
- readonly token?: string;
5
- readonly json?: boolean;
6
- }
7
- export declare function runAuth(options?: AuthCommandOptions): Promise<void>;
8
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,wBAAsB,OAAO,CAAC,OAAO,GAAE,kBAAuB,iBA8C7D"}