@akanjs/cli 3.2.0-rc.9 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/.build-stamp +2 -2
  2. package/CodeAgent-fx6088tv.js +11 -0
  3. package/{CodeTui-qstk5vpj.js → CodeTui-zee8atsr.js} +822 -666
  4. package/README.ko.md +7 -0
  5. package/README.md +7 -0
  6. package/TunnelShare-9ry4vh0y.js +18 -0
  7. package/agent.command-x65f2ags.js +61 -0
  8. package/akanCode.js +12 -12
  9. package/appExecutor-79azsb2w.js +11 -0
  10. package/{application.command-m4rq4wc2.js → application.command-azbd1pb2.js} +83 -37
  11. package/{applicationBuildRunner-df7rx3ra.js → applicationBuildRunner-trfxv3pd.js} +49 -18
  12. package/buildBatch.proc.js +25 -11
  13. package/{cloud.command-a0gy0qq2.js → cloud.command-gapp4634.js} +33 -29
  14. package/cloud.script-3b401efv.js +35 -0
  15. package/{code.command-5rsdqw8s.js → code.command-5smx61yf.js} +13 -9
  16. package/context.command-ym5jbkny.js +64 -0
  17. package/context.runner-kctbfsde.js +34 -0
  18. package/{dependencyScanner-78sq8m4q.js → dependencyScanner-ge10gb52.js} +2 -2
  19. package/{devTui-h77zrjv5.js → devTui-rf374y2w.js} +1 -1
  20. package/{fileSys-zpvt5gtf.js → fileSys-q22646yc.js} +1 -1
  21. package/{guideline.command-mffxknbr.js → guideline.command-zwypaqsh.js} +9 -5
  22. package/guidelines/agentRule/agentRule.instruction.md +25 -9
  23. package/guidelines/akanApi/akanApi.instruction.md +6 -4
  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 -4
  27. package/guidelines/conventions/rules/ts.md +3 -3
  28. package/guidelines/errorCodes/errorCodes.instruction.md +165 -0
  29. package/guidelines/fieldRule/fieldRule.instruction.md +2 -1
  30. package/guidelines/mcpRule/mcpRule.instruction.md +225 -5
  31. package/guidelines/pageRule/pageRule.instruction.md +10 -1
  32. package/guidelines/queryRule/queryRule.instruction.md +3 -1
  33. package/guidelines/runtimeRule/runtimeRule.instruction.md +14 -8
  34. package/guidelines/transportRule/transportRule.instruction.md +31 -1
  35. package/incrementalBuilder.proc.js +577 -411
  36. package/{index-w15mg3km.js → index-0dm25wvf.js} +1 -1
  37. package/{index-0gg15zwa.js → index-0s7w2085.js} +6 -6
  38. package/{index-hj6w4ka1.js → index-1p81ecbz.js} +1 -1
  39. package/{index-swwjakt0.js → index-275a4r3n.js} +11 -11
  40. package/{index-j6gc8n14.js → index-2jmvfa62.js} +11 -9
  41. package/{index-qd7xn2bk.js → index-2ny1e95c.js} +2 -2
  42. package/{index-exn38bzx.js → index-2yn3r67f.js} +116 -54
  43. package/{index-34792nh7.js → index-3txdtztz.js} +1 -1
  44. package/{index-28x1aszt.js → index-41a03gkj.js} +149 -53
  45. package/{index-2mf1aen9.js → index-4ss4gkv3.js} +2 -2
  46. package/{index-an76bdrv.js → index-612fdtbk.js} +1 -1
  47. package/{index-5radqwn2.js → index-67sd09ag.js} +12 -12
  48. package/{index-0hbtve0a.js → index-6dzjer7p.js} +32 -28
  49. package/{index-3ghdb7p5.js → index-71y6176j.js} +2777 -3676
  50. package/{index-xyn02k0w.js → index-78y75t0a.js} +662 -433
  51. package/index-7wf8snar.js +80 -0
  52. package/{index-skmtj8rm.js → index-8jtqfye2.js} +27 -10
  53. package/{index-2mrn1mrg.js → index-9f3reh2y.js} +1 -1
  54. package/{index-nmvhjn8c.js → index-9wh04mqy.js} +93 -82
  55. package/{index-xvk2a75m.js → index-a860mx0m.js} +3 -3
  56. package/{index-5zwr4n6k.js → index-baccvws5.js} +65 -8
  57. package/{index-yf9wc28h.js → index-bejy9zyc.js} +1 -1
  58. package/{index-bns3wcpc.js → index-by2tvsq6.js} +1 -1
  59. package/{index-r0a604h4.js → index-c669pbyb.js} +5 -4
  60. package/{index-x40bdsca.js → index-dadwp2aw.js} +33 -98
  61. package/{index-vm0dn0mt.js → index-dmcpetwe.js} +200 -138
  62. package/{index-43f4h4cm.js → index-ebn9kgea.js} +6 -6
  63. package/{index-hqv34wzq.js → index-gt8phqpt.js} +10 -10
  64. package/{index-yckz5t8b.js → index-h901f24n.js} +516 -434
  65. package/{index-j3v29pq7.js → index-j0wr4e32.js} +219 -175
  66. package/{index-gcx48get.js → index-j592zfqc.js} +2 -2
  67. package/{index-grxs6fts.js → index-j6jjmn2r.js} +57 -31
  68. package/{index-w8yasvpc.js → index-jek2re5k.js} +2136 -2175
  69. package/{index-ny2k80mv.js → index-jf4vk1s0.js} +9 -2
  70. package/{index-gxav1bjz.js → index-k6vwww45.js} +9 -9
  71. package/{index-99qvtff2.js → index-kfvjzk8r.js} +5 -5
  72. package/{index-j6eeh5d7.js → index-knpm8sdm.js} +5 -5
  73. package/{index-2r9ff9qm.js → index-nc3br31y.js} +2 -2
  74. package/{index-35j83zkd.js → index-p5zh7pmc.js} +2 -2
  75. package/{index-cmg5ngqa.js → index-p7beqww9.js} +2 -2
  76. package/{index-b4qq3rq0.js → index-rwgqba9p.js} +1 -1
  77. package/{index-rfzp4pqs.js → index-s885g0jj.js} +3 -3
  78. package/{index-9p260r4e.js → index-trffs83s.js} +538 -250
  79. package/{index-k92x3vne.js → index-v7ajmsh3.js} +1 -1
  80. package/index-w1zexzpx.js +127 -0
  81. package/{index-h7hehkw6.js → index-xczjdng6.js} +3 -1
  82. package/{index-39jz41jb.js → index-xs9a3ddt.js} +3 -3
  83. package/{index-rp4yf32g.js → index-xwwex8rf.js} +36 -29
  84. package/{index-ra9fvn7s.js → index-ybcb9wc8.js} +74 -38
  85. package/index-z92zm3wd.js +788 -0
  86. package/{index-j9790rhk.js → index-z96ks033.js} +1509 -1121
  87. package/index-zfnz878d.js +30 -0
  88. package/{index-2vgv7fs7.js → index-zmd9xxgd.js} +727 -693
  89. package/{index-ygdbn9jn.js → index-zyb0ebm4.js} +1 -1
  90. package/index.js +28 -24
  91. package/libExecutor-jc6f8hm6.js +10 -0
  92. package/{library.command-bmd7zc5m.js → library.command-nxvesvhb.js} +12 -5
  93. package/{localRegistry.command-y6en1599.js → localRegistry.command-xz62e4ng.js} +29 -24
  94. package/{module.command-7exfffqw.js → module.command-aaws9byg.js} +11 -7
  95. package/{package.command-adskw2rj.js → package.command-j7hv26p0.js} +14 -10
  96. package/package.json +8 -8
  97. package/{page.command-dw01272p.js → page.command-7yffs7n9.js} +8 -4
  98. package/{pipeline.command-0b1r3y5r.js → pipeline.command-7yk0zcng.js} +15 -9
  99. package/pkgExecutor-arxmvx4t.js +10 -0
  100. package/{primitive.command-byw6vc04.js → primitive.command-7a1pt715.js} +12 -8
  101. package/{projectTypecheck-kkrpq60a.js → projectTypecheck-f4qhbecd.js} +1 -1
  102. package/{prompter-qrwx1p17.js → prompter-qyggfhqd.js} +2 -2
  103. package/{quality.command-6rqnhzct.js → quality.command-c6mvrjh1.js} +25 -16
  104. package/{recipeScanner-4b69ybe0.js → recipeScanner-rrx69awy.js} +1 -1
  105. package/{repair.command-rw5zymak.js → repair.command-093adzt9.js} +12 -8
  106. package/{routeSourceValidator-4h947v7c.js → routeSourceValidator-8n6j1vn7.js} +4 -2
  107. package/{scalar.command-2dyp9nh9.js → scalar.command-2ex84spb.js} +10 -6
  108. package/skills/akan-debug/SKILL.md +8 -5
  109. package/skills/akan-err/SKILL.md +7 -0
  110. package/skills/akan-mcp/SKILL.md +19 -1
  111. package/skills/akan-scaffold/SKILL.md +1 -1
  112. package/skills/akan-validate/SKILL.md +3 -3
  113. package/{subspace.command-111ynwv1.js → subspace.command-4n4n4jpv.js} +32 -24
  114. package/templates/app/page/_layout.tsx +13 -0
  115. package/templates/app/page/styles.css.template +40 -0
  116. package/templates/appSample/page/_index.tsx +9 -9
  117. package/templates/appSample/page/_layout.tsx +1 -0
  118. package/templates/appSample/page/styles.css.template +40 -5
  119. package/templates/appSample/ui/Recipe/jellyButton.ts +1 -1
  120. package/templates/biomeForm.ts +1 -1
  121. package/templates/env/_env.server.type.ts +1 -1
  122. package/templates/facetIndex/index.ts +2 -37
  123. package/templates/lib/sig.ts +0 -4
  124. package/templates/lib/useClient.ts +1 -1
  125. package/templates/workspaceRoot/.devcontainer/devcontainer.json.template +1 -1
  126. package/templates/workspaceRoot/AGENTS.md.template +2 -1
  127. package/templates/workspaceRoot/README.ts +4 -2
  128. package/{tunnel.command-2gcpfbdj.js → tunnel.command-f7ep1qfa.js} +17 -13
  129. package/{typeChecker-s640r6c0.js → typeChecker-7jt6abrs.js} +1 -1
  130. package/typecheck.proc.js +3 -2
  131. package/{verify.command-djgs86ma.js → verify.command-zrkxnvct.js} +21 -17
  132. package/{workflow.command-n0k2mxr5.js → workflow.command-ks16jegk.js} +21 -14
  133. package/{workspace.command-fh1qwxfx.js → workspace.command-ahhfpaag.js} +60 -54
  134. package/CodeAgent-x2p3a3e0.js +0 -11
  135. package/TunnelShare-c4xsfzg5.js +0 -15
  136. package/agent.command-9et2e27p.js +0 -52
  137. package/cloud.script-xze4zh7n.js +0 -31
  138. package/context.command-rk1dwrg4.js +0 -57
  139. package/context.runner-83ky5m1b.js +0 -30
  140. /package/templates/{appSample → app}/public/fonts/Pretendard-Bold.woff2 +0 -0
  141. /package/templates/{appSample → app}/public/fonts/Pretendard-Medium.woff2 +0 -0
  142. /package/templates/{appSample → app}/public/fonts/Pretendard-Regular.woff2 +0 -0
  143. /package/templates/{appSample → app}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
