@akanjs/cli 3.1.1-rc.6 → 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.
Files changed (28) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-y6ppa10x.js → CodeAgent-3sy7kjgj.js} +2 -2
  3. package/{CodeTui-dy37zz3j.js → CodeTui-rqxarxsn.js} +1 -1
  4. package/{TunnelShare-mnn0jxnp.js → TunnelShare-2ef94kha.js} +3 -3
  5. package/akanCode.js +2 -2
  6. package/{application.command-fdghyjfj.js → application.command-14xsthcr.js} +3 -3
  7. package/{cloud.command-eyxwxnrn.js → cloud.command-rmw1kcf1.js} +15 -10
  8. package/{cloud.script-c9f92bev.js → cloud.script-v1ysyerg.js} +6 -6
  9. package/{code.command-4kqbrjt9.js → code.command-719k3e9q.js} +4 -4
  10. package/{context.command-h56yvjay.js → context.command-c4t4z1vy.js} +4 -4
  11. package/{context.runner-cf11819z.js → context.runner-qb15sjf8.js} +3 -3
  12. package/{index-jhbkzc8c.js → index-0p37cz91.js} +42 -1
  13. package/{index-ds2tmxgx.js → index-5max10jx.js} +533 -137
  14. package/{index-bksa6cqh.js → index-5phjb48k.js} +3 -3
  15. package/{index-krz4bcg5.js → index-8ap5z1n5.js} +1 -1
  16. package/{index-kr9vpvdn.js → index-8w76g4rm.js} +4 -4
  17. package/{index-zz4vrw85.js → index-hmmv2cah.js} +1 -1
  18. package/{index-44hh6bx2.js → index-mdqr41sp.js} +53 -6
  19. package/{index-e9b3zh22.js → index-myc22sgv.js} +65 -18
  20. package/{index-12ny6e0x.js → index-pa3c2mb8.js} +11 -9
  21. package/{index-jg2xev75.js → index-qd5km521.js} +3 -97
  22. package/{index-secyhsjs.js → index-zrte51fn.js} +1 -1
  23. package/index.js +8 -8
  24. package/{localRegistry.command-bajag7gm.js → localRegistry.command-2t3fghje.js} +5 -5
  25. package/package.json +2 -2
  26. package/{subspace.command-dzpfbc99.js → subspace.command-kvxmyxtf.js} +3 -3
  27. package/{tunnel.command-cfw6f0vz.js → tunnel.command-kxv0ddmp.js} +3 -3
  28. package/{workspace.command-5rc8f0wt.js → workspace.command-tsc99yec.js} +8 -8
@@ -5,7 +5,7 @@ import {
5
5
  McpServerConfig,
6
6
  McpSignIn,
7
7
  AkanCodeCompaction2
8
- } from "./index-krz4bcg5.js";
8
+ } from "./index-8ap5z1n5.js";
9
9
  import {
10
10
  stripAnsi
11
11
  } from "./index-7md2g9vw.js";
