@akanjs/cli 3.1.2-rc.4 → 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 (118) hide show
  1. package/.build-stamp +1 -1
  2. package/{CodeAgent-z34p8m91.js → CodeAgent-h6g8dg3a.js} +2 -2
  3. package/{CodeTui-nvd9fk3g.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-962mp3kg.js → agent.command-2f657613.js} +19 -17
  8. package/akanCode.js +2 -2
  9. package/{application.command-1nr0bqq1.js → application.command-yb8v177e.js} +35 -21
  10. package/{applicationBuildRunner-xy7hnfzq.js → applicationBuildRunner-sctcmkyx.js} +55 -16
  11. package/buildBatch.proc.js +7 -7
  12. package/{cloud.command-cj7b3m6y.js → cloud.command-et06ja22.js} +35 -18
  13. package/cloud.script-s6rbrwer.js +30 -0
  14. package/{code.command-asq7xrr6.js → code.command-7m67c7zc.js} +6 -6
  15. package/commandManifest.json +1 -1
  16. package/{context.command-fw4g2pw1.js → context.command-569z0rqf.js} +20 -19
  17. package/context.runner-ms8v1rxy.js +29 -0
  18. package/{guideline.command-43gfjsjv.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/incrementalBuilder.proc.js +69 -39
  24. package/{index-0tkj05cz.js → index-0fb3cpbt.js} +3 -3
  25. package/{index-6t7fkx73.js → index-1q1cjn8s.js} +21 -11
  26. package/{index-90q0w90q.js → index-3wjbhj2n.js} +1 -1
  27. package/{index-6zgt7zmx.js → index-48d5qsj3.js} +4 -4
  28. package/{index-z47rw9ez.js → index-5w9my9qe.js} +8 -8
  29. package/{index-qwe079ww.js → index-6wpaq392.js} +61 -15
  30. package/{index-kc871vpc.js → index-7xdpww43.js} +69 -12
  31. package/index-7y5yghjg.js +2969 -0
  32. package/{index-38patcx6.js → index-8g7tdsk4.js} +249 -696
  33. package/{index-kdswbvys.js → index-8pb9yvp8.js} +63 -21
  34. package/{index-hmj94es2.js → index-8ts9774g.js} +4 -4
  35. package/{index-r0q2ka2b.js → index-93ewzmp6.js} +43 -14
  36. package/{index-y0y0pnx8.js → index-9tbgb4d8.js} +1 -1
  37. package/index-abgh0jve.js +126 -0
  38. package/{index-t0hk1kxq.js → index-aj3ehkcx.js} +1 -1
  39. package/{index-demt944k.js → index-d4n1wmrz.js} +37 -4
  40. package/{index-sra1a5f8.js → index-drz9e84d.js} +22 -8
  41. package/{index-gfh90r3t.js → index-e3vmjtph.js} +2 -2
  42. package/{index-k64mhwbw.js → index-eajbmk10.js} +2 -1
  43. package/{index-g0yds382.js → index-ed6ea0qp.js} +1 -1
  44. package/{index-ap6ac70m.js → index-fjr4d6yd.js} +444 -368
  45. package/index-hqrkqxx2.js +176 -0
  46. package/{index-jzpeny42.js → index-jdamtr7e.js} +3 -3
  47. package/{index-ampz4vgv.js → index-kpdv34rq.js} +4 -4
  48. package/{index-kc6ffq0s.js → index-ktb3wcqz.js} +73 -34
  49. package/{index-dcm66hss.js → index-mmym5xmb.js} +4 -2
  50. package/{index-8d9r465x.js → index-mqntfzv5.js} +2 -2
  51. package/{index-4am4dvmf.js → index-ny2k80mv.js} +15 -3
  52. package/index-p6hjwt2d.js +1668 -0
  53. package/{index-53h0053j.js → index-rc5fvqj2.js} +12 -14
  54. package/{index-r8t5sq7z.js → index-ryrm5z2c.js} +66 -19
  55. package/{index-jzz6ye8x.js → index-s2grpzef.js} +40 -8
  56. package/{index-38by07nw.js → index-sr5da35e.js} +32 -9
  57. package/{index-qev8p5wp.js → index-sy481q2x.js} +1 -1
  58. package/{index-ck64kxrn.js → index-thckcabc.js} +2 -2
  59. package/{index-wymcdsas.js → index-vkzfk7qt.js} +25 -23
  60. package/{index-vkpqe29t.js → index-w639tvkd.js} +24 -125
  61. package/index-ygdbn9jn.js +122 -0
  62. package/{index-w60zxxye.js → index-zpv14wpy.js} +3 -3
  63. package/{index-2yan1ajk.js → index-zxsygkda.js} +18 -9
  64. package/index.js +24 -23
  65. package/{library.command-zh29tjdd.js → library.command-1gp5qe3r.js} +3 -3
  66. package/{localRegistry.command-k9pn9ahj.js → localRegistry.command-v3g21rex.js} +25 -16
  67. package/{module.command-dgpqs9fz.js → module.command-4xz9he6h.js} +6 -6
  68. package/{package.command-1je4hsca.js → package.command-s7qpnn1g.js} +12 -3
  69. package/package.json +2 -2
  70. package/{page.command-cgsasanh.js → page.command-fan34c49.js} +3 -3
  71. package/{pipeline.command-tb46sa8v.js → pipeline.command-ph4fnn9w.js} +2 -2
  72. package/{primitive.command-bzsy23x5.js → primitive.command-3fqh8emf.js} +7 -7
  73. package/{projectTypecheck-h8rgaczy.js → projectTypecheck-vkb40hjc.js} +1 -1
  74. package/{quality.command-120m9h6v.js → quality.command-ecj6exsh.js} +15 -10
  75. package/{repair.command-6m4wd0qv.js → repair.command-fe9jw719.js} +6 -6
  76. package/{scalar.command-3dn5hsc6.js → scalar.command-cnvfhk0n.js} +5 -5
  77. package/skills/akan-debug/SKILL.md +2 -1
  78. package/skills/akan-page/SKILL.md +16 -7
  79. package/skills/akan-service/SKILL.md +48 -19
  80. package/{subspace.command-s8nyfqbn.js → subspace.command-yxtt3v3e.js} +8 -8
  81. package/templates/app/lib/___appName__/__appName__.abstract.md.template +6 -0
  82. package/templates/app/page/_index.tsx +4 -284
  83. package/templates/app/page/_layout.tsx +1 -26
  84. package/templates/app/page/styles.css.template +58 -318
  85. package/templates/appSample/page/_index.tsx +281 -0
  86. package/templates/appSample/page/_layout.tsx +55 -0
  87. package/templates/appSample/page/styles.css.template +327 -0
  88. package/templates/libRoot/lib/___libName__/__libName__.abstract.md.template +6 -0
  89. package/templates/workspaceRoot/package.json.template +1 -12
  90. package/{tunnel.command-8mwrqkr3.js → tunnel.command-ggj38mqf.js} +7 -7
  91. package/{verify.command-2pspfy7k.js → verify.command-w9ttxkdz.js} +16 -14
  92. package/{workflow.command-7sy5vnsj.js → workflow.command-ss8devj0.js} +12 -12
  93. package/{workspace.command-x518tdv4.js → workspace.command-rw1p0xeq.js} +50 -38
  94. package/TunnelShare-jwbb50kz.js +0 -14
  95. package/cloud.script-8kr7qgfa.js +0 -27
  96. package/context.runner-p6m5cxk3.js +0 -28
  97. package/index-d894868w.js +0 -842
  98. package/index-re2kfscb.js +0 -1363
  99. /package/templates/{app → appSample}/page/_overrides.tsx +0 -0
  100. /package/templates/{app → appSample}/public/fonts/Pretendard-Black.woff2 +0 -0
  101. /package/templates/{app → appSample}/public/fonts/Pretendard-Bold.woff2 +0 -0
  102. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraBold.woff2 +0 -0
  103. /package/templates/{app → appSample}/public/fonts/Pretendard-ExtraLight.woff2 +0 -0
  104. /package/templates/{app → appSample}/public/fonts/Pretendard-Light.woff2 +0 -0
  105. /package/templates/{app → appSample}/public/fonts/Pretendard-Medium.woff2 +0 -0
  106. /package/templates/{app → appSample}/public/fonts/Pretendard-Regular.woff2 +0 -0
  107. /package/templates/{app → appSample}/public/fonts/Pretendard-SemiBold.woff2 +0 -0
  108. /package/templates/{app → appSample}/public/fonts/Pretendard-Thin.woff2 +0 -0
  109. /package/templates/{app → appSample}/public/jelly/cloud.webp +0 -0
  110. /package/templates/{app → appSample}/public/jelly/comet.webp +0 -0
  111. /package/templates/{app → appSample}/public/jelly/moon.webp +0 -0
  112. /package/templates/{app → appSample}/public/jelly/planet.webp +0 -0
  113. /package/templates/{app → appSample}/public/jelly/rocket.webp +0 -0
  114. /package/templates/{app → appSample}/public/jelly/star.webp +0 -0
  115. /package/templates/{app → appSample}/public/jelly/sugar.webp +0 -0
  116. /package/templates/{app → appSample}/public/logo.png +0 -0
  117. /package/templates/{app → appSample}/ui/Recipe/index.ts +0 -0
  118. /package/templates/{app → appSample}/ui/Recipe/jellyButton.ts +0 -0
@@ -0,0 +1,176 @@
1
+ // @bun
2
+ import {
3
+ JsonFormatter
4
+ } from "./index-sr5da35e.js";
5
+
6
+ // pkgs/@akanjs/devkit/maintainabilityBaseline.ts
7
+ class MaintainabilityBaseline {
8
+ sections;
9
+ reasons;
10
+ static fileName = "akan.baseline.json";
11
+ static reasonMinChars = 10;
12
+ static debtRules = [
13
+ "akan.size.file",
14
+ "akan.size.component",
15
+ "akan.size.function",
16
+ "akan.size.class",
17
+ "akan.component.store-access",
18
+ "akan.store.multi-write",
19
+ "akan.store.root-write-chain",
20
+ "akan.component.write-chain",
21
+ "akan.write.placement",
22
+ "akan.service.call-in-loop"
23
+ ];
24
+ static reasonedRules = new Set([
25
+ "akan.size.file",
26
+ "akan.size.component",
27
+ "akan.size.function",
28
+ "akan.size.class",
29
+ "akan.component.store-access",
30
+ "akan.service.call-in-loop"
31
+ ]);
32
+ static countOf(violation) {
33
+ if (violation.kind === "size")
34
+ return violation.lineCount;
35
+ if (violation.kind === "classSize")
36
+ return violation.memberCount;
37
+ if (violation.kind === "storeAccess")
38
+ return violation.accessCount;
39
+ if (violation.kind === "multiWrite")
40
+ return violation.writeCount;
41
+ if (violation.kind === "writePlacement")
42
+ return violation.writes.length;
43
+ return violation.calls.length;
44
+ }
45
+ static isDebtRule(name) {
46
+ return MaintainabilityBaseline.debtRules.includes(name);
47
+ }
48
+ static parse(text, source = MaintainabilityBaseline.fileName, { lenient = false } = {}) {
49
+ let json;
50
+ try {
51
+ json = JSON.parse(text);
52
+ } catch {
53
+ throw new Error(`${source} is not valid JSON.`);
54
+ }
55
+ if (typeof json !== "object" || json === null || Array.isArray(json))
56
+ throw new Error(`${source} holds an object keyed by rule id.`);
57
+ const sections = new Map;
58
+ let reasons = new Map;
59
+ for (const [name, value] of Object.entries(json)) {
60
+ if (name === "reasons") {
61
+ const entries = MaintainabilityBaseline.#reasonsOf(value);
62
+ if (!entries)
63
+ throw new Error(`${source}: "reasons" maps an entry's key to a sentence.`);
64
+ reasons = new Map(entries);
65
+ continue;
66
+ }
67
+ if (!MaintainabilityBaseline.isDebtRule(name)) {
68
+ if (lenient)
69
+ continue;
70
+ throw new Error(`${source}: "${name}" is not a rule id. Its sections are ${MaintainabilityBaseline.debtRules.join(", ")} and "reasons"; rewrite it with \`akan quality baseline --force\`.`);
71
+ }
72
+ const counts = MaintainabilityBaseline.#countsOf(value);
73
+ if (!counts)
74
+ throw new Error(`${source}: "${name}" maps each key to a whole-number count.`);
75
+ sections.set(name, new Map(counts));
76
+ }
77
+ return new MaintainabilityBaseline(sections, reasons);
78
+ }
79
+ static of(violations, reasons = new Map) {
80
+ const sections = new Map;
81
+ for (const violation of violations) {
82
+ const counts = sections.get(violation.rule) ?? new Map;
83
+ const count = MaintainabilityBaseline.countOf(violation);
84
+ counts.set(violation.key, Math.max(counts.get(violation.key) ?? 0, count));
85
+ sections.set(violation.rule, counts);
86
+ }
87
+ return new MaintainabilityBaseline(sections).#withReasonsOf(reasons);
88
+ }
89
+ constructor(sections = new Map, reasons = new Map) {
90
+ this.sections = sections;
91
+ this.reasons = reasons;
92
+ }
93
+ get isEmpty() {
94
+ return [...this.sections.values()].every((counts) => !counts.size);
95
+ }
96
+ allows(violation) {
97
+ const recorded = this.recordedOf(violation);
98
+ return recorded !== undefined && MaintainabilityBaseline.countOf(violation) <= recorded;
99
+ }
100
+ recordedOf(violation) {
101
+ return this.sections.get(violation.rule)?.get(violation.key);
102
+ }
103
+ reasonOf(key) {
104
+ const reason = this.#holdsReasoned(key) ? this.reasons.get(key) : undefined;
105
+ return reason && reason.replace(/\s/g, "").length >= MaintainabilityBaseline.reasonMinChars ? reason : undefined;
106
+ }
107
+ entriesByRule() {
108
+ return new Map([...this.sections].filter(([, counts]) => counts.size).map(([rule, counts]) => [
109
+ rule,
110
+ [...counts].map(([key, count]) => ({
111
+ key,
112
+ count,
113
+ reason: MaintainabilityBaseline.reasonedRules.has(rule) ? this.reasonOf(key) : undefined
114
+ }))
115
+ ]));
116
+ }
117
+ tightenedBy(violations) {
118
+ const current = MaintainabilityBaseline.of(violations);
119
+ const sections = new Map([...this.sections].map(([rule, counts]) => [
120
+ rule,
121
+ MaintainabilityBaseline.#lowered(counts, current.sections.get(rule) ?? new Map)
122
+ ]));
123
+ return new MaintainabilityBaseline(sections).#withReasonsOf(this.reasons);
124
+ }
125
+ #withReasonsOf(reasons) {
126
+ return new MaintainabilityBaseline(this.sections, new Map([...reasons].filter(([key]) => this.#holdsReasoned(key))));
127
+ }
128
+ grownFrom(committed) {
129
+ return [...this.sections].flatMap(([rule, counts]) => MaintainabilityBaseline.#raised(counts, committed.sections.get(rule) ?? new Map).filter(([key]) => !(MaintainabilityBaseline.reasonedRules.has(rule) && this.reasonOf(key))).map(([key, count, recorded]) => ({ rule, key, count, committed: recorded })));
130
+ }
131
+ stringify() {
132
+ const sections = MaintainabilityBaseline.debtRules.flatMap((rule) => {
133
+ const counts = this.sections.get(rule);
134
+ return counts?.size ? [[rule, MaintainabilityBaseline.#sortedObjectOf(counts)]] : [];
135
+ });
136
+ return JsonFormatter.stringify({
137
+ ...Object.fromEntries(sections),
138
+ ...this.reasons.size ? { reasons: MaintainabilityBaseline.#sortedObjectOf(this.reasons) } : {}
139
+ }, MaintainabilityBaseline.fileName);
140
+ }
141
+ #holdsReasoned(key) {
142
+ return [...this.sections].some(([rule, counts]) => MaintainabilityBaseline.reasonedRules.has(rule) && counts.has(key));
143
+ }
144
+ static #countsOf(value) {
145
+ if (typeof value !== "object" || value === null || Array.isArray(value))
146
+ return null;
147
+ const entries = Object.entries(value);
148
+ return entries.every(([, count]) => Number.isInteger(count)) ? entries : null;
149
+ }
150
+ static #reasonsOf(value) {
151
+ if (typeof value !== "object" || value === null || Array.isArray(value))
152
+ return null;
153
+ const entries = Object.entries(value);
154
+ return entries.every(([, reason]) => typeof reason === "string") ? entries : null;
155
+ }
156
+ static #lowered(recorded, current) {
157
+ return new Map([...recorded].flatMap(([key, count]) => {
158
+ const measured = current.get(key);
159
+ return measured === undefined ? [] : [[key, Math.min(count, measured)]];
160
+ }));
161
+ }
162
+ static #raised(working, committed) {
163
+ return [...working].flatMap(([key, count]) => {
164
+ const recorded = committed.get(key);
165
+ return recorded !== undefined && count <= recorded ? [] : [[key, count, recorded]];
166
+ });
167
+ }
168
+ static #sortedObjectOf(values) {
169
+ return Object.fromEntries([...values].sort(([a], [b]) => MaintainabilityBaseline.#byKey(a, b)));
170
+ }
171
+ static #byKey(a, b) {
172
+ return a < b ? -1 : a > b ? 1 : 0;
173
+ }
174
+ }
175
+
176
+ export { MaintainabilityBaseline };
@@ -15,7 +15,7 @@ import {
15
15
  SubagentPool2,
16
16
  McpSignIn,
17
17
  AkanCodeCompaction2
18
- } from "./index-90q0w90q.js";
18
+ } from "./index-3wjbhj2n.js";
19
19
  import {
20
20
  PreviewView2,
21
21
  stripAnsi
@@ -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-p6m5cxk3.js");
662
+ const { ContextRunner } = await import("./context.runner-ms8v1rxy.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-p6m5cxk3.js");
670
+ const { ContextRunner } = await import("./context.runner-ms8v1rxy.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,16 +1,16 @@
1
1
  // @bun
2
2
  import {
3
3
  jsonText
4
- } from "./index-kdswbvys.js";
4
+ } from "./index-8pb9yvp8.js";
5
5
  import {
6
6
  akanMcpInstallTargets
7
- } from "./index-ck64kxrn.js";
7
+ } from "./index-thckcabc.js";
8
8
  import {
9
9
  script
10
- } from "./index-r0q2ka2b.js";
10
+ } from "./index-93ewzmp6.js";
11
11
  import {
12
12
  ContextRunner2
13
- } from "./index-53h0053j.js";
13
+ } from "./index-rc5fvqj2.js";
14
14
 
