@akanjs/cli 3.3.0-rc.1 → 3.3.0-rc.3

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 (105) hide show
  1. package/.build-stamp +2 -2
  2. package/CodeAgent-0r05qa30.js +11 -0
  3. package/{CodeTui-zee8atsr.js → CodeTui-brryts78.js} +4 -4
  4. package/TunnelShare-dcx5j51j.js +16 -0
  5. package/{agent.command-x65f2ags.js → agent.command-xn4maemk.js} +20 -22
  6. package/akanCode.js +5 -5
  7. package/appExecutor-qt1nm242.js +11 -0
  8. package/{application.command-azbd1pb2.js → application.command-rv2n5bw8.js} +17 -19
  9. package/{applicationBuildRunner-trfxv3pd.js → applicationBuildRunner-ggkd5qgy.js} +16 -13
  10. package/buildBatch.proc.js +19 -18
  11. package/{cloud.command-gapp4634.js → cloud.command-hgnbps4n.js} +19 -24
  12. package/cloud.script-rzsnzjsg.js +30 -0
  13. package/{code.command-5smx61yf.js → code.command-9gfph3t3.js} +13 -13
  14. package/{context.command-ym5jbkny.js → context.command-dwhz1fwq.js} +20 -22
  15. package/context.runner-gh9rr71p.js +32 -0
  16. package/csrArtifactBuilder-zawt8knq.js +9 -0
  17. package/{index-2ny1e95c.js → dependencyScanner-93g8tk0r.js} +6 -5
  18. package/{fileSys-q22646yc.js → fileSys-e5mwt73x.js} +1 -1
  19. package/frameworkGraph-aneq2nwy.js +8 -0
  20. package/{guideline.command-zwypaqsh.js → guideline.command-v2daz21k.js} +8 -8
  21. package/guidelines/akanApi/akanApi.instruction.md +7 -2
  22. package/guidelines/conventions/core.md +6 -11
  23. package/guidelines/conventions/rules/app.md +1 -2
  24. package/guidelines/conventions/rules/auth.md +18 -27
  25. package/guidelines/conventions/rules/config.md +14 -46
  26. package/guidelines/conventions/rules/page.md +19 -34
  27. package/guidelines/conventions/rules/server.md +1 -4
  28. package/guidelines/conventions/rules/ssr.md +3 -4
  29. package/guidelines/conventions/rules/ts.md +2 -1
  30. package/guidelines/cssRule/cssRule.instruction.md +1 -0
  31. package/guidelines/pageRule/pageRule.instruction.md +6 -53
  32. package/incrementalBuilder.proc.js +24 -18
  33. package/{index-j6jjmn2r.js → index-0k64a38w.js} +62 -21
  34. package/{index-78y75t0a.js → index-0vtpxfx6.js} +6 -7
  35. package/{index-4ss4gkv3.js → index-0vv0a5h8.js} +2 -2
  36. package/{index-j0wr4e32.js → index-1v5eghaa.js} +9 -9
  37. package/{index-kfvjzk8r.js → index-2ktpwjgf.js} +3 -3
  38. package/{index-w1zexzpx.js → index-2t7jnfg5.js} +1 -1
  39. package/{index-p7beqww9.js → index-3fmzz9sf.js} +18 -18
  40. package/{index-8jtqfye2.js → index-58ck1gsm.js} +6 -6
  41. package/{index-0s7w2085.js → index-5cpjkfhk.js} +4 -4
  42. package/{index-71y6176j.js → index-609zbjve.js} +8 -8
  43. package/{index-9wh04mqy.js → index-66b1hrxh.js} +2 -2
  44. package/{index-gt8phqpt.js → index-6yefp97x.js} +4 -4
  45. package/{index-0dm25wvf.js → index-7ssr7wq4.js} +1 -1
  46. package/{index-612fdtbk.js → index-8fg1hvj5.js} +1 -1
  47. package/{index-41a03gkj.js → index-91bcfjej.js} +19 -19
  48. package/{index-275a4r3n.js → index-999e5kp4.js} +11 -15
  49. package/{index-s885g0jj.js → index-arcdcexp.js} +3 -3
  50. package/{index-jek2re5k.js → index-b3kjr19v.js} +4 -4
  51. package/{index-3txdtztz.js → index-bjg9thz8.js} +1 -1
  52. package/{index-baccvws5.js → index-bsew0a12.js} +1 -1
  53. package/{index-zfnz878d.js → index-c67vjafa.js} +1 -1
  54. package/{index-z92zm3wd.js → index-cfzqdsam.js} +29 -11
  55. package/{index-dadwp2aw.js → index-dy5reyet.js} +271 -39
  56. package/{index-67sd09ag.js → index-fqhr7j56.js} +8 -8
  57. package/{index-zmd9xxgd.js → index-g7hm77j6.js} +3 -3
  58. package/{index-h901f24n.js → index-ghs8gtvp.js} +5 -5
  59. package/{index-v7ajmsh3.js → index-h1k3zyyb.js} +1 -1
  60. package/{index-knpm8sdm.js → index-j3fqs8rc.js} +1 -1
  61. package/{index-6dzjer7p.js → index-jzwdwse0.js} +6 -6
  62. package/{index-2jmvfa62.js → index-m4s4tzjr.js} +3 -3
  63. package/{index-xwwex8rf.js → index-ndfxse05.js} +5 -5
  64. package/{index-z96ks033.js → index-rd669r6x.js} +153 -45
  65. package/{index-k6vwww45.js → index-rnhbh45p.js} +7 -7
  66. package/{index-ybcb9wc8.js → index-rwhdcnr8.js} +9 -9
  67. package/{index-a860mx0m.js → index-sn5cka91.js} +24 -24
  68. package/{index-ebn9kgea.js → index-v0gt5ryd.js} +18 -15
  69. package/{index-2yn3r67f.js → index-vznyyaf8.js} +6 -6
  70. package/{index-dmcpetwe.js → index-w18qdjyf.js} +98 -23
  71. package/{index-p5zh7pmc.js → index-xv3pvdw4.js} +1 -1
  72. package/{index-nc3br31y.js → index-yejf6fth.js} +2 -2
  73. package/{index-7wf8snar.js → index-zfmc4380.js} +1 -1
  74. package/{index-j592zfqc.js → index-zx3bv21b.js} +1 -1
  75. package/{index-by2tvsq6.js → index-zyjztrvc.js} +1 -1
  76. package/index.js +30 -28
  77. package/{libExecutor-jc6f8hm6.js → libExecutor-p21kkayq.js} +3 -3
  78. package/{library.command-nxvesvhb.js → library.command-m4gw18qq.js} +8 -8
  79. package/{localRegistry.command-xz62e4ng.js → localRegistry.command-3yq90wgp.js} +18 -23
  80. package/{module.command-aaws9byg.js → module.command-9vfdxapr.js} +10 -10
  81. package/{package.command-j7hv26p0.js → package.command-rt4y8xaf.js} +9 -12
  82. package/package.json +3 -2
  83. package/{page.command-7yffs7n9.js → page.command-4zc20rnv.js} +8 -8
  84. package/{pipeline.command-7yk0zcng.js → pipeline.command-4ekd9xgb.js} +7 -7
  85. package/{pkgExecutor-arxmvx4t.js → pkgExecutor-mh903rz9.js} +3 -3
  86. package/{primitive.command-7a1pt715.js → primitive.command-5g3xe4mf.js} +11 -11
  87. package/{projectTypecheck-f4qhbecd.js → projectTypecheck-bz6smek9.js} +1 -1
  88. package/{prompter-qyggfhqd.js → prompter-d33wmdpa.js} +2 -2
  89. package/{quality.command-c6mvrjh1.js → quality.command-zf8dyc9w.js} +9 -9
  90. package/{repair.command-093adzt9.js → repair.command-sx0eyq4w.js} +10 -10
  91. package/{scalar.command-2ex84spb.js → scalar.command-4bvzmbbh.js} +9 -9
  92. package/skills/akan-page/SKILL.md +18 -13
  93. package/skills/akan-runtime/SKILL.md +21 -16
  94. package/skills/akan-service/SKILL.md +2 -2
  95. package/{subspace.command-4n4n4jpv.js → subspace.command-cxyej1an.js} +11 -13
  96. package/{tunnel.command-f7ep1qfa.js → tunnel.command-gvnv36yf.js} +10 -12
  97. package/{verify.command-zrkxnvct.js → verify.command-yj2mngs0.js} +15 -17
  98. package/{workflow.command-ks16jegk.js → workflow.command-42p9g0w8.js} +15 -15
  99. package/{workspace.command-ahhfpaag.js → workspace.command-91wx03de.js} +34 -38
  100. package/CodeAgent-fx6088tv.js +0 -11
  101. package/TunnelShare-9ry4vh0y.js +0 -18
  102. package/appExecutor-79azsb2w.js +0 -11
  103. package/cloud.script-3b401efv.js +0 -35
  104. package/context.runner-kctbfsde.js +0 -34
  105. package/dependencyScanner-ge10gb52.js +0 -8
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  resolveSsrPageEntriesForApp
4
- } from "./index-z92zm3wd.js";
4
+ } from "./index-cfzqdsam.js";
5
5
  import {
6
6
  createBarrelImportsPlugin,
7
7
  workspaceBarrels,
@@ -10,7 +10,7 @@ import {
10
10
  CsrEntryFiles,
11
11
  PagesEntrySourceGenerator,
12
12
  PagesBundleBuilder
13
- } from "./index-9wh04mqy.js";
13
+ } from "./index-66b1hrxh.js";
14
14
 