@@ -809,7 +809,7 @@ class AkanToolPack2 {
809
809
  return { name: "akan-tools", factory: async (pi) => await this.#register(pi) };
810
810
  }
811
811
  async names() {
812
- const { ContextRunner } = await import("./context.runner-cf11819z.js");
812
+ const { ContextRunner } = await import("./context.runner-qb15sjf8.js");
813
813
  return [
814
814
  ...new ContextRunner().listMcpTools(this.#options.mode).map((tool) => tool.name),
815
815
  AkanToolPack2.verifyToolName
@@ -817,7 +817,7 @@ class AkanToolPack2 {
817
817
  }
818
818
  static verifyToolName = "akan_verify";
819
819
  async#register(pi) {
820
- const { ContextRunner } = await import("./context.runner-cf11819z.js");
820
+ const { ContextRunner } = await import("./context.runner-qb15sjf8.js");
821
821
  const runner = new ContextRunner;
822
822
  const guidelineNames = await AkanToolPack2.#guidelineNames();
823
823
  for (const tool of runner.listMcpTools(this.#options.mode, { guidelineNames })) {
@@ -179,7 +179,7 @@ class SubagentPool2 {
179
179
  }
180
180
  }
181
181
  async#run(id, kind, prompt, signal) {
182
- const { CodeAgent } = await import("./CodeAgent-y6ppa10x.js");
182
+ const { CodeAgent } = await import("./CodeAgent-3sy7kjgj.js");
183
183
  const budget = this.#options.parent.tools.subagent;
184
184
  const child = SubagentPool2.childOf(this.#options.parent, kind);
185
185
  const agent = await CodeAgent.create({
@@ -21,16 +21,16 @@ import {
21
21
  import {
22
22
  runner
23
23
  } from "./index-3wypz6xj.js";
24
+ import {
25
+ NativeApp
26
+ } from "./index-5max10jx.js";
24
27
  import {
25
28
  isPlaceholderAppId
26
- } from "./index-jg2xev75.js";
29
+ } from "./index-qd5km521.js";
27
30
  import {
28
31
  getMobileTargets,
29
32
  appIdsOf
30
33
  } from "./index-m9jj544v.js";
31
- import {
32
- NativeApp
33
- } from "./index-ds2tmxgx.js";
34
34
  import {
35
35
  Prompter2
36
36
  } from "./index-zzvvc845.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  GlobalConfig,
4
4
  CloudApi
5
- } from "./index-e9b3zh22.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,26 +4,27 @@ import {
4
4
  CloudApi,
5
5
  CloudUpdates,
6
6
  PipelineSecrets
7
- } from "./index-e9b3zh22.js";
7
+ } from "./index-myc22sgv.js";
8
8
  import {
9
9
  PkgExecutor
10
10
  } from "./index-wcej7g4z.js";
11
11
  import {
12
+ UpdatePackFolder,
12
13
  NativePublicEnv,
13
- UpdatePackFolder
14
- } from "./index-ds2tmxgx.js";
14
+ NativeApp
15
+ } from "./index-5max10jx.js";
15
16
  import {
16
17
  script
17
18
  } from "./index-3wypz6xj.js";
18
19
  import {
19
20
  ApplicationScript
20
- } from "./index-12ny6e0x.js";
21
+ } from "./index-pa3c2mb8.js";
21
22
  import {
22
23
  PackageScript
23
24
  } from "./index-42j4a8zq.js";
24
25
  import {
25
26
  CloudRunner
26
- } from "./index-jhbkzc8c.js";
27
+ } from "./index-0p37cz91.js";
27
28
 
28
29
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
29
30
  import { Logger } from "akanjs/common";
@@ -93,6 +94,7 @@ class CloudScript2 extends script("cloud", [CloudRunner, ApplicationScript, Pack
93
94
  }
94
95
  async pushUpdate(workspace, app, {
95
96
  platform,
97
+ arch = null,
96
98
  target,
97
99
  env,
98
100
  channel,
@@ -104,6 +106,22 @@ class CloudScript2 extends script("cloud", [CloudRunner, ApplicationScript, Pack
104
106
  pack: packDir,
105
107
  publicEnv
106
108
  }) {
109
+ if (platform && platform !== "ios" && platform !== "android") {
110
+ if (packDir || publicEnv)
111
+ throw new Error("--pack and --public-env take a phone's web bundle; a desktop release goes up as `akan publish-update` wrote it.");
112
+ return await this.#pushRelease(workspace, app, platform, {
113
+ arch,
114
+ target,
115
+ env: env ?? "main",
116
+ channel,
117
+ notes,
118
+ subspace,
119
+ given,
120
+ allowLocalRelease
121
+ });
122
+ }
123
+ if (arch)
124
+ throw new Error("--arch picks a desktop release's CPU; a phone's update is its web bundle.");
107
125
  if (packDir && publicEnv)
108
126
  throw new Error("--public-env picks what a pack is built with, and --pack uploads one already built: give one.");
109
127
  const devProjectId = await this.cloudRunner.projectOf(workspace, subspace, app.name);
@@ -116,6 +134,35 @@ class CloudScript2 extends script("cloud", [CloudRunner, ApplicationScript, Pack
116
134
  notes
117
135
  });
118
136
  }
137
+ async#pushRelease(workspace, app, platform, {
138
+ arch,
139
+ target,
140
+ env,
141
+ channel,
142
+ notes,
143
+ subspace,
144
+ given,
145
+ allowLocalRelease
146
+ }) {
147
+ const hostArch = process.arch === "arm64" || process.arch === "x64" ? process.arch : null;
148
+ const cpu = arch ?? hostArch;
149
+ if (!cpu)
150
+ throw new Error(`This computer's CPU is ${process.arch}: name the release's with --arch arm64 or x64.`);
151
+ if (env === "local" && !allowLocalRelease)
152
+ throw new Error("A release with --env local is blocked. Pass --allow-local-release only for explicit local release testing.");
153
+ const devProjectId = await this.cloudRunner.projectOf(workspace, subspace, app.name);
154
+ const read = await this.cloudRunner.readRelease(app, {
155
+ platform: platform === "desktop" ? NativeApp.desktopPlatform() : platform,
156
+ arch: cpu,
157
+ target,
158
+ env,
159
+ channel
160
+ });
161
+ return await this.cloudRunner.pushRelease(await this.#cloudApi(workspace, given), devProjectId, app, {
162
+ ...read,
163
+ notes
164
+ });
165
+ }
119
166
  async#packToPush(app, {
