@akanjs/cli 3.2.0-rc.17 → 3.2.0-rc.19

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 (94) hide show
  1. package/.build-stamp +2 -2
  2. package/{CodeAgent-18qg03re.js → CodeAgent-q0xkt4at.js} +2 -2
  3. package/{CodeTui-zkm51zf3.js → CodeTui-n56kpaca.js} +819 -663
  4. package/TunnelShare-844s9te4.js +18 -0
  5. package/{agent.command-5k2zegmj.js → agent.command-k07raqft.js} +20 -20
  6. package/akanCode.js +8 -8
  7. package/{appExecutor-1bgs9a69.js → appExecutor-xav1zemr.js} +3 -3
  8. package/{application.command-ge27047n.js → application.command-dv8y8r12.js} +52 -25
  9. package/{applicationBuildRunner-7skfg8zn.js → applicationBuildRunner-vhx7zq97.js} +9 -10
  10. package/buildBatch.proc.js +20 -11
  11. package/{cloud.command-d18qj1v2.js → cloud.command-0vjy3x96.js} +22 -22
  12. package/cloud.script-jp48r0kw.js +35 -0
  13. package/{code.command-tz4x5zm6.js → code.command-xc5exq4b.js} +10 -10
  14. package/{context.command-x1smtm5q.js → context.command-etsat8yk.js} +22 -22
  15. package/context.runner-e52ak0cx.js +34 -0
  16. package/{guideline.command-rdcwxf8g.js → guideline.command-zqkntk7b.js} +6 -6
  17. package/guidelines/agentRule/agentRule.instruction.md +5 -4
  18. package/guidelines/conventions/core.md +18 -0
  19. package/guidelines/errorCodes/errorCodes.instruction.md +6 -0
  20. package/guidelines/mcpRule/mcpRule.instruction.md +4 -2
  21. package/guidelines/transportRule/transportRule.instruction.md +3 -1
  22. package/incrementalBuilder.proc.js +559 -409
  23. package/{index-gh4brxzn.js → index-12js5pj4.js} +1 -1
  24. package/{index-jfkh776h.js → index-12vv4g80.js} +1 -1
  25. package/index-4zqebbqb.js +80 -0
  26. package/{index-er2ja34m.js → index-6bryy19d.js} +500 -422
  27. package/{index-3641r8q0.js → index-6pzncry1.js} +4 -4
  28. package/{index-fcrr79gh.js → index-6rrh0ffr.js} +44 -32
  29. package/{index-nd39rssn.js → index-7jr9mfp2.js} +286 -144
  30. package/{index-sp331bww.js → index-81qt1jyj.js} +1 -1
  31. package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
  32. package/{index-e82xwj3x.js → index-a05ewnnp.js} +1 -1
  33. package/{index-bjnebzzc.js → index-bxevbjw7.js} +8 -8
  34. package/{index-vm6pr11y.js → index-c1vym3gx.js} +2 -2
  35. package/{index-t8tysbxv.js → index-c9hd79py.js} +4 -4
  36. package/{index-j2eqe3jk.js → index-c9mnfy9r.js} +38 -23
  37. package/{index-dtpeyts6.js → index-cc9pevta.js} +1 -1
  38. package/{index-trp7jdr1.js → index-cet2s7xk.js} +7 -6
  39. package/{index-yr5jv8yd.js → index-dasa0kbj.js} +3 -3
  40. package/{index-bxqbt5p3.js → index-ddc2zjj5.js} +1 -1
  41. package/{index-g7e58wz2.js → index-dz7z9n9t.js} +25 -25
  42. package/{index-z7t6neq1.js → index-e4vna9dn.js} +4 -4
  43. package/{index-669sg3yp.js → index-ean2tff1.js} +723 -691
  44. package/{index-ttfz2sc7.js → index-fgp04fh7.js} +6 -6
  45. package/{index-bzdq8wfw.js → index-g541mhzw.js} +3 -3
  46. package/{index-t329y8am.js → index-gh741qft.js} +8 -8
  47. package/{index-d2r762fk.js → index-k51718xz.js} +2136 -2175
  48. package/{index-39byv35b.js → index-m6r3pvf5.js} +2 -2
  49. package/{index-emf3wzvh.js → index-my17308p.js} +7 -7
  50. package/{index-xywq95wk.js → index-nd8bq17n.js} +6 -6
  51. package/{index-q4e18ne4.js → index-nxcmgqk3.js} +3 -3
  52. package/{index-b2sptt87.js → index-pkgha3rt.js} +5 -5
  53. package/{index-s75h0455.js → index-q2t2w996.js} +1 -1
  54. package/{index-6p02be7n.js → index-qtqhsb33.js} +204 -160
  55. package/{index-h7yd92c8.js → index-rj2n5kfk.js} +67 -67
  56. package/{index-1ts8vfsk.js → index-s5gvwvkb.js} +103 -138
  57. package/{index-neassptx.js → index-sh3yzse2.js} +8 -7
  58. package/{index-f482h2hj.js → index-syn4vm3y.js} +1 -1
  59. package/{index-n8mxyy3f.js → index-t00xrkey.js} +1 -1
  60. package/{index-g56xae1n.js → index-v72mh89f.js} +7 -8
  61. package/{index-q57rsax4.js → index-wq8pnev4.js} +3 -3
  62. package/{index-dp7sht3v.js → index-wxr3941g.js} +8 -8
  63. package/{index-0c8zj1da.js → index-y8mqkhcf.js} +1 -1
  64. package/{index-9mx3b3zh.js → index-zk1gjk46.js} +4 -4
  65. package/index.js +27 -27
  66. package/{libExecutor-hxe5eqfh.js → libExecutor-mr3vxtnr.js} +2 -2
  67. package/{library.command-83shs8fw.js → library.command-ps9q5t37.js} +7 -7
  68. package/{localRegistry.command-sz713jg3.js → localRegistry.command-rszxmvd0.js} +21 -21
  69. package/{module.command-jhhm0nmw.js → module.command-fcybnn1a.js} +10 -10
  70. package/{package.command-42syy96v.js → package.command-zen3rhye.js} +10 -10
  71. package/package.json +2 -2
  72. package/{page.command-jkv29zzs.js → page.command-gwrxymms.js} +7 -7
  73. package/{pipeline.command-6sg9g4hq.js → pipeline.command-m1brkqqw.js} +6 -6
  74. package/{pkgExecutor-6p82w5y1.js → pkgExecutor-x51agavp.js} +2 -2
  75. package/{primitive.command-tt6aq7m9.js → primitive.command-5vkxvvmk.js} +11 -11
  76. package/{projectTypecheck-wfrz0cxr.js → projectTypecheck-9dzfah37.js} +1 -1
  77. package/{quality.command-tqar7ss5.js → quality.command-gqry7eas.js} +9 -9
  78. package/{repair.command-qkcn329t.js → repair.command-qs4ejcrg.js} +10 -10
  79. package/{routeSourceValidator-8aph1dsr.js → routeSourceValidator-8n6j1vn7.js} +3 -1
  80. package/{scalar.command-6nvq11ag.js → scalar.command-ny0vchqq.js} +9 -9
  81. package/skills/akan-scaffold/SKILL.md +1 -1
  82. package/{subspace.command-dvwds4cv.js → subspace.command-5pxqjgmw.js} +12 -12
  83. package/templates/biomeForm.ts +1 -1
  84. package/templates/env/_env.server.type.ts +1 -1
  85. package/templates/facetIndex/index.ts +2 -37
  86. package/templates/workspaceRoot/AGENTS.md.template +2 -1
  87. package/{tunnel.command-h8r69a7v.js → tunnel.command-ndajt0xk.js} +11 -11
  88. package/{verify.command-ynec8kt2.js → verify.command-m59ashc7.js} +17 -17
  89. package/{workflow.command-f70fx73a.js → workflow.command-jchqey88.js} +15 -15
  90. package/{workspace.command-vagjy1q9.js → workspace.command-g0gzxkpd.js} +36 -36
  91. package/TunnelShare-6t4rwyc0.js +0 -19
  92. package/cloud.script-0hbhm3mw.js +0 -35
  93. package/context.runner-vb7jc0k8.js +0 -34
  94. package/index-dqsc1b5t.js +0 -18
