@akanjs/cli 3.1.1 → 3.1.2-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 (113) hide show
  1. package/.build-stamp +1 -1
  2. package/CodeAgent-dyc45f5w.js +11 -0
  3. package/{CodeAgentRpcHost-9g27hmer.js → CodeAgentRpcHost-6dzfkvsc.js} +1 -1
  4. package/CodeAgentRpcListener-tcwrdvst.js +182 -0
  5. package/{CodeTui-h6yz2kvq.js → CodeTui-q55b2zrn.js} +25 -8
  6. package/TunnelShare-hdq9h1hr.js +14 -0
  7. package/{agent.command-3r4jsck8.js → agent.command-20zaqe60.js} +18 -15
  8. package/akanCode.js +8 -7
  9. package/{application.command-g7xv6ad0.js → application.command-nd0fshsk.js} +11 -11
  10. package/{applicationBuildRunner-qvjnhr9j.js → applicationBuildRunner-s13x3zqb.js} +10 -9
  11. package/buildBatch.proc.js +6 -6
  12. package/{cloud.command-6ebygmhw.js → cloud.command-8kbddsz9.js} +25 -18
  13. package/cloud.script-hgvvajm3.js +27 -0
  14. package/code.command-625bg8s8.js +345 -0
  15. package/{context.command-svdh6b2w.js → context.command-p6haqjay.js} +19 -18
  16. package/context.runner-rsnqnk9j.js +27 -0
  17. package/{dependencyScanner-3afj2vt1.js → dependencyScanner-78sq8m4q.js} +2 -2
  18. package/{fileSys-wzzrntkw.js → fileSys-zpvt5gtf.js} +1 -1
  19. package/{guideline.command-qwp3tnjx.js → guideline.command-195g0h9a.js} +4 -4
  20. package/guidelines/agentRule/agentRule.instruction.md +22 -8
  21. package/guidelines/conventions/rules/auth.md +5 -4
  22. package/guidelines/conventions/rules/config.md +5 -1
  23. package/guidelines/conventions/rules/gates.md +2 -1
  24. package/guidelines/conventions/rules/module.md +1 -1
  25. package/guidelines/conventions/rules/server.md +8 -3
  26. package/guidelines/conventions/rules/ssr.md +2 -2
  27. package/guidelines/conventions/rules/tsx.md +2 -1
  28. package/guidelines/pageRule/pageRule.instruction.md +4 -4
  29. package/guidelines/runtimeRule/runtimeRule.instruction.md +35 -25
  30. package/guidelines/ssrRule/ssrRule.instruction.md +11 -10
  31. package/guidelines/transportRule/transportRule.instruction.md +5 -4
  32. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +1 -1
  33. package/incrementalBuilder.proc.js +4 -4
  34. package/{index-w4k2ragk.js → index-00a7j05x.js} +7 -7
  35. package/{index-w7q6h97v.js → index-0j1t1h2b.js} +3 -1
  36. package/{index-payhwt51.js → index-1h2jc0x3.js} +141 -67
  37. package/{index-vxmy1p4f.js → index-1qsd8ft1.js} +63 -123
  38. package/{index-s6da8ta9.js → index-2mwjshz5.js} +158 -51
  39. package/index-2nxk8wgs.js +266 -0
  40. package/{index-k5jbcxyh.js → index-2phm56a1.js} +49 -8
  41. package/{index-jje9qzyq.js → index-35j83zkd.js} +37 -3
  42. package/{index-m5n3ka0p.js → index-4am4dvmf.js} +13 -2
  43. package/index-75y7bcz4.js +28 -0
  44. package/{index-b8c289dx.js → index-7apsdr5g.js} +55 -12
  45. package/{index-8559hsz4.js → index-84h43kg6.js} +6 -5
  46. package/{index-eja64h28.js → index-9zy8479y.js} +5 -3
  47. package/{index-96wzdhfh.js → index-a1vb3x7t.js} +209 -36
  48. package/{index-52w0fvh8.js → index-bns3wcpc.js} +15 -0
  49. package/{index-am36s3jh.js → index-cjmjvg4r.js} +157 -117
  50. package/{index-1p0qbq3m.js → index-defp4gmb.js} +1 -1
  51. package/{index-4pdts00b.js → index-ewbmfarf.js} +10 -8
  52. package/{index-9rvcs76p.js → index-fhw7yq2d.js} +10 -10
  53. package/{index-8scw1pjk.js → index-g500c5j9.js} +178 -82
  54. package/{index-qxzrp5xt.js → index-g841cap9.js} +4 -4
  55. package/{index-qkkdhjm6.js → index-gr9thy79.js} +5 -5
  56. package/{index-4pf8g7ff.js → index-h7hehkw6.js} +3 -0
  57. package/{index-4mj92tsh.js → index-hm0tn7qv.js} +73 -68
  58. package/{index-r2wedvqn.js → index-j6eeh5d7.js} +1 -1
  59. package/{index-tgt2fnd6.js → index-j7hwy56s.js} +3 -3
  60. package/{index-rnphv731.js → index-jc2zbwra.js} +2 -2
  61. package/{index-z4b84y6k.js → index-khk05tsf.js} +1 -1
  62. package/{index-tvehn2sp.js → index-qd7xn2bk.js} +1 -1
  63. package/{index-266dewjs.js → index-qw6814m4.js} +53 -15
  64. package/{index-zcf6k8a5.js → index-raz588b3.js} +47 -12
  65. package/{index-at7bz0xq.js → index-s4nvxpzm.js} +2 -0
  66. package/{index-3yz30c07.js → index-sp0qsr7a.js} +114 -12
  67. package/{index-1shvxzt0.js → index-sveq36gh.js} +39 -42
  68. package/{index-r2w2eh93.js → index-t1t9wq9a.js} +4 -4
  69. package/index-t78230d7.js +191 -0
  70. package/{index-r0k3ham2.js → index-tgqameyb.js} +4 -4
  71. package/{index-dd44g6vz.js → index-tp56652m.js} +5 -5
  72. package/index-w15mg3km.js +389 -0
  73. package/{index-xq543a5y.js → index-y4kcmbt2.js} +2 -2
  74. package/index-yf9wc28h.js +52 -0
  75. package/{index-xqgwjz7a.js → index-zbrwnmf1.js} +9 -7
  76. package/{index-xxfy1jp2.js → index-zttm13c3.js} +4 -4
  77. package/index.js +24 -24
  78. package/{library.command-2853y6mk.js → library.command-63hgt9te.js} +4 -4
  79. package/{localRegistry.command-76ds31p4.js → localRegistry.command-g3f8k25t.js} +43 -23
  80. package/{module.command-yfnb0abs.js → module.command-r4sa2khp.js} +7 -6
  81. package/{package.command-d9s86hp9.js → package.command-96eheyvd.js} +5 -5
  82. package/package.json +2 -2
  83. package/{page.command-6a8a8rd1.js → page.command-gs6d841d.js} +4 -4
  84. package/{pipeline.command-rt3rwd2z.js → pipeline.command-wdfvdbfj.js} +3 -3
  85. package/{primitive.command-emcebgrq.js → primitive.command-dfsv4mpe.js} +8 -7
  86. package/{projectTypecheck-51m7eh1f.js → projectTypecheck-kqj1t6hb.js} +1 -1
  87. package/{prompter-hgcta8pb.js → prompter-qrwx1p17.js} +2 -2
  88. package/{quality.command-xtrk0n3x.js → quality.command-webzxee2.js} +6 -4
  89. package/{repair.command-51szxnxx.js → repair.command-3r3j1xre.js} +7 -6
  90. package/{scalar.command-8qv27t82.js → scalar.command-e8y47j6d.js} +6 -5
  91. package/skills/akan-agent/SKILL.md +8 -1
  92. package/skills/akan-code/SKILL.md +37 -11
  93. package/skills/akan-debug/SKILL.md +2 -1
  94. package/skills/akan-err/SKILL.md +2 -1
  95. package/skills/akan-query/SKILL.md +3 -2
  96. package/skills/akan-runtime/SKILL.md +3 -0
  97. package/{subspace.command-pn56pnh8.js → subspace.command-a1sf9n5a.js} +12 -10
  98. package/templates/appSample/lib/task/task.signal.ts +14 -9
  99. package/templates/appSample/srvkit/guards.ts +11 -0
  100. package/templates/service/__model__.dictionary.ts +3 -5
  101. package/templates/workspaceRoot/.gitignore.template +1 -0
  102. package/{tunnel.command-q2h0j2en.js → tunnel.command-dcb0wg93.js} +25 -13
  103. package/{verify.command-z1dsbmrt.js → verify.command-yyepccbh.js} +13 -11
  104. package/{workflow.command-r3y67jeq.js → workflow.command-z5pg9ay0.js} +12 -11
  105. package/{workspace.command-t2f0xsrw.js → workspace.command-d7x5jttw.js} +74 -47
  106. package/CodeAgent-35wnb7w5.js +0 -9
  107. package/CodeAgentRpcListener-7p7z5dd7.js +0 -97
  108. package/TunnelShare-xyjpa7gx.js +0 -14
  109. package/cloud.script-0s1jybd5.js +0 -26
  110. package/code.command-mpkm2emr.js +0 -167
  111. package/context.runner-ch0z3a8g.js +0 -26
  112. package/index-c6eggbee.js +0 -123
  113. package/index-ksfgqq1x.js +0 -49