@@ -1,39 +1,45 @@
1
1
  // @bun
2
2
  import {
3
3
  ApplicationBuildReporter
4
- } from "./index-vm0dn0mt.js";
4
+ } from "./index-dmcpetwe.js";
5
5
  import {
6
6
  script,
7
7
  markCliErrorPrinted,
8
8
  assertPromptable
9
- } from "./index-exn38bzx.js";
9
+ } from "./index-2yn3r67f.js";
10
10
  import {
11
11
  CliError
12
12
  } from "./index-j4yvgfhr.js";
13
13
  import {
14
- SysExecutor,
15
- AppExecutor,
16
- LibExecutor,
17
- PkgExecutor
18
- } from "./index-3ghdb7p5.js";
14
+ SysExecutor
15
+ } from "./index-71y6176j.js";
16
+ import {
17
+ AppExecutor2
18
+ } from "./index-z92zm3wd.js";
19
+ import {
20
+ LibExecutor2
21
+ } from "./index-zfnz878d.js";
22
+ import {
23
+ PkgExecutor2
24
+ } from "./index-w1zexzpx.js";
19
25
  import {
20
26
  DesktopServerStage
21
- } from "./index-an76bdrv.js";
27
+ } from "./index-612fdtbk.js";
22
28
  import {
23
29
  LibraryScript
24
- } from "./index-j6gc8n14.js";
30
+ } from "./index-2jmvfa62.js";
25
31
  import {
26
32
  ApplicationRunner,
27
33
  VerifyScope
28
- } from "./index-j9790rhk.js";
34
+ } from "./index-z96ks033.js";
29
35
  import {
30
36
  PreviewChrome2,
31
37
  PreviewView2,
32
38
  stripAnsi
33
- } from "./index-b4qq3rq0.js";
39
+ } from "./index-rwgqba9p.js";
34
40
  import {
35
41
  formatSlicePlan
36
- } from "./index-gcx48get.js";
42
+ } from "./index-j592zfqc.js";
37
43
  import {
38
44
  assertPlainName
39
45
  } from "./index-va90m8nd.js";