120
167
  platform,
121
168
  target,
@@ -128,7 +175,7 @@ class CloudScript2 extends script("cloud", [CloudRunner, ApplicationScript, Pack
128
175
  if (packDir)
129
176
  return await this.cloudRunner.readPack(app, packDir, { platform, target, env, allowLocalRelease });
130
177
  if (!platform)
131
- throw new Error("push-update needs --platform ios or android to pack, or --pack <dir> to upload what `akan pack-update` wrote.");
178
+ throw new Error("push-update needs --platform ios or android to pack, or --pack <dir> to upload what `akan pack-update` wrote, or --platform desktop for the release `akan publish-update` wrote.");
132
179
  return await this.applicationScript.packUpdate(app, platform, {
133
180
  target: target ?? undefined,
134
181
  env: env ?? "main",
@@ -6,10 +6,10 @@ import {
6
6
  resolveMobileTargets
7
7
  } from "./index-m9jj544v.js";
8
8
  import {
9
- NativePublicEnv,
10
9
  UpdatePackFolder,
10
+ NativePublicEnv,
11
11
  NativeApp
12
- } from "./index-ds2tmxgx.js";
12
+ } from "./index-5max10jx.js";
13
13
  import {
14
14
  ExitCodeError
15
15
  } from "./index-3wypz6xj.js";
@@ -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,12 +389,13 @@ 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;
398
+ static maxAppBytes = 1024 * 1024 * 1024;
387
399
  static #transientPut = new Set([0, 408, 429, 500, 502, 503, 504]);
388
400
  static #putFloorBytesPerSecond = 64 * 1024;
389
401
  static #maxPutRetryAfterMs = 60000;
@@ -415,7 +427,10 @@ class UpdatePackUpload {
415
427
  }
416
428
  async stage(archive, fields) {
417
429
  const file = Bun.file(archive);
418
- if (file.size < 1 || file.size > UpdatePackUpload.maxBytes)
430
+ if (fields.kind === "app") {
431
+ if (file.size < 1 || file.size > UpdatePackUpload.maxAppBytes)
432
+ throw new Error(`The release archive is ${file.size} bytes; a project takes 1 byte to 1 GiB.`);
433
+ } else if (file.size < 1 || file.size > UpdatePackUpload.maxBytes)
419
434
  throw new Error(`The pack archive is ${file.size} bytes; a project takes 1 byte to 200 MiB.`);
420
435
  const hasher = new Bun.CryptoHasher("sha256");
421
436
  for await (const chunk of file.stream())
@@ -477,7 +492,7 @@ class UpdatePackUpload {
477
492
  const waitMs = Math.max(this.#commitRetryMs, error instanceof CloudHttpError && error.retryAfterMs || 0);
478
493
  if (now + waitMs > deadline)
479
494
  throw error;
480
- 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.`);
481
496
  await sleep(waitMs);
482
497
  }
483
498
  }
@@ -536,7 +551,7 @@ class CloudUpdates {
536
551
  const target = channel ?? pack.channel;
537
552
  return await UpdatePackFolder.withArchive(pack, async (archive) => {
538
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) => {
539
- 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`");
540
555
  });
541
556
  const label = `${pack.app} ${pack.target} ${pack.platform} on channel ${target}: release ${release.id}`;
542
557
  if (release.status === "rejected")
@@ -544,12 +559,44 @@ class CloudUpdates {
544
559
  ${(release.problems ?? []).map((problem) => ` - ${problem}`).join(`
545
560
  `)}`, 2);
546
561
  if (release.status === "published")
547
- Logger2.rawLog(`Published ${label} (${pack.files} files, native API ${pack.nativeApi}).`);
562
+ Logger3.rawLog(`Published ${label} (${pack.files} files, native API ${pack.nativeApi}).`);
548
563
  else
549
- 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.`);
550
565
  return release;
551
566
  });
552
567
  }
568
+ async pushRelease(release, {
569
+ appName,
570
+ target,
571
+ notes,
572
+ signer,
573
+ url
574
+ }) {
575
+ const { platform, arch, channel } = release;
576
+ return await release.withArchive(release.record(signer), async (archive) => {
577
+ const record = await new UpdatePackUpload(this.cloudApi, this.devProjectId).send(archive, { appName, target, platform, kind: "app", arch, channel, notes }).catch((error) => {
578
+ throw CloudUpdates.#refusal(error, "a release is uploaded by a project member signed in with `akan login`");
579
+ });
580
+ const label = `${appName} ${target} ${platform}-${arch} on channel ${channel}: release ${record.id}`;
581
+ const problems = (record.problems ?? []).map((problem) => ` - ${problem}`).join(`
582
+ `);
583
+ if (record.status === "rejected")
584
+ throw new ExitCodeError(`The project rejected ${label}:
585
+ ${problems}`, 2);
586
+ const manifestUrl = typeof record.manifestUrl === "string" ? record.manifestUrl : `${url}/${platform}-${arch}/${channel}.json`;
587
+ const what = `${label} (${release.manifest.bundle}, ${release.payloads.length + 3} files)`;
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}.`);
589
+ if (problems)
590
+ Logger3.rawLog(`The project noted:
591
+ ${problems}`);
592
+ return record;
593
+ });
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
+ }
553
600
  async registerBinary(app, pack, { distribution, env }) {
554
601
  const { cloudApi, devProjectId } = this;
555
602
  const bundlePath = await CloudUpdates.storeBundlePath(app, pack.target, pack.platform);
@@ -585,13 +632,13 @@ ${(release.problems ?? []).map((problem) => ` - ${problem}`).join(`
585
632
  }))).catch((error) => {
586
633
  throw CloudApi.refusal(error, "a binary is registered by a project member signed in with `akan login`");
587
634
  });
