@akanjs/cli 3.1.2-rc.3 → 3.2.0-rc.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 (130) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-n2tkg59z.js → CodeAgent-h6g8dg3a.js} +2 -2
  3. package/{CodeTui-9wsdx7ap.js → CodeTui-n9gacepn.js} +1 -1
  4. package/README.ko.md +9 -0
  5. package/README.md +9 -0
  6. package/TunnelShare-k3ja4w9x.js +14 -0
  7. package/{agent.command-tffz6wdn.js → agent.command-2f657613.js} +19 -17
  8. package/akanCode.js +2 -2
  9. package/{application.command-7bkxbrsp.js → application.command-yb8v177e.js} +45 -22
  10. package/{applicationBuildRunner-s13x3zqb.js → applicationBuildRunner-sctcmkyx.js} +57 -17
  11. package/buildBatch.proc.js +7 -7
  12. package/{cloud.command-a792bc10.js → cloud.command-et06ja22.js} +35 -18
  13. package/cloud.script-s6rbrwer.js +30 -0
  14. package/{code.command-ma8dtzww.js → code.command-7m67c7zc.js} +6 -6
  15. package/commandManifest.json +1 -1
  16. package/{context.command-80a1qhps.js → context.command-569z0rqf.js} +20 -19
  17. package/context.runner-ms8v1rxy.js +29 -0
  18. package/{guideline.command-195g0h9a.js → guideline.command-gnv3e8p8.js} +2 -2
  19. package/guidelines/akanApi/akanApi.instruction.md +317 -0
  20. package/guidelines/conventions/rules/app.md +5 -5
  21. package/guidelines/conventions/rules/config.md +1 -1
  22. package/guidelines/conventions/rules/gates.md +10 -5
  23. package/guidelines/conventions/rules/page.md +4 -2
  24. package/guidelines/conventions/rules/server.md +2 -0
  25. package/guidelines/conventions/rules/style.md +3 -1
  26. package/guidelines/conventions/rules/ts.md +2 -1
  27. package/guidelines/cssRule/cssRule.instruction.md +3 -1
  28. package/guidelines/pageRule/pageRule.instruction.md +3 -0
  29. package/incrementalBuilder.proc.js +70 -14
  30. package/{index-tns543wd.js → index-0fb3cpbt.js} +3 -3
  31. package/{index-zbrwnmf1.js → index-1q1cjn8s.js} +21 -11
  32. package/{index-wrmq92vk.js → index-3wjbhj2n.js} +1 -1
  33. package/{index-361ex3rb.js → index-48d5qsj3.js} +4 -4
  34. package/{index-aayg4dqf.js → index-5w9my9qe.js} +8 -8
  35. package/{index-1h2jc0x3.js → index-6wpaq392.js} +61 -15
  36. package/{index-tp56652m.js → index-7xdpww43.js} +69 -12
  37. package/index-7y5yghjg.js +2969 -0
  38. package/{index-zttm13c3.js → index-8g7tdsk4.js} +249 -696
  39. package/{index-m02tdq8a.js → index-8pb9yvp8.js} +63 -21
  40. package/{index-gbp1q1b5.js → index-8ts9774g.js} +4 -4
  41. package/{index-9zy8479y.js → index-93ewzmp6.js} +43 -14
  42. package/{index-zdpte1pj.js → index-9tbgb4d8.js} +1 -1
  43. package/index-abgh0jve.js +126 -0
  44. package/{index-khk05tsf.js → index-aj3ehkcx.js} +1 -1
  45. package/{index-84h43kg6.js → index-d4n1wmrz.js} +37 -4
  46. package/{index-gr9thy79.js → index-drz9e84d.js} +22 -8
  47. package/{index-hapx5myy.js → index-e3vmjtph.js} +2 -2
  48. package/{index-k64mhwbw.js → index-eajbmk10.js} +2 -1
  49. package/{index-0j1t1h2b.js → index-ed6ea0qp.js} +1 -1
  50. package/{index-sjabnf7j.js → index-fjr4d6yd.js} +444 -368
  51. package/index-hqrkqxx2.js +176 -0
  52. package/{index-z7kbxdqg.js → index-jdamtr7e.js} +3 -3
  53. package/{index-scck6h6d.js → index-kpdv34rq.js} +4 -4
  54. package/{index-ppvqy5bc.js → index-ktb3wcqz.js} +73 -34
  55. package/{index-sveq36gh.js → index-mmym5xmb.js} +4 -2
  56. package/{index-y4kcmbt2.js → index-mqntfzv5.js} +2 -2
  57. package/{index-4am4dvmf.js → index-ny2k80mv.js} +15 -3
  58. package/index-p6hjwt2d.js +1668 -0
  59. package/{index-wwe9rsrx.js → index-r0a604h4.js} +12 -2
  60. package/{index-jb2sreps.js → index-rc5fvqj2.js} +18 -18
  61. package/{index-db2nqrad.js → index-ryrm5z2c.js} +71 -19
  62. package/{index-eft5c2mp.js → index-s2grpzef.js} +331 -27
  63. package/{index-g500c5j9.js → index-sr5da35e.js} +33 -10
  64. package/{index-defp4gmb.js → index-sy481q2x.js} +1 -1
  65. package/{index-j9d3mjx1.js → index-thckcabc.js} +2 -2
  66. package/{index-9z3egsmg.js → index-vkzfk7qt.js} +25 -23
  67. package/index-w639tvkd.js +166 -0
  68. package/index-ygdbn9jn.js +122 -0
  69. package/{index-sp0qsr7a.js → index-zpv14wpy.js} +3 -3
  70. package/{index-sx91nf4z.js → index-zxsygkda.js} +18 -9
  71. package/index.js +24 -23
  72. package/{library.command-63hgt9te.js → library.command-1gp5qe3r.js} +3 -3
  73. package/{localRegistry.command-343ksmn9.js → localRegistry.command-v3g21rex.js} +25 -16
  74. package/{module.command-2hce9m6k.js → module.command-4xz9he6h.js} +6 -6
  75. package/{package.command-96eheyvd.js → package.command-s7qpnn1g.js} +12 -3
  76. package/package.json +2 -2
  77. package/{page.command-gs6d841d.js → page.command-fan34c49.js} +3 -3
  78. package/{pipeline.command-wdfvdbfj.js → pipeline.command-ph4fnn9w.js} +2 -2
  79. package/{primitive.command-7tdj12wn.js → primitive.command-3fqh8emf.js} +7 -7
  80. package/{projectTypecheck-kqj1t6hb.js → projectTypecheck-vkb40hjc.js} +1 -1
  81. package/{quality.command-29bgarh1.js → quality.command-ecj6exsh.js} +15 -10
  82. package/{repair.command-yng4rf5d.js → repair.command-fe9jw719.js} +6 -6
  83. package/{scalar.command-1nk4329t.js → scalar.command-cnvfhk0n.js} +5 -5
  84. package/skills/akan-debug/SKILL.md +2 -1
  85. package/skills/akan-page/SKILL.md +30 -2
  86. package/skills/akan-service/SKILL.md +77 -1
  87. package/{subspace.command-5cehmcdd.js → subspace.command-yxtt3v3e.js} +8 -8
  88. package/templates/app/lib/___appName__/__appName__.abstract.md.template +6 -0
  89. package/templates/app/page/_index.tsx +4 -284
  90. package/templates/app/page/_layout.tsx +1 -26
  91. package/templates/app/page/styles.css.template +58 -318
  92. package/templates/appSample/page/_index.tsx +281 -0
  93. package/templates/appSample/page/_layout.tsx +55 -0
  94. package/templates/appSample/page/styles.css.template +327 -0
  95. package/templates/libRoot/lib/___libName__/__libName__.abstract.md.template +6 -0
  96. package/templates/workspaceRoot/package.json.template +1 -12
  97. package/{tunnel.command-yrd4atqy.js → tunnel.command-ggj38mqf.js} +7 -7
  98. package/{typeChecker-j2jdnqsr.js → typeChecker-s640r6c0.js} +1 -1
  99. package/typecheck.proc.js +1 -1
  100. package/{verify.command-kbq0fcg8.js → verify.command-w9ttxkdz.js} +16 -14
  101. package/{workflow.command-274qfa8z.js → workflow.command-ss8devj0.js} +12 -12
  102. package/{workspace.command-r6hgmawy.js → workspace.command-rw1p0xeq.js} +50 -38
  103. package/TunnelShare-6d7z36sr.js +0 -14
  104. package/cloud.script-t2n13gv6.js +0 -27
  105. package/context.runner-wxqb3qcy.js +0 -28
  106. package/index-j2dgmzbj.js +0 -1259
  107. package/index-p6x5b7hr.js +0 -839
  108. package/index-vzpnr12w.js +0 -65
  109. package/templates/workspaceRoot/patches/zod@3.25.76.patch.template +0 -22
  110. package/templates/workspaceRoot/patches/zod@4.4.3.patch.template +0 -11
  111. /package/templates/{app → appSample}/page/_overrides.tsx +0 -0
  112. /package/templates/{app → appSample}/public/fonts/Pretendard-Black.woff2 +0 -0
  113. /package/templates/{app → appSample}/public/fonts/Pretendard-Bold.woff2 +0 -0
  114. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraBold.woff2 +0 -0
  115. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraLight.woff2 +0 -0
  116. /package/templates/{app → appSample}/public/fonts/Pretendard-Light.woff2 +0 -0
  117. /package/templates/{app → appSample}/public/fonts/Pretendard-Medium.woff2 +0 -0
  118. /package/templates/{app → appSample}/public/fonts/Pretendard-Regular.woff2 +0 -0
  119. /package/templates/{app → appSample}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
  120. /package/templates/{app → appSample}/public/fonts/Pretendard-Thin.woff2 +0 -0
  121. /package/templates/{app → appSample}/public/jelly/cloud.webp +0 -0
  122. /package/templates/{app → appSample}/public/jelly/comet.webp +0 -0
  123. /package/templates/{app → appSample}/public/jelly/moon.webp +0 -0
  124. /package/templates/{app → appSample}/public/jelly/planet.webp +0 -0
  125. /package/templates/{app → appSample}/public/jelly/rocket.webp +0 -0
  126. /package/templates/{app → appSample}/public/jelly/star.webp +0 -0
  127. /package/templates/{app → appSample}/public/jelly/sugar.webp +0 -0
  128. /package/templates/{app → appSample}/public/logo.png +0 -0
  129. /package/templates/{app → appSample}/ui/Recipe/index.ts +0 -0
  130. /package/templates/{app → appSample}/ui/Recipe/jellyButton.ts +0 -0
