@akanjs/cli 3.0.0-beta.9 → 3.0.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 (224) hide show
  1. package/.build-stamp +1 -1
  2. package/CodeAgent-2vmp9qe0.js +9 -0
  3. package/CodeAgentRpcHost-p7h6n2hp.js +7 -0
  4. package/CodeAgentRpcListener-7p7z5dd7.js +97 -0
  5. package/CodeTui-5ed6bg2a.js +1457 -0
  6. package/README.ko.md +83 -28
  7. package/README.md +70 -27
  8. package/TunnelShare-cwh9ezsm.js +9 -0
  9. package/{agent.command-0q17pnrs.js → agent.command-gn73rhe7.js} +8 -9
  10. package/akanCode.js +102 -0
  11. package/application.command-e968t0hw.js +246 -0
  12. package/{applicationBuildRunner-kxwbssgn.js → applicationBuildRunner-64taxseg.js} +121 -77
  13. package/buildBatch.proc.js +120 -32
  14. package/cloud.command-0jm301rr.js +95 -0
  15. package/cloud.script-nemnzjpv.js +20 -0
  16. package/code.command-18kcm7hq.js +154 -0
  17. package/commandManifest.json +1 -1
  18. package/consoleToStderr-h5bryj94.js +7 -0
  19. package/context.command-trd9bn18.js +48 -0
  20. package/context.runner-y5hwh673.js +21 -0
  21. package/{dependencyScanner-shs82ynp.js → dependencyScanner-06z2dmrr.js} +2 -2
  22. package/{devTui-m1atgkc9.js → devTui-q7k7bakd.js} +122 -40
  23. package/fileSys-wzzrntkw.js +9 -0
  24. package/guideline.command-bdmdn2de.js +42 -0
  25. package/guidelines/agentRule/agentRule.instruction.md +154 -26
  26. package/guidelines/conventions/conventions.instruction.md +134 -48
  27. package/guidelines/mcpRule/mcpRule.instruction.md +7 -5
  28. package/guidelines/queryRule/queryRule.instruction.md +21 -7
  29. package/guidelines/runtimeRule/runtimeRule.instruction.md +291 -6
  30. package/guidelines/ssrRule/ssrRule.instruction.md +4 -2
  31. package/guidelines/transportRule/transportRule.instruction.md +10 -8
  32. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +20 -0
  33. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +66 -3
  34. package/incrementalBuilder.proc.js +564 -109
  35. package/index-0wpybxtr.js +2729 -0
  36. package/{index-kcxmv48c.js → index-2ahj896a.js} +45 -79
  37. package/index-2wc41k5w.js +49 -0
  38. package/index-3hx1z96c.js +87 -0
  39. package/{index-2tv3fdx4.js → index-3w94e7n3.js} +1228 -1458
  40. package/{index-hwkygn9s.js → index-48k96p55.js} +325 -36
  41. package/index-4npz05nm.js +187 -0
  42. package/{index-q0y2jq9j.js → index-52w0fvh8.js} +21 -4
  43. package/index-6he6gvfg.js +4300 -0
  44. package/index-7md2g9vw.js +6 -0
  45. package/{index-04bk599g.js → index-93j60em0.js} +10 -17
  46. package/index-94s080qm.js +266 -0
  47. package/index-9dp031by.js +12 -0
  48. package/{index-ktb5njgy.js → index-9z771ptz.js} +49 -99
  49. package/{index-y6n8nmny.js → index-abxpehf8.js} +75 -203
  50. package/{index-3d9y066c.js → index-bjwxs904.js} +9 -8
  51. package/{index-9077wzd2.js → index-by9pxkr0.js} +43 -26
  52. package/index-c6eggbee.js +123 -0
  53. package/index-d2242ksy.js +99 -0
  54. package/index-drehwpdt.js +1119 -0
  55. package/{index-92zztqy1.js → index-dy0jx9ay.js} +2 -17
  56. package/{index-ffvk10zz.js → index-f3c78nd6.js} +107 -241
  57. package/index-gbggbqcp.js +1058 -0
  58. package/{index-by5gpp8x.js → index-hj6w4ka1.js} +2 -1
  59. package/index-hsmtysz4.js +53 -0
  60. package/{index-j9yhg404.js → index-jmrn54tt.js} +4 -7
  61. package/{index-a64esmtb.js → index-kcdj1z5v.js} +523 -1022
  62. package/{index-d43r08tf.js → index-kqabytj7.js} +77 -150
  63. package/{index-vyvre9en.js → index-mbxbhay5.js} +6 -2
  64. package/{index-vxtad5bd.js → index-mgxpx3f2.js} +5 -8
  65. package/index-p6pbz9n5.js +25 -0
  66. package/{index-sj5vxr8f.js → index-p993efkq.js} +981 -897
  67. package/{index-2xp0kfkt.js → index-pmhqttv3.js} +37 -25
  68. package/index-tqm7jjcn.js +700 -0
  69. package/{index-0g7r8xz3.js → index-vpj42xwt.js} +114 -232
  70. package/index-wa5jbxj1.js +760 -0
  71. package/{index-k2j1hc4r.js → index-wprnsjms.js} +12 -12
  72. package/{index-gyd220p2.js → index-y3mphr1m.js} +554 -577
  73. package/index-yg7jhz8x.js +69 -0
  74. package/{index-h7yw2z9n.js → index-zzvvc845.js} +8 -14
  75. package/index.js +23 -22
  76. package/{library.command-qzzbj6d8.js → library.command-9h749a1x.js} +4 -5
  77. package/{localRegistry.command-vyrgg4xw.js → localRegistry.command-2bqqhxyz.js} +23 -43
  78. package/{module.command-rq5hq3ax.js → module.command-nv8nzgft.js} +8 -12
  79. package/{package.command-d9hd6v9n.js → package.command-mq4bggp6.js} +6 -7
  80. package/package.json +15 -7
  81. package/{page.command-126d56te.js → page.command-j639n707.js} +4 -5
  82. package/{primitive.command-taxd1538.js → primitive.command-kz6849th.js} +9 -23
  83. package/prompter-76k56b37.js +8 -0
  84. package/{quality.command-6gsna0a3.js → quality.command-4hyabwkb.js} +205 -377
  85. package/{recipeScanner-fpagtgc1.js → recipeScanner-4b69ybe0.js} +1 -1
  86. package/{repair.command-tq2dgy72.js → repair.command-a9awpbqr.js} +11 -35
  87. package/{routeSourceValidator-apyqw7wk.js → routeSourceValidator-7ycnfz0e.js} +0 -6
  88. package/{scalar.command-3bcmrrkv.js → scalar.command-ma4fpm9m.js} +7 -11
  89. package/skills/akan-code/SKILL.md +130 -0
  90. package/skills/akan-debug/SKILL.md +42 -0
  91. package/skills/akan-deps/SKILL.md +50 -0
  92. package/skills/akan-err/SKILL.md +39 -0
  93. package/skills/akan-module/SKILL.md +45 -0
  94. package/skills/akan-scaffold/SKILL.md +76 -0
  95. package/skills/akan-scalar/SKILL.md +52 -0
  96. package/skills/akan-service/SKILL.md +34 -0
  97. package/skills/akan-store/SKILL.md +67 -0
  98. package/skills/akan-ui/SKILL.md +63 -0
  99. package/skills/akan-validate/SKILL.md +44 -0
  100. package/{subspace.command-eddzqpx3.js → subspace.command-3k2pmrs4.js} +53 -62
  101. package/templates/__scalar/__model__/__model__.abstract.md.template +8 -0
  102. package/templates/app/page/_index.tsx +257 -258
  103. package/templates/app/page/_layout.tsx +5 -1
  104. package/templates/app/page/_overrides.tsx +12 -0
  105. package/templates/app/page/styles.css.template +316 -14
  106. package/templates/app/public/apple-touch-icon.png +0 -0
  107. package/templates/app/public/favicon.ico +0 -0
  108. package/templates/app/public/jelly/cloud.webp +0 -0
  109. package/templates/app/public/jelly/comet.webp +0 -0
  110. package/templates/app/public/jelly/moon.webp +0 -0
  111. package/templates/app/public/jelly/planet.webp +0 -0
  112. package/templates/app/public/jelly/rocket.webp +0 -0
  113. package/templates/app/public/jelly/star.webp +0 -0
  114. package/templates/app/public/jelly/sugar.webp +0 -0
  115. package/templates/app/public/logo.png +0 -0
  116. package/templates/app/ui/Recipe/index.ts +9 -0
  117. package/templates/app/ui/Recipe/jellyButton.ts +63 -0
  118. package/templates/appSample/lib/__scalar/workHistory/workHistory.abstract.ts +8 -39
  119. package/templates/appSample/lib/_noti/noti.abstract.ts +6 -29
  120. package/templates/appSample/lib/task/Task.Unit.tsx +1 -1
  121. package/templates/appSample/lib/task/Task.Util.tsx +10 -13
  122. package/templates/appSample/lib/task/Task.View.tsx +2 -2
  123. package/templates/appSample/lib/task/Task.Zone.tsx +5 -2
  124. package/templates/appSample/lib/task/task.abstract.ts +12 -32
  125. package/templates/appSample/lib/task/task.signal.spec.ts +1 -15
  126. package/templates/appSample/lib/task/task.signal.test.ts +15 -1
  127. package/templates/appSample/lib/task/task.signal.ts +10 -8
  128. package/templates/appSample/page/task/[taskId]/_index.tsx +6 -6
  129. package/templates/appSample/page/task/[taskId]/edit.tsx +5 -4
  130. package/templates/appSample/page/task/_index.tsx +4 -3
  131. package/templates/appSample/page/task/_layout.tsx +1 -1
  132. package/templates/appSample/page/task/new.tsx +5 -4
  133. package/templates/appSample/srvkit/{AuthGuard.ts → guards.ts} +7 -4
  134. package/templates/appSample/srvkit/{SessionInternalArg.ts → internalArgs.ts} +6 -4
  135. package/templates/appSample/ui/GlobalLoading.tsx +2 -1
  136. package/templates/appSample/ui/QuantityControl.tsx +3 -3
  137. package/templates/client.ts +7 -30
  138. package/templates/crudPages/[__model__Id]/edit/page.tsx +2 -1
  139. package/templates/crudPages/[__model__Id]/page.tsx +2 -1
  140. package/templates/crudPages/new/page.tsx +2 -1
  141. package/templates/crudPages/page.tsx +2 -1
  142. package/templates/crudSinglePage/page.tsx +2 -1
  143. package/templates/lib/__lib/lib.dictionary.ts +0 -2
  144. package/templates/lib/__lib/lib.document.ts +0 -2
  145. package/templates/lib/sig.ts +8 -30
  146. package/templates/localDev/docker-compose.yaml.template +3 -14
  147. package/templates/module/__model__.signal.ts +12 -4
  148. package/templates/pkgRoot/tsconfig.json.template +2 -7
  149. package/templates/server.ts +1 -3
  150. package/templates/service/__model__.abstract.md.template +8 -0
  151. package/templates/workspaceRoot/.gitignore.template +0 -1
  152. package/templates/workspaceRoot/AGENTS.md.template +6 -0
  153. package/templates/workspaceRoot/package.json.template +1 -3
  154. package/tunnel.command-xwr46b66.js +129 -0
  155. package/{typeChecker-3xgrzc2v.js → typeChecker-px49mezc.js} +1 -1
  156. package/typecheck.proc.js +1 -1
  157. package/workflow.command-t7wqe4h7.js +79 -0
  158. package/{workspace.command-06wvstgr.js → workspace.command-4derhzrh.js} +79 -109
  159. package/abstractCompactor-gmkc0z8j.js +0 -102
  160. package/application.command-18y0s485.js +0 -204
  161. package/applicationReleasePackager-4yasxwv9.js +0 -244
  162. package/capacitorApp-36rbr858.js +0 -12
  163. package/cloud.command-av97ndh6.js +0 -94
  164. package/cloud.script-cm11xjdz.js +0 -20
  165. package/context.command-5v37ef3n.js +0 -81
  166. package/devTuiView-0hc2emhe.js +0 -9
  167. package/getDirname-dr3jz1xg.js +0 -7
  168. package/guideline.command-4pz9g1rt.js +0 -360
  169. package/guidelines/agentRule/agentRule.generate.json +0 -31
  170. package/guidelines/componentRule/componentRule.generate.json +0 -31
  171. package/guidelines/conventions/conventions.generate.json +0 -25
  172. package/guidelines/cssRule/cssRule.generate.json +0 -31
  173. package/guidelines/docPageRule/docPageRule.generate.json +0 -31
  174. package/guidelines/docPageRule/docPageRule.instruction.md +0 -25
  175. package/guidelines/docSyncRule/docSyncRule.generate.json +0 -31
  176. package/guidelines/docSyncRule/docSyncRule.instruction.md +0 -25
  177. package/guidelines/enumConstant/enumConstant.generate.json +0 -31
  178. package/guidelines/enumConstant/enumConstant.instruction.md +0 -28
  179. package/guidelines/fieldRule/fieldRule.generate.json +0 -31
  180. package/guidelines/framework/framework.generate.json +0 -32
  181. package/guidelines/mcpRule/mcpRule.generate.json +0 -35
  182. package/guidelines/modelConstant/modelConstant.generate.json +0 -32
  183. package/guidelines/modelDictionary/modelDictionary.generate.json +0 -32
  184. package/guidelines/modelDocument/modelDocument.generate.json +0 -31
  185. package/guidelines/modelService/modelService.generate.json +0 -31
  186. package/guidelines/modelSignal/modelSignal.generate.json +0 -31
  187. package/guidelines/modelStore/modelStore.generate.json +0 -31
  188. package/guidelines/modelTemplate/modelTemplate.generate.json +0 -31
  189. package/guidelines/modelUnit/modelUnit.generate.json +0 -31
  190. package/guidelines/modelUtil/modelUtil.generate.json +0 -31
  191. package/guidelines/modelView/modelView.generate.json +0 -31
  192. package/guidelines/modelZone/modelZone.generate.json +0 -31
  193. package/guidelines/moduleCodegen/moduleCodegen.generate.json +0 -31
  194. package/guidelines/moduleCodegen/moduleCodegen.instruction.md +0 -28
  195. package/guidelines/moduleOverview/moduleOverview.generate.json +0 -31
  196. package/guidelines/queryRule/queryRule.generate.json +0 -31
  197. package/guidelines/recipeRule/recipeRule.generate.json +0 -31
  198. package/guidelines/runtimeRule/runtimeRule.generate.json +0 -25
  199. package/guidelines/scalarConstant/scalarConstant.generate.json +0 -32
  200. package/guidelines/scalarDictionary/scalarDictionary.generate.json +0 -32
  201. package/guidelines/scalarModule/scalarModule.generate.json +0 -31
  202. package/guidelines/sharedUiUsage/sharedUiUsage.generate.json +0 -31
  203. package/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +0 -25
  204. package/guidelines/ssrRule/ssrRule.generate.json +0 -31
  205. package/guidelines/transportRule/transportRule.generate.json +0 -31
  206. package/guidelines/utilUiUsage/utilUiUsage.generate.json +0 -31
  207. package/guidelines/utilUiUsage/utilUiUsage.instruction.md +0 -25
  208. package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +0 -24
  209. package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +0 -33
  210. package/index-47pj3aee.js +0 -76
  211. package/index-5ystnsd5.js +0 -841
  212. package/index-6wwzs1bc.js +0 -7
  213. package/index-a17x49vg.js +0 -229
  214. package/index-m0xccmmm.js +0 -228
  215. package/index-meh558jy.js +0 -65
  216. package/index-rtxxan88.js +0 -471
  217. package/index-te54x9zm.js +0 -338
  218. package/index-w8kmx1b6.js +0 -2176
  219. package/index-wt7qrtd4.js +0 -1516
  220. package/templates/__scalar/__model__/__model__.abstract.md +0 -28
  221. package/templates/module/__model__.abstract.md +0 -28
  222. package/templates/service/__model__.abstract.md +0 -28
  223. package/templates/workspaceRoot/patches/react-dom@19.2.7.patch.template +0 -62
  224. package/workflow.command-gtdnzvbz.js +0 -108
