@akanjs/cli 3.0.0-alpha.5 → 3.0.0-alpha.50

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 (110) 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-20e0cwbs.js} +2 -2
  5. package/{agent.command-b0fcx3r2.js → agent.command-nqs3bw0g.js} +8 -7
  6. package/{application.command-cgmy00gd.js → application.command-k2v46pxf.js} +7 -6
  7. package/{applicationBuildRunner-n1svrwgt.js → applicationBuildRunner-t5v6tcrm.js} +6 -7
  8. package/{applicationReleasePackager-gg8ccbeh.js → applicationReleasePackager-93nzdfsy.js} +1 -1
  9. package/buildBatch.proc.js +6 -5
  10. package/{capacitorApp-yyw35vg4.js → capacitorApp-927ahhz2.js} +29 -26
  11. package/{cloud.command-1m7hfdpk.js → cloud.command-7jwmxtez.js} +11 -10
  12. package/{context.command-b5heat2a.js → context.command-6kn3tady.js} +16 -15
  13. package/{dependencyScanner-f6grrep3.js → dependencyScanner-rbs2407b.js} +1 -1
  14. package/getDirname-ka11hm7e.js +8 -0
  15. package/{guideline.command-9ew6aqhm.js → guideline.command-pjdrndqk.js} +7 -6
  16. package/guidelines/agentRule/agentRule.generate.json +31 -0
  17. package/guidelines/agentRule/agentRule.instruction.md +413 -0
  18. package/guidelines/conventions/conventions.generate.json +25 -0
  19. package/guidelines/conventions/conventions.instruction.md +752 -0
  20. package/guidelines/cssRule/cssRule.instruction.md +7 -0
  21. package/guidelines/framework/framework.instruction.md +1 -0
  22. package/guidelines/mcpRule/mcpRule.generate.json +25 -0
  23. package/guidelines/mcpRule/mcpRule.instruction.md +164 -0
  24. package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +24 -0
  25. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +638 -0
  26. package/incrementalBuilder.proc.js +7 -6
  27. package/index-1577bej2.js +7 -0
  28. package/{index-jn9vfpwz.js → index-24h5bqpj.js} +54 -15
  29. package/{index-hrwzz2wf.js → index-4z05haak.js} +1 -1
  30. package/{index-m4kpmmtj.js → index-5em412h5.js} +1 -1
  31. package/{index-6npsfpxr.js → index-5fe016p2.js} +3 -3
  32. package/{index-bjpxzr6s.js → index-5vy2jzar.js} +1 -1
  33. package/{index-exhpp31y.js → index-6bs24rb4.js} +15 -7
  34. package/{index-nx1vbtsc.js → index-7etegaht.js} +14 -14
  35. package/{index-wrrb8rxk.js → index-7w5vv8jk.js} +4 -4
  36. package/{index-meh7mmz9.js → index-7zd96bng.js} +8 -4
  37. package/{index-p69fcwe1.js → index-866yqz3y.js} +13 -13
  38. package/{index-jkynkyfk.js → index-8rr621r2.js} +5 -3
  39. package/{index-47qxw1tz.js → index-90zyjrby.js} +170 -65
  40. package/{index-pfrt7qwh.js → index-97cw8sg1.js} +4 -4
  41. package/{index-p6txr1ss.js → index-bwt525ne.js} +9 -11
  42. package/{index-qp089jp0.js → index-j37qq1f2.js} +1 -1
  43. package/{index-c94nq3c1.js → index-k7sm38v6.js} +3 -3
  44. package/{index-j9cxndc0.js → index-qnv0aqmm.js} +9 -6
  45. package/{index-0cj2zxbm.js → index-sh01r3pm.js} +1 -1
  46. package/{index-0fj4yg7k.js → index-wr999y03.js} +105 -227
  47. package/{index-nfxq39kj.js → index-xe3ychw5.js} +37 -6
  48. package/{index-60a3jfcz.js → index-xrdrttjb.js} +8 -8
  49. package/{index-mn96y1nk.js → index-y59x51f1.js} +6 -6
  50. package/{index-mterpj70.js → index-zgkey4d0.js} +86 -17
  51. package/index.js +20 -19
  52. package/{library.command-aa1g8nsa.js → library.command-7h3yezwc.js} +5 -4
  53. package/{localRegistry.command-kshva1ck.js → localRegistry.command-vnkc41gj.js} +10 -9
  54. package/{module.command-b1zzgqde.js → module.command-4g11k3xd.js} +9 -8
  55. package/{package.command-9qv6vr9s.js → package.command-z7dd6vy2.js} +5 -4
  56. package/package.json +3 -4
  57. package/{page.command-k16pw244.js → page.command-y996708m.js} +5 -4
  58. package/{primitive.command-s60dn1ae.js → primitive.command-4fcn8k83.js} +10 -9
  59. package/{quality.command-p3vaze52.js → quality.command-hx5af2yn.js} +193 -112
  60. package/{recipeScanner-tghkzrrt.js → recipeScanner-zrzev25x.js} +3 -3
  61. package/{repair.command-mfv749ha.js → repair.command-ysxd8pef.js} +7 -6
  62. package/{routeSourceValidator-cncd92fv.js → routeSourceValidator-7fycdqyv.js} +3 -39
  63. package/{scalar.command-hs3nwzv1.js → scalar.command-3chgxybs.js} +8 -7
  64. package/templates/app/env/env.server.debug.ts.template +1 -5
  65. package/templates/app/env/env.server.develop.ts.template +1 -5
  66. package/templates/app/env/env.server.local.ts.template +1 -5
  67. package/templates/app/env/env.server.main.ts.template +1 -5
  68. package/templates/app/page/styles.css.template +3 -3
  69. package/templates/appSample/srvkit/AuthGuard.ts +9 -5
  70. package/templates/appSample/srvkit/SessionInternalArg.ts +4 -3
  71. package/templates/crudPages/[__model__Id]/edit/page.tsx +1 -1
  72. package/templates/crudPages/new/page.tsx +1 -1
  73. package/templates/crudSinglePage/page.tsx +1 -1
  74. package/templates/env/_env.server.type.ts +7 -5
  75. package/templates/lib/db.ts +1 -1
  76. package/templates/lib/dict.ts +1 -1
  77. package/templates/lib/sig.ts +1 -1
  78. package/templates/lib/srv.ts +6 -2
  79. package/templates/module/__Model__.Util.tsx +1 -1
  80. package/templates/module/__Model__.Zone.tsx +3 -5
  81. package/templates/workspaceRoot/AGENTS.md.template +0 -967
  82. package/templates/workspaceRoot/CLAUDE.md.template +19 -0
  83. package/templates/workspaceRoot/biome.json.template +4 -220
  84. package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +15 -16
  85. package/templates/workspaceRoot/docs/GENERATED.md.template +12 -10
  86. package/{typeChecker-kravn7ns.js → typeChecker-g6bh0xfv.js} +1 -1
  87. package/typecheck.proc.js +1 -1
  88. package/{workflow.command-z0e0fk0z.js → workflow.command-endxfzv5.js} +15 -14
  89. package/{workspace.command-3q1d6kk4.js → workspace.command-5f2nmmd5.js} +70 -52
  90. package/templates/workspaceRoot/.cursor/rules/akan-page-routing.mdc.template +0 -43
  91. package/templates/workspaceRoot/.cursor/rules/akan-sync-conventions.mdc.template +0 -34
  92. package/templates/workspaceRoot/.cursor/rules/application-test-commands.mdc.template +0 -16
  93. package/templates/workspaceRoot/.cursor/rules/change-scope.mdc.template +0 -12
  94. package/templates/workspaceRoot/.cursor/rules/client-server-boundaries.mdc.template +0 -18
  95. package/templates/workspaceRoot/.cursor/rules/coding-comments.mdc.template +0 -25
  96. package/templates/workspaceRoot/.cursor/rules/coding-style.mdc.template +0 -44
  97. package/templates/workspaceRoot/.cursor/rules/domain-module-conventions.mdc.template +0 -17
  98. package/templates/workspaceRoot/.cursor/rules/format-lint.mdc.template +0 -12
  99. package/templates/workspaceRoot/.cursor/rules/lint-enforced-rules.mdc.template +0 -18
  100. package/templates/workspaceRoot/.cursor/rules/module-file-playbook.mdc.template +0 -61
  101. package/templates/workspaceRoot/.cursor/rules/naming-conventions.mdc.template +0 -15
  102. package/templates/workspaceRoot/.cursor/rules/react-component-style.mdc.template +0 -21
  103. package/templates/workspaceRoot/.cursor/rules/repo-overview.mdc.template +0 -17
  104. package/templates/workspaceRoot/.cursor/rules/scalar-modeling.mdc.template +0 -58
  105. package/templates/workspaceRoot/.cursor/rules/secrets-and-env.mdc.template +0 -13
  106. package/templates/workspaceRoot/.cursor/rules/service-signal-conventions.mdc.template +0 -83
  107. package/templates/workspaceRoot/.cursor/rules/srvkit-adapters-and-guards.mdc.template +0 -50
  108. package/templates/workspaceRoot/.cursor/rules/ssr-first.mdc.template +0 -59
  109. package/templates/workspaceRoot/.cursor/rules/typescript-imports.mdc.template +0 -16
  110. /package/{index-r24hmh0q.js → index-yb2wsc7f.js} +0 -0
