@akanjs/cli 3.0.0-alpha.11 → 3.0.0-alpha.111

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 (140) hide show
  1. package/.build-stamp +1 -1
  2. package/README.ko.md +1 -1
  3. package/README.md +1 -1
  4. package/{abstractCompactor-e5yq60qz.js → abstractCompactor-mjh5ppsq.js} +3 -5
  5. package/{agent.command-a3n15c6t.js → agent.command-d2gfxfck.js} +11 -13
  6. package/{application.command-rdm3et0g.js → application.command-pj2m7584.js} +65 -38
  7. package/{applicationBuildRunner-6m8n71w4.js → applicationBuildRunner-kxwbssgn.js} +27 -23
  8. package/{applicationReleasePackager-gg8ccbeh.js → applicationReleasePackager-4yasxwv9.js} +8 -9
  9. package/buildBatch.proc.js +12 -14
  10. package/capacitorApp-36rbr858.js +12 -0
  11. package/{cloud.command-56aeekqn.js → cloud.command-gxqp8xdv.js} +15 -18
  12. package/commandManifest.json +1 -1
  13. package/{context.command-ysxawe7h.js → context.command-ez8a0zyz.js} +19 -23
  14. package/dependencyScanner-shs82ynp.js +8 -0
  15. package/devTui-40ggmd99.js +553 -0
  16. package/devTuiView-c08ccbat.js +9 -0
  17. package/getDirname-dr3jz1xg.js +7 -0
  18. package/{guideline.command-yqf9a372.js → guideline.command-xmqwx8zm.js} +24 -22
  19. package/guidelines/agentRule/agentRule.generate.json +31 -0
  20. package/guidelines/agentRule/agentRule.instruction.md +531 -0
  21. package/guidelines/conventions/conventions.instruction.md +493 -369
  22. package/guidelines/framework/framework.generate.json +3 -2
  23. package/guidelines/framework/framework.instruction.md +0 -9
  24. package/guidelines/mcpRule/mcpRule.generate.json +35 -0
  25. package/guidelines/mcpRule/mcpRule.instruction.md +460 -0
  26. package/guidelines/modelStore/modelStore.instruction.md +12 -0
  27. package/guidelines/modelTemplate/modelTemplate.instruction.md +5 -0
  28. package/guidelines/queryRule/queryRule.generate.json +31 -0
  29. package/guidelines/queryRule/queryRule.instruction.md +178 -0
  30. package/guidelines/runtimeRule/runtimeRule.generate.json +25 -0
  31. package/guidelines/runtimeRule/runtimeRule.instruction.md +220 -0
  32. package/guidelines/ssrRule/ssrRule.instruction.md +51 -5
  33. package/guidelines/transportRule/transportRule.generate.json +31 -0
  34. package/guidelines/transportRule/transportRule.instruction.md +60 -0
  35. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +54 -764
  36. package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +33 -0
  37. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +467 -0
  38. package/incrementalBuilder.proc.js +26 -25
  39. package/{index-8pd02prk.js → index-259dsnz3.js} +58 -25
  40. package/{index-yzsxc30b.js → index-2tv3fdx4.js} +975 -234
  41. package/index-3d9y066c.js +76 -0
  42. package/{index-76rn3g2c.js → index-47pj3aee.js} +4 -4
  43. package/{index-m90fn8xe.js → index-4edzf1gr.js} +32 -32
  44. package/{index-3789fdpg.js → index-600zhnve.js} +94 -61
  45. package/{index-1577bej2.js → index-6wwzs1bc.js} +2 -2
  46. package/{index-cv9cxs5k.js → index-7737gxcp.js} +18 -18
  47. package/{index-a5cs7d8r.js → index-8few9nyh.js} +13 -13
  48. package/{index-mewacxye.js → index-8pm30m73.js} +57 -57
  49. package/{index-wnp7hwq7.js → index-92zztqy1.js} +7 -7
  50. package/{index-fgc8r6dj.js → index-a5vmm6x4.js} +3 -1
  51. package/{index-cav1azma.js → index-a64esmtb.js} +1106 -1369
  52. package/{index-nwqqssnb.js → index-aj7tyh5w.js} +26 -23
  53. package/{index-xys926f2.js → index-by5gpp8x.js} +4 -4
  54. package/{index-yzmqvg23.js → index-fz5q3gd7.js} +8 -8
  55. package/{index-kcsa1zff.js → index-gyd220p2.js} +4 -4
  56. package/{index-j37qq1f2.js → index-h7yw2z9n.js} +7 -7
  57. package/{index-bjpxzr6s.js → index-hwkygn9s.js} +51 -3
  58. package/index-j9yhg404.js +159 -0
  59. package/{index-46tjzh6s.js → index-kcxmv48c.js} +29 -29
  60. package/{index-0cj2zxbm.js → index-kn1h7p1x.js} +12 -11
  61. package/{index-e4b2ae6b.js → index-ktb5njgy.js} +41 -34
  62. package/{index-etwh7sd3.js → index-mak3cd28.js} +100 -32
  63. package/{index-xjd3rqzj.js → index-n68jx79w.js} +6 -15
  64. package/{index-z1s5f4e0.js → index-ne2qy0nk.js} +36 -37
  65. package/{index-65aeh789.js → index-pnqbkf5p.js} +1 -1
  66. package/{index-67546d0j.js → index-q0y2jq9j.js} +14 -2
  67. package/{index-4mgkgba3.js → index-rwg2aa4f.js} +14 -14
  68. package/{index-bzznxgcx.js → index-v0qh106m.js} +1002 -128
  69. package/{index-j9cxndc0.js → index-w8kmx1b6.js} +20 -11
  70. package/{index-h5whaj26.js → index-ws5e0j51.js} +16 -12
  71. package/{index-9va8zayb.js → index-wt7qrtd4.js} +27 -27
  72. package/index.js +22 -25
  73. package/{library.command-x6t29a30.js → library.command-nbsky672.js} +11 -10
  74. package/{localRegistry.command-649g1n7b.js → localRegistry.command-ts6t5e5a.js} +20 -23
  75. package/{module.command-8w8ys5t3.js → module.command-29vqzrh8.js} +13 -16
  76. package/{package.command-zgy7f3fz.js → package.command-axv0abmn.js} +8 -10
  77. package/package.json +5 -7
  78. package/{page.command-yjmnkyk2.js → page.command-vs9s3zrh.js} +7 -9
  79. package/{primitive.command-gfqaagsg.js → primitive.command-cbxmqbtc.js} +13 -16
  80. package/{quality.command-ec8r1dn3.js → quality.command-gmbs7nws.js} +184 -334
  81. package/recipeScanner-fpagtgc1.js +11 -0
  82. package/{repair.command-p9ey6mkm.js → repair.command-bqsjptsj.js} +12 -14
  83. package/{routeSourceValidator-e4jmbfcx.js → routeSourceValidator-apyqw7wk.js} +90 -19
  84. package/{scalar.command-9dhmqhtm.js → scalar.command-6k1vhe9s.js} +11 -14
  85. package/subspace.command-35a3t6vv.js +755 -0
  86. package/templates/app/env/env.client.debug.ts.template +1 -5
  87. package/templates/app/env/env.client.develop.ts.template +1 -5
  88. package/templates/app/env/env.client.local.ts.template +1 -5
  89. package/templates/app/env/env.client.main.ts.template +1 -5
  90. package/templates/app/env/env.client.testing.ts.template +1 -5
  91. package/templates/app/env/env.client.type.ts +2 -6
  92. package/templates/app/env/env.server.debug.ts.template +1 -5
  93. package/templates/app/env/env.server.develop.ts.template +1 -5
  94. package/templates/app/env/env.server.local.ts.template +1 -5
  95. package/templates/app/env/env.server.main.ts.template +1 -5
  96. package/templates/app/main.ts +3 -1
  97. package/templates/app/page/_index.tsx +3 -3
  98. package/templates/app/page/_layout.tsx +31 -32
  99. package/templates/appSample/lib/task/task.signal.ts +11 -6
  100. package/templates/appSample/page/task/[taskId]/_index.tsx +22 -27
  101. package/templates/appSample/page/task/[taskId]/edit.tsx +25 -30
  102. package/templates/appSample/page/task/_index.tsx +3 -7
  103. package/templates/appSample/page/task/_layout.tsx +4 -15
  104. package/templates/appSample/page/task/new.tsx +4 -10
  105. package/templates/appSample/srvkit/AuthGuard.ts +2 -2
  106. package/templates/crudPages/[__model__Id]/edit/page.tsx +27 -29
  107. package/templates/crudPages/[__model__Id]/page.tsx +24 -32
  108. package/templates/crudPages/new/page.tsx +26 -25
  109. package/templates/crudPages/page.tsx +27 -26
  110. package/templates/crudSinglePage/page.tsx +26 -21
  111. package/templates/env/_env.server.type.ts +7 -5
  112. package/templates/lib/db.ts +1 -1
  113. package/templates/lib/dict.ts +1 -1
  114. package/templates/lib/sig.ts +5 -1
  115. package/templates/lib/srv.ts +6 -2
  116. package/templates/module/__model__.dictionary.ts +4 -1
  117. package/templates/module/__model__.signal.ts +2 -3
  118. package/templates/module/__model__.store.ts +1 -2
  119. package/templates/workspaceRoot/.gitignore.template +0 -1
  120. package/templates/workspaceRoot/.husky/pre-commit.template +16 -0
  121. package/templates/workspaceRoot/.vscode/settings.json.template +1 -1
  122. package/templates/workspaceRoot/AGENTS.md.template +4 -0
  123. package/templates/workspaceRoot/CLAUDE.md.template +19 -0
  124. package/templates/workspaceRoot/biome.json.template +1 -1
  125. package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +10 -14
  126. package/templates/workspaceRoot/docs/GENERATED.md.template +12 -10
  127. package/templates/workspaceRoot/package.json.template +2 -4
  128. package/typeChecker-3xgrzc2v.js +7 -0
  129. package/typecheck.proc.js +4 -5
  130. package/{workflow.command-ycwc6zr6.js → workflow.command-nwpcdc8p.js} +22 -25
  131. package/{workspace.command-xhyhajxa.js → workspace.command-aczjxzbf.js} +64 -66
  132. package/capacitorApp-mr81qdxq.js +0 -61
  133. package/dependencyScanner-f6grrep3.js +0 -9
  134. package/getDirname-m9s0cmhq.js +0 -8
  135. package/index-mxvakhsm.js +0 -66
  136. package/index-r24hmh0q.js +0 -4
  137. package/recipeScanner-tghkzrrt.js +0 -12
  138. package/typeChecker-kravn7ns.js +0 -8
  139. /package/{index-0wae5ebk.js → index-meh558jy.js} +0 -0
  140. /package/{index-ss469dec.js → index-nz8prx9g.js} +0 -0
