@akanjs/cli 3.0.0-beta.2 → 3.0.0-beta.20

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 (187) hide show
  1. package/.build-stamp +1 -1
  2. package/CodeAgent-awv258wb.js +9 -0
  3. package/CodeAgentRpcHost-p7h6n2hp.js +7 -0
  4. package/CodeAgentRpcListener-7p7z5dd7.js +97 -0
  5. package/CodeTui-1nqh35ez.js +1457 -0
  6. package/README.md +3 -0
  7. package/TunnelShare-scf4e4pd.js +9 -0
  8. package/{agent.command-d2gfxfck.js → agent.command-1s9ag7sb.js} +8 -9
  9. package/akanCode.js +102 -0
  10. package/{application.command-pj2m7584.js → application.command-49hwy6va.js} +51 -78
  11. package/{applicationBuildRunner-kxwbssgn.js → applicationBuildRunner-ybyp97pv.js} +63 -64
  12. package/{applicationReleasePackager-4yasxwv9.js → applicationReleasePackager-esnrphw8.js} +40 -60
  13. package/buildBatch.proc.js +19 -24
  14. package/{capacitorApp-36rbr858.js → capacitorApp-1synz4en.js} +3 -4
  15. package/cloud.command-d7rqtzt9.js +94 -0
  16. package/cloud.script-bkbpcr96.js +19 -0
  17. package/code.command-nn48xzej.js +154 -0
  18. package/commandManifest.json +1 -1
  19. package/consoleToStderr-h5bryj94.js +7 -0
  20. package/context.command-s3mcmvpa.js +48 -0
  21. package/context.runner-k99nb5pk.js +21 -0
  22. package/{dependencyScanner-shs82ynp.js → dependencyScanner-ye2e6pdz.js} +2 -2
  23. package/{devTui-40ggmd99.js → devTui-q7k7bakd.js} +122 -40
  24. package/fileSys-5ngz93ga.js +9 -0
  25. package/guideline.command-sct4qnt5.js +42 -0
  26. package/guidelines/agentRule/agentRule.instruction.md +206 -25
  27. package/guidelines/conventions/conventions.instruction.md +79 -24
  28. package/guidelines/fieldRule/fieldRule.instruction.md +1 -0
  29. package/guidelines/mcpRule/mcpRule.instruction.md +7 -5
  30. package/guidelines/queryRule/queryRule.instruction.md +17 -7
  31. package/guidelines/runtimeRule/runtimeRule.instruction.md +74 -0
  32. package/guidelines/ssrRule/ssrRule.instruction.md +4 -2
  33. package/guidelines/transportRule/transportRule.instruction.md +51 -0
  34. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +66 -3
  35. package/incrementalBuilder.proc.js +31 -48
  36. package/{index-h7yw2z9n.js → index-0bq14vr1.js} +8 -14
  37. package/index-13ffe9wp.js +69 -0
  38. package/index-22d57v4c.js +266 -0
  39. package/{index-fz5q3gd7.js → index-31yr441d.js} +10 -17
  40. package/index-3hx1z96c.js +87 -0
  41. package/index-3sq321ak.js +53 -0
  42. package/{index-kcxmv48c.js → index-3t7g9e4r.js} +45 -79
  43. package/{index-q0y2jq9j.js → index-5b6tavv3.js} +6 -3
  44. package/{index-47pj3aee.js → index-5e0n4hqx.js} +11 -12
  45. package/{index-259dsnz3.js → index-5pc1qrbv.js} +5 -8
  46. package/index-7md2g9vw.js +6 -0
  47. package/index-8mna0947.js +187 -0
  48. package/{index-zry5nz81.js → index-8sf7wmdr.js} +51 -30
  49. package/{index-2tv3fdx4.js → index-9d9bgcx4.js} +342 -765
  50. package/index-9dp031by.js +12 -0
  51. package/{index-ne2qy0nk.js → index-ahemdr5n.js} +12 -12
  52. package/{index-ws5e0j51.js → index-as7xmyz8.js} +40 -24
  53. package/index-axzjaqve.js +1118 -0
  54. package/{index-3d9y066c.js → index-bjwxs904.js} +9 -8
  55. package/index-c6eggbee.js +123 -0
  56. package/index-d2242ksy.js +99 -0
  57. package/{index-a64esmtb.js → index-ddxvdd1p.js} +169 -305
  58. package/{index-92zztqy1.js → index-dy0jx9ay.js} +2 -17
  59. package/{index-pnqbkf5p.js → index-dzf3r49a.js} +6 -2
  60. package/{index-w8kmx1b6.js → index-fgq75haa.js} +198 -290
  61. package/{index-by5gpp8x.js → index-hj6w4ka1.js} +2 -1
  62. package/{index-hwkygn9s.js → index-khpfpcsd.js} +302 -33
  63. package/{index-wt7qrtd4.js → index-mxav6j3c.js} +93 -232
  64. package/{index-gyd220p2.js → index-myhc3c1j.js} +554 -577
  65. package/{index-600zhnve.js → index-nv5976x3.js} +56 -197
  66. package/index-p6pbz9n5.js +25 -0
  67. package/{index-4edzf1gr.js → index-przybvy5.js} +77 -150
  68. package/index-smme4r47.js +49 -0
  69. package/{index-mak3cd28.js → index-w2zdcw3k.js} +137 -255
  70. package/index-wa5jbxj1.js +760 -0
  71. package/{index-v0qh106m.js → index-ww4z397j.js} +527 -723
  72. package/{index-j9yhg404.js → index-xqjwd384.js} +4 -7
  73. package/{index-7737gxcp.js → index-xqpzbab5.js} +107 -241
  74. package/index-xsjh6nzh.js +2729 -0
  75. package/{index-ktb5njgy.js → index-ygn77a5w.js} +47 -99
  76. package/index-ztp3e73t.js +700 -0
  77. package/index.js +23 -22
  78. package/{library.command-nbsky672.js → library.command-1gx04jgn.js} +4 -5
  79. package/{localRegistry.command-yeq57wjr.js → localRegistry.command-zndxj1q6.js} +22 -42
  80. package/{module.command-29vqzrh8.js → module.command-3waddk95.js} +8 -11
  81. package/{package.command-axv0abmn.js → package.command-zrc7br1y.js} +6 -7
  82. package/package.json +14 -5
  83. package/{page.command-vs9s3zrh.js → page.command-vpjgardh.js} +4 -5
  84. package/{primitive.command-cbxmqbtc.js → primitive.command-sz84tk4t.js} +9 -22
  85. package/prompter-ptaa3nk0.js +8 -0
  86. package/{quality.command-gmbs7nws.js → quality.command-g869hafs.js} +203 -376
  87. package/{recipeScanner-fpagtgc1.js → recipeScanner-4b69ybe0.js} +1 -1
  88. package/{repair.command-bqsjptsj.js → repair.command-chsnjvvv.js} +11 -35
  89. package/{routeSourceValidator-apyqw7wk.js → routeSourceValidator-7ycnfz0e.js} +0 -6
  90. package/{scalar.command-6k1vhe9s.js → scalar.command-2v21newx.js} +7 -10
  91. package/skills/akan-code/SKILL.md +130 -0
  92. package/skills/akan-debug/SKILL.md +42 -0
  93. package/skills/akan-deps/SKILL.md +50 -0
  94. package/skills/akan-err/SKILL.md +39 -0
  95. package/skills/akan-module/SKILL.md +45 -0
  96. package/skills/akan-scaffold/SKILL.md +76 -0
  97. package/skills/akan-scalar/SKILL.md +52 -0
  98. package/skills/akan-service/SKILL.md +34 -0
  99. package/skills/akan-store/SKILL.md +67 -0
  100. package/skills/akan-ui/SKILL.md +63 -0
  101. package/skills/akan-validate/SKILL.md +44 -0
  102. package/{subspace.command-fwjfcts7.js → subspace.command-ckcbwfp1.js} +138 -67
  103. package/templates/__scalar/__model__/__model__.abstract.md.template +8 -0
  104. package/templates/appSample/lib/__scalar/workHistory/workHistory.abstract.ts +8 -39
  105. package/templates/appSample/lib/_noti/noti.abstract.ts +6 -29
  106. package/templates/appSample/lib/task/task.abstract.ts +12 -32
  107. package/templates/appSample/lib/task/task.signal.spec.ts +15 -18
  108. package/templates/appSample/lib/task/task.signal.test.ts +15 -1
  109. package/templates/appSample/lib/task/task.signal.ts +1 -1
  110. package/templates/appSample/srvkit/{AuthGuard.ts → guards.ts} +7 -4
  111. package/templates/appSample/srvkit/{SessionInternalArg.ts → internalArgs.ts} +6 -4
  112. package/templates/client.ts +7 -30
  113. package/templates/crudPages/[__model__Id]/edit/page.tsx +2 -1
  114. package/templates/crudPages/[__model__Id]/page.tsx +2 -1
  115. package/templates/crudPages/new/page.tsx +2 -1
  116. package/templates/crudPages/page.tsx +2 -1
  117. package/templates/crudSinglePage/page.tsx +2 -1
  118. package/templates/lib/__lib/lib.dictionary.ts +0 -2
  119. package/templates/lib/__lib/lib.document.ts +0 -2
  120. package/templates/lib/sig.ts +8 -30
  121. package/templates/localDev/docker-compose.yaml.template +3 -14
  122. package/templates/module/__model__.signal.ts +12 -4
  123. package/templates/pkgRoot/tsconfig.json.template +2 -7
  124. package/templates/server.ts +0 -2
  125. package/templates/service/__model__.abstract.md.template +8 -0
  126. package/tunnel.command-kd2yr4fx.js +129 -0
  127. package/{typeChecker-3xgrzc2v.js → typeChecker-px49mezc.js} +1 -1
  128. package/typecheck.proc.js +1 -1
  129. package/workflow.command-44252cqv.js +79 -0
  130. package/{workspace.command-8s050m0h.js → workspace.command-fqcztt5p.js} +77 -109
  131. package/abstractCompactor-mjh5ppsq.js +0 -101
  132. package/cloud.command-jshwdq22.js +0 -93
  133. package/context.command-ez8a0zyz.js +0 -80
  134. package/devTuiView-c08ccbat.js +0 -9
  135. package/getDirname-dr3jz1xg.js +0 -7
  136. package/guideline.command-xmqwx8zm.js +0 -359
  137. package/guidelines/agentRule/agentRule.generate.json +0 -31
  138. package/guidelines/componentRule/componentRule.generate.json +0 -31
  139. package/guidelines/conventions/conventions.generate.json +0 -25
  140. package/guidelines/cssRule/cssRule.generate.json +0 -31
  141. package/guidelines/docPageRule/docPageRule.generate.json +0 -31
  142. package/guidelines/docPageRule/docPageRule.instruction.md +0 -25
  143. package/guidelines/docSyncRule/docSyncRule.generate.json +0 -31
  144. package/guidelines/docSyncRule/docSyncRule.instruction.md +0 -25
  145. package/guidelines/enumConstant/enumConstant.generate.json +0 -31
  146. package/guidelines/enumConstant/enumConstant.instruction.md +0 -28
  147. package/guidelines/fieldRule/fieldRule.generate.json +0 -31
  148. package/guidelines/framework/framework.generate.json +0 -32
  149. package/guidelines/mcpRule/mcpRule.generate.json +0 -35
  150. package/guidelines/modelConstant/modelConstant.generate.json +0 -32
  151. package/guidelines/modelDictionary/modelDictionary.generate.json +0 -32
  152. package/guidelines/modelDocument/modelDocument.generate.json +0 -31
  153. package/guidelines/modelService/modelService.generate.json +0 -31
  154. package/guidelines/modelSignal/modelSignal.generate.json +0 -31
  155. package/guidelines/modelStore/modelStore.generate.json +0 -31
  156. package/guidelines/modelTemplate/modelTemplate.generate.json +0 -31
  157. package/guidelines/modelUnit/modelUnit.generate.json +0 -31
  158. package/guidelines/modelUtil/modelUtil.generate.json +0 -31
  159. package/guidelines/modelView/modelView.generate.json +0 -31
  160. package/guidelines/modelZone/modelZone.generate.json +0 -31
  161. package/guidelines/moduleCodegen/moduleCodegen.generate.json +0 -31
  162. package/guidelines/moduleCodegen/moduleCodegen.instruction.md +0 -28
  163. package/guidelines/moduleOverview/moduleOverview.generate.json +0 -31
  164. package/guidelines/queryRule/queryRule.generate.json +0 -31
  165. package/guidelines/recipeRule/recipeRule.generate.json +0 -31
  166. package/guidelines/runtimeRule/runtimeRule.generate.json +0 -25
  167. package/guidelines/scalarConstant/scalarConstant.generate.json +0 -32
  168. package/guidelines/scalarDictionary/scalarDictionary.generate.json +0 -32
  169. package/guidelines/scalarModule/scalarModule.generate.json +0 -31
  170. package/guidelines/sharedUiUsage/sharedUiUsage.generate.json +0 -31
  171. package/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +0 -25
  172. package/guidelines/ssrRule/ssrRule.generate.json +0 -31
  173. package/guidelines/transportRule/transportRule.generate.json +0 -31
  174. package/guidelines/utilUiUsage/utilUiUsage.generate.json +0 -31
  175. package/guidelines/utilUiUsage/utilUiUsage.instruction.md +0 -25
  176. package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +0 -24
  177. package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +0 -33
  178. package/index-2hq52jq3.js +0 -465
  179. package/index-6wwzs1bc.js +0 -7
  180. package/index-8pm30m73.js +0 -841
  181. package/index-kn1h7p1x.js +0 -560
  182. package/index-meh558jy.js +0 -65
  183. package/index-rwg2aa4f.js +0 -229
  184. package/templates/__scalar/__model__/__model__.abstract.md +0 -28
  185. package/templates/module/__model__.abstract.md +0 -28
  186. package/templates/service/__model__.abstract.md +0 -28
  187. package/workflow.command-nwpcdc8p.js +0 -107