@@ -2,12 +2,15 @@
2
2
  import {
3
3
  Spinner
4
4
  } from "./index-mxvakhsm.js";
5
+ import {
6
+ getDirname
7
+ } from "./index-1577bej2.js";
5
8
  import {
6
9
  FileSys
7
10
  } from "./index-67546d0j.js";
8
11
  import {
9
12
  __require
10
- } from "./index-r24hmh0q.js";
13
+ } from "./index-yb2wsc7f.js";
11
14
 
12
15
  // pkgs/@akanjs/devkit/executors.ts
13
16
  import {
@@ -30,6 +33,7 @@ import path5 from "path";
30
33
  import { pathToFileURL } from "url";
31
34
  import {
32
35
  capitalize,
36
+ getPageSourceFileViolation,
33
37
  isRouteSourceFile,
34
38
  Logger,
35
39
  parseRouteModuleKey,
@@ -41,9 +45,24 @@ import chalk2 from "chalk";
41
45
 
42
46
  // pkgs/@akanjs/devkit/agentsIndex.ts
43
47
  var recipeScannerLoad = null;
44
- var loadRecipeScanner = () => recipeScannerLoad ??= import("./recipeScanner-tghkzrrt.js");
48
+ var loadRecipeScanner = () => recipeScannerLoad ??= import("./recipeScanner-zrzev25x.js");
45
49
  var AGENT_BLOCK_START = "<!-- akan:agent:start -->";
46
50
  var AGENT_BLOCK_END = "<!-- akan:agent:end -->";
51
+ var AGENT_VERSION_PREFIX = "<!-- akan:agent:version ";
52
+ var stampBlockVersion = (block, version) => `${AGENT_VERSION_PREFIX}${version} -->
53
+
54
+ ${block}`;
55
+ var extractBlockVersion = (content) => content.match(/<!-- akan:agent:version ([^\s]+) -->/)?.[1] ?? null;
56
+ var readDevkitVersion = async () => {
57
+ const { readFile } = await import("fs/promises");
58
+ const { getDirname: getDirname2 } = await import("./getDirname-ka11hm7e.js");
59
+ try {
60
+ const raw = await readFile(`${getDirname2(import.meta.url)}/package.json`, "utf-8");
61
+ return JSON.parse(raw).version ?? null;
62
+ } catch {
63
+ return null;
64
+ }
65
+ };
47
66
  var upsertAgentBlock = (existing, block) => {
48
67
  const managed = `${AGENT_BLOCK_START}
49
68
  ${block}
@@ -137,9 +156,29 @@ ${AGENT_BLOCK_START}
137
156
  ${block}
138
157
  ${AGENT_BLOCK_END}
139
158
  `;
159
+ var CLAUDE_COMMENT_RULE = `## Comments \u2014 Overrides Your Default
160
+
161
+ Write **no comments** unless the comment passes the test below. This is the rule agents break most often here, so it
162
+ is repeated outside the guide: a diff that adds a comment the test rejects is a diff to redo.
163
+
164
+ Before typing \`//\`, \`/*\`, or a doc block, ask \u2014 **does this sentence carry a fact that is nowhere in the code?**
165
+
166
+ - Restates the identifier, the signature, or the line under it \u2192 delete it.
167
+ - Labels a section (\`// helpers\`, \`// state\`) or narrates a step (\`// fetch the user\`, \`// then save\`) \u2192 delete it.
168
+ - JSDoc on an ordinary function, or a why/how preamble on ordinary logic \u2192 delete it.
169
+ - Explains the edit you just made, for whoever reads the diff \u2192 say it in your reply, not in the file.
170
+ - Names a vendor or protocol quirk, an infrastructure constraint, a library gotcha, security reasoning, a math
171
+ derivation, a domain field's business meaning, a state transition, or why an obvious alternative was rejected \u2192
172
+ keep it, one line.
173
+
174
+ That keep-list is exact \u2014 \`Comments\` in the guide is the full version. "It aids readability" and "this logic is
175
+ subtle" are not on it: rename or split the code instead. When you edit an existing file, match its density; if the
176
+ surrounding code carries none, your diff carries none.`;
140
177
  var renderScopeClaudeMd = (scope) => `# ${scope.name} \u2014 Claude Code Guide
141
178
 
142
179
  @AGENTS.md
180
+
181
+ ${CLAUDE_COMMENT_RULE}
143
182
  `;
144
183
 
145
184
  // pkgs/@akanjs/devkit/akanConfig/akanConfig.ts
@@ -182,8 +221,6 @@ var DEFAULT_OPTIMIZE_IMPORTS = [
182
221
  ];
183
222
  var WORKSPACE_BARREL_FACETS = ["ui", "webkit", "common", "client", "server"];
184
223
  var SSR_RUNTIME_PACKAGES = ["react", "react-dom", "react-server-dom-webpack"];
185
- var NATIVE_RUNTIME_PACKAGES = ["sharp"];
186
- var DEFAULT_BACKEND_RUNTIME_PACKAGES = ["croner"];
187
224
  var MOBILE_RUNTIME_PACKAGES = [
188
225
  "@capacitor/cli",
189
226
  "@capacitor/core",
@@ -212,8 +249,6 @@ var DATABASE_MODE_RUNTIME_PACKAGES = {
212
249
  };
213
250
  var AKAN_RUNTIME_PACKAGES = new Set([
214
251
  ...SSR_RUNTIME_PACKAGES,
215
- ...NATIVE_RUNTIME_PACKAGES,
216
- ...DEFAULT_BACKEND_RUNTIME_PACKAGES,
217
252
  ...MOBILE_RUNTIME_PACKAGES,
218
253
  ...Object.values(DATABASE_MODE_RUNTIME_PACKAGES).flat()
219
254
  ]);
@@ -298,7 +333,7 @@ class AkanAppConfig {
298
333
  subRoutes = new Map;
299
334
  basePaths = new Set;
300
335
  branches = new Set(["debug", "develop", "main"]);
301
- constructor(app, libs, rootPackageJson, config, baseDevEnv, plugins = []) {
336
+ constructor(app, libs, rootPackageJson, config, baseDevEnv, plugins = [], libExternalLibs = []) {
302
337
  this.app = app;
303
338
  this.rootPackageJson = rootPackageJson;
304
339
  this.libs = libs;
@@ -306,7 +341,7 @@ class AkanAppConfig {
306
341
  this.plugins = plugins;
307
342
  this.#applyRoutes(config?.routes);
308
343
  this.defaultDatabaseMode = config?.defaultDatabaseMode ?? "single";
309
- this.externalLibs = config?.externalLibs ?? [];
344
+ this.externalLibs = [...new Set([...config?.externalLibs ?? [], ...libExternalLibs])];
310
345
  this.barrelImports = [
311
346
  ...DEFAULT_BARREL_IMPORTS,
312
347
  ...WORKSPACE_BARREL_FACETS.map((facet) => `@apps/${app.name}/${facet}`),
@@ -495,7 +530,15 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
495
530
  ]);
496
531
  const resolved = typeof configImp === "function" ? configImp(app) : configImp;
497
532
  const { plugins, ...config } = resolved ?? {};
498
- return new AkanAppConfig(app, libs, rootPackageJson, config, baseDevEnv, plugins ?? []);
533
+ const libExternalLibs = await AkanAppConfig.#collectLibExternalLibs(app, libs, bustImportCache);
534
+ return new AkanAppConfig(app, libs, rootPackageJson, config, baseDevEnv, plugins ?? [], libExternalLibs);
535
+ }
536
+ static async#collectLibExternalLibs(app, libs, bustImportCache) {
537
+ const libConfigs = await Promise.all(libs.map(async (libName) => LibExecutor.from(app, libName).getConfig({ refresh: bustImportCache }).catch((error) => {
538
+ app.logger.warn(`Skipped libs/${libName}/akan.config.ts externalLibs: ${String(error)}`);
539
+ return null;
540
+ })));
541
+ return libConfigs.flatMap((libConfig) => libConfig?.externalLibs ?? []);
499
542
  }
500
543
  #resolveProductionDependencyVersion(lib) {
501
544
  const rootVersion = this.rootPackageJson.dependencies?.[lib] ?? this.rootPackageJson.devDependencies?.[lib];
@@ -505,13 +548,7 @@ CMD [${command.map((c) => `"${c}"`).join(",")}]`;
505
548
  return akanPackageJson.dependencies?.[lib] ?? akanPackageJson.peerDependencies?.[lib];
506
549
  }
507
550
  #getProductionRuntimePackages() {
508
- return [
509
- ...this.externalLibs,
510
- ...SSR_RUNTIME_PACKAGES,
511
- ...NATIVE_RUNTIME_PACKAGES,
512
- ...DEFAULT_BACKEND_RUNTIME_PACKAGES,
513
- ...this.getDatabaseModeRuntimePackages()
514
- ];
551
+ return [...this.externalLibs, ...SSR_RUNTIME_PACKAGES, ...this.getDatabaseModeRuntimePackages()];
515
552
  }
516
553
  getDatabaseModeRuntimePackages(databaseMode = this.defaultDatabaseMode) {
517
554
  return [...DATABASE_MODE_RUNTIME_PACKAGES[databaseMode]];
@@ -605,8 +642,8 @@ class AkanLibConfig {
605
642
  this.externalLibs = config?.externalLibs ?? [];
606
643
  this.plugins = plugins;
607
644
  }
608
- static async from(lib) {
609
- const [configImp] = await Promise.all([import(`${lib.cwdPath}/akan.config.ts`).then((mod) => mod.default)]);
645
+ static async from(lib, { bustImportCache = false } = {}) {
646
+ const configImp = await AkanAppConfig.importConfigModule(lib.cwdPath, { bustImportCache });
610
647
  const resolved = typeof configImp === "function" ? configImp(lib) : configImp;
611
648
  const { plugins, ...config } = resolved ?? {};
612
649
  return new AkanLibConfig(lib, config, plugins ?? []);
@@ -627,42 +664,47 @@ var decreaseBuildNum = async (app) => {
627
664
  const akanConfigContent = akanConfig.replace(`buildNum: ${appConfig.mobile.buildNum}`, `buildNum: ${appConfig.mobile.buildNum - 1}`);
628
665
  fs.writeFileSync(akanConfigPath, akanConfigContent);
629
666
  };
630
- // pkgs/@akanjs/devkit/getDirname.ts
631
- import path2 from "path";
632
- import { fileURLToPath as fileURLToPath2 } from "url";
633
- var getDirname = (url) => path2.dirname(fileURLToPath2(url));
634
-
635
667
  // pkgs/@akanjs/devkit/linter.ts
636
668
  import { spawn } from "child_process";
637
669
  import { existsSync, readFileSync } from "fs";
638
- import path3 from "path";
670
+ import path2 from "path";
639
671
  import chalk from "chalk";
672
+ var BIOME_CONFIG_FILES = ["biome.json", "biome.jsonc"];
640
673
 
641
674
  class Linter {
642
675
  lintRoot;
676
+ configPath;
643
677
  #biomeBin;
644
678
  constructor(cwdPath) {
645
679
  this.lintRoot = this.#findBiomeRootPath(cwdPath);
646
- const localBiomeBin = path3.join(this.lintRoot, "node_modules/.bin/biome");
680
+ this.configPath = Linter.#configPathIn(this.lintRoot) ?? path2.join(this.lintRoot, "biome.json");
681
+ const localBiomeBin = path2.join(this.lintRoot, "node_modules/.bin/biome");
647
682
  this.#biomeBin = existsSync(localBiomeBin) ? localBiomeBin : "biome";
648
683
  }
684
+ static #configPathIn(dir) {
685
+ for (const fileName of BIOME_CONFIG_FILES) {
686
+ const configPath = path2.join(dir, fileName);
687
+ if (existsSync(configPath))
688
+ return configPath;
689
+ }
690
+ return null;
691
+ }
649
692
  #findBiomeRootPath(dir) {
650
- const configPath = path3.join(dir, "biome.json");
651
- if (existsSync(configPath))
693
+ if (Linter.#configPathIn(dir))
652
694
  return dir;
653
- const parentDir = path3.dirname(dir);
695
+ const parentDir = path2.dirname(dir);
654
696
  if (parentDir === dir)
655
697
  throw new Error(`biome.json not found from ${dir}`);
656
698
  return this.#findBiomeRootPath(parentDir);
657
699
  }
658
700
  #toBiomePath(filePath) {
659
- const relativePath = path3.relative(this.lintRoot, filePath);
660
- if (!relativePath.startsWith("..") && !path3.isAbsolute(relativePath))
701
+ const relativePath = path2.relative(this.lintRoot, filePath);
702
+ if (!relativePath.startsWith("..") && !path2.isAbsolute(relativePath))
661
703
  return relativePath;
662
704
  return filePath;
663
705
  }
664
706
  #resolveFilePath(filePath) {
665
- return path3.isAbsolute(filePath) ? filePath : path3.join(this.lintRoot, filePath);
707
+ return path2.isAbsolute(filePath) ? filePath : path2.join(this.lintRoot, filePath);
666
708
  }
667
709
  async#runBiome(args, input) {
668
710
  return await new Promise((resolve, reject) => {
@@ -694,7 +736,7 @@ class Linter {
694
736
  const diagnosticPath = diagnostic.location?.path;
695
737
  if (!diagnosticPath)
696
738
  return fallbackFilePath;
697
- return path3.isAbsolute(diagnosticPath) ? diagnosticPath : path3.join(this.lintRoot, diagnosticPath);
739
+ return path2.isAbsolute(diagnosticPath) ? diagnosticPath : path2.join(this.lintRoot, diagnosticPath);
698
740
  }
699
741
  #createLintMessage(diagnostic) {
700
742
  const start = diagnostic.location?.start;
@@ -759,7 +801,7 @@ class Linter {
759
801
  "--max-diagnostics=none",
760
802
  "--no-errors-on-unmatched",
761
803
  "--config-path",
762
- path3.join(this.lintRoot, "biome.json"),
804
+ this.configPath,
763
805
  this.#toBiomePath(filePath)
764
806
  ]);
765
807
  const report = this.#parseBiomeReport(stdout || stderr);
@@ -880,14 +922,7 @@ ${errorText}, ${warningText} found`];
880
922
  if (!dryRun)
881
923
  return await this.#checkFile(resolvedFilePath, { write: true });
882
924
  const source = readFileSync(resolvedFilePath, "utf8");
883
- const { stdout } = await this.#runBiome([
884
- "check",
885
- "--write",
886
- "--config-path",
887
- path3.join(this.lintRoot, "biome.json"),
888
- "--stdin-file-path",
889
- this.#toBiomePath(resolvedFilePath)
890
- ], source);
925
+ const { stdout } = await this.#runBiome(["check", "--write", "--config-path", this.configPath, "--stdin-file-path", this.#toBiomePath(resolvedFilePath)], source);
891
926
  const lintResult = await this.lintFile(resolvedFilePath);
892
927
  return { ...lintResult, fixed: stdout !== source, output: stdout };
893
928
  }
@@ -895,7 +930,7 @@ ${errorText}, ${warningText} found`];
895
930
  const resolvedFilePath = this.#resolveFilePath(filePath);
896
931
  if (!existsSync(resolvedFilePath))
897
932
  throw new Error(`File not found: ${filePath}`);
898
- return JSON.parse(readFileSync(path3.join(this.lintRoot, "biome.json"), "utf8"));
933
+ return JSON.parse(readFileSync(this.configPath, "utf8"));
899
934
  }
900
935
  async getProblematicRules(filePath) {
901
936
  const { results } = await this.lintFile(filePath);
@@ -910,6 +945,31 @@ ${errorText}, ${warningText} found`];
910
945
  }