15
15
  // pkgs/@akanjs/devkit/frontendBuild/csrArtifactBuilder.ts
16
16
  import { mkdir as mkdir2, rm as rm2, unlink as unlink2 } from "fs/promises";
@@ -236,7 +236,7 @@ class McpAppViewBuilder {
236
236
  ...options,
237
237
  plugins: [
238
238
  ...options.plugins,
239
- await CsrArtifactBuilder.barrelImportsPlugin(this.#app, McpAppPageTrimmer.pipe(pagePaths)),
239
+ await CsrArtifactBuilder2.barrelImportsPlugin(this.#app, McpAppPageTrimmer.pipe(pagePaths)),
240
240
  PureLazyMarker.plugin()
241
241
  ],
242
242
  entrypoints: views.map((view) => path3.join(generatedDir, `${view.name}.html`)),
@@ -365,12 +365,12 @@ ${importsOf(view.rootOverrides, "rootOverride")}${importsOf(view.overrides, "ove
365
365
  if (cssAsset) {
366
366
  const artifactDir = path3.join(this.#command === "build" ? this.#app.dist.cwdPath : this.#app.cwdPath, ".akan", "artifact");
367
367
  const css = await Bun.file(path3.join(artifactDir, cssAsset.cssRelPath)).text();
368
- html = CsrArtifactBuilder.injectBeforeHeadEnd(html, CsrArtifactBuilder.createInlineStyle(css));
368
+ html = CsrArtifactBuilder2.injectBeforeHeadEnd(html, CsrArtifactBuilder2.createInlineStyle(css));
369
369
  } else
370
370
  this.#app.logger.warn(`[mcp-app-build] no compiled stylesheet for ${view.name}; its view ships without CSS`);
371
371
  const scripts = [];
372
- html = await CsrArtifactBuilder.replaceModuleScriptSrc(html, async (src) => {
373
- const jsPath = CsrArtifactBuilder.resolveHtmlAssetPath(htmlPath, src);
372
+ html = await CsrArtifactBuilder2.replaceModuleScriptSrc(html, async (src) => {
373
+ const jsPath = CsrArtifactBuilder2.resolveHtmlAssetPath(htmlPath, src);
374
374
  scripts.push(jsPath);
375
375
  return await Bun.file(jsPath).text();
376
376
  });
@@ -383,7 +383,7 @@ ${importsOf(view.rootOverrides, "rootOverride")}${importsOf(view.overrides, "ove
383
383
  }
384
384
 
385
385
  // pkgs/@akanjs/devkit/frontendBuild/csrArtifactBuilder.ts
386
- class CsrArtifactBuilder {
386
+ class CsrArtifactBuilder2 {
387
387
  #app;
388
388
  #command;
389
389
  #lang;
@@ -409,13 +409,13 @@ class CsrArtifactBuilder {
409
409
  await mkdir2(this.#generatedDir, { recursive: true });
410
410
  const generatedFiles = Object.fromEntries((await Promise.all(htmlBasePaths.map(async (basePath) => [
411
411
  this.#createHtmlFile(basePath),
412
- await this.#createEntryFile(basePath, CsrArtifactBuilder.pageEntriesForBasePath(pageEntries, basePath, basePaths))
412
+ await this.#createEntryFile(basePath, CsrArtifactBuilder2.pageEntriesForBasePath(pageEntries, basePath, basePaths))
413
413
  ]))).flat());
414
- const options = CsrArtifactBuilder.bundleOptions(this.#app, this.#command, akanConfig.optimizeImports);
414
+ const options = CsrArtifactBuilder2.bundleOptions(this.#app, this.#command, akanConfig.optimizeImports);
415
415
  const result = await Bun.build({
416
416
  ...options,
417
- plugins: [...options.plugins, await CsrArtifactBuilder.barrelImportsPlugin(this.#app)],
418
- entrypoints: htmlBasePaths.map((basePath) => this.#generatedPath(CsrArtifactBuilder.htmlFilename(basePath))),
417
+ plugins: [...options.plugins, await CsrArtifactBuilder2.barrelImportsPlugin(this.#app)],
418
+ entrypoints: htmlBasePaths.map((basePath) => this.#generatedPath(CsrArtifactBuilder2.htmlFilename(basePath))),
419
419
  files: generatedFiles,
420
420
  root: this.#generatedDir,
421
421
  outdir: this.#outputDir
@@ -429,7 +429,7 @@ ${logs}` : ""}`);
429
429
  await this.#inlineCsrArtifacts(cssAssets);
430
430
  await this.#buildMcpAppViews(pageEntries, { basePaths, cssAssets, options });
431
431
  if (this.#command === "build")
432
- await CsrArtifactBuilder.writePublicEnv(this.#app, options.define);
432
+ await CsrArtifactBuilder2.writePublicEnv(this.#app, options.define);
433
433
  this.#app.verbose(`[csr-build] output -> ${this.#outputDir}`);
434
434
  return { outputDir: this.#outputDir };
435
435
  }
@@ -442,7 +442,7 @@ ${logs}` : ""}`);
442
442
  return await this.#buildMcpAppViews(pageEntries, {
443
443
  basePaths: [...akanConfig.basePaths],
444
444
  cssAssets: await this.#loadCssAssets(),
445
- options: CsrArtifactBuilder.bundleOptions(this.#app, this.#command, akanConfig.optimizeImports)
445
+ options: CsrArtifactBuilder2.bundleOptions(this.#app, this.#command, akanConfig.optimizeImports)
446
446
  });
447
447
  }
448
448
  async#buildMcpAppViews(pageEntries, option) {
@@ -472,7 +472,7 @@ ${logs}` : ""}`);
472
472
  static async writePublicEnv(app, define) {
473
473
  const prefix = "process.env.";
474
474
  const publicEnv = Object.fromEntries(Object.entries(define).filter(([key]) => key.startsWith(`${prefix}AKAN_PUBLIC_`)).map(([key, value]) => [key.slice(prefix.length), JSON.parse(value)]));
475
- await Bun.write(CsrArtifactBuilder.publicEnvPath(app), `${JSON.stringify(publicEnv, null, 2)}
475
+ await Bun.write(CsrArtifactBuilder2.publicEnvPath(app), `${JSON.stringify(publicEnv, null, 2)}
476
476
  `);
477
477
  }
478
478
  static pageEntriesForBasePath(pageEntries, basePath, basePaths) {
@@ -502,7 +502,7 @@ ${logs}` : ""}`);
502
502
  }
503
503
  async#createEntryFile(basePath, pageEntries) {
504
504
  return [
505
- this.#generatedPath(CsrArtifactBuilder.entryFilename(basePath)),
505
+ this.#generatedPath(CsrArtifactBuilder2.entryFilename(basePath)),
506
506
  `import { bootCsr } from "akanjs/webkit";
507
507
  ${await PagesEntrySourceGenerator.generateStatic(pageEntries)}
508
508
  void bootCsr(pages);
@@ -511,7 +511,7 @@ void bootCsr(pages);
511
511
  }
512
512
  #createHtmlFile(basePath) {
513
513
  return [
514
- this.#generatedPath(CsrArtifactBuilder.htmlFilename(basePath)),
514
+ this.#generatedPath(CsrArtifactBuilder2.htmlFilename(basePath)),
515
515
  `<!doctype html>
516
516
  <html lang="${this.#lang}">
517
517
  <head>
@@ -522,7 +522,7 @@ void bootCsr(pages);
522
522
  </head>
523
523
  <body>
524
524
  <div id="root"></div>
525
- <script type="module" src="./${CsrArtifactBuilder.entryFilename(basePath)}"></script>
525
+ <script type="module" src="./${CsrArtifactBuilder2.entryFilename(basePath)}"></script>
526
526
  </body>
527
527
  </html>
528
528
  `
@@ -543,7 +543,7 @@ void bootCsr(pages);
543
543
  const htmlFile = Bun.file(htmlPath);
544
544
  if (!await htmlFile.exists())
545
545
  continue;
546
- const basePath = CsrArtifactBuilder.basePathOfHtml(htmlPath);
546
+ const basePath = CsrArtifactBuilder2.basePathOfHtml(htmlPath);
547
547
  const cssAsset = cssAssets[basePath];
548
548
  if (!cssAsset) {
549
549
  this.#app.logger.warn(`[csr-build] base-artifact.json has no compiled stylesheet for ${basePath || "root"}; ${path4.basename(htmlPath)} ships without CSS`);
@@ -568,11 +568,11 @@ ${remainingAssets.join(`
568
568
  let next = html;
569
569
  if (cssAsset) {
570
570
  const css = await Bun.file(path4.join(this.#artifactDir, cssAsset.cssRelPath)).text();
571
- next = CsrArtifactBuilder.injectBeforeHeadEnd(next, CsrArtifactBuilder.createInlineStyle(css));
571
+ next = CsrArtifactBuilder2.injectBeforeHeadEnd(next, CsrArtifactBuilder2.createInlineStyle(css));
572
572
  }
573
573
  const jsFiles = [];
574
- next = await CsrArtifactBuilder.replaceModuleScriptSrc(next, async (src) => {
575
- const jsPath = CsrArtifactBuilder.resolveHtmlAssetPath(htmlPath, src);
574
+ next = await CsrArtifactBuilder2.replaceModuleScriptSrc(next, async (src) => {
575
+ const jsPath = CsrArtifactBuilder2.resolveHtmlAssetPath(htmlPath, src);
576
576
  jsFiles.push(jsPath);
577
577
  return await Bun.file(jsPath).text();
578
578
  });
@@ -588,7 +588,7 @@ ${remainingAssets.join(`
588
588
  return files.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
589
589
  }
590
590
  static injectBeforeHeadEnd(html, snippet) {
591
- const scannable = CsrArtifactBuilder.blankEmbeddedContent(html);
591
+ const scannable = CsrArtifactBuilder2.blankEmbeddedContent(html);
592
592
  const headEnd = scannable.search(/<\/head\s*>/i);
593
593
  if (headEnd !== -1)
594
594
  return `${html.slice(0, headEnd)}${snippet}
@@ -621,7 +621,7 @@ ${css.replace(/<\/style/gi, "<\\/style")}
621
621
  matched = true;
622
622
  result += html.slice(lastIndex, match.index);
623
623
  result += `<script type="module">
624
- ${CsrArtifactBuilder.escapeInlineScript(await loadScript(src))}
624
+ ${CsrArtifactBuilder2.escapeInlineScript(await loadScript(src))}
625
625
  </script>`;
626
626
  lastIndex = match.index + full.length;
627
627
  }
@@ -641,4 +641,4 @@ ${CsrArtifactBuilder.escapeInlineScript(await loadScript(src))}
641
641
  }
642
642
  }
643
643
 
644
- export { CsrArtifactBuilder };
644
+ export { CsrArtifactBuilder2 };
@@ -5,17 +5,14 @@ import {
5
5
  WorkspaceExecutor,
6
6
  ServerEnvProfile,
7
7
  AkanAppConfig
8
- } from "./index-71y6176j.js";
8
+ } from "./index-609zbjve.js";
9
9
  import {
10
10
  resolveAppId,
11
11
  targetHtmlFilename
12
12
  } from "./index-m9jj544v.js";
13
- import {
14
- CsrArtifactBuilder
15
- } from "./index-a860mx0m.js";
16
13
  import {
17
14
  ExitCodeError
18
- } from "./index-2yn3r67f.js";
15
+ } from "./index-vznyyaf8.js";
19
16
 
20
17
  // pkgs/@akanjs/devkit/mobile/desktopBin.ts
21
18
  import { chmod, mkdir, rename, rm, writeFile } from "fs/promises";
@@ -865,16 +862,7 @@ class NativeConfig {
865
862
  const native = NativeConfig.#compact({ ios, macos, android, resources });
866
863
  const googleServices = target.android?.googleServices;
867
864
  const pushAndroid = target.android?.push;
868
- const desktop = NativeConfig.#compact({
869
- recovery: target.desktop?.recovery,
870
- screenCapture: target.desktop?.screenCapture,
871
- webview2: target.desktop?.webview2,
872
- publisher: target.desktop?.publisher,
873
- window: NativeConfig.#compact({ ...target.desktop?.window }),
874
- server: desktopServer,
875
- bin: desktopBin,
876
- dmg: NativeConfig.#dmg(target.desktop?.dmg, abs)
877
- });
865
+ const desktop = NativeConfig.#desktop(target.desktop, desktopServer, desktopBin, abs);
878
866
  const background = target.backgroundColor;
879
867
  const shell = NativeConfig.#compact({
880
868
  backgroundColor: typeof background === "string" ? background : background?.light,
@@ -911,6 +899,7 @@ class NativeConfig {
911
899
  }
912
900
  } : {},
913
901
  ...target.ios?.privacy ? { privacy: target.ios.privacy } : {},
902
+ ...target.ios?.hideFormAccessoryBar ? { ios: { hideFormAccessoryBar: true } } : {},
914
903
  android: {
915
904
  debugAppIdSuffix: ".debug",
916
905
  ...googleServices ? { googleServices: abs(googleServices) } : {},
@@ -982,6 +971,18 @@ class NativeConfig {
982
971
  return { image: abs(splash) };
983
972
  return { ...splash, ...splash.image ? { image: abs(splash.image) } : {} };
984
973
  }
974
+ static #desktop(desktop, server, bin, abs) {
975
+ return NativeConfig.#compact({
976
+ recovery: desktop?.recovery,
977
+ screenCapture: desktop?.screenCapture,
978
+ webview2: desktop?.webview2,
979
+ publisher: desktop?.publisher,
980
+ window: NativeConfig.#compact({ ...desktop?.window }),
981
+ server,
982
+ bin,
983
+ dmg: NativeConfig.#dmg(desktop?.dmg, abs)
984
+ });
985
+ }
985
986
  static #dmg(dmg, abs) {
986
987
  if (!dmg)
987
988
  return;
@@ -1126,12 +1127,14 @@ class NativePublicEnv {
1126
1127
  return [...new Set([...Object.keys(a), ...Object.keys(b)])].filter((key) => a[key] !== b[key]).sort((x, y) => x < y ? -1 : x > y ? 1 : 0);
1127
1128
  }
1128
1129
  static async built(app) {
1130
+ const { CsrArtifactBuilder } = await import("./csrArtifactBuilder-zawt8knq.js");
1129
1131
  const file = Bun.file(CsrArtifactBuilder.publicEnvPath(app));
1130
1132
  if (!await file.exists())
1131
1133
  return null;
1132
1134
  return NativePublicEnv.of(await file.json());
1133
1135
  }
1134
1136
  static async inlined(app) {
1137
+ const { CsrArtifactBuilder } = await import("./csrArtifactBuilder-zawt8knq.js");
1135
1138
  const file = Bun.file(CsrArtifactBuilder.publicEnvPath(app));
1136
1139
  const env = await file.exists() ? await file.json() : process.env;
1137
1140
  return Object.fromEntries(Object.entries(env).flatMap(([key, value]) => key.startsWith("AKAN_PUBLIC_") && typeof value === "string" ? [[key, value]] : []));
@@ -5,24 +5,24 @@ import {
5
5
  import {
6
6
  Executor,
7
7
  WorkspaceExecutor
8
- } from "./index-71y6176j.js";
8
+ } from "./index-609zbjve.js";
9
9
  import {
10
10
  getDirname2,
11
11
  FileSys2
12
- } from "./index-by2tvsq6.js";
12
+ } from "./index-zyjztrvc.js";
13
13
  import {
14
14
  AppExecutor2
15
- } from "./index-z92zm3wd.js";
15
+ } from "./index-cfzqdsam.js";
16
16
  import {
17
17
  LibExecutor2
18
- } from "./index-zfnz878d.js";
18
+ } from "./index-c67vjafa.js";
19
19
  import {
20
20
  PkgExecutor2
21
- } from "./index-w1zexzpx.js";
21
+ } from "./index-2t7jnfg5.js";
22
22
  import {
23
23
  ModuleExecutor,
24
24
  ErrorReport
25
- } from "./index-7wf8snar.js";
25
+ } from "./index-zfmc4380.js";
26
26
 
27
27
  // pkgs/@akanjs/devkit/commandDecorators/camelToKebabCase.ts
28
28
  var camelToKebabCase = (str) => str.replace(/([A-Z])/g, "-$1").toLowerCase();
@@ -1,10 +1,14 @@
1
1
  // @bun
2
2
  import {
3
- ErrorReport
4
- } from "./index-7wf8snar.js";
3
+ FileSys2
4
+ } from "./index-zyjztrvc.js";
5
+ import {
6
+ JsonFormatter,
7
+ AkanAppConfig
8
+ } from "./index-609zbjve.js";
5
9
  import {
6
- JsonFormatter
7
- } from "./index-71y6176j.js";
10
+ ErrorReport
11
+ } from "./index-zfmc4380.js";
8
12
 
9
13
  // pkgs/@akanjs/devkit/app/applicationBuildReporter.ts
10
14
  import { Logger } from "akanjs/common";
@@ -14,14 +18,28 @@ import path4 from "path";
14
18
  import { toError } from "akanjs/common";
15
19
 
16
20
  // pkgs/@akanjs/devkit/frontendBuild/fontPruner.ts
17
- import { rm, rmdir, stat as stat2 } from "fs/promises";
21
+ import { rm as rm2, rmdir, stat as stat2 } from "fs/promises";
18
22
  import path2 from "path";
19
23
  import { isFontOptimizationEnabled } from "akanjs/client";
20
24
 
21
25
  // pkgs/@akanjs/devkit/frontendBuild/fontOptimizer.ts
22
- import { mkdir, stat } from "fs/promises";
26
+ import { mkdir, readdir, rm, stat } from "fs/promises";
23
27
  import path from "path";
24
28
  import ts from "typescript";
29
+
30
+ // pkgs/@akanjs/devkit/frontendBuild/buildCacheStamp.ts
31
+ import { statSync } from "fs";
32
+ var buildCacheStamp = (producers) => ({
33
+ akanjs: AkanAppConfig.akanVersion,
34
+ bun: `${Bun.version}+${Bun.revision}`,
35
+ code: producers.map((file) => {
36
+ const stats = statSync(file, { throwIfNoEntry: false });
37
+ return stats ? `${stats.mtimeMs}:${stats.size}` : "missing";
38
+ }).join(",")
39
+ });
40
+ var isBuildCacheStamp = (value, stamp) => value?.akanjs === stamp.akanjs && value.bun === stamp.bun && value.code === stamp.code;
41
+
42
+ // pkgs/@akanjs/devkit/frontendBuild/fontOptimizer.ts
25
43
  var FONT_URL_PREFIX = "/_akan/fonts";
26
44
  var DEFAULT_FONT_SUBSETS = ["latin"];
27
45
 
@@ -29,15 +47,18 @@ class FontOptimizer {
29
47
  #app;
30
48
  #command;
31
49
  #artifactRoot;
50
+ #cacheRoot;
51
+ #stamp = buildCacheStamp([import.meta.path]);
32
52
  #files = [];
33
53
  #cssParts = [];
34
54
  #woff2Ready = null;
35
55
  static #ksX1001Text = null;
36
- static #cacheVersion = 3;
56
+ static #cacheVersion = 4;
37
57
  constructor(app, command = "start") {
38
58
  this.#app = app;
39
59
  this.#command = command;
40
60
  this.#artifactRoot = path.join(command === "build" ? app.dist.cwdPath : app.cwdPath, ".akan/artifact");
61
+ this.#cacheRoot = command === "build" ? this.#artifactRoot : path.join(app.cwdPath, ".akan/cache");
41
62
  }
42
63
  async optimize() {
43
64
  const fonts = await this.discoverFonts();
@@ -58,11 +79,13 @@ class FontOptimizer {
58
79
  const result = { css: this.#cssParts.join(`
59
80
  `), fonts, files: this.#files };
60
81
  if (cacheKey)
61
- await this.#writeCache(cacheKey, result);
82
+ await this.#writeCache(cacheKey, result).catch(() => {
83
+ return;
84
+ });
62
85
  return result;
63
86
  }
64
87
  get #cachePath() {
65
- return path.join(this.#artifactRoot, "fontCache.json");
88
+ return path.join(this.#cacheRoot, "fontCache.json");
66
89
  }
67
90
  async#buildCacheKey(fonts) {
68
91
  const sources = [];
@@ -71,10 +94,10 @@ class FontOptimizer {
71
94
  continue;
72
95
  for (const face of this.#getFontFaces(font)) {
73
96
  const sourcePath = await this.#resolveFontSourcePath(face.src);
74
- const stamp = sourcePath ? await this.#fileStamp(sourcePath) : null;
75
- if (!stamp)
97
+ const digest = sourcePath ? await this.#fileDigest(sourcePath) : null;
98
+ if (!digest)
76
99
  return null;
77
- sources.push({ optimizedSrc: face.optimizedSrc, ...stamp });
100
+ sources.push({ optimizedSrc: face.optimizedSrc, sourcePath, ...digest });
78
101
  }
79
102
  for (const filePath of font.subsetFiles ?? []) {
80
103
  const abs = path.isAbsolute(filePath) ? filePath : path.join(this.#app.cwdPath, filePath);
@@ -86,11 +109,30 @@ class FontOptimizer {
86
109
  if (this.#getFontSubsets(font).includes("auto"))
87
110
  sources.push({ autoSubsetText: this.#cacheDigest(await this.#collectAutoSubsetText()) });
88
111
  }
89
- return this.#cacheDigest({ version: FontOptimizer.#cacheVersion, fonts, sources });
112
+ const lockfile = await this.#lockfileDigest();
113
+ return this.#cacheDigest({
114
+ version: FontOptimizer.#cacheVersion,
115
+ command: this.#command,
116
+ lockfile,
117
+ fonts,
118
+ sources
119
+ });
120
+ }
121
+ async#lockfileDigest() {
122
+ const root = this.#app.workspace.workspaceRoot;
123
+ const lockfiles = await Promise.all(["bun.lock", "bun.lockb"].map((name) => Bun.file(path.join(root, name)).bytes().catch(() => null)));
124
+ return lockfiles.map((bytes) => bytes ? this.#sha256(bytes) : null);
125
+ }
126
+ #sha256(bytes) {
127
+ return new Bun.CryptoHasher("sha256").update(bytes).digest("hex");
90
128
  }
91
129
  #cacheDigest(value) {
92
130
  return new Bun.CryptoHasher("sha256").update(this.#stableStringify(value)).digest("hex");
93
131
  }
132
+ async#fileDigest(filePath) {
133
+ const bytes = await Bun.file(filePath).bytes().catch(() => null);
134
+ return bytes ? { size: bytes.byteLength, sha256: this.#sha256(bytes) } : null;
135
+ }
94
136
  async#fileStamp(filePath) {
95
137
  try {
96
138
  const stats = await stat(filePath);
@@ -101,23 +143,56 @@ class FontOptimizer {
101
143
  }
102
144
  async#readCache(key) {
103
145
  const cache = await Bun.file(this.#cachePath).json().catch(() => null);
104
- if (cache?.version !== FontOptimizer.#cacheVersion || cache.key !== key)
146
+ if (cache?.version !== FontOptimizer.#cacheVersion || cache.key !== key || typeof cache.css !== "string")
147
+ return null;
148
+ if (!isBuildCacheStamp(cache, this.#stamp) || !Array.isArray(cache.files))
105
149
  return null;
106
- const files = cache.files.map((relativePath) => path.join(this.#artifactRoot, relativePath));
107
- for (const filePath of files) {
108
- if (!await Bun.file(filePath).exists())
150
+ const files = [];
151
+ for (const file of cache.files) {
152
+ const bytes = await this.#readIntact(this.#cacheRoot, file);
153
+ if (!bytes)
109
154
  return null;
155
+ if (this.#cacheRoot !== this.#artifactRoot && !await this.#readIntact(this.#artifactRoot, file))
156
+ await Bun.write(path.join(this.#artifactRoot, file.path), bytes);
157
+ files.push(path.join(this.#artifactRoot, file.path));
110
158
  }
111
159
  return { css: cache.css, files };
112
160
  }
161
+ async#readIntact(root, file) {
162
+ if (typeof file?.path !== "string" || typeof file.size !== "number")
163
+ return null;
164
+ const bytes = await Bun.file(path.join(root, file.path)).bytes().catch(() => null);
165
+ if (!bytes || bytes.byteLength !== file.size || this.#sha256(bytes) !== file.sha256)
166
+ return null;
167
+ return bytes;
168
+ }
113
169
  async#writeCache(key, result) {
170
+ const files = [];
171
+ for (const filePath of result.files) {
172
+ const bytes = await Bun.file(filePath).bytes();
173
+ const relativePath = path.relative(this.#artifactRoot, filePath);
174
+ const cachedPath = path.join(this.#cacheRoot, relativePath);
175
+ if (cachedPath !== filePath)
176
+ await FileSys2.writeTextAtomic(cachedPath, bytes);
177
+ files.push({ path: relativePath, size: bytes.byteLength, sha256: this.#sha256(bytes) });
178
+ }
114
179
  const cache = {
115
180
  version: FontOptimizer.#cacheVersion,
181
+ ...this.#stamp,
116
182
  key,
117
183
  css: result.css,
118
- files: result.files.map((filePath) => path.relative(this.#artifactRoot, filePath))
184
+ files
119
185
  };
120
- await Bun.write(this.#cachePath, JSON.stringify(cache));
186
+ await FileSys2.writeTextAtomic(this.#cachePath, JSON.stringify(cache));
187
+ await this.#pruneCachedFonts(files);
188
+ }
189
+ async#pruneCachedFonts(kept) {
190
+ if (this.#cacheRoot === this.#artifactRoot)
191
+ return;
192
+ const dir = path.join(this.#cacheRoot, FONT_URL_PREFIX.replace(/^\/_akan\//, ""));
193
+ const keep = new Set(kept.map((file) => path.join(this.#cacheRoot, file.path)));
194
+ const names = await readdir(dir).catch(() => []);
195
+ await Promise.all(names.filter((name) => !name.endsWith(".tmp")).map((name) => path.join(dir, name)).filter((filePath) => !keep.has(filePath)).map((filePath) => rm(filePath, { force: true })));
121
196
  }
122
197
  async discoverFonts() {
123
198
  const pageKeys = await this.#app.getPageKeys();
@@ -620,7 +695,7 @@ class FontPruner {
620
695
  }
621
696
  }
622
697
  async#remove(files) {
623
- await Promise.all(files.map((file) => rm(path2.join(this.#publicRoot, file), { force: true })));
698
+ await Promise.all(files.map((file) => rm2(path2.join(this.#publicRoot, file), { force: true })));
624
699
  const dirs = [...new Set(files.map((file) => path2.posix.dirname(file)))].filter((dir) => dir !== "." && dir !== "/").sort((a, b) => b.length - a.length);
625
700
  for (const dir of dirs)
626
701
  await rmdir(path2.join(this.#publicRoot, dir)).catch(() => {
@@ -1244,7 +1319,7 @@ class HmrChangeClassifier {
1244
1319
  }
1245
1320
 
1246
1321
  // pkgs/@akanjs/devkit/frontendBuild/sourceMtimeIndex.ts
1247
- import { readdir, stat as stat3 } from "fs/promises";
1322
+ import { readdir as readdir2, stat as stat3 } from "fs/promises";
1248
1323
  import path7 from "path";
1249
1324
  var UNREADABLE = Number.NaN;
1250
1325
 
@@ -1465,7 +1540,7 @@ class SourceMtimeIndex {
1465
1540
  }
1466
1541
  static async#readdirPath(dir) {
1467
1542
  try {
1468
- return { entries: await readdir(dir, { withFileTypes: true }), err: null };
1543
+ return { entries: await readdir2(dir, { withFileTypes: true }), err: null };
1469
1544
  } catch (err) {
1470
1545
  return { entries: null, err };
1471
1546
  }
@@ -1773,4 +1848,4 @@ class WatchRootResolver {
1773
1848
  }
1774
1849
  }
1775
1850
 
1776
- 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, precompressArtifacts, RouteJsBudget, ApplicationBuildReporter };
1851
+ 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, buildCacheStamp, isBuildCacheStamp, FontOptimizer, FontPruner, precompressArtifacts, RouteJsBudget, ApplicationBuildReporter };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  FileSys2
4
- } from "./index-by2tvsq6.js";
4
+ } from "./index-zyjztrvc.js";
5
5
  import {
6
6
  ShellOnlyEnv
7
7
  } from "./index-bejy9zyc.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  akanCodePaths2
4
- } from "./index-p5zh7pmc.js";
4
+ } from "./index-xv3pvdw4.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-fx6088tv.js");
160
+ const { CodeAgent } = await import("./CodeAgent-0r05qa30.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?.();
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  execEmoji,
4
4
  Executor
5
- } from "./index-71y6176j.js";
5
+ } from "./index-609zbjve.js";
6
6
  // pkgs/@akanjs/devkit/executors/moduleExecutor.ts
7
7
  class ModuleExecutor extends Executor {
8
8
  sys;
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  AppInfo
4
- } from "./index-71y6176j.js";
4
+ } from "./index-609zbjve.js";
5
5
 
6
6
  // pkgs/@akanjs/devkit/workspace/slicePlanner.ts
7
7
  class SlicePlanner {
@@ -39,7 +39,7 @@ class FileSys2 {
39
39
  return await Bun.file(path).write(content);
40
40
  }
41
41
  static async writeTextAtomic(filePath, content) {
42
- const temp = `${filePath}.${process.pid}.${Date.now().toString(36)}.tmp`;
42
+ const temp = `${filePath}.${process.pid}.${crypto.randomUUID()}.tmp`;
43
43
  try {
44
44
  await Bun.write(temp, content);
45
45
  await FileSys2.replace(temp, filePath);
package/index.js CHANGED
@@ -4,14 +4,14 @@ import {
4
4
  getTargetMetas,
5
5
  getTargetCommandNames,
6
6
  runCommands
7
- } from "./index-2yn3r67f.js";
7
+ } from "./index-vznyyaf8.js";
8
8
  import"./index-j4yvgfhr.js";
9
- import"./index-71y6176j.js";
10
- import"./index-by2tvsq6.js";
11
- import"./index-z92zm3wd.js";
12
- import"./index-zfnz878d.js";
13
- import"./index-w1zexzpx.js";
14
- import"./index-7wf8snar.js";
9
+ import"./index-609zbjve.js";
10
+ import"./index-zyjztrvc.js";
11
+ import"./index-cfzqdsam.js";
12
+ import"./index-c67vjafa.js";
13
+ import"./index-2t7jnfg5.js";
14
+ import"./index-zfmc4380.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/bunVersionGuard.ts
17
17
  class BunVersionGuard {
@@ -27,27 +27,27 @@ import path from "path";
27
27
 
28
28
  // pkgs/@akanjs/cli/commandModules.ts
29
29
  var commandModules = {
30
- workspace: async () => (await import("./workspace.command-ahhfpaag.js")).WorkspaceCommand,
31
- agent: async () => (await import("./agent.command-x65f2ags.js")).AgentCommand,
32
- code: async () => (await import("./code.command-5smx61yf.js")).CodeCommand,
33
- application: async () => (await import("./application.command-azbd1pb2.js")).ApplicationCommand,
34
- library: async () => (await import("./library.command-nxvesvhb.js")).LibraryCommand,
35
- localRegistry: async () => (await import("./localRegistry.command-xz62e4ng.js")).LocalRegistryCommand,
36
- package: async () => (await import("./package.command-j7hv26p0.js")).PackageCommand,
37
- module: async () => (await import("./module.command-aaws9byg.js")).ModuleCommand,
38
- page: async () => (await import("./page.command-7yffs7n9.js")).PageCommand,
39
- context: async () => (await import("./context.command-ym5jbkny.js")).ContextCommand,
40
- cloud: async () => (await import("./cloud.command-gapp4634.js")).CloudCommand,
41
- subspace: async () => (await import("./subspace.command-4n4n4jpv.js")).SubspaceCommand,
42
- guideline: async () => (await import("./guideline.command-zwypaqsh.js")).GuidelineCommand,
43
- scalar: async () => (await import("./scalar.command-2ex84spb.js")).ScalarCommand,
44
- primitive: async () => (await import("./primitive.command-7a1pt715.js")).PrimitiveCommand,
45
- quality: async () => (await import("./quality.command-c6mvrjh1.js")).QualityCommand,
46
- verify: async () => (await import("./verify.command-zrkxnvct.js")).VerifyCommand,
47
- repair: async () => (await import("./repair.command-093adzt9.js")).RepairCommand,
48
- workflow: async () => (await import("./workflow.command-ks16jegk.js")).WorkflowCommand,
49
- pipeline: async () => (await import("./pipeline.command-7yk0zcng.js")).PipelineCommand,
50
- tunnel: async () => (await import("./tunnel.command-f7ep1qfa.js")).TunnelCommand
30
+ workspace: async () => (await import("./workspace.command-91wx03de.js")).WorkspaceCommand,
31
+ agent: async () => (await import("./agent.command-xn4maemk.js")).AgentCommand,
32
+ code: async () => (await import("./code.command-9gfph3t3.js")).CodeCommand,
33
+ application: async () => (await import("./application.command-rv2n5bw8.js")).ApplicationCommand,
34
+ library: async () => (await import("./library.command-m4gw18qq.js")).LibraryCommand,
35
+ localRegistry: async () => (await import("./localRegistry.command-3yq90wgp.js")).LocalRegistryCommand,
36
+ package: async () => (await import("./package.command-rt4y8xaf.js")).PackageCommand,
37
+ module: async () => (await import("./module.command-9vfdxapr.js")).ModuleCommand,
38
+ page: async () => (await import("./page.command-4zc20rnv.js")).PageCommand,
39
+ context: async () => (await import("./context.command-dwhz1fwq.js")).ContextCommand,
40
+ cloud: async () => (await import("./cloud.command-hgnbps4n.js")).CloudCommand,
41
+ subspace: async () => (await import("./subspace.command-cxyej1an.js")).SubspaceCommand,
42
+ guideline: async () => (await import("./guideline.command-v2daz21k.js")).GuidelineCommand,
43
+ scalar: async () => (await import("./scalar.command-4bvzmbbh.js")).ScalarCommand,
44
+ primitive: async () => (await import("./primitive.command-5g3xe4mf.js")).PrimitiveCommand,
45
+ quality: async () => (await import("./quality.command-zf8dyc9w.js")).QualityCommand,
46
+ verify: async () => (await import("./verify.command-yj2mngs0.js")).VerifyCommand,
47
+ repair: async () => (await import("./repair.command-sx0eyq4w.js")).RepairCommand,
48
+ workflow: async () => (await import("./workflow.command-42p9g0w8.js")).WorkflowCommand,
49
+ pipeline: async () => (await import("./pipeline.command-4ekd9xgb.js")).PipelineCommand,
50
+ tunnel: async () => (await import("./tunnel.command-gvnv36yf.js")).TunnelCommand
51
51
  };
52
52
  var commandModuleIds = Object.keys(commandModules);
53
53
 
@@ -75,6 +75,8 @@ class CommandManifest {
75
75
  }
76
76
  static resolve(manifest, argv) {
77
77
  const requested = argv[2];
78
+ if (requested === "--version" || requested === "-V")
79
+ return [];
78
80
  if (!manifest || !requested || requested.startsWith("-"))
79
81
  return null;
80
82
  const id = manifest.byCommand[requested];
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  LibExecutor2
4
- } from "./index-zfnz878d.js";
5
- import"./index-71y6176j.js";
4
+ } from "./index-c67vjafa.js";
5
+ import"./index-609zbjve.js";
6
6
  import"./index-j4yvgfhr.js";
7
- import"./index-by2tvsq6.js";
7
+ import"./index-zyjztrvc.js";
8
8
  export {
9
9
  LibExecutor2 as LibExecutor
10
10
  };