@akanjs/cli 3.0.0-beta.30 → 3.0.0-beta.32

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 (85) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-xnfyyz8h.js → CodeAgent-2vmp9qe0.js} +2 -2
  3. package/{CodeTui-h66xb1fh.js → CodeTui-5ed6bg2a.js} +1 -1
  4. package/{agent.command-c4v7kjff.js → agent.command-gn73rhe7.js} +5 -5
  5. package/akanCode.js +2 -2
  6. package/{application.command-yzsswrz6.js → application.command-e968t0hw.js} +14 -9
  7. package/{applicationBuildRunner-qkt6spd5.js → applicationBuildRunner-64taxseg.js} +3 -3
  8. package/buildBatch.proc.js +3 -3
  9. package/{cloud.command-v8h688jc.js → cloud.command-0jm301rr.js} +9 -9
  10. package/cloud.script-nemnzjpv.js +20 -0
  11. package/{code.command-jff3tw7y.js → code.command-18kcm7hq.js} +6 -6
  12. package/{context.command-y5sevk3c.js → context.command-trd9bn18.js} +13 -13
  13. package/context.runner-y5hwh673.js +21 -0
  14. package/{guideline.command-11cndccb.js → guideline.command-bdmdn2de.js} +2 -2
  15. package/guidelines/conventions/conventions.instruction.md +7 -4
  16. package/guidelines/runtimeRule/runtimeRule.instruction.md +29 -6
  17. package/incrementalBuilder.proc.js +2 -2
  18. package/{index-mk3b9rk1.js → index-0wpybxtr.js} +3 -3
  19. package/{index-n3jk2501.js → index-3w94e7n3.js} +27 -4
  20. package/{index-wfwgcnyc.js → index-4npz05nm.js} +4 -4
  21. package/{index-6x9p8dpb.js → index-6he6gvfg.js} +1 -1
  22. package/{index-0ncc0mbk.js → index-93j60em0.js} +3 -3
  23. package/{index-tzc1gtrg.js → index-9z771ptz.js} +2 -2
  24. package/{index-hqd0h1pb.js → index-abxpehf8.js} +7 -7
  25. package/{index-a4s954kq.js → index-by9pxkr0.js} +2 -2
  26. package/{index-5rp0h6na.js → index-drehwpdt.js} +2 -2
  27. package/{index-rtwhw4aq.js → index-f3c78nd6.js} +7 -7
  28. package/{index-kb16nzyt.js → index-gbggbqcp.js} +96 -35
  29. package/{index-tsb0f8ya.js → index-hsmtysz4.js} +2 -2
  30. package/{index-35mmm9ca.js → index-jmrn54tt.js} +1 -1
  31. package/{index-376gpdds.js → index-kcdj1z5v.js} +2 -2
  32. package/{index-hf6f4xnb.js → index-kqabytj7.js} +4 -4
  33. package/{index-se643zvp.js → index-mbxbhay5.js} +1 -1
  34. package/{index-gxamdf18.js → index-mgxpx3f2.js} +2 -2
  35. package/{index-3rh7thcx.js → index-p993efkq.js} +33 -18
  36. package/{index-qcejqgts.js → index-pmhqttv3.js} +5 -5
  37. package/{index-8tv7356t.js → index-tqm7jjcn.js} +1 -1
  38. package/{index-xb7qhxa8.js → index-vpj42xwt.js} +1 -1
  39. package/{index-bxmejydw.js → index-wprnsjms.js} +3 -3
  40. package/{index-hmdq5pqm.js → index-y3mphr1m.js} +1 -1
  41. package/{index-167c77aq.js → index-yg7jhz8x.js} +4 -4
  42. package/index.js +21 -21
  43. package/{library.command-n9kp7yms.js → library.command-9h749a1x.js} +3 -3
  44. package/{localRegistry.command-jx6kxt2x.js → localRegistry.command-2bqqhxyz.js} +8 -8
  45. package/{module.command-q2xjf6cx.js → module.command-nv8nzgft.js} +5 -5
  46. package/{package.command-q5a3nsw5.js → package.command-mq4bggp6.js} +3 -3
  47. package/package.json +2 -2
  48. package/{page.command-ppenrxjn.js → page.command-j639n707.js} +3 -3
  49. package/{primitive.command-dvgg8nem.js → primitive.command-kz6849th.js} +6 -6
  50. package/{quality.command-pz7kg3pc.js → quality.command-4hyabwkb.js} +2 -2
  51. package/{repair.command-a6py9xvz.js → repair.command-a9awpbqr.js} +5 -5
  52. package/{scalar.command-7f3xfpen.js → scalar.command-ma4fpm9m.js} +4 -4
  53. package/{subspace.command-z7nqs508.js → subspace.command-3k2pmrs4.js} +4 -4
  54. package/templates/app/page/_index.tsx +257 -258
  55. package/templates/app/page/_layout.tsx +5 -1
  56. package/templates/app/page/_overrides.tsx +12 -0
  57. package/templates/app/page/styles.css.template +316 -14
  58. package/templates/app/public/apple-touch-icon.png +0 -0
  59. package/templates/app/public/favicon.ico +0 -0
  60. package/templates/app/public/jelly/cloud.webp +0 -0
  61. package/templates/app/public/jelly/comet.webp +0 -0
  62. package/templates/app/public/jelly/moon.webp +0 -0
  63. package/templates/app/public/jelly/planet.webp +0 -0
  64. package/templates/app/public/jelly/rocket.webp +0 -0
  65. package/templates/app/public/jelly/star.webp +0 -0
  66. package/templates/app/public/jelly/sugar.webp +0 -0
  67. package/templates/app/public/logo.png +0 -0
  68. package/templates/app/ui/Recipe/index.ts +9 -0
  69. package/templates/app/ui/Recipe/jellyButton.ts +63 -0
  70. package/templates/appSample/lib/task/Task.Unit.tsx +1 -1
  71. package/templates/appSample/lib/task/Task.Util.tsx +10 -13
  72. package/templates/appSample/lib/task/Task.View.tsx +2 -2
  73. package/templates/appSample/lib/task/Task.Zone.tsx +5 -2
  74. package/templates/appSample/page/task/[taskId]/_index.tsx +6 -6
  75. package/templates/appSample/page/task/[taskId]/edit.tsx +5 -4
  76. package/templates/appSample/page/task/_index.tsx +4 -3
  77. package/templates/appSample/page/task/_layout.tsx +1 -1
  78. package/templates/appSample/page/task/new.tsx +5 -4
  79. package/templates/appSample/ui/GlobalLoading.tsx +2 -1
  80. package/templates/appSample/ui/QuantityControl.tsx +3 -3
  81. package/{tunnel.command-zy4wbcgt.js → tunnel.command-xwr46b66.js} +2 -2
  82. package/{workflow.command-f142t17s.js → workflow.command-t7wqe4h7.js} +10 -10
  83. package/{workspace.command-gpk1149x.js → workspace.command-4derhzrh.js} +24 -21
  84. package/cloud.script-yct1sk4k.js +0 -20
  85. package/context.runner-90hsmacr.js +0 -21