@@ -6,16 +6,24 @@ interface Dict {
6
6
  models: string;
7
7
  sysName: string;
8
8
  }
9
- export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict) {
9
+ interface Options {
10
+ sharedGuards?: boolean;
11
+ }
12
+ export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict, options: Options = {}) {
13
+ // Admin lives in libs/shared; without it root and cru stay None, shut until the app names a guard of its own.
14
+ const guardImports = options.sharedGuards
15
+ ? `import { Admin } from "@libs/shared/srvkit";\nimport { endpoint, internal, Public, slice } from "akanjs/signal";`
16
+ : `import { endpoint, internal, None, Public, slice } from "akanjs/signal";`;
17
+ const writeGuard = options.sharedGuards ? "Admin" : "None";
10
18
  return `
11
- import { endpoint, internal, None, Public, slice } from "akanjs/signal";
19
+ ${guardImports}
12
20
 
13
21
  import * as srv from "../srv";
14
22
 
15
23
  export class ${dict.Model}Internal extends internal(srv.${dict.model}, ({ interval }) => ({})) {}
16
24
 
17
- export class ${dict.Model}Slice extends slice(srv.${dict.model}, { guards: { root: None, get: Public, cru: Public } }, (init) => ({
18
- inPublic: init()
25
+ export class ${dict.Model}Slice extends slice(srv.${dict.model}, { guards: { root: ${writeGuard}, get: Public, cru: ${writeGuard} } }, (init) => ({
26
+ inPublic: init({ guards: [Public] })
19
27
  .exec(function () {
20
28
  return this.${dict.model}Service.queryAny();
21
29
  }),
@@ -1,10 +1,5 @@
1
1
  {
2
- "extends": "../../tsconfig.json",
2
+ "extends": "<%= workspaceRootPath %>/tsconfig.json",
3
3
  "files": [],
4
- "include": ["**/*.ts", "**/*.tsx"],
5
- "references": [
6
- {
7
- "path": "./tsconfig.spec.json"
8
- }
9
- ]
4
+ "include": ["**/*.ts", "**/*.tsx"]
10
5
  }
@@ -1,7 +1,5 @@
1
1
  import type { AppInfo, LibInfo } from "akanjs";
2
2
 
3
- const capitalize = (str: string) => str.charAt(0).toUpperCase() + str.slice(1);
4
-
5
3
  export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: { [key: string]: string } = {}) {
6
4
  if (!scanInfo) return null;
7
5
  const libs = scanInfo.getLibs();
@@ -32,7 +30,7 @@ ${scalarModules.map(([model]) => ` { constant: cnst.${model}, database: db.${
32
30
 
33
31
  ${scanInfo.type === "app" ? `export const server = new AkanServer("${scanInfo.name}", env, undefined${libs.length ? `, ${libs.join(", ")}` : ""}, lib);` : ""}
34
32
 
35
- export { env } from "./env/env.server.testing";
33
+ ${scanInfo.type === "lib" ? `export { env } from "./env/env.server.testing";` : ""}
36
34
  export * as db from "./lib/db";
37
35
  export * as srv from "./lib/srv";
38
36
  export * as sig from "./lib/sig";
@@ -0,0 +1,8 @@
1
+ # <%= model %> Service Abstract
2
+
3
+ <One sentence: the workflow or integration this service owns, stated as fact.>
4
+
5
+ ## Rules
6
+
7
+ - <An invariant the code obeys but cannot explain: a lifetime, a refusal, an ordering, and its reason.>
8
+ - <Two to five of them. If the service moves something through states, end the file with one arrow line.>
@@ -103,7 +103,6 @@ apps/*/common/index.ts
103
103
  apps/*/plugin/index.ts
104
104
  apps/*/client.ts
105
105
  apps/*/server.ts
106
- apps/*/capacitor.config.json
107
106
  libs/*/lib/cnst.ts
108
107
  libs/*/lib/dict.ts
109
108
  libs/*/lib/db.ts
@@ -6,6 +6,12 @@ the framework generate the repeated surfaces.
6
6
  For agent-neutral documentation that Claude Code, Codex, Devin, GitHub Copilot Coding Agent, and other tools can
7
7
  also read, see `docs/AI-DEVELOPMENT.md` and `docs/GENERATED.md`.
8
8
 
9
+ ## Framework Bugs And Feature Requests
10
+
11
+ If you hit an Akan.js bug, or a fix that one framework change would solve more easily than app-level workarounds,
12
+ draft a GitHub issue for <https://github.com/akan-team/akanjs/issues> (version, repro, expected vs actual) and ask
13
+ the user before filing it. Keep any interim workaround small and marked `// TODO: <issue url>`.
14
+
9
15
  ## Generated Context
10
16
 
11
17
  The section below is regenerated by `akan agent install` (run `bun run setup:agent`). It lists this
@@ -30,7 +30,5 @@
30
30
  },
31
31
  "dependencies": {},
32
32
  "devDependencies": {},
33
- "patchedDependencies": {
34
- "react-dom@19.2.7": "patches/react-dom@19.2.7.patch"
35
- }
33
+ "patchedDependencies": {}
36
34
  }
@@ -0,0 +1,129 @@
1
+ // @bun
2
+ import"./index-52w0fvh8.js";
3
+ import {
4
+ GlobalConfig,
5
+ CloudApi
6
+ } from "./index-94s080qm.js";
7
+ import {
8
+ Workspace,
9
+ runner,
10
+ script,
11
+ command
12
+ } from "./index-vpj42xwt.js";
13
+ import {
14
+ AppExecutor
15
+ } from "./index-3w94e7n3.js";
16
+ import {
17
+ TunnelShare2
18
+ } from "./index-2wc41k5w.js";
19
+ import {
20
+ writeClipboard
21
+ } from "./index-p6pbz9n5.js";
22
+
23
+ // pkgs/@akanjs/cli/tunnel/tunnel.script.ts
24
+ import { select } from "@inquirer/prompts";
25
+
26
+ // pkgs/@akanjs/cli/tunnel/tunnel.runner.ts
27
+ import { Logger } from "akanjs/common";
28
+ import chalk from "chalk";
29
+ class TunnelRunner extends runner("tunnel") {
30
+ async share(app, options) {
31
+ const spinner = app.spinning("Requesting a tunnel...");
32
+ const share = await TunnelShare2.open(app, {
33
+ ...options,
34
+ onLost: (reason) => Logger.rawLog(`tunnel disconnected (${reason}); reconnecting`, undefined, "error")
35
+ }).catch((error) => {
36
+ spinner.fail("Could not open the tunnel");
37
+ throw error;
38
+ });
39
+ spinner.succeed(`${app.name} is shared`);
40
+ const copied = await writeClipboard(share.url);
41
+ Logger.rawLog(`
42
+ ${chalk.bold(share.url)}${copied ? chalk.dim(" (copied)") : ""}`);
43
+ if (share.grant.expiresAt)
44
+ Logger.rawLog(chalk.dim(` expires ${share.grant.expiresAt}`));
45
+ Logger.rawLog(chalk.dim(` code ${share.grant.code} \u2014 stop it with: akan tunnel --stop ${share.grant.code}
46
+ `));
47
+ await TunnelRunner.holdUntilInterrupt(() => share.close());
48
+ }
49
+ async list(workspace, host = GlobalConfig.akanCloudHost) {
50
+ const api = await CloudApi.fromHost(workspace, host);
51
+ const tunnels = await api.tunnelListInSelf();
52
+ if (!tunnels.length) {
53
+ Logger.rawLog("No tunnels are open.");
54
+ return;
55
+ }
56
+ for (const tunnel of tunnels)
57
+ Logger.rawLog(`${tunnel.connected ? chalk.green("\u25CF") : chalk.dim("\u25CB")} ${tunnel.code} ${tunnel.url}` + `${tunnel.name ? ` ${chalk.dim(tunnel.name)}` : ""}` + `${tunnel.expiresAt ? chalk.dim(` expires ${tunnel.expiresAt}`) : ""}`);
58
+ }
59
+ async stop(code, workspace, host = GlobalConfig.akanCloudHost) {
60
+ const api = await CloudApi.fromHost(workspace, host);
61
+ const stopped = await api.revokeTunnel(code);
62
+ if (stopped)
63
+ Logger.rawLog(`Stopped ${code}.`);
64
+ else
65
+ Logger.rawLog(`No tunnel named ${code} is open.`, undefined, "error");
66
+ }
67
+ static holdUntilInterrupt(onInterrupt) {
68
+ return new Promise((resolve) => {
69
+ let closing = false;
70
+ const stop = () => {
71
+ if (closing) {
72
+ Logger.rawLog("Abandoning the tunnel release; it will expire on its own.", undefined, "error");
73
+ process.exit(130);
74
+ }
75
+ closing = true;
76
+ onInterrupt().then(() => resolve());
77
+ };
78
+ process.on("SIGINT", stop);
79
+ process.on("SIGTERM", stop);
80
+ });
81
+ }
82
+ }
83
+
84
+ // pkgs/@akanjs/cli/tunnel/tunnel.script.ts
85
+ class TunnelScript extends script("tunnel", [TunnelRunner]) {
86
+ static async resolveApp(workspace, name) {
87
+ const appNames = await workspace.getApps();
88
+ if (!appNames.length)
89
+ throw new Error("No apps found in this workspace (apps/<appName>/akan.config.ts)");
90
+ if (name && !appNames.includes(name))
91
+ throw new Error(`Unknown app: ${name}. Available: ${appNames.join(", ")}`);
92
+ if (name)
93
+ return AppExecutor.from(workspace, name);
94
+ const only = appNames.length === 1 ? appNames[0] : null;
95
+ if (only)
96
+ return AppExecutor.from(workspace, only);
97
+ return AppExecutor.from(workspace, await select({ message: "Select the app to share", choices: appNames }));
98
+ }
99
+ async share(name, { workspace, host, port, ttl }) {
100
+ const app = await TunnelScript.resolveApp(workspace, name);
101
+ await this.tunnelRunner.share(app, {
102
+ workspace,
103
+ ...host ? { host } : {},
104
+ ...port ? { port } : {},
105
+ ...ttl ? { ttlMinutes: ttl } : {}
106
+ });
107
+ }
108
+ async list(workspace, host) {
109
+ await this.tunnelRunner.list(workspace, host);
110
+ }
111
+ async stop(code, workspace, host) {
112
+ await this.tunnelRunner.stop(code, workspace, host);
113
+ }
114
+ }
115
+
116
+ // pkgs/@akanjs/cli/tunnel/tunnel.command.ts
117
+ class TunnelCommand extends command("tunnel", [TunnelScript], ({ public: target }) => ({
118
+ tunnel: target({ desc: "Share a locally running app on a public URL" }).arg("app", String, { desc: "app to share", nullable: true }).option("list", Boolean, { desc: "list the shares this account is holding", default: false }).option("stop", String, { desc: "stop the share with this code", default: "" }).option("host", String, { desc: "host of the cloud", default: GlobalConfig.akanCloudHost }).option("port", Number, { desc: "local port to share (default: the app's dev port)", nullable: true }).option("ttl", Number, { desc: "minutes before the share expires", nullable: true }).with(Workspace).exec(async function(app, list, stop, host, port, ttl, workspace) {
119
+ if (list)
120
+ return await this.tunnelScript.list(workspace, host);
121
+ if (stop)
122
+ return await this.tunnelScript.stop(stop, workspace, host);
123
+ await this.tunnelScript.share(app, { workspace, host, ...port ? { port } : {}, ...ttl ? { ttl } : {} });
124
+ })
125
+ })) {
126
+ }
127
+ export {
128
+ TunnelCommand
129
+ };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  TypeChecker2
4
- } from "./index-92zztqy1.js";
4
+ } from "./index-dy0jx9ay.js";
5
5
  export {
6
6
  TypeChecker2 as TypeChecker
7
7
  };
