@akanjs/cli 3.0.0-beta.3 → 3.0.0-beta.31

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 (194) hide show
  1. package/.build-stamp +1 -1
  2. package/CodeAgent-tbdpdjat.js +9 -0
  3. package/CodeAgentRpcHost-p7h6n2hp.js +7 -0
  4. package/CodeAgentRpcListener-7p7z5dd7.js +97 -0
  5. package/CodeTui-my2x5fah.js +1457 -0
  6. package/README.md +3 -0
  7. package/TunnelShare-cwh9ezsm.js +9 -0
  8. package/{agent.command-d2gfxfck.js → agent.command-vz60x05c.js} +8 -9
  9. package/akanCode.js +102 -0
  10. package/application.command-pxqfjrqm.js +241 -0
  11. package/{applicationBuildRunner-kxwbssgn.js → applicationBuildRunner-shnfyfdy.js} +121 -77
  12. package/buildBatch.proc.js +120 -32
  13. package/cloud.command-9v9tpgps.js +95 -0
  14. package/cloud.script-baqdthnz.js +20 -0
  15. package/code.command-13h14j25.js +154 -0
  16. package/commandManifest.json +1 -1
  17. package/consoleToStderr-h5bryj94.js +7 -0
  18. package/context.command-x1hbasm5.js +48 -0
  19. package/context.runner-kqbjjea1.js +21 -0
  20. package/{dependencyScanner-shs82ynp.js → dependencyScanner-06z2dmrr.js} +2 -2
  21. package/{devTui-40ggmd99.js → devTui-q7k7bakd.js} +122 -40
  22. package/fileSys-wzzrntkw.js +9 -0
  23. package/guideline.command-vfk11hpj.js +42 -0
  24. package/guidelines/agentRule/agentRule.instruction.md +209 -33
  25. package/guidelines/conventions/conventions.instruction.md +144 -41
  26. package/guidelines/fieldRule/fieldRule.instruction.md +1 -0
  27. package/guidelines/mcpRule/mcpRule.instruction.md +7 -5
  28. package/guidelines/queryRule/queryRule.instruction.md +21 -7
  29. package/guidelines/runtimeRule/runtimeRule.instruction.md +271 -6
  30. package/guidelines/ssrRule/ssrRule.instruction.md +4 -2
  31. package/guidelines/transportRule/transportRule.instruction.md +51 -0
  32. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +20 -0
  33. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +66 -3
  34. package/incrementalBuilder.proc.js +564 -109
  35. package/{index-mak3cd28.js → index-1skctzbq.js} +137 -255
  36. package/{index-kcxmv48c.js → index-2ahj896a.js} +45 -79
  37. package/index-2wc41k5w.js +49 -0
  38. package/index-3hx1z96c.js +87 -0
  39. package/{index-hwkygn9s.js → index-48k96p55.js} +325 -36
  40. package/{index-q0y2jq9j.js → index-52w0fvh8.js} +21 -4
  41. package/index-7md2g9vw.js +6 -0
  42. package/index-7yf7rnjg.js +53 -0
  43. package/{index-gyd220p2.js → index-84r80zdx.js} +554 -577
  44. package/{index-zry5nz81.js → index-8psse8dw.js} +51 -30
  45. package/index-947t6zm4.js +1119 -0
  46. package/index-94s080qm.js +266 -0
  47. package/index-9dp031by.js +12 -0
  48. package/index-9s5zga3q.js +4300 -0
  49. package/{index-ws5e0j51.js → index-arnkqb6f.js} +43 -26
  50. package/{index-3d9y066c.js → index-bjwxs904.js} +9 -8
  51. package/index-c6eggbee.js +123 -0
  52. package/{index-4edzf1gr.js → index-cxafpw23.js} +77 -150
  53. package/index-d2242ksy.js +99 -0
  54. package/index-d5yn19ef.js +700 -0
  55. package/{index-92zztqy1.js → index-dy0jx9ay.js} +2 -17
  56. package/{index-2tv3fdx4.js → index-e52z7psd.js} +1212 -1458
  57. package/{index-a64esmtb.js → index-ew8dna9s.js} +523 -1022
  58. package/{index-7737gxcp.js → index-f50dy7yq.js} +107 -241
  59. package/index-f8q701fb.js +1003 -0
  60. package/{index-by5gpp8x.js → index-hj6w4ka1.js} +2 -1
  61. package/{index-j9yhg404.js → index-ksq4t16z.js} +4 -7
  62. package/index-nhhrjvk1.js +187 -0
  63. package/index-p6pbz9n5.js +25 -0
  64. package/index-ptshj7y1.js +2729 -0
  65. package/{index-fz5q3gd7.js → index-q9q7x4zj.js} +10 -17
  66. package/{index-pnqbkf5p.js → index-qk9vv9hm.js} +6 -2
  67. package/{index-600zhnve.js → index-rqxa9r98.js} +75 -203
  68. package/{index-ne2qy0nk.js → index-smbecayj.js} +12 -12
  69. package/{index-ktb5njgy.js → index-vcdxpmsx.js} +49 -99
  70. package/index-wa5jbxj1.js +760 -0
  71. package/index-ymnqrsxm.js +69 -0
  72. package/{index-v0qh106m.js → index-zc90rh75.js} +961 -892
  73. package/{index-259dsnz3.js → index-zvr7wfyg.js} +5 -8
  74. package/{index-h7yw2z9n.js → index-zzvvc845.js} +8 -14
  75. package/index.js +23 -22
  76. package/{library.command-nbsky672.js → library.command-m52jqc0s.js} +4 -5
  77. package/{localRegistry.command-yeq57wjr.js → localRegistry.command-x5vs1z43.js} +23 -42
  78. package/{module.command-29vqzrh8.js → module.command-ty3k6rwd.js} +8 -11
  79. package/{package.command-axv0abmn.js → package.command-hphdh4g4.js} +6 -7
  80. package/package.json +15 -7
  81. package/{page.command-vs9s3zrh.js → page.command-5aq8mzvq.js} +4 -5
  82. package/{primitive.command-cbxmqbtc.js → primitive.command-adwj84kx.js} +9 -22
  83. package/prompter-76k56b37.js +8 -0
  84. package/{quality.command-gmbs7nws.js → quality.command-y10kea2f.js} +205 -377
  85. package/{recipeScanner-fpagtgc1.js → recipeScanner-4b69ybe0.js} +1 -1
  86. package/{repair.command-bqsjptsj.js → repair.command-v7mwqvjh.js} +11 -35
  87. package/{routeSourceValidator-apyqw7wk.js → routeSourceValidator-7ycnfz0e.js} +0 -6
  88. package/{scalar.command-6k1vhe9s.js → scalar.command-pg3gneer.js} +7 -10
  89. package/skills/akan-code/SKILL.md +130 -0
  90. package/skills/akan-debug/SKILL.md +42 -0
  91. package/skills/akan-deps/SKILL.md +50 -0
  92. package/skills/akan-err/SKILL.md +39 -0
  93. package/skills/akan-module/SKILL.md +45 -0
  94. package/skills/akan-scaffold/SKILL.md +76 -0
  95. package/skills/akan-scalar/SKILL.md +52 -0
  96. package/skills/akan-service/SKILL.md +34 -0
  97. package/skills/akan-store/SKILL.md +67 -0
  98. package/skills/akan-ui/SKILL.md +63 -0
  99. package/skills/akan-validate/SKILL.md +44 -0
  100. package/{subspace.command-fwjfcts7.js → subspace.command-ejdmvbq7.js} +138 -67
  101. package/templates/__scalar/__model__/__model__.abstract.md.template +8 -0
  102. package/templates/appSample/lib/__scalar/workHistory/workHistory.abstract.ts +8 -39
  103. package/templates/appSample/lib/_noti/noti.abstract.ts +6 -29
  104. package/templates/appSample/lib/task/task.abstract.ts +12 -32
  105. package/templates/appSample/lib/task/task.signal.spec.ts +15 -18
  106. package/templates/appSample/lib/task/task.signal.test.ts +15 -1
  107. package/templates/appSample/lib/task/task.signal.ts +1 -1
  108. package/templates/appSample/srvkit/{AuthGuard.ts → guards.ts} +7 -4
  109. package/templates/appSample/srvkit/{SessionInternalArg.ts → internalArgs.ts} +6 -4
  110. package/templates/client.ts +7 -30
  111. package/templates/crudPages/[__model__Id]/edit/page.tsx +2 -1
  112. package/templates/crudPages/[__model__Id]/page.tsx +2 -1
  113. package/templates/crudPages/new/page.tsx +2 -1
  114. package/templates/crudPages/page.tsx +2 -1
  115. package/templates/crudSinglePage/page.tsx +2 -1
  116. package/templates/lib/__lib/lib.dictionary.ts +0 -2
  117. package/templates/lib/__lib/lib.document.ts +0 -2
  118. package/templates/lib/sig.ts +8 -30
  119. package/templates/localDev/docker-compose.yaml.template +3 -14
  120. package/templates/module/__model__.signal.ts +12 -4
  121. package/templates/pkgRoot/tsconfig.json.template +2 -7
  122. package/templates/server.ts +1 -3
  123. package/templates/service/__model__.abstract.md.template +8 -0
  124. package/templates/workspaceRoot/.gitignore.template +0 -1
  125. package/templates/workspaceRoot/package.json.template +1 -3
  126. package/tunnel.command-rz9qf230.js +129 -0
  127. package/{typeChecker-3xgrzc2v.js → typeChecker-px49mezc.js} +1 -1
  128. package/typecheck.proc.js +1 -1
  129. package/workflow.command-6r809r2z.js +79 -0
  130. package/{workspace.command-8s050m0h.js → workspace.command-8g3cw7jd.js} +77 -109
  131. package/abstractCompactor-mjh5ppsq.js +0 -101
  132. package/application.command-pj2m7584.js +0 -204
  133. package/applicationReleasePackager-4yasxwv9.js +0 -244
  134. package/capacitorApp-36rbr858.js +0 -12
  135. package/cloud.command-jshwdq22.js +0 -93
  136. package/context.command-ez8a0zyz.js +0 -80
  137. package/devTuiView-c08ccbat.js +0 -9
  138. package/getDirname-dr3jz1xg.js +0 -7
  139. package/guideline.command-xmqwx8zm.js +0 -359
  140. package/guidelines/agentRule/agentRule.generate.json +0 -31
  141. package/guidelines/componentRule/componentRule.generate.json +0 -31
  142. package/guidelines/conventions/conventions.generate.json +0 -25
  143. package/guidelines/cssRule/cssRule.generate.json +0 -31
  144. package/guidelines/docPageRule/docPageRule.generate.json +0 -31
  145. package/guidelines/docPageRule/docPageRule.instruction.md +0 -25
  146. package/guidelines/docSyncRule/docSyncRule.generate.json +0 -31
  147. package/guidelines/docSyncRule/docSyncRule.instruction.md +0 -25
  148. package/guidelines/enumConstant/enumConstant.generate.json +0 -31
  149. package/guidelines/enumConstant/enumConstant.instruction.md +0 -28
  150. package/guidelines/fieldRule/fieldRule.generate.json +0 -31
  151. package/guidelines/framework/framework.generate.json +0 -32
  152. package/guidelines/mcpRule/mcpRule.generate.json +0 -35
  153. package/guidelines/modelConstant/modelConstant.generate.json +0 -32
  154. package/guidelines/modelDictionary/modelDictionary.generate.json +0 -32
  155. package/guidelines/modelDocument/modelDocument.generate.json +0 -31
  156. package/guidelines/modelService/modelService.generate.json +0 -31
  157. package/guidelines/modelSignal/modelSignal.generate.json +0 -31
  158. package/guidelines/modelStore/modelStore.generate.json +0 -31
  159. package/guidelines/modelTemplate/modelTemplate.generate.json +0 -31
  160. package/guidelines/modelUnit/modelUnit.generate.json +0 -31
  161. package/guidelines/modelUtil/modelUtil.generate.json +0 -31
  162. package/guidelines/modelView/modelView.generate.json +0 -31
  163. package/guidelines/modelZone/modelZone.generate.json +0 -31
  164. package/guidelines/moduleCodegen/moduleCodegen.generate.json +0 -31
  165. package/guidelines/moduleCodegen/moduleCodegen.instruction.md +0 -28
  166. package/guidelines/moduleOverview/moduleOverview.generate.json +0 -31
  167. package/guidelines/queryRule/queryRule.generate.json +0 -31
  168. package/guidelines/recipeRule/recipeRule.generate.json +0 -31
  169. package/guidelines/runtimeRule/runtimeRule.generate.json +0 -25
  170. package/guidelines/scalarConstant/scalarConstant.generate.json +0 -32
  171. package/guidelines/scalarDictionary/scalarDictionary.generate.json +0 -32
  172. package/guidelines/scalarModule/scalarModule.generate.json +0 -31
  173. package/guidelines/sharedUiUsage/sharedUiUsage.generate.json +0 -31
  174. package/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +0 -25
  175. package/guidelines/ssrRule/ssrRule.generate.json +0 -31
  176. package/guidelines/transportRule/transportRule.generate.json +0 -31
  177. package/guidelines/utilUiUsage/utilUiUsage.generate.json +0 -31
  178. package/guidelines/utilUiUsage/utilUiUsage.instruction.md +0 -25
  179. package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +0 -24
  180. package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +0 -33
  181. package/index-2hq52jq3.js +0 -465
  182. package/index-47pj3aee.js +0 -76
  183. package/index-6wwzs1bc.js +0 -7
  184. package/index-8pm30m73.js +0 -841
  185. package/index-kn1h7p1x.js +0 -560
  186. package/index-meh558jy.js +0 -65
  187. package/index-rwg2aa4f.js +0 -229
  188. package/index-w8kmx1b6.js +0 -2176
  189. package/index-wt7qrtd4.js +0 -1516
  190. package/templates/__scalar/__model__/__model__.abstract.md +0 -28
  191. package/templates/module/__model__.abstract.md +0 -28
  192. package/templates/service/__model__.abstract.md +0 -28
  193. package/templates/workspaceRoot/patches/react-dom@19.2.7.patch.template +0 -62
  194. package/workflow.command-nwpcdc8p.js +0 -107
