@akanjs/cli 3.0.0-alpha.4 → 3.0.0-alpha.5

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 (60) hide show
  1. package/.build-stamp +1 -1
  2. package/{abstractCompactor-rk6twzvj.js → abstractCompactor-e5yq60qz.js} +2 -2
  3. package/{agent.command-jfz8yfwy.js → agent.command-b0fcx3r2.js} +7 -7
  4. package/{application.command-mxyqtd6p.js → application.command-cgmy00gd.js} +5 -5
  5. package/{applicationBuildRunner-cwk52sb7.js → applicationBuildRunner-n1svrwgt.js} +4 -4
  6. package/{applicationReleasePackager-yrrhbkv3.js → applicationReleasePackager-gg8ccbeh.js} +1 -1
  7. package/buildBatch.proc.js +4 -4
  8. package/{capacitorApp-j357ak1g.js → capacitorApp-yyw35vg4.js} +3 -5
  9. package/{cloud.command-f87dwe52.js → cloud.command-1m7hfdpk.js} +9 -9
  10. package/{context.command-z5bf8bn7.js → context.command-b5heat2a.js} +15 -15
  11. package/{guideline.command-1m1ctar3.js → guideline.command-9ew6aqhm.js} +5 -5
  12. package/guidelines/ssrRule/ssrRule.generate.json +31 -0
  13. package/guidelines/ssrRule/ssrRule.instruction.md +108 -0
  14. package/incrementalBuilder.proc.js +3 -3
  15. package/{index-3pgtw35d.js → index-0cj2zxbm.js} +1 -1
  16. package/{index-cap2k2ch.js → index-0fj4yg7k.js} +52 -17
  17. package/{index-jtm86byd.js → index-47qxw1tz.js} +28 -22
  18. package/{index-vhv3xnjz.js → index-60a3jfcz.js} +6 -6
  19. package/{index-b978vs2e.js → index-6npsfpxr.js} +3 -3
  20. package/{index-csqk9z5j.js → index-c94nq3c1.js} +3 -3
  21. package/{index-cn24dcqn.js → index-exhpp31y.js} +2 -2
  22. package/{index-hjzr8ja1.js → index-hrwzz2wf.js} +1 -1
  23. package/{index-rh16j3c7.js → index-j9cxndc0.js} +3 -2
  24. package/{index-jk9q6pse.js → index-jkynkyfk.js} +1 -1
  25. package/{index-4yp06pn1.js → index-jn9vfpwz.js} +9 -31
  26. package/{index-4zgs8g1w.js → index-m4kpmmtj.js} +1 -1
  27. package/{index-e3qskyt2.js → index-meh7mmz9.js} +2 -2
  28. package/{index-ybybkec0.js → index-mn96y1nk.js} +6 -6
  29. package/{index-y0k42k04.js → index-mterpj70.js} +17 -86
  30. package/{index-6pz1j0zj.js → index-mxvakhsm.js} +6 -2
  31. package/{index-n0z3f2xg.js → index-nfxq39kj.js} +4 -4
  32. package/{index-tq1y56tp.js → index-nx1vbtsc.js} +35 -12
  33. package/{index-1s71fwrq.js → index-p69fcwe1.js} +11 -11
  34. package/{index-xj8bks3p.js → index-p6txr1ss.js} +4 -4
  35. package/{index-r4w8cry5.js → index-pfrt7qwh.js} +4 -4
  36. package/{index-xwgm94zr.js → index-qp089jp0.js} +1 -1
  37. package/{index-fmgbwsr5.js → index-wrrb8rxk.js} +4 -4
  38. package/index.js +19 -19
  39. package/{library.command-pwfx8dx2.js → library.command-aa1g8nsa.js} +4 -4
  40. package/{localRegistry.command-r4zjx5py.js → localRegistry.command-kshva1ck.js} +8 -8
  41. package/{module.command-0t3ewata.js → module.command-b1zzgqde.js} +8 -8
  42. package/{package.command-7hmkxvpa.js → package.command-9qv6vr9s.js} +4 -4
  43. package/package.json +2 -2
  44. package/{page.command-st6r4s0q.js → page.command-k16pw244.js} +4 -4
  45. package/{primitive.command-1qkxpzsn.js → primitive.command-s60dn1ae.js} +9 -9
  46. package/{quality.command-hy5vt1bh.js → quality.command-p3vaze52.js} +456 -71
  47. package/{repair.command-nakkq2zp.js → repair.command-mfv749ha.js} +6 -6
  48. package/{scalar.command-fjq272gs.js → scalar.command-hs3nwzv1.js} +7 -7
  49. package/templates/lib/db.ts +3 -1
  50. package/templates/lib/useClient.ts +9 -3
  51. package/templates/workspaceRoot/.cursor/rules/akan-sync-conventions.mdc.template +3 -2
  52. package/templates/workspaceRoot/.cursor/rules/client-server-boundaries.mdc.template +1 -0
  53. package/templates/workspaceRoot/.cursor/rules/ssr-first.mdc.template +59 -0
  54. package/templates/workspaceRoot/AGENTS.md.template +161 -25
  55. package/templates/workspaceRoot/biome.json.template +22 -19
  56. package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +1 -4
  57. package/{workflow.command-jswbgk90.js → workflow.command-z0e0fk0z.js} +12 -12
  58. package/{workspace.command-h9wwcjpt.js → workspace.command-3q1d6kk4.js} +21 -21
  59. package/templates/libRoot/base/baseLogic.ts +0 -14
  60. package/templates/libRoot/base/index.ts +0 -8
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  Spinner
4
- } from "./index-6pz1j0zj.js";
4
+ } from "./index-mxvakhsm.js";
5
5
  import {
6
6
  FileSys
7
7
  } from "./index-67546d0j.js";
