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

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 (69) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-n3tzjm91.js → CodeAgent-gzfc5t52.js} +2 -2
  3. package/{CodeTui-fnm9ft4d.js → CodeTui-bpsjs8wz.js} +1 -1
  4. package/TunnelShare-tfrnftgr.js +14 -0
  5. package/{agent.command-3qxf4xcj.js → agent.command-67ysh3n6.js} +5 -5
  6. package/akanCode.js +2 -2
  7. package/{application.command-zfja7x4r.js → application.command-q0tqw5pc.js} +35 -9
  8. package/{applicationBuildRunner-vh4j6vdv.js → applicationBuildRunner-wsszr305.js} +5 -5
  9. package/buildBatch.proc.js +5 -5
  10. package/{cloud.command-fcc8e8tp.js → cloud.command-e7tkxyx6.js} +13 -13
  11. package/cloud.script-krzh3d7k.js +24 -0
  12. package/{code.command-130bdmhe.js → code.command-ttk8tje2.js} +6 -6
  13. package/commandManifest.json +1 -1
  14. package/{context.command-0qx447mb.js → context.command-bdsk2z2r.js} +16 -16
  15. package/context.runner-bxzv0gm0.js +25 -0
  16. package/{guideline.command-cv5bmrx2.js → guideline.command-man90n70.js} +2 -2
  17. package/guidelines/conventions/conventions.instruction.md +24 -1
  18. package/incrementalBuilder.proc.js +3 -3
  19. package/{index-trpasv9q.js → index-033wne2j.js} +1 -1
  20. package/{index-w44cy4vs.js → index-1r5a8bzx.js} +2 -2
  21. package/{index-86jt2a0e.js → index-27y8t17p.js} +1 -1
  22. package/{index-1djcjcre.js → index-2w8j2fnv.js} +3 -3
  23. package/{index-g1mbppa9.js → index-35m6bzm7.js} +3 -3
  24. package/{index-awbdfcf2.js → index-4393nb4b.js} +4 -4
  25. package/{index-qwa5k1j8.js → index-48edp6q4.js} +1 -1
  26. package/{index-vk0pa0mn.js → index-4v43h00g.js} +1 -1
  27. package/{index-axs61rna.js → index-54wc2phm.js} +3 -3
  28. package/{index-1xj2t7cb.js → index-75n5q4ph.js} +7 -7
  29. package/{index-hsadfb6c.js → index-844q7f8z.js} +7 -7
  30. package/{index-4mhy6qme.js → index-8jehkey8.js} +4 -4
  31. package/{index-pydbnfez.js → index-9mt4smfy.js} +2 -2
  32. package/{index-dye8pnxx.js → index-cae9m5jz.js} +1 -1
  33. package/{index-j237xtew.js → index-ebarbgba.js} +2 -2
  34. package/{index-va06nr10.js → index-g6ax17x4.js} +24 -4
  35. package/{index-1p98exm2.js → index-g9ks2k8c.js} +2 -2
  36. package/{index-192ha4xh.js → index-h3r3nr9y.js} +1 -1
  37. package/{index-qtfmtcrw.js → index-h6czey01.js} +71 -18
  38. package/{index-cpb3nvma.js → index-jrmzcp66.js} +2 -2
  39. package/{index-5edzv8fn.js → index-nv79n88g.js} +2 -2
  40. package/{index-665zp9rs.js → index-nx64dz92.js} +2 -2
  41. package/{index-fmzcs8v6.js → index-p2r64bpa.js} +4 -4
  42. package/{index-j4mkhz93.js → index-pg1t468s.js} +3 -3
  43. package/{index-fyq1z6kt.js → index-rc51f9ht.js} +3 -3
  44. package/{index-tamvyvj3.js → index-ta1dychm.js} +3 -3
  45. package/{index-jw1zm273.js → index-vkb9m4z7.js} +53 -9
  46. package/{index-35hc95h5.js → index-xsd96yzw.js} +1 -1
  47. package/{index-d72hfmdm.js → index-zv5s8x58.js} +8 -8
  48. package/index.js +22 -22
  49. package/{library.command-erp2f56n.js → library.command-6amzsrb8.js} +3 -3
  50. package/{localRegistry.command-hj3p16p5.js → localRegistry.command-yqc0nyhh.js} +12 -12
  51. package/{module.command-gs2r615e.js → module.command-10x6jv6c.js} +5 -5
  52. package/{package.command-j10r76ax.js → package.command-pwfvecjf.js} +3 -3
  53. package/package.json +2 -2
  54. package/{page.command-4h4a8pnh.js → page.command-ahhgx9y1.js} +3 -3
  55. package/{pipeline.command-a2nrk26m.js → pipeline.command-1ptr3e9y.js} +2 -2
  56. package/{primitive.command-w6t0asqz.js → primitive.command-g5xwv6tj.js} +6 -6
  57. package/{projectTypecheck-f534enqj.js → projectTypecheck-fx8x7cat.js} +1 -1
  58. package/{quality.command-77x7vbbx.js → quality.command-fw9ck061.js} +2 -2
  59. package/{repair.command-y6sstev7.js → repair.command-g8kecj96.js} +5 -5
  60. package/{scalar.command-20b8cy0k.js → scalar.command-fprap51w.js} +4 -4
  61. package/{subspace.command-baz73jpk.js → subspace.command-sc0t527y.js} +8 -8
  62. package/templates/migration/__migrationId__.ts +23 -0
  63. package/templates/server.ts +8 -1
  64. package/{tunnel.command-2kw8vt9g.js → tunnel.command-mqnsqbwf.js} +7 -7
  65. package/{workflow.command-2djwmpqf.js → workflow.command-j0jgkr13.js} +10 -10
  66. package/{workspace.command-jqs7vjhe.js → workspace.command-1r9hvvw0.js} +24 -24
  67. package/TunnelShare-661cxz5e.js +0 -14
  68. package/cloud.script-1xt3tnts.js +0 -24
  69. package/context.runner-1vsjztjg.js +0 -25
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  resolveSsrPageEntriesForApp
4
- } from "./index-va06nr10.js";
4
+ } from "./index-g6ax17x4.js";
5
5
  import {
6
6
  computeRouteSeedIndex,
7
7
  saveRouteSeedIndex,
@@ -9,7 +9,7 @@ import {
9
9
  ClientEntriesBundler,
10
10
  VENDOR_SPECIFIERS,
11
11
  RouteClientBuilder
12
- } from "./index-w44cy4vs.js";
12
+ } from "./index-1r5a8bzx.js";
13
13
  import {
14
14
  SOURCE_EXTS
15
15
  } from "./index-5nd1wtkv.js";