@@ -5,33 +5,26 @@ import {
5
5
  writeGeneratedSyncState,
6
6
  createRepairReport,
7
7
  renderRepairReport
8
- } from "./index-gyd220p2.js";
8
+ } from "./index-84r80zdx.js";
9
9
  import {
10
10
  AkanContextAnalyzer
11
- } from "./index-ktb5njgy.js";
11
+ } from "./index-vcdxpmsx.js";
12
12
  import {
13
13
  runner
14
- } from "./index-mak3cd28.js";
14
+ } from "./index-1skctzbq.js";
15
15
 
16
16
  // pkgs/@akanjs/cli/repair/repair.runner.ts
17
- var commandForShell = (command) => command.startsWith("akan ") ? `bun run ${command}` : command;
17
+ var spawnShell = async (workspace, command) => await workspace.spawn("bash", ["-lc", command.startsWith("akan ") ? `bun run ${command}` : command], {
18
+ cwd: workspace.workspaceRoot
19
+ });
18
20
  var defaultExecutor = (workspace) => async (command) => {
21
+ const base = { command: command.command, reason: command.reason };
19
22
  try {
20
- const stdout = await workspace.spawn("bash", ["-lc", commandForShell(command.command)], {
21
- cwd: workspace.workspaceRoot
22
- });
23
- return {
24
- command: command.command,
25
- reason: command.reason,
26
- status: "passed",
27
- exitCode: 0,
28
- stdout
29
- };
23
+ return { ...base, status: "passed", exitCode: 0, stdout: await spawnShell(workspace, command.command) };
30
24
  } catch (error) {
31
25
  const commandError = error;
32
26
  return {
33
- command: command.command,
34
- reason: command.reason,
27
+ ...base,
35
28
  status: "failed",
36
29
  exitCode: commandError.code ?? 1,
37
30
  stdout: commandError.stdout,
@@ -158,4 +151,4 @@ class RepairRunner extends runner("repair") {
158
151
  }
159
152
  }
160
153
 
161
- export { RepairRunner };
154
+ export { spawnShell, RepairRunner };
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-mak3cd28.js";
5
+ } from "./index-1skctzbq.js";
6
6
 
7
7
  // pkgs/@akanjs/cli/page/page.runner.ts
8
8
  class PageRunner extends runner("page") {
@@ -10,7 +10,11 @@ class PageRunner extends runner("page") {
10
10
  await app.applyTemplate({
11
11
  basePath: basePath ?? `page/(${app.name})/(public)/${module.name}`,
12
12
  template: single ? "crudSinglePage" : "crudPages",
13
- dict: { model: module.name, appName: module.sys.name }
13
+ dict: {
14
+ model: module.name,
15
+ appName: module.sys.name,
16
+ clientPath: `@${module.sys.type}s/${module.sys.name}/client`
17
+ }
14
18
  });
15
19
  }
16
20
  }
@@ -1,60 +1,45 @@
1
1
  // @bun
2
2
  import {
3
3
  AppExecutor
4
- } from "./index-2tv3fdx4.js";
4
+ } from "./index-e52z7psd.js";
5
5
  import {
6
6
  jsonText,
7
7
  createWorkflowBaselineSummary,
8
8
  buildAkanModuleContextIndex,
9
- createWorkflowStepRegistry,
10
9
  toolingRolloutGate
11
- } from "./index-gyd220p2.js";
10
+ } from "./index-84r80zdx.js";
12
11
  import {
13
12
  buildResourceList,
14
13
  codexMcpConfigPath,
15
- akanMcpInstallTargets,
16
14
  akanMcpInstallConfigPaths,
17
15
  createAkanMcpServer,
18
16
  createAkanCodexMcpServerBlock,
19
17
  upsertCodexMcpServerBlock,
20
18
  renderDoctorText,
21
19
  AkanContextAnalyzer
22
- } from "./index-ktb5njgy.js";
20
+ } from "./index-vcdxpmsx.js";
23
21
  import {
24
- CommandContainer,
25
- runner,
26
- script
27
- } from "./index-mak3cd28.js";
22
+ runner
23
+ } from "./index-1skctzbq.js";
28
24
  import {
29
- isPlaceholderAppId2
30
- } from "./index-wt7qrtd4.js";
25
+ getMobileTargets,
26
+ appIdsOf,
27
+ NativeApp,
28
+ isPlaceholderAppId
29
+ } from "./index-f8q701fb.js";
31
30
  import {
32
- Prompter
33
- } from "./index-h7yw2z9n.js";
31
+ Prompter2
32
+ } from "./index-zzvvc845.js";
34
33
  import {
35
34
  RepairRunner
36
- } from "./index-fz5q3gd7.js";
35
+ } from "./index-q9q7x4zj.js";
37
36
  import {
38
37
  WorkflowRunner
39
- } from "./index-7737gxcp.js";
40
- import {
41
- ModuleScript
42
- } from "./index-8pm30m73.js";
43
- import {
44
- PrimitiveScript
45
- } from "./index-4edzf1gr.js";
46
- import {
47
- ScalarScript
48
- } from "./index-rwg2aa4f.js";
49
- import {
50
- getMobileTargets
51
- } from "./index-47pj3aee.js";
52
-
53
- // pkgs/@akanjs/cli/context/context.script.ts
54
- import { Logger } from "akanjs/common";
38
+ } from "./index-f50dy7yq.js";
55
39
 