@@ -2,16 +2,24 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-etwh7sd3.js";
5
+ } from "./index-mak3cd28.js";
6
6
  import {
7
7
  LibExecutor
8
- } from "./index-yzsxc30b.js";
8
+ } from "./index-2tv3fdx4.js";
9
+ import {
10
+ LibSource,
11
+ formatLibStatuses
12
+ } from "./index-3d9y066c.js";
13
+
14
+ // pkgs/@akanjs/cli/library/library.script.ts
15
+ import { Logger } from "akanjs/common";
9
16
 
10
- // pkgs/@akanjs/cli/semver.ts
11
- function parseVersion(version) {
17
+ // pkgs/@akanjs/devkit/semver.ts
18
+ var stripRangeOperator = (version) => version.replace(/^[\s^~>=<v]+/, "").trim();
19
+ var parseVersion = (version) => {
12
20
  return version.replace(/^[^\d]*/, "").split(/[.-]/).map((part) => Number.parseInt(part, 10)).map((part) => Number.isFinite(part) ? part : 0);
13
- }
14
- function compareSemver(a, b) {
21
+ };
22
+ var compareNumeric = (a, b) => {
15
23
  const left = parseVersion(a);
16
24
  const right = parseVersion(b);
17
25
  const length = Math.max(left.length, right.length);
@@ -21,40 +29,64 @@ function compareSemver(a, b) {
21
29
  return diff > 0 ? 1 : -1;
22
30
  }
23
31
  return 0;
24
- }
32
+ };
33
+ var compareSemver = (a, b) => {
34
+ try {
35
+ return Bun.semver.order(stripRangeOperator(a), stripRangeOperator(b));
36
+ } catch {
37
+ return compareNumeric(a, b);
38
+ }
39
+ };
25
40
 