15
15
  // pkgs/@akanjs/cli/context/context.script.ts
16
16
  import { Logger } from "akanjs/common";
@@ -7,7 +7,7 @@ import {
7
7
  AppExecutor,
8
8
  LibExecutor,
9
9
  PkgExecutor
10
- } from "./index-38by07nw.js";
10
+ } from "./index-sr5da35e.js";
11
11
  import {
12
12
  FileSys2
13
13
  } from "./index-bns3wcpc.js";
@@ -46,28 +46,28 @@ import {
46
46
  filesChangedSince,
47
47
  HmrWatcher,
48
48
  WatchRootResolver
49
- } from "./index-d894868w.js";
49
+ } from "./index-p6hjwt2d.js";
50
50
  import {
51
51
  runner,
52
52
  ExitCodeError,
53
53
  assertPromptable
54
- } from "./index-r0q2ka2b.js";
54
+ } from "./index-93ewzmp6.js";
55
55
  import {
56
56
  UpdatePackFolder,
57
57
  UpdateUploader,
58
58
  NativePublicEnv,
59
59
  NativeApp
60
- } from "./index-w60zxxye.js";
60
+ } from "./index-zpv14wpy.js";
61
61
  import {
62
62
  DesktopServerStage
63
- } from "./index-g0yds382.js";
63
+ } from "./index-ed6ea0qp.js";
64
64
  import {
65
65
  resolveMobileTargets,
66
66
  resolveAppId
67
67
  } from "./index-m9jj544v.js";