56
40
  // pkgs/@akanjs/devkit/akanMcpContract.ts
57
41
  import path from "path";
42
+ import { isRecord } from "akanjs/common";
58
43
  var emptySchema = { type: "object", properties: {} };
59
44
  var stringProperty = { type: "string" };
60
45
  var booleanProperty = { type: "boolean" };
@@ -138,18 +123,11 @@ var inspectAkanContextInputSchema = {
138
123
  },
139
124
  required: ["question", "draft", "review", "request"]
140
125
  };
141
- var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
142
126
  var slugPart = (value) => typeof value === "string" ? value.trim().replace(/[^a-zA-Z0-9]+/g, "-").replace(/^-+|-+$/g, "").toLowerCase() : "";
143
127
  var optionalString = (args, key) => {
144
128
  const value = args[key];
145
129
  return typeof value === "string" && value ? value : undefined;
146
130
  };
147
- var nestedStringArg = (args, key) => {
148
- const value = args[key];
149
- if (typeof value !== "string" || !value)
150
- throw new Error(`MCP tool argument "${key}" is required.`);
151
- return value;
152
- };
153
131
  var isInspectAkanContextRequestType = (value) => typeof value === "string" && inspectAkanContextRequestTypes.includes(value);
154
132
  var parseJsonOutput = (output) => JSON.parse(output);