588
- 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}.`);
589
636
  return binary;
590
637
  });
591
638
  }
592
639
  }
593
640
  // pkgs/@akanjs/devkit/cloud/pipelineSecrets.ts
594
- import { capitalize, Logger as Logger3, PipelineNames } from "akanjs/common";
641
+ import { capitalize, Logger as Logger4, PipelineNames } from "akanjs/common";
595
642
  class PipelineSecrets {
596
643
  cloudApi;
597
644
  devProjectId;
@@ -628,7 +675,7 @@ class PipelineSecrets {
628
675
  unavailable: PipelineSecrets.#secretsUnavailable
629
676
  });
630
677
  });
631
- 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.`);
632
679
  }
633
680
  async list(branch) {
634
681
  PipelineSecrets.assertBranch(branch);
@@ -638,7 +685,7 @@ class PipelineSecrets {
638
685
  });
639
686
  });
640
687
  const secrets = listed.filter((secret) => !branch || secret.scope === "*" || secret.scope === branch);
641
- Logger3.rawLog(PipelineSecrets.format(secrets));
688
+ Logger4.rawLog(PipelineSecrets.format(secrets));
642
689
  }
643
690
  async remove({ name, branch }) {
644
691
  PipelineSecrets.assertName(name);
@@ -648,7 +695,7 @@ class PipelineSecrets {
648
695
  unavailable: PipelineSecrets.#secretsUnavailable
649
696
  });