@@ -1,16 +1,16 @@
1
1
  // @bun
2
2
  import {
3
3
  jsonText
4
- } from "./index-4mj92tsh.js";
4
+ } from "./index-hm0tn7qv.js";
5
5
  import {
6
6
  akanMcpInstallTargets
7
- } from "./index-tgt2fnd6.js";
7
+ } from "./index-j7hwy56s.js";
8
8
  import {
9
9
  script
10
- } from "./index-eja64h28.js";
10
+ } from "./index-9zy8479y.js";
11
11
  import {
12
12
  ContextRunner2
13
- } from "./index-266dewjs.js";
13
+ } from "./index-qw6814m4.js";
14
14
 
15
15
  // pkgs/@akanjs/cli/context/context.script.ts
16
16
  import { Logger } from "akanjs/common";
@@ -1,29 +1,29 @@
1
1
  // @bun
2
2
  import {
3
3
  FileSys2
4
- } from "./index-52w0fvh8.js";
4
+ } from "./index-bns3wcpc.js";
5
5
  import {
6
6
  SOURCE_EXTS,
7
7
  WatchRootResolver
8
8
  } from "./index-p6x5b7hr.js";
9
9
  import {
10
- bundleDefine,
11
- CsrEntryFiles,
12
10
  loaderFor,
13
11
  BarrelAnalyzer,
14
12
  createBarrelImportsPlugin,
15
13
  createTsconfigPackageResolver,
16
14
  rewriteBarrelImports,
15
+ bundleDefine,
16
+ CsrEntryFiles,
17
17
  toClientReferencePath,
18
18
  scanUseClientExports,
19
19
  CsrDevPaths,
20
20
  PagesEntrySourceGenerator,
21
21
  PagesBundleBuilder
22
- } from "./index-xqgwjz7a.js";
22
+ } from "./index-zbrwnmf1.js";
23
23
  import {
24
24
  AsyncDefaultExportDetector,
25
25
  resolveSsrPageEntriesForApp
26
- } from "./index-8scw1pjk.js";
26
+ } from "./index-g500c5j9.js";
27
27
 
