@akanjs/cli 3.1.1-rc.9 → 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 (207) 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-z5vkm9ea.js → CodeTui-q55b2zrn.js} +25 -8
  6. package/TunnelShare-hdq9h1hr.js +14 -0
  7. package/agent.command-20zaqe60.js +49 -0
  8. package/akanCode.js +13 -8
  9. package/{application.command-wthg8nn9.js → application.command-nd0fshsk.js} +45 -12
  10. package/{applicationBuildRunner-t2r84sz6.js → applicationBuildRunner-s13x3zqb.js} +14 -10
  11. package/buildBatch.proc.js +7 -7
  12. package/{cloud.command-sz11hpre.js → cloud.command-8kbddsz9.js} +28 -19
  13. package/cloud.script-hgvvajm3.js +27 -0
  14. package/code.command-625bg8s8.js +345 -0
  15. package/commandManifest.json +1 -1
  16. package/{context.command-15j9b7c0.js → context.command-p6haqjay.js} +20 -18
  17. package/context.runner-rsnqnk9j.js +27 -0
  18. package/{dependencyScanner-3afj2vt1.js → dependencyScanner-78sq8m4q.js} +2 -2
  19. package/{devTui-q7k7bakd.js → devTui-evr3b35y.js} +1 -1
  20. package/{fileSys-wzzrntkw.js → fileSys-zpvt5gtf.js} +1 -1
  21. package/{guideline.command-snh85ctf.js → guideline.command-195g0h9a.js} +4 -4
  22. package/guidelines/agentRule/agentRule.instruction.md +22 -8
  23. package/guidelines/conventions/core.md +106 -0
  24. package/guidelines/conventions/rules/app.md +83 -0
  25. package/guidelines/conventions/rules/auth.md +46 -0
  26. package/guidelines/conventions/rules/config.md +60 -0
  27. package/guidelines/conventions/rules/constant.md +24 -0
  28. package/guidelines/conventions/rules/gates.md +32 -0
  29. package/guidelines/conventions/rules/layer.md +25 -0
  30. package/guidelines/conventions/rules/migration.md +27 -0
  31. package/guidelines/conventions/rules/module.md +90 -0
  32. package/guidelines/conventions/rules/page.md +56 -0
  33. package/guidelines/conventions/rules/sensitive.md +16 -0
  34. package/guidelines/conventions/rules/server.md +91 -0
  35. package/guidelines/conventions/rules/ssr.md +47 -0
  36. package/guidelines/conventions/rules/style.md +43 -0
  37. package/guidelines/conventions/rules/test.md +34 -0
  38. package/guidelines/conventions/rules/ts.md +95 -0
  39. package/guidelines/conventions/rules/tsx.md +76 -0
  40. package/guidelines/mcpRule/mcpRule.instruction.md +1 -1
  41. package/guidelines/pageRule/pageRule.instruction.md +8 -7
  42. package/guidelines/queryRule/queryRule.instruction.md +4 -0
  43. package/guidelines/runtimeRule/runtimeRule.instruction.md +35 -25
  44. package/guidelines/ssrRule/ssrRule.instruction.md +11 -10
  45. package/guidelines/transportRule/transportRule.instruction.md +5 -4
  46. package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +4 -4
  47. package/incrementalBuilder.proc.js +7 -7
  48. package/{index-301pdbzz.js → index-00a7j05x.js} +7 -7
  49. package/{index-js6geqjn.js → index-0j1t1h2b.js} +3 -1
  50. package/{index-6txx6a9p.js → index-1h2jc0x3.js} +154 -88
  51. package/{index-55j120r8.js → index-1qsd8ft1.js} +65 -145
  52. package/{index-9th4gszy.js → index-2mwjshz5.js} +233 -1271
  53. package/index-2nxk8wgs.js +266 -0
  54. package/{index-j9vyj3dj.js → index-2phm56a1.js} +49 -8
  55. package/index-35j83zkd.js +61 -0
  56. package/index-4am4dvmf.js +29 -0
  57. package/index-75y7bcz4.js +28 -0
  58. package/index-7apsdr5g.js +487 -0
  59. package/{index-42j4a8zq.js → index-84h43kg6.js} +8 -6
  60. package/index-9bv479q5.js +1 -0
  61. package/{index-3wypz6xj.js → index-9zy8479y.js} +11 -5
  62. package/{index-a5dhqkdr.js → index-a1vb3x7t.js} +273 -259
  63. package/{index-52w0fvh8.js → index-bns3wcpc.js} +15 -0
  64. package/index-cjmjvg4r.js +3622 -0
  65. package/{index-pcwzkdqb.js → index-defp4gmb.js} +1 -1
  66. package/index-ewbmfarf.js +1606 -0
  67. package/index-fbewhg4g.js +590 -0
  68. package/index-fhw7yq2d.js +653 -0
  69. package/{index-wcej7g4z.js → index-g500c5j9.js} +271 -105
  70. package/{index-74tjjsnc.js → index-g841cap9.js} +33 -37
  71. package/{index-2azahjaw.js → index-gr9thy79.js} +5 -5
  72. package/{index-4pf8g7ff.js → index-h7hehkw6.js} +3 -0
  73. package/{index-xjf5j657.js → index-hm0tn7qv.js} +1001 -91
  74. package/index-j6eeh5d7.js +138 -0
  75. package/{index-31es1yev.js → index-j7hwy56s.js} +108 -7
  76. package/{index-skk9zc1x.js → index-jc2zbwra.js} +2 -2
  77. package/{index-905qdgqp.js → index-khk05tsf.js} +1 -1
  78. package/{index-5nd1wtkv.js → index-p6x5b7hr.js} +1 -1
  79. package/{index-tvehn2sp.js → index-qd7xn2bk.js} +1 -1
  80. package/{index-a58emady.js → index-qw6814m4.js} +55 -17
  81. package/index-raz588b3.js +445 -0
  82. package/{index-at7bz0xq.js → index-s4nvxpzm.js} +2 -0
  83. package/{index-bt438yxm.js → index-sp0qsr7a.js} +116 -13
  84. package/{index-xb8809yb.js → index-sveq36gh.js} +40 -43
  85. package/{index-hmt54t45.js → index-t1t9wq9a.js} +4 -4
  86. package/index-t78230d7.js +191 -0
  87. package/index-tenw3mah.js +225 -0
  88. package/{index-qfp55x1y.js → index-tgqameyb.js} +4 -4
  89. package/{index-espk51ah.js → index-tp56652m.js} +6 -6
  90. package/index-w15mg3km.js +389 -0
  91. package/{index-dy0jx9ay.js → index-wwe9rsrx.js} +14 -0
  92. package/{index-2xcc2ax5.js → index-y4kcmbt2.js} +2 -2
  93. package/index-yf9wc28h.js +52 -0
  94. package/{index-0fz95kxe.js → index-zbrwnmf1.js} +9 -7
  95. package/{index-40brg4px.js → index-zttm13c3.js} +5 -5
  96. package/index.js +24 -23
  97. package/{library.command-gycrwhf1.js → library.command-63hgt9te.js} +4 -4
  98. package/{localRegistry.command-jtd8gaes.js → localRegistry.command-g3f8k25t.js} +46 -22
  99. package/{module.command-v6hgs1bc.js → module.command-r4sa2khp.js} +7 -6
  100. package/{package.command-shzpcfph.js → package.command-96eheyvd.js} +5 -5
  101. package/package.json +2 -2
  102. package/{page.command-ptxn5kqk.js → page.command-gs6d841d.js} +4 -4
  103. package/{pipeline.command-zz31pgax.js → pipeline.command-wdfvdbfj.js} +3 -3
  104. package/{primitive.command-a1vse91z.js → primitive.command-dfsv4mpe.js} +8 -7
  105. package/{projectTypecheck-2ztky9cf.js → projectTypecheck-kqj1t6hb.js} +1 -1
  106. package/{prompter-76k56b37.js → prompter-qrwx1p17.js} +2 -2
  107. package/quality.command-webzxee2.js +78 -0
  108. package/{repair.command-cvazbz99.js → repair.command-3r3j1xre.js} +7 -6
  109. package/{routeSourceValidator-6jd0q6r6.js → routeSourceValidator-4h947v7c.js} +13 -3
  110. package/{scalar.command-0acvyp26.js → scalar.command-e8y47j6d.js} +6 -5
  111. package/skills/akan-agent/SKILL.md +43 -0
  112. package/skills/akan-code/SKILL.md +38 -11
  113. package/skills/akan-debug/SKILL.md +41 -6
  114. package/skills/akan-deps/SKILL.md +1 -2
  115. package/skills/akan-err/SKILL.md +2 -1
  116. package/skills/akan-mcp/SKILL.md +40 -0
  117. package/skills/akan-page/SKILL.md +44 -0
  118. package/skills/akan-query/SKILL.md +39 -0
  119. package/skills/akan-runtime/SKILL.md +43 -0
  120. package/skills/akan-scaffold/SKILL.md +16 -6
  121. package/skills/akan-transport/SKILL.md +40 -0
  122. package/skills/akan-validate/SKILL.md +13 -11
  123. package/{subspace.command-822qx2bx.js → subspace.command-a1sf9n5a.js} +12 -10
  124. package/templates/__scalar/__model__/__model__.constant.ts +3 -5
  125. package/templates/__scalar/__model__/__model__.dictionary.ts +6 -5
  126. package/templates/__scalar/__model__/__model__.document.ts +3 -3
  127. package/templates/app/akan.config.ts +2 -3
  128. package/templates/app/env/env.client.ts +2 -4
  129. package/templates/app/env/env.client.type.ts +2 -3
  130. package/templates/app/env/env.server.ts +2 -3
  131. package/templates/app/lib/___appName__/__appName__.dictionary.ts +1 -2
  132. package/templates/app/lib/___appName__/__appName__.service.ts +3 -3
  133. package/templates/app/lib/___appName__/__appName__.signal.ts +5 -5
  134. package/templates/app/lib/___appName__/__appName__.store.ts +4 -6
  135. package/templates/app/lib/option.ts +2 -3
  136. package/templates/app/main.ts +2 -4
  137. package/templates/app/page/_index.tsx +3 -3
  138. package/templates/app/page/_layout.tsx +13 -10
  139. package/templates/appSample/lib/__scalar/workHistory/workHistory.constant.ts +1 -5
  140. package/templates/appSample/lib/__scalar/workHistory/workHistory.dictionary.ts +1 -1
  141. package/templates/appSample/lib/_noti/noti.signal.ts +1 -1
  142. package/templates/appSample/lib/task/Task.Template.tsx +2 -1
  143. package/templates/appSample/lib/task/Task.Unit.tsx +3 -2
  144. package/templates/appSample/lib/task/Task.Util.tsx +16 -4
  145. package/templates/appSample/lib/task/task.constant.ts +1 -5
  146. package/templates/appSample/lib/task/task.dictionary.ts +2 -8
  147. package/templates/appSample/lib/task/task.document.ts +1 -1
  148. package/templates/appSample/lib/task/task.signal.ts +14 -9
  149. package/templates/appSample/page/task/_index.tsx +2 -1
  150. package/templates/appSample/page/task/new.tsx +2 -1
  151. package/templates/appSample/srvkit/guards.ts +11 -0
  152. package/templates/appSample/ui/QuantityControl.tsx +5 -9
  153. package/templates/biomeForm.ts +144 -0
  154. package/templates/crudPages/[__model__Id]/edit/page.tsx +3 -3
  155. package/templates/crudPages/[__model__Id]/page.tsx +5 -5
  156. package/templates/crudPages/new/page.tsx +4 -3
  157. package/templates/crudPages/page.tsx +3 -3
  158. package/templates/crudSinglePage/page.tsx +9 -5
  159. package/templates/libRoot/akan.config.ts +2 -3
  160. package/templates/libRoot/lib/___libName__/__libName__.dictionary.ts +1 -2
  161. package/templates/libRoot/lib/___libName__/__libName__.service.ts +5 -4
  162. package/templates/libRoot/lib/___libName__/__libName__.signal.ts +6 -5
  163. package/templates/libRoot/lib/___libName__/__libName__.store.ts +5 -6
  164. package/templates/libRoot/lib/option.ts +1 -2
  165. package/templates/module/__Model__.Template.tsx +11 -10
  166. package/templates/module/__Model__.Unit.tsx +18 -5
  167. package/templates/module/__Model__.Util.tsx +9 -7
  168. package/templates/module/__Model__.View.tsx +9 -6
  169. package/templates/module/__Model__.Zone.tsx +25 -17
  170. package/templates/module/__model__.constant.ts +8 -9
  171. package/templates/module/__model__.dictionary.ts +16 -17
  172. package/templates/module/__model__.document.ts +6 -8
  173. package/templates/module/__model__.service.ts +3 -3
  174. package/templates/module/__model__.signal.ts +11 -10
  175. package/templates/module/__model__.store.ts +3 -5
  176. package/templates/service/__model__.dictionary.ts +5 -6
  177. package/templates/service/__model__.service.ts +3 -3
  178. package/templates/service/__model__.signal.ts +5 -4
  179. package/templates/service/__model__.store.ts +3 -5
  180. package/templates/workspaceRoot/.gitignore.template +4 -0
  181. package/templates/workspaceRoot/.vscode/settings.json.template +21 -21
  182. package/templates/workspaceRoot/AGENTS.md.template +4 -10
  183. package/{tunnel.command-ycmja19q.js → tunnel.command-dcb0wg93.js} +25 -13
  184. package/{typeChecker-px49mezc.js → typeChecker-j2jdnqsr.js} +1 -1
  185. package/typecheck.proc.js +6 -1
  186. package/verify.command-yyepccbh.js +93 -0
  187. package/{workflow.command-abb1d5xy.js → workflow.command-z5pg9ay0.js} +49 -14
  188. package/workspace.command-d7x5jttw.js +290 -0
  189. package/CodeAgent-8d5qs787.js +0 -9
  190. package/CodeAgentRpcListener-7p7z5dd7.js +0 -97
  191. package/TunnelShare-qkm8zp03.js +0 -14
  192. package/agent.command-ydftceda.js +0 -25
  193. package/cloud.script-nqevg5qw.js +0 -24
  194. package/code.command-9h3yrzhe.js +0 -167
  195. package/context.runner-8gg030b0.js +0 -25
  196. package/guidelines/conventions/conventions.instruction.md +0 -617
  197. package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +0 -291
  198. package/index-2mwc0g0d.js +0 -49
  199. package/index-4vgbysa0.js +0 -279
  200. package/index-7md2g9vw.js +0 -6
  201. package/index-b70zct19.js +0 -856
  202. package/index-c6eggbee.js +0 -123
  203. package/index-zzvvc845.js +0 -74
  204. package/quality.command-ah8qcakd.js +0 -1478
  205. package/templates/workspaceRoot/docs/AI-DEVELOPMENT.md.template +0 -69
  206. package/templates/workspaceRoot/docs/GENERATED.md.template +0 -55
  207. package/workspace.command-qm7cw29v.js +0 -521
