@akanjs/cli 3.1.0-rc.8 → 3.1.0

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 (92) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-rkjyxgec.js → CodeAgent-c53dm40p.js} +2 -2
  3. package/{CodeAgentRpcHost-p7h6n2hp.js → CodeAgentRpcHost-9g27hmer.js} +1 -1
  4. package/{CodeTui-h7pyj6xa.js → CodeTui-xz9jtrn3.js} +47 -4
  5. package/README.ko.md +1 -1
  6. package/README.md +1 -1
  7. package/TunnelShare-59zd4j8n.js +14 -0
  8. package/{agent.command-3qxf4xcj.js → agent.command-qawf7z4s.js} +5 -5
  9. package/akanCode.js +7 -5
  10. package/{application.command-m1kcd7jf.js → application.command-jqrgqk6j.js} +35 -9
  11. package/{applicationBuildRunner-dj0xkrep.js → applicationBuildRunner-grgrey5c.js} +23 -8
  12. package/buildBatch.proc.js +9 -9
  13. package/{cloud.command-3jzym8q7.js → cloud.command-p9067ssj.js} +13 -13
  14. package/cloud.script-f0r4ce7j.js +24 -0
  15. package/{code.command-0ad6gw2a.js → code.command-t6j55sbk.js} +25 -12
  16. package/commandManifest.json +1 -1
  17. package/{context.command-0qx447mb.js → context.command-eqbzbgth.js} +16 -16
  18. package/context.runner-1cs88ags.js +25 -0
  19. package/{guideline.command-cv5bmrx2.js → guideline.command-w905q73w.js} +2 -2
  20. package/guidelines/agentRule/agentRule.instruction.md +25 -10
  21. package/guidelines/conventions/conventions.instruction.md +71 -24
  22. package/guidelines/fieldRule/fieldRule.instruction.md +17 -0
  23. package/guidelines/mcpRule/mcpRule.instruction.md +93 -48
  24. package/guidelines/modelDocument/modelDocument.instruction.md +2 -1
  25. package/guidelines/modelStore/modelStore.instruction.md +7 -0
  26. package/guidelines/pageRule/pageRule.instruction.md +55 -8
  27. package/guidelines/queryRule/queryRule.instruction.md +24 -10
  28. package/guidelines/runtimeRule/runtimeRule.instruction.md +12 -4
  29. package/guidelines/ssrRule/ssrRule.instruction.md +9 -6
  30. package/guidelines/transportRule/transportRule.instruction.md +36 -5
  31. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +5 -3
  32. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +28 -8
  33. package/incrementalBuilder.proc.js +3 -3
  34. package/{index-j4mkhz93.js → index-0dd6z4b9.js} +3 -3
  35. package/{index-h47cf1gg.js → index-1de5f0qq.js} +7 -7
  36. package/{index-6xn2n442.js → index-1enc9rga.js} +4 -4
  37. package/index-25ks6x4k.js +643 -0
  38. package/{index-wa5jbxj1.js → index-2mrn1mrg.js} +1 -0
  39. package/{index-qwa5k1j8.js → index-3aynkpf8.js} +1 -1
  40. package/{index-vk0pa0mn.js → index-3hvmytbs.js} +2 -1
  41. package/{index-w44cy4vs.js → index-45c0mxb6.js} +2 -2
  42. package/{index-fyq1z6kt.js → index-48n4yhm4.js} +3 -3
  43. package/{index-192ha4xh.js → index-64pjry21.js} +1 -1
  44. package/{index-5edzv8fn.js → index-aqwdjn4x.js} +2 -2
  45. package/{index-d2242ksy.js → index-at7bz0xq.js} +3 -0
  46. package/{index-9z426msb.js → index-avjqbtkj.js} +7 -6
  47. package/{index-20bxxyvn.js → index-bs9yr4we.js} +40 -2
  48. package/{index-d72hfmdm.js → index-cgexcnwd.js} +8 -8
  49. package/{index-1xj2t7cb.js → index-dkfadmrx.js} +7 -7
  50. package/{index-35hc95h5.js → index-eabfsarf.js} +1 -1
  51. package/{index-pydbnfez.js → index-er62k6w3.js} +35 -9
  52. package/{index-1p98exm2.js → index-f2gfq0yh.js} +2 -2
  53. package/{index-jw1zm273.js → index-fbw3kmt5.js} +54 -10
  54. package/{index-4mhy6qme.js → index-fnqj2d2w.js} +4 -4
  55. package/{index-awbdfcf2.js → index-hqh4mpgt.js} +4 -4
  56. package/{index-fmzcs8v6.js → index-j4dzazmw.js} +4 -4
  57. package/{index-va06nr10.js → index-n8dsax1f.js} +64 -19
  58. package/{index-g1mbppa9.js → index-nr8m4j21.js} +5 -5
  59. package/{index-86jt2a0e.js → index-qh73jnyb.js} +1 -1
  60. package/{index-8fp3b47h.js → index-vtj332gj.js} +281 -46
  61. package/{index-tamvyvj3.js → index-wt7m1hfc.js} +3 -3
  62. package/{index-cpb3nvma.js → index-yfy3t4kw.js} +2 -2
  63. package/{index-trpasv9q.js → index-yyxy7aff.js} +1 -1
  64. package/{index-d47ypebv.js → index-z5cxrbvv.js} +75 -19
  65. package/index.js +40 -22
  66. package/{library.command-erp2f56n.js → library.command-z1v7zepj.js} +3 -3
  67. package/{localRegistry.command-xxpqgxjw.js → localRegistry.command-48n23bjy.js} +12 -12
  68. package/{module.command-gs2r615e.js → module.command-rv307dk7.js} +5 -5
  69. package/{package.command-7343f74r.js → package.command-7xkzc8m1.js} +3 -3
  70. package/package.json +22 -22
  71. package/{page.command-4h4a8pnh.js → page.command-34hpdt7v.js} +3 -3
  72. package/{pipeline.command-a2nrk26m.js → pipeline.command-ckvhrpyg.js} +2 -2
  73. package/{primitive.command-w6t0asqz.js → primitive.command-em0twr5a.js} +6 -6
  74. package/{projectTypecheck-f534enqj.js → projectTypecheck-fy6hn05y.js} +1 -1
  75. package/{quality.command-77x7vbbx.js → quality.command-c6p2819k.js} +2 -2
  76. package/{repair.command-y6sstev7.js → repair.command-j6czdgrv.js} +5 -5
  77. package/{routeSourceValidator-7ycnfz0e.js → routeSourceValidator-6jd0q6r6.js} +47 -14
  78. package/{scalar.command-20b8cy0k.js → scalar.command-17e20sj2.js} +4 -4
  79. package/skills/akan-code/SKILL.md +4 -0
  80. package/skills/akan-store/SKILL.md +4 -2
  81. package/{subspace.command-92xkc0s0.js → subspace.command-n3j7vv0w.js} +8 -17
  82. package/templates/migration/__migrationId__.ts +23 -0
  83. package/templates/server.ts +8 -1
  84. package/templates/workspaceRoot/.gitignore.template +1 -1
  85. package/templates/workspaceRoot/biome.json.template +1 -1
  86. package/{tunnel.command-2kw8vt9g.js → tunnel.command-cm578f4s.js} +7 -7
  87. package/{workflow.command-2djwmpqf.js → workflow.command-h9vkr6jb.js} +10 -10
  88. package/{workspace.command-5se6spqb.js → workspace.command-tp8ysvjs.js} +30 -28
  89. package/TunnelShare-661cxz5e.js +0 -14
  90. package/cloud.script-r4nskbc6.js +0 -24
  91. package/context.runner-1vsjztjg.js +0 -25
  92. package/index-665zp9rs.js +0 -271
