@akanjs/cli 3.0.0-beta.2 → 3.0.0-beta.21
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.
- package/.build-stamp +1 -1
- package/CodeAgent-q2m47rqp.js +9 -0
- package/CodeAgentRpcHost-p7h6n2hp.js +7 -0
- package/CodeAgentRpcListener-7p7z5dd7.js +97 -0
- package/CodeTui-pdqhc3sn.js +1457 -0
- package/README.md +3 -0
- package/TunnelShare-scf4e4pd.js +9 -0
- package/{agent.command-d2gfxfck.js → agent.command-ttn09rx3.js} +8 -9
- package/akanCode.js +102 -0
- package/application.command-7gweenv7.js +179 -0
- package/{applicationBuildRunner-kxwbssgn.js → applicationBuildRunner-38exmejd.js} +63 -64
- package/buildBatch.proc.js +26 -25
- package/cloud.command-bhztw7c2.js +95 -0
- package/cloud.script-aabyhgba.js +20 -0
- package/code.command-6s8c0k91.js +154 -0
- package/commandManifest.json +1 -1
- package/consoleToStderr-h5bryj94.js +7 -0
- package/context.command-phmgywt2.js +48 -0
- package/context.runner-yvyw5g2d.js +21 -0
- package/{dependencyScanner-shs82ynp.js → dependencyScanner-ye2e6pdz.js} +2 -2
- package/{devTui-40ggmd99.js → devTui-q7k7bakd.js} +122 -40
- package/fileSys-5ngz93ga.js +9 -0
- package/guideline.command-7jk47fgq.js +42 -0
- package/guidelines/agentRule/agentRule.instruction.md +209 -28
- package/guidelines/conventions/conventions.instruction.md +96 -29
- package/guidelines/fieldRule/fieldRule.instruction.md +1 -0
- package/guidelines/mcpRule/mcpRule.instruction.md +7 -5
- package/guidelines/queryRule/queryRule.instruction.md +17 -7
- package/guidelines/runtimeRule/runtimeRule.instruction.md +77 -3
- package/guidelines/ssrRule/ssrRule.instruction.md +4 -2
- package/guidelines/transportRule/transportRule.instruction.md +51 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +66 -3
- package/incrementalBuilder.proc.js +31 -48
- package/{index-h7yw2z9n.js → index-0bq14vr1.js} +8 -14
- package/{index-259dsnz3.js → index-1db2cw0y.js} +5 -8
- package/index-22d57v4c.js +266 -0
- package/index-3hx1z96c.js +87 -0
- package/{index-kcxmv48c.js → index-3t7g9e4r.js} +45 -79
- package/{index-ne2qy0nk.js → index-4dn1p115.js} +12 -12
- package/{index-q0y2jq9j.js → index-5b6tavv3.js} +6 -3
- package/index-7cqjvraf.js +69 -0
- package/index-7md2g9vw.js +6 -0
- package/{index-zry5nz81.js → index-8kb5p54p.js} +51 -30
- package/{index-ktb5njgy.js → index-9629w7ns.js} +49 -99
- package/index-9dp031by.js +12 -0
- package/{index-a64esmtb.js → index-aadpbnt2.js} +172 -308
- package/{index-3d9y066c.js → index-bjwxs904.js} +9 -8
- package/index-c6eggbee.js +123 -0
- package/index-d0arnrm8.js +700 -0
- package/index-d2242ksy.js +99 -0
- package/{index-600zhnve.js → index-dg97qp24.js} +70 -200
- package/{index-92zztqy1.js → index-dy0jx9ay.js} +2 -17
- package/{index-w8kmx1b6.js → index-fgq75haa.js} +198 -290
- package/{index-2tv3fdx4.js → index-ga6hygxr.js} +944 -1333
- package/{index-by5gpp8x.js → index-hj6w4ka1.js} +2 -1
- package/index-hr5n7t4x.js +465 -0
- package/{index-hwkygn9s.js → index-khpfpcsd.js} +302 -33
- package/{index-7737gxcp.js → index-m0ms3n1c.js} +107 -241
- package/{index-ws5e0j51.js → index-mgfx3mfs.js} +43 -26
- package/index-p6pbz9n5.js +25 -0
- package/index-pp54p5zk.js +53 -0
- package/{index-j9yhg404.js → index-q44jbw48.js} +4 -7
- package/{index-mak3cd28.js → index-rmcw8yc8.js} +137 -255
- package/{index-pnqbkf5p.js → index-rnt66vym.js} +6 -2
- package/index-smme4r47.js +49 -0
- package/index-tgjy8xf3.js +187 -0
- package/index-v5eayqqw.js +2729 -0
- package/index-wa5jbxj1.js +760 -0
- package/{index-4edzf1gr.js → index-wp43xrjv.js} +77 -150
- package/{index-fz5q3gd7.js → index-ya5qbmyg.js} +10 -17
- package/index-yjkte9aj.js +1119 -0
- package/{index-gyd220p2.js → index-yy4s1j72.js} +554 -577
- package/{index-v0qh106m.js → index-z50k041j.js} +580 -862
- package/index.js +23 -22
- package/{library.command-nbsky672.js → library.command-ccb1cp92.js} +4 -5
- package/{localRegistry.command-yeq57wjr.js → localRegistry.command-ajb9n87j.js} +23 -42
- package/{module.command-29vqzrh8.js → module.command-5k6h407d.js} +8 -11
- package/{package.command-axv0abmn.js → package.command-e6ntvpez.js} +6 -7
- package/package.json +14 -6
- package/{page.command-vs9s3zrh.js → page.command-v4f90wb8.js} +4 -5
- package/{primitive.command-cbxmqbtc.js → primitive.command-g6km57q5.js} +9 -22
- package/prompter-ptaa3nk0.js +8 -0
- package/{quality.command-gmbs7nws.js → quality.command-de3p36pz.js} +205 -377
- package/{recipeScanner-fpagtgc1.js → recipeScanner-4b69ybe0.js} +1 -1
- package/{repair.command-bqsjptsj.js → repair.command-d3x1javq.js} +11 -35
- package/{routeSourceValidator-apyqw7wk.js → routeSourceValidator-7ycnfz0e.js} +0 -6
- package/{scalar.command-6k1vhe9s.js → scalar.command-7ezrac2b.js} +7 -10
- package/skills/akan-code/SKILL.md +130 -0
- package/skills/akan-debug/SKILL.md +42 -0
- package/skills/akan-deps/SKILL.md +50 -0
- package/skills/akan-err/SKILL.md +39 -0
- package/skills/akan-module/SKILL.md +45 -0
- package/skills/akan-scaffold/SKILL.md +76 -0
- package/skills/akan-scalar/SKILL.md +52 -0
- package/skills/akan-service/SKILL.md +34 -0
- package/skills/akan-store/SKILL.md +67 -0
- package/skills/akan-ui/SKILL.md +63 -0
- package/skills/akan-validate/SKILL.md +44 -0
- package/{subspace.command-fwjfcts7.js → subspace.command-ps71ynp6.js} +138 -67
- package/templates/__scalar/__model__/__model__.abstract.md.template +8 -0
- package/templates/appSample/lib/__scalar/workHistory/workHistory.abstract.ts +8 -39
- package/templates/appSample/lib/_noti/noti.abstract.ts +6 -29
- package/templates/appSample/lib/task/task.abstract.ts +12 -32
- package/templates/appSample/lib/task/task.signal.spec.ts +15 -18
- package/templates/appSample/lib/task/task.signal.test.ts +15 -1
- package/templates/appSample/lib/task/task.signal.ts +1 -1
- package/templates/appSample/srvkit/{AuthGuard.ts → guards.ts} +7 -4
- package/templates/appSample/srvkit/{SessionInternalArg.ts → internalArgs.ts} +6 -4
- package/templates/client.ts +7 -30
- package/templates/crudPages/[__model__Id]/edit/page.tsx +2 -1
- package/templates/crudPages/[__model__Id]/page.tsx +2 -1
- package/templates/crudPages/new/page.tsx +2 -1
- package/templates/crudPages/page.tsx +2 -1
- package/templates/crudSinglePage/page.tsx +2 -1
- package/templates/lib/__lib/lib.dictionary.ts +0 -2
- package/templates/lib/__lib/lib.document.ts +0 -2
- package/templates/lib/sig.ts +8 -30
- package/templates/localDev/docker-compose.yaml.template +3 -14
- package/templates/module/__model__.signal.ts +12 -4
- package/templates/pkgRoot/tsconfig.json.template +2 -7
- package/templates/server.ts +0 -2
- package/templates/service/__model__.abstract.md.template +8 -0
- package/templates/workspaceRoot/.gitignore.template +0 -1
- package/tunnel.command-hsrv2mny.js +129 -0
- package/{typeChecker-3xgrzc2v.js → typeChecker-px49mezc.js} +1 -1
- package/typecheck.proc.js +1 -1
- package/workflow.command-z2p32nmf.js +79 -0
- package/{workspace.command-8s050m0h.js → workspace.command-tmdqkrh0.js} +77 -109
- package/abstractCompactor-mjh5ppsq.js +0 -101
- package/application.command-pj2m7584.js +0 -204
- package/applicationReleasePackager-4yasxwv9.js +0 -244
- package/capacitorApp-36rbr858.js +0 -12
- package/cloud.command-jshwdq22.js +0 -93
- package/context.command-ez8a0zyz.js +0 -80
- package/devTuiView-c08ccbat.js +0 -9
- package/getDirname-dr3jz1xg.js +0 -7
- package/guideline.command-xmqwx8zm.js +0 -359
- package/guidelines/agentRule/agentRule.generate.json +0 -31
- package/guidelines/componentRule/componentRule.generate.json +0 -31
- package/guidelines/conventions/conventions.generate.json +0 -25
- package/guidelines/cssRule/cssRule.generate.json +0 -31
- package/guidelines/docPageRule/docPageRule.generate.json +0 -31
- package/guidelines/docPageRule/docPageRule.instruction.md +0 -25
- package/guidelines/docSyncRule/docSyncRule.generate.json +0 -31
- package/guidelines/docSyncRule/docSyncRule.instruction.md +0 -25
- package/guidelines/enumConstant/enumConstant.generate.json +0 -31
- package/guidelines/enumConstant/enumConstant.instruction.md +0 -28
- package/guidelines/fieldRule/fieldRule.generate.json +0 -31
- package/guidelines/framework/framework.generate.json +0 -32
- package/guidelines/mcpRule/mcpRule.generate.json +0 -35
- package/guidelines/modelConstant/modelConstant.generate.json +0 -32
- package/guidelines/modelDictionary/modelDictionary.generate.json +0 -32
- package/guidelines/modelDocument/modelDocument.generate.json +0 -31
- package/guidelines/modelService/modelService.generate.json +0 -31
- package/guidelines/modelSignal/modelSignal.generate.json +0 -31
- package/guidelines/modelStore/modelStore.generate.json +0 -31
- package/guidelines/modelTemplate/modelTemplate.generate.json +0 -31
- package/guidelines/modelUnit/modelUnit.generate.json +0 -31
- package/guidelines/modelUtil/modelUtil.generate.json +0 -31
- package/guidelines/modelView/modelView.generate.json +0 -31
- package/guidelines/modelZone/modelZone.generate.json +0 -31
- package/guidelines/moduleCodegen/moduleCodegen.generate.json +0 -31
- package/guidelines/moduleCodegen/moduleCodegen.instruction.md +0 -28
- package/guidelines/moduleOverview/moduleOverview.generate.json +0 -31
- package/guidelines/queryRule/queryRule.generate.json +0 -31
- package/guidelines/recipeRule/recipeRule.generate.json +0 -31
- package/guidelines/runtimeRule/runtimeRule.generate.json +0 -25
- package/guidelines/scalarConstant/scalarConstant.generate.json +0 -32
- package/guidelines/scalarDictionary/scalarDictionary.generate.json +0 -32
- package/guidelines/scalarModule/scalarModule.generate.json +0 -31
- package/guidelines/sharedUiUsage/sharedUiUsage.generate.json +0 -31
- package/guidelines/sharedUiUsage/sharedUiUsage.instruction.md +0 -25
- package/guidelines/ssrRule/ssrRule.generate.json +0 -31
- package/guidelines/transportRule/transportRule.generate.json +0 -31
- package/guidelines/utilUiUsage/utilUiUsage.generate.json +0 -31
- package/guidelines/utilUiUsage/utilUiUsage.instruction.md +0 -25
- package/guidelines/workspaceOnboarding/workspaceOnboarding.generate.json +0 -24
- package/guidelines/workspaceRecipes/workspaceRecipes.generate.json +0 -33
- package/index-2hq52jq3.js +0 -465
- package/index-47pj3aee.js +0 -76
- package/index-6wwzs1bc.js +0 -7
- package/index-8pm30m73.js +0 -841
- package/index-kn1h7p1x.js +0 -560
- package/index-meh558jy.js +0 -65
- package/index-rwg2aa4f.js +0 -229
- package/index-wt7qrtd4.js +0 -1516
- package/templates/__scalar/__model__/__model__.abstract.md +0 -28
- package/templates/module/__model__.abstract.md +0 -28
- package/templates/service/__model__.abstract.md +0 -28
- package/workflow.command-nwpcdc8p.js +0 -107
|
@@ -4,11 +4,13 @@ import {
|
|
|
4
4
|
workflowPlanApproval,
|
|
5
5
|
createWorkflowApplyReport,
|
|
6
6
|
workflowCommandsForPlan,
|
|
7
|
+
workflowPathsForPlan,
|
|
7
8
|
writeWorkflowRunArtifact,
|
|
8
9
|
readWorkflowRunArtifact,
|
|
9
10
|
createWorkflowBaselineSummary,
|
|
10
11
|
createWorkflowValidationRunReport,
|
|
11
12
|
createDryRunWorkflowApplyReport,
|
|
13
|
+
createWorkflowStepRegistry,
|
|
12
14
|
WorkflowExecutor,
|
|
13
15
|
listWorkflowSpecs,
|
|
14
16
|
getWorkflowSpec,
|
|
@@ -20,18 +22,31 @@ import {
|
|
|
20
22
|
renderWorkflowApply,
|
|
21
23
|
renderWorkflowValidation,
|
|
22
24
|
renderWorkflowRunArtifact
|
|
23
|
-
} from "./index-
|
|
25
|
+
} from "./index-yy4s1j72.js";
|
|
24
26
|
import {
|
|
25
27
|
AkanContextAnalyzer
|
|
26
|
-
} from "./index-
|
|
28
|
+
} from "./index-9629w7ns.js";
|
|
27
29
|
import {
|
|
30
|
+
CommandContainer,
|
|
28
31
|
runner
|
|
29
|
-
} from "./index-
|
|
32
|
+
} from "./index-rmcw8yc8.js";
|
|
33
|
+
import {
|
|
34
|
+
ModuleScript
|
|
35
|
+
} from "./index-tgjy8xf3.js";
|
|
36
|
+
import {
|
|
37
|
+
PrimitiveScript
|
|
38
|
+
} from "./index-wp43xrjv.js";
|
|
39
|
+
import {
|
|
40
|
+
spawnShell
|
|
41
|
+
} from "./index-ya5qbmyg.js";
|
|
42
|
+
import {
|
|
43
|
+
ScalarScript
|
|
44
|
+
} from "./index-pp54p5zk.js";
|
|
30
45
|
|
|
31
46
|
// pkgs/@akanjs/cli/workflow/workflow.runner.ts
|
|
32
47
|
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
33
48
|
import path from "path";
|
|
34
|
-
import {
|
|
49
|
+
import { isRecord } from "akanjs/common";
|
|
35
50
|
|
|
36
51
|
// pkgs/@akanjs/cli/workflows/shared.ts
|
|
37
52
|
var sysInputs = {
|
|
@@ -56,6 +71,12 @@ var baseValidation = [
|
|
|
56
71
|
kind: "lint"
|
|
57
72
|
}
|
|
58
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.");
|
|
59
80
|
|
|
60
81
|
// pkgs/@akanjs/cli/workflows/addEnumField.ts
|
|
61
82
|
var addEnumFieldWorkflowSpec = {
|
|
@@ -79,12 +100,7 @@ var addEnumFieldWorkflowSpec = {
|
|
|
79
100
|
store: "infer"
|
|
80
101
|
},
|
|
81
102
|
steps: [
|
|
82
|
-
|
|
83
|
-
id: "inspect-module",
|
|
84
|
-
title: "Inspect module",
|
|
85
|
-
tool: "inspectModule",
|
|
86
|
-
description: "Read module files and existing enum conventions."
|
|
87
|
-
},
|
|
103
|
+
inspectModuleStep("Read module files and existing enum conventions."),
|
|
88
104
|
{
|
|
89
105
|
id: "update-constant",
|
|
90
106
|
title: "Update enum field",
|
|
@@ -103,18 +119,8 @@ var addEnumFieldWorkflowSpec = {
|
|
|
103
119
|
tool: "updateOptionEnum",
|
|
104
120
|
description: "Plan option entries used by UI controls."
|
|
105
121
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
title: "Sync generated files",
|
|
109
|
-
tool: "syncTarget",
|
|
110
|
-
description: "Refresh generated files after enum source changes."
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
id: "validate-target",
|
|
114
|
-
title: "Validate target",
|
|
115
|
-
tool: "lintTarget",
|
|
116
|
-
description: "Run validation commands for the target."
|
|
117
|
-
}
|
|
122
|
+
syncGeneratedStep("Refresh generated files after enum source changes."),
|
|
123
|
+
validateTarget
|
|
118
124
|
],
|
|
119
125
|
predictedChanges: [
|
|
120
126
|
{ target: "*/lib/<module>/<module>.constant.ts", action: "modify", reason: "Enum field shape is added." },
|
|
@@ -146,7 +152,7 @@ var addFieldWorkflowSpec = {
|
|
|
146
152
|
values: { type: "string-list", description: "Comma-separated enum values when type is enum." },
|
|
147
153
|
default: {
|
|
148
154
|
type: "string",
|
|
149
|
-
description: "Optional default value. plan/apply coerce by field type: Int/Float to numeric literals, Boolean to true/false, Date to
|
|
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."
|
|
150
156
|
},
|
|
151
157
|
surfaces: {
|
|
152
158
|
type: "string-list",
|
|
@@ -165,12 +171,7 @@ var addFieldWorkflowSpec = {
|
|
|
165
171
|
store: "infer"
|
|
166
172
|
},
|
|
167
173
|
steps: [
|
|
168
|
-
|
|
169
|
-
id: "inspect-module",
|
|
170
|
-
title: "Inspect module",
|
|
171
|
-
tool: "inspectModule",
|
|
172
|
-
description: "Read module files and detect existing field/UI patterns."
|
|
173
|
-
},
|
|
174
|
+
inspectModuleStep("Read module files and detect existing field/UI patterns."),
|
|
174
175
|
{
|
|
175
176
|
id: "update-constant",
|
|
176
177
|
title: "Update constant",
|
|
@@ -190,18 +191,8 @@ var addFieldWorkflowSpec = {
|
|
|
190
191
|
description: "Plan optional Template, Unit, View, and Store updates according to inferred surfaces.",
|
|
191
192
|
when: "optionalSurfaces.* is include or infer"
|
|
192
193
|
},
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
title: "Sync generated files",
|
|
196
|
-
tool: "syncTarget",
|
|
197
|
-
description: "Refresh generated files after source changes."
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
id: "validate-target",
|
|
201
|
-
title: "Validate target",
|
|
202
|
-
tool: "lintTarget",
|
|
203
|
-
description: "Run validation commands for the target."
|
|
204
|
-
}
|
|
194
|
+
syncGeneratedStep("Refresh generated files after source changes."),
|
|
195
|
+
validateTarget
|
|
205
196
|
],
|
|
206
197
|
predictedChanges: [
|
|
207
198
|
{
|
|
@@ -272,12 +263,7 @@ var addMutationWorkflowSpec = {
|
|
|
272
263
|
dictionary: "include"
|
|
273
264
|
},
|
|
274
265
|
steps: [
|
|
275
|
-
|
|
276
|
-
id: "inspect-module",
|
|
277
|
-
title: "Inspect module",
|
|
278
|
-
tool: "inspectModule",
|
|
279
|
-
description: "Read service, signal, store, and UI action patterns."
|
|
280
|
-
},
|
|
266
|
+
inspectModuleStep("Read service, signal, store, and UI action patterns."),
|
|
281
267
|
{
|
|
282
268
|
id: "update-service",
|
|
283
269
|
title: "Update service",
|
|
@@ -296,18 +282,8 @@ var addMutationWorkflowSpec = {
|
|
|
296
282
|
tool: "updateActionSurfaces",
|
|
297
283
|
description: "Plan optional store and UI action changes."
|
|
298
284
|
},
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
title: "Sync generated files",
|
|
302
|
-
tool: "syncTarget",
|
|
303
|
-
description: "Refresh generated service and signal barrels."
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
id: "validate-target",
|
|
307
|
-
title: "Validate target",
|
|
308
|
-
tool: "lintTarget",
|
|
309
|
-
description: "Run validation commands for the target."
|
|
310
|
-
}
|
|
285
|
+
syncGeneratedStep("Refresh generated service and signal barrels."),
|
|
286
|
+
validateTarget
|
|
311
287
|
],
|
|
312
288
|
predictedChanges: [
|
|
313
289
|
{
|
|
@@ -355,12 +331,7 @@ var addSliceWorkflowSpec = {
|
|
|
355
331
|
dictionary: "include"
|
|
356
332
|
},
|
|
357
333
|
steps: [
|
|
358
|
-
|
|
359
|
-
id: "inspect-module",
|
|
360
|
-
title: "Inspect module",
|
|
361
|
-
tool: "inspectModule",
|
|
362
|
-
description: "Read existing query, slice, zone, and page loading patterns."
|
|
363
|
-
},
|
|
334
|
+
inspectModuleStep("Read existing query, slice, zone, and page loading patterns."),
|
|
364
335
|
{
|
|
365
336
|
id: "update-service-query",
|
|
366
337
|
title: "Update service query",
|
|
@@ -379,18 +350,8 @@ var addSliceWorkflowSpec = {
|
|
|
379
350
|
tool: "connectSliceSurfaces",
|
|
380
351
|
description: "Plan optional Zone and page loader changes."
|
|
381
352
|
},
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
title: "Sync generated files",
|
|
385
|
-
tool: "syncTarget",
|
|
386
|
-
description: "Refresh generated files after slice changes."
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
id: "validate-target",
|
|
390
|
-
title: "Validate target",
|
|
391
|
-
tool: "lintTarget",
|
|
392
|
-
description: "Run validation commands for the target."
|
|
393
|
-
}
|
|
353
|
+
syncGeneratedStep("Refresh generated files after slice changes."),
|
|
354
|
+
validateTarget
|
|
394
355
|
],
|
|
395
356
|
predictedChanges: [
|
|
396
357
|
{
|
|
@@ -445,30 +406,15 @@ var createModuleWorkflowSpec = {
|
|
|
445
406
|
view: "include"
|
|
446
407
|
},
|
|
447
408
|
steps: [
|
|
448
|
-
|
|
449
|
-
id: "inspect-system",
|
|
450
|
-
title: "Inspect target system",
|
|
451
|
-
tool: "inspectSystem",
|
|
452
|
-
description: "Check the target app or library before planning new module files."
|
|
453
|
-
},
|
|
409
|
+
inspectSystemStep("Check the target app or library before planning new module files."),
|
|
454
410
|
{
|
|
455
411
|
id: "create-module",
|
|
456
412
|
title: "Create module",
|
|
457
413
|
tool: "createModule",
|
|
458
414
|
description: "Use the existing create-module primitive to scaffold conventional module files."
|
|
459
415
|
},
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
title: "Sync generated files",
|
|
463
|
-
tool: "syncTarget",
|
|
464
|
-
description: "Refresh generated barrels after adding a module."
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
id: "validate-target",
|
|
468
|
-
title: "Validate target",
|
|
469
|
-
tool: "lintTarget",
|
|
470
|
-
description: "Run validation commands that prove the scaffold matches Akan conventions."
|
|
471
|
-
}
|
|
416
|
+
syncGeneratedStep("Refresh generated barrels after adding a module."),
|
|
417
|
+
validateTargetStep("Run validation commands that prove the scaffold matches Akan conventions.")
|
|
472
418
|
],
|
|
473
419
|
predictedChanges: [
|
|
474
420
|
{ target: "*/lib/<module>/*", action: "create", reason: "New module source files are scaffolded." },
|
|
@@ -498,30 +444,15 @@ var createScalarWorkflowSpec = {
|
|
|
498
444
|
dictionary: "include"
|
|
499
445
|
},
|
|
500
446
|
steps: [
|
|
501
|
-
|
|
502
|
-
id: "inspect-system",
|
|
503
|
-
title: "Inspect target system",
|
|
504
|
-
tool: "inspectSystem",
|
|
505
|
-
description: "Check the target app or library before planning a scalar."
|
|
506
|
-
},
|
|
447
|
+
inspectSystemStep("Check the target app or library before planning a scalar."),
|
|
507
448
|
{
|
|
508
449
|
id: "create-scalar",
|
|
509
450
|
title: "Create scalar",
|
|
510
451
|
tool: "createScalar",
|
|
511
452
|
description: "Use the existing create-scalar primitive to scaffold scalar files."
|
|
512
453
|
},
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
title: "Sync generated files",
|
|
516
|
-
tool: "syncTarget",
|
|
517
|
-
description: "Refresh generated barrels after adding a scalar."
|
|
518
|
-
},
|
|
519
|
-
{
|
|
520
|
-
id: "validate-target",
|
|
521
|
-
title: "Validate target",
|
|
522
|
-
tool: "lintTarget",
|
|
523
|
-
description: "Run validation commands for the scalar target."
|
|
524
|
-
}
|
|
454
|
+
syncGeneratedStep("Refresh generated barrels after adding a scalar."),
|
|
455
|
+
validateTargetStep("Run validation commands for the scalar target.")
|
|
525
456
|
],
|
|
526
457
|
predictedChanges: [
|
|
527
458
|
{ target: "*/lib/__scalar/<scalar>/*", action: "create", reason: "New scalar source files are scaffolded." }
|
|
@@ -551,30 +482,15 @@ var createUiWorkflowSpec = {
|
|
|
551
482
|
store: "infer"
|
|
552
483
|
},
|
|
553
484
|
steps: [
|
|
554
|
-
|
|
555
|
-
id: "inspect-module",
|
|
556
|
-
title: "Inspect module",
|
|
557
|
-
tool: "inspectModule",
|
|
558
|
-
description: "Read existing module context and component files."
|
|
559
|
-
},
|
|
485
|
+
inspectModuleStep("Read existing module context and component files."),
|
|
560
486
|
{
|
|
561
487
|
id: "create-ui",
|
|
562
488
|
title: "Create UI surface",
|
|
563
489
|
tool: "createUi",
|
|
564
490
|
description: "Create the requested UI surface through an Akan primitive."
|
|
565
491
|
},
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
title: "Sync generated files",
|
|
569
|
-
tool: "syncTarget",
|
|
570
|
-
description: "Refresh UI barrels after adding a component."
|
|
571
|
-
},
|
|
572
|
-
{
|
|
573
|
-
id: "validate-target",
|
|
574
|
-
title: "Validate target",
|
|
575
|
-
tool: "lintTarget",
|
|
576
|
-
description: "Run validation commands for the target."
|
|
577
|
-
}
|
|
492
|
+
syncGeneratedStep("Refresh UI barrels after adding a component."),
|
|
493
|
+
validateTarget
|
|
578
494
|
],
|
|
579
495
|
predictedChanges: [
|
|
580
496
|
{ target: "*/lib/<module>/<Module>.<Surface>.tsx", action: "create", reason: "New UI component is created." },
|
|
@@ -597,7 +513,6 @@ var workflowSpecs = [
|
|
|
597
513
|
|
|
598
514
|
// pkgs/@akanjs/cli/workflow/workflow.runner.ts
|
|
599
515
|
var resolvePath = (filePath) => path.isAbsolute(filePath) ? filePath : path.join(process.cwd(), filePath);
|
|
600
|
-
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
601
516
|
var isWorkflowPlan = (value) => {
|
|
602
517
|
if (!isRecord(value))
|
|
603
518
|
return false;
|
|
@@ -627,17 +542,19 @@ var failedPlan = (workflow, diagnostics) => ({
|
|
|
627
542
|
requiresApproval: true,
|
|
628
543
|
approval: workflowPlanApproval
|
|
629
544
|
});
|
|
630
|
-
var failedApplyReport = (workflow,
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
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
|
+
};
|
|
641
558
|
var inferValidationKind = (command) => {
|
|
642
559
|
if (command.kind)
|
|
643
560
|
return command.kind;
|
|
@@ -667,25 +584,13 @@ ${error.message ?? ""}`.toLowerCase();
|
|
|
667
584
|
return "unknown";
|
|
668
585
|
};
|
|
669
586
|
var defaultValidationExecutor = (workspace) => async (command) => {
|
|
670
|
-
const
|
|
587
|
+
const base = { command: command.command, reason: command.reason, kind: inferValidationKind(command) };
|
|
671
588
|
try {
|
|
672
|
-
|
|
673
|
-
cwd: workspace.workspaceRoot
|
|
674
|
-
});
|
|
675
|
-
return {
|
|
676
|
-
command: command.command,
|
|
677
|
-
reason: command.reason,
|
|
678
|
-
kind,
|
|
679
|
-
status: "passed",
|
|
680
|
-
exitCode: 0,
|
|
681
|
-
stdout
|
|
682
|
-
};
|
|
589
|
+
return { ...base, status: "passed", exitCode: 0, stdout: await spawnShell(workspace, command.command) };
|
|
683
590
|
} catch (error) {
|
|
684
591
|
const commandError = error;
|
|
685
592
|
return {
|
|
686
|
-
|
|
687
|
-
reason: command.reason,
|
|
688
|
-
kind,
|
|
593
|
+
...base,
|
|
689
594
|
status: "failed",
|
|
690
595
|
exitCode: commandError.code ?? 1,
|
|
691
596
|
failureScope: classifyValidationFailure(command, commandError),
|
|
@@ -695,24 +600,17 @@ var defaultValidationExecutor = (workspace) => async (command) => {
|
|
|
695
600
|
}
|
|
696
601
|
};
|
|
697
602
|
var readJsonFile = async (filePath) => JSON.parse(await readFile(resolvePath(filePath), "utf8"));
|
|
698
|
-
var
|
|
699
|
-
|
|
700
|
-
|
|
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 };
|
|
701
613
|
};
|
|
702
|
-
var workflowPathsForPlanLike = (plan) => {
|
|
703
|
-
const app = planInputString(plan, "app");
|
|
704
|
-
const module = planInputString(plan, "module");
|
|
705
|
-
const moduleClass = module ? capitalize(module) : "<Module>";
|
|
706
|
-
return plan.predictedChanges.map((change) => change.target.replace(/^\*\//, app ? `apps/${app}/` : "").replaceAll("<module>", module || "<module>").replaceAll("<Module>", moduleClass));
|
|
707
|
-
};
|
|
708
|
-
var workflowDiagnosticFromDoctor = (diagnostic, fallbackScope) => ({
|
|
709
|
-
severity: diagnostic.severity,
|
|
710
|
-
code: diagnostic.code,
|
|
711
|
-
message: diagnostic.message,
|
|
712
|
-
scope: diagnostic.scope ?? fallbackScope,
|
|
713
|
-
failureScope: (diagnostic.scope ?? fallbackScope) === "baseline" ? "workspace-config" : (diagnostic.scope ?? fallbackScope) === "workflow" ? "source-change" : "unknown",
|
|
714
|
-
context: diagnostic.context
|
|
715
|
-
});
|
|
716
614
|
var baselineBlockerCachePath = (workflow) => `.akan/workflows/baseline/${workflow}.json`;
|
|
717
615
|
var blockerFingerprint = (blocker) => [blocker.failureScope, blocker.code, blocker.command ?? "", blocker.kind ?? "", blocker.message].join("|");
|
|
718
616
|
var applyBaselineBlockerCache = async (workspace, report) => {
|
|
@@ -768,6 +666,18 @@ var withBaselineDetailsPolicy = (report, includeBaselineDetails) => {
|
|
|
768
666
|
};
|
|
769
667
|
|
|
770
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
|
+
}
|
|
771
681
|
list({ format = "markdown" } = {}) {
|
|
772
682
|
const workflows = listWorkflowSpecs(workflowSpecs);
|
|
773
683
|
if (format === "json")
|
|
@@ -809,50 +719,24 @@ class WorkflowRunner extends runner("workflow") {
|
|
|
809
719
|
};
|
|
810
720
|
let plan;
|
|
811
721
|
try {
|
|
812
|
-
const parsed =
|
|
813
|
-
if (!isWorkflowPlan(parsed))
|
|
814
|
-
|
|
815
|
-
{
|
|
816
|
-
severity: "error",
|
|
817
|
-
code: "workflow-plan-invalid",
|
|
818
|
-
message: `Workflow plan file is invalid: ${planPath}.`
|
|
819
|
-
}
|
|
820
|
-
]);
|
|
821
|
-
return await renderApplyReport(report);
|
|
822
|
-
}
|
|
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}.`));
|
|
823
725
|
plan = parsed;
|
|
824
726
|
} catch (error) {
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
severity: "error",
|
|
828
|
-
code: "workflow-plan-read-failed",
|
|
829
|
-
message: `Could not read workflow plan file: ${planPath}. ${error instanceof Error ? error.message : ""}`.trim()
|
|
830
|
-
}
|
|
831
|
-
]);
|
|
832
|
-
return await renderApplyReport(report);
|
|
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()));
|
|
833
729
|
}
|
|
834
730
|
const spec = getWorkflowSpec(workflowSpecs, plan.workflow);
|
|
835
731
|
if (!spec) {
|
|
836
|
-
const
|
|
837
|
-
|
|
838
|
-
severity: "error",
|
|
839
|
-
code: "workflow-unknown",
|
|
840
|
-
message: `Unknown workflow in plan: ${plan.workflow}.`
|
|
841
|
-
}
|
|
842
|
-
], plan);
|
|
843
|
-
return await renderApplyReport(report);
|
|
732
|
+
const message = `Unknown workflow in plan: ${plan.workflow}.`;
|
|
733
|
+
return await renderApplyReport(failedApplyReport(plan.workflow, "workflow-unknown", message, plan));
|
|
844
734
|
}
|
|
845
735
|
if (dryRun)
|
|
846
736
|
return await renderApplyReport(createDryRunWorkflowApplyReport(plan));
|
|
847
737
|
if (!registry) {
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
severity: "error",
|
|
851
|
-
code: "workflow-registry-missing",
|
|
852
|
-
message: "Workflow apply requires a step runner registry."
|
|
853
|
-
}
|
|
854
|
-
], plan);
|
|
855
|
-
return await renderApplyReport(report);
|
|
738
|
+
const message = "Workflow apply requires a step runner registry.";
|
|
739
|
+
return await renderApplyReport(failedApplyReport(plan.workflow, "workflow-registry-missing", message, plan));
|
|
856
740
|
}
|
|
857
741
|
return await renderApplyReport(await new WorkflowExecutor(registry, workspace).apply(plan));
|
|
858
742
|
}
|
|
@@ -909,6 +793,15 @@ class WorkflowRunner extends runner("workflow") {
|
|
|
909
793
|
}
|
|
910
794
|
}
|
|
911
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
|
+
});
|
|
912
805
|
const loadFromArtifact = (artifact, sourcePath) => {
|
|
913
806
|
if (isWorkflowApplyReport(artifact)) {
|
|
914
807
|
return {
|
|
@@ -932,21 +825,7 @@ class WorkflowRunner extends runner("workflow") {
|
|
|
932
825
|
repairActions: artifact.repairActions
|
|
933
826
|
};
|
|
934
827
|
}
|
|
935
|
-
return {
|
|
936
|
-
workflow: "unknown",
|
|
937
|
-
source: { type: "run-report", runId: runIdOrPlan },
|
|
938
|
-
plan: undefined,
|
|
939
|
-
commands: [],
|
|
940
|
-
diagnostics: [
|
|
941
|
-
{
|
|
942
|
-
severity: "error",
|
|
943
|
-
code: "workflow-validation-source-unsupported",
|
|
944
|
-
message: `Workflow validation source is not supported: ${runIdOrPlan}.`
|
|
945
|
-
}
|
|
946
|
-
],
|
|
947
|
-
changedFiles: [],
|
|
948
|
-
repairActions: []
|
|
949
|
-
};
|
|
828
|
+
return unreadable("workflow-validation-source-unsupported", `Workflow validation source is not supported: ${runIdOrPlan}.`);
|
|
950
829
|
};
|
|
951
830
|
try {
|
|
952
831
|
const parsed = await readJsonFile(runIdOrPlan);
|
|
@@ -957,7 +836,7 @@ class WorkflowRunner extends runner("workflow") {
|
|
|
957
836
|
plan: parsed,
|
|
958
837
|
commands: workflowCommandsForPlan(parsed),
|
|
959
838
|
diagnostics: parsed.diagnostics,
|
|
960
|
-
changedFiles:
|
|
839
|
+
changedFiles: workflowPathsForPlan(parsed),
|
|
961
840
|
repairActions: []
|
|
962
841
|
};
|
|
963
842
|
}
|
|
@@ -968,21 +847,8 @@ class WorkflowRunner extends runner("workflow") {
|
|
|
968
847
|
const artifact = await readWorkflowRunArtifact(workspace, runIdOrPlan);
|
|
969
848
|
return loadFromArtifact(artifact, runIdOrPlan);
|
|
970
849
|
} catch (error) {
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
source: { type: "run-report", runId: runIdOrPlan },
|
|
974
|
-
plan: undefined,
|
|
975
|
-
commands: [],
|
|
976
|
-
diagnostics: [
|
|
977
|
-
{
|
|
978
|
-
severity: "error",
|
|
979
|
-
code: "workflow-validation-source-read-failed",
|
|
980
|
-
message: `Could not read workflow validation source: ${runIdOrPlan}. ${error instanceof Error ? error.message : ""}`.trim()
|
|
981
|
-
}
|
|
982
|
-
],
|
|
983
|
-
changedFiles: [],
|
|
984
|
-
repairActions: []
|
|
985
|
-
};
|
|
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());
|
|
986
852
|
}
|
|
987
853
|
}
|
|
988
854
|
}
|