package/typecheck.proc.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  TypeChecker2
4
- } from "./index-92zztqy1.js";
4
+ } from "./index-dy0jx9ay.js";
5
5
 
6
6
  // pkgs/@akanjs/devkit/typecheck/typecheck.proc.ts
7
7
  import { Logger } from "akanjs/common";
@@ -0,0 +1,79 @@
1
+ // @bun
2
+ import {
3
+ Workspace,
4
+ script,
5
+ command
6
+ } from "./index-vpj42xwt.js";
7
+ import"./index-52w0fvh8.js";
8
+ import"./index-3w94e7n3.js";
9
+ import"./index-hj6w4ka1.js";
10
+ import"./index-y3mphr1m.js";
11
+ import"./index-9z771ptz.js";
12
+ import"./index-mbxbhay5.js";
13
+ import"./index-4npz05nm.js";
14
+ import"./index-kqabytj7.js";
15
+ import"./index-93j60em0.js";
16
+ import"./index-hsmtysz4.js";
17
+ import {
18
+ WorkflowRunner
19
+ } from "./index-f3c78nd6.js";
20
+
21
+ // pkgs/@akanjs/cli/workflow/workflow.script.ts
22
+ import { Logger } from "akanjs/common";
23
+ class WorkflowScript extends script("workflow", [WorkflowRunner]) {
24
+ async workflow(action, workflow, inputs, {
25
+ format = "markdown",
26
+ out = null,
27
+ dryRun = false,
28
+ workspace
29
+ } = {}) {
30
+ if (action === "list") {
31
+ Logger.rawLog(this.workflowRunner.list({ format }));
32
+ return;
33
+ }
34
+ if (!workflow)
35
+ throw new Error(`Workflow name is required for "${action}".`);
36
+ if (action === "explain") {
37
+ Logger.rawLog(this.workflowRunner.explain(workflow, { format }));
38
+ return;
39
+ }
40
+ if (action === "plan") {
41
+ Logger.rawLog(await this.workflowRunner.plan(workflow, inputs, { format, out }));
42
+ return;
43
+ }
44
+ if (action === "apply") {
45
+ if (!workspace)
46
+ throw new Error("Workspace is required for workflow apply.");
47
+ const registry = WorkflowRunner.stepRegistry(workspace);
48
+ Logger.rawLog(await this.workflowRunner.apply(workflow, { dryRun, format, workspace, registry }));
49
+ return;
50
+ }
51
+ if (action === "validate") {
52
+ if (!workspace)
53
+ throw new Error("Workspace is required for workflow validate.");
54
+ Logger.rawLog(await this.workflowRunner.validate(workflow, { format, workspace }));
55
+ return;
56
+ }
57
+ if (action === "report") {
58
+ if (!workspace)
59
+ throw new Error("Workspace is required for workflow report.");
60
+ Logger.rawLog(await this.workflowRunner.report(workflow, { format, workspace }));
61
+ return;
62
+ }
63
+ throw new Error(`Unknown workflow action: ${action}. Use list, explain, plan, apply, validate, or report.`);
64
+ }
65
+ }
66
+
67
+ // pkgs/@akanjs/cli/workflow/workflow.command.ts
68
+ class WorkflowCommand extends command("workflow", [WorkflowScript], ({ public: target }) => ({
69
+ workflow: target({ desc: "List, explain, plan, apply, validate, or report Akan workflows" }).arg("action", String, {
70
+ desc: "list, explain, plan, apply, validate, or report",
71
+ enum: ["list", "explain", "plan", "apply", "validate", "report"]
72
+ }).arg("workflow", String, { desc: "workflow name, plan path, or run id", nullable: true }).with(Workspace).option("format", String, { desc: "output format", flag: "o", default: "markdown", enum: ["markdown", "json"] }).option("out", String, { flag: "w", desc: "write workflow plan JSON to this path", nullable: true }).option("dryRun", Boolean, { flag: "r", desc: "show predicted apply report without writing files", default: false }).option("app", String, { desc: "target app or library name", nullable: true }).option("module", String, { desc: "target module name", nullable: true }).option("field", String, { desc: "field name", nullable: true }).option("type", String, { desc: "field type or scalar name", nullable: true }).option("values", String, { flag: "l", desc: "comma-separated values", nullable: true }).option("default", String, { desc: "default value", nullable: true }).option("scalar", String, { flag: "c", desc: "scalar name", nullable: true }).option("surface", String, { flag: "u", desc: "UI surface name", nullable: true }).option("mutation", String, { flag: "n", desc: "mutation name", nullable: true }).option("slice", String, { flag: "i", desc: "slice name", nullable: true }).exec(async function(action, workflow, workspace, format, out, dryRun, app, module, field, typeName, values, defaultValue, scalar, surface, mutation, slice) {
73
+ await this.workflowScript.workflow(action, workflow, { app, module, field, type: typeName, values, default: defaultValue, scalar, surface, mutation, slice }, { format, out, dryRun, workspace });
74
+ })
75
+ })) {
76
+ }
77
+ export {
78
+ WorkflowCommand
79
+ };
@@ -1,28 +1,28 @@
1
1
  // @bun
