@akanjs/cli 3.1.1-rc.0 → 3.1.1-rc.10

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 (78) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-4pnxwptq.js → CodeAgent-8d5qs787.js} +2 -2
  3. package/{CodeTui-hhndze8h.js → CodeTui-z5vkm9ea.js} +1 -1
  4. package/TunnelShare-qkm8zp03.js +14 -0
  5. package/{agent.command-p02330r6.js → agent.command-ydftceda.js} +5 -5
  6. package/akanCode.js +2 -2
  7. package/{application.command-ywks5ywm.js → application.command-wthg8nn9.js} +18 -13
  8. package/{applicationBuildRunner-9cnnsdm5.js → applicationBuildRunner-t2r84sz6.js} +72 -26
  9. package/buildBatch.proc.js +5 -5
  10. package/{cloud.command-1tzkvje1.js → cloud.command-sz11hpre.js} +22 -17
  11. package/cloud.script-nqevg5qw.js +24 -0
  12. package/{code.command-16pm1p2v.js → code.command-9h3yrzhe.js} +6 -6
  13. package/{context.command-6ys86sqf.js → context.command-15j9b7c0.js} +16 -16
  14. package/context.runner-8gg030b0.js +25 -0
  15. package/{guideline.command-3zay3d8g.js → guideline.command-snh85ctf.js} +2 -2
  16. package/guidelines/agentRule/agentRule.instruction.md +21 -4
  17. package/guidelines/conventions/conventions.instruction.md +17 -10
  18. package/guidelines/mcpRule/mcpRule.instruction.md +13 -6
  19. package/guidelines/pageRule/pageRule.instruction.md +21 -5
  20. package/guidelines/queryRule/queryRule.instruction.md +13 -1
  21. package/guidelines/runtimeRule/runtimeRule.instruction.md +20 -2
  22. package/guidelines/ssrRule/ssrRule.instruction.md +6 -1
  23. package/guidelines/transportRule/transportRule.instruction.md +12 -5
  24. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +2 -1
  25. package/incrementalBuilder.proc.js +3 -3
  26. package/{index-jgs8z8xb.js → index-0fz95kxe.js} +1 -1
  27. package/{index-1f33g2z5.js → index-2azahjaw.js} +81 -28
  28. package/{index-kcbq2qcf.js → index-2mwc0g0d.js} +1 -1
  29. package/{index-qkcwsg6r.js → index-2xcc2ax5.js} +2 -2
  30. package/{index-68c3gzvg.js → index-301pdbzz.js} +56 -9
  31. package/{index-z6v7k9sb.js → index-31es1yev.js} +24 -2
  32. package/{index-p4dnj2wc.js → index-3wypz6xj.js} +59 -8
  33. package/{index-e9e9cebg.js → index-40brg4px.js} +3 -3
  34. package/{index-tk3jg2bm.js → index-42j4a8zq.js} +2 -2
  35. package/{index-1mfyyxh5.js → index-4vgbysa0.js} +3 -3
  36. package/{index-9hbhm6cs.js → index-55j120r8.js} +1 -1
  37. package/{index-vg28jsf9.js → index-6txx6a9p.js} +214 -71
  38. package/{index-zn6bn1s2.js → index-74tjjsnc.js} +4 -4
  39. package/{index-g2s33373.js → index-905qdgqp.js} +1 -1
  40. package/{index-qtkycaqn.js → index-9th4gszy.js} +38 -21
  41. package/{index-bb4hj03s.js → index-a58emady.js} +10 -10
  42. package/{index-4w3skd33.js → index-a5dhqkdr.js} +3 -3
  43. package/{index-sh9mmp5v.js → index-b70zct19.js} +7 -7
  44. package/{index-z9xepn8t.js → index-bt438yxm.js} +556 -142
  45. package/{index-ngpn9hzy.js → index-espk51ah.js} +2 -2
  46. package/{index-b5vptvnt.js → index-hmt54t45.js} +4 -4
  47. package/{index-qfzfaq96.js → index-j9vyj3dj.js} +3 -3
  48. package/{index-ekpp5tax.js → index-js6geqjn.js} +4 -97
  49. package/{index-fmder14z.js → index-pcwzkdqb.js} +1 -1
  50. package/{index-jaa81e9r.js → index-qfp55x1y.js} +4 -4
  51. package/{index-sng3vt0p.js → index-skk9zc1x.js} +2 -2
  52. package/{index-rr7jk14m.js → index-wcej7g4z.js} +13 -10
  53. package/{index-q8age5az.js → index-xb8809yb.js} +2 -2
  54. package/{index-ynqxpwx6.js → index-xjf5j657.js} +1 -1
  55. package/index.js +22 -22
  56. package/{library.command-a8n9h8j4.js → library.command-gycrwhf1.js} +3 -3
  57. package/{localRegistry.command-1e6m7w2f.js → localRegistry.command-jtd8gaes.js} +12 -12
  58. package/{module.command-b6f1p1xa.js → module.command-v6hgs1bc.js} +5 -5
  59. package/{package.command-tc27ftmy.js → package.command-shzpcfph.js} +3 -3
  60. package/package.json +2 -2
  61. package/{page.command-m5wyqfkd.js → page.command-ptxn5kqk.js} +3 -3
  62. package/{pipeline.command-4qxyafpz.js → pipeline.command-zz31pgax.js} +2 -2
  63. package/{primitive.command-9yaatk0d.js → primitive.command-a1vse91z.js} +6 -6
  64. package/{projectTypecheck-87k6z6ab.js → projectTypecheck-2ztky9cf.js} +1 -1
  65. package/{quality.command-ht1wjhv8.js → quality.command-ah8qcakd.js} +387 -73
  66. package/{repair.command-evg9g911.js → repair.command-cvazbz99.js} +5 -5
  67. package/{scalar.command-xsejjeq1.js → scalar.command-0acvyp26.js} +4 -4
  68. package/{subspace.command-ps12q5y7.js → subspace.command-822qx2bx.js} +8 -8
  69. package/templates/app/tsconfig.json.template +2 -7
  70. package/templates/env/_env.server.type.ts +10 -5
  71. package/templates/facetIndex/index.ts +2 -2
  72. package/templates/workspaceRoot/bunfig.toml.template +0 -4
  73. package/{tunnel.command-khzgvrj8.js → tunnel.command-ycmja19q.js} +7 -7
  74. package/{workflow.command-qpyq0ya5.js → workflow.command-abb1d5xy.js} +10 -10
  75. package/{workspace.command-3dq7e9g2.js → workspace.command-qm7cw29v.js} +33 -32
  76. package/TunnelShare-zmq6bbar.js +0 -14
  77. package/cloud.script-8g83xqdg.js +0 -24
  78. package/context.runner-3jrypwe3.js +0 -25