@@ -19,7 +19,7 @@ import {
19
19
  createTsconfigPackageResolver,
20
20
  rewriteBarrelImports,
21
21
  PagesBundleBuilder
22
- } from "./index-192ha4xh.js";
22
+ } from "./index-h3r3nr9y.js";
23
23
  import {
24
24
  CssBlockParser
25
25
  } from "./index-62md4dwy.js";
@@ -22,26 +22,26 @@ import {
22
22
  renderWorkflowApply,
23
23
  renderWorkflowValidation,
24
24
  renderWorkflowRunArtifact
25
- } from "./index-trpasv9q.js";
25
+ } from "./index-033wne2j.js";
26
26
  import {
27
27
  AkanContextAnalyzer
28
- } from "./index-5edzv8fn.js";
28
+ } from "./index-nv79n88g.js";
29
29
  import {
30
30
  CommandContainer,
31
31
  runner
32
- } from "./index-jw1zm273.js";
32
+ } from "./index-vkb9m4z7.js";
33
33
  import {
34
34
  ModuleScript
35
- } from "./index-fmzcs8v6.js";
35
+ } from "./index-p2r64bpa.js";
36
36
  import {
37
37
  PrimitiveScript
38
- } from "./index-awbdfcf2.js";
38
+ } from "./index-4393nb4b.js";
39
39
  import {
40
40
  spawnShell
41
- } from "./index-j4mkhz93.js";
41
+ } from "./index-pg1t468s.js";
42
42
  import {
43
43
  ScalarScript
44
- } from "./index-1p98exm2.js";
44
+ } from "./index-g9ks2k8c.js";
45
45
 
46
46
  // pkgs/@akanjs/cli/workflow/workflow.runner.ts
