deepspace 0.6.0 → 0.6.2
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 +23 -0
- package/dist/cli.js +318 -123
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +28 -3
- package/dist/index.js +124 -13
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +53 -1
- package/dist/server.js +86 -1
- package/dist/server.js.map +1 -1
- package/dist/worker.d.ts +53 -1
- package/dist/worker.js +86 -1
- package/dist/worker.js.map +1 -1
- package/features/ai-chat/src/ChatPanel.tsx +14 -12
- package/features/cron/src/CronLogPage.tsx +3 -3
- package/package.json +2 -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 defineCommand23, runMain } from "citty";
|
|
5
5
|
import { spawnSync as spawnSync6 } from "child_process";
|
|
6
|
-
import { readFileSync as readFileSync17, existsSync as
|
|
7
|
-
import { dirname as dirname5, join as
|
|
6
|
+
import { readFileSync as readFileSync17, existsSync as existsSync15 } from "fs";
|
|
7
|
+
import { dirname as dirname5, join as join16 } from "path";
|
|
8
8
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
9
9
|
|
|
10
10
|
// src/cli/lib/cli-errors.ts
|
|
@@ -1342,7 +1342,7 @@ var logout_default = defineCommand2({
|
|
|
1342
1342
|
|
|
1343
1343
|
// src/cli/commands/dev.ts
|
|
1344
1344
|
import { defineCommand as defineCommand3 } from "citty";
|
|
1345
|
-
import { resolve as resolve4, basename as basename2, join as
|
|
1345
|
+
import { resolve as resolve4, basename as basename2, join as join10 } from "path";
|
|
1346
1346
|
import spawn from "cross-spawn";
|
|
1347
1347
|
|
|
1348
1348
|
// src/cli/auth.ts
|
|
@@ -1788,6 +1788,112 @@ function removeMacosJunk(dir) {
|
|
|
1788
1788
|
return removed;
|
|
1789
1789
|
}
|
|
1790
1790
|
|
|
1791
|
+
// src/cli/lib/schema-lint.ts
|
|
1792
|
+
import { existsSync as existsSync9 } from "fs";
|
|
1793
|
+
import { join as join9 } from "path";
|
|
1794
|
+
import { pathToFileURL } from "url";
|
|
1795
|
+
|
|
1796
|
+
// src/server/schemas/registry.ts
|
|
1797
|
+
var USERS_COLUMNS = [
|
|
1798
|
+
{ name: "email", storage: "text", interpretation: "plain" },
|
|
1799
|
+
{ name: "name", storage: "text", interpretation: "plain" },
|
|
1800
|
+
{ name: "imageUrl", storage: "text", interpretation: "plain" },
|
|
1801
|
+
{ name: "role", storage: "text", interpretation: "plain" },
|
|
1802
|
+
{ name: "createdAt", storage: "text", interpretation: { kind: "datetime" } },
|
|
1803
|
+
{ name: "lastSeenAt", storage: "text", interpretation: { kind: "datetime" } }
|
|
1804
|
+
];
|
|
1805
|
+
var BASE_USERS_SCHEMA = {
|
|
1806
|
+
name: "users",
|
|
1807
|
+
columns: [...USERS_COLUMNS],
|
|
1808
|
+
permissions: {
|
|
1809
|
+
"*": { read: "own", create: false, update: false, delete: false },
|
|
1810
|
+
admin: { read: true, create: false, update: true, delete: true }
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1813
|
+
function lintSchema(schema) {
|
|
1814
|
+
const warnings = [];
|
|
1815
|
+
const VISIBILITY_AWARE = ["published", "shared"];
|
|
1816
|
+
if (schema.visibilityField) {
|
|
1817
|
+
const offendingRoles = Object.entries(schema.permissions).filter(([, perms]) => perms.read === true).map(([role]) => role);
|
|
1818
|
+
if (offendingRoles.length > 0) {
|
|
1819
|
+
const usesAware = Object.values(schema.permissions).some(
|
|
1820
|
+
(p10) => typeof p10.read === "string" && VISIBILITY_AWARE.includes(p10.read)
|
|
1821
|
+
);
|
|
1822
|
+
if (!usesAware) {
|
|
1823
|
+
warnings.push(
|
|
1824
|
+
`[${schema.name}] visibilityField is declared but no role uses read: 'published' or 'shared'. Roles with read: true (${offendingRoles.join(", ")}) will see every row regardless of visibility. Change those to read: 'published' (owner OR public) or 'shared' (owner OR collaborator OR public) to actually enforce the filter, or remove visibilityField if you don't intend to gate reads by it.`
|
|
1825
|
+
);
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
if (schema.ownerField) {
|
|
1830
|
+
const col = schema.columns.find((c) => c.name === schema.ownerField);
|
|
1831
|
+
if (col && !col.userBound) {
|
|
1832
|
+
warnings.push(
|
|
1833
|
+
`[${schema.name}] ownerField is '${schema.ownerField}' but that column is not marked userBound: true. A client can create a row with someone else's id in this field, bypassing 'own' permission checks. Add userBound: true (and ideally immutable: true) to the column.`
|
|
1834
|
+
);
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
for (const col of schema.columns) {
|
|
1838
|
+
if (col.userBound && col.storage !== "text") {
|
|
1839
|
+
warnings.push(
|
|
1840
|
+
`[${schema.name}] column '${col.name}' is userBound but storage is '${col.storage}'. userBound stamps the user id (a string); use storage: 'text'.`
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
return warnings;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
// src/cli/lib/schema-lint.ts
|
|
1848
|
+
async function lintProjectSchemas(appDir) {
|
|
1849
|
+
const schemasPath = join9(appDir, "src", "schemas.ts");
|
|
1850
|
+
if (!existsSync9(schemasPath)) return null;
|
|
1851
|
+
let schemas;
|
|
1852
|
+
try {
|
|
1853
|
+
const esbuild = await import("esbuild");
|
|
1854
|
+
const outFile = join9(appDir, ".wrangler", "deploy", "schemas.lint.bundle.mjs");
|
|
1855
|
+
await esbuild.build({
|
|
1856
|
+
entryPoints: [schemasPath],
|
|
1857
|
+
bundle: true,
|
|
1858
|
+
format: "esm",
|
|
1859
|
+
platform: "node",
|
|
1860
|
+
target: "node18",
|
|
1861
|
+
outfile: outFile,
|
|
1862
|
+
logLevel: "silent",
|
|
1863
|
+
write: true
|
|
1864
|
+
});
|
|
1865
|
+
const mod = await import(`${pathToFileURL(outFile).href}?t=${Date.now()}`);
|
|
1866
|
+
schemas = mod.schemas;
|
|
1867
|
+
} catch {
|
|
1868
|
+
console.warn(
|
|
1869
|
+
"Schema lint skipped: could not bundle src/schemas.ts (the worker still lints at runtime)."
|
|
1870
|
+
);
|
|
1871
|
+
return null;
|
|
1872
|
+
}
|
|
1873
|
+
if (!Array.isArray(schemas)) return null;
|
|
1874
|
+
const findings = [];
|
|
1875
|
+
for (const schema of schemas) {
|
|
1876
|
+
if (!schema || typeof schema !== "object") continue;
|
|
1877
|
+
try {
|
|
1878
|
+
findings.push(...lintSchema(schema));
|
|
1879
|
+
} catch {
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
return findings;
|
|
1883
|
+
}
|
|
1884
|
+
var MAX_PRINTED_FINDINGS = 5;
|
|
1885
|
+
function formatSchemaLintFindings(findings) {
|
|
1886
|
+
if (findings.length === 0) return [];
|
|
1887
|
+
const n = findings.length;
|
|
1888
|
+
const shown = findings.slice(0, MAX_PRINTED_FINDINGS);
|
|
1889
|
+
const hidden = n - shown.length;
|
|
1890
|
+
return [
|
|
1891
|
+
`Schema lint: ${n} warning${n === 1 ? "" : "s"} in src/schemas.ts \u2014 ${n === 1 ? "this ships" : "these ship"} as permission/privacy bugs:`,
|
|
1892
|
+
...shown.map((f) => ` \u2022 ${f}`),
|
|
1893
|
+
...hidden > 0 ? [` \u2026and ${hidden} more \u2014 fix the above and re-run to see the rest.`] : []
|
|
1894
|
+
];
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1791
1897
|
// src/cli/lib/port.ts
|
|
1792
1898
|
import { createServer } from "net";
|
|
1793
1899
|
var DEFAULT_PORT = 5173;
|
|
@@ -1874,7 +1980,7 @@ var dev_default = defineCommand3({
|
|
|
1874
1980
|
);
|
|
1875
1981
|
} else {
|
|
1876
1982
|
console.warn(
|
|
1877
|
-
`Warning: could not update ${
|
|
1983
|
+
`Warning: could not update ${join10(worktree.mainRepoRoot, ".claude", "launch.json")} (malformed or unwritable) \u2014 the Claude preview tool may serve the main repo's code instead of this worktree.`
|
|
1878
1984
|
);
|
|
1879
1985
|
}
|
|
1880
1986
|
if (!explicitPort && process.env.DEEPSPACE_PORT) {
|
|
@@ -1887,6 +1993,10 @@ var dev_default = defineCommand3({
|
|
|
1887
1993
|
updatePort: explicitPort
|
|
1888
1994
|
});
|
|
1889
1995
|
ensureInstallReady(appDir);
|
|
1996
|
+
const lintFindings = await lintProjectSchemas(appDir);
|
|
1997
|
+
if (lintFindings && lintFindings.length > 0) {
|
|
1998
|
+
for (const line of formatSchemaLintFindings(lintFindings)) console.warn(line);
|
|
1999
|
+
}
|
|
1890
2000
|
let token;
|
|
1891
2001
|
try {
|
|
1892
2002
|
token = await ensureToken();
|
|
@@ -2474,15 +2584,15 @@ var screenshot_default = defineCommand6({
|
|
|
2474
2584
|
// src/cli/commands/test-accounts.ts
|
|
2475
2585
|
import { defineCommand as defineCommand7 } from "citty";
|
|
2476
2586
|
import * as p3 from "@clack/prompts";
|
|
2477
|
-
import { readFileSync as readFileSync10, writeFileSync as writeFileSync8, existsSync as
|
|
2478
|
-
import { join as
|
|
2587
|
+
import { readFileSync as readFileSync10, writeFileSync as writeFileSync8, existsSync as existsSync10, mkdirSync as mkdirSync4 } from "fs";
|
|
2588
|
+
import { join as join11 } from "path";
|
|
2479
2589
|
import { homedir as homedir4 } from "os";
|
|
2480
2590
|
var SESSION_COOKIE2 = "__Secure-better-auth.session_token";
|
|
2481
2591
|
var AUTH_URL4 = process.env.DEEPSPACE_AUTH_URL ?? PLATFORM_URLS.auth;
|
|
2482
|
-
var DIR3 =
|
|
2483
|
-
var ACCOUNTS_PATH =
|
|
2592
|
+
var DIR3 = join11(homedir4(), ".deepspace");
|
|
2593
|
+
var ACCOUNTS_PATH = join11(DIR3, "test-accounts.json");
|
|
2484
2594
|
function loadAccounts() {
|
|
2485
|
-
if (!
|
|
2595
|
+
if (!existsSync10(ACCOUNTS_PATH)) return [];
|
|
2486
2596
|
try {
|
|
2487
2597
|
return JSON.parse(readFileSync10(ACCOUNTS_PATH, "utf-8"));
|
|
2488
2598
|
} catch {
|
|
@@ -2764,9 +2874,9 @@ var test_accounts_default = defineCommand7({
|
|
|
2764
2874
|
import { defineCommand as defineCommand8 } from "citty";
|
|
2765
2875
|
import { execSync as execSync2 } from "child_process";
|
|
2766
2876
|
import { randomUUID } from "crypto";
|
|
2767
|
-
import { readFileSync as readFileSync11, readdirSync as readdirSync4, existsSync as
|
|
2768
|
-
import { join as
|
|
2769
|
-
import { pathToFileURL } from "url";
|
|
2877
|
+
import { readFileSync as readFileSync11, readdirSync as readdirSync4, existsSync as existsSync11 } from "fs";
|
|
2878
|
+
import { join as join12, resolve as resolve7, dirname as dirname2 } from "path";
|
|
2879
|
+
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
2770
2880
|
import * as p4 from "@clack/prompts";
|
|
2771
2881
|
var DEPLOY_URL3 = process.env.DEEPSPACE_DEPLOY_URL ?? PLATFORM_URLS.deploy;
|
|
2772
2882
|
var API_URL2 = process.env.DEEPSPACE_API_URL ?? PLATFORM_URLS.api;
|
|
@@ -2978,7 +3088,7 @@ var deploy_default = defineCommand8({
|
|
|
2978
3088
|
}
|
|
2979
3089
|
p4.log.info(`Id: ${appId}`);
|
|
2980
3090
|
const readCustomDevVarsAt = (path) => {
|
|
2981
|
-
if (!
|
|
3091
|
+
if (!existsSync11(path)) return {};
|
|
2982
3092
|
const section = extractCustomDevVars(stripGeneratedSecretsCache(readFileSync11(path, "utf-8")));
|
|
2983
3093
|
if (!section) return {};
|
|
2984
3094
|
try {
|
|
@@ -3017,6 +3127,10 @@ var deploy_default = defineCommand8({
|
|
|
3017
3127
|
}
|
|
3018
3128
|
const junk = removeMacosJunk(appDir);
|
|
3019
3129
|
if (junk > 0) p4.log.info(`Removed ${junk} macOS metadata file(s) (._*, .DS_Store)`);
|
|
3130
|
+
const lintFindings = await lintProjectSchemas(appDir);
|
|
3131
|
+
if (lintFindings && lintFindings.length > 0) {
|
|
3132
|
+
p4.log.warn(formatSchemaLintFindings(lintFindings).join("\n"));
|
|
3133
|
+
}
|
|
3020
3134
|
const s = createSpinner();
|
|
3021
3135
|
s.start("Building...");
|
|
3022
3136
|
let preparedWranglerConfig;
|
|
@@ -3039,14 +3153,14 @@ var deploy_default = defineCommand8({
|
|
|
3039
3153
|
preparedWranglerConfig?.cleanup();
|
|
3040
3154
|
}
|
|
3041
3155
|
s.stop("Built");
|
|
3042
|
-
const deployConfigPath =
|
|
3043
|
-
if (!
|
|
3156
|
+
const deployConfigPath = join12(appDir, ".wrangler", "deploy", "config.json");
|
|
3157
|
+
if (!existsSync11(deployConfigPath)) {
|
|
3044
3158
|
p4.cancel("Build output config not found at .wrangler/deploy/config.json");
|
|
3045
3159
|
process.exit(1);
|
|
3046
3160
|
}
|
|
3047
3161
|
const deployConfig = JSON.parse(readFileSync11(deployConfigPath, "utf-8"));
|
|
3048
3162
|
const outputWranglerPath = resolve7(dirname2(deployConfigPath), deployConfig.configPath);
|
|
3049
|
-
if (!
|
|
3163
|
+
if (!existsSync11(outputWranglerPath)) {
|
|
3050
3164
|
p4.cancel(`Output wrangler.json not found at ${outputWranglerPath}`);
|
|
3051
3165
|
process.exit(1);
|
|
3052
3166
|
}
|
|
@@ -3059,13 +3173,13 @@ var deploy_default = defineCommand8({
|
|
|
3059
3173
|
process.exit(1);
|
|
3060
3174
|
}
|
|
3061
3175
|
const workerDir = dirname2(outputWranglerPath);
|
|
3062
|
-
const workerBundlePath =
|
|
3176
|
+
const workerBundlePath = join12(workerDir, outputConfig.main);
|
|
3063
3177
|
const clientDir = outputConfig.assets?.directory ? resolve7(workerDir, outputConfig.assets.directory) : null;
|
|
3064
|
-
if (!
|
|
3178
|
+
if (!existsSync11(workerBundlePath)) {
|
|
3065
3179
|
p4.cancel(`Worker bundle not found at ${workerBundlePath}`);
|
|
3066
3180
|
process.exit(1);
|
|
3067
3181
|
}
|
|
3068
|
-
if (!clientDir || !
|
|
3182
|
+
if (!clientDir || !existsSync11(clientDir)) {
|
|
3069
3183
|
p4.cancel(`Client assets not found at ${clientDir}`);
|
|
3070
3184
|
process.exit(1);
|
|
3071
3185
|
}
|
|
@@ -3300,13 +3414,13 @@ then redeploy. (Pass --allow-missing-secrets to deploy without them.)`
|
|
|
3300
3414
|
}
|
|
3301
3415
|
});
|
|
3302
3416
|
async function syncSubscriptionPlans(appDir, appName, token) {
|
|
3303
|
-
const subsPath =
|
|
3304
|
-
if (!
|
|
3417
|
+
const subsPath = join12(appDir, "src", "subscriptions.ts");
|
|
3418
|
+
if (!existsSync11(subsPath)) return;
|
|
3305
3419
|
let plans;
|
|
3306
3420
|
try {
|
|
3307
3421
|
const esbuild = await import("esbuild");
|
|
3308
|
-
const outDir =
|
|
3309
|
-
const outFile =
|
|
3422
|
+
const outDir = join12(appDir, ".wrangler", "deploy");
|
|
3423
|
+
const outFile = join12(outDir, "subscriptions.bundle.mjs");
|
|
3310
3424
|
await esbuild.build({
|
|
3311
3425
|
entryPoints: [subsPath],
|
|
3312
3426
|
bundle: true,
|
|
@@ -3317,7 +3431,7 @@ async function syncSubscriptionPlans(appDir, appName, token) {
|
|
|
3317
3431
|
logLevel: "silent",
|
|
3318
3432
|
write: true
|
|
3319
3433
|
});
|
|
3320
|
-
const mod = await import(`${
|
|
3434
|
+
const mod = await import(`${pathToFileURL2(outFile).href}?t=${Date.now()}`);
|
|
3321
3435
|
plans = mod.subscriptionPlans;
|
|
3322
3436
|
} catch (err) {
|
|
3323
3437
|
p4.log.warn(`Could not load src/subscriptions.ts: ${errMessage(err)}`);
|
|
@@ -3448,13 +3562,13 @@ current billing period? (Skip to leave them grandfathered.)`
|
|
|
3448
3562
|
}
|
|
3449
3563
|
}
|
|
3450
3564
|
async function syncOneTimeProducts(appDir, appName, token) {
|
|
3451
|
-
const productsPath =
|
|
3452
|
-
if (!
|
|
3565
|
+
const productsPath = join12(appDir, "src", "products.ts");
|
|
3566
|
+
if (!existsSync11(productsPath)) return;
|
|
3453
3567
|
let products;
|
|
3454
3568
|
try {
|
|
3455
3569
|
const esbuild = await import("esbuild");
|
|
3456
|
-
const outDir =
|
|
3457
|
-
const outFile =
|
|
3570
|
+
const outDir = join12(appDir, ".wrangler", "deploy");
|
|
3571
|
+
const outFile = join12(outDir, "products.bundle.mjs");
|
|
3458
3572
|
await esbuild.build({
|
|
3459
3573
|
entryPoints: [productsPath],
|
|
3460
3574
|
bundle: true,
|
|
@@ -3465,7 +3579,7 @@ async function syncOneTimeProducts(appDir, appName, token) {
|
|
|
3465
3579
|
logLevel: "silent",
|
|
3466
3580
|
write: true
|
|
3467
3581
|
});
|
|
3468
|
-
const mod = await import(`${
|
|
3582
|
+
const mod = await import(`${pathToFileURL2(outFile).href}?t=${Date.now()}`);
|
|
3469
3583
|
products = mod.oneTimeProducts;
|
|
3470
3584
|
} catch (err) {
|
|
3471
3585
|
p4.log.warn(`Could not load src/products.ts: ${errMessage(err)}`);
|
|
@@ -3529,7 +3643,7 @@ function collectAssets(dir) {
|
|
|
3529
3643
|
function walk(d, prefix) {
|
|
3530
3644
|
for (const entry of readdirSync4(d, { withFileTypes: true })) {
|
|
3531
3645
|
if (entry.name === ".assetsignore") continue;
|
|
3532
|
-
const full =
|
|
3646
|
+
const full = join12(d, entry.name);
|
|
3533
3647
|
const rel = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
3534
3648
|
if (entry.isDirectory()) {
|
|
3535
3649
|
walk(full, rel);
|
|
@@ -3708,28 +3822,108 @@ var apps_default = defineCommand11({
|
|
|
3708
3822
|
}
|
|
3709
3823
|
});
|
|
3710
3824
|
|
|
3711
|
-
// src/cli/commands/
|
|
3825
|
+
// src/cli/commands/usage.ts
|
|
3712
3826
|
import { defineCommand as defineCommand12 } from "citty";
|
|
3713
|
-
|
|
3714
|
-
|
|
3827
|
+
var API_URL3 = process.env.DEEPSPACE_API_URL ?? PLATFORM_URLS.api;
|
|
3828
|
+
function formatCredits(value) {
|
|
3829
|
+
if (value > 0 && value < 1) return "<1";
|
|
3830
|
+
if (value < 10) return value.toFixed(1).replace(/\.0$/, "");
|
|
3831
|
+
return Math.round(value).toLocaleString("en-US");
|
|
3832
|
+
}
|
|
3833
|
+
function formatUsd(value) {
|
|
3834
|
+
return `$${Math.abs(value) >= 0.01 || value === 0 ? value.toFixed(2) : value.toFixed(4)}`;
|
|
3835
|
+
}
|
|
3836
|
+
function formatDate(iso) {
|
|
3837
|
+
return new Date(iso).toLocaleDateString("en-US", {
|
|
3838
|
+
month: "short",
|
|
3839
|
+
day: "numeric",
|
|
3840
|
+
year: "numeric",
|
|
3841
|
+
timeZone: "UTC"
|
|
3842
|
+
});
|
|
3843
|
+
}
|
|
3844
|
+
function renderSummary(summary) {
|
|
3845
|
+
const { credits, usageByIntegration } = summary;
|
|
3846
|
+
const lines = [];
|
|
3847
|
+
const renews = credits.subscription.renewsAt ? ` \xB7 renews ${formatDate(credits.subscription.renewsAt)}` : "";
|
|
3848
|
+
lines.push(`Plan: ${credits.subscription.tier}${renews}`);
|
|
3849
|
+
lines.push(
|
|
3850
|
+
`Credits: ${formatCredits(credits.credits)} of ${formatCredits(credits.totalAllocation)} remaining (100 credits = $1)`
|
|
3851
|
+
);
|
|
3852
|
+
const bonusActive = credits.bonus.allocation > 0 || credits.bonus.expired;
|
|
3853
|
+
const purchasedActive = credits.purchased.allocation > 0 || credits.purchased.used > 0;
|
|
3854
|
+
if (bonusActive || purchasedActive) {
|
|
3855
|
+
const bucket = (b) => `${formatCredits(b.remaining)} of ${formatCredits(b.allocation)} remaining`;
|
|
3856
|
+
lines.push(` Subscription: ${bucket(credits.subscription)}`);
|
|
3857
|
+
if (bonusActive) {
|
|
3858
|
+
const expires = credits.bonus.expiresAt ? ` \xB7 expires ${formatDate(credits.bonus.expiresAt)}` : "";
|
|
3859
|
+
lines.push(
|
|
3860
|
+
` Bonus: ${credits.bonus.expired ? "expired" : bucket(credits.bonus) + expires}`
|
|
3861
|
+
);
|
|
3862
|
+
}
|
|
3863
|
+
if (purchasedActive) {
|
|
3864
|
+
lines.push(` Purchased: ${bucket(credits.purchased)}`);
|
|
3865
|
+
}
|
|
3866
|
+
}
|
|
3867
|
+
lines.push("");
|
|
3868
|
+
if (!usageByIntegration.length) {
|
|
3869
|
+
lines.push("No integration usage in the last 30 days.");
|
|
3870
|
+
} else {
|
|
3871
|
+
lines.push("Usage by integration (last 30 days):");
|
|
3872
|
+
const nameWidth = Math.max(11, ...usageByIntegration.map((u) => u.name.length));
|
|
3873
|
+
lines.push(`${"INTEGRATION".padEnd(nameWidth)} CALLS COST`);
|
|
3874
|
+
for (const u of usageByIntegration) {
|
|
3875
|
+
lines.push(`${u.name.padEnd(nameWidth)} ${String(u.count).padEnd(5)} ${formatUsd(u.totalCost)}`);
|
|
3876
|
+
}
|
|
3877
|
+
}
|
|
3878
|
+
lines.push("");
|
|
3879
|
+
lines.push(`Dashboard: ${DASHBOARD_URL}`);
|
|
3880
|
+
return lines.join("\n");
|
|
3881
|
+
}
|
|
3882
|
+
var usage_default = defineCommand12({
|
|
3883
|
+
meta: {
|
|
3884
|
+
name: "usage",
|
|
3885
|
+
description: "Show credit balance, quota headroom, and per-integration spend"
|
|
3886
|
+
},
|
|
3887
|
+
args: {
|
|
3888
|
+
json: {
|
|
3889
|
+
type: "boolean",
|
|
3890
|
+
description: "Emit the raw usage summary as JSON instead of human output",
|
|
3891
|
+
default: false
|
|
3892
|
+
}
|
|
3893
|
+
},
|
|
3894
|
+
async run({ args }) {
|
|
3895
|
+
const token = await ensureToken();
|
|
3896
|
+
const summary = await apiFetch(API_URL3, token, "/api/usage/summary");
|
|
3897
|
+
if (args.json) {
|
|
3898
|
+
process.stdout.write(JSON.stringify(summary, null, 2) + "\n");
|
|
3899
|
+
return;
|
|
3900
|
+
}
|
|
3901
|
+
console.log(renderSummary(summary));
|
|
3902
|
+
}
|
|
3903
|
+
});
|
|
3904
|
+
|
|
3905
|
+
// src/cli/commands/add.ts
|
|
3906
|
+
import { defineCommand as defineCommand13 } from "citty";
|
|
3907
|
+
import { existsSync as existsSync12, readFileSync as readFileSync12 } from "fs";
|
|
3908
|
+
import { resolve as resolve8, join as join13, dirname as dirname3 } from "path";
|
|
3715
3909
|
import { fileURLToPath } from "url";
|
|
3716
3910
|
import { spawnSync as spawnSync5 } from "child_process";
|
|
3717
3911
|
function findScript(from) {
|
|
3718
|
-
const inNodeModules =
|
|
3719
|
-
if (
|
|
3720
|
-
const inDotDeepspace =
|
|
3721
|
-
if (
|
|
3912
|
+
const inNodeModules = join13(from, "node_modules", "deepspace", "scripts", "add-feature.cjs");
|
|
3913
|
+
if (existsSync12(inNodeModules)) return inNodeModules;
|
|
3914
|
+
const inDotDeepspace = join13(from, ".deepspace", "scripts", "add-feature.cjs");
|
|
3915
|
+
if (existsSync12(inDotDeepspace)) return inDotDeepspace;
|
|
3722
3916
|
return null;
|
|
3723
3917
|
}
|
|
3724
3918
|
function runningScript() {
|
|
3725
3919
|
const here = dirname3(fileURLToPath(import.meta.url));
|
|
3726
|
-
const script =
|
|
3727
|
-
return
|
|
3920
|
+
const script = join13(here, "..", "scripts", "add-feature.cjs");
|
|
3921
|
+
return existsSync12(script) ? script : null;
|
|
3728
3922
|
}
|
|
3729
3923
|
function isDeepSpaceApp(dir) {
|
|
3730
|
-
if (
|
|
3731
|
-
const pkgPath =
|
|
3732
|
-
if (!
|
|
3924
|
+
if (existsSync12(join13(dir, "wrangler.toml"))) return true;
|
|
3925
|
+
const pkgPath = join13(dir, "package.json");
|
|
3926
|
+
if (!existsSync12(pkgPath)) return false;
|
|
3733
3927
|
try {
|
|
3734
3928
|
const pkg2 = JSON.parse(readFileSync12(pkgPath, "utf-8"));
|
|
3735
3929
|
return Boolean(pkg2.dependencies?.deepspace || pkg2.devDependencies?.deepspace);
|
|
@@ -3745,7 +3939,7 @@ function runInstaller(script, passArgs, cwd) {
|
|
|
3745
3939
|
}
|
|
3746
3940
|
process.exit(res.status ?? 1);
|
|
3747
3941
|
}
|
|
3748
|
-
var add_default =
|
|
3942
|
+
var add_default = defineCommand13({
|
|
3749
3943
|
meta: {
|
|
3750
3944
|
name: "add",
|
|
3751
3945
|
description: "Add a feature to your DeepSpace app"
|
|
@@ -3790,7 +3984,7 @@ var add_default = defineCommand12({
|
|
|
3790
3984
|
const passArgs2 = args.list ? ["--list"] : args.info ? ["--info", String(args.info)] : ["--help"];
|
|
3791
3985
|
runInstaller(script2, passArgs2, process.cwd());
|
|
3792
3986
|
}
|
|
3793
|
-
if (!
|
|
3987
|
+
if (!existsSync12(appDir)) {
|
|
3794
3988
|
console.error(`Target directory not found: ${appDir}`);
|
|
3795
3989
|
console.error("Create a new app first: deepspace create <name>");
|
|
3796
3990
|
process.exit(1);
|
|
@@ -3806,8 +4000,8 @@ var add_default = defineCommand12({
|
|
|
3806
4000
|
if (!script) {
|
|
3807
4001
|
console.error("Could not find the deepspace feature installer.");
|
|
3808
4002
|
console.error("Looked in:");
|
|
3809
|
-
console.error(` ${
|
|
3810
|
-
console.error(` ${
|
|
4003
|
+
console.error(` ${join13(appDir, "node_modules", "deepspace", "scripts", "add-feature.cjs")}`);
|
|
4004
|
+
console.error(` ${join13(appDir, ".deepspace", "scripts", "add-feature.cjs")}`);
|
|
3811
4005
|
console.error("Are you in a DeepSpace app directory? Try `npm install` first.");
|
|
3812
4006
|
process.exit(1);
|
|
3813
4007
|
}
|
|
@@ -3818,9 +4012,9 @@ var add_default = defineCommand12({
|
|
|
3818
4012
|
});
|
|
3819
4013
|
|
|
3820
4014
|
// src/cli/commands/domain.ts
|
|
3821
|
-
import { defineCommand as
|
|
3822
|
-
var
|
|
3823
|
-
var api = (token, path, init) => apiFetch(
|
|
4015
|
+
import { defineCommand as defineCommand14 } from "citty";
|
|
4016
|
+
var API_URL4 = process.env.DEEPSPACE_API_URL ?? PLATFORM_URLS.api;
|
|
4017
|
+
var api = (token, path, init) => apiFetch(API_URL4, token, path, init);
|
|
3824
4018
|
function scrubInternal(value) {
|
|
3825
4019
|
if (Array.isArray(value)) return value.map(scrubInternal);
|
|
3826
4020
|
if (value && typeof value === "object") {
|
|
@@ -3854,7 +4048,7 @@ async function confirm3(message) {
|
|
|
3854
4048
|
});
|
|
3855
4049
|
});
|
|
3856
4050
|
}
|
|
3857
|
-
var search =
|
|
4051
|
+
var search = defineCommand14({
|
|
3858
4052
|
meta: { name: "search", description: "Search for available domains" },
|
|
3859
4053
|
args: {
|
|
3860
4054
|
query: { type: "positional", description: "Domain or keyword", required: true },
|
|
@@ -3884,7 +4078,7 @@ var search = defineCommand13({
|
|
|
3884
4078
|
}
|
|
3885
4079
|
}
|
|
3886
4080
|
});
|
|
3887
|
-
var buy =
|
|
4081
|
+
var buy = defineCommand14({
|
|
3888
4082
|
meta: { name: "buy", description: "Buy a domain and attach it to an app" },
|
|
3889
4083
|
args: {
|
|
3890
4084
|
domain: { type: "positional", description: "Domain to buy", required: true },
|
|
@@ -3994,7 +4188,7 @@ var buy = defineCommand13({
|
|
|
3994
4188
|
process.exit(1);
|
|
3995
4189
|
}
|
|
3996
4190
|
});
|
|
3997
|
-
var list2 =
|
|
4191
|
+
var list2 = defineCommand14({
|
|
3998
4192
|
meta: { name: "list", description: "List your domains" },
|
|
3999
4193
|
args: {
|
|
4000
4194
|
json: { type: "boolean", description: "Emit JSON" }
|
|
@@ -4020,7 +4214,7 @@ var list2 = defineCommand13({
|
|
|
4020
4214
|
}
|
|
4021
4215
|
}
|
|
4022
4216
|
});
|
|
4023
|
-
var status =
|
|
4217
|
+
var status = defineCommand14({
|
|
4024
4218
|
meta: { name: "status", description: "Show details for one domain" },
|
|
4025
4219
|
args: {
|
|
4026
4220
|
domain: { type: "positional", description: "Domain", required: true },
|
|
@@ -4050,7 +4244,7 @@ var status = defineCommand13({
|
|
|
4050
4244
|
console.log(`Charged: ${fmtCents(found.chargedCents)}/yr`);
|
|
4051
4245
|
}
|
|
4052
4246
|
});
|
|
4053
|
-
var attach =
|
|
4247
|
+
var attach = defineCommand14({
|
|
4054
4248
|
meta: { name: "attach", description: "Re-point a domain at a different app" },
|
|
4055
4249
|
args: {
|
|
4056
4250
|
domain: { type: "positional", description: "Domain to re-point", required: true },
|
|
@@ -4081,7 +4275,7 @@ var attach = defineCommand13({
|
|
|
4081
4275
|
console.log(`\u2713 ${args.domain} now points at ${targetApp}`);
|
|
4082
4276
|
}
|
|
4083
4277
|
});
|
|
4084
|
-
var detach =
|
|
4278
|
+
var detach = defineCommand14({
|
|
4085
4279
|
meta: {
|
|
4086
4280
|
name: "detach",
|
|
4087
4281
|
description: "Stop routing the domain (keeps the registration; auto-renew unchanged)"
|
|
@@ -4113,7 +4307,7 @@ var detach = defineCommand13({
|
|
|
4113
4307
|
);
|
|
4114
4308
|
}
|
|
4115
4309
|
});
|
|
4116
|
-
var renew =
|
|
4310
|
+
var renew = defineCommand14({
|
|
4117
4311
|
meta: { name: "renew", description: "Toggle auto-renewal at the registrar" },
|
|
4118
4312
|
args: {
|
|
4119
4313
|
domain: { type: "positional", description: "Domain", required: true },
|
|
@@ -4139,13 +4333,13 @@ var renew = defineCommand13({
|
|
|
4139
4333
|
console.log(`\u2713 ${args.domain} auto-renew ${enabled ? "enabled" : "disabled"}`);
|
|
4140
4334
|
}
|
|
4141
4335
|
});
|
|
4142
|
-
var domain_default =
|
|
4336
|
+
var domain_default = defineCommand14({
|
|
4143
4337
|
meta: { name: "domain", description: "Buy and manage custom domains" },
|
|
4144
4338
|
subCommands: { search, buy, list: list2, status, attach, detach, renew }
|
|
4145
4339
|
});
|
|
4146
4340
|
|
|
4147
4341
|
// src/cli/commands/collaborators.ts
|
|
4148
|
-
import { defineCommand as
|
|
4342
|
+
import { defineCommand as defineCommand15 } from "citty";
|
|
4149
4343
|
|
|
4150
4344
|
// src/server/auth/testAccounts.ts
|
|
4151
4345
|
var TEST_ACCOUNT_EMAIL_SUFFIX = "@deepspace.test";
|
|
@@ -4154,12 +4348,12 @@ function isTestAccountEmail(email) {
|
|
|
4154
4348
|
}
|
|
4155
4349
|
|
|
4156
4350
|
// src/cli/commands/collaborators.ts
|
|
4157
|
-
var
|
|
4351
|
+
var API_URL5 = process.env.DEEPSPACE_API_URL ?? PLATFORM_URLS.api;
|
|
4158
4352
|
var DEPLOY_URL6 = process.env.DEEPSPACE_DEPLOY_URL ?? PLATFORM_URLS.deploy;
|
|
4159
4353
|
function api2(token, path, init) {
|
|
4160
|
-
return apiFetch(
|
|
4354
|
+
return apiFetch(API_URL5, token, path, init);
|
|
4161
4355
|
}
|
|
4162
|
-
var list3 =
|
|
4356
|
+
var list3 = defineCommand15({
|
|
4163
4357
|
meta: { name: "list", description: "List collaborators on your app" },
|
|
4164
4358
|
args: {
|
|
4165
4359
|
app: { type: "string", alias: "a", description: "App id or name (defaults to ./wrangler.toml)" },
|
|
@@ -4191,7 +4385,7 @@ var list3 = defineCommand14({
|
|
|
4191
4385
|
}
|
|
4192
4386
|
}
|
|
4193
4387
|
});
|
|
4194
|
-
var add =
|
|
4388
|
+
var add = defineCommand15({
|
|
4195
4389
|
meta: { name: "add", description: "Authorize someone to deploy your app" },
|
|
4196
4390
|
args: {
|
|
4197
4391
|
email: {
|
|
@@ -4236,7 +4430,7 @@ var add = defineCommand14({
|
|
|
4236
4430
|
console.log(`\u2713 ${res.collaborator.emailDisplay} can now deploy ${app}`);
|
|
4237
4431
|
}
|
|
4238
4432
|
});
|
|
4239
|
-
var remove =
|
|
4433
|
+
var remove = defineCommand15({
|
|
4240
4434
|
meta: { name: "remove", description: "Remove a collaborator from your app" },
|
|
4241
4435
|
args: {
|
|
4242
4436
|
email: { type: "positional", description: "Collaborator email", required: true },
|
|
@@ -4268,7 +4462,7 @@ var remove = defineCommand14({
|
|
|
4268
4462
|
console.log(`\u2713 ${found.emailDisplay} can no longer deploy ${app}`);
|
|
4269
4463
|
}
|
|
4270
4464
|
});
|
|
4271
|
-
var cancel4 =
|
|
4465
|
+
var cancel4 = defineCommand15({
|
|
4272
4466
|
meta: { name: "cancel", description: "Cancel a pending (un-accepted) email invite" },
|
|
4273
4467
|
args: {
|
|
4274
4468
|
email: { type: "positional", description: "Invited email", required: true },
|
|
@@ -4300,17 +4494,17 @@ var cancel4 = defineCommand14({
|
|
|
4300
4494
|
console.log(`\u2713 Cancelled the pending invite to ${found.email} on ${app}`);
|
|
4301
4495
|
}
|
|
4302
4496
|
});
|
|
4303
|
-
var collaborators_default =
|
|
4497
|
+
var collaborators_default = defineCommand15({
|
|
4304
4498
|
meta: { name: "collaborators", description: "Manage who can deploy your app" },
|
|
4305
4499
|
subCommands: { list: list3, add, remove, cancel: cancel4 }
|
|
4306
4500
|
});
|
|
4307
4501
|
|
|
4308
4502
|
// src/cli/commands/transfer.ts
|
|
4309
|
-
import { defineCommand as
|
|
4503
|
+
import { defineCommand as defineCommand16 } from "citty";
|
|
4310
4504
|
import * as p6 from "@clack/prompts";
|
|
4311
|
-
var
|
|
4505
|
+
var API_URL6 = process.env.DEEPSPACE_API_URL ?? PLATFORM_URLS.api;
|
|
4312
4506
|
var DEPLOY_URL7 = process.env.DEEPSPACE_DEPLOY_URL ?? PLATFORM_URLS.deploy;
|
|
4313
|
-
var offer =
|
|
4507
|
+
var offer = defineCommand16({
|
|
4314
4508
|
meta: { name: "offer", description: "Offer this app to another DeepSpace user" },
|
|
4315
4509
|
args: {
|
|
4316
4510
|
email: { type: "positional", description: "Recipient email", required: true },
|
|
@@ -4324,7 +4518,7 @@ var offer = defineCommand15({
|
|
|
4324
4518
|
const token = await ensureToken();
|
|
4325
4519
|
const app = await resolveAppTarget(DEPLOY_URL7, token, args.app);
|
|
4326
4520
|
const pending = await apiFetch(
|
|
4327
|
-
|
|
4521
|
+
API_URL6,
|
|
4328
4522
|
token,
|
|
4329
4523
|
`/api/app-transfers/${encodeURIComponent(app)}`
|
|
4330
4524
|
);
|
|
@@ -4345,7 +4539,7 @@ var offer = defineCommand15({
|
|
|
4345
4539
|
}
|
|
4346
4540
|
}
|
|
4347
4541
|
const { expiresAt } = await apiFetch(
|
|
4348
|
-
|
|
4542
|
+
API_URL6,
|
|
4349
4543
|
token,
|
|
4350
4544
|
`/api/app-transfers/${encodeURIComponent(app)}`,
|
|
4351
4545
|
{ method: "POST", body: JSON.stringify({ email: args.email }) }
|
|
@@ -4359,7 +4553,7 @@ var offer = defineCommand15({
|
|
|
4359
4553
|
);
|
|
4360
4554
|
}
|
|
4361
4555
|
});
|
|
4362
|
-
var status2 =
|
|
4556
|
+
var status2 = defineCommand16({
|
|
4363
4557
|
meta: { name: "status", description: "Show the pending transfer offer, if any" },
|
|
4364
4558
|
args: {
|
|
4365
4559
|
app: { type: "string", alias: "a", description: "App id or name (defaults to ./wrangler.toml)" }
|
|
@@ -4367,7 +4561,7 @@ var status2 = defineCommand15({
|
|
|
4367
4561
|
async run({ args }) {
|
|
4368
4562
|
const token = await ensureToken();
|
|
4369
4563
|
const app = await resolveAppTarget(DEPLOY_URL7, token, args.app);
|
|
4370
|
-
const { transfer } = await apiFetch(
|
|
4564
|
+
const { transfer } = await apiFetch(API_URL6, token, `/api/app-transfers/${encodeURIComponent(app)}`);
|
|
4371
4565
|
if (!transfer) {
|
|
4372
4566
|
console.log(`No pending transfer for ${app}.`);
|
|
4373
4567
|
return;
|
|
@@ -4375,7 +4569,7 @@ var status2 = defineCommand15({
|
|
|
4375
4569
|
console.log(`Pending: ${app} \u2192 ${transfer.toEmailDisplay} (expires ${transfer.expiresAt}).`);
|
|
4376
4570
|
}
|
|
4377
4571
|
});
|
|
4378
|
-
var accept =
|
|
4572
|
+
var accept = defineCommand16({
|
|
4379
4573
|
meta: { name: "accept", description: "Accept a transfer offered to you" },
|
|
4380
4574
|
args: {
|
|
4381
4575
|
app: { type: "string", alias: "a", description: "App id of the offered app", required: true }
|
|
@@ -4391,7 +4585,7 @@ var accept = defineCommand15({
|
|
|
4391
4585
|
);
|
|
4392
4586
|
}
|
|
4393
4587
|
});
|
|
4394
|
-
var cancel5 =
|
|
4588
|
+
var cancel5 = defineCommand16({
|
|
4395
4589
|
meta: { name: "cancel", description: "Cancel/decline the pending offer (either party)" },
|
|
4396
4590
|
args: {
|
|
4397
4591
|
app: { type: "string", alias: "a", description: "App id or name (defaults to ./wrangler.toml)" }
|
|
@@ -4399,22 +4593,22 @@ var cancel5 = defineCommand15({
|
|
|
4399
4593
|
async run({ args }) {
|
|
4400
4594
|
const token = await ensureToken();
|
|
4401
4595
|
const app = await resolveAppTarget(DEPLOY_URL7, token, args.app);
|
|
4402
|
-
await apiFetch(
|
|
4596
|
+
await apiFetch(API_URL6, token, `/api/app-transfers/${encodeURIComponent(app)}`, { method: "DELETE" });
|
|
4403
4597
|
console.log(`\u2713 Transfer offer for ${app} cancelled.`);
|
|
4404
4598
|
}
|
|
4405
4599
|
});
|
|
4406
|
-
var transfer_default =
|
|
4600
|
+
var transfer_default = defineCommand16({
|
|
4407
4601
|
meta: { name: "transfer", description: "Transfer app ownership to another user" },
|
|
4408
4602
|
subCommands: { offer, status: status2, accept, cancel: cancel5 }
|
|
4409
4603
|
});
|
|
4410
4604
|
|
|
4411
4605
|
// src/cli/commands/integrations.ts
|
|
4412
|
-
import { defineCommand as
|
|
4606
|
+
import { defineCommand as defineCommand17 } from "citty";
|
|
4413
4607
|
|
|
4414
4608
|
// src/cli/commands/_invoke-impl.ts
|
|
4415
4609
|
import { readFileSync as readFileSync13 } from "fs";
|
|
4416
4610
|
import * as p7 from "@clack/prompts";
|
|
4417
|
-
var
|
|
4611
|
+
var API_URL7 = process.env.DEEPSPACE_API_URL ?? PLATFORM_URLS.api;
|
|
4418
4612
|
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
4419
4613
|
function parseTarget(target) {
|
|
4420
4614
|
if (!target || typeof target !== "string") {
|
|
@@ -4456,7 +4650,7 @@ function flushAndExit(code) {
|
|
|
4456
4650
|
});
|
|
4457
4651
|
}
|
|
4458
4652
|
async function fetchCatalog(opts = {}) {
|
|
4459
|
-
const url = opts.summary ? `${
|
|
4653
|
+
const url = opts.summary ? `${API_URL7}/api/integrations?summary=1` : `${API_URL7}/api/integrations`;
|
|
4460
4654
|
const res = await fetch(url);
|
|
4461
4655
|
if (!res.ok) {
|
|
4462
4656
|
throw new Error(`Failed to fetch integration catalog (${res.status})`);
|
|
@@ -4580,7 +4774,7 @@ async function runInvoke(args) {
|
|
|
4580
4774
|
const startedAt = Date.now();
|
|
4581
4775
|
let res;
|
|
4582
4776
|
try {
|
|
4583
|
-
res = await fetch(`${
|
|
4777
|
+
res = await fetch(`${API_URL7}/api/integrations/${integration}/${endpoint}`, {
|
|
4584
4778
|
method: "POST",
|
|
4585
4779
|
headers: {
|
|
4586
4780
|
"Content-Type": "application/json",
|
|
@@ -4631,7 +4825,7 @@ async function runInvoke(args) {
|
|
|
4631
4825
|
}
|
|
4632
4826
|
|
|
4633
4827
|
// src/cli/commands/integrations.ts
|
|
4634
|
-
var list4 =
|
|
4828
|
+
var list4 = defineCommand17({
|
|
4635
4829
|
meta: {
|
|
4636
4830
|
name: "list",
|
|
4637
4831
|
description: "List all available integrations"
|
|
@@ -4652,7 +4846,7 @@ var list4 = defineCommand16({
|
|
|
4652
4846
|
}
|
|
4653
4847
|
}
|
|
4654
4848
|
});
|
|
4655
|
-
var info =
|
|
4849
|
+
var info = defineCommand17({
|
|
4656
4850
|
meta: {
|
|
4657
4851
|
name: "info",
|
|
4658
4852
|
description: "Print schema + example body for an integration endpoint"
|
|
@@ -4678,7 +4872,7 @@ var info = defineCommand16({
|
|
|
4678
4872
|
}
|
|
4679
4873
|
}
|
|
4680
4874
|
});
|
|
4681
|
-
var invoke =
|
|
4875
|
+
var invoke = defineCommand17({
|
|
4682
4876
|
meta: {
|
|
4683
4877
|
name: "invoke",
|
|
4684
4878
|
description: "Invoke a platform integration as the logged-in user"
|
|
@@ -4738,7 +4932,7 @@ var invoke = defineCommand16({
|
|
|
4738
4932
|
}
|
|
4739
4933
|
}
|
|
4740
4934
|
});
|
|
4741
|
-
var integrations_default =
|
|
4935
|
+
var integrations_default = defineCommand17({
|
|
4742
4936
|
meta: {
|
|
4743
4937
|
name: "integrations",
|
|
4744
4938
|
description: "List, inspect, and invoke platform integrations"
|
|
@@ -4751,8 +4945,8 @@ var integrations_default = defineCommand16({
|
|
|
4751
4945
|
});
|
|
4752
4946
|
|
|
4753
4947
|
// src/cli/commands/invoke.ts
|
|
4754
|
-
import { defineCommand as
|
|
4755
|
-
var invoke_default =
|
|
4948
|
+
import { defineCommand as defineCommand18 } from "citty";
|
|
4949
|
+
var invoke_default = defineCommand18({
|
|
4756
4950
|
meta: {
|
|
4757
4951
|
name: "invoke",
|
|
4758
4952
|
description: "Invoke a platform integration as the logged-in user"
|
|
@@ -4832,13 +5026,13 @@ var invoke_default = defineCommand17({
|
|
|
4832
5026
|
});
|
|
4833
5027
|
|
|
4834
5028
|
// src/cli/commands/library.ts
|
|
4835
|
-
import { defineCommand as
|
|
4836
|
-
import { existsSync as
|
|
4837
|
-
import { join as
|
|
5029
|
+
import { defineCommand as defineCommand19 } from "citty";
|
|
5030
|
+
import { existsSync as existsSync13, readFileSync as readFileSync14 } from "fs";
|
|
5031
|
+
import { join as join14, resolve as resolve9 } from "path";
|
|
4838
5032
|
import { parse as parseToml4 } from "smol-toml";
|
|
4839
5033
|
import * as p8 from "@clack/prompts";
|
|
4840
5034
|
var DEFAULT_LIBRARY_APP = "deepdotspace-site";
|
|
4841
|
-
var publish =
|
|
5035
|
+
var publish = defineCommand19({
|
|
4842
5036
|
meta: {
|
|
4843
5037
|
name: "publish",
|
|
4844
5038
|
description: "Publish the current app to the DeepSpace library"
|
|
@@ -4912,8 +5106,8 @@ var publish = defineCommand18({
|
|
|
4912
5106
|
let appName = typeof args.app === "string" && args.app.trim() ? args.app.trim() : void 0;
|
|
4913
5107
|
if (!appName) {
|
|
4914
5108
|
const appDir = resolve9(typeof args.dir === "string" && args.dir ? args.dir : ".");
|
|
4915
|
-
const wranglerPath =
|
|
4916
|
-
if (!
|
|
5109
|
+
const wranglerPath = join14(appDir, "wrangler.toml");
|
|
5110
|
+
if (!existsSync13(wranglerPath)) {
|
|
4917
5111
|
return die("No --app provided and no wrangler.toml found. Either pass --app <name> or run from your app's directory.");
|
|
4918
5112
|
}
|
|
4919
5113
|
const cfg = parseToml4(readFileSync14(wranglerPath, "utf-8"));
|
|
@@ -4977,7 +5171,7 @@ var publish = defineCommand18({
|
|
|
4977
5171
|
p8.outro("Done");
|
|
4978
5172
|
}
|
|
4979
5173
|
});
|
|
4980
|
-
var unpublish =
|
|
5174
|
+
var unpublish = defineCommand19({
|
|
4981
5175
|
meta: {
|
|
4982
5176
|
name: "unpublish",
|
|
4983
5177
|
description: "Remove a library entry (owner or admin only)"
|
|
@@ -5036,7 +5230,7 @@ var unpublish = defineCommand18({
|
|
|
5036
5230
|
p8.outro("Done");
|
|
5037
5231
|
}
|
|
5038
5232
|
});
|
|
5039
|
-
var library_default =
|
|
5233
|
+
var library_default = defineCommand19({
|
|
5040
5234
|
meta: {
|
|
5041
5235
|
name: "library",
|
|
5042
5236
|
description: "Manage your DeepSpace library entries"
|
|
@@ -5048,13 +5242,13 @@ var library_default = defineCommand18({
|
|
|
5048
5242
|
});
|
|
5049
5243
|
|
|
5050
5244
|
// src/cli/commands/feedback.ts
|
|
5051
|
-
import { defineCommand as
|
|
5245
|
+
import { defineCommand as defineCommand20 } from "citty";
|
|
5052
5246
|
import * as p9 from "@clack/prompts";
|
|
5053
|
-
import { existsSync as
|
|
5054
|
-
import { dirname as dirname4, join as
|
|
5247
|
+
import { existsSync as existsSync14, readFileSync as readFileSync15 } from "fs";
|
|
5248
|
+
import { dirname as dirname4, join as join15 } from "path";
|
|
5055
5249
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5056
5250
|
import { release } from "os";
|
|
5057
|
-
var
|
|
5251
|
+
var API_URL8 = process.env.DEEPSPACE_API_URL ?? PLATFORM_URLS.api;
|
|
5058
5252
|
var TYPES = ["bug", "feature", "other"];
|
|
5059
5253
|
var TYPE_LABELS = {
|
|
5060
5254
|
bug: "Bug report",
|
|
@@ -5064,7 +5258,7 @@ var TYPE_LABELS = {
|
|
|
5064
5258
|
var MAX_TITLE_LEN = 200;
|
|
5065
5259
|
var MAX_BODY_LEN = 1e4;
|
|
5066
5260
|
var MAX_CONTEXT_LEN = 200;
|
|
5067
|
-
var api3 = (token, path, init) => apiFetch(
|
|
5261
|
+
var api3 = (token, path, init) => apiFetch(API_URL8, token, path, init);
|
|
5068
5262
|
function normalizeType(raw) {
|
|
5069
5263
|
const value = (raw ?? "bug").toLowerCase();
|
|
5070
5264
|
if (TYPES.includes(value)) return value;
|
|
@@ -5074,11 +5268,11 @@ function readCliVersion() {
|
|
|
5074
5268
|
try {
|
|
5075
5269
|
const here = dirname4(fileURLToPath2(import.meta.url));
|
|
5076
5270
|
const candidates = [
|
|
5077
|
-
|
|
5078
|
-
|
|
5271
|
+
join15(here, "..", "package.json"),
|
|
5272
|
+
join15(here, "..", "..", "..", "package.json")
|
|
5079
5273
|
];
|
|
5080
5274
|
for (const path of candidates) {
|
|
5081
|
-
if (!
|
|
5275
|
+
if (!existsSync14(path)) continue;
|
|
5082
5276
|
const pkg2 = JSON.parse(readFileSync15(path, "utf-8"));
|
|
5083
5277
|
if (pkg2.name === "deepspace" && pkg2.version) return pkg2.version;
|
|
5084
5278
|
}
|
|
@@ -5126,7 +5320,7 @@ function buildFeedbackPayload(input) {
|
|
|
5126
5320
|
...input.context
|
|
5127
5321
|
};
|
|
5128
5322
|
}
|
|
5129
|
-
var feedback_default =
|
|
5323
|
+
var feedback_default = defineCommand20({
|
|
5130
5324
|
meta: {
|
|
5131
5325
|
name: "feedback",
|
|
5132
5326
|
description: "Submit a bug report, feature request, or feedback to DeepSpace"
|
|
@@ -5288,7 +5482,7 @@ Context: deepspace ${payload.cliVersion} \xB7 ${payload.nodeVersion} \xB7 ${payl
|
|
|
5288
5482
|
});
|
|
5289
5483
|
|
|
5290
5484
|
// src/cli/commands/secrets.ts
|
|
5291
|
-
import { defineCommand as
|
|
5485
|
+
import { defineCommand as defineCommand21 } from "citty";
|
|
5292
5486
|
import { readFileSync as readFileSync16 } from "fs";
|
|
5293
5487
|
|
|
5294
5488
|
// src/cli/lib/citty-args.ts
|
|
@@ -5358,7 +5552,7 @@ function warnIfDebugRoutesEnabled(secrets) {
|
|
|
5358
5552
|
}
|
|
5359
5553
|
var APPLY_HINT = "Run `deepspace deploy` to apply \u2014 secrets take effect at deploy time.";
|
|
5360
5554
|
var LOCAL_DEV_HINT = "Running `deepspace dev`? Restart it to load the change locally.";
|
|
5361
|
-
var list5 =
|
|
5555
|
+
var list5 = defineCommand21({
|
|
5362
5556
|
meta: { name: "list", description: "List masked secrets in a config" },
|
|
5363
5557
|
args: {
|
|
5364
5558
|
...COMMON_ARGS,
|
|
@@ -5389,7 +5583,7 @@ var list5 = defineCommand20({
|
|
|
5389
5583
|
}
|
|
5390
5584
|
}
|
|
5391
5585
|
});
|
|
5392
|
-
var set =
|
|
5586
|
+
var set = defineCommand21({
|
|
5393
5587
|
meta: { name: "set", description: "Set secrets from KEY=value pairs" },
|
|
5394
5588
|
args: {
|
|
5395
5589
|
...COMMON_ARGS,
|
|
@@ -5431,7 +5625,7 @@ var set = defineCommand20({
|
|
|
5431
5625
|
}
|
|
5432
5626
|
}
|
|
5433
5627
|
});
|
|
5434
|
-
var get =
|
|
5628
|
+
var get = defineCommand21({
|
|
5435
5629
|
meta: { name: "get", description: "Get a secret; pass --plain to print the value" },
|
|
5436
5630
|
args: {
|
|
5437
5631
|
...COMMON_ARGS,
|
|
@@ -5456,7 +5650,7 @@ var get = defineCommand20({
|
|
|
5456
5650
|
}
|
|
5457
5651
|
}
|
|
5458
5652
|
});
|
|
5459
|
-
var del2 =
|
|
5653
|
+
var del2 = defineCommand21({
|
|
5460
5654
|
meta: { name: "delete", description: "Delete one or more secrets" },
|
|
5461
5655
|
args: {
|
|
5462
5656
|
...COMMON_ARGS,
|
|
@@ -5486,7 +5680,7 @@ var del2 = defineCommand20({
|
|
|
5486
5680
|
}
|
|
5487
5681
|
}
|
|
5488
5682
|
});
|
|
5489
|
-
var upload =
|
|
5683
|
+
var upload = defineCommand21({
|
|
5490
5684
|
meta: { name: "upload", description: "Upload secrets from a dotenv or JSON file" },
|
|
5491
5685
|
args: {
|
|
5492
5686
|
...COMMON_ARGS,
|
|
@@ -5511,7 +5705,7 @@ var upload = defineCommand20({
|
|
|
5511
5705
|
}
|
|
5512
5706
|
}
|
|
5513
5707
|
});
|
|
5514
|
-
var download =
|
|
5708
|
+
var download = defineCommand21({
|
|
5515
5709
|
meta: { name: "download", description: "Download a config\u2019s secrets (dotenv/json/shell)" },
|
|
5516
5710
|
args: {
|
|
5517
5711
|
...COMMON_ARGS,
|
|
@@ -5535,7 +5729,7 @@ var download = defineCommand20({
|
|
|
5535
5729
|
}
|
|
5536
5730
|
}
|
|
5537
5731
|
});
|
|
5538
|
-
var pull =
|
|
5732
|
+
var pull = defineCommand21({
|
|
5539
5733
|
meta: { name: "pull", description: "Refresh the .dev.vars cache from the app store" },
|
|
5540
5734
|
args: { ...COMMON_ARGS },
|
|
5541
5735
|
async run({ args }) {
|
|
@@ -5563,7 +5757,7 @@ var pull = defineCommand20({
|
|
|
5563
5757
|
}
|
|
5564
5758
|
}
|
|
5565
5759
|
});
|
|
5566
|
-
var configsList =
|
|
5760
|
+
var configsList = defineCommand21({
|
|
5567
5761
|
meta: { name: "list", description: "List the app\u2019s configs" },
|
|
5568
5762
|
args: { ...COMMON_ARGS },
|
|
5569
5763
|
async run({ args }) {
|
|
@@ -5582,7 +5776,7 @@ var configsList = defineCommand20({
|
|
|
5582
5776
|
}
|
|
5583
5777
|
}
|
|
5584
5778
|
});
|
|
5585
|
-
var configsCreate =
|
|
5779
|
+
var configsCreate = defineCommand21({
|
|
5586
5780
|
meta: { name: "create", description: "Create a config (optionally copying another)" },
|
|
5587
5781
|
args: {
|
|
5588
5782
|
...COMMON_ARGS,
|
|
@@ -5613,7 +5807,7 @@ var configsCreate = defineCommand20({
|
|
|
5613
5807
|
}
|
|
5614
5808
|
}
|
|
5615
5809
|
});
|
|
5616
|
-
var configsDelete =
|
|
5810
|
+
var configsDelete = defineCommand21({
|
|
5617
5811
|
meta: { name: "delete", description: "Delete a config and all of its secrets" },
|
|
5618
5812
|
args: {
|
|
5619
5813
|
...COMMON_ARGS,
|
|
@@ -5630,11 +5824,11 @@ var configsDelete = defineCommand20({
|
|
|
5630
5824
|
}
|
|
5631
5825
|
}
|
|
5632
5826
|
});
|
|
5633
|
-
var configs =
|
|
5827
|
+
var configs = defineCommand21({
|
|
5634
5828
|
meta: { name: "configs", description: "Manage the app\u2019s secrets configs" },
|
|
5635
5829
|
subCommands: { list: configsList, create: configsCreate, delete: configsDelete }
|
|
5636
5830
|
});
|
|
5637
|
-
var secrets_default =
|
|
5831
|
+
var secrets_default = defineCommand21({
|
|
5638
5832
|
meta: { name: "secrets", description: "Manage the app\u2019s secrets store" },
|
|
5639
5833
|
subCommands: {
|
|
5640
5834
|
list: list5,
|
|
@@ -5649,8 +5843,8 @@ var secrets_default = defineCommand20({
|
|
|
5649
5843
|
});
|
|
5650
5844
|
|
|
5651
5845
|
// src/cli/commands/init.ts
|
|
5652
|
-
import { defineCommand as
|
|
5653
|
-
var init_default =
|
|
5846
|
+
import { defineCommand as defineCommand22 } from "citty";
|
|
5847
|
+
var init_default = defineCommand22({
|
|
5654
5848
|
meta: {
|
|
5655
5849
|
name: "init",
|
|
5656
5850
|
description: "Mint this app\u2019s immutable DEEPSPACE_APP_ID into wrangler.toml"
|
|
@@ -5696,11 +5890,11 @@ var init_default = defineCommand21({
|
|
|
5696
5890
|
|
|
5697
5891
|
// src/cli/cli.ts
|
|
5698
5892
|
var __dirname = dirname5(fileURLToPath3(import.meta.url));
|
|
5699
|
-
var pkg = JSON.parse(readFileSync17(
|
|
5700
|
-
if (process.platform === "linux" && !process.env.SSL_CERT_FILE &&
|
|
5893
|
+
var pkg = JSON.parse(readFileSync17(join16(__dirname, "..", "package.json"), "utf-8"));
|
|
5894
|
+
if (process.platform === "linux" && !process.env.SSL_CERT_FILE && existsSync15("/etc/ssl/certs/ca-certificates.crt")) {
|
|
5701
5895
|
process.env.SSL_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt";
|
|
5702
5896
|
}
|
|
5703
|
-
var create2 =
|
|
5897
|
+
var create2 = defineCommand23({
|
|
5704
5898
|
meta: {
|
|
5705
5899
|
name: "create",
|
|
5706
5900
|
description: "Create a new DeepSpace app (runs create-deepspace; all flags are forwarded)"
|
|
@@ -5727,7 +5921,7 @@ var create2 = defineCommand22({
|
|
|
5727
5921
|
process.exit(res.status ?? 1);
|
|
5728
5922
|
}
|
|
5729
5923
|
});
|
|
5730
|
-
var main =
|
|
5924
|
+
var main = defineCommand23({
|
|
5731
5925
|
meta: {
|
|
5732
5926
|
name: "deepspace",
|
|
5733
5927
|
version: pkg.version,
|
|
@@ -5740,6 +5934,7 @@ var main = defineCommand22({
|
|
|
5740
5934
|
logout: logout_default,
|
|
5741
5935
|
whoami: whoami_default,
|
|
5742
5936
|
apps: apps_default,
|
|
5937
|
+
usage: usage_default,
|
|
5743
5938
|
dev: dev_default,
|
|
5744
5939
|
kill: kill_default,
|
|
5745
5940
|
test: test_default,
|