@akanjs/cli 3.2.0-rc.2 → 3.2.0-rc.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/.build-stamp +2 -1
  2. package/CodeAgent-faqv7t4g.js +11 -0
  3. package/{CodeTui-zyc7zaq6.js → CodeTui-vqck9tet.js} +822 -666
  4. package/README.ko.md +26 -1
  5. package/README.md +26 -1
  6. package/TunnelShare-bwe3ddv7.js +18 -0
  7. package/agent.command-p75jvgrd.js +56 -0
  8. package/akanCode.js +12 -12
  9. package/appExecutor-020cyesq.js +11 -0
  10. package/{application.command-vb278qnq.js → application.command-ta2knqxm.js} +72 -34
  11. package/{applicationBuildRunner-bqbyeg84.js → applicationBuildRunner-gkh82j2b.js} +18 -13
  12. package/buildBatch.proc.js +26 -11
  13. package/{cloud.command-ca777ee2.js → cloud.command-v3jhfvm5.js} +31 -28
  14. package/cloud.script-be9s1432.js +35 -0
  15. package/{code.command-j08txqcd.js → code.command-mh7dh1st.js} +14 -9
  16. package/{context.command-2fa6egp9.js → context.command-1ycfjkdd.js} +28 -23
  17. package/context.runner-333jkz86.js +34 -0
  18. package/{dependencyScanner-78sq8m4q.js → dependencyScanner-ge10gb52.js} +2 -2
  19. package/{devTui-w38ch13a.js → devTui-rf374y2w.js} +1 -1
  20. package/{fileSys-zpvt5gtf.js → fileSys-q22646yc.js} +1 -1
  21. package/{guideline.command-w6yqpdec.js → guideline.command-w1grfwh7.js} +9 -4
  22. package/guidelines/agentRule/agentRule.instruction.md +17 -5
  23. package/guidelines/akanApi/akanApi.instruction.md +5 -3
  24. package/guidelines/conventions/core.md +23 -5
  25. package/guidelines/conventions/rules/app.md +4 -1
  26. package/guidelines/conventions/rules/page.md +5 -0
  27. package/guidelines/errorCodes/errorCodes.instruction.md +158 -0
  28. package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
  29. package/guidelines/mcpRule/mcpRule.instruction.md +86 -2
  30. package/guidelines/pageRule/pageRule.instruction.md +11 -1
  31. package/guidelines/runtimeRule/runtimeRule.instruction.md +7 -2
  32. package/guidelines/transportRule/transportRule.instruction.md +8 -1
  33. package/incrementalBuilder.proc.js +574 -410
  34. package/{index-c5ymqb05.js → index-013n6z7m.js} +12 -12
  35. package/{index-w15mg3km.js → index-0dm25wvf.js} +1 -1
  36. package/{index-8nbx607g.js → index-0hj82f9w.js} +136 -48
  37. package/{index-ebwkh7bt.js → index-1c0mjc2b.js} +25 -7
  38. package/{index-6h775rv3.js → index-1jk52ffq.js} +53 -12
  39. package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
  40. package/{index-ygrdw6jw.js → index-1pjwsh2g.js} +65 -8
  41. package/{index-cbcwxp5v.js → index-22g3jq43.js} +9 -7
  42. package/{index-466z5931.js → index-2d9nm03s.js} +580 -364
  43. package/{index-0fj9ra3q.js → index-2k6mve6a.js} +18 -11
  44. package/{index-qd7xn2bk.js → index-2ny1e95c.js} +2 -2
  45. package/{index-j7p0jgaq.js → index-52w4jb87.js} +6 -6
  46. package/{index-e22zedc2.js → index-5h888r6j.js} +3 -3
  47. package/{index-7kmbqp0b.js → index-6pxmcaq8.js} +1 -1
  48. package/{index-xa0289eg.js → index-6zb17wcm.js} +16 -9
  49. package/{index-qgazn58x.js → index-7a07tdap.js} +50 -38
  50. package/{index-m5sg5spm.js → index-7ehdht84.js} +565 -187
  51. package/{index-y725zb1a.js → index-7v7tvgt7.js} +196 -168
  52. package/{index-pq5rjkch.js → index-88s746ns.js} +7 -2
  53. package/{index-r0a604h4.js → index-99kjwyma.js} +1 -1
  54. package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
  55. package/{index-386canwe.js → index-9rv2zt48.js} +186 -121
  56. package/{index-wr9magsr.js → index-9zswcze5.js} +3 -3
  57. package/{index-xq97me1h.js → index-a41vv4cy.js} +811 -697
  58. package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
  59. package/{index-bdmgqzb5.js → index-bket1068.js} +58 -29
  60. package/{index-bns3wcpc.js → index-by2tvsq6.js} +1 -1
  61. package/{index-1cb9apzn.js → index-czf94w8c.js} +2 -2
  62. package/{index-65b6ms4c.js → index-d3178asw.js} +15 -11
  63. package/index-dss3ds74.js +127 -0
  64. package/{index-annxfpgz.js → index-eyfty8kk.js} +9 -9
  65. package/{index-ny2k80mv.js → index-ffa52fwf.js} +1 -1
  66. package/{index-8jpc5fqv.js → index-g7jgd4xs.js} +2 -2
  67. package/{index-abfbf01s.js → index-gwsesvqc.js} +2 -2
  68. package/{index-kcpk2d20.js → index-h1w4wqgd.js} +1474 -1139
  69. package/{index-j1hjb477.js → index-hp2c7xc2.js} +1 -1
  70. package/index-j4yvgfhr.js +70 -0
  71. package/{index-84c2pgak.js → index-jx2jcw1r.js} +89 -78
  72. package/{index-j6eeh5d7.js → index-knpm8sdm.js} +5 -5
  73. package/{index-2gees180.js → index-mpp4aas6.js} +62 -33
  74. package/index-na8r4a27.js +30 -0
  75. package/{index-0mqga3h9.js → index-nmxszh6x.js} +525 -440
  76. package/{index-35j83zkd.js → index-p5zh7pmc.js} +2 -2
  77. package/{index-20wvskt8.js → index-pt0agdck.js} +1 -1
  78. package/{index-htxck0pn.js → index-q444k260.js} +15 -10
  79. package/{index-wfmpxke3.js → index-qssq2d41.js} +2775 -3677
  80. package/{index-23860fej.js → index-rwgqba9p.js} +24 -9
  81. package/{index-v50xjbbe.js → index-t4d0ckde.js} +1 -1
  82. package/index-va90m8nd.js +25 -0
  83. package/index-vjbne22r.js +80 -0
  84. package/{index-djc5nxpy.js → index-w23tf30e.js} +6 -6
  85. package/{index-mvwvxgtd.js → index-wa01phm9.js} +289 -210
  86. package/{index-h7hehkw6.js → index-xczjdng6.js} +3 -1
  87. package/{index-vbhx60x5.js → index-xwe7y0gf.js} +2140 -2165
  88. package/index-ze48c0vd.js +788 -0
  89. package/{index-dk4g0x0d.js → index-zttyg7tg.js} +27 -16
  90. package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
  91. package/index.js +29 -24
  92. package/libExecutor-tq994592.js +10 -0
  93. package/{library.command-8d03a0pq.js → library.command-x219mhcx.js} +9 -4
  94. package/{localRegistry.command-vyv5k6t0.js → localRegistry.command-4p17wa9t.js} +30 -24
  95. package/{module.command-vy3kg965.js → module.command-tjthnvvr.js} +17 -8
  96. package/{package.command-qjh13rs9.js → package.command-c6df2hxx.js} +13 -8
  97. package/package.json +2 -2
  98. package/{page.command-t0nx1jat.js → page.command-gf06paq2.js} +9 -4
  99. package/{pipeline.command-2yjeas7m.js → pipeline.command-y07dgj9b.js} +14 -8
  100. package/pkgExecutor-stde3yc3.js +10 -0
  101. package/{primitive.command-8vm49279.js → primitive.command-0enfygxn.js} +13 -8
  102. package/{projectTypecheck-s9hhe5sa.js → projectTypecheck-mk8wefvd.js} +2 -1
  103. package/{prompter-qrwx1p17.js → prompter-qyggfhqd.js} +2 -2
  104. package/{quality.command-v76fev72.js → quality.command-dkbdztad.js} +23 -16
  105. package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
  106. package/{repair.command-fp4m3w03.js → repair.command-g5vd95ax.js} +13 -8
  107. package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8n6j1vn7.js} +4 -2
  108. package/{scalar.command-hxe6try8.js → scalar.command-7909pg0d.js} +11 -6
  109. package/skills/akan-debug/SKILL.md +10 -3
  110. package/skills/akan-err/SKILL.md +7 -0
  111. package/skills/akan-mcp/SKILL.md +13 -2
  112. package/skills/akan-scaffold/SKILL.md +2 -2
  113. package/skills/akan-transport/SKILL.md +2 -0
  114. package/skills/akan-validate/SKILL.md +1 -0
  115. package/{subspace.command-q42n1844.js → subspace.command-at4jt1fb.js} +29 -23
  116. package/templates/biomeForm.ts +1 -1
  117. package/templates/env/_env.server.type.ts +1 -1
  118. package/templates/facetIndex/index.ts +2 -37
  119. package/templates/lib/sig.ts +0 -4
  120. package/templates/lib/useClient.ts +1 -1
  121. package/templates/workspaceRoot/AGENTS.md.template +2 -1
  122. package/{tunnel.command-22g11n0x.js → tunnel.command-91h92dwr.js} +17 -12
  123. package/{typeChecker-s640r6c0.js → typeChecker-bfrd1n9n.js} +1 -1
  124. package/typecheck.proc.js +6 -3
  125. package/{verify.command-rx43bha1.js → verify.command-pzky05ts.js} +26 -20
  126. package/{workflow.command-yg0d8mmq.js → workflow.command-mqqe4n12.js} +37 -19
  127. package/{workspace.command-fcfztvn5.js → workspace.command-y4rznvhx.js} +64 -53
  128. package/CodeAgent-6cpjtj25.js +0 -11
  129. package/TunnelShare-zkfkrw8w.js +0 -14
  130. package/agent.command-kf1g3nh4.js +0 -51
  131. package/cloud.script-agpxzq6j.js +0 -30
  132. package/context.runner-ftv8373t.js +0 -29
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- // pkgs/@akanjs/devkit/shellOnlyEnv.ts
2
+ // pkgs/@akanjs/devkit/util/shellOnlyEnv.ts
3
3
  import { existsSync, readFileSync } from "fs";
