deepspace 0.22.0 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -2193,6 +2193,7 @@ async function secretsApi(deployUrl, token, path, init = {}) {
2193
2193
  if (!res.ok) {
2194
2194
  const err = new Error(body.error ?? `Secrets request failed (${res.status})`);
2195
2195
  err.status = res.status;
2196
+ err.code = body.code;
2196
2197
  err.apiPath = path;
2197
2198
  throw err;
2198
2199
  }
@@ -6267,7 +6268,14 @@ var deploy_default = defineCommand3({
6267
6268
  if (!appId) {
6268
6269
  return output.die(
6269
6270
  `No app id in wrangler.toml${envName ? ` for [env.${envName}]` : ""}. Run \`deepspace app init${envName ? ` --env ${envName}` : ""}\` to register this app, then re-deploy.`,
6270
- "app_not_initialized"
6271
+ "app_not_initialized",
6272
+ {
6273
+ action: {
6274
+ cwd: appDir,
6275
+ argv: ["deepspace", "app", "init", ...envName ? ["--env", envName] : []]
6276
+ },
6277
+ actionRequired: true
6278
+ }
6271
6279
  );
6272
6280
  }
6273
6281
  p12.log.info(`Id: ${appId}`);
@@ -6281,6 +6289,12 @@ var deploy_default = defineCommand3({
6281
6289
  output
6282
6290
  });
6283
6291
  const sourceState = await getAppSource(DEPLOY_URL3, token, appId);
6292
+ if (!sourceState.registered) {
6293
+ output.die(
6294
+ `${appId} is not registered. If this repo's id came from an older SDK's scaffold, run \`deepspace app init --new-id\` to register it as a fresh app; a brand-new app dir registers with \`deepspace app init\`.`,
6295
+ "app_not_registered"
6296
+ );
6297
+ }
6284
6298
  const repositoryPreflight = preflightDeployRepository({
6285
6299
  appDir,
6286
6300
  push: args.push !== false,
@@ -6556,7 +6570,7 @@ async function warnIfPhantomApp(deployUrl, token, appId, explicit) {
6556
6570
  const apps = await listApps(deployUrl, token);
6557
6571
  if (!apps.some((app2) => app2.appId === appId)) {
6558
6572
  process.stderr.write(
6559
- `warning: ${appId} is not among your apps. If it exists and you have access (collaborator/admin), the server will use it; if it doesn't exist, this will register it as a NEW app under your account \u2014 check the id if that's not what you meant (a subdomain name also works with -a).
6573
+ `warning: ${appId} is not among your apps. If it exists and you have access (collaborator/admin), the server will use it; if it doesn't exist, the command will be refused (app_not_registered \u2014 ids are registered at \`deepspace app init\`). Check the id (a subdomain name also works with -a).
6560
6574
  `
6561
6575
  );
6562
6576
  }
@@ -10291,6 +10305,25 @@ var init_default = defineDeepspaceCommand({
10291
10305
  const envName = args.env || void 0;
10292
10306
  const existing = readAppId(appDir, envName);
10293
10307
  if (existing && !args["new-id"]) {
10308
+ const token2 = await ensureToken();
10309
+ let state;
10310
+ try {
10311
+ state = await getAppSource(DEPLOY_URL12, token2, existing);
10312
+ } catch (error) {
10313
+ if (error instanceof ApiError && error.code === "forbidden") {
10314
+ throw new Refusal(
10315
+ `wrangler.toml carries ${existing}, which is registered to another user. Run \`deepspace app init --new-id\` to fork this repo as your own app (new data and secrets; the original is untouched).`,
10316
+ "not_app_owner"
10317
+ );
10318
+ }
10319
+ throw error;
10320
+ }
10321
+ if (!state.registered) {
10322
+ throw new Refusal(
10323
+ `wrangler.toml carries ${existing}, but that id was never registered \u2014 it was minted locally by an older SDK. Ids are server-minted at registration now, and an existing unregistered id cannot be claimed. Run \`deepspace app init --new-id\` to register this repo as a fresh app (new data and secrets; nothing to migrate \u2014 the old id never had server-side state).`,
10324
+ "app_not_registered"
10325
+ );
10326
+ }
10294
10327
  if (!args.json) {
10295
10328
  console.log(`Already initialized: ${existing}${envName ? ` (env: ${envName})` : ""}`);
10296
10329
  console.log(`App dir: ${appDir}`);
@@ -10747,6 +10780,24 @@ var push_default = defineDeepspaceCommand({
10747
10780
  );
10748
10781
  }
10749
10782
  const { token, appId } = await resolveTarget3();
10783
+ let sourceState;
10784
+ try {
10785
+ sourceState = await getAppSource(deployBaseUrl(), token, appId);
10786
+ } catch (error) {
10787
+ if (error instanceof ApiError && error.code === "forbidden") {
10788
+ throw new Refusal(
10789
+ `${appId} is registered to another user. Run \`deepspace app init --new-id\` to fork this repo as your own app (new data and secrets; the original is untouched).`,
10790
+ "not_app_owner"
10791
+ );
10792
+ }
10793
+ throw error;
10794
+ }
10795
+ if (!sourceState.registered) {
10796
+ throw new Refusal(
10797
+ `${appId} is not registered. If this repo's id came from an older SDK's scaffold, run \`deepspace app init --new-id\` to register it as a fresh app; a brand-new app dir registers with \`deepspace app init\`.`,
10798
+ "app_not_registered"
10799
+ );
10800
+ }
10750
10801
  const pullRecoveryCwd = selectedBranchCheckout(appDir, branch) ?? appDir;
10751
10802
  ensureSpaceRemote(appDir, appId);
10752
10803
  if (force) {
@@ -13786,7 +13837,7 @@ import { join as join24, resolve as resolve20 } from "path";
13786
13837
  // package.json
13787
13838
  var package_default = {
13788
13839
  name: "deepspace",
13789
- version: "0.22.0",
13840
+ version: "0.22.1",
13790
13841
  engines: {
13791
13842
  node: ">=22.15.0 <23 || >=24 <25 || >=26 <27"
13792
13843
  },