@@ -142,8 +142,7 @@ ${summary.join(", ")} found${output.join(`
142
142
  configFileParsingDiagnostics: parsedConfig.errors,
143
143
  host
144
144
  });
145
- const program = builderProgram.getProgram();
146
- const diagnostics = [...ts.getPreEmitDiagnostics(program), ...builderProgram.emit().diagnostics];
145
+ const diagnostics = [...TypeChecker2.#preEmitDiagnostics(builderProgram), ...builderProgram.emit().diagnostics];
147
146
  const errors = diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error);
148
147
  const warnings = diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Warning);
149
148
  return {
@@ -154,6 +153,17 @@ ${summary.join(", ")} found${output.join(`
154
153
  message: TypeChecker2.formatDiagnosticMessages(diagnostics)
155
154
  };
156
155
  }
156
+ static #preEmitDiagnostics(builderProgram) {
157
+ const { declaration, composite } = builderProgram.getCompilerOptions();
158
+ return ts.sortAndDeduplicateDiagnostics([
159
+ ...builderProgram.getConfigFileParsingDiagnostics(),
160
+ ...builderProgram.getOptionsDiagnostics(),
161
+ ...builderProgram.getSyntacticDiagnostics(),
162
+ ...builderProgram.getGlobalDiagnostics(),
163
+ ...builderProgram.getSemanticDiagnostics(),
164
+ ...declaration || composite ? builderProgram.getDeclarationDiagnostics() : []
165
+ ]);
166
+ }
157
167
  static parseConfig(configPath) {
158
168
  const configFile = ts.readConfigFile(configPath, (fileName) => ts.sys.readFile(fileName));
159
169
  const configDiagnostics = configFile.error ? [configFile.error] : [];
@@ -1,13 +1,13 @@
1
1
  // @bun
2
2
  import {
3
3
  AppExecutor
4
- } from "./index-g500c5j9.js";
4
+ } from "./index-sr5da35e.js";
5
5
  import {
6
6
  jsonText,
7
7
  createWorkflowBaselineSummary,
8
8
  buildAkanModuleContextIndex,
9
9
  toolingRolloutGate
10
- } from "./index-m02tdq8a.js";
10
+ } from "./index-8pb9yvp8.js";
11
11
  import {
12
12
  buildResourceList,
13
13
  codexMcpConfigPath,
@@ -17,16 +17,16 @@ import {
17
17
  upsertCodexMcpServerBlock,
18
18
  renderDoctorText,
19
19
  AkanContextAnalyzer
20
- } from "./index-j9d3mjx1.js";
20
+ } from "./index-thckcabc.js";
21
21
  import {
22
22
  runner
23
- } from "./index-9zy8479y.js";
23
+ } from "./index-93ewzmp6.js";
24
24
  import {
25
25
  NativeApp
26
- } from "./index-sp0qsr7a.js";
26
+ } from "./index-zpv14wpy.js";
27
27
  import {
28
28
  isPlaceholderAppId
29
- } from "./index-0j1t1h2b.js";
29
+ } from "./index-ed6ea0qp.js";
30
30
  import {
31
31
  getMobileTargets,
32
32
  appIdsOf
@@ -36,13 +36,13 @@ import {
36
36
  } from "./index-j6eeh5d7.js";
37
37
  import {
38
38
  WorkspaceGraph
39
- } from "./index-vzpnr12w.js";
39
+ } from "./index-w639tvkd.js";
40
40
  import {
41
41
  RepairRunner
42
- } from "./index-tns543wd.js";
42
+ } from "./index-0fb3cpbt.js";
43
43
  import {
44
44
  WorkflowRunner
45
- } from "./index-9z3egsmg.js";
45
+ } from "./index-vkzfk7qt.js";
46
46
 