@@ -1,60 +1,45 @@
1
1
  // @bun
2
2
  import {
3
3
  AppExecutor
4
- } from "./index-2tv3fdx4.js";
4
+ } from "./index-9d9bgcx4.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-myhc3c1j.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";
23
- import {
24
- CommandContainer,
25
- runner,
26
- script
27
- } from "./index-mak3cd28.js";
20
+ } from "./index-ygn77a5w.js";
28
21
  import {
29
22
  isPlaceholderAppId2
30
- } from "./index-wt7qrtd4.js";
23
+ } from "./index-mxav6j3c.js";
24
+ import {
25
+ runner
26
+ } from "./index-w2zdcw3k.js";
31
27
  import {
32
- Prompter
33
- } from "./index-h7yw2z9n.js";
28
+ Prompter2
29
+ } from "./index-0bq14vr1.js";
34
30
  import {
35
31
  RepairRunner
36
- } from "./index-fz5q3gd7.js";
32
+ } from "./index-31yr441d.js";
37
33
  import {
38
34
  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";
35
+ } from "./index-xqpzbab5.js";
49
36
  import {
50
37
  getMobileTargets
51
- } from "./index-47pj3aee.js";
52
-
53
- // pkgs/@akanjs/cli/context/context.script.ts
54
- import { Logger } from "akanjs/common";
38
+ } from "./index-5e0n4hqx.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, {
@@ -694,7 +620,7 @@ class ContextRunner extends runner("context") {
694
620
  `);
695
621
  }
696
622
  async getGuidelineResource(name) {
697
- return await Prompter.getInstruction(name);
623
+ return await Prompter2.getInstruction(name);
698
624
  }
699
625
  async installMcp(workspace, target, { force = false, mode = "readonly" } = {}) {
700
626
  if (target === "codex")
@@ -710,13 +636,7 @@ class ContextRunner extends runner("context") {
710
636
  if (currentAkanServer && !force && JSON.stringify(currentAkanServer) !== JSON.stringify(nextAkanServer)) {
711
637
  throw new Error(`${configPath} already has an "akan" MCP server. Re-run with --force to overwrite it.`);
712
638
  }
713
- const nextConfig = {
714
- ...existing,
715
- mcpServers: {
716
- ...mcpServers,
717
- akan: nextAkanServer
718
- }
719
- };
639
+ const nextConfig = { ...existing, mcpServers: { ...mcpServers, akan: nextAkanServer } };
720
640
  await workspace.writeFile(configPath, `${JSON.stringify(nextConfig, null, 2)}
721
641
  `);
722
642
  return configPath;
@@ -773,7 +693,7 @@ class ContextRunner extends runner("context") {
773
693
  return modules;
774
694
  }
775
695
  if (name === "get_guideline")
776
- return await Prompter.getInstruction(stringArg(args, "name"));
696
+ return await Prompter2.getInstruction(stringArg(args, "name"));
777
697
  if (name === "doctor_workspace")
778
698
  return compactDoctorWorkspaceResult(await AkanContextAnalyzer.doctor(workspace, {
779
699
  strict: !!args.strict,
@@ -809,7 +729,7 @@ class ContextRunner extends runner("context") {
809
729
  format: "json",
810
730
  dryRun: !!args.dryRun,
811
731
  workspace,
812
- registry: createCliWorkflowStepRegistry(workspace)
732
+ registry: WorkflowRunner.stepRegistry(workspace)
813
733
  }));
814
734
  const validationTarget = typeof report.validationTarget === "string" ? report.validationTarget : typeof report.applyReportPath === "string" ? report.applyReportPath : stringArg(args, "planPath");
815
735
  return {
@@ -863,14 +783,14 @@ ${payload}`);
863
783
  const respondError = (id, code, message, framing) => {
864
784
  writeMessage({ jsonrpc: "2.0", id: id ?? null, error: { code, message } }, framing);
865
785
  };