@@ -6,17 +6,20 @@ 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-z9xepn8t.js";
12
+ } from "./index-bt438yxm.js";
13
13
  import {
14
14
  ExitCodeError
15
- } from "./index-p4dnj2wc.js";
15
+ } from "./index-3wypz6xj.js";
16
16
  import {
17
17
  ConfigLock
18
18
  } from "./index-bqbf654f.js";
19
19
 
20
+ // pkgs/@akanjs/devkit/cloud/cloudApi.ts
21
+ import { isRecord as isRecord2, Logger } from "akanjs/common";
22
+
20
23
  // pkgs/@akanjs/devkit/cloud/cloudHttpError.ts
21
24
  import { isRecord } from "akanjs/common";
22
25
 
@@ -43,9 +46,17 @@ class CloudHttpError extends Error {
43
46
  return error instanceof CloudHttpError ? error.status : null;
44
47
  }
45
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() {
46
57
  try {
47
58
  const parsed = JSON.parse(this.body);
48
- return isRecord(parsed) && typeof parsed.error === "string" ? parsed.error : null;
59
+ return isRecord(parsed) ? parsed : null;
49
60
  } catch {
50
61
  return null;
51
62
  }
@@ -271,13 +282,17 @@ class CloudApi {
271
282
  return new Error("The server did not accept your sign-in: run `akan login`, then try again.", { cause: error });
272
283
  if (error.status === 403)
273
284
  return new Error(`The project refused: ${who}.`, { cause: error });
274
- if (error.status === 400)
275
- 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
+ }
276
290
  const { errKey } = error;
277
291
  if (error.status === 503 && unavailable && errKey && errKey !== "base.error.serverUnavailable")
278
292
  return new Error(`${unavailable}: ${errKey}.`, { cause: error });
279
293
  return error;
280
294
  }
