deepspace 0.10.2 → 0.10.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/CHANGELOG.md +6 -0
- package/dist/{chunk-T7V4GUIN.js → chunk-ZJ43EK3N.js} +220 -107
- package/dist/chunk-ZJ43EK3N.js.map +1 -0
- package/dist/cli.js +177 -386
- package/dist/cli.js.map +1 -1
- package/dist/documentation-client-core.js +1 -1
- package/dist/documentation-default-renderer.cjs +34 -34
- package/dist/documentation-react.js +1 -1
- package/dist/documentation-runtime.js +10 -10
- package/dist/documentation-server-core.js +1 -1
- package/dist/documentation.d.ts +2 -1
- package/dist/documentation.js +326 -157
- package/dist/documentation.js.map +1 -1
- package/dist/fonts/geist-mono-OFL.txt +93 -0
- package/dist/fonts/geist-mono-variable.woff2 +0 -0
- package/dist/fonts/inter-OFL.txt +92 -0
- package/dist/fonts/inter-variable.woff2 +0 -0
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-T7V4GUIN.js.map +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli/cli.ts
|
|
4
|
-
import { defineCommand as
|
|
4
|
+
import { defineCommand as defineCommand13, runMain, runCommand } from "citty";
|
|
5
5
|
import { sync as spawnSync8 } from "cross-spawn";
|
|
6
|
-
import { readFileSync as
|
|
7
|
-
import { dirname as dirname10, join as
|
|
6
|
+
import { readFileSync as readFileSync27, existsSync as existsSync25 } from "fs";
|
|
7
|
+
import { dirname as dirname10, join as join24 } from "path";
|
|
8
8
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
9
9
|
|
|
10
10
|
// src/cli/lib/spinner.ts
|
|
@@ -709,7 +709,7 @@ async function provisionProfile(jwt) {
|
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
711
|
function sleep(ms) {
|
|
712
|
-
return new Promise((
|
|
712
|
+
return new Promise((resolve18) => setTimeout(resolve18, ms));
|
|
713
713
|
}
|
|
714
714
|
function base64url(bytes) {
|
|
715
715
|
return bytes.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
@@ -1267,7 +1267,7 @@ function upsertWorktreeLaunchConfig(mainRepoRoot, worktreeName, appDir, opts) {
|
|
|
1267
1267
|
let port = opts.port;
|
|
1268
1268
|
if (opts.probePort) {
|
|
1269
1269
|
const taken = new Set(
|
|
1270
|
-
config.configurations.map((c) => Number(c?.port)).filter((
|
|
1270
|
+
config.configurations.map((c) => Number(c?.port)).filter((p34) => Number.isInteger(p34) && p34 > 0)
|
|
1271
1271
|
);
|
|
1272
1272
|
for (let i = 0; i < WORKTREE_PORT_RANGE && taken.has(port); i++) {
|
|
1273
1273
|
port = WORKTREE_PORT_MIN + (port - WORKTREE_PORT_MIN + 1) % WORKTREE_PORT_RANGE;
|
|
@@ -1838,7 +1838,8 @@ async function refreshSecretsCache(deployUrl, token, appId, wranglerEnv) {
|
|
|
1838
1838
|
return {
|
|
1839
1839
|
pulled,
|
|
1840
1840
|
rendered: renderSecretsCache(pulled.values, pulled),
|
|
1841
|
-
|
|
1841
|
+
// An empty store is the common case and not worth a status line.
|
|
1842
|
+
summary: count ? `Secrets: ${pulled.configName} (${count} secret${count === 1 ? "" : "s"})` : null
|
|
1842
1843
|
};
|
|
1843
1844
|
}
|
|
1844
1845
|
|
|
@@ -2289,18 +2290,18 @@ function ensureInstallReady(appDir) {
|
|
|
2289
2290
|
const logPath = join9(sentinelDir, "install.log");
|
|
2290
2291
|
if (existsSync9(errPath)) {
|
|
2291
2292
|
const detail = readFileSync11(errPath, "utf-8").trimEnd();
|
|
2292
|
-
const
|
|
2293
|
+
const log28 = existsSync9(logPath) ? ` Full log: ${logPath}.` : "";
|
|
2293
2294
|
throw new Refusal(
|
|
2294
|
-
`Dependency install failed: ${detail}.${
|
|
2295
|
+
`Dependency install failed: ${detail}.${log28} Run \`npm install\` (or \`bun install\`) manually, then retry.`,
|
|
2295
2296
|
"install_failed",
|
|
2296
2297
|
{ action: { cwd: appDir, argv: [detectPackageManager(appDir), "install"] } }
|
|
2297
2298
|
);
|
|
2298
2299
|
}
|
|
2299
2300
|
if (existsSync9(startedPath) && !existsSync9(donePath)) {
|
|
2300
2301
|
if (!installWorkerAlive(sentinelDir)) {
|
|
2301
|
-
const
|
|
2302
|
+
const log28 = existsSync9(logPath) ? ` See what happened: ${logPath}.` : "";
|
|
2302
2303
|
throw new Refusal(
|
|
2303
|
-
`The dependency install is no longer running and never finished.${
|
|
2304
|
+
`The dependency install is no longer running and never finished.${log28} Run \`npm install\` (or \`bun install\`) manually, then retry.`,
|
|
2304
2305
|
"install_failed",
|
|
2305
2306
|
{ action: { cwd: appDir, argv: [detectPackageManager(appDir), "install"] } }
|
|
2306
2307
|
);
|
|
@@ -2449,7 +2450,7 @@ function lintSchema(schema) {
|
|
|
2449
2450
|
const offendingRoles = Object.entries(schema.permissions).filter(([, perms]) => perms.read === true).map(([role]) => role);
|
|
2450
2451
|
if (offendingRoles.length > 0) {
|
|
2451
2452
|
const usesAware = Object.values(schema.permissions).some(
|
|
2452
|
-
(
|
|
2453
|
+
(p34) => typeof p34.read === "string" && VISIBILITY_AWARE.includes(p34.read)
|
|
2453
2454
|
);
|
|
2454
2455
|
if (!usesAware) {
|
|
2455
2456
|
warnings.push(
|
|
@@ -2533,10 +2534,10 @@ function formatSchemaLintFindings(findings) {
|
|
|
2533
2534
|
import { createServer } from "net";
|
|
2534
2535
|
var DEFAULT_PORT = 5173;
|
|
2535
2536
|
function checkPortAvailable(port, host = "0.0.0.0") {
|
|
2536
|
-
return new Promise((
|
|
2537
|
+
return new Promise((resolve18) => {
|
|
2537
2538
|
const srv = createServer();
|
|
2538
|
-
srv.once("error", () =>
|
|
2539
|
-
srv.once("listening", () => srv.close(() =>
|
|
2539
|
+
srv.once("error", () => resolve18(false));
|
|
2540
|
+
srv.once("listening", () => srv.close(() => resolve18(true)));
|
|
2540
2541
|
srv.listen(port, host);
|
|
2541
2542
|
});
|
|
2542
2543
|
}
|
|
@@ -2664,7 +2665,7 @@ var dev_default = defineDeepspaceCommand({
|
|
|
2664
2665
|
const refreshed = await refreshSecretsCache(DEPLOY_URL, token, appIdForSecrets, wranglerEnv);
|
|
2665
2666
|
if (refreshed) {
|
|
2666
2667
|
generatedSecretsCache = refreshed.rendered;
|
|
2667
|
-
say(refreshed.summary);
|
|
2668
|
+
if (refreshed.summary) say(refreshed.summary);
|
|
2668
2669
|
}
|
|
2669
2670
|
} catch (err) {
|
|
2670
2671
|
throw new Refusal(
|
|
@@ -3261,7 +3262,7 @@ var test_default = defineDeepspaceCommand({
|
|
|
3261
3262
|
const refreshed = await refreshSecretsCache(DEPLOY_URL2, token, appIdForSecrets, wranglerEnv);
|
|
3262
3263
|
if (refreshed) {
|
|
3263
3264
|
generatedSecretsCache = refreshed.rendered;
|
|
3264
|
-
say(refreshed.summary);
|
|
3265
|
+
if (refreshed.summary) say(refreshed.summary);
|
|
3265
3266
|
}
|
|
3266
3267
|
} catch (err) {
|
|
3267
3268
|
throw new Refusal(
|
|
@@ -5172,7 +5173,7 @@ async function pushWithTransientRetry(push) {
|
|
|
5172
5173
|
} catch (error) {
|
|
5173
5174
|
const message = errorMessage3(error);
|
|
5174
5175
|
if (/(?:HTTP |error: )(?:429|503)\b/i.test(message) && attempt < backoffMs.length) {
|
|
5175
|
-
await new Promise((
|
|
5176
|
+
await new Promise((resolve18) => setTimeout(resolve18, backoffMs[attempt]));
|
|
5176
5177
|
continue;
|
|
5177
5178
|
}
|
|
5178
5179
|
throw error;
|
|
@@ -5444,7 +5445,7 @@ async function postWithRetry(url, makeInit, {
|
|
|
5444
5445
|
lastError = error;
|
|
5445
5446
|
}
|
|
5446
5447
|
if (attempt < attempts) {
|
|
5447
|
-
await new Promise((
|
|
5448
|
+
await new Promise((resolve18) => setTimeout(resolve18, Math.min(8e3, 500 * 2 ** (attempt - 1))));
|
|
5448
5449
|
}
|
|
5449
5450
|
}
|
|
5450
5451
|
if (lastResponse) return lastResponse;
|
|
@@ -5480,7 +5481,7 @@ async function loadDeploySecrets(options) {
|
|
|
5480
5481
|
generatedSecretsCache: refreshed.rendered,
|
|
5481
5482
|
sharedDevVarsCache: true
|
|
5482
5483
|
});
|
|
5483
|
-
p11.log.info(refreshed.summary);
|
|
5484
|
+
if (refreshed.summary) p11.log.info(refreshed.summary);
|
|
5484
5485
|
}
|
|
5485
5486
|
} catch (error) {
|
|
5486
5487
|
if (error?.status === 403) {
|
|
@@ -5826,7 +5827,7 @@ async function waitForAssetsReady(url, timeoutMs) {
|
|
|
5826
5827
|
if (!body.includes("Assets have not yet deployed") && !body.includes("No app configured")) {
|
|
5827
5828
|
streak++;
|
|
5828
5829
|
if (streak >= 3) return true;
|
|
5829
|
-
await new Promise((
|
|
5830
|
+
await new Promise((resolve18) => setTimeout(resolve18, 1500));
|
|
5830
5831
|
continue;
|
|
5831
5832
|
}
|
|
5832
5833
|
streak = 0;
|
|
@@ -5834,7 +5835,7 @@ async function waitForAssetsReady(url, timeoutMs) {
|
|
|
5834
5835
|
streak = 0;
|
|
5835
5836
|
}
|
|
5836
5837
|
const waitMs = Math.min(8e3, 1e3 * 2 ** (attempt - 1));
|
|
5837
|
-
await new Promise((
|
|
5838
|
+
await new Promise((resolve18) => setTimeout(resolve18, waitMs));
|
|
5838
5839
|
}
|
|
5839
5840
|
return false;
|
|
5840
5841
|
}
|
|
@@ -6127,12 +6128,20 @@ var apps_default = defineDeepspaceCommand({
|
|
|
6127
6128
|
if (!apps.length) {
|
|
6128
6129
|
console.log("No apps yet. Create one with `npx create-deepspace <name>` and `deepspace deploy`.");
|
|
6129
6130
|
} else {
|
|
6130
|
-
const
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6131
|
+
const rows = [...apps].sort(
|
|
6132
|
+
(left, right) => Number(right.status !== "undeployed") - Number(left.status !== "undeployed")
|
|
6133
|
+
);
|
|
6134
|
+
const nameWidth = Math.max(4, ...rows.map((a) => (a.name ?? "\u2014").length));
|
|
6135
|
+
const statusWidth = Math.max(6, ...rows.map((a) => a.status.length));
|
|
6136
|
+
const idWidth = Math.max(6, ...rows.map((a) => a.appId.length));
|
|
6137
|
+
console.log(
|
|
6138
|
+
`${"NAME".padEnd(nameWidth)} ${"STATUS".padEnd(statusWidth)} ${"APP ID".padEnd(idWidth)} URL`
|
|
6139
|
+
);
|
|
6140
|
+
for (const a of rows) {
|
|
6134
6141
|
const url = a.url ?? "(not deployed)";
|
|
6135
|
-
console.log(
|
|
6142
|
+
console.log(
|
|
6143
|
+
`${(a.name ?? "\u2014").padEnd(nameWidth)} ${a.status.padEnd(statusWidth)} ${a.appId.padEnd(idWidth)} ${url}`
|
|
6144
|
+
);
|
|
6136
6145
|
}
|
|
6137
6146
|
}
|
|
6138
6147
|
}
|
|
@@ -7536,11 +7545,11 @@ function fmtDate(iso) {
|
|
|
7536
7545
|
}
|
|
7537
7546
|
async function confirm4(message) {
|
|
7538
7547
|
process.stdout.write(`${message} [y/N] `);
|
|
7539
|
-
return new Promise((
|
|
7548
|
+
return new Promise((resolve18) => {
|
|
7540
7549
|
process.stdin.setEncoding("utf-8");
|
|
7541
7550
|
process.stdin.once("data", (data) => {
|
|
7542
7551
|
const answer = data.toString().trim().toLowerCase();
|
|
7543
|
-
|
|
7552
|
+
resolve18(answer === "y" || answer === "yes");
|
|
7544
7553
|
});
|
|
7545
7554
|
});
|
|
7546
7555
|
}
|
|
@@ -7867,8 +7876,8 @@ var list3 = defineDeepspaceCommand({
|
|
|
7867
7876
|
}
|
|
7868
7877
|
if (pending.length) {
|
|
7869
7878
|
console.log(`PENDING INVITES ON ${app2}`);
|
|
7870
|
-
for (const
|
|
7871
|
-
console.log(` ${
|
|
7879
|
+
for (const p34 of pending) {
|
|
7880
|
+
console.log(` ${p34.email} (expires ${new Date(p34.expiresAt).toLocaleDateString()})`);
|
|
7872
7881
|
}
|
|
7873
7882
|
}
|
|
7874
7883
|
}
|
|
@@ -7966,7 +7975,7 @@ var cancel3 = defineDeepspaceCommand({
|
|
|
7966
7975
|
`/api/app-collaborators/${encodeURIComponent(app2)}`
|
|
7967
7976
|
);
|
|
7968
7977
|
const target = email.trim().toLowerCase();
|
|
7969
|
-
const found = pending.find((
|
|
7978
|
+
const found = pending.find((p34) => p34.email.toLowerCase() === target);
|
|
7970
7979
|
if (!found) {
|
|
7971
7980
|
throw new Refusal(`${email} has no pending invite on ${app2}`, "no_pending_invite", {
|
|
7972
7981
|
action: cliAction("deepspace", "app", "collaborators", "list", "--app", app2)
|
|
@@ -8434,227 +8443,10 @@ var integrations_default = defineCommand8({
|
|
|
8434
8443
|
}
|
|
8435
8444
|
});
|
|
8436
8445
|
|
|
8437
|
-
// src/cli/commands/library.ts
|
|
8438
|
-
import { defineCommand as defineCommand9 } from "citty";
|
|
8439
|
-
import { existsSync as existsSync21, readFileSync as readFileSync22 } from "fs";
|
|
8440
|
-
import { join as join20, resolve as resolve15 } from "path";
|
|
8441
|
-
import { parse as parseToml4 } from "smol-toml";
|
|
8442
|
-
import * as p16 from "@clack/prompts";
|
|
8443
|
-
var DEFAULT_LIBRARY_APP = "deepdotspace-site";
|
|
8444
|
-
var str = (v) => typeof v === "string" && v ? v : void 0;
|
|
8445
|
-
var publish = defineDeepspaceCommand({
|
|
8446
|
-
meta: {
|
|
8447
|
-
name: "publish",
|
|
8448
|
-
description: "Publish the current app to the DeepSpace library"
|
|
8449
|
-
},
|
|
8450
|
-
args: {
|
|
8451
|
-
dir: {
|
|
8452
|
-
type: "string",
|
|
8453
|
-
description: "App directory (default: current directory)",
|
|
8454
|
-
required: false
|
|
8455
|
-
},
|
|
8456
|
-
app: {
|
|
8457
|
-
type: "string",
|
|
8458
|
-
description: "App name (default: read from wrangler.toml)",
|
|
8459
|
-
required: false
|
|
8460
|
-
},
|
|
8461
|
-
name: {
|
|
8462
|
-
type: "string",
|
|
8463
|
-
description: "Display name (default: app name)",
|
|
8464
|
-
required: false
|
|
8465
|
-
},
|
|
8466
|
-
description: {
|
|
8467
|
-
type: "string",
|
|
8468
|
-
description: "Short description",
|
|
8469
|
-
required: false
|
|
8470
|
-
},
|
|
8471
|
-
category: {
|
|
8472
|
-
type: "string",
|
|
8473
|
-
description: "Category (e.g. Productivity, Finance, AI). Default: General",
|
|
8474
|
-
required: false
|
|
8475
|
-
},
|
|
8476
|
-
tags: {
|
|
8477
|
-
type: "string",
|
|
8478
|
-
description: "Comma-separated tags",
|
|
8479
|
-
required: false
|
|
8480
|
-
},
|
|
8481
|
-
visibility: {
|
|
8482
|
-
type: "string",
|
|
8483
|
-
description: "'public' (default), 'unlisted', or 'private'",
|
|
8484
|
-
required: false
|
|
8485
|
-
},
|
|
8486
|
-
screenshot: {
|
|
8487
|
-
type: "string",
|
|
8488
|
-
description: "Override the auto-captured preview with a public PNG URL",
|
|
8489
|
-
required: false
|
|
8490
|
-
},
|
|
8491
|
-
"library-app": {
|
|
8492
|
-
type: "string",
|
|
8493
|
-
description: `Target library app subdomain (default: ${DEFAULT_LIBRARY_APP})`,
|
|
8494
|
-
required: false
|
|
8495
|
-
}
|
|
8496
|
-
},
|
|
8497
|
-
async run({ args }) {
|
|
8498
|
-
const json = args.json;
|
|
8499
|
-
const intro6 = (s) => {
|
|
8500
|
-
if (!json) p16.intro(s);
|
|
8501
|
-
};
|
|
8502
|
-
const info2 = (s) => {
|
|
8503
|
-
if (!json) p16.log.info(s);
|
|
8504
|
-
};
|
|
8505
|
-
intro6("Publishing to the DeepSpace library");
|
|
8506
|
-
const appErr = parseAppArg(str(args.app)).error;
|
|
8507
|
-
if (appErr) throw new Refusal(appErr, "invalid_app");
|
|
8508
|
-
let appName = str(args.app)?.trim();
|
|
8509
|
-
if (!appName) {
|
|
8510
|
-
const appDir = resolve15(str(args.dir) ?? ".");
|
|
8511
|
-
const wranglerPath = join20(appDir, "wrangler.toml");
|
|
8512
|
-
if (!existsSync21(wranglerPath)) {
|
|
8513
|
-
throw new Refusal(
|
|
8514
|
-
"No --app provided and no wrangler.toml found. Either pass --app <name> or run from your app's directory.",
|
|
8515
|
-
"not_in_app_repo"
|
|
8516
|
-
);
|
|
8517
|
-
}
|
|
8518
|
-
const cfg = parseToml4(readFileSync22(wranglerPath, "utf-8"));
|
|
8519
|
-
const nameRes = resolveAppName(cfg.name);
|
|
8520
|
-
if (!nameRes.ok) throw new Refusal(`wrangler.toml: ${nameRes.reason}`, "invalid_config");
|
|
8521
|
-
appName = nameRes.name;
|
|
8522
|
-
}
|
|
8523
|
-
info2(`App: ${appName}`);
|
|
8524
|
-
const visibility = str(args.visibility) ?? "public";
|
|
8525
|
-
if (!["public", "private", "unlisted"].includes(visibility)) {
|
|
8526
|
-
throw new Refusal("--visibility must be 'public', 'unlisted', or 'private'.", "invalid_visibility");
|
|
8527
|
-
}
|
|
8528
|
-
const tags = str(args.tags) ? String(args.tags).split(",").map((t) => t.trim()).filter(Boolean) : void 0;
|
|
8529
|
-
const libraryApp = str(args["library-app"]) ?? DEFAULT_LIBRARY_APP;
|
|
8530
|
-
const libraryHost = process.env.DEEPSPACE_LIBRARY_HOST ?? `https://${libraryApp}.app.space`;
|
|
8531
|
-
let token;
|
|
8532
|
-
try {
|
|
8533
|
-
token = await ensureToken();
|
|
8534
|
-
} catch (err) {
|
|
8535
|
-
throw new Refusal(err instanceof Error ? err.message : String(err), "not_authenticated", {
|
|
8536
|
-
action: cliAction("deepspace", "auth", "login")
|
|
8537
|
-
});
|
|
8538
|
-
}
|
|
8539
|
-
const payload = {
|
|
8540
|
-
appName,
|
|
8541
|
-
...args.name ? { name: args.name } : {},
|
|
8542
|
-
...args.description ? { description: args.description } : {},
|
|
8543
|
-
...args.category ? { category: args.category } : {},
|
|
8544
|
-
...tags ? { tags } : {},
|
|
8545
|
-
visibility,
|
|
8546
|
-
...args.screenshot ? { screenshotUrl: args.screenshot } : {}
|
|
8547
|
-
};
|
|
8548
|
-
const url = `${libraryHost}/api/actions/library.publish`;
|
|
8549
|
-
let res;
|
|
8550
|
-
try {
|
|
8551
|
-
res = await fetch(url, {
|
|
8552
|
-
method: "POST",
|
|
8553
|
-
headers: {
|
|
8554
|
-
"Content-Type": "application/json",
|
|
8555
|
-
Authorization: `Bearer ${token}`
|
|
8556
|
-
},
|
|
8557
|
-
body: JSON.stringify(payload)
|
|
8558
|
-
});
|
|
8559
|
-
} catch (err) {
|
|
8560
|
-
throw new Refusal(
|
|
8561
|
-
`Network error reaching ${url}: ${err instanceof Error ? err.message : String(err)}`,
|
|
8562
|
-
"network_error"
|
|
8563
|
-
);
|
|
8564
|
-
}
|
|
8565
|
-
const body = await res.text();
|
|
8566
|
-
let parsed;
|
|
8567
|
-
try {
|
|
8568
|
-
parsed = JSON.parse(body);
|
|
8569
|
-
} catch {
|
|
8570
|
-
throw new Refusal(`Server returned non-JSON (${res.status}): ${body.slice(0, 400)}`, "invalid_response");
|
|
8571
|
-
}
|
|
8572
|
-
if (!parsed.success) {
|
|
8573
|
-
throw new Refusal(parsed.error ?? `Publish failed (HTTP ${res.status}).`, "publish_failed");
|
|
8574
|
-
}
|
|
8575
|
-
if (!json) {
|
|
8576
|
-
p16.log.success(`Published ${appName} as ${parsed.data?.templateHandle} (v${parsed.data?.version})`);
|
|
8577
|
-
if (parsed.data?.url) p16.log.message(parsed.data.url);
|
|
8578
|
-
p16.outro("Done");
|
|
8579
|
-
}
|
|
8580
|
-
return {
|
|
8581
|
-
data: {
|
|
8582
|
-
appName,
|
|
8583
|
-
templateHandle: parsed.data?.templateHandle ?? null,
|
|
8584
|
-
url: parsed.data?.url ?? null,
|
|
8585
|
-
version: parsed.data?.version ?? null,
|
|
8586
|
-
visibility
|
|
8587
|
-
}
|
|
8588
|
-
};
|
|
8589
|
-
}
|
|
8590
|
-
});
|
|
8591
|
-
var unpublish = defineDeepspaceCommand({
|
|
8592
|
-
meta: {
|
|
8593
|
-
name: "unpublish",
|
|
8594
|
-
description: "Remove a library entry (owner or admin only)"
|
|
8595
|
-
},
|
|
8596
|
-
args: {
|
|
8597
|
-
handle: {
|
|
8598
|
-
type: "positional",
|
|
8599
|
-
description: "templateHandle to remove (usually your app name)",
|
|
8600
|
-
required: true
|
|
8601
|
-
},
|
|
8602
|
-
"library-app": {
|
|
8603
|
-
type: "string",
|
|
8604
|
-
description: `Target library app subdomain (default: ${DEFAULT_LIBRARY_APP})`,
|
|
8605
|
-
required: false
|
|
8606
|
-
}
|
|
8607
|
-
},
|
|
8608
|
-
async run({ args }) {
|
|
8609
|
-
const json = args.json;
|
|
8610
|
-
if (!json) p16.intro("Unpublishing library entry");
|
|
8611
|
-
let token;
|
|
8612
|
-
try {
|
|
8613
|
-
token = await ensureToken();
|
|
8614
|
-
} catch (err) {
|
|
8615
|
-
throw new Refusal(err instanceof Error ? err.message : String(err), "not_authenticated", {
|
|
8616
|
-
action: cliAction("deepspace", "auth", "login")
|
|
8617
|
-
});
|
|
8618
|
-
}
|
|
8619
|
-
const libraryApp = str(args["library-app"]) ?? DEFAULT_LIBRARY_APP;
|
|
8620
|
-
const libraryHost = process.env.DEEPSPACE_LIBRARY_HOST ?? `https://${libraryApp}.app.space`;
|
|
8621
|
-
const res = await fetch(`${libraryHost}/api/actions/library.unpublish`, {
|
|
8622
|
-
method: "POST",
|
|
8623
|
-
headers: { "Content-Type": "application/json", Authorization: `Bearer ${token}` },
|
|
8624
|
-
body: JSON.stringify({ templateHandle: String(args.handle) })
|
|
8625
|
-
});
|
|
8626
|
-
const body = await res.text();
|
|
8627
|
-
let parsed;
|
|
8628
|
-
try {
|
|
8629
|
-
parsed = JSON.parse(body);
|
|
8630
|
-
} catch {
|
|
8631
|
-
throw new Refusal(`Server returned non-JSON (${res.status}): ${body.slice(0, 400)}`, "invalid_response");
|
|
8632
|
-
}
|
|
8633
|
-
if (!parsed.success) {
|
|
8634
|
-
throw new Refusal(parsed.error ?? `HTTP ${res.status}`, "unpublish_failed");
|
|
8635
|
-
}
|
|
8636
|
-
if (!json) {
|
|
8637
|
-
p16.log.success(`Unpublished ${parsed.data?.templateHandle}`);
|
|
8638
|
-
p16.outro("Done");
|
|
8639
|
-
}
|
|
8640
|
-
return { data: { templateHandle: parsed.data?.templateHandle ?? String(args.handle) } };
|
|
8641
|
-
}
|
|
8642
|
-
});
|
|
8643
|
-
var library_default = defineCommand9({
|
|
8644
|
-
meta: {
|
|
8645
|
-
name: "library",
|
|
8646
|
-
description: "Manage your DeepSpace library entries"
|
|
8647
|
-
},
|
|
8648
|
-
subCommands: {
|
|
8649
|
-
publish,
|
|
8650
|
-
unpublish
|
|
8651
|
-
}
|
|
8652
|
-
});
|
|
8653
|
-
|
|
8654
8446
|
// src/cli/commands/feedback.ts
|
|
8655
|
-
import * as
|
|
8656
|
-
import { existsSync as
|
|
8657
|
-
import { dirname as dirname8, join as
|
|
8447
|
+
import * as p16 from "@clack/prompts";
|
|
8448
|
+
import { existsSync as existsSync21, readFileSync as readFileSync22 } from "fs";
|
|
8449
|
+
import { dirname as dirname8, join as join20 } from "path";
|
|
8658
8450
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
8659
8451
|
import { release } from "os";
|
|
8660
8452
|
var API_URL8 = process.env.DEEPSPACE_API_URL ?? PLATFORM_URLS.api;
|
|
@@ -8677,12 +8469,12 @@ function readCliVersion() {
|
|
|
8677
8469
|
try {
|
|
8678
8470
|
const here = dirname8(fileURLToPath2(import.meta.url));
|
|
8679
8471
|
const candidates = [
|
|
8680
|
-
|
|
8681
|
-
|
|
8472
|
+
join20(here, "..", "package.json"),
|
|
8473
|
+
join20(here, "..", "..", "..", "package.json")
|
|
8682
8474
|
];
|
|
8683
8475
|
for (const path of candidates) {
|
|
8684
|
-
if (!
|
|
8685
|
-
const pkg2 = JSON.parse(
|
|
8476
|
+
if (!existsSync21(path)) continue;
|
|
8477
|
+
const pkg2 = JSON.parse(readFileSync22(path, "utf-8"));
|
|
8686
8478
|
if (pkg2.name === "deepspace" && pkg2.version) return pkg2.version;
|
|
8687
8479
|
}
|
|
8688
8480
|
} catch {
|
|
@@ -8775,21 +8567,21 @@ var feedback_default = defineDeepspaceCommand({
|
|
|
8775
8567
|
);
|
|
8776
8568
|
}
|
|
8777
8569
|
if (interactive && (!args.type || !title || !body)) {
|
|
8778
|
-
|
|
8570
|
+
p16.intro("DeepSpace Feedback");
|
|
8779
8571
|
if (!args.type) {
|
|
8780
|
-
const picked = await
|
|
8572
|
+
const picked = await p16.select({
|
|
8781
8573
|
message: "What kind of feedback is this?",
|
|
8782
8574
|
options: TYPES.map((t) => ({ value: t, label: TYPE_LABELS[t] })),
|
|
8783
8575
|
initialValue: type
|
|
8784
8576
|
});
|
|
8785
|
-
if (
|
|
8786
|
-
|
|
8577
|
+
if (p16.isCancel(picked)) {
|
|
8578
|
+
p16.cancel("Cancelled.");
|
|
8787
8579
|
return { data: { submitted: false, cancelled: true } };
|
|
8788
8580
|
}
|
|
8789
8581
|
type = picked;
|
|
8790
8582
|
}
|
|
8791
8583
|
if (!title) {
|
|
8792
|
-
const t = await
|
|
8584
|
+
const t = await p16.text({
|
|
8793
8585
|
message: "Title",
|
|
8794
8586
|
placeholder: "Short summary of the issue",
|
|
8795
8587
|
validate: (v) => {
|
|
@@ -8799,14 +8591,14 @@ var feedback_default = defineDeepspaceCommand({
|
|
|
8799
8591
|
return void 0;
|
|
8800
8592
|
}
|
|
8801
8593
|
});
|
|
8802
|
-
if (
|
|
8803
|
-
|
|
8594
|
+
if (p16.isCancel(t)) {
|
|
8595
|
+
p16.cancel("Cancelled.");
|
|
8804
8596
|
return { data: { submitted: false, cancelled: true } };
|
|
8805
8597
|
}
|
|
8806
8598
|
title = String(t);
|
|
8807
8599
|
}
|
|
8808
8600
|
if (!body) {
|
|
8809
|
-
const m = await
|
|
8601
|
+
const m = await p16.text({
|
|
8810
8602
|
message: "Details",
|
|
8811
8603
|
placeholder: "What happened? Steps to reproduce, what you expected\u2026",
|
|
8812
8604
|
validate: (v) => {
|
|
@@ -8816,8 +8608,8 @@ var feedback_default = defineDeepspaceCommand({
|
|
|
8816
8608
|
return void 0;
|
|
8817
8609
|
}
|
|
8818
8610
|
});
|
|
8819
|
-
if (
|
|
8820
|
-
|
|
8611
|
+
if (p16.isCancel(m)) {
|
|
8612
|
+
p16.cancel("Cancelled.");
|
|
8821
8613
|
return { data: { submitted: false, cancelled: true } };
|
|
8822
8614
|
}
|
|
8823
8615
|
body = String(m);
|
|
@@ -8835,7 +8627,7 @@ var feedback_default = defineDeepspaceCommand({
|
|
|
8835
8627
|
throw new Refusal(err.message, "invalid_input");
|
|
8836
8628
|
}
|
|
8837
8629
|
if (interactive && !args.yes) {
|
|
8838
|
-
|
|
8630
|
+
p16.note(
|
|
8839
8631
|
`${TYPE_LABELS[payload.type]}
|
|
8840
8632
|
${payload.title}
|
|
8841
8633
|
|
|
@@ -8844,9 +8636,9 @@ ${payload.body}
|
|
|
8844
8636
|
Context: deepspace ${payload.cliVersion} \xB7 ${payload.nodeVersion} \xB7 ${payload.platform}` + (payload.appName ? ` \xB7 app ${payload.appName}` : ""),
|
|
8845
8637
|
"Review"
|
|
8846
8638
|
);
|
|
8847
|
-
const ok2 = await
|
|
8848
|
-
if (
|
|
8849
|
-
|
|
8639
|
+
const ok2 = await p16.confirm({ message: "Send this to the DeepSpace team?" });
|
|
8640
|
+
if (p16.isCancel(ok2) || !ok2) {
|
|
8641
|
+
p16.cancel("Not sent.");
|
|
8850
8642
|
return { data: { submitted: false, cancelled: true } };
|
|
8851
8643
|
}
|
|
8852
8644
|
}
|
|
@@ -8866,7 +8658,7 @@ Context: deepspace ${payload.cliVersion} \xB7 ${payload.nodeVersion} \xB7 ${payl
|
|
|
8866
8658
|
});
|
|
8867
8659
|
if (!args.json) {
|
|
8868
8660
|
if (interactive) {
|
|
8869
|
-
|
|
8661
|
+
p16.outro(`Thanks! Submitted as ${result.report.id}.`);
|
|
8870
8662
|
} else {
|
|
8871
8663
|
console.log(`Submitted feedback ${result.report.id} (${result.report.type}).`);
|
|
8872
8664
|
}
|
|
@@ -8877,8 +8669,8 @@ Context: deepspace ${payload.cliVersion} \xB7 ${payload.nodeVersion} \xB7 ${payl
|
|
|
8877
8669
|
});
|
|
8878
8670
|
|
|
8879
8671
|
// src/cli/commands/secrets.ts
|
|
8880
|
-
import { defineCommand as
|
|
8881
|
-
import { readFileSync as
|
|
8672
|
+
import { defineCommand as defineCommand9 } from "citty";
|
|
8673
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
8882
8674
|
|
|
8883
8675
|
// src/cli/lib/citty-args.ts
|
|
8884
8676
|
function dedupePositionals(bound, rest) {
|
|
@@ -8981,7 +8773,7 @@ function warnIfDebugRoutesEnabled(secrets) {
|
|
|
8981
8773
|
}
|
|
8982
8774
|
var APPLY_HINT = "Run `deepspace deploy` to apply \u2014 secrets take effect at deploy time.";
|
|
8983
8775
|
var LOCAL_DEV_HINT = "Running `deepspace dev start`? Restart it to load the change locally.";
|
|
8984
|
-
var list5 =
|
|
8776
|
+
var list5 = defineCommand9({
|
|
8985
8777
|
meta: { name: "list", description: "List masked secrets in a config" },
|
|
8986
8778
|
args: {
|
|
8987
8779
|
...COMMON_ARGS,
|
|
@@ -9011,7 +8803,7 @@ var list5 = defineCommand10({
|
|
|
9011
8803
|
}
|
|
9012
8804
|
}
|
|
9013
8805
|
});
|
|
9014
|
-
var set =
|
|
8806
|
+
var set = defineCommand9({
|
|
9015
8807
|
meta: { name: "set", description: "Set secrets from KEY=value pairs" },
|
|
9016
8808
|
args: {
|
|
9017
8809
|
...COMMON_ARGS,
|
|
@@ -9060,7 +8852,7 @@ var set = defineCommand10({
|
|
|
9060
8852
|
}
|
|
9061
8853
|
}
|
|
9062
8854
|
});
|
|
9063
|
-
var get =
|
|
8855
|
+
var get = defineCommand9({
|
|
9064
8856
|
meta: { name: "get", description: "Get a secret; pass --plain to print the value" },
|
|
9065
8857
|
args: {
|
|
9066
8858
|
...COMMON_ARGS,
|
|
@@ -9096,7 +8888,7 @@ var get = defineCommand10({
|
|
|
9096
8888
|
}
|
|
9097
8889
|
}
|
|
9098
8890
|
});
|
|
9099
|
-
var del2 =
|
|
8891
|
+
var del2 = defineCommand9({
|
|
9100
8892
|
meta: { name: "delete", description: "Delete one or more secrets" },
|
|
9101
8893
|
args: {
|
|
9102
8894
|
...COMMON_ARGS,
|
|
@@ -9130,7 +8922,7 @@ var del2 = defineCommand10({
|
|
|
9130
8922
|
}
|
|
9131
8923
|
}
|
|
9132
8924
|
});
|
|
9133
|
-
var upload =
|
|
8925
|
+
var upload = defineCommand9({
|
|
9134
8926
|
meta: { name: "upload", description: "Upload secrets from a dotenv or JSON file" },
|
|
9135
8927
|
args: {
|
|
9136
8928
|
...COMMON_ARGS,
|
|
@@ -9148,7 +8940,7 @@ var upload = defineCommand10({
|
|
|
9148
8940
|
async run({ args }) {
|
|
9149
8941
|
try {
|
|
9150
8942
|
const t = await resolveTarget(args);
|
|
9151
|
-
const content = args.file === "-" ?
|
|
8943
|
+
const content = args.file === "-" ? readFileSync23(0, "utf-8") : readFileSync23(args.file, "utf-8");
|
|
9152
8944
|
const secrets = parseSecretsUpload(content);
|
|
9153
8945
|
if (Object.keys(secrets).length === 0)
|
|
9154
8946
|
fail(new InputError("No secrets found in the input.", "empty_input"));
|
|
@@ -9167,7 +8959,7 @@ var upload = defineCommand10({
|
|
|
9167
8959
|
}
|
|
9168
8960
|
}
|
|
9169
8961
|
});
|
|
9170
|
-
var download =
|
|
8962
|
+
var download = defineCommand9({
|
|
9171
8963
|
meta: { name: "download", description: "Download a config\u2019s secrets (dotenv/json/shell)" },
|
|
9172
8964
|
args: {
|
|
9173
8965
|
...COMMON_ARGS,
|
|
@@ -9196,7 +8988,7 @@ var download = defineCommand10({
|
|
|
9196
8988
|
}
|
|
9197
8989
|
}
|
|
9198
8990
|
});
|
|
9199
|
-
var pull =
|
|
8991
|
+
var pull = defineCommand9({
|
|
9200
8992
|
meta: { name: "pull", description: "Refresh the .dev.vars cache from the app store" },
|
|
9201
8993
|
args: { ...COMMON_ARGS },
|
|
9202
8994
|
async run({ args }) {
|
|
@@ -9239,7 +9031,7 @@ var pull = defineCommand10({
|
|
|
9239
9031
|
}
|
|
9240
9032
|
}
|
|
9241
9033
|
});
|
|
9242
|
-
var configsList =
|
|
9034
|
+
var configsList = defineCommand9({
|
|
9243
9035
|
meta: { name: "list", description: "List the app\u2019s configs" },
|
|
9244
9036
|
args: { ...COMMON_ARGS },
|
|
9245
9037
|
async run({ args }) {
|
|
@@ -9260,7 +9052,7 @@ var configsList = defineCommand10({
|
|
|
9260
9052
|
}
|
|
9261
9053
|
}
|
|
9262
9054
|
});
|
|
9263
|
-
var configsCreate =
|
|
9055
|
+
var configsCreate = defineCommand9({
|
|
9264
9056
|
meta: { name: "create", description: "Create a config (optionally copying another)" },
|
|
9265
9057
|
args: {
|
|
9266
9058
|
...COMMON_ARGS,
|
|
@@ -9300,7 +9092,7 @@ var configsCreate = defineCommand10({
|
|
|
9300
9092
|
}
|
|
9301
9093
|
}
|
|
9302
9094
|
});
|
|
9303
|
-
var configsDelete =
|
|
9095
|
+
var configsDelete = defineCommand9({
|
|
9304
9096
|
meta: { name: "delete", description: "Delete a config and all of its secrets" },
|
|
9305
9097
|
args: {
|
|
9306
9098
|
...COMMON_ARGS,
|
|
@@ -9321,11 +9113,11 @@ var configsDelete = defineCommand10({
|
|
|
9321
9113
|
}
|
|
9322
9114
|
}
|
|
9323
9115
|
});
|
|
9324
|
-
var configs =
|
|
9116
|
+
var configs = defineCommand9({
|
|
9325
9117
|
meta: { name: "configs", description: "Manage the app\u2019s secrets configs" },
|
|
9326
9118
|
subCommands: { list: configsList, create: configsCreate, delete: configsDelete }
|
|
9327
9119
|
});
|
|
9328
|
-
var secrets_default =
|
|
9120
|
+
var secrets_default = defineCommand9({
|
|
9329
9121
|
meta: { name: "secrets", description: "Manage the app\u2019s secrets store" },
|
|
9330
9122
|
subCommands: {
|
|
9331
9123
|
list: list5,
|
|
@@ -9402,9 +9194,9 @@ var init_default = defineDeepspaceCommand({
|
|
|
9402
9194
|
});
|
|
9403
9195
|
|
|
9404
9196
|
// src/cli/commands/status.ts
|
|
9405
|
-
import { defineCommand as
|
|
9406
|
-
import * as
|
|
9407
|
-
import { existsSync as
|
|
9197
|
+
import { defineCommand as defineCommand10 } from "citty";
|
|
9198
|
+
import * as p17 from "@clack/prompts";
|
|
9199
|
+
import { existsSync as existsSync22, readFileSync as readFileSync24 } from "fs";
|
|
9408
9200
|
function timeAgo(iso) {
|
|
9409
9201
|
const ms = Date.now() - Date.parse(iso);
|
|
9410
9202
|
if (!Number.isFinite(ms) || ms < 0) return iso;
|
|
@@ -9437,7 +9229,7 @@ function resolveStatusApp(appDir, wranglerEnv) {
|
|
|
9437
9229
|
if (!resolved.ok) throw new InputError(resolved.reason, "invalid_env");
|
|
9438
9230
|
return { appName: resolved.name, appId: readAppId(appDir, wranglerEnv) };
|
|
9439
9231
|
}
|
|
9440
|
-
var status_default =
|
|
9232
|
+
var status_default = defineCommand10({
|
|
9441
9233
|
meta: {
|
|
9442
9234
|
name: "status",
|
|
9443
9235
|
description: "One screenful of current state: session, app, workspace, and live release"
|
|
@@ -9489,7 +9281,7 @@ var status_default = defineCommand11({
|
|
|
9489
9281
|
json.services = urls;
|
|
9490
9282
|
if (urlOverrides.length > 0) json.urlOverrides = urlOverrides;
|
|
9491
9283
|
}
|
|
9492
|
-
facts.loggedIn =
|
|
9284
|
+
facts.loggedIn = existsSync22(SESSION_PATH);
|
|
9493
9285
|
let userId = null;
|
|
9494
9286
|
if (!facts.loggedIn) {
|
|
9495
9287
|
lines.push(["Session", "not logged in"]);
|
|
@@ -9498,7 +9290,7 @@ var status_default = defineCommand11({
|
|
|
9498
9290
|
let who = "logged in";
|
|
9499
9291
|
try {
|
|
9500
9292
|
const payload = decodeJwtPayload(
|
|
9501
|
-
|
|
9293
|
+
readFileSync24(TOKEN_PATH, "utf-8").trim()
|
|
9502
9294
|
);
|
|
9503
9295
|
if (payload.email) who = payload.email;
|
|
9504
9296
|
userId = payload.sub ?? null;
|
|
@@ -9670,12 +9462,12 @@ var status_default = defineCommand11({
|
|
|
9670
9462
|
return;
|
|
9671
9463
|
}
|
|
9672
9464
|
const width = Math.max(...lines.map(([k]) => k.length));
|
|
9673
|
-
for (const [k, v] of lines)
|
|
9465
|
+
for (const [k, v] of lines) p17.log.message(`${k.padEnd(width)} ${v}`);
|
|
9674
9466
|
}
|
|
9675
9467
|
});
|
|
9676
9468
|
|
|
9677
9469
|
// src/cli/commands/push.ts
|
|
9678
|
-
import * as
|
|
9470
|
+
import * as p18 from "@clack/prompts";
|
|
9679
9471
|
function pullRecoveryAction(cwd, appId, branch) {
|
|
9680
9472
|
return {
|
|
9681
9473
|
cwd,
|
|
@@ -9859,7 +9651,7 @@ var push_default = defineDeepspaceCommand({
|
|
|
9859
9651
|
const recoverable = isRecoverablePushFailure(result.status);
|
|
9860
9652
|
const rejectReason = result.reason ?? result.summary;
|
|
9861
9653
|
const errorMsg = ok2 ? null : result.status === "ref_conflict" ? `The cloud repo's ${branch} moved while you worked (${rejectReason}). Run \`deepspace pull --app ${shQuote(appId)} --branch ${shQuote(branch)}\` to integrate, then push again.` : result.status === "rejected" ? `The cloud repo rejected ${branch}: ${rejectReason}.` + (OVERSIZED_PUSH_RE.test(rejectReason) ? ` ${oversizedPushFix(appDir)}` : "") : `The cloud repo's ${branch} has commit(s) your local ${branch} doesn't. Run \`deepspace pull --app ${shQuote(appId)} --branch ${shQuote(branch)}\` and merge (or rebase), then push. Avoid --force here \u2014 it's guarded and will refuse rather than silently drop a peer's commits.`;
|
|
9862
|
-
if (!args.json && ok2)
|
|
9654
|
+
if (!args.json && ok2) p18.log.info(`App: ${appId}`);
|
|
9863
9655
|
const action = recoverable ? pullRecoveryAction(pullRecoveryCwd, appId, branch) : void 0;
|
|
9864
9656
|
if (!ok2) {
|
|
9865
9657
|
throw new Refusal(errorMsg ?? `Push did not complete.`, result.status, {
|
|
@@ -9881,7 +9673,7 @@ var push_default = defineDeepspaceCommand({
|
|
|
9881
9673
|
});
|
|
9882
9674
|
|
|
9883
9675
|
// src/cli/commands/pull.ts
|
|
9884
|
-
import * as
|
|
9676
|
+
import * as p19 from "@clack/prompts";
|
|
9885
9677
|
import { realpathSync as realpathSync4 } from "fs";
|
|
9886
9678
|
function targetedVcAction(command, cwd, appId, branch) {
|
|
9887
9679
|
return {
|
|
@@ -10143,7 +9935,7 @@ var pull_default = defineDeepspaceCommand({
|
|
|
10143
9935
|
}
|
|
10144
9936
|
const actionRequired = recoveryAction !== void 0;
|
|
10145
9937
|
spinner2?.stop(codeForState ? `Fetched ${SPACE_REMOTE}/${branch}.` : line);
|
|
10146
|
-
if (!args.json)
|
|
9938
|
+
if (!args.json) p19.log.info(`App: ${appId} \xB7 ${SPACE_REMOTE}/${branch} at ${remoteOid.slice(0, 10)}`);
|
|
10147
9939
|
if (codeForState) {
|
|
10148
9940
|
throw new Refusal(line, codeForState, {
|
|
10149
9941
|
actionRequired,
|
|
@@ -10162,19 +9954,19 @@ var pull_default = defineDeepspaceCommand({
|
|
|
10162
9954
|
});
|
|
10163
9955
|
|
|
10164
9956
|
// src/cli/commands/clone.ts
|
|
10165
|
-
import * as
|
|
10166
|
-
import { existsSync as
|
|
10167
|
-
import { resolve as
|
|
9957
|
+
import * as p20 from "@clack/prompts";
|
|
9958
|
+
import { existsSync as existsSync23, readdirSync as readdirSync6, rmSync as rmSync5 } from "fs";
|
|
9959
|
+
import { resolve as resolve15, basename as basename3, join as join21 } from "path";
|
|
10168
9960
|
function cleanFailedCloneDir(dir) {
|
|
10169
9961
|
let entries;
|
|
10170
9962
|
try {
|
|
10171
9963
|
entries = readdirSync6(dir);
|
|
10172
9964
|
} catch {
|
|
10173
|
-
return
|
|
9965
|
+
return existsSync23(dir) ? ["<unreadable>"] : [];
|
|
10174
9966
|
}
|
|
10175
9967
|
if (entries.length === 1 && entries[0] === ".git") {
|
|
10176
9968
|
try {
|
|
10177
|
-
rmSync5(
|
|
9969
|
+
rmSync5(join21(dir, ".git"), { recursive: true, force: true });
|
|
10178
9970
|
return [];
|
|
10179
9971
|
} catch {
|
|
10180
9972
|
return entries;
|
|
@@ -10183,7 +9975,7 @@ function cleanFailedCloneDir(dir) {
|
|
|
10183
9975
|
return entries;
|
|
10184
9976
|
}
|
|
10185
9977
|
function validateCloneTarget(dir) {
|
|
10186
|
-
if (!
|
|
9978
|
+
if (!existsSync23(dir)) return false;
|
|
10187
9979
|
let entries;
|
|
10188
9980
|
try {
|
|
10189
9981
|
entries = readdirSync6(dir);
|
|
@@ -10218,7 +10010,7 @@ var clone_default = defineDeepspaceCommand({
|
|
|
10218
10010
|
async run({ args }) {
|
|
10219
10011
|
assertAppTargetResolvable(String(args.app));
|
|
10220
10012
|
const selector = String(args.app).trim();
|
|
10221
|
-
const dir =
|
|
10013
|
+
const dir = resolve15(String(args.dir ?? selector));
|
|
10222
10014
|
const dirPreexisted = validateCloneTarget(dir);
|
|
10223
10015
|
const spinner2 = args.json ? null : createSpinner();
|
|
10224
10016
|
spinner2?.start(`Resolving ${selector}\u2026`);
|
|
@@ -10264,7 +10056,7 @@ var clone_default = defineDeepspaceCommand({
|
|
|
10264
10056
|
`Cloned ${selector} (${branches.length} ${branches.length === 1 ? "branch" : "branches"}) into ${basename3(dir)}/ at ${head?.slice(0, 10) ?? "(unborn)"}.`
|
|
10265
10057
|
);
|
|
10266
10058
|
if (!args.json && !branch) {
|
|
10267
|
-
|
|
10059
|
+
p20.log.warn("HEAD is detached \u2014 check `git branch -a`.");
|
|
10268
10060
|
}
|
|
10269
10061
|
return {
|
|
10270
10062
|
data: {
|
|
@@ -10283,7 +10075,7 @@ var clone_default = defineDeepspaceCommand({
|
|
|
10283
10075
|
});
|
|
10284
10076
|
|
|
10285
10077
|
// src/cli/commands/releases.ts
|
|
10286
|
-
import * as
|
|
10078
|
+
import * as p21 from "@clack/prompts";
|
|
10287
10079
|
var DEPLOY_URL11 = process.env.DEEPSPACE_DEPLOY_URL ?? PLATFORM_URLS.deploy;
|
|
10288
10080
|
var releases_default = defineDeepspaceCommand({
|
|
10289
10081
|
meta: {
|
|
@@ -10324,7 +10116,7 @@ var releases_default = defineDeepspaceCommand({
|
|
|
10324
10116
|
spinner2?.stop(`Loaded ${releases.length} ${releases.length === 1 ? "release" : "releases"}.`);
|
|
10325
10117
|
if (!args.json) {
|
|
10326
10118
|
if (releases.length === 0) {
|
|
10327
|
-
|
|
10119
|
+
p21.log.info("No releases yet \u2014 the history starts with the next `deepspace deploy`.");
|
|
10328
10120
|
} else {
|
|
10329
10121
|
for (const r of releases) {
|
|
10330
10122
|
const source = r.commitOid ? `commit ${r.commitOid.slice(0, 10)}` : "(no source recorded)";
|
|
@@ -10333,7 +10125,7 @@ var releases_default = defineDeepspaceCommand({
|
|
|
10333
10125
|
`#${r.seq} ${r.id} ${r.kind.padEnd(8)} ${r.createdAt} ${r.actor} ${source} ${rollback}`
|
|
10334
10126
|
);
|
|
10335
10127
|
}
|
|
10336
|
-
|
|
10128
|
+
p21.log.info(
|
|
10337
10129
|
`Roll back an available release with: deepspace rollback <release-id>${wranglerEnv ? ` --env ${wranglerEnv}` : ""}`
|
|
10338
10130
|
);
|
|
10339
10131
|
}
|
|
@@ -10343,7 +10135,7 @@ var releases_default = defineDeepspaceCommand({
|
|
|
10343
10135
|
});
|
|
10344
10136
|
|
|
10345
10137
|
// src/cli/commands/rollback.ts
|
|
10346
|
-
import * as
|
|
10138
|
+
import * as p22 from "@clack/prompts";
|
|
10347
10139
|
var REL_ID_RE = /^rel_[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
10348
10140
|
function unavailableDoGuardRefusal(message) {
|
|
10349
10141
|
return new Refusal(
|
|
@@ -10456,18 +10248,18 @@ Re-run with --allow-do-deletion to accept the data loss.`,
|
|
|
10456
10248
|
spinner2?.stop(`Rolled back to ${result.rolledBackTo ?? releaseId}.`);
|
|
10457
10249
|
const doClassGuard = result.doClassGuard === "unverified" ? "unverified" : void 0;
|
|
10458
10250
|
if (!args.json) {
|
|
10459
|
-
if (result.url)
|
|
10251
|
+
if (result.url) p22.log.success(`Live at: ${result.url}`);
|
|
10460
10252
|
if (result.bundleRetained === false) {
|
|
10461
|
-
|
|
10253
|
+
p22.log.warn(
|
|
10462
10254
|
"The rollback is live, but its bundle was concurrently retired and is not available for a future rollback."
|
|
10463
10255
|
);
|
|
10464
10256
|
}
|
|
10465
10257
|
if (doClassGuard === "unverified") {
|
|
10466
|
-
|
|
10258
|
+
p22.log.warn(
|
|
10467
10259
|
"DO-class guard bypassed (--allow-do-deletion): this rollback was NOT checked against the live Durable Object classes \u2014 any class the target doesn't declare has been deleted with its data."
|
|
10468
10260
|
);
|
|
10469
10261
|
}
|
|
10470
|
-
|
|
10262
|
+
p22.log.info(
|
|
10471
10263
|
"This rollback is itself the newest release \u2014 `deepspace releases` shows the full history."
|
|
10472
10264
|
);
|
|
10473
10265
|
}
|
|
@@ -10487,14 +10279,14 @@ Re-run with --allow-do-deletion to accept the data loss.`,
|
|
|
10487
10279
|
});
|
|
10488
10280
|
|
|
10489
10281
|
// src/cli/commands/workspace.ts
|
|
10490
|
-
import { defineCommand as
|
|
10282
|
+
import { defineCommand as defineCommand11 } from "citty";
|
|
10491
10283
|
|
|
10492
10284
|
// src/cli/commands/workspace/new.ts
|
|
10493
|
-
import * as
|
|
10494
|
-
import { isAbsolute as isAbsolute6, resolve as
|
|
10285
|
+
import * as p25 from "@clack/prompts";
|
|
10286
|
+
import { isAbsolute as isAbsolute6, resolve as resolve16 } from "path";
|
|
10495
10287
|
|
|
10496
10288
|
// src/cli/commands/workspace/analysis.ts
|
|
10497
|
-
import * as
|
|
10289
|
+
import * as p23 from "@clack/prompts";
|
|
10498
10290
|
var MAX_OVERLAP_PATHS = 20;
|
|
10499
10291
|
var PEER_REF_PREFIX = `${spacePrivateRef("peers")}/`;
|
|
10500
10292
|
function peerWorkspaceRef(workspaceId) {
|
|
@@ -10608,16 +10400,16 @@ function printOverlaps(overlaps, json) {
|
|
|
10608
10400
|
for (const overlap of overlaps) {
|
|
10609
10401
|
const sample = overlap.paths.slice(0, 5).join(", ");
|
|
10610
10402
|
const more = overlap.paths.length - 5 + overlap.morePaths;
|
|
10611
|
-
|
|
10403
|
+
p23.log.warn(
|
|
10612
10404
|
`Overlap: ${overlap.workspaceId} ("${overlap.task}") also modified ${sample}${more > 0 ? ` (+${more} more)` : ""} \u2014 coordinate before landing.`
|
|
10613
10405
|
);
|
|
10614
10406
|
}
|
|
10615
10407
|
}
|
|
10616
10408
|
|
|
10617
10409
|
// src/cli/commands/workspace/local.ts
|
|
10618
|
-
import * as
|
|
10619
|
-
import { mkdirSync as mkdirSync7, readFileSync as
|
|
10620
|
-
import { dirname as dirname9, isAbsolute as isAbsolute5, join as
|
|
10410
|
+
import * as p24 from "@clack/prompts";
|
|
10411
|
+
import { mkdirSync as mkdirSync7, readFileSync as readFileSync25, realpathSync as realpathSync5, renameSync as renameSync2, statSync, writeFileSync as writeFileSync9 } from "fs";
|
|
10412
|
+
import { dirname as dirname9, isAbsolute as isAbsolute5, join as join22, relative as relative2, sep as sep2 } from "path";
|
|
10621
10413
|
var WORKSPACE_MARKER = "deepspace-workspace.json";
|
|
10622
10414
|
function excludeWorktreeDir(appDir, dir) {
|
|
10623
10415
|
try {
|
|
@@ -10638,7 +10430,7 @@ function worktreeMarkerPath(worktreeRoot) {
|
|
|
10638
10430
|
const result = runGit(worktreeRoot, ["rev-parse", "--absolute-git-dir"], { allowFail: true });
|
|
10639
10431
|
if (result.status !== 0) return null;
|
|
10640
10432
|
const gitDir = result.stdout.toString("utf-8").trim();
|
|
10641
|
-
return isAbsolute5(gitDir) ?
|
|
10433
|
+
return isAbsolute5(gitDir) ? join22(gitDir, WORKSPACE_MARKER) : null;
|
|
10642
10434
|
} catch {
|
|
10643
10435
|
return null;
|
|
10644
10436
|
}
|
|
@@ -10674,7 +10466,7 @@ function isManagedWorkspaceWorktree(worktreeRoot, workspaceId) {
|
|
|
10674
10466
|
const markerPath = worktreeMarkerPath(worktreeRoot);
|
|
10675
10467
|
if (!markerPath) return false;
|
|
10676
10468
|
try {
|
|
10677
|
-
const marker = JSON.parse(
|
|
10469
|
+
const marker = JSON.parse(readFileSync25(markerPath, "utf-8"));
|
|
10678
10470
|
return marker.version === 1 && marker.workspaceId === workspaceId && marker.mode === "managed-linked";
|
|
10679
10471
|
} catch {
|
|
10680
10472
|
return false;
|
|
@@ -10683,11 +10475,11 @@ function isManagedWorkspaceWorktree(worktreeRoot, workspaceId) {
|
|
|
10683
10475
|
function defaultWorkspaceRoot(appDir, workspaceId) {
|
|
10684
10476
|
const primary = listWorktrees(appDir)[0];
|
|
10685
10477
|
if (!primary) throw new Error("Git did not report a primary worktree");
|
|
10686
|
-
return
|
|
10478
|
+
return join22(primary.path, ".deepspace", "ws", workspaceId.slice(3).toLowerCase());
|
|
10687
10479
|
}
|
|
10688
10480
|
function appDirInWorktree(appDir, worktreeRoot) {
|
|
10689
10481
|
const appRelative = relative2(realpathSync5(repoToplevel(appDir)), realpathSync5(appDir));
|
|
10690
|
-
return appRelative ?
|
|
10482
|
+
return appRelative ? join22(worktreeRoot, appRelative) : worktreeRoot;
|
|
10691
10483
|
}
|
|
10692
10484
|
function materializeWorkspaceWorktree(appDir, worktreeRoot, branch, startPoint, workspaceId, options = {}) {
|
|
10693
10485
|
const createdOid = resolveCommit(appDir, startPoint);
|
|
@@ -10705,7 +10497,7 @@ function materializeWorkspaceWorktree(appDir, worktreeRoot, branch, startPoint,
|
|
|
10705
10497
|
function inOwnLinkedWorktree(appDir, id) {
|
|
10706
10498
|
if (workspaceIdFromBranch(currentBranch(appDir)) !== id) return false;
|
|
10707
10499
|
try {
|
|
10708
|
-
return statSync(
|
|
10500
|
+
return statSync(join22(repoToplevel(appDir), ".git")).isFile();
|
|
10709
10501
|
} catch {
|
|
10710
10502
|
return false;
|
|
10711
10503
|
}
|
|
@@ -10851,7 +10643,7 @@ function cleanupAction(outcome) {
|
|
|
10851
10643
|
}
|
|
10852
10644
|
function reportCleanupHuman(outcome) {
|
|
10853
10645
|
if (outcome.error) {
|
|
10854
|
-
|
|
10646
|
+
p24.log.warn(
|
|
10855
10647
|
cleanupRefusalMessage({
|
|
10856
10648
|
error: outcome.error,
|
|
10857
10649
|
worktreeDir: outcome.worktreeDir,
|
|
@@ -10864,12 +10656,12 @@ function reportCleanupHuman(outcome) {
|
|
|
10864
10656
|
outcome.worktreeRemoved ? "worktree" : null,
|
|
10865
10657
|
outcome.branchDeleted ? `branch ${outcome.branch}` : null
|
|
10866
10658
|
].filter(Boolean);
|
|
10867
|
-
if (parts.length)
|
|
10659
|
+
if (parts.length) p24.log.success(`Removed ${parts.join(" + ")}.`);
|
|
10868
10660
|
if (outcome.worktreeRetained) {
|
|
10869
|
-
|
|
10661
|
+
p24.log.info(`Retained externally managed worktree: ${outcome.worktreeRetained}`);
|
|
10870
10662
|
}
|
|
10871
10663
|
if (outcome.worktreeRemoved && outcome.mainDir) {
|
|
10872
|
-
|
|
10664
|
+
p24.log.info(`This directory was removed \u2014 run: cd ${shQuote(outcome.mainDir)}`);
|
|
10873
10665
|
}
|
|
10874
10666
|
}
|
|
10875
10667
|
|
|
@@ -11051,7 +10843,7 @@ var newWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11051
10843
|
idempotencyKey: mintIdempotencyKey()
|
|
11052
10844
|
});
|
|
11053
10845
|
const dirInput = typeof args.dir === "string" ? args.dir.trim() : "";
|
|
11054
|
-
const worktreeRoot = dirInput ? isAbsolute6(dirInput) ? dirInput :
|
|
10846
|
+
const worktreeRoot = dirInput ? isAbsolute6(dirInput) ? dirInput : resolve16(appDir, dirInput) : defaultWorkspaceRoot(appDir, id);
|
|
11055
10847
|
const dir = appDirInWorktree(appDir, worktreeRoot);
|
|
11056
10848
|
try {
|
|
11057
10849
|
materializeWorkspaceWorktree(appDir, worktreeRoot, branch, baseOid, id);
|
|
@@ -11066,8 +10858,8 @@ var newWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11066
10858
|
}
|
|
11067
10859
|
spinner2?.stop(`Workspace ${id} created.`);
|
|
11068
10860
|
if (!args.json) {
|
|
11069
|
-
|
|
11070
|
-
|
|
10861
|
+
p25.log.info(`Work in: cd ${dir}`);
|
|
10862
|
+
p25.log.info(
|
|
11071
10863
|
`Then: commit as usual, \`deepspace workspace sync\` to publish, \`deepspace workspace land\` when done.`
|
|
11072
10864
|
);
|
|
11073
10865
|
}
|
|
@@ -11088,9 +10880,9 @@ var newWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11088
10880
|
});
|
|
11089
10881
|
|
|
11090
10882
|
// src/cli/commands/workspace/attach.ts
|
|
11091
|
-
import * as
|
|
11092
|
-
import { existsSync as
|
|
11093
|
-
import { isAbsolute as isAbsolute7, resolve as
|
|
10883
|
+
import * as p26 from "@clack/prompts";
|
|
10884
|
+
import { existsSync as existsSync24, readdirSync as readdirSync7, rmSync as rmSync6 } from "fs";
|
|
10885
|
+
import { isAbsolute as isAbsolute7, resolve as resolve17 } from "path";
|
|
11094
10886
|
function finishedWorkspaceMessage(id, view) {
|
|
11095
10887
|
const workspace = view.workspace;
|
|
11096
10888
|
if (workspace.status === "landed") {
|
|
@@ -11099,7 +10891,7 @@ function finishedWorkspaceMessage(id, view) {
|
|
|
11099
10891
|
return `Workspace ${id} is ${workspace.status} \u2014 its ref is retained briefly (fetch ${workspace.ref} to inspect), but attach only works on active workspaces.`;
|
|
11100
10892
|
}
|
|
11101
10893
|
function cleanFailedFreshAttachDir(dir) {
|
|
11102
|
-
if (!
|
|
10894
|
+
if (!existsSync24(dir)) return [];
|
|
11103
10895
|
let entries;
|
|
11104
10896
|
try {
|
|
11105
10897
|
entries = readdirSync7(dir);
|
|
@@ -11175,7 +10967,7 @@ var attachWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11175
10967
|
);
|
|
11176
10968
|
}
|
|
11177
10969
|
const requestedDir = typeof args.dir === "string" ? args.dir.trim() : "";
|
|
11178
|
-
const worktreeRoot = requestedDir ? isAbsolute7(requestedDir) ? requestedDir :
|
|
10970
|
+
const worktreeRoot = requestedDir ? isAbsolute7(requestedDir) ? requestedDir : resolve17(appDir, requestedDir) : defaultWorkspaceRoot(appDir, id);
|
|
11179
10971
|
const dir2 = appDirInWorktree(appDir, worktreeRoot);
|
|
11180
10972
|
if (resolveCommit(appDir, `refs/heads/${branch}`)) {
|
|
11181
10973
|
throw new Refusal(
|
|
@@ -11186,8 +10978,8 @@ var attachWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11186
10978
|
materializeWorkspaceWorktree(appDir, worktreeRoot, branch, tip2, id);
|
|
11187
10979
|
spinner2?.stop(`Attached ${id}.`);
|
|
11188
10980
|
if (!args.json) {
|
|
11189
|
-
|
|
11190
|
-
|
|
10981
|
+
p26.log.info(`Task: ${view2.workspace.task}`);
|
|
10982
|
+
p26.log.info(`Work in: cd ${dir2}`);
|
|
11191
10983
|
}
|
|
11192
10984
|
const action2 = { cwd: dir2, argv: [detectPackageManager(dir2), "install"] };
|
|
11193
10985
|
return {
|
|
@@ -11214,11 +11006,11 @@ var attachWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11214
11006
|
extra: { status: view.workspace.status }
|
|
11215
11007
|
});
|
|
11216
11008
|
}
|
|
11217
|
-
const dir =
|
|
11009
|
+
const dir = resolve17(
|
|
11218
11010
|
process.cwd(),
|
|
11219
11011
|
(typeof args.dir === "string" ? args.dir.trim() : "") || `ws-${id.slice(3).toLowerCase()}`
|
|
11220
11012
|
);
|
|
11221
|
-
if (
|
|
11013
|
+
if (existsSync24(dir)) {
|
|
11222
11014
|
spinner2?.stop("Target exists.");
|
|
11223
11015
|
throw new Refusal(`${dir} already exists \u2014 pass a different directory.`, "dir_exists");
|
|
11224
11016
|
}
|
|
@@ -11259,8 +11051,8 @@ var attachWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11259
11051
|
spinner2?.stop(`Attached ${id}.`);
|
|
11260
11052
|
const action = { cwd: dir, argv: [detectPackageManager(dir), "install"] };
|
|
11261
11053
|
if (!args.json) {
|
|
11262
|
-
|
|
11263
|
-
|
|
11054
|
+
p26.log.info(`Task: ${view.workspace.task}`);
|
|
11055
|
+
p26.log.info("Pull app secrets after install if this workspace needs them.");
|
|
11264
11056
|
}
|
|
11265
11057
|
return {
|
|
11266
11058
|
data: {
|
|
@@ -11277,7 +11069,7 @@ var attachWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11277
11069
|
});
|
|
11278
11070
|
|
|
11279
11071
|
// src/cli/commands/workspace/sync.ts
|
|
11280
|
-
import * as
|
|
11072
|
+
import * as p27 from "@clack/prompts";
|
|
11281
11073
|
var syncWorkspaceCommand = defineDeepspaceCommand({
|
|
11282
11074
|
meta: {
|
|
11283
11075
|
name: "sync",
|
|
@@ -11338,12 +11130,12 @@ var syncWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11338
11130
|
);
|
|
11339
11131
|
printOverlaps(overlaps, args.json);
|
|
11340
11132
|
if (!args.json && trunkOverlap.length > 0) {
|
|
11341
|
-
|
|
11133
|
+
p27.log.warn(
|
|
11342
11134
|
`Trunk already changed ${trunkOverlap.length} file(s) you also touch \u2014 landed work you haven't merged: ${trunkOverlap.slice(0, 5).join(", ")}${trunkOverlap.length > 5 ? ` (+${trunkOverlap.length - 5} more)` : ""}. Merge trunk before landing (\`deepspace workspace status\` shows the full picture).`
|
|
11343
11135
|
);
|
|
11344
11136
|
}
|
|
11345
11137
|
if (!args.json && dirty.length > 0) {
|
|
11346
|
-
|
|
11138
|
+
p27.log.warn(
|
|
11347
11139
|
`${dirty.length} uncommitted ${dirty.length === 1 ? "file" : "files"} NOT synced \u2014 commit them to this workspace branch (WIP commits are fine \u2014 they land with the merge).`
|
|
11348
11140
|
);
|
|
11349
11141
|
}
|
|
@@ -11363,7 +11155,7 @@ var syncWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11363
11155
|
});
|
|
11364
11156
|
|
|
11365
11157
|
// src/cli/commands/workspace/list.ts
|
|
11366
|
-
import * as
|
|
11158
|
+
import * as p28 from "@clack/prompts";
|
|
11367
11159
|
|
|
11368
11160
|
// src/cli/lib/actor-labels.ts
|
|
11369
11161
|
var API_URL9 = process.env.DEEPSPACE_API_URL ?? PLATFORM_URLS.api;
|
|
@@ -11411,7 +11203,7 @@ var listWorkspacesCommand = defineDeepspaceCommand({
|
|
|
11411
11203
|
if (views.length === 0) {
|
|
11412
11204
|
spinner2?.stop("No workspaces found.");
|
|
11413
11205
|
if (!args.json) {
|
|
11414
|
-
|
|
11206
|
+
p28.log.info(
|
|
11415
11207
|
all ? "No workspaces." : 'No active workspaces. Create one with `deepspace workspace new -t "\u2026"`.'
|
|
11416
11208
|
);
|
|
11417
11209
|
}
|
|
@@ -11440,13 +11232,13 @@ var listWorkspacesCommand = defineDeepspaceCommand({
|
|
|
11440
11232
|
);
|
|
11441
11233
|
}
|
|
11442
11234
|
}
|
|
11443
|
-
|
|
11235
|
+
p28.log.info("\u2191 commits ahead of base \xB7 \u2193 trunk commits since base (staleness)");
|
|
11444
11236
|
return { data: { workspaces } };
|
|
11445
11237
|
}
|
|
11446
11238
|
});
|
|
11447
11239
|
|
|
11448
11240
|
// src/cli/commands/workspace/status.ts
|
|
11449
|
-
import * as
|
|
11241
|
+
import * as p29 from "@clack/prompts";
|
|
11450
11242
|
var workspaceStatusCommand = defineDeepspaceCommand({
|
|
11451
11243
|
meta: { name: "status", description: "This workspace: base staleness, overlaps, sync state" },
|
|
11452
11244
|
args: {
|
|
@@ -11506,22 +11298,22 @@ var workspaceStatusCommand = defineDeepspaceCommand({
|
|
|
11506
11298
|
overlaps
|
|
11507
11299
|
};
|
|
11508
11300
|
if (!args.json) {
|
|
11509
|
-
|
|
11510
|
-
|
|
11301
|
+
p29.log.info(`Task: ${workspace.task}`);
|
|
11302
|
+
p29.log.info(
|
|
11511
11303
|
`Base: ${workspace.baseOid.slice(0, 10)} \xB7 ahead ${aheadExact ?? "?"} commit(s) \xB7 trunk moved ${behindExact ?? "?"} commit(s) since your base`
|
|
11512
11304
|
);
|
|
11513
11305
|
if (!attached) {
|
|
11514
|
-
|
|
11306
|
+
p29.log.info(
|
|
11515
11307
|
`Not checked out in this clone \u2014 showing the published state (local HEAD/uncommitted unavailable). Attach it with \`deepspace workspace attach ${id} <dir>\`.`
|
|
11516
11308
|
);
|
|
11517
11309
|
}
|
|
11518
11310
|
if (unsynced)
|
|
11519
|
-
|
|
11311
|
+
p29.log.warn(
|
|
11520
11312
|
`Local HEAD ${headOid?.slice(0, 10)} is not synced (server has ${view.tipOid?.slice(0, 10) ?? "nothing"}) \u2014 run \`deepspace workspace sync\`.`
|
|
11521
11313
|
);
|
|
11522
|
-
if (dirty.length > 0)
|
|
11314
|
+
if (dirty.length > 0) p29.log.warn(`${dirty.length} uncommitted file(s) in the worktree.`);
|
|
11523
11315
|
if (trunkOverlap.length > 0) {
|
|
11524
|
-
|
|
11316
|
+
p29.log.warn(
|
|
11525
11317
|
`Trunk also modified: ${trunkOverlap.slice(0, 5).join(", ")}${trunkOverlap.length > 5 ? ` (+${trunkOverlap.length - 5} more)` : ""} \u2014 expect merge attention at land time.`
|
|
11526
11318
|
);
|
|
11527
11319
|
}
|
|
@@ -11532,17 +11324,17 @@ var workspaceStatusCommand = defineDeepspaceCommand({
|
|
|
11532
11324
|
});
|
|
11533
11325
|
|
|
11534
11326
|
// src/cli/commands/workspace/land.ts
|
|
11535
|
-
import * as
|
|
11327
|
+
import * as p30 from "@clack/prompts";
|
|
11536
11328
|
|
|
11537
11329
|
// src/cli/lib/validation.ts
|
|
11538
11330
|
import { sync as spawnSync7 } from "cross-spawn";
|
|
11539
|
-
import { readFileSync as
|
|
11540
|
-
import { join as
|
|
11331
|
+
import { readFileSync as readFileSync26 } from "fs";
|
|
11332
|
+
import { join as join23 } from "path";
|
|
11541
11333
|
var MAX_SUMMARY_CHARS = 4e3;
|
|
11542
11334
|
var MAX_OUTPUT_BUFFER = 64 * 1024 * 1024;
|
|
11543
11335
|
function configuredCommand(appDir) {
|
|
11544
11336
|
try {
|
|
11545
|
-
const pkg2 = JSON.parse(
|
|
11337
|
+
const pkg2 = JSON.parse(readFileSync26(join23(appDir, "package.json"), "utf-8"));
|
|
11546
11338
|
if (pkg2.scripts?.validate) return `${detectPackageManager(appDir)} run --silent validate`;
|
|
11547
11339
|
} catch {
|
|
11548
11340
|
}
|
|
@@ -11818,7 +11610,7 @@ var landWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11818
11610
|
if (!args.json && cleanup && !cleanup.error) {
|
|
11819
11611
|
reportCleanupHuman(cleanup);
|
|
11820
11612
|
} else if (!args.json && retainedWorktree) {
|
|
11821
|
-
|
|
11613
|
+
p30.log.info(`Retained checkout: ${retainedWorktree}`);
|
|
11822
11614
|
}
|
|
11823
11615
|
if (cleanup?.error) {
|
|
11824
11616
|
const action = cleanupAction({
|
|
@@ -11840,7 +11632,7 @@ var landWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11840
11632
|
});
|
|
11841
11633
|
|
|
11842
11634
|
// src/cli/commands/workspace/drop.ts
|
|
11843
|
-
import * as
|
|
11635
|
+
import * as p31 from "@clack/prompts";
|
|
11844
11636
|
function isWorkspaceTipPublished(appDir, localTip, publishedOids) {
|
|
11845
11637
|
return publishedOids.some(
|
|
11846
11638
|
(publishedOid) => publishedOid === localTip || isAncestor(appDir, localTip, publishedOid)
|
|
@@ -11849,9 +11641,9 @@ function isWorkspaceTipPublished(appDir, localTip, publishedOids) {
|
|
|
11849
11641
|
function workspaceUnsyncedRefusal(args) {
|
|
11850
11642
|
const syncArgv = ["deepspace", "workspace", "sync", "--app", args.appId, "--workspace", args.id];
|
|
11851
11643
|
const dropArgv = ["deepspace", "workspace", "drop", args.id, "--app", args.appId];
|
|
11852
|
-
const
|
|
11644
|
+
const publish = args.workspaceDir ? `Publish them first with \`${humanCommand(syncArgv)}\`, then re-run \`${humanCommand(dropArgv)}\`.` : `Recreate a worktree from the branch (\`git worktree add <dir> ${args.branch}\`), publish from there with \`${humanCommand(syncArgv)}\`, then re-run \`${humanCommand(dropArgv)}\`.`;
|
|
11853
11645
|
return new Refusal(
|
|
11854
|
-
`${args.id} has committed work that isn't published yet. ${
|
|
11646
|
+
`${args.id} has committed work that isn't published yet. ${publish} Alternatively, pass \`--keep-worktree\` to drop the cloud workspace while retaining the local branch/worktree for manual disposal. Nothing was dropped.`,
|
|
11855
11647
|
"workspace_unsynced",
|
|
11856
11648
|
{
|
|
11857
11649
|
...args.workspaceDir ? { action: { cwd: args.workspaceDir, argv: syncArgv } } : {},
|
|
@@ -11886,7 +11678,7 @@ var dropWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11886
11678
|
const { view: view2 } = await api5.dropWorkspace(explicitId);
|
|
11887
11679
|
spinner2?.stop();
|
|
11888
11680
|
if (!args.json) {
|
|
11889
|
-
|
|
11681
|
+
p31.log.success(
|
|
11890
11682
|
`Dropped ${explicitId}. Its ref sticks around briefly for undo, then is reaped.`
|
|
11891
11683
|
);
|
|
11892
11684
|
}
|
|
@@ -11938,9 +11730,9 @@ var dropWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11938
11730
|
};
|
|
11939
11731
|
spinner2?.stop();
|
|
11940
11732
|
if (!args.json) {
|
|
11941
|
-
|
|
11733
|
+
p31.log.success(`Dropped ${id}. Its ref sticks around briefly for undo, then is reaped.`);
|
|
11942
11734
|
if (cleanup && !cleanup.error) reportCleanupHuman(cleanup);
|
|
11943
|
-
else if (retainedWorktree)
|
|
11735
|
+
else if (retainedWorktree) p31.log.info(`Retained checkout: ${retainedWorktree}`);
|
|
11944
11736
|
}
|
|
11945
11737
|
if (cleanup?.error) {
|
|
11946
11738
|
const action = cleanupAction({
|
|
@@ -11962,7 +11754,7 @@ var dropWorkspaceCommand = defineDeepspaceCommand({
|
|
|
11962
11754
|
});
|
|
11963
11755
|
|
|
11964
11756
|
// src/cli/commands/workspace.ts
|
|
11965
|
-
var workspace_default =
|
|
11757
|
+
var workspace_default = defineCommand11({
|
|
11966
11758
|
meta: {
|
|
11967
11759
|
name: "workspace",
|
|
11968
11760
|
description: "Durable parallel-agent workspaces (new/attach/sync/list/status/land/drop)"
|
|
@@ -11979,7 +11771,7 @@ var workspace_default = defineCommand12({
|
|
|
11979
11771
|
});
|
|
11980
11772
|
|
|
11981
11773
|
// src/cli/commands/activity.ts
|
|
11982
|
-
import * as
|
|
11774
|
+
import * as p32 from "@clack/prompts";
|
|
11983
11775
|
var FOLLOW_INTERVAL_MS = 5e3;
|
|
11984
11776
|
function landIndex(events) {
|
|
11985
11777
|
const m = /* @__PURE__ */ new Map();
|
|
@@ -12092,7 +11884,7 @@ var activity_default = defineDeepspaceCommand({
|
|
|
12092
11884
|
const lands = landIndex(page.events);
|
|
12093
11885
|
for (const e of page.events) console.log(formatEvent2(e, lands, actors));
|
|
12094
11886
|
if (page.events.length === 0 && !args.follow) {
|
|
12095
|
-
|
|
11887
|
+
p32.log.info(cursor > 0 ? `No activity after #${cursor}.` : "No activity yet.");
|
|
12096
11888
|
}
|
|
12097
11889
|
}
|
|
12098
11890
|
cursor = page.cursor;
|
|
@@ -12102,7 +11894,7 @@ var activity_default = defineDeepspaceCommand({
|
|
|
12102
11894
|
}
|
|
12103
11895
|
if (!args.follow) {
|
|
12104
11896
|
if (page.events.length > 0) {
|
|
12105
|
-
|
|
11897
|
+
p32.log.info(
|
|
12106
11898
|
`Cursor: ${cursor}` + (page.hasMore ? ` \xB7 more available (next page: --since ${cursor})` : ` (resume later with --since ${cursor})`)
|
|
12107
11899
|
);
|
|
12108
11900
|
}
|
|
@@ -12124,7 +11916,7 @@ var activity_default = defineDeepspaceCommand({
|
|
|
12124
11916
|
})
|
|
12125
11917
|
);
|
|
12126
11918
|
} else {
|
|
12127
|
-
|
|
11919
|
+
p32.log.warn(`Activity feed interrupted (${code}); retrying in 5s.`);
|
|
12128
11920
|
}
|
|
12129
11921
|
}
|
|
12130
11922
|
await new Promise((resolveSleep) => setTimeout(resolveSleep, FOLLOW_INTERVAL_MS));
|
|
@@ -12133,7 +11925,7 @@ var activity_default = defineDeepspaceCommand({
|
|
|
12133
11925
|
});
|
|
12134
11926
|
|
|
12135
11927
|
// src/cli/commands/git-credential.ts
|
|
12136
|
-
import { defineCommand as
|
|
11928
|
+
import { defineCommand as defineCommand12 } from "citty";
|
|
12137
11929
|
function parseFields(input) {
|
|
12138
11930
|
const fields = /* @__PURE__ */ new Map();
|
|
12139
11931
|
for (const line of input.split("\n")) {
|
|
@@ -12182,7 +11974,7 @@ async function readStdin() {
|
|
|
12182
11974
|
for await (const chunk of process.stdin) data += chunk;
|
|
12183
11975
|
return data;
|
|
12184
11976
|
}
|
|
12185
|
-
var git_credential_default =
|
|
11977
|
+
var git_credential_default = defineCommand12({
|
|
12186
11978
|
meta: {
|
|
12187
11979
|
name: "git-credential",
|
|
12188
11980
|
description: "Git credential helper (installed automatically; not for direct use)"
|
|
@@ -12217,7 +12009,7 @@ var git_credential_default = defineCommand13({
|
|
|
12217
12009
|
});
|
|
12218
12010
|
|
|
12219
12011
|
// src/cli/commands/source.ts
|
|
12220
|
-
import * as
|
|
12012
|
+
import * as p33 from "@clack/prompts";
|
|
12221
12013
|
var TRANSFER_PREFIX = spacePrivateRef("source-transfer");
|
|
12222
12014
|
var source_default = defineDeepspaceCommand({
|
|
12223
12015
|
meta: {
|
|
@@ -12270,7 +12062,7 @@ var source_default = defineDeepspaceCommand({
|
|
|
12270
12062
|
const remoteArg = typeof args.remote === "string" ? args.remote.trim() : void 0;
|
|
12271
12063
|
const result = requested === "github" ? await moveToGitHub({ appDir, appId, token, deployUrl, state, remoteArg }) : await moveToDeepSpace({ appDir, appId, token, deployUrl, state, remoteArg });
|
|
12272
12064
|
if (!args.json) {
|
|
12273
|
-
|
|
12065
|
+
p33.log.success(
|
|
12274
12066
|
result.source.provider === "github" ? `Source: GitHub \xB7 ${result.source.repository} (revision ${result.revision})` : `Source: DeepSpace (revision ${result.revision})`
|
|
12275
12067
|
);
|
|
12276
12068
|
}
|
|
@@ -13036,11 +12828,11 @@ function reportMigration(migration, json) {
|
|
|
13036
12828
|
|
|
13037
12829
|
// src/cli/cli.ts
|
|
13038
12830
|
var __dirname = dirname10(fileURLToPath3(import.meta.url));
|
|
13039
|
-
var pkg = JSON.parse(
|
|
13040
|
-
if (process.platform === "linux" && !process.env.SSL_CERT_FILE &&
|
|
12831
|
+
var pkg = JSON.parse(readFileSync27(join24(__dirname, "..", "package.json"), "utf-8"));
|
|
12832
|
+
if (process.platform === "linux" && !process.env.SSL_CERT_FILE && existsSync25("/etc/ssl/certs/ca-certificates.crt")) {
|
|
13041
12833
|
process.env.SSL_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt";
|
|
13042
12834
|
}
|
|
13043
|
-
var create2 =
|
|
12835
|
+
var create2 = defineCommand13({
|
|
13044
12836
|
meta: {
|
|
13045
12837
|
name: "create",
|
|
13046
12838
|
description: "Create a new DeepSpace app (runs create-deepspace; all flags are forwarded)"
|
|
@@ -13079,14 +12871,14 @@ var create2 = defineCommand14({
|
|
|
13079
12871
|
}
|
|
13080
12872
|
});
|
|
13081
12873
|
var rename = (cmd, name) => ({ ...cmd, meta: { ...cmd.meta ?? {}, name } });
|
|
13082
|
-
var auth =
|
|
12874
|
+
var auth = defineCommand13({
|
|
13083
12875
|
meta: { name: "auth", description: "Session: login, logout, whoami" },
|
|
13084
12876
|
subCommands: { login: login_default, logout: logout_default, whoami: whoami_default }
|
|
13085
12877
|
});
|
|
13086
|
-
var app =
|
|
12878
|
+
var app = defineCommand13({
|
|
13087
12879
|
meta: {
|
|
13088
12880
|
name: "app",
|
|
13089
|
-
description: "The app itself: create, init, list, source, migrate, undeploy, transfer, collaborators, domain,
|
|
12881
|
+
description: "The app itself: create, init, list, source, migrate, undeploy, transfer, collaborators, domain, usage"
|
|
13090
12882
|
},
|
|
13091
12883
|
subCommands: {
|
|
13092
12884
|
create: create2,
|
|
@@ -13096,17 +12888,16 @@ var app = defineCommand14({
|
|
|
13096
12888
|
transfer: transfer_default,
|
|
13097
12889
|
collaborators: collaborators_default,
|
|
13098
12890
|
domain: domain_default,
|
|
13099
|
-
library: library_default,
|
|
13100
12891
|
usage: usage_default,
|
|
13101
12892
|
source: source_default,
|
|
13102
12893
|
migrate: migrate_default
|
|
13103
12894
|
}
|
|
13104
12895
|
});
|
|
13105
|
-
var devGroup =
|
|
12896
|
+
var devGroup = defineCommand13({
|
|
13106
12897
|
meta: { name: "dev", description: "Local development" },
|
|
13107
12898
|
subCommands: { start: rename(dev_default, "start"), kill: kill_default }
|
|
13108
12899
|
});
|
|
13109
|
-
var testGroup =
|
|
12900
|
+
var testGroup = defineCommand13({
|
|
13110
12901
|
meta: { name: "test", description: "App tests and test tooling" },
|
|
13111
12902
|
subCommands: {
|
|
13112
12903
|
run: rename(test_default, "run"),
|
|
@@ -13114,7 +12905,7 @@ var testGroup = defineCommand14({
|
|
|
13114
12905
|
accounts: rename(test_accounts_default, "accounts")
|
|
13115
12906
|
}
|
|
13116
12907
|
});
|
|
13117
|
-
var main =
|
|
12908
|
+
var main = defineCommand13({
|
|
13118
12909
|
meta: {
|
|
13119
12910
|
name: "deepspace",
|
|
13120
12911
|
version: pkg.version,
|