866
- const guidelineNames = await Prompter.listGuidelines();
786
+ const guidelineNames = await Prompter2.listGuidelines();
867
787
  const resources = buildResourceList(guidelineNames);
868
788
  const readResource = async (uri) => {
869
789
  if (uri === "akan://docs/framework")
870
- return { uri, mimeType: "text/markdown", text: await Prompter.getInstruction("framework") };
790
+ return { uri, mimeType: "text/markdown", text: await Prompter2.getInstruction("framework") };
871
791
  const guideline = /^akan:\/\/guidelines\/(.+)$/.exec(uri)?.[1];
872
792
  if (guideline)
873
- return { uri, mimeType: "text/markdown", text: await Prompter.getInstruction(guideline) };
793
+ return { uri, mimeType: "text/markdown", text: await Prompter2.getInstruction(guideline) };
874
794
  const context = await AkanContextAnalyzer.analyze(workspace);
875
795
  if (uri === "akan://workspace/summary")
876
796
  return { uri, mimeType: "application/json", text: jsonText(context, { trailingNewline: false }) };
@@ -902,22 +822,14 @@ ${payload}`);
902
822
  serverInfo: { name: "akan", version: process.env.AKAN_VERSION ?? "0.0.0" }
903
823
  }, framing);
904
824
  } else if (request.method === "tools/list") {
905
- respond(request.id, {
906
- tools: this.listMcpTools(mode, { guidelineNames })
907
- }, framing);
825
+ respond(request.id, { tools: this.listMcpTools(mode, { guidelineNames }) }, framing);
908
826
  } else if (request.method === "tools/call") {
909
827
  const name = params.name;
910
828
  const args = params.arguments ?? {};
911
829
  try {
912
830
  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);
831
+ const text = typeof result === "string" ? result : jsonText(result, { trailingNewline: false });
832
+ respond(request.id, { content: [{ type: "text", text }] }, framing);
921
833
  } catch (error) {
922
834
  respond(request.id, { content: [{ type: "text", text: toolErrorText(error) }], isError: true }, framing);
923
835
  }
@@ -1026,7 +938,7 @@ ${payload}`);
1026
938
  test: "`akan test <app-or-lib-or-pkg>` prepares the target and runs its tests.",