47
47
  import { mkdir, readFile, writeFile } from "fs/promises";
@@ -4,26 +4,26 @@ import {
4
4
  CloudApi,
5
5
  CloudUpdates,
6
6
  PipelineSecrets
7
- } from "./index-cpb3nvma.js";
7
+ } from "./index-jrmzcp66.js";
8
8
  import {
9
9
  PkgExecutor
10
- } from "./index-va06nr10.js";
10
+ } from "./index-g6ax17x4.js";
11
11
  import {
12
12
  NativePublicEnv,
13
13
  UpdatePackFolder
14
- } from "./index-g1mbppa9.js";
14
+ } from "./index-35m6bzm7.js";
15
15
  import {
16
16
  script
17
- } from "./index-jw1zm273.js";
17
+ } from "./index-vkb9m4z7.js";
18
18
  import {
19
19
  ApplicationScript
20
- } from "./index-qtfmtcrw.js";
20
+ } from "./index-h6czey01.js";
21
21
  import {
22
22
  PackageScript
23
- } from "./index-j237xtew.js";
23
+ } from "./index-ebarbgba.js";
24
24
  import {
25
25
  CloudRunner
26
- } from "./index-fyq1z6kt.js";
26
+ } from "./index-rc51f9ht.js";
27
27
 
28
28
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
29
29
  import { Logger } from "akanjs/common";
@@ -1,16 +1,16 @@
1
1
  // @bun
2
2
  import {
3
3
  jsonText
4
- } from "./index-trpasv9q.js";
4
+ } from "./index-033wne2j.js";
5
5
  import {
6
6
  akanMcpInstallTargets
7
- } from "./index-5edzv8fn.js";
7
+ } from "./index-nv79n88g.js";
8
8
  import {
9
9
  script
10
- } from "./index-jw1zm273.js";
10
+ } from "./index-vkb9m4z7.js";
11
11
  import {
12
12
  ContextRunner2
13
- } from "./index-d72hfmdm.js";
13
+ } from "./index-zv5s8x58.js";
14
14
 
15
15
  // pkgs/@akanjs/cli/context/context.script.ts
16
16
  import { Logger } from "akanjs/common";
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-jw1zm273.js";
5
+ } from "./index-vkb9m4z7.js";
6
6
  import {
7
7
  LibSource,
8
8
  formatLibStatuses,
9
9
  LibExecutor
10
- } from "./index-va06nr10.js";
10
+ } from "./index-g6ax17x4.js";
11
11
 
12
12
  // pkgs/@akanjs/cli/library/library.script.ts
13
13
  import { Logger } from "akanjs/common";
@@ -179,7 +179,7 @@ class SubagentPool2 {
179
179
  }
180
180
  }
181
181
  async#run(id, kind, prompt, signal) {
182
- const { CodeAgent } = await import("./CodeAgent-n3tzjm91.js");
182
+ const { CodeAgent } = await import("./CodeAgent-gzfc5t52.js");
183
183
  const budget = this.#options.parent.tools.subagent;