155
133
  var workspacePath = (workspace, filePath) => path.isAbsolute(filePath) ? filePath : path.join(workspace.workspaceRoot, filePath);
@@ -204,50 +182,31 @@ var inspectAkanContextPropsArg = (args) => {
204
182
  if (!isInspectAkanContextRequestType(args.request.type)) {
205
183
  throw new Error('MCP tool argument "request.type" must be a supported inspect_akan_context request type.');
206
184
  }
207
- const draft = { reason: nestedStringArg(args.draft, "reason"), type: args.draft.type };
185
+ const base = { question, draft: { reason: stringArg(args.draft, "reason"), type: args.draft.type }, review };
208
186
  const request = args.request;
209
187
  if (request.type === "workspaceOverview")
210
- return { question, draft, review, request: { type: request.type } };
188
+ return { ...base, request: { type: request.type } };
211
189
  if (request.type === "moduleContext")
212
190
  return {
213
- question,
214
- draft,
215
- review,
216
- request: {
217
- type: request.type,
218
- app: nestedStringArg(request, "app"),
219
- module: nestedStringArg(request, "module")
220
- }
191
+ ...base,
192
+ request: { type: request.type, app: stringArg(request, "app"), module: stringArg(request, "module") }
221
193
  };
222
194
  if (request.type === "fieldInsertionContext")
223
195
  return {
224
- question,
225
- draft,
226
- review,
196
+ ...base,
227
197
  request: {
228
198
  type: request.type,
229
- app: nestedStringArg(request, "app"),
230
- module: nestedStringArg(request, "module"),
231
- field: nestedStringArg(request, "field"),
232
- fieldType: nestedStringArg(request, "fieldType")
199
+ app: stringArg(request, "app"),
200
+ module: stringArg(request, "module"),
201
+ field: stringArg(request, "field"),
202
+ fieldType: stringArg(request, "fieldType")
233
203
  }
234
204
  };
235
205
  if (request.type === "workflowDiagnostics")
236
- return {
237
- question,
238
- draft,
239
- review,
240
- request: { type: request.type, runIdOrPlan: nestedStringArg(request, "runIdOrPlan") }
241
- };
206
+ return { ...base, request: { type: request.type, runIdOrPlan: stringArg(request, "runIdOrPlan") } };
242
207
  return {
243
- question,
244
- draft,
245
- review,
246
- request: {
247
- type: "escape",
248
- reason: nestedStringArg(request, "reason"),
249
- nextStep: optionalString(request, "nextStep")
250
- }
208
+ ...base,
209
+ request: { type: "escape", reason: stringArg(request, "reason"), nextStep: optionalString(request, "nextStep") }
251
210
  };
252
211
  };
