@akanjs/cli 3.1.1-rc.7 → 3.1.1-rc.8

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/.build-stamp CHANGED
@@ -1 +1 @@
1
- a5bf31c17cc6b60e36b70c7841c4145edae3bbddd06b8d5ecd3b716788f87acd
1
+ 5bc34f19ccee615879fdbf1e588c2c52ebd7a1c93f6a04638c896b62af49fe67
@@ -1,8 +1,8 @@
1
1
  // @bun
2
2
  import {
3
3
  TunnelShare2
4
- } from "./index-vah0fgkr.js";
5
- import"./index-xy97mqgq.js";
4
+ } from "./index-hmmv2cah.js";
5
+ import"./index-myc22sgv.js";
6
6
  import"./index-5max10jx.js";
7
7
  import"./index-m9jj544v.js";
8
8
  import"./index-xb8809yb.js";
@@ -19,7 +19,7 @@ import"./index-0fz95kxe.js";
19
19
  import"./index-2xcc2ax5.js";
20
20
  import {
21
21
  ApplicationScript
22
- } from "./index-pbtzb54h.js";
22
+ } from "./index-pa3c2mb8.js";
23
23
  import"./index-7md2g9vw.js";
24
24
  import {
25
25
  writeOption,
@@ -6,10 +6,10 @@ import {
6
6
  } from "./index-3wypz6xj.js";
7
7
  import"./index-52w0fvh8.js";
8
8
  import"./index-wcej7g4z.js";
9
- import"./index-xy97mqgq.js";
9
+ import"./index-myc22sgv.js";
10
10
  import {
11
11
  PlatformTestRun
12
- } from "./index-jh72e64b.js";
12
+ } from "./index-0p37cz91.js";
13
13
  import"./index-5max10jx.js";
14
14
  import"./index-qd5km521.js";
15
15
  import"./index-m9jj544v.js";
@@ -17,13 +17,13 @@ import"./index-xb8809yb.js";
17
17
  import"./index-0fz95kxe.js";
18
18
  import"./index-5nd1wtkv.js";
19
19
  import"./index-2xcc2ax5.js";
20
- import"./index-pbtzb54h.js";
20
+ import"./index-pa3c2mb8.js";
21
21
  import"./index-7md2g9vw.js";
22
22
  import"./index-tvehn2sp.js";
23
23
  import"./index-42j4a8zq.js";
24
24
  import {
25
25
  CloudScript2
26
- } from "./index-hqegmnb5.js";
26
+ } from "./index-mdqr41sp.js";
27
27
  import {
28
28
  writeOption,
29
29
  oneNativeTargetOption,
@@ -1,14 +1,14 @@
1
1
  // @bun
2
2
  import {
3
3
  CloudScript2
4
- } from "./index-hqegmnb5.js";
5
- import"./index-jh72e64b.js";
6
- import"./index-pbtzb54h.js";
4
+ } from "./index-mdqr41sp.js";
5
+ import"./index-0p37cz91.js";
6
+ import"./index-pa3c2mb8.js";
7
7
  import"./index-pcwzkdqb.js";
8
8
  import"./index-2xcc2ax5.js";
9
9
  import"./index-42j4a8zq.js";
10
10
  import"./index-qd5km521.js";
11
- import"./index-xy97mqgq.js";
11
+ import"./index-myc22sgv.js";
12
12
  import"./index-5max10jx.js";
13
13
  import"./index-m9jj544v.js";
14
14
  import"./index-3wypz6xj.js";
@@ -6,7 +6,7 @@ import {
6
6
  CloudApi,
7
7
  CloudUpdates,
8
8
  PipelineSecrets
9
- } from "./index-xy97mqgq.js";
9
+ } from "./index-myc22sgv.js";
10
10
  import {
11
11
  resolveMobileTargets
12
12
  } from "./index-m9jj544v.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  GlobalConfig,
4
4
  CloudApi
