@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,10 +1,11 @@
1
1
  // @bun
2
2
  import {
3
- AkanContextAnalyzer
4
- } from "./index-0mqga3h9.js";
3
+ CommandContainer,
4
+ runner
5
+ } from "./index-9rv2zt48.js";
5
6
  import {
6
7
  WorkspaceExecutor
7
- } from "./index-wfmpxke3.js";
8
+ } from "./index-qssq2d41.js";
8
9
  import {
9
10
  jsonText,
10
11
  workflowPlanApproval,
@@ -30,27 +31,26 @@ import {
30
31
  renderWorkflowApply,
31
32
  renderWorkflowValidation,
32
33
  renderWorkflowRunArtifact
33
- } from "./index-xq97me1h.js";
34
+ } from "./index-a41vv4cy.js";
34
35
  import {
35
- CommandContainer,
36
- runner
37
- } from "./index-386canwe.js";
36
+ AkanContextAnalyzer
37
+ } from "./index-nmxszh6x.js";
38
38
  import {
39
39
  ModuleScript
40
- } from "./index-htxck0pn.js";
40
+ } from "./index-q444k260.js";
41
41
  import {
42
42
  PrimitiveScript
43
- } from "./index-qgazn58x.js";
43
+ } from "./index-7a07tdap.js";
44
44
  import {
45
45
  spawnAkan,
46
46
  isWorkspaceTarget
47
- } from "./index-cbcwxp5v.js";
47
+ } from "./index-22g3jq43.js";
48
48
  import {
49
49
  ScalarScript
50
- } from "./index-pq5rjkch.js";
50
+ } from "./index-88s746ns.js";
51
51
  import {
52
52
  workflowSpecs
53
- } from "./index-v50xjbbe.js";
53
+ } from "./index-t4d0ckde.js";
54
54
 
55
55
  // pkgs/@akanjs/cli/workflow/workflow.runner.ts
56
56
  import { mkdir, readFile, writeFile } from "fs/promises";
@@ -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
 
6
6
  // pkgs/@akanjs/devkit/codeAgent/agent/WorkspaceTrust.ts
7
7
  import { createHash } from "crypto";
@@ -1,37 +1,48 @@
1
1
  // @bun
2
2
  import {
3
3
  ApplicationBuildReporter
4
- } from "./index-y725zb1a.js";
4
+ } from "./index-7v7tvgt7.js";
5
5
  import {
6
6
  script,
7
- ExitCodeError,
8
7
  markCliErrorPrinted,
9
8
  assertPromptable
10
- } from "./index-386canwe.js";
9
+ } from "./index-9rv2zt48.js";
11
10
  import {
12
- SysExecutor,
13
- AppExecutor,
14
- LibExecutor,
15
- PkgExecutor
16
- } from "./index-wfmpxke3.js";
11
+ CliError
12
+ } from "./index-j4yvgfhr.js";
13
+ import {
14
+ SysExecutor
15
+ } from "./index-qssq2d41.js";
16
+ import {
17
+ AppExecutor2
18
+ } from "./index-ze48c0vd.js";
19
+ import {
20
+ LibExecutor2
21
+ } from "./index-na8r4a27.js";
22
+ import {
23
+ PkgExecutor2
24
+ } from "./index-dss3ds74.js";
17
25
  import {
18
26
  DesktopServerStage
19
- } from "./index-20wvskt8.js";
27
+ } from "./index-pt0agdck.js";
20
28
  import {
21
29
  LibraryScript
22
- } from "./index-xa0289eg.js";
30
+ } from "./index-6zb17wcm.js";
23
31
  import {
24
32
  ApplicationRunner,
25
33
  VerifyScope
26
- } from "./index-kcpk2d20.js";
34
+ } from "./index-h1w4wqgd.js";
27
35
  import {
28
36
  PreviewChrome2,
29
37
  PreviewView2,
30
38
  stripAnsi
31
- } from "./index-23860fej.js";
39
+ } from "./index-rwgqba9p.js";
32
40
  import {
33
41
  formatSlicePlan
34
- } from "./index-8jpc5fqv.js";
42
+ } from "./index-g7jgd4xs.js";
43
+ import {
44
+ assertPlainName
45
+ } from "./index-va90m8nd.js";
35
46
  import {
36
47
  openBrowser
37
48
  } from "./index-9dp031by.js";