650
697
  });
651
- 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.`);
652
699
  }
653
700
  static format(secrets) {
654
701
  if (!secrets.length)
@@ -52,18 +52,18 @@ import {
52
52
  PkgExecutor
53
53
  } from "./index-wcej7g4z.js";
54
54
  import {
55
- DesktopServerStage,
56
- UpdateUploader
57
- } from "./index-jg2xev75.js";
55
+ UpdatePackFolder,
56
+ UpdateUploader,
57
+ NativePublicEnv,
58
+ NativeApp
59
+ } from "./index-5max10jx.js";
60
+ import {
61
+ DesktopServerStage
62
+ } from "./index-qd5km521.js";
58
63
  import {
59
64
  resolveMobileTargets,
60
65
  resolveAppId
61
66
  } from "./index-m9jj544v.js";
62
- import {
63
- NativePublicEnv,
64
- UpdatePackFolder,
65
- NativeApp
66
- } from "./index-ds2tmxgx.js";
67
67
  import {
68
68
  LibraryScript
69
69
  } from "./index-2xcc2ax5.js";
@@ -2309,6 +2309,8 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
2309
2309
  const { publicKey, keyId, keyPath, created } = await new NativeApp(app, mobileTarget).updateKeygen(nativePlatform);
2310
2310
  app.log(`${appId}: ${created ? "made" : "read"} ${keyPath}${created ? " (keep it private and backed up: without it, installed apps take no more updates)" : ""}`);
2311
2311
  app.log(` native: { updates: { url: "https://\u2026/${app.name}", publicKeys: [${JSON.stringify(publicKey)}] } }`);
2312
+ if (platform === "desktop")
2313
+ app.log(" url: hosted on Akan Cloud, register this public key as an external key on the release screen and use the URL it gives; self-hosted, the public address you upload the release to");
2312
2314
  app.log(` keyId ${keyId}: what publish-update --revoke and updates.revokedKeys name this key by`);
2313
2315
  const { publicKey: one, publicKeys } = mobileTarget.config.updates ?? {};
2314
2316
  const declared = publicKeys ?? (one ? [one] : null);
@@ -3706,7 +3708,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
3706
3708
  await Promise.all(shares.map(async (share) => await share.close()));
3707
3709
  }, "Abandoning the tunnel release; the shares expire on their own.");
3708
3710
  await Promise.all(apps.map(async (app) => {
3709
- const { TunnelShare } = await import("./TunnelShare-mnn0jxnp.js");
3711
+ const { TunnelShare } = await import("./TunnelShare-2ef94kha.js");
3710
3712
  const share = await TunnelShare.open(app, { workspace: app.workspace });
3711
3713
  shares.push(share);
3712
3714
  urls.set(app.name, share.url);
@@ -1,8 +1,7 @@
1
1
  // @bun
2
2
  import {
3
- DesktopBin,
4
- UpdatePackFolder
5
- } from "./index-ds2tmxgx.js";
3
+ DesktopBin
4
+ } from "./index-5max10jx.js";
6
5
  // pkgs/@akanjs/devkit/mobile/desktopServerStage.ts
7
6
  import { cp, mkdir, readdir, rm, writeFile } from "fs/promises";
8
7
  import path from "path";
@@ -146,97 +145,4 @@ var isPlaceholderAppId = (appId) => {
146
145
  return true;
147
146
  return normalized.split(".").some((segment) => placeholderAppIdSegment.test(segment));
148
147
  };
149
- // pkgs/@akanjs/devkit/mobile/updateUploader.ts
150
- import { readdir as readdir2 } from "fs/promises";
151
- import path2 from "path";
152
- import { isRecord, trimTrailingSlashes } from "akanjs/common";
153
- class UpdateUploader {
154
- bucket;
155
- prefix;
156
- static #manifest = /\.json(?:\.sig)?$/;
157
- static parseTarget(target) {
158
- const match = /^s3:\/\/([^/]+)(?:\/(.*))?$/.exec(target.trim());
159
- if (!match?.[1])
160
- throw new Error(`--upload takes s3://<bucket>/<prefix>, not ${JSON.stringify(target)}.`);
161
- return { bucket: match[1], prefix: trimTrailingSlashes(match[2] ?? "") };
162
- }
163
- static order(files) {
164
- const manifests = files.filter((file) => UpdateUploader.#manifest.test(file));
165
- return {
166
- releases: files.filter((file) => !UpdateUploader.#manifest.test(file)).sort((a, b) => a.localeCompare(b)),
167
- manifests: manifests.sort((a, b) => Number(a.endsWith(".json")) - Number(b.endsWith(".json")) || a.localeCompare(b))
168
- };
169
- }
170
- static async releaseFiles(updatesDir, { dir, channel, bundle }) {
171
- const keyOf = (file) => UpdateUploader.#keyOf(updatesDir, dir, file);
172
- const desktop = await UpdateUploader.#read(path2.join(dir, `${channel}.json`));
173
- if (desktop?.bundle === bundle) {
174
- const archive = desktop.archive?.url;
175
- const patches = UpdateUploader.#field(desktop.patches, "url");
176
- return [archive, ...patches, `${channel}.json.sig`, `${channel}.json`].map(keyOf);
177
- }
178
- const names = await readdir2(path2.join(dir, channel)).catch(() => []);
179
- for (const name of names.filter((name) => name.endsWith(".json"))) {
180
- const envelope = await UpdateUploader.#read(path2.join(dir, channel, name));
181
- const manifest = typeof envelope?.manifest === "string" ? UpdateUploader.#parse(Buffer.from(envelope.manifest, "base64").toString("utf8")) : null;
182
- if (manifest?.bundle !== bundle)
183
- continue;
184
- const hashes = [...new Set(UpdateUploader.#field(manifest.files, "sha256"))];
185
- if (!hashes.every((hash) => typeof hash === "string" && /^[0-9a-f]{64}$/.test(hash)))
186
- throw new Error(`${path2.join(dir, channel, name)} lists a file whose sha256 is not 64 hex digits; nothing was uploaded.`);
187
- return [...hashes.map((hash) => `${UpdatePackFolder.filesDir}/${hash}`), `${channel}/${name}`].map(keyOf);
188
- }
189
- throw new Error(`${dir} holds no ${channel} manifest of release ${bundle}; nothing was uploaded.`);
190
- }
191
- static #keyOf(updatesDir, dir, file) {
192
- const resolved = typeof file === "string" ? path2.resolve(dir, file) : "";
193
- const key = path2.relative(updatesDir, resolved);
194
- if (!resolved.startsWith(`${path2.resolve(dir)}${path2.sep}`) || key.startsWith("..") || path2.isAbsolute(key))
195
- throw new Error(`The release in ${dir} names ${typeof file === "string" ? JSON.stringify(file) : "a file with no path"}, which is not inside that folder; nothing was uploaded.`);
196
- return key.split(path2.sep).join("/");
197
- }
198
- static #field(list, key) {
199
- return Array.isArray(list) ? list.map((item) => isRecord(item) ? item[key] : undefined) : [];
200
- }
201
- static async#read(file) {
202
- const text = await Bun.file(file).text().catch(() => "");
203
- return UpdateUploader.#parse(text);
204
- }
205
- static #parse(text) {
206
- try {
207
- const value = JSON.parse(text);
208
- return isRecord(value) ? value : null;
209
- } catch {
210
- return null;
211
- }
212
- }
213
- constructor(bucket, prefix) {
214
- this.bucket = bucket;
215
- this.prefix = prefix;
216
- }
217
- static forTarget(target) {
218
- const { bucket, prefix } = UpdateUploader.parseTarget(target);
219
- return new UpdateUploader(new Bun.S3Client({ bucket }), prefix);
220
- }
221
- async upload(updatesDir, release) {
222
- const { releases, manifests } = UpdateUploader.order(await UpdateUploader.releaseFiles(updatesDir, release));
223
- const keyOf = (file) => this.prefix ? `${this.prefix}/${file}` : file;
224
- let uploaded = 0;
225
- let skipped = 0;
226
- for (const file of releases) {
227
- if (await this.bucket.exists(keyOf(file))) {
228
- skipped++;
229
- continue;
230
- }
231
- await this.bucket.write(keyOf(file), Bun.file(path2.join(updatesDir, file)));
232
- uploaded++;
233
- }
234
- for (const file of manifests) {
235
- const type = file.endsWith(".json") ? "application/json" : "text/plain";
236
- await this.bucket.write(keyOf(file), Bun.file(path2.join(updatesDir, file)), { type });
237
- uploaded++;
238
- }
239
- return { uploaded, skipped };
240
- }
241
- }
242
- export { DesktopServerStage, isPlaceholderAppId, UpdateUploader };
148
+ export { DesktopServerStage, isPlaceholderAppId };
@@ -10,7 +10,7 @@ import {
10
10
  } from "./index-3wypz6xj.js";
