@akanjs/cli 3.1.1-rc.8 → 3.1.1

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 (184) hide show
  1. package/.build-stamp +1 -1
  2. package/CodeAgent-35wnb7w5.js +9 -0
  3. package/{CodeTui-rqxarxsn.js → CodeTui-h6yz2kvq.js} +1 -1
  4. package/TunnelShare-xyjpa7gx.js +14 -0
  5. package/agent.command-3r4jsck8.js +46 -0
  6. package/akanCode.js +10 -6
  7. package/{application.command-14xsthcr.js → application.command-g7xv6ad0.js} +46 -13
  8. package/{applicationBuildRunner-t2r84sz6.js → applicationBuildRunner-qvjnhr9j.js} +9 -6
  9. package/buildBatch.proc.js +6 -6
  10. package/{cloud.command-rmw1kcf1.js → cloud.command-6ebygmhw.js} +17 -15
  11. package/cloud.script-0s1jybd5.js +26 -0
  12. package/{code.command-719k3e9q.js → code.command-mpkm2emr.js} +6 -6
  13. package/commandManifest.json +1 -1
  14. package/{context.command-c4t4z1vy.js → context.command-svdh6b2w.js} +18 -17
  15. package/context.runner-ch0z3a8g.js +26 -0
  16. package/{devTui-q7k7bakd.js → devTui-evr3b35y.js} +1 -1
  17. package/{guideline.command-snh85ctf.js → guideline.command-qwp3tnjx.js} +3 -3
  18. package/guidelines/conventions/core.md +106 -0
  19. package/guidelines/conventions/rules/app.md +83 -0
  20. package/guidelines/conventions/rules/auth.md +45 -0
  21. package/guidelines/conventions/rules/config.md +56 -0
  22. package/guidelines/conventions/rules/constant.md +24 -0
  23. package/guidelines/conventions/rules/gates.md +31 -0
  24. package/guidelines/conventions/rules/layer.md +25 -0
  25. package/guidelines/conventions/rules/migration.md +27 -0
  26. package/guidelines/conventions/rules/module.md +90 -0
  27. package/guidelines/conventions/rules/page.md +56 -0
  28. package/guidelines/conventions/rules/sensitive.md +16 -0
  29. package/guidelines/conventions/rules/server.md +86 -0
  30. package/guidelines/conventions/rules/ssr.md +47 -0
  31. package/guidelines/conventions/rules/style.md +43 -0
  32. package/guidelines/conventions/rules/test.md +34 -0
  33. package/guidelines/conventions/rules/ts.md +95 -0
  34. package/guidelines/conventions/rules/tsx.md +75 -0
  35. package/guidelines/mcpRule/mcpRule.instruction.md +1 -1
  36. package/guidelines/pageRule/pageRule.instruction.md +4 -3
  37. package/guidelines/queryRule/queryRule.instruction.md +4 -0
  38. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +3 -3
  39. package/incrementalBuilder.proc.js +6 -6
  40. package/{index-pcwzkdqb.js → index-1p0qbq3m.js} +1 -1
  41. package/{index-xb8809yb.js → index-1shvxzt0.js} +3 -3
  42. package/{index-8w76g4rm.js → index-266dewjs.js} +11 -11
  43. package/{index-5max10jx.js → index-3yz30c07.js} +72 -53
  44. package/{index-xjf5j657.js → index-4mj92tsh.js} +952 -47
  45. package/index-4pdts00b.js +1604 -0
  46. package/{index-42j4a8zq.js → index-8559hsz4.js} +4 -3
  47. package/{index-wcej7g4z.js → index-8scw1pjk.js} +93 -23
  48. package/{index-5phjb48k.js → index-96wzdhfh.js} +74 -233
  49. package/index-9bv479q5.js +1 -0
  50. package/index-9rvcs76p.js +653 -0
  51. package/index-am36s3jh.js +3582 -0
  52. package/index-b8c289dx.js +444 -0
  53. package/{index-espk51ah.js → index-dd44g6vz.js} +3 -3
  54. package/{index-3wypz6xj.js → index-eja64h28.js} +7 -3
  55. package/index-fbewhg4g.js +590 -0
  56. package/index-jje9qzyq.js +27 -0
  57. package/{index-j9vyj3dj.js → index-k5jbcxyh.js} +3 -3
  58. package/{index-hmmv2cah.js → index-ksfgqq1x.js} +1 -1
  59. package/index-m5n3ka0p.js +18 -0
  60. package/{index-5nd1wtkv.js → index-p6x5b7hr.js} +1 -1
  61. package/{index-0p37cz91.js → index-payhwt51.js} +21 -29
  62. package/{index-myc22sgv.js → index-qkkdhjm6.js} +5 -4
  63. package/{index-74tjjsnc.js → index-qxzrp5xt.js} +33 -37
  64. package/{index-zrte51fn.js → index-r0k3ham2.js} +4 -4
  65. package/{index-hmt54t45.js → index-r2w2eh93.js} +4 -4
  66. package/index-r2wedvqn.js +138 -0
  67. package/{index-skk9zc1x.js → index-rnphv731.js} +2 -2
  68. package/{index-pa3c2mb8.js → index-s6da8ta9.js} +82 -1227
  69. package/index-tenw3mah.js +225 -0
  70. package/{index-31es1yev.js → index-tgt2fnd6.js} +107 -6
  71. package/{index-8ap5z1n5.js → index-vxmy1p4f.js} +16 -36
  72. package/{index-mdqr41sp.js → index-w4k2ragk.js} +7 -7
  73. package/{index-qd5km521.js → index-w7q6h97v.js} +1 -1
  74. package/{index-dy0jx9ay.js → index-wwe9rsrx.js} +14 -0
  75. package/{index-2xcc2ax5.js → index-xq543a5y.js} +2 -2
  76. package/{index-0fz95kxe.js → index-xqgwjz7a.js} +1 -1
  77. package/{index-40brg4px.js → index-xxfy1jp2.js} +4 -4
  78. package/{index-905qdgqp.js → index-z4b84y6k.js} +1 -1
  79. package/index-zcf6k8a5.js +410 -0
  80. package/index.js +23 -22
  81. package/{library.command-gycrwhf1.js → library.command-2853y6mk.js} +3 -3
  82. package/{localRegistry.command-2t3fghje.js → localRegistry.command-76ds31p4.js} +19 -15
  83. package/{module.command-v6hgs1bc.js → module.command-yfnb0abs.js} +5 -5
  84. package/{package.command-shzpcfph.js → package.command-d9s86hp9.js} +3 -3
  85. package/package.json +2 -2
  86. package/{page.command-ptxn5kqk.js → page.command-6a8a8rd1.js} +3 -3
  87. package/{pipeline.command-zz31pgax.js → pipeline.command-rt3rwd2z.js} +2 -2
  88. package/{primitive.command-a1vse91z.js → primitive.command-emcebgrq.js} +6 -6
  89. package/{projectTypecheck-2ztky9cf.js → projectTypecheck-51m7eh1f.js} +1 -1
  90. package/{prompter-76k56b37.js → prompter-hgcta8pb.js} +1 -1
  91. package/quality.command-xtrk0n3x.js +76 -0
  92. package/{repair.command-cvazbz99.js → repair.command-51szxnxx.js} +5 -5
  93. package/{routeSourceValidator-6jd0q6r6.js → routeSourceValidator-4h947v7c.js} +13 -3
  94. package/{scalar.command-0acvyp26.js → scalar.command-8qv27t82.js} +4 -4
  95. package/skills/akan-agent/SKILL.md +36 -0
  96. package/skills/akan-code/SKILL.md +1 -0
  97. package/skills/akan-debug/SKILL.md +40 -6
  98. package/skills/akan-deps/SKILL.md +1 -2
  99. package/skills/akan-mcp/SKILL.md +40 -0
  100. package/skills/akan-page/SKILL.md +44 -0
  101. package/skills/akan-query/SKILL.md +38 -0
  102. package/skills/akan-runtime/SKILL.md +40 -0
  103. package/skills/akan-scaffold/SKILL.md +16 -6
  104. package/skills/akan-transport/SKILL.md +40 -0
  105. package/skills/akan-validate/SKILL.md +13 -11
  106. package/{subspace.command-kvxmyxtf.js → subspace.command-pn56pnh8.js} +8 -8
  107. package/templates/__scalar/__model__/__model__.constant.ts +3 -5
  108. package/templates/__scalar/__model__/__model__.dictionary.ts +6 -5
  109. package/templates/__scalar/__model__/__model__.document.ts +3 -3
  110. package/templates/app/akan.config.ts +2 -3
  111. package/templates/app/env/env.client.ts +2 -4
  112. package/templates/app/env/env.client.type.ts +2 -3
  113. package/templates/app/env/env.server.ts +2 -3
  114. package/templates/app/lib/___appName__/__appName__.dictionary.ts +1 -2
  115. package/templates/app/lib/___appName__/__appName__.service.ts +3 -3
  116. package/templates/app/lib/___appName__/__appName__.signal.ts +5 -5
  117. package/templates/app/lib/___appName__/__appName__.store.ts +4 -6
  118. package/templates/app/lib/option.ts +2 -3
  119. package/templates/app/main.ts +2 -4
  120. package/templates/app/page/_index.tsx +3 -3
  121. package/templates/app/page/_layout.tsx +13 -10
  122. package/templates/appSample/lib/__scalar/workHistory/workHistory.constant.ts +1 -5
  123. package/templates/appSample/lib/__scalar/workHistory/workHistory.dictionary.ts +1 -1
  124. package/templates/appSample/lib/_noti/noti.signal.ts +1 -1
  125. package/templates/appSample/lib/task/Task.Template.tsx +2 -1
  126. package/templates/appSample/lib/task/Task.Unit.tsx +3 -2
  127. package/templates/appSample/lib/task/Task.Util.tsx +16 -4
  128. package/templates/appSample/lib/task/task.constant.ts +1 -5
  129. package/templates/appSample/lib/task/task.dictionary.ts +2 -8
  130. package/templates/appSample/lib/task/task.document.ts +1 -1
  131. package/templates/appSample/page/task/_index.tsx +2 -1
  132. package/templates/appSample/page/task/new.tsx +2 -1
  133. package/templates/appSample/ui/QuantityControl.tsx +5 -9
  134. package/templates/biomeForm.ts +144 -0
  135. package/templates/crudPages/[__model__Id]/edit/page.tsx +3 -3
  136. package/templates/crudPages/[__model__Id]/page.tsx +5 -5
  137. package/templates/crudPages/new/page.tsx +4 -3
  138. package/templates/crudPages/page.tsx +3 -3
  139. package/templates/crudSinglePage/page.tsx +9 -5
  140. package/templates/libRoot/akan.config.ts +2 -3
  141. package/templates/libRoot/lib/___libName__/__libName__.dictionary.ts +1 -2
  142. package/templates/libRoot/lib/___libName__/__libName__.service.ts +5 -4
  143. package/templates/libRoot/lib/___libName__/__libName__.signal.ts +6 -5
  144. package/templates/libRoot/lib/___libName__/__libName__.store.ts +5 -6
  145. package/templates/libRoot/lib/option.ts +1 -2
  146. package/templates/module/__Model__.Template.tsx +11 -10
  147. package/templates/module/__Model__.Unit.tsx +18 -5
  148. package/templates/module/__Model__.Util.tsx +9 -7
  149. package/templates/module/__Model__.View.tsx +9 -6
  150. package/templates/module/__Model__.Zone.tsx +25 -17
  151. package/templates/module/__model__.constant.ts +8 -9
  152. package/templates/module/__model__.dictionary.ts +16 -17
  153. package/templates/module/__model__.document.ts +6 -8
  154. package/templates/module/__model__.service.ts +3 -3
  155. package/templates/module/__model__.signal.ts +11 -10
  156. package/templates/module/__model__.store.ts +3 -5
  157. package/templates/service/__model__.dictionary.ts +6 -5
  158. package/templates/service/__model__.service.ts +3 -3
  159. package/templates/service/__model__.signal.ts +5 -4
  160. package/templates/service/__model__.store.ts +3 -5
  161. package/templates/workspaceRoot/.gitignore.template +3 -0
  162. package/templates/workspaceRoot/.vscode/settings.json.template +21 -21
  163. package/templates/workspaceRoot/AGENTS.md.template +4 -10
  164. package/{tunnel.command-kxv0ddmp.js → tunnel.command-q2h0j2en.js} +7 -7
  165. package/{typeChecker-px49mezc.js → typeChecker-j2jdnqsr.js} +1 -1
  166. package/typecheck.proc.js +6 -1
  167. package/verify.command-z1dsbmrt.js +91 -0
  168. package/{workflow.command-abb1d5xy.js → workflow.command-r3y67jeq.js} +47 -13
  169. package/workspace.command-t2f0xsrw.js +263 -0
  170. package/CodeAgent-3sy7kjgj.js +0 -9
  171. package/TunnelShare-2ef94kha.js +0 -14
  172. package/agent.command-ydftceda.js +0 -25
  173. package/cloud.script-v1ysyerg.js +0 -24
  174. package/context.runner-qb15sjf8.js +0 -25
  175. package/guidelines/conventions/conventions.instruction.md +0 -617
  176. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +0 -291
  177. package/index-4vgbysa0.js +0 -279
  178. package/index-7md2g9vw.js +0 -6
  179. package/index-b70zct19.js +0 -856
  180. package/index-zzvvc845.js +0 -74
  181. package/quality.command-ah8qcakd.js +0 -1478
  182. package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +0 -69
  183. package/templates/workspaceRoot/docs/GENERATED.md.template +0 -55
  184. package/workspace.command-tsc99yec.js +0 -521