295
+ static #remoteAuthTimeoutMs = 20000;
281
296
  #api;
282
297
  #accessToken = null;
283
298
  #workspace;
@@ -345,11 +360,14 @@ class CloudApi {
345
360
  return localPath;
346
361
  }
347
362
  async getRemoteAuthToken(remoteId) {
348
- try {
349
- return this.#authorize(await this.#api.get(`/getRemoteAuthToken/${remoteId}`));
350
- } catch (_) {
363
+ const answer = await this.#api.get(`/getRemoteAuthToken/${encodeURIComponent(remoteId)}`, {
364
+ signal: AbortSignal.timeout(CloudApi.#remoteAuthTimeoutMs)
365
+ });
366
+ if (answer === null)
351
367
  return null;
352
- }
368
+ if (!isRecord2(answer) || typeof answer.jwt !== "string" || !answer.jwt)
369
+ throw new Error(`${this.host} answered the sign-in poll with something other than a session.`);
370
+ return this.#authorize(answer);
353
371
  }
354
372
  async refreshAuthToken(refreshToken) {
355
373
  return this.#authorize(await this.#api.post(`/refreshAuthToken`, { refreshToken }, { signal: AbortSignal.timeout(20000) }));
@@ -364,21 +382,20 @@ class CloudApi {
364
382
  return await this.#api.post(`/tunnel/revokeTunnel`, { code }, { signal: AbortSignal.timeout(5000) });
365
383
  }
366
384
  async getRemoteSelf() {
367
- try {
368
- return await this.#api.get(`/getRemoteSelf`);
369
- } catch {
370
- return null;
371
- }
385
+ return await this.#api.get(`/getRemoteSelf`, {
386
+ signal: AbortSignal.timeout(CloudApi.#remoteAuthTimeoutMs)
387
+ });
372
388
  }
373
389
  }
374
390
  // pkgs/@akanjs/devkit/cloud/cloudUpdates.ts
375
391
  import path2 from "path";
376
- import { Logger as Logger2 } from "akanjs/common";
392
+ import { Logger as Logger3 } from "akanjs/common";
377
393
 
378
394
  // pkgs/@akanjs/devkit/cloud/updatePackUpload.ts