911
946
  }
912
947
 
948
+ // pkgs/@akanjs/devkit/repoIdentity.ts
949
+ import { execFileSync } from "child_process";
950
+ import path3 from "path";
951
+ var resolved = new Map;
952
+ var readRemoteName = (workspaceRoot) => {
953
+ try {
954
+ const url = execFileSync("git", ["config", "--get", "remote.origin.url"], {
955
+ cwd: workspaceRoot,
956
+ encoding: "utf-8",
957
+ stdio: ["ignore", "pipe", "ignore"]
958
+ }).trim();
959
+ return url.replace(/\.git$/, "").split(/[/:]/).pop() || null;
960
+ } catch {
961
+ return null;
962
+ }
963
+ };
964
+ var resolveRepoName = (workspaceRoot) => {
965
+ const cached = resolved.get(workspaceRoot);
966
+ if (cached)
967
+ return cached;
968
+ const repoName = readRemoteName(workspaceRoot) ?? path3.basename(workspaceRoot);
969
+ resolved.set(workspaceRoot, repoName);
970
+ return repoName;
971
+ };
972
+
913
973
  // pkgs/@akanjs/devkit/scanInfo.ts
914
974
  import { rm } from "fs/promises";
915
975
  import path4 from "path";
@@ -946,6 +1006,34 @@ var appRootAllowedDirs = new Set([
946
1006
  "ui",
947
1007
  "webkit"
948
1008
  ]);