@@ -913,19 +913,8 @@ ${errorText}, ${warningText} found`];
913
913
  // pkgs/@akanjs/devkit/scanInfo.ts
914
914
  import { rm } from "fs/promises";
915
915
  import path4 from "path";
916
- var databaseFileTypes = [
917
- "constant",
918
- "dictionary",
919
- "document",
920
- "service",
921
- "signal",
922
- "store",
923
- "template",
924
- "unit",
925
- "util",
926
- "view",
927
- "zone"
928
- ];
916
+
917
+ // pkgs/@akanjs/devkit/workspaceLayout.ts
929
918
  var appRootAllowedFiles = new Set([
930
919
  "AGENTS.md",
931
920
  "CLAUDE.md",
@@ -939,25 +928,25 @@ var appRootAllowedFiles = new Set([
939
928
  "tsconfig.json",
940
929
  "tsconfig.tsbuildinfo"
941
930
  ]);
942
- var generatedRootCapacitorConfigFiles = ["capacitor.config.js", "capacitor.config.json"];
943
931
  var appRootAllowedDirs = new Set([
944
932
  ".akan",
945
933
  "android",
934
+ "common",
946
935
  "env",
947
936
  "ios",
948
937
  "lib",
949
938
  "mobile",
950
939
  "page",
940
+ "plugin",
951
941
  "private",
952
942
  "public",
953
943
  "script",
954
- "ui",
944
+ "secrets",
955
945
  "srvkit",
956
- "webkit",
957
- "common",
958
- "secrets"
946
+ "ui",
947
+ "webkit"
959
948
  ]);
960
- var libRootAllowedFiles = new Set([
949
+ var libFacetRootAllowedFiles = new Set([
961
950
  "cnst.ts",
962
951
  "db.ts",
963
952
  "dict.ts",
@@ -968,6 +957,23 @@ var libRootAllowedFiles = new Set([
968
957
  "useClient.ts",
969
958
  "useServer.ts"
970
959
  ]);
960
+ var isScannedAppRootEntry = (name) => !name.startsWith(".") || appRootAllowedDirs.has(name);
961
+
962
+ // pkgs/@akanjs/devkit/scanInfo.ts
963
+ var databaseFileTypes = [
964
+ "constant",
965
+ "dictionary",
966
+ "document",
967
+ "service",
968
+ "signal",
969
+ "store",
970
+ "template",
971
+ "unit",
972
+ "util",
973
+ "view",
974
+ "zone"
975
+ ];
976
+ var generatedRootCapacitorConfigFiles = ["capacitor.config.js", "capacitor.config.json"];
971
977
  var internalLibDirs = new Set(["__lib", "__scalar"]);
972
978
  var moduleNonUiFileTypes = {
973
979
  database: new Set(["constant", "dictionary", "document", "service", "signal", "store"]),
@@ -983,7 +989,7 @@ var testFilePattern = /\.(test|spec)\.(ts|tsx)$/;
983
989
  var rootSignalTestFilePattern = /^[A-Za-z][A-Za-z0-9_-]*\.signal\.(test|spec)\.(ts|tsx)$/;
984
990
  var createDependencyScanner = async (exec) => (await import("./dependencyScanner-f6grrep3.js")).TypeScriptDependencyScanner.from(exec);
985
991
  var isAllowedTestFile = (filename) => testFilePattern.test(filename);
986
- var isAllowedLibRootFile = (filename) => libRootAllowedFiles.has(filename) || rootSignalTestFilePattern.test(filename);
992
+ var isAllowedLibRootFile = (filename) => libFacetRootAllowedFiles.has(filename) || rootSignalTestFilePattern.test(filename);
987
993
  var getScanPath = (exec, relativePath) => path4.posix.join(`${exec.type}s`, exec.name, relativePath.split(path4.sep).join("/"));
988
994
  async function clearGeneratedRootCapacitorConfigs(exec) {
989
995
  if (exec.type !== "app")
@@ -3003,4 +3009,4 @@ class ModuleExecutor extends Executor {
3003
3009
  }
3004
3010
  }
3005
3011
 
3006
- export { AGENT_BLOCK_START, AGENT_BLOCK_END, upsertAgentBlock, extractAgentBlock, renderRecipeEntries, collectScopeRecipeSources, renderScopeAgentBlock, getDirname, CommandExecutionError, Executor, WorkspaceExecutor, SysExecutor, AppExecutor, LibExecutor, PkgExecutor, ModuleExecutor };
3012
+ export { AGENT_BLOCK_START, AGENT_BLOCK_END, upsertAgentBlock, extractAgentBlock, renderRecipeEntries, collectScopeRecipeSources, renderScopeAgentBlock, getDirname, appRootAllowedFiles, appRootAllowedDirs, libFacetRootAllowedFiles, isScannedAppRootEntry, CommandExecutionError, Executor, WorkspaceExecutor, SysExecutor, AppExecutor, LibExecutor, PkgExecutor, ModuleExecutor };
@@ -1,13 +1,13 @@
1
1
  // @bun
2
2
  import {
3
3
  PageScript
4
- } from "./index-hjzr8ja1.js";
4
+ } from "./index-hrwzz2wf.js";
5
5
  import {
6
6
  pluralizeName
7
7
  } from "./index-ss469dec.js";
8
8
  import {
9
9
  AiSession
10
- } from "./index-3pgtw35d.js";
10
+ } from "./index-0cj2zxbm.js";
11
11
  import {
12
12
  bilingualDescriptionForField,
13
13
  bilingualLabelForField,
@@ -15,17 +15,17 @@ import {
15
15
  generatedFilesForSync,
16
16
  moduleSourcePaths,
17
17
  sourceFile
18
- } from "./index-4zgs8g1w.js";
18
+ } from "./index-m4kpmmtj.js";
19
19
  import {
20
20
  Prompter
21
- } from "./index-xwgm94zr.js";
21
+ } from "./index-qp089jp0.js";
22
22
  import {
23
23
  runner,
24
24
  script
25
- } from "./index-jk9q6pse.js";
25
+ } from "./index-jkynkyfk.js";
26
26
  import {
27
27
  ModuleExecutor
28
- } from "./index-jtm86byd.js";
28
+ } from "./index-47qxw1tz.js";
29
29
  import {
30
30
  FileSys
31
31
  } from "./index-67546d0j.js";
@@ -1,17 +1,17 @@
1
1
  // @bun
2
2
  import {
3
3
  AkanContextAnalyzer
4
- } from "./index-4yp06pn1.js";
4
+ } from "./index-jn9vfpwz.js";
5
5
  import {
6
6
  createRepairReport,
7
7
  generatedFilePathsForTarget,
8
8
  renderRepairReport,
9
9
  writeGeneratedSyncState,
10
10
  writeWorkflowRunArtifact
11
- } from "./index-4zgs8g1w.js";
11
+ } from "./index-m4kpmmtj.js";
12
12
  import {
13
13
  runner
14
- } from "./index-jk9q6pse.js";
14
+ } from "./index-jkynkyfk.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/repair/repair.runner.ts
17
17
  var commandForShell = (command) => command.startsWith("akan ") ? `bun run ${command}` : command;
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  AkanContextAnalyzer
4
- } from "./index-4yp06pn1.js";
4
+ } from "./index-jn9vfpwz.js";
5
5
  import {
6
6
  WorkflowExecutor,
7
7
  compactWorkflowInputs,
@@ -23,10 +23,10 @@ import {
23
23
  workflowCommandsForPlan,
24
24
  workflowPlanApproval,
25
25
  writeWorkflowRunArtifact
26
- } from "./index-4zgs8g1w.js";
26
+ } from "./index-m4kpmmtj.js";
27
27
  import {
28
28
  runner
29
- } from "./index-jk9q6pse.js";
29
+ } from "./index-jkynkyfk.js";
30
30
 
31
31
  // pkgs/@akanjs/cli/workflow/workflow.runner.ts
32
32
  import { mkdir, readFile, writeFile } from "fs/promises";
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-jk9q6pse.js";
5
+ } from "./index-jkynkyfk.js";
6
6
  import {
7
7
  LibExecutor
8
- } from "./index-jtm86byd.js";
8
+ } from "./index-47qxw1tz.js";
9
9
 
10
10
  // pkgs/@akanjs/cli/semver.ts
11
11
  function parseVersion(version) {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-jk9q6pse.js";
5
+ } from "./index-jkynkyfk.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/page/page.runner.ts
8
8
  class PageRunner extends runner("page") {
@@ -1143,16 +1143,17 @@ class RouteClientBuilder {
1143
1143
  #knownEntries;
1144
1144
  #command;
1145
1145
  #discovery;
1146
+ #entries;
1146
1147
  constructor(options) {
1147
1148
  this.#app = options.app;
1148
1149
  this.#seeds = options.seeds;
1149
1150
  this.#knownEntries = options.knownEntries ?? new Set;
1150
1151
  this.#command = options.command ?? "start";
1151
1152
  this.#discovery = options.discovery;
1153
+ this.#entries = options.entries;
1152
1154
  }
1153
1155
  async build() {
1154
- const discovery = this.#discovery ?? await GraphClientEntryDiscovery.create(this.#app);
1155
- const discovered = await discovery.discover(this.#seeds);
1156
+ const discovered = this.#entries ?? await (this.#discovery ?? await GraphClientEntryDiscovery.create(this.#app)).discover(this.#seeds);
1156
1157
  const entries = discovered.filter((e) => !this.#knownEntries.has(e));
1157
1158
  if (entries.length === 0)
1158
1159
  return this.#emptyResult(discovered);
@@ -7,7 +7,7 @@ import {
7
7
  PkgExecutor,
8
8
  WorkspaceExecutor,
9
9
  getDirname
10
- } from "./index-jtm86byd.js";
10
+ } from "./index-47qxw1tz.js";
11
11
  import {
12
12
  FileSys
13
13
  } from "./index-67546d0j.js";
@@ -2,11 +2,14 @@
2
2
  import {
3
3
  workflowRunArtifactPath,
4
4
  workflowSyncDir
5
- } from "./index-4zgs8g1w.js";
5
+ } from "./index-m4kpmmtj.js";
6
6
  import {
7
7
  AppExecutor,
8
- LibExecutor
9
- } from "./index-jtm86byd.js";
8
+ LibExecutor,
9
+ appRootAllowedDirs,
10
+ appRootAllowedFiles,
11
+ isScannedAppRootEntry
12
+ } from "./index-47qxw1tz.js";
10
13
  import {
11
14
  collectRecipeSources,
12
15
  findInlineRecipeDuplicates,
@@ -150,33 +153,6 @@ var moduleShapeFiles = (module) => {
150
153
  ];
151
154
  };
152
155
  var constantFieldNames = (content) => [...content.matchAll(/\b([A-Za-z_$][\w$]*)\s*:\s*field\(/g)].map((match) => match[1]).filter(Boolean);
153
- var appRootAllowFiles = new Set([
154
- "AGENTS.md",
155
- "CLAUDE.md",
156
- "akan.app.json",
157
- "akan.config.ts",
158
- "capacitor.config.ts",
159
- "client.ts",
160
- "main.ts",
161
- "package.json",
162
- "server.ts",
163
- "tsconfig.json"
164
- ]);
165
- var appRootAllowDirs = new Set([
166
- ".akan",
167
- "android",
168
- "common",
169
- "env",
170
- "ios",
171
- "lib",
172
- "page",
173
- "private",
174
- "public",
175
- "script",
176
- "srvkit",
177
- "ui",
178
- "webkit"
179
- ]);
180
156
  var safeReadDir = async (dirPath) => {
181
157
  try {
182
158
  return (await readdir(dirPath, { withFileTypes: true })).sort((a, b) => a.name.localeCompare(b.name));
@@ -404,7 +380,9 @@ class AkanContextAnalyzer {
404
380
  for (const app of context.apps) {
405
381
  const appPath = path.join(workspace.workspaceRoot, app.path);
406
382
  for (const entry of await safeReadDir(appPath)) {
407
- const allowed = entry.isDirectory() ? appRootAllowDirs.has(entry.name) : appRootAllowFiles.has(entry.name);
383
+ if (!isScannedAppRootEntry(entry.name))
384
+ continue;
385
+ const allowed = entry.isDirectory() ? appRootAllowedDirs.has(entry.name) : appRootAllowedFiles.has(entry.name);
408
386
  if (!allowed) {
409
387
  const action = repairAction("module-shape", `akan repair module-shape --app ${app.name}`, "Review app root shape and remove or move the unknown entry.", false);
410
388
  diagnostics.push({
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  AppExecutor,
4
4
  LibExecutor
5
- } from "./index-jtm86byd.js";
5
+ } from "./index-47qxw1tz.js";
6
6
 
7
7
  // pkgs/@akanjs/devkit/workflow/utils.ts
8
8
  var jsonText = (value, { trailingNewline = true } = {}) => `${JSON.stringify(value, null, 2)}${trailingNewline ? `
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-jk9q6pse.js";
5
+ } from "./index-jkynkyfk.js";
6
6
  import {
7
7
  PkgExecutor
8
- } from "./index-jtm86byd.js";
8
+ } from "./index-47qxw1tz.js";
9
9
  import {
10
10
  TypeScriptDependencyScanner
11
11
  } from "./index-46tjzh6s.js";
@@ -1,24 +1,24 @@
1
1
  // @bun
2
2
  import {
3
3
  CloudRunner
4
- } from "./index-xj8bks3p.js";
4
+ } from "./index-p6txr1ss.js";
5
5
  import {
6
6
  PackageScript
7
- } from "./index-e3qskyt2.js";
7
+ } from "./index-meh7mmz9.js";
8
8
  import {
9
9
  AiSession,
10
10
  CloudApi,
11
11
  GlobalConfig
12
- } from "./index-3pgtw35d.js";
12
+ } from "./index-0cj2zxbm.js";
13
13
  import {
14
14
  ApplicationScript
15
- } from "./index-tq1y56tp.js";
15
+ } from "./index-nx1vbtsc.js";
16
16
  import {
17
17
  script
18
- } from "./index-jk9q6pse.js";
18
+ } from "./index-jkynkyfk.js";
19
19
  import {
20
20
  PkgExecutor
21
- } from "./index-jtm86byd.js";
21
+ } from "./index-47qxw1tz.js";
22
22
 
23
23
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
24
24
  import { Logger } from "akanjs/common";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./index-76rn3g2c.js";
6
6
  import {
7
7
  CommandExecutionError
8
- } from "./index-jtm86byd.js";
8
+ } from "./index-47qxw1tz.js";
9
9
 
10
10
  // pkgs/@akanjs/devkit/capacitorApp.ts
11
11
  import { cp, mkdir, readFile, rm, writeFile } from "fs/promises";
@@ -514,10 +514,6 @@ function getAdbDeviceStateIssues(output) {
514
514
  return [];
515
515
  });
516
516
  }
517
- function getAndroidLocalServerHost(adbDevicesOutput, fallbackHost) {
518
- const onlineDeviceIds = adbDevicesOutput?.split(/\r?\n/).map((line) => line.trim().split(/\s+/)).filter(([id, state]) => id && state === "device").map(([id]) => id) ?? [];
519
- return onlineDeviceIds.length === 1 && onlineDeviceIds[0]?.startsWith("emulator-") ? "10.0.2.2" : fallbackHost;
520
- }
521
517
  var ANDROID_MIN_SDK_VERSION = 26;
522
518
  function raiseGradleMinSdkVersion(content, floor = ANDROID_MIN_SDK_VERSION) {
523
519
  const match = content.match(/minSdkVersion\s*=\s*(\d+)/);
@@ -695,7 +691,7 @@ class CapacitorApp {
695
691
  async save() {
696
692
  await this.project.commit();
697
693
  }
698
- async#prepareIos({ operation, env, regenerate = false, iosRunTargetKind }) {
694
+ async#prepareIos({ operation, env, regenerate = false }) {
699
695
  await this.init({ platform: "ios", operation, env, regenerate });
700
696
  await this.#prepareTargetAssets();
701
697
  await this.#prepareExternalFiles("ios");
@@ -704,10 +700,9 @@ class CapacitorApp {
704
700
  await this.#applyDeepLinks("ios", { operation, env });
705
701
  await this.#flushIosEntitlements();
706
702
  await this.project.commit();
707
- await this.#setCodeSignEntitlementsInIosIfExists("App/App.entitlements");
708
703
  await this.#generateAssets({ operation, env });
709
704
  this.app.verbose(`syncing iOS`);
710
- await this.#spawnMobile("npx", ["cap", "sync", "ios"], { operation, env }, { iosRunTargetKind });
705
+ await this.#spawnMobile("npx", ["cap", "sync", "ios"], { operation, env });
711
706
  this.app.verbose(`sync completed.`);
712
707
  }
713
708
  async buildIos({ env = "debug", regenerate = false } = {}) {
@@ -726,10 +721,10 @@ class CapacitorApp {
726
721
  async runIos({ operation, env, regenerate = false, noAllowProvisioningUpdates = false, iosDeviceId }) {
727
722
  if (operation === "release")
728
723
  await this.prepareWww();
724
+ await this.#prepareIos({ operation, env, regenerate });
729
725
  const runTarget = await this.#selectIosRunTarget(iosDeviceId);
730
- await this.#prepareIos({ operation, env, regenerate, iosRunTargetKind: runTarget.kind });
731
726
  if (runTarget.kind === "simulator") {
732
- await this.#spawnMobile("npx", ["cap", "run", "ios", "--target", runTarget.id, "--no-sync"], { operation, env }, { stdio: "inherit", platform: "ios", iosRunTargetKind: runTarget.kind });
727
+ await this.#spawnMobile("npx", ["cap", "run", "ios", "--target", runTarget.id], { operation, env }, { stdio: "inherit" });
733
728
  return;
734
729
  }
735
730
  await this.#runIosPhysicalDevice({ operation, env, runTarget, noAllowProvisioningUpdates });
@@ -805,7 +800,7 @@ ${textError instanceof Error ? textError.message : ""}`);
805
800
  noAllowProvisioningUpdates