379
- import { Logger, sleep } from "akanjs/common";
395
+ import { Logger as Logger2, sleep } from "akanjs/common";
380
396
  class UpdatePackUpload {
381
397
  static maxBytes = 200 * 1024 * 1024;
398
+ static maxAppBytes = 1024 * 1024 * 1024;
382
399
  static #transientPut = new Set([0, 408, 429, 500, 502, 503, 504]);
383
400
  static #putFloorBytesPerSecond = 64 * 1024;
384
401
  static #maxPutRetryAfterMs = 60000;
@@ -410,7 +427,10 @@ class UpdatePackUpload {
410
427
  }
411
428
  async stage(archive, fields) {
412
429
  const file = Bun.file(archive);
413
- 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)
414
434
  throw new Error(`The pack archive is ${file.size} bytes; a project takes 1 byte to 200 MiB.`);
415
435
  const hasher = new Bun.CryptoHasher("sha256");
416
436
  for await (const chunk of file.stream())
@@ -472,7 +492,7 @@ class UpdatePackUpload {
472
492
  const waitMs = Math.max(this.#commitRetryMs, error instanceof CloudHttpError && error.retryAfterMs || 0);
473
493
  if (now + waitMs > deadline)
474
494
  throw error;
475
- 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.`);
476
496
  await sleep(waitMs);
477
497
  }
478
498
  }
@@ -531,7 +551,7 @@ class CloudUpdates {
531
551
  const target = channel ?? pack.channel;
532
552
  return await UpdatePackFolder.withArchive(pack, async (archive) => {
533
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) => {
534
- 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`");
535
555
  });
536
556
  const label = `${pack.app} ${pack.target} ${pack.platform} on channel ${target}: release ${release.id}`;
537
557
  if (release.status === "rejected")
@@ -539,12 +559,45 @@ class CloudUpdates {
539
559
  ${(release.problems ?? []).map((problem) => ` - ${problem}`).join(`
540
560
  `)}`, 2);
541
561
  if (release.status === "published")
542
- Logger2.rawLog(`Published ${label} (${pack.files} files, native API ${pack.nativeApi}).`);
562
+ Logger3.rawLog(`Published ${label} (${pack.files} files, native API ${pack.nativeApi}).`);
543
563
  else
544
- 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.`);
545
565
  return release;
546
566
  });
547
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}/app.json`;
587
+ const files = 1 + release.manifestFiles.length + release.payloads.length;
588
+ const what = `${label} (${release.manifest.bundle}, ${files} files)`;
589
+ 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}.`);
590
+ if (problems)
591
+ Logger3.rawLog(`The project noted:
592
+ ${problems}`);
593
+ return record;
594
+ });
595
+ }
596
+ static #refusal(error, who) {
597
+ const refusal = CloudApi.refusal(error, who);
598
+ const verdict = error instanceof CloudHttpError && error.status === 400 && !!error.errKey?.startsWith("release.error.");
599
+ return verdict && refusal instanceof Error ? new ExitCodeError(refusal.message, 2) : refusal;
600
+ }
548
601
  async registerBinary(app, pack, { distribution, env }) {
549
602
  const { cloudApi, devProjectId } = this;
550
603
  const bundlePath = await CloudUpdates.storeBundlePath(app, pack.target, pack.platform);
@@ -580,13 +633,13 @@ ${(release.problems ?? []).map((problem) => ` - ${problem}`).join(`
580
633
  }))).catch((error) => {
581
634
  throw CloudApi.refusal(error, "a binary is registered by a project member signed in with `akan login`");
582
635
  });
583
- Logger2.rawLog(`Registered ${pack.app} ${pack.target} ${pack.platform} (${distribution}): binary ${binary.id}, native API ${pack.nativeApi}.`);
636
+ Logger3.rawLog(`Registered ${pack.app} ${pack.target} ${pack.platform} (${distribution}): binary ${binary.id}, native API ${pack.nativeApi}.`);
584
637
  return binary;
585
638
  });
586
639
  }
587
640
  }
588
641
  // pkgs/@akanjs/devkit/cloud/pipelineSecrets.ts
589
- import { capitalize, Logger as Logger3, PipelineNames } from "akanjs/common";
642
+ import { capitalize, Logger as Logger4, PipelineNames } from "akanjs/common";
590
643
  class PipelineSecrets {
591
644
  cloudApi;
592
645
  devProjectId;
@@ -623,7 +676,7 @@ class PipelineSecrets {
623
676
  unavailable: PipelineSecrets.#secretsUnavailable
624
677
  });
625
678
  });
626
- Logger3.rawLog(`Saved ${saved.name} for ${saved.scope === "*" ? "every branch" : `branch ${saved.scope}`}. Builds that start from now on use it.`);
679
+ Logger4.rawLog(`Saved ${saved.name} for ${saved.scope === "*" ? "every branch" : `branch ${saved.scope}`}. Builds that start from now on use it.`);
627
680
  }
628
681
  async list(branch) {
629
682
  PipelineSecrets.assertBranch(branch);
@@ -633,7 +686,7 @@ class PipelineSecrets {
633
686
  });
634
687
  });
635
688
  const secrets = listed.filter((secret) => !branch || secret.scope === "*" || secret.scope === branch);
636
- Logger3.rawLog(PipelineSecrets.format(secrets));
689
+ Logger4.rawLog(PipelineSecrets.format(secrets));
637
690
  }
638
691
  async remove({ name, branch }) {
639
692
  PipelineSecrets.assertName(name);
@@ -643,7 +696,7 @@ class PipelineSecrets {
643
696
  unavailable: PipelineSecrets.#secretsUnavailable
644
697
  });
645
698
  });
646
- Logger3.rawLog(removed ? `Removed ${name} for ${branch ? `branch ${branch}` : "every branch"}.` : `No ${name} for ${branch ? `branch ${branch}` : "every branch"} to remove.`);
699
+ Logger4.rawLog(removed ? `Removed ${name} for ${branch ? `branch ${branch}` : "every branch"}.` : `No ${name} for ${branch ? `branch ${branch}` : "every branch"} to remove.`);
647
700
  }
648
701
  static format(secrets) {
649
702
  if (!secrets.length)
@@ -664,4 +717,4 @@ class PipelineSecrets {
664
717
  throw new Error(`--branch ${branch} is not a deployed branch: ${PipelineSecrets.#secretBranches.join(", ")}.`);
665
718
  }
666
719
  }
667
- export { getDefaultHostConfig, GlobalConfig, CloudApi, CloudUpdates, PipelineSecrets };
720
+ export { CloudHttpError, getDefaultHostConfig, GlobalConfig, CloudApi, CloudUpdates, PipelineSecrets };
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  GlobalConfig,
4
4
  CloudApi
5
- } from "./index-1f33g2z5.js";
5
+ } from "./index-2azahjaw.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/tunnel/TunnelShare.ts
8
8
  import { TunnelAgent } from "akanjs/server/tunnel";
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-p4dnj2wc.js";
5
+ } from "./index-3wypz6xj.js";
6
6
  import {
7
7
  LibSource,
8
8
  formatLibStatuses,
9
9
  CommandExecutionError,
10
10
  LibExecutor
11
- } from "./index-rr7jk14m.js";
11
+ } from "./index-wcej7g4z.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/library/library.script.ts
14
14
  import { Logger } from "akanjs/common";