@@ -1,13 +1,13 @@
1
1
  // @bun
2
2
  import {
3
3
  AppExecutor
4
- } from "./index-n3jk2501.js";
4
+ } from "./index-3w94e7n3.js";
5
5
  import {
6
6
  jsonText,
7
7
  createWorkflowBaselineSummary,
8
8
  buildAkanModuleContextIndex,
9
9
  toolingRolloutGate
10
- } from "./index-hmdq5pqm.js";
10
+ } from "./index-y3mphr1m.js";
11
11
  import {
12
12
  buildResourceList,
13
13
  codexMcpConfigPath,
@@ -17,25 +17,25 @@ import {
17
17
  upsertCodexMcpServerBlock,
18
18
  renderDoctorText,
19
19
  AkanContextAnalyzer
20
- } from "./index-tzc1gtrg.js";
20
+ } from "./index-9z771ptz.js";
21
21
  import {
22
22
  runner
23
- } from "./index-xb7qhxa8.js";
23
+ } from "./index-vpj42xwt.js";
24
24
  import {
25
25
  getMobileTargets,
26
26
  appIdsOf,
27
27
  NativeApp,
28
28
  isPlaceholderAppId
29
- } from "./index-kb16nzyt.js";
29
+ } from "./index-gbggbqcp.js";
30
30
  import {
31
31
  Prompter2
32
32
  } from "./index-zzvvc845.js";
33
33
  import {
34
34
  RepairRunner
35
- } from "./index-0ncc0mbk.js";
35
+ } from "./index-93j60em0.js";
36
36
  import {
37
37
  WorkflowRunner
38
- } from "./index-rtwhw4aq.js";
38
+ } from "./index-f3c78nd6.js";
39
39
 
40
40
  // pkgs/@akanjs/devkit/akanMcpContract.ts
41
41
  import path from "path";
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-xb7qhxa8.js";
5
+ } from "./index-vpj42xwt.js";
6
6
  import {
7
7
  FileSys2
8
8
  } from "./index-52w0fvh8.js";
9
9
  import {
10
10
  PkgExecutor
11
- } from "./index-n3jk2501.js";
11
+ } from "./index-3w94e7n3.js";
12
12
  import {
13
13
  TypeScriptDependencyScanner2
14
14
  } from "./index-2ahj896a.js";
@@ -6,11 +6,11 @@ import {
6
6
  } from "./index-94s080qm.js";
7
7
  import {
8
8
  runner
9
- } from "./index-xb7qhxa8.js";
9
+ } from "./index-vpj42xwt.js";
10
10
  import {
11
11
  WorkspaceExecutor,
12
12
  AppExecutor
13
- } from "./index-n3jk2501.js";
13
+ } from "./index-3w94e7n3.js";
14
14
  import {
15
15
  openBrowser
16
16
  } from "./index-9dp031by.js";