@@ -42,6 +48,7 @@ import {
42
48
  } from "./index-9dp031by.js";
43
49
 
44
50
  // pkgs/@akanjs/cli/application/application.script.ts
51
+ import { mkdir as mkdir3, rm } from "fs/promises";
45
52
  import path3 from "path";
46
53
  import { confirm } from "@inquirer/prompts";
47
54
  import { Logger as Logger3, toError } from "akanjs/common";
@@ -627,6 +634,7 @@ class AppPreview {
627
634
  static mobileViewport = { width: 390, height: 844 };
628
635
  static desktopViewport = { width: 1280, height: 800 };
629
636
  static csrTarget = "preview";
637
+ static #fullUrl = /^https?:\/\//i;
630
638
  static settleMs = 1000;
631
639
  static logGraceMs = 300;
632
640
  static stopGraceMs = 15000;
@@ -636,11 +644,9 @@ class AppPreview {
636
644
  if (unavailable)
637
645
  throw new Error(unavailable);
638
646
  const changed = options.changed ? await AppPreview.#changedPages(app) : { paths: [], skipped: [] };
639
- if (options.changed && !changed.paths.length && !options.paths?.length)
640
- throw new Error(`No page to open: ${changed.skipped.join("; ")}. Pass a concrete path, e.g. \`akan preview ${app.name} /memo/1\`.`);
641
- const paths = await AppPreview.pathsOf(app, options.paths ?? [], !!options.csr, changed.paths);
642
647
  const port = await app.getDevPort();
643
648
  const origin = `http://localhost:${port}`;
649
+ const plan = await AppPreview.planOf(app, options, changed, origin);
644
650
  const root = app.workspace.workspaceRoot;
645
651
  const previewDir = path2.join(ApplicationRunner.runtimeDirOf(app), "preview");
646
652
  const started = await ApplicationRunner.answers(origin, app.name, root) ? null : await AppPreview.#startServer(app, port, previewDir);
@@ -655,6 +661,7 @@ class AppPreview {
655
661
  serverLog: started ? path2.relative(root, started.logPath) : null,
656
662
  logsRead: false,
657
663
  skipped: changed.skipped,
664
+ notes: plan.notes,
658
665
  pages: []
659
666
  };
660
667
  try {
@@ -664,7 +671,7 @@ class AppPreview {
664
671
  const tail = await AppPreview.#tail(app, records);
665
672
  report.logsRead = !!tail;
666
673
  try {
667
- for (const pagePath of paths) {
674
+ for (const pagePath of plan.paths) {
668
675
  const mark = records.length;
669
676
  const page = await AppPreview.#probe(origin, pagePath, {
670
677
  engine,
@@ -690,22 +697,39 @@ class AppPreview {
690
697
  started?.proc.unref();
691
698
  }
692
699
  }
693
- static async pathsOf(app, paths, csr, pages = []) {
700
+ static async planOf(app, options, changed, origin) {
701
+ const typed = options.paths ?? [];
702
+ if (options.changed && !changed.paths.length && !typed.length)
703
+ throw new Error(`No page to open: ${changed.skipped.join("; ")}. Pass a concrete path, e.g. \`akan preview ${app.name} /memo/1\`.`);
694
704
  const { i18n, api } = await app.getConfig();
695
- return AppPreview.pagePaths(paths, i18n, {
696
- csr,
705
+ const { paths, asWritten, folded } = AppPreview.#plan(typed, i18n, {
706
+ csr: !!options.csr,
697
707
  apiPrefix: api.prefix,
698
708
  publicDir: path2.join(app.cwdPath, "public"),
699
- pages
709
+ pages: changed.paths
700
710
  });
711
+ const dev = new URL(origin);
712
+ const isDevServer = (url) => url.protocol === dev.protocol && url.port === dev.port && AppPreview.#isDevHost(url.hostname);
713
+ const elsewhere = [...new Set(typed)].filter((raw) => AppPreview.#fullUrl.test(raw) && !isDevServer(new URL(raw)));
714
+ const skipsBoot = asWritten;
715
+ const notes = [
716
+ ...elsewhere.length ? [
717
+ `${elsewhere.join(", ")} ${elsewhere.length === 1 ? "names another server: its path opens" : "name other servers: their paths open"} on ${origin}.`
718
+ ] : [],
719
+ ...options.csr && skipsBoot.length ? [
720
+ `--csr does not apply to ${skipsBoot.join(", ")}: ${skipsBoot.length === 1 ? "it opens" : "they open"} without the CSR boot.`
721
+ ] : [],
722
+ ...folded.map(({ raw, kept }) => `${raw} opens as ${kept}, which writes the same screenshot.`)
723
+ ];
724
+ return { paths, notes };
701
725
  }
702
- static pagePaths(paths, i18n, {
703
- csr,
704
- apiPrefix = "/api",
705
- publicDir = null,
706
- pages = []
707
- }) {
726
+ static #plan(paths, i18n, { csr, apiPrefix = "/api", publicDir = null, pages = [] }) {
708
727
  const keepsUnprefixed = i18n.localePrefix === "as-needed" && !csr;
728
+ const urlOf = (raw) => {
729
+ const url = AppPreview.#fullUrl.test(raw) ? new URL(raw) : AppPreview.probeUrlOf("http://localhost", raw);
730
+ url.pathname = url.pathname.replace(/^\/{2,}/, "/");
731
+ return url;
732
+ };
709
733
  const asPage = (url) => {
710
734
  const [first] = url.pathname.split("/").filter(Boolean);
711
735
  if (!keepsUnprefixed && (!first || !i18n.locales.includes(first)))
@@ -716,16 +740,35 @@ class AppPreview {
716
740
  }
717
741
  return `${url.pathname}${url.search}`;
718
742
  };
719
- const urlOf = (raw) => new URL(`http://localhost${raw.startsWith("/") ? "" : "/"}${raw}`);
720
- const typed = (paths.length || pages.length ? paths : ["/"]).map((raw) => {
721
- if (/^https?:\/\//.test(raw)) {
722
- const url = new URL(raw);
723
- return `${url.pathname}${url.search}`;
724
- }
743
+ const rows = (paths.length || pages.length ? paths : ["/"]).map((raw) => {
725
744
  const url = urlOf(raw);
726
- return AppPreview.#isPagePath(url.pathname, i18n, { apiPrefix, publicDir }) ? asPage(url) : `${url.pathname}${url.search}`;
745
+ const isPage = !AppPreview.#fullUrl.test(raw) && AppPreview.#isPagePath(url.pathname, i18n, { apiPrefix, publicDir });
746
+ return { raw, path: isPage ? asPage(url) : `${url.pathname}${url.search}`, asWritten: !isPage };
727
747
  });
728
- return [...new Set([...typed, ...pages.map((page) => asPage(urlOf(page)))])];
748
+ for (const page of pages)
749
+ rows.push({ raw: null, path: asPage(urlOf(page)), asWritten: false });
750
+ const byScreenshot = new Map;
751
+ const folded = [];
752
+ for (const row of rows) {
753
+ const name = AppPreview.screenshotName(row.path);
754
+ const kept = byScreenshot.get(name);
755
+ if (!kept)
756
+ byScreenshot.set(name, row);
757
+ else if (row.raw !== null && kept.path !== row.path)
758
+ folded.push({ raw: row.raw, kept: kept.path });
759
+ }
760
+ const planned = [...byScreenshot.values()];
761
+ return {
762
+ paths: planned.map((row) => row.path),
763
+ asWritten: planned.flatMap((row) => row.asWritten && row.raw !== null ? [row.raw] : []),
764
+ folded
765
+ };
766
+ }
767
+ static #isDevHost(hostname) {
768
+ return ["localhost", "127.0.0.1", "0.0.0.0"].includes(hostname.replace(/\.$/, ""));
769
+ }
770
+ static probeUrlOf(origin, pagePath) {
771
+ return new URL(`${origin}${pagePath.startsWith("/") ? "" : "/"}${pagePath}`);
729
772
  }
730
773
  static #serverFiles = new Set([
731
774
  "/favicon.ico",
@@ -743,6 +786,8 @@ class AppPreview {
743
786
  const prefixes = ["/_akan", "/__csr", "/__rsc", "/.well-known", apiPrefix.replace(/\/+$/, "")].filter(Boolean);
744
787
  if (prefixes.some((prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`)))
745
788
  return false;
789
+ if (pathname.endsWith("/"))
790
+ return true;
746
791
  if (AppPreview.#serverFiles.has(pathname))
747
792
  return false;
748
793
  if (segments.length === 2 && segments[1] === "manifest.webmanifest")
@@ -799,15 +844,21 @@ class AppPreview {
799
844
  return { paths, skipped };
800
845
  }
801
846
  static screenshotName(pagePath) {
802
- const url = new URL(pagePath, "http://localhost");
847
+ const url = AppPreview.probeUrlOf("http://localhost", pagePath);
803
848
  const slugOf = (text) => text.replace(/[^\w-]/g, "_");
804
849
  const hashOf = (text) => Bun.hash(text).toString(36).slice(0, 6);
805
- const pathSlug = slugOf(url.pathname.split("/").filter(Boolean).join("-")) || "index";
806
- const page = pathSlug.length > 80 ? `${pathSlug.slice(0, 80)}-${hashOf(url.pathname)}` : pathSlug;
807
- const params = [...url.searchParams].filter(([key]) => key !== "csr" && key !== "akanMobileTarget");
850
+ const pathname = url.pathname.replace(/(.)\/+$/, "$1");
851
+ const plain = pathname.split("/").filter(Boolean).join("-");
852
+ const isPlain = /^(\/[a-z0-9]+)*$/.test(pathname) && plain.length <= 80;
853
+ const page = !plain ? "_index" : isPlain ? plain : `${slugOf(plain).slice(0, 80)}_${hashOf(pathname)}`;
854
+ const boot = ["csr=true", `akanMobileTarget=${AppPreview.csrTarget}`];
855
+ const pairs = url.search.slice(1).split("&").filter(Boolean);
856
+ const isBoot = boot.every((pair) => pairs.includes(pair));
857
+ const rest = isBoot ? pairs.filter((pair) => !boot.includes(pair)) : pairs;
858
+ const params = [...new URLSearchParams(rest.join("&"))];
808
859
  const readable = slugOf(params.map(([key, value]) => `${key}-${value}`).join("-")).slice(0, 40);
809
- const query = params.length ? `.${readable}-${hashOf(new URLSearchParams(params).toString())}` : "";
810
- return `${page}${query}${url.searchParams.get("csr") === "true" ? ".csr" : ""}.png`;
860
+ const query = rest.length ? `.${readable}-${hashOf(rest.join("&"))}` : "";
861
+ return `${page}${query}${isBoot ? ".csr" : ""}.png`;
811
862
  }
812
863
  static attribute(page, records) {
813
864
  const pathname = new URL(page.finalUrl).pathname;
@@ -836,6 +887,8 @@ class AppPreview {
836
887
  lines.push("The app's log socket did not answer, so client and server errors are not shown.");
837
888
  for (const reason of report.skipped)
838
889
  lines.push(`Not opened: ${reason}.`);
890
+ for (const note of report.notes)
891
+ lines.push(`Note: ${note}`);
839
892
  lines.push("");
840
893
  for (const page of report.pages) {
841
894
  const verdict = page.failed ? "FAIL" : page.domFindings.length || page.consoleWarnings.length ? "warn" : "ok";
@@ -873,7 +926,7 @@ class AppPreview {
873
926
  screenshot,
874
927
  timeoutMs
875
928
  }) {
876
- const url = new URL(pagePath, origin).toString();
929
+ const url = AppPreview.probeUrlOf(origin, pagePath).toString();
877
930
  const at = Date.now();
878
931
  const page = {
879
932
  path: pagePath,
@@ -1400,9 +1453,9 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1400
1453
  }
1401
1454
  }
1402
1455
  async typecheck(exec, { write = true, clean = false, incremental = true, tests = false } = {}) {
1403
- if (!(exec instanceof AppExecutor) && !(exec instanceof LibExecutor))
1456
+ if (!(exec instanceof AppExecutor2) && !(exec instanceof LibExecutor2))
1404
1457
  throw new Error(`akan typecheck takes an app or a library; ${exec.name} is a package, checked by its own tsconfig.`);
1405
- if (exec instanceof AppExecutor)
1458
+ if (exec instanceof AppExecutor2)
1406
1459
  await exec.scanSync({ write });
1407
1460
  else if (write)
1408
1461
  await this.libraryScript.syncLibrary(exec);
@@ -1410,7 +1463,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1410
1463
  await exec.scan({ write: false });
1411
1464
  const spinner = exec.spinning(`Typechecking ${exec.name}${tests ? " with its tests" : ""}...`);
1412
1465
  try {
1413
- if (exec instanceof LibExecutor)
1466
+ if (exec instanceof LibExecutor2)
1414
1467
  await this.applicationRunner.typecheckLibrary(exec, { clean, incremental, tests });
1415
1468
  else
1416
1469
  await this.applicationRunner.typecheck(exec, { clean, incremental, tests });
@@ -1422,10 +1475,22 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1422
1475
  throw error;
1423
1476
  }
1424
1477
  }
1425
- async test(exec, { write = true, files = [], coverage = false } = {}) {
1478
+ async test(exec, {
1479
+ write = true,
1480
+ files = [],
1481
+ coverage = false,
1482
+ parallel = 1,
1483
+ junit
1484
+ } = {}) {
1485
+ if (!Number.isInteger(parallel) || parallel < 1)
1486
+ throw new CliError("usage", `--parallel takes a whole number of bun processes, 1 or more; got ${parallel}`);
1426
1487
  const testPaths = this.applicationRunner.resolveTestPaths(exec, files);
1427
- const flags = coverage ? ApplicationScript.#coverageFlagsOf(exec) : [];
1428
- if (exec instanceof LibExecutor) {
1488
+ const flags = [
1489
+ ...coverage ? ApplicationScript.#coverageFlagsOf(exec) : [],
1490
+ ...parallel > 1 ? await ApplicationScript.#parallelFlagsOf(exec, parallel) : [],
1491
+ ...junit ? await ApplicationScript.#junitFlagsOf(junit) : []
1492
+ ];
1493
+ if (exec instanceof LibExecutor2) {
1429
1494
  if (write)
1430
1495
  await this.libraryScript.syncLibrary(exec);
1431
1496
  else
@@ -1436,7 +1501,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1436
1501
  }
1437
1502
  const spinner = exec.spinning(`Preparing ${exec.name}...`);
1438
1503
  try {
1439
- if (exec instanceof PkgExecutor)
1504
+ if (exec instanceof PkgExecutor2)
1440
1505
  await exec.scan({ refresh: true });
1441
1506
  else
1442
1507
  await exec.scanSync({ write });
@@ -1447,11 +1512,42 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1447
1512
  }
1448
1513
  await this.applicationRunner.test(exec, testPaths, flags);
1449
1514
  }
1515
+ static #localDirOf(exec, kind) {
1516
+ const root = exec instanceof SysExecutor || exec instanceof PkgExecutor2 ? exec.workspace.workspaceRoot : null;
1517
+ return root ? path3.join(root, "local", kind, path3.relative(root, exec.cwdPath)) : `local/${kind}`;
1518
+ }
1450
1519
  static #coverageFlagsOf(exec) {
1451
- const root = exec instanceof SysExecutor || exec instanceof PkgExecutor ? exec.workspace.workspaceRoot : null;
1452
- const dir = root ? path3.join(root, "local", "coverage", path3.relative(root, exec.cwdPath)) : "local/coverage";
1520
+ const dir = ApplicationScript.#localDirOf(exec, "coverage");
1453
1521
  return ["--coverage", "--coverage-reporter=text", "--coverage-reporter=lcov", `--coverage-dir=${dir}`];
1454
1522
  }
1523
+ static async#parallelFlagsOf(exec, parallel) {
1524
+ const timings = path3.join(ApplicationScript.#localDirOf(exec, "test-timings"), "timings.json");
1525
+ if (!await ApplicationScript.#readsAsTimings(timings)) {
1526
+ await rm(timings, { force: true });
1527
+ Logger3.warn(`${timings} was not a timings file bun reads, so it was dropped; this run records it again`);
1528
+ }
1529
+ return [`--parallel=${parallel}`, `--timings=${timings}`, "--update-timings"];
1530
+ }
1531
+ static async#readsAsTimings(timings) {
1532
+ const file = Bun.file(timings);
1533
+ if (!await file.exists())
1534
+ return true;
1535
+ const text = await file.text();
1536
+ if (text === "")
1537
+ return true;
1538
+ try {
1539
+ const parsed = JSON.parse(text);
1540
+ const files = parsed?.files;
1541
+ return parsed?.version === 1 && typeof files === "object" && files !== null && !Array.isArray(files) && Object.values(files).every((ms) => typeof ms !== "string");
1542
+ } catch {
1543
+ return false;
1544
+ }
1545
+ }
1546
+ static async#junitFlagsOf(junit) {
1547
+ const outfile = path3.resolve(junit);
1548
+ await mkdir3(path3.dirname(outfile), { recursive: true });
1549
+ return ["--reporter=junit", `--reporter-outfile=${outfile}`];
1550
+ }
1455
1551
  async start(apps, {
1456
1552
  open = false,
1457
1553
  dbup = true,
@@ -1519,7 +1615,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1519
1615
  throw new Error("No app selected to start");
1520
1616
  const startedDatabase = dbup ? await this.#prepareSharedDatabase(apps) : false;
1521
1617
  const supervisor = new DevSupervisor({ apps, mode, concurrency, open, write, shares });
1522
- const view = mode === "tui" ? new (await import("./devTui-h77zrjv5.js")).DevTui(supervisor) : new DevStreamView(apps.map((app) => app.name));
1618
+ const view = mode === "tui" ? new (await import("./devTui-rf374y2w.js")).DevTui(supervisor) : new DevStreamView(apps.map((app) => app.name));
1523
1619
  await supervisor.run(view);
1524
1620
  if (startedDatabase)
1525
1621
  await this.#stopDatabase(workspace);
@@ -1651,7 +1747,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1651
1747
  await this.applicationRunner.transferDatabase(app, direction, dir);
1652
1748
  }
1653
1749
  async dbupDeclared(workspace, mode) {
1654
- const declared = mode ? [mode] : await Promise.all((await workspace.getApps()).map(async (appName) => (await AppExecutor.from(workspace, appName).getConfig()).database.modes)).then((modes) => [...new Set(modes.flat())]);
1750
+ const declared = mode ? [mode] : await Promise.all((await workspace.getApps()).map(async (appName) => (await AppExecutor2.from(workspace, appName).getConfig()).database.modes)).then((modes) => [...new Set(modes.flat())]);
1655
1751
  const needing = declared.filter((each) => each !== "single");
1656
1752
  if (!needing.length) {
1657
1753
  workspace.log("No app here declares a database mode that runs on local services; single needs none.");
@@ -1683,7 +1779,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1683
1779
  await Promise.all(shares.map(async (share) => await share.close()));
1684
1780
  }, "Abandoning the tunnel release; the shares expire on their own.");
1685
1781
  await Promise.all(apps.map(async (app) => {
1686
- const { TunnelShare } = await import("./TunnelShare-c4xsfzg5.js");
1782
+ const { TunnelShare } = await import("./TunnelShare-9ry4vh0y.js");
1687
1783
  const share = await TunnelShare.open(app, { workspace: app.workspace });
1688
1784
  shares.push(share);
1689
1785
  urls.set(app.name, share.url);
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-exn38bzx.js";
5
+ } from "./index-2yn3r67f.js";
6
6
  import {
7
7
  generatedFilesForSync,
8
8
  createPassedPrimitiveReport,
9
9
  scalarChangedFiles
10
- } from "./index-2vgv7fs7.js";
10
+ } from "./index-zmd9xxgd.js";
11
11
  import {
12
12
  pluralizeName
13
13
  } from "./index-nz8prx9g.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  DesktopBin
4
- } from "./index-43f4h4cm.js";
4
+ } from "./index-ebn9kgea.js";
5
5
  // pkgs/@akanjs/devkit/mobile/desktopServerStage.ts
6
6
  import { cp, mkdir, readdir, rm, writeFile } from "fs/promises";
7
7
  import path from "path";
@@ -1,10 +1,11 @@
1
1
  // @bun
2
2
  import {
3
- WorkspaceExecutor
4
- } from "./index-3ghdb7p5.js";
3
+ CommandContainer,
4
+ runner
5
+ } from "./index-2yn3r67f.js";
5
6
  import {
6
- AkanContextAnalyzer
7
- } from "./index-yckz5t8b.js";
7
+ WorkspaceExecutor
8
+ } from "./index-71y6176j.js";
8
9
  import {
9
10
  jsonText,
10
11
  workflowPlanApproval,
@@ -30,24 +31,23 @@ import {
30
31
  renderWorkflowApply,
31
32
  renderWorkflowValidation,
32
33
  renderWorkflowRunArtifact
33
- } from "./index-2vgv7fs7.js";
34
+ } from "./index-zmd9xxgd.js";
34
35
  import {
35
- CommandContainer,
36
- runner
37
- } from "./index-exn38bzx.js";
36
+ AkanContextAnalyzer
37
+ } from "./index-h901f24n.js";
38
38
  import {
39
39
  ModuleScript
40
- } from "./index-hqv34wzq.js";
40
+ } from "./index-gt8phqpt.js";
41
41
  import {
42
42
  PrimitiveScript
43
- } from "./index-0hbtve0a.js";
43
+ } from "./index-6dzjer7p.js";
44
44
  import {
45
45
  spawnAkan,
46
46
  isWorkspaceTarget
47
- } from "./index-99qvtff2.js";
47
+ } from "./index-kfvjzk8r.js";
48
48
  import {
49
49
  ScalarScript
50
- } from "./index-2mf1aen9.js";
50
+ } from "./index-4ss4gkv3.js";
51
51
  import {
52
52
  workflowSpecs
53
53
  } from "./index-t4d0ckde.js";
@@ -1,57 +1,61 @@
1
1
  // @bun
2
2
  import {
3
3
  script
4
- } from "./index-exn38bzx.js";
4
+ } from "./index-2yn3r67f.js";
5
5
  import {
6
- AppExecutor,
7
- LibExecutor,
8
- ModuleExecutor
9
- } from "./index-3ghdb7p5.js";
6
+ AppExecutor2
7
+ } from "./index-z92zm3wd.js";
8
+ import {
9
+ LibExecutor2
10
+ } from "./index-zfnz878d.js";
10
11
  import {
11
12
  InteractionScaffold,
12
13
  workflowStatus,
13
14
  compactDiagnostics,
14
15
  generatedFilePathsForTarget,
15
- sourceFile,
16
- moduleComponentName,
17
- moduleSourcePaths,
18
- generatedFilesForSync,
19
- validationCommandsForTarget,
20
- nextActionsForTarget,
21
- createPrimitiveWriteReport,
22
- normalizeFieldType,
16
+ hasSourceParseErrors,
23
17
  ensureNamedImport,
24
18
  ensureBaseImport,
25
- coerceFieldDefault,
26
- fieldExpression,
19
+ ensureEnumImport,
20
+ ensureConstantTypeImport,
27
21
  viaBuilderParameterName,
28
22
  insertIntoObject,
29
23
  insertLightProjectionField,
30
- insertTemplateField,
31
- ensureEnumImport,
32
24
  insertEnumClass,
33
- insertDictionaryModelField,
34
25
  hasConstantInputField,
26
+ insertDictionaryModelField,
35
27
  hasDictionaryModelField,
36
- ensureConstantTypeImport,
37
28
  insertDictionaryEnum,
29
+ normalizeFieldType,
30
+ coerceFieldDefault,
31
+ fieldExpression,
38
32
  parseValues,
39
- hasSourceParseErrors,
33
+ moduleComponentName,
34
+ moduleSourcePaths,
35
+ addFieldUiPolicyForType,
36
+ withFieldTypeImport,
37
+ KeyRename,
40
38
  hasClassMethod,
41
39
  insertClassMethod,
42
40
  hasSignalFactoryEntry,
43
41
  insertSignalFactoryEntry,
44
- addFieldUiPolicyForType,
45
- withFieldTypeImport,
46
- KeyRename,
47
- MutationScaffold
48
- } from "./index-2vgv7fs7.js";
42
+ MutationScaffold,
43
+ sourceFile,
44
+ generatedFilesForSync,
45
+ validationCommandsForTarget,
46
+ nextActionsForTarget,
47
+ createPrimitiveWriteReport,
48
+ insertTemplateField
49
+ } from "./index-zmd9xxgd.js";
49
50
  import {
50
51
  ModuleScript
51
- } from "./index-hqv34wzq.js";
52
+ } from "./index-gt8phqpt.js";
52
53
  import {
53
54
  plainNameProblem
54
55
  } from "./index-va90m8nd.js";
56
+ import {
57
+ ModuleExecutor
58
+ } from "./index-7wf8snar.js";
55
59
 
56
60
  // pkgs/@akanjs/cli/primitive/primitive.script.ts
57
61
  import { capitalize, lowerlize } from "akanjs/common";
@@ -61,9 +65,9 @@ class PrimitiveScript extends script("primitive", [ModuleScript]) {
61
65
  return null;
62
66
  const [apps, libs] = await workspace.getSyss();
63
67
  if (apps.includes(target))
64
- return AppExecutor.from(workspace, target);
68
+ return AppExecutor2.from(workspace, target);
65
69
  if (libs.includes(target))
66
- return LibExecutor.from(workspace, target);
70
+ return LibExecutor2.from(workspace, target);
67
71
  return null;
68
72
  }
69
73
  async createUi(workspace, input) {