@@ -4,26 +4,27 @@ import {
4
4
  CloudApi,
5
5
  CloudUpdates,
6
6
  PipelineSecrets
7
- } from "./index-1f33g2z5.js";
7
+ } from "./index-2azahjaw.js";
8
8
  import {
9
9
  PkgExecutor
10
- } from "./index-rr7jk14m.js";
10
+ } from "./index-wcej7g4z.js";
11
11
  import {
12
+ UpdatePackFolder,
12
13
  NativePublicEnv,
13
- UpdatePackFolder
14
- } from "./index-z9xepn8t.js";
14
+ NativeApp
15
+ } from "./index-bt438yxm.js";
15
16
  import {
16
17
  script
17
- } from "./index-p4dnj2wc.js";
18
+ } from "./index-3wypz6xj.js";
18
19
  import {
19
20
  ApplicationScript
20
- } from "./index-qtkycaqn.js";
21
+ } from "./index-9th4gszy.js";
21
22
  import {
22
23
  PackageScript
23
- } from "./index-tk3jg2bm.js";
24
+ } from "./index-42j4a8zq.js";
24
25
  import {
25
26
  CloudRunner
26
- } from "./index-vg28jsf9.js";
27
+ } from "./index-6txx6a9p.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",
@@ -10,7 +10,7 @@ import {
10
10
  isScannedRootEntry,
11
11
  AppExecutor,
12
12
  LibExecutor
13
- } from "./index-rr7jk14m.js";
13
+ } from "./index-wcej7g4z.js";
14
14
  import {
15
15
  FileSys2
16
16
  } from "./index-52w0fvh8.js";
