@sixb/cli 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -22
- package/dist/commands/access-token-utils.d.ts.map +1 -1
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/dev-runner.d.ts.map +1 -1
- package/dist/commands/env.d.ts +6 -1
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/lake-cleanup.d.ts +2 -12
- package/dist/commands/lake-cleanup.d.ts.map +1 -1
- package/dist/commands/lake-rejected.d.ts +10 -0
- package/dist/commands/lake-rejected.d.ts.map +1 -0
- package/dist/commands/orchestrator.d.ts.map +1 -1
- package/dist/commands/scheduler.d.ts +2 -5
- package/dist/commands/scheduler.d.ts.map +1 -1
- package/dist/commands/worker-group.d.ts.map +1 -1
- package/dist/lib/command-line.d.ts +12 -7
- package/dist/lib/command-line.d.ts.map +1 -1
- package/dist/lib/deploy-release.d.ts +7 -1
- package/dist/lib/deploy-release.d.ts.map +1 -1
- package/dist/lib/duration.d.ts +3 -0
- package/dist/lib/duration.d.ts.map +1 -0
- package/dist/lib/loadSixb.d.ts.map +1 -1
- package/dist/lib/production-roles.d.ts +0 -4
- package/dist/lib/production-roles.d.ts.map +1 -1
- package/dist/lib/runtime.d.ts +7 -9
- package/dist/lib/runtime.d.ts.map +1 -1
- package/dist/lib/worker-concurrency.d.ts.map +1 -1
- package/dist/lib/worker-registry.d.ts +4 -1
- package/dist/lib/worker-registry.d.ts.map +1 -1
- package/dist/tui/format.d.ts.map +1 -1
- package/dist/ui/deploy-screens.d.ts +4 -2
- package/dist/ui/deploy-screens.d.ts.map +1 -1
- package/dist/ui/env-screens.d.ts +14 -1
- package/dist/ui/env-screens.d.ts.map +1 -1
- package/dist/ui/screens.d.ts +5 -11
- package/dist/ui/screens.d.ts.map +1 -1
- package/package.json +20 -16
- package/src/commands/access-token-utils.ts +2 -20
- package/src/commands/api.ts +7 -0
- package/src/commands/check.ts +75 -1
- package/src/commands/deploy.ts +15 -3
- package/src/commands/dev-runner.ts +5 -0
- package/src/commands/env.ts +99 -20
- package/src/commands/lake-cleanup.ts +25 -48
- package/src/commands/lake-rejected.ts +36 -0
- package/src/commands/orchestrator.ts +2 -7
- package/src/commands/scheduler.ts +11 -61
- package/src/commands/worker-group.ts +6 -3
- package/src/index.tsx +10 -4
- package/src/lib/command-line.ts +25 -12
- package/src/lib/deploy-release.ts +42 -2
- package/src/lib/duration.ts +11 -0
- package/src/lib/loadSixb.ts +3 -4
- package/src/lib/production-roles.ts +0 -1
- package/src/lib/runtime.ts +62 -43
- package/src/lib/shareable-providers.ts +2 -2
- package/src/lib/worker-concurrency.ts +1 -0
- package/src/lib/worker-registry.ts +36 -1
- package/src/tui/format.ts +10 -1
- package/src/ui/deploy-screens.ts +8 -1
- package/src/ui/env-screens.ts +39 -5
- package/src/ui/screens.ts +21 -20
package/dist/ui/screens.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LakeRetentionReport } from "@sixb/core/lake-storage";
|
|
1
2
|
import { type CliHelp } from "../lib/command-line";
|
|
2
3
|
export type KeyValueItem = {
|
|
3
4
|
label: string;
|
|
@@ -114,18 +115,11 @@ export declare function lakeCheckView({ projectId, warnings, }: {
|
|
|
114
115
|
projectId: string;
|
|
115
116
|
warnings?: readonly string[];
|
|
116
117
|
}): string;
|
|
117
|
-
export
|
|
118
|
-
readonly dryRun: boolean;
|
|
119
|
-
readonly expireOlderThan: string;
|
|
120
|
-
readonly deleteOlderThan: string;
|
|
121
|
-
readonly snapshots: number;
|
|
122
|
-
readonly keptSnapshots?: number;
|
|
123
|
-
readonly oldFiles: number;
|
|
124
|
-
readonly orphanedFiles: number;
|
|
125
|
-
}
|
|
126
|
-
export declare function lakeCleanupView({ projectId, report, }: {
|
|
118
|
+
export declare function lakeCleanupView({ projectId, keepVersionsFor, deleteFilesAfter, report, }: {
|
|
127
119
|
projectId: string;
|
|
128
|
-
|
|
120
|
+
keepVersionsFor: string;
|
|
121
|
+
deleteFilesAfter: string;
|
|
122
|
+
report: LakeRetentionReport;
|
|
129
123
|
}): string;
|
|
130
124
|
export declare function initView({ name, files, commands: next, }: {
|
|
131
125
|
name: string;
|
package/dist/ui/screens.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screens.d.ts","sourceRoot":"","sources":["../../src/ui/screens.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EAIb,MAAM,qBAAqB,CAAA;AAyB5B,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAwC3D,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,QAAQ,CAAC,EAAE,YAAY,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,MAAM,CAwBjF;AAED,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EACJ,YAAY,GACb,EAAE;IACD,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GAAG,MAAM,CAQT;AAID,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,OAAO,EACP,WAAW,EACX,OAAY,GACb,EAAE;IACD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC5B,GAAG,MAAM,CAkBT;AAID,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,KAAK,EACL,UAAoB,EACpB,OAAO,GACR,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,Q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,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,MAAM,EACN,OAAY,GACb,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,CAAA;IAC1C,+EAA+E;IAC/E,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC5B,GAAG,MAAM,CAOT;AAED,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,QAAa,GACd,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC7B,GAAG,MAAM,CAET;AAED,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,MAAM,GACP,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB,EAAE,MAAM,CAAA;IACxB,MAAM,EAAE,mBAAmB,CAAA;CAC5B,GAAG,MAAM,CAyBT;AAED,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,KAAK,EACL,QAAQ,EAAE,IAAI,GACf,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;CAC5B,GAAG,MAAM,CAKT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sixb/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Command-line interface for Sixb projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sixb",
|
|
@@ -25,33 +25,37 @@
|
|
|
25
25
|
"build": "bun ../../scripts/build-package.ts",
|
|
26
26
|
"typecheck": "tsc --noEmit",
|
|
27
27
|
"test": "bun test",
|
|
28
|
-
"test:e2e": "bun test ./tests/build.e2e.ts && bun test ./tests/prod-roles.e2e.ts && bun test ./tests/worker-group.e2e.ts && bun test ./tests/dev-reload.e2e.ts && bun test ./tests/pipeline-markings.e2e.ts && bun test ./tests/connect-signed-out.e2e.ts && bun test ./tests/desktop-runner.e2e.ts",
|
|
28
|
+
"test:e2e": "bun test ./tests/build.e2e.ts && bun test ./tests/prod-roles.e2e.ts && bun test ./tests/worker-group.e2e.ts && bun test ./tests/ingest-roles.e2e.ts && bun test ./tests/dev-reload.e2e.ts && bun test ./tests/pipeline-markings.e2e.ts && bun test ./tests/run-recovery.e2e.ts && bun test ./tests/run-recovery-infra.e2e.ts && bun test ./tests/run-recovery-dev.e2e.ts && bun test ./tests/connect-signed-out.e2e.ts && bun test ./tests/desktop-runner.e2e.ts",
|
|
29
29
|
"prepack": "bun run build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@opentui/core": "0.6.6",
|
|
33
33
|
"@opentui/react": "0.6.6",
|
|
34
|
-
"@sixb/agent": "0.2.
|
|
35
|
-
"@sixb/agent-worker": "0.2.
|
|
36
|
-
"@sixb/app": "^0.2.
|
|
37
|
-
"@sixb/client": "^0.2.
|
|
38
|
-
"@sixb/core": "0.2.
|
|
39
|
-
"@sixb/cli-core": "^0.2.
|
|
40
|
-
"@sixb/
|
|
41
|
-
"@sixb/
|
|
42
|
-
"@sixb/
|
|
43
|
-
"@sixb/
|
|
34
|
+
"@sixb/agent": "0.2.3",
|
|
35
|
+
"@sixb/agent-worker": "0.2.3",
|
|
36
|
+
"@sixb/app": "^0.2.3",
|
|
37
|
+
"@sixb/client": "^0.2.3",
|
|
38
|
+
"@sixb/core": "0.2.3",
|
|
39
|
+
"@sixb/cli-core": "^0.2.3",
|
|
40
|
+
"@sixb/lake-worker": "0.2.3",
|
|
41
|
+
"@sixb/orchestrator": "0.2.3",
|
|
42
|
+
"@sixb/pipeline-worker": "0.2.3",
|
|
43
|
+
"@sixb/projection-worker": "0.2.3",
|
|
44
|
+
"@sixb/rules-worker": "0.2.3",
|
|
44
45
|
"@sixb/sandboxes-local": "^0.2.0",
|
|
45
|
-
"@sixb/server": "0.2.
|
|
46
|
-
"@sixb/sync-worker": "0.2.
|
|
47
|
-
"@sixb/workflow-worker": "0.2.
|
|
46
|
+
"@sixb/server": "0.2.3",
|
|
47
|
+
"@sixb/sync-worker": "0.2.3",
|
|
48
|
+
"@sixb/workflow-worker": "0.2.3",
|
|
48
49
|
"create-sixb": "^0.2.0",
|
|
49
50
|
"react": "^19.2.0"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@sixb/deploy-ssh": "0.2.0",
|
|
53
54
|
"@sixb/desktop": "0.2.1",
|
|
54
|
-
"@sixb/ducklake": "0.2.
|
|
55
|
+
"@sixb/ducklake": "0.2.3",
|
|
56
|
+
"@sixb/pg": "0.2.3",
|
|
57
|
+
"@sixb/queues-bullmq": "0.2.3",
|
|
58
|
+
"@sixb/sqlite": "0.2.3",
|
|
55
59
|
"@types/bun": "latest",
|
|
56
60
|
"@types/react": "^19.0.0",
|
|
57
61
|
"typescript": "^5.7.0"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { SixbApiClientConfig } from "../lib/api-client"
|
|
2
|
+
import { parseDurationMs } from "../lib/duration"
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* The API creates tokens only for a signed-in session, never for another access token, so say how
|
|
@@ -25,7 +26,7 @@ export function resolveExpiration(options: ExpirationOptions): string {
|
|
|
25
26
|
return date.toISOString()
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
const duration = parseDurationMs(options.expiresIn ?? "90d")
|
|
29
|
+
const duration = parseDurationMs(options.expiresIn ?? "90d", "--expires-in")
|
|
29
30
|
return new Date(Date.now() + duration).toISOString()
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -55,22 +56,3 @@ export function formatDate(value: string | undefined): string {
|
|
|
55
56
|
if (Number.isNaN(date.getTime())) return value
|
|
56
57
|
return date.toISOString().replace("T", " ").slice(0, 16)
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
function parseDurationMs(value: string): number {
|
|
60
|
-
const match = value.trim().match(/^(\d+)(m|h|d|w|y)$/)
|
|
61
|
-
if (!match) {
|
|
62
|
-
throw new Error("[SixbCLI] Use --expires-in like 30d, 12h, 4w, or 1y.")
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const amount = Number(match[1])
|
|
66
|
-
const unit = match[2]
|
|
67
|
-
const multipliers = {
|
|
68
|
-
m: 60_000,
|
|
69
|
-
h: 60 * 60_000,
|
|
70
|
-
d: 24 * 60 * 60_000,
|
|
71
|
-
w: 7 * 24 * 60 * 60_000,
|
|
72
|
-
y: 365 * 24 * 60 * 60_000,
|
|
73
|
-
} as const
|
|
74
|
-
|
|
75
|
-
return amount * multipliers[unit as keyof typeof multipliers]
|
|
76
|
-
}
|
package/src/commands/api.ts
CHANGED
|
@@ -64,6 +64,10 @@ export async function runApi(options: ApiOptions = {}) {
|
|
|
64
64
|
port: topology.apiPort,
|
|
65
65
|
hostname: topology.apiHost,
|
|
66
66
|
quiet: true,
|
|
67
|
+
// `sixb orchestrator` owns it.
|
|
68
|
+
ontologyMaintenance: false,
|
|
69
|
+
// A lake worker owns it. Without one, changes wait where `sixb check` and the Console show.
|
|
70
|
+
ingestFlush: false,
|
|
67
71
|
browser: {
|
|
68
72
|
publicOrigin: topology.apiPublicOrigin,
|
|
69
73
|
allowedOrigins: topology.allowedBrowserOrigins,
|
|
@@ -85,6 +89,9 @@ export async function runApi(options: ApiOptions = {}) {
|
|
|
85
89
|
{ label: "events", value: apiEventsUrl(topology) },
|
|
86
90
|
],
|
|
87
91
|
storage: migration.summary,
|
|
92
|
+
warnings: [
|
|
93
|
+
"This process runs no upkeep. Keep `sixb orchestrator` running, even with no schedules: it delivers events left undelivered, purges expired records, and runs cron.",
|
|
94
|
+
],
|
|
88
95
|
})
|
|
89
96
|
)
|
|
90
97
|
|
package/src/commands/check.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { dirname, resolve } from "node:path"
|
|
2
|
+
import { getLakeRetentionRuntime, ingestStalledSince } from "@sixb/core/internal/runtime"
|
|
3
|
+
import { countLostRuns } from "@sixb/core/internal/workers"
|
|
2
4
|
import { assertDeclaredEnv } from "../lib/env-config"
|
|
3
5
|
import { errorMessage } from "../lib/errors"
|
|
4
6
|
import { checkRuntimeHealth } from "../lib/health"
|
|
@@ -59,7 +61,12 @@ export async function runCheck(options: CheckOptions = {}) {
|
|
|
59
61
|
// are a different thing and counting them here read as ontology drift.
|
|
60
62
|
warnings: 0,
|
|
61
63
|
},
|
|
62
|
-
warnings: [
|
|
64
|
+
warnings: [
|
|
65
|
+
...health.warnings,
|
|
66
|
+
...markings.warnings,
|
|
67
|
+
...(await lakeWorkerWarnings(sixb, health.storage.ok)),
|
|
68
|
+
...(await lostRunWarnings(sixb, health.storage.ok)),
|
|
69
|
+
],
|
|
63
70
|
})
|
|
64
71
|
)
|
|
65
72
|
|
|
@@ -87,6 +94,73 @@ export async function runCheck(options: CheckOptions = {}) {
|
|
|
87
94
|
|
|
88
95
|
const CLOSE_TIMEOUT_MS = 10_000
|
|
89
96
|
|
|
97
|
+
/**
|
|
98
|
+
* What storage says, since no process knows what the others run. A storage that is down or behind
|
|
99
|
+
* has its own row in this report.
|
|
100
|
+
*/
|
|
101
|
+
async function lakeWorkerWarnings(
|
|
102
|
+
sixb: LoadedSixbHost,
|
|
103
|
+
storageOk: boolean
|
|
104
|
+
): Promise<readonly string[]> {
|
|
105
|
+
if (!storageOk) return []
|
|
106
|
+
|
|
107
|
+
const [status, stalled] = await Promise.all([
|
|
108
|
+
getLakeRetentionRuntime(sixb)
|
|
109
|
+
.status()
|
|
110
|
+
.catch(() => null),
|
|
111
|
+
stalledIngestDatasets(sixb),
|
|
112
|
+
])
|
|
113
|
+
|
|
114
|
+
return [
|
|
115
|
+
...(status?.state === "no-worker"
|
|
116
|
+
? ["Lake cleanup is requested but no lake worker has run it. Run `sixb worker lake`."]
|
|
117
|
+
: []),
|
|
118
|
+
...(stalled.length > 0
|
|
119
|
+
? [
|
|
120
|
+
`Ingested changes wait and nothing writes them, in ${stalled.join(", ")}. Run \`sixb worker lake\`.`,
|
|
121
|
+
]
|
|
122
|
+
: []),
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async function stalledIngestDatasets(sixb: LoadedSixbHost): Promise<readonly string[]> {
|
|
127
|
+
const summaries = await sixb.storage.datasetIngest
|
|
128
|
+
?.summarize({ projectId: sixb.id })
|
|
129
|
+
.catch(() => [])
|
|
130
|
+
|
|
131
|
+
return (summaries ?? [])
|
|
132
|
+
.filter(
|
|
133
|
+
(summary) => summary.pendingDeliveries > 0 && ingestStalledSince(summary, Date.now()) !== null
|
|
134
|
+
)
|
|
135
|
+
.map((summary) => summary.datasetId)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* What the orchestrator's `runs` pass will do once it starts: runs that lost their job go on, with
|
|
140
|
+
* their side effects, so whoever is upgrading can look at them first.
|
|
141
|
+
*/
|
|
142
|
+
async function lostRunWarnings(
|
|
143
|
+
sixb: LoadedSixbHost,
|
|
144
|
+
storageOk: boolean
|
|
145
|
+
): Promise<readonly string[]> {
|
|
146
|
+
if (!storageOk) return []
|
|
147
|
+
|
|
148
|
+
const counts = await countLostRuns({
|
|
149
|
+
projectId: sixb.id,
|
|
150
|
+
storage: sixb.storage,
|
|
151
|
+
queues: sixb.queues,
|
|
152
|
+
events: sixb.events,
|
|
153
|
+
now: new Date(),
|
|
154
|
+
}).catch(() => [])
|
|
155
|
+
|
|
156
|
+
return counts.flatMap(({ primitive, goOn, end }) => [
|
|
157
|
+
...(goOn > 0
|
|
158
|
+
? [`${goOn} ${primitive} run(s) lost their job and will go on when the orchestrator starts.`]
|
|
159
|
+
: []),
|
|
160
|
+
...(end > 0 ? [`${end} ${primitive} run(s) are too old to go on and will end cancelled.`] : []),
|
|
161
|
+
])
|
|
162
|
+
}
|
|
163
|
+
|
|
90
164
|
interface MarkingsCheck {
|
|
91
165
|
readonly ok: boolean
|
|
92
166
|
readonly warning?: boolean
|
package/src/commands/deploy.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
DeployRelease,
|
|
11
11
|
} from "@sixb/core/deploy"
|
|
12
12
|
import { loadDeployConfig } from "../lib/deploy-config"
|
|
13
|
-
import { buildDeployRelease } from "../lib/deploy-release"
|
|
13
|
+
import { buildDeployRelease, lakeWorkChecks } from "../lib/deploy-release"
|
|
14
14
|
import {
|
|
15
15
|
commitHasProjectFile,
|
|
16
16
|
deployer,
|
|
@@ -68,7 +68,13 @@ export async function runDeploy(options: DeployOptions = {}): Promise<void> {
|
|
|
68
68
|
envFromSource,
|
|
69
69
|
})
|
|
70
70
|
if (options.json) return writeJson(release)
|
|
71
|
-
await renderStatic(
|
|
71
|
+
await renderStatic(
|
|
72
|
+
deployReleaseView({
|
|
73
|
+
release,
|
|
74
|
+
configPath: relative(cwd, path) || path,
|
|
75
|
+
warnings: configWarnings(config),
|
|
76
|
+
})
|
|
77
|
+
)
|
|
72
78
|
return
|
|
73
79
|
}
|
|
74
80
|
|
|
@@ -118,6 +124,7 @@ export async function runDeploy(options: DeployOptions = {}): Promise<void> {
|
|
|
118
124
|
release,
|
|
119
125
|
seconds: (Date.now() - deployStartedAt) / 1000,
|
|
120
126
|
keptEnv: progress.state.keptEnv,
|
|
127
|
+
warnings: configWarnings(config),
|
|
121
128
|
})
|
|
122
129
|
)
|
|
123
130
|
}
|
|
@@ -130,9 +137,10 @@ export async function runDeployCheck(options: { readonly json?: boolean; readonl
|
|
|
130
137
|
envFromSource: Boolean((await loadEnvConfig(cwd))?.source),
|
|
131
138
|
})
|
|
132
139
|
const projectPath = await projectPathOf(cwd)
|
|
133
|
-
const
|
|
140
|
+
const targetChecks = await withTask("deploy check", `Checking ${location(config)}`, () =>
|
|
134
141
|
config.target.check(release, { name: config.name, projectPath })
|
|
135
142
|
)
|
|
143
|
+
const checks = [...targetChecks, ...lakeWorkChecks(config)]
|
|
136
144
|
if (options.json) writeJson(checks)
|
|
137
145
|
else
|
|
138
146
|
await renderStatic(deployChecksView({ name: config.name, location: location(config), checks }))
|
|
@@ -300,6 +308,10 @@ async function publicKeys(value: string): Promise<string[]> {
|
|
|
300
308
|
return [value]
|
|
301
309
|
}
|
|
302
310
|
|
|
311
|
+
function configWarnings(config: DeployConfig): readonly string[] {
|
|
312
|
+
return lakeWorkChecks(config).map((check) => `${check.label}: ${check.detail} ${check.remedy}`)
|
|
313
|
+
}
|
|
314
|
+
|
|
303
315
|
function blocksDeploy(check: DeployCheck): boolean {
|
|
304
316
|
return check.status === "fixable" || check.status === "manual"
|
|
305
317
|
}
|
|
@@ -113,6 +113,10 @@ export async function runDevRuntime(options: DevOptions = {}) {
|
|
|
113
113
|
port: topology.apiPort,
|
|
114
114
|
hostname: topology.apiHost,
|
|
115
115
|
quiet: true,
|
|
116
|
+
// The orchestrator this process co-hosts owns it.
|
|
117
|
+
ontologyMaintenance: false,
|
|
118
|
+
// So does the lake worker.
|
|
119
|
+
ingestFlush: false,
|
|
116
120
|
browser: {
|
|
117
121
|
publicOrigin: topology.apiPublicOrigin,
|
|
118
122
|
allowedOrigins: topology.allowedBrowserOrigins,
|
|
@@ -156,6 +160,7 @@ export async function runDevRuntime(options: DevOptions = {}) {
|
|
|
156
160
|
{ type: "pipeline", worker: runtime.pipelineWorker },
|
|
157
161
|
{ type: "workflow", worker: runtime.workflowWorker },
|
|
158
162
|
{ type: "sync", worker: runtime.syncWorker },
|
|
163
|
+
{ type: "lake", worker: runtime.lakeWorker },
|
|
159
164
|
].flatMap(({ type, worker }) => (worker ? [{ type, concurrency: worker.concurrency }] : [])),
|
|
160
165
|
warnings: devApp.warning ? [devApp.warning, ...runtime.warnings] : runtime.warnings,
|
|
161
166
|
}
|
package/src/commands/env.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { errorMessage, SixbCliError } from "../lib/errors"
|
|
|
23
23
|
import { promptHidden } from "../lib/hidden-prompt"
|
|
24
24
|
import { renderStatic } from "../ui"
|
|
25
25
|
import {
|
|
26
|
+
type EnvInitConfig,
|
|
26
27
|
type EnvStatusCell,
|
|
27
28
|
envInitView,
|
|
28
29
|
envKeptView,
|
|
@@ -34,6 +35,7 @@ import { canRunLive } from "../ui/live/can-run-live"
|
|
|
34
35
|
|
|
35
36
|
const ENV_NAMES: readonly EnvName[] = ["dev", "prod"]
|
|
36
37
|
const DOPPLER_PACKAGE = "@sixb/env-doppler"
|
|
38
|
+
const SOURCE_EXAMPLE = `Add one, such as \`source: doppler({ project: "shop" })\` from ${DOPPLER_PACKAGE}, or \`source: azureKeyVault({ vaults: { dev: "shop-dev", prod: "shop-prod" } })\` from @sixb/env-azure-key-vault.`
|
|
37
39
|
|
|
38
40
|
// ─── pull ────────────────────────────────────────────────────────────────────
|
|
39
41
|
|
|
@@ -264,16 +266,25 @@ export async function runEnvStatus(options: { readonly cwd?: string } = {}): Pro
|
|
|
264
266
|
|
|
265
267
|
// ─── init ────────────────────────────────────────────────────────────────────
|
|
266
268
|
|
|
269
|
+
/**
|
|
270
|
+
* Moves a project's values to its source. Given a Doppler project, it also writes `sixb.env.ts`.
|
|
271
|
+
* Without one, it uploads to the source `sixb.env.ts` already names, whatever it is, and fills in
|
|
272
|
+
* its empty `vars: {}`.
|
|
273
|
+
*/
|
|
267
274
|
export async function runEnvInit(options: {
|
|
268
|
-
readonly project
|
|
275
|
+
readonly project?: string
|
|
269
276
|
readonly dev?: string
|
|
270
277
|
readonly prod?: string
|
|
271
278
|
readonly cwd?: string
|
|
272
279
|
}): Promise<void> {
|
|
273
280
|
const cwd = options.cwd ?? process.cwd()
|
|
274
281
|
const configPath = join(cwd, ENV_CONFIG_FILE)
|
|
275
|
-
|
|
276
|
-
|
|
282
|
+
const { project } = options
|
|
283
|
+
const configExists = await Bun.file(configPath).exists()
|
|
284
|
+
if (project !== undefined && configExists) {
|
|
285
|
+
throw new SixbCliError(`[SixbEnv] ${ENV_CONFIG_FILE} already exists.`, {
|
|
286
|
+
remediation: `To upload to the source it names, leave out the project: ${INIT_USAGE}`,
|
|
287
|
+
})
|
|
277
288
|
}
|
|
278
289
|
|
|
279
290
|
const files = [
|
|
@@ -283,11 +294,13 @@ export async function runEnvInit(options: {
|
|
|
283
294
|
const given = files.flatMap(([env, file]) => (file === undefined ? [] : [{ env, file }]))
|
|
284
295
|
if (given.length === 0) {
|
|
285
296
|
throw new SixbCliError("[SixbEnv] Say where the current values are.", {
|
|
286
|
-
remediation:
|
|
297
|
+
remediation: project === undefined ? INIT_USAGE : `sixb env init ${project} ${INIT_FILES}`,
|
|
287
298
|
})
|
|
288
299
|
}
|
|
289
300
|
|
|
290
|
-
const
|
|
301
|
+
const existing = configExists ? await loadEnvConfig(cwd) : null
|
|
302
|
+
const source =
|
|
303
|
+
project === undefined ? sourceToFill(existing) : await loadDopplerSource(cwd, project)
|
|
291
304
|
const uploads = await Promise.all(
|
|
292
305
|
given.map(async ({ env, file }) => {
|
|
293
306
|
const path = resolve(cwd, file)
|
|
@@ -298,33 +311,102 @@ export async function runEnvInit(options: {
|
|
|
298
311
|
})
|
|
299
312
|
)
|
|
300
313
|
|
|
301
|
-
// Check every environment before writing to any, so a conflict changes nothing.
|
|
302
|
-
//
|
|
314
|
+
// Check every environment before writing to any, so a conflict changes nothing. A value the
|
|
315
|
+
// source already has isn't sent again, so running this twice, or after an upload that didn't
|
|
316
|
+
// finish, changes nothing it doesn't need to.
|
|
317
|
+
const sends: { readonly env: EnvName; readonly values: Record<string, string> }[] = []
|
|
303
318
|
for (const { env, values } of uploads) {
|
|
304
|
-
const
|
|
319
|
+
const current = await source.read(env)
|
|
305
320
|
const conflicts = Object.keys(values).filter(
|
|
306
|
-
(name) => name in
|
|
321
|
+
(name) => name in current && current[name] !== values[name]
|
|
307
322
|
)
|
|
308
323
|
if (conflicts.length > 0) {
|
|
309
324
|
throw new SixbCliError(
|
|
310
|
-
`[SixbEnv] ${
|
|
325
|
+
`[SixbEnv] ${project ?? "The source"} already has other values in ${env} for ${conflicts.sort().join(", ")}.`,
|
|
311
326
|
{
|
|
312
327
|
remediation:
|
|
313
328
|
"Change them in your source's dashboard, or edit the file, and run this again.",
|
|
314
329
|
}
|
|
315
330
|
)
|
|
316
331
|
}
|
|
332
|
+
sends.push({
|
|
333
|
+
env,
|
|
334
|
+
values: Object.fromEntries(Object.entries(values).filter(([name]) => !(name in current))),
|
|
335
|
+
})
|
|
317
336
|
}
|
|
318
|
-
for (const { env, values } of
|
|
337
|
+
for (const { env, values } of sends) await source.write(env, values)
|
|
319
338
|
|
|
320
339
|
const vars = declaredVars(uploads)
|
|
321
|
-
|
|
340
|
+
let config: EnvInitConfig
|
|
341
|
+
if (project !== undefined) {
|
|
342
|
+
await writeFile(configPath, renderEnvConfig(project, vars))
|
|
343
|
+
config = { kind: "written", names: Object.keys(vars).length }
|
|
344
|
+
} else {
|
|
345
|
+
config = await fillVars(configPath, existing?.vars ?? {}, vars)
|
|
346
|
+
}
|
|
322
347
|
await renderStatic(
|
|
323
348
|
envInitView({
|
|
324
|
-
uploaded: uploads.map(({ env, values }) =>
|
|
325
|
-
|
|
349
|
+
uploaded: uploads.map(({ env, values }, index) => {
|
|
350
|
+
const sent = Object.keys(sends[index]?.values ?? {}).length
|
|
351
|
+
return { env, count: sent, already: Object.keys(values).length - sent }
|
|
352
|
+
}),
|
|
353
|
+
config,
|
|
354
|
+
})
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const INIT_FILES = "--dev .env --prod .env.prod"
|
|
359
|
+
const INIT_USAGE = `sixb env init ${INIT_FILES}`
|
|
360
|
+
|
|
361
|
+
function sourceToFill(config: EnvConfig | null): EnvSource {
|
|
362
|
+
if (!config) {
|
|
363
|
+
throw new SixbCliError(`[SixbEnv] There's no ${ENV_CONFIG_FILE} naming a source yet.`, {
|
|
364
|
+
remediation: `Write one with its source and \`vars: {}\`, then run this again. For Doppler, \`sixb env init <project> ${INIT_FILES}\` writes it for you.`,
|
|
365
|
+
})
|
|
366
|
+
}
|
|
367
|
+
if (!config.source) {
|
|
368
|
+
throw new SixbCliError(`[SixbEnv] ${ENV_CONFIG_FILE} has no \`source\` to upload to.`, {
|
|
369
|
+
remediation: SOURCE_EXAMPLE,
|
|
326
370
|
})
|
|
371
|
+
}
|
|
372
|
+
return config.source
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Declares the uploaded names in an existing `sixb.env.ts`. Only an empty `vars: {}` is replaced:
|
|
377
|
+
* anything else is the author's code, so the rules are printed for them to add instead.
|
|
378
|
+
*/
|
|
379
|
+
async function fillVars(
|
|
380
|
+
path: string,
|
|
381
|
+
declared: Readonly<Record<string, EnvVarRule>>,
|
|
382
|
+
guessed: Readonly<Record<string, EnvVarRule>>
|
|
383
|
+
): Promise<EnvInitConfig> {
|
|
384
|
+
const undeclared = Object.fromEntries(
|
|
385
|
+
Object.entries(guessed).filter(([name]) => !(name in declared))
|
|
386
|
+
)
|
|
387
|
+
const names = Object.keys(undeclared).length
|
|
388
|
+
if (names === 0) return { kind: "unchanged" }
|
|
389
|
+
|
|
390
|
+
const text = await readFile(path, "utf8")
|
|
391
|
+
const empty = [...text.matchAll(EMPTY_VARS)]
|
|
392
|
+
if (Object.keys(declared).length > 0 || empty.length !== 1) {
|
|
393
|
+
return { kind: "paste", names, lines: varLines(undeclared, "") }
|
|
394
|
+
}
|
|
395
|
+
await writeFile(
|
|
396
|
+
path,
|
|
397
|
+
text.replace(EMPTY_VARS, (_match, indent: string) => renderVars(undeclared, indent))
|
|
327
398
|
)
|
|
399
|
+
return { kind: "written", names }
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
const EMPTY_VARS = /^([ \t]*)vars:\s*\{\s*\}/gm
|
|
403
|
+
|
|
404
|
+
function renderVars(vars: Readonly<Record<string, EnvVarRule>>, indent: string): string {
|
|
405
|
+
return [`${indent}vars: {`, ...varLines(vars, `${indent} `), `${indent}}`].join("\n")
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function varLines(vars: Readonly<Record<string, EnvVarRule>>, indent: string): string[] {
|
|
409
|
+
return Object.entries(vars).map(([name, rule]) => `${indent}${name}: "${rule}",`)
|
|
328
410
|
}
|
|
329
411
|
|
|
330
412
|
/**
|
|
@@ -366,16 +448,13 @@ function uploadableValues(
|
|
|
366
448
|
}
|
|
367
449
|
|
|
368
450
|
function renderEnvConfig(project: string, vars: Readonly<Record<string, EnvVarRule>>): string {
|
|
369
|
-
const lines = Object.entries(vars).map(([name, rule]) => ` ${name}: "${rule}",`)
|
|
370
451
|
return [
|
|
371
452
|
'import { defineEnv } from "@sixb/core/env"',
|
|
372
453
|
`import { doppler } from "${DOPPLER_PACKAGE}"`,
|
|
373
454
|
"",
|
|
374
455
|
"export default defineEnv({",
|
|
375
456
|
` source: doppler({ project: ${JSON.stringify(project)} }),`,
|
|
376
|
-
|
|
377
|
-
...lines,
|
|
378
|
-
" },",
|
|
457
|
+
`${renderVars(vars, " ")},`,
|
|
379
458
|
"})",
|
|
380
459
|
"",
|
|
381
460
|
].join("\n")
|
|
@@ -410,12 +489,12 @@ async function requireSource(
|
|
|
410
489
|
const config = await loadEnvConfig(cwd)
|
|
411
490
|
if (!config) {
|
|
412
491
|
throw new SixbCliError(`[SixbEnv] No ${ENV_CONFIG_FILE} in ${cwd}.`, {
|
|
413
|
-
remediation:
|
|
492
|
+
remediation: `sixb env init <project> ${INIT_FILES}`,
|
|
414
493
|
})
|
|
415
494
|
}
|
|
416
495
|
if (!config.source) {
|
|
417
496
|
throw new SixbCliError(`[SixbEnv] ${ENV_CONFIG_FILE} has no \`source\`.`, {
|
|
418
|
-
remediation:
|
|
497
|
+
remediation: SOURCE_EXAMPLE,
|
|
419
498
|
})
|
|
420
499
|
}
|
|
421
500
|
return { config, source: config.source }
|
|
@@ -1,79 +1,56 @@
|
|
|
1
|
+
import { getLakeRetentionRuntime } from "@sixb/core/internal/runtime"
|
|
2
|
+
import { parseDurationMs } from "../lib/duration"
|
|
1
3
|
import { loadSixbFromEntry } from "../lib/loadSixb"
|
|
2
4
|
import { resolveRuntimeEntry } from "../lib/production"
|
|
3
5
|
import { stopSixbProviders } from "../lib/runtime"
|
|
4
6
|
import { lakeCleanupView, renderStatic, withTask } from "../ui"
|
|
5
7
|
|
|
6
|
-
const DEFAULT_RETENTION = "7 days"
|
|
7
|
-
|
|
8
8
|
export interface LakeCleanupOptions {
|
|
9
9
|
entry?: string
|
|
10
10
|
dryRun?: boolean
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
interface LakeMaintenanceOptions {
|
|
16
|
-
readonly dryRun?: boolean
|
|
17
|
-
readonly expireOlderThan?: string
|
|
18
|
-
readonly deleteOlderThan?: string
|
|
19
|
-
readonly protect?: readonly { readonly datasetId: string; readonly versionId: string }[]
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface LakeMaintenanceReport {
|
|
23
|
-
readonly dryRun: boolean
|
|
24
|
-
readonly expireOlderThan: string
|
|
25
|
-
readonly deleteOlderThan: string
|
|
26
|
-
readonly snapshots: number
|
|
27
|
-
/** Old snapshots kept because a version they hold is still needed, when the provider says. */
|
|
28
|
-
readonly keptSnapshots?: number
|
|
29
|
-
readonly oldFiles: number
|
|
30
|
-
readonly orphanedFiles: number
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
interface LakeMaintenanceProvider {
|
|
34
|
-
runMaintenance(options?: LakeMaintenanceOptions): Promise<LakeMaintenanceReport>
|
|
11
|
+
keepVersionsFor?: string
|
|
12
|
+
deleteFilesAfter?: string
|
|
35
13
|
}
|
|
36
14
|
|
|
37
15
|
export async function runLakeCleanup(options: LakeCleanupOptions = {}) {
|
|
16
|
+
const keepVersions = durationFlag(options.keepVersionsFor, "--keep-versions-for")
|
|
17
|
+
const deleteFiles = durationFlag(options.deleteFilesAfter, "--delete-files-after")
|
|
18
|
+
|
|
38
19
|
const entry = await resolveRuntimeEntry({ entry: options.entry })
|
|
39
20
|
const sixb = await withTask("lake cleanup", "Loading project", () => loadSixbFromEntry(entry))
|
|
40
21
|
|
|
41
22
|
try {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
throw new Error("Configured lake storage does not support maintenance cleanup.")
|
|
23
|
+
if (sixb.lakeStorage.maintenance === undefined) {
|
|
24
|
+
throw new Error("[SixbCLI] Configured lake storage does not support retention cleanup.")
|
|
45
25
|
}
|
|
46
26
|
|
|
47
|
-
const
|
|
48
|
-
const
|
|
27
|
+
const retention = getLakeRetentionRuntime(sixb)
|
|
28
|
+
const { settings } = retention
|
|
29
|
+
const keepVersionsFor = options.keepVersionsFor ?? settings.keepVersionsFor
|
|
30
|
+
const deleteFilesAfter = options.deleteFilesAfter ?? settings.deleteFilesAfter
|
|
49
31
|
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
const applied = await sixb.storage.ontology.sources.listActive({ projectId: sixb.projectId })
|
|
32
|
+
// The same passes as automatic retention, without its time budget: they keep the versions
|
|
33
|
+
// projections applied, and run until none reports more. A dry run measures one pass.
|
|
53
34
|
const report = await withTask(
|
|
54
35
|
"lake cleanup",
|
|
55
36
|
options.dryRun ? "Measuring" : "Cleaning up",
|
|
56
37
|
() =>
|
|
57
|
-
|
|
38
|
+
retention.apply({
|
|
58
39
|
dryRun: options.dryRun ?? false,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
protect: applied.map(({ datasetVersion }) => ({
|
|
62
|
-
datasetId: datasetVersion.datasetId,
|
|
63
|
-
versionId: datasetVersion.versionId,
|
|
64
|
-
})),
|
|
40
|
+
keepVersionsForMs: keepVersions ?? settings.keepVersionsForMs,
|
|
41
|
+
deleteFilesAfterMs: deleteFiles ?? settings.deleteFilesAfterMs,
|
|
65
42
|
})
|
|
66
43
|
)
|
|
67
|
-
|
|
44
|
+
|
|
45
|
+
await renderStatic(
|
|
46
|
+
lakeCleanupView({ projectId: sixb.id, keepVersionsFor, deleteFilesAfter, report })
|
|
47
|
+
)
|
|
68
48
|
} finally {
|
|
69
49
|
await stopSixbProviders(sixb)
|
|
70
50
|
}
|
|
71
51
|
}
|
|
72
52
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
value !== null &&
|
|
77
|
-
typeof (value as { runMaintenance?: unknown }).runMaintenance === "function"
|
|
78
|
-
)
|
|
53
|
+
/** Read before anything loads, so that a typo fails at once. */
|
|
54
|
+
function durationFlag(value: string | undefined, flag: string): number | null {
|
|
55
|
+
return value === undefined ? null : parseDurationMs(value, flag)
|
|
79
56
|
}
|