806
801
  }) {
807
802
  const mobileEnv = sanitizeIosNativeRunEnv(await this.#commandEnv(operation, env));
808
- const configContent = await this.#writeCapacitorConfig({ operation, platform: "ios", iosRunTargetKind: runTarget.kind }, mobileEnv);
803
+ const configContent = await this.#writeCapacitorConfig({ operation }, mobileEnv);
809
804
  await this.#writeRootCapacitorConfig(configContent);
810
805
  const scheme = this.#iosScheme();
811
806
  const command = buildIosNativeRunCommand({
@@ -862,7 +857,6 @@ ${error.message}`;
862
857
  await this.#applyAndroidMinSdkVersion();
863
858
  await this.#applyPermissions({ operation, env });
864
859
  await this.#applyDeepLinks("android", { operation, env });
865
- await this.#disableNativeKeyboardResizeInAndroid();
866
860
  await this.project.commit();
867
861
  await this.#generateAssets({ operation, env });
868
862
  await this.#ensureAndroidAssetsDir();
@@ -922,23 +916,6 @@ ${error.message}`;
922
916
  async openAndroid() {
923
917
  await this.#spawnMobile("npx", ["cap", "open", "android"], { operation: "local", env: "local" });
924
918
  }
925
- async#disableNativeKeyboardResizeInAndroid() {
926
- const manifestPath = path.join(this.app.cwdPath, this.androidRootPath, "app/src/main/AndroidManifest.xml");
927
- let manifest = await readFile(manifestPath, "utf8");
928
- let changed = false;
929
- manifest = manifest.replace(/<activity\b[^>]*android:name="\.MainActivity"[^>]*>/, (activityTag) => {
930
- if (activityTag.includes("android:windowSoftInputMode=")) {
931
- const nextTag = activityTag.replace(/android:windowSoftInputMode="[^"]*"/, 'android:windowSoftInputMode="adjustNothing"');
932
- changed ||= nextTag !== activityTag;
933
- return nextTag;
934
- }
935
- changed = true;
936
- return activityTag.replace(/>$/, `
937
- android:windowSoftInputMode="adjustNothing">`);
938
- });
939
- if (changed)
940
- await writeFile(manifestPath, manifest);
941
- }
942
919
  async#ensureAndroidAssetsDir() {
943
920
  await mkdir(path.join(this.app.cwdPath, this.androidAssetsPath), { recursive: true });
944
921
  }
@@ -1028,16 +1005,12 @@ ${error.message}`;
1028
1005
  return html.replace(/<\/head\s*>/i, `${script}
1029
1006
  </head>`);
1030
1007
  }
1031
- async#writeCapacitorConfig({
1032
- operation,
1033
- platform,
1034
- iosRunTargetKind
1035
- }, commandEnv) {
1008
+ async#writeCapacitorConfig({ operation }, commandEnv) {
1036
1009
  await mkdir(this.targetRoot, { recursive: true });
1037
1010
  let localIp;
1038
1011
  if (operation === "local") {
1039
1012
  const override = commandEnv.AKAN_PUBLIC_CLIENT_HOST ?? process.env.AKAN_PUBLIC_CLIENT_HOST;
1040
- const resolution = await this.#resolveLocalDevHost({ override, platform, iosRunTargetKind });
1013
+ const resolution = selectLocalDevHost(os.networkInterfaces(), { override });
1041
1014
  localIp = resolution.host;
1042
1015
  this.#logDevHostResolution(resolution, commandEnv);
1043
1016
  }
@@ -1051,29 +1024,9 @@ ${error.message}`;
1051
1024
  await Bun.write(path.join(this.targetRoot, "capacitor.config.json"), content);
1052
1025
  return content;
1053
1026
  }
1054
- async#resolveLocalDevHost({
1055
- override,
1056
- platform,
1057
- iosRunTargetKind
1058
- }) {
1059
- const resolution = selectLocalDevHost(os.networkInterfaces(), { override });
1060
- if (resolution.source === "override")
1061
- return resolution;
1062
- if (platform === "ios" && iosRunTargetKind === "simulator")
1063
- return { ...resolution, host: "localhost", source: "platform" };
1064
- if (platform === "android") {
1065
- try {
1066
- const host = getAndroidLocalServerHost(await this.#spawn("adb", ["devices"]), resolution.host);
1067
- return host === resolution.host ? resolution : { ...resolution, host, source: "platform" };
1068
- } catch {
1069
- return resolution;
1070
- }
1071
- }
1072
- return resolution;
1073
- }
1074
1027
  #logDevHostResolution(resolution, commandEnv) {
1075
1028
  this.app.log(`Mobile live-reload server: ${this.#localCsrUrl(resolution.host, commandEnv)}`);
1076
- if (resolution.source === "override" || resolution.source === "platform")
1029
+ if (resolution.source === "override")
1077
1030
  return;
1078
1031
  const suspicious = resolution.host === "127.0.0.1" || resolution.host.startsWith("169.254.");
1079
1032
  const alternatives = resolution.candidates.filter((candidate) => candidate.address !== resolution.host);
@@ -1273,26 +1226,18 @@ ${error.message}`;
1273
1226
  return await this.app.spawn(command, args, { cwd: this.app.cwdPath, ...options });
1274
1227
  }
1275
1228
  async#spawnMobile(command, args = [], { operation, env }, options = {}) {
1276
- const { iosRunTargetKind, platform, ...spawnOptions } = options;
1277
1229
  const mobileEnv = { ...await this.#commandEnv(operation, env), ...options.env };
1278
- const configContent = await this.#writeCapacitorConfig({ operation, platform: platform ?? this.#inferMobilePlatform(args), iosRunTargetKind }, mobileEnv);
1230
+ const configContent = await this.#writeCapacitorConfig({ operation }, mobileEnv);
1279
1231
  await this.#writeRootCapacitorConfig(configContent);
1280
1232
  try {
1281
1233
  return await this.#spawn(command, args, {
1282
- ...spawnOptions,
1234
+ ...options,
1283
1235
  env: mobileEnv
1284
1236
  });
1285
1237
  } finally {
1286
1238
  await this.#clearRootCapacitorConfigs();
1287
1239
  }
1288
1240
  }
1289
- #inferMobilePlatform(args) {
1290
- if (args.includes("android"))
1291
- return "android";
1292
- if (args.includes("ios"))
1293
- return "ios";
1294
- return;
1295
- }
1296
1241
  async addCamera() {
1297
1242
  await this.#setPermissionInIos({
1298
1243
  cameraUsageDescription: "$(PRODUCT_NAME) requires access to the camera to take photos.",
@@ -1394,31 +1339,17 @@ ${error.message}`;
1394
1339
  while (end < lines.length && !/^\s*\};\s*$/.test(lines[end] ?? ""))
