@akanjs/cli 3.1.0-rc.20 → 3.1.0-rc.22

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 (76) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-n3tzjm91.js → CodeAgent-fee0pnwp.js} +2 -2
  3. package/{CodeTui-fnm9ft4d.js → CodeTui-xh71b2k8.js} +1 -1
  4. package/TunnelShare-s7bpe55e.js +14 -0
  5. package/{agent.command-3qxf4xcj.js → agent.command-tge9rvmt.js} +5 -5
  6. package/akanCode.js +2 -2
  7. package/{application.command-zfja7x4r.js → application.command-j5b8yrcf.js} +35 -9
  8. package/{applicationBuildRunner-vh4j6vdv.js → applicationBuildRunner-s41mgz21.js} +21 -7
  9. package/buildBatch.proc.js +9 -9
  10. package/{cloud.command-fcc8e8tp.js → cloud.command-q9srng6e.js} +13 -13
  11. package/cloud.script-vfsd4gxs.js +24 -0
  12. package/{code.command-130bdmhe.js → code.command-n6r6zt97.js} +6 -6
  13. package/commandManifest.json +1 -1
  14. package/{context.command-0qx447mb.js → context.command-1je84w1b.js} +16 -16
  15. package/context.runner-xg0ngz93.js +25 -0
  16. package/{guideline.command-cv5bmrx2.js → guideline.command-0e0sx2vg.js} +2 -2
  17. package/guidelines/conventions/conventions.instruction.md +42 -13
  18. package/guidelines/mcpRule/mcpRule.instruction.md +88 -47
  19. package/guidelines/pageRule/pageRule.instruction.md +53 -8
  20. package/guidelines/runtimeRule/runtimeRule.instruction.md +8 -1
  21. package/guidelines/ssrRule/ssrRule.instruction.md +8 -5
  22. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +1 -1
  23. package/incrementalBuilder.proc.js +3 -3
  24. package/{index-fmzcs8v6.js → index-1bhv9dh4.js} +4 -4
  25. package/{index-qtfmtcrw.js → index-1xqq3va9.js} +71 -18
  26. package/{index-86jt2a0e.js → index-3xhak9e0.js} +1 -1
  27. package/{index-tamvyvj3.js → index-4fe4qqgn.js} +3 -3
  28. package/{index-g1mbppa9.js → index-551gh8h2.js} +5 -5
  29. package/{index-trpasv9q.js → index-5m0s0gdv.js} +1 -1
  30. package/index-6mprvdt8.js +566 -0
  31. package/{index-192ha4xh.js → index-6nqnqzv1.js} +1 -1
  32. package/{index-dye8pnxx.js → index-73esn3y2.js} +1 -1
  33. package/{index-4mhy6qme.js → index-7xy30jev.js} +4 -4
  34. package/{index-1xj2t7cb.js → index-85h3dhe0.js} +7 -7
  35. package/{index-axs61rna.js → index-8abyrfw8.js} +5 -4
  36. package/{index-1p98exm2.js → index-94jq9cbz.js} +2 -2
  37. package/{index-cpb3nvma.js → index-9h0z0tjr.js} +2 -2
  38. package/{index-hsadfb6c.js → index-c9rfak6r.js} +7 -7
  39. package/{index-w44cy4vs.js → index-cgyqx6q1.js} +2 -2
  40. package/{index-d72hfmdm.js → index-cq5x7a9k.js} +8 -8
  41. package/{index-j237xtew.js → index-deckcwbg.js} +2 -2
  42. package/{index-vk0pa0mn.js → index-ex35dg39.js} +2 -1
  43. package/{index-35hc95h5.js → index-f9118j70.js} +1 -1
  44. package/{index-jw1zm273.js → index-g5px5pxd.js} +53 -9
  45. package/{index-va06nr10.js → index-gxqvev8w.js} +52 -12
  46. package/{index-fyq1z6kt.js → index-hagw9c94.js} +3 -3
  47. package/{index-pydbnfez.js → index-p44jnjfr.js} +2 -2
  48. package/{index-awbdfcf2.js → index-rp9anyeb.js} +4 -4
  49. package/{index-j4mkhz93.js → index-t8npm331.js} +3 -3
  50. package/{index-5edzv8fn.js → index-tbmtmkhx.js} +2 -2
  51. package/{index-1djcjcre.js → index-vyh8kemm.js} +3 -3
  52. package/{index-qwa5k1j8.js → index-x7bny3wv.js} +1 -1
  53. package/index.js +22 -22
  54. package/{library.command-erp2f56n.js → library.command-ys9s0mtc.js} +3 -3
  55. package/{localRegistry.command-hj3p16p5.js → localRegistry.command-kmp3sd47.js} +12 -12
  56. package/{module.command-gs2r615e.js → module.command-5sx9453y.js} +5 -5
  57. package/{package.command-j10r76ax.js → package.command-s0d3417k.js} +3 -3
  58. package/package.json +2 -2
  59. package/{page.command-4h4a8pnh.js → page.command-zsa03pmc.js} +3 -3
  60. package/{pipeline.command-a2nrk26m.js → pipeline.command-j8h6qsha.js} +2 -2
  61. package/{primitive.command-w6t0asqz.js → primitive.command-n2978nmw.js} +6 -6
  62. package/{projectTypecheck-f534enqj.js → projectTypecheck-qg2jf80j.js} +1 -1
  63. package/{quality.command-77x7vbbx.js → quality.command-7kgz46st.js} +2 -2
  64. package/{repair.command-y6sstev7.js → repair.command-2sszcckw.js} +5 -5
  65. package/{routeSourceValidator-7ycnfz0e.js → routeSourceValidator-6jd0q6r6.js} +47 -14
  66. package/{scalar.command-20b8cy0k.js → scalar.command-230jrhzf.js} +4 -4
  67. package/{subspace.command-baz73jpk.js → subspace.command-y5v4ypd3.js} +8 -8
  68. package/templates/migration/__migrationId__.ts +23 -0
  69. package/templates/server.ts +8 -1
  70. package/{tunnel.command-2kw8vt9g.js → tunnel.command-ja29zghd.js} +7 -7
  71. package/{workflow.command-2djwmpqf.js → workflow.command-0eg8czt5.js} +10 -10
  72. package/{workspace.command-jqs7vjhe.js → workspace.command-zcym1dk5.js} +24 -24
  73. package/TunnelShare-661cxz5e.js +0 -14
  74. package/cloud.script-1xt3tnts.js +0 -24
  75. package/context.runner-1vsjztjg.js +0 -25
  76. package/index-665zp9rs.js +0 -271