26
41
  // pkgs/@akanjs/cli/library/library.runner.ts
27
42
  class LibraryRunner extends runner("library") {
43
+ static libraryRepository = "https://github.com/akan-team/akanjs.git";
28
44
  async createLibrary(libName, workspace) {
29
- await workspace.exec(`mkdir -p libs/${libName}`);
45
+ await workspace.mkdir(`libs/${libName}`);
30
46
  await workspace.applyTemplate({ basePath: `libs/${libName}`, template: "libRoot", dict: { libName } });
31
47
  const lib = LibExecutor.from(workspace, libName);
32
48
  return lib;
33
49
  }
34
50
  async removeLibrary(lib) {
35
- await lib.workspace.exec(`rm -rf libs/${lib.name}`);
51
+ await lib.workspace.removeDir(`libs/${lib.name}`);
36
52
  }
37
53
  async#copyInstalledLibrary(workspace, libName) {
38
54
  const installedPackageJson = `node_modules/akanjs/libs/${libName}/package.json`;
39
55
  if (!await workspace.exists(installedPackageJson))
40
- return false;
56
+ return null;
41
57
  await workspace.cp(`node_modules/akanjs/libs/${libName}`, `libs/${libName}`);
42
- return true;
58
+ return { origin: "akanjs", sha: await this.#installedAkanVersion(workspace) };
59
+ }
60
+ async#installedAkanVersion(workspace) {
61
+ const manifestPath = "node_modules/akanjs/package.json";
62
+ if (!await workspace.exists(manifestPath))
63
+ return "unknown";
64
+ const { version } = await workspace.readJson(manifestPath);
65
+ return version ?? "unknown";
43
66
  }