2
2
  import {
3
- FileSys
4
- } from "./index-q0y2jq9j.js";
3
+ FileSys2
4
+ } from "./index-52w0fvh8.js";
5
5
  import {
6
6
  GlobalConfig
7
- } from "./index-m0xccmmm.js";
7
+ } from "./index-94s080qm.js";
8
8
  import {
9
9
  Exec,
10
10
  Workspace,
11
11
  runner,
12
12
  script,
13
13
  command
14
- } from "./index-0g7r8xz3.js";
14
+ } from "./index-vpj42xwt.js";
15
15
  import {
16
16
  extractAgentBlock,
17
17
  collectScopeRecipeSources,
18
18
  renderScopeAgentBlock,
19
+ Linter,
19
20
  WorkspaceExecutor,
20
21
  SysExecutor,
21
22
  AppExecutor,
22
23
  LibExecutor,
23
24
  PkgExecutor
24
- } from "./index-2tv3fdx4.js";
25
- import"./index-6wwzs1bc.js";
25
+ } from "./index-3w94e7n3.js";
26
26
  import {
27
27
  countBlocking,
28
28
  formatStyleContract,
@@ -31,43 +31,44 @@ import {
31
31
  import {
32
32
  collectRecipeSources2,
33
33
  scanRecipes2
34
- } from "./index-by5gpp8x.js";
35
- import"./index-gyd220p2.js";
36
- import"./index-ktb5njgy.js";
37
- import"./index-h7yw2z9n.js";
34
+ } from "./index-hj6w4ka1.js";
35
+ import"./index-y3mphr1m.js";
36
+ import"./index-9z771ptz.js";
37
+ import"./index-zzvvc845.js";
38
38
  import {
39
39
  AgentScript
40
- } from "./index-k2j1hc4r.js";
41
- import {
42
- ApplicationScript
43
- } from "./index-sj5vxr8f.js";
40
+ } from "./index-wprnsjms.js";
41
+ import"./index-48k96p55.js";
42
+ import"./index-gbggbqcp.js";
44
43
  import {
45
44
  LibraryScript
46
- } from "./index-vxtad5bd.js";
47
- import"./index-hwkygn9s.js";
48
- import"./index-te54x9zm.js";
49
- import"./index-kcxmv48c.js";
45
+ } from "./index-mgxpx3f2.js";
46
+ import {
47
+ ApplicationScript
48
+ } from "./index-p993efkq.js";
49
+ import"./index-7md2g9vw.js";
50
+ import"./index-2ahj896a.js";
50
51
  import {
51
52
  PackageScript
52
- } from "./index-9077wzd2.js";
53
+ } from "./index-by9pxkr0.js";
53
54
  import {
54
55
  getNpmRegistryUrl,
55
56
  getLatestPackageVersion
56
- } from "./index-rtxxan88.js";
57
+ } from "./index-drehwpdt.js";
57
58
  import {
58
59
  CloudScript2
59
- } from "./index-2xp0kfkt.js";
60
+ } from "./index-pmhqttv3.js";
61
+ import"./index-abxpehf8.js";
62
+ import"./index-93j60em0.js";
63
+ import"./index-mbxbhay5.js";
64
+ import"./index-4npz05nm.js";
65
+ import"./index-kqabytj7.js";
66
+ import"./index-hsmtysz4.js";
67
+ import"./index-f3c78nd6.js";
60
68
  import {
61
69
  ContextScript
62
- } from "./index-y6n8nmny.js";
63
- import"./index-wt7qrtd4.js";
64
- import"./index-04bk599g.js";
65
- import"./index-ffvk10zz.js";
66
- import"./index-5ystnsd5.js";
67
- import"./index-vyvre9en.js";
68
- import"./index-d43r08tf.js";
69
- import"./index-a17x49vg.js";
70
- import"./index-j9yhg404.js";
70
+ } from "./index-yg7jhz8x.js";
71
+ import"./index-jmrn54tt.js";
71
72
 