@@ -22,26 +22,26 @@ import {
22
22
  renderWorkflowApply,
23
23
  renderWorkflowValidation,
24
24
  renderWorkflowRunArtifact
25
- } from "./index-hmdq5pqm.js";
25
+ } from "./index-y3mphr1m.js";
26
26
  import {
27
27
  AkanContextAnalyzer
28
- } from "./index-tzc1gtrg.js";
28
+ } from "./index-9z771ptz.js";
29
29
  import {
30
30
  CommandContainer,
31
31
  runner
32
- } from "./index-xb7qhxa8.js";
32
+ } from "./index-vpj42xwt.js";
33
33
  import {
34
34
  ModuleScript
35
- } from "./index-wfwgcnyc.js";
35
+ } from "./index-4npz05nm.js";
36
36
  import {
37
37
  PrimitiveScript
38
- } from "./index-hf6f4xnb.js";
38
+ } from "./index-kqabytj7.js";
39
39
  import {
40
40
  spawnShell
41
- } from "./index-0ncc0mbk.js";
41
+ } from "./index-93j60em0.js";
42
42
  import {
43
43
  ScalarScript
44
- } from "./index-tsb0f8ya.js";
44
+ } from "./index-hsmtysz4.js";
45
45
 
46
46
  // pkgs/@akanjs/cli/workflow/workflow.runner.ts
47
47
  import { mkdir, readFile, writeFile } from "fs/promises";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  binPlatforms,
4
4
  Executor
5
- } from "./index-n3jk2501.js";
5
+ } from "./index-3w94e7n3.js";
6
6
 
7
7
  // pkgs/@akanjs/devkit/mobile/mobileTarget.ts
8
8
  var trimSlashes = (value) => value.replace(/^\/+|\/+$/g, "");
@@ -92,8 +92,8 @@ class DesktopBin {
92
92
  this.app = app;
93
93
  this.config = config;
94
94
  }