47
47
  // pkgs/@akanjs/devkit/akanMcpContract.ts
48
48
  import { lstatSync, realpathSync } from "fs";
@@ -299,8 +299,8 @@ var readonlyMcpTools = [
299
299
  },
300
300
  {
301
301
  name: "get_graph",
302
- description: "Read-only Akan Graph from source, no dev server needed: models with their fields and relations, slices and endpoints with guards, the service methods and queries each calls, the store actions that fetch them, and the components and pages that use them. Every node and edge carries its source location. Pass app and/or module to scope a large workspace.",
303
- inputSchema: { type: "object", properties: { app: stringProperty, module: stringProperty } }
302
+ description: "Read-only Akan Graph from source, no dev server needed: models with their fields and relations, slices and endpoints with the guards they name (each guard keyed by the app or lib that declares it, with its scope and the comment that says what it checks), the service methods and queries each calls, the store actions that fetch them, and the components and routes that use them. A module's jobs (internal: interval, cron, timeout, initialize, destroy, process) read their schedule and server or operation modes and call service methods like endpoints do; each adaptor a service plugs (an adapt() class, or an akanjs role) is a node, a method that calls it links to it, and an adaptor links to the adaptors it plugs itself. Each page/ file is a route (its URL pattern after the locale) or a layout, layouts wrap what they contain, and a route or layout that runs .guard() reads `guard` and links each function its guard calls; a layout's guard gates every route it wraps. A graph too large to answer unscoped drops first the routes and layouts that neither changed nor use a change; app or module brings them back. Every node and edge carries its source location. Pass app and/or module to scope a large workspace. Pass since (a git revision such as main, or HEAD for uncommitted work) for the Change Map instead: what changed since HEAD forked from it, working tree included, with each node, field and edge marked added, removed or changed, the unchanged neighbours they call or are called by, and the changed files no node covers, each marked the same way.",
303
+ inputSchema: { type: "object", properties: { app: stringProperty, module: stringProperty, since: stringProperty } }
304
304
  },