1009
+ var libRootAllowedFiles = new Set([
1010
+ "AGENTS.md",
1011
+ "CLAUDE.md",
1012
+ "README.md",
1013
+ "akan.config.ts",
1014
+ "akan.lib.json",
1015
+ "client.ts",
1016
+ "index.ts",
1017
+ "package.json",
1018
+ "server.ts",
1019
+ "tsconfig.json",
1020
+ "tsconfig.spec.json",
1021
+ "tsconfig.tsbuildinfo"
1022
+ ]);
1023
+ var libRootAllowedDirs = new Set([
1024
+ "common",
1025
+ "env",
1026
+ "lib",
1027
+ "page",
1028
+ "plugin",
1029
+ "private",
1030
+ "public",
1031
+ "srvkit",
1032
+ "ui",
1033
+ "webkit"
1034
+ ]);
1035
+ var rootAllowedFiles = { app: appRootAllowedFiles, lib: libRootAllowedFiles };
1036
+ var rootAllowedDirs = { app: appRootAllowedDirs, lib: libRootAllowedDirs };
949
1037
  var libFacetRootAllowedFiles = new Set([
950
1038
  "cnst.ts",
951
1039
  "db.ts",
@@ -957,7 +1045,9 @@ var libFacetRootAllowedFiles = new Set([
957
1045
  "useClient.ts",
958
1046
  "useServer.ts"
959
1047
  ]);
960
- var isScannedAppRootEntry = (name) => !name.startsWith(".") || appRootAllowedDirs.has(name);
1048
+ var libFacetRootTestPattern = /^[A-Za-z][A-Za-z0-9_-]*\.signal\.(test|spec)\.(ts|tsx)$/;
1049
+ var isAllowedLibFacetRootFile = (filename) => libFacetRootAllowedFiles.has(filename) || libFacetRootTestPattern.test(filename);
1050
+ var isScannedRootEntry = (type, name) => !name.startsWith(".") || rootAllowedDirs[type].has(name);
961
1051
 
962
1052
  // pkgs/@akanjs/devkit/scanInfo.ts
963
1053
  var databaseFileTypes = [
@@ -986,10 +1076,8 @@ var moduleUiFileTypes = {
986
1076
  scalar: new Set(["Template", "Unit"])
987
1077
  };
988
1078
  var testFilePattern = /\.(test|spec)\.(ts|tsx)$/;
989
- var rootSignalTestFilePattern = /^[A-Za-z][A-Za-z0-9_-]*\.signal\.(test|spec)\.(ts|tsx)$/;
990
- var createDependencyScanner = async (exec) => (await import("./dependencyScanner-f6grrep3.js")).TypeScriptDependencyScanner.from(exec);
1079
+ var createDependencyScanner = async (exec) => (await import("./dependencyScanner-rbs2407b.js")).TypeScriptDependencyScanner.from(exec);
991
1080
  var isAllowedTestFile = (filename) => testFilePattern.test(filename);
992
- var isAllowedLibRootFile = (filename) => libFacetRootAllowedFiles.has(filename) || rootSignalTestFilePattern.test(filename);
993
1081
  var getScanPath = (exec, relativePath) => path4.posix.join(`${exec.type}s`, exec.name, relativePath.split(path4.sep).join("/"));
994
1082
  async function clearGeneratedRootCapacitorConfigs(exec) {
995
1083
  if (exec.type !== "app")
@@ -1006,17 +1094,20 @@ async function assertScanConvention(exec, libRoot) {
1006
1094
  const addViolation = (relativePath, reason) => {
1007
1095
  violations.push(`${getScanPath(exec, relativePath)}: ${reason}`);
1008
1096
  };
1009
- if (exec.type === "app") {
1010
- const { files, dirs } = await exec.getFilesAndDirs(".");
1011
- files.filter((filename) => !appRootAllowedFiles.has(filename)).forEach((filename) => {
1012
- addViolation(filename, "unsupported app root file");
1013
- });
1014
- dirs.filter((dirname) => !appRootAllowedDirs.has(dirname)).forEach((dirname) => {
1015
- addViolation(dirname, "unsupported app root folder");
1016
- });
1017
- }
1018
- libRoot.files.filter((filename) => !isAllowedLibRootFile(filename)).forEach((filename) => {
1019
- addViolation(path4.join("lib", filename), "unsupported lib root file");
1097
+ const allowedRootFiles = rootAllowedFiles[exec.type];
1098
+ const allowedRootDirs = rootAllowedDirs[exec.type];
1099
+ const { files, dirs } = await exec.getFilesAndDirs(".");
1100
+ files.filter((filename) => !allowedRootFiles.has(filename)).forEach((filename) => {
1101
+ addViolation(filename, `unsupported ${exec.type} root file`);
1102
+ });
1103
+ dirs.filter((dirname) => !allowedRootDirs.has(dirname)).forEach((dirname) => {
1104
+ addViolation(dirname, `unsupported ${exec.type} root folder`);
1105
+ });
1106
+ if (exec.type === "lib")
1107
+ for (const { relativePath, reason } of await exec.getPageConventionViolations())
1108
+ addViolation(relativePath, reason);
1109
+ libRoot.files.filter((filename) => !isAllowedLibFacetRootFile(filename)).forEach((filename) => {
1110
+ addViolation(path4.join("lib", filename), "unsupported lib facet root file");
1020
1111
  });
1021
1112
  libRoot.dirs.filter((dirname) => dirname.startsWith("__") && !internalLibDirs.has(dirname)).forEach((dirname) => {
1022
1113
  addViolation(path4.join("lib", dirname), "unsupported internal lib folder");
@@ -1634,7 +1725,7 @@ class Executor {
1634
1725
  }));
1635
1726
  });
1636
1727
  proc.on("exit", (code, signal) => {
1637
- if (!!code || signal)
1728
+ if (code || signal)
1638
1729
  reject(new CommandExecutionError({
1639
1730
  command,
1640
1731
  cwd,
@@ -1732,7 +1823,7 @@ class Executor {
1732
1823
  }));
1733
1824
  });
1734
1825
  proc.on("exit", (code, signal) => {
1735
- if (!!code || signal)
1826
+ if (code || signal)
1736
1827
  reject(new CommandExecutionError({
1737
1828
  command: modulePath,
1738
1829
  args,
@@ -2028,7 +2119,7 @@ class Executor {
2028
2119
  return this._applyTemplate({ ...options, dict });
2029
2120
  }
2030
2121
  async getTypeChecker() {
2031
- const { TypeChecker } = await import("./typeChecker-kravn7ns.js");
2122
+ const { TypeChecker } = await import("./typeChecker-g6bh0xfv.js");
2032
2123
  this.typeChecker ??= new TypeChecker(this);
2033
2124
  return this.typeChecker;
2034
2125
  }
@@ -2109,7 +2200,7 @@ class WorkspaceExecutor extends Executor {
2109
2200
  static #execs = new Map;
2110
2201
  static fromRoot({
2111
2202
  workspaceRoot = process.cwd(),
2112
- repoName = path5.basename(process.cwd())
2203
+ repoName = resolveRepoName(workspaceRoot)
2113
2204
  } = {}) {
2114
2205
  return WorkspaceExecutor.#execs.get(repoName) ?? new WorkspaceExecutor({ workspaceRoot, repoName });
2115
2206
  }
@@ -2297,6 +2388,18 @@ class SysExecutor extends Executor {
2297
2388
  const path6 = this.type === "app" ? `apps/${this.name}/lib` : `libs/${this.name}/lib`;
2298
2389
  return await this.workspace.getDirInModule(path6, this.name);
2299
2390
  }
2391
+ async getPageConventionViolations() {
2392
+ if (!await this.exists("page"))
2393
+ return [];
2394
+ const violations = [];
2395
+ for (const entry of await this.getAllFiles("**/*", { cwd: this.getPath("page") })) {
2396
+ const relativePath = entry.split(path5.sep).join("/");
2397
+ const reason = getPageSourceFileViolation(relativePath);
2398
+ if (reason)
2399
+ violations.push({ relativePath: `page/${relativePath}`, reason });
2400
+ }
2401
+ return violations;
2402
+ }
2300
2403
  #scanInfo = null;
2301
2404
  hasScanInfo() {
2302
2405
  return this.#scanInfo !== null;
@@ -2485,7 +2588,7 @@ class SysExecutor extends Executor {
2485
2588
  class AppExecutor extends SysExecutor {
2486
2589
  static #routeSourceValidator = null;
2487
2590
  static async#getRouteSourceValidator() {
2488
- AppExecutor.#routeSourceValidator ??= (await import("./routeSourceValidator-cncd92fv.js")).RouteSourceValidator;
2591
+ AppExecutor.#routeSourceValidator ??= (await import("./routeSourceValidator-7fycdqyv.js")).RouteSourceValidator;
2489
2592
  return AppExecutor.#routeSourceValidator;
2490
2593
  }
2491
2594
  dist;
@@ -2553,6 +2656,8 @@ class AppExecutor extends SysExecutor {
2553
2656
  ]);
2554
2657
  } else
2555
2658
  await this.removeDir(".akan");
2659
+ if (type === "start")
2660
+ process.env.NODE_ENV = "development";
2556
2661
  const devPort = type === "start" ? (await this.getDevPort()).toString() : undefined;
2557
2662
  const env = this.getCommandEnv({
2558
2663
  AKAN_COMMAND_TYPE: type,
@@ -2869,7 +2974,7 @@ class LibExecutor extends SysExecutor {
2869
2974
  async getConfig({ refresh } = {}) {
2870
2975
  if (this.#akanConfig && !refresh)
2871
2976
  return this.#akanConfig;
2872
- this.#akanConfig = await AkanLibConfig.from(this);
2977
+ this.#akanConfig = await AkanLibConfig.from(this, { bustImportCache: refresh });
2873
2978
  return this.#akanConfig;
2874
2979
  }
2875
2980
  }
@@ -2966,7 +3071,7 @@ class PkgExecutor extends Executor {
2966
3071
  default: "./index.ts"
2967
3072
  }
2968
3073
  },
2969
- engines: { bun: ">=1.3.13" },
3074
+ engines: { bun: ">=1.4.0" },
2970
3075
  ...dependencyMaps
2971
3076
  };
2972
3077
  await Promise.all([this.dist.writeJson("package.json", distPkgJson), this.writeJson("package.json", distPkgJson)]);
@@ -3009,4 +3114,4 @@ class ModuleExecutor extends Executor {
3009
3114
  }
3010
3115
  }
3011
3116
 
3012
- export { AGENT_BLOCK_START, AGENT_BLOCK_END, upsertAgentBlock, extractAgentBlock, renderRecipeEntries, collectScopeRecipeSources, renderScopeAgentBlock, getDirname, appRootAllowedFiles, appRootAllowedDirs, libFacetRootAllowedFiles, isScannedAppRootEntry, CommandExecutionError, Executor, WorkspaceExecutor, SysExecutor, AppExecutor, LibExecutor, PkgExecutor, ModuleExecutor };
3117
+ export { AGENT_BLOCK_START, AGENT_BLOCK_END, stampBlockVersion, extractBlockVersion, readDevkitVersion, upsertAgentBlock, extractAgentBlock, renderRecipeEntries, collectScopeRecipeSources, renderScopeAgentBlock, CLAUDE_COMMENT_RULE, rootAllowedFiles, rootAllowedDirs, isAllowedLibFacetRootFile, isScannedRootEntry, CommandExecutionError, Executor, WorkspaceExecutor, SysExecutor, AppExecutor, LibExecutor, PkgExecutor, ModuleExecutor };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  ModuleScript
4
- } from "./index-60a3jfcz.js";
4
+ } from "./index-xrdrttjb.js";
5
5
  import {
6
6
  addFieldUiPolicyForType,
7
7
  coerceFieldDefault,
@@ -34,15 +34,15 @@ import {
34
34
  sourceFile,
35
35
  validationCommandsForTarget,
36
36
  viaBuilderParameterName
37
- } from "./index-m4kpmmtj.js";
37
+ } from "./index-5em412h5.js";
38
38
  import {
39
39
  script
40
- } from "./index-jkynkyfk.js";
40
+ } from "./index-8rr621r2.js";
41
41
  import {
42
42
  AppExecutor,
43
43
  LibExecutor,
44
44
  ModuleExecutor
45
- } from "./index-47qxw1tz.js";
45
+ } from "./index-90zyjrby.js";
46
46
 
47
47
  // pkgs/@akanjs/cli/primitive/primitive.script.ts
48
48
  import { capitalize } from "akanjs/common";
@@ -4,24 +4,17 @@ import {
4
4
  CloudApi,
5
5
  GlobalConfig,
6
6
  getDefaultHostConfig
7
- } from "./index-0cj2zxbm.js";
7
+ } from "./index-sh01r3pm.js";
8
8
  import {
9
9
  openBrowser
10
- } from "./index-nx1vbtsc.js";
10
+ } from "./index-7etegaht.js";
11
11
  import {
12
12
  runner
13
- } from "./index-jkynkyfk.js";
13
+ } from "./index-8rr621r2.js";
14
14
  import {
15
15
  AppExecutor,
16
16
  WorkspaceExecutor
17
- } from "./index-47qxw1tz.js";
18
-
19
- // pkgs/@akanjs/cli/cloud/cloud.runner.ts
20
- import path from "path";
21
- import { confirm, input, select } from "@inquirer/prompts";
22
- import { Logger, sleep } from "akanjs/common";
23
- import chalk from "chalk";
24
- import * as QRcode from "qrcode";
17
+ } from "./index-90zyjrby.js";
25
18
 
26
19
  // pkgs/@akanjs/cli/npmRegistry.ts
27
20
  var defaultNpmRegistry = "https://registry.npmjs.org";
@@ -40,6 +33,11 @@ async function getLatestPackageVersion(packageName, tag = "latest", registryUrl)
40
33
  }
41
34
 
42
35
  // pkgs/@akanjs/cli/cloud/cloud.runner.ts
36
+ import path from "path";
37
+ import { confirm, input, select } from "@inquirer/prompts";
38
+ import { Logger, sleep } from "akanjs/common";
39
+ import chalk from "chalk";
40
+ import * as QRcode from "qrcode";
43
41
  var addRemoteEnvServerValue = "__addRemoteEnvServer";
44
42
  var removeRemoteEnvServerValue = "__removeRemoteEnvServer";
45
43
 
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  getDirname
4
- } from "./index-47qxw1tz.js";
4
+ } from "./index-1577bej2.js";
5
5
 
6
6
  // pkgs/@akanjs/devkit/prompter.ts
7
7
  import fsPromise from "fs/promises";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  AkanContextAnalyzer
4
- } from "./index-jn9vfpwz.js";
4
+ } from "./index-24h5bqpj.js";
5
5
  import {
6
6
  WorkflowExecutor,
7
7
  compactWorkflowInputs,
@@ -23,10 +23,10 @@ import {
23
23
  workflowCommandsForPlan,
24
24
  workflowPlanApproval,
25
25
  writeWorkflowRunArtifact
26
- } from "./index-m4kpmmtj.js";
26
+ } from "./index-5em412h5.js";
27
27
  import {
28
28
  runner
29
- } from "./index-jkynkyfk.js";
29
+ } from "./index-8rr621r2.js";
30
30
 
