@akanjs/cli 3.2.0-rc.3 → 3.2.0-rc.4

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 (74) hide show
  1. package/.build-stamp +2 -1
  2. package/{CodeAgent-e9c712an.js → CodeAgent-4a2skdph.js} +3 -3
  3. package/{CodeTui-wv9yf7eq.js → CodeTui-enrzsnzc.js} +1 -1
  4. package/{TunnelShare-zkfkrw8w.js → TunnelShare-xs5rrpf1.js} +5 -5
  5. package/{agent.command-9erafkcb.js → agent.command-y22t9x1e.js} +11 -11
  6. package/akanCode.js +3 -3
  7. package/{application.command-6515t682.js → application.command-yhj5arwc.js} +10 -10
  8. package/{applicationBuildRunner-bqbyeg84.js → applicationBuildRunner-6w1fd61b.js} +5 -5
  9. package/buildBatch.proc.js +4 -4
  10. package/{cloud.command-32esk0v1.js → cloud.command-bqfh4cnx.js} +13 -13
  11. package/{cloud.script-arsagnq6.js → cloud.script-8jvfw1sh.js} +13 -13
  12. package/{code.command-xk7rwq2x.js → code.command-y94hwxsn.js} +5 -5
  13. package/{context.command-jwenkkf0.js → context.command-xz65fhrn.js} +15 -15
  14. package/context.runner-dpt5wjb7.js +29 -0
  15. package/{devTui-cd03z4mx.js → devTui-h77zrjv5.js} +1 -1
  16. package/{guideline.command-w6yqpdec.js → guideline.command-sn843nw6.js} +1 -1
  17. package/guidelines/conventions/rules/page.md +4 -0
  18. package/guidelines/pageRule/pageRule.instruction.md +5 -0
  19. package/guidelines/runtimeRule/runtimeRule.instruction.md +5 -1
  20. package/guidelines/transportRule/transportRule.instruction.md +5 -0
  21. package/incrementalBuilder.proc.js +2 -2
  22. package/{index-xrmrvafh.js → index-02b8qvww.js} +2 -2
  23. package/{index-j1hjb477.js → index-2rcptfyp.js} +1 -1
  24. package/{index-84c2pgak.js → index-3rff2c48.js} +1 -0
  25. package/{index-dpgywgeq.js → index-3wen6ddy.js} +1 -1
  26. package/{index-43acpsc7.js → index-49y45vbj.js} +9 -9
  27. package/{index-8gm4yag8.js → index-4mgabs8t.js} +4 -4
  28. package/{index-ytpmk3pb.js → index-50mg8bsm.js} +4 -4
  29. package/{index-20wvskt8.js → index-5hhe0rdd.js} +1 -1
  30. package/{index-kcpk2d20.js → index-5qq6qky3.js} +8 -8
  31. package/{index-vbhx60x5.js → index-5w8amdr7.js} +1 -1
  32. package/{index-bdmgqzb5.js → index-8vxdsqra.js} +35 -22
  33. package/{index-ddk49ypz.js → index-ah09graf.js} +53 -26
  34. package/{index-sc0g6zbm.js → index-b4qq3rq0.js} +23 -10
  35. package/{index-2eym1yjb.js → index-b9q5aw30.js} +10 -10
  36. package/{index-ngpt3zz3.js → index-fqx74yxn.js} +11 -8
  37. package/{index-djc5nxpy.js → index-g43360sn.js} +2 -2
  38. package/{index-bak9f2br.js → index-gsty3pkx.js} +5 -1
  39. package/{index-386canwe.js → index-hkq0q73d.js} +44 -25
  40. package/{index-s34v3y28.js → index-jgj6ajnk.js} +4 -4
  41. package/{index-zhkcab5a.js → index-jqsj5wjb.js} +1 -1
  42. package/{index-54s6knqe.js → index-jrdp7c4h.js} +2 -2
  43. package/{index-wr9magsr.js → index-jxaq2evq.js} +1 -1
  44. package/{index-h0p6n4k1.js → index-kgxhwgdk.js} +3 -3
  45. package/{index-6h775rv3.js → index-kjmrkc45.js} +4 -4
  46. package/{index-qrk06tfp.js → index-kr8dvqnr.js} +1 -1
  47. package/{index-j4hkbzj6.js → index-qrp98bmp.js} +4 -4
  48. package/{index-0ba8nj4d.js → index-sjj3ywn5.js} +16 -9
  49. package/index-va90m8nd.js +25 -0
  50. package/{index-e22zedc2.js → index-vftjqv28.js} +2 -2
  51. package/{index-2rqyrvcy.js → index-w15hnxmb.js} +5 -5
  52. package/{index-zcdmnfrf.js → index-w88xghey.js} +6 -6
  53. package/{index-7kmbqp0b.js → index-z9b72teg.js} +1 -1
  54. package/index.js +22 -22
  55. package/{library.command-qs8beggh.js → library.command-6eafevmj.js} +2 -2
  56. package/{localRegistry.command-hz4ged9n.js → localRegistry.command-9tef2qsj.js} +12 -12
  57. package/{module.command-z9js77m2.js → module.command-pn1k7dfk.js} +9 -5
  58. package/{package.command-zqenq8c0.js → package.command-kbg9z7re.js} +2 -2
  59. package/package.json +2 -2
  60. package/{page.command-t0nx1jat.js → page.command-st0y2xg8.js} +2 -2
  61. package/{pipeline.command-2yjeas7m.js → pipeline.command-76m32y7z.js} +1 -1
  62. package/{primitive.command-v5kypwy4.js → primitive.command-ax6wg70s.js} +5 -5
  63. package/{quality.command-q55j2htd.js → quality.command-0gzskga8.js} +2 -2
  64. package/{repair.command-7ssbbdq2.js → repair.command-g5kc3x89.js} +4 -4
  65. package/{scalar.command-p5jb7z57.js → scalar.command-ck8621dy.js} +3 -3
  66. package/skills/akan-debug/SKILL.md +6 -2
  67. package/skills/akan-transport/SKILL.md +2 -0
  68. package/{subspace.command-7wxy6ptj.js → subspace.command-vh6dye0v.js} +6 -6
  69. package/{tunnel.command-22g11n0x.js → tunnel.command-4mezrypt.js} +6 -6
  70. package/{verify.command-m0wnndd7.js → verify.command-f2n4bwp7.js} +8 -8
  71. package/{workflow.command-jx8dqs9n.js → workflow.command-bx9xwgs5.js} +9 -9
  72. package/{workspace.command-ca9kfyt3.js → workspace.command-04qgwsst.js} +27 -27
  73. package/context.runner-mqpp67br.js +0 -29
  74. package/index-x3x31df8.js +0 -14