@@ -622,6 +633,7 @@ class AppPreview {
622
633
  static mobileViewport = { width: 390, height: 844 };
623
634
  static desktopViewport = { width: 1280, height: 800 };
624
635
  static csrTarget = "preview";
636
+ static #fullUrl = /^https?:\/\//i;
625
637
  static settleMs = 1000;
626
638
  static logGraceMs = 300;
627
639
  static stopGraceMs = 15000;
@@ -630,17 +642,10 @@ class AppPreview {
630
642
  const unavailable = PreviewView2.unavailableReason(engine);
631
643
  if (unavailable)
632
644
  throw new Error(unavailable);
633
- const { i18n, api } = await app.getConfig();
634
645
  const changed = options.changed ? await AppPreview.#changedPages(app) : { paths: [], skipped: [] };
635
- if (options.changed && !changed.paths.length && !options.paths?.length)
636
- throw new Error(`No page to open: ${changed.skipped.join("; ")}. Pass a concrete path, e.g. \`akan preview ${app.name} /memo/1\`.`);
637
- const paths = AppPreview.pagePaths([...options.paths ?? [], ...changed.paths], i18n, {
638
- csr: !!options.csr,
639
- apiPrefix: api.prefix,
640
- publicDir: path2.join(app.cwdPath, "public")
641
- });
642
646
  const port = await app.getDevPort();
643
647
  const origin = `http://localhost:${port}`;
648
+ const plan = await AppPreview.planOf(app, options, changed, origin);
644
649
  const root = app.workspace.workspaceRoot;
645
650
  const previewDir = path2.join(ApplicationRunner.runtimeDirOf(app), "preview");
646
651
  const started = await ApplicationRunner.answers(origin, app.name, root) ? null : await AppPreview.#startServer(app, port, previewDir);
@@ -655,6 +660,7 @@ class AppPreview {
655
660
  serverLog: started ? path2.relative(root, started.logPath) : null,
656
661
  logsRead: false,
657
662
  skipped: changed.skipped,
663
+ notes: plan.notes,
658
664
  pages: []
659
665
  };
660
666
  try {
@@ -664,7 +670,7 @@ class AppPreview {
664
670
  const tail = await AppPreview.#tail(app, records);
665
671
  report.logsRead = !!tail;
666
672
  try {
667
- for (const pagePath of paths) {
673
+ for (const pagePath of plan.paths) {
668
674
  const mark = records.length;
669
675
  const page = await AppPreview.#probe(origin, pagePath, {
670
676
  engine,
@@ -690,12 +696,40 @@ class AppPreview {
690
696
  started?.proc.unref();
691
697
  }
692
698
  }
693
- static pagePaths(paths, i18n, { csr, apiPrefix = "/api", publicDir = null }) {
699
+ static async planOf(app, options, changed, origin) {
700
+ const typed = options.paths ?? [];
701
+ if (options.changed && !changed.paths.length && !typed.length)
702
+ throw new Error(`No page to open: ${changed.skipped.join("; ")}. Pass a concrete path, e.g. \`akan preview ${app.name} /memo/1\`.`);
703
+ const { i18n, api } = await app.getConfig();
704
+ const { paths, asWritten, folded } = AppPreview.#plan(typed, i18n, {
705
+ csr: !!options.csr,
706
+ apiPrefix: api.prefix,
707
+ publicDir: path2.join(app.cwdPath, "public"),
708
+ pages: changed.paths
709
+ });
710
+ const dev = new URL(origin);
711
+ const isDevServer = (url) => url.protocol === dev.protocol && url.port === dev.port && AppPreview.#isDevHost(url.hostname);
712
+ const elsewhere = [...new Set(typed)].filter((raw) => AppPreview.#fullUrl.test(raw) && !isDevServer(new URL(raw)));
713
+ const skipsBoot = asWritten;
714
+ const notes = [
715
+ ...elsewhere.length ? [
716
+ `${elsewhere.join(", ")} ${elsewhere.length === 1 ? "names another server: its path opens" : "name other servers: their paths open"} on ${origin}.`
717
+ ] : [],
718
+ ...options.csr && skipsBoot.length ? [
719
+ `--csr does not apply to ${skipsBoot.join(", ")}: ${skipsBoot.length === 1 ? "it opens" : "they open"} without the CSR boot.`
720
+ ] : [],
721
+ ...folded.map(({ raw, kept }) => `${raw} opens as ${kept}, which writes the same screenshot.`)
722
+ ];
723
+ return { paths, notes };
724
+ }
725
+ static #plan(paths, i18n, { csr, apiPrefix = "/api", publicDir = null, pages = [] }) {
694
726
  const keepsUnprefixed = i18n.localePrefix === "as-needed" && !csr;
695
- const pages = (paths.length ? paths : ["/"]).map((raw) => {
696
- const url = new URL(/^https?:\/\//.test(raw) ? raw : `http://localhost${raw.startsWith("/") ? "" : "/"}${raw}`);
697
- if (!AppPreview.#isPagePath(url.pathname, i18n, { apiPrefix, publicDir }))
698
- return `${url.pathname}${url.search}`;
727
+ const urlOf = (raw) => {
728
+ const url = AppPreview.#fullUrl.test(raw) ? new URL(raw) : AppPreview.probeUrlOf("http://localhost", raw);
729
+ url.pathname = url.pathname.replace(/^\/{2,}/, "/");
730
+ return url;
731
+ };
732
+ const asPage = (url) => {
699
733
  const [first] = url.pathname.split("/").filter(Boolean);
700
734
  if (!keepsUnprefixed && (!first || !i18n.locales.includes(first)))
701
735
  url.pathname = `/${i18n.defaultLocale}${url.pathname === "/" ? "/" : url.pathname}`;
@@ -704,11 +738,45 @@ class AppPreview {
704
738
  url.searchParams.set("akanMobileTarget", AppPreview.csrTarget);
705
739
  }
706
740
  return `${url.pathname}${url.search}`;
741
+ };
742
+ const rows = (paths.length || pages.length ? paths : ["/"]).map((raw) => {
743
+ const url = urlOf(raw);
744
+ const isPage = !AppPreview.#fullUrl.test(raw) && AppPreview.#isPagePath(url.pathname, i18n, { apiPrefix, publicDir });
745
+ return { raw, path: isPage ? asPage(url) : `${url.pathname}${url.search}`, asWritten: !isPage };
707
746
  });
708
- return [...new Set(pages)];
747
+ for (const page of pages)
748
+ rows.push({ raw: null, path: asPage(urlOf(page)), asWritten: false });
749
+ const byScreenshot = new Map;
750
+ const folded = [];
751
+ for (const row of rows) {
752
+ const name = AppPreview.screenshotName(row.path);
753
+ const kept = byScreenshot.get(name);
754
+ if (!kept)
755
+ byScreenshot.set(name, row);
756
+ else if (row.raw !== null && kept.path !== row.path)
757
+ folded.push({ raw: row.raw, kept: kept.path });
758
+ }
759
+ const planned = [...byScreenshot.values()];
760
+ return {
761
+ paths: planned.map((row) => row.path),
762
+ asWritten: planned.flatMap((row) => row.asWritten && row.raw !== null ? [row.raw] : []),
763
+ folded
764
+ };
765
+ }
766
+ static #isDevHost(hostname) {
767
+ return ["localhost", "127.0.0.1", "0.0.0.0"].includes(hostname.replace(/\.$/, ""));
709
768
  }
710
- static #serverFiles = new Set(["/favicon.ico", "/robots.txt", "/sitemap.xml", "/manifest.webmanifest"]);
711
- static #basePathFiles = new Set(["sitemap.xml", "manifest.webmanifest"]);
769
+ static probeUrlOf(origin, pagePath) {
770
+ return new URL(`${origin}${pagePath.startsWith("/") ? "" : "/"}${pagePath}`);
771
+ }
772
+ static #serverFiles = new Set([
773
+ "/favicon.ico",
774
+ "/robots.txt",
775
+ "/sitemap.xml",
776
+ "/manifest.webmanifest",
777
+ "/openapi.json",
778
+ "/mcp"
779
+ ]);
712
780
  static #isPagePath(pathname, i18n, { apiPrefix, publicDir }) {
713
781
  const segments = pathname.split("/").filter(Boolean);
714
782
  const [first] = segments;
@@ -717,9 +785,11 @@ class AppPreview {
717
785
  const prefixes = ["/_akan", "/__csr", "/__rsc", "/.well-known", apiPrefix.replace(/\/+$/, "")].filter(Boolean);
718
786
  if (prefixes.some((prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`)))
719
787
  return false;
788
+ if (pathname.endsWith("/"))
789
+ return true;
720
790
  if (AppPreview.#serverFiles.has(pathname))
721
791
  return false;
722
- if (segments.length === 2 && AppPreview.#basePathFiles.has(segments[1] ?? ""))
792
+ if (segments.length === 2 && segments[1] === "manifest.webmanifest")
723
793
  return false;
724
794
  return !(publicDir && AppPreview.#isPublicFile(publicDir, pathname));
725
795
  }
@@ -773,9 +843,21 @@ class AppPreview {
773
843
  return { paths, skipped };
774
844
  }
775
845
  static screenshotName(pagePath) {
776
- const url = new URL(pagePath, "http://localhost");
777
- const slug = url.pathname.split("/").filter(Boolean).join("-").replace(/[^\w-]/g, "_") || "index";
778
- return `${slug}${url.searchParams.get("csr") === "true" ? ".csr" : ""}.png`;
846
+ const url = AppPreview.probeUrlOf("http://localhost", pagePath);
847
+ const slugOf = (text) => text.replace(/[^\w-]/g, "_");
848
+ const hashOf = (text) => Bun.hash(text).toString(36).slice(0, 6);
849
+ const pathname = url.pathname.replace(/(.)\/+$/, "$1");
850
+ const plain = pathname.split("/").filter(Boolean).join("-");
851
+ const isPlain = /^(\/[a-z0-9]+)*$/.test(pathname) && plain.length <= 80;
852
+ const page = !plain ? "_index" : isPlain ? plain : `${slugOf(plain).slice(0, 80)}_${hashOf(pathname)}`;
853
+ const boot = ["csr=true", `akanMobileTarget=${AppPreview.csrTarget}`];
854
+ const pairs = url.search.slice(1).split("&").filter(Boolean);
855
+ const isBoot = boot.every((pair) => pairs.includes(pair));
856
+ const rest = isBoot ? pairs.filter((pair) => !boot.includes(pair)) : pairs;
857
+ const params = [...new URLSearchParams(rest.join("&"))];
858
+ const readable = slugOf(params.map(([key, value]) => `${key}-${value}`).join("-")).slice(0, 40);
859
+ const query = rest.length ? `.${readable}-${hashOf(rest.join("&"))}` : "";
860
+ return `${page}${query}${isBoot ? ".csr" : ""}.png`;
779
861
  }
780
862
  static attribute(page, records) {
781
863
  const pathname = new URL(page.finalUrl).pathname;
@@ -804,6 +886,8 @@ class AppPreview {
804
886
  lines.push("The app's log socket did not answer, so client and server errors are not shown.");
805
887
  for (const reason of report.skipped)
806
888
  lines.push(`Not opened: ${reason}.`);
889
+ for (const note of report.notes)
890
+ lines.push(`Note: ${note}`);
807
891
  lines.push("");
808
892
  for (const page of report.pages) {
809
893
  const verdict = page.failed ? "FAIL" : page.domFindings.length || page.consoleWarnings.length ? "warn" : "ok";
@@ -841,7 +925,7 @@ class AppPreview {
841
925
  screenshot,
842
926
  timeoutMs
843
927
  }) {
844
- const url = new URL(pagePath, origin).toString();
928
+ const url = AppPreview.probeUrlOf(origin, pagePath).toString();
845
929
  const at = Date.now();
846
930
  const page = {
847
931
  path: pagePath,
@@ -1230,6 +1314,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1230
1314
  #interrupt = new InterruptTeardown;
1231
1315
  async confirmDatabaseModeDependencyInstall(databaseMode, installSpecs) {
1232
1316
  assertPromptable(`Database mode '${databaseMode}' requires missing dependencies: ${installSpecs.join(", ")}`, {
1317
+ code: "failed",
1233
1318
  remedy: `install them first with \`bun add ${installSpecs.join(" ")}\``
1234
1319
  });
1235
1320
  return await confirm({
@@ -1258,6 +1343,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1258
1343
  }
1259
1344
  }
1260
1345
  async createApplication(appName, workspace, { start = false, libs = [] } = {}) {
1346
+ assertPlainName("app", appName);
1261
1347
  const spinner = workspace.spinning("Creating application...");
1262
1348
  const app = await this.applicationRunner.createApplication(appName, workspace, libs);
1263
1349
  spinner.succeed(`Application created in apps/${app.name}`);
@@ -1307,7 +1393,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1307
1393
  Logger3.rawLog(format === "json" ? JSON.stringify(report, null, 2) : AppPreview.render(report));
1308
1394
  if (!report.pages.some((page) => page.failed))
1309
1395
  return;
1310
- const failure = new ExitCodeError("preview found broken pages", 1);
1396
+ const failure = new CliError("checkFailed", "preview found broken pages");
1311
1397
  markCliErrorPrinted(failure);
1312
1398
  throw failure;
1313
1399
  }
@@ -1340,7 +1426,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1340
1426
  quiet = false,
1341
1427
  profile,
1342
1428
  env,
1343
- updateBudget = false
1429
+ budget = "report"
1344
1430
  } = {}) {
1345
1431
  await app.scanSync({ write });
1346
1432
  if (!quiet)
@@ -1351,10 +1437,12 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1351
1437
  spinner: !quiet,
1352
1438
  envProfile: profile,
1353
1439
  environment: env,
1354
- budget: updateBudget ? "update" : "enforce"
1440
+ budget
1355
1441
  });
1356
1442
  Logger3.rawLog(`${app.name} built in dist/apps/${app.name}`);
1357
- if (!quiet)
1443
+ if (quiet)
1444
+ ApplicationBuildReporter.printRouteJsWarnings(result);
1445
+ else
1358
1446
  ApplicationBuildReporter.printSummary(result);
1359
1447
  } catch (error) {
1360
1448
  Logger3.rawLog(`${app.name} build failed in dist/apps/${app.name}`, undefined, "error");
@@ -1364,9 +1452,9 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1364
1452
  }
1365
1453
  }
1366
1454
  async typecheck(exec, { write = true, clean = false, incremental = true, tests = false } = {}) {
1367
- if (!(exec instanceof AppExecutor) && !(exec instanceof LibExecutor))
1455
+ if (!(exec instanceof AppExecutor2) && !(exec instanceof LibExecutor2))
1368
1456
  throw new Error(`akan typecheck takes an app or a library; ${exec.name} is a package, checked by its own tsconfig.`);
1369
- if (exec instanceof AppExecutor)
1457
+ if (exec instanceof AppExecutor2)
1370
1458
  await exec.scanSync({ write });
1371
1459
  else if (write)
1372
1460
  await this.libraryScript.syncLibrary(exec);
@@ -1374,7 +1462,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1374
1462
  await exec.scan({ write: false });
1375
1463
  const spinner = exec.spinning(`Typechecking ${exec.name}${tests ? " with its tests" : ""}...`);
1376
1464
  try {
1377
- if (exec instanceof LibExecutor)
1465
+ if (exec instanceof LibExecutor2)
1378
1466
  await this.applicationRunner.typecheckLibrary(exec, { clean, incremental, tests });
1379
1467
  else
1380
1468
  await this.applicationRunner.typecheck(exec, { clean, incremental, tests });
@@ -1389,7 +1477,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1389
1477
  async test(exec, { write = true, files = [], coverage = false } = {}) {
1390
1478
  const testPaths = this.applicationRunner.resolveTestPaths(exec, files);
1391
1479
  const flags = coverage ? ApplicationScript.#coverageFlagsOf(exec) : [];
1392
- if (exec instanceof LibExecutor) {
1480
+ if (exec instanceof LibExecutor2) {
1393
1481
  if (write)
1394
1482
  await this.libraryScript.syncLibrary(exec);
1395
1483
  else
@@ -1400,7 +1488,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1400
1488
  }
1401
1489
  const spinner = exec.spinning(`Preparing ${exec.name}...`);
1402
1490
  try {
1403
- if (exec instanceof PkgExecutor)
1491
+ if (exec instanceof PkgExecutor2)
1404
1492
  await exec.scan({ refresh: true });
1405
1493
  else
1406
1494
  await exec.scanSync({ write });
@@ -1412,7 +1500,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1412
1500
  await this.applicationRunner.test(exec, testPaths, flags);
1413
1501
  }
1414
1502
  static #coverageFlagsOf(exec) {
1415
- const root = exec instanceof SysExecutor || exec instanceof PkgExecutor ? exec.workspace.workspaceRoot : null;
1503
+ const root = exec instanceof SysExecutor || exec instanceof PkgExecutor2 ? exec.workspace.workspaceRoot : null;
1416
1504
  const dir = root ? path3.join(root, "local", "coverage", path3.relative(root, exec.cwdPath)) : "local/coverage";
1417
1505
  return ["--coverage", "--coverage-reporter=text", "--coverage-reporter=lcov", `--coverage-dir=${dir}`];
1418
1506
  }
@@ -1483,7 +1571,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1483
1571
  throw new Error("No app selected to start");
1484
1572
  const startedDatabase = dbup ? await this.#prepareSharedDatabase(apps) : false;
1485
1573
  const supervisor = new DevSupervisor({ apps, mode, concurrency, open, write, shares });
1486
- const view = mode === "tui" ? new (await import("./devTui-w38ch13a.js")).DevTui(supervisor) : new DevStreamView(apps.map((app) => app.name));
1574
+ const view = mode === "tui" ? new (await import("./devTui-rf374y2w.js")).DevTui(supervisor) : new DevStreamView(apps.map((app) => app.name));
1487
1575
  await supervisor.run(view);
1488
1576
  if (startedDatabase)
1489
1577
  await this.#stopDatabase(workspace);
@@ -1615,7 +1703,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1615
1703
  await this.applicationRunner.transferDatabase(app, direction, dir);
1616
1704
  }
1617
1705
  async dbupDeclared(workspace, mode) {
1618
- 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())]);
1706
+ 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())]);
1619
1707
  const needing = declared.filter((each) => each !== "single");