package/index-b70zct19.js DELETED
@@ -1,856 +0,0 @@
1
- // @bun
2
- import {
3
- jsonText,
4
- workflowPlanApproval,
5
- createWorkflowApplyReport,
6
- workflowCommandsForPlan,
7
- workflowPathsForPlan,
8
- writeWorkflowRunArtifact,
9
- readWorkflowRunArtifact,
10
- createWorkflowBaselineSummary,
11
- createWorkflowValidationRunReport,
12
- createDryRunWorkflowApplyReport,
13
- createWorkflowStepRegistry,
14
- WorkflowExecutor,
15
- listWorkflowSpecs,
16
- getWorkflowSpec,
17
- compactWorkflowInputs,
18
- createWorkflowPlan,
19
- renderWorkflowList,
20
- renderWorkflowExplain,
21
- renderWorkflowPlan,
22
- renderWorkflowApply,
23
- renderWorkflowValidation,
24
- renderWorkflowRunArtifact
25
- } from "./index-xjf5j657.js";
26
- import {
27
- AkanContextAnalyzer
28
- } from "./index-31es1yev.js";
29
- import {
30
- CommandContainer,
31
- runner
32
- } from "./index-3wypz6xj.js";
33
- import {
34
- ModuleScript
35
- } from "./index-hmt54t45.js";
36
- import {
37
- PrimitiveScript
38
- } from "./index-74tjjsnc.js";
39
- import {
40
- spawnShell
41
- } from "./index-j9vyj3dj.js";
42
- import {
43
- ScalarScript
44
- } from "./index-skk9zc1x.js";
45
-
46
- // pkgs/@akanjs/cli/workflow/workflow.runner.ts
47
- import { mkdir, readFile, writeFile } from "fs/promises";
48
- import path from "path";
49
- import { isRecord } from "akanjs/common";
50
-
51
- // pkgs/@akanjs/cli/workflows/shared.ts
52
- var sysInputs = {
53
- app: {
54
- type: "string",
55
- required: true,
56
- description: "Target app or library name."
57
- }
58
- };
59
- var moduleInput = {
60
- module: {
61
- type: "string",
62
- required: true,
63
- description: "Target domain, service, or scalar module name."
64
- }
65
- };
66
- var baseValidation = [
67
- { command: "akan sync <app-or-lib>", reason: "Refresh generated Akan files from source conventions.", kind: "sync" },
68
- {
69
- command: "akan lint <app-or-lib-or-pkg>",
70
- reason: "Validate formatting, imports, and static lint rules.",
71
- kind: "lint"
72
- }
73
- ];
74
- var stepOf = (id, title, tool) => (description) => ({ id, title, tool, description });
75
- var inspectModuleStep = stepOf("inspect-module", "Inspect module", "inspectModule");
76
- var inspectSystemStep = stepOf("inspect-system", "Inspect target system", "inspectSystem");
77
- var syncGeneratedStep = stepOf("sync-generated", "Sync generated files", "syncTarget");
78
- var validateTargetStep = stepOf("validate-target", "Validate target", "lintTarget");
79
- var validateTarget = validateTargetStep("Run validation commands for the target.");
80
-
81
- // pkgs/@akanjs/cli/workflows/addEnumField.ts
82
- var addEnumFieldWorkflowSpec = {
83
- schemaVersion: 1,
84
- name: "add-enum-field",
85
- description: "Plan an enum field addition with option and dictionary coverage.",
86
- whenToUse: "Use when the user asks to add a field with a closed set of values.",
87
- inputs: {
88
- ...sysInputs,
89
- ...moduleInput,
90
- field: { type: "string", required: true, description: "Name of the enum field to add." },
91
- values: { type: "string-list", required: true, description: "Comma-separated enum values." },
92
- default: { type: "string", description: "Optional default enum value." }
93
- },
94
- optionalSurfaces: {
95
- dictionary: "include",
96
- option: "include",
97
- template: "infer",
98
- unit: "infer",
99
- view: "infer",
100
- store: "infer"
101
- },
102
- steps: [
103
- inspectModuleStep("Read module files and existing enum conventions."),
104
- {
105
- id: "update-constant",
106
- title: "Update enum field",
107
- tool: "updateConstantEnumField",
108
- description: "Plan enum type and field shape changes."
109
- },
110
- {
111
- id: "update-dictionary",
112
- title: "Update dictionary",
113
- tool: "updateDictionaryEnum",
114
- description: "Plan enum labels and field labels."
115
- },
116
- {
117
- id: "update-option",
118
- title: "Update options",
119
- tool: "updateOptionEnum",
120
- description: "Plan option entries used by UI controls."
121
- },
122
- syncGeneratedStep("Refresh generated files after enum source changes."),
123
- validateTarget
124
- ],
125
- predictedChanges: [
126
- { target: "*/lib/<module>/<module>.constant.ts", action: "modify", reason: "Enum field shape is added." },
127
- { target: "*/lib/<module>/<module>.dictionary.ts", action: "modify", reason: "Enum labels are added." },
128
- { target: "*/lib/<module>/<module>.option.ts", action: "modify", reason: "Enum options may be added." }
129
- ],
130
- validation: [
131
- ...baseValidation,
132
- { command: "akan typecheck <app-name>", reason: "Validate enum usage across module surfaces.", kind: "typecheck" }
133
- ],
134
- completionCriteria: ["Enum values are represented.", "Labels and options exist.", "Sync, lint, and typecheck pass."]
135
- };
136
-
137
- // pkgs/@akanjs/cli/workflows/addField.ts
138
- var addFieldWorkflowSpec = {
139
- schemaVersion: 1,
140
- name: "add-field",
141
- description: "Plan a field addition across domain and selected UI surfaces.",
142
- whenToUse: "Use when the user asks to add a new field to an existing domain module.",
143
- inputs: {
144
- ...sysInputs,
145
- ...moduleInput,
146
- field: { type: "string", required: true, description: "Name of the field to add." },
147
- type: {
148
- type: "string",
149
- required: true,
150
- description: "Field type or scalar name. Use Int for integer fields or Float for decimal fields; do not use Number."
151
- },
152
- values: { type: "string-list", description: "Comma-separated enum values when type is enum." },
153
- default: {
154
- type: "string",
155
- description: "Optional default value. plan/apply coerce by field type: Int/Float to numeric literals, Boolean to true/false, Date (now, a timestamp, or a date string) to a () => dayjs(...) thunk, String/scalar to string literals, and enum only when the value is in values."
156
- },
157
- surfaces: {
158
- type: "string-list",
159
- description: "Optional UI surfaces to update, comma-separated. Use template to auto-update simple generated Template forms; View/Unit stay planned as manual review."
160
- },
161
- includeInLight: {
162
- type: "boolean",
163
- description: "Whether to add the field to the Light<Model> projection used by list/card displays."
164
- }
165
- },
166
- optionalSurfaces: {
167
- dictionary: "include",
168
- template: "infer",
169
- unit: "infer",
170
- view: "infer",
171
- store: "infer"
172
- },
173
- steps: [
174
- inspectModuleStep("Read module files and detect existing field/UI patterns."),
175
- {
176
- id: "update-constant",
177
- title: "Update constant",
178
- tool: "updateConstantField",
179
- description: "Plan the source-of-truth field shape change."
180
- },
181
- {
182
- id: "update-dictionary",
183
- title: "Update dictionary",
184
- tool: "updateDictionaryField",
185
- description: "Plan field labels and user-facing text."
186
- },
187
- {
188
- id: "update-ui-surfaces",
189
- title: "Update UI surfaces",
190
- tool: "updateUiSurfaces",
191
- description: "Plan optional Template, Unit, View, and Store updates according to inferred surfaces.",
192
- when: "optionalSurfaces.* is include or infer"
193
- },
194
- syncGeneratedStep("Refresh generated files after source changes."),
195
- validateTarget
196
- ],
197
- predictedChanges: [
198
- {
199
- target: "*/lib/<module>/<module>.constant.ts",
200
- action: "modify",
201
- applyScope: "auto",
202
- reason: "Field shape is added."
203
- },
204
- {
205
- target: "*/lib/<module>/<module>.dictionary.ts",
206
- action: "modify",
207
- applyScope: "auto",
208
- reason: "Field label is added."
209
- },
210
- {
211
- target: "*/lib/<module>/<Module>.Template.tsx",
212
- action: "modify",
213
- applyScope: "manual-review",
214
- reason: "Form surface may include the field."
215
- },
216
- {
217
- target: "*/lib/cnst.ts",
218
- action: "sync",
219
- applyScope: "generated-sync",
220
- reason: "Generated constants may change after sync."
221
- },
222
- {
223
- target: "*/lib/dict.ts",
224
- action: "sync",
225
- applyScope: "generated-sync",
226
- reason: "Generated dictionary barrel may change after sync."
227
- }
228
- ],
229
- validation: [
230
- ...baseValidation,
231
- {
232
- command: "akan typecheck <app-name>",
233
- reason: "Validate cross-surface TypeScript contracts after field changes.",
234
- kind: "typecheck"
235
- }
236
- ],
237
- completionCriteria: [
238
- "Field exists in source-of-truth module shape.",
239
- "Dictionary labels cover the field.",
240
- "Generated files are refreshed.",
241
- "Lint and typecheck pass."
242
- ]
243
- };
244
-
245
- // pkgs/@akanjs/cli/workflows/addMutation.ts
246
- var addMutationWorkflowSpec = {
247
- schemaVersion: 1,
248
- name: "add-mutation",
249
- description: "Plan a server mutation and matching signal/store/UI action surface.",
250
- whenToUse: "Use when the user asks for a new state-changing module action.",
251
- inputs: {
252
- ...sysInputs,
253
- ...moduleInput,
254
- mutation: { type: "string", required: true, description: "Mutation/action name." }
255
- },
256
- optionalSurfaces: {
257
- service: "include",
258
- signal: "include",
259
- store: "infer",
260
- util: "infer",
261
- unit: "infer",
262
- view: "infer",
263
- dictionary: "include"
264
- },
265
- steps: [
266
- inspectModuleStep("Read service, signal, store, and UI action patterns."),
267
- {
268
- id: "update-service",
269
- title: "Update service",
270
- tool: "updateServiceMutation",
271
- description: "Plan the server-side mutation method."
272
- },
273
- {
274
- id: "update-signal",
275
- title: "Update signal",
276
- tool: "updateSignalMutation",
277
- description: "Plan the client/server signal mutation binding."
278
- },
279
- {
280
- id: "update-action-surfaces",
281
- title: "Update action surfaces",
282
- tool: "updateActionSurfaces",
283
- description: "Plan optional store and UI action changes."
284
- },
285
- syncGeneratedStep("Refresh generated service and signal barrels."),
286
- validateTarget
287
- ],
288
- predictedChanges: [
289
- {
290
- target: "*/lib/<module>/<module>.service.ts",
291
- action: "modify",
292
- applyScope: "auto",
293
- reason: "Service mutation method stub is added."
294
- },
295
- {
296
- target: "*/lib/<module>/<module>.signal.ts",
297
- action: "modify",
298
- applyScope: "auto",
299
- reason: "Signal endpoint mutation is added."
300
- },
301
- { target: "*/lib/srv.ts", action: "sync", reason: "Generated service barrel may change after sync." },
302
- { target: "*/lib/sig.ts", action: "sync", reason: "Generated signal barrel may change after sync." }
303
- ],
304
- validation: [
305
- ...baseValidation,
306
- {
307
- command: "akan typecheck <app-name>",
308
- reason: "Validate mutation contracts across service and signal.",
309
- kind: "typecheck"
310
- }
311
- ],
312
- completionCriteria: ["Service and signal contracts align.", "Generated files are refreshed.", "Validation passes."]
313
- };
314
-
315
- // pkgs/@akanjs/cli/workflows/addSlice.ts
316
- var addSliceWorkflowSpec = {
317
- schemaVersion: 1,
318
- name: "add-slice",
319
- description: "Plan a list/query slice across data access, signal, and view surfaces.",
320
- whenToUse: "Use when the user asks for a filtered list, tab, segment, or reusable query slice.",
321
- inputs: {
322
- ...sysInputs,
323
- ...moduleInput,
324
- slice: { type: "string", required: true, description: "Slice or query name." }
325
- },
326
- optionalSurfaces: {
327
- service: "include",
328
- signal: "include",
329
- zone: "infer",
330
- page: "infer",
331
- dictionary: "include"
332
- },
333
- steps: [
334
- inspectModuleStep("Read existing query, slice, zone, and page loading patterns."),
335
- {
336
- id: "update-service-query",
337
- title: "Update service query",
338
- tool: "updateServiceSlice",
339
- description: "Plan the query helper or filter handling."
340
- },
341
- {
342
- id: "update-signal-slice",
343
- title: "Update signal slice",
344
- tool: "updateSignalSlice",
345
- description: "Plan the signal slice contract."
346
- },
347
- {
348
- id: "connect-view-surfaces",
349
- title: "Connect view surfaces",
350
- tool: "connectSliceSurfaces",
351
- description: "Plan optional Zone and page loader changes."
352
- },
353
- syncGeneratedStep("Refresh generated files after slice changes."),
354
- validateTarget
355
- ],
356
- predictedChanges: [
357
- {
358
- target: "*/lib/<module>/<module>.service.ts",
359
- action: "modify",
360
- applyScope: "auto",
361
- reason: "Query helper method stub is added."
362
- },
363
- {
364
- target: "*/lib/<module>/<module>.signal.ts",
365
- action: "modify",
366
- applyScope: "auto",
367
- reason: "Signal slice entry is added."
368
- },
369
- {
370
- target: "*/lib/<module>/<Module>.Zone.tsx",
371
- action: "modify",
372
- applyScope: "manual-review",
373
- reason: "Zone may connect slice state."
374
- },
375
- { target: "*/lib/sig.ts", action: "sync", reason: "Generated signal barrel may change after sync." }
376
- ],
377
- validation: [
378
- ...baseValidation,
379
- {
380
- command: "akan build <app-name>",
381
- reason: "Validate page and list surfaces when a slice changes app behavior.",
382
- kind: "custom"
383
- }
384
- ],
385
- completionCriteria: [
386
- "Slice query and signal shape align.",
387
- "Optional view surfaces are planned.",
388
- "Validation passes."
389
- ]
390
- };
391
-
392
- // pkgs/@akanjs/cli/workflows/createModule.ts
393
- var createModuleWorkflowSpec = {
394
- schemaVersion: 1,
395
- name: "create-module",
396
- description: "Plan a new database-backed domain module using Akan module conventions.",
397
- whenToUse: "Use when the user asks for a new business entity with constant, service, signal, store, and UI surfaces.",
398
- inputs: {
399
- ...sysInputs,
400
- module: { type: "string", required: true, description: "Name of the module to create." }
401
- },
402
- optionalSurfaces: {
403
- page: "infer",
404
- template: "include",
405
- unit: "include",
406
- view: "include"
407
- },
408
- steps: [
409
- inspectSystemStep("Check the target app or library before planning new module files."),
410
- {
411
- id: "create-module",
412
- title: "Create module",
413
- tool: "createModule",
414
- description: "Use the existing create-module primitive to scaffold conventional module files."
415
- },
416
- syncGeneratedStep("Refresh generated barrels after adding a module."),
417
- validateTargetStep("Run validation commands that prove the scaffold matches Akan conventions.")
418
- ],
419
- predictedChanges: [
420
- { target: "*/lib/<module>/*", action: "create", reason: "New module source files are scaffolded." },
421
- { target: "*/lib/cnst.ts", action: "sync", reason: "Generated constant barrel may include the new module." },
422
- { target: "*/lib/srv.ts", action: "sync", reason: "Generated service barrel may include the new module." },
423
- { target: "*/lib/sig.ts", action: "sync", reason: "Generated signal barrel may include the new module." }
424
- ],
425
- validation: baseValidation,
426
- completionCriteria: [
427
- "Module abstract and conventional files exist.",
428
- "Generated files are refreshed with sync.",
429
- "Lint passes for the target."
430
- ]
431
- };
432
-
433
- // pkgs/@akanjs/cli/workflows/createScalar.ts
434
- var createScalarWorkflowSpec = {
435
- schemaVersion: 1,
436
- name: "create-scalar",
437
- description: "Plan a reusable scalar value module without database ownership.",
438
- whenToUse: "Use when the user asks for a reusable value object, primitive domain type, or shared scalar.",
439
- inputs: {
440
- ...sysInputs,
441
- scalar: { type: "string", required: true, description: "Name of the scalar to create." }
442
- },
443
- optionalSurfaces: {
444
- dictionary: "include"
445
- },
446
- steps: [
447
- inspectSystemStep("Check the target app or library before planning a scalar."),
448
- {
449
- id: "create-scalar",
450
- title: "Create scalar",
451
- tool: "createScalar",
452
- description: "Use the existing create-scalar primitive to scaffold scalar files."
453
- },
454
- syncGeneratedStep("Refresh generated barrels after adding a scalar."),
455
- validateTargetStep("Run validation commands for the scalar target.")
456
- ],
457
- predictedChanges: [
458
- { target: "*/lib/__scalar/<scalar>/*", action: "create", reason: "New scalar source files are scaffolded." }
459
- ],
460
- validation: baseValidation,
461
- completionCriteria: ["Scalar files exist under __scalar.", "Generated files are refreshed.", "Lint passes."]
462
- };
463
-
464
- // pkgs/@akanjs/cli/workflows/createUi.ts
465
- var createUiWorkflowSpec = {
466
- schemaVersion: 1,
467
- name: "create-ui",
468
- description: "Plan creation of a conventional module UI surface.",
469
- whenToUse: "Use when the user asks for a View, Unit, Template, Zone, or Util component for an existing module.",
470
- inputs: {
471
- ...sysInputs,
472
- ...moduleInput,
473
- surface: {
474
- type: "string",
475
- required: true,
476
- description: "UI surface to create.",
477
- allowedValues: ["view", "unit", "template", "zone", "util"]
478
- }
479
- },
480
- optionalSurfaces: {
481
- dictionary: "infer",
482
- store: "infer"
483
- },
484
- steps: [
485
- inspectModuleStep("Read existing module context and component files."),
486
- {
487
- id: "create-ui",
488
- title: "Create UI surface",
489
- tool: "createUi",
490
- description: "Create the requested UI surface through an Akan primitive."
491
- },
492
- syncGeneratedStep("Refresh UI barrels after adding a component."),
493
- validateTarget
494
- ],
495
- predictedChanges: [
496
- { target: "*/lib/<module>/<Module>.<Surface>.tsx", action: "create", reason: "New UI component is created." },
497
- { target: "*/ui/index.ts", action: "sync", reason: "Generated UI barrel may include the new component." }
498
- ],
499
- validation: baseValidation,
500
- completionCriteria: ["Requested UI surface exists.", "UI barrels are refreshed.", "Lint passes."]
501
- };
502
-
503
- // pkgs/@akanjs/cli/workflows/index.ts
504
- var workflowSpecs = [
505
- createModuleWorkflowSpec,
506
- createScalarWorkflowSpec,
507
- createUiWorkflowSpec,
508
- addFieldWorkflowSpec,
509
- addEnumFieldWorkflowSpec,
510
- addMutationWorkflowSpec,
511
- addSliceWorkflowSpec
512
- ];
513
-
514
- // pkgs/@akanjs/cli/workflow/workflow.runner.ts
515
- var resolvePath = (filePath) => path.isAbsolute(filePath) ? filePath : path.join(process.cwd(), filePath);
516
- var isWorkflowPlan = (value) => {
517
- if (!isRecord(value))
518
- return false;
519
- return value.schemaVersion === 1 && value.mode === "plan" && typeof value.workflow === "string";
520
- };
521
- var isWorkflowApplyReport = (value) => {
522
- if (!isRecord(value))
523
- return false;
524
- return value.schemaVersion === 1 && (value.mode === "apply" || value.mode === "dry-run") && isWorkflowPlan(value.plan);
525
- };
526
- var isWorkflowRunArtifact = (value) => {
527
- if (!isRecord(value))
528
- return false;
529
- return value.schemaVersion === 1 && (typeof value.mode === "string" || typeof value.command === "string");
530
- };
531
- var failedPlan = (workflow, diagnostics) => ({
532
- schemaVersion: 1,
533
- workflow,
534
- mode: "plan",
535
- inputs: {},
536
- optionalSurfaces: {},
537
- steps: [],
538
- predictedChanges: [],
539
- validation: [],
540
- diagnostics,
541
- recommendations: [],
542
- requiresApproval: true,
543
- approval: workflowPlanApproval
544
- });
545
- var failedApplyReport = (workflow, code, message, plan) => {
546
- const diagnostics = [{ severity: "error", code, message }];
547
- return createWorkflowApplyReport({
548
- workflow,
549
- mode: "apply",
550
- changedFiles: [],
551
- generatedFiles: [],
552
- commands: [],
553
- diagnostics,
554
- nextActions: [],
555
- plan: plan ?? failedPlan(workflow, diagnostics)
556
- });
557
- };
558
- var inferValidationKind = (command) => {
559
- if (command.kind)
560
- return command.kind;
561
- if (/\bakan\s+sync\b/.test(command.command))
562
- return "sync";
563
- if (/\bakan\s+lint\b/.test(command.command))
564
- return "lint";
565
- if (/\bakan\s+typecheck\b/.test(command.command))
566
- return "typecheck";
567
- if (/\bakan\s+doctor\b/.test(command.command))
568
- return "doctor";
569
- return "custom";
570
- };
571
- var classifyValidationFailure = (command, error) => {
572
- const output = `${error.stdout ?? ""}
573
- ${error.stderr ?? ""}
574
- ${error.message ?? ""}`.toLowerCase();
575
- if (error.code === 127 || output.includes("command not found") || output.includes("bun: command not found")) {
576
- return "environment";
577
- }
578
- if (output.includes("biome.json") || output.includes("biome configuration") || output.includes("configuration file") || output.includes("invalid configuration") || output.includes("failed to load")) {
579
- return "workspace-config";
580
- }
581
- const kind = inferValidationKind(command);
582
- if (kind === "lint" || kind === "typecheck" || kind === "sync")
583
- return "source-change";
584
- return "unknown";
585
- };
586
- var defaultValidationExecutor = (workspace) => async (command) => {
587
- const base = { command: command.command, reason: command.reason, kind: inferValidationKind(command) };
588
- try {
589
- return { ...base, status: "passed", exitCode: 0, stdout: await spawnShell(workspace, command.command) };
590
- } catch (error) {
591
- const commandError = error;
592
- return {
593
- ...base,
594
- status: "failed",
595
- exitCode: commandError.code ?? 1,
596
- failureScope: classifyValidationFailure(command, commandError),
597
- stdout: commandError.stdout,
598
- stderr: commandError.stderr ?? commandError.message
599
- };
600
- }
601
- };
602
- var readJsonFile = async (filePath) => JSON.parse(await readFile(resolvePath(filePath), "utf8"));
603
- var workflowDiagnosticFromDoctor = ({
604
- severity,
605
- code,
606
- message,
607
- scope,
608
- context
609
- }, fallbackScope) => {
610
- const resolvedScope = scope ?? fallbackScope;
611
- const failureScope = resolvedScope === "baseline" ? "workspace-config" : resolvedScope === "workflow" ? "source-change" : "unknown";
612
- return { severity, code, message, scope: resolvedScope, failureScope, context };
613
- };
614
- var baselineBlockerCachePath = (workflow) => `.akan/workflows/baseline/${workflow}.json`;
615
- var blockerFingerprint = (blocker) => [blocker.failureScope, blocker.code, blocker.command ?? "", blocker.kind ?? "", blocker.message].join("|");
616
- var applyBaselineBlockerCache = async (workspace, report) => {
617
- const cacheableBlockers = report.knownBlockers.filter((blocker) => blocker.failureScope === "workspace-config" || blocker.failureScope === "environment");
618
- if (cacheableBlockers.length === 0)
619
- return report;
620
- const cachePath = baselineBlockerCachePath(report.workflow);
621
- const cached = (await workspace.exists(cachePath) ? await workspace.readJson(cachePath) : null) ?? { schemaVersion: 1, workflow: report.workflow, blockers: [] };
622
- const knownFingerprints = new Set(cached.blockers.map((blocker) => blocker.fingerprint));
623
- const now = new Date().toISOString();
624
- const blockers = new Map(cached.blockers.map((blocker) => [blocker.fingerprint, blocker]));
625
- for (const blocker of cacheableBlockers) {
626
- const fingerprint = blockerFingerprint(blocker);
627
- blockers.set(fingerprint, {
628
- fingerprint,
629
- code: blocker.code,
630
- message: blocker.message,
631
- failureScope: blocker.failureScope,
632
- command: blocker.command,
633
- kind: blocker.kind,
634
- lastSeenAt: now
635
- });
636
- }
637
- await workspace.writeFile(cachePath, jsonText({ schemaVersion: 1, workflow: report.workflow, blockers: [...blockers.values()] }), { silent: true });
638
- const knownBlockers = report.knownBlockers.map((blocker) => {
639
- if (!knownFingerprints.has(blockerFingerprint(blocker)))
640
- return blocker;
641
- return {
642
- ...blocker,
643
- known: true,
644
- message: `Known baseline blocker, unrelated to this source change: ${blocker.message}`
645
- };
646
- });
647
- return {
648
- ...report,
649
- knownBlockers,
650
- baselineSummary: {
651
- ...report.baselineSummary,
652
- knownBlockerCount: knownBlockers.filter((blocker) => blocker.known).length
653
- }
654
- };
655
- };
656
- var withBaselineDetailsPolicy = (report, includeBaselineDetails) => {
657
- const baselineDiagnostics = report.baselineDiagnostics ?? [];
658
- return {
659
- ...report,
660
- baselineSummary: createWorkflowBaselineSummary(baselineDiagnostics, {
661
- detailsIncluded: includeBaselineDetails,
662
- knownBlockerCount: report.knownBlockers.filter((blocker) => blocker.known).length
663
- }),
664
- baselineDiagnostics: includeBaselineDetails ? baselineDiagnostics : []
665
- };
666
- };
667
-
668
- class WorkflowRunner extends runner("workflow") {
669
- static stepRegistry(workspace) {
670
- return createWorkflowStepRegistry({
671
- workspace,
672
- createModule: (sys, module) => CommandContainer.get(ModuleScript).createModuleTemplate(sys, module),
673
- createScalar: (sys, scalar) => CommandContainer.get(ScalarScript).createScalar(sys, scalar),
674
- createUi: (input) => CommandContainer.get(PrimitiveScript).createUi(workspace, input),
675
- addField: (input) => CommandContainer.get(PrimitiveScript).addField(workspace, input),
676
- addEnumField: (input) => CommandContainer.get(PrimitiveScript).addEnumField(workspace, input),
677
- addMutation: (input) => CommandContainer.get(PrimitiveScript).addMutation(workspace, input),
678
- addSlice: (input) => CommandContainer.get(PrimitiveScript).addSlice(workspace, input)
679
- });
680
- }
681
- list({ format = "markdown" } = {}) {
682
- const workflows = listWorkflowSpecs(workflowSpecs);
683
- if (format === "json")
684
- return jsonText({
685
- schemaVersion: 1,
686
- workflows: workflows.map(({ name, description, whenToUse }) => ({ name, description, whenToUse }))
687
- });
688
- return renderWorkflowList(workflows);
689
- }
690
- explain(workflow, { format = "markdown" } = {}) {
691
- const spec = getWorkflowSpec(workflowSpecs, workflow);
692
- if (!spec)
693
- throw new Error(`Unknown workflow: ${workflow}. Run \`akan workflow list\` to see available workflows.`);
694
- return format === "json" ? jsonText(spec) : renderWorkflowExplain(spec);
695
- }
696
- async plan(workflow, inputs, { format = "markdown", out = null } = {}) {
697
- const spec = getWorkflowSpec(workflowSpecs, workflow);
698
- if (!spec)
699
- throw new Error(`Unknown workflow: ${workflow}. Run \`akan workflow list\` to see available workflows.`);
700
- const plan = createWorkflowPlan(spec, compactWorkflowInputs(inputs));
701
- if (out) {
702
- const outPath = resolvePath(out);
703
- await mkdir(path.dirname(outPath), { recursive: true });
704
- await writeFile(outPath, jsonText(plan));
705
- }
706
- return format === "json" ? jsonText(plan) : renderWorkflowPlan(plan);
707
- }
708
- async apply(planPath, {
709
- dryRun = false,
710
- format = "markdown",
711
- registry,
712
- workspace
713
- } = {}) {
714
- const renderApplyReport = async (report) => {
715
- if (!workspace)
716
- return renderWorkflowApply(report, format);
717
- const { artifact } = await writeWorkflowRunArtifact(workspace, report);
718
- return renderWorkflowApply(artifact, format);
719
- };
720
- let plan;
721
- try {
722
- const parsed = await readJsonFile(planPath);
723
- if (!isWorkflowPlan(parsed))
724
- return await renderApplyReport(failedApplyReport("unknown", "workflow-plan-invalid", `Workflow plan file is invalid: ${planPath}.`));
725
- plan = parsed;
726
- } catch (error) {
727
- const message = `Could not read workflow plan file: ${planPath}. ${error instanceof Error ? error.message : ""}`;
728
- return await renderApplyReport(failedApplyReport("unknown", "workflow-plan-read-failed", message.trim()));
729
- }
730
- const spec = getWorkflowSpec(workflowSpecs, plan.workflow);
731
- if (!spec) {
732
- const message = `Unknown workflow in plan: ${plan.workflow}.`;
733
- return await renderApplyReport(failedApplyReport(plan.workflow, "workflow-unknown", message, plan));
734
- }
735
- if (dryRun)
736
- return await renderApplyReport(createDryRunWorkflowApplyReport(plan));
737
- if (!registry) {
738
- const message = "Workflow apply requires a step runner registry.";
739
- return await renderApplyReport(failedApplyReport(plan.workflow, "workflow-registry-missing", message, plan));
740
- }
741
- return await renderApplyReport(await new WorkflowExecutor(registry, workspace).apply(plan));
742
- }
743
- async validate(runIdOrPlan, {
744
- format = "markdown",
745
- workspace,
746
- execute,
747
- includeBaselineDetails = false
748
- }) {
749
- const loaded = await this.loadValidationTarget(runIdOrPlan, workspace);
750
- const doctor = await AkanContextAnalyzer.doctor(workspace, {
751
- strict: true,
752
- runIdOrPlan,
753
- changedFiles: loaded.changedFiles
754
- });
755
- const report = withBaselineDetailsPolicy(await applyBaselineBlockerCache(workspace, await createWorkflowValidationRunReport({
756
- workflow: loaded.plan?.workflow ?? loaded.workflow,
757
- source: loaded.source,
758
- plan: loaded.plan,
759
- commands: loaded.commands,
760
- execute: execute ?? defaultValidationExecutor(workspace),
761
- diagnostics: loaded.diagnostics,
762
- baselineDiagnostics: (doctor.baselineDiagnostics ?? []).map((diagnostic) => workflowDiagnosticFromDoctor(diagnostic, "baseline")),
763
- workflowDiagnostics: (doctor.workflowDiagnostics ?? []).map((diagnostic) => workflowDiagnosticFromDoctor(diagnostic, "workflow")),
764
- repairActions: loaded.repairActions
765
- })), includeBaselineDetails);
766
- await writeWorkflowRunArtifact(workspace, report);
767
- return renderWorkflowValidation(report, format);
768
- }
769
- async report(runId, { format = "markdown", workspace }) {
770
- try {
771
- return renderWorkflowRunArtifact(await readWorkflowRunArtifact(workspace, runId), format);
772
- } catch (error) {
773
- const report = await createWorkflowValidationRunReport({
774
- runId,
775
- workflow: "unknown",
776
- source: { type: "run-report", runId },
777
- commands: [],
778
- execute: async (command) => ({
779
- command: command.command,
780
- reason: command.reason,
781
- status: "failed",
782
- exitCode: 1
783
- }),
784
- diagnostics: [
785
- {
786
- severity: "error",
787
- code: "workflow-run-read-failed",
788
- message: `Could not read workflow run report: ${runId}. ${error instanceof Error ? error.message : ""}`.trim()
789
- }
790
- ]
791
- });
792
- return renderWorkflowValidation(report, format);
793
- }
794
- }
795
- async loadValidationTarget(runIdOrPlan, workspace) {
796
- const unreadable = (code, message) => ({
797
- workflow: "unknown",
798
- source: { type: "run-report", runId: runIdOrPlan },
799
- plan: undefined,
800
- commands: [],
801
- diagnostics: [{ severity: "error", code, message }],
802
- changedFiles: [],
803
- repairActions: []
804
- });
805
- const loadFromArtifact = (artifact, sourcePath) => {
806
- if (isWorkflowApplyReport(artifact)) {
807
- return {
808
- workflow: artifact.workflow,
809
- source: { type: "apply-report", path: sourcePath, runId: artifact.runId },
810
- plan: artifact.plan,
811
- commands: artifact.recommendedValidationCommands.length ? artifact.recommendedValidationCommands : workflowCommandsForPlan(artifact.plan),
812
- diagnostics: artifact.diagnostics,
813
- changedFiles: artifact.changedFiles.map((file) => file.path),
814
- repairActions: []
815
- };
816
- }
817
- if ("mode" in artifact && artifact.mode === "validate") {
818
- return {
819
- workflow: artifact.workflow,
820
- source: { type: "run-report", runId: artifact.runId },
821
- plan: artifact.plan,
822
- commands: artifact.plan ? workflowCommandsForPlan(artifact.plan) : [],
823
- diagnostics: artifact.diagnostics,
824
- changedFiles: [],
825
- repairActions: artifact.repairActions
826
- };
827
- }
828
- return unreadable("workflow-validation-source-unsupported", `Workflow validation source is not supported: ${runIdOrPlan}.`);
829
- };
830
- try {
831
- const parsed = await readJsonFile(runIdOrPlan);
832
- if (isWorkflowPlan(parsed)) {
833
- return {
834
- workflow: parsed.workflow,
835
- source: { type: "plan", path: resolvePath(runIdOrPlan) },
836
- plan: parsed,
837
- commands: workflowCommandsForPlan(parsed),
838
- diagnostics: parsed.diagnostics,
839
- changedFiles: workflowPathsForPlan(parsed),
840
- repairActions: []
841
- };
842
- }
843
- if (isWorkflowRunArtifact(parsed))
844
- return loadFromArtifact(parsed, resolvePath(runIdOrPlan));
845
- } catch {}
846
- try {
847
- const artifact = await readWorkflowRunArtifact(workspace, runIdOrPlan);
848
- return loadFromArtifact(artifact, runIdOrPlan);
849
- } catch (error) {
850
- const message = `Could not read workflow validation source: ${runIdOrPlan}. ${error instanceof Error ? error.message : ""}`;
851
- return unreadable("workflow-validation-source-read-failed", message.trim());
852
- }
853
- }
854
- }
855
-
856
- export { WorkflowRunner };