@@ -14,12 +14,12 @@ import {
14
14
  import {
15
15
  PreviewView2,
16
16
  stripAnsi
17
- } from "./index-sc0g6zbm.js";
17
+ } from "./index-b4qq3rq0.js";
18
18
  import {
19
19
  SubagentPool2,
20
20
  McpSignIn,
21
21
  AkanCodeCompaction2
22
- } from "./index-qrk06tfp.js";
22
+ } from "./index-kr8dvqnr.js";
23
23
  import {
24
24
  codeAgentIsLoopback,
25
25
  codeAgentHostListed,
@@ -659,7 +659,7 @@ class AkanToolPack2 {
659
659
  return { name: "akan-tools", factory: async (pi) => await this.#register(pi) };
660
660
  }
661
661
  async names() {
662
- const { ContextRunner } = await import("./context.runner-mqpp67br.js");
662
+ const { ContextRunner } = await import("./context.runner-dpt5wjb7.js");
663
663
  return [
664
664
  ...new ContextRunner().listMcpTools(this.#options.mode).map((tool) => tool.name),
665
665
  AkanToolPack2.verifyToolName
@@ -667,7 +667,7 @@ class AkanToolPack2 {
667
667
  }
668
668
  static verifyToolName = "akan_verify";
669
669
  async#register(pi) {
670
- const { ContextRunner } = await import("./context.runner-mqpp67br.js");
670
+ const { ContextRunner } = await import("./context.runner-dpt5wjb7.js");
671
671
  const runner = new ContextRunner;
672
672
  const guidelineNames = await AkanToolPack2.#guidelineNames();
673
673
  for (const tool of runner.listMcpTools(this.#options.mode, { guidelineNames })) {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  DesktopBin
4
- } from "./index-djc5nxpy.js";
4
+ } from "./index-g43360sn.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";
@@ -51,16 +51,16 @@ import {
51
51
  runner,
52
52
  ExitCodeError,
53
53
  assertPromptable
54
- } from "./index-386canwe.js";
54
+ } from "./index-hkq0q73d.js";
55
55
  import {
56
56
  UpdatePackFolder,
57
57
  UpdateUploader,
58
58
  NativePublicEnv,
59
59
  NativeApp
60
- } from "./index-djc5nxpy.js";
60
+ } from "./index-g43360sn.js";
61
61
  import {
62
62
  DesktopServerStage
63
- } from "./index-20wvskt8.js";
63
+ } from "./index-5hhe0rdd.js";
64
64
  import {
65
65
  resolveMobileTargets,
66
66
  resolveAppId
@@ -569,7 +569,7 @@ class IncrementalBuilderHost {
569
569
  this.#inFlight.clear();
570
570
  this.logger.warn(`failing ${lost.length} unanswered builder request(s): ${reason}`);
571
571
  for (const [id, type] of lost)
572
- this.#onMessage({ type: `${type}-res`, id, ok: false, error: reason });
572
+ this.#onMessage({ type: `${type}-res`, id, ok: false, error: reason, kind: "unavailable" });
573
573
  }
574
574
  stop() {
575
575
  this.#manualStop = true;
@@ -1608,11 +1608,11 @@ ${this.#backendStderrTail.join(`
1608
1608
  }
1609
1609
  #failBuilderRequest(message, error) {
1610
1610
  if (message.type === "build-route")
1611
- this.#sendToBackend({ type: "build-route-res", id: message.id, ok: false, error });
1611
+ this.#sendToBackend({ type: "build-route-res", id: message.id, ok: false, error, kind: "unavailable" });
1612
1612
  else if (message.type === "build-csr")
1613
- this.#sendToBackend({ type: "build-csr-res", id: message.id, ok: false, error });
1613
+ this.#sendToBackend({ type: "build-csr-res", id: message.id, ok: false, error, kind: "unavailable" });
1614
1614
  else if (message.type === "build-graph")
1615
- this.#sendToBackend({ type: "build-graph-res", id: message.id, ok: false, error });
1615
+ this.#sendToBackend({ type: "build-graph-res", id: message.id, ok: false, error, kind: "unavailable" });
1616
1616
  else
1617
1617
  return false;
1618
1618
  return true;
@@ -2038,7 +2038,7 @@ var reportsNoTestFile = (exec) => {
2038
2038
  };
2039
2039
 
2040
2040
  // pkgs/@akanjs/cli/application/application.runner.ts
2041
- var loadBuildRunner = async () => (await import("./applicationBuildRunner-bqbyeg84.js")).ApplicationBuildRunner;
2041
+ var loadBuildRunner = async () => (await import("./applicationBuildRunner-6w1fd61b.js")).ApplicationBuildRunner;
2042
2042
  var loadPrompts = async () => await import("@inquirer/prompts");
2043
2043
 
2044
2044
  class ApplicationRunner extends runner("application") {
@@ -21,7 +21,7 @@ import {
21
21
  CsrDevPaths,
22
22
  PagesEntrySourceGenerator,
23
23
  PagesBundleBuilder
24
- } from "./index-84c2pgak.js";
24
+ } from "./index-3rff2c48.js";
25
25
  import {
26
26
  AsyncDefaultExportDetector,
27
27
  StoreBootstrap,
@@ -9,7 +9,7 @@ import {
9
9
  ClientEntriesBundler,
10
10
  VENDOR_SPECIFIERS,
11
11
  RouteClientBuilder
12
- } from "./index-vbhx60x5.js";
12
+ } from "./index-5w8amdr7.js";
13
13
  import {
14
14
  SOURCE_EXTS,
15
15
  FontOptimizer,
@@ -22,7 +22,7 @@ import {
22
22
  CsrEntryFiles,
23
23
  toClientReferencePath,
24
24
  PagesBundleBuilder
25
- } from "./index-84c2pgak.js";
25
+ } from "./index-3rff2c48.js";
26
26
  import {
27
27
  CssBlockParser
28
28
  } from "./index-62md4dwy.js";
@@ -975,16 +975,7 @@ class SsrBaseArtifactBuilder {
975
975
  const rscClientUrl = clientBundle.entryUrlsByAbsPath.get(rscClientEntry) ?? "";
976
976
  const rscRuntimeSsrManifest = {
977
977
  moduleLoading: null,
978
- moduleMap: Object.fromEntries(Object.entries(clientBundle.manifest).map(([key, row]) => {
979
- const ssrOutput = ssrBundle.entryOutputAbsByAbsPath.get(rscSegmentOutletEntry);
980
- if (!ssrOutput || key !== `${clientBundle.clientReferenceIdByAbsPath.get(rscSegmentOutletEntry)}#${row.name}`) {
981
- return null;
982
- }
983
- return [
984
- row.id,
985
- { [row.name]: { id: ssrOutput, chunks: [ssrOutput, ssrOutput], name: row.name, async: true } }
986
- ];
987
- }).filter((entry) => Boolean(entry)))
978
+ moduleMap: SsrBaseArtifactBuilder.outletModuleMap(clientBundle.manifest, clientBundle.clientReferenceIdByAbsPath.get(rscSegmentOutletEntry), ssrBundle.entryOutputAbsByAbsPath.get(rscSegmentOutletEntry))
988
979
  };
989
980
  const vendorMap = Object.fromEntries(vendorEntries.map(({ specifier, absPath }) => [specifier, clientBundle.entryUrlsByAbsPath.get(absPath) ?? ""]));
990
981
  this.#app.verbose(`[base-artifact] rscClientUrl=${rscClientUrl} vendors=${Object.keys(vendorMap).length}`);
@@ -1000,6 +991,20 @@ class SsrBaseArtifactBuilder {
1000
991
  }
1001
992
  };
1002
993
  }
994
+ static outletModuleMap(manifest, outletReferenceId, ssrOutput) {
995
+ const moduleMap = {};
996
+ if (!ssrOutput || !outletReferenceId)
997
+ return moduleMap;
998
+ for (const [key, row] of Object.entries(manifest)) {
999
+ if (key !== `${outletReferenceId}#${row.name}`)
1000
+ continue;
1001
+ moduleMap[row.id] = {
1002
+ ...moduleMap[row.id],
1003
+ [row.name]: { id: ssrOutput, chunks: [ssrOutput, ssrOutput], name: row.name, async: true }
1004
+ };
1005
+ }
1006
+ return moduleMap;
1007
+ }
1003
1008
  async#resolveAkanServerPath() {
1004
1009
  const candidates = [];
1005
1010
  try {
@@ -1070,28 +1075,36 @@ class VendorImportScanner {
1070
1075
  for (const specifier of specifiers)
1071
1076
  this.#names.set(specifier, new Set);
1072
1077
  }
1073
- static async exportsUsedIn(dir, specifiers) {
1078
+ static async exportsUsedIn(dir, specifiers, entryUrls) {
1074
1079
  const scanner = new VendorImportScanner(specifiers);
1075
- if (!fs3.existsSync(dir))
1076
- return scanner.usedExports();
1077
- for await (const relative of new Bun.Glob("**/*.js").scan({ cwd: dir }))
1078
- scanner.scan(await Bun.file(path8.join(dir, relative)).text(), relative);
1080
+ const scanned = [];
1081
+ if (fs3.existsSync(dir))
1082
+ for await (const relative of new Bun.Glob("**/*.js").scan({ cwd: dir })) {
1083
+ scanner.scan(await Bun.file(path8.join(dir, relative)).text(), relative);
1084
+ scanned.push(`/${relative.split(path8.sep).join("/")}`);
1085
+ }
1086
+ const unread = [...new Set(entryUrls)].filter((url) => !scanned.some((relative) => url.endsWith(relative)));
1087
+ if (unread.length > 0) {
1088
+ const named = `${unread.slice(0, 3).join(", ")}${unread.length > 3 ? `, and ${unread.length - 3} more` : ""}`;
1089
+ throw new Error(`[VendorImportScanner] no file under ${dir} for the route client entries ${named}; narrowing the vendor entries without them would drop names those pages import`);
1090
+ }
1079
1091
  return scanner.usedExports();
1080
1092
  }
1081
1093
  scan(source, fileName = "chunk.js") {
1082
1094
  if (![...this.#specifiers].some((specifier) => source.includes(specifier)))
1083
1095
  return this;
1084
- const file = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, false, ts.ScriptKind.JS);
1085
- const visit = (node) => {
1096
+ const stack = [ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, false, ts.ScriptKind.JS)];
1097
+ for (let node = stack.pop();node; node = stack.pop()) {
1086
1098
  if (ts.isImportDeclaration(node))
1087
1099
  this.#readImport(node);
1088
1100
  else if (ts.isExportDeclaration(node))
1089
1101
  this.#readExport(node);
1090
1102
  else if (ts.isCallExpression(node))
1091
1103
  this.#readCall(node);
1092
- ts.forEachChild(node, visit);
1093
- };
1094
- visit(file);
1104
+ ts.forEachChild(node, (child) => {
1105
+ stack.push(child);
1106
+ });
1107
+ }
1095
1108
  return this;
1096
1109
  }
1097
1110
  usedExports() {
@@ -7,7 +7,7 @@ import {
7
7
  ExitCodeError,
8
8
  markCliErrorPrinted,
9
9
  assertPromptable
10
- } from "./index-386canwe.js";
10
+ } from "./index-hkq0q73d.js";
11
11
  import {
12
12
  SysExecutor,
13
13
  AppExecutor,
@@ -16,25 +16,25 @@ import {
16
16
  } from "./index-wfmpxke3.js";
17
17
  import {
18
18
  DesktopServerStage
19
- } from "./index-20wvskt8.js";
19
+ } from "./index-5hhe0rdd.js";
20
20
  import {
21
21
  LibraryScript
22
- } from "./index-54s6knqe.js";
22
+ } from "./index-jrdp7c4h.js";
23
23
  import {
24
24
  ApplicationRunner,
25
25
  VerifyScope
26
- } from "./index-kcpk2d20.js";
26
+ } from "./index-5qq6qky3.js";
27
27
  import {
28
28
  PreviewChrome2,
29
29
  PreviewView2,
30
30
  stripAnsi
31
- } from "./index-sc0g6zbm.js";
31
+ } from "./index-b4qq3rq0.js";
32
32
  import {
33
33
  formatSlicePlan
34
34
  } from "./index-8jpc5fqv.js";
35
35
  import {
36
36
  assertPlainName
37
- } from "./index-x3x31df8.js";
37
+ } from "./index-va90m8nd.js";
38
38
  import {
39
39
  openBrowser
40
40
  } from "./index-9dp031by.js";
@@ -633,15 +633,10 @@ class AppPreview {
633
633
  const unavailable = PreviewView2.unavailableReason(engine);
634
634
  if (unavailable)
635
635
  throw new Error(unavailable);
636
- const { i18n, api } = await app.getConfig();
637
636
  const changed = options.changed ? await AppPreview.#changedPages(app) : { paths: [], skipped: [] };
638
637
  if (options.changed && !changed.paths.length && !options.paths?.length)
639
638
  throw new Error(`No page to open: ${changed.skipped.join("; ")}. Pass a concrete path, e.g. \`akan preview ${app.name} /memo/1\`.`);
640
- const paths = AppPreview.pagePaths([...options.paths ?? [], ...changed.paths], i18n, {
641
- csr: !!options.csr,
642
- apiPrefix: api.prefix,
643
- publicDir: path2.join(app.cwdPath, "public")
644
- });
639
+ const paths = await AppPreview.pathsOf(app, options.paths ?? [], !!options.csr, changed.paths);
645
640
  const port = await app.getDevPort();
646
641
  const origin = `http://localhost:${port}`;
647
642
  const root = app.workspace.workspaceRoot;
@@ -693,12 +688,23 @@ class AppPreview {
693
688
  started?.proc.unref();
694
689
  }
695
690
  }
696
- static pagePaths(paths, i18n, { csr, apiPrefix = "/api", publicDir = null }) {
691
+ static async pathsOf(app, paths, csr, pages = []) {
692
+ const { i18n, api } = await app.getConfig();
693
+ return AppPreview.pagePaths(paths, i18n, {
694
+ csr,
695
+ apiPrefix: api.prefix,
696
+ publicDir: path2.join(app.cwdPath, "public"),
697
+ pages
698
+ });
699
+ }
700
+ static pagePaths(paths, i18n, {
701
+ csr,
702
+ apiPrefix = "/api",
703
+ publicDir = null,
704
+ pages = []
705
+ }) {
697
706
  const keepsUnprefixed = i18n.localePrefix === "as-needed" && !csr;
698
- const pages = (paths.length ? paths : ["/"]).map((raw) => {
699
- const url = new URL(/^https?:\/\//.test(raw) ? raw : `http://localhost${raw.startsWith("/") ? "" : "/"}${raw}`);
700
- if (!AppPreview.#isPagePath(url.pathname, i18n, { apiPrefix, publicDir }))
701
- return `${url.pathname}${url.search}`;
707
+ const asPage = (url) => {
702
708
  const [first] = url.pathname.split("/").filter(Boolean);
703
709
  if (!keepsUnprefixed && (!first || !i18n.locales.includes(first)))
704
710
  url.pathname = `/${i18n.defaultLocale}${url.pathname === "/" ? "/" : url.pathname}`;
@@ -707,11 +713,26 @@ class AppPreview {
707
713
  url.searchParams.set("akanMobileTarget", AppPreview.csrTarget);
708
714
  }
709
715
  return `${url.pathname}${url.search}`;
716
+ };
717
+ const urlOf = (raw) => new URL(`http://localhost${raw.startsWith("/") ? "" : "/"}${raw}`);
718
+ const typed = (paths.length || pages.length ? paths : ["/"]).map((raw) => {
719
+ if (/^https?:\/\//.test(raw)) {
720
+ const url = new URL(raw);
721
+ return `${url.pathname}${url.search}`;
722
+ }
723
+ const url = urlOf(raw);
724
+ return AppPreview.#isPagePath(url.pathname, i18n, { apiPrefix, publicDir }) ? asPage(url) : `${url.pathname}${url.search}`;
710
725
  });
711
- return [...new Set(pages)];
712
- }
713
- static #serverFiles = new Set(["/favicon.ico", "/robots.txt", "/sitemap.xml", "/manifest.webmanifest"]);
714
- static #basePathFiles = new Set(["sitemap.xml", "manifest.webmanifest"]);
726
+ return [...new Set([...typed, ...pages.map((page) => asPage(urlOf(page)))])];
727
+ }
728
+ static #serverFiles = new Set([
729
+ "/favicon.ico",
730
+ "/robots.txt",
731
+ "/sitemap.xml",
732
+ "/manifest.webmanifest",
733
+ "/openapi.json",
734
+ "/mcp"
735
+ ]);
715
736
  static #isPagePath(pathname, i18n, { apiPrefix, publicDir }) {
716
737
  const segments = pathname.split("/").filter(Boolean);
717
738
  const [first] = segments;
@@ -722,7 +743,7 @@ class AppPreview {
722
743
  return false;
723
744
  if (AppPreview.#serverFiles.has(pathname))
724
745
  return false;
725
- if (segments.length === 2 && AppPreview.#basePathFiles.has(segments[1] ?? ""))
746
+ if (segments.length === 2 && segments[1] === "manifest.webmanifest")
726
747
  return false;
727
748
  return !(publicDir && AppPreview.#isPublicFile(publicDir, pathname));
728
749
  }
@@ -777,8 +798,14 @@ class AppPreview {
777
798
  }
778
799
  static screenshotName(pagePath) {
779
800
  const url = new URL(pagePath, "http://localhost");
780
- const slug = url.pathname.split("/").filter(Boolean).join("-").replace(/[^\w-]/g, "_") || "index";
781
- return `${slug}${url.searchParams.get("csr") === "true" ? ".csr" : ""}.png`;
801
+ const slugOf = (text) => text.replace(/[^\w-]/g, "_");
802
+ const hashOf = (text) => Bun.hash(text).toString(36).slice(0, 6);
803
+ const pathSlug = slugOf(url.pathname.split("/").filter(Boolean).join("-")) || "index";
804
+ const page = pathSlug.length > 80 ? `${pathSlug.slice(0, 80)}-${hashOf(url.pathname)}` : pathSlug;
805
+ const params = [...url.searchParams].filter(([key]) => key !== "csr" && key !== "akanMobileTarget");
806
+ const readable = slugOf(params.map(([key, value]) => `${key}-${value}`).join("-")).slice(0, 40);
807
+ const query = params.length ? `.${readable}-${hashOf(new URLSearchParams(params).toString())}` : "";
808
+ return `${page}${query}${url.searchParams.get("csr") === "true" ? ".csr" : ""}.png`;
782
809
  }
783
810
  static attribute(page, records) {
784
811
  const pathname = new URL(page.finalUrl).pathname;
@@ -1487,7 +1514,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1487
1514
  throw new Error("No app selected to start");
1488
1515
  const startedDatabase = dbup ? await this.#prepareSharedDatabase(apps) : false;
1489
1516
  const supervisor = new DevSupervisor({ apps, mode, concurrency, open, write, shares });
1490
- const view = mode === "tui" ? new (await import("./devTui-cd03z4mx.js")).DevTui(supervisor) : new DevStreamView(apps.map((app) => app.name));
1517
+ const view = mode === "tui" ? new (await import("./devTui-h77zrjv5.js")).DevTui(supervisor) : new DevStreamView(apps.map((app) => app.name));
1491
1518
  await supervisor.run(view);
1492
1519
  if (startedDatabase)
1493
1520
  await this.#stopDatabase(workspace);
@@ -1651,7 +1678,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1651
1678
  await Promise.all(shares.map(async (share) => await share.close()));
1652
1679
  }, "Abandoning the tunnel release; the shares expire on their own.");
1653
1680
  await Promise.all(apps.map(async (app) => {
1654
- const { TunnelShare } = await import("./TunnelShare-zkfkrw8w.js");
1681
+ const { TunnelShare } = await import("./TunnelShare-xs5rrpf1.js");
1655
1682
  const share = await TunnelShare.open(app, { workspace: app.workspace });
1656
1683
  shares.push(share);
1657
1684
  urls.set(app.name, share.url);
@@ -102,17 +102,8 @@ class PreviewView2 {
102
102
  settleMs = 0
103
103
  } = {}) {
104
104
  const logs = [];
105
- const view = PreviewView2.#open({ width, height, engine, onConsole: (line) => logs.push(line) });
105
+ const view = await PreviewView2.#start(() => PreviewView2.#open({ width, height, engine, onConsole: (line) => logs.push(line) }), engine, { startTimeoutMs, timeoutMs });
106
106
  try {
107
- const startMs = PreviewView2.#stalled.has(engine) ? Math.min(startTimeoutMs, timeoutMs) : startTimeoutMs;
108
- const stalled = new Error(`Timed out starting the ${engine} browser after ${startMs / 1000} s.`);
109
- await PreviewView2.#within(view.navigate("about:blank"), Date.now() + startMs, stalled).then(() => PreviewView2.#stalled.delete(engine), (error) => {
110
- if (error === stalled)
111
- PreviewView2.#stalled.add(engine);
112
- else
113
- PreviewView2.#stalled.delete(engine);
114
- throw error;
115
- });
116
107
  const deadline = Date.now() + timeoutMs;
117
108
  const within = (work, what) => PreviewView2.#within(work, deadline, new Error(`Timed out ${what} ${url}; the dev server may be rebuilding or stuck.`));
118
109
  let page = await PreviewView2.#load(view, url, settleMs, within);
@@ -138,6 +129,28 @@ class PreviewView2 {
138
129
  await view.close();
139
130
  }
140
131
  }
132
+ static async#start(open, engine, { startTimeoutMs, timeoutMs }) {
133
+ for (let attempt = 1;; attempt++) {
134
+ const startMs = PreviewView2.#stalled.has(engine) ? Math.min(startTimeoutMs, timeoutMs) : startTimeoutMs;
135
+ const stalled = new Error(`Timed out starting the ${engine} browser after ${startMs / 1000} s.`);
136
+ let view;
137
+ try {
138
+ view = open();
139
+ await PreviewView2.#within(view.navigate("about:blank"), Date.now() + startMs, stalled);
140
+ PreviewView2.#stalled.delete(engine);
141
+ return view;
142
+ } catch (error) {
143
+ await view?.close();
144
+ if (error === stalled)
145
+ PreviewView2.#stalled.add(engine);
146
+ else
147
+ PreviewView2.#stalled.delete(engine);
148
+ if (error === stalled || attempt > 1)
149
+ throw error;
150
+ await Bun.sleep(100);
151
+ }
152
+ }
153
+ }
141
154
  static async#load(view, url, settleMs, within) {
142
155
  await within(view.navigate(url), "loading");
143
156
  if (settleMs > 0)
@@ -1,4 +1,7 @@
1
1
  // @bun
2
+ import {
3
+ AppExecutor
4
+ } from "./index-wfmpxke3.js";
2
5
  import {
3
6
  buildResourceList,
4
7
  codexMcpConfigPath,
@@ -8,26 +11,23 @@ import {
8
11
  upsertCodexMcpServerBlock,
9
12
  renderDoctorText,
10
13
  AkanContextAnalyzer
11
- } from "./index-ngpt3zz3.js";
12
- import {
13
- AppExecutor
14
- } from "./index-wfmpxke3.js";
14
+ } from "./index-fqx74yxn.js";
15
15
  import {
16
16
  jsonText,
17
17
  workflowStatus,
18
18
  createWorkflowBaselineSummary,
19
19
  buildAkanModuleContextIndex,
20
20
  toolingRolloutGate
21
- } from "./index-xrmrvafh.js";
21
+ } from "./index-02b8qvww.js";
22
22
  import {
23
23
  runner
24
- } from "./index-386canwe.js";
24
+ } from "./index-hkq0q73d.js";
25
25
  import {
26
26
  NativeApp
27
- } from "./index-djc5nxpy.js";
27
+ } from "./index-g43360sn.js";
28
28
  import {
29
29
  isPlaceholderAppId
30
- } from "./index-20wvskt8.js";
30
+ } from "./index-5hhe0rdd.js";
31
31
  import {
32
32
  getMobileTargets,
33
33
  appIdsOf
@@ -40,10 +40,10 @@ import {
40
40
  } from "./index-39jz41jb.js";
41
41
  import {
42
42
  RepairRunner
43
- } from "./index-8gm4yag8.js";
43
+ } from "./index-4mgabs8t.js";
44
44
  import {
45
45
  WorkflowRunner
46
- } from "./index-43acpsc7.js";
46
+ } from "./index-49y45vbj.js";
47
47
 
