@dreamlake/dreamlake-cli 0.111.2 → 0.112.0
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/dist/api/skills.js +1 -1
- package/dist/cli/agents/index.js +20 -20
- package/dist/cli/agents/manage.js +1 -1
- package/dist/cli/artifact/index.js +5 -5
- package/dist/cli/artifact/meta.js +1 -1
- package/dist/cli/auth/commands.d.ts +2 -2
- package/dist/cli/auth/commands.js +9 -9
- package/dist/cli/auth/device-flow.js +2 -2
- package/dist/cli/auth/materialized.d.ts +1 -1
- package/dist/cli/auth/materialized.js +1 -1
- package/dist/cli/compat/http.js +2 -2
- package/dist/cli/compat/presignedTransfer.js +2 -2
- package/dist/cli/config.js +2 -2
- package/dist/cli/connection/index.js +8 -8
- package/dist/cli/connection/oauth.js +3 -3
- package/dist/cli/connection/write.js +6 -6
- package/dist/cli/create/index.js +2 -2
- package/dist/cli/declare/index.js +14 -14
- package/dist/cli/delete/index.js +4 -4
- package/dist/cli/download/index.js +3 -3
- package/dist/cli/env/compose.js +1 -1
- package/dist/cli/env/index.js +9 -9
- package/dist/cli/experiments/index.js +2 -2
- package/dist/cli/experiments/native-commands.js +1 -1
- package/dist/cli/experiments/native-run-data.js +1 -1
- package/dist/cli/graphql.js +1 -1
- package/dist/cli/help-examples.generated.js +253 -253
- package/dist/cli/hosts/bootstrap-source.d.ts +1 -1
- package/dist/cli/hosts/bootstrap-source.js +1 -1
- package/dist/cli/hosts/inventory.js +2 -2
- package/dist/cli/hosts/picker.js +2 -2
- package/dist/cli/hosts/ssh.js +1 -1
- package/dist/cli/hosts/upgrade.d.ts +2 -2
- package/dist/cli/hosts/upgrade.js +3 -3
- package/dist/cli/index.js +7 -3
- package/dist/cli/lakeshore/connections.js +1 -1
- package/dist/cli/lakeshore/index.d.ts +1 -1
- package/dist/cli/lakeshore/index.js +4 -4
- package/dist/cli/launch/index.js +10 -10
- package/dist/cli/library/add.js +4 -4
- package/dist/cli/library/cache.js +1 -1
- package/dist/cli/library/discover.js +1 -1
- package/dist/cli/library/freshness.js +1 -1
- package/dist/cli/library/index.js +1 -1
- package/dist/cli/library/info.js +1 -1
- package/dist/cli/library/manifest.js +1 -1
- package/dist/cli/library/pull.js +1 -1
- package/dist/cli/library/push.js +2 -2
- package/dist/cli/library/rm.js +2 -2
- package/dist/cli/library/search.js +2 -2
- package/dist/cli/library/stat.js +1 -1
- package/dist/cli/library/tools.js +1 -1
- package/dist/cli/library/wire.js +1 -1
- package/dist/cli/list/index.js +4 -4
- package/dist/cli/memos/document.d.ts +1 -1
- package/dist/cli/memos/document.js +1 -1
- package/dist/cli/memos/edit-commands.d.ts +2 -2
- package/dist/cli/memos/edit-commands.js +2 -2
- package/dist/cli/memos/files-commands.d.ts +1 -1
- package/dist/cli/memos/files-commands.js +2 -2
- package/dist/cli/memos/index.js +7 -7
- package/dist/cli/memos/media-commands.js +1 -1
- package/dist/cli/memos/move-command.js +2 -2
- package/dist/cli/memos/rm-command.d.ts +1 -1
- package/dist/cli/memos/rm-command.js +2 -2
- package/dist/cli/namespace.js +2 -2
- package/dist/cli/nymph/index.js +4 -4
- package/dist/cli/ownership/index.js +1 -1
- package/dist/cli/ownership/metadata-transfer.js +2 -2
- package/dist/cli/page/index.js +5 -5
- package/dist/cli/pipeline/index.js +5 -5
- package/dist/cli/project/attachments.js +1 -1
- package/dist/cli/project/grants.js +1 -1
- package/dist/cli/project/index.js +1 -1
- package/dist/cli/project/move.js +3 -3
- package/dist/cli/project/stream.js +2 -2
- package/dist/cli/provider/dreamdir.js +2 -2
- package/dist/cli/provider/index.js +18 -18
- package/dist/cli/provider/lifecycle.js +14 -14
- package/dist/cli/python.js +4 -4
- package/dist/cli/queues/index.js +4 -4
- package/dist/cli/queues/slurm.js +2 -2
- package/dist/cli/resources.js +2 -2
- package/dist/cli/run/index.js +1 -1
- package/dist/cli/runconfig/index.js +3 -3
- package/dist/cli/runnable/bound.js +3 -3
- package/dist/cli/runnable/index.js +14 -14
- package/dist/cli/runnable/path.d.ts +1 -1
- package/dist/cli/runnable/path.js +1 -1
- package/dist/cli/self-update/alias-migration.d.ts +11 -0
- package/dist/cli/self-update/alias-migration.js +56 -0
- package/dist/cli/self-update/index.d.ts +1 -1
- package/dist/cli/self-update/index.js +5 -5
- package/dist/cli/self-update/install.js +2 -2
- package/dist/cli/self-update/update.d.ts +1 -1
- package/dist/cli/self-update/update.js +7 -7
- package/dist/cli/session-affiliation.js +1 -1
- package/dist/cli/sessions/control.d.ts +1 -1
- package/dist/cli/sessions/control.js +2 -2
- package/dist/cli/sessions/index.js +5 -5
- package/dist/cli/sessions/live.js +1 -1
- package/dist/cli/sessions/runner/serve.js +1 -1
- package/dist/cli/sessions/wrap.d.ts +2 -2
- package/dist/cli/sessions/wrap.js +8 -8
- package/dist/cli/skill/index.js +22 -22
- package/dist/cli/skill/prefs.js +1 -1
- package/dist/cli/skill/read.js +3 -3
- package/dist/cli/skill/registry.js +2 -2
- package/dist/cli/snapshot/index.js +9 -9
- package/dist/cli/source/access.js +3 -3
- package/dist/cli/source/control.js +8 -8
- package/dist/cli/source/delete.js +6 -6
- package/dist/cli/source/index.js +14 -14
- package/dist/cli/source/share.js +8 -8
- package/dist/cli/source/upload.d.ts +1 -1
- package/dist/cli/source/upload.js +2 -2
- package/dist/cli/source/write.js +2 -2
- package/dist/cli/spawn.js +1 -1
- package/dist/cli/tasks/index.js +1 -1
- package/dist/cli/update/index.js +2 -2
- package/dist/cli/upload/index.js +3 -3
- package/dist/cli/upload/multipart.js +1 -1
- package/dist/cli/vault/index.js +1 -1
- package/dist/cli/vault/sshSync.js +1 -1
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/dist/cli/workflow/index.d.ts +1 -1
- package/dist/cli/workflow/index.js +6 -6
- package/package.json +10 -10
|
@@ -14,7 +14,7 @@ export async function runProjectAttachment(action, project, opts) {
|
|
|
14
14
|
throw new Error('--resource must be a resource database ID');
|
|
15
15
|
const ctx = resolveCtx(opts);
|
|
16
16
|
if (!ctx.token)
|
|
17
|
-
throw new Error("Not authenticated — run '
|
|
17
|
+
throw new Error("Not authenticated — run 'dl login' first");
|
|
18
18
|
const base = `/namespaces/${encodeURIComponent(opts.namespace)}/projects/${encodeURIComponent(project)}`;
|
|
19
19
|
const inspected = await requestJson(ctx.remote, base, { token: ctx.token, redirect: 'error' });
|
|
20
20
|
if (inspected.permissions?.content?.[action === 'attach' ? 'create' : 'delete'] !== true)
|
|
@@ -20,7 +20,7 @@ export async function runProjectGrant(project, opts, removeId) {
|
|
|
20
20
|
throw new Error('A grant ID is required');
|
|
21
21
|
const ctx = resolveCtx(opts);
|
|
22
22
|
if (!ctx.token)
|
|
23
|
-
throw new Error("Not authenticated — run '
|
|
23
|
+
throw new Error("Not authenticated — run 'dl login' first");
|
|
24
24
|
const base = `/namespaces/${encodeURIComponent(opts.namespace)}/projects/${encodeURIComponent(project)}/grants`;
|
|
25
25
|
const access = await requestJson(ctx.remote, base, { token: ctx.token, redirect: 'error' });
|
|
26
26
|
if (access?.viewerRole !== 'ADMIN' || !access.baseline || !Array.isArray(access.teams) || !Array.isArray(access.grants))
|
|
@@ -14,7 +14,7 @@ export async function runProjectRead(action, project, opts) {
|
|
|
14
14
|
throw new Error('An explicit namespace and project slug are required');
|
|
15
15
|
const c = resolveCtx(opts);
|
|
16
16
|
if (!c.token)
|
|
17
|
-
throw new Error("Not authenticated — run '
|
|
17
|
+
throw new Error("Not authenticated — run 'dl login' first");
|
|
18
18
|
const path = `/namespaces/${encodeURIComponent(opts.namespace)}/projects/${encodeURIComponent(project)}` + (action === 'grants' ? '/grants' : '');
|
|
19
19
|
const result = await requestJson(c.remote, path, { token: c.token, redirect: 'error' });
|
|
20
20
|
if (!result || typeof result !== 'object' || Array.isArray(result) ||
|
package/dist/cli/project/move.js
CHANGED
|
@@ -129,7 +129,7 @@ export async function runLegacyProjectMove(project, opts) {
|
|
|
129
129
|
throw new Error('Replay the saved request unchanged; do not combine --request-file with request overrides');
|
|
130
130
|
const c = resolveCtx(opts);
|
|
131
131
|
if (!c.token)
|
|
132
|
-
throw new Error("Not authenticated — run '
|
|
132
|
+
throw new Error("Not authenticated — run 'dl login' first");
|
|
133
133
|
const get = (path, timeoutMs) => requestJson(c.remote, path, { token: c.token, redirect: 'error', timeoutMs });
|
|
134
134
|
const post = (path, json) => requestJson(c.remote, path, { token: c.token, method: 'POST', json, redirect: 'error' });
|
|
135
135
|
const base = `/namespaces/${segment(source)}/ownership`;
|
|
@@ -230,8 +230,8 @@ export async function runLegacyProjectMove(project, opts) {
|
|
|
230
230
|
await new Promise(resolve => setTimeout(resolve, Math.min(1000, Math.max(0, deadline - performance.now()))));
|
|
231
231
|
}
|
|
232
232
|
const nextAction = operation.state === 'pending'
|
|
233
|
-
? `
|
|
234
|
-
: `
|
|
233
|
+
? `dl ownership accept ${operation.id} --namespace ${quoted(destination)}`
|
|
234
|
+
: `dl ownership status ${operation.id} --namespace ${quoted(source)}`;
|
|
235
235
|
emitProjectResult({ ...review, operation, nextAction, timedOut: !!opts.wait && ['preparing', 'committing', 'aborting'].includes(operation.state) }, () => `Transfer ${operation.id}: ${operation.state}.\n${nextAction}`, opts.json);
|
|
236
236
|
return ['rejected', 'cancelled', 'expired', 'aborted', 'recovery-required'].includes(operation.state) ? 3 : 0;
|
|
237
237
|
}
|
|
@@ -96,7 +96,7 @@ export async function runProjectStreamMove(project, opts) {
|
|
|
96
96
|
throw new Error('Replay streaming review unchanged; no request overrides');
|
|
97
97
|
const c = resolveCtx(opts);
|
|
98
98
|
if (!c.token)
|
|
99
|
-
throw new Error("Not authenticated — run '
|
|
99
|
+
throw new Error("Not authenticated — run 'dl login' first");
|
|
100
100
|
const get = (path, timeoutMs) => requestJson(c.remote, path, { token: c.token, redirect: 'error', timeoutMs });
|
|
101
101
|
const post = (path, json) => requestJson(c.remote, path, { token: c.token, method: 'POST', json, redirect: 'error' });
|
|
102
102
|
const base = `/namespaces/${encodeURIComponent(source)}/ownership`;
|
|
@@ -196,7 +196,7 @@ export async function runProjectStreamMove(project, opts) {
|
|
|
196
196
|
if (progress.state !== 'completed')
|
|
197
197
|
throw new Error('Streaming completion is not confirmed by the operation-bound final watermark; inspect the same operation');
|
|
198
198
|
}
|
|
199
|
-
const nextAction = `
|
|
199
|
+
const nextAction = `dl ownership progress ${operationId} --namespace '${source.replace(/'/g, "'\"'\"'")}'`;
|
|
200
200
|
emitProjectResult({ ...review, operation, progress, nextAction, timedOut: !!opts.wait && busy.has(operation.state) }, () => `Streaming transfer ${operationId}: ${operation.state}.\n${nextAction}`, opts.json);
|
|
201
201
|
return failed.has(operation.state) ? 3 : 0;
|
|
202
202
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// WHY THERE IS A ROOT RULE AT ALL. `runnable import --out` is the only other
|
|
4
4
|
// command in this CLI that writes into a project tree, and it makes you say
|
|
5
|
-
// where. A provider cannot: `
|
|
5
|
+
// where. A provider cannot: `dl provider status -n aws-demo` has to find
|
|
6
6
|
// the same directory `create` wrote, from any subdirectory of the repo, with no
|
|
7
7
|
// flag. So the root is INFERRED, exactly the way `findDreamRc()` infers it:
|
|
8
8
|
//
|
|
@@ -76,7 +76,7 @@ export function invalidNameMessage(name) {
|
|
|
76
76
|
// PR — that is the point of a deliberate provider — but state, the provider
|
|
77
77
|
// plugin cache and saved plans are neither reviewable nor safe to share.
|
|
78
78
|
export const DREAM_GITIGNORE = [
|
|
79
|
-
"# Written by `
|
|
79
|
+
"# Written by `dl provider create`. The scaffold is meant to be",
|
|
80
80
|
"# committed and reviewed; everything below is machine state that is not.",
|
|
81
81
|
"providers/*/terraform/.terraform/",
|
|
82
82
|
"providers/*/terraform/terraform.tfstate*",
|
|
@@ -8,7 +8,7 @@ function registerGroup(program, spec, text) {
|
|
|
8
8
|
.command("create")
|
|
9
9
|
.description(`create a ${spec.label}`)
|
|
10
10
|
.option("--file <path>", "JSON or YAML file holding the row (name, kind, config, …)")
|
|
11
|
-
// `-n` is the short form because `
|
|
11
|
+
// `-n` is the short form because `dl provider create -n aws-demo` is
|
|
12
12
|
// what a person types. It is shared with storage and queue-def, which is
|
|
13
13
|
// harmless: all three are named rows.
|
|
14
14
|
.option("-n, --name <name>", "row name, unique within the namespace (overrides --file)")
|
|
@@ -118,19 +118,19 @@ export function registerProviderCommand(program) {
|
|
|
118
118
|
"route. After a create, `show` can only tell you that a secret EXISTS.",
|
|
119
119
|
"",
|
|
120
120
|
"Examples:",
|
|
121
|
-
"
|
|
122
|
-
"
|
|
121
|
+
" dl provider create --file provider.json --if-exists ok",
|
|
122
|
+
" dl provider create --name kit-local --kind local --config '{\"shell\":\"bash\"}'",
|
|
123
123
|
],
|
|
124
124
|
after: [
|
|
125
125
|
"The full cycle, five commands:",
|
|
126
126
|
"",
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
127
|
+
" dl provider create --file provider.json --if-exists ok",
|
|
128
|
+
" dl provider list",
|
|
129
|
+
" dl provider show kit-local",
|
|
130
|
+
" dl provider update kit-local --description '…' # config is a REPLACE",
|
|
131
|
+
" dl provider delete kit-local --yes # soft delete",
|
|
132
132
|
"",
|
|
133
|
-
"`
|
|
133
|
+
"`dl declare provider.json --collection lakeshore-providers` still works",
|
|
134
134
|
"and does exactly what `provider create` does. It is the generic writer for all",
|
|
135
135
|
"five head collections; this group is the lifecycle for one of them.",
|
|
136
136
|
],
|
|
@@ -148,7 +148,7 @@ export function registerProviderCommand(program) {
|
|
|
148
148
|
//
|
|
149
149
|
// NO LEAF DECLARES `--version`, EVER. `program.version(VERSION, "-v, --version")`
|
|
150
150
|
// at cli/index.ts:61 is resolved from ANY descendant command, so
|
|
151
|
-
// `
|
|
151
|
+
// `dl provider plan --version` would print 0.6.0 and exit 0 having
|
|
152
152
|
// planned nothing.
|
|
153
153
|
function registerLifecycle(program) {
|
|
154
154
|
const group = program.commands.find((c) => c.name() === PROVIDER_SPEC.group);
|
|
@@ -224,10 +224,10 @@ function registerLifecycle(program) {
|
|
|
224
224
|
...AGENT_LOOP,
|
|
225
225
|
"",
|
|
226
226
|
"Examples:",
|
|
227
|
-
"
|
|
228
|
-
"
|
|
229
|
-
"
|
|
230
|
-
"
|
|
227
|
+
" dl provider create -n aws-demo --provider kube",
|
|
228
|
+
" dl provider create -n aws-demo --continue --json",
|
|
229
|
+
" dl provider create -n lab-box --provider ssh",
|
|
230
|
+
" dl provider create -n aws-pair --provider aws-jump-worker --json",
|
|
231
231
|
"",
|
|
232
232
|
"aws-jump-worker packages controller/worker modules with typed JSON inputs,",
|
|
233
233
|
"S3 backend onboarding, and AGENT.md instructions. It defaults to exact",
|
|
@@ -275,7 +275,7 @@ function registerLifecycle(program) {
|
|
|
275
275
|
"you to re-run — terraform owns that recovery and we do not reimplement it.",
|
|
276
276
|
"",
|
|
277
277
|
"Example:",
|
|
278
|
-
"
|
|
278
|
+
" dl provider apply -n aws-demo --yes",
|
|
279
279
|
].join("\n"))
|
|
280
280
|
.action(async (opts) => process.exit(await runProviderApply(opts)));
|
|
281
281
|
common(group
|
|
@@ -323,8 +323,8 @@ function registerLifecycle(program) {
|
|
|
323
323
|
"a row while its nymph is still running leaves that nymph polling the control",
|
|
324
324
|
"plane forever, so the honest order is disconnect first, delete second:",
|
|
325
325
|
"",
|
|
326
|
-
"
|
|
327
|
-
"
|
|
326
|
+
" dl provider disconnect -n lab-box",
|
|
327
|
+
" dl provider delete lab-box --yes",
|
|
328
328
|
"",
|
|
329
329
|
"THE STOP MATCHES THE START. The same supervisor ladder `connect` climbed is",
|
|
330
330
|
"climbed again on the host, and the action is whatever it reports NOW:",
|
|
@@ -379,7 +379,7 @@ export function registerStorageCommand(program) {
|
|
|
379
379
|
"Credentials go in `--secret`, which is encrypted at rest and never returned.",
|
|
380
380
|
"",
|
|
381
381
|
"Example:",
|
|
382
|
-
"
|
|
382
|
+
" dl storage create --name kit-bucket --kind s3 \\",
|
|
383
383
|
" --config '{\"bucket\":\"kit-artifacts\",\"region\":\"us-west-2\"}'",
|
|
384
384
|
],
|
|
385
385
|
after: [
|
|
@@ -48,13 +48,13 @@ import { gitignoreWrite, invalidNameMessage, providerDir, readProviderRecord, re
|
|
|
48
48
|
import { LOCK_FILE, PLUGIN_DIR, STATE_FILE, failureDetail, isVariableProblem, parsePlanStream, parseValidate, resolveTerraform, runTerraform, TIMEOUTS, } from "./terraform.js";
|
|
49
49
|
import { detectSupervisor, nymphCommand, probeHost, startNymph, stopCommand, stopLabel, stopNymph, supervisorLabel, unreachableMessage, } from "./ssh.js";
|
|
50
50
|
// ─── the printed commands ────────────────────────────────────────────────────
|
|
51
|
-
const cmdContinue = (n) => `
|
|
52
|
-
const cmdPlan = (n) => `
|
|
53
|
-
const cmdApply = (n) => `
|
|
54
|
-
const cmdConnect = (n) => `
|
|
55
|
-
const cmdDisconnect = (n) => `
|
|
56
|
-
const cmdStatus = (n) => `
|
|
57
|
-
const cmdCreate = (n, vendor) => `
|
|
51
|
+
const cmdContinue = (n) => `dl provider create -n ${n} --continue`;
|
|
52
|
+
const cmdPlan = (n) => `dl provider plan -n ${n}`;
|
|
53
|
+
const cmdApply = (n) => `dl provider apply -n ${n} --yes`;
|
|
54
|
+
const cmdConnect = (n) => `dl provider connect -n ${n}`;
|
|
55
|
+
const cmdDisconnect = (n) => `dl provider disconnect -n ${n}`;
|
|
56
|
+
const cmdStatus = (n) => `dl provider status -n ${n}`;
|
|
57
|
+
const cmdCreate = (n, vendor) => `dl provider create -n ${n} --provider ${vendor}`;
|
|
58
58
|
/**
|
|
59
59
|
* The next action for ANY terraform failure — init, validate, plan or apply.
|
|
60
60
|
*
|
|
@@ -319,7 +319,7 @@ function printNext(action) {
|
|
|
319
319
|
process.stdout.write(` next: ${action.command}\n`);
|
|
320
320
|
}
|
|
321
321
|
function scopeResult(opts, result) {
|
|
322
|
-
if (result.vendor !== JUMP_WORKER_VENDOR || !result.nextAction?.command.startsWith("
|
|
322
|
+
if (result.vendor !== JUMP_WORKER_VENDOR || !result.nextAction?.command.startsWith("dl provider "))
|
|
323
323
|
return result;
|
|
324
324
|
const quote = (value) => "'" + value.replace(/'/g, "'\"'\"'") + "'";
|
|
325
325
|
const dreamDir = result.dir ? path.dirname(path.dirname(result.dir)) : opts.dreamDir;
|
|
@@ -408,7 +408,7 @@ function enrollmentHandoff(opts, c) {
|
|
|
408
408
|
...c.where, vendor: JUMP_WORKER_VENDOR, status: "needs_input", files: [],
|
|
409
409
|
blocking: [{ key: "owned-enrollment-evidence", reason: "unset", file,
|
|
410
410
|
why: "Follow the explicit enrollment and mapper handoff; external mode reuses the existing controller enrollment. Infrastructure IDs and hostnames are not Host, Enrollment or Worker authority. Generic connect/disconnect does not manage this setup." }],
|
|
411
|
-
nextAction: { kind: "edit_then_continue", file, command: `
|
|
411
|
+
nextAction: { kind: "edit_then_continue", file, command: `dl hosts enroll --help` },
|
|
412
412
|
};
|
|
413
413
|
if (opts.json)
|
|
414
414
|
emitJson(scopeResult(opts, result));
|
|
@@ -696,7 +696,7 @@ export async function runProviderPlan(opts, deps = {}) {
|
|
|
696
696
|
function notScaffolded(name, dir) {
|
|
697
697
|
return (`no provider scaffold at ${dir} — nothing to work with. ` +
|
|
698
698
|
`Create it first, deliberately, with a vendor: ` +
|
|
699
|
-
`
|
|
699
|
+
`dl provider create -n ${name} --provider <${VENDORS.join("|")}>`);
|
|
700
700
|
}
|
|
701
701
|
/** Missing / invalid variable → a question (rc 0). Anything else → an error. */
|
|
702
702
|
function classify(errs) {
|
|
@@ -886,7 +886,7 @@ export async function runProviderApply(opts, deps = {}) {
|
|
|
886
886
|
const changes = stream.changes ?? { add: 0, change: 0, destroy: 0 };
|
|
887
887
|
const claim = existing.vendor === JUMP_WORKER_VENDOR ? null : await fetchClaim(c.server, c.namespace, c.name);
|
|
888
888
|
const nextAction = existing.vendor === JUMP_WORKER_VENDOR
|
|
889
|
-
? { kind: "edit_then_continue", file: path.join(c.dir, "terraform", "ENROLLMENT.md"), command: "
|
|
889
|
+
? { kind: "edit_then_continue", file: path.join(c.dir, "terraform", "ENROLLMENT.md"), command: "dl hosts enroll --help" }
|
|
890
890
|
: claim && claim.live > 0 ? null : { kind: "run", command: cmdConnect(c.name) };
|
|
891
891
|
const result = {
|
|
892
892
|
status: "applied",
|
|
@@ -972,7 +972,7 @@ export async function runProviderConnect(opts, deps = {}) {
|
|
|
972
972
|
const nextAction = {
|
|
973
973
|
kind: "edit_then_continue",
|
|
974
974
|
file: path.join(c.dir, "adopt.json"),
|
|
975
|
-
command: `
|
|
975
|
+
command: `dl provider connect -n ${c.name} --host user@host.example`,
|
|
976
976
|
};
|
|
977
977
|
const result = {
|
|
978
978
|
status: "needs_input",
|
|
@@ -1196,7 +1196,7 @@ export async function runProviderDisconnect(opts, deps = {}) {
|
|
|
1196
1196
|
// to stop. Reporting a cheerful "disconnected" would be a lie that leaves a
|
|
1197
1197
|
// nymph polling.
|
|
1198
1198
|
return reject(opts, `no supervisor on ${host} — NOTHING WAS STOPPED. There is no systemd and no ` +
|
|
1199
|
-
`tmux here, so nothing on this host was started by \`
|
|
1199
|
+
`tmux here, so nothing on this host was started by \`dl provider ` +
|
|
1200
1200
|
`connect\` and this command has nothing it knows how to stop.`, where, {
|
|
1201
1201
|
kind: "NoSupervisor",
|
|
1202
1202
|
nextAction: { kind: "shell", command: `ssh ${host} 'pgrep -af nymph'`, host },
|
|
@@ -1254,7 +1254,7 @@ export async function runProviderDisconnect(opts, deps = {}) {
|
|
|
1254
1254
|
}
|
|
1255
1255
|
// The line the docs page's "Kill" section exists because nobody could say.
|
|
1256
1256
|
process.stdout.write(` the provider row is untouched — disconnect is not delete.\n` +
|
|
1257
|
-
` to remove the row as well:
|
|
1257
|
+
` to remove the row as well: dl provider delete ${c.name} --yes\n`);
|
|
1258
1258
|
if (after && after.live > 0) {
|
|
1259
1259
|
warn(`${after.live} worker${after.live === 1 ? "" : "s"} still claiming '${c.name}' — ` +
|
|
1260
1260
|
`the control plane has not noticed the missing handshake yet`);
|
package/dist/cli/python.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The Python bridge — the ONE place in this CLI that knows Python exists.
|
|
2
2
|
//
|
|
3
|
-
// WHY THERE IS A SUBPROCESS HERE AT ALL. `
|
|
4
|
-
// `
|
|
3
|
+
// WHY THERE IS A SUBPROCESS HERE AT ALL. `dl snapshot` and
|
|
4
|
+
// `dl launch` drive logic that already exists, is tested, and was proven
|
|
5
5
|
// end to end against a live control plane: git-archive with `.dreamrc` exclude
|
|
6
6
|
// pathspecs, dirty-tree commit-object synthesis, the presign POST, the S3 PUT,
|
|
7
7
|
// submodule parsing, the `CodeRepo` register, the msgpack envelope, and
|
|
@@ -59,7 +59,7 @@ const probeSpawn = boundedSpawn(120_000);
|
|
|
59
59
|
// control-plane path. A snapshot that exists only on DreamLake is not
|
|
60
60
|
// launchable by anything.
|
|
61
61
|
//
|
|
62
|
-
// So neither command calls `ctx()` and neither requires `
|
|
62
|
+
// So neither command calls `ctx()` and neither requires `dl login`.
|
|
63
63
|
// Gating a job launch behind a DreamLake login would be a false gate. When the
|
|
64
64
|
// `Repo`/`RepoSnapshot` mirror lands, `ctx()` gets added then — not now.
|
|
65
65
|
export const NO_SERVER_MESSAGE = "no control plane — pass --server or set LAKESHORE_URL " +
|
|
@@ -121,7 +121,7 @@ const NO_INTERPRETER_MESSAGE = "no python interpreter found — set DREAMLAKE_PY
|
|
|
121
121
|
"(the interpreter that has dreamlake-lakeshore installed)";
|
|
122
122
|
function protocolMismatch(n) {
|
|
123
123
|
return (`dreamlake-lakeshore speaks protocol ${n}, this CLI speaks ${PROTOCOL} — ` +
|
|
124
|
-
`upgrade the CLI (
|
|
124
|
+
`upgrade the CLI (dl self-update) or the SDK`);
|
|
125
125
|
}
|
|
126
126
|
// One probe per interpreter per process, so `launch` pays ~80 ms once rather
|
|
127
127
|
// than once per bridge call. Keyed by the resolved interpreter path.
|
package/dist/cli/queues/index.js
CHANGED
|
@@ -24,7 +24,7 @@ async function context(opts) {
|
|
|
24
24
|
const remote = resolveRemote();
|
|
25
25
|
const token = resolveToken();
|
|
26
26
|
if (!token)
|
|
27
|
-
throw new Error("not authenticated — run '
|
|
27
|
+
throw new Error("not authenticated — run 'dl login' first");
|
|
28
28
|
const ns = await resolveNamespace(opts.namespace, { remote, token });
|
|
29
29
|
if (!ns)
|
|
30
30
|
throw new Error("choose a DreamLake namespace with --namespace <slug>");
|
|
@@ -85,7 +85,7 @@ export async function runQueuesMount(opts, io = mountInput) {
|
|
|
85
85
|
if (opts.json)
|
|
86
86
|
emitJson(mount);
|
|
87
87
|
else
|
|
88
|
-
process.stdout.write(`Mounted ${mount.slug} in ${c.ns}.\nNext:
|
|
88
|
+
process.stdout.write(`Mounted ${mount.slug} in ${c.ns}.\nNext: dl queues list ${mount.slug} --namespace ${c.ns}\n`);
|
|
89
89
|
return 0;
|
|
90
90
|
}
|
|
91
91
|
catch (err) {
|
|
@@ -227,7 +227,7 @@ export async function runQueuesWorkerClaims(prefix, workerId, opts) {
|
|
|
227
227
|
if (opts.enable && opts.disable)
|
|
228
228
|
throw new Error("choose one of --enable or --disable");
|
|
229
229
|
if (!/^[a-f0-9]{24}$/.test(workerId))
|
|
230
|
-
throw new Error("worker ID must be the 24-character ID shown by '
|
|
230
|
+
throw new Error("worker ID must be the 24-character ID shown by 'dl queues workers'");
|
|
231
231
|
const c = await context(opts);
|
|
232
232
|
const path = `${c.path}/${seg(prefix)}`;
|
|
233
233
|
const mount = await requestJson(c.remote, path, { token: c.token });
|
|
@@ -263,7 +263,7 @@ export async function runQueuesWorkerPin(prefix, workerId, opts, deps = {}) {
|
|
|
263
263
|
if (opts.clear && queues.length)
|
|
264
264
|
throw new Error("choose one of --queue or --clear");
|
|
265
265
|
if (!/^[a-f0-9]{24}$/.test(workerId))
|
|
266
|
-
throw new Error("worker ID must be the 24-character ID shown by '
|
|
266
|
+
throw new Error("worker ID must be the 24-character ID shown by 'dl queues workers'");
|
|
267
267
|
const c = await context(opts);
|
|
268
268
|
const path = `${c.path}/${seg(prefix)}`;
|
|
269
269
|
const mount = await requestJson(c.remote, path, { token: c.token });
|
package/dist/cli/queues/slurm.js
CHANGED
|
@@ -11,7 +11,7 @@ const names = (v) => Array.isArray(v) && v.length && v.every(x => text(x) !== un
|
|
|
11
11
|
async function context(opts) {
|
|
12
12
|
const remote = resolveRemote(), token = resolveToken();
|
|
13
13
|
if (!token)
|
|
14
|
-
throw new Error("not authenticated — run '
|
|
14
|
+
throw new Error("not authenticated — run 'dl login' first");
|
|
15
15
|
const namespace = await resolveNamespace(opts.namespace, { remote, token });
|
|
16
16
|
if (!namespace)
|
|
17
17
|
throw new Error("choose a DreamLake namespace with --namespace <slug>");
|
|
@@ -86,7 +86,7 @@ function jobDetails(job) {
|
|
|
86
86
|
export async function runSlurmJobs(clusterId, opts) {
|
|
87
87
|
try {
|
|
88
88
|
if (!clusterId.trim() || /[\x00-\x1f\x7f-\x9f]/.test(clusterId))
|
|
89
|
-
throw new Error("provide a cluster ID from '
|
|
89
|
+
throw new Error("provide a cluster ID from 'dl queues slurm clusters'");
|
|
90
90
|
const c = await context(opts);
|
|
91
91
|
const result = await requestJson(c.remote, `${c.path}/${encodeURIComponent(clusterId)}/snapshot`, { token: c.token });
|
|
92
92
|
if (result?.schemaVersion !== 1 || result.clusterId !== clusterId)
|
package/dist/cli/resources.js
CHANGED
|
@@ -20,12 +20,12 @@ export async function resolveProjectCtx(projectStr) {
|
|
|
20
20
|
const remote = resolveRemote();
|
|
21
21
|
const token = resolveToken();
|
|
22
22
|
if (!token) {
|
|
23
|
-
fail("not authenticated. run '
|
|
23
|
+
fail("not authenticated. run 'dl login' first");
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
const namespace = await resolveNamespace(s.namespace, { token, remote });
|
|
27
27
|
if (!namespace) {
|
|
28
|
-
fail("namespace not specified and no authenticated user found. run '
|
|
28
|
+
fail("namespace not specified and no authenticated user found. run 'dl login'");
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
s.namespace = namespace;
|
package/dist/cli/run/index.js
CHANGED
|
@@ -52,7 +52,7 @@ export async function drainLogs(path, cursor, json = false) {
|
|
|
52
52
|
}
|
|
53
53
|
return { cursor: page.nextCursor, done: page.done };
|
|
54
54
|
}
|
|
55
|
-
const help = `Usage:
|
|
55
|
+
const help = `Usage: dl run --target namespace/group/host[/user] [options] --uv-run <args...>\n dl run --target namespace/group/host[/user] [options] --uvx <args...>\n\nAll DreamLake options precede the execution selector; everything after it is workload argv.\n --setup <metadata.json> Pinned repository + reviewed vault mappings (private mode)\n --allow-vault-delivery Explicit consent; requires setup + enrollment, no includes\n --include <file> Explicit relative file to upload (repeatable; 100 files, 1 MiB total)\n --enrollment-id <id> Select a host enrollment when ambiguous\n --request-id <id> Stable retry ID (generated otherwise)\n --timeout-seconds <n> Remote timeout, 1–86400 (default 3600)\n --provider-id <id> Select provider with --association-id and --association-revision\n --association-id <id> Owned Slurm association (--uv-run only)\n --association-revision <n> Expected association revision\n --cpus <n> --memory-mib <n> --gpus <n> Placement resource requests\n --no-wait Return the persisted receipt after submission\n --json Output JSON receipt; use runs logs for output\n\nNo files are inferred from workload arguments. Include your script and dependencies explicitly.\nRequires a compatible server and an online nymph with tracked-run and uv capabilities.\n`;
|
|
56
56
|
export async function executeRun(args) {
|
|
57
57
|
const selector = args.findIndex(arg => arg === "--uv-run" || arg === "--uvx");
|
|
58
58
|
const before = selector < 0 ? args : args.slice(0, selector);
|
|
@@ -6,13 +6,13 @@ import { emitJson, fail, renderTable } from "../helpers.js";
|
|
|
6
6
|
async function ctx(nsFlag) {
|
|
7
7
|
const token = resolveToken();
|
|
8
8
|
if (!token) {
|
|
9
|
-
fail("not authenticated — run '
|
|
9
|
+
fail("not authenticated — run 'dl login' first");
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
12
|
const remote = resolveRemote();
|
|
13
13
|
const ns = await resolveNamespace(nsFlag, { token, remote });
|
|
14
14
|
if (!ns) {
|
|
15
|
-
fail("could not resolve namespace — run '
|
|
15
|
+
fail("could not resolve namespace — run 'dl login' or pass --namespace");
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
18
|
return { token, remote, ns };
|
|
@@ -107,7 +107,7 @@ export function registerRunConfigCommand(program) {
|
|
|
107
107
|
"The host key answers one question and only one: which of these configs would",
|
|
108
108
|
"land on the same worker. It is derived from runtime + extras + provider, and",
|
|
109
109
|
"it is display-only — never treat it as a scheduling decision. Read a key off",
|
|
110
|
-
"`
|
|
110
|
+
"`dl runconfig show`, then feed it back here to see its neighbours.",
|
|
111
111
|
].join("\n"))
|
|
112
112
|
.action(async (opts) => process.exit(await runRunConfigList(opts)));
|
|
113
113
|
runconfig
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// `
|
|
1
|
+
// `dl runnable bind | execute | execution-receipt` — a registered UDF
|
|
2
2
|
// pinned to ONE configured snapshot and ONE locked runtime, executed on a
|
|
3
3
|
// queue through the existing configured-snapshot runner.
|
|
4
4
|
//
|
|
@@ -126,7 +126,7 @@ export async function runBind(ref, opts, deps = {}) {
|
|
|
126
126
|
try {
|
|
127
127
|
const pin = pinnedReference(ref);
|
|
128
128
|
if (!OID.test(opts.snapshot))
|
|
129
|
-
throw new Error("--snapshot must be the 24-hex configured CodeRepo id printed by `
|
|
129
|
+
throw new Error("--snapshot must be the 24-hex configured CodeRepo id printed by `dl snapshot`");
|
|
130
130
|
const server = resolveServer(opts.server);
|
|
131
131
|
if (!server)
|
|
132
132
|
throw new Error("no control plane — pass --server or set LAKESHORE_URL");
|
|
@@ -290,7 +290,7 @@ export async function runBoundCommand(command, ref, opts, deps = {}) {
|
|
|
290
290
|
export function registerRunnableBound(runnable) {
|
|
291
291
|
runnable.command("bind <ref>")
|
|
292
292
|
.description("bind a registered UDF version to one configured snapshot and locked runtime (immutable execution binding)")
|
|
293
|
-
.option("--snapshot <id>", "24-hex configured CodeRepo id from `
|
|
293
|
+
.option("--snapshot <id>", "24-hex configured CodeRepo id from `dl snapshot` (control-plane path)")
|
|
294
294
|
.option("--target <host>", "namespace/group/host[/user] you own: build this checkout's configured archive and upload it through DreamLake (no control-plane credential)")
|
|
295
295
|
.option("--enrollment <id>", "with --target: the host enrollment, when it has more than one")
|
|
296
296
|
.option("--config <path>", "with --target: explicit .dreamrc (default: walk up from the current directory)")
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { collectionList } from "../collection-list.js";
|
|
2
|
-
// `
|
|
2
|
+
// `dl runnable …` — the read side of the Runnable collection, plus the
|
|
3
3
|
// one write that `declare` cannot express.
|
|
4
4
|
//
|
|
5
5
|
// A Runnable is named code you invoke. It has two layers:
|
|
@@ -36,13 +36,13 @@ import { registerRunnableBound } from "./bound.js";
|
|
|
36
36
|
async function ctx(nsFlag) {
|
|
37
37
|
const token = resolveToken();
|
|
38
38
|
if (!token) {
|
|
39
|
-
fail("not authenticated — run '
|
|
39
|
+
fail("not authenticated — run 'dl login' first");
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
42
|
const remote = resolveRemote();
|
|
43
43
|
const ns = await resolveNamespace(nsFlag, { token, remote });
|
|
44
44
|
if (!ns) {
|
|
45
|
-
fail("could not resolve namespace — run '
|
|
45
|
+
fail("could not resolve namespace — run 'dl login' or pass --namespace");
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
48
48
|
return { token, remote, ns };
|
|
@@ -219,7 +219,7 @@ export async function runRunnableVersionPush(name, opts) {
|
|
|
219
219
|
return 1;
|
|
220
220
|
}
|
|
221
221
|
if (res.status === 404) {
|
|
222
|
-
fail(`runnable '${name}' not found in namespace '${c.ns}' — declare the head row first with '
|
|
222
|
+
fail(`runnable '${name}' not found in namespace '${c.ns}' — declare the head row first with 'dl declare'`);
|
|
223
223
|
return 1;
|
|
224
224
|
}
|
|
225
225
|
if (res.status !== 200 && res.status !== 201) {
|
|
@@ -309,7 +309,7 @@ export async function runRunnableVersionShow(name, version, opts) {
|
|
|
309
309
|
});
|
|
310
310
|
if (!resolved.ok) {
|
|
311
311
|
fail(resolved.code === "no-versions"
|
|
312
|
-
? `${resolved.message} — register one with '
|
|
312
|
+
? `${resolved.message} — register one with 'dl runnable version push'`
|
|
313
313
|
: resolved.message);
|
|
314
314
|
return 1;
|
|
315
315
|
}
|
|
@@ -329,7 +329,7 @@ export async function runRunnableVersionShow(name, version, opts) {
|
|
|
329
329
|
return 1;
|
|
330
330
|
}
|
|
331
331
|
// Raw, undecorated, exactly the stored bytes — so
|
|
332
|
-
//
|
|
332
|
+
// dl runnable version show a b --source-only > udf.py
|
|
333
333
|
// round-trips to the same sha256.
|
|
334
334
|
process.stdout.write(row.source);
|
|
335
335
|
return 0;
|
|
@@ -381,7 +381,7 @@ export async function runRunnableImport(name, opts) {
|
|
|
381
381
|
if (!resolved.ok) {
|
|
382
382
|
fail(resolved.code === "no-versions"
|
|
383
383
|
? `${resolved.message} — nothing to import. ` +
|
|
384
|
-
`Register one with '
|
|
384
|
+
`Register one with 'dl runnable version push'.`
|
|
385
385
|
: resolved.message);
|
|
386
386
|
return 1;
|
|
387
387
|
}
|
|
@@ -445,7 +445,7 @@ export async function runRunnableImport(name, opts) {
|
|
|
445
445
|
// WHY THE FLAG IS `--at` AND NOT `--version`. It cannot be `--version`:
|
|
446
446
|
// `program.version(VERSION, "-v, --version")` in cli/index.ts registers a
|
|
447
447
|
// version option that Commander resolves from ANY descendant command, so
|
|
448
|
-
// `
|
|
448
|
+
// `dl runnable import foo --version <sha>` prints "0.6.0" and exits 0
|
|
449
449
|
// without importing anything. That was true of the pre-existing `--version`
|
|
450
450
|
// flag on `import` too — it has never worked from a shell, only from the tests,
|
|
451
451
|
// which call the run* functions directly and never parse argv.
|
|
@@ -468,7 +468,7 @@ export function registerRunnableCommand(program) {
|
|
|
468
468
|
.addHelpText("after", [
|
|
469
469
|
"",
|
|
470
470
|
"`latestVersion` is truncated to 12 characters in the table so the columns fit.",
|
|
471
|
-
"Use `
|
|
471
|
+
"Use `dl runnable show <name>` for the full 64-character hash — that is",
|
|
472
472
|
"the only form that addresses anything.",
|
|
473
473
|
].join("\n"))
|
|
474
474
|
.action(async (opts) => process.exit(await runRunnableList(opts)));
|
|
@@ -486,8 +486,8 @@ export function registerRunnableCommand(program) {
|
|
|
486
486
|
"written. The kind segment is VERIFIED against the stored row, never guessed:",
|
|
487
487
|
"a path that says udf/ cannot quietly resolve to an agent.",
|
|
488
488
|
"",
|
|
489
|
-
"
|
|
490
|
-
"
|
|
489
|
+
" dl runnable show udf/chengdu/examples.cpu.add@latest",
|
|
490
|
+
" dl runnable show examples.cpu.add --namespace chengdu",
|
|
491
491
|
"",
|
|
492
492
|
"A namespace in the path beats --namespace. Resolution is client-side: the",
|
|
493
493
|
"server still only accepts a full 64-character hash.",
|
|
@@ -545,8 +545,8 @@ export function registerRunnableCommand(program) {
|
|
|
545
545
|
"matches on it (two extra), and an ambiguous prefix is an error rather than a",
|
|
546
546
|
"guess. A bare name plus a full hash still takes exactly one request.",
|
|
547
547
|
"",
|
|
548
|
-
"
|
|
549
|
-
"
|
|
548
|
+
" dl runnable version show udf/chengdu/examples.cpu.add@latest --source-only > udf.py",
|
|
549
|
+
" dl runnable version show examples.embed.embed_frames <sha256> --source-only > udf.py",
|
|
550
550
|
].join("\n"))
|
|
551
551
|
.action(async (name, ver, opts) => process.exit(await runRunnableVersionShow(name, ver, { ...opts, version: opts.at })));
|
|
552
552
|
runnable
|
|
@@ -571,7 +571,7 @@ export function registerRunnableCommand(program) {
|
|
|
571
571
|
"",
|
|
572
572
|
"Import does not fetch a RunConfig. No route joins a Runnable to one, and there",
|
|
573
573
|
"is no ?include= — a RunConfig is referenced by name, on purpose. Fetch it",
|
|
574
|
-
"separately with `
|
|
574
|
+
"separately with `dl runconfig show`.",
|
|
575
575
|
].join("\n"))
|
|
576
576
|
.action(async (name, opts) => process.exit(await runRunnableImport(name, { ...opts, version: opts.at })));
|
|
577
577
|
}
|
|
@@ -25,7 +25,7 @@ export declare function parseRunnablePath(raw: string): RunnablePath;
|
|
|
25
25
|
* else. Never throws: a malformed path returns null here and produces its real
|
|
26
26
|
* error later, from parseRunnablePath, where the message can be specific.
|
|
27
27
|
*
|
|
28
|
-
* This is what makes an address self-contained. `
|
|
28
|
+
* This is what makes an address self-contained. `dl runnable show
|
|
29
29
|
* udf/chengdu/examples.cpu.add` has to work whether or not the active login
|
|
30
30
|
* resolves to a namespace, because the string already says which one.
|
|
31
31
|
*/
|
|
@@ -136,7 +136,7 @@ export function parseRunnablePath(raw) {
|
|
|
136
136
|
* else. Never throws: a malformed path returns null here and produces its real
|
|
137
137
|
* error later, from parseRunnablePath, where the message can be specific.
|
|
138
138
|
*
|
|
139
|
-
* This is what makes an address self-contained. `
|
|
139
|
+
* This is what makes an address self-contained. `dl runnable show
|
|
140
140
|
* udf/chengdu/examples.cpu.add` has to work whether or not the active login
|
|
141
141
|
* resolves to a namespace, because the string already says which one.
|
|
142
142
|
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface AliasMigrationOptions {
|
|
2
|
+
bin?: string;
|
|
3
|
+
versions?: string;
|
|
4
|
+
executable?: string;
|
|
5
|
+
version?: string;
|
|
6
|
+
windows?: boolean;
|
|
7
|
+
searchPath?: string;
|
|
8
|
+
}
|
|
9
|
+
/** Only fill a missing alias for a verified native install. Existing entries,
|
|
10
|
+
* including foreign commands, are left to the explicit installer's checks. */
|
|
11
|
+
export declare function migrateCommandAlias(options?: AliasMigrationOptions): string | null;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Older updaters install the new binary without knowing about dl. Complete that
|
|
2
|
+
// local setup on its first invocation, without downloading or changing versions.
|
|
3
|
+
import { lstatSync, readFileSync, statSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { installAlias } from "./alias.js";
|
|
6
|
+
import { binDir, canonical, isWindows, versionPath, versionsDir } from "./paths.js";
|
|
7
|
+
import { VERSION } from "../version.js";
|
|
8
|
+
/** Only fill a missing alias for a verified native install. Existing entries,
|
|
9
|
+
* including foreign commands, are left to the explicit installer's checks. */
|
|
10
|
+
export function migrateCommandAlias(options = {}) {
|
|
11
|
+
const windows = options.windows ?? isWindows;
|
|
12
|
+
const bin = options.bin ?? binDir();
|
|
13
|
+
const versions = options.versions ?? versionsDir();
|
|
14
|
+
const executable = options.executable ?? process.execPath;
|
|
15
|
+
const ext = windows ? ".exe" : "";
|
|
16
|
+
const launcher = path.join(bin, `dreamlake${ext}`);
|
|
17
|
+
const alias = path.join(bin, `dl${ext}`);
|
|
18
|
+
try {
|
|
19
|
+
try {
|
|
20
|
+
lstatSync(alias);
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
catch (err) {
|
|
24
|
+
if (err.code !== "ENOENT")
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (windows) {
|
|
28
|
+
// Windows runs a launcher copy, not the versioned file. Verify both its
|
|
29
|
+
// location and its bytes before copying it; npm/source/downloads stay out.
|
|
30
|
+
if (canonical(executable).toLowerCase() !== canonical(launcher).toLowerCase()) {
|
|
31
|
+
// Windows can spell the same home as RUNNER~1 and runneradmin; Bun's
|
|
32
|
+
// realpath does not always expand the short spelling. Compare the file
|
|
33
|
+
// identity as well, never merely matching an arbitrary binary's bytes.
|
|
34
|
+
const running = statSync(executable, { bigint: true });
|
|
35
|
+
const installedLauncher = statSync(launcher, { bigint: true });
|
|
36
|
+
if (running.ino === 0n || running.ino !== installedLauncher.ino || running.dev !== installedLauncher.dev)
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
const installed = options.version
|
|
40
|
+
? path.join(versions, `${options.version}.exe`)
|
|
41
|
+
: versionPath(VERSION);
|
|
42
|
+
if (!readFileSync(launcher).equals(readFileSync(installed)))
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const root = canonical(versions) + path.sep;
|
|
47
|
+
if (!canonical(executable).startsWith(root) || !canonical(launcher).startsWith(root))
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
return installAlias({ bin, versions: [], windows, searchPath: options.searchPath });
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// A missing/read-only installation must never prevent the requested command.
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|