44
67
  async#copyLibraryFromRepository(workspace, libName) {
45
68
  await workspace.mkdir("node_modules/.akan");
46
69
  if (await workspace.exists("node_modules/.akan/akanjs"))
47
70
  await workspace.removeDir("node_modules/.akan/akanjs");
48
- await workspace.exec(`cd node_modules/.akan && git clone https://github.com/akan-team/akanjs.git`);
71
+ await workspace.exec(`cd node_modules/.akan && git clone ${LibraryRunner.libraryRepository}`);
49
72
  await workspace.cp(`node_modules/.akan/akanjs/libs/${libName}`, `libs/${libName}`);
73
+ const sha = await workspace.spawn("git", ["-C", "node_modules/.akan/akanjs", "rev-parse", "HEAD"]);
74
+ return { origin: LibraryRunner.libraryRepository, sha: sha.trim().slice(0, 12) };
50
75
  }
51
76
  async installLibrary(workspace, libName) {
52
- const copiedFromInstalledPackage = await this.#copyInstalledLibrary(workspace, libName);
53
- if (!copiedFromInstalledPackage)
54
- await this.#copyLibraryFromRepository(workspace, libName);
55
- await workspace.cp(`libs/${libName}/env/env.server.example.ts`, `libs/${libName}/env/env.server.testing.ts`);
56
- await workspace.commit(`Add ${libName} library`);
57
- return LibExecutor.from(workspace, libName);
77
+ const source = await this.#copyInstalledLibrary(workspace, libName) ?? await this.#copyLibraryFromRepository(workspace, libName);
78
+ const testingEnv = `libs/${libName}/env/env.server.testing.ts`;
79
+ if (!await workspace.exists(testingEnv))
80
+ await workspace.cp(`libs/${libName}/env/env.server.example.ts`, testingEnv);
81
+ const lib = LibExecutor.from(workspace, libName);
82
+ const stamp = await new LibSource(lib).write(source);
83
+ if (await workspace.hasChanges())
84
+ await workspace.commit(`Install ${libName} library from ${stamp.origin}`);
85
+ return lib;
86
+ }
87
+ async libraryStatuses(workspace) {
88
+ const libNames = await workspace.getLibs();
89
+ return await Promise.all(libNames.map((libName) => new LibSource(LibExecutor.from(workspace, libName)).status()));
58
90
  }