31
31
  // pkgs/@akanjs/cli/workflow/workflow.runner.ts
32
32
  import { mkdir, readFile, writeFile } from "fs/promises";
@@ -849,6 +849,7 @@ class ClientEntriesBundler {
849
849
  #externalSubpaths;
850
850
  #externalAliases;
851
851
  #command;
852
+ #target;
852
853
  #outputSubdir;
853
854
  #reactFastRefresh;
854
855
  #artifactDir;
@@ -870,6 +871,7 @@ class ClientEntriesBundler {
870
871
  this.#externalSubpaths = options.externalSubpaths ?? [];
871
872
  this.#externalAliases = options.externalAliases ?? {};
872
873
  this.#command = options.command ?? "start";
874
+ this.#target = options.target ?? "browser";
873
875
  this.#outputSubdir = options.outputSubdir ?? "client";
874
876
  this.#reactFastRefresh = options.reactFastRefresh ?? false;
875
877
  this.#artifactDir = `${this.#command === "build" ? this.#app.dist.cwdPath : this.#app.cwdPath}/.akan/artifact`;
@@ -883,7 +885,7 @@ class ClientEntriesBundler {
883
885
  entrypoints: this.#opaqueEntries.entries,
884
886
  outdir: this.#outdir,
885
887
  splitting: true,
886
- target: "browser",
888
+ target: this.#target,
887
889
  format: "esm",
888
890
  naming: CLIENT_BUNDLE_NAMING,
889
891
  metafile: true,
@@ -1117,7 +1119,8 @@ var VENDOR_SPECIFIERS = [
1117
1119
  "akanjs/store",
1118
1120
  "akanjs/base",
1119
1121
  "akanjs/common",
1120
- "akanjs/constant"
1122
+ "akanjs/constant",
1123
+ "akanjs/fetch"
1121
1124
  ];
1122
1125
 
1123
1126
  // pkgs/@akanjs/devkit/frontendBuild/routeClientBuilder.ts
@@ -1226,12 +1229,11 @@ class RouteClientBuilder {
1226
1229
  }).bundle();
1227
1230
  }
1228
1231
  async#buildSsrBundle(bootstrapEntries) {
1229
- const externalOptions = RouteClientBuilder.resolveSsrClientExternalOptions(this.#command);
1230
1232
  return new ClientEntriesBundler({
1231
1233
  app: this.#app,
1232
1234
  entries: bootstrapEntries.buildEntries,
1233
1235
  plugins: [await createBarrelImportsPlugin(this.#app)],
1234
- ...externalOptions,
1236
+ ...RouteClientBuilder.resolveSsrClientBundleOptions(this.#command),
1235
1237
  outputSubdir: "client-ssr",
1236
1238
  command: this.#command
1237
1239
  }).bundle();
@@ -1293,15 +1295,16 @@ ${defaultNames.map((name) => `export default ${name};`).join(`
1293
1295
  const serverEntry = RouteClientBuilder.resolveAkanServerEntry();
1294
1296
  return { [Bun.resolveSync("akanjs/fetch", serverEntry)]: "akanjs/fetch" };
1295
1297
  }
1296
- static resolveSsrClientExternalOptions(command) {
1298
+ static resolveSsrClientBundleOptions(command) {
1297
1299
  if (command === "start") {
1298
1300
  return {
1301
+ target: "bun",
1299
1302
  external: SSR_CLIENT_EXTERNALS,
1300
1303
  externalSubpaths: ["akanjs/fetch"],
1301
1304
  externalAliases: RouteClientBuilder.resolveSsrClientRuntimeAliases()
1302
1305
  };
1303
1306
  }
1304
- return { external: SSR_CLIENT_ALIAS_EXTERNALS };
1307
+ return { target: "bun", external: SSR_CLIENT_ALIAS_EXTERNALS };
1305
1308
  }
1306
1309
  static resolveAkanServerEntry() {
1307
1310
  try {
@@ -240,7 +240,7 @@ import { ChatOpenAI } from "@langchain/openai";
240
240
  import { Logger } from "akanjs/common";
241
241
  import chalk from "chalk";
242
242
  var MAX_ASK_TRY = 300;
243
- var deepSeekLlmModels = ["deepseek-chat", "deepseek-reasoner"];
243
+ var deepSeekLlmModels = ["deepseek-v4-flash", "deepseek-v4-pro"];
244
244
  var openAiLlmModels = ["gpt-5.5"];
245
245
  var supportedLlmModels = [...deepSeekLlmModels, ...openAiLlmModels];
246
246
  var isOpenAiLlmModel = (model) => openAiLlmModels.includes(model);