1620
1708
  if (!needing.length) {
1621
1709
  workspace.log("No app here declares a database mode that runs on local services; single needs none.");
@@ -1647,7 +1735,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1647
1735
  await Promise.all(shares.map(async (share) => await share.close()));
1648
1736
  }, "Abandoning the tunnel release; the shares expire on their own.");
1649
1737
  await Promise.all(apps.map(async (app) => {
1650
- const { TunnelShare } = await import("./TunnelShare-zkfkrw8w.js");
1738
+ const { TunnelShare } = await import("./TunnelShare-bwe3ddv7.js");
1651
1739
  const share = await TunnelShare.open(app, { workspace: app.workspace });
1652
1740
  shares.push(share);
1653
1741
  urls.set(app.name, share.url);
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  AkanGraphDiff,
4
4
  AkanIndex
5
- } from "./index-m5sg5spm.js";
5
+ } from "./index-7ehdht84.js";
6
6
  import {
7
7
  GitRevision
8
- } from "./index-ygdbn9jn.js";
8
+ } from "./index-zyb0ebm4.js";
9
9
 
10
- // pkgs/@akanjs/devkit/workspaceGraph.ts
10
+ // pkgs/@akanjs/devkit/workspace/workspaceGraph.ts
11
11
  import { readFile } from "fs/promises";