184
184
  const child = SubagentPool2.childOf(this.#options.parent, kind);
185
185
  const agent = await CodeAgent.create({
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-jw1zm273.js";
5
+ } from "./index-vkb9m4z7.js";
6
6
  import {
7
7
  FileSys2
8
8
  } from "./index-52w0fvh8.js";
9
9
  import {
10
10
  PkgExecutor
11
- } from "./index-va06nr10.js";
11
+ } from "./index-g6ax17x4.js";
12
12
  import {
13
13
  TypeScriptDependencyScanner2
14
14
  } from "./index-tvehn2sp.js";
@@ -2251,6 +2251,7 @@ var resolveRepoName = (workspaceRoot) => {
2251
2251
  };
2252
2252
 
2253
2253
  // pkgs/@akanjs/devkit/scanInfo.ts
2254
+ import { createHash } from "crypto";
2254
2255
  import path11 from "path";
2255
2256
 
2256
2257
  // pkgs/@akanjs/devkit/workspaceLayout.ts
@@ -2574,10 +2575,13 @@ class ScanInfo {
2574
2575
  var isAkanFrameworkDependency = (dep) => dep === "akanjs" || dep.startsWith("akanjs/");
2575
2576
 
2576
2577
  class AppInfo extends ScanInfo {
2578
+ static migrationDir = "script/migration";
2579
+ static #migrationIdRe = /^\d{12}_[A-Za-z][A-Za-z0-9]*$/;
2577
2580
  type = "app";
2578
2581
  exec;
2579
2582
  akanConfig;
2580
2583
  libDeps;
2584
+ migrations;
2581
2585
  static appInfos = new Map;
2582
2586
  static async fromExecutor(exec, options = {}) {
2583
2587
  const existingAppInfo = AppInfo.appInfos.get(exec.name);
@@ -2589,16 +2593,20 @@ class AppInfo extends ScanInfo {
2589
2593
  const libExecutor = LibExecutor.from(exec, libName);
2590
2594
  LibInfo.libInfos.set(libName, await LibInfo.fromExecutor(libExecutor));
2591
2595
  }));
2592
- const libDeps = await AppInfo.#getAllLibDeps(exec, scanResult.libDeps);
2593
- const appInfo = new AppInfo(exec, scanResult, libDeps);
2596
+ const [libDeps, migrations] = await Promise.all([
2597
+ AppInfo.#getAllLibDeps(exec, scanResult.libDeps),
2598
+ AppInfo.scanMigrations(exec)
2599
+ ]);
2600
+ const appInfo = new AppInfo(exec, scanResult, libDeps, migrations);
2594
2601
  AppInfo.appInfos.set(exec.name, appInfo);
2595
2602
  return appInfo;
2596
2603
  }
2597
- constructor(exec, scanResult, libDeps) {
2604
+ constructor(exec, scanResult, libDeps, migrations = []) {
2598
2605
  super(scanResult);
2599
2606
  this.exec = exec;
2600
2607
  this.akanConfig = scanResult.akanConfig;
2601
2608
  this.libDeps = libDeps;
2609
+ this.migrations = migrations;
2602
2610
  }
2603
2611
  getScanResult() {
2604
2612
  return this.scanResult;
@@ -2606,6 +2614,18 @@ class AppInfo extends ScanInfo {
2606
2614
  setRoutes(routes) {
2607
2615
  this.scanResult.routes = routes;
2608
2616
  }
2617
+ static async scanMigrations(exec) {
2618
+ const files = (await exec.readdir(AppInfo.migrationDir)).filter((file) => file.endsWith(".ts") && !/\.(test|spec|d)\.ts$/.test(file));
2619
+ return await Promise.all(files.map(async (file) => {
2620
+ const id = file.slice(0, -".ts".length);
2621
+ if (!AppInfo.#migrationIdRe.test(id))
2622
+ throw new Error(`${AppInfo.migrationDir}/${file}: a migration is named <yyyyMMddHHmm>_<camelName>.ts; create one with \`akan create-migration\``);
2623
+ const source = (await exec.readFile(`${AppInfo.migrationDir}/${file}`)).replace(/^\uFEFF/, "").replaceAll(`\r
2624
+ `, `
2625
+ `);
2626
+ return { id, checksum: createHash("sha256").update(source).digest("hex") };
2627
+ }));
2628
+ }
2609
2629
  static async#getAllLibDeps(exec, libDeps, libSet = new Set) {
2610
2630
  await Promise.all(libDeps.map(async (libName) => {
2611
2631
  if (libSet.has(libName))
@@ -4268,4 +4288,4 @@ class ModuleExecutor extends Executor {
4268
4288
  }
4269
4289
  }
4270
4290
 
4271
- export { AGENT_BLOCK_START, AGENT_BLOCK_END, stampBlockVersion, extractBlockVersion, readDevkitVersion, upsertAgentBlock, extractAgentBlock, renderRecipeEntries, collectScopeRecipeSources, renderScopeAgentBlock, CLAUDE_COMMENT_RULE, binPlatforms, ServerEnvProfile, AkanAppConfig, AkanWorkspaceConfig, AsyncDefaultExportDetector, resolveSsrPageEntriesForApp, CodegenLock, Linter, LibSource, formatLibStatuses, rootAllowedFiles, rootAllowedDirs, isAllowedLibFacetRootFile, libFacetRootHintOf, barrelFacetDirs, facetIndexShadowOf, rootEntryHintOf, isScannedRootEntry, AppInfo, Spinner, ProjectTypecheck2, Executor, WorkspaceExecutor, SysExecutor, AppExecutor, LibExecutor, PkgExecutor, ModuleExecutor };
4291
+ export { AGENT_BLOCK_START, AGENT_BLOCK_END, stampBlockVersion, extractBlockVersion, readDevkitVersion, upsertAgentBlock, extractAgentBlock, renderRecipeEntries, collectScopeRecipeSources, renderScopeAgentBlock, CLAUDE_COMMENT_RULE, binPlatforms, ServerEnvProfile, AkanAppConfig, AkanWorkspaceConfig, AsyncDefaultExportDetector, resolveSsrPageEntriesForApp, CodegenLock, Linter, LibSource, formatLibStatuses, rootAllowedFiles, rootAllowedDirs, isAllowedLibFacetRootFile, libFacetRootHintOf, barrelFacetDirs, facetIndexShadowOf, rootEntryHintOf, isScannedRootEntry, AppInfo, Spinner, ProjectTypecheck2, CommandExecutionError, Executor, WorkspaceExecutor, SysExecutor, AppExecutor, LibExecutor, PkgExecutor, ModuleExecutor };
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-jw1zm273.js";
5
+ } from "./index-vkb9m4z7.js";
6
6
  import {
7
7
  generatedFilesForSync,
8
8
  createPassedPrimitiveReport,
9
9
  scalarChangedFiles
10
- } from "./index-trpasv9q.js";
10
+ } from "./index-033wne2j.js";
11
11
  import {
12
12
  pluralizeName
13
13
  } from "./index-nz8prx9g.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  AsyncDefaultExportDetector,
4
4
  resolveSsrPageEntriesForApp
5
- } from "./index-va06nr10.js";
5
+ } from "./index-g6ax17x4.js";
6
6
  import {
7
7
  FileSys2
8
8
  } from "./index-52w0fvh8.js";
@@ -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-vkb9m4z7.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-g6ax17x4.js";
50
53
  import {
51
54
  DesktopServerStage,
52
55
  UpdateUploader
53
- } from "./index-vk0pa0mn.js";
56
+ } from "./index-4v43h00g.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-35m6bzm7.js";
63
66
  import {
64
67
  LibraryScript
65
- } from "./index-pydbnfez.js";
68
+ } from "./index-9mt4smfy.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-xsd96yzw.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-vh4j6vdv.js")).ApplicationBuildRunner;
1902
+ var loadBuildRunner = async () => (await import("./applicationBuildRunner-wsszr305.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-fx8x7cat.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,6 +3433,7 @@ 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
  }
@@ -3635,7 +3688,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
3635
3688
  await Promise.all(shares.map(async (share) => await share.close()));
3636
3689
  }, "Abandoning the tunnel release; the shares expire on their own.");