@@ -5,7 +5,7 @@ import {
5
5
  McpServerConfig,
6
6
  McpSignIn,
7
7
  AkanCodeCompaction2
8
- } from "./index-dye8pnxx.js";
8
+ } from "./index-73esn3y2.js";
9
9
  import {
10
10
  stripAnsi
11
11
  } from "./index-7md2g9vw.js";
@@ -809,7 +809,7 @@ class AkanToolPack2 {
809
809
  return { name: "akan-tools", factory: async (pi) => await this.#register(pi) };
810
810
  }
811
811
  async names() {
812
- const { ContextRunner } = await import("./context.runner-1vsjztjg.js");
812
+ const { ContextRunner } = await import("./context.runner-xg0ngz93.js");
813
813
  return [
814
814
  ...new ContextRunner().listMcpTools(this.#options.mode).map((tool) => tool.name),
815
815
  AkanToolPack2.verifyToolName
@@ -817,7 +817,7 @@ class AkanToolPack2 {
817
817
  }
818
818
  static verifyToolName = "akan_verify";
819
819
  async#register(pi) {
820
- const { ContextRunner } = await import("./context.runner-1vsjztjg.js");
820
+ const { ContextRunner } = await import("./context.runner-xg0ngz93.js");
821
821
  const runner = new ContextRunner;
822
822
  const guidelineNames = await AkanToolPack2.#guidelineNames();
823
823
  for (const tool of runner.listMcpTools(this.#options.mode, { guidelineNames })) {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  GlobalConfig,
4
4
  CloudApi
5
- } from "./index-cpb3nvma.js";
5
+ } from "./index-9h0z0tjr.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/tunnel/TunnelShare.ts
8
8
  import { TunnelAgent } from "akanjs/server/tunnel";
package/index.js CHANGED
@@ -4,35 +4,35 @@ import {
4
4
  getTargetMetas,
5
5
  getTargetCommandNames,
6
6
  runCommands
7
- } from "./index-jw1zm273.js";
7
+ } from "./index-g5px5pxd.js";
8
8
  import"./index-52w0fvh8.js";
9
- import"./index-va06nr10.js";
9
+ import"./index-gxqvev8w.js";
10
10
 
11
11
  // pkgs/@akanjs/cli/commandManifest.ts
12
12
  import path from "path";
13
13
 
14
14
  // pkgs/@akanjs/cli/commandModules.ts
15
15
  var commandModules = {
16
- workspace: async () => (await import("./workspace.command-jqs7vjhe.js")).WorkspaceCommand,
17
- agent: async () => (await import("./agent.command-3qxf4xcj.js")).AgentCommand,
18
- code: async () => (await import("./code.command-130bdmhe.js")).CodeCommand,
19
- application: async () => (await import("./application.command-zfja7x4r.js")).ApplicationCommand,
20
- library: async () => (await import("./library.command-erp2f56n.js")).LibraryCommand,
21
- localRegistry: async () => (await import("./localRegistry.command-hj3p16p5.js")).LocalRegistryCommand,
22
- package: async () => (await import("./package.command-j10r76ax.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-fcc8e8tp.js")).CloudCommand,
27
- subspace: async () => (await import("./subspace.command-baz73jpk.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
16
+ workspace: async () => (await import("./workspace.command-zcym1dk5.js")).WorkspaceCommand,
17
+ agent: async () => (await import("./agent.command-tge9rvmt.js")).AgentCommand,
18
+ code: async () => (await import("./code.command-n6r6zt97.js")).CodeCommand,
19
+ application: async () => (await import("./application.command-j5b8yrcf.js")).ApplicationCommand,
20
+ library: async () => (await import("./library.command-ys9s0mtc.js")).LibraryCommand,
21
+ localRegistry: async () => (await import("./localRegistry.command-kmp3sd47.js")).LocalRegistryCommand,
22
+ package: async () => (await import("./package.command-s0d3417k.js")).PackageCommand,
23
+ module: async () => (await import("./module.command-5sx9453y.js")).ModuleCommand,
24
+ page: async () => (await import("./page.command-zsa03pmc.js")).PageCommand,
25
+ context: async () => (await import("./context.command-1je84w1b.js")).ContextCommand,
26
+ cloud: async () => (await import("./cloud.command-q9srng6e.js")).CloudCommand,
27
+ subspace: async () => (await import("./subspace.command-y5v4ypd3.js")).SubspaceCommand,
28
+ guideline: async () => (await import("./guideline.command-0e0sx2vg.js")).GuidelineCommand,
29
+ scalar: async () => (await import("./scalar.command-230jrhzf.js")).ScalarCommand,
30
+ primitive: async () => (await import("./primitive.command-n2978nmw.js")).PrimitiveCommand,
31
+ quality: async () => (await import("./quality.command-7kgz46st.js")).QualityCommand,
32
+ repair: async () => (await import("./repair.command-2sszcckw.js")).RepairCommand,
33
+ workflow: async () => (await import("./workflow.command-0eg8czt5.js")).WorkflowCommand,
34
+ pipeline: async () => (await import("./pipeline.command-j8h6qsha.js")).PipelineCommand,
35
+ tunnel: async () => (await import("./tunnel.command-ja29zghd.js")).TunnelCommand
36
36
  };
37
37
  var commandModuleIds = Object.keys(commandModules);
38
38
 
@@ -3,12 +3,12 @@ import {
3
3
  Lib,
4
4
  Workspace,
5
5
  command
6
- } from "./index-jw1zm273.js";
6
+ } from "./index-g5px5pxd.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-va06nr10.js";
8
+ import"./index-gxqvev8w.js";
9
9
  import {
10
10
  LibraryScript
11
- } from "./index-pydbnfez.js";
11
+ } from "./index-p44jnjfr.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-g5px5pxd.js";
8
8
  import"./index-52w0fvh8.js";
9
9
  import {
10
10
  PkgExecutor
11
- } from "./index-va06nr10.js";
11
+ } from "./index-gxqvev8w.js";
12
12
  import"./index-5nd1wtkv.js";
13
- import"./index-vk0pa0mn.js";
13
+ import"./index-ex35dg39.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-551gh8h2.js";
16
+ import"./index-6mprvdt8.js";
17
+ import"./index-6nqnqzv1.js";
18
+ import"./index-p44jnjfr.js";
18
19
  import {
19
20
  ApplicationScript
20
- } from "./index-qtfmtcrw.js";
21
+ } from "./index-1xqq3va9.js";
21
22
  import"./index-7md2g9vw.js";
22
- import"./index-cpb3nvma.js";
23
+ import"./index-9h0z0tjr.js";
23
24
  import {
24
25
  getNpmRegistryUrl,
25
26
  CloudRunner
26
- } from "./index-fyq1z6kt.js";
27
+ } from "./index-hagw9c94.js";
27
28
  import"./index-tvehn2sp.js";