48
48
  // pkgs/@akanjs/devkit/akanMcpContract.ts
49
49
  import { lstatSync, realpathSync } from "fs";
@@ -23,26 +23,31 @@ import {
23
23
  workflowPathsForPlan,
24
24
  workflowRunArtifactPath,
25
25
  workflowSyncDir
26
- } from "./index-xrmrvafh.js";
26
+ } from "./index-02b8qvww.js";
27
27
 
28
28
  // pkgs/@akanjs/devkit/akanContext.ts
29
29
  import { readdir } from "fs/promises";
30
30
  import path from "path";
31
31
  import { capitalize, isRecord, parseRouteModuleKey } from "akanjs/common";
32
32
 
33
- // pkgs/@akanjs/devkit/constantFieldNames.ts
33
+ // pkgs/@akanjs/devkit/moduleFieldNames.ts
34
34
  import ts from "typescript";
35
35
  var isFieldCall = (node) => ts.isCallExpression(node) && (ts.isIdentifier(node.expression) ? node.expression.text === "field" : ts.isPropertyAccessExpression(node.expression) && isFieldCall(node.expression.expression));
36
- var constantFieldNames = (content) => {
36
+ var propertyNames = (content, declares) => {
37
37
  const names = [];
38
38
  const visit = (node) => {
39
- if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && isFieldCall(node.initializer))
39
+ if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && declares(node.initializer))
40
40
  names.push(node.name.text);
41
41
  ts.forEachChild(node, visit);
42
42
  };