3637
3690
  await Promise.all(apps.map(async (app) => {
3638
- const { TunnelShare } = await import("./TunnelShare-661cxz5e.js");
3691
+ const { TunnelShare } = await import("./TunnelShare-tfrnftgr.js");
3639
3692
  const share = await TunnelShare.open(app, { workspace: app.workspace });
3640
3693
  shares.push(share);
3641
3694
  urls.set(app.name, share.url);
@@ -9,10 +9,10 @@ import {
9
9
  NativePublicEnv,
10
10
  UpdatePackFolder,
11
11
  NativeApp
12
- } from "./index-g1mbppa9.js";
12
+ } from "./index-35m6bzm7.js";
13
13
  import {
14
14
  ExitCodeError
15
- } from "./index-jw1zm273.js";
15
+ } from "./index-vkb9m4z7.js";
16
16
  import {
17
17
  ConfigLock
18
18
  } from "./index-bqbf654f.js";
@@ -10,7 +10,7 @@ import {
10
10
  isScannedRootEntry,
11
11
  AppExecutor,
12
12
  LibExecutor
13
- } from "./index-va06nr10.js";
13
+ } from "./index-g6ax17x4.js";
14
14
  import {
15
15
  FileSys2
16
16
  } from "./index-52w0fvh8.js";