72
73
  // pkgs/@akanjs/cli/workspace/workspace.runner.ts
73
74
  import path from "path";
@@ -96,29 +97,15 @@ var defaultMaxDiagnostics = 200;
96
97
  class WorkspaceRunner extends runner("workspace") {
97
98
  async generateAgentRules(workspace, { overwrite = false, cursorRules = true } = {}) {
98
99
  const [appNames] = await workspace.getExecs();
99
- const dict = {
100
- repoName: workspace.repoName,
101
- appName: appNames[0] ?? "app"
102
- };
103
- const created = await workspace.applyTemplate({
104
- basePath: ".",
105
- template: "workspaceRoot/AGENTS.md.template",
106
- dict,
107
- overwrite
108
- });
109
- created.push(...await workspace.applyTemplate({
110
- basePath: ".",
111
- template: "workspaceRoot/CLAUDE.md.template",
112
- dict,
113
- overwrite
114
- }));
115
- if (cursorRules)
116
- created.push(...await workspace.applyTemplate({
117
- basePath: ".cursor/rules",
118
- template: "workspaceRoot/.cursor/rules/akan.mdc.template",
119
- dict,
120
- overwrite
121
- }));
100
+ const dict = { repoName: workspace.repoName, appName: appNames[0] ?? "app" };
101
+ const templates = [
102
+ [".", "workspaceRoot/AGENTS.md.template"],
103
+ [".", "workspaceRoot/CLAUDE.md.template"],
104
+ ...cursorRules ? [[".cursor/rules", "workspaceRoot/.cursor/rules/akan.mdc.template"]] : []
105
+ ];
106
+ const created = [];
107
+ for (const [basePath, template] of templates)
108
+ created.push(...await workspace.applyTemplate({ basePath, template, dict, overwrite }));
122
109
  return created;
123
110
  }
124
111
  async createWorkspace(repoName, appName, {
@@ -181,57 +168,47 @@ class WorkspaceRunner extends runner("workspace") {
181
168
  return Object.fromEntries(Object.entries(dependencyVersions).filter(([dependency]) => defaultWorkspacePeerDependencies.has(dependency)));
182
169
  }
183
170
  async#getCliPackageJson() {
184
- const packageJsonCandidates = [
171
+ const found = await this.#findPackageJson("@akanjs/cli", [
185
172
  path.join(import.meta.dir, "../package.json"),
186
173
  path.join(import.meta.dir, "package.json"),
187
174
  path.join(path.dirname(Bun.main), "package.json")
188
- ];
189
- try {
190
- packageJsonCandidates.unshift(Bun.resolveSync("@akanjs/cli/package.json", import.meta.dir));
191
- } catch {}
192
- for (const packageJsonPath of packageJsonCandidates) {
193
- if (!await Bun.file(packageJsonPath).exists())
194
- continue;
195
- const packageJson = await FileSys.readJson(packageJsonPath);
196
- if (packageJson.name === "@akanjs/cli")
197
- return packageJson;
198
- }
199
- return { name: "@akanjs/cli", version: "0.0.0", description: "@akanjs/cli" };
175
+ ]);
176
+ return found ?? { name: "@akanjs/cli", version: "0.0.0", description: "@akanjs/cli" };
200
177
  }