@@ -39,18 +39,21 @@ import {
39
39
  import {
40
40
  runner,
41
41
  script,
42
+ markCliErrorPrinted,
42
43
  assertPromptable
43
- } from "./index-jw1zm273.js";
44
+ } from "./index-fbw3kmt5.js";
44
45
  import {
46
+ AppInfo,
47
+ CommandExecutionError,
45
48
  WorkspaceExecutor,
46
49
  AppExecutor,
47
50
  LibExecutor,
48
51
  PkgExecutor
49
- } from "./index-va06nr10.js";
52
+ } from "./index-n8dsax1f.js";
50
53
  import {
51
54
  DesktopServerStage,
52
55
  UpdateUploader
53
- } from "./index-vk0pa0mn.js";
56
+ } from "./index-3hvmytbs.js";
54
57
  import {
55
58
  resolveMobileTargets,
56
59
  resolveAppId
@@ -59,17 +62,17 @@ import {
59
62
  NativePublicEnv,
60
63
  UpdatePackFolder,
61
64
  NativeApp
62
- } from "./index-g1mbppa9.js";
65
+ } from "./index-nr8m4j21.js";
63
66
  import {
64
67
  LibraryScript
65
- } from "./index-pydbnfez.js";
68
+ } from "./index-er62k6w3.js";
66
69
  import {
67
70
  stripAnsi
68
71
  } from "./index-7md2g9vw.js";
69
72
  import {
70
73
  SlicePlanner,
71
74
  formatSlicePlan
72
- } from "./index-35hc95h5.js";
75
+ } from "./index-eabfsarf.js";
73
76
  import {
74
77
  openBrowser
75
78
  } from "./index-9dp031by.js";