12
12
  import path from "path";
13
13
  import ts from "typescript";
@@ -86,9 +86,22 @@ ${sha}`;
86
86
  const seeds = new Set(graph.nodes.filter((node) => (!owners || owners.has(node.owner ?? "")) && (!module || node.module === module)).map((node) => node.id));
87
87
  const guards = new Set(graph.nodes.filter((node) => node.kind === "guard").map((node) => node.id));
88
88
  const reaches = (id) => seeds.has(id) && !guards.has(id);
89
- const edges = graph.edges.filter((edge) => reaches(edge.from) || reaches(edge.to));
90
- const ids = new Set([...seeds, ...edges.flatMap((edge) => [edge.from, edge.to])]);
91
- return { version: 1, nodes: graph.nodes.filter((node) => ids.has(node.id)), edges };
89
+ const edges = graph.edges.filter((edge) => edge.kind !== "binds" && (reaches(edge.from) || reaches(edge.to)));
90
+ const kept = new Set([...seeds, ...edges.flatMap((edge) => [edge.from, edge.to])]);
91
+ const isLib = !!app && graph.nodes.some((node) => node.owner === `libs/${app}`) && !graph.nodes.some((node) => node.owner === `apps/${app}`);
92
+ const applicable = WorkspaceGraph.#bindingsOf(graph, app && !isLib ? `apps/${app}` : null);
93
+ const isOwn = (edge) => !module && !!owners?.has(edge.label ?? "");
94
+ const roles = new Set(applicable.filter((edge) => isOwn(edge) || kept.has(edge.from) || reaches(edge.to)).map((edge) => edge.from));
95
+ const bindings = applicable.filter((edge) => roles.has(edge.from));
96
+ const ids = new Set([...kept, ...bindings.flatMap((edge) => [edge.from, edge.to])]);
97
+ return { version: 1, nodes: graph.nodes.filter((node) => ids.has(node.id)), edges: [...edges, ...bindings] };
98
+ }
99
+ static #bindingsOf(graph, appOwner) {
100
+ const binds = graph.edges.filter((edge) => edge.kind === "binds");
101
+ if (!appOwner)
102
+ return binds;
103
+ const own = new Set(binds.filter((edge) => edge.label === appOwner && edge.change !== "removed").map((edge) => edge.from));
104
+ return binds.filter((edge) => edge.label === appOwner || !edge.label?.startsWith("apps/") && !own.has(edge.from));
92
105
  }
93
106
  static #withoutPages(graph) {
94
107
  const changed = new Set(graph.nodes.filter((node) => node.change).map((node) => node.id));
@@ -105,7 +118,12 @@ ${sha}`;
105
118
  const isVisible = ({ owner }) => !owner || owner === appOwner || owner.startsWith("libs/");