201
178
  async#getAkanPackageJson() {
202
- const packageJsonCandidates = [
179
+ const ancestors = [];
180
+ for (let current = import.meta.dir, depth = 0;depth < 6; depth++) {
181
+ ancestors.push(path.join(current, "package.json"));
182
+ if (path.dirname(current) === current)
183
+ break;
184
+ current = path.dirname(current);
185
+ }
186
+ const found = await this.#findPackageJson("akanjs", [
203
187
  path.join(import.meta.dir, "../../../akanjs/package.json"),
204
188
  path.join(process.cwd(), "pkgs/akanjs/package.json"),
205
- path.join(path.dirname(Bun.main), "node_modules/akanjs/package.json")
206
- ];
189
+ path.join(path.dirname(Bun.main), "node_modules/akanjs/package.json"),
190
+ ...ancestors
191
+ ]);
192
+ if (!found)
193
+ throw new Error(`[workspace] failed to locate akanjs package.json from ${import.meta.dir}`);
194
+ return found;
195
+ }
196
+ async#findPackageJson(name, candidates) {
207
197
  try {
208
- packageJsonCandidates.unshift(Bun.resolveSync("akanjs/package.json", import.meta.dir));
198
+ candidates.unshift(Bun.resolveSync(`${name}/package.json`, import.meta.dir));
209
199
  } catch {}