@@ -1896,7 +1899,7 @@ ${uniqueCandidates.map((candidate) => ` - ${candidate}`).join(`
1896
1899
 
1897
1900
  // pkgs/@akanjs/cli/application/application.runner.ts
1898
1901
  import { Logger as Logger3, toError } from "akanjs/common";
1899
- var loadBuildRunner = async () => (await import("./applicationBuildRunner-dj0xkrep.js")).ApplicationBuildRunner;
1902
+ var loadBuildRunner = async () => (await import("./applicationBuildRunner-grgrey5c.js")).ApplicationBuildRunner;
1900
1903
  var loadPrompts = async () => await import("@inquirer/prompts");
1901
1904
 
1902
1905
  class ApplicationRunner extends runner("application") {
@@ -1938,8 +1941,12 @@ class ApplicationRunner extends runner("application") {
1938
1941
  const scriptPath = `script/${scriptName}.ts`;
1939
1942
  if (!await app.exists(scriptPath))
1940
1943
  throw new Error(`Script file not found: apps/${app.name}/${scriptPath}`);
1941
- await app.spawn("bun", [scriptPath], {
1942
- env: app.getCommandEnv({ AKAN_COMMAND_TYPE: "script", ...await app.getDatabaseModeEnv() }),
1944
+ await this.#spawnFromRoot(app, "script", [`${app.cwdPath}/${scriptPath}`]);
1945
+ }
1946
+ async#spawnFromRoot(app, commandType, args) {
1947
+ await app.spawn("bun", args, {
1948
+ cwd: app.workspace.workspaceRoot,
1949
+ env: app.getCommandEnv({ AKAN_COMMAND_TYPE: commandType, ...await app.getDatabaseModeEnv() }),
1943
1950
  stdio: "inherit"
1944
1951
  });
1945
1952
  }
@@ -2026,10 +2033,7 @@ try {
2026
2033
  await server.stop();
2027
2034
  }
2028
2035
  `;
2029
- await app.spawn("bun", ["-e", code], {
2030
- env: app.getCommandEnv({ AKAN_COMMAND_TYPE: "console", ...await app.getDatabaseModeEnv() }),
2031
- stdio: "inherit"
2032
- });
2036
+ await this.#spawnFromRoot(app, "console", ["-e", code]);
2033
2037
  }
2034
2038
  async transferDatabase(app, direction, dir) {
2035
2039
  const serverPath = `${app.cwdPath}/server.ts`;
@@ -2048,16 +2052,55 @@ try {
2048
2052
  await server.stop();
2049
2053
  }
2050
2054
  `;
2051
- await app.spawn("bun", ["-e", code], {
2052
- env: app.getCommandEnv({ AKAN_COMMAND_TYPE: "script", ...await app.getDatabaseModeEnv() }),
2053
- stdio: "inherit"
2055
+ await this.#spawnFromRoot(app, "script", ["-e", code]);
2056
+ }
2057
+ async migrate(app, argv) {
2058
+ const serverPath = `${app.cwdPath}/server.ts`;
2059
+ if (!await app.exists("server.ts"))
2060
+ throw new Error(`Server file not found: apps/${app.name}/server.ts`);
2061
+ const code = `
2062
+ const argv = ${JSON.stringify(argv)};
2063
+ let loaded;
2064
+ try {
2065
+ loaded = await import(${JSON.stringify(serverPath)});
2066
+ } catch (error) {
2067
+ console.error(error);
2068
+ const { MigrationCommand } = await import("akanjs/server");
2069
+ process.exitCode = await MigrationCommand.print(MigrationCommand.failure(null, error), MigrationCommand.jsonOf(argv));
2070
+ }
2071
+ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, argv, ${JSON.stringify(`akan migrate ${app.name}`)});
2072
+ `;
2073
+ try {
2074
+ await this.#spawnFromRoot(app, "script", ["-e", code]);
2075
+ } catch (error) {
2076
+ if (!(error instanceof CommandExecutionError) || error.code === null)
2077
+ throw error;
2078
+ process.exitCode = error.code;
2079
+ }
2080
+ }
2081
+ async createMigration(app, migrationName, now = new Date) {
2082
+ const words = migrationName.split(/[^A-Za-z0-9]+/).filter(Boolean);
2083
+ const name = words.map((word, idx) => (idx ? word.charAt(0).toUpperCase() : word.charAt(0).toLowerCase()) + word.slice(1)).join("");
2084
+ if (!/^[A-Za-z][A-Za-z0-9]*$/.test(name))
2085
+ throw new Error(`"${migrationName}" is no migration name; name what it does in camelCase, e.g. bizLicenseOwnership`);
2086
+ const migrationId = `${now.toISOString().replace(/\D/g, "").slice(0, 12)}_${name}`;
2087
+ const filePath = `${AppInfo.migrationDir}/${migrationId}.ts`;
2088
+ if (await app.exists(filePath))
2089
+ throw new Error(`apps/${app.name}/${filePath} already exists`);
2090
+ const title = name.replace(/([a-z0-9])([A-Z])/g, "$1 $2").toLowerCase();
2091
+ await app.applyTemplate({
2092
+ basePath: AppInfo.migrationDir,
2093
+ template: "migration",
2094
+ dict: { migrationId, title: title.charAt(0).toUpperCase() + title.slice(1) },
2095
+ overwrite: false
2054
2096
  });
2097
+ return migrationId;
2055
2098
  }
2056
2099
  async typecheck(app, options = {}) {
2057
2100
  await new (await loadBuildRunner())(app).typecheck(options);
2058
2101
  }
2059
2102
  async typecheckLibrary(lib, options = {}) {
2060
- const { ProjectTypecheck } = await import("./projectTypecheck-f534enqj.js");
2103
+ const { ProjectTypecheck } = await import("./projectTypecheck-fy6hn05y.js");
2061
2104
  const root = lib.workspace.workspaceRoot;
2062
2105
  await new ProjectTypecheck(lib.cwdPath, root, { ...process.env, AKAN_WORKSPACE_ROOT: root }).run([
2063
2106
  "../../server.ts",
@@ -3339,6 +3382,14 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
3339
3382
  await app.scanSync();
3340
3383
  await this.applicationRunner.runConsole(app);
3341
3384
  }
3385
+ async migrate(app, argv) {
3386
+ await app.scanSync();
3387
+ await this.applicationRunner.migrate(app, argv);
3388
+ }
3389
+ async createMigration(app, migrationName) {
3390
+ const migrationId = await this.applicationRunner.createMigration(app, migrationName);
3391
+ Logger6.rawLog(`Created apps/${app.name}/script/migration/${migrationId}.ts; plan it with \`akan migrate ${app.name} plan ${migrationId}\``);
3392
+ }
3342
3393
  async logs(app, options) {
3343
3394
  await this.applicationRunner.runLogs(app, options);
3344
3395
  }