@@ -23,7 +23,7 @@ import {
23
23
  workflowPathsForPlan,
24
24
  workflowRunArtifactPath,
25
25
  workflowSyncDir
26
- } from "./index-ynqxpwx6.js";
26
+ } from "./index-xjf5j657.js";
27
27
 
28
28
  // pkgs/@akanjs/devkit/akanContext.ts
29
29
  import { readdir } from "fs/promises";
@@ -372,6 +372,25 @@ class AkanContextAnalyzer {
372
372
  hint
373
373
  };
374
374
  }
375
+ static async#configLeftovers(workspace, sysPaths) {
376
+ const leftovers = [];
377
+ for (const sysPath of sysPaths) {
378
+ const tsconfigPath = `${sysPath}/tsconfig.json`;
379
+ const tsconfig = await safeReadText(path.join(workspace.workspaceRoot, tsconfigPath));
380
+ if (tsconfig && (/"name"\s*:\s*"next"/.test(tsconfig) || tsconfig.includes(".next/types")))
381
+ leftovers.push({
382
+ path: tsconfigPath,
383
+ message: `${tsconfigPath} still names the Next.js TS plugin or .next/types, which Akan never uses \u2014 delete the "next" plugin entry and the ".next/types/**/*.ts" include.`
384
+ });
385
+ }
386
+ const bunfig = await safeReadText(path.join(workspace.workspaceRoot, "bunfig.toml"));
387
+ if (bunfig?.includes("bun-plugin-tailwind"))
388
+ leftovers.push({
389
+ path: "bunfig.toml",
390
+ message: "bunfig.toml still loads bun-plugin-tailwind, which is not installed and which Akan never uses (it compiles Tailwind itself) \u2014 delete the [serve.static] section, which Akan never reads."
391
+ });
392
+ return leftovers;
393
+ }
375
394
  static async doctor(workspace, {
376
395
  strict = false,
377
396
  runIdOrPlan = null,
@@ -415,6 +434,9 @@ class AkanContextAnalyzer {
415
434
  const agentDrift = await AkanContextAnalyzer.#agentGuideDrift(workspace);
416
435
  if (agentDrift)
417
436
  report({ severity: "warning", code: agentDrift.code, path: "AGENTS.md", message: agentDrift.message }, repairAction("generated", "akan agent install agents-md", agentDrift.hint, true));
437
+ const sysPaths = [...context.apps, ...context.libs].map((sys) => sys.path);
438
+ for (const leftover of await AkanContextAnalyzer.#configLeftovers(workspace, sysPaths))
439
+ diagnostics.push({ severity: "warning", code: "config-leftover", ...leftover });
418
440
  for (const sys of [...context.apps, ...context.libs]) {
419
441
  for (const module of sys.modules) {
420
442
  const moduleShapeCommand = `akan repair module-shape --app ${sys.name} --module ${module.name}`;
@@ -10,7 +10,7 @@ import {
10
10
  LibExecutor,
11
11
  PkgExecutor,
12
12
  ModuleExecutor
13
- } from "./index-rr7jk14m.js";
13
+ } from "./index-wcej7g4z.js";
14
14
 
15
15
  // pkgs/@akanjs/devkit/commandDecorators/camelToKebabCase.ts
16
16
  var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
@@ -60,7 +60,7 @@ var Pkg = createInternalArgToken("Pkg");
60
60
  var Module = createInternalArgToken("Module");
61
61
  var Workspace = createInternalArgToken("Workspace");
62
62
  // pkgs/@akanjs/devkit/commandDecorators/command.ts
63
- import path2 from "path";
63
+ import path3 from "path";
64
64
  import { Logger } from "akanjs/common";
65
65
  import chalk2 from "chalk";
66
66
  import { program } from "commander";
@@ -299,6 +299,59 @@ var formatCommandHelp = (command, key) => {
299
299
  `);
300
300
  };
301
301
 
302
+ // pkgs/@akanjs/devkit/commandDecorators/workspaceVersionCheck.ts
303
+ import { existsSync, readFileSync, realpathSync } from "fs";
304
+ import path2 from "path";
305
+
306
+ class WorkspaceVersionCheck {
307
+ static #exemptCommands = new Set(["update", "create-workspace"]);
308
+ static #infoFlags = new Set(["--help", "-h", "--version", "-V"]);
309
+ static #updateTags = new Set(["dev", "canary", "beta", "rc", "alpha"]);
310
+ static warning(cliVersion, argv, workspaceRoot) {
311
+ const args = argv.slice(2);
312
+ if (!cliVersion || WorkspaceVersionCheck.#exemptCommands.has(args[0] ?? ""))
313
+ return null;
314
+ if (args.some((arg) => WorkspaceVersionCheck.#infoFlags.has(arg)))
315
+ return null;
316
+ const installed = WorkspaceVersionCheck.installedAkanVersion(workspaceRoot);
317
+ if (!installed || installed === cliVersion)
318
+ return null;
319
+ const pinnedCli = WorkspaceVersionCheck.#versionAt(path2.join(workspaceRoot, "node_modules/@akanjs/cli"));
320
+ const runner = pinnedCli === installed ? ["bunx"] : ["bunx", "-p", `@akanjs/cli@${installed}`];
321
+ const rerun = [...runner, "akan", ...args].map(WorkspaceVersionCheck.#quote).join(" ");
322
+ const [, prerelease = ""] = cliVersion.split("-");
323
+ const tag = prerelease.split(".")[0];
324
+ const update = `akan update${WorkspaceVersionCheck.#updateTags.has(tag) ? ` --tag ${tag}` : ""}`;
325
+ const lines = [
326
+ `This akan is @akanjs/cli ${cliVersion}, but this workspace has akanjs ${installed}: what it generates may not match the installed framework.`,
327
+ `Run the matching CLI: ${rerun}`
328
+ ];
329
+ if (Bun.semver.order(cliVersion, installed) > 0)
330
+ lines.push(`Or move the workspace and this CLI to the newest release of the line together: ${update}`);
331
+ else if (pinnedCli !== installed)
332
+ lines.push(`Pin it so \`bunx akan\` runs it: bun add -d @akanjs/cli@${installed}`);
333
+ return lines.join(`
334
+ `);
335
+ }
336
+ static installedAkanVersion(workspaceRoot) {
337
+ const packageDir = path2.join(workspaceRoot, "node_modules", "akanjs");
338
+ if (!existsSync(packageDir))
339
+ return null;
340
+ if (!realpathSync(packageDir).split(path2.sep).includes("node_modules"))
341
+ return null;
342
+ return WorkspaceVersionCheck.#versionAt(packageDir);
343
+ }
344
+ static #versionAt(packageDir) {
345
+ const packageJsonPath = path2.join(packageDir, "package.json");
346
+ if (!existsSync(packageJsonPath))
347
+ return null;
348
+ return JSON.parse(readFileSync(packageJsonPath, "utf8")).version ?? null;
349
+ }
350
+ static #quote(arg) {
351
+ return /^[\w@%+=:,./-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'\\''`)}'`;
352
+ }
353
+ }
354
+
302
355
  // pkgs/@akanjs/devkit/commandDecorators/command.ts
303
356
  var loggedCliErrorObjects = new WeakSet;
304
357
  var loggedCliErrorMessages = new Set;
@@ -607,7 +660,7 @@ var runCommands = async (...commands) => {
607
660
  process.exit(ExitCodeError.codeOf(error) ?? failureExitCode);
608
661
  });
609
662
  const __dirname2 = getDirname2(import.meta.url);
610
- const packageJsonCandidates = [`${path2.dirname(Bun.main)}/package.json`, `${__dirname2}/../package.json`];
663
+ const packageJsonCandidates = [`${path3.dirname(Bun.main)}/package.json`, `${__dirname2}/../package.json`];
611
664
  let cliPackageJson = null;
612
665
  for (const packageJsonPath of packageJsonCandidates) {
613
666
  if (!await FileSys2.fileExists(packageJsonPath))
@@ -627,12 +680,10 @@ var runCommands = async (...commands) => {
627
680
  program.version(process.env.AKAN_VERSION).description("Akan CLI").configureHelp({
628
681
  helpWidth: 100
629
682
  });
630
- const installedAkanPackageJson = await FileSys2.fileExists("./node_modules/akanjs/package.json") ? await FileSys2.readJson("./node_modules/akanjs/package.json") : null;
631
- if (installedAkanPackageJson && installedAkanPackageJson.version !== process.env.AKAN_VERSION) {
683
+ const versionWarning = WorkspaceVersionCheck.warning(cliPackageJson?.version, process.argv, process.cwd());
684
+ if (versionWarning)
632
685
  Logger.rawLog(chalk2.yellow(`
633
- Akan CLI version is mismatch with installed package. ${process.env.AKAN_VERSION} (global) vs ${installedAkanPackageJson.version} (akanjs)
634
- It may cause unexpected behavior. Run \`akan update\` to update latest akanjs.`), undefined, "error");
635
- }
686
+ ${versionWarning}`), undefined, "error");
636
687
  for (const command of commands) {
637
688
  const targetMetas = getTargetMetas(command);
638
689
  for (const targetMeta of targetMetas) {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  resolveSsrPageEntriesForApp
4
- } from "./index-rr7jk14m.js";
4
+ } from "./index-wcej7g4z.js";
5
5
  import {
6
6
  computeRouteSeedIndex,
7
7
  saveRouteSeedIndex,
@@ -9,7 +9,7 @@ import {
9
9
  ClientEntriesBundler,
10
10
  VENDOR_SPECIFIERS,
11
11
  RouteClientBuilder
12
- } from "./index-ngpn9hzy.js";
12
+ } from "./index-espk51ah.js";
13
13
  import {
14
14
  SOURCE_EXTS
15
15
  } from "./index-5nd1wtkv.js";
@@ -19,7 +19,7 @@ import {
19
19
  createTsconfigPackageResolver,
20
20
  rewriteBarrelImports,
21
21
  PagesBundleBuilder
22
- } from "./index-jgs8z8xb.js";
22
+ } from "./index-0fz95kxe.js";
23
23
  import {
24
24
  CssBlockParser
25
25
  } from "./index-62md4dwy.js";
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-p4dnj2wc.js";
5
+ } from "./index-3wypz6xj.js";
6
6
  import {
7
7
  FileSys2
8
8
  } from "./index-52w0fvh8.js";
9
9
  import {
10
10
  PkgExecutor
11
- } from "./index-rr7jk14m.js";
11
+ } from "./index-wcej7g4z.js";
12
12
  import {
13
13
  TypeScriptDependencyScanner2
14
14
  } from "./index-tvehn2sp.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-p4dnj2wc.js";
5
+ } from "./index-3wypz6xj.js";
6
6
  import {
7
7
  AGENT_BLOCK_START,
8
8
  AGENT_BLOCK_END,
@@ -13,14 +13,14 @@ import {
13
13
  CLAUDE_COMMENT_RULE,
14
14
  AppExecutor,
15
15
  LibExecutor
16
- } from "./index-rr7jk14m.js";
16
+ } from "./index-wcej7g4z.js";
17
17
  import {
18
18
  collectRecipeSources2,
19
19
  scanRecipes2
20
20
  } from "./index-hj6w4ka1.js";
21
21
  import {
22
22
  AkanContextAnalyzer
23
- } from "./index-z6v7k9sb.js";
23
+ } from "./index-31es1yev.js";
24
24
  import {
25
25
  Prompter2
26
26
  } from "./index-zzvvc845.js";
@@ -179,7 +179,7 @@ class SubagentPool2 {
179
179
  }
180
180
  }
181
181
  async#run(id, kind, prompt, signal) {
182
- const { CodeAgent } = await import("./CodeAgent-4pnxwptq.js");
182
+ const { CodeAgent } = await import("./CodeAgent-8d5qs787.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({