4
4
  import path from "path";
5
5
  var dotenvFiles = [
@@ -1,7 +1,9 @@
1
1
  // @bun
2
2
  import {
3
+ ROOT_LAYOUT_SYSTEM,
4
+ isImplicitRootLayoutKey,
3
5
  resolveSsrPageEntriesForApp
4
- } from "./index-wfmpxke3.js";
6
+ } from "./index-ze48c0vd.js";
5
7
  import {
6
8
  computeRouteSeedIndex,
7
9
  saveRouteSeedIndex,
@@ -9,12 +11,12 @@ import {
9
11
  ClientEntriesBundler,
10
12
  VENDOR_SPECIFIERS,
11
13
  RouteClientBuilder
12
- } from "./index-vbhx60x5.js";
14
+ } from "./index-xwe7y0gf.js";
13
15
  import {
14
16
  SOURCE_EXTS,
15
17
  FontOptimizer,
16
18
  FontPruner
17
- } from "./index-y725zb1a.js";
19
+ } from "./index-7v7tvgt7.js";
18
20
  import {
19
21
  BarrelAnalyzer,
20
22
  createTsconfigPackageResolver,
@@ -22,7 +24,7 @@ import {
22
24
  CsrEntryFiles,
23
25
  toClientReferencePath,
24
26
  PagesBundleBuilder
25
- } from "./index-84c2pgak.js";
27
+ } from "./index-jx2jcw1r.js";
26
28
  import {
27
29
  CssBlockParser
28
30
  } from "./index-62md4dwy.js";