5
- } from "./index-xy97mqgq.js";
5
+ } from "./index-myc22sgv.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/tunnel/TunnelShare.ts
8
8
  import { TunnelAgent } from "akanjs/server/tunnel";
@@ -4,7 +4,7 @@ import {
4
4
  CloudApi,
5
5
  CloudUpdates,
6
6
  PipelineSecrets
7
- } from "./index-xy97mqgq.js";
7
+ } from "./index-myc22sgv.js";
8
8
  import {
9
9
  PkgExecutor
10
10
  } from "./index-wcej7g4z.js";
@@ -18,13 +18,13 @@ import {
18
18
  } from "./index-3wypz6xj.js";
19
19
  import {
20
20
  ApplicationScript
21
- } from "./index-pbtzb54h.js";
21
+ } from "./index-pa3c2mb8.js";
22
22
  import {
23
23
  PackageScript
24
24
  } from "./index-42j4a8zq.js";
25
25
  import {
26
26
  CloudRunner
27
- } from "./index-jh72e64b.js";
27
+ } from "./index-0p37cz91.js";
28
28
 
29
29
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
30
30
  import { Logger } from "akanjs/common";
@@ -18,7 +18,7 @@ import {
18
18
  } from "./index-bqbf654f.js";
19
19
 
20
20
  // pkgs/@akanjs/devkit/cloud/cloudApi.ts
21
- import { isRecord as isRecord2 } from "akanjs/common";
21
+ import { isRecord as isRecord2, Logger } from "akanjs/common";
22
22
 
23
23
  // pkgs/@akanjs/devkit/cloud/cloudHttpError.ts
24
24
  import { isRecord } from "akanjs/common";
@@ -46,9 +46,17 @@ class CloudHttpError extends Error {
46
46
  return error instanceof CloudHttpError ? error.status : null;
47
47
  }
48
48
  get error() {
49
+ const error = this.#payload?.error;
50
+ return typeof error === "string" ? error : null;
51
+ }
52
+ get data() {
53
+ const data = this.#payload?.data;
54
+ return isRecord(data) ? data : null;
55
+ }
56
+ get #payload() {
49
57
  try {
50
58
  const parsed = JSON.parse(this.body);
51
- return isRecord(parsed) && typeof parsed.error === "string" ? parsed.error : null;
59
+ return isRecord(parsed) ? parsed : null;
52
60
  } catch {
53
61
  return null;
54
62
  }