305
305
  {
306
306
  name: "get_guideline",
@@ -756,11 +756,13 @@ class ContextRunner2 extends runner("context") {
756
756
  }
757
757
  return modules;
758
758
  }
759
- if (name === "get_graph")
760
- return WorkspaceGraph.answer(await WorkspaceGraph.build(workspace), {
759
+ if (name === "get_graph") {
760
+ const scope = {
761
761
  app: typeof args.app === "string" ? args.app : null,
762
762
  module: typeof args.module === "string" ? args.module : null
763
- });
763
+ };
764
+ return typeof args.since === "string" ? WorkspaceGraph.answerChanges(await WorkspaceGraph.changes(workspace, args.since), scope) : WorkspaceGraph.answer(await WorkspaceGraph.build(workspace), scope);
765
+ }
764
766
  if (name === "get_guideline")
765
767
  return await Prompter2.getInstruction(stringArg(args, "name"));
766
768
  if (name === "doctor_workspace")
@@ -781,10 +783,8 @@ class ContextRunner2 extends runner("context") {
781
783
  const workflow = stringArg(args, "workflow");
782
784
  const inputs = workflowInputsArg(args);
783
785
  const planPath = typeof args.out === "string" && args.out ? args.out : defaultWorkflowPlanPath(workflow, inputs);
784
- const plan = parseJsonOutput(await new WorkflowRunner().plan(workflow, inputs, {
785
- format: "json",
786
- out: workflowArtifactPath(workspace, planPath)
787
- }));
786
+ const out = workflowArtifactPath(workspace, planPath);
787
+ const plan = parseJsonOutput(await new WorkflowRunner().plan(workflow, inputs, { format: "json", out, workspace }));
788
788
  return {
789
789
  ...plan,
790
790
  planPath,
@@ -1,28 +1,29 @@
1
1
  // @bun
2
2
  import {
3
3
  ApplicationBuildReporter
4
- } from "./index-p6x5b7hr.js";
4
+ } from "./index-p6hjwt2d.js";
5
5
  import {
6
6
  script,
7
7
  ExitCodeError,
8
8
  markCliErrorPrinted,
9
9
  assertPromptable
10
- } from "./index-9zy8479y.js";
10
+ } from "./index-93ewzmp6.js";
11
11
  import {
12
+ SysExecutor,
12
13
  AppExecutor,
13
14
  LibExecutor,
14
15
  PkgExecutor
15
- } from "./index-g500c5j9.js";
16
+ } from "./index-sr5da35e.js";
16
17
  import {
17
18
  DesktopServerStage
18
- } from "./index-0j1t1h2b.js";
19
+ } from "./index-ed6ea0qp.js";
19
20
  import {
20
21
  LibraryScript
21
- } from "./index-y4kcmbt2.js";
22
+ } from "./index-mqntfzv5.js";
22
23
  import {
23
24
  ApplicationRunner,
24
25
  VerifyScope
25
- } from "./index-ppvqy5bc.js";
26
+ } from "./index-ktb3wcqz.js";
26
27
  import {
27
28
  PreviewChrome2,
28
29
  PreviewView2,
@@ -30,17 +31,18 @@ import {
30
31
  } from "./index-tenw3mah.js";
31
32
  import {
32
33
  formatSlicePlan
33
- } from "./index-defp4gmb.js";
34
+ } from "./index-sy481q2x.js";
34
35
  import {
35
36
  openBrowser
36
37
  } from "./index-9dp031by.js";