1027
939
  build: "`akan build <app-name>` creates a production build after preparing generated files.",
1028
940
  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.",
941
+ "guideline show": "`akan guideline show <name>` prints an Akan guideline instruction.",
1030
942
  workflow: "`akan workflow list|explain|plan|apply|validate|report` lists, plans, applies, validates, and reports agent-readable Akan workflows.",
1031
943
  "workflow list": "`akan workflow list` lists parseable read-only workflow specs.",
1032
944
  "workflow explain": "`akan workflow explain <workflow>` explains inputs, optional surfaces, steps, and validation.",
@@ -1049,57 +961,4 @@ ${payload}`);
1049
961
  }
1050
962
  }
1051
963
 
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 };
964
+ export { ContextRunner2 };
@@ -0,0 +1,25 @@
1
+ // @bun
2
+ // pkgs/@akanjs/cli/clipboard.ts
3
+ var clipboardCommands = () => {
4
+ if (process.platform === "darwin")
5
+ return [["pbcopy"]];
6
+ if (process.platform === "win32")
7
+ return [["clip"]];
8
+ return [["wl-copy"], ["xclip", "-selection", "clipboard"], ["xsel", "--clipboard", "--input"]];
9
+ };
10
+ var writeClipboard = async (text) => {
11
+ for (const command of clipboardCommands()) {
12
+ try {
13
+ const proc = Bun.spawn(command, {
14
+ stdin: new TextEncoder().encode(text),
15
+ stdout: "ignore",
16
+ stderr: "ignore"
17
+ });
18
+ if (await proc.exited === 0)
19
+ return true;
20
+ } catch {}
21
+ }
22
+ return false;
23
+ };
24
+
25
+ export { writeClipboard };