@@ -3,7 +3,7 @@ import {
3
3
  AsyncDefaultExportDetector,
4
4
  StoreBootstrap,
5
5
  resolveSsrPageEntriesForApp
6
- } from "./index-trp7jdr1.js";
6
+ } from "./index-cet2s7xk.js";
7
7
  import {
8
8
  FileSys2
9
9
  } from "./index-by2tvsq6.js";
@@ -579,6 +579,50 @@ var serializeNamedItem = (item) => {
579
579
  return `${prefix}${item.imported} as ${item.local}`;
580
580
  };
581
581
 
582
+ // pkgs/@akanjs/devkit/transforms/rscUseClientTransform.ts
583
+ import path3 from "path";
584
+ import ts2 from "typescript";
585
+ var USE_CLIENT_RE = /^\s*(?:\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\/\s*|\/\/[^\n]*\n\s*)*["']use client["']/;
586
+ var IMPLICIT_ROOT_LAYOUT_RE = /[/\\]\.akan[/\\]generated[/\\](?:implicit-root-layout|root-layouts[/\\][^/\\]*__root_layout)\.(tsx|ts|jsx|js)$/;
587
+ var STAR_REEXPORT_HINT_RE = /\bexport\s*\*\s*from\b/;
588
+ var hasUseClientDirective = (source) => USE_CLIENT_RE.test(source);
589
+ function toClientReferencePath(absPath, workspaceRoot) {
590
+ return path3.relative(path3.resolve(workspaceRoot), path3.resolve(absPath)).split(path3.sep).join("/");
591
+ }
592
+ var starReexportSpecifiers = (source, filePath) => ts2.createSourceFile(filePath, source, ts2.ScriptTarget.Latest).statements.filter((statement) => ts2.isExportDeclaration(statement) && !statement.exportClause && !statement.isTypeOnly && !!statement.moduleSpecifier && ts2.isStringLiteral(statement.moduleSpecifier)).map((statement) => statement.moduleSpecifier.text);
593
+ var scanUseClientExports = (source, filePath, workspaceRoot) => {
594
+ const stars = USE_CLIENT_RE.test(source) && STAR_REEXPORT_HINT_RE.test(source) ? starReexportSpecifiers(source, filePath) : [];
595
+ if (stars.length) {
596
+ const file = workspaceRoot ? toClientReferencePath(filePath, workspaceRoot) : filePath;
597
+ const listed = stars.slice(0, 3).map((specifier) => `\`export * from ${JSON.stringify(specifier)}\``);
598
+ const written = stars.length > 3 ? `${listed.join(", ")} (and ${stars.length - 3} more)` : listed.join(", ");
599
+ throw new Error(`${file} is a "use client" module, so it cannot ${written}: the server sees only the names a client module ` + `declares, and a star re-export declares none. Re-export them by name \u2014 \`export { \u2026 } from ${JSON.stringify(stars[0])}\`.`);
600
+ }
601
+ return new Bun.Transpiler({ loader: loaderFor(filePath) }).scan(source).exports;
602
+ };
603
+ function transformUseClient(source, args) {
604
+ if (!USE_CLIENT_RE.test(source))
605
+ return null;
606
+ if (IMPLICIT_ROOT_LAYOUT_RE.test(args.path))
607
+ return null;
608
+ const exports = scanUseClientExports(source, args.path, args.workspaceRoot);
609
+ if (exports.length === 0)
610
+ return null;
611
+ args.onClientModule?.(args.path, exports);
612
+ const referencePath = args.workspaceRoot ? toClientReferencePath(args.path, args.workspaceRoot) : args.path;
613
+ const filePathLit = JSON.stringify(referencePath);
614
+ const lines = [`import { registerClientReference } from "react-server-dom-webpack/server.node";`];
615
+ for (const name of exports) {
616
+ const nameLit = JSON.stringify(name);
617
+ const errMsg = JSON.stringify(`Attempted to call '${name}' from '${referencePath}' on the server, but it is a client-only export.`);
618
+ const proxy = `() => { throw new Error(${errMsg}); }`;
619
+ const binding = name === "default" ? `export default registerClientReference(${proxy}, ${filePathLit}, ${nameLit});` : `export const ${name} = registerClientReference(${proxy}, ${filePathLit}, ${nameLit});`;
620
+ lines.push(binding);
621
+ }
622
+ return lines.join(`
623
+ `);
624
+ }
625
+
582
626
  // pkgs/@akanjs/devkit/frontendBuild/bundleDefine.ts
583
627
  var bundleConditions = (command) => command === "build" ? ["production"] : [];
584
628
  var bundleDefine = (app, command, renderEnv) => {
@@ -593,7 +637,7 @@ var bundleDefine = (app, command, renderEnv) => {
593
637
 
594
638
  // pkgs/@akanjs/devkit/frontendBuild/csrDevPaths.ts
595
639
  import fs2 from "fs";
596
- import path3 from "path";
640
+ import path4 from "path";
597
641
 
598
642
  class CsrDevPaths {
599
643
  static modulePrefix = "akan-module:";
@@ -606,18 +650,18 @@ class CsrDevPaths {
606
650
  }
607
651
  idOf(file) {
608
652
  const real = CsrDevPaths.realpath(file);
609
- const relative = path3.relative(this.root, real);
610
- const id = relative.startsWith("..") || path3.isAbsolute(relative) ? real : relative;
611
- return id.split(path3.sep).join("/");
653
+ const relative = path4.relative(this.root, real);
654
+ const id = relative.startsWith("..") || path4.isAbsolute(relative) ? real : relative;
655
+ return id.split(path4.sep).join("/");
612
656
  }
613
657
  fileOf(id) {
614
- return path3.isAbsolute(id) ? id : path3.join(this.root, id);
658
+ return path4.isAbsolute(id) ? id : path4.join(this.root, id);
615
659
  }
616
660
  static isStub(target) {
617
661
  return target.startsWith(CsrDevPaths.stubPrefix);
618
662
  }
619
663
  static isVendorFile(file) {
620
- return file.includes(`${path3.sep}node_modules${path3.sep}`);
664
+ return file.includes(`${path4.sep}node_modules${path4.sep}`);
621
665
  }
622
666
  static isScript(file) {
623
667
  return /\.[cm]?[jt]sx?$/.test(file);
@@ -630,7 +674,7 @@ class CsrDevPaths {
630
674
  return await source.exists() ? Bun.hash(await source.arrayBuffer()).toString(36) : "";
631
675
  }
632
676
  static realpath(file) {
633
- return fs2.existsSync(file) ? fs2.realpathSync.native(file) : path3.resolve(file);
677
+ return fs2.existsSync(file) ? fs2.realpathSync.native(file) : path4.resolve(file);
634
678
  }
635
679
  static isNamed(file) {
636
680
  try {
@@ -647,7 +691,7 @@ class CsrDevPaths {
647
691
  return CsrDevPaths.#asFile(base, kind) ?? CsrDevPaths.#asFolder(base, kind);
648
692
  }
649
693
  static resolveRelative(dir, specifier, kind = "import") {
650
- const base = path3.resolve(dir, specifier);
694
+ const base = path4.resolve(dir, specifier);
651
695
  const folder = /(^|[\\/])\.\.?$|[\\/]$/.test(specifier);
652
696
  return folder ? CsrDevPaths.#asFolder(base, kind) : CsrDevPaths.resolveOnDisk(base, kind);
653
697
  }
@@ -657,15 +701,15 @@ class CsrDevPaths {
657
701
  }
658
702
  static #asFolder(dir, kind) {
659
703
  const entry = CsrDevPaths.#packageEntryOf(dir, kind);
660
- const named = entry ? CsrDevPaths.#asFile(path3.join(dir, entry), kind) ?? CsrDevPaths.#indexOf(path3.join(dir, entry), kind) : null;
704
+ const named = entry ? CsrDevPaths.#asFile(path4.join(dir, entry), kind) ?? CsrDevPaths.#indexOf(path4.join(dir, entry), kind) : null;
661
705
  return named ?? CsrDevPaths.#indexOf(dir, kind);
662
706
  }
663
707
  static #indexOf(dir, kind) {
664
- return CsrDevPaths.#asFile(path3.join(dir, "index"), kind);
708
+ return CsrDevPaths.#asFile(path4.join(dir, "index"), kind);
665
709
  }
666
710
  static #packageEntryOf(dir, kind) {
667
711
  try {
668
- const pkg = JSON.parse(fs2.readFileSync(path3.join(dir, "package.json"), "utf8"));
712
+ const pkg = JSON.parse(fs2.readFileSync(path4.join(dir, "package.json"), "utf8"));
669
713
  const fields = kind === "require" ? [pkg.browser, pkg.main] : [pkg.browser, pkg.module, pkg.main];
670
714
  const entry = fields.find((field) => typeof field === "string");
671
715
  return typeof entry === "string" ? entry : null;
@@ -678,11 +722,11 @@ class CsrDevPaths {
678
722
  const name = first.startsWith("@") ? `${first}/${second}` : first;
679
723
  if (!name || name.startsWith("."))
680
724
  return false;
681
- for (let dir = path3.resolve(from);; dir = path3.dirname(dir)) {
682
- const pkgDir = path3.join(dir, "node_modules", name);
683
- if (fs2.existsSync(path3.join(pkgDir, "package.json")))
725
+ for (let dir = path4.resolve(from);; dir = path4.dirname(dir)) {
726
+ const pkgDir = path4.join(dir, "node_modules", name);
727
+ if (fs2.existsSync(path4.join(pkgDir, "package.json")))
684
728
  return (fs2.statSync(pkgDir, { throwIfNoEntry: false })?.ctimeMs ?? 0) > since;
685
- if (path3.dirname(dir) === dir)
729
+ if (path4.dirname(dir) === dir)
686
730
  return false;
687
731
  }
688
732
  }
@@ -704,7 +748,7 @@ class CsrDevPaths {
704
748
  }
705
749
 
706
750
  // pkgs/@akanjs/devkit/frontendBuild/csrEntryFiles.ts
707
- import path4 from "path";
751
+ import path5 from "path";
708
752
 
709
753
  class CsrEntryFiles {
710
754
  static entryFilename(basePath) {
@@ -717,7 +761,7 @@ class CsrEntryFiles {
717
761
  });
718
762
  }
719
763
  static basePathOfPageKey(pageKey, basePaths) {
720
- const normalized = pageKey.split(path4.sep).join("/").replace(/^\.\//, "");
764
+ const normalized = pageKey.split(path5.sep).join("/").replace(/^\.\//, "");
721
765
  const segments = normalized.split("/");
722
766
  const firstPublicSegment = segments.find((segment) => segment !== "[lang]" && !/^\(.+\)$/.test(segment));
723
767
  return firstPublicSegment && basePaths.includes(firstPublicSegment) ? firstPublicSegment : null;
@@ -730,7 +774,7 @@ import path9 from "path";
730
774
  import ts3 from "typescript";
731
775
 
732
776
  // pkgs/@akanjs/devkit/transforms/externalizeFrameworkPlugin.ts
733
- import path5 from "path";
777
+ import path6 from "path";
734
778
  var DEFAULT_INCLUDE = ["akanjs/", "@apps/", "@libs/"];
735
779
  var DEFAULT_EXCLUDE_EXACT = new Set(["akanjs/webkit", "@akanjs/cli", "@akanjs/devkit"]);
736
780
  var DEFAULT_EXCLUDE_PREFIX = ["@akanjs/cli/", "@akanjs/devkit/"];
@@ -766,7 +810,7 @@ async function createExternalizeFrameworkPlugin(options) {
766
810
  const replPath = repl?.endsWith("/*") ? repl.slice(0, -1) : repl ?? "";
767
811
  if (!replPath)
768
812
  continue;
769
- const candidate = path5.resolve(workspaceRoot, replPath + suffix);
813
+ const candidate = path6.resolve(workspaceRoot, replPath + suffix);
770
814
  const hit = await firstExisting(candidate);
771
815
  if (hit)
772
816
  return hit;
@@ -776,8 +820,8 @@ async function createExternalizeFrameworkPlugin(options) {
776
820
  if (!spec.startsWith(`${pkg}/`))
777
821
  continue;
778
822
  const suffix = spec.slice(pkg.length + 1);
779
- const pkgDir = path5.dirname(path5.resolve(workspaceRoot, entryFile));
780
- const candidate = path5.join(pkgDir, suffix);
823
+ const pkgDir = path6.dirname(path6.resolve(workspaceRoot, entryFile));
824
+ const candidate = path6.join(pkgDir, suffix);
781
825
  const hit = await firstExisting(candidate);
782
826
  if (hit)
783
827
  return hit;
@@ -822,57 +866,13 @@ async function firstExisting(basePath) {
822
866
  return candidate;
823
867
  }
824
868
  for (const ext of CANDIDATE_EXTS3) {
825
- const candidate = path5.join(basePath, `index${ext}`);
869
+ const candidate = path6.join(basePath, `index${ext}`);
826
870
  if (await Bun.file(candidate).exists())
827
871
  return candidate;
828
872
  }
829
873
  return null;
830
874
  }
831
875
 
832
- // pkgs/@akanjs/devkit/transforms/rscUseClientTransform.ts
833
- import path6 from "path";
834
- import ts2 from "typescript";
835
- var USE_CLIENT_RE = /^\s*(?:\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\/\s*|\/\/[^\n]*\n\s*)*["']use client["']/;
836
- var IMPLICIT_ROOT_LAYOUT_RE = /[/\\]\.akan[/\\]generated[/\\](?:implicit-root-layout|root-layouts[/\\][^/\\]*__root_layout)\.(tsx|ts|jsx|js)$/;
837
- var STAR_REEXPORT_HINT_RE = /\bexport\s*\*\s*from\b/;
838
- var hasUseClientDirective = (source) => USE_CLIENT_RE.test(source);
839
- function toClientReferencePath(absPath, workspaceRoot) {
840
- return path6.relative(path6.resolve(workspaceRoot), path6.resolve(absPath)).split(path6.sep).join("/");
841
- }
842
- var starReexportSpecifiers = (source, filePath) => ts2.createSourceFile(filePath, source, ts2.ScriptTarget.Latest).statements.filter((statement) => ts2.isExportDeclaration(statement) && !statement.exportClause && !statement.isTypeOnly && !!statement.moduleSpecifier && ts2.isStringLiteral(statement.moduleSpecifier)).map((statement) => statement.moduleSpecifier.text);
843
- var scanUseClientExports = (source, filePath, workspaceRoot) => {
844
- const stars = USE_CLIENT_RE.test(source) && STAR_REEXPORT_HINT_RE.test(source) ? starReexportSpecifiers(source, filePath) : [];
845
- if (stars.length) {
846
- const file = workspaceRoot ? toClientReferencePath(filePath, workspaceRoot) : filePath;
847
- const listed = stars.slice(0, 3).map((specifier) => `\`export * from ${JSON.stringify(specifier)}\``);
848
- const written = stars.length > 3 ? `${listed.join(", ")} (and ${stars.length - 3} more)` : listed.join(", ");
849
- throw new Error(`${file} is a "use client" module, so it cannot ${written}: the server sees only the names a client module ` + `declares, and a star re-export declares none. Re-export them by name \u2014 \`export { \u2026 } from ${JSON.stringify(stars[0])}\`.`);
850
- }
851
- return new Bun.Transpiler({ loader: loaderFor(filePath) }).scan(source).exports;
852
- };
853
- function transformUseClient(source, args) {
854
- if (!USE_CLIENT_RE.test(source))
855
- return null;
856
- if (IMPLICIT_ROOT_LAYOUT_RE.test(args.path))
857
- return null;
858
- const exports = scanUseClientExports(source, args.path, args.workspaceRoot);
859
- if (exports.length === 0)
860
- return null;
861
- args.onClientModule?.(args.path, exports);
862
- const referencePath = args.workspaceRoot ? toClientReferencePath(args.path, args.workspaceRoot) : args.path;
863
- const filePathLit = JSON.stringify(referencePath);
864
- const lines = [`import { registerClientReference } from "react-server-dom-webpack/server.node";`];
865
- for (const name of exports) {
866
- const nameLit = JSON.stringify(name);
867
- const errMsg = JSON.stringify(`Attempted to call '${name}' from '${referencePath}' on the server, but it is a client-only export.`);
868
- const proxy = `() => { throw new Error(${errMsg}); }`;
869
- const binding = name === "default" ? `export default registerClientReference(${proxy}, ${filePathLit}, ${nameLit});` : `export const ${name} = registerClientReference(${proxy}, ${filePathLit}, ${nameLit});`;
870
- lines.push(binding);
871
- }
872
- return lines.join(`
873
- `);
874
- }
875
-
876
876
  // pkgs/@akanjs/devkit/transforms/useClientBundlePlugin.ts
877
877
  function createUseClientBundlePlugin(options = {}) {
878
878
  return {
@@ -1,11 +1,12 @@
1
1
  // @bun
2
+ import {
3
+ ErrorReport
4
+ } from "./index-4zqebbqb.js";
2
5
  import {
3
6
  JsonFormatter
4
- } from "./index-g56xae1n.js";
7
+ } from "./index-v72mh89f.js";
5
8
 
6
9
  // pkgs/@akanjs/devkit/app/applicationBuildReporter.ts
7
- import { realpathSync } from "fs";
8
- import path4 from "path";
9
10
  import { Logger } from "akanjs/common";
10
11
 
11
12
  // pkgs/@akanjs/devkit/app/routeJsBudget.ts
@@ -893,45 +894,7 @@ class ApplicationBuildReporter {
893
894
  }
894
895
  static localBuildNotice = "Built for local: the server runs without endpoint rate limits, and boots on local defaults (Redis on localhost, the first database mode) where a deployment would stop to ask. For a host others can reach, run `akan build <app> --env main` with AKAN_PUBLIC_REPO_NAME and AKAN_PUBLIC_SERVE_DOMAIN set in the shell or the workspace .env.";
895
896
  static formatError(error, workspaceRoot = process.cwd()) {
896
- if (error instanceof AggregateError) {
897
- const nestedMessages = error.errors.map((nestedError, index) => ApplicationBuildReporter.formatError(nestedError, workspaceRoot).trim() || `Unknown error ${index + 1}`).map((message) => message.replace(/^/gm, " ")).join(`
898
- `);
899
- return nestedMessages ? `${error.message}
900
- ${nestedMessages}` : error.message;
901
- }
902
- if (error instanceof Error) {
903
- const causeMessage = error.cause ? `
904
- Caused by: ${ApplicationBuildReporter.formatError(error.cause, workspaceRoot)}` : "";
905
- return `${ApplicationBuildReporter.#withLocation(error.message, error, workspaceRoot)}${causeMessage}`;
906
- }
907
- if (typeof error === "object" && error !== null && "message" in error)
908
- return ApplicationBuildReporter.#withLocation(String(error.message), error, workspaceRoot);
909
- return String(error);
910
- }
911
- static #withLocation(message, error, workspaceRoot) {
912
- const { position } = error;
913
- if (!position?.file)
914
- return message;
915
- const file = ApplicationBuildReporter.#relativeToWorkspace(position.file, workspaceRoot);
916
- const location = position.line > 0 ? `${file}:${position.line}:${position.column}` : file;
917
- return message.includes(location) ? message : message.replace(/^.*/, (headline) => `${headline} (${location})`);
918
- }
919
- static #relativeToWorkspace(file, workspaceRoot) {
920
- if (!path4.isAbsolute(file))
921
- return file;
922
- for (const root of [workspaceRoot, ApplicationBuildReporter.#realpathOf(workspaceRoot)]) {
923
- const relative = path4.relative(root, file);
924
- if (!relative.startsWith(`..${path4.sep}`) && !path4.isAbsolute(relative))
925
- return relative.replaceAll(path4.sep, "/");
926
- }
927
- return file;
928
- }
929
- static #realpathOf(dir) {
930
- try {
931
- return realpathSync(dir);
932
- } catch {
933
- return dir;
934
- }
897
+ return ErrorReport.format(error, workspaceRoot);
935
898
  }
936
899
  static formatDuration(ms) {
937
900
  if (ms < 1000)
@@ -948,7 +911,7 @@ Caused by: ${ApplicationBuildReporter.formatError(error.cause, workspaceRoot)}`
948
911
  }
949
912
 
950
913
  // pkgs/@akanjs/devkit/akanApp/devHostPolicy.ts
951
- import path5 from "path";
914
+ import path4 from "path";
952
915
  var UNAVAILABLE_REDIS_HOST = "redis-tunnel-unavailable.invalid";
953
916
  var redisTunnelPolicy = ({
954
917
  environment,
@@ -989,18 +952,18 @@ var devHostStateOf = (state, gaveUp) => state === "stopped" && gaveUp ? "failed"
989
952
  var RESTART_ROLE_ORDER = ["server", "shared", "barrel", "config"];
990
953
  var generationValue = (generation) => generation ?? -1;
991
954
  var isLegacyBackendFallbackFile = (file, workspaceRoot) => {
992
- const abs = path5.resolve(file);
993
- const ext = path5.extname(abs).toLowerCase();
955
+ const abs = path4.resolve(file);
956
+ const ext = path4.extname(abs).toLowerCase();
994
957
  if (!SOURCE_EXTS.has(ext))
995
958
  return false;
996
- const rel = path5.relative(path5.resolve(workspaceRoot), abs);
997
- if (!rel || rel.startsWith("..") || path5.isAbsolute(rel))
959
+ const rel = path4.relative(path4.resolve(workspaceRoot), abs);
960
+ if (!rel || rel.startsWith("..") || path4.isAbsolute(rel))
998
961
  return false;
999
- const parts = rel.split(path5.sep).filter(Boolean);
962
+ const parts = rel.split(path4.sep).filter(Boolean);
1000
963
  const [scope] = parts;
1001
964
  if (scope !== "apps" && scope !== "libs" && scope !== "pkgs")
1002
965
  return false;
1003
- const base = path5.basename(abs);
966
+ const base = path4.basename(abs);
1004
967
  return parts.includes("srvkit") || parts.includes("common") || SERVER_SUFFIXES.some((suffix) => base.endsWith(suffix)) || SHARED_SUFFIXES.some((suffix) => base.endsWith(suffix)) || RUNTIME_METADATA_BASENAMES.has(base) || base === "main.ts" || base === "server.ts";
1005
968
  };
1006
969
  var shouldMarkBuildPhaseRecovered = (previousByPhase, status) => {
@@ -1161,83 +1124,12 @@ var mergeInvalidateMessages = (current, next) => {
1161
1124
  var buildStatusReplaySequence = (pendingReplay, latestByPhase) => [...pendingReplay, ...latestByPhase.values()];
1162
1125
  var filesChangedSince = (before, after) => [...before].filter(([file, stamp]) => after.get(file) !== stamp).map(([file]) => file);
1163
1126
 
1164
- // pkgs/@akanjs/devkit/frontendBuild/watchRootResolver.ts
1165
- import fs from "fs";
1166
- import { readFile } from "fs/promises";
1167
- import path6 from "path";
1168
-
1169
- class WatchRootResolver {
1170
- #app;
1171
- constructor(app) {
1172
- this.#app = app;
1173
- }
1174
- async resolve() {
1175
- const tsconfig = await this.#app.getTsConfig();
1176
- const appDir = path6.resolve(this.#app.cwdPath);
1177
- const appsContainer = path6.dirname(appDir);
1178
- const libsContainer = path6.resolve(this.#app.workspace.workspaceRoot, "libs");
1179
- const libRoots = (await this.#resolveLibDeps(libsContainer))?.map((name) => path6.join(libsContainer, name)).filter((dir) => fs.existsSync(dir));
1180
- const set = new Set;
1181
- set.add(path6.resolve(`${this.#app.cwdPath}/page`));
1182
- for (const targets of Object.values(tsconfig.compilerOptions.paths ?? {})) {
1183
- for (const target of targets) {
1184
- if (!target)
1185
- continue;
1186
- if (path6.isAbsolute(target))
1187
- continue;
1188
- const cleaned = target.replace(/\/?\*+.*$/, "").replace(/\/[^/]+\.[^/]+$/, "");
1189
- const resolved = path6.resolve(this.#app.workspace.workspaceRoot, cleaned);
1190
- if (resolved === libsContainer && libRoots) {
1191
- for (const root of libRoots)
1192
- set.add(root);
1193
- continue;
1194
- }
1195
- const root = resolved === appsContainer ? appDir : resolved;
1196
- if (fs.existsSync(root))
1197
- set.add(root);
1198
- }
1199
- }
1200
- return [...set];
1201
- }
1202
- async#resolveLibDeps(libsContainer) {
1203
- const scanInfo = this.#app.getScanInfo({ allowEmpty: true });
1204
- if (scanInfo?.type === "app")
1205
- return scanInfo.libDeps;
1206
- const direct = await WatchRootResolver.#readManifestLibDeps(path6.join(this.#app.cwdPath, "akan.app.json"));
1207
- if (!direct)
1208
- return null;
1209
- const closure = new Set;
1210
- const queue = [...direct];
1211
- while (queue.length > 0) {
1212
- const name = queue.shift();
1213
- if (!name || closure.has(name))
1214
- continue;
1215
- closure.add(name);
1216
- const nested = await WatchRootResolver.#readManifestLibDeps(path6.join(libsContainer, name, "akan.lib.json"));
1217
- if (!nested)
1218
- return null;
1219
- queue.push(...nested);
1220
- }
1221
- return [...closure];
1222
- }
1223
- static async#readManifestLibDeps(manifestPath) {
1224
- try {
1225
- const parsed = JSON.parse(await readFile(manifestPath, "utf8"));
1226
- if (!Array.isArray(parsed.libDeps))
1227
- return null;
1228
- return parsed.libDeps.filter((name) => typeof name === "string" && name.length > 0);
1229
- } catch {
1230
- return null;
1231
- }
1232
- }
1233
- }
1234
-
1235
1127
  // pkgs/@akanjs/devkit/frontendBuild/hmrWatcher.ts
1236
- import fs2 from "fs";
1237
- import path9 from "path";
1128
+ import fs from "fs";
1129
+ import path7 from "path";
1238
1130
 
1239
1131
  // pkgs/@akanjs/devkit/frontendBuild/hmrChangeClassifier.ts
1240
- import path7 from "path";
1132
+ import path5 from "path";
1241
1133
  var CSS_EXTS = new Set([".css"]);
1242
1134
  var CONFIG_BASENAMES = new Set(["akan.config.ts", "bunfig.toml", "tsconfig.json", "package.json"]);
1243
1135
 
@@ -1245,10 +1137,10 @@ class HmrChangeClassifier {
1245
1137
  classify(abs) {
1246
1138
  if (this.#isUninteresting(abs))
1247
1139
  return "ignore";
1248
- const base = path7.basename(abs);
1140
+ const base = path5.basename(abs);
1249
1141
  if (CONFIG_BASENAMES.has(base))
1250
1142
  return "config";
1251
- const ext = path7.extname(abs).toLowerCase();
1143
+ const ext = path5.extname(abs).toLowerCase();
1252
1144
  if (CSS_EXTS.has(ext))
1253
1145
  return "css";
1254
1146
  if (SOURCE_EXTS.has(ext))
@@ -1256,16 +1148,16 @@ class HmrChangeClassifier {
1256
1148
  return "ignore";
1257
1149
  }
1258
1150
  #isUninteresting(abs) {
1259
- const base = path7.basename(abs);
1151
+ const base = path5.basename(abs);
1260
1152
  if (!base)
1261
1153
  return true;
1262
1154
  if (base.startsWith("."))
1263
1155
  return true;
1264
1156
  if (base.endsWith("~") || base.endsWith(".swp") || base.endsWith(".swx") || base.endsWith(".tmp"))
1265
1157
  return true;
1266
- if (abs.includes(`${path7.sep}node_modules${path7.sep}`))
1158
+ if (abs.includes(`${path5.sep}node_modules${path5.sep}`))
1267
1159
  return true;
1268
- if (abs.includes(`${path7.sep}.akan${path7.sep}`))
1160
+ if (abs.includes(`${path5.sep}.akan${path5.sep}`))
1269
1161
  return true;
1270
1162
  return false;
1271
1163
  }
@@ -1273,7 +1165,7 @@ class HmrChangeClassifier {
1273
1165
 
1274
1166
  // pkgs/@akanjs/devkit/frontendBuild/sourceMtimeIndex.ts
1275
1167
  import { readdir, stat as stat3 } from "fs/promises";
1276
- import path8 from "path";
1168
+ import path6 from "path";
1277
1169
  var UNREADABLE = Number.NaN;
1278
1170
 
1279
1171
  class SourceMtimeIndex {
@@ -1336,7 +1228,7 @@ class SourceMtimeIndex {
1336
1228
  if (!this.#primed)
1337
1229
  return;
1338
1230
  await Promise.all(paths.map(async (file) => {
1339
- const abs = path8.resolve(file);
1231
+ const abs = path6.resolve(file);
1340
1232
  const stats = await stat3(abs).catch(() => null);
1341
1233
  if (!stats?.isFile()) {
1342
1234
  this.#files.delete(abs);
@@ -1422,7 +1314,7 @@ class SourceMtimeIndex {
1422
1314
  for (const entry of entries) {
1423
1315
  if (SourceMtimeIndex.#skipDirent(entry.name))
1424
1316
  continue;
1425
- const abs = path8.join(dir, entry.name);
1317
+ const abs = path6.join(dir, entry.name);
1426
1318
  if (entry.isDirectory()) {
1427
1319
  descend.push(abs);
1428
1320
  continue;
@@ -1449,7 +1341,7 @@ class SourceMtimeIndex {
1449
1341
  }
1450
1342
  if (known) {
1451
1343
  for (const abs of [...this.#files.keys()]) {
1452
- if (present.has(abs) || path8.dirname(abs) !== dir)
1344
+ if (present.has(abs) || path6.dirname(abs) !== dir)
1453
1345
  continue;
1454
1346
  this.#files.delete(abs);
1455
1347
  changed?.add(abs);
@@ -1467,7 +1359,7 @@ class SourceMtimeIndex {
1467
1359
  this.#unsettled.delete(dir);
1468
1360
  }
1469
1361
  #forget(dir) {
1470
- const prefix = `${dir}${path8.sep}`;
1362
+ const prefix = `${dir}${path6.sep}`;
1471
1363
  this.#dirs.delete(dir);
1472
1364
  this.#unreadable.delete(dir);
1473
1365
  this.#unsettled.delete(dir);
@@ -1505,8 +1397,8 @@ class SourceMtimeIndex {
1505
1397
  return !name || name.startsWith(".") || name === "node_modules";
1506
1398
  }
1507
1399
  static #pruneNestedRoots(roots) {
1508
- const resolved = [...new Set(roots.map((root) => path8.resolve(root)))].sort();
1509
- return resolved.filter((root) => !resolved.some((other) => other !== root && root.startsWith(`${other}${path8.sep}`)));
1400
+ const resolved = [...new Set(roots.map((root) => path6.resolve(root)))].sort();
1401
+ return resolved.filter((root) => !resolved.some((other) => other !== root && root.startsWith(`${other}${path6.sep}`)));
1510
1402
  }
1511
1403
  }
1512
1404
 
@@ -1531,7 +1423,7 @@ class HmrWatcher {
1531
1423
  #reportedCompensating = false;
1532
1424
  #reportedGaps = "";
1533
1425
  constructor(opts) {
1534
- this.#roots = [...new Set(opts.roots.map((r) => path9.resolve(r)))];
1426
+ this.#roots = [...new Set(opts.roots.map((r) => path7.resolve(r)))];
1535
1427
  this.#debounceMs = opts.debounceMs ?? HmrWatcher.#envDebounceMs() ?? 30;
1536
1428
  this.#verifyDelayMs = opts.verifyDelayMs ?? 250;
1537
1429
  this.#onBatch = opts.onBatch;
@@ -1544,10 +1436,10 @@ class HmrWatcher {
1544
1436
  async start() {
1545
1437
  for (const root of this.#roots) {
1546
1438
  try {
1547
- const w = fs2.watch(root, { recursive: true, persistent: false }, (_event, filename) => {
1439
+ const w = fs.watch(root, { recursive: true, persistent: false }, (_event, filename) => {
1548
1440
  if (!filename)
1549
1441
  return;
1550
- const abs = path9.resolve(root, filename.toString());
1442
+ const abs = path7.resolve(root, filename.toString());
1551
1443
  this.#queue(abs);
1552
1444
  });
1553
1445
  w.on("error", (err) => {
@@ -1622,6 +1514,8 @@ class HmrWatcher {
1622
1514
  try {
1623
1515
  while (!this.#stopped) {
1624
1516
  await this.#mergeDetectedChanges();
1517
+ if (this.#stopped)
1518
+ break;
1625
1519
  if (this.#pending.size === 0) {
1626
1520
  this.#windowStartedAt = null;
1627
1521
  break;
@@ -1711,4 +1605,75 @@ class HmrWatcher {
1711
1605
  }
1712
1606
  }
1713
1607
 
1608
+ // pkgs/@akanjs/devkit/frontendBuild/watchRootResolver.ts
1609
+ import fs2 from "fs";
1610
+ import { readFile } from "fs/promises";
1611
+ import path8 from "path";
1612
+
1613
+ class WatchRootResolver {
1614
+ #app;
1615
+ constructor(app) {
1616
+ this.#app = app;
1617
+ }
1618
+ async resolve() {
1619
+ const tsconfig = await this.#app.getTsConfig();
1620
+ const appDir = path8.resolve(this.#app.cwdPath);
1621
+ const appsContainer = path8.dirname(appDir);
1622
+ const libsContainer = path8.resolve(this.#app.workspace.workspaceRoot, "libs");
1623
+ const libRoots = (await this.#resolveLibDeps(libsContainer))?.map((name) => path8.join(libsContainer, name)).filter((dir) => fs2.existsSync(dir));
1624
+ const set = new Set;
1625
+ set.add(path8.resolve(`${this.#app.cwdPath}/page`));
1626
+ for (const targets of Object.values(tsconfig.compilerOptions.paths ?? {})) {
1627
+ for (const target of targets) {
1628
+ if (!target)
1629
+ continue;
1630
+ if (path8.isAbsolute(target))
1631
+ continue;
1632
+ const cleaned = target.replace(/\/?\*+.*$/, "").replace(/\/[^/]+\.[^/]+$/, "");
1633
+ const resolved = path8.resolve(this.#app.workspace.workspaceRoot, cleaned);
1634
+ if (resolved === libsContainer && libRoots) {
1635
+ for (const root of libRoots)
1636
+ set.add(root);
1637
+ continue;
1638
+ }
1639
+ const root = resolved === appsContainer ? appDir : resolved;
1640
+ if (fs2.existsSync(root))
1641
+ set.add(root);
1642
+ }
1643
+ }
1644
+ return [...set];
1645
+ }
1646
+ async#resolveLibDeps(libsContainer) {
1647
+ const scanInfo = this.#app.getScanInfo({ allowEmpty: true });
1648
+ if (scanInfo?.type === "app")
1649
+ return scanInfo.libDeps;
1650
+ const direct = await WatchRootResolver.#readManifestLibDeps(path8.join(this.#app.cwdPath, "akan.app.json"));
1651
+ if (!direct)
1652
+ return null;
1653
+ const closure = new Set;
1654
+ const queue = [...direct];
1655
+ while (queue.length > 0) {
1656
+ const name = queue.shift();
1657
+ if (!name || closure.has(name))
1658
+ continue;
1659
+ closure.add(name);
1660
+ const nested = await WatchRootResolver.#readManifestLibDeps(path8.join(libsContainer, name, "akan.lib.json"));
1661
+ if (!nested)
1662
+ return null;
1663
+ queue.push(...nested);
1664
+ }
1665
+ return [...closure];
1666
+ }
1667
+ static async#readManifestLibDeps(manifestPath) {
1668
+ try {
1669
+ const parsed = JSON.parse(await readFile(manifestPath, "utf8"));
1670
+ if (!Array.isArray(parsed.libDeps))
1671
+ return null;
1672
+ return parsed.libDeps.filter((name) => typeof name === "string" && name.length > 0);
1673
+ } catch {
1674
+ return null;
1675
+ }
1676
+ }
1677
+ }
1678
+
1714
1679
  export { UNAVAILABLE_REDIS_HOST, redisTunnelPolicy, backendRecoveryPolicy, BUILDER_MIN_RSS_RECYCLE_INTERVAL_MS, SOURCE_EXTS, shouldRestartBackendByDevPlan, shouldRestartBuilderByDevPlan, normalizeBackendReportedGeneration, shouldRestartDevHostByDevPlan, devHostStateOf, isLegacyBackendFallbackFile, shouldMarkBuildPhaseRecovered, shouldKeepBuildFailure, createBackendBuildStatus, backendRestartReasonFromMessage, mergeBackendRestartReasons, shouldReplaceLastGoodMessage, shouldQueueBuildStatusReplay, hasBuildFailureForGeneration, decideBuilderRssRecycle, decideBuilderRssSettle, decideIdleSuspend, resolveIdleSuspendMs, hasAnyBuildFailure, shouldRefreshConfigOnIdleWake, shouldHoldForReturningBuilder, shouldWarnBuilderRssCeilingTight, isRssCeilingUnreachable, shouldRelayRecycledFrontendState, mergeInvalidateMessages, buildStatusReplaySequence, filesChangedSince, HmrWatcher, WatchRootResolver, FontOptimizer, FontPruner, RouteJsBudget, ApplicationBuildReporter };
@@ -5,23 +5,24 @@ import {
5
5
  import {
6
6
  Executor,
7
7
  WorkspaceExecutor
8
- } from "./index-g56xae1n.js";
8
+ } from "./index-v72mh89f.js";
9
9
  import {
10
10
  getDirname2,
11
11
  FileSys2
12
12
  } from "./index-by2tvsq6.js";
13
13
  import {
14
14
  AppExecutor2
15
- } from "./index-trp7jdr1.js";
15
+ } from "./index-cet2s7xk.js";
16
16
  import {
17
17
  LibExecutor2
18
- } from "./index-n8mxyy3f.js";
18
+ } from "./index-t00xrkey.js";
19
19
  import {
20
20
  PkgExecutor2
21
- } from "./index-dtpeyts6.js";
21
+ } from "./index-cc9pevta.js";
22
22
  import {
23
- ModuleExecutor
24
- } from "./index-dqsc1b5t.js";
23
+ ModuleExecutor,
24
+ ErrorReport
25
+ } from "./index-4zqebbqb.js";
25
26
 
26
27
  // pkgs/@akanjs/devkit/commandDecorators/camelToKebabCase.ts
27
28
  var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
@@ -371,7 +372,7 @@ var printCliError = (error, stream = "log") => {
371
372
  return;
372
373
  loggedCliErrorObjects.add(error);
373
374
  }
374
- const message = CliError.messageOf(error);
375
+ const message = error instanceof Error ? ErrorReport.format(error) || error.name : CliError.messageOf(error);
375
376
  if (loggedCliErrorMessages.has(message))
376
377
  return;
377
378
  loggedCliErrorMessages.add(message);
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  JsonFormatter
4
- } from "./index-g56xae1n.js";
4
+ } from "./index-v72mh89f.js";
5
5
 
6
6
  // pkgs/@akanjs/devkit/quality/maintainabilityBaseline.ts
7
7
  class MaintainabilityBaseline {