37
38
 
38
39
  // pkgs/@akanjs/cli/application/application.script.ts
40
+ import path3 from "path";
39
41
  import { confirm } from "@inquirer/prompts";
40
42
  import { Logger as Logger3, toError } from "akanjs/common";
41
43
 
42
44
  // pkgs/@akanjs/cli/application/appPreview.ts
43
- import { closeSync, openSync, realpathSync } from "fs";
45
+ import { closeSync, openSync, realpathSync, statSync } from "fs";
44
46
  import { mkdir as mkdir2 } from "fs/promises";
45
47
  import path2 from "path";
46
48
  import { parseRouteModuleKey } from "akanjs/common";
@@ -628,11 +630,15 @@ class AppPreview {
628
630
  const unavailable = PreviewView2.unavailableReason(engine);
629
631
  if (unavailable)
630
632
  throw new Error(unavailable);
631
- const { i18n } = await app.getConfig();
633
+ const { i18n, api } = await app.getConfig();
632
634
  const changed = options.changed ? await AppPreview.#changedPages(app) : { paths: [], skipped: [] };
633
635
  if (options.changed && !changed.paths.length && !options.paths?.length)
634
636
  throw new Error(`No page to open: ${changed.skipped.join("; ")}. Pass a concrete path, e.g. \`akan preview ${app.name} /memo/1\`.`);
635
- const paths = AppPreview.pagePaths([...options.paths ?? [], ...changed.paths], i18n, { csr: !!options.csr });
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
+ });
636
642
  const port = await app.getDevPort();