28
29
  import {
29
30
  PackageScript
30
- } from "./index-j237xtew.js";
31
- import"./index-35hc95h5.js";
32
- import"./index-665zp9rs.js";
31
+ } from "./index-deckcwbg.js";
32
+ import"./index-f9118j70.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-g5px5pxd.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-va06nr10.js";
8
+ import"./index-gxqvev8w.js";
9
9
  import {
10
10
  renderPrimitiveReport
11
- } from "./index-trpasv9q.js";
12
- import"./index-86jt2a0e.js";
11
+ } from "./index-5m0s0gdv.js";
12
+ import"./index-3xhak9e0.js";
13
13
  import {
14
14
  ModuleScript
15
- } from "./index-fmzcs8v6.js";
15
+ } from "./index-1bhv9dh4.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-g5px5pxd.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-va06nr10.js";
8
+ import"./index-gxqvev8w.js";
9
9
  import"./index-tvehn2sp.js";
10
10
  import {
11
11
  PackageScript
12
- } from "./index-j237xtew.js";
12
+ } from "./index-deckcwbg.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.20",
3
+ "version": "3.1.0-rc.22",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -39,7 +39,7 @@
39
39
  "@earendil-works/pi-tui": "1.3.0",
40
40
  "@inquirer/prompts": "^8.7.3",