59
91
  async mergeLibraryDependencies(lib) {
60
92
  const libPackageJson = await lib.getPackageJson();
@@ -70,7 +102,7 @@ class LibraryRunner extends runner("library") {
70
102
  return [dep, newerVersion];
71
103
  }));
72
104
  Object.keys(allDependencies).sort().forEach((dep) => {
73
- if (!!libPackageJson.dependencies?.[dep] || !!rootPackageJson.dependencies?.[dep])
105
+ if (libPackageJson.dependencies?.[dep] || rootPackageJson.dependencies?.[dep])
74
106
  dependencies[dep] = allDependencies[dep];
75
107
  else
76
108
  devDependencies[dep] = allDependencies[dep];
@@ -80,7 +112,6 @@ class LibraryRunner extends runner("library") {
80
112
  await lib.workspace.spawn("bun", ["install"]);
81
113
  await lib.workspace.commit(`Merge ${lib.name} library dependencies`);
82
114
  }
83
- async testLibrary(lib) {}
84
115
  }
85
116
 
86
117
  // pkgs/@akanjs/cli/library/library.script.ts
@@ -102,6 +133,13 @@ class LibraryScript extends script("library", [LibraryRunner]) {
102
133
  await this.libraryRunner.removeLibrary(lib);
103
134
  spinner.succeed(`Library ${lib.name} (libs/${lib.name}) is removed`);
104
135
  }
136
+ async libraryStatus(workspace, format = "text") {
137
+ const spinner = workspace.spinning("Checking library sources...");
138
+ const statuses = await this.libraryRunner.libraryStatuses(workspace);
139
+ const drifted = statuses.filter((status) => status.drift === "drifted").length;
140
+ spinner.succeed(`Checked ${statuses.length} libraries (${drifted} drifted)`);
141
+ Logger.rawLog(format === "json" ? JSON.stringify(statuses, null, 2) : formatLibStatuses(statuses));
142
+ }
105
143
  async installLibrary(workspace, libName) {
106
144
  const installSpinner = workspace.spinning(`Installing ${libName} library`);
107
145
  const lib = await this.libraryRunner.installLibrary(workspace, libName);
@@ -110,11 +148,6 @@ class LibraryScript extends script("library", [LibraryRunner]) {
110
148
  await this.libraryRunner.mergeLibraryDependencies(lib);
111
149
  mergeSpinner.succeed(`${libName} library (libs/${libName}) dependencies merged to root package.json`);
112
150
  }
113
- async testLibrary(lib) {
114
- const spinner = lib.spinning("Testing library...");
115
- await this.libraryRunner.testLibrary(lib);
116
- spinner.succeed(`Library ${lib.name} (libs/${lib.name}) test is successful`);
117
- }
118
151
  }
119
152
 
120
153
  export { LibraryScript };