253
212
  var inspectDiagnostic = (severity, code, message) => ({ severity, code, message });
@@ -471,22 +430,11 @@ var inspectAkanContext = async (workspace, args) => {
471
430
  strict: true,
472
431
  runIdOrPlan: workspacePath(workspace, props.request.runIdOrPlan)
473
432
  });
474
- const baselineSummary = createWorkflowBaselineSummary((doctor.baselineDiagnostics ?? []).map((diagnostic) => ({
475
- severity: diagnostic.severity,
476
- code: diagnostic.code,
477
- message: diagnostic.message,
478
- scope: diagnostic.scope,
479
- context: diagnostic.context
480
- })), { detailsIncluded: false });
481
- diagnostics.push(...(doctor.workflowDiagnostics ?? doctor.diagnostics).map((diagnostic) => ({
482
- severity: diagnostic.severity,
483
- code: diagnostic.code,
484
- message: diagnostic.message,
485
- scope: diagnostic.scope,
486
- context: {
487
- ...diagnostic.context,
488
- ...diagnostic.path ? { paths: [diagnostic.path] } : {}
489
- }
433
+ const toWorkflowDiagnostic = ({ severity, code, message, scope }, context) => ({ severity, code, message, scope, context });
434
+ const baselineSummary = createWorkflowBaselineSummary((doctor.baselineDiagnostics ?? []).map((diagnostic) => toWorkflowDiagnostic(diagnostic, diagnostic.context)), { detailsIncluded: false });
435
+ diagnostics.push(...(doctor.workflowDiagnostics ?? doctor.diagnostics).map((diagnostic) => toWorkflowDiagnostic(diagnostic, {
436
+ ...diagnostic.context,
437
+ ...diagnostic.path ? { paths: [diagnostic.path] } : {}
490
438
  })));
491
439
  return baseResult("workflowDiagnostics", [
492
440
  {
@@ -504,9 +452,10 @@ var inspectAkanContext = async (workspace, args) => {
504
452
  workflowDiagnostics: doctor.workflowDiagnostics?.length ?? 0
505
453
  });
506
454
  }
455
+ const moduleRequest = props.request.type === "moduleContext" || props.request.type === "fieldInsertionContext" ? props.request : null;
507
456
  const context = await AkanContextAnalyzer.analyze(workspace, {
508
- app: props.request.type === "moduleContext" || props.request.type === "fieldInsertionContext" ? props.request.app : null,
509
- module: props.request.type === "moduleContext" || props.request.type === "fieldInsertionContext" ? props.request.module : null,
457
+ app: moduleRequest?.app ?? null,
458
+ module: moduleRequest?.module ?? null,
510
459
  includeAbstractContent: false
511
460
  });
512
461
  if (props.request.type === "workspaceOverview") {
@@ -594,41 +543,22 @@ var inspectAkanContext = async (workspace, args) => {
594
543
  });
595
544
  };
596
545
 
597
- // pkgs/@akanjs/cli/context/context.workflowRegistry.ts
598
- var createCliWorkflowStepRegistry = (workspace) => createWorkflowStepRegistry({
599
- workspace,
600
- createModule: (sys, module) => CommandContainer.get(ModuleScript).createModuleTemplate(sys, module),
601
- createScalar: (sys, scalar) => CommandContainer.get(ScalarScript).createScalar(sys, scalar),
602
- createUi: (input) => CommandContainer.get(PrimitiveScript).createUi(workspace, input),
603
- addField: (input) => CommandContainer.get(PrimitiveScript).addField(workspace, input),
604
- addEnumField: (input) => CommandContainer.get(PrimitiveScript).addEnumField(workspace, input),
605
- addMutation: (input) => CommandContainer.get(PrimitiveScript).addMutation(workspace, input),
606
- addSlice: (input) => CommandContainer.get(PrimitiveScript).addSlice(workspace, input)
607
- });
608
-
609
546
  // pkgs/@akanjs/cli/context/context.runner.ts
610
547
  var toolErrorText = (error) => {
611
548
  const message = error instanceof Error ? error.message : String(error);
612
549
  return message.replace(/\/(?:[^\s"'/]+\/)*(?=(?:pkgs|apps|libs|infra)\/)/g, "<workspace>/");
613
550
  };
614
- var workflowDiagnosticFromContext = (diagnostic) => ({
615
- severity: diagnostic.severity,
616
- code: diagnostic.code,
617
- message: diagnostic.message,
618
- scope: diagnostic.scope,
619
- context: diagnostic.context
620
- });
621
551
  var compactDoctorWorkspaceResult = (result, includeBaselineDetails) => {
622
552
  const baselineDiagnostics = result.baselineDiagnostics ?? [];
623
- if (baselineDiagnostics.length === 0) {
624
- return {
625
- ...result,
626
- baselineSummary: createWorkflowBaselineSummary([], { detailsIncluded: includeBaselineDetails })
627
- };
628
- }
629
- const baselineSummary = createWorkflowBaselineSummary(baselineDiagnostics.map(workflowDiagnosticFromContext), {
630
- detailsIncluded: includeBaselineDetails
631
- });
553
+ const baselineSummary = createWorkflowBaselineSummary(baselineDiagnostics.map(({ severity, code, message, scope, context }) => ({
554
+ severity,
555
+ code,
556
+ message,
557
+ scope,
558
+ context
559
+ })), { detailsIncluded: includeBaselineDetails });
560
+ if (baselineDiagnostics.length === 0)
561
+ return { ...result, baselineSummary };
632
562
  return {
633
563
  ...result,
634
564
  baselineSummary,
@@ -637,17 +567,13 @@ var compactDoctorWorkspaceResult = (result, includeBaselineDetails) => {
637
567
  };
638
568
  };
639
569
 
640
- class ContextRunner extends runner("context") {
570
+ class ContextRunner2 extends runner("context") {
641
571
  async getContext(workspace, {
642
572
  format = "markdown",
643
573
  app = null,
644
574
  module = null
645
575
  } = {}) {
646
- const context = await AkanContextAnalyzer.analyze(workspace, {
647
- app,
648
- module,
649
- includeAbstractContent: !!module
650
- });
576
+ const context = await AkanContextAnalyzer.analyze(workspace, { app, module, includeAbstractContent: !!module });
651
577
  return format === "json" ? jsonText(context) : AkanContextAnalyzer.renderMarkdown(context, { module });
652
578
  }
653
579
  async doctor(workspace, {
@@ -663,19 +589,32 @@ class ContextRunner extends runner("context") {
663
589
  async#doctorIos(workspace, format) {
664
590
  const appNames = await workspace.getApps();
665
591
  const diagnostics = [];
592
+ let toolchainChecked = false;
666
593
  for (const appName of appNames) {
667
594
  const app = AppExecutor.from(workspace, appName);
668
595
  const config = await app.getConfig();
669
- if (!config.hasMobileConfig)
596
+ if (!config.hasNativeConfig)
670
597
  continue;
598
+ if (!toolchainChecked) {
599
+ toolchainChecked = true;
600
+ const report = await NativeApp.doctor(app.cwdPath, ["ios"]);
601
+ for (const check of report.checks.filter((check) => !check.ok || check.warn))
602
+ diagnostics.push({
603
+ severity: check.ok ? "warning" : "error",
604
+ code: "native-toolchain",
605
+ path: `${check.group} \u203A ${check.name}`,
606
+ message: [check.detail, check.hint].filter(Boolean).join(" ")
607
+ });
608
+ }
671
609
  for (const { name, config: target } of await getMobileTargets(app)) {
672
- if (!isPlaceholderAppId2(target.appId))
610
+ const placeholder = appIdsOf(target.appId).find(isPlaceholderAppId);
611
+ if (!placeholder)
673
612
  continue;
674
613
  diagnostics.push({
675
614
  severity: "warning",
676
615
  code: "mobile-appid-placeholder",
677
616
  path: `apps/${appName}/akan.config.ts`,
678
- message: `Mobile target '${name}' uses placeholder bundle id '${target.appId}'. Apple's developer portal almost always already claims it, so signing to a physical device fails with "cannot be registered to your development team". Set a unique mobile.appId (reverse-DNS of your org).`
617
+ message: `Native target '${name}' uses placeholder bundle id '${placeholder}'. Apple's developer portal almost always already claims it, so signing to a physical device fails with "cannot be registered to your development team". Set a unique native.appId (reverse-DNS of your org).`
679
618
  });
680
619
  }
681
620
  }
@@ -684,7 +623,7 @@ class ContextRunner extends runner("context") {
684
623
  return jsonText({ schemaVersion: 1, kind: "ios", status, diagnostics });
685
624
  const lines = [`Akan iOS diagnostics for ${workspace.repoName}`];
686
625
  if (diagnostics.length === 0)
687
- lines.push(" No mobile configuration issues found.");
626
+ lines.push(" No native configuration issues found.");
688
627
  else
689
628
  for (const diagnostic of diagnostics) {
690
629
  lines.push(` [${diagnostic.severity}] ${diagnostic.code}: ${diagnostic.message}`);
@@ -694,7 +633,7 @@ class ContextRunner extends runner("context") {
694
633
  `);
695
634
  }
696
635
  async getGuidelineResource(name) {
697
- return await Prompter.getInstruction(name);
636
+ return await Prompter2.getInstruction(name);
698
637
  }
699
638
  async installMcp(workspace, target, { force = false, mode = "readonly" } = {}) {
700
639
  if (target === "codex")
@@ -710,13 +649,7 @@ class ContextRunner extends runner("context") {
710
649
  if (currentAkanServer && !force && JSON.stringify(currentAkanServer) !== JSON.stringify(nextAkanServer)) {
711
650
  throw new Error(`${configPath} already has an "akan" MCP server. Re-run with --force to overwrite it.`);
712
651
  }
713
- const nextConfig = {
714
- ...existing,
715
- mcpServers: {
716
- ...mcpServers,
717
- akan: nextAkanServer
718
- }
719
- };
652
+ const nextConfig = { ...existing, mcpServers: { ...mcpServers, akan: nextAkanServer } };
720
653
  await workspace.writeFile(configPath, `${JSON.stringify(nextConfig, null, 2)}
721
654
  `);
722
655
  return configPath;
@@ -773,7 +706,7 @@ class ContextRunner extends runner("context") {
773
706
  return modules;
774
707
  }
775
708
  if (name === "get_guideline")
776
- return await Prompter.getInstruction(stringArg(args, "name"));
709
+ return await Prompter2.getInstruction(stringArg(args, "name"));
777
710
  if (name === "doctor_workspace")
778
711
  return compactDoctorWorkspaceResult(await AkanContextAnalyzer.doctor(workspace, {
779
712
  strict: !!args.strict,
@@ -809,7 +742,7 @@ class ContextRunner extends runner("context") {
809
742
  format: "json",
810
743
  dryRun: !!args.dryRun,
811
744
  workspace,
812
- registry: createCliWorkflowStepRegistry(workspace)
745
+ registry: WorkflowRunner.stepRegistry(workspace)
813
746
  }));
814
747
  const validationTarget = typeof report.validationTarget === "string" ? report.validationTarget : typeof report.applyReportPath === "string" ? report.applyReportPath : stringArg(args, "planPath");
815
748
  return {
@@ -863,14 +796,14 @@ ${payload}`);
863
796
  const respondError = (id, code, message, framing) => {
864
797
  writeMessage({ jsonrpc: "2.0", id: id ?? null, error: { code, message } }, framing);
865
798
  };
866
- const guidelineNames = await Prompter.listGuidelines();
799
+ const guidelineNames = await Prompter2.listGuidelines();
867
800
  const resources = buildResourceList(guidelineNames);
868
801
  const readResource = async (uri) => {
869
802
  if (uri === "akan://docs/framework")
870
- return { uri, mimeType: "text/markdown", text: await Prompter.getInstruction("framework") };
803
+ return { uri, mimeType: "text/markdown", text: await Prompter2.getInstruction("framework") };
871
804
  const guideline = /^akan:\/\/guidelines\/(.+)$/.exec(uri)?.[1];
872
805
  if (guideline)
873
- return { uri, mimeType: "text/markdown", text: await Prompter.getInstruction(guideline) };
806
+ return { uri, mimeType: "text/markdown", text: await Prompter2.getInstruction(guideline) };
874
807
  const context = await AkanContextAnalyzer.analyze(workspace);
875
808
  if (uri === "akan://workspace/summary")
876
809
  return { uri, mimeType: "application/json", text: jsonText(context, { trailingNewline: false }) };
@@ -902,22 +835,14 @@ ${payload}`);
902
835
  serverInfo: { name: "akan", version: process.env.AKAN_VERSION ?? "0.0.0" }
903
836
  }, framing);
904
837
  } else if (request.method === "tools/list") {
905
- respond(request.id, {
906
- tools: this.listMcpTools(mode, { guidelineNames })
907
- }, framing);
838
+ respond(request.id, { tools: this.listMcpTools(mode, { guidelineNames }) }, framing);
908
839
  } else if (request.method === "tools/call") {
909
840
  const name = params.name;
910
841
  const args = params.arguments ?? {};
911
842
  try {
912
843
  const result = await this.callMcpTool(workspace, name, args, { mode });
913
- respond(request.id, {
914
- content: [
915
- {
916
- type: "text",
917
- text: typeof result === "string" ? result : jsonText(result, { trailingNewline: false })
918
- }
919
- ]
920
- }, framing);
844
+ const text = typeof result === "string" ? result : jsonText(result, { trailingNewline: false });
845
+ respond(request.id, { content: [{ type: "text", text }] }, framing);
921
846
  } catch (error) {
922
847
  respond(request.id, { content: [{ type: "text", text: toolErrorText(error) }], isError: true }, framing);
923
848
  }
@@ -1026,7 +951,7 @@ ${payload}`);
1026
951
  test: "`akan test <app-or-lib-or-pkg>` prepares the target and runs its tests.",
1027
952
  build: "`akan build <app-name>` creates a production build after preparing generated files.",
1028
953
  doctor: "`akan doctor --strict --format json` reports agent-readable workspace convention diagnostics and validation hints.",
1029
- "guideline show": "`akan guideline show <name>` prints an Akan codegen guideline instruction.",
954
+ "guideline show": "`akan guideline show <name>` prints an Akan guideline instruction.",
1030
955
  workflow: "`akan workflow list|explain|plan|apply|validate|report` lists, plans, applies, validates, and reports agent-readable Akan workflows.",
1031
956
  "workflow list": "`akan workflow list` lists parseable read-only workflow specs.",
1032
957
  "workflow explain": "`akan workflow explain <workflow>` explains inputs, optional surfaces, steps, and validation.",
@@ -1049,57 +974,4 @@ ${payload}`);
1049
974
  }
1050
975
  }
1051
976
 
1052
- // pkgs/@akanjs/cli/context/context.script.ts
1053
- var resolveMcpInstallTargets = (target) => {
1054
- if (!target || target === "all")
1055
- return [...akanMcpInstallTargets];
1056
- if (akanMcpInstallTargets.includes(target))
1057
- return [target];
1058
- throw new Error(`Unknown MCP install target: ${target}. Use cursor, claude, codex, or all.`);
1059
- };
1060
- var mcpTargetLabels = {
1061
- cursor: "Cursor",
1062
- claude: "Claude Code",
1063
- codex: "Codex"
1064
- };
1065
-
1066
- class ContextScript extends script("context", [ContextRunner]) {
1067
- async context(workspace, options = {}) {
1068
- Logger.rawLog(await this.contextRunner.getContext(workspace, options));
1069
- }
1070
- async doctor(workspace, options = {}) {
1071
- Logger.rawLog(await this.contextRunner.doctor(workspace, options));
1072
- }
1073
- async mcpInstall(workspace, target, { force = false, mode = "apply" } = {}) {
1074
- const targets = resolveMcpInstallTargets(target);
1075
- const written = [];
1076
- for (const t of targets) {
1077
- const configPath = await this.contextRunner.installMcp(workspace, t, { force, mode });
1078
- written.push(`${mcpTargetLabels[t]}: ${configPath}`);
1079
- }
1080
- Logger.rawLog(`Akan MCP server installed (${mode} mode):
1081
- ${written.map((line) => `- ${line}`).join(`
1082
- `)}`);
1083
- }
1084
- async mcp(workspace, { mode = "apply" } = {}) {
1085
- await this.contextRunner.runMcp(workspace, { mode });
1086
- }
1087
- async mcpCall(workspace, tool, {
1088
- mode = "readonly",
1089
- args = null,
1090
- format = "json"
1091
- } = {}) {
1092
- let parsedArgs = {};
1093
- if (args) {
1094
- const parsed = JSON.parse(args);
1095
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
1096
- throw new Error("MCP call args must be a JSON object.");
1097
- }
1098
- parsedArgs = parsed;
1099
- }
1100
- const result = await this.contextRunner.callMcpTool(workspace, tool, parsedArgs, { mode });
1101
- Logger.rawLog(format === "json" ? jsonText(result) : String(result));
1102
- }
1103
- }
1104
-
1105
- export { ContextScript };
977
+ export { ContextRunner2 };
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  runner,
4
4
  script
5
- } from "./index-mak3cd28.js";
5
+ } from "./index-1skctzbq.js";
6
6
  import {
7
7
  AGENT_BLOCK_START,
8
8
  AGENT_BLOCK_END,
@@ -13,17 +13,17 @@ import {
13
13
  CLAUDE_COMMENT_RULE,
14
14
  AppExecutor,
15
15
  LibExecutor
16
- } from "./index-2tv3fdx4.js";
16
+ } from "./index-e52z7psd.js";
17
17
  import {
18
18
  collectRecipeSources2,
19
19
  scanRecipes2
20
- } from "./index-by5gpp8x.js";
20
+ } from "./index-hj6w4ka1.js";
21
21
  import {
22
22
  AkanContextAnalyzer
23
- } from "./index-ktb5njgy.js";
23
+ } from "./index-vcdxpmsx.js";
24
24
  import {
25
- Prompter
26
- } from "./index-h7yw2z9n.js";
25
+ Prompter2
26
+ } from "./index-zzvvc845.js";
27
27
 
28
28
  // pkgs/@akanjs/cli/agent/agent.script.ts
29
29
  import { Logger as Logger2 } from "akanjs/common";
@@ -106,10 +106,10 @@ ${scopeIndexPointer}
106
106
  `;
107
107
  };
108
108
  var renderGuides = async (context) => {
109
- const conventions = (await Prompter.getInstruction("conventions")).trim();
109
+ const conventions = (await Prompter2.getInstruction("conventions")).trim();
110
110
  if (context.pkgs.some((pkg) => pkg.name === "akanjs"))
111
111
  return conventions;
112
- const onboarding = (await Prompter.getInstruction("workspaceOnboarding")).trim();
112
+ const onboarding = (await Prompter2.getInstruction("workspaceOnboarding")).trim();
113
113
  const appName = context.apps[0]?.name ?? "app";
114
114
  return `${conventions}
115
115
 
@@ -117,7 +117,7 @@ ${onboarding.replaceAll("<%= appName %>", appName)}`;
117
117
  };
118
118
  var renderManagedBlock = async (workspace) => {
119
119
  const context = await AkanContextAnalyzer.analyze(workspace);
120
- const frameworkGuide = await Prompter.getInstruction("framework");
120
+ const frameworkGuide = await Prompter2.getInstruction("framework");
121
121
  const appNames = context.apps.map((app) => app.name);
122
122
  const sampleCleanup = await renderSampleCleanup(workspace, appNames);
123
123
  const recipeIndex = await renderRecipeIndex(workspace);
@@ -126,7 +126,7 @@ var renderManagedBlock = async (workspace) => {
126
126
  const block = `## Workspace
127
127
 
128
128
  - Repo: ${context.repoName}
129
- - Apps: ${context.apps.map((app) => app.name).join(", ") || "none"}
129
+ - Apps: ${appNames.join(", ") || "none"}
130
130
  - Libraries: ${context.libs.map((lib) => lib.name).join(", ") || "none"}
131
131
  - Packages: ${context.pkgs.map((pkg) => pkg.name).join(", ") || "none"}
132
132
 
@@ -138,7 +138,7 @@ ${sampleCleanup}## Akan Module Abstracts
138
138
  - Update the abstract when business invariants, workflows, or public behavior change.
139
139
  - Do not update the abstract for formatting-only, import-only, or style-only changes.
140
140
  - Service modules live in \`lib/_<service>\`, but their abstract file is \`<service>.abstract.md\`.
141
- - Keep an abstract short. Run \`akan compact <app-or-lib>\` to rewrite bloated abstracts down to the invariants the code cannot show; \`akan quality scan\` warns past 300 lines.
141
+ - Keep an abstract short \u2014 the invariants the code cannot show, and nothing it already states. \`akan quality scan\` warns past 300 lines.
142
142
 
143
143
  ## Generated Files
144
144
 
@@ -148,7 +148,7 @@ If generated output is stale or broken, update the owning source file and run \`
148
148
  ${recipeIndex}## MCP Workflow Policy
149
149
 
150
150
  - **Prefer an Akan workflow to a direct source edit.** A direct edit is denied when an allowlisted workflow or repair tool can make the change.
151
- - Inspect with \`akan mcp --mode plan\` (\`list_workflows\`, \`explain_workflow\`, \`plan_workflow\`); apply with \`akan mcp --mode apply\`, which allowlists \`apply_workflow\`, \`run_validation\`, and the repair tools.
151
+ - Inspect with \`akan mcp --mode plan\` (\`list_workflows\`, \`explain_workflow\`, \`plan_workflow\`); apply with \`akan mcp --mode apply\`, which allowlists \`apply_workflow\`, \`run_validation\`, and three of the five repair tools \u2014 \`repair_generated\`, \`repair_imports\` and \`repair_module_shape\`. \`akan repair format\` and \`akan repair dictionary\` are CLI-only.
152
152
  - If \`plan_workflow\` returns \`planPath\` or \`next.tool=apply_workflow\`, call \`apply_workflow({ planPath })\` before editing source. Then run \`run_validation\` with \`validationTarget\` when present, otherwise \`applyReportPath\`.
153
153
  - Split a compound request into workflows and apply each \`planPath\` in order, such as \`create-module\` followed by \`add-field\`.
154
154
  - When no workflow exists, or apply reports unsupported/no-op/failed diagnostics needing manual action, keep edits scoped to owning source files and never patch generated files directly.