@@ -98,7 +100,7 @@ class AllRoutesBuilder {
98
100
  };
99
101
  #knownSet = new Set;
100
102
  #routeIds = [];
101
- #entriesByRoute = new Map;
103
+ #ssrEntriesByRoute = new Map;
102
104
  #externalsByChunkUrl = {};
103
105
  #discovery = null;
104
106
  constructor(app, command = "start") {
@@ -111,14 +113,16 @@ class AllRoutesBuilder {
111
113
  const pageEntries = await resolveSsrPageEntriesForApp(this.#app, pageKeys);
112
114
  const seedIndex = computeRouteSeedIndex(pageEntries);
113
115
  this.#app.verbose(`[build-all] discovered ${seedIndex.entries.length} routes`);
114
- this.#discovery = await GraphClientEntryDiscovery.create(this.#app);
116
+ const discovery = await GraphClientEntryDiscovery.create(this.#app);
117
+ this.#discovery = discovery;
118
+ const importsAs = await this.#ssrImportsAs(discovery, pageEntries);
115
119
  const allEntries = new Set;
116
120
  for (const entry of seedIndex.entries) {
117
121
  const seeds = Array.from(new Set([...seedIndex.globalLayoutFiles, ...entry.seeds]));
118
- const routeEntries = await this.#discovery.discover(seeds);
122
+ const routeEntries = await discovery.discover(seeds);
119
123
  for (const discovered of routeEntries)
120
124
  allEntries.add(discovered);
121
- this.#entriesByRoute.set(entry.routeId, routeEntries);
125
+ this.#ssrEntriesByRoute.set(entry.routeId, await discovery.discover(seeds, { importsAs }));
122
126
  this.#routeIds.push(entry.routeId);
123
127
  }
124
128
  this.#app.verbose(`[build-all] ${allEntries.size} client entries across ${this.#routeIds.length} routes`);
@@ -134,10 +138,22 @@ class AllRoutesBuilder {
134
138
  this.#app.verbose(`[build-all] wrote ${manifestPath} routes=${this.#routeIds.length} entries=${this.#merged.knownEntries.length}`);
135
139
  return { manifest, manifestPath, seedIndex };
136
140
  }
141
+ async#ssrImportsAs(discovery, pageEntries) {
142
+ const { specifier, ssrShell, importsNoSsrPageRenders } = ROOT_LAYOUT_SYSTEM;
143
+ const importsAs = new Map;
144
+ const toShell = new Map([[specifier, ssrShell]]);
145
+ for (const { key, moduleAbsPath } of pageEntries)
146
+ if (isImplicitRootLayoutKey(key))
147
+ importsAs.set(path.resolve(moduleAbsPath), toShell);
148
+ const system = await discovery.resolveImport(specifier, this.#app.cwdPath);
149
+ if (system)
150
+ importsAs.set(system, new Map(importsNoSsrPageRenders.map((spec) => [spec, null])));
151
+ return importsAs;
152
+ }
137
153
  async writeModulePreloads(runtimeChunks) {
138
154
  const preloads = new RouteModulePreloads({
139
155
  runtimeChunks,
140
- entriesByRoute: this.#entriesByRoute,
156
+ entriesByRoute: this.#ssrEntriesByRoute,
141
157
  clientManifest: this.#merged.clientManifest,
142
158
  externalsByChunkUrl: this.#externalsByChunkUrl,
143
159
  workspaceRoot: this.#app.workspace.workspaceRoot
@@ -975,16 +991,7 @@ class SsrBaseArtifactBuilder {
975
991
  const rscClientUrl = clientBundle.entryUrlsByAbsPath.get(rscClientEntry) ?? "";
976
992
  const rscRuntimeSsrManifest = {
977
993
  moduleLoading: null,
978
- moduleMap: Object.fromEntries(Object.entries(clientBundle.manifest).map(([key, row]) => {
979
- const ssrOutput = ssrBundle.entryOutputAbsByAbsPath.get(rscSegmentOutletEntry);
980
- if (!ssrOutput || key !== `${clientBundle.clientReferenceIdByAbsPath.get(rscSegmentOutletEntry)}#${row.name}`) {
981
- return null;
982
- }
983
- return [
984
- row.id,
985
- { [row.name]: { id: ssrOutput, chunks: [ssrOutput, ssrOutput], name: row.name, async: true } }
986
- ];
987
- }).filter((entry) => Boolean(entry)))
994
+ moduleMap: SsrBaseArtifactBuilder.outletModuleMap(clientBundle.manifest, clientBundle.clientReferenceIdByAbsPath.get(rscSegmentOutletEntry), ssrBundle.entryOutputAbsByAbsPath.get(rscSegmentOutletEntry))
988
995
  };
989
996
  const vendorMap = Object.fromEntries(vendorEntries.map(({ specifier, absPath }) => [specifier, clientBundle.entryUrlsByAbsPath.get(absPath) ?? ""]));
990
997
  this.#app.verbose(`[base-artifact] rscClientUrl=${rscClientUrl} vendors=${Object.keys(vendorMap).length}`);
@@ -1000,6 +1007,20 @@ class SsrBaseArtifactBuilder {
1000
1007
  }
1001
1008
  };
1002
1009
  }
1010
+ static outletModuleMap(manifest, outletReferenceId, ssrOutput) {
1011
+ const moduleMap = {};
1012
+ if (!ssrOutput || !outletReferenceId)
1013
+ return moduleMap;
1014
+ for (const [key, row] of Object.entries(manifest)) {
1015
+ if (key !== `${outletReferenceId}#${row.name}`)
1016
+ continue;
1017
+ moduleMap[row.id] = {
1018
+ ...moduleMap[row.id],
1019
+ [row.name]: { id: ssrOutput, chunks: [ssrOutput, ssrOutput], name: row.name, async: true }
1020
+ };
1021
+ }
1022
+ return moduleMap;
1023
+ }
1003
1024
  async#resolveAkanServerPath() {
1004
1025
  const candidates = [];
1005
1026
  try {
@@ -1070,28 +1091,36 @@ class VendorImportScanner {
1070
1091
  for (const specifier of specifiers)
1071
1092
  this.#names.set(specifier, new Set);
1072
1093
  }
1073
- static async exportsUsedIn(dir, specifiers) {
1094
+ static async exportsUsedIn(dir, specifiers, entryUrls) {
1074
1095
  const scanner = new VendorImportScanner(specifiers);
1075
- if (!fs3.existsSync(dir))
1076
- return scanner.usedExports();
1077
- for await (const relative of new Bun.Glob("**/*.js").scan({ cwd: dir }))
1078
- scanner.scan(await Bun.file(path8.join(dir, relative)).text(), relative);
1096
+ const scanned = [];
1097
+ if (fs3.existsSync(dir))
1098
+ for await (const relative of new Bun.Glob("**/*.js").scan({ cwd: dir })) {
1099
+ scanner.scan(await Bun.file(path8.join(dir, relative)).text(), relative);
1100
+ scanned.push(`/${relative.split(path8.sep).join("/")}`);
1101
+ }
1102
+ const unread = [...new Set(entryUrls)].filter((url) => !scanned.some((relative) => url.endsWith(relative)));
1103
+ if (unread.length > 0) {
1104
+ const named = `${unread.slice(0, 3).join(", ")}${unread.length > 3 ? `, and ${unread.length - 3} more` : ""}`;
1105
+ throw new Error(`[VendorImportScanner] no file under ${dir} for the route client entries ${named}; narrowing the vendor entries without them would drop names those pages import`);
1106
+ }
1079
1107
  return scanner.usedExports();
1080
1108
  }
1081
1109
  scan(source, fileName = "chunk.js") {
1082
1110
  if (![...this.#specifiers].some((specifier) => source.includes(specifier)))
1083
1111
  return this;
1084
- const file = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, false, ts.ScriptKind.JS);
1085
- const visit = (node) => {
1112
+ const stack = [ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, false, ts.ScriptKind.JS)];
1113
+ for (let node = stack.pop();node; node = stack.pop()) {
1086
1114
  if (ts.isImportDeclaration(node))
1087
1115
  this.#readImport(node);
1088
1116
  else if (ts.isExportDeclaration(node))
1089
1117
  this.#readExport(node);
1090
1118
  else if (ts.isCallExpression(node))
1091
1119
  this.#readCall(node);
1092
- ts.forEachChild(node, visit);
1093
- };
1094
- visit(file);
1120
+ ts.forEachChild(node, (child) => {
1121
+ stack.push(child);
1122
+ });
1123
+ }
1095
1124
  return this;
1096
1125
  }
1097
1126
  usedExports() {
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- // pkgs/@akanjs/devkit/fileSys.ts
2
+ // pkgs/@akanjs/devkit/util/fileSys.ts
3
3
  import { chmodSync, mkdirSync, statSync } from "fs";
4
4
  import { lstat, rename, rm, stat } from "fs/promises";
5
5
  import nodePath from "path";
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  FrameworkMapBuilder,
4
4
  FrameworkMapDoc
5
- } from "./index-m5sg5spm.js";
5
+ } from "./index-7ehdht84.js";
6
6
 
7
- // pkgs/@akanjs/devkit/frameworkGraph.ts
7
+ // pkgs/@akanjs/devkit/docs/frameworkGraph.ts
8
8
  import { readdir, readFile, realpath, stat } from "fs/promises";
9
9
  import path from "path";
10
10
  import ts from "typescript";
@@ -2,27 +2,30 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-386canwe.js";
5
+ } from "./index-9rv2zt48.js";
6
6
  import {
7
7
  FileSys2
8
- } from "./index-bns3wcpc.js";
8
+ } from "./index-by2tvsq6.js";
9
9
  import {
10
- PkgExecutor
11
- } from "./index-wfmpxke3.js";
12
- import {
13
- TypeScriptDependencyScanner2
14
- } from "./index-qd7xn2bk.js";
10
+ PkgExecutor2
11
+ } from "./index-dss3ds74.js";
15
12
  import {
16
13
  FrameworkGraph
17
- } from "./index-1cb9apzn.js";
14
+ } from "./index-czf94w8c.js";
18
15
  import {
19
16
  MaintainabilityBaseline
20
- } from "./index-ygrdw6jw.js";
17
+ } from "./index-1pjwsh2g.js";
18
+ import {
19
+ TypeScriptDependencyScanner2
20
+ } from "./index-2ny1e95c.js";
21
+ import {
22
+ assertPackageName
23
+ } from "./index-va90m8nd.js";
21
24
 
22
25
  // pkgs/@akanjs/cli/package/package.runner.ts
23
26
  import path2 from "path";
24
27
 
25
- // pkgs/@akanjs/devkit/packageExportsMap.ts
28
+ // pkgs/@akanjs/devkit/workspace/packageExportsMap.ts
26
29
  import { statSync } from "fs";
27
30
  import path from "path";
28
31
 
@@ -370,7 +373,7 @@ ${problems.join(`
370
373
  return { file: FrameworkGraph.architectureFile, changed: next !== current };
371
374
  }
372
375
  async verifyAkanPublishPackages(workspace) {
373
- const pkgs = PackageRunner.publishableAkanPackages.map((pkgName) => PkgExecutor.from(workspace, pkgName));
376
+ const pkgs = PackageRunner.publishableAkanPackages.map((pkgName) => PkgExecutor2.from(workspace, pkgName));
374
377
  const peerExportsMaps = new Map;
375
378
  for (const pkg of pkgs) {
376
379
  if (!await Bun.file(`${pkg.dist.cwdPath}/package.json`).exists())
@@ -404,6 +407,7 @@ class PackageScript extends script("package", [PackageRunner]) {
404
407
  return await this.packageRunner.version(workspace, { log });
405
408
  }
406
409
  async createPackage(workspace, pkgName) {
410
+ assertPackageName(pkgName);
407
411
  const spinner = workspace.spinning(`Creating package in pkgs/${pkgName}...`);
408
412
  await this.packageRunner.createPackage(workspace, pkgName);
409
413
  spinner.succeed(`Package in pkgs/${pkgName} is created`);
@@ -0,0 +1,127 @@
1
+ // @bun
2
+ import {
3
+ execEmoji,
4
+ Executor,
5
+ PkgInfo,
6
+ WorkspaceExecutor
7
+ } from "./index-qssq2d41.js";
8
+
9
+ // pkgs/@akanjs/devkit/executors/pkgExecutor.ts
10
+ import path from "path";
11
+ class PkgExecutor2 extends Executor {
12
+ workspace;
13
+ name;
14
+ dist;
15
+ emoji = execEmoji.pkg;
16
+ constructor({ workspace = WorkspaceExecutor.fromRoot(), name }) {
17
+ super(name, `${workspace.workspaceRoot}/pkgs/${name}`);
18
+ this.workspace = workspace;
19
+ this.name = name;
20
+ this.dist = new Executor(`dist/${name}`, `${this.workspace.workspaceRoot}/dist/pkgs/${name}`);
21
+ }
22
+ static from(executor, name) {
23
+ return new PkgExecutor2({ workspace: executor instanceof WorkspaceExecutor ? executor : executor.workspace, name });
24
+ }
25
+ #scanInfo = null;
26
+ async scan({ refresh } = {}) {
27
+ if (this.#scanInfo && !refresh)
28
+ return this.#scanInfo;
29
+ const scanInfo = await PkgInfo.fromExecutor(this, { refresh });
30
+ this.#scanInfo = scanInfo;
31
+ return scanInfo;
32
+ }
33
+ async#getDependencyVersion(rootPackageJson, dep) {
34
+ const rootDeps = {
35
+ ...rootPackageJson.dependencies,
36
+ ...rootPackageJson.devDependencies
37
+ };
38
+ const rootVersion = rootDeps[dep];
39
+ if (rootVersion)
40
+ return rootVersion;
41
+ const overrideVersion = rootPackageJson.overrides?.[dep];
42
+ if (typeof overrideVersion === "string")
43
+ return overrideVersion;
44
+ try {
45
+ const packageJsonPath = `pkgs/${dep}/package.json`;
46
+ if (!await Bun.file(path.join(this.workspace.workspaceRoot, packageJsonPath)).exists())
47
+ return;
48
+ const packageJson = await this.workspace.readJson(packageJsonPath);
49
+ if (packageJson.name === dep)
50
+ return packageJson.version;
51
+ } catch {
52
+ return;
53
+ }
54
+ }
55
+ async#toDependencyMap(rootPackageJson, dependencies = [], devDependencies = []) {
56
+ const dependencyNames = [...new Set(dependencies)].sort();
57
+ const devDependencyNames = [...new Set(devDependencies)].filter((dep) => !dependencyNames.includes(dep)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
58
+ const dependencyVersions = new Map;
59
+ const missingDeps = [];
60
+ for (const dep of [...dependencyNames, ...devDependencyNames]) {
61
+ const version = await this.#getDependencyVersion(rootPackageJson, dep);
62
+ if (version)
63
+ dependencyVersions.set(dep, version);
64
+ else
65
+ missingDeps.push(dep);
66
+ }
67
+ if (missingDeps.length > 0)
68
+ throw new Error(`Missing dependency versions in root package.json: ${missingDeps.join(", ")}`);
69
+ const toDependencyMap = (names) => Object.fromEntries(names.map((dep) => [dep, dependencyVersions.get(dep)]));
70
+ return { dependencies: toDependencyMap(dependencyNames), devDependencies: toDependencyMap(devDependencyNames) };
71
+ }
72
+ async updatePackageJsonDependencies(dependencies = [], devDependencies = []) {
73
+ const [rootPackageJson, pkgJson] = await Promise.all([this.workspace.getPackageJson(), this.getPackageJson()]);
74
+ const dependencyMaps = await this.#toDependencyMap(rootPackageJson, dependencies, devDependencies);
75
+ const newPkgJson = {
76
+ ...pkgJson,
77
+ ...dependencyMaps
78
+ };
79
+ await this.writeJson("package.json", newPkgJson);
80
+ return newPkgJson;
81
+ }
82
+ async generateDistPackageJson(dependencies = [], devDependencies = []) {
83
+ const [rootPackageJson, pkgJson] = await Promise.all([this.workspace.getPackageJson(), this.getPackageJson()]);
84
+ const dependencyMaps = await this.#toDependencyMap(rootPackageJson, dependencies, devDependencies);
85
+ const distPkgJson = {
86
+ ...pkgJson,
87
+ type: "module",
88
+ exports: {
89
+ ...pkgJson.exports,
90
+ ".": {
91
+ import: "./index.ts",
92
+ types: "./index.ts",
93
+ default: "./index.ts"
94
+ }
95
+ },
96
+ engines: { bun: ">=1.4.4" },
97
+ ...dependencyMaps
98
+ };
99
+ await Promise.all([this.dist.writeJson("package.json", distPkgJson), this.writeJson("package.json", distPkgJson)]);
100
+ return distPkgJson;
101
+ }
102
+ async build() {
103
+ await Bun.build({
104
+ root: this.cwdPath,
105
+ entrypoints: [`${this.cwdPath}/index.ts`],
106
+ splitting: false,
107
+ target: "bun"
108
+ });
109
+ await this.cp(`${this.cwdPath}/dist`, this.dist.cwdPath);
110
+ }
111
+ async generateTsconfigJson() {
112
+ const [rootTsconfig, pkgTsconfig] = await Promise.all([this.workspace.getTsConfig(), this.getTsConfig()]);
113
+ const tsconfig = {
114
+ ...rootTsconfig,
115
+ ...pkgTsconfig,
116
+ compilerOptions: {
117
+ ...rootTsconfig.compilerOptions,
118
+ ...pkgTsconfig.compilerOptions,
119
+ paths: {}
120
+ }
121
+ };
122
+ await this.dist.writeJson("tsconfig.json", tsconfig);
123
+ return tsconfig;
124
+ }
125
+ }
126
+
127
+ export { PkgExecutor2 };
@@ -4,27 +4,27 @@ import {
4
4
  CloudApi,
5
5
  CloudUpdates,
6
6
  PipelineSecrets
7
- } from "./index-e22zedc2.js";
7
+ } from "./index-5h888r6j.js";
8
8
  import {
9
- PkgExecutor
10
- } from "./index-wfmpxke3.js";
9
+ PkgExecutor2
10
+ } from "./index-dss3ds74.js";
11
11
  import {
12
12
  UpdatePackFolder,
13
13
  NativePublicEnv,
14
14
  NativeApp
15
- } from "./index-djc5nxpy.js";
15
+ } from "./index-w23tf30e.js";
16
16
  import {
17
17
  script
18
- } from "./index-386canwe.js";
18
+ } from "./index-9rv2zt48.js";
19
19
  import {
20
20
  ApplicationScript
21
- } from "./index-8nbx607g.js";
21
+ } from "./index-0hj82f9w.js";
22
22
  import {
23
23
  PackageScript
24
- } from "./index-65b6ms4c.js";
24
+ } from "./index-d3178asw.js";
25
25
  import {
26
26
  CloudRunner
27
- } from "./index-6h775rv3.js";
27
+ } from "./index-1jk52ffq.js";
28
28
 
29
29
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
30
30
  import { Logger } from "akanjs/common";
@@ -220,7 +220,7 @@ class CloudScript2 extends script("cloud", [CloudRunner, ApplicationScript, Pack
220
220
  } = {}) {
221
221
  const akanPkgs = await this.cloudRunner.getAkanPkgs(workspace);
222
222
  await this.packageScript.updateWorskpaceRootPackageJson(workspace);
223
- const pkgs = akanPkgs.map((pkgName) => PkgExecutor.from(workspace, pkgName));
223
+ const pkgs = akanPkgs.map((pkgName) => PkgExecutor2.from(workspace, pkgName));
224
224
  if (test) {
225
225
  const platformRun = platforms.length ? await this.cloudRunner.startPlatformTests(workspace, platforms, akanPkgs) : null;
226
226
  let localFailure = null;
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  ShellOnlyEnv
4
- } from "./index-yf9wc28h.js";
4
+ } from "./index-bejy9zyc.js";
5
5
 
6
6
  // pkgs/@akanjs/cli/npmRegistry.ts
7
7
  import { Logger } from "akanjs/common";
@@ -1,9 +1,9 @@
1
1
  // @bun
2
2
  import {
3
3
  AppInfo
4
- } from "./index-wfmpxke3.js";
4
+ } from "./index-qssq2d41.js";
5
5
 
6
- // pkgs/@akanjs/devkit/slicePlanner.ts
6
+ // pkgs/@akanjs/devkit/workspace/slicePlanner.ts
7
7
  class SlicePlanner {
8
8
  static memberDirs = ["apps", "libs", "pkgs"];
9
9
  static toolchainDependencies = [
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  akanCodePaths2
4
- } from "./index-35j83zkd.js";
4
+ } from "./index-p5zh7pmc.js";
5
5
  import {
6
6
  ConfigLock
7
7
  } from "./index-bqbf654f.js";
@@ -157,7 +157,7 @@ class SubagentPool2 {
157
157
  }
158
158
  }
159
159
  async#run(id, kind, prompt, signal) {
160
- const { CodeAgent } = await import("./CodeAgent-6cpjtj25.js");
160
+ const { CodeAgent } = await import("./CodeAgent-faqv7t4g.js");
161
161
  const budget = this.#options.parent.tools.subagent;
162
162
  const child = SubagentPool2.childOf(this.#options.parent, kind);
163
163
  const model = this.#options.model?.();