1395
1340
  end++;
1396
1341
  const settings = lines.slice(start, end + 1);
1397
- const configName = lines.slice(end + 1, end + 8).find((setting) => setting.includes("name = ")) ?? "";
1342
+ if (settings.some((setting) => setting.includes("CODE_SIGN_ENTITLEMENTS")))
1343
+ continue;
1398
1344
  const indent = line.match(/^\s*/)?.[0] ?? "";
1399
- const insertSettings = [];
1400
- if (!settings.some((setting) => setting.includes("CODE_SIGN_ENTITLEMENTS"))) {
1401
- insertSettings.push(`${indent}CODE_SIGN_ENTITLEMENTS = ${entitlementsRelPath};`);
1402
- }
1403
- if (configName.includes("name = Debug;") && !settings.some((setting) => setting.includes("CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION"))) {
1404
- insertSettings.push(`${indent}CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION = YES;`);
1405
- }
1406
- if (insertSettings.length > 0) {
1407
- lines.splice(index, 0, ...insertSettings);
1408
- index += insertSettings.length;
1409
- changed = true;
1410
- }
1345
+ lines.splice(index, 0, `${indent}CODE_SIGN_ENTITLEMENTS = ${entitlementsRelPath};`);
1346
+ index++;
1347
+ changed = true;
1411
1348
  }