43
- visit(ts.createSourceFile("constant.ts", content, ts.ScriptTarget.Latest));
43
+ visit(ts.createSourceFile("module.ts", content, ts.ScriptTarget.Latest));
44
44
  return names;
45
45
  };
46
+ var constantFieldNames = (content) => propertyNames(content, isFieldCall);
47
+ var unlabeledFieldNames = (constantContent, dictionaryContent) => {
48
+ const labels = new Set(propertyNames(dictionaryContent, () => true));
49
+ return constantFieldNames(constantContent).filter((name) => !labels.has(name));
50
+ };
46
51
 
47
52
  // pkgs/@akanjs/devkit/akanContext.ts
48
53
  var guidelineResourceUri = (name) => `akan://guidelines/${name}`;
@@ -546,9 +551,7 @@ class AkanContextAnalyzer {
546
551
  safeReadText(dictionaryPath)
547
552
  ]);
548
553
  if (constantContent && dictionaryContent) {
549
- for (const fieldName of constantFieldNames(constantContent)) {
550
- if (new RegExp(`\\b${fieldName}\\s*:`).test(dictionaryContent))
551
- continue;
554
+ for (const fieldName of unlabeledFieldNames(constantContent, dictionaryContent)) {
552
555
  report({
553
556
  severity: "warning",
554
557
  code: "dictionary-label-missing",
@@ -12,10 +12,10 @@ import {
12
12
  } from "./index-m9jj544v.js";
13
13
  import {
14
14
  CsrArtifactBuilder
15
- } from "./index-wr9magsr.js";
15
+ } from "./index-jxaq2evq.js";
16
16
  import {
17
17
  ExitCodeError
18
- } from "./index-386canwe.js";
18
+ } from "./index-hkq0q73d.js";
19
19
 
20
20
  // pkgs/@akanjs/devkit/mobile/desktopBin.ts
21
21
  import { chmod, mkdir, rename, rm, writeFile } from "fs/promises";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-386canwe.js";
5
+ } from "./index-hkq0q73d.js";
6
6
  import {
7
7
  FileSys2
8
8
  } from "./index-bns3wcpc.js";
@@ -18,6 +18,9 @@ import {
18
18
  import {
19
19
  MaintainabilityBaseline
20
20
  } from "./index-ygrdw6jw.js";
21
+ import {
22
+ assertPackageName
23
+ } from "./index-va90m8nd.js";
21
24
 
22
25
  // pkgs/@akanjs/cli/package/package.runner.ts
23
26
  import path2 from "path";
@@ -404,6 +407,7 @@ class PackageScript extends script("package", [PackageRunner]) {
404
407
  return await this.packageRunner.version(workspace, { log });
405
408
  }
406
409
  async createPackage(workspace, pkgName) {
410
+ assertPackageName(pkgName);
407
411
  const spinner = workspace.spinning(`Creating package in pkgs/${pkgName}...`);
408
412
  await this.packageRunner.createPackage(workspace, pkgName);
409
413
  spinner.succeed(`Package in pkgs/${pkgName} is created`);