@@ -274,8 +282,11 @@ class CloudApi {
274
282
  return new Error("The server did not accept your sign-in: run `akan login`, then try again.", { cause: error });
275
283
  if (error.status === 403)
276
284
  return new Error(`The project refused: ${who}.`, { cause: error });
277
- if (error.status === 400)
278
- return new Error(`The project refused the request${error.error ? `: ${error.error}` : ""}.`, { cause: error });
285
+ if (error.status === 400) {
286
+ const { data } = error;
287
+ const why = `${error.error ? `: ${error.error}` : ""}${data ? ` ${Logger.inlineData(data)}` : ""}`;
288
+ return new Error(`The project refused the request${why}.`, { cause: error });
289
+ }
279
290
  const { errKey } = error;
280
291
  if (error.status === 503 && unavailable && errKey && errKey !== "base.error.serverUnavailable")
281
292
  return new Error(`${unavailable}: ${errKey}.`, { cause: error });
@@ -378,10 +389,10 @@ class CloudApi {
378
389
  }
379
390
  // pkgs/@akanjs/devkit/cloud/cloudUpdates.ts
380
391
  import path2 from "path";
381
- import { Logger as Logger2 } from "akanjs/common";
392
+ import { Logger as Logger3 } from "akanjs/common";
382
393
 
383
394
  // pkgs/@akanjs/devkit/cloud/updatePackUpload.ts
384
- import { Logger, sleep } from "akanjs/common";
395
+ import { Logger as Logger2, sleep } from "akanjs/common";
385
396
  class UpdatePackUpload {
386
397
  static maxBytes = 200 * 1024 * 1024;
387
398
  static maxAppBytes = 1024 * 1024 * 1024;
@@ -481,7 +492,7 @@ class UpdatePackUpload {
481
492
  const waitMs = Math.max(this.#commitRetryMs, error instanceof CloudHttpError && error.retryAfterMs || 0);
482
493
  if (now + waitMs > deadline)
483
494
  throw error;
484
- Logger.rawLog(`The project is still taking the pack; asking again in ${Math.round(waitMs / 1000)}s.`);
495
+ Logger2.rawLog(`The project is still taking the pack; asking again in ${Math.round(waitMs / 1000)}s.`);
485
496
  await sleep(waitMs);
486
497
  }
487
498
  }
@@ -540,7 +551,7 @@ class CloudUpdates {
540
551
  const target = channel ?? pack.channel;
541
552
  return await UpdatePackFolder.withArchive(pack, async (archive) => {
542
553
  const release = await new UpdatePackUpload(this.cloudApi, this.devProjectId).send(archive, { appName: pack.app, target: pack.target, platform: pack.platform, channel: target, notes }).catch((error) => {
543
- throw CloudApi.refusal(error, "a pack is uploaded by a project member signed in with `akan login`");
554
+ throw CloudUpdates.#refusal(error, "a pack is uploaded by a project member signed in with `akan login`");
544
555
  });
545
556
  const label = `${pack.app} ${pack.target} ${pack.platform} on channel ${target}: release ${release.id}`;
546
557
  if (release.status === "rejected")
@@ -548,9 +559,9 @@ class CloudUpdates {
548
559
  ${(release.problems ?? []).map((problem) => ` - ${problem}`).join(`
549
560
  `)}`, 2);
550
561
  if (release.status === "published")
551
- Logger2.rawLog(`Published ${label} (${pack.files} files, native API ${pack.nativeApi}).`);
562
+ Logger3.rawLog(`Published ${label} (${pack.files} files, native API ${pack.nativeApi}).`);
552
563
  else
553
- Logger2.rawLog(`Staged ${label} (${pack.files} files, native API ${pack.nativeApi}). Publish it from the project's release screen.`);
564
+ Logger3.rawLog(`Staged ${label} (${pack.files} files, native API ${pack.nativeApi}). Publish it from the project's release screen.`);
554
565
  return release;
555
566
  });
556
567
  }
@@ -564,7 +575,7 @@ ${(release.problems ?? []).map((problem) => ` - ${problem}`).join(`
564
575
  const { platform, arch, channel } = release;
565
576
  return await release.withArchive(release.record(signer), async (archive) => {
566
577
  const record = await new UpdatePackUpload(this.cloudApi, this.devProjectId).send(archive, { appName, target, platform, kind: "app", arch, channel, notes }).catch((error) => {
567
- throw CloudApi.refusal(error, "a release is uploaded by a project member signed in with `akan login`");
578
+ throw CloudUpdates.#refusal(error, "a release is uploaded by a project member signed in with `akan login`");
568
579
  });
569
580
  const label = `${appName} ${target} ${platform}-${arch} on channel ${channel}: release ${record.id}`;
570
581
  const problems = (record.problems ?? []).map((problem) => ` - ${problem}`).join(`
@@ -574,13 +585,18 @@ ${(release.problems ?? []).map((problem) => ` - ${problem}`).join(`
574
585
  ${problems}`, 2);
575
586
  const manifestUrl = typeof record.manifestUrl === "string" ? record.manifestUrl : `${url}/${platform}-${arch}/${channel}.json`;
576
587
  const what = `${label} (${release.manifest.bundle}, ${release.payloads.length + 3} files)`;
577
- Logger2.rawLog(record.status === "published" ? `Published ${what}. Installed apps read ${manifestUrl}.` : `Staged ${what}. Publish it from the project's release screen; installed apps read ${manifestUrl}.`);
588
+ Logger3.rawLog(record.status === "published" ? `Published ${what}. Installed apps read ${manifestUrl}.` : `Staged ${what}. Publish it from the project's release screen; installed apps read ${manifestUrl}.`);
578
589
  if (problems)
579
- Logger2.rawLog(`The project noted:
590
+ Logger3.rawLog(`The project noted:
580
591
  ${problems}`);
581
592
  return record;
582
593
  });
583
594
  }
595
+ static #refusal(error, who) {
596
+ const refusal = CloudApi.refusal(error, who);
597
+ const verdict = error instanceof CloudHttpError && error.status === 400 && !!error.errKey?.startsWith("release.error.");
598
+ return verdict && refusal instanceof Error ? new ExitCodeError(refusal.message, 2) : refusal;
599
+ }
584
600
  async registerBinary(app, pack, { distribution, env }) {
585
601
  const { cloudApi, devProjectId } = this;
586
602
  const bundlePath = await CloudUpdates.storeBundlePath(app, pack.target, pack.platform);
@@ -616,13 +632,13 @@ ${problems}`);
616
632
  }))).catch((error) => {
617
633
  throw CloudApi.refusal(error, "a binary is registered by a project member signed in with `akan login`");
618
634
  });
619
- Logger2.rawLog(`Registered ${pack.app} ${pack.target} ${pack.platform} (${distribution}): binary ${binary.id}, native API ${pack.nativeApi}.`);
635
+ Logger3.rawLog(`Registered ${pack.app} ${pack.target} ${pack.platform} (${distribution}): binary ${binary.id}, native API ${pack.nativeApi}.`);
620
636
  return binary;
621
637
  });
