@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.
Files changed (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +275 -0
  3. package/dist/commands/access-token-utils.d.ts +9 -0
  4. package/dist/commands/access-token-utils.d.ts.map +1 -0
  5. package/dist/commands/api.d.ts +13 -0
  6. package/dist/commands/api.d.ts.map +1 -0
  7. package/dist/commands/app.d.ts +9 -0
  8. package/dist/commands/app.d.ts.map +1 -0
  9. package/dist/commands/atlas.d.ts +9 -0
  10. package/dist/commands/atlas.d.ts.map +1 -0
  11. package/dist/commands/auth.d.ts +8 -0
  12. package/dist/commands/auth.d.ts.map +1 -0
  13. package/dist/commands/build.d.ts +6 -0
  14. package/dist/commands/build.d.ts.map +1 -0
  15. package/dist/commands/check.d.ts +5 -0
  16. package/dist/commands/check.d.ts.map +1 -0
  17. package/dist/commands/db-migrate.d.ts +5 -0
  18. package/dist/commands/db-migrate.d.ts.map +1 -0
  19. package/dist/commands/dev.d.ts +12 -0
  20. package/dist/commands/dev.d.ts.map +1 -0
  21. package/dist/commands/init.d.ts +3 -0
  22. package/dist/commands/init.d.ts.map +1 -0
  23. package/dist/commands/lake-check.d.ts +5 -0
  24. package/dist/commands/lake-check.d.ts.map +1 -0
  25. package/dist/commands/lake-cleanup.d.ts +16 -0
  26. package/dist/commands/lake-cleanup.d.ts.map +1 -0
  27. package/dist/commands/orchestrator.d.ts +6 -0
  28. package/dist/commands/orchestrator.d.ts.map +1 -0
  29. package/dist/commands/rules.d.ts +6 -0
  30. package/dist/commands/rules.d.ts.map +1 -0
  31. package/dist/commands/scheduler.d.ts +6 -0
  32. package/dist/commands/scheduler.d.ts.map +1 -0
  33. package/dist/commands/service-account.d.ts +14 -0
  34. package/dist/commands/service-account.d.ts.map +1 -0
  35. package/dist/commands/token.d.ts +14 -0
  36. package/dist/commands/token.d.ts.map +1 -0
  37. package/dist/commands/typegen.d.ts +5 -0
  38. package/dist/commands/typegen.d.ts.map +1 -0
  39. package/dist/commands/worker-group.d.ts +8 -0
  40. package/dist/commands/worker-group.d.ts.map +1 -0
  41. package/dist/commands/worker.d.ts +8 -0
  42. package/dist/commands/worker.d.ts.map +1 -0
  43. package/dist/index.d.ts +3 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/lib/api-client.d.ts +26 -0
  46. package/dist/lib/api-client.d.ts.map +1 -0
  47. package/dist/lib/browser-topology.d.ts +62 -0
  48. package/dist/lib/browser-topology.d.ts.map +1 -0
  49. package/dist/lib/errors.d.ts +19 -0
  50. package/dist/lib/errors.d.ts.map +1 -0
  51. package/dist/lib/health.d.ts +25 -0
  52. package/dist/lib/health.d.ts.map +1 -0
  53. package/dist/lib/loadSixb.d.ts +49 -0
  54. package/dist/lib/loadSixb.d.ts.map +1 -0
  55. package/dist/lib/production-roles.d.ts +65 -0
  56. package/dist/lib/production-roles.d.ts.map +1 -0
  57. package/dist/lib/production.d.ts +29 -0
  58. package/dist/lib/production.d.ts.map +1 -0
  59. package/dist/lib/public-origin.d.ts +17 -0
  60. package/dist/lib/public-origin.d.ts.map +1 -0
  61. package/dist/lib/runtime.d.ts +76 -0
  62. package/dist/lib/runtime.d.ts.map +1 -0
  63. package/dist/lib/shareable-providers.d.ts +20 -0
  64. package/dist/lib/shareable-providers.d.ts.map +1 -0
  65. package/dist/lib/storage-migration.d.ts +40 -0
  66. package/dist/lib/storage-migration.d.ts.map +1 -0
  67. package/dist/lib/typegen.d.ts +5 -0
  68. package/dist/lib/typegen.d.ts.map +1 -0
  69. package/dist/lib/worker-registry.d.ts +30 -0
  70. package/dist/lib/worker-registry.d.ts.map +1 -0
  71. package/dist/tsconfig.json +5 -0
  72. package/dist/ui/index.d.ts +164 -0
  73. package/dist/ui/index.d.ts.map +1 -0
  74. package/package.json +68 -0
  75. package/src/commands/access-token-utils.ts +63 -0
  76. package/src/commands/api.tsx +111 -0
  77. package/src/commands/app.tsx +91 -0
  78. package/src/commands/atlas.tsx +75 -0
  79. package/src/commands/auth.tsx +96 -0
  80. package/src/commands/build.tsx +90 -0
  81. package/src/commands/check.tsx +58 -0
  82. package/src/commands/db-migrate.tsx +27 -0
  83. package/src/commands/dev.tsx +141 -0
  84. package/src/commands/init.tsx +18 -0
  85. package/src/commands/lake-check.tsx +20 -0
  86. package/src/commands/lake-cleanup.tsx +63 -0
  87. package/src/commands/orchestrator.tsx +87 -0
  88. package/src/commands/rules.tsx +81 -0
  89. package/src/commands/scheduler.tsx +77 -0
  90. package/src/commands/service-account.tsx +304 -0
  91. package/src/commands/token.tsx +143 -0
  92. package/src/commands/typegen.tsx +18 -0
  93. package/src/commands/worker-group.tsx +120 -0
  94. package/src/commands/worker.tsx +96 -0
  95. package/src/index.tsx +390 -0
  96. package/src/lib/api-client.ts +132 -0
  97. package/src/lib/browser-topology.ts +292 -0
  98. package/src/lib/errors.ts +40 -0
  99. package/src/lib/health.ts +138 -0
  100. package/src/lib/loadSixb.ts +175 -0
  101. package/src/lib/production-roles.ts +48 -0
  102. package/src/lib/production.ts +104 -0
  103. package/src/lib/public-origin.ts +46 -0
  104. package/src/lib/runtime.ts +346 -0
  105. package/src/lib/shareable-providers.ts +67 -0
  106. package/src/lib/storage-migration.ts +120 -0
  107. package/src/lib/typegen.ts +12 -0
  108. package/src/lib/worker-registry.ts +191 -0
  109. package/src/ui/index.tsx +953 -0
@@ -0,0 +1,164 @@
1
+ import type React from "react";
2
+ export declare function renderStatic(view: React.ReactNode): Promise<void>;
3
+ export declare function renderPersistent(view: React.ReactNode): import("ink").Instance;
4
+ /**
5
+ * Renders a caught failure the one way the CLI renders failures, so a remediation carried on
6
+ * the error reaches the terminal without each caller remembering to pass it through.
7
+ */
8
+ export declare function renderCliError(error: unknown, options?: {
9
+ readonly title?: string;
10
+ readonly details?: readonly string[];
11
+ }): Promise<void>;
12
+ export type KeyValueItem = {
13
+ label: string;
14
+ value: string;
15
+ };
16
+ export declare function KeyValueResultView({ title, subtitle, items, titleColor, message, }: {
17
+ title: string;
18
+ subtitle?: string;
19
+ items: readonly KeyValueItem[];
20
+ titleColor?: string;
21
+ message?: string;
22
+ }): import("react/jsx-runtime").JSX.Element;
23
+ export declare function TableResultView({ title, subtitle, headers, rows, emptyMessage, }: {
24
+ title: string;
25
+ subtitle?: string;
26
+ headers: readonly string[];
27
+ rows: readonly (readonly string[])[];
28
+ emptyMessage: string;
29
+ }): import("react/jsx-runtime").JSX.Element;
30
+ export declare function SecretResultView({ title, subtitle, items, secretLabel, secret, message, }: {
31
+ title: string;
32
+ subtitle?: string;
33
+ items: readonly KeyValueItem[];
34
+ secretLabel?: string;
35
+ secret: string;
36
+ message?: string;
37
+ }): import("react/jsx-runtime").JSX.Element;
38
+ export declare function LoadingView({ title, subtitle, status, }: {
39
+ title: string;
40
+ subtitle?: string;
41
+ status: string;
42
+ }): import("react/jsx-runtime").JSX.Element;
43
+ export declare function HelpView({ errorMessage }: {
44
+ errorMessage?: string;
45
+ }): import("react/jsx-runtime").JSX.Element;
46
+ export declare function VersionView({ version }: {
47
+ version: string;
48
+ }): import("react/jsx-runtime").JSX.Element;
49
+ export declare function ErrorView({ title, message, remediation, details, }: {
50
+ title?: string;
51
+ message: string;
52
+ /** What to do next. Rendered apart from the diagnosis, not appended to it. */
53
+ remediation?: string;
54
+ details?: readonly string[];
55
+ }): import("react/jsx-runtime").JSX.Element;
56
+ export declare function DevView({ name, apiUrl, apiDocsUrl, wsUrl, uiUrl, uiStatus, appUrl, mqttUrl, warnings, }: {
57
+ name: string;
58
+ apiUrl: string;
59
+ apiDocsUrl: string;
60
+ wsUrl: string;
61
+ uiUrl: string | null;
62
+ uiStatus: string | null;
63
+ appUrl?: string | null;
64
+ mqttUrl: string | null;
65
+ warnings?: readonly string[];
66
+ }): import("react/jsx-runtime").JSX.Element;
67
+ export declare function StartView({ name, apiUrl, apiDocsUrl, wsUrl, uiUrl, uiStatus, appUrl, warnings, }: {
68
+ name: string;
69
+ apiUrl: string;
70
+ apiDocsUrl: string;
71
+ wsUrl: string;
72
+ uiUrl: string | null;
73
+ uiStatus?: string | null;
74
+ appUrl?: string | null;
75
+ warnings?: readonly string[];
76
+ }): import("react/jsx-runtime").JSX.Element;
77
+ export declare function WorkerView({ name, workerId, storage, warnings, }: {
78
+ name: string;
79
+ workerId: string;
80
+ storage?: string | null;
81
+ warnings?: readonly string[];
82
+ }): import("react/jsx-runtime").JSX.Element;
83
+ export declare function WorkerGroupView({ name, workerTypes, storage, warnings, }: {
84
+ name: string;
85
+ workerTypes: readonly string[];
86
+ storage?: string | null;
87
+ warnings?: readonly string[];
88
+ }): import("react/jsx-runtime").JSX.Element;
89
+ export declare function RoleView({ title, name, serviceName, items, storage, warnings, }: {
90
+ title: string;
91
+ name: string;
92
+ serviceName: string;
93
+ items: KeyValueItem[];
94
+ storage?: string | null;
95
+ warnings?: readonly string[];
96
+ }): import("react/jsx-runtime").JSX.Element;
97
+ export declare function CheckView({ projectId, storage, timeseries, broker, queues, projectValidation, ontology, warnings, }: {
98
+ projectId: string;
99
+ storage: {
100
+ ok: boolean;
101
+ message?: string;
102
+ };
103
+ timeseries: {
104
+ ok: boolean;
105
+ message?: string;
106
+ };
107
+ broker: {
108
+ ok: boolean;
109
+ message?: string;
110
+ };
111
+ queues: {
112
+ ok: boolean;
113
+ message?: string;
114
+ };
115
+ projectValidation?: {
116
+ ok: boolean;
117
+ message?: string;
118
+ };
119
+ ontology?: {
120
+ enabled: boolean;
121
+ source: string;
122
+ errors: number;
123
+ warnings: number;
124
+ };
125
+ warnings: readonly string[];
126
+ }): import("react/jsx-runtime").JSX.Element;
127
+ export declare function BuildView({ entry, outdir }: {
128
+ entry: string;
129
+ outdir: string;
130
+ }): import("react/jsx-runtime").JSX.Element;
131
+ export declare function TypegenView({ path, objectTypes, skipped, written, }: {
132
+ path: string;
133
+ objectTypes: number;
134
+ skipped: boolean;
135
+ written: boolean;
136
+ }): import("react/jsx-runtime").JSX.Element;
137
+ export declare function DbMigrateView({ projectId, status, applied, }: {
138
+ projectId: string;
139
+ status: "migrated" | "current" | "skipped";
140
+ /** Migration step ids this run applied, named so the output can be checked. */
141
+ applied?: readonly string[];
142
+ }): import("react/jsx-runtime").JSX.Element;
143
+ export declare function LakeCheckView({ projectId, status }: {
144
+ projectId: string;
145
+ status: "ok";
146
+ }): import("react/jsx-runtime").JSX.Element;
147
+ export interface LakeCleanupReport {
148
+ readonly dryRun: boolean;
149
+ readonly expireOlderThan: string;
150
+ readonly deleteOlderThan: string;
151
+ readonly snapshots: number;
152
+ readonly oldFiles: number;
153
+ readonly orphanedFiles: number;
154
+ }
155
+ export declare function LakeCleanupView({ projectId, report, }: {
156
+ projectId: string;
157
+ report: LakeCleanupReport;
158
+ }): import("react/jsx-runtime").JSX.Element;
159
+ export declare function InitView({ name, targetDir, files, }: {
160
+ name: string;
161
+ targetDir: string;
162
+ files: string[];
163
+ }): import("react/jsx-runtime").JSX.Element;
164
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,wBAAsB,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,iBAOvD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,0BAErD;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAO,GAC9E,OAAO,CAAC,IAAI,CAAC,CASf;AAmBD,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAsF3D,wBAAgB,kBAAkB,CAAC,EACjC,KAA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AE,2CAWvF;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B;AAED,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,MAAM,GACP,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,iBAAiB,CAAA;CAC1B,2CAoBA;AAED,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,SAAS,EACT,KAAK,GACN,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB,2CAgBA"}
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@sixb/cli",
3
+ "version": "0.0.1",
4
+ "description": "Command-line interface for Sixb projects",
5
+ "keywords": [
6
+ "sixb",
7
+ "bun",
8
+ "cli"
9
+ ],
10
+ "homepage": "https://sixb.ai",
11
+ "bugs": {
12
+ "url": "https://github.com/sixb-ai/sixb/issues"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/sixb-ai/sixb.git",
17
+ "directory": "packages/cli"
18
+ },
19
+ "author": "Sixb contributors",
20
+ "type": "module",
21
+ "bin": {
22
+ "sixb": "./src/index.tsx"
23
+ },
24
+ "scripts": {
25
+ "build": "bun ../../scripts/build-package.ts",
26
+ "typecheck": "tsc --noEmit",
27
+ "test": "bun test",
28
+ "test:e2e": "bun test ./tests/prod-roles.e2e.ts && bun test ./tests/worker-group.e2e.ts",
29
+ "prepack": "bun run build"
30
+ },
31
+ "dependencies": {
32
+ "@sixb/app": "0.0.1",
33
+ "@sixb/action-worker": "0.0.1",
34
+ "@sixb/agent-worker": "0.0.1",
35
+ "@sixb/atlas": "0.0.1",
36
+ "@sixb/client": "0.0.1",
37
+ "@sixb/core": "0.0.1",
38
+ "@sixb/orchestrator": "0.0.1",
39
+ "@sixb/pipeline-worker": "0.0.1",
40
+ "@sixb/projection-worker": "0.0.1",
41
+ "@sixb/rules-worker": "0.0.1",
42
+ "@sixb/server": "0.0.1",
43
+ "@sixb/sync-worker": "0.0.1",
44
+ "@sixb/workflow-worker": "0.0.1",
45
+ "create-sixb": "0.0.1",
46
+ "ink": "^6.0.0",
47
+ "react": "^19.0.0",
48
+ "react-devtools-core": "^4.19.1"
49
+ },
50
+ "devDependencies": {
51
+ "@types/bun": "latest",
52
+ "@types/react": "^19.0.0",
53
+ "typescript": "^5.7.0"
54
+ },
55
+ "license": "MIT",
56
+ "engines": {
57
+ "bun": ">=1.3.0"
58
+ },
59
+ "publishConfig": {
60
+ "access": "public"
61
+ },
62
+ "files": [
63
+ "dist",
64
+ "src",
65
+ "README.md",
66
+ "LICENSE"
67
+ ]
68
+ }
@@ -0,0 +1,63 @@
1
+ export interface ExpirationOptions {
2
+ readonly expiresAt?: string
3
+ readonly expiresIn?: string
4
+ }
5
+
6
+ export function resolveExpiration(options: ExpirationOptions): string {
7
+ if (options.expiresAt?.trim()) {
8
+ const date = new Date(options.expiresAt)
9
+ if (Number.isNaN(date.getTime())) {
10
+ throw new Error("[SixbCLI] --expires-at must be a valid date or ISO timestamp.")
11
+ }
12
+ return date.toISOString()
13
+ }
14
+
15
+ const duration = parseDurationMs(options.expiresIn ?? "90d")
16
+ return new Date(Date.now() + duration).toISOString()
17
+ }
18
+
19
+ export function normalizeGroupIds(values: readonly string[] | undefined): string[] {
20
+ const groupIds: string[] = []
21
+ for (const value of values ?? []) {
22
+ for (const groupId of value.split(",")) {
23
+ const trimmed = groupId.trim()
24
+ if (trimmed && !groupIds.includes(trimmed)) {
25
+ groupIds.push(trimmed)
26
+ }
27
+ }
28
+ }
29
+
30
+ return groupIds
31
+ }
32
+
33
+ export function formatGroups(groupIds: readonly string[] | undefined): string {
34
+ if (!groupIds) return "Inherited"
35
+ if (groupIds.length === 0) return "None"
36
+ return groupIds.join(",")
37
+ }
38
+
39
+ export function formatDate(value: string | undefined): string {
40
+ if (!value) return "Never"
41
+ const date = new Date(value)
42
+ if (Number.isNaN(date.getTime())) return value
43
+ return date.toISOString().replace("T", " ").slice(0, 16)
44
+ }
45
+
46
+ function parseDurationMs(value: string): number {
47
+ const match = value.trim().match(/^(\d+)(m|h|d|w|y)$/)
48
+ if (!match) {
49
+ throw new Error("[SixbCLI] Use --expires-in like 30d, 12h, 4w, or 1y.")
50
+ }
51
+
52
+ const amount = Number(match[1])
53
+ const unit = match[2]
54
+ const multipliers = {
55
+ m: 60_000,
56
+ h: 60 * 60_000,
57
+ d: 24 * 60 * 60_000,
58
+ w: 7 * 24 * 60 * 60_000,
59
+ y: 365 * 24 * 60 * 60_000,
60
+ } as const
61
+
62
+ return amount * multipliers[unit as keyof typeof multipliers]
63
+ }
@@ -0,0 +1,111 @@
1
+ import { stat } from "node:fs/promises"
2
+ import { resolve } from "node:path"
3
+ import { createSixbServer, type SixbServer } from "@sixb/server"
4
+ import { apiDocsUrl, apiEventsUrl, apiUrl, resolveBrowserTopology } from "../lib/browser-topology"
5
+ import type { LoadedSixb } from "../lib/loadSixb"
6
+ import { builtAppOutdir, loadProductionSixb } from "../lib/production"
7
+ import { runUntilSignal, stopQuietly, stopSixbProviders } from "../lib/runtime"
8
+ import { migrateStorageForRole } from "../lib/storage-migration"
9
+ import { LoadingView, RoleView, renderCliError, renderPersistent } from "../ui"
10
+
11
+ export interface ApiOptions {
12
+ entry?: string
13
+ noMigrate?: boolean
14
+ port?: string
15
+ host?: string
16
+ apiPort?: string
17
+ apiHost?: string
18
+ apiPublicOrigin?: string
19
+ atlasPublicOrigin?: string
20
+ appPublicOrigin?: string
21
+ }
22
+
23
+ export async function runApi(options: ApiOptions = {}) {
24
+ process.env.NODE_ENV = "production"
25
+
26
+ const loaded = await loadProductionSixb({ entry: options.entry, role: "api" })
27
+ const app = renderPersistent(
28
+ <LoadingView title="Starting sixb api" subtitle={loaded.entry} status="Preparing runtime" />
29
+ )
30
+
31
+ let sixb: LoadedSixb | null = loaded.sixb
32
+ let server: SixbServer | null = null
33
+
34
+ try {
35
+ // Ahead of `server.start()`, which is what kicks off the read-only schema probe
36
+ // behind `/ready`. Migrating after it would leave the probe racing the change it
37
+ // reports on, and the first `/ready` answer would be stale by construction.
38
+ const migration = await migrateStorageForRole(sixb, {
39
+ role: "api",
40
+ noMigrate: options.noMigrate,
41
+ onStart: () =>
42
+ app.rerender(
43
+ <LoadingView
44
+ title="Starting sixb api"
45
+ subtitle={loaded.entry}
46
+ status="Migrating storage"
47
+ />
48
+ ),
49
+ })
50
+
51
+ const appOutdir = builtAppOutdir(loaded.buildOutdir)
52
+ const hasBuiltCustomApp = await stat(resolve(appOutdir, "index.html"))
53
+ .then(() => true)
54
+ .catch(() => false)
55
+ const topology = resolveBrowserTopology({
56
+ role: "api",
57
+ host: options.host,
58
+ apiHost: options.apiHost,
59
+ port: options.port,
60
+ apiPort: options.apiPort,
61
+ apiPublicOrigin: options.apiPublicOrigin,
62
+ atlasPublicOrigin: options.atlasPublicOrigin,
63
+ appPublicOrigin: options.appPublicOrigin,
64
+ hasCustomApp: hasBuiltCustomApp,
65
+ })
66
+
67
+ server = createSixbServer({
68
+ sixb: sixb as unknown as never,
69
+ port: topology.apiPort,
70
+ host: topology.apiHost,
71
+ quiet: true,
72
+ browser: {
73
+ publicOrigin: topology.apiPublicOrigin,
74
+ allowedOrigins: topology.allowedBrowserOrigins,
75
+ },
76
+ })
77
+ await server.start()
78
+
79
+ app.rerender(
80
+ <RoleView
81
+ title="Sixb API started"
82
+ name={sixb.id}
83
+ serviceName="API"
84
+ items={[
85
+ { label: "API", value: apiUrl(topology) },
86
+ { label: "API docs", value: apiDocsUrl(topology) },
87
+ { label: "Events", value: apiEventsUrl(topology) },
88
+ ]}
89
+ storage={migration.summary}
90
+ />
91
+ )
92
+
93
+ await runUntilSignal(async () => {
94
+ app.unmount()
95
+ console.log("\nShutting down api...")
96
+ await stopQuietly(() => server?.stop() ?? Promise.resolve())
97
+ if (sixb) {
98
+ await stopSixbProviders(sixb)
99
+ }
100
+ sixb = null
101
+ })
102
+ } catch (error) {
103
+ app.unmount()
104
+ await stopQuietly(() => server?.stop() ?? Promise.resolve())
105
+ if (sixb) {
106
+ await stopSixbProviders(sixb)
107
+ }
108
+ await renderCliError(error)
109
+ process.exit(1)
110
+ }
111
+ }
@@ -0,0 +1,91 @@
1
+ import { stat } from "node:fs/promises"
2
+ import { resolve } from "node:path"
3
+ import { type CustomAppDevServer, createCustomApp } from "@sixb/app"
4
+ import { resolveBrowserTopology, servedUrl } from "../lib/browser-topology"
5
+ import type { LoadedSixb } from "../lib/loadSixb"
6
+ import { builtAppOutdir, loadProductionSixb } from "../lib/production"
7
+ import { runUntilSignal, stopQuietly, stopSixbProviders } from "../lib/runtime"
8
+ import { LoadingView, RoleView, renderCliError, renderPersistent } from "../ui"
9
+
10
+ export interface AppOptions {
11
+ entry?: string
12
+ port?: string
13
+ host?: string
14
+ apiPublicOrigin?: string
15
+ appPublicOrigin?: string
16
+ }
17
+
18
+ export async function runApp(options: AppOptions = {}) {
19
+ process.env.NODE_ENV = "production"
20
+
21
+ const loaded = await loadProductionSixb({ entry: options.entry, role: "app" })
22
+ const app = renderPersistent(
23
+ <LoadingView title="Starting sixb app" subtitle={loaded.entry} status="Starting app" />
24
+ )
25
+
26
+ let sixb: LoadedSixb | null = loaded.sixb
27
+ let customAppServer: CustomAppDevServer | null = null
28
+
29
+ try {
30
+ const appOutdir = builtAppOutdir(loaded.buildOutdir)
31
+ const hasBuiltCustomApp = await stat(resolve(appOutdir, "index.html"))
32
+ .then(() => true)
33
+ .catch(() => false)
34
+
35
+ if (!hasBuiltCustomApp) {
36
+ throw new Error(
37
+ `[SixbCustomApp] No built app found in ${appOutdir}. Run \`sixb build\` before \`sixb app\`.`
38
+ )
39
+ }
40
+
41
+ const topology = resolveBrowserTopology({
42
+ role: "app",
43
+ host: options.host,
44
+ port: options.port,
45
+ apiPublicOrigin: options.apiPublicOrigin,
46
+ appPublicOrigin: options.appPublicOrigin,
47
+ })
48
+
49
+ const customApp = await createCustomApp({
50
+ rootDir: loaded.projectRoot,
51
+ apiBaseUrl: topology.apiPublicOrigin,
52
+ audience: "app",
53
+ authEnabled: sixb.auth.isEnabled(),
54
+ })
55
+ customAppServer = await customApp.start({
56
+ host: topology.host,
57
+ port: topology.appPort,
58
+ outdir: appOutdir,
59
+ apiBaseUrl: topology.apiPublicOrigin,
60
+ audience: "app",
61
+ authEnabled: sixb.auth.isEnabled(),
62
+ })
63
+
64
+ app.rerender(
65
+ <RoleView
66
+ title="Sixb app started"
67
+ name={sixb.id}
68
+ serviceName="Custom app"
69
+ items={[{ label: "URL", value: servedUrl(topology) }]}
70
+ />
71
+ )
72
+
73
+ await runUntilSignal(async () => {
74
+ app.unmount()
75
+ console.log("\nShutting down app...")
76
+ await stopQuietly(() => customAppServer?.stop() ?? Promise.resolve())
77
+ if (sixb) {
78
+ await stopSixbProviders(sixb)
79
+ }
80
+ sixb = null
81
+ })
82
+ } catch (error) {
83
+ app.unmount()
84
+ await stopQuietly(() => customAppServer?.stop() ?? Promise.resolve())
85
+ if (sixb) {
86
+ await stopSixbProviders(sixb)
87
+ }
88
+ await renderCliError(error)
89
+ process.exit(1)
90
+ }
91
+ }
@@ -0,0 +1,75 @@
1
+ import { type AtlasAppServer, createAtlasApp } from "@sixb/atlas"
2
+ import { resolveBrowserTopology, servedUrl } from "../lib/browser-topology"
3
+ import type { LoadedSixb } from "../lib/loadSixb"
4
+ import { builtAtlasOutdir, loadProductionSixb } from "../lib/production"
5
+ import { runUntilSignal, stopQuietly, stopSixbProviders } from "../lib/runtime"
6
+ import { LoadingView, RoleView, renderCliError, renderPersistent } from "../ui"
7
+
8
+ export interface AtlasOptions {
9
+ entry?: string
10
+ port?: string
11
+ host?: string
12
+ apiPublicOrigin?: string
13
+ atlasPublicOrigin?: string
14
+ }
15
+
16
+ export async function runAtlas(options: AtlasOptions = {}) {
17
+ process.env.NODE_ENV = "production"
18
+
19
+ const loaded = await loadProductionSixb({ entry: options.entry, role: "atlas" })
20
+ const app = renderPersistent(
21
+ <LoadingView title="Starting sixb atlas" subtitle={loaded.entry} status="Starting Atlas" />
22
+ )
23
+
24
+ let sixb: LoadedSixb | null = loaded.sixb
25
+ let atlasServer: AtlasAppServer | null = null
26
+
27
+ try {
28
+ const topology = resolveBrowserTopology({
29
+ role: "atlas",
30
+ host: options.host,
31
+ port: options.port,
32
+ apiPublicOrigin: options.apiPublicOrigin,
33
+ atlasPublicOrigin: options.atlasPublicOrigin,
34
+ })
35
+
36
+ const atlas = createAtlasApp({
37
+ apiBaseUrl: topology.apiPublicOrigin,
38
+ audience: "atlas",
39
+ authEnabled: sixb.auth.isEnabled(),
40
+ })
41
+ atlasServer = await atlas.start({
42
+ host: topology.host,
43
+ port: topology.atlasPort,
44
+ development: false,
45
+ outdir: builtAtlasOutdir(loaded.buildOutdir),
46
+ })
47
+
48
+ app.rerender(
49
+ <RoleView
50
+ title="Sixb Atlas started"
51
+ name={sixb.id}
52
+ serviceName="Atlas"
53
+ items={[{ label: "URL", value: servedUrl(topology) }]}
54
+ />
55
+ )
56
+
57
+ await runUntilSignal(async () => {
58
+ app.unmount()
59
+ console.log("\nShutting down atlas...")
60
+ await stopQuietly(() => atlasServer?.stop() ?? Promise.resolve())
61
+ if (sixb) {
62
+ await stopSixbProviders(sixb)
63
+ }
64
+ sixb = null
65
+ })
66
+ } catch (error) {
67
+ app.unmount()
68
+ await stopQuietly(() => atlasServer?.stop() ?? Promise.resolve())
69
+ if (sixb) {
70
+ await stopSixbProviders(sixb)
71
+ }
72
+ await renderCliError(error)
73
+ process.exit(1)
74
+ }
75
+ }
@@ -0,0 +1,96 @@
1
+ import { getProjectInfo } from "@sixb/client"
2
+ import {
3
+ createCliSixbClient,
4
+ resolveApiClientConfig,
5
+ SixbApiError,
6
+ unwrapSixbApiResult,
7
+ } from "../lib/api-client"
8
+ import { KeyValueResultView, renderStatic } from "../ui"
9
+
10
+ export interface AuthCommandOptions {
11
+ readonly action?: string
12
+ readonly apiUrl?: string
13
+ readonly token?: string
14
+ readonly json?: boolean
15
+ }
16
+
17
+ export async function runAuth(options: AuthCommandOptions = {}) {
18
+ const action = options.action ?? "status"
19
+ if (action !== "status") {
20
+ throw new Error("Usage: sixb auth status")
21
+ }
22
+
23
+ const config = resolveApiClientConfig(options)
24
+ if (!config.token) {
25
+ await renderStatus({
26
+ authenticated: false,
27
+ apiUrl: config.apiUrl,
28
+ apiUrlSource: config.apiUrlSource,
29
+ message: "No API token found. Set SIXB_API_TOKEN or pass --token.",
30
+ json: options.json,
31
+ })
32
+ process.exitCode = 1
33
+ return
34
+ }
35
+
36
+ const client = createCliSixbClient(config)
37
+ try {
38
+ const project = unwrapSixbApiResult(await getProjectInfo({ client }))
39
+ await renderStatus({
40
+ authenticated: true,
41
+ apiUrl: config.apiUrl,
42
+ apiUrlSource: config.apiUrlSource,
43
+ tokenSource: config.tokenSource,
44
+ projectId: project.id,
45
+ json: options.json,
46
+ })
47
+ } catch (error) {
48
+ if (error instanceof SixbApiError && (error.status === 401 || error.status === 403)) {
49
+ await renderStatus({
50
+ authenticated: false,
51
+ apiUrl: config.apiUrl,
52
+ apiUrlSource: config.apiUrlSource,
53
+ tokenSource: config.tokenSource,
54
+ message: error.message,
55
+ json: options.json,
56
+ })
57
+ process.exitCode = 1
58
+ return
59
+ }
60
+
61
+ throw error
62
+ }
63
+ }
64
+
65
+ async function renderStatus(input: {
66
+ readonly authenticated: boolean
67
+ readonly apiUrl: string
68
+ readonly apiUrlSource: string
69
+ readonly tokenSource?: string
70
+ readonly projectId?: string
71
+ readonly message?: string
72
+ readonly json?: boolean
73
+ }) {
74
+ if (input.json) {
75
+ const { json: _json, ...payload } = input
76
+ console.log(JSON.stringify(payload, null, 2))
77
+ return
78
+ }
79
+
80
+ const items = [{ label: "API", value: `${input.apiUrl} (${input.apiUrlSource})` }]
81
+ if (input.projectId) {
82
+ items.push({ label: "Project", value: input.projectId })
83
+ }
84
+ if (input.tokenSource) {
85
+ items.push({ label: "Token", value: input.tokenSource })
86
+ }
87
+
88
+ await renderStatic(
89
+ <KeyValueResultView
90
+ title={input.authenticated ? "Authenticated" : "Not authenticated"}
91
+ titleColor={input.authenticated ? "green" : "red"}
92
+ items={items}
93
+ message={input.message}
94
+ />
95
+ )
96
+ }