210
- for (const packageJsonPath of packageJsonCandidates) {
200
+ for (const packageJsonPath of candidates) {
211
201
  if (!await Bun.file(packageJsonPath).exists())
212
202
  continue;
213
- const packageJson = await FileSys.readJson(packageJsonPath);
214
- if (packageJson.name === "akanjs")
203
+ const packageJson = await FileSys2.readJson(packageJsonPath);
204
+ if (packageJson.name === name)
215
205
  return packageJson;
216
206
  }
217
- let current = import.meta.dir;
218
- for (let depth = 0;depth < 6; depth++) {
219
- const packageJsonPath = path.join(current, "package.json");
220
- if (await Bun.file(packageJsonPath).exists()) {
221
- const packageJson = await FileSys.readJson(packageJsonPath);
222
- if (packageJson.name === "akanjs")
223
- return packageJson;
224
- }
225
- const parent = path.dirname(current);
226
- if (parent === current)
227
- break;
228
- current = parent;
229
- }
230
- throw new Error(`[workspace] failed to locate akanjs package.json from ${import.meta.dir}`);
207
+ return null;
231
208
  }
232
209
  async lint(exec, workspace, { fix = true, maxDiagnostics = defaultMaxDiagnostics } = {}) {
233
210
  const configPath = await WorkspaceRunner.resolveBiomeConfigPath(workspace);
234
- await workspace.spawn("./node_modules/.bin/biome", [
211
+ await workspace.spawn(`./node_modules/.bin/${Linter.biomeBinName}`, [
235
212
  "check",
236
213
  ...fix ? ["--write"] : [],
237
214
  "--no-errors-on-unmatched",
@@ -353,7 +330,10 @@ class WorkspaceScript extends script("workspace", [
353
330
  await this.libraryScript.installLibrary(workspace, "util");
354
331
  await this.libraryScript.installLibrary(workspace, "shared");
355
332
  }
356
- await this.applicationScript.createApplication(appName, workspace, { libs: installLibs ? ["util", "shared"] : [] });
333
+ await this.applicationScript.createApplication(appName, workspace, {
334
+ libs: installLibs ? ["util", "shared"] : [],
335
+ sample: true
336
+ });
357
337
  await workspace.applyTemplate({
358
338
  basePath: `apps/${appName}`,
359
339
  template: "appSample",
@@ -439,10 +419,13 @@ class WorkspaceScript extends script("workspace", [
439
419
  }
440
420
 
441
421
  // pkgs/@akanjs/cli/workspace/workspace.command.ts
422
+ var maxDiagnosticsOption = {
423
+ desc: "How many diagnostics Biome prints before truncating (0 for no limit)",
424
+ default: defaultMaxDiagnostics
425
+ };
426
+
442
427
  class WorkspaceCommand extends command("workspace", [WorkspaceScript], ({ public: target }) => ({
443
- createWorkspace: target({ desc: "Create a new Akan.js workspace", runsOnWorkspaceRoot: false }).arg("workspaceName", String, { desc: "what is the name of your organization?" }).option("app", String, {
444
- desc: "what is the codename of your first application? (e.g. myapp)"
445
- }).option("dir", String, {
428
+ createWorkspace: target({ desc: "Create a new Akan.js workspace", runsOnWorkspaceRoot: false }).arg("workspaceName", String, { desc: "what is the name of your organization?" }).option("app", String, { desc: "what is the codename of your first application? (e.g. myapp)" }).option("dir", String, {
446
429
  desc: "directory of workspace",
447
430
  default: process.env.USE_AKANJS_PKGS === "true" ? "local" : "."
448
431
  }).option("libs", Boolean, {
@@ -455,17 +438,10 @@ class WorkspaceCommand extends command("workspace", [WorkspaceScript], ({ public
455
438
  }
456
439
  ],
457
440
  default: false
458
- }).option("init", Boolean, {
459
- desc: "Do you want to initialize the workspace? (Recommended)",
460
- default: true
461
- }).option("registry", String, {
441
+ }).option("init", Boolean, { desc: "Do you want to initialize the workspace? (Recommended)", default: true }).option("registry", String, {
462
442
  desc: "npm registry URL for installing Akan packages",
463
443
  default: process.env.AKAN_NPM_REGISTRY ?? "https://registry.npmjs.org"
464
- }).option("owner", String, {
465
- desc: "owner of the workspace",
466
- default: process.env.GITHUB_OWNER,
467
- nullable: true
468
- }).option("mcpInstall", Boolean, {
444
+ }).option("owner", String, { desc: "owner of the workspace", default: process.env.GITHUB_OWNER, nullable: true }).option("mcpInstall", Boolean, {
469
445
  desc: "Install the Akan MCP server config for Cursor, Claude Code, and Codex? (Recommended)",
470
446
  default: true
471
447
  }).option("agentInstall", Boolean, {
@@ -489,16 +465,10 @@ class WorkspaceCommand extends command("workspace", [WorkspaceScript], ({ public
489
465
  }).option("overwrite", Boolean, { desc: "Overwrite existing agent rule files", default: false }).option("cursorRules", Boolean, { desc: "Generate .cursor/rules/akan.mdc", default: true }).with(Workspace).exec(async function(overwrite, cursorRules, workspace) {
490
466
  await this.workspaceScript.generateAgentRules(workspace, { overwrite, cursorRules });
491
467
  }),
492
- lint: target({ desc: "Lint and fix code in a specific app/lib/pkg" }).with(Exec).option("fix", Boolean, { default: true }).option("maxDiagnostics", Number, {
493
- desc: "How many diagnostics Biome prints before truncating (0 for no limit)",
494
- default: defaultMaxDiagnostics
495
- }).with(Workspace).exec(async function(exec, fix, maxDiagnostics, workspace) {
468
+ lint: target({ desc: "Lint and fix code in a specific app/lib/pkg" }).with(Exec).option("fix", Boolean, { default: true }).option("maxDiagnostics", Number, maxDiagnosticsOption).with(Workspace).exec(async function(exec, fix, maxDiagnostics, workspace) {
496
469
  await this.workspaceScript.lint(exec, workspace, { fix, maxDiagnostics });
497
470
  }),
498
- lintAll: target({ desc: "Lint and fix code in all apps and libraries" }).option("fix", Boolean, { default: true }).option("maxDiagnostics", Number, {
499
- desc: "How many diagnostics Biome prints before truncating (0 for no limit)",
500
- default: defaultMaxDiagnostics
501
- }).with(Workspace).exec(async function(fix, maxDiagnostics, workspace) {
471
+ lintAll: target({ desc: "Lint and fix code in all apps and libraries" }).option("fix", Boolean, { default: true }).option("maxDiagnostics", Number, maxDiagnosticsOption).with(Workspace).exec(async function(fix, maxDiagnostics, workspace) {
502
472
  await this.workspaceScript.lintAll(workspace, { fix, maxDiagnostics });
503
473
  }),
504
474
  syncAll: target({ desc: "Sync dependencies and configuration for all apps and libraries" }).with(Workspace).exec(async function(workspace) {