622
638
  }
623
639
  }
624
640
  // pkgs/@akanjs/devkit/cloud/pipelineSecrets.ts
625
- import { capitalize, Logger as Logger3, PipelineNames } from "akanjs/common";
641
+ import { capitalize, Logger as Logger4, PipelineNames } from "akanjs/common";
626
642
  class PipelineSecrets {
627
643
  cloudApi;
628
644
  devProjectId;
@@ -659,7 +675,7 @@ class PipelineSecrets {
659
675
  unavailable: PipelineSecrets.#secretsUnavailable
660
676
  });
661
677
  });
662
- Logger3.rawLog(`Saved ${saved.name} for ${saved.scope === "*" ? "every branch" : `branch ${saved.scope}`}. Builds that start from now on use it.`);
678
+ Logger4.rawLog(`Saved ${saved.name} for ${saved.scope === "*" ? "every branch" : `branch ${saved.scope}`}. Builds that start from now on use it.`);
663
679
  }
664
680
  async list(branch) {
665
681
  PipelineSecrets.assertBranch(branch);
@@ -669,7 +685,7 @@ class PipelineSecrets {
669
685
  });
670
686
  });
671
687
  const secrets = listed.filter((secret) => !branch || secret.scope === "*" || secret.scope === branch);
672
- Logger3.rawLog(PipelineSecrets.format(secrets));
688
+ Logger4.rawLog(PipelineSecrets.format(secrets));
673
689
  }
674
690
  async remove({ name, branch }) {
675
691
  PipelineSecrets.assertName(name);
@@ -679,7 +695,7 @@ class PipelineSecrets {
679
695
  unavailable: PipelineSecrets.#secretsUnavailable
680
696
  });
681
697
  });
682
- Logger3.rawLog(removed ? `Removed ${name} for ${branch ? `branch ${branch}` : "every branch"}.` : `No ${name} for ${branch ? `branch ${branch}` : "every branch"} to remove.`);
698
+ Logger4.rawLog(removed ? `Removed ${name} for ${branch ? `branch ${branch}` : "every branch"}.` : `No ${name} for ${branch ? `branch ${branch}` : "every branch"} to remove.`);
683
699
  }