68
68
  import {
69
69
  SlicePlanner
70
- } from "./index-qev8p5wp.js";
70
+ } from "./index-sy481q2x.js";
71
71
  import {
72
72
  openBrowser
73
73
  } from "./index-9dp031by.js";
@@ -79,8 +79,8 @@ import {
79
79
  } from "./index-bqbf654f.js";
80
80
 
81
81
  // pkgs/@akanjs/cli/application/application.runner.ts
82
- import { existsSync, realpathSync } from "fs";
83
- import path6 from "path";
82
+ import { existsSync, realpathSync as realpathSync2 } from "fs";
83
+ import path7 from "path";
84
84
 
85
85
  // pkgs/@akanjs/devkit/akanApp/akanApp.host.ts
86
86
  import path4 from "path";
@@ -2005,17 +2005,49 @@ ${uniqueCandidates.map((candidate) => ` - ${candidate}`).join(`
2005
2005
  }
2006
2006
 
2007
2007
  // pkgs/@akanjs/cli/application/application.runner.ts
2008
- import { Logger as Logger3, toError } from "akanjs/common";
2009
- var loadBuildRunner = async () => (await import("./applicationBuildRunner-xy7hnfzq.js")).ApplicationBuildRunner;
2008
+ import { Logger as Logger4, toError } from "akanjs/common";
2009
+
2010
+ // pkgs/@akanjs/cli/application/testTarget.ts
2011
+ import { readdirSync, realpathSync, statSync } from "fs";
2012
+ import path6 from "path";
2013
+ import { Logger as Logger3 } from "akanjs/common";
2014
+ var testFileName = /[._](test|spec)\.[cm]?[jt]sx?$/i;
2015
+ var hasTestFile = (dir, seen = new Set) => {
2016
+ const real = realpathSync(dir);
2017
+ if (seen.has(real))
2018
+ return false;
2019
+ seen.add(real);
2020
+ return readdirSync(dir, { withFileTypes: true }).some((entry) => {
2021
+ const entryPath = path6.join(dir, entry.name);
2022
+ const isDir = entry.isDirectory() || entry.isSymbolicLink() && statSync(entryPath, { throwIfNoEntry: false })?.isDirectory();
2023
+ if (!isDir)
2024
+ return testFileName.test(entry.name);
2025
+ return !entry.name.startsWith(".") && entry.name !== "node_modules" && hasTestFile(entryPath, seen);
2026
+ });
2027
+ };
2028
+ var testTargetOf = (exec) => {
2029
+ const root = exec instanceof SysExecutor || exec instanceof PkgExecutor ? exec.workspace.workspaceRoot : process.cwd();
2030
+ return { root, target: path6.relative(root, exec.cwdPath).split(path6.sep).join("/") };
2031
+ };
2032
+ var reportsNoTestFile = (exec) => {
2033
+ if (hasTestFile(exec.cwdPath))
2034
+ return false;
2035
+ const hint = exec instanceof AppExecutor || exec instanceof LibExecutor ? " A signal test goes beside its module, as lib/<model>/<model>.signal.test.ts." : "";
2036
+ Logger3.rawLog(`No *.test.ts or *.spec.ts file in ${testTargetOf(exec).target}, so no test ran.${hint}`);
2037
+ return true;
2038
+ };
2039
+
2040
+ // pkgs/@akanjs/cli/application/application.runner.ts
2041
+ var loadBuildRunner = async () => (await import("./applicationBuildRunner-sctcmkyx.js")).ApplicationBuildRunner;
2010
2042
  var loadPrompts = async () => await import("@inquirer/prompts");
2011
2043
 
2012
2044
  class ApplicationRunner extends runner("application") {
2013
- async createApplication(appName, workspace, libs = [], { sample = false } = {}) {
2045
+ async createApplication(appName, workspace, libs = []) {
2014
2046
  await workspace.applyTemplate({
2015
2047
  basePath: `apps/${appName}`,
2016
2048
  template: "app",
2017
2049
  dict: { appName },
2018
- options: { libs, sample }
2050
+ options: { libs }
2019
2051
  });
2020
2052
  return AppExecutor.from(workspace, appName);
2021
2053
  }
@@ -2058,7 +2090,7 @@ class ApplicationRunner extends runner("application") {
2058
2090
  });
2059
2091
  }
2060
2092
  static runtimeDirOf(app, override) {
2061
- return path6.resolve(override ?? process.env.AKAN_RUNTIME_DIR ?? path6.join(app.workspace.workspaceRoot, "local", "apps", app.name, "runtime"));
2093
+ return path7.resolve(override ?? process.env.AKAN_RUNTIME_DIR ?? path7.join(app.workspace.workspaceRoot, "local", "apps", app.name, "runtime"));
2062
2094
  }
2063
2095
  async runLogs(app, options) {
2064
2096
  const { LogControlUnavailableError, LogTailClient } = await import("akanjs/server/logging/logTailClient");
@@ -2068,7 +2100,7 @@ class ApplicationRunner extends runner("application") {
2068
2100
  const { level, grep, endpoint, trace, child, role, origin, since } = options;
2069
2101
  const query = Object.fromEntries(Object.entries({ level, grep, endpoint, trace, child, role, origin, since }).filter(([, value]) => value !== undefined && value !== null && value !== ""));
2070
2102
  const print = (record) => process.stdout.write(options.json ? `${JSON.stringify(record)}
2071
- ` : Logger3.render(record));
2103
+ ` : Logger4.render(record));
2072
2104
  const note = (text) => process.stderr.write(`[akan logs] ${text}
2073
2105
  `);
2074
2106
  const { promise: closed, resolve: finish } = Promise.withResolvers();
@@ -2084,7 +2116,7 @@ class ApplicationRunner extends runner("application") {
2084
2116
  });