@@ -3359,6 +3410,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
3359
3410
  } catch (error) {
3360
3411
  Logger6.rawLog(`${app.name} build failed in dist/apps/${app.name}`, undefined, "error");
3361
3412
  Logger6.rawLog(ApplicationBuildReporter.formatError(error), undefined, "error");
3413
+ markCliErrorPrinted(error);
3362
3414
  throw error;
3363
3415
  }
3364
3416
  }
@@ -3381,12 +3433,16 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
3381
3433
  } catch (error) {
3382
3434
  spinner.fail(`${exec.name} typecheck failed`);
3383
3435
  Logger6.rawLog(ApplicationBuildReporter.formatError(error), undefined, "error");
3436
+ markCliErrorPrinted(error);
3384
3437
  throw error;
3385
3438
  }
3386
3439
  }
3387
3440
  async test(exec, { write = true } = {}) {
3388
3441
  if (exec instanceof LibExecutor) {
3389
- await this.libraryScript.syncLibrary(exec);
3442
+ if (write)
3443
+ await this.libraryScript.syncLibrary(exec);
3444
+ else
3445
+ await exec.scan({ write: false });
3390
3446
  exec.spinning(`Preparing ${exec.name}...`).succeed(`${exec.name} prepared`);
3391
3447
  await this.applicationRunner.test(exec);
3392
3448
  return;
@@ -3635,7 +3691,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
3635
3691
  await Promise.all(shares.map(async (share) => await share.close()));
3636
3692
  }, "Abandoning the tunnel release; the shares expire on their own.");