1412
1349
  if (changed)
1413
1350
  await writeFile(pbxprojPath, lines.join(`
1414
1351
  `));
1415
1352
  }
1416
- async#setCodeSignEntitlementsInIosIfExists(entitlementsRelPath) {
1417
- const entitlementsPath = path.join(this.app.cwdPath, this.iosProjectPath, entitlementsRelPath);
1418
- if (!await Bun.file(entitlementsPath).exists())
1419
- return;
1420
- await this.#setCodeSignEntitlementsInIos(entitlementsRelPath);
1421
- }
1422
1353
  async#setUrlSchemesInAndroid(schemes) {
1423
1354
  const manifestPath = path.join(this.app.cwdPath, this.androidRootPath, "app/src/main/AndroidManifest.xml");
1424
1355
  let manifest = await readFile(manifestPath, "utf8");
@@ -1513,4 +1444,4 @@ ${filter}$1`);
1513
1444
  }
1514
1445
  }
1515
1446
 
1516
- export { SWIFTUICORE_MIN_IOS_MAJOR, rootCapacitorConfigFilenames, rootCapacitorConfigPaths, clearRootCapacitorConfigs, writeRootCapacitorConfig, selectLocalDevHost, parseIosRuntimeMajor, sortIosRunTargets, parseDevicectlDevices, parseSimctlDevices, buildIosNativeRunCommand, classifyIosRunFailure, formatIosRunFailureMessage, sanitizeIosNativeRunEnv, PLACEHOLDER_APP_IDS, isPlaceholderAppId, getMissingAndroidReleaseSigningKeys, formatAndroidReleaseSigningError, getAdbDeviceStateIssues, getAndroidLocalServerHost, ANDROID_MIN_SDK_VERSION, raiseGradleMinSdkVersion, assertJsonSerializable, materializeCapacitorConfig, CapacitorApp };
1447
+ export { SWIFTUICORE_MIN_IOS_MAJOR, rootCapacitorConfigFilenames, rootCapacitorConfigPaths, clearRootCapacitorConfigs, writeRootCapacitorConfig, selectLocalDevHost, parseIosRuntimeMajor, sortIosRunTargets, parseDevicectlDevices, parseSimctlDevices, buildIosNativeRunCommand, classifyIosRunFailure, formatIosRunFailureMessage, sanitizeIosNativeRunEnv, PLACEHOLDER_APP_IDS, isPlaceholderAppId, getMissingAndroidReleaseSigningKeys, formatAndroidReleaseSigningError, getAdbDeviceStateIssues, ANDROID_MIN_SDK_VERSION, raiseGradleMinSdkVersion, assertJsonSerializable, materializeCapacitorConfig, CapacitorApp };
@@ -4,6 +4,10 @@ import ora from "ora";
4
4
 
5
5
  class Spinner {
6
6
  static padding = 12;
7
+ static oraOptions = { discardStdin: false };
8
+ static canAnimate(stream = process.stderr) {
9
+ return !stream.isTTY || stream.columns > 0;
10
+ }
7
11
  spinner;
8
12
  stopWatch = null;
9
13
  startAt = new Date;
@@ -14,10 +18,10 @@ class Spinner {
14
18
  Spinner.padding = Math.max(Spinner.padding, prefix.length);
15
19
  this.prefix = prefix;
16
20
  this.message = message;
17
- this.spinner = ora(message);
21
+ this.spinner = ora({ ...Spinner.oraOptions, text: message });
18
22
  this.spinner.prefixText = prefix.padStart(Spinner.padding, " ");
19
23
  this.spinner.indent = indent;
20
- this.enableSpin = enableSpin;
24
+ this.enableSpin = enableSpin && Spinner.canAnimate();
21
25
  }
22
26
  start() {
23
27
  this.startAt = new Date;
@@ -1,14 +1,14 @@
1
1
  // @bun
2
2
  import {
3
3
  AkanContextAnalyzer
4
- } from "./index-4yp06pn1.js";
4
+ } from "./index-jn9vfpwz.js";
5
5
  import {
6
6
  Prompter
7
- } from "./index-xwgm94zr.js";
7
+ } from "./index-qp089jp0.js";
8
8
  import {
9
9
  runner,
10
10
  script
11
- } from "./index-jk9q6pse.js";
11
+ } from "./index-jkynkyfk.js";
12
12
  import {
13
13
  AGENT_BLOCK_END,
14
14
  AGENT_BLOCK_START,
@@ -16,7 +16,7 @@ import {
16
16
  LibExecutor,
17
17
  renderRecipeEntries,
18
18
  upsertAgentBlock
19
- } from "./index-jtm86byd.js";
19
+ } from "./index-47qxw1tz.js";
20
20
  import {
21
21
  collectRecipeSources,
22
22
  scanRecipes