@@ -0,0 +1,225 @@
1
+ // @bun
2
+ // pkgs/@akanjs/devkit/preview/PreviewChrome.ts
3
+ import { existsSync } from "fs";
4
+ import { homedir } from "os";
5
+ import path from "path";
6
+
7
+ class PreviewChrome2 {
8
+ static pathEnvKey = "BUN_CHROME_PATH";
9
+ static backendEnvKey = "AKAN_CODE_WEBVIEW_BACKEND";
10
+ static executables = [
11
+ "chromium",
12
+ "chromium-browser",
13
+ "google-chrome-stable",
14
+ "google-chrome",
15
+ "brave-browser",
16
+ "microsoft-edge",
17
+ "chrome"
18
+ ];
19
+ static appBundles = [
20
+ "Google Chrome.app/Contents/MacOS/Google Chrome",
21
+ "Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary",
22
+ "Chromium.app/Contents/MacOS/Chromium",
23
+ "Brave Browser.app/Contents/MacOS/Brave Browser",
24
+ "Microsoft Edge.app/Contents/MacOS/Microsoft Edge"
25
+ ];
26
+ static get backend() {
27
+ const declared = process.env[PreviewChrome2.backendEnvKey];
28
+ if (declared === "webkit" || declared === "chrome")
29
+ return declared;
30
+ return process.platform === "darwin" ? "webkit" : "chrome";
31
+ }
32
+ static executable() {
33
+ const declared = process.env[PreviewChrome2.pathEnvKey];
34
+ if (declared)
35
+ return declared;
36
+ for (const name of PreviewChrome2.executables) {
37
+ const found = Bun.which(name);
38
+ if (found)
39
+ return found;
40
+ }
41
+ if (process.platform !== "darwin")
42
+ return;
43
+ for (const root of ["/Applications", path.join(homedir(), "Applications")])
44
+ for (const bundle of PreviewChrome2.appBundles) {
45
+ const candidate = path.join(root, bundle);
46
+ if (existsSync(candidate))
47
+ return candidate;
48
+ }
49
+ return;
50
+ }
51
+ static get available() {
52
+ return PreviewChrome2.isAvailable();
53
+ }
54
+ static isAvailable(engine = PreviewChrome2.backend) {
55
+ return engine === "webkit" ? process.platform === "darwin" : !!PreviewChrome2.executable();
56
+ }
57
+ static backendOption(engine = PreviewChrome2.backend) {
58
+ if (engine === "webkit")
59
+ return "webkit";
60
+ const argv = ["--disable-dev-shm-usage"];
61
+ if (process.getuid?.() === 0)
62
+ argv.push("--no-sandbox");
63
+ return { type: "chrome", argv };
64
+ }
65
+ static dockerRuns = [
66
+ "apt-get update && apt-get install -y --no-install-recommends chromium fonts-liberation fonts-noto-color-emoji fonts-noto-cjk && rm -rf /var/lib/apt/lists/*"
67
+ ];
68
+ static unavailableReason(engine = PreviewChrome2.backend) {
69
+ if (PreviewChrome2.isAvailable(engine))
70
+ return;
71
+ if (engine === "webkit")
72
+ return `The webkit WebView backend exists only on macOS. Set ${PreviewChrome2.backendEnvKey}=chrome and install a browser.`;
73
+ return [
74
+ "The page preview needs a browser and this machine has none on PATH.",
75
+ `Install one (${PreviewChrome2.dockerRuns[0]}) or point ${PreviewChrome2.pathEnvKey} at an existing Chrome.`
76
+ ].join(" ");
77
+ }
78
+ }
79
+
80
+ // pkgs/@akanjs/devkit/preview/PreviewView.ts
81
+ class PreviewView2 {
82
+ static get available() {
83
+ return PreviewView2.isAvailable();
84
+ }
85
+ static isAvailable(engine = PreviewChrome2.backend) {
86
+ return typeof Bun.WebView === "function" && PreviewChrome2.isAvailable(engine);
87
+ }
88
+ static unavailableReason(engine = PreviewChrome2.backend) {
89
+ if (typeof Bun.WebView !== "function")
90
+ return "This Bun build has no WebView, so the page preview is off.";
91
+ return PreviewChrome2.unavailableReason(engine);
92
+ }
93
+ static async probe(url, {
94
+ screenshot = false,
95
+ width = 1280,
96
+ height = 800,
97
+ engine = PreviewChrome2.backend,
98
+ timeoutMs = 30000,
99
+ settleMs = 0
100
+ } = {}) {
101
+ const logs = [];
102
+ const deadline = Date.now() + timeoutMs;
103
+ const within = (work, what) => PreviewView2.#within(work, deadline, `${what} ${url}`);
104
+ const view = PreviewView2.#open({ width, height, engine, onConsole: (line) => logs.push(line) });
105
+ try {
106
+ let page = await PreviewView2.#load(view, url, settleMs, within);
107
+ if (page.empty) {
108
+ logs.length = 0;
109
+ page = await PreviewView2.#load(view, url, settleMs, within);
110
+ }
111
+ const result = {
112
+ url,
113
+ finalUrl: page.href,
114
+ status: page.status ?? await PreviewView2.#statusOf(page.href, deadline),
115
+ title: page.title,
116
+ text: page.text,
117
+ consoleErrors: logs.filter((line) => line.startsWith("error")),
118
+ consoleWarnings: logs.filter((line) => line.startsWith("warn")),
119
+ pageErrors: page.pageErrors,
120
+ domFindings: page.domFindings
121
+ };
122
+ if (screenshot)
123
+ result.screenshot = await within(view.screenshot({ encoding: "base64" }), "screenshotting");
124
+ return result;
125
+ } finally {
126
+ await view.close();
127
+ }
128
+ }
129
+ static async#load(view, url, settleMs, within) {
130
+ await within(view.navigate(url), "loading");
131
+ if (settleMs > 0)
132
+ await Bun.sleep(settleMs);
133
+ const read = await within(view.evaluate(readPageExpression), "reading");
134
+ return {
135
+ href: typeof read?.href === "string" ? read.href : url,
136
+ title: typeof read?.title === "string" ? read.title : "",
137
+ text: typeof read?.text === "string" ? read.text : "",
138
+ status: typeof read?.status === "number" && read.status > 0 ? read.status : null,
139
+ empty: read?.empty === true,
140
+ pageErrors: PreviewView2.#strings(read?.pageErrors),
141
+ domFindings: PreviewView2.#strings(read?.domFindings)
142
+ };
143
+ }
144
+ static async#statusOf(href, deadline) {
145
+ const left = Math.max(1, deadline - Date.now());
146
+ const response = await fetch(href, { redirect: "manual", signal: AbortSignal.timeout(left) }).catch(() => null);
147
+ return response?.status ?? null;
148
+ }
149
+ static async#within(work, deadline, what) {
150
+ let timer;
151
+ const expired = new Promise((_, reject) => {
152
+ timer = setTimeout(() => reject(new Error(`Timed out ${what}; the dev server may be rebuilding or stuck.`)), Math.max(0, deadline - Date.now()));
153
+ });
154
+ try {
155
+ return await Promise.race([work, expired]);
156
+ } finally {
157
+ clearTimeout(timer);
158
+ }
159
+ }
160
+ static #open({
161
+ width,
162
+ height,
163
+ engine,
164
+ onConsole
165
+ }) {
166
+ const Ctor = Bun.WebView;
167
+ return new Ctor({
168
+ width,
169
+ height,
170
+ dataStore: "ephemeral",
171
+ backend: PreviewChrome2.backendOption(engine),
172
+ console: (type, ...args) => onConsole(`${type} ${PreviewView2.formatConsole(args)}`)
173
+ });
174
+ }
175
+ static formatConsole(args) {
176
+ const [first, ...rest] = args;
177
+ const head = typeof first === "string" ? first.replace(/%[sdifoOc]/g, (token) => {
178
+ if (!rest.length)
179
+ return token;
180
+ const value = rest.shift();
181
+ return token === "%c" ? "" : String(value);
182
+ }) : String(first);
183
+ return [head, ...rest.map(String)].join(" ").replace(/\n(\s*\n)+/g, `
184
+ `).slice(0, 1500);
185
+ }
186
+ static #strings(value) {
187
+ return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
188
+ }
189
+ }
190
+ var readPageExpression = `(() => {
191
+ const pageErrors = [];
192
+ const domFindings = [];
193
+ const body = document.body;
194
+ const rendered = body ? Array.from(body.children).filter((el) => !["SCRIPT", "STYLE", "TEMPLATE", "LINK", "NOSCRIPT"].includes(el.tagName) && !el.classList.contains("__akan_hmr_overlay")) : [];
195
+ const empty = !rendered.length && !(body && body.innerText && body.innerText.trim());
196
+ if (empty) pageErrors.push("The page body rendered empty.");
197
+ if (self.__AKAN_HMR_SYSTEM_PAGE__) pageErrors.push("The server could not render this page and answered with its error page: " + (body ? body.innerText.trim().replace(/\\s+/g, " ").slice(0, 400) : ""));
198
+ const overlay = document.querySelector('.__akan_hmr_overlay[data-status="error"]');
199
+ if (overlay) pageErrors.push("The dev build failed: " + overlay.textContent.trim().slice(0, 400));
200
+ const all = Array.from(document.querySelectorAll("body *"));
201
+ const viewportWidth = document.documentElement.clientWidth;
202
+ const pageWidth = document.documentElement.scrollWidth;
203
+ if (pageWidth > viewportWidth + 8) {
204
+ const wide = all.find((el) => el.getBoundingClientRect().right > viewportWidth + 8);
205
+ domFindings.push("The page is " + pageWidth + "px wide in a " + viewportWidth + "px viewport" + (wide ? ", first wider element: " + (wide.tagName.toLowerCase() + "." + (typeof wide.className === "string" ? wide.className : "")).slice(0, 120) : "") + ".");
206
+ }
207
+ const invisibleText = all.filter((el) => {
208
+ if (!el.textContent || !el.textContent.trim()) return false;
209
+ const style = getComputedStyle(el);
210
+ return style.color === style.backgroundColor && style.backgroundColor !== "rgba(0, 0, 0, 0)";
211
+ });
212
+ if (invisibleText.length) domFindings.push(invisibleText.length + " element(s) render text in the same colour as their background.");
213
+ const unresolved = all.filter((el) => /(^|\\s)(bg|text|border)-(base-100|base-content|primary-content|error)(\\s|$)/.test(typeof el.className === "string" ? el.className : ""));
214
+ if (unresolved.length) domFindings.push(unresolved.length + " element(s) use a dropped daisyUI colour slot that renders no CSS.");
215
+ const navigation = performance.getEntriesByType("navigation")[0];
216
+ const status = navigation && typeof navigation.responseStatus === "number" ? navigation.responseStatus : null;
217
+ const text = body ? body.innerText.trim().replace(/\\s+/g, " ").slice(0, 600) : "";
218
+ return { href: location.href, title: document.title, text, status, empty, pageErrors, domFindings };
219
+ })()`;
220
+
221
+ // pkgs/@akanjs/devkit/stripAnsi.ts
222
+ var ansi = new RegExp(`${String.fromCharCode(27)}(?:[@-Z\\\\-_]|\\[[\\s\\S]*?[@-~])`, "g");
223
+ var stripAnsi = (text) => text.replace(ansi, "");
224
+
225
+ export { PreviewChrome2, PreviewView2, stripAnsi };
@@ -10,7 +10,7 @@ import {
10
10
  isScannedRootEntry,
11
11
  AppExecutor,
12
12
  LibExecutor
13
- } from "./index-wcej7g4z.js";
13
+ } from "./index-8scw1pjk.js";
14
14
  import {
15
15
  FileSys2
16
16
  } from "./index-52w0fvh8.js";