11
11
  import {
12
12
  ContextRunner2
13
- } from "./index-kr9vpvdn.js";
13
+ } from "./index-8w76g4rm.js";
14
14
 
15
15
  // pkgs/@akanjs/cli/context/context.script.ts
16
16
  import { Logger } from "akanjs/common";
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-5rc8f0wt.js")).WorkspaceCommand,
25
+ workspace: async () => (await import("./workspace.command-tsc99yec.js")).WorkspaceCommand,
26
26
  agent: async () => (await import("./agent.command-ydftceda.js")).AgentCommand,
27
- code: async () => (await import("./code.command-4kqbrjt9.js")).CodeCommand,
28
- application: async () => (await import("./application.command-fdghyjfj.js")).ApplicationCommand,
27
+ code: async () => (await import("./code.command-719k3e9q.js")).CodeCommand,
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-bajag7gm.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
- context: async () => (await import("./context.command-h56yvjay.js")).ContextCommand,
35
- cloud: async () => (await import("./cloud.command-eyxwxnrn.js")).CloudCommand,
36
- subspace: async () => (await import("./subspace.command-dzpfbc99.js")).SubspaceCommand,
34
+ context: async () => (await import("./context.command-c4t4z1vy.js")).ContextCommand,
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-cfw6f0vz.js")).TunnelCommand
44
+ tunnel: async () => (await import("./tunnel.command-kxv0ddmp.js")).TunnelCommand
45
45
  };