95
- static platform() {
96
- const platform = `${process.platform}-${process.arch}`;
95
+ static platform(arch = process.arch) {
96
+ const platform = `${process.platform}-${arch}`;
97
97
  return binPlatforms.includes(platform) ? platform : null;
98
98
  }
99
99
  static select(config, libs) {
@@ -135,14 +135,14 @@ class DesktopBin {
135
135
  get #cacheDir() {
136
136
  return path.join(this.app.cwdPath, ".akan", "cache", "bin");
137
137
  }
138
- async stage(dir) {
138
+ async stage(dir, arch = process.arch) {
139
139
  const scanInfo = this.app.getScanInfo({ allowEmpty: true }) ?? await this.app.scan({ write: false });
140
140
  const chosen = DesktopBin.select(this.config, scanInfo.getLibs());
141
141
  if (!chosen.size)
142
142
  return [];
143
- const platform = DesktopBin.platform();
143
+ const platform = DesktopBin.platform(arch);
144
144
  if (!platform)
145
- throw new Error(`bin: this computer is ${process.platform}-${process.arch}, and a bin names only ${binPlatforms.join(", ")}.`);
145
+ throw new Error(`bin: this desktop app is for ${process.platform}-${arch}, and a bin names only ${binPlatforms.join(", ")}.`);
146
146
  await rm(dir, { recursive: true, force: true });
147
147
  await mkdir(dir, { recursive: true });
148
148
  for (const [name, { owner, platforms }] of chosen) {
@@ -410,7 +410,8 @@ class NativeConfig {
410
410
  ...Object.entries(target.ios?.files ?? {}).map(([to, from]) => ({ from: abs(from), to: `ios/${to}` })),
411
411
  ...Object.entries(target.android?.files ?? {}).map(([to, from]) => ({ from: abs(from), to: `android/${to}` }))
412
412
  ];
413
- const native = NativeConfig.#compact({ ios, android, resources });
413
+ const macos = NativeConfig.#compact({ entitlements: target.desktop?.entitlements });
414
+ const native = NativeConfig.#compact({ ios, macos, android, resources });
414
415
  const googleServices = target.android?.googleServices;
415
416
  const pushAndroid = target.android?.push;
416
417
  const desktop = NativeConfig.#compact({
@@ -623,9 +624,14 @@ class NativeApp {
623
624
  devOutDir(platform) {
624
625
  return path6.join(this.targetRoot, "dev", platform);
625
626
  }
626
- async assembleWeb() {
627
+ indexPath(platform) {
628
+ const { config } = this.target;
629
+ const section = platform === "ios" ? config.ios : platform === "android" ? config.android : config.desktop;
630
+ return section?.indexPath ?? config.indexPath;
631
+ }
632
+ async assembleWeb(platform) {
627
633
  const dist = this.app.dist.cwdPath;
628
- return await this.web.assemble(this.target.config, {
634
+ return await this.web.assemble({ ...this.target.config, indexPath: this.indexPath(platform) }, {
629
635
  html: path6.join(dist, "csr", targetHtmlFilename(this.target.config)),
630
636
  publicDir: path6.join(dist, "public"),
631
637
  fontsDir: path6.join(dist, ".akan", "artifact", "fonts")
@@ -637,7 +643,8 @@ class NativeApp {
637
643
  async config({
638
644
  server,
639
645
  platform,
640
- stageBin = true
646
+ stageBin = true,
647
+ arch
641
648
  }) {
642
649
  const [appConfig, plugins, nativePlugins] = await Promise.all([
643
650
  this.app.getConfig(),
@@ -645,7 +652,7 @@ class NativeApp {
645
652
  NativePluginFolders.of(this.app)
646
653
  ]);
647
654
  const desktop = platform === "macos" || platform === "windows" || platform === "linux";
648
- const carried = desktop && stageBin ? await new DesktopBin(this.app, appConfig).stage(this.binDir) : [];
655
+ const carried = desktop && stageBin ? await new DesktopBin(this.app, appConfig).stage(this.binDir, arch) : [];
649
656
  return NativeConfig.build({
650
657
  appPath: this.app.cwdPath,
651
658
  target: this.target.config,
@@ -659,10 +666,10 @@ class NativeApp {
659
666
  ...carried.length ? { desktopBin: this.binDir } : {}
660
667
  });
661
668
  }
662
- async prepare(platform, server) {
669
+ async prepare(platform, server, arch) {
663
670
  const [api, { config, warnings }] = await Promise.all([
664
671
  NativeApi.load(this.app.cwdPath),
665
- this.config({ platform, ...server ? { server } : {} })
672
+ this.config({ platform, ...server ? { server } : {}, ...arch ? { arch } : {} })
666
673
  ]);
667
674
  for (const warning of warnings)
668
675
  this.app.logger.warn(warning);
@@ -705,21 +712,33 @@ class NativeApp {
705
712
  }
706
713
  };
707
714
  }
708
- async build(platform, { profile = "release", server, installer = false } = {}) {
715
+ async build(platform, { profile = "release", server, installer = false, arch } = {}) {
709
716
  NativeApp.#assertServerPlatform(platform, server);
710
- if (installer && platform !== "windows")
711
- throw new Error(`An installer is built for Windows, not for ${platform}.`);
712
- await this.assembleWeb();
713
- const { api, config } = await this.prepare(platform, server);
717
+ NativeApp.assertInstaller(platform, installer);
718
+ await this.assembleWeb(platform);
719
+ const { api, config } = await this.prepare(platform, server, arch);
714
720
  return await api.build({
715
721
  ...this.#task(platform, config),
716
722
  profile,
717
- ...installer ? { windows: { installer } } : {}
723
+ ...arch ? { arch } : {},
724
+ ...platform === "windows" ? {
725
+ windows: {
726
+ ...installer ? { installer } : {},
727
+ ...profile === "release" ? NativeApp.#windowsSigning(api) : {}
728
+ }
729
+ } : {},
730
+ ...platform === "macos" ? {
731
+ macos: {
732
+ ...profile === "release" ? api.macosDistributionFromEnv(process.env) : {},
733
+ ...installer ? { dmg: true } : {}
734
+ }
735
+ } : {},
736
+ ...platform === "linux" && installer ? { linux: { appImage: true } } : {}
718
737
  });
719
738
  }
720
739
  async run(platform, { device, teamId, profile = "debug", server } = {}) {
721
740
  NativeApp.#assertServerPlatform(platform, server);
722
- await this.assembleWeb();
741
+ await this.assembleWeb(platform);
723
742
  const { api, config } = await this.prepare(platform, server);
724
743
  return await api.run({
725
744
  ...this.#task(platform, config),
@@ -743,7 +762,7 @@ class NativeApp {
743
762
  wsPaths: [`${routes.prefix}${routes.websocketPrefix}`],
744
763
  reversePorts: [Number(new URL(upstream).port)],
745
764
  onLine: this.#appLine,
746
- startPath: this.startPath(lang),
765
+ startPath: this.startPath(lang, platform),
747
766
  ...device ? { device } : {},
748
767
  ...teamId ? { ios: { signing: { teamId } } } : {}
749
768
  });
@@ -770,7 +789,7 @@ class NativeApp {
770
789
  return [`${this.app.name}${target} ${label} ready`, ...device ? [device.name] : [], upstream, `${seconds}s`].join(" \xB7 ");
771
790
  }
772
791
  async releaseIos({ teamId, adHoc = false } = {}) {
773
- await this.assembleWeb();
792
+ await this.assembleWeb("ios");
774
793
  const { api, config } = await this.prepare("ios");
775
794
  return await api.release({
776
795
  ...this.#task("ios", config),
@@ -784,13 +803,15 @@ class NativeApp {
784
803
  async publishUpdate(platform, { channel, server } = {}) {
785
804
  NativeApp.#assertServerPlatform(platform, server);
786
805
  this.#assertUpdates();
787
- await this.assembleWeb();
806
+ await this.assembleWeb(platform);
788
807
  const { api, config } = await this.prepare(platform, server);
789
808
  return await api.publishUpdate({
790
809
  ...this.#task(platform, config),
791
810
  platform,
792
811
  out: this.updatesDir,
793
- ...channel ? { channel } : {}
812
+ ...channel ? { channel } : {},
813
+ ...platform === "macos" ? { macos: api.macosDistributionFromEnv(process.env) } : {},
814
+ ...platform === "windows" ? { windows: NativeApp.#windowsSigning(api) } : {}
794
815
  });
795
816
  }
796
817
  async assertPublishable(platform, { channel, server = false } = {}) {
@@ -828,12 +849,12 @@ class NativeApp {
828
849
  }
829
850
  async releaseAndroid({ formats = ["aab"] } = {}) {
830
851
  const signing = NativeApp.androidSigning();
831
- await this.assembleWeb();
852
+ await this.assembleWeb("android");
832
853
  const { api, config } = await this.prepare("android");
833
854
  return await api.release({ ...this.#task("android", config), platform: "android", signing, formats });
834
855
  }
835
856
  async packUpdate(platform, { out } = {}) {
836
- await this.assembleWeb();
857
+ await this.assembleWeb(platform);
837
858
  const { api, config } = await this.prepare(platform);
838
859
  if (!config.updates)
839
860
  throw new Error(`Native target '${this.target.name}' takes no updates: add native.updates: { url, publicKey } to akan.config.ts first.`);
@@ -862,16 +883,25 @@ class NativeApp {
862
883
  }
863
884
  return { keystore, storePassword, alias, ...keyPassword ? { keyPassword } : {} };
864
885
  }
865
- startPath(lang) {
886
+ startPath(lang, platform) {
866
887
  const basePath = this.target.config.basePath?.replace(/^\/+|\/+$/g, "");
888
+ const indexPath = this.indexPath(platform);
867
889
  const params = new URLSearchParams({ csr: "true", akanMobileTarget: this.target.name });
868
890
  if (basePath)
869
891
  params.set("akanMobileBasePath", basePath);
870
- if (this.target.config.indexPath)
871
- params.set("akanMobileIndexPath", this.target.config.indexPath);
872
- const home = [lang, basePath, this.target.config.indexPath].flatMap((part) => (part ?? "").split("/")).filter((segment) => segment.length > 0);
892
+ if (indexPath)
893
+ params.set("akanMobileIndexPath", indexPath);
894
+ const home = [lang, basePath, indexPath].flatMap((part) => (part ?? "").split("/")).filter((segment) => segment.length > 0);
873
895
  return `/${home.join("/")}?${params}`;
874
896
  }
897
+ static #windowsSigning(api) {
898
+ const signing = api.windowsSigningFromEnv(process.env);
899
+ return signing ? { signing } : {};
900
+ }
901
+ static assertInstaller(platform, installer) {
902
+ if (installer && (platform === "ios" || platform === "android"))
903
+ throw new Error(`An installer is built for a desktop app (Windows, macOS, Linux), not for ${platform}.`);
904
+ }
875
905
  static #assertServerPlatform(platform, server) {
876
906
  if (server && (platform === "ios" || platform === "android"))
877
907
  throw new Error(`Only a desktop app carries its server; ${platform} cannot run one.`);
@@ -960,24 +990,55 @@ class DesktopServerStage {
960
990
  message: `${image}, and a desktop app's server runs none of them: declare in bin the executables its code spawns, or those calls fail on the user's computer.`
961
991
  };
962
992
  }
963
- static packageJson(config, built) {
993
+ static packageJson(config, built, omit = []) {
964
994
  const otherDrivers = new Set(config.database.modes.filter((mode) => mode !== "single").flatMap((mode) => config.getDatabaseModeRuntimePackages(mode)));
965
- const dependencies = Object.entries(built.dependencies ?? {}).filter(([name]) => config.externalLibs.includes(name) || name !== DesktopServerStage.rscRenderer && !otherDrivers.has(name));
995
+ const dependencies = Object.entries(built.dependencies ?? {}).filter(([name]) => !omit.includes(name) && (config.externalLibs.includes(name) || name !== DesktopServerStage.rscRenderer && !otherDrivers.has(name)));
966
996
  return { ...built, dependencies: Object.fromEntries(dependencies) };
967
997
  }
968
- async install() {
998
+ static async dependentsOf(nodeModules, name) {
999
+ const dependents = new Set;
1000
+ for await (const manifest of new Bun.Glob("**/package.json").scan({ cwd: nodeModules, onlyFiles: true })) {
1001
+ const json = await Bun.file(path7.join(nodeModules, manifest)).json().catch(() => null);
1002
+ if (!json?.name || json.name === name)
1003
+ continue;
1004
+ const declared = { ...json.dependencies, ...json.optionalDependencies, ...json.peerDependencies };
1005
+ if (name in declared)
1006
+ dependents.add(json.name);
1007
+ }
1008
+ return [...dependents].sort();
1009
+ }
1010
+ static installArgs(arch) {
1011
+ return ["install", "--production", "--prefer-offline", ...arch && arch !== process.arch ? [`--cpu=${arch}`] : []];
1012
+ }
1013
+ async install(arch, omit = []) {
969
1014
  const config = await this.app.getConfig();
970
1015
  DesktopServerStage.assertCarriable(config);
971
1016
  await rm3(this.dir, { recursive: true, force: true });
972
1017
  await mkdir3(this.dir, { recursive: true });
973
- await writeFile2(path7.join(this.dir, "package.json"), JSON.stringify(DesktopServerStage.packageJson(config, config.getProductionPackageJson()), null, 2));
1018
+ const built = config.getProductionPackageJson();
1019
+ for (const name of omit.filter((name) => !(name in (built.dependencies ?? {}))))
1020
+ this.app.logger.warn(`desktop.server.omit names ${name}, which the server does not depend on directly.`);
1021
+ await writeFile2(path7.join(this.dir, "package.json"), JSON.stringify(DesktopServerStage.packageJson(config, built, omit), null, 2));
974
1022
  try {
975
- await this.app.spawn(process.execPath, ["install", "--production", "--prefer-offline"], { cwd: this.dir });
1023
+ await this.app.spawn(process.execPath, DesktopServerStage.installArgs(arch), { cwd: this.dir });
976
1024
  } catch (error) {
977
1025
  throw new Error(`The desktop app's server could not install its packages in ${this.dir}: it needs the npm registry, or a Bun cache that already holds every one of them.
978
1026
  ${error instanceof Error ? error.message : String(error)}`, { cause: error });
979
1027
  }
980
1028
  await rm3(path7.join(this.dir, "node_modules", ".bin"), { recursive: true, force: true });
1029
+ await this.#assertOmitted(omit);
1030
+ }
1031
+ async#assertOmitted(omit) {
1032
+ const nodeModules = path7.join(this.dir, "node_modules");
1033
+ const kept = [];
1034
+ for (const name of omit) {
1035
+ if (!await Bun.file(path7.join(nodeModules, name, "package.json")).exists())
1036
+ continue;
1037
+ const dependents = await DesktopServerStage.dependentsOf(nodeModules, name);
1038
+ kept.push(`${name} (needed by ${dependents.join(", ") || "a package that names it"})`);
1039
+ }
1040
+ if (kept.length)
1041
+ throw new Error(`desktop.server.omit leaves out packages another dependency still installs: ${kept.join("; ")}. Omit those too, or keep the package.`);
981
1042
  }
982
1043
  async prepare(environment) {
983
1044
  const config = await this.app.getConfig();
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-xb7qhxa8.js";
5
+ } from "./index-vpj42xwt.js";
6
6
  import {
7
7
  generatedFilesForSync,
8
8
  createPassedPrimitiveReport,
9
9
  scalarChangedFiles
10
- } from "./index-hmdq5pqm.js";
10
+ } from "./index-y3mphr1m.js";
11
11
  import {
12
12
  pluralizeName
13
13
  } from "./index-nz8prx9g.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  AppInfo
4
- } from "./index-n3jk2501.js";
4
+ } from "./index-3w94e7n3.js";
5
5
 
6
6
  // pkgs/@akanjs/devkit/slicePlanner.ts
7
7
  class SlicePlanner {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  resolveSsrPageEntriesForApp
4
- } from "./index-n3jk2501.js";
4
+ } from "./index-3w94e7n3.js";
5
5
  import {
6
6
  computeRouteSeedIndex,
7
7
  saveRouteSeedIndex,
@@ -16,7 +16,7 @@ import {
16
16
  CsrEntryFiles,
17
17
  PagesEntrySourceGenerator,
18
18
  PagesBundleBuilder
19
- } from "./index-6x9p8dpb.js";
19
+ } from "./index-6he6gvfg.js";
20
20
  import {
21
21
  SOURCE_EXTS
22
22
  } from "./index-48k96p55.js";
@@ -1,12 +1,12 @@
1
1
  // @bun
2
2
  import {
3
3
  script
4
- } from "./index-xb7qhxa8.js";
4
+ } from "./index-vpj42xwt.js";
5
5
  import {
6
6
  AppExecutor,
7
7
  LibExecutor,
8
8
  ModuleExecutor
9
- } from "./index-n3jk2501.js";
9
+ } from "./index-3w94e7n3.js";
10
10
  import {
11
11
  workflowStatus,
12
12
  compactDiagnostics,
@@ -41,10 +41,10 @@ import {
41
41
  hasSignalFactoryEntry,
42
42
  insertSignalFactoryEntry,
43
43
  addFieldUiPolicyForType
44
- } from "./index-hmdq5pqm.js";
44
+ } from "./index-y3mphr1m.js";
45
45
  import {
46
46
  ModuleScript
47
- } from "./index-wfwgcnyc.js";
47
+ } from "./index-4npz05nm.js";
48
48
 
49
49
  // pkgs/@akanjs/cli/primitive/primitive.script.ts
50
50
  import { capitalize, lowerlize } from "akanjs/common";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-xb7qhxa8.js";
5
+ } from "./index-vpj42xwt.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/page/page.runner.ts
8
8
  class PageRunner extends runner("page") {
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-xb7qhxa8.js";
5
+ } from "./index-vpj42xwt.js";
6
6
  import {
7
7
  LibExecutor
8
- } from "./index-n3jk2501.js";
8
+ } from "./index-3w94e7n3.js";
9
9
  import {
10
10
  LibSource,
11
11
  formatLibStatuses
@@ -37,29 +37,29 @@ import {
37
37
  import {
38
38
  runner,
39
39
  script
40
- } from "./index-xb7qhxa8.js";
40
+ } from "./index-vpj42xwt.js";
41
41
  import {
42
42
  WorkspaceExecutor,
43
43
  AppExecutor,
44
44
  LibExecutor,
45
45
  PkgExecutor
46
- } from "./index-n3jk2501.js";
46
+ } from "./index-3w94e7n3.js";
47
47
  import {
48
48
  DesktopServerStage,
49
49
  resolveMobileTargets,
50
50
  resolveAppId,
51
51
  NativeApp
52
- } from "./index-kb16nzyt.js";
52
+ } from "./index-gbggbqcp.js";
53
53
  import {
54
54
  LibraryScript
55
- } from "./index-gxamdf18.js";
55
+ } from "./index-mgxpx3f2.js";
56
56
  import {
57
57
  stripAnsi
58
58
  } from "./index-7md2g9vw.js";
59
59
  import {
60
60
  SlicePlanner,
61
61
  formatSlicePlan
62
- } from "./index-35mmm9ca.js";
62
+ } from "./index-jmrn54tt.js";
63
63
  import {
64
64
  openBrowser
65
65
  } from "./index-9dp031by.js";
@@ -1867,16 +1867,16 @@ ${uniqueCandidates.map((candidate) => ` - ${candidate}`).join(`
1867
1867
 
1868
1868
  // pkgs/@akanjs/cli/application/application.runner.ts
1869
1869
  import { Logger as Logger3 } from "akanjs/common";
1870
- var loadBuildRunner = async () => (await import("./applicationBuildRunner-qkt6spd5.js")).ApplicationBuildRunner;
1870
+ var loadBuildRunner = async () => (await import("./applicationBuildRunner-64taxseg.js")).ApplicationBuildRunner;
1871
1871
  var loadPrompts = async () => await import("@inquirer/prompts");
1872
1872
 
1873
1873
  class ApplicationRunner extends runner("application") {
1874
- async createApplication(appName, workspace, libs = []) {
1874
+ async createApplication(appName, workspace, libs = [], { sample = false } = {}) {
1875
1875
  await workspace.applyTemplate({
1876
1876
  basePath: `apps/${appName}`,
1877
1877
  template: "app",
1878
1878
  dict: { appName },
1879
- options: { libs }
1879
+ options: { libs, sample }
1880
1880
  });
1881
1881
  return AppExecutor.from(workspace, appName);
1882
1882
  }
@@ -2059,16 +2059,20 @@ try {
2059
2059
  setTimeout(() => openBrowser(`http://localhost:${env.AKAN_PUBLIC_CLIENT_PORT ?? env.PORT ?? "8282"}`), 3000);
2060
2060
  return appHost;
2061
2061
  }
2062
- async buildMobile(app, platform, { target, env = "debug", profile = "release", installer = false } = {}) {
2062
+ async buildMobile(app, platform, { target, env = "debug", profile = "release", installer = false, arch } = {}) {
2063
2063
  const targets = await resolveMobileTargets(app, target);
2064
- if (installer && platform !== "windows")
2065
- throw new Error(`--installer builds a Windows setup program; this computer builds for ${platform}.`);
2066
- const carried = await this.#stageMobile(app, platform, targets, env);
2064
+ NativeApp.assertInstaller(platform, installer);
2065
+ if (arch && platform !== "macos" && platform !== "windows" && platform !== "linux")
2066
+ throw new Error(`--arch picks a desktop app's CPU; ${platform} builds for its own.`);
2067
+ if (arch === "x64" && platform === "macos")
2068
+ throw new Error("A macOS app is built for Apple silicon (arm64) only.");
2069
+ const carried = await this.#stageMobile(app, platform, targets, env, arch);
2067
2070
  await this.#runMobileTargets(targets, async (mobileTarget) => {
2068
2071
  this.#reportBuild(app, mobileTarget, await new NativeApp(app, mobileTarget, env).build(platform, {
2069
2072
  profile,
2070
2073
  ...carried && ApplicationRunner.carriesServer(mobileTarget, platform) ? { server: carried } : {},
2071
- ...installer ? { installer } : {}
2074
+ ...installer ? { installer } : {},
2075
+ ...arch ? { arch } : {}
2072
2076
  }));
2073
2077
  });
2074
2078
  }
@@ -2218,11 +2222,22 @@ try {
2218
2222
  app.log(`${app.name}/${mobileTarget.name} ${artifact.kind}: ${artifact.path}`);
2219
2223
  }
2220
2224
  static carriesServer({ config }, platform = NativeApp.desktopPlatform()) {
2221
- return platform !== "ios" && platform !== "android" && config.desktop?.server === true;
2225
+ return platform !== "ios" && platform !== "android" && !!config.desktop?.server;
2222
2226
  }
2223
- async#stageMobile(app, platform, targets, env) {
2227
+ static serverOmit(targets, platform) {
2228
+ const carrying = targets.filter((target) => ApplicationRunner.carriesServer(target, platform));
2229
+ const omits = carrying.map(({ config }) => {
2230
+ const server = config.desktop?.server;
2231
+ return typeof server === "object" ? server.omit ?? [] : [];
2232
+ });
2233
+ const [first = [], ...rest] = omits;
2234
+ if (rest.some((omit) => omit.join("\x00") !== first.join("\x00")))
2235
+ throw new Error(`The targets that carry the server omit different packages (${carrying.map(({ name }, idx) => `${name}: ${omits[idx]?.join(", ") || "none"}`).join("; ")}); build them one --target at a time.`);
2236
+ return first;
2237
+ }
2238
+ async#stageMobile(app, platform, targets, env, arch) {
2224
2239
  const stage = targets.some((mobileTarget) => ApplicationRunner.carriesServer(mobileTarget, platform)) ? new DesktopServerStage(app) : null;
2225
- await stage?.install();
2240
+ await stage?.install(arch, ApplicationRunner.serverOmit(targets, platform));
2226
2241
  await this.#buildMobileCsr(app, env);
2227
2242
  return await stage?.prepare(env);
2228
2243
  }
@@ -3160,9 +3175,9 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
3160
3175
  throw error;
3161
3176
  }
3162
3177
  }
3163
- async createApplication(appName, workspace, { start = false, libs = [] } = {}) {
3178
+ async createApplication(appName, workspace, { start = false, libs = [], sample = false } = {}) {
3164
3179
  const spinner = workspace.spinning("Creating application...");
3165
- const app = await this.applicationRunner.createApplication(appName, workspace, libs);
3180
+ const app = await this.applicationRunner.createApplication(appName, workspace, libs, { sample });
3166
3181
  spinner.succeed(`Application created in apps/${app.name}`);
3167
3182
  await app.scanSync();
3168
3183
  if (start)
@@ -5,19 +5,19 @@ import {
5
5
  } from "./index-94s080qm.js";
6
6
  import {
7
7
  script
8
- } from "./index-xb7qhxa8.js";
8
+ } from "./index-vpj42xwt.js";
9
9
  import {
10
10
  PkgExecutor
11
- } from "./index-n3jk2501.js";
11
+ } from "./index-3w94e7n3.js";
12
12
  import {
13
13
  ApplicationScript
14
- } from "./index-3rh7thcx.js";
14
+ } from "./index-p993efkq.js";
15
15
  import {
16
16
  PackageScript
17
- } from "./index-a4s954kq.js";
17
+ } from "./index-by9pxkr0.js";
18
18
  import {
19
19
  CloudRunner
20
- } from "./index-5rp0h6na.js";
20
+ } from "./index-drehwpdt.js";
21
21
 
22
22
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
23
23
  import { Logger } from "akanjs/common";
@@ -116,7 +116,7 @@ class SubagentPool2 {
116
116
  }
117
117
  }
118
118
  async#run(id, kind, prompt, signal) {
119
- const { CodeAgent } = await import("./CodeAgent-xnfyyz8h.js");
119
+ const { CodeAgent } = await import("./CodeAgent-2vmp9qe0.js");
120
120
  const budget = this.#options.parent.tools.subagent;
121
121
  const child = SubagentPool2.childOf(this.#options.parent, kind);
122
122
  const agent = await CodeAgent.create({
@@ -10,7 +10,7 @@ import {
10
10
  LibExecutor,
11
11
  PkgExecutor,
12
12
  ModuleExecutor
13
- } from "./index-n3jk2501.js";
13
+ } from "./index-3w94e7n3.js";
14
14
 
15
15
  // pkgs/@akanjs/devkit/commandDecorators/camelToKebabCase.ts
16
16
  var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();