@@ -23,12 +23,12 @@ import {
23
23
  workflowPathsForPlan,
24
24
  workflowRunArtifactPath,
25
25
  workflowSyncDir
26
- } from "./index-xjf5j657.js";
26
+ } from "./index-4mj92tsh.js";
27
27
 
28
28
  // pkgs/@akanjs/devkit/akanContext.ts
29
29
  import { readdir } from "fs/promises";
30
30
  import path from "path";
31
- import { capitalize, isRecord } from "akanjs/common";
31
+ import { capitalize, isRecord, parseRouteModuleKey } from "akanjs/common";
32
32
  var guidelineResourceUri = (name) => `akan://guidelines/${name}`;
33
33
  var staticResourceList = [
34
34
  { uri: "akan://docs/framework", name: "Akan framework guide", mimeType: "text/markdown" },
@@ -129,6 +129,7 @@ var generatedFiles = [
129
129
  "*/common/index.ts"
130
130
  ];
131
131
  var validationCommands = [
132
+ "akan verify [<app-or-lib-or-pkg>]",
132
133
  "akan sync <app-or-lib>",
133
134
  "akan lint <app-or-lib-or-pkg>",
134
135
  "akan typecheck <app-or-lib>",
@@ -142,7 +143,7 @@ var unknownGeneratedFilesFreshness = {
142
143
  status: "unknown",
143
144
  message: "Run sync before validation so generated Akan files match the current source conventions.",
144
145
  refreshCommand: "akan sync <app-or-lib>",
145
- verifyingCommands: ["akan lint <app-or-lib-or-pkg>", "akan build <app-name>"]
146
+ verifyingCommands: ["akan verify <app-or-lib>"]
146
147
  };
147
148
  var repairAction = (kind, command, reason, safeToRun) => ({
148
149
  kind,
@@ -231,7 +232,7 @@ var generatedFreshnessFromStates = async (workspace) => {
231
232
  status: targets.some((target) => target.status === "fresh") ? "fresh" : "stale",
232
233
  message: lastFresh ? `Generated files were refreshed for ${lastFresh.target} at ${lastFresh.lastSyncedAt}.` : "Generated sync state exists, but the last recorded repair did not pass.",
233
234
  refreshCommand: "akan sync <app-or-lib>",
234
- verifyingCommands: ["akan lint <app-or-lib-or-pkg>", "akan build <app-name>"],
235
+ verifyingCommands: ["akan verify <app-or-lib>"],
235
236
  targets
236
237
  };
237
238
  };
@@ -306,9 +307,33 @@ var getSysModules = async (workspace, sys, {
306
307
  }
307
308
  return modules.sort((a, b) => `${a.sysName}:${a.path}`.localeCompare(`${b.sysName}:${b.path}`));
308
309
  };
310
+ var getAppRoutes = async (app, workspaceRoot) => {
311
+ const sources = await app.getRouteSources();
312
+ const guardedLayouts = new Set;
313
+ const pages = [];
314
+ for (const source of sources) {
315
+ const parsed = parseRouteModuleKey(source.key);
316
+ if (parsed.kind === "layout" && source.info.chain?.guarded)
317
+ guardedLayouts.add(parsed.routeSegments.join("/"));
318
+ else if (parsed.kind === "page")
319
+ pages.push({ source, parsed });
320
+ }
321
+ return pages.map(({ source, parsed }) => {
322
+ const segments = parsed.routeSegments;
323
+ const reach = parsed.leaf === "_index" ? segments.length : segments.length - 1;
324
+ const underGuard = Array.from({ length: reach + 1 }, (_, idx) => segments.slice(0, idx).join("/")).some((prefix) => guardedLayouts.has(prefix));
325
+ return {
326
+ path: parsed.pattern.replace(/^\/:lang/, "") || "/",
327
+ file: path.relative(workspaceRoot, source.absPath).replaceAll(path.sep, "/"),
328
+ search: source.info.chain?.search ?? [],
329
+ guarded: !!source.info.chain?.guarded || underGuard,
330
+ devOnly: source.info.devOnly
331
+ };
332
+ }).sort((a, b) => a.path.localeCompare(b.path));
333
+ };
309
334
  var getSysContext = async (workspace, type, name, options) => {
310
335
  const sys = type === "app" ? AppExecutor.from(workspace, name) : LibExecutor.from(workspace, name);
311
- return {
336
+ const context = {
312
337
  type,
313
338
  name,
314
339
  path: `${type}s/${name}`,
@@ -318,6 +343,9 @@ var getSysContext = async (workspace, type, name, options) => {
318
343
  module: options.module
319
344
  })
320
345
  };
346
+ if (sys instanceof AppExecutor && options.app === name)
347
+ await getAppRoutes(sys, workspace.workspaceRoot).then((routes) => context.routes = routes, (error) => context.routeError = error instanceof Error ? error.message : String(error));
348
+ return context;
321
349
  };
322
350
 
323
351
  class AkanContextAnalyzer {
@@ -372,6 +400,41 @@ class AkanContextAnalyzer {
372
400
  hint
373
401
  };
374
402
  }
403
+ static async#agentGuideOversize(workspace, sysPaths) {
404
+ const sizeOf = async (file) => {
405
+ const content = await safeReadText(path.join(workspace.workspaceRoot, file));
406
+ return { file, bytes: content === null ? 0 : Buffer.byteLength(content) };
407
+ };
408
+ const root = await sizeOf("AGENTS.md");
409
+ if (root.bytes === 0)
410
+ return null;
411
+ const scoped = await Promise.all(sysPaths.map((sysPath) => sizeOf(`${sysPath}/AGENTS.md`)));
412
+ const largest = scoped.reduce((max, entry) => entry.bytes > max.bytes ? entry : max, { file: "", bytes: 0 });
413
+ const total = root.bytes + largest.bytes;
414
+ if (total <= 32 * 1024 * 0.8)
415
+ return null;
416
+ const subject = largest.bytes ? `AGENTS.md and ${largest.file} add up to` : "AGENTS.md is";
417
+ return `${subject} ${Math.ceil(total / 1024)} KiB of the 32 KiB Codex reads \u2014 run \`akan agent install\`, then shorten the text outside the akan:agent markers or move it into a skill.`;
418
+ }
419
+ static async#agentGuideLeftovers(workspace) {
420
+ const root = workspace.workspaceRoot;
421
+ const guide = await safeReadText(path.join(root, "AGENTS.md")) ?? "";
422
+ const leftovers = [];
423
+ for (const doc of ["docs/AI-DEVELOPMENT.md", "docs/GENERATED.md"]) {
424
+ const pointer = guide.includes(doc);
425
+ if (await safeReadText(path.join(root, doc)) !== null)
426
+ leftovers.push({
427
+ path: doc,
428
+ message: `${doc} is an older template's copy of the agent guide, and nothing reads it now \u2014 delete it${pointer ? " and the AGENTS.md sentence that points to it" : ""}.`
429
+ });
430
+ else if (pointer)
431
+ leftovers.push({
432
+ path: "AGENTS.md",
433
+ message: `AGENTS.md points to ${doc}, which is gone \u2014 delete that sentence.`
434
+ });
435
+ }
436
+ return leftovers;
437
+ }
375
438
  static async#configLeftovers(workspace, sysPaths) {
376
439
  const leftovers = [];
377
440
  for (const sysPath of sysPaths) {
@@ -435,6 +498,11 @@ class AkanContextAnalyzer {
435
498
  if (agentDrift)
436
499
  report({ severity: "warning", code: agentDrift.code, path: "AGENTS.md", message: agentDrift.message }, repairAction("generated", "akan agent install agents-md", agentDrift.hint, true));
437
500
  const sysPaths = [...context.apps, ...context.libs].map((sys) => sys.path);
501
+ const oversize = await AkanContextAnalyzer.#agentGuideOversize(workspace, sysPaths);
502
+ if (oversize)
503
+ diagnostics.push({ severity: "warning", code: "agent-guide-oversized", path: "AGENTS.md", message: oversize });
504
+ for (const leftover of await AkanContextAnalyzer.#agentGuideLeftovers(workspace))
505
+ diagnostics.push({ severity: "warning", code: "agent-guide-leftover", ...leftover });
438
506
  for (const leftover of await AkanContextAnalyzer.#configLeftovers(workspace, sysPaths))
439
507
  diagnostics.push({ severity: "warning", code: "config-leftover", ...leftover });
440
508
  for (const sys of [...context.apps, ...context.libs]) {
@@ -597,6 +665,12 @@ class AkanContextAnalyzer {
597
665
  lines.push("", "## Apps", ...context.apps.map((app) => `- ${app.name}: ${app.modules.length} module(s)`));
598
666
  lines.push("", "## Libraries", ...context.libs.map((lib) => `- ${lib.name}: ${lib.modules.length} module(s)`));
599
667
  lines.push("", "## Packages", ...context.pkgs.map((pkg) => `- ${pkg.name}${pkg.version ? ` (${pkg.version})` : ""}`));
668
+ for (const app of context.apps) {
669
+ if (app.routeError)
670
+ lines.push("", `## Routes: ${app.name}`, `- Not read: ${app.routeError}`);
671
+ else if (app.routes)
672
+ lines.push("", `## Routes: ${app.name}`, ...AkanContextAnalyzer.#routeLines(app.name, app.routes));
673
+ }
600
674
  const modules = AkanContextAnalyzer.findModules(context, moduleName);
601
675
  lines.push("", "## Modules");
602
676
  for (const module of modules) {
@@ -613,6 +687,33 @@ class AkanContextAnalyzer {
613
687
  `)}
614
688
  `;
615
689
  }
690
+ static routeListLimit = 60;
691
+ static #routeLines(appName, routes) {
692
+ const folderOf = (route) => route.file.split("/").slice(0, 4).join("/");
693
+ const groups = Map.groupBy(routes, folderOf);
694
+ const folded = new Set;
695
+ let listed = routes.length;
696
+ for (const [folder, members] of [...groups].sort((a, b) => b[1].length - a[1].length)) {
697
+ if (listed <= AkanContextAnalyzer.routeListLimit)
698
+ break;
699
+ folded.add(folder);
700
+ listed -= members.length;
701
+ }
702
+ const lines = [`Paths omit the \`/:lang\` prefix; \`akan preview ${appName} <path>\` opens one.`];
703
+ for (const route of routes) {
704
+ if (folded.has(folderOf(route)))
705
+ continue;
706
+ const search = route.search.length ? ` ?${route.search.join("&")}` : "";
707
+ const marks = `${route.guarded ? " (guarded)" : ""}${route.devOnly ? " (dev only)" : ""}`;
708
+ lines.push(`- ${route.path}${search}${marks} \u2014 ${route.file}`);
709
+ }
710
+ for (const folder of folded) {
711
+ const members = groups.get(folder) ?? [];
712
+ const examples = members.slice(0, 3).map((route) => route.path);
713
+ lines.push(`- ${folder}/: ${members.length} routes folded (${examples.join(", ")}, \u2026); \`--format json\` lists every route`);
714
+ }
715
+ return lines;
716
+ }
616
717
  }
617
718
 
618
719
  export { buildResourceList, codexMcpConfigPath, akanMcpInstallTargets, akanMcpInstallConfigPaths, createAkanMcpServer, createAkanCodexMcpServerBlock, upsertCodexMcpServerBlock, renderDoctorText, AkanContextAnalyzer };
@@ -2,6 +2,9 @@
2
2
  import {
3
3
  ConfigLock
4
4
  } from "./index-bqbf654f.js";
5
+ import {
6
+ akanCodePaths2
7
+ } from "./index-jje9qzyq.js";
5
8
 
6
9
  // pkgs/@akanjs/devkit/codeAgent/agent/AkanCodeCompaction.ts
7
10
  class AkanCodeCompaction2 {
@@ -41,31 +44,6 @@ class AkanCodeCompaction2 {
41
44
  }
42
45
  }
43
46
 
44
- // pkgs/@akanjs/devkit/codeAgent/agent/akanCodePaths.ts
45
- import { existsSync } from "fs";
46
- import { homedir } from "os";
47
- import path from "path";
48
- var builtinSkillsDir = () => {
49
- const candidates = [path.join(import.meta.dir, "skills"), path.join(import.meta.dir, "..", "skills")];
50
- return candidates.find((candidate) => existsSync(candidate));
51
- };
52
- var globalDir = () => process.env.AKAN_CODE_HOME ?? path.join(homedir(), ".akan", "code");
53
- var akanCodePaths2 = {
54
- workspaceDir: (workspaceRoot) => path.join(workspaceRoot, ".akan", "code"),
55
- sessionsDir: (workspaceRoot) => path.join(workspaceRoot, ".akan", "code", "sessions"),
56
- extensionsDir: (workspaceRoot) => path.join(workspaceRoot, ".akan", "code", "extensions"),
57
- skillsDir: (workspaceRoot) => path.join(workspaceRoot, ".akan", "code", "skills"),
58
- mailDir: (workspaceRoot) => path.join(workspaceRoot, ".akan", "code", "mail"),
59
- builtinSkillsDir,
60
- mcpFile: (workspaceRoot) => path.join(workspaceRoot, ".akan", "code", "mcp.json"),
61
- globalMcpFile: () => path.join(globalDir(), "mcp.json"),
62
- globalSkillsDir: () => path.join(globalDir(), "skills"),
63
- globalDir,
64
- authFile: () => path.join(globalDir(), "auth.json"),
65
- mcpAuthFile: () => path.join(globalDir(), "mcpAuth.json"),
66
- modelsFile: () => path.join(globalDir(), "models.json")
67
- };
68
-
69
47
  // pkgs/@akanjs/devkit/codeAgent/agent/SubagentPool.ts
70
48
  import { codeAgentReadOnlyBuiltins } from "akanjs/common";
71
49
  import { Type } from "typebox";
@@ -179,13 +157,15 @@ class SubagentPool2 {
179
157
  }
180
158
  }
181
159
  async#run(id, kind, prompt, signal) {
182
- const { CodeAgent } = await import("./CodeAgent-3sy7kjgj.js");
160
+ const { CodeAgent } = await import("./CodeAgent-35wnb7w5.js");
183
161
  const budget = this.#options.parent.tools.subagent;
184
162
  const child = SubagentPool2.childOf(this.#options.parent, kind);
163
+ const model = this.#options.model?.();
185
164
  const agent = await CodeAgent.create({
186
165
  workspace: this.#options.workspace,
187
166
  cwd: this.#options.cwd,
188
167
  profile: child,
168
+ ...model ? { model } : {},
189
169
  apps: [],
190
170
  depth: this.#options.depth + 1,
191
171
  subagentSpend: this.#spend
@@ -230,8 +210,8 @@ class SubagentPool2 {
230
210
  }
231
211
 
232
212
  // pkgs/@akanjs/devkit/codeAgent/tools/McpServerConfig.ts
233
- import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "fs";
234
- import path2 from "path";
213
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
214
+ import path from "path";
235
215
  class McpServerConfig {
236
216
  static file(workspaceRoot, scope = "workspace") {
237
217
  return scope === "global" ? akanCodePaths2.globalMcpFile() : akanCodePaths2.mcpFile(workspaceRoot);
@@ -259,7 +239,7 @@ class McpServerConfig {
259
239
  const entry = /^https?:\/\//.test(head) ? { url: head } : { command: head, args: rest };
260
240
  const { file, key, map } = McpServerConfig.#parse(workspaceRoot, scope);
261
241
  const next = { ...map, [name]: entry };
262
- mkdirSync(path2.dirname(file), { recursive: true });
242
+ mkdirSync(path.dirname(file), { recursive: true });
263
243
  writeFileSync(file, `${JSON.stringify({ [key]: next }, null, 2)}
264
244
  `);
265
245
  return McpServerConfig.#refOf(name, entry);
@@ -295,7 +275,7 @@ class McpServerConfig {
295
275
  }
296
276
  static problem(workspaceRoot) {
297
277
  for (const { file } of McpServerConfig.files(workspaceRoot)) {
298
- if (!existsSync2(file))
278
+ if (!existsSync(file))
299
279
  continue;
300
280
  try {
301
281
  JSON.parse(readFileSync(file, "utf8"));
@@ -308,7 +288,7 @@ class McpServerConfig {
308
288
  static #parse(workspaceRoot, scope) {
309
289
  const file = McpServerConfig.file(workspaceRoot, scope);
310
290
  const empty = { file, key: "mcpServers", map: {} };
311
- if (!existsSync2(file))
291
+ if (!existsSync(file))
312
292
  return empty;
313
293
  try {
314
294
  const parsed = JSON.parse(readFileSync(file, "utf8"));
@@ -546,8 +526,8 @@ class McpOAuthLoopback {
546
526
  }
547
527
 
548
528
  // pkgs/@akanjs/devkit/codeAgent/tools/McpTokenStore.ts
549
- import { chmodSync, existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync, writeFileSync as writeFileSync2 } from "fs";
550
- import path3 from "path";
529
+ import { chmodSync, existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, renameSync, writeFileSync as writeFileSync2 } from "fs";
530
+ import path2 from "path";
551
531
  class McpTokenStore {
552
532
  static file() {
553
533
  return akanCodePaths2.mcpAuthFile();
@@ -578,7 +558,7 @@ class McpTokenStore {
578
558
  static skewMs = 60000;
579
559
  static #all() {
580
560
  const file = McpTokenStore.file();
581
- if (!existsSync3(file))
561
+ if (!existsSync2(file))
582
562
  return {};
583
563
  try {
584
564
  const parsed = JSON.parse(readFileSync2(file, "utf8"));
@@ -589,7 +569,7 @@ class McpTokenStore {
589
569
  }
590
570
  static #save(servers) {
591
571
  const file = McpTokenStore.file();
592
- mkdirSync2(path3.dirname(file), { recursive: true, mode: 448 });
572
+ mkdirSync2(path2.dirname(file), { recursive: true, mode: 448 });
593
573
  const temp = `${file}.${process.pid}.tmp`;
594
574
  writeFileSync2(temp, `${JSON.stringify({ servers }, null, 2)}
595
575
  `, { mode: 384 });
@@ -735,4 +715,4 @@ ${stored.refreshToken}`;
735
715
  }
736
716
  }
737
717
 
738
- export { SubagentPool2, akanCodePaths2, McpServerConfig, McpTokenStore, McpSignIn, AkanCodeCompaction2 };
718
+ export { SubagentPool2, McpServerConfig, McpTokenStore, McpSignIn, AkanCodeCompaction2 };
@@ -4,27 +4,27 @@ import {
4
4
  CloudApi,
5
5
  CloudUpdates,
6
6
  PipelineSecrets
7
- } from "./index-myc22sgv.js";
7
+ } from "./index-qkkdhjm6.js";
8
8
  import {
9
9
  PkgExecutor
10
- } from "./index-wcej7g4z.js";
10
+ } from "./index-8scw1pjk.js";
11
11
  import {
12
12
  UpdatePackFolder,
13
13
  NativePublicEnv,
14
14
  NativeApp
15
- } from "./index-5max10jx.js";
15
+ } from "./index-3yz30c07.js";
16
16
  import {
17
17
  script
18
- } from "./index-3wypz6xj.js";
18
+ } from "./index-eja64h28.js";
19
19
  import {
20
20
  ApplicationScript
21
- } from "./index-pa3c2mb8.js";
21
+ } from "./index-4pdts00b.js";
22
22
  import {
23
23
  PackageScript
24
- } from "./index-42j4a8zq.js";
24
+ } from "./index-8559hsz4.js";
25
25
  import {
26
26
  CloudRunner
27
- } from "./index-0p37cz91.js";
27
+ } from "./index-payhwt51.js";
28
28
 
29
29
  // pkgs/@akanjs/cli/cloud/cloud.script.ts
30
30
  import { Logger } from "akanjs/common";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  DesktopBin
4
- } from "./index-5max10jx.js";
4
+ } from "./index-3yz30c07.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";
@@ -166,6 +166,20 @@ ${summary.join(", ")} found${output.join(`
166
166
  throw new Error(TypeChecker2.formatDiagnosticMessages(parsedConfig.errors));
167
167
  return parsedConfig;
168
168
  }
169
+ static toRecords(diagnostics, root) {
170
+ return diagnostics.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error || diagnostic.category === ts.DiagnosticCategory.Warning).map((diagnostic) => {
171
+ const position = diagnostic.file && diagnostic.start !== undefined ? diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : null;
172
+ return {
173
+ file: diagnostic.file ? path.relative(root, diagnostic.file.fileName).split(path.sep).join("/") : null,
174
+ line: position ? position.line + 1 : 0,
175
+ col: position ? position.character + 1 : 0,
176
+ code: `TS${diagnostic.code}`,
177
+ severity: diagnostic.category === ts.DiagnosticCategory.Error ? "error" : "warning",
178
+ message: ts.flattenDiagnosticMessageText(diagnostic.messageText, `
179
+ `)
180
+ };
181
+ });
182
+ }
169
183
  static formatDiagnosticMessages(diagnostics) {
170
184
  return ts.formatDiagnosticsWithColorAndContext(diagnostics, {
171
185
  getCanonicalFileName: (fileName) => fileName,
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-3wypz6xj.js";
5
+ } from "./index-eja64h28.js";
6
6
  import {
7
7
  LibSource,
8
8
  formatLibStatuses,
9
9
  CommandExecutionError,
10
10
  LibExecutor
11
- } from "./index-wcej7g4z.js";
11
+ } from "./index-8scw1pjk.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/library/library.script.ts
14
14
  import { Logger } from "akanjs/common";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  AsyncDefaultExportDetector,
4
4
  resolveSsrPageEntriesForApp
5
- } from "./index-wcej7g4z.js";
5
+ } from "./index-8scw1pjk.js";
6
6
  import {
7
7
  FileSys2
8
8
  } from "./index-52w0fvh8.js";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  resolveSsrPageEntriesForApp
4
- } from "./index-wcej7g4z.js";
4
+ } from "./index-8scw1pjk.js";
5
5
  import {
6
6
  computeRouteSeedIndex,
7
7
  saveRouteSeedIndex,
@@ -9,17 +9,17 @@ import {
9
9
  ClientEntriesBundler,
10
10
  VENDOR_SPECIFIERS,
11
11
  RouteClientBuilder
12
- } from "./index-espk51ah.js";
12
+ } from "./index-dd44g6vz.js";
13
13
  import {
14
14
  SOURCE_EXTS
15
- } from "./index-5nd1wtkv.js";
15
+ } from "./index-p6x5b7hr.js";
16
16
  import {
17
17
  CsrEntryFiles,
18
18
  BarrelAnalyzer,
19
19
  createTsconfigPackageResolver,
20
20
  rewriteBarrelImports,
21
21
  PagesBundleBuilder
22
- } from "./index-0fz95kxe.js";
22
+ } from "./index-xqgwjz7a.js";
23
23
  import {
24
24
  CssBlockParser
25
25
  } from "./index-62md4dwy.js";