106
119
  const nodes = graph.nodes.filter(isVisible);
107
120
  const ids = new Set(nodes.map((node) => node.id));
108
- return { version: 1, nodes, edges: graph.edges.filter((edge) => ids.has(edge.from) && ids.has(edge.to)) };
121
+ const bindings = new Set(WorkspaceGraph.#bindingsOf(graph, appOwner));
122
+ return {
123
+ version: 1,
124
+ nodes,
125
+ edges: graph.edges.filter((edge) => ids.has(edge.from) && ids.has(edge.to) && (edge.kind !== "binds" || bindings.has(edge)))
126
+ };
109
127
  }
110
128
  static changesVisibleTo(changes, app) {
111
129
  const visible = WorkspaceGraph.visibleTo(changes, app);
@@ -6,29 +6,31 @@ import {
6
6
  CloudApi,
7
7
  CloudUpdates,
8
8
  PipelineSecrets
9
- } from "./index-e22zedc2.js";
9
+ } from "./index-5h888r6j.js";
10
10
  import {
11
11
  resolveMobileTargets
12
12
  } from "./index-m9jj544v.js";
13
13
  import {
14
- WorkspaceExecutor,
15
- AppExecutor
16
- } from "./index-wfmpxke3.js";
14
+ WorkspaceExecutor
15
+ } from "./index-qssq2d41.js";
16
+ import {
17
+ AppExecutor2
18
+ } from "./index-ze48c0vd.js";
17
19
  import {
18
20
  NativeApp
19
- } from "./index-djc5nxpy.js";
21
+ } from "./index-w23tf30e.js";
20
22
  import {
21
23
  runner,
22
24
  assertPromptable
23
- } from "./index-386canwe.js";
25
+ } from "./index-9rv2zt48.js";
24
26
  import {
25
27
  getNpmRegistryUrl,
26
28
  getPublishedVersions,
27
29
  getLatestPackageVersion
28
- } from "./index-ny2k80mv.js";
30
+ } from "./index-ffa52fwf.js";
29
31
  import {
30
32
  SubspaceConfig
31
- } from "./index-h7hehkw6.js";
33
+ } from "./index-xczjdng6.js";
32
34
  import {
33
35
  openBrowser
34
36
  } from "./index-9dp031by.js";