@@ -23,7 +23,7 @@ import {
23
23
  workflowPathsForPlan,
24
24
  workflowRunArtifactPath,
25
25
  workflowSyncDir
26
- } from "./index-trpasv9q.js";
26
+ } from "./index-033wne2j.js";
27
27
 
28
28
  // pkgs/@akanjs/devkit/akanContext.ts
29
29
  import { readdir } from "fs/promises";
@@ -1,13 +1,13 @@
1
1
  // @bun
2
2
  import {
3
3
  resolveSsrPageEntriesForApp
4
- } from "./index-va06nr10.js";
4
+ } from "./index-g6ax17x4.js";
5
5
  import {
6
6
  bundleDefine,
7
7
  CsrEntryFiles,
8
8
  PagesEntrySourceGenerator,
9
9
  PagesBundleBuilder
10
- } from "./index-192ha4xh.js";
10
+ } from "./index-h3r3nr9y.js";
11
11
 
12
12
  // pkgs/@akanjs/devkit/frontendBuild/csrArtifactBuilder.ts
13
13
  import { mkdir, rm, unlink } from "fs/promises";
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-jw1zm273.js";
5
+ } from "./index-vkb9m4z7.js";
6
6
  import {
7
7
  ModuleExecutor
8
- } from "./index-va06nr10.js";
8
+ } from "./index-g6ax17x4.js";
9
9
  import {
10
10
  sourceFile,
11
11
  moduleSourcePaths,
@@ -13,10 +13,10 @@ import {
13
13
  createPassedPrimitiveReport,
14
14
  bilingualLabelForField,
15
15
  bilingualDescriptionForField
16
- } from "./index-trpasv9q.js";
16
+ } from "./index-033wne2j.js";
17
17
  import {
18
18
  PageScript
19
- } from "./index-86jt2a0e.js";
19
+ } from "./index-27y8t17p.js";
20
20
  import {
21
21
  pluralizeName
22
22
  } from "./index-nz8prx9g.js";
@@ -5,13 +5,13 @@ import {
5
5
  writeGeneratedSyncState,
6
6
  createRepairReport,
7
7
  renderRepairReport
8
- } from "./index-trpasv9q.js";
8
+ } from "./index-033wne2j.js";
9
9
  import {
10
10
  AkanContextAnalyzer
11
- } from "./index-5edzv8fn.js";
11
+ } from "./index-nv79n88g.js";
12
12
  import {
13
13
  runner
14
- } from "./index-jw1zm273.js";
14
+ } from "./index-vkb9m4z7.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/repair/repair.runner.ts
17
17
  var spawnShell = async (workspace, command) => await workspace.spawn("bash", ["-lc", command.startsWith("akan ") ? `bun run ${command}` : command], {
@@ -5,15 +5,15 @@ import {
5
5
  CloudApi,
6
6
  CloudUpdates,
7
7
  PipelineSecrets
8
- } from "./index-cpb3nvma.js";
8
+ } from "./index-jrmzcp66.js";
9
9
  import {
10
10
  WorkspaceExecutor,
11
11
  AppExecutor
12
- } from "./index-va06nr10.js";
12
+ } from "./index-g6ax17x4.js";
13
13
  import {
14
14
  runner,
15
15
  assertPromptable
16
- } from "./index-jw1zm273.js";
16
+ } from "./index-vkb9m4z7.js";
17
17
  import {
18
18
  SubspaceConfig
19
19
  } from "./index-4pf8g7ff.js";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-jw1zm273.js";
5
+ } from "./index-vkb9m4z7.js";
6
6
  import {
7
7
  AGENT_BLOCK_START,
8
8
  AGENT_BLOCK_END,
@@ -13,14 +13,14 @@ import {
13
13
  CLAUDE_COMMENT_RULE,
14
14
  AppExecutor,
15
15
  LibExecutor
16
- } from "./index-va06nr10.js";
16
+ } from "./index-g6ax17x4.js";
17
17
  import {
18
18
  collectRecipeSources2,
19
19
  scanRecipes2
20
20
  } from "./index-hj6w4ka1.js";
21
21
  import {
22
22
  AkanContextAnalyzer
23
- } from "./index-5edzv8fn.js";
23
+ } from "./index-nv79n88g.js";
24
24
  import {
25
25
  Prompter2
26
26
  } from "./index-zzvvc845.js";