3637
3693
  await Promise.all(apps.map(async (app) => {
3638
- const { TunnelShare } = await import("./TunnelShare-661cxz5e.js");
3694
+ const { TunnelShare } = await import("./TunnelShare-59zd4j8n.js");
3639
3695
  const share = await TunnelShare.open(app, { workspace: app.workspace });
3640
3696
  shares.push(share);
3641
3697
  urls.set(app.name, share.url);
package/index.js CHANGED
@@ -4,35 +4,44 @@ import {
4
4
  getTargetMetas,
5
5
  getTargetCommandNames,
6
6
  runCommands
7
- } from "./index-jw1zm273.js";
7
+ } from "./index-fbw3kmt5.js";
8
8
  import"./index-52w0fvh8.js";
9
- import"./index-va06nr10.js";
9
+ import"./index-n8dsax1f.js";
10
+
11
+ // pkgs/@akanjs/cli/bunVersionGuard.ts
12
+ class BunVersionGuard {
13
+ static refusal(bunVersion, range) {
14
+ if (Bun.semver.satisfies(bunVersion.replace(/-.*$/, ""), range))
15
+ return null;
16
+ return `akan requires Bun ${range}, but this is Bun ${bunVersion}. Run \`bun upgrade\`, then try again.`;
17
+ }
18
+ }
10
19
 
11
20
  // pkgs/@akanjs/cli/commandManifest.ts
12
21
  import path from "path";
13
22
 
14
23
  // pkgs/@akanjs/cli/commandModules.ts
15
24
  var commandModules = {
16
- workspace: async () => (await import("./workspace.command-5se6spqb.js")).WorkspaceCommand,
17
- agent: async () => (await import("./agent.command-3qxf4xcj.js")).AgentCommand,
18
- code: async () => (await import("./code.command-0ad6gw2a.js")).CodeCommand,
19
- application: async () => (await import("./application.command-m1kcd7jf.js")).ApplicationCommand,
20
- library: async () => (await import("./library.command-erp2f56n.js")).LibraryCommand,
21
- localRegistry: async () => (await import("./localRegistry.command-xxpqgxjw.js")).LocalRegistryCommand,
22
- package: async () => (await import("./package.command-7343f74r.js")).PackageCommand,
23
- module: async () => (await import("./module.command-gs2r615e.js")).ModuleCommand,
24
- page: async () => (await import("./page.command-4h4a8pnh.js")).PageCommand,
25
- context: async () => (await import("./context.command-0qx447mb.js")).ContextCommand,
26
- cloud: async () => (await import("./cloud.command-3jzym8q7.js")).CloudCommand,
27
- subspace: async () => (await import("./subspace.command-92xkc0s0.js")).SubspaceCommand,
28
- guideline: async () => (await import("./guideline.command-cv5bmrx2.js")).GuidelineCommand,
29
- scalar: async () => (await import("./scalar.command-20b8cy0k.js")).ScalarCommand,
30
- primitive: async () => (await import("./primitive.command-w6t0asqz.js")).PrimitiveCommand,
31
- quality: async () => (await import("./quality.command-77x7vbbx.js")).QualityCommand,
32
- repair: async () => (await import("./repair.command-y6sstev7.js")).RepairCommand,
33
- workflow: async () => (await import("./workflow.command-2djwmpqf.js")).WorkflowCommand,
34
- pipeline: async () => (await import("./pipeline.command-a2nrk26m.js")).PipelineCommand,
35
- tunnel: async () => (await import("./tunnel.command-2kw8vt9g.js")).TunnelCommand
25
+ workspace: async () => (await import("./workspace.command-tp8ysvjs.js")).WorkspaceCommand,
26
+ agent: async () => (await import("./agent.command-qawf7z4s.js")).AgentCommand,
27
+ code: async () => (await import("./code.command-t6j55sbk.js")).CodeCommand,
28
+ application: async () => (await import("./application.command-jqrgqk6j.js")).ApplicationCommand,
29
+ library: async () => (await import("./library.command-z1v7zepj.js")).LibraryCommand,
30
+ localRegistry: async () => (await import("./localRegistry.command-48n23bjy.js")).LocalRegistryCommand,
31
+ package: async () => (await import("./package.command-7xkzc8m1.js")).PackageCommand,
32
+ module: async () => (await import("./module.command-rv307dk7.js")).ModuleCommand,
33
+ page: async () => (await import("./page.command-34hpdt7v.js")).PageCommand,
34
+ context: async () => (await import("./context.command-eqbzbgth.js")).ContextCommand,
35
+ cloud: async () => (await import("./cloud.command-p9067ssj.js")).CloudCommand,
36
+ subspace: async () => (await import("./subspace.command-n3j7vv0w.js")).SubspaceCommand,
37
+ guideline: async () => (await import("./guideline.command-w905q73w.js")).GuidelineCommand,
38
+ scalar: async () => (await import("./scalar.command-17e20sj2.js")).ScalarCommand,
39
+ primitive: async () => (await import("./primitive.command-em0twr5a.js")).PrimitiveCommand,
40
+ quality: async () => (await import("./quality.command-c6p2819k.js")).QualityCommand,
41
+ repair: async () => (await import("./repair.command-j6czdgrv.js")).RepairCommand,
42
+ workflow: async () => (await import("./workflow.command-h9vkr6jb.js")).WorkflowCommand,
43
+ pipeline: async () => (await import("./pipeline.command-ckvhrpyg.js")).PipelineCommand,
44
+ tunnel: async () => (await import("./tunnel.command-cm578f4s.js")).TunnelCommand
36
45
  };
37
46
  var commandModuleIds = Object.keys(commandModules);
38
47
 
@@ -66,8 +75,17 @@ class CommandManifest {
66
75
  return id ? [id] : null;
67
76
  }
68
77
  }
78
+ // pkgs/@akanjs/cli/package.json
79
+ var engines = {
80
+ bun: ">=1.4.4"
81
+ };
69
82
 
70
83
  // pkgs/@akanjs/cli/index.ts
84
+ var bunRefusal = BunVersionGuard.refusal(Bun.version, engines.bun);
85
+ if (bunRefusal) {
86
+ console.error(bunRefusal);
87
+ process.exit(1);
88
+ }
71
89
  var ids = CommandManifest.resolve(await CommandManifest.read(), process.argv) ?? commandModuleIds;
72
90
  var commands = await Promise.all(ids.map(async (id) => await commandModules[id]()));
73
91
  await runCommands(...commands);
@@ -3,12 +3,12 @@ import {
3
3
  Lib,
4
4
  Workspace,
5
5
  command
6
- } from "./index-jw1zm273.js";
6
+ } from "./index-fbw3kmt5.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-va06nr10.js";
8
+ import"./index-n8dsax1f.js";
9
9
  import {
10
10
  LibraryScript
11
- } from "./index-pydbnfez.js";
11
+ } from "./index-er62k6w3.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/library/library.command.ts
14
14
  class LibraryCommand extends command("library", [LibraryScript], ({ public: target }) => ({
@@ -4,32 +4,32 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-jw1zm273.js";
7
+ } from "./index-fbw3kmt5.js";
8
8
  import"./index-52w0fvh8.js";
9
9
  import {
10
10
  PkgExecutor
11
- } from "./index-va06nr10.js";
11
+ } from "./index-n8dsax1f.js";
12
12
  import"./index-5nd1wtkv.js";
13
- import"./index-vk0pa0mn.js";
13
+ import"./index-3hvmytbs.js";
14
14
  import"./index-m9jj544v.js";
15
- import"./index-g1mbppa9.js";
16
- import"./index-192ha4xh.js";
17
- import"./index-pydbnfez.js";
15
+ import"./index-nr8m4j21.js";
16
+ import"./index-25ks6x4k.js";
17
+ import"./index-64pjry21.js";
18
+ import"./index-er62k6w3.js";
18
19
  import {
19
20
  ApplicationScript
20
- } from "./index-d47ypebv.js";
21
+ } from "./index-z5cxrbvv.js";
21
22
  import"./index-7md2g9vw.js";