28
28
  // pkgs/@akanjs/devkit/frontendBuild/autoImportSync.ts
29
29
  import { readdir, readFile, stat } from "fs/promises";
@@ -0,0 +1,389 @@
1
+ // @bun
2
+ import {
3
+ akanCodePaths2
4
+ } from "./index-35j83zkd.js";
5
+
6
+ // pkgs/@akanjs/devkit/codeAgent/agent/WorkspaceTrust.ts
7
+ import { createHash } from "crypto";
8
+ import {
9
+ chmodSync,
10
+ existsSync as existsSync2,
11
+ lstatSync,
12
+ readdirSync,
13
+ readFileSync as readFileSync2,
14
+ realpathSync,
15
+ renameSync,
16
+ statSync,
17
+ writeFileSync as writeFileSync2
18
+ } from "fs";
19
+ import path2 from "path";
20
+
21
+ // pkgs/@akanjs/devkit/codeAgent/tools/McpServerConfig.ts
22
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
23
+ import path from "path";
24
+ class McpServerConfig {
25
+ static file(workspaceRoot, scope = "workspace") {
26
+ return scope === "global" ? akanCodePaths2.globalMcpFile() : akanCodePaths2.mcpFile(workspaceRoot);
27
+ }
28
+ static files(workspaceRoot) {
29
+ return [
30
+ { scope: "global", file: McpServerConfig.file(workspaceRoot, "global") },
31
+ { scope: "workspace", file: McpServerConfig.file(workspaceRoot, "workspace") }
32
+ ];
33
+ }
34
+ static read(workspaceRoot, scopes) {
35
+ return McpServerConfig.declared(workspaceRoot, scopes).filter((entry) => !entry.disabled).map((entry) => entry.ref);
36
+ }
37
+ static declared(workspaceRoot, scopes) {
38
+ const byName = new Map;
39
+ for (const { scope } of McpServerConfig.files(workspaceRoot).filter((file) => !scopes || scopes.includes(file.scope)))
40
+ for (const [name, entry] of Object.entries(McpServerConfig.#parse(workspaceRoot, scope).map))
41
+ byName.set(name, { ref: McpServerConfig.#refOf(name, entry), disabled: !!entry.disabled, scope });
42
+ return [...byName.values()];
43
+ }
44
+ static add(workspaceRoot, name, target, scope = "global") {
45
+ const [head, ...rest] = target;
46
+ if (!head)
47
+ throw new Error("Give the server a command to run, or a url to reach.");
48
+ const entry = /^https?:\/\//.test(head) ? { url: head } : { command: head, args: rest };
49
+ const { file, key, map } = McpServerConfig.#parse(workspaceRoot, scope);
50
+ const next = { ...map, [name]: entry };
51
+ mkdirSync(path.dirname(file), { recursive: true });
52
+ writeFileSync(file, `${JSON.stringify({ [key]: next }, null, 2)}
53
+ `);
54
+ return McpServerConfig.#refOf(name, entry);
55
+ }
56
+ static remove(workspaceRoot, name, only) {
57
+ const candidates = McpServerConfig.files(workspaceRoot).filter(({ scope }) => !only || scope === only);
58
+ for (const { scope } of candidates.reverse()) {
59
+ const { file, key, map } = McpServerConfig.#parse(workspaceRoot, scope);
60
+ if (!(name in map))
61
+ continue;
62
+ const next = { ...map };
63
+ delete next[name];
64
+ writeFileSync(file, `${JSON.stringify({ [key]: next }, null, 2)}
65
+ `);
66
+ return scope;
67
+ }
68
+ return false;
69
+ }
70
+ static #refOf(name, entry) {
71
+ return {
72
+ name,
73
+ transport: entry.url ? "http" : "stdio",
74
+ ...entry.command ? { command: entry.command } : {},
75
+ ...entry.args ? { args: entry.args } : {},
76
+ ...entry.url ? { url: entry.url } : {},
77
+ ...entry.env ? { env: entry.env } : {},
78
+ ...entry.headers ? { headers: entry.headers } : {},
79
+ ...entry.oauth ? { oauth: entry.oauth } : {}
80
+ };
81
+ }
82
+ static targetOf(ref) {
83
+ return ref.url ?? [ref.command, ...ref.args ?? []].filter(Boolean).join(" ");
84
+ }
85
+ static problem(workspaceRoot) {
86
+ for (const { file } of McpServerConfig.files(workspaceRoot)) {
87
+ if (!existsSync(file))
88
+ continue;
89
+ try {
90
+ JSON.parse(readFileSync(file, "utf8"));
91
+ } catch (error) {
92
+ return `${file} is not valid JSON \u2014 ${String(error)}`;
93
+ }
94
+ }
95
+ return;
96
+ }
97
+ static #parse(workspaceRoot, scope) {
98
+ const file = McpServerConfig.file(workspaceRoot, scope);
99
+ const empty = { file, key: "mcpServers", map: {} };
100
+ if (!existsSync(file))
101
+ return empty;
102
+ try {
103
+ const parsed = JSON.parse(readFileSync(file, "utf8"));
104
+ if (parsed.servers && !parsed.mcpServers)
105
+ return { file, key: "servers", map: parsed.servers };
106
+ return { ...empty, map: parsed.mcpServers ?? {} };
107
+ } catch {
108
+ return empty;
109
+ }
110
+ }
111
+ }
112
+
113
+ // pkgs/@akanjs/devkit/codeAgent/agent/WorkspaceTrust.ts
114
+ var maxExtensionFiles = 1e4;
115
+ var maxExtensionBytes = 64 * 1024 * 1024;
116
+
117
+ class WorkspaceTrust {
118
+ static #granted = new Map;
119
+ static items(workspaceRoot, kinds = ["mcp", "extensions"]) {
120
+ return kinds.map((kind) => WorkspaceTrust.#itemOf(workspaceRoot, kind)).filter((item) => !!item);
121
+ }
122
+ static pending(workspaceRoot, kinds) {
123
+ return WorkspaceTrust.items(workspaceRoot, kinds).filter((item) => !WorkspaceTrust.#approved(workspaceRoot, item));
124
+ }
125
+ static isTrusted(workspaceRoot, kind) {
126
+ const item = WorkspaceTrust.#itemOf(workspaceRoot, kind);
127
+ return !item || WorkspaceTrust.#approved(workspaceRoot, item);
128
+ }
129
+ static approve(workspaceRoot, items, remember) {
130
+ const key = WorkspaceTrust.#keyOf(workspaceRoot);
131
+ for (const item of items)
132
+ WorkspaceTrust.#granted.set(`${key}
133
+ ${item.kind}`, item.hash);
134
+ const checked = items.filter((item) => item.hash);
135
+ if (!remember || !checked.length)
136
+ return;
137
+ const all = WorkspaceTrust.#read();
138
+ const record = { ...all[key] };
139
+ for (const item of checked)
140
+ record[item.kind] = item.hash;
141
+ WorkspaceTrust.#write({ ...all, [key]: record });
142
+ }
143
+ static carry(workspaceRoot, kind, edit) {
144
+ const before = WorkspaceTrust.#itemOf(workspaceRoot, kind);
145
+ const trusted = !before || WorkspaceTrust.#approved(workspaceRoot, before);
146
+ const remembered = !before || WorkspaceTrust.#read()[WorkspaceTrust.#keyOf(workspaceRoot)]?.[kind] === before.hash;
147
+ const result = edit();
148
+ const after = WorkspaceTrust.#itemOf(workspaceRoot, kind);
149
+ if (trusted && after)
150
+ WorkspaceTrust.approve(workspaceRoot, [after], remembered);
151
+ return result;
152
+ }
153
+ static #approved(workspaceRoot, item) {
154
+ const key = WorkspaceTrust.#keyOf(workspaceRoot);
155
+ return WorkspaceTrust.#granted.get(`${key}
156
+ ${item.kind}`) === item.hash || !!item.hash && WorkspaceTrust.#read()[key]?.[item.kind] === item.hash;
157
+ }
158
+ static #itemOf(workspaceRoot, kind) {
159
+ return kind === "mcp" ? WorkspaceTrust.#mcp(workspaceRoot) : WorkspaceTrust.#extensions(workspaceRoot);
160
+ }
161
+ static #mcp(workspaceRoot) {
162
+ const servers = McpServerConfig.read(workspaceRoot, ["workspace"]).sort((a, b) => a.name.localeCompare(b.name));
163
+ if (!servers.length)
164
+ return;
165
+ return {
166
+ kind: "mcp",
167
+ lines: servers.map((ref) => `${ref.name}: ${McpServerConfig.targetOf(ref)}`),
168
+ hash: WorkspaceTrust.#digest(WorkspaceTrust.#canonical(servers))
169
+ };
170
+ }
171
+ static #extensions(workspaceRoot) {
172
+ const dir = akanCodePaths2.extensionsDir(workspaceRoot);
173
+ let root;
174
+ try {
175
+ root = realpathSync(dir);
176
+ } catch {
177
+ return;
178
+ }
179
+ const walk = { root, files: [], bytes: 0, seen: new Set };
180
+ WorkspaceTrust.#walk(walk, dir, "");
181
+ const lines = walk.files.map((file) => file.name);
182
+ if (walk.unchecked)
183
+ return { kind: "extensions", lines: [walk.unchecked, ...lines], hash: "" };
184
+ if (!walk.files.length)
185
+ return;
186
+ const hash = createHash("sha256");
187
+ for (const file of walk.files)
188
+ hash.update(`${file.name}\x00${WorkspaceTrust.#digest(readFileSync2(file.path))}
189
+ `);
190
+ return { kind: "extensions", lines, hash: hash.digest("hex") };
191
+ }
192
+ static #walk(walk, dir, prefix) {
193
+ let entries;
194
+ try {
195
+ const real = realpathSync(dir);
196
+ if (walk.seen.has(real))
197
+ return;
198
+ walk.seen.add(real);
199
+ entries = readdirSync(dir).filter((entry) => entry !== ".git").sort();
200
+ } catch {
201
+ return;
202
+ }
203
+ for (const entry of entries) {
204
+ if (walk.unchecked)
205
+ return;
206
+ const full = path2.join(dir, entry);
207
+ const name = prefix ? `${prefix}/${entry}` : entry;
208
+ try {
209
+ if (lstatSync(full).isSymbolicLink() && !WorkspaceTrust.#inside(walk.root, realpathSync(full))) {
210
+ walk.unchecked = `${name} links out of the folder: it cannot be checked, so it is asked about at every start`;
211
+ return;
212
+ }
213
+ const stat = statSync(full);
214
+ if (stat.isDirectory())
215
+ WorkspaceTrust.#walk(walk, full, name);
216
+ else if (stat.isFile()) {
217
+ walk.files.push({ name, path: full });
218
+ walk.bytes += stat.size;
219
+ if (walk.files.length > maxExtensionFiles || walk.bytes > maxExtensionBytes)
220
+ walk.unchecked = `more than ${maxExtensionFiles} files or ${maxExtensionBytes >> 20} MiB: too many to check, so asked about at every start`;
221
+ }
222
+ } catch {}
223
+ }
224
+ }
225
+ static #inside(root, real) {
226
+ const relative = path2.relative(root, real);
227
+ return relative !== ".." && !relative.startsWith(`..${path2.sep}`) && !path2.isAbsolute(relative);
228
+ }
229
+ static #keyOf(workspaceRoot) {
230
+ try {
231
+ return realpathSync(workspaceRoot);
232
+ } catch {
233
+ return path2.resolve(workspaceRoot);
234
+ }
235
+ }
236
+ static #digest(content) {
237
+ return createHash("sha256").update(content).digest("hex");
238
+ }
239
+ static #canonical(value) {
240
+ if (Array.isArray(value))
241
+ return `[${value.map((entry) => WorkspaceTrust.#canonical(entry)).join(",")}]`;
242
+ if (value && typeof value === "object")
243
+ return `{${Object.entries(value).filter(([, entry]) => entry !== undefined).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, entry]) => `${JSON.stringify(key)}:${WorkspaceTrust.#canonical(entry)}`).join(",")}}`;
244
+ return JSON.stringify(value);
245
+ }
246
+ static #read() {
247
+ const file = akanCodePaths2.trustFile();
248
+ if (!existsSync2(file))
249
+ return {};
250
+ try {
251
+ const parsed = JSON.parse(readFileSync2(file, "utf8"));
252
+ return parsed.workspaces ?? {};
253
+ } catch {
254
+ return {};
255
+ }
256
+ }
257
+ static #write(workspaces) {
258
+ akanCodePaths2.ensureGlobalDir();
259
+ const file = akanCodePaths2.trustFile();
260
+ const temp = `${file}.${process.pid}.tmp`;
261
+ writeFileSync2(temp, `${JSON.stringify({ workspaces }, null, 2)}
262
+ `, { mode: 384 });
263
+ renameSync(temp, file);
264
+ chmodSync(file, 384);
265
+ }
266
+ }
267
+
268
+ // pkgs/@akanjs/devkit/codeAgent/agent/akanCodeModel.ts
269
+ var akanCodeDefaultModel2 = { provider: "deepseek", id: "deepseek-flash" };
270
+ var catalogueMissesImages = new Set(["deepseek/deepseek-v4-flash"]);
271
+ var correctInputs = (model) => {
272
+ if (!model || model.input.includes("image"))
273
+ return model;
274
+ if (!catalogueMissesImages.has(`${model.provider}/${model.id}`))
275
+ return model;
276
+ return { ...model, input: [...model.input, "image"] };
277
+ };
278
+ var akanCodeModel2 = async (runtime, ref) => {
279
+ if (ref) {
280
+ const requested = runtime.getModel(ref.provider, ref.id);
281
+ if (!requested)
282
+ throw new Error(`Unknown model: ${ref.provider}/${ref.id}`);
283
+ if (!runtime.hasConfiguredAuth(ref.provider))
284
+ throw new Error(`No API key configured for ${ref.provider}. Set ${ref.provider.toUpperCase()}_API_KEY.`);
285
+ return correctInputs(requested);
286
+ }
287
+ const fallback = runtime.getModel(akanCodeDefaultModel2.provider, akanCodeDefaultModel2.id);
288
+ if (fallback && runtime.hasConfiguredAuth(fallback.provider))
289
+ return correctInputs(fallback);
290
+ return correctInputs((await runtime.getAvailable())[0]);
291
+ };
292
+ var akanCodeModelSupportsImages2 = (model) => !!model?.input.includes("image");
293
+ var akanCodeModelWarnings2 = (model, compactionFloor) => {
294
+ if (!model)
295
+ return [];
296
+ if (model.contextWindow >= compactionFloor)
297
+ return [];
298
+ return [
299
+ `${model.provider}/${model.id} declares a ${model.contextWindow}-token context window, below the ${compactionFloor} the compaction policy needs, so every turn will compact immediately. Check the model entry in ~/.akan/code/models.json.`
300
+ ];
301
+ };
302
+
303
+ // pkgs/@akanjs/devkit/codeAgent/agent/CodeAgentStreamPrinter.ts
304
+ import { codeAgentEventLabel } from "akanjs/common";
305
+ import chalk from "chalk";
306
+
307
+ class CodeAgentStreamPrinter2 {
308
+ #options;
309
+ #write;
310
+ #streaming = false;
311
+ constructor(options = {}) {
312
+ this.#options = options;
313
+ this.#write = options.write ?? ((text) => process.stdout.write(text));
314
+ }
315
+ print(event) {
316
+ if (this.#options.json)
317
+ return this.#write(`${JSON.stringify(event)}
318
+ `);
319
+ switch (event.type) {
320
+ case "text_delta":
321
+ this.#streaming = true;
322
+ return this.#write(event.text);
323
+ case "thinking_delta":
324
+ if (!this.#options.thinking)
325
+ return;
326
+ this.#streaming = true;
327
+ return this.#write(chalk.dim(event.text));
328
+ case "tool_start":
329
+ return this.#line(chalk.cyan(`\u2192 ${event.tool.title}`));
330
+ case "tool_end":
331
+ return this.#line(CodeAgentStreamPrinter2.#toolEnd(event));
332
+ case "session":
333
+ return this.#line(chalk.dim(codeAgentEventLabel(event)));
334
+ case "turn_end":
335
+ if (event.stopReason === "truncated")
336
+ return this.#line(chalk.yellow(codeAgentEventLabel(event)));
337
+ return;
338
+ case "message":
339
+ case "tool_progress":
340
+ case "turn_start":
341
+ case "idle":
342
+ case "queue":
343
+ case "context":
344
+ case "subagent":
345
+ return;
346
+ case "question":
347
+ return this.#line(chalk.yellow(`? ${event.question.prompt}`));
348
+ case "approval":
349
+ return this.#line(chalk.yellow(`approve? ${event.request.summary}`));
350
+ case "notice":
351
+ return this.#line(CodeAgentStreamPrinter2.#notice(event.level, event.message));
352
+ case "error":
353
+ return this.#line(chalk.red(`error: ${event.message}`));
354
+ default:
355
+ return this.#line(chalk.dim(codeAgentEventLabel(event)));
356
+ }
357
+ }
358
+ finish() {
359
+ if (this.#streaming)
360
+ this.#write(`
361
+ `);
362
+ this.#streaming = false;
363
+ }
364
+ #line(text) {
365
+ if (this.#streaming)
366
+ this.#write(`
367
+ `);
368
+ this.#streaming = false;
369
+ this.#write(`${text}
370
+ `);
371
+ }
372
+ static #toolEnd(event) {
373
+ if (event.outcome === "ok")
374
+ return chalk.green(`\u2713 ${event.tool.title}`);
375
+ if (event.outcome === "blocked")
376
+ return chalk.yellow(`\u29B8 ${event.tool.title} \u2014 ${event.output}`);
377
+ return chalk.red(`\u2717 ${event.tool.title} \u2014 ${event.output.split(`
378
+ `)[0] ?? ""}`);
379
+ }
380
+ static #notice(level, message) {
381
+ if (level === "error")
382
+ return chalk.red(message);
383
+ if (level === "warning")
384
+ return chalk.yellow(message);
385
+ return chalk.dim(message);
386
+ }
387
+ }
388
+
389
+ export { akanCodeDefaultModel2, akanCodeModel2, akanCodeModelSupportsImages2, akanCodeModelWarnings2, CodeAgentStreamPrinter2, McpServerConfig, WorkspaceTrust };
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-eja64h28.js";
5
+ } from "./index-9zy8479y.js";
6
6
  import {
7
7
  LibSource,
8
8
  formatLibStatuses,
9
9
  CommandExecutionError,
10
10
  LibExecutor
11
- } from "./index-8scw1pjk.js";
11
+ } from "./index-g500c5j9.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/library/library.script.ts
14
14
  import { Logger } from "akanjs/common";
@@ -0,0 +1,52 @@
1
+ // @bun
2
+ // pkgs/@akanjs/devkit/shellOnlyEnv.ts
3
+ import { existsSync, readFileSync } from "fs";
4
+ import path from "path";
5
+ var dotenvFiles = [
6
+ ".env",
7
+ ".env.local",
8
+ ".env.development",
9
+ ".env.development.local",
10
+ ".env.production",
11
+ ".env.production.local",
12
+ ".env.test",
13
+ ".env.test.local"
14
+ ];
15
+ var assignedKey = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*[=:]/;
16
+
17
+ class ShellOnlyEnv {
18
+ #keys;
19
+ #cache;
20
+ constructor(keys) {
21
+ this.#keys = new Set(keys);
22
+ }
23
+ get(key) {
24
+ if (this.#found().has(key))
25
+ return;
26
+ return process.env[key];
27
+ }
28
+ ignored() {
29
+ return [...this.#found()].map(([key, file]) => `${key} is set in ${file}, which the repository controls, so it is ignored. Export it in your shell instead.`);
30
+ }
31
+ #found() {
32
+ const cwd = process.cwd();
33
+ if (this.#cache?.cwd === cwd)
34
+ return this.#cache.found;
35
+ const found = new Map;
36
+ for (const name of dotenvFiles) {
37
+ const file = path.join(cwd, name);
38
+ if (!existsSync(file))
39
+ continue;
40
+ for (const line of readFileSync(file, "utf8").split(`
41
+ `)) {
42
+ const key = line.match(assignedKey)?.[1];
43
+ if (key && this.#keys.has(key) && !found.has(key))
44
+ found.set(key, name);
45
+ }
46
+ }
47
+ this.#cache = { cwd, found };
48
+ return found;
49
+ }
50
+ }
51
+
52
+ export { ShellOnlyEnv };
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  AsyncDefaultExportDetector,
4
4
  resolveSsrPageEntriesForApp
5
- } from "./index-8scw1pjk.js";
5
+ } from "./index-g500c5j9.js";
6
6
  import {
7
7
  FileSys2
8
- } from "./index-52w0fvh8.js";
8
+ } from "./index-bns3wcpc.js";
9
9
 
10
10
  // pkgs/@akanjs/devkit/transforms/barrelAnalyzer.ts
11
11
  import path from "path";
@@ -201,9 +201,8 @@ var defaultResolveRelative = async (fromFile, relSpec) => {
201
201
  // pkgs/@akanjs/devkit/transforms/barrelImportsPlugin.ts
202
202
  import path2 from "path";
203
203
  import ts from "typescript";
204
- var createBarrelImportsPlugin = async (app, { skipPath = defaultSkipPath, pipeAfter, external = [] } = {}) => {
205
- const akanConfig = await app.getConfig();
206
- const barrels = [...new Set(akanConfig.barrelImports)].filter((barrel) => barrel && !external.includes(barrel));
204
+ var createBarrelImportsPlugin = async (app, { skipPath = defaultSkipPath, pipeAfter, external = [], barrels: only } = {}) => {
205
+ const barrels = [...new Set(only ?? (await app.getConfig()).barrelImports)].filter((barrel) => barrel && !external.includes(barrel));
207
206
  const analyzer = new BarrelAnalyzer({
208
207
  resolvePackage: await createTsconfigPackageResolver(app)
209
208
  });
@@ -215,7 +214,10 @@ var createBarrelImportsPlugin = async (app, { skipPath = defaultSkipPath, pipeAf
215
214
  }, async (args) => {
216
215
  const realPath = args.path.replace(/\?v=\d+$/, "");
217
216
  const loader = loaderFor(realPath);
218
- let source = await Bun.file(realPath).text();
217
+ const file = Bun.file(realPath);
218
+ if (!await file.exists())
219
+ return;
220
+ let source = await file.text();
219
221
  if (skipPath(realPath))
220
222
  return { contents: source, loader };
221
223
  if (!MACRO_ATTR_RE.test(source) && barrels.length > 0) {
@@ -1170,4 +1172,4 @@ class PagesBundleBuilder {
1170
1172
  }
1171
1173
  }
1172
1174
 
1173
- export { bundleDefine, CsrEntryFiles, loaderFor, BarrelAnalyzer, createBarrelImportsPlugin, createTsconfigPackageResolver, rewriteBarrelImports, toClientReferencePath, scanUseClientExports, CsrDevPaths, PagesEntrySourceGenerator, ServerGraphFile, PagesBundleBuilder };
1175
+ export { loaderFor, BarrelAnalyzer, createBarrelImportsPlugin, createTsconfigPackageResolver, rewriteBarrelImports, bundleDefine, CsrEntryFiles, toClientReferencePath, scanUseClientExports, CsrDevPaths, PagesEntrySourceGenerator, ServerGraphFile, PagesBundleBuilder };
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  resolveSsrPageEntriesForApp
4
- } from "./index-8scw1pjk.js";
4
+ } from "./index-g500c5j9.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-dd44g6vz.js";
12
+ } from "./index-tp56652m.js";
13
13
  import {
14
14
  SOURCE_EXTS
15
15
  } from "./index-p6x5b7hr.js";
16
16
  import {
17
- CsrEntryFiles,
18
17
  BarrelAnalyzer,
19
18
  createTsconfigPackageResolver,
20
19
  rewriteBarrelImports,
20
+ CsrEntryFiles,
21
21
  PagesBundleBuilder
22
- } from "./index-xqgwjz7a.js";
22
+ } from "./index-zbrwnmf1.js";
23
23
  import {
24
24
  CssBlockParser
25
25
  } from "./index-62md4dwy.js";
package/index.js CHANGED
@@ -4,9 +4,9 @@ import {
4
4
  getTargetMetas,
5
5
  getTargetCommandNames,
6
6
  runCommands
7
- } from "./index-eja64h28.js";
8
- import"./index-52w0fvh8.js";
9
- import"./index-8scw1pjk.js";
7
+ } from "./index-9zy8479y.js";
8
+ import"./index-bns3wcpc.js";
9
+ import"./index-g500c5j9.js";
10
10
 
11
11
  // pkgs/@akanjs/cli/bunVersionGuard.ts
12
12
  class BunVersionGuard {
@@ -22,27 +22,27 @@ import path from "path";
22
22
 
23
23
  // pkgs/@akanjs/cli/commandModules.ts
24
24
  var commandModules = {
25
- workspace: async () => (await import("./workspace.command-t2f0xsrw.js")).WorkspaceCommand,
26
- agent: async () => (await import("./agent.command-3r4jsck8.js")).AgentCommand,
27
- code: async () => (await import("./code.command-mpkm2emr.js")).CodeCommand,
28
- application: async () => (await import("./application.command-g7xv6ad0.js")).ApplicationCommand,
29
- library: async () => (await import("./library.command-2853y6mk.js")).LibraryCommand,
30
- localRegistry: async () => (await import("./localRegistry.command-76ds31p4.js")).LocalRegistryCommand,
31
- package: async () => (await import("./package.command-d9s86hp9.js")).PackageCommand,
32
- module: async () => (await import("./module.command-yfnb0abs.js")).ModuleCommand,
33
- page: async () => (await import("./page.command-6a8a8rd1.js")).PageCommand,
34
- context: async () => (await import("./context.command-svdh6b2w.js")).ContextCommand,
35
- cloud: async () => (await import("./cloud.command-6ebygmhw.js")).CloudCommand,
36
- subspace: async () => (await import("./subspace.command-pn56pnh8.js")).SubspaceCommand,
37
- guideline: async () => (await import("./guideline.command-qwp3tnjx.js")).GuidelineCommand,
38
- scalar: async () => (await import("./scalar.command-8qv27t82.js")).ScalarCommand,
39
- primitive: async () => (await import("./primitive.command-emcebgrq.js")).PrimitiveCommand,
40
- quality: async () => (await import("./quality.command-xtrk0n3x.js")).QualityCommand,
41
- verify: async () => (await import("./verify.command-z1dsbmrt.js")).VerifyCommand,
42
- repair: async () => (await import("./repair.command-51szxnxx.js")).RepairCommand,
43
- workflow: async () => (await import("./workflow.command-r3y67jeq.js")).WorkflowCommand,
44
- pipeline: async () => (await import("./pipeline.command-rt3rwd2z.js")).PipelineCommand,
45
- tunnel: async () => (await import("./tunnel.command-q2h0j2en.js")).TunnelCommand
25
+ workspace: async () => (await import("./workspace.command-d7x5jttw.js")).WorkspaceCommand,
26
+ agent: async () => (await import("./agent.command-20zaqe60.js")).AgentCommand,
27
+ code: async () => (await import("./code.command-625bg8s8.js")).CodeCommand,
28
+ application: async () => (await import("./application.command-nd0fshsk.js")).ApplicationCommand,
29
+ library: async () => (await import("./library.command-63hgt9te.js")).LibraryCommand,
30
+ localRegistry: async () => (await import("./localRegistry.command-g3f8k25t.js")).LocalRegistryCommand,
31
+ package: async () => (await import("./package.command-96eheyvd.js")).PackageCommand,
32
+ module: async () => (await import("./module.command-r4sa2khp.js")).ModuleCommand,
33
+ page: async () => (await import("./page.command-gs6d841d.js")).PageCommand,
34
+ context: async () => (await import("./context.command-p6haqjay.js")).ContextCommand,
35
+ cloud: async () => (await import("./cloud.command-8kbddsz9.js")).CloudCommand,
36
+ subspace: async () => (await import("./subspace.command-a1sf9n5a.js")).SubspaceCommand,
37
+ guideline: async () => (await import("./guideline.command-195g0h9a.js")).GuidelineCommand,
38
+ scalar: async () => (await import("./scalar.command-e8y47j6d.js")).ScalarCommand,
39
+ primitive: async () => (await import("./primitive.command-dfsv4mpe.js")).PrimitiveCommand,
40
+ quality: async () => (await import("./quality.command-webzxee2.js")).QualityCommand,
41
+ verify: async () => (await import("./verify.command-yyepccbh.js")).VerifyCommand,
42
+ repair: async () => (await import("./repair.command-3r3j1xre.js")).RepairCommand,
43
+ workflow: async () => (await import("./workflow.command-z5pg9ay0.js")).WorkflowCommand,
44
+ pipeline: async () => (await import("./pipeline.command-wdfvdbfj.js")).PipelineCommand,
45
+ tunnel: async () => (await import("./tunnel.command-dcb0wg93.js")).TunnelCommand
46
46
  };
47
47
  var commandModuleIds = Object.keys(commandModules);
48
48
 
@@ -3,12 +3,12 @@ import {
3
3
  Lib,
4
4
  Workspace,
5
5
  command
6
- } from "./index-eja64h28.js";
7
- import"./index-52w0fvh8.js";
8
- import"./index-8scw1pjk.js";
6
+ } from "./index-9zy8479y.js";
7
+ import"./index-bns3wcpc.js";
8
+ import"./index-g500c5j9.js";
9
9
  import {
10
10
  LibraryScript
11
- } from "./index-xq543a5y.js";
11
+ } from "./index-y4kcmbt2.js";
12
12
 
13
13
  // pkgs/@akanjs/cli/library/library.command.ts
14
14
  class LibraryCommand extends command("library", [LibraryScript], ({ public: target }) => ({