637
643
  const origin = `http://localhost:${port}`;
638
644
  const root = app.workspace.workspaceRoot;
@@ -684,10 +690,12 @@ class AppPreview {
684
690
  started?.proc.unref();
685
691
  }
686
692
  }
687
- static pagePaths(paths, i18n, { csr }) {
693
+ static pagePaths(paths, i18n, { csr, apiPrefix = "/api", publicDir = null }) {
688
694
  const keepsUnprefixed = i18n.localePrefix === "as-needed" && !csr;
689
695
  const pages = (paths.length ? paths : ["/"]).map((raw) => {
690
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}`;
691
699
  const [first] = url.pathname.split("/").filter(Boolean);
692
700
  if (!keepsUnprefixed && (!first || !i18n.locales.includes(first)))
693
701
  url.pathname = `/${i18n.defaultLocale}${url.pathname === "/" ? "/" : url.pathname}`;
@@ -699,6 +707,31 @@ class AppPreview {
699
707
  });
700
708
  return [...new Set(pages)];
701
709
  }
710
+ static #serverFiles = new Set(["/favicon.ico", "/robots.txt", "/sitemap.xml", "/manifest.webmanifest"]);
711
+ static #basePathFiles = new Set(["sitemap.xml", "manifest.webmanifest"]);
712
+ static #isPagePath(pathname, i18n, { apiPrefix, publicDir }) {
713
+ const segments = pathname.split("/").filter(Boolean);
714
+ const [first] = segments;
715
+ if (first && i18n.locales.includes(first))
716
+ return true;
717
+ const prefixes = ["/_akan", "/__csr", "/__rsc", "/.well-known", apiPrefix.replace(/\/+$/, "")].filter(Boolean);
718
+ if (prefixes.some((prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`)))
719
+ return false;
720
+ if (AppPreview.#serverFiles.has(pathname))
721
+ return false;
722
+ if (segments.length === 2 && AppPreview.#basePathFiles.has(segments[1] ?? ""))
723
+ return false;
724
+ return !(publicDir && AppPreview.#isPublicFile(publicDir, pathname));
725
+ }
726
+ static #isPublicFile(publicDir, pathname) {
727
+ try {
728
+ const root = path2.resolve(publicDir);
729
+ const filePath = path2.resolve(root, `.${decodeURIComponent(pathname)}`);
730
+ return filePath.startsWith(`${root}${path2.sep}`) && statSync(filePath).isFile();
731
+ } catch {
732
+ return false;
733
+ }
734
+ }
702
735
  static changedPageLimit = 8;
703
736
  static changedPages(sources, changedFiles) {
704
737
  const realOf = (file) => {
@@ -1224,9 +1257,9 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1224
1257
  throw error;
1225
1258
  }
1226
1259
  }
1227
- async createApplication(appName, workspace, { start = false, libs = [], sample = false } = {}) {
1260
+ async createApplication(appName, workspace, { start = false, libs = [] } = {}) {
1228
1261
  const spinner = workspace.spinning("Creating application...");
1229
- const app = await this.applicationRunner.createApplication(appName, workspace, libs, { sample });
1262
+ const app = await this.applicationRunner.createApplication(appName, workspace, libs);
1230
1263
  spinner.succeed(`Application created in apps/${app.name}`);
1231
1264
  await app.scanSync();
1232
1265
  if (start)
@@ -1281,16 +1314,21 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1281
1314
  async studio(app, {
1282
1315
  module,
1283
1316
  view,
1317
+ since = null,
1284
1318
  editor,
1285
1319
  open,
1286
1320
  format
1287
1321
  }) {
1322
+ if (since && view !== "changes")
1323
+ throw new Error("`--since` picks what the Change Map compares with; pass `--view changes` with it.");
1288
1324
  const origin = `http://localhost:${await app.getDevPort()}`;
1289
1325
  if (!await ApplicationRunner.answers(origin, app.name, app.workspace.workspaceRoot))
1290
1326
  throw new Error(`No dev server answers ${origin}. Run \`akan start ${app.name}\` first.`);
1291
1327
  const search = new URLSearchParams({ view, editor });
1292
1328
  if (module)
1293
1329
  search.set("module", module);
1330
+ if (since)
1331
+ search.set("since", since);
1294
1332
  const url = `${origin}/_akan/studio?${search.toString()}`;
1295
1333
  if (open)
1296
1334
  await openBrowser(url);
@@ -1300,13 +1338,21 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1300
1338
  write = true,
1301
1339
  fast = false,
1302
1340
  quiet = false,
1303
- profile
1341
+ profile,
1342
+ env,
1343
+ updateBudget = false
1304
1344
  } = {}) {
1305
1345
  await app.scanSync({ write });
1306
1346
  if (!quiet)
1307
1347
  Logger3.rawLog(`Creating an optimized production build for ${app.name}...`);
1308
1348
  try {
1309
- const result = await this.applicationRunner.build(app, { fast, spinner: !quiet, envProfile: profile });
1349
+ const result = await this.applicationRunner.build(app, {
1350
+ fast,
1351
+ spinner: !quiet,
1352
+ envProfile: profile,
1353
+ environment: env,
1354
+ budget: updateBudget ? "update" : "enforce"
1355
+ });
1310
1356
  Logger3.rawLog(`${app.name} built in dist/apps/${app.name}`);
1311
1357
  if (!quiet)
1312
1358
  ApplicationBuildReporter.printSummary(result);
@@ -1340,15 +1386,16 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1340
1386
  throw error;
1341
1387
  }
1342
1388
  }
1343
- async test(exec, { write = true, files = [] } = {}) {
1389
+ async test(exec, { write = true, files = [], coverage = false } = {}) {
1344
1390
  const testPaths = this.applicationRunner.resolveTestPaths(exec, files);
1391
+ const flags = coverage ? ApplicationScript.#coverageFlagsOf(exec) : [];
1345
1392
  if (exec instanceof LibExecutor) {
1346
1393
  if (write)
1347
1394
  await this.libraryScript.syncLibrary(exec);
1348
1395
  else
1349
1396
  await exec.scan({ write: false });
1350
1397
  exec.spinning(`Preparing ${exec.name}...`).succeed(`${exec.name} prepared`);
1351
- await this.applicationRunner.test(exec, testPaths);
1398
+ await this.applicationRunner.test(exec, testPaths, flags);
1352
1399
  return;
1353
1400
  }
1354
1401
  const spinner = exec.spinning(`Preparing ${exec.name}...`);
@@ -1362,7 +1409,12 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1362
1409
  spinner.fail(`${exec.name} prepare failed`);
1363
1410
  throw error;
1364
1411
  }
1365
- await this.applicationRunner.test(exec, testPaths);
1412
+ await this.applicationRunner.test(exec, testPaths, flags);
1413
+ }
1414
+ static #coverageFlagsOf(exec) {
1415
+ const root = exec instanceof SysExecutor || exec instanceof PkgExecutor ? exec.workspace.workspaceRoot : null;
1416
+ const dir = root ? path3.join(root, "local", "coverage", path3.relative(root, exec.cwdPath)) : "local/coverage";
1417
+ return ["--coverage", "--coverage-reporter=text", "--coverage-reporter=lcov", `--coverage-dir=${dir}`];
1366
1418
  }
1367
1419
  async start(apps, {
1368
1420
  open = false,
@@ -1595,7 +1647,7 @@ class ApplicationScript extends script("application", [ApplicationRunner, Librar
1595
1647
  await Promise.all(shares.map(async (share) => await share.close()));
1596
1648
  }, "Abandoning the tunnel release; the shares expire on their own.");
1597
1649
  await Promise.all(apps.map(async (app) => {
1598
- const { TunnelShare } = await import("./TunnelShare-6d7z36sr.js");
1650
+ const { TunnelShare } = await import("./TunnelShare-k3ja4w9x.js");
1599
1651
  const share = await TunnelShare.open(app, { workspace: app.workspace });
1600
1652
  shares.push(share);
1601
1653
  urls.set(app.name, share.url);