22
- import"./index-cpb3nvma.js";
23
+ import"./index-yfy3t4kw.js";
23
24
  import {
24
25
  getNpmRegistryUrl,
25
26
  CloudRunner
26
- } from "./index-fyq1z6kt.js";
27
+ } from "./index-48n4yhm4.js";
27
28
  import"./index-tvehn2sp.js";
28
29
  import {
29
30
  PackageScript
30
- } from "./index-6xn2n442.js";
31
- import"./index-35hc95h5.js";
32
- import"./index-665zp9rs.js";
31
+ } from "./index-1enc9rga.js";
32
+ import"./index-eabfsarf.js";
33
33
 
34
34
  // pkgs/@akanjs/cli/localRegistry/localRegistry.runner.ts
35
35
  import { mkdir, rm } from "fs/promises";
@@ -3,16 +3,16 @@ import {
3
3
  Sys,
4
4
  Module,
5
5
  command
6
- } from "./index-jw1zm273.js";
6
+ } from "./index-fbw3kmt5.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-va06nr10.js";
8
+ import"./index-n8dsax1f.js";
9
9
  import {
10
10
  renderPrimitiveReport
11
- } from "./index-trpasv9q.js";
12
- import"./index-86jt2a0e.js";
11
+ } from "./index-yyxy7aff.js";
12
+ import"./index-qh73jnyb.js";
13
13
  import {
14
14
  ModuleScript
15
- } from "./index-fmzcs8v6.js";
15
+ } from "./index-j4dzazmw.js";
16
16
 
17
17
  // pkgs/@akanjs/cli/module/module.command.ts
18
18
  import { Logger, lowerlize } from "akanjs/common";
@@ -3,13 +3,13 @@ import {
3
3
  Pkg,
4
4
  Workspace,
5
5
  command
6
- } from "./index-jw1zm273.js";
6
+ } from "./index-fbw3kmt5.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-va06nr10.js";
8
+ import"./index-n8dsax1f.js";
9
9
  import"./index-tvehn2sp.js";
10
10
  import {
11
11
  PackageScript
12
- } from "./index-6xn2n442.js";
12
+ } from "./index-1enc9rga.js";
13
13
 
14
14
  // pkgs/@akanjs/cli/package/package.command.ts
15
15
  class PackageCommand extends command("package", [PackageScript], ({ public: target }) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/cli",
3
- "version": "3.1.0-rc.8",
3
+ "version": "3.1.0",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -14,7 +14,7 @@
14
14
  "directory": "pkgs/@akanjs/cli"
15
15
  },
16
16
  "engines": {
17
- "bun": ">=1.4.0"
17
+ "bun": ">=1.4.4"
18
18
  },
19
19
  "bin": {
20
20
  "akan": "./index.js"
@@ -31,31 +31,31 @@
31
31
  "./package.json": "./package.json"
32
32
  },
33
33
  "dependencies": {
34
- "@earendil-works/chord": "0.86.1",
35
- "@earendil-works/pi-agent-core": "0.86.1",
36
- "@earendil-works/pi-ai": "0.86.1",
37
- "@earendil-works/pi-coding-agent": "0.86.1",
38
- "@earendil-works/pi-telemetry": "0.86.1",
39
- "@earendil-works/pi-tui": "0.86.1",
40
- "@inquirer/prompts": "^8.4.3",
41
- "@tailwindcss/node": "^4.3.0",
42
- "akanjs": "3.1.0-rc.8",
43
- "chalk": "^5.6.2",
44
- "commander": "^14.0.3",
45
- "dayjs": "^1.11.20",
46
- "fontaine": "^0.8.0",
34
+ "@earendil-works/pi-agent-core": "1.3.0",
35
+ "@earendil-works/pi-ai": "1.3.0",
36
+ "@earendil-works/pi-codemode": "1.3.0",
37
+ "@earendil-works/pi-coding-agent": "1.3.0",
38
+ "@earendil-works/pi-mcp": "1.3.0",
39
+ "@earendil-works/pi-tui": "1.3.0",
40
+ "@inquirer/prompts": "^8.7.3",
41
+ "@tailwindcss/node": "^4.3.3",
42
+ "akanjs": "3.1.0",
43
+ "chalk": "^6.0.1",
44
+ "commander": "^15.0.0",
45
+ "dayjs": "^1.11.23",
46
+ "fontaine": "^1.0.1",
47
47
  "fonteditor-core": "^2.6.3",
48
- "ignore": "^7.0.5",
48
+ "ignore": "^7.0.12",
49
49
  "ink": "^6.8.0",
50
- "ora": "^9.4.0",
50
+ "ora": "^9.4.1",
51
51
  "qrcode": "^1.5.4",
52
- "react": "19.3.0",
52
+ "react": "19.3.1",
53
53
  "ssh2": "^1.17.0",
54
- "string-width": "^8.2.1",
55
- "subset-font": "^2.5.0",
54
+ "string-width": "^8.3.0",
55
+ "subset-font": "^2.9.0",
56
56
  "tailwind-scrollbar": "^4.0.2",
57
- "tailwindcss": "^4.3.0",
58
- "typebox": "1.1.38",
57
+ "tailwindcss": "^4.3.3",
58
+ "typebox": "1.3.37",
59
59
  "typescript": "^6.0.3"
60
60
  },