2085
2117
  } catch (error) {
2086
2118
  if (error instanceof LogControlUnavailableError)
2087
- throw new Error(`${app.name} is not running (no ${path6.basename(socketPath)} in ${runtimeDir}). Start it with \`akan start ${app.name}\`, or pass --runtime-dir for a built app.`);
2119
+ throw new Error(`${app.name} is not running (no ${path7.basename(socketPath)} in ${runtimeDir}). Start it with \`akan start ${app.name}\`, or pass --runtime-dir for a built app.`);
2088
2120
  throw error;
2089
2121
  }
2090
2122
  const sinceMs = since ? LogQueryMatcher.parseSince(since) : undefined;
@@ -2146,7 +2178,7 @@ try {
2146
2178
  const serverPath = `${app.cwdPath}/server.ts`;
2147
2179
  if (!await app.exists("server.ts"))
2148
2180
  throw new Error(`Server file not found: apps/${app.name}/server.ts`);
2149
- const target = path6.resolve(app.workspace.workspaceRoot, dir);
2181
+ const target = path7.resolve(app.workspace.workspaceRoot, dir);
2150
2182
  const code = `
2151
2183
  const { server } = await import(${JSON.stringify(serverPath)});
2152
2184
  const { DatabaseAdaptorRole, DocumentTransfer } = await import("akanjs/service");
@@ -2207,7 +2239,7 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
2207
2239
  await new (await loadBuildRunner())(app).typecheck(options);
2208
2240
  }
2209
2241
  async typecheckLibrary(lib, options = {}) {
2210
- const { ProjectTypecheck } = await import("./projectTypecheck-h8rgaczy.js");
2242
+ const { ProjectTypecheck } = await import("./projectTypecheck-vkb40hjc.js");
2211
2243
  const root = lib.workspace.workspaceRoot;
2212
2244
  await new ProjectTypecheck(lib.cwdPath, root, { ...process.env, AKAN_WORKSPACE_ROOT: root }).run([
2213
2245
  "../../server.ts",
@@ -2219,29 +2251,30 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
2219
2251
  ], options);
2220
2252
  }
2221
2253
  resolveTestPaths(exec, files) {
2222
- const root = exec instanceof SysExecutor || exec instanceof PkgExecutor ? exec.workspace.workspaceRoot : process.cwd();
2223
- const target = path6.relative(root, exec.cwdPath).split(path6.sep).join("/");
2224
- const isInside = (relative) => relative !== ".." && !relative.startsWith(`..${path6.sep}`) && !path6.isAbsolute(relative);
2254
+ const { root, target } = testTargetOf(exec);
2255
+ const isInside = (relative) => relative !== ".." && !relative.startsWith(`..${path7.sep}`) && !path7.isAbsolute(relative);
2225
2256
  return files.map((file) => {
2226
- const candidates = path6.isAbsolute(file) ? [file] : [path6.resolve(exec.cwdPath, file), path6.resolve(root, file)];
2227
- const existing = candidates.filter((candidate) => existsSync(candidate)).map((candidate) => path6.relative(exec.cwdPath, candidate));
2257
+ const candidates = path7.isAbsolute(file) ? [file] : [path7.resolve(exec.cwdPath, file), path7.resolve(root, file)];
2258
+ const existing = candidates.filter((candidate) => existsSync(candidate)).map((candidate) => path7.relative(exec.cwdPath, candidate));
2228
2259
  const found = existing.find(isInside);
2229
2260
  if (found === undefined)
2230
2261
  throw new Error(existing.length ? `${file} is outside ${target}: akan test ${exec.name} runs its own tests only` : `${file} names no file or folder in ${target}`);
2231
- return `./${found.split(path6.sep).join("/")}`;
2262
+ return `./${found.split(path7.sep).join("/")}`;
2232
2263
  });
2233
2264
  }
2234
- async test(exec, testPaths = []) {
2265
+ async test(exec, testPaths = [], flags = []) {
2235
2266
  const isSignalTarget = exec instanceof AppExecutor || exec instanceof LibExecutor;
2267
+ if (!testPaths.length && reportsNoTestFile(exec))
2268
+ return;
2236
2269
  const preloadPath = isSignalTarget ? await resolveSignalTestPreloadPath(exec) : null;
2237
2270
  const env = isSignalTarget ? {
2238
2271
  AKAN_TEST_SIGNAL: "1",
2239
2272
  AKAN_TEST_TARGET_TYPE: exec.type,
2240
2273
  AKAN_TEST_TARGET_NAME: exec.name,
2241
2274
  AKAN_TEST_LIBS: exec.getScanInfo({ allowEmpty: true })?.getLibs().join(",") ?? "",
2242
- AKAN_RUNTIME_DIR: path6.join(exec.workspace.workspaceRoot, "local", `${exec.type}s`, exec.name, "runtime")
2275
+ AKAN_RUNTIME_DIR: path7.join(exec.workspace.workspaceRoot, "local", `${exec.type}s`, exec.name, "runtime")
2243
2276
  } : {};
2244
- const args = ["test", "--isolate", ...preloadPath ? ["--preload", preloadPath] : [], ...testPaths];
2277
+ const args = ["test", "--isolate", ...flags, ...preloadPath ? ["--preload", preloadPath] : [], ...testPaths];
2245
2278
  await exec.spawn("bun", args, {
2246
2279
  ...isSignalTarget ? { env: { ...process.env, ...env } } : {},
2247
2280
  stdio: "inherit"
@@ -2251,9 +2284,13 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
2251
2284
  fast = false,
2252
2285
  reporter,
2253
2286
  spinner = false,
2254
- envProfile
2287
+ envProfile,
2288
+ environment,
2289
+ budget
2255
2290
  } = {}) {
2256
- return new (await loadBuildRunner())(app, { fast, reporter, profile: envProfile }).build({ spinner });
2291
+ return new (await loadBuildRunner())(app, { fast, reporter, profile: envProfile, environment, budget }).build({
2292
+ spinner
2293
+ });
2257
2294
  }
2258
2295
  async start(app, {
2259
2296
  open = false,
@@ -2355,9 +2392,9 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
2355
2392
  static #sameCheckout(reported, own) {
2356
2393
  const canonical = (root) => {
2357
2394
  try {
2358
- return realpathSync.native(root);
2395
+ return realpathSync2.native(root);
2359
2396
  } catch {
2360
- return path6.resolve(root);
2397
+ return path7.resolve(root);
2361
2398
  }
2362
2399
  };
2363
2400
  return canonical(reported) === canonical(own);
@@ -2381,13 +2418,13 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
2381
2418
  if (!mobileTarget || targets.length > 1)
2382
2419
  throw new Error("pack-update packs one native target at a time; pass --target <name>.");
2383
2420
  const nativeApp = new NativeApp(app, mobileTarget, env);
2384
- await UpdatePackFolder.clear(path6.resolve(out ?? path6.join(nativeApp.updatesDir, platform)));
2421
+ await UpdatePackFolder.clear(path7.resolve(out ?? path7.join(nativeApp.updatesDir, platform)));
2385
2422
  const pinned = publicEnv ? await NativePublicEnv.load(publicEnv) : against ? await NativePublicEnv.recordedIn(against) : null;
2386
2423
  await this.#buildMobileCsr(app, env, undefined, pinned);
2387
2424
  const { pack } = await nativeApp.packUpdate(platform, { out });
2388
2425
  app.logger.info(`packed ${mobileTarget.name} ${platform} for channel '${pack.channel}' to ${pack.out}: ${pack.files} files, ${(pack.size / 1024).toFixed(0)} KiB, native API ${pack.nativeApi}`);
2389
2426
  if (against) {
2390
- const bundle = path6.join(pack.out, UpdatePackFolder.bundleFile);
2427
+ const bundle = path7.join(pack.out, UpdatePackFolder.bundleFile);
2391
2428
  const compat = await NativeApp.compareBundles(app.cwdPath, against, bundle);
2392
2429
  const envProblem = await NativePublicEnv.problemAgainst(against, bundle);
2393
2430
  await UpdatePackFolder.writeCompat(pack, {
@@ -2540,7 +2577,9 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
2540
2577
  APP_OPERATION_MODE: "release"
2541
2578
  });
2542
2579
  try {
2543
- await new (await loadBuildRunner())(app, { environment: env, profile: envProfile }).build({ spinner: true });
2580
+ await new (await loadBuildRunner())(app, { environment: env, profile: envProfile, budget: "off" }).build({
2581
+ spinner: true
2582
+ });
2544
2583
  } finally {
2545
2584
  for (const [key, value] of Object.entries(prevEnv)) {
2546
2585
  if (value === undefined)
@@ -2570,7 +2609,7 @@ if (loaded) process.exitCode = await loaded.migrations.command(loaded.server, ar
2570
2609
  return;
2571
2610
  for (const failure of failures) {
2572
2611
  const message = toError(failure.error).message;
2573
- Logger3.rawLog(`Native target ${failure.target} failed: ${message}`, undefined, "error");
2612
+ Logger4.rawLog(`Native target ${failure.target} failed: ${message}`, undefined, "error");
2574
2613
  }
2575
2614
  throw new Error(`${failures.length}/${results.length} native targets failed`);
2576
2615
  }
@@ -1,14 +1,15 @@
1
1
  // @bun
2
2
  import {
3
3
  resolveSsrPageEntriesForApp
4
- } from "./index-38by07nw.js";
4
+ } from "./index-sr5da35e.js";
5
5
  import {
6
6
  createBarrelImportsPlugin,
7
+ bundleConditions,
7
8
  bundleDefine,
8
9
  CsrEntryFiles,
9
10
  PagesEntrySourceGenerator,
10
11
  PagesBundleBuilder
11
- } from "./index-6t7fkx73.js";
12
+ } from "./index-1q1cjn8s.js";
12
13
 
13
14
  // pkgs/@akanjs/devkit/frontendBuild/csrArtifactBuilder.ts
14
15
  import { mkdir as mkdir2, rm as rm2, unlink as unlink2 } from "fs/promises";
@@ -455,6 +456,7 @@ ${logs}` : ""}`);
455
456
  splitting: false,
456
457
  minify: true,
457
458
  define: bundleDefine(app, command, "csr"),
459
+ conditions: bundleConditions(command),
458
460
  optimizeImports,
459
461
  plugins: [PagesBundleBuilder.createCssStubPlugin(), createBrowserDirnamePlugin(), SideEffectImportOrder.plugin()]
460
462
  };
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-r0q2ka2b.js";
5
+ } from "./index-93ewzmp6.js";
6
6
  import {
7
7
  LibSource,
8
8
  formatLibStatuses,
9
9
  CommandExecutionError,
10
10
  LibExecutor
11
- } from "./index-38by07nw.js";
11
+ } from "./index-sr5da35e.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/library/library.script.ts
14
14
  import { Logger } from "akanjs/common";
@@ -13,10 +13,22 @@ var warnIgnoredNpmRegistry = () => {
13
13
  Logger.warn(line);
14
14
  };
15
15
  var getNpmRegistryUrl = (registryUrl = npmRegistryFromEnv() ?? defaultNpmRegistry) => registryUrl.replace(/\/+$/, "");
16
+ var packageUrl = (registry, packageName) => `${registry}/${encodeURIComponent(packageName).replace(/^%40/, "@")}`;
17
+ async function getPublishedVersions(packageName, registryUrl) {
18
+ const registry = getNpmRegistryUrl(registryUrl);
19
+ const res = await fetch(packageUrl(registry, packageName), {
20
+ headers: { Accept: "application/vnd.npm.install-v1+json" }
21
+ });
22
+ if (res.status === 404)
23
+ return null;
24
+ if (!res.ok)
25
+ throw new Error(`Failed to fetch ${packageName} metadata from ${registry} (${res.status})`);
26
+ const metadata = await res.json();
27
+ return { tags: metadata["dist-tags"] ?? {}, versions: Object.keys(metadata.versions ?? {}) };
28
+ }
16
29
  async function getLatestPackageVersion(packageName, tag = "latest", registryUrl) {
17
30
  const registry = getNpmRegistryUrl(registryUrl);
18
- const url = `${registry}/${encodeURIComponent(packageName).replace(/^%40/, "@")}`;
19
- const res = await fetch(url);
31
+ const res = await fetch(packageUrl(registry, packageName));
20
32
  if (!res.ok)
21
33
  throw new Error(`Failed to fetch ${packageName} metadata from ${registry}`);
22
34
  const metadata = await res.json();
@@ -26,4 +38,4 @@ async function getLatestPackageVersion(packageName, tag = "latest", registryUrl)
26
38
  return version;
27
39
  }
28
40
 
29
- export { npmRegistryFromEnv, warnIgnoredNpmRegistry, getNpmRegistryUrl, getLatestPackageVersion };
41
+ export { npmRegistryFromEnv, warnIgnoredNpmRegistry, getNpmRegistryUrl, getPublishedVersions, getLatestPackageVersion };