41
41
  "@tailwindcss/node": "^4.3.3",
42
- "akanjs": "3.1.0-rc.20",
42
+ "akanjs": "3.1.0-rc.22",
43
43
  "chalk": "^6.0.1",
44
44
  "commander": "^15.0.0",
45
45
  "dayjs": "^1.11.23",
@@ -3,12 +3,12 @@ import {
3
3
  App,
4
4
  Module,
5
5
  command
6
- } from "./index-jw1zm273.js";
6
+ } from "./index-g5px5pxd.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-va06nr10.js";
8
+ import"./index-gxqvev8w.js";
9
9
  import {
10
10
  PageScript
11
- } from "./index-86jt2a0e.js";
11
+ } from "./index-3xhak9e0.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-g5px5pxd.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-gxqvev8w.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-g5px5pxd.js";
6
6
  import"./index-52w0fvh8.js";
7
- import"./index-va06nr10.js";
7
+ import"./index-gxqvev8w.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-5m0s0gdv.js";
11
+ import"./index-3xhak9e0.js";
12
+ import"./index-1bhv9dh4.js";
13
13
  import {
14
14
  PrimitiveScript
15
- } from "./index-awbdfcf2.js";
15
+ } from "./index-rp9anyeb.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-gxqvev8w.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-g5px5pxd.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-gxqvev8w.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-g5px5pxd.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-va06nr10.js";
8
+ import"./index-gxqvev8w.js";
9
9
  import"./index-hj6w4ka1.js";
10
- import"./index-trpasv9q.js";
11
- import"./index-5edzv8fn.js";
10
+ import"./index-5m0s0gdv.js";
11
+ import"./index-tbmtmkhx.js";
12
12
  import {
13
13
  RepairRunner
14
- } from "./index-j4mkhz93.js";
14
+ } from "./index-t8npm331.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");
@@ -2,15 +2,15 @@
2
2
  import {
3
3
  Sys,
4
4
  command
5
- } from "./index-jw1zm273.js";
5
+ } from "./index-g5px5pxd.js";
6
6
  import"./index-52w0fvh8.js";