@@ -715,7 +717,7 @@ class EnvArchive {
715
717
  static async#secretGlobs(workspace) {
716
718
  const [appNames] = await workspace.getExecs();
717
719
  const entries = await Promise.all(appNames.map(async (appName) => {
718
- const { secrets = [] } = await AppExecutor.from(workspace, appName).getConfig();
720
+ const { secrets = [] } = await AppExecutor2.from(workspace, appName).getConfig();
719
721
  return [appName, secrets.map((pattern) => new Bun.Glob(pattern))];
720
722
  }));
721
723
  return new Map(entries);
@@ -1067,6 +1069,7 @@ ${run.format(results)}
1067
1069
  if (!interactive)
1068
1070
  continue;
1069
1071
  assertPromptable(`${result.platform} did not pass (${reason}) \u2014 ${run.logDir}`, {
1072
+ code: "failed",
1070
1073
  remedy: "leave it out of --platforms to publish without it, or run it in a terminal to be asked"
1071
1074
  });
1072
1075
  const proceed = await confirm({
@@ -1169,6 +1172,44 @@ ${run.format(results)}
1169
1172
  Logger3.info(`${library}@${nextVersion} is published to ${registry ?? "npm"}`);
1170
1173
  }
1171
1174
  Logger3.info(`All libraries are published to ${registry ?? "npm"}`);
1175
+ if (!registry && isOfficialRelease)
1176
+ await this.releaseEditorExtension(workspace);
1177
+ }
1178
+ async releaseEditorExtension(workspace) {
1179
+ const repo = "akan-team/akanjs";
1180
+ const bundled = [
1181
+ "pkgs/@akanjs/vscode",
1182
+ "pkgs/@akanjs/language",
1183
+ ":(exclude)pkgs/@akanjs/language/package.json",
1184
+ ":(exclude)pkgs/@akanjs/language/CHANGELOG.md",
1185
+ "pkgs/akanjs/common/akanNames.ts",
1186
+ "pkgs/akanjs/common/akanGraph.ts",
1187
+ "pkgs/akanjs/common/capitalize.ts",
1188
+ "apps/akan/public/icon-512x512.png",
1189
+ "bun.lock"
1190
+ ];
1191
+ try {
1192
+ if ((await workspace.spawn("git", ["status", "--porcelain", "--", ...bundled])).trim())
1193
+ throw new Error("files the extension bundles have uncommitted changes, such as the version `changeset version` wrote");
1194
+ const sha = (await workspace.spawn("git", ["rev-parse", "HEAD"])).trim();
1195
+ const onMain = (await workspace.spawn("gh", ["api", `repos/${repo}/compare/${sha}...main`, "--jq", ".status"])).trim();
1196
+ if (onMain !== "identical" && onMain !== "ahead")
1197
+ throw new Error(`${sha.slice(0, 9)} is not on main`);
1198
+ await workspace.spawn("gh", [
1199
+ "workflow",
1200
+ "run",
1201
+ "vscode-publish.yml",
1202
+ "--repo",
1203
+ repo,
1204
+ "--ref",
1205
+ "main",
1206
+ "-f",
1207
+ `sha=${sha}`
1208
+ ]);
1209
+ Logger3.info(`CI is releasing the editor extension from ${sha.slice(0, 9)}: https://github.com/${repo}/actions/workflows/vscode-publish.yml`);
1210
+ } catch (error) {
1211
+ Logger3.warn(`The editor extension was not released: ${error instanceof Error ? error.message : String(error)}. Commit and push the release to main, then run from that commit \`gh workflow run vscode-publish.yml --repo ${repo} --ref main -f sha=$(git rev-parse HEAD)\``);
1212
+ }
1172
1213
  }
1173
1214
  #dependenciesFirst(libraries, dependencies) {
1174
1215
  const ordered = [];
@@ -1244,7 +1285,7 @@ ${run.format(results)}
1244
1285
  async downloadEnv(cloudApi, workspace, workspaceId) {
1245
1286
  await workspace.mkdir("local");
1246
1287
  const localPath = await cloudApi.downloadEnv(workspaceId).catch((error) => {
1247
- throw CloudApi.refusal(error, "downloading its env archive takes the project owner's own `akan login`");
1288
+ throw CloudApi.refusal(error, "only the repository owner, or an owner or operator they allowed on the project's settings page, can download its env archive; sign in as one of them with `akan login`");
1248
1289
  });
1249
1290
  await EnvArchive.extract(workspace, localPath);
1250
1291
  await workspace.remove(localPath);
@@ -1316,7 +1357,7 @@ ${run.format(results)}
1316
1357
  }
1317
1358
  async#gatherCustomSecretFiles(workspace, appNames) {
1318
1359
  const secretPaths = await Promise.all(appNames.map(async (appName) => {
1319
- const config = await AppExecutor.from(workspace, appName).getConfig();
1360
+ const config = await AppExecutor2.from(workspace, appName).getConfig();
1320
1361
  const secretGlobs = config.secrets ?? [];
1321
1362
  if (secretGlobs.length === 0)
1322
1363
  return [];
@@ -1400,7 +1441,7 @@ ${run.format(results)}
1400
1441
  }
1401
1442
  async#syncSecretGitignore(workspace, appNames) {
1402
1443
  const patterns = (await Promise.all(appNames.map(async (appName) => {
1403
- const config = await AppExecutor.from(workspace, appName).getConfig();
1444
+ const config = await AppExecutor2.from(workspace, appName).getConfig();
1404
1445
  return (config.secrets ?? []).map((pattern) => `apps/${appName}/${pattern.replace(/^\/+/, "")}`);
1405
1446
  }))).flat();
1406
1447
  const uniquePatterns = [...new Set(patterns)].sort();
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- // pkgs/@akanjs/devkit/recipeScanner.ts
2
+ // pkgs/@akanjs/devkit/context/recipeScanner.ts
3
3
  import { readdir } from "fs/promises";
4
4
  import ts from "typescript";
5
5
  var collectRecipeSources2 = async (uiDirPath, importFrom, basename = "Recipe") => {