46
46
  var commandModuleIds = Object.keys(commandModules);
47
47
 
@@ -10,21 +10,21 @@ import {
10
10
  PkgExecutor
11
11
  } from "./index-wcej7g4z.js";
12
12
  import"./index-5nd1wtkv.js";
13
- import"./index-jg2xev75.js";
13
+ import"./index-5max10jx.js";
14
+ import"./index-qd5km521.js";
14
15
  import"./index-m9jj544v.js";
15
- import"./index-ds2tmxgx.js";
16
16
  import"./index-xb8809yb.js";
17
17
  import"./index-0fz95kxe.js";
18
18
  import"./index-2xcc2ax5.js";
19
19
  import {
20
20
  ApplicationScript
21
- } from "./index-12ny6e0x.js";
21
+ } from "./index-pa3c2mb8.js";
22
22
  import"./index-7md2g9vw.js";
23
- import"./index-e9b3zh22.js";
23
+ import"./index-myc22sgv.js";
24
24
  import {
25
25
  getNpmRegistryUrl,
26
26
  CloudRunner
27
- } from "./index-jhbkzc8c.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.6",
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.6",
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,9 +17,9 @@ import {
17
17
  } from "./index-wcej7g4z.js";
18
18
  import {
19
19
  GlobalConfig
20
- } from "./index-e9b3zh22.js";
20
+ } from "./index-myc22sgv.js";
21
21
  import"./index-m9jj544v.js";
22
- import"./index-ds2tmxgx.js";
22
+ import"./index-5max10jx.js";
23
23
  import"./index-xb8809yb.js";
24
24
  import"./index-0fz95kxe.js";
25
25
  import {
@@ -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-c9f92bev.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-e9b3zh22.js";
15
+ } from "./index-myc22sgv.js";
16
16
  import"./index-m9jj544v.js";
17
- import"./index-ds2tmxgx.js";
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-zz4vrw85.js";
22
+ } from "./index-hmmv2cah.js";
23
23
  import {
24
24
  writeClipboard
25
25
  } from "./index-p6pbz9n5.js";