7
- import"./index-va06nr10.js";
7
+ import"./index-gxqvev8w.js";
8
8
  import {
9
9
  renderPrimitiveReport
10
- } from "./index-trpasv9q.js";
10
+ } from "./index-5m0s0gdv.js";
11
11
  import {
12
12
  ScalarScript
13
- } from "./index-1p98exm2.js";
13
+ } from "./index-94jq9cbz.js";
14
14
 
15
15
  // pkgs/@akanjs/cli/scalar/scalar.command.ts
16
16
  import { Logger, lowerlize } from "akanjs/common";
@@ -5,7 +5,7 @@ import {
5
5
  runner,
6
6
  script,
7
7
  command
8
- } from "./index-jw1zm273.js";
8
+ } from "./index-g5px5pxd.js";
9
9
  import {
10
10
  FileSys2
11
11
  } from "./index-52w0fvh8.js";
@@ -14,20 +14,20 @@ import {
14
14
  Executor,
15
15
  WorkspaceExecutor,
16
16
  AppExecutor
17
- } from "./index-va06nr10.js";
17
+ } from "./index-gxqvev8w.js";
18
18
  import {
19
19
  GlobalConfig
20
- } from "./index-cpb3nvma.js";
20
+ } from "./index-9h0z0tjr.js";
21
21
  import"./index-m9jj544v.js";
22
- import"./index-g1mbppa9.js";
23
- import"./index-192ha4xh.js";
22
+ import"./index-551gh8h2.js";
23
+ import"./index-6mprvdt8.js";
24
+ import"./index-6nqnqzv1.js";
24
25
  import {
25
26
  SubspaceConfig
26
27
  } from "./index-4pf8g7ff.js";
27
28
  import {
28
29
  SlicePlanner
29
- } from "./index-35hc95h5.js";
30
- import"./index-665zp9rs.js";
30
+ } from "./index-f9118j70.js";
31
31
 
32
32
  // pkgs/@akanjs/devkit/subspace.ts
33
33
  import { mkdir as mkdir2 } from "fs/promises";