684
700
  static format(secrets) {
685
701
  if (!secrets.length)
@@ -3708,7 +3708,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
3708
3708
  await Promise.all(shares.map(async (share) => await share.close()));
3709
3709
  }, "Abandoning the tunnel release; the shares expire on their own.");
3710
3710
  await Promise.all(apps.map(async (app) => {
3711
- const { TunnelShare } = await import("./TunnelShare-q38dxrrr.js");
3711
+ const { TunnelShare } = await import("./TunnelShare-2ef94kha.js");
3712
3712
  const share = await TunnelShare.open(app, { workspace: app.workspace });
3713
3713
  shares.push(share);
3714
3714
  urls.set(app.name, share.url);
package/index.js CHANGED
@@ -22,18 +22,18 @@ import path from "path";
22
22
 
23
23
  // pkgs/@akanjs/cli/commandModules.ts
24
24
  var commandModules = {
25
- workspace: async () => (await import("./workspace.command-fmgycnbr.js")).WorkspaceCommand,
25
+ workspace: async () => (await import("./workspace.command-tsc99yec.js")).WorkspaceCommand,
26
26
  agent: async () => (await import("./agent.command-ydftceda.js")).AgentCommand,
27
27
  code: async () => (await import("./code.command-719k3e9q.js")).CodeCommand,
28
- application: async () => (await import("./application.command-fm2yn6hj.js")).ApplicationCommand,
28
+ application: async () => (await import("./application.command-14xsthcr.js")).ApplicationCommand,
29
29
  library: async () => (await import("./library.command-gycrwhf1.js")).LibraryCommand,
30
- localRegistry: async () => (await import("./localRegistry.command-h924ek5g.js")).LocalRegistryCommand,
30
+ localRegistry: async () => (await import("./localRegistry.command-2t3fghje.js")).LocalRegistryCommand,
31
31
  package: async () => (await import("./package.command-shzpcfph.js")).PackageCommand,
32
32
  module: async () => (await import("./module.command-v6hgs1bc.js")).ModuleCommand,
33
33
  page: async () => (await import("./page.command-ptxn5kqk.js")).PageCommand,
34
34
  context: async () => (await import("./context.command-c4t4z1vy.js")).ContextCommand,
35
- cloud: async () => (await import("./cloud.command-ya0evzfq.js")).CloudCommand,
36
- subspace: async () => (await import("./subspace.command-vem71tr5.js")).SubspaceCommand,
35
+ cloud: async () => (await import("./cloud.command-rmw1kcf1.js")).CloudCommand,
36
+ subspace: async () => (await import("./subspace.command-kvxmyxtf.js")).SubspaceCommand,
37
37
  guideline: async () => (await import("./guideline.command-snh85ctf.js")).GuidelineCommand,
38
38
  scalar: async () => (await import("./scalar.command-0acvyp26.js")).ScalarCommand,
39
39
  primitive: async () => (await import("./primitive.command-a1vse91z.js")).PrimitiveCommand,
@@ -41,7 +41,7 @@ var commandModules = {
41
41
  repair: async () => (await import("./repair.command-cvazbz99.js")).RepairCommand,
42
42
  workflow: async () => (await import("./workflow.command-abb1d5xy.js")).WorkflowCommand,
43
43
  pipeline: async () => (await import("./pipeline.command-zz31pgax.js")).PipelineCommand,
44
- tunnel: async () => (await import("./tunnel.command-vy08ecyp.js")).TunnelCommand
44
+ tunnel: async () => (await import("./tunnel.command-kxv0ddmp.js")).TunnelCommand
45
45
  };
46
46
  var commandModuleIds = Object.keys(commandModules);
47
47
 
@@ -18,13 +18,13 @@ import"./index-0fz95kxe.js";
18
18
  import"./index-2xcc2ax5.js";
19
19
  import {
20
20
  ApplicationScript
21
- } from "./index-pbtzb54h.js";
21
+ } from "./index-pa3c2mb8.js";
22
22
  import"./index-7md2g9vw.js";
23
- import"./index-xy97mqgq.js";
23
+ import"./index-myc22sgv.js";
24
24
  import {
25
25
  getNpmRegistryUrl,
26
26
  CloudRunner
27
- } from "./index-jh72e64b.js";
27
+ } from "./index-0p37cz91.js";
28
28
  import"./index-tvehn2sp.js";
29
29
  import {
30
30
  PackageScript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/cli",
3
- "version": "3.1.1-rc.7",
3
+ "version": "3.1.1-rc.8",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -39,7 +39,7 @@
39
39
  "@earendil-works/pi-tui": "1.3.0",
40
40
  "@inquirer/prompts": "^8.7.3",
41
41
  "@tailwindcss/node": "^4.3.3",
42
- "akanjs": "3.1.1-rc.7",
42
+ "akanjs": "3.1.1-rc.8",
43
43
  "chalk": "^6.0.1",
44
44
  "commander": "^15.0.0",
45
45
  "dayjs": "^1.11.23",
@@ -17,7 +17,7 @@ import {
17
17
  } from "./index-wcej7g4z.js";
18
18
  import {
19
19
  GlobalConfig
20
- } from "./index-xy97mqgq.js";
20
+ } from "./index-myc22sgv.js";
21
21
  import"./index-m9jj544v.js";
22
22
  import"./index-5max10jx.js";
23
23
  import"./index-xb8809yb.js";
@@ -816,7 +816,7 @@ class SubspaceRunner extends runner("subspace") {
816
816
  if (!asked)
817
817
  return { name: subspace.name, workspaceId, host, apps, libs: [], outcome: "cancelled", files: [] };
818
818
  const { libs } = await subspace.slice();
819
- const { CloudScript } = await import("./cloud.script-zg43jse2.js");
819
+ const { CloudScript } = await import("./cloud.script-v1ysyerg.js");
820
820
  const { files } = await CommandContainer.get(CloudScript).uploadEnv(workspace, {
821
821
  host,
822
822
  workspaceId,
@@ -12,14 +12,14 @@ import {
12
12
  import {
13
13
  GlobalConfig,
14
14
  CloudApi
15
- } from "./index-xy97mqgq.js";
15
+ } from "./index-myc22sgv.js";
16
16
  import"./index-m9jj544v.js";
17
17
  import"./index-5max10jx.js";
18
18
  import"./index-xb8809yb.js";
19
19
  import"./index-0fz95kxe.js";
20
20
  import {
21
21
  TunnelShare2
22
- } from "./index-vah0fgkr.js";
22
+ } from "./index-hmmv2cah.js";
23
23
  import {
24
24
  writeClipboard
25
25
  } from "./index-p6pbz9n5.js";
@@ -46,9 +46,9 @@ import {
46
46
  } from "./index-2xcc2ax5.js";
47
47
  import {
48
48
  ApplicationScript
49
- } from "./index-pbtzb54h.js";
49
+ } from "./index-pa3c2mb8.js";
50
50
  import"./index-7md2g9vw.js";
51
- import"./index-xy97mqgq.js";
51
+ import"./index-myc22sgv.js";
52
52
  import"./index-tvehn2sp.js";
53
53
  import {
54
54
  PackageScript
@@ -56,10 +56,10 @@ import {
56
56
  import {
57
57
  getNpmRegistryUrl,
58
58
  getLatestPackageVersion
59
- } from "./index-jh72e64b.js";
59
+ } from "./index-0p37cz91.js";
60
60
  import {
61
61
  CloudScript2
62
- } from "./index-hqegmnb5.js";
62
+ } from "./index-mdqr41sp.js";
63
63
  import"./index-8w76g4rm.js";
64
64
  import"./index-j9vyj3dj.js";
65
65
  import"./index-905qdgqp.js";