61
61
  "devDependencies": {},
@@ -3,12 +3,12 @@ import {
3
3
  App,
4
4
  Module,
5
5
  command
6
- } from "./index-jw1zm273.js";
6
+ } from "./index-fbw3kmt5.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-va06nr10.js";
8
+ import"./index-n8dsax1f.js";
9
9
  import {
10
10
  PageScript
11
- } from "./index-86jt2a0e.js";
11
+ } from "./index-qh73jnyb.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/page/page.command.ts
14
14
  class PageCommand extends command("page", [PageScript], ({ public: target }) => ({
@@ -4,7 +4,7 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-jw1zm273.js";
7
+ } from "./index-fbw3kmt5.js";
8
8
  import {
9
9
  FileSys2
10
10
  } from "./index-52w0fvh8.js";
@@ -12,7 +12,7 @@ import {
12
12
  AkanAppConfig,
13
13
  AkanWorkspaceConfig,
14
14
  AppExecutor
15
- } from "./index-va06nr10.js";
15
+ } from "./index-n8dsax1f.js";
16
16
  import {
17
17
  resolveMobileTargets
18
18
  } from "./index-m9jj544v.js";
@@ -2,17 +2,17 @@
2
2
  import {
3
3
  Workspace,
4
4
  command
5
- } from "./index-jw1zm273.js";
5
+ } from "./index-fbw3kmt5.js";
6
6
  import"./index-52w0fvh8.js";
7
- import"./index-va06nr10.js";
7
+ import"./index-n8dsax1f.js";
8
8
  import {
9
9
  renderPrimitiveReport
10
- } from "./index-trpasv9q.js";
11
- import"./index-86jt2a0e.js";
12
- import"./index-fmzcs8v6.js";
10
+ } from "./index-yyxy7aff.js";
11
+ import"./index-qh73jnyb.js";
12
+ import"./index-j4dzazmw.js";
13
13
  import {
14
14
  PrimitiveScript
15
- } from "./index-awbdfcf2.js";
15
+ } from "./index-hqh4mpgt.js";
16
16
 
17
17
  // pkgs/@akanjs/cli/primitive/primitive.command.ts
18
18
  import { Logger } from "akanjs/common";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  ProjectTypecheck2
4
- } from "./index-va06nr10.js";
4
+ } from "./index-n8dsax1f.js";
5
5
  export {
6
6
  ProjectTypecheck2 as ProjectTypecheck
7
7
  };
@@ -3,7 +3,7 @@ import {
3
3
  Workspace,
4
4
  script,
5
5
  command
6
- } from "./index-jw1zm273.js";
6
+ } from "./index-fbw3kmt5.js";
7
7
  import"./index-52w0fvh8.js";
8
8
  import {
9
9
  rootAllowedFiles,
@@ -12,7 +12,7 @@ import {
12
12
  libFacetRootHintOf,
13
13
  facetIndexShadowOf,
14
14
  rootEntryHintOf
15
- } from "./index-va06nr10.js";
15
+ } from "./index-n8dsax1f.js";
16
16
 
17
17
  // pkgs/@akanjs/devkit/qualityScanner.ts
18
18
  import { createHash } from "crypto";
@@ -3,15 +3,15 @@ import {
3
3
  Workspace,
4
4
  script,
5
5
  command
6
- } from "./index-jw1zm273.js";
6
+ } from "./index-fbw3kmt5.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-va06nr10.js";
8
+ import"./index-n8dsax1f.js";
9
9
  import"./index-hj6w4ka1.js";
10
- import"./index-trpasv9q.js";
11
- import"./index-5edzv8fn.js";
10
+ import"./index-yyxy7aff.js";
11
+ import"./index-aqwdjn4x.js";
12
12
  import {
13
13
  RepairRunner
14
- } from "./index-j4mkhz93.js";
14
+ } from "./index-0dd6z4b9.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/repair/repair.script.ts
17
17
  import { Logger } from "akanjs/common";
@@ -58,6 +58,8 @@ class RouteSourceValidator {
58
58
  throw new Error(`[route-convention] head and generateHead cannot both be exported in ${filePath}`);
59
59
  }
60
60
  const chain = RouteSourceValidator.#readChain(sourceFile, filePath);
61
+ if (!chain && exported.has("guard"))
62
+ throw new Error(`[route-convention] ${filePath} exports guard beside a legacy default; declare it with .guard() on its chain`);
61
63
  if (!chain)