@@ -825,7 +825,7 @@ class SubspaceRunner extends runner("subspace") {
825
825
  if (!asked)
826
826
  return { name: subspace.name, workspaceId, host, apps, libs: [], outcome: "cancelled", files: [] };
827
827
  const { libs } = await subspace.slice();
828
- const { CloudScript } = await import("./cloud.script-1xt3tnts.js");
828
+ const { CloudScript } = await import("./cloud.script-vfsd4gxs.js");
829
829
  const { files } = await CommandContainer.get(CloudScript).uploadEnv(workspace, {
830
830
  host,
831
831
  workspaceId,
@@ -0,0 +1,23 @@
1
+ import type { AppInfo, LibInfo } from "akanjs";
2
+
3
+ interface Dict {
4
+ migrationId: string;
5
+ title: string;
6
+ }
7
+ export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict) {
8
+ return `import { migration } from "akanjs/server";
9
+
10
+ export default migration(${JSON.stringify(dict.title)})
11
+ .plan(async ({ table }) => {
12
+ // TODO: count the rows apply changes, and list each decision a person approves
13
+ return { summary: {}, items: [] };
14
+ })
15
+ .apply(async ({ table }, { items }) => {
16
+ // TODO: write through table(refName), so every change is logged and a rollback can undo it
17
+ })
18
+ .verify(async ({ table }) => {
19
+ // TODO: one line per row apply left wrong; none means the data is as intended
20
+ return [];
21
+ });
22
+ `;
23
+ }
@@ -6,7 +6,7 @@ export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { [
6
6
  const databaseModules = [...scanInfo.database.entries()].filter(([_, files]) => files.has("service"));
7
7
  const serviceModules = [...scanInfo.service.entries()].filter(([_, files]) => files.has("service"));
8
8
  const scalarModules = [...scanInfo.scalar.entries()];
9
- return `import { ${scanInfo.type === "app" ? "AkanServer, " : ""}AkanLib } from "akanjs/server";
9
+ return `import { ${scanInfo.type === "app" ? "AkanServer, " : ""}AkanLib${scanInfo.type === "app" ? ", Migrations" : ""} } from "akanjs/server";
10
10
  import * as cnst from "./lib/cnst";
11
11
  import * as db from "./lib/db";
12
12
  import * as sig from "./lib/sig";
@@ -29,6 +29,13 @@ ${scalarModules.map(([model]) => ` { constant: cnst.${model}, database: db.${
29
29
  });
30
30
 
31
31
  ${scanInfo.type === "app" ? `export const server = new AkanServer("${scanInfo.name}", env, undefined${libs.length ? `, ${libs.join(", ")}` : ""}, lib);` : ""}
32
+ ${
33
+ scanInfo.type === "app"
34
+ ? `export const migrations = new Migrations([
35
+ ${scanInfo.migrations.map(({ id, checksum }) => ` { id: "${id}", checksum: "${checksum}", load: () => import("./script/migration/${id}") },`).join("\n")}
36
+ ]);`
37
+ : ""
38
+ }
32
39
 
33
40
  ${scanInfo.type === "lib" ? `export { env } from "./env/env.server.testing";` : ""}
34
41
  export * as db from "./lib/db";
@@ -4,25 +4,25 @@ import {
4
4
  runner,
5
5
  script,
6
6
  command
7
- } from "./index-jw1zm273.js";
7
+ } from "./index-g5px5pxd.js";
8
8
  import"./index-52w0fvh8.js";
9
9
  import {
10
10
  AppExecutor
11
- } from "./index-va06nr10.js";
11
+ } from "./index-gxqvev8w.js";
12
12
  import {
13
13
  GlobalConfig,
14
14
  CloudApi
15
- } from "./index-cpb3nvma.js";
15
+ } from "./index-9h0z0tjr.js";
16
16
  import"./index-m9jj544v.js";
17
- import"./index-g1mbppa9.js";
18
- import"./index-192ha4xh.js";
17
+ import"./index-551gh8h2.js";
18
+ import"./index-6mprvdt8.js";
19
+ import"./index-6nqnqzv1.js";
19
20
  import {
20
21
  TunnelShare2
21
- } from "./index-qwa5k1j8.js";
22
+ } from "./index-x7bny3wv.js";
22
23
  import {
23
24
  writeClipboard
24
25
  } from "./index-p6pbz9n5.js";
25
- import"./index-665zp9rs.js";
26
26
 
27
27
  // pkgs/@akanjs/cli/tunnel/tunnel.script.ts
28
28
  import { select } from "@inquirer/prompts";
@@ -3,20 +3,20 @@ import {
3
3
  Workspace,
4
4
  script,
5
5
  command
6
- } from "./index-jw1zm273.js";
6
+ } from "./index-g5px5pxd.js";
7
7
  import"./index-52w0fvh8.js";
8
- import"./index-va06nr10.js";
8
+ import"./index-gxqvev8w.js";
9
9
  import"./index-hj6w4ka1.js";
10
- import"./index-trpasv9q.js";
11
- import"./index-5edzv8fn.js";
12
- import"./index-86jt2a0e.js";
13
- import"./index-fmzcs8v6.js";
14
- import"./index-awbdfcf2.js";
15
- import"./index-j4mkhz93.js";
16
- import"./index-1p98exm2.js";
10
+ import"./index-5m0s0gdv.js";
11
+ import"./index-tbmtmkhx.js";
12
+ import"./index-3xhak9e0.js";
13
+ import"./index-1bhv9dh4.js";
14
+ import"./index-rp9anyeb.js";
15
+ import"./index-t8npm331.js";
16
+ import"./index-94jq9cbz.js";
17
17
  import {
18
18
  WorkflowRunner
19
- } from "./index-1xj2t7cb.js";
19
+ } from "./index-85h3dhe0.js";
20
20
 
21
21
  // pkgs/@akanjs/cli/workflow/workflow.script.ts
22
22
  import { Logger } from "akanjs/common";