62
64
  return { devOnly: RouteSourceValidator.#readDevOnly(sourceFile, filePath) };
63
65
  const named = [...exported].filter((name) => name !== "default");
@@ -71,32 +73,61 @@ class RouteSourceValidator {
71
73
  RouteSourceValidator.#assertChainParams(chain, options.pattern, filePath);
72
74
  return {
73
75
  devOnly: chain.devOnly,
74
- chain: { kind: chain.kind, params: chain.params, ...chain.prompt ? { prompt: chain.prompt } : {} }
76
+ chain: {
77
+ kind: chain.kind,
78
+ params: chain.params,
79
+ ...chain.prompt ? { prompt: chain.prompt } : {},
80
+ apps: chain.apps
81
+ }
75
82
  };
76
83
  }
77
84
  static #readChain(sourceFile, filePath) {
78
85
  for (const statement of sourceFile.statements) {
86
+ const local = RouteSourceValidator.#defaultLocalOf(statement);
87
+ if (local && RouteSourceValidator.#bindsChain(sourceFile, local))
88
+ throw new Error(`[route-convention] ${filePath} exports its chain through "${local}"; write \`export default page()\u2026\` \u2014 the build reads the chain without evaluating the module`);
79
89
  if (!ts.isExportAssignment(statement) || statement.isExportEquals)
80
90
  continue;
81
- let node = RouteSourceValidator.#unwrapExpression(statement.expression);
82
- const stages = [];
83
- while (node && ts.isCallExpression(node)) {
84
- const callee = node.expression;
85
- if (ts.isPropertyAccessExpression(callee)) {
86
- stages.unshift({ name: callee.name.text, args: node.arguments });
87
- node = callee.expression;
88
- continue;
89
- }
90
- if (ts.isIdentifier(callee) && chainRoots.has(callee.text))
91
- return RouteSourceValidator.#chainOf(callee.text, stages, filePath);
92
- return null;
91
+ const walked = RouteSourceValidator.#walkChain(RouteSourceValidator.#unwrapExpression(statement.expression));
92
+ return walked ? RouteSourceValidator.#chainOf(walked.kind, walked.stages, filePath) : null;
93
+ }
94
+ return null;
95
+ }
96
+ static #defaultLocalOf(statement) {
97
+ if (ts.isExportAssignment(statement) && !statement.isExportEquals) {
98
+ const node = RouteSourceValidator.#unwrapExpression(statement.expression);
99
+ return node && ts.isIdentifier(node) ? node.text : undefined;
100
+ }
101
+ if (!ts.isExportDeclaration(statement) || statement.moduleSpecifier || statement.isTypeOnly)
102
+ return;
103
+ const clause = statement.exportClause;
104
+ if (!clause || !ts.isNamedExports(clause))
105
+ return;
106
+ const element = clause.elements.find((element) => !element.isTypeOnly && element.name.text === "default");
107
+ return element?.propertyName && ts.isIdentifier(element.propertyName) ? element.propertyName.text : undefined;
108
+ }
109
+ static #walkChain(start) {
110
+ let node = start;
111
+ const stages = [];
112
+ while (node && ts.isCallExpression(node)) {
113
+ const callee = node.expression;
114
+ if (ts.isPropertyAccessExpression(callee)) {
115
+ stages.unshift({ name: callee.name.text, args: node.arguments });
116
+ node = callee.expression;
117
+ continue;
93
118
  }
119
+ if (ts.isIdentifier(callee) && chainRoots.has(callee.text))
120
+ return { kind: callee.text, stages };
94
121
  return null;
95
122
  }
96
123
  return null;
97
124
  }
125
+ static #bindsChain(sourceFile, name) {
126
+ return sourceFile.statements.some((statement) => ts.isVariableStatement(statement) && statement.declarationList.declarations.some((declaration) => ts.isIdentifier(declaration.name) && declaration.name.text === name && !!RouteSourceValidator.#walkChain(RouteSourceValidator.#unwrapExpression(declaration.initializer))));
127
+ }
98
128
  static #chainOf(kind, stages, filePath) {
99
129
  const params = [];
130
+ const apps = [];
100
131
  let prompt;
101
132
  let devOnly = false;
102
133
  const literal = (stage) => {
@@ -110,10 +141,12 @@ class RouteSourceValidator {
110
141
  params.push(literal(stage));
111
142
  else if (stage.name === "prompt")
112
143
  prompt = literal(stage);
144
+ else if (stage.name === "app")
145
+ apps.push(literal(stage));
113
146
  else if (stage.name === "config")
114
147
  devOnly = RouteSourceValidator.#devOnlyOf(RouteSourceValidator.#unwrapExpression(stage.args[0]), filePath);
115
148
  }
116
- return { kind, params, prompt, devOnly };
149
+ return { kind, params, prompt, apps, devOnly };
117
150
  }
118
151
  static #assertChainParams(chain, pattern, filePath) {
119
152
  const inPath = pattern.split("/").filter((part) => part.startsWith(":")).map((part) => part.slice(1)).filter((name) => name !== "lang");