@akanjs/cli 3.0.0-beta.8 → 3.0.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.
- package/.build-stamp +1 -1
- package/CodeAgent-2vmp9qe0.js +9 -0
- package/CodeAgentRpcHost-p7h6n2hp.js +7 -0
- package/CodeAgentRpcListener-7p7z5dd7.js +97 -0
- package/CodeTui-5ed6bg2a.js +1457 -0
- package/README.ko.md +83 -28
- package/README.md +70 -27
- package/TunnelShare-cwh9ezsm.js +9 -0
- package/{agent.command-0q17pnrs.js → agent.command-gn73rhe7.js} +8 -9
- package/akanCode.js +102 -0
- package/application.command-e968t0hw.js +246 -0
- package/{applicationBuildRunner-kxwbssgn.js → applicationBuildRunner-64taxseg.js} +121 -77
- package/buildBatch.proc.js +120 -32
- package/cloud.command-0jm301rr.js +95 -0
- package/cloud.script-nemnzjpv.js +20 -0
- package/code.command-18kcm7hq.js +154 -0
- package/commandManifest.json +1 -1
- package/consoleToStderr-h5bryj94.js +7 -0
- package/context.command-trd9bn18.js +48 -0
- package/context.runner-y5hwh673.js +21 -0
- package/{dependencyScanner-shs82ynp.js → dependencyScanner-06z2dmrr.js} +2 -2
- package/{devTui-m1atgkc9.js → devTui-q7k7bakd.js} +122 -40
- package/fileSys-wzzrntkw.js +9 -0
- package/guideline.command-bdmdn2de.js +42 -0
- package/guidelines/agentRule/agentRule.instruction.md +154 -26
- package/guidelines/conventions/conventions.instruction.md +134 -48
- package/guidelines/mcpRule/mcpRule.instruction.md +7 -5
- package/guidelines/queryRule/queryRule.instruction.md +21 -7
- package/guidelines/runtimeRule/runtimeRule.instruction.md +291 -6
- package/guidelines/ssrRule/ssrRule.instruction.md +4 -2
- package/guidelines/transportRule/transportRule.instruction.md +10 -8
- package/guidelines/workspaceOnboarding/workspaceOnboarding.instruction.md +20 -0
- package/guidelines/workspaceRecipes/workspaceRecipes.instruction.md +66 -3
- package/incrementalBuilder.proc.js +564 -109
- package/index-0wpybxtr.js +2729 -0
- package/{index-kcxmv48c.js → index-2ahj896a.js} +45 -79
- package/index-2wc41k5w.js +49 -0
- package/index-3hx1z96c.js +87 -0
- package/{index-2tv3fdx4.js → index-3w94e7n3.js} +1228 -1458
- package/{index-hwkygn9s.js → index-48k96p55.js} +325 -36
- package/index-4npz05nm.js +187 -0
- package/{index-q0y2jq9j.js → index-52w0fvh8.js} +21 -4
- package/index-6he6gvfg.js +4300 -0
- package/index-7md2g9vw.js +6 -0
- package/{index-04bk599g.js → index-93j60em0.js} +10 -17
- package/index-94s080qm.js +266 -0
- package/index-9dp031by.js +12 -0
- package/{index-ktb5njgy.js → index-9z771ptz.js} +49 -99
- package/{index-y6n8nmny.js → index-abxpehf8.js} +75 -203
- package/{index-3d9y066c.js → index-bjwxs904.js} +9 -8
- package/{index-9077wzd2.js → index-by9pxkr0.js} +43 -26
- package/index-c6eggbee.js +123 -0
- package/index-d2242ksy.js +99 -0
- package/index-drehwpdt.js +1119 -0
- package/{index-92zztqy1.js → index-dy0jx9ay.js} +2 -17
- package/{index-ffvk10zz.js → index-f3c78nd6.js} +107 -241
- package/index-gbggbqcp.js +1058 -0
- package/{index-by5gpp8x.js → index-hj6w4ka1.js} +2 -1
- package/index-hsmtysz4.js +53 -0
- package/{index-j9yhg404.js → index-jmrn54tt.js} +4 -7
- package/{index-a64esmtb.js → index-kcdj1z5v.js} +523 -1022
- package/{index-d43r08tf.js → index-kqabytj7.js} +77 -150
- package/{index-vyvre9en.js → index-mbxbhay5.js} +6 -2
- package/{index-vxtad5bd.js → index-mgxpx3f2.js} +5 -8
- package/index-p6pbz9n5.js +25 -0
- package/{index-sj5vxr8f.js → index-p993efkq.js} +981 -897
- package/{index-2xp0kfkt.js → index-pmhqttv3.js} +37 -25
- package/index-tqm7jjcn.js +700 -0
- package/{index-0g7r8xz3.js → index-vpj42xwt.js} +114 -232
- package/index-wa5jbxj1.js +760 -0
- package/{index-k2j1hc4r.js → index-wprnsjms.js} +12 -12
- package/{index-gyd220p2.js → index-y3mphr1m.js} +554 -577
- package/index-yg7jhz8x.js +69 -0
- package/{index-h7yw2z9n.js → index-zzvvc845.js} +8 -14
- package/index.js +23 -22
- package/{library.command-qzzbj6d8.js → library.command-9h749a1x.js} +4 -5
- package/{localRegistry.command-vyrgg4xw.js → localRegistry.command-2bqqhxyz.js} +23 -43
- package/{module.command-rq5hq3ax.js → module.command-nv8nzgft.js} +8 -12
- package/{package.command-d9hd6v9n.js → package.command-mq4bggp6.js} +6 -7
- package/package.json +15 -7
- package/{page.command-126d56te.js → page.command-j639n707.js} +4 -5
- package/{primitive.command-taxd1538.js → primitive.command-kz6849th.js} +9 -23
- package/prompter-76k56b37.js +8 -0
- package/{quality.command-6gsna0a3.js → quality.command-4hyabwkb.js} +205 -377
- package/{recipeScanner-fpagtgc1.js → recipeScanner-4b69ybe0.js} +1 -1
- package/{repair.command-tq2dgy72.js → repair.command-a9awpbqr.js} +11 -35
- package/{routeSourceValidator-apyqw7wk.js → routeSourceValidator-7ycnfz0e.js} +0 -6
- package/{scalar.command-3bcmrrkv.js → scalar.command-ma4fpm9m.js} +7 -11
- 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-eddzqpx3.js → subspace.command-3k2pmrs4.js} +53 -62
- package/templates/__scalar/__model__/__model__.abstract.md.template +8 -0
- package/templates/app/page/_index.tsx +257 -258
- package/templates/app/page/_layout.tsx +5 -1
- package/templates/app/page/_overrides.tsx +12 -0
- package/templates/app/page/styles.css.template +316 -14
- package/templates/app/public/apple-touch-icon.png +0 -0
- package/templates/app/public/favicon.ico +0 -0
- package/templates/app/public/jelly/cloud.webp +0 -0
- package/templates/app/public/jelly/comet.webp +0 -0
- package/templates/app/public/jelly/moon.webp +0 -0
- package/templates/app/public/jelly/planet.webp +0 -0
- package/templates/app/public/jelly/rocket.webp +0 -0
- package/templates/app/public/jelly/star.webp +0 -0
- package/templates/app/public/jelly/sugar.webp +0 -0
- package/templates/app/public/logo.png +0 -0
- package/templates/app/ui/Recipe/index.ts +9 -0
- package/templates/app/ui/Recipe/jellyButton.ts +63 -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.Unit.tsx +1 -1
- package/templates/appSample/lib/task/Task.Util.tsx +10 -13
- package/templates/appSample/lib/task/Task.View.tsx +2 -2
- package/templates/appSample/lib/task/Task.Zone.tsx +5 -2
- package/templates/appSample/lib/task/task.abstract.ts +12 -32
- package/templates/appSample/lib/task/task.signal.spec.ts +1 -15
- package/templates/appSample/lib/task/task.signal.test.ts +15 -1
- package/templates/appSample/lib/task/task.signal.ts +10 -8
- package/templates/appSample/page/task/[taskId]/_index.tsx +6 -6
- package/templates/appSample/page/task/[taskId]/edit.tsx +5 -4
- package/templates/appSample/page/task/_index.tsx +4 -3
- package/templates/appSample/page/task/_layout.tsx +1 -1
- package/templates/appSample/page/task/new.tsx +5 -4
- package/templates/appSample/srvkit/{AuthGuard.ts → guards.ts} +7 -4
- package/templates/appSample/srvkit/{SessionInternalArg.ts → internalArgs.ts} +6 -4
- package/templates/appSample/ui/GlobalLoading.tsx +2 -1
- package/templates/appSample/ui/QuantityControl.tsx +3 -3
- 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 +1 -3
- package/templates/service/__model__.abstract.md.template +8 -0
- package/templates/workspaceRoot/.gitignore.template +0 -1
- package/templates/workspaceRoot/AGENTS.md.template +6 -0
- package/templates/workspaceRoot/package.json.template +1 -3
- package/tunnel.command-xwr46b66.js +129 -0
- package/{typeChecker-3xgrzc2v.js → typeChecker-px49mezc.js} +1 -1
- package/typecheck.proc.js +1 -1
- package/workflow.command-t7wqe4h7.js +79 -0
- package/{workspace.command-06wvstgr.js → workspace.command-4derhzrh.js} +79 -109
- package/abstractCompactor-gmkc0z8j.js +0 -102
- package/application.command-18y0s485.js +0 -204
- package/applicationReleasePackager-4yasxwv9.js +0 -244
- package/capacitorApp-36rbr858.js +0 -12
- package/cloud.command-av97ndh6.js +0 -94
- package/cloud.script-cm11xjdz.js +0 -20
- package/context.command-5v37ef3n.js +0 -81
- package/devTuiView-0hc2emhe.js +0 -9
- package/getDirname-dr3jz1xg.js +0 -7
- package/guideline.command-4pz9g1rt.js +0 -360
- 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-47pj3aee.js +0 -76
- package/index-5ystnsd5.js +0 -841
- package/index-6wwzs1bc.js +0 -7
- package/index-a17x49vg.js +0 -229
- package/index-m0xccmmm.js +0 -228
- package/index-meh558jy.js +0 -65
- package/index-rtxxan88.js +0 -471
- package/index-te54x9zm.js +0 -338
- package/index-w8kmx1b6.js +0 -2176
- 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/templates/workspaceRoot/patches/react-dom@19.2.7.patch.template +0 -62
- package/workflow.command-gtdnzvbz.js +0 -108
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AppExecutor,
|
|
4
4
|
LibExecutor
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-3w94e7n3.js";
|
|
6
6
|
|
|
7
7
|
// pkgs/@akanjs/devkit/workflow/utils.ts
|
|
8
8
|
var jsonText = (value, { trailingNewline = true } = {}) => `${JSON.stringify(value, null, 2)}${trailingNewline ? `
|
|
@@ -21,50 +21,8 @@ var uniqueBy = (values, key) => {
|
|
|
21
21
|
};
|
|
22
22
|
var compactDiagnostics = (diagnostics) => diagnostics.filter((diagnostic) => !!diagnostic);
|
|
23
23
|
|
|
24
|
-
// pkgs/@akanjs/devkit/workflow/primitive.ts
|
|
25
|
-
var createPrimitiveWriteReport = ({
|
|
26
|
-
command,
|
|
27
|
-
status,
|
|
28
|
-
changedFiles = [],
|
|
29
|
-
generatedFiles = [],
|
|
30
|
-
validationCommands = [],
|
|
31
|
-
diagnostics = [],
|
|
32
|
-
nextActions = []
|
|
33
|
-
}) => ({
|
|
34
|
-
schemaVersion: 1,
|
|
35
|
-
command,
|
|
36
|
-
status: status ?? (diagnostics.some((diagnostic) => diagnostic.severity === "error") ? "failed" : "passed"),
|
|
37
|
-
changedFiles,
|
|
38
|
-
generatedFiles,
|
|
39
|
-
validationCommands,
|
|
40
|
-
diagnostics,
|
|
41
|
-
nextActions
|
|
42
|
-
});
|
|
43
|
-
var renderPrimitiveWriteReport = (report) => [
|
|
44
|
-
`# Primitive Write: ${report.command}`,
|
|
45
|
-
"",
|
|
46
|
-
`- Status: ${report.status}`,
|
|
47
|
-
"",
|
|
48
|
-
"## Changed Files",
|
|
49
|
-
...report.changedFiles.length ? report.changedFiles.map((file) => `- \`${file.action}\` ${file.path}: ${file.reason}`) : ["- none"],
|
|
50
|
-
"",
|
|
51
|
-
"## Generated Files",
|
|
52
|
-
...report.generatedFiles.length ? report.generatedFiles.map((file) => `- \`${file.action}\` ${file.path}: ${file.reason}`) : ["- none"],
|
|
53
|
-
"",
|
|
54
|
-
"## Validation Commands",
|
|
55
|
-
...report.validationCommands.length ? report.validationCommands.map((validation) => `- \`${validation.command}\`: ${validation.reason}`) : ["- none"],
|
|
56
|
-
"",
|
|
57
|
-
"## Diagnostics",
|
|
58
|
-
...report.diagnostics.length ? report.diagnostics.map((diagnostic) => `- [${diagnostic.severity}] ${diagnostic.code}: ${diagnostic.message}`) : ["- none"],
|
|
59
|
-
"",
|
|
60
|
-
"## Next Actions",
|
|
61
|
-
...report.nextActions.length ? report.nextActions.map((action) => `- \`${action.command}\`: ${action.reason}`) : ["- none"],
|
|
62
|
-
""
|
|
63
|
-
].join(`
|
|
64
|
-
`);
|
|
65
|
-
var renderPrimitiveReport = (report, format = "markdown") => format === "json" ? jsonText(report) : renderPrimitiveWriteReport(report);
|
|
66
|
-
|
|
67
24
|
// pkgs/@akanjs/devkit/workflow/artifacts.ts
|
|
25
|
+
import { capitalize } from "akanjs/common";
|
|
68
26
|
var sourceChangeBlocked = (diagnostics) => diagnostics.some((diagnostic) => diagnostic.severity === "error" && (diagnostic.failureScope === "source-change" || !diagnostic.failureScope || diagnostic.failureScope === "unknown"));
|
|
69
27
|
var workflowPlanApproval = {
|
|
70
28
|
required: true,
|
|
@@ -147,6 +105,16 @@ var workflowCommandsForPlan = (plan) => plan.validation.map((validation) => ({
|
|
|
147
105
|
reason: validation.reason,
|
|
148
106
|
kind: validation.kind
|
|
149
107
|
}));
|
|
108
|
+
var planInputString = (plan, key) => {
|
|
109
|
+
const value = plan.inputs[key];
|
|
110
|
+
return typeof value === "string" ? value : "";
|
|
111
|
+
};
|
|
112
|
+
var workflowPathsForPlan = (plan) => {
|
|
113
|
+
const app = planInputString(plan, "app");
|
|
114
|
+
const module = planInputString(plan, "module");
|
|
115
|
+
const moduleClass = module ? capitalize(module) : "<Module>";
|
|
116
|
+
return plan.predictedChanges.map((change) => change.target.replace(/^\*\//, app ? `apps/${app}/` : "").replaceAll("<module>", module || "<module>").replaceAll("<Module>", moduleClass));
|
|
117
|
+
};
|
|
150
118
|
var workflowRunsDir = ".akan/workflows/runs";
|
|
151
119
|
var createWorkflowRunId = (prefix = "run") => `${prefix}-${new Date().toISOString().replace(/[-:.TZ]/g, "").slice(0, 14)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
152
120
|
var getRunId = (artifact) => {
|
|
@@ -415,16 +383,321 @@ var createRepairReport = ({
|
|
|
415
383
|
generatedFiles,
|
|
416
384
|
...syncedAt ? { syncedAt } : {}
|
|
417
385
|
});
|
|
386
|
+
|
|
387
|
+
// pkgs/@akanjs/devkit/workflow/render.ts
|
|
388
|
+
var listOr = (items, render, empty = "- none") => items?.length ? items.map(render) : [empty];
|
|
389
|
+
var renderDiagnostic = (diagnostic) => `- [${diagnostic.severity}] ${diagnostic.code}: ${diagnostic.message}`;
|
|
390
|
+
var renderCommand = (entry) => `- \`${entry.command}\`: ${entry.reason}`;
|
|
391
|
+
var renderFile = (file) => `- \`${file.action}\` ${file.path}: ${file.reason}`;
|
|
392
|
+
var renderRecommendation = (recommendation) => {
|
|
393
|
+
const target = recommendation.target ? ` ${recommendation.target}` : "";
|
|
394
|
+
const action = recommendation.action ? ` Action: ${recommendation.action}` : "";
|
|
395
|
+
return `- [${recommendation.kind}]${target} ${recommendation.message}${action}`;
|
|
396
|
+
};
|
|
397
|
+
var renderWorkflowList = (specs) => [
|
|
398
|
+
"# Akan Workflows",
|
|
399
|
+
"",
|
|
400
|
+
...specs.flatMap((spec) => [`- \`${spec.name}\`: ${spec.description}`, ` - When: ${spec.whenToUse}`]),
|
|
401
|
+
""
|
|
402
|
+
].join(`
|
|
403
|
+
`);
|
|
404
|
+
var renderWorkflowExplain = (spec) => [
|
|
405
|
+
`# Workflow: ${spec.name}`,
|
|
406
|
+
"",
|
|
407
|
+
spec.description,
|
|
408
|
+
"",
|
|
409
|
+
"## When To Use",
|
|
410
|
+
spec.whenToUse,
|
|
411
|
+
"",
|
|
412
|
+
"## Inputs",
|
|
413
|
+
...Object.entries(spec.inputs).map(([name, input]) => `- \`${name}\`${input.required ? " (required)" : ""}: ${input.description}${input.allowedValues ? ` Allowed: ${input.allowedValues.join(", ")}.` : ""}`),
|
|
414
|
+
"",
|
|
415
|
+
"## Optional Surfaces",
|
|
416
|
+
...Object.entries(spec.optionalSurfaces ?? {}).map(([name, mode]) => `- \`${name}\`: ${mode}`),
|
|
417
|
+
"",
|
|
418
|
+
"## Steps",
|
|
419
|
+
...spec.steps.map((step, index) => `${index + 1}. \`${step.id}\` (${step.tool}): ${step.description}`),
|
|
420
|
+
"",
|
|
421
|
+
"## Validation",
|
|
422
|
+
...spec.validation.map(renderCommand),
|
|
423
|
+
""
|
|
424
|
+
].join(`
|
|
425
|
+
`);
|
|
426
|
+
var renderWorkflowPlan = (plan) => [
|
|
427
|
+
`# Workflow Plan: ${plan.workflow}`,
|
|
428
|
+
"",
|
|
429
|
+
`- Mode: ${plan.mode}`,
|
|
430
|
+
`- Requires approval: ${plan.requiresApproval}`,
|
|
431
|
+
`- Approval: ${plan.approval?.meaning ?? "Review this read-only plan before applying workflow mutations."}`,
|
|
432
|
+
"",
|
|
433
|
+
"## Inputs",
|
|
434
|
+
...Object.entries(plan.inputs).map(([name, value]) => `- \`${name}\`: ${Array.isArray(value) ? value.join(", ") : value}`),
|
|
435
|
+
"",
|
|
436
|
+
"## Optional Surfaces",
|
|
437
|
+
...Object.entries(plan.optionalSurfaces).map(([name, mode]) => `- \`${name}\`: ${mode}`),
|
|
438
|
+
"",
|
|
439
|
+
"## Steps",
|
|
440
|
+
...plan.steps.map((step, index) => `${index + 1}. \`${step.id}\` (${step.tool}): ${step.description}`),
|
|
441
|
+
"",
|
|
442
|
+
"## Predicted Changes",
|
|
443
|
+
...plan.predictedChanges.map((change) => {
|
|
444
|
+
const scope = change.applyScope ? ` (${change.applyScope})` : "";
|
|
445
|
+
return `- \`${change.action}\`${scope} ${change.target}: ${change.reason}`;
|
|
446
|
+
}),
|
|
447
|
+
"",
|
|
448
|
+
"## Validation",
|
|
449
|
+
...plan.validation.map(renderCommand),
|
|
450
|
+
"",
|
|
451
|
+
"## Diagnostics",
|
|
452
|
+
...listOr(plan.diagnostics, renderDiagnostic),
|
|
453
|
+
"",
|
|
454
|
+
"## Recommendations",
|
|
455
|
+
...listOr(plan.recommendations, (recommendation) => `- [${recommendation.kind}] ${recommendation.message}`),
|
|
456
|
+
""
|
|
457
|
+
].join(`
|
|
458
|
+
`);
|
|
459
|
+
var renderWorkflowApplyReport = (report) => {
|
|
460
|
+
const applySummary = {
|
|
461
|
+
sourceFilesChanged: report.summary?.sourceFilesChanged ?? report.changedFiles,
|
|
462
|
+
generatedFilesSynced: report.summary?.generatedFilesSynced ?? report.generatedFiles
|
|
463
|
+
};
|
|
464
|
+
const manualReviewItems = [
|
|
465
|
+
...report.diagnostics.filter((diagnostic) => diagnostic.severity === "warning").map(renderDiagnostic),
|
|
466
|
+
...report.recommendations.filter((recommendation) => recommendation.kind === "manual-action").map(renderRecommendation)
|
|
467
|
+
];
|
|
468
|
+
const validationBlockers = report.diagnostics.filter((diagnostic) => diagnostic.severity === "error" && (diagnostic.failureScope === "workspace-config" || diagnostic.failureScope === "environment")).map(renderDiagnostic);
|
|
469
|
+
const sourceBlockers = report.diagnostics.filter((diagnostic) => diagnostic.severity === "error" && (diagnostic.failureScope === "source-change" || !diagnostic.failureScope || diagnostic.failureScope === "unknown")).map(renderDiagnostic);
|
|
470
|
+
return [
|
|
471
|
+
`# Workflow Apply: ${report.workflow}`,
|
|
472
|
+
"",
|
|
473
|
+
`- Mode: ${report.mode}`,
|
|
474
|
+
`- Status: ${report.status}`,
|
|
475
|
+
`- Source-change status: ${sourceBlockers.length ? "failed" : "passed"}`,
|
|
476
|
+
`- Workspace status: ${validationBlockers.length ? "blocked" : "not blocked during apply"}`,
|
|
477
|
+
`- Source files changed: ${applySummary.sourceFilesChanged.length}`,
|
|
478
|
+
`- Generated files queued for sync: ${applySummary.generatedFilesSynced.length}`,
|
|
479
|
+
...report.validationTarget ? [`- Validation target: ${report.validationTarget}`] : [],
|
|
480
|
+
"",
|
|
481
|
+
"## Apply Checks",
|
|
482
|
+
...report.postApplyChecks?.length ? report.postApplyChecks.map((check) => `- [${check.status}] ${check.code} ${check.target}: ${check.message}`) : ["- not run"],
|
|
483
|
+
"",
|
|
484
|
+
"## Source Change Blockers",
|
|
485
|
+
...sourceBlockers.length ? sourceBlockers : ["- none"],
|
|
486
|
+
"",
|
|
487
|
+
"## Automatically Modified",
|
|
488
|
+
...listOr(applySummary.sourceFilesChanged, renderFile),
|
|
489
|
+
"",
|
|
490
|
+
"## Generated Sync",
|
|
491
|
+
...listOr(applySummary.generatedFilesSynced, renderFile),
|
|
492
|
+
"",
|
|
493
|
+
"## Applied Commands",
|
|
494
|
+
...listOr(report.appliedCommands, renderCommand),
|
|
495
|
+
"",
|
|
496
|
+
"## Recommended Validation Commands",
|
|
497
|
+
...listOr(report.recommendedValidationCommands, renderCommand),
|
|
498
|
+
"",
|
|
499
|
+
"## User Review Required",
|
|
500
|
+
...manualReviewItems.length ? manualReviewItems : ["- none"],
|
|
501
|
+
"",
|
|
502
|
+
"## Validation Blockers",
|
|
503
|
+
...validationBlockers.length ? validationBlockers : report.recommendedValidationCommands.length ? ["- none detected during apply; run validation with the validation target for command-level blockers."] : ["- none"],
|
|
504
|
+
"",
|
|
505
|
+
"## Diagnostics",
|
|
506
|
+
...listOr(report.diagnostics, renderDiagnostic),
|
|
507
|
+
"",
|
|
508
|
+
"## Recommendations",
|
|
509
|
+
...listOr(report.recommendations.slice(0, 3), renderRecommendation),
|
|
510
|
+
"",
|
|
511
|
+
"## Next Actions",
|
|
512
|
+
...listOr(report.nextActions.slice(0, 3), renderCommand),
|
|
513
|
+
""
|
|
514
|
+
].join(`
|
|
515
|
+
`);
|
|
516
|
+
};
|
|
517
|
+
var renderWorkflowApply = (report, format = "markdown") => format === "json" ? jsonText(report) : renderWorkflowApplyReport(report);
|
|
518
|
+
var renderWorkflowValidationRunReport = (report) => {
|
|
519
|
+
const baselineSummary = report.baselineSummary ?? {
|
|
520
|
+
status: report.baselineDiagnostics?.some((diagnostic) => diagnostic.severity === "error") ? "failed" : "unknown",
|
|
521
|
+
total: report.baselineDiagnostics?.length ?? 0,
|
|
522
|
+
totalErrors: report.baselineDiagnostics?.filter((diagnostic) => diagnostic.severity === "error").length ?? 0,
|
|
523
|
+
totalWarnings: report.baselineDiagnostics?.filter((diagnostic) => diagnostic.severity === "warning").length ?? 0,
|
|
524
|
+
detailsIncluded: true,
|
|
525
|
+
knownBlockerCount: report.knownBlockers.filter((blocker) => blocker.known).length,
|
|
526
|
+
byCode: []
|
|
527
|
+
};
|
|
528
|
+
return [
|
|
529
|
+
`# Workflow Validation: ${report.workflow}`,
|
|
530
|
+
"",
|
|
531
|
+
`- Run: ${report.runId}`,
|
|
532
|
+
`- Status: ${report.status}`,
|
|
533
|
+
`- Source status: ${report.sourceStatus}`,
|
|
534
|
+
`- Workspace status: ${report.workspaceStatus}`,
|
|
535
|
+
`- Validation commands status: ${report.validationCommandsStatus ?? "unknown"}`,
|
|
536
|
+
`- Baseline status: ${report.baselineStatus ?? baselineSummary.status}`,
|
|
537
|
+
`- Overall status: ${report.overallStatus}`,
|
|
538
|
+
"",
|
|
539
|
+
"## Status Summary",
|
|
540
|
+
`- Source-change: ${report.summary.sourceChange}`,
|
|
541
|
+
`- Generated sync: ${report.summary.generatedSync}`,
|
|
542
|
+
`- Validation commands: ${report.summary.validationCommands ?? "unknown"}`,
|
|
543
|
+
`- Baseline: ${report.summary.baseline ?? baselineSummary.status}`,
|
|
544
|
+
`- Workspace config: ${report.summary.workspaceConfig}`,
|
|
545
|
+
`- Environment: ${report.summary.environment}`,
|
|
546
|
+
"",
|
|
547
|
+
"## Source Change Diagnostics",
|
|
548
|
+
...listOr(report.workflowDiagnostics, renderDiagnostic),
|
|
549
|
+
"",
|
|
550
|
+
"## Existing Workspace Blockers",
|
|
551
|
+
`- Status: ${baselineSummary.status}`,
|
|
552
|
+
`- Errors: ${baselineSummary.totalErrors}`,
|
|
553
|
+
`- Warnings: ${baselineSummary.totalWarnings}`,
|
|
554
|
+
...listOr(baselineSummary.byCode, (item) => `- [${item.severity}] ${item.code} (${item.count}x): ${item.sampleMessage}`),
|
|
555
|
+
...baselineSummary.detailsIncluded ? [] : [
|
|
556
|
+
"- Baseline details are summarized by default. Re-run validation with includeBaselineDetails=true for full baselineDiagnostics."
|
|
557
|
+
],
|
|
558
|
+
"",
|
|
559
|
+
"## Existing Workspace Blocker Details",
|
|
560
|
+
...listOr(report.baselineDiagnostics, renderDiagnostic, baselineSummary.detailsIncluded ? "- none" : "- omitted"),
|
|
561
|
+
"",
|
|
562
|
+
"## Known Blockers",
|
|
563
|
+
...listOr(report.knownBlockers, (blocker) => {
|
|
564
|
+
const command = blocker.command ? ` \`${blocker.command}\`` : "";
|
|
565
|
+
const count = blocker.count > 1 ? ` (${blocker.count}x)` : "";
|
|
566
|
+
const known = blocker.known ? " known" : "";
|
|
567
|
+
return `- [${blocker.failureScope}${known}]${command}${count}: ${blocker.message}`;
|
|
568
|
+
}),
|
|
569
|
+
"",
|
|
570
|
+
"## Commands",
|
|
571
|
+
...listOr(report.commands, (command) => {
|
|
572
|
+
const scope = command.failureScope ? ` (${command.failureScope})` : "";
|
|
573
|
+
return `- [${command.status}] \`${command.command}\`${scope}: ${command.reason}`;
|
|
574
|
+
}),
|
|
575
|
+
"",
|
|
576
|
+
"## Diagnostics",
|
|
577
|
+
...listOr(report.diagnostics, renderDiagnostic),
|
|
578
|
+
"",
|
|
579
|
+
"## Repair Actions",
|
|
580
|
+
...listOr(report.repairActions, renderCommand),
|
|
581
|
+
"",
|
|
582
|
+
"## Next Actions",
|
|
583
|
+
...listOr(report.nextActions, renderCommand),
|
|
584
|
+
""
|
|
585
|
+
].join(`
|
|
586
|
+
`);
|
|
587
|
+
};
|
|
588
|
+
var renderWorkflowValidation = (report, format = "markdown") => format === "json" ? jsonText(report) : renderWorkflowValidationRunReport(report);
|
|
589
|
+
var renderRepairReportMarkdown = (report) => [
|
|
590
|
+
`# Akan Repair: ${report.kind}`,
|
|
591
|
+
"",
|
|
592
|
+
`- Status: ${report.status}`,
|
|
593
|
+
`- Target: ${report.target ?? "none"}`,
|
|
594
|
+
"",
|
|
595
|
+
"## Commands",
|
|
596
|
+
...listOr(report.commands, (command) => `- [${command.status}] \`${command.command}\`: ${command.reason}`),
|
|
597
|
+
"",
|
|
598
|
+
"## Diagnostics",
|
|
599
|
+
...listOr(report.diagnostics, renderDiagnostic),
|
|
600
|
+
"",
|
|
601
|
+
"## Next Actions",
|
|
602
|
+
...listOr(report.nextActions, renderCommand),
|
|
603
|
+
""
|
|
604
|
+
].join(`
|
|
605
|
+
`);
|
|
606
|
+
var renderRepairReport = (report, format = "markdown") => format === "json" ? jsonText(report) : renderRepairReportMarkdown(report);
|
|
607
|
+
var renderWorkflowRunArtifact = (artifact, format = "markdown") => {
|
|
608
|
+
if ("kind" in artifact)
|
|
609
|
+
return renderRepairReport(artifact, format);
|
|
610
|
+
if ("mode" in artifact && artifact.mode === "validate")
|
|
611
|
+
return renderWorkflowValidation(artifact, format);
|
|
612
|
+
if ("mode" in artifact && (artifact.mode === "apply" || artifact.mode === "dry-run")) {
|
|
613
|
+
return renderWorkflowApply(artifact, format);
|
|
614
|
+
}
|
|
615
|
+
return jsonText(artifact);
|
|
616
|
+
};
|
|
617
|
+
var renderPrimitiveWriteReport = (report) => [
|
|
618
|
+
`# Primitive Write: ${report.command}`,
|
|
619
|
+
"",
|
|
620
|
+
`- Status: ${report.status}`,
|
|
621
|
+
"",
|
|
622
|
+
"## Changed Files",
|
|
623
|
+
...listOr(report.changedFiles, renderFile),
|
|
624
|
+
"",
|
|
625
|
+
"## Generated Files",
|
|
626
|
+
...listOr(report.generatedFiles, renderFile),
|
|
627
|
+
"",
|
|
628
|
+
"## Validation Commands",
|
|
629
|
+
...listOr(report.validationCommands, renderCommand),
|
|
630
|
+
"",
|
|
631
|
+
"## Diagnostics",
|
|
632
|
+
...listOr(report.diagnostics, renderDiagnostic),
|
|
633
|
+
"",
|
|
634
|
+
"## Next Actions",
|
|
635
|
+
...listOr(report.nextActions, renderCommand),
|
|
636
|
+
""
|
|
637
|
+
].join(`
|
|
638
|
+
`);
|
|
639
|
+
var renderPrimitiveReport = (report, format = "markdown") => format === "json" ? jsonText(report) : renderPrimitiveWriteReport(report);
|
|
418
640
|
// pkgs/@akanjs/devkit/workflow/executor.ts
|
|
419
|
-
import
|
|
641
|
+
import { capitalize as capitalize2 } from "akanjs/common";
|
|
642
|
+
import ts4 from "typescript";
|
|
420
643
|
|
|
421
644
|
// pkgs/@akanjs/devkit/workflow/moduleIndex.ts
|
|
422
645
|
import { access } from "fs/promises";
|
|
423
646
|
import path from "path";
|
|
424
|
-
import
|
|
647
|
+
import ts3 from "typescript";
|
|
425
648
|
|
|
426
649
|
// pkgs/@akanjs/devkit/workflow/source.ts
|
|
650
|
+
import { lowerlize } from "akanjs/common";
|
|
651
|
+
import ts2 from "typescript";
|
|
652
|
+
|
|
653
|
+
// pkgs/@akanjs/devkit/workflow/sourceAst.ts
|
|
427
654
|
import ts from "typescript";
|
|
655
|
+
var sourceFileFor = (fileName, content) => ts.createSourceFile(fileName, content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
656
|
+
var nodeName = (node) => {
|
|
657
|
+
if (!node)
|
|
658
|
+
return null;
|
|
659
|
+
if (ts.isIdentifier(node) || ts.isStringLiteral(node) || ts.isNumericLiteral(node))
|
|
660
|
+
return node.text;
|
|
661
|
+
return null;
|
|
662
|
+
};
|
|
663
|
+
var propertyName = (node) => ts.isPropertyAssignment(node) || ts.isShorthandPropertyAssignment(node) || ts.isMethodDeclaration(node) ? nodeName(node.name) : null;
|
|
664
|
+
var expressionName = (expression) => {
|
|
665
|
+
if (ts.isIdentifier(expression))
|
|
666
|
+
return expression.text;
|
|
667
|
+
if (ts.isPropertyAccessExpression(expression))
|
|
668
|
+
return expression.name.text;
|
|
669
|
+
if (ts.isCallExpression(expression))
|
|
670
|
+
return expressionName(expression.expression);
|
|
671
|
+
if (ts.isAsExpression(expression))
|
|
672
|
+
return expressionName(expression.expression);
|
|
673
|
+
return null;
|
|
674
|
+
};
|
|
675
|
+
var callExpressionName = (node) => ts.isPropertyAccessExpression(node.expression) ? node.expression.name.text : expressionName(node.expression);
|
|
676
|
+
var firstObjectReturnedByArrow = (node) => {
|
|
677
|
+
if (!ts.isArrowFunction(node) && !ts.isFunctionExpression(node))
|
|
678
|
+
return null;
|
|
679
|
+
if (ts.isObjectLiteralExpression(node.body))
|
|
680
|
+
return node.body;
|
|
681
|
+
if (ts.isParenthesizedExpression(node.body) && ts.isObjectLiteralExpression(node.body.expression)) {
|
|
682
|
+
return node.body.expression;
|
|
683
|
+
}
|
|
684
|
+
if (!ts.isBlock(node.body))
|
|
685
|
+
return null;
|
|
686
|
+
for (const statement of node.body.statements) {
|
|
687
|
+
if (ts.isReturnStatement(statement) && statement.expression && ts.isObjectLiteralExpression(statement.expression)) {
|
|
688
|
+
return statement.expression;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
return null;
|
|
692
|
+
};
|
|
693
|
+
var isViaCall = (expression) => ts.isCallExpression(expression) && expressionName(expression.expression) === "via";
|
|
694
|
+
var heritageCall = (node) => {
|
|
695
|
+
const heritage = node.heritageClauses?.flatMap((clause) => [...clause.types]) ?? [];
|
|
696
|
+
const expression = heritage.find((clause) => isViaCall(clause.expression))?.expression;
|
|
697
|
+
return expression && ts.isCallExpression(expression) ? expression : null;
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
// pkgs/@akanjs/devkit/workflow/source.ts
|
|
428
701
|
var getSysRoot = (sys) => `${sys.type}s/${sys.name}`;
|
|
429
702
|
var sourceFile = (sys, path, action, reason) => ({
|
|
430
703
|
path: `${getSysRoot(sys)}/${path}`,
|
|
@@ -457,6 +730,24 @@ var nextActionsForTarget = (target) => [
|
|
|
457
730
|
{ command: `akan sync ${target}`, reason: "Refresh generated Akan files after source changes." },
|
|
458
731
|
{ command: `akan lint ${target}`, reason: "Validate the target after generated files are refreshed." }
|
|
459
732
|
];
|
|
733
|
+
var createPrimitiveWriteReport = ({
|
|
734
|
+
command,
|
|
735
|
+
status,
|
|
736
|
+
changedFiles = [],
|
|
737
|
+
generatedFiles = [],
|
|
738
|
+
validationCommands = [],
|
|
739
|
+
diagnostics = [],
|
|
740
|
+
nextActions = []
|
|
741
|
+
}) => ({
|
|
742
|
+
schemaVersion: 1,
|
|
743
|
+
command,
|
|
744
|
+
status: status ?? (diagnostics.some((diagnostic) => diagnostic.severity === "error") ? "failed" : "passed"),
|
|
745
|
+
changedFiles,
|
|
746
|
+
generatedFiles,
|
|
747
|
+
validationCommands,
|
|
748
|
+
diagnostics,
|
|
749
|
+
nextActions
|
|
750
|
+
});
|
|
460
751
|
var createPassedPrimitiveReport = ({
|
|
461
752
|
command,
|
|
462
753
|
changedFiles,
|
|
@@ -473,7 +764,6 @@ var createPassedPrimitiveReport = ({
|
|
|
473
764
|
});
|
|
474
765
|
var scalarChangedFiles = (sys, scalarName, files) => Object.values(files).map((file) => sourceFile(sys, `lib/__scalar/${scalarName}/${file.filename}`, "create", "Scalar source file was created."));
|
|
475
766
|
var titleize = (value) => value.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[-_]+/g, " ").replace(/\b\w/g, (char) => char.toUpperCase());
|
|
476
|
-
var lowerlize = (value) => `${value.slice(0, 1).toLowerCase()}${value.slice(1)}`;
|
|
477
767
|
var koLabels = {
|
|
478
768
|
amount: "\uAE08\uC561",
|
|
479
769
|
budget: "\uC608\uC0B0",
|
|
@@ -531,20 +821,24 @@ var normalizeFieldType = (typeName) => {
|
|
|
531
821
|
};
|
|
532
822
|
return normalizedTypes[typeName.toLowerCase()] ?? typeName;
|
|
533
823
|
};
|
|
534
|
-
var
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
if (baseImport) {
|
|
540
|
-
if (baseImport.names.includes(typeName))
|
|
824
|
+
var ensureNamedImport = (content, moduleSpecifier, name) => {
|
|
825
|
+
const source = sourceFileFor("source.ts", content);
|
|
826
|
+
const namedImport = findNamedImport(source, moduleSpecifier);
|
|
827
|
+
if (namedImport) {
|
|
828
|
+
if (namedImport.names.includes(name))
|
|
541
829
|
return content;
|
|
542
|
-
const nextNames = [...
|
|
543
|
-
return spliceText(content,
|
|
830
|
+
const nextNames = [...namedImport.names, name].sort();
|
|
831
|
+
return spliceText(content, namedImport.namedBindingsStart, namedImport.namedBindingsEnd, `{ ${nextNames.join(", ")} }`);
|
|
544
832
|
}
|
|
545
|
-
return `import { ${
|
|
833
|
+
return `import { ${name} } from "${moduleSpecifier}";
|
|
546
834
|
${content}`;
|
|
547
835
|
};
|
|
836
|
+
var ensureBaseImport = (content, name) => ensureNamedImport(content, "akanjs/base", name);
|
|
837
|
+
var ensureBaseTypeImport = (content, typeName) => {
|
|
838
|
+
if (typeName !== "Int" && typeName !== "Float")
|
|
839
|
+
return content;
|
|
840
|
+
return ensureBaseImport(content, typeName);
|
|
841
|
+
};
|
|
548
842
|
var numericDefault = (typeName, rawDefault) => {
|
|
549
843
|
if (typeof rawDefault === "number") {
|
|
550
844
|
if (!Number.isFinite(rawDefault))
|
|
@@ -572,16 +866,16 @@ var booleanDefault = (rawDefault) => {
|
|
|
572
866
|
};
|
|
573
867
|
var dateDefault = (rawDefault) => {
|
|
574
868
|
if (typeof rawDefault === "number" && Number.isFinite(rawDefault))
|
|
575
|
-
return `
|
|
869
|
+
return `() => dayjs(${rawDefault})`;
|
|
576
870
|
if (typeof rawDefault !== "string")
|
|
577
871
|
return null;
|
|
578
872
|
const trimmed = rawDefault.trim();
|
|
579
873
|
if (!trimmed)
|
|
580
874
|
return null;
|
|
581
875
|
if (trimmed === "now")
|
|
582
|
-
return "
|
|
876
|
+
return "() => dayjs()";
|
|
583
877
|
if (!Number.isNaN(Date.parse(trimmed)))
|
|
584
|
-
return `
|
|
878
|
+
return `() => dayjs(${JSON.stringify(trimmed)})`;
|
|
585
879
|
return null;
|
|
586
880
|
};
|
|
587
881
|
var coerceFieldDefault = (typeName, defaultValue, options = {}) => {
|
|
@@ -683,7 +977,6 @@ var fieldOrderingPriority = [
|
|
|
683
977
|
"createdAt",
|
|
684
978
|
"updatedAt"
|
|
685
979
|
];
|
|
686
|
-
var sourceFileFor = (fileName, content, scriptKind = ts.ScriptKind.TS) => ts.createSourceFile(fileName, content, ts.ScriptTarget.Latest, true, scriptKind);
|
|
687
980
|
var hasParseDiagnostics = (source) => (source.parseDiagnostics ?? []).length > 0;
|
|
688
981
|
var spliceText = (content, start, end, replacement) => `${content.slice(0, start)}${replacement}${content.slice(end)}`;
|
|
689
982
|
var lineStartAt = (content, position) => content.lastIndexOf(`
|
|
@@ -694,49 +987,6 @@ var lineEndAt = (content, position) => {
|
|
|
694
987
|
return end < 0 ? content.length : end + 1;
|
|
695
988
|
};
|
|
696
989
|
var lineIndentAt = (content, position) => /^[ \t]*/.exec(content.slice(lineStartAt(content, position)))?.[0] ?? "";
|
|
697
|
-
var nodeName = (node) => {
|
|
698
|
-
if (!node)
|
|
699
|
-
return null;
|
|
700
|
-
if (ts.isIdentifier(node) || ts.isStringLiteral(node) || ts.isNumericLiteral(node))
|
|
701
|
-
return node.text;
|
|
702
|
-
return null;
|
|
703
|
-
};
|
|
704
|
-
var propertyName = (node) => ts.isPropertyAssignment(node) || ts.isShorthandPropertyAssignment(node) || ts.isMethodDeclaration(node) ? nodeName(node.name) : null;
|
|
705
|
-
var expressionName = (expression) => {
|
|
706
|
-
if (ts.isIdentifier(expression))
|
|
707
|
-
return expression.text;
|
|
708
|
-
if (ts.isPropertyAccessExpression(expression))
|
|
709
|
-
return expression.name.text;
|
|
710
|
-
if (ts.isCallExpression(expression))
|
|
711
|
-
return expressionName(expression.expression);
|
|
712
|
-
if (ts.isAsExpression(expression))
|
|
713
|
-
return expressionName(expression.expression);
|
|
714
|
-
return null;
|
|
715
|
-
};
|
|
716
|
-
var firstObjectReturnedByArrow = (node) => {
|
|
717
|
-
if (!ts.isArrowFunction(node) && !ts.isFunctionExpression(node))
|
|
718
|
-
return null;
|
|
719
|
-
if (ts.isObjectLiteralExpression(node.body))
|
|
720
|
-
return node.body;
|
|
721
|
-
if (ts.isParenthesizedExpression(node.body) && ts.isObjectLiteralExpression(node.body.expression)) {
|
|
722
|
-
return node.body.expression;
|
|
723
|
-
}
|
|
724
|
-
if (!ts.isBlock(node.body))
|
|
725
|
-
return null;
|
|
726
|
-
for (const statement of node.body.statements) {
|
|
727
|
-
if (ts.isReturnStatement(statement) && statement.expression && ts.isObjectLiteralExpression(statement.expression)) {
|
|
728
|
-
return statement.expression;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
return null;
|
|
732
|
-
};
|
|
733
|
-
var isViaCall = (expression) => ts.isCallExpression(expression) && expressionName(expression.expression) === "via";
|
|
734
|
-
var heritageCall = (node) => {
|
|
735
|
-
const heritage = node.heritageClauses?.flatMap((clause) => [...clause.types]) ?? [];
|
|
736
|
-
const expression = heritage.find((clause) => isViaCall(clause.expression))?.expression;
|
|
737
|
-
return expression && ts.isCallExpression(expression) ? expression : null;
|
|
738
|
-
};
|
|
739
|
-
var callExpressionName = (node) => ts.isPropertyAccessExpression(node.expression) ? node.expression.name.text : expressionName(node.expression);
|
|
740
990
|
var locatedObject = (source, objectLiteral) => ({
|
|
741
991
|
objectStart: objectLiteral.getStart(source),
|
|
742
992
|
objectEnd: objectLiteral.getEnd(),
|
|
@@ -757,25 +1007,25 @@ var findConstantInputObject = (source, className) => {
|
|
|
757
1007
|
const visit = (node) => {
|
|
758
1008
|
if (locator)
|
|
759
1009
|
return;
|
|
760
|
-
if (!
|
|
761
|
-
|
|
1010
|
+
if (!ts2.isClassDeclaration(node) || node.name?.text !== className) {
|
|
1011
|
+
ts2.forEachChild(node, visit);
|
|
762
1012
|
return;
|
|
763
1013
|
}
|
|
764
1014
|
const viaCall = heritageCall(node);
|
|
765
|
-
const callback = viaCall?.arguments.find((arg) =>
|
|
1015
|
+
const callback = viaCall?.arguments.find((arg) => ts2.isArrowFunction(arg) || ts2.isFunctionExpression(arg));
|
|
766
1016
|
const objectLiteral = callback ? firstObjectReturnedByArrow(callback) : null;
|
|
767
1017
|
if (objectLiteral)
|
|
768
1018
|
locator = locatedObject(source, objectLiteral);
|
|
769
1019
|
};
|
|
770
|
-
|
|
1020
|
+
ts2.forEachChild(source, visit);
|
|
771
1021
|
return locator;
|
|
772
1022
|
};
|
|
773
1023
|
var chainMethodsForCall = (node) => {
|
|
774
|
-
if (
|
|
1024
|
+
if (ts2.isAsExpression(node) || ts2.isParenthesizedExpression(node))
|
|
775
1025
|
return chainMethodsForCall(node.expression);
|
|
776
|
-
if (!
|
|
1026
|
+
if (!ts2.isCallExpression(node))
|
|
777
1027
|
return [];
|
|
778
|
-
if (
|
|
1028
|
+
if (ts2.isPropertyAccessExpression(node.expression)) {
|
|
779
1029
|
return [...chainMethodsForCall(node.expression.expression), node.expression.name.text];
|
|
780
1030
|
}
|
|
781
1031
|
const name = expressionName(node.expression);
|
|
@@ -783,7 +1033,7 @@ var chainMethodsForCall = (node) => {
|
|
|
783
1033
|
};
|
|
784
1034
|
var outermostFluentCall = (node) => {
|
|
785
1035
|
let current = node;
|
|
786
|
-
while (
|
|
1036
|
+
while (ts2.isPropertyAccessExpression(current.parent) && current.parent.expression === current && ts2.isCallExpression(current.parent.parent) && current.parent.parent.expression === current.parent) {
|
|
787
1037
|
current = current.parent.parent;
|
|
788
1038
|
}
|
|
789
1039
|
return current;
|
|
@@ -807,16 +1057,16 @@ var findDictionaryModelObject = (source, moduleClassName) => {
|
|
|
807
1057
|
const visit = (node) => {
|
|
808
1058
|
if (locator)
|
|
809
1059
|
return;
|
|
810
|
-
if (!
|
|
811
|
-
|
|
1060
|
+
if (!ts2.isCallExpression(node) || callExpressionName(node) !== "model") {
|
|
1061
|
+
ts2.forEachChild(node, visit);
|
|
812
1062
|
return;
|
|
813
1063
|
}
|
|
814
1064
|
const typeArgument = node.typeArguments?.[0];
|
|
815
1065
|
if (!typeArgument || typeArgument.getText(source) !== moduleClassName) {
|
|
816
|
-
|
|
1066
|
+
ts2.forEachChild(node, visit);
|
|
817
1067
|
return;
|
|
818
1068
|
}
|
|
819
|
-
const callback = node.arguments.find((arg) =>
|
|
1069
|
+
const callback = node.arguments.find((arg) => ts2.isArrowFunction(arg) || ts2.isFunctionExpression(arg));
|
|
820
1070
|
const objectLiteral = callback ? firstObjectReturnedByArrow(callback) : null;
|
|
821
1071
|
if (objectLiteral) {
|
|
822
1072
|
locator = {
|
|
@@ -825,7 +1075,7 @@ var findDictionaryModelObject = (source, moduleClassName) => {
|
|
|
825
1075
|
};
|
|
826
1076
|
}
|
|
827
1077
|
};
|
|
828
|
-
|
|
1078
|
+
ts2.forEachChild(source, visit);
|
|
829
1079
|
return locator;
|
|
830
1080
|
};
|
|
831
1081
|
var findLightProjectionArray = (source, moduleClassName) => {
|
|
@@ -833,35 +1083,35 @@ var findLightProjectionArray = (source, moduleClassName) => {
|
|
|
833
1083
|
const visit = (node) => {
|
|
834
1084
|
if (locator)
|
|
835
1085
|
return;
|
|
836
|
-
if (!
|
|
837
|
-
|
|
1086
|
+
if (!ts2.isClassDeclaration(node) || node.name?.text !== `Light${moduleClassName}`) {
|
|
1087
|
+
ts2.forEachChild(node, visit);
|
|
838
1088
|
return;
|
|
839
1089
|
}
|
|
840
1090
|
const viaCall = heritageCall(node);
|
|
841
1091
|
const projectionArg = viaCall?.arguments.find((arg) => {
|
|
842
|
-
const expression =
|
|
843
|
-
return
|
|
1092
|
+
const expression = ts2.isAsExpression(arg) ? arg.expression : arg;
|
|
1093
|
+
return ts2.isArrayLiteralExpression(expression);
|
|
844
1094
|
});
|
|
845
|
-
const arrayLiteral = projectionArg ?
|
|
846
|
-
if (!projectionArg || !arrayLiteral || !
|
|
1095
|
+
const arrayLiteral = projectionArg ? ts2.isAsExpression(projectionArg) ? projectionArg.expression : projectionArg : null;
|
|
1096
|
+
if (!projectionArg || !arrayLiteral || !ts2.isArrayLiteralExpression(arrayLiteral))
|
|
847
1097
|
return;
|
|
848
1098
|
locator = {
|
|
849
1099
|
projectionStart: projectionArg.getStart(source),
|
|
850
1100
|
projectionEnd: projectionArg.getEnd(),
|
|
851
|
-
fields: arrayLiteral.elements.map((element) =>
|
|
1101
|
+
fields: arrayLiteral.elements.map((element) => ts2.isStringLiteralLike(element) ? element.text : null).filter((field) => field !== null)
|
|
852
1102
|
};
|
|
853
1103
|
};
|
|
854
|
-
|
|
1104
|
+
ts2.forEachChild(source, visit);
|
|
855
1105
|
return locator;
|
|
856
1106
|
};
|
|
857
1107
|
var findNamedImport = (source, moduleSpecifier) => {
|
|
858
1108
|
for (const statement of source.statements) {
|
|
859
|
-
if (!
|
|
1109
|
+
if (!ts2.isImportDeclaration(statement) || !ts2.isStringLiteral(statement.moduleSpecifier))
|
|
860
1110
|
continue;
|
|
861
1111
|
if (statement.moduleSpecifier.text !== moduleSpecifier)
|
|
862
1112
|
continue;
|
|
863
1113
|
const namedBindings = statement.importClause?.namedBindings;
|
|
864
|
-
if (!namedBindings || !
|
|
1114
|
+
if (!namedBindings || !ts2.isNamedImports(namedBindings))
|
|
865
1115
|
continue;
|
|
866
1116
|
return {
|
|
867
1117
|
names: namedBindings.elements.map((element) => element.name.text),
|
|
@@ -872,10 +1122,10 @@ var findNamedImport = (source, moduleSpecifier) => {
|
|
|
872
1122
|
return null;
|
|
873
1123
|
};
|
|
874
1124
|
var fieldExpressionBuilder = (property) => {
|
|
875
|
-
if (!
|
|
1125
|
+
if (!ts2.isPropertyAssignment(property))
|
|
876
1126
|
return null;
|
|
877
|
-
const initializer =
|
|
878
|
-
if (!
|
|
1127
|
+
const initializer = ts2.isAsExpression(property.initializer) ? property.initializer.expression : property.initializer;
|
|
1128
|
+
if (!ts2.isCallExpression(initializer))
|
|
879
1129
|
return null;
|
|
880
1130
|
return expressionName(initializer.expression);
|
|
881
1131
|
};
|
|
@@ -913,7 +1163,7 @@ ${options.closingIndent}}`);
|
|
|
913
1163
|
}
|
|
914
1164
|
const beforeField = locator.fields[insertIndex];
|
|
915
1165
|
if (beforeField) {
|
|
916
|
-
const leadingComments =
|
|
1166
|
+
const leadingComments = ts2.getLeadingCommentRanges(content, beforeField.fullStart) ?? [];
|
|
917
1167
|
const insertAt = lineStartAt(content, leadingComments[0]?.pos ?? beforeField.start);
|
|
918
1168
|
const indent = lineIndentAt(content, beforeField.start) || options.fieldIndent;
|
|
919
1169
|
return spliceText(content, insertAt, insertAt, `${indent}${formattedLine}
|
|
@@ -931,17 +1181,17 @@ var viaBuilderParameterName = (content, className) => {
|
|
|
931
1181
|
const visit = (node) => {
|
|
932
1182
|
if (builderName !== null)
|
|
933
1183
|
return;
|
|
934
|
-
if (!
|
|
935
|
-
|
|
1184
|
+
if (!ts2.isClassDeclaration(node) || node.name?.text !== className) {
|
|
1185
|
+
ts2.forEachChild(node, visit);
|
|
936
1186
|
return;
|
|
937
1187
|
}
|
|
938
1188
|
const viaCall = heritageCall(node);
|
|
939
|
-
const callback = viaCall?.arguments.find((arg) =>
|
|
940
|
-
if (callback && (
|
|
1189
|
+
const callback = viaCall?.arguments.find((arg) => ts2.isArrowFunction(arg) || ts2.isFunctionExpression(arg));
|
|
1190
|
+
if (callback && (ts2.isArrowFunction(callback) || ts2.isFunctionExpression(callback))) {
|
|
941
1191
|
builderName = nodeName(callback.parameters[0]?.name);
|
|
942
1192
|
}
|
|
943
1193
|
};
|
|
944
|
-
|
|
1194
|
+
ts2.forEachChild(source, visit);
|
|
945
1195
|
return builderName;
|
|
946
1196
|
};
|
|
947
1197
|
var inspectConstantStructure = (content, className, moduleClassName) => {
|
|
@@ -952,12 +1202,12 @@ var inspectConstantStructure = (content, className, moduleClassName) => {
|
|
|
952
1202
|
const fields = [];
|
|
953
1203
|
if (inputObject) {
|
|
954
1204
|
const visit = (node) => {
|
|
955
|
-
if (!
|
|
956
|
-
|
|
1205
|
+
if (!ts2.isClassDeclaration(node) || node.name?.text !== className) {
|
|
1206
|
+
ts2.forEachChild(node, visit);
|
|
957
1207
|
return;
|
|
958
1208
|
}
|
|
959
1209
|
const viaCall = heritageCall(node);
|
|
960
|
-
const callback = viaCall?.arguments.find((arg) =>
|
|
1210
|
+
const callback = viaCall?.arguments.find((arg) => ts2.isArrowFunction(arg) || ts2.isFunctionExpression(arg));
|
|
961
1211
|
const objectLiteral = callback ? firstObjectReturnedByArrow(callback) : null;
|
|
962
1212
|
if (!objectLiteral)
|
|
963
1213
|
return;
|
|
@@ -968,7 +1218,7 @@ var inspectConstantStructure = (content, className, moduleClassName) => {
|
|
|
968
1218
|
return { name, expressionBuilder: fieldExpressionBuilder(property) };
|
|
969
1219
|
}).filter((field) => field !== null));
|
|
970
1220
|
};
|
|
971
|
-
|
|
1221
|
+
ts2.forEachChild(source, visit);
|
|
972
1222
|
}
|
|
973
1223
|
return {
|
|
974
1224
|
parseValid: !hasParseDiagnostics(source),
|
|
@@ -1125,26 +1375,26 @@ var findClassDeclaration = (source, className) => {
|
|
|
1125
1375
|
const visit = (node) => {
|
|
1126
1376
|
if (found)
|
|
1127
1377
|
return;
|
|
1128
|
-
if (
|
|
1378
|
+
if (ts2.isClassDeclaration(node) && node.name?.text === className) {
|
|
1129
1379
|
found = node;
|
|
1130
1380
|
return;
|
|
1131
1381
|
}
|
|
1132
|
-
|
|
1382
|
+
ts2.forEachChild(node, visit);
|
|
1133
1383
|
};
|
|
1134
|
-
|
|
1384
|
+
ts2.forEachChild(source, visit);
|
|
1135
1385
|
return found;
|
|
1136
1386
|
};
|
|
1137
1387
|
var firstHeritageCall = (node) => {
|
|
1138
1388
|
const expression = (node.heritageClauses?.flatMap((clause) => [...clause.types]) ?? [])[0]?.expression;
|
|
1139
|
-
return expression &&
|
|
1389
|
+
return expression && ts2.isCallExpression(expression) ? expression : null;
|
|
1140
1390
|
};
|
|
1141
1391
|
var factoryArrowOf = (call) => {
|
|
1142
|
-
const arg = call.arguments.find((argument) =>
|
|
1143
|
-
return arg && (
|
|
1392
|
+
const arg = call.arguments.find((argument) => ts2.isArrowFunction(argument) || ts2.isFunctionExpression(argument));
|
|
1393
|
+
return arg && (ts2.isArrowFunction(arg) || ts2.isFunctionExpression(arg)) ? arg : null;
|
|
1144
1394
|
};
|
|
1145
1395
|
var hasClassMethod = (content, className, methodName) => {
|
|
1146
1396
|
const node = findClassDeclaration(sourceFileFor("service.ts", content), className);
|
|
1147
|
-
return Boolean(node?.members.some((member) =>
|
|
1397
|
+
return Boolean(node?.members.some((member) => ts2.isMethodDeclaration(member) && nodeName(member.name) === methodName));
|
|
1148
1398
|
};
|
|
1149
1399
|
var insertClassMethod = (content, className, methodBlock) => {
|
|
1150
1400
|
const source = sourceFileFor("service.ts", content);
|
|
@@ -1187,9 +1437,9 @@ var factoryParamEdit = (content, source, arrow, plan) => {
|
|
|
1187
1437
|
const param = arrow.parameters[0];
|
|
1188
1438
|
if (plan.mode === "positional")
|
|
1189
1439
|
return nodeName(param.name) === plan.name ? "unchanged" : null;
|
|
1190
|
-
if (!
|
|
1440
|
+
if (!ts2.isObjectBindingPattern(param.name))
|
|
1191
1441
|
return null;
|
|
1192
|
-
const names = param.name.elements.map((element) =>
|
|
1442
|
+
const names = param.name.elements.map((element) => ts2.isIdentifier(element.name) ? element.name.text : null);
|
|
1193
1443
|
if (names.some((name) => name === null))
|
|
1194
1444
|
return null;
|
|
1195
1445
|
if (names.includes(plan.name))
|
|
@@ -1260,13 +1510,12 @@ var fileExists = async (filePath) => {
|
|
|
1260
1510
|
return false;
|
|
1261
1511
|
}
|
|
1262
1512
|
};
|
|
1263
|
-
var sourceFileFor2 = (filePath, content) => ts2.createSourceFile(filePath, content, ts2.ScriptTarget.Latest, true, ts2.ScriptKind.TS);
|
|
1264
1513
|
var parseDiagnosticsFor = (source, filePath) => {
|
|
1265
1514
|
const parseDiagnostics = source.parseDiagnostics ?? [];
|
|
1266
1515
|
return parseDiagnostics.map((diagnostic) => ({
|
|
1267
1516
|
severity: "error",
|
|
1268
1517
|
code: "module-index-typescript-parse-error",
|
|
1269
|
-
message: `TypeScript parse diagnostic TS${diagnostic.code} in ${filePath}: ${
|
|
1518
|
+
message: `TypeScript parse diagnostic TS${diagnostic.code} in ${filePath}: ${ts3.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
1270
1519
|
`)}`,
|
|
1271
1520
|
context: { target: filePath, paths: [filePath] }
|
|
1272
1521
|
}));
|
|
@@ -1284,63 +1533,44 @@ var spanFor = (source, file, node) => {
|
|
|
1284
1533
|
endOffset
|
|
1285
1534
|
};
|
|
1286
1535
|
};
|
|
1287
|
-
var nodeName2 = (node) => {
|
|
1288
|
-
if (!node)
|
|
1289
|
-
return null;
|
|
1290
|
-
if (ts2.isIdentifier(node) || ts2.isStringLiteral(node) || ts2.isNumericLiteral(node))
|
|
1291
|
-
return node.text;
|
|
1292
|
-
return null;
|
|
1293
|
-
};
|
|
1294
|
-
var propertyName2 = (node) => ts2.isPropertyAssignment(node) || ts2.isShorthandPropertyAssignment(node) || ts2.isMethodDeclaration(node) ? nodeName2(node.name) : null;
|
|
1295
|
-
var expressionName2 = (expression) => {
|
|
1296
|
-
if (ts2.isIdentifier(expression))
|
|
1297
|
-
return expression.text;
|
|
1298
|
-
if (ts2.isPropertyAccessExpression(expression))
|
|
1299
|
-
return expression.name.text;
|
|
1300
|
-
if (ts2.isCallExpression(expression))
|
|
1301
|
-
return expressionName2(expression.expression);
|
|
1302
|
-
if (ts2.isAsExpression(expression))
|
|
1303
|
-
return expressionName2(expression.expression);
|
|
1304
|
-
return null;
|
|
1305
|
-
};
|
|
1306
1536
|
var expressionSummary = (expression) => {
|
|
1307
|
-
if (
|
|
1537
|
+
if (ts3.isAsExpression(expression))
|
|
1308
1538
|
return expressionSummary(expression.expression);
|
|
1309
|
-
if (
|
|
1310
|
-
return
|
|
1311
|
-
if (
|
|
1539
|
+
if (ts3.isIdentifier(expression) || ts3.isPropertyAccessExpression(expression))
|
|
1540
|
+
return expressionName(expression) ?? "expression";
|
|
1541
|
+
if (ts3.isArrayLiteralExpression(expression))
|
|
1312
1542
|
return "array-literal";
|
|
1313
|
-
if (
|
|
1543
|
+
if (ts3.isObjectLiteralExpression(expression))
|
|
1314
1544
|
return "object-literal";
|
|
1315
|
-
if (
|
|
1545
|
+
if (ts3.isStringLiteralLike(expression))
|
|
1316
1546
|
return "string-literal";
|
|
1317
|
-
if (
|
|
1547
|
+
if (ts3.isNumericLiteral(expression))
|
|
1318
1548
|
return "numeric-literal";
|
|
1319
|
-
if (expression.kind ===
|
|
1549
|
+
if (expression.kind === ts3.SyntaxKind.TrueKeyword || expression.kind === ts3.SyntaxKind.FalseKeyword) {
|
|
1320
1550
|
return "boolean-literal";
|
|
1321
1551
|
}
|
|
1322
|
-
if (
|
|
1323
|
-
const callee =
|
|
1552
|
+
if (ts3.isCallExpression(expression)) {
|
|
1553
|
+
const callee = expressionName(expression.expression);
|
|
1324
1554
|
return callee ? `${callee}(...)` : "call-expression";
|
|
1325
1555
|
}
|
|
1326
|
-
return
|
|
1556
|
+
return ts3.SyntaxKind[expression.kind] ?? "expression";
|
|
1327
1557
|
};
|
|
1328
1558
|
var typeSummaryForInitializer = (initializer) => {
|
|
1329
1559
|
if (!initializer)
|
|
1330
1560
|
return;
|
|
1331
|
-
const expression =
|
|
1332
|
-
if (!
|
|
1561
|
+
const expression = ts3.isAsExpression(initializer) ? initializer.expression : initializer;
|
|
1562
|
+
if (!ts3.isCallExpression(expression))
|
|
1333
1563
|
return expressionSummary(expression);
|
|
1334
|
-
const callee =
|
|
1564
|
+
const callee = expressionName(expression.expression);
|
|
1335
1565
|
const firstArg = expression.arguments[0];
|
|
1336
1566
|
const argSummary = firstArg ? expressionSummary(firstArg) : "";
|
|
1337
1567
|
return [callee, argSummary ? `(${argSummary})` : ""].filter(Boolean).join("");
|
|
1338
1568
|
};
|
|
1339
1569
|
var fieldsFromObject = (source, file, objectLiteral, kind) => objectLiteral.properties.map((property, index) => {
|
|
1340
|
-
const name =
|
|
1570
|
+
const name = propertyName(property);
|
|
1341
1571
|
if (!name)
|
|
1342
1572
|
return null;
|
|
1343
|
-
const initializer =
|
|
1573
|
+
const initializer = ts3.isPropertyAssignment(property) ? property.initializer : undefined;
|
|
1344
1574
|
return {
|
|
1345
1575
|
name,
|
|
1346
1576
|
kind,
|
|
@@ -1349,31 +1579,8 @@ var fieldsFromObject = (source, file, objectLiteral, kind) => objectLiteral.prop
|
|
|
1349
1579
|
sourceSpan: spanFor(source, file, property)
|
|
1350
1580
|
};
|
|
1351
1581
|
}).filter((field) => field !== null);
|
|
1352
|
-
var firstObjectReturnedByArrow2 = (node) => {
|
|
1353
|
-
if (!ts2.isArrowFunction(node) && !ts2.isFunctionExpression(node))
|
|
1354
|
-
return null;
|
|
1355
|
-
if (ts2.isObjectLiteralExpression(node.body))
|
|
1356
|
-
return node.body;
|
|
1357
|
-
if (ts2.isParenthesizedExpression(node.body) && ts2.isObjectLiteralExpression(node.body.expression)) {
|
|
1358
|
-
return node.body.expression;
|
|
1359
|
-
}
|
|
1360
|
-
if (!ts2.isBlock(node.body))
|
|
1361
|
-
return null;
|
|
1362
|
-
for (const statement of node.body.statements) {
|
|
1363
|
-
if (ts2.isReturnStatement(statement) && statement.expression && ts2.isObjectLiteralExpression(statement.expression)) {
|
|
1364
|
-
return statement.expression;
|
|
1365
|
-
}
|
|
1366
|
-
}
|
|
1367
|
-
return null;
|
|
1368
|
-
};
|
|
1369
|
-
var isViaCall2 = (expression) => ts2.isCallExpression(expression) && expressionName2(expression.expression) === "via";
|
|
1370
|
-
var heritageCall2 = (node) => {
|
|
1371
|
-
const heritage = node.heritageClauses?.flatMap((clause) => [...clause.types]) ?? [];
|
|
1372
|
-
const expression = heritage.find((clause) => isViaCall2(clause.expression))?.expression;
|
|
1373
|
-
return expression && ts2.isCallExpression(expression) ? expression : null;
|
|
1374
|
-
};
|
|
1375
1582
|
var parseConstantIndex = (filePath, content, moduleClassName) => {
|
|
1376
|
-
const source =
|
|
1583
|
+
const source = sourceFileFor(filePath, content);
|
|
1377
1584
|
const diagnostics = parseDiagnosticsFor(source, filePath);
|
|
1378
1585
|
const inputClassName = `${moduleClassName}Input`;
|
|
1379
1586
|
let inputClass = null;
|
|
@@ -1384,22 +1591,22 @@ var parseConstantIndex = (filePath, content, moduleClassName) => {
|
|
|
1384
1591
|
let fields = [];
|
|
1385
1592
|
let lightProjection;
|
|
1386
1593
|
const visit = (node) => {
|
|
1387
|
-
if (!
|
|
1388
|
-
|
|
1594
|
+
if (!ts3.isClassDeclaration(node) || !node.name) {
|
|
1595
|
+
ts3.forEachChild(node, visit);
|
|
1389
1596
|
return;
|
|
1390
1597
|
}
|
|
1391
1598
|
const className = node.name.text;
|
|
1392
|
-
const viaCall =
|
|
1599
|
+
const viaCall = heritageCall(node);
|
|
1393
1600
|
if (className === inputClassName) {
|
|
1394
1601
|
inputClass = node;
|
|
1395
1602
|
if (!viaCall)
|
|
1396
1603
|
return;
|
|
1397
1604
|
inputViaFound = true;
|
|
1398
|
-
const callback = viaCall.arguments.find((arg) =>
|
|
1399
|
-
if (callback && (
|
|
1605
|
+
const callback = viaCall.arguments.find((arg) => ts3.isArrowFunction(arg) || ts3.isFunctionExpression(arg));
|
|
1606
|
+
if (callback && (ts3.isArrowFunction(callback) || ts3.isFunctionExpression(callback))) {
|
|
1400
1607
|
inputBuilderFound = true;
|
|
1401
|
-
builderName =
|
|
1402
|
-
const objectLiteral =
|
|
1608
|
+
builderName = nodeName(callback.parameters[0]?.name) ?? null;
|
|
1609
|
+
const objectLiteral = firstObjectReturnedByArrow(callback);
|
|
1403
1610
|
if (objectLiteral) {
|
|
1404
1611
|
inputBuilderObjectFound = true;
|
|
1405
1612
|
fields = fieldsFromObject(source, filePath, objectLiteral, "constant");
|
|
@@ -1410,15 +1617,15 @@ var parseConstantIndex = (filePath, content, moduleClassName) => {
|
|
|
1410
1617
|
return;
|
|
1411
1618
|
if (className === `Light${moduleClassName}`) {
|
|
1412
1619
|
const projectionArg = viaCall.arguments.find((arg) => {
|
|
1413
|
-
const expression =
|
|
1414
|
-
return
|
|
1620
|
+
const expression = ts3.isAsExpression(arg) ? arg.expression : arg;
|
|
1621
|
+
return ts3.isArrayLiteralExpression(expression);
|
|
1415
1622
|
});
|
|
1416
|
-
const arrayLiteral = projectionArg ?
|
|
1417
|
-
if (arrayLiteral &&
|
|
1623
|
+
const arrayLiteral = projectionArg ? ts3.isAsExpression(projectionArg) ? projectionArg.expression : projectionArg : null;
|
|
1624
|
+
if (arrayLiteral && ts3.isArrayLiteralExpression(arrayLiteral)) {
|
|
1418
1625
|
lightProjection = {
|
|
1419
1626
|
className,
|
|
1420
1627
|
sourceSpan: spanFor(source, filePath, arrayLiteral),
|
|
1421
|
-
fields: arrayLiteral.elements.map((element, order) =>
|
|
1628
|
+
fields: arrayLiteral.elements.map((element, order) => ts3.isStringLiteralLike(element) ? {
|
|
1422
1629
|
name: element.text,
|
|
1423
1630
|
kind: "lightProjection",
|
|
1424
1631
|
order,
|
|
@@ -1429,7 +1636,7 @@ var parseConstantIndex = (filePath, content, moduleClassName) => {
|
|
|
1429
1636
|
}
|
|
1430
1637
|
}
|
|
1431
1638
|
};
|
|
1432
|
-
|
|
1639
|
+
ts3.forEachChild(source, visit);
|
|
1433
1640
|
if (!inputClass) {
|
|
1434
1641
|
diagnostics.push({
|
|
1435
1642
|
severity: "error",
|
|
@@ -1471,29 +1678,28 @@ var parseConstantIndex = (filePath, content, moduleClassName) => {
|
|
|
1471
1678
|
diagnostics
|
|
1472
1679
|
};
|
|
1473
1680
|
};
|
|
1474
|
-
var callExpressionName2 = (node) => ts2.isPropertyAccessExpression(node.expression) ? node.expression.name.text : expressionName2(node.expression);
|
|
1475
1681
|
var parseDictionaryIndex = (filePath, content, moduleClassName) => {
|
|
1476
|
-
const source =
|
|
1682
|
+
const source = sourceFileFor(filePath, content);
|
|
1477
1683
|
const diagnostics = parseDiagnosticsFor(source, filePath);
|
|
1478
1684
|
let index;
|
|
1479
1685
|
let modelFound = false;
|
|
1480
1686
|
const visit = (node) => {
|
|
1481
|
-
if (modelFound || !
|
|
1482
|
-
|
|
1687
|
+
if (modelFound || !ts3.isCallExpression(node)) {
|
|
1688
|
+
ts3.forEachChild(node, visit);
|
|
1483
1689
|
return;
|
|
1484
1690
|
}
|
|
1485
|
-
if (
|
|
1486
|
-
|
|
1691
|
+
if (callExpressionName(node) !== "model") {
|
|
1692
|
+
ts3.forEachChild(node, visit);
|
|
1487
1693
|
return;
|
|
1488
1694
|
}
|
|
1489
1695
|
const typeArgument = node.typeArguments?.[0];
|
|
1490
1696
|
if (!typeArgument || typeArgument.getText(source) !== moduleClassName) {
|
|
1491
|
-
|
|
1697
|
+
ts3.forEachChild(node, visit);
|
|
1492
1698
|
return;
|
|
1493
1699
|
}
|
|
1494
1700
|
modelFound = true;
|
|
1495
|
-
const callback = node.arguments.find((arg) =>
|
|
1496
|
-
if (!callback || !
|
|
1701
|
+
const callback = node.arguments.find((arg) => ts3.isArrowFunction(arg) || ts3.isFunctionExpression(arg));
|
|
1702
|
+
if (!callback || !ts3.isArrowFunction(callback) && !ts3.isFunctionExpression(callback)) {
|
|
1497
1703
|
diagnostics.push({
|
|
1498
1704
|
severity: "error",
|
|
1499
1705
|
code: "module-index-dictionary-builder-missing",
|
|
@@ -1502,7 +1708,7 @@ var parseDictionaryIndex = (filePath, content, moduleClassName) => {
|
|
|
1502
1708
|
});
|
|
1503
1709
|
return;
|
|
1504
1710
|
}
|
|
1505
|
-
const objectLiteral =
|
|
1711
|
+
const objectLiteral = firstObjectReturnedByArrow(callback);
|
|
1506
1712
|
if (!objectLiteral) {
|
|
1507
1713
|
diagnostics.push({
|
|
1508
1714
|
severity: "error",
|
|
@@ -1514,12 +1720,12 @@ var parseDictionaryIndex = (filePath, content, moduleClassName) => {
|
|
|
1514
1720
|
index = {
|
|
1515
1721
|
path: filePath,
|
|
1516
1722
|
modelClassName: moduleClassName,
|
|
1517
|
-
translatorName:
|
|
1723
|
+
translatorName: nodeName(callback.parameters[0]?.name),
|
|
1518
1724
|
fields: objectLiteral ? fieldsFromObject(source, filePath, objectLiteral, "dictionary") : [],
|
|
1519
1725
|
sourceSpan: spanFor(source, filePath, node)
|
|
1520
1726
|
};
|
|
1521
1727
|
};
|
|
1522
|
-
|
|
1728
|
+
ts3.forEachChild(source, visit);
|
|
1523
1729
|
return { index, diagnostics, modelFound };
|
|
1524
1730
|
};
|
|
1525
1731
|
var expectedFilesFor = (module) => {
|
|
@@ -1683,15 +1889,8 @@ var workflowStringInput = (value) => typeof value === "string" ? value : null;
|
|
|
1683
1889
|
var workflowStringListInput = (value) => Array.isArray(value) ? value.join(",") : null;
|
|
1684
1890
|
var workflowStringArrayInput = (value) => Array.isArray(value) ? value : null;
|
|
1685
1891
|
var workflowBooleanInput = (value) => typeof value === "boolean" ? value : null;
|
|
1686
|
-
var postApplyDiagnostic = (code, message, target) => ({
|
|
1687
|
-
severity
|
|
1688
|
-
code,
|
|
1689
|
-
message,
|
|
1690
|
-
failureScope: "source-change",
|
|
1691
|
-
context: { target }
|
|
1692
|
-
});
|
|
1693
|
-
var postApplyWarning = (code, message, target) => ({
|
|
1694
|
-
severity: "warning",
|
|
1892
|
+
var postApplyDiagnostic = (code, message, target, severity = "error") => ({
|
|
1893
|
+
severity,
|
|
1695
1894
|
code,
|
|
1696
1895
|
message,
|
|
1697
1896
|
failureScope: "source-change",
|
|
@@ -1699,9 +1898,9 @@ var postApplyWarning = (code, message, target) => ({
|
|
|
1699
1898
|
});
|
|
1700
1899
|
var sourceKindForPath = (filePath) => {
|
|
1701
1900
|
if (filePath.endsWith(".tsx"))
|
|
1702
|
-
return
|
|
1901
|
+
return ts4.ScriptKind.TSX;
|
|
1703
1902
|
if (filePath.endsWith(".ts"))
|
|
1704
|
-
return
|
|
1903
|
+
return ts4.ScriptKind.TS;
|
|
1705
1904
|
return null;
|
|
1706
1905
|
};
|
|
1707
1906
|
var checkPathCasing = async (workspace, filePath) => {
|
|
@@ -1729,7 +1928,7 @@ var checkTypeScriptSyntax = async (workspace, filePath) => {
|
|
|
1729
1928
|
if (!scriptKind)
|
|
1730
1929
|
return null;
|
|
1731
1930
|
const content = await workspace.readFile(filePath);
|
|
1732
|
-
const source =
|
|
1931
|
+
const source = ts4.createSourceFile(filePath, content, ts4.ScriptTarget.Latest, true, scriptKind);
|
|
1733
1932
|
const diagnostic = (source.parseDiagnostics ?? [])[0];
|
|
1734
1933
|
if (!diagnostic)
|
|
1735
1934
|
return null;
|
|
@@ -1737,33 +1936,29 @@ var checkTypeScriptSyntax = async (workspace, filePath) => {
|
|
|
1737
1936
|
const location = position ? `:${position.line + 1}:${position.character + 1}` : "";
|
|
1738
1937
|
return {
|
|
1739
1938
|
code: "workflow-post-apply-syntax-error",
|
|
1740
|
-
message: `Generated source has a TypeScript syntax error at ${filePath}${location}: ${
|
|
1939
|
+
message: `Generated source has a TypeScript syntax error at ${filePath}${location}: ${ts4.flattenDiagnosticMessageText(diagnostic.messageText, " ")}`
|
|
1741
1940
|
};
|
|
1742
1941
|
};
|
|
1743
1942
|
var checkChangedFile = async (workspace, file) => {
|
|
1744
1943
|
if (file.action === "remove")
|
|
1745
1944
|
return { postApplyChecks: [] };
|
|
1746
|
-
const
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
return { diagnostics, postApplyChecks: checks };
|
|
1753
|
-
}
|
|
1754
|
-
const syntaxIssue = await checkTypeScriptSyntax(workspace, file.path);
|
|
1755
|
-
if (syntaxIssue) {
|
|
1756
|
-
diagnostics.push(postApplyDiagnostic(syntaxIssue.code, syntaxIssue.message, file.path));
|
|
1757
|
-
checks.push({ ...syntaxIssue, target: file.path, status: "failed" });
|
|
1758
|
-
return { diagnostics, postApplyChecks: checks };
|
|
1945
|
+
const issue = await checkPathCasing(workspace, file.path) ?? await checkTypeScriptSyntax(workspace, file.path);
|
|
1946
|
+
if (issue) {
|
|
1947
|
+
return {
|
|
1948
|
+
diagnostics: [postApplyDiagnostic(issue.code, issue.message, file.path)],
|
|
1949
|
+
postApplyChecks: [{ ...issue, target: file.path, status: "failed" }]
|
|
1950
|
+
};
|
|
1759
1951
|
}
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1952
|
+
return {
|
|
1953
|
+
postApplyChecks: [
|
|
1954
|
+
{
|
|
1955
|
+
code: "workflow-post-apply-file-valid",
|
|
1956
|
+
target: file.path,
|
|
1957
|
+
status: "passed",
|
|
1958
|
+
message: "Changed file exists with exact casing and parses as source when applicable."
|
|
1959
|
+
}
|
|
1960
|
+
]
|
|
1961
|
+
};
|
|
1767
1962
|
};
|
|
1768
1963
|
var checkRecommendationPath = async (workspace, recommendation) => {
|
|
1769
1964
|
if (!recommendation.target || recommendation.target.includes("*") || recommendation.target.startsWith("<"))
|
|
@@ -1815,12 +2010,6 @@ var workflowModuleContext = async (workspace, plan) => {
|
|
|
1815
2010
|
files
|
|
1816
2011
|
};
|
|
1817
2012
|
};
|
|
1818
|
-
var structureCheck = (code, target, status, message) => ({
|
|
1819
|
-
code,
|
|
1820
|
-
target,
|
|
1821
|
-
status,
|
|
1822
|
-
message
|
|
1823
|
-
});
|
|
1824
2013
|
var checkAddFieldStructure = async (workspace, plan) => {
|
|
1825
2014
|
if (plan.workflow !== "add-field" && plan.workflow !== "add-enum-field")
|
|
1826
2015
|
return {};
|
|
@@ -1857,7 +2046,12 @@ var checkAddFieldStructure = async (workspace, plan) => {
|
|
|
1857
2046
|
...index.diagnostics.filter((diagnostic) => diagnostic.severity === "error" && diagnostic.context?.paths?.includes(constantPath)).map((diagnostic) => diagnostic.message)
|
|
1858
2047
|
].filter((failure) => failure !== null);
|
|
1859
2048
|
const constantValid = constantFailures.length === 0;
|
|
1860
|
-
postApplyChecks.push(
|
|
2049
|
+
postApplyChecks.push({
|
|
2050
|
+
code: constantValid ? "workflow-post-apply-constant-shape-valid" : "workflow-post-apply-structure-invalid",
|
|
2051
|
+
target: constantPath,
|
|
2052
|
+
status: constantValid ? "passed" : "failed",
|
|
2053
|
+
message: constantValid ? `${inputClassName} keeps via structure, builder usage, imports, and requested field presence.` : constantFailures.join(" ")
|
|
2054
|
+
});
|
|
1861
2055
|
if (!constantValid) {
|
|
1862
2056
|
diagnostics.push(postApplyDiagnostic("workflow-post-apply-structure-invalid", constantFailures.join(" "), constantPath));
|
|
1863
2057
|
}
|
|
@@ -1871,16 +2065,26 @@ var checkAddFieldStructure = async (workspace, plan) => {
|
|
|
1871
2065
|
...index.diagnostics.filter((diagnostic) => diagnostic.severity === "error" && diagnostic.context?.paths?.includes(dictionaryPath)).map((diagnostic) => diagnostic.message)
|
|
1872
2066
|
].filter((failure) => failure !== null);
|
|
1873
2067
|
const dictionaryValid = dictionaryFailures.length === 0;
|
|
1874
|
-
postApplyChecks.push(
|
|
2068
|
+
postApplyChecks.push({
|
|
2069
|
+
code: dictionaryValid ? "workflow-post-apply-dictionary-shape-valid" : "workflow-post-apply-structure-invalid",
|
|
2070
|
+
target: dictionaryPath,
|
|
2071
|
+
status: dictionaryValid ? "passed" : "failed",
|
|
2072
|
+
message: dictionaryValid ? `.model<${moduleClassName}> keeps the requested field inside the model object and preserves dictionary chain order.` : dictionaryFailures.join(" ")
|
|
2073
|
+
});
|
|
1875
2074
|
if (!dictionaryValid) {
|
|
1876
2075
|
diagnostics.push(postApplyDiagnostic("workflow-post-apply-structure-invalid", dictionaryFailures.join(" "), dictionaryPath));
|
|
1877
2076
|
}
|
|
1878
2077
|
const constantOrderValid = fieldOrderValid(constantNames, fieldName);
|
|
1879
2078
|
const dictionaryOrderValid = fieldOrderValid(dictionaryStructure.fields, fieldName);
|
|
1880
2079
|
const orderValid = constantOrderValid && dictionaryOrderValid;
|
|
1881
|
-
postApplyChecks.push(
|
|
2080
|
+
postApplyChecks.push({
|
|
2081
|
+
code: "workflow-post-apply-field-order-valid",
|
|
2082
|
+
target: `${constantPath}, ${dictionaryPath}`,
|
|
2083
|
+
status: orderValid ? "passed" : "failed",
|
|
2084
|
+
message: orderValid ? `Field "${fieldName}" follows the shared priority ordering policy.` : `Field "${fieldName}" is present but does not match the shared priority ordering policy.`
|
|
2085
|
+
});
|
|
1882
2086
|
if (!orderValid) {
|
|
1883
|
-
diagnostics.push(
|
|
2087
|
+
diagnostics.push(postApplyDiagnostic("workflow-post-apply-field-order-mismatch", `Field "${fieldName}" is present but does not match the shared priority ordering policy.`, `${constantPath}, ${dictionaryPath}`, "warning"));
|
|
1884
2088
|
}
|
|
1885
2089
|
return { diagnostics, postApplyChecks };
|
|
1886
2090
|
};
|
|
@@ -1912,6 +2116,10 @@ var unsupportedInput = (input, message) => ({
|
|
|
1912
2116
|
input,
|
|
1913
2117
|
message
|
|
1914
2118
|
});
|
|
2119
|
+
var surfaceReview = (plan, { code, target, action, message, reason }) => ({
|
|
2120
|
+
recommendations: [{ code, kind: "manual-action", target, action, confidence: "medium", message }],
|
|
2121
|
+
nextActions: [{ command: `akan workflow explain ${plan.workflow}`, reason }]
|
|
2122
|
+
});
|
|
1915
2123
|
var addFieldUiSurfaceInspection = (plan) => {
|
|
1916
2124
|
const app = workflowStringInput(plan.inputs.app);
|
|
1917
2125
|
const module = workflowStringInput(plan.inputs.module) ?? "<module>";
|
|
@@ -1920,26 +2128,38 @@ var addFieldUiSurfaceInspection = (plan) => {
|
|
|
1920
2128
|
const policy = addFieldUiPolicyForType(typeName ?? "String");
|
|
1921
2129
|
const surfaces = workflowStringArrayInput(plan.inputs.surfaces);
|
|
1922
2130
|
const templateRequested = surfaces?.includes("template") ?? false;
|
|
1923
|
-
const moduleClassName = moduleComponentName(module);
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
};
|
|
2131
|
+
const moduleClassName = moduleComponentName(module);
|
|
2132
|
+
return surfaceReview(plan, {
|
|
2133
|
+
code: "add-field-ui-surface-review",
|
|
2134
|
+
target: `${app ? `apps/${app}` : "*"}/${moduleSourcePaths(module).template}`,
|
|
2135
|
+
action: templateRequested ? `Template was requested for ${field}. If no Template file changed, users will not see the field in the form yet because the file was missing, the generated ${module}Form/Layout.Template pattern was not found, or ${policy.component} needs option binding. Add it inside Layout.Template near existing Field components.` : `Template was not selected, so users will not see ${field} in the form from this apply. If list/card display is needed, include ${field} in Light${moduleClassName} projection data and place it in the local Unit/View card layout.`,
|
|
2136
|
+
message: `Review user-visible UI for ${module}.${field}; recommended component is ${policy.component}.`,
|
|
2137
|
+
reason: "Review UI surface guidance before manually editing ambiguous UI files."
|
|
2138
|
+
});
|
|
2139
|
+
};
|
|
2140
|
+
var addMutationActionSurfaceInspection = (plan) => {
|
|
2141
|
+
const module = workflowStringInput(plan.inputs.module) ?? "<module>";
|
|
2142
|
+
const mutation = workflowStringInput(plan.inputs.mutation) ?? "<mutation>";
|
|
2143
|
+
const moduleClassName = moduleComponentName(module);
|
|
2144
|
+
return surfaceReview(plan, {
|
|
2145
|
+
code: "add-mutation-action-surface-review",
|
|
2146
|
+
target: `*/${moduleSourcePaths(module).store}`,
|
|
2147
|
+
action: `Name the endpoint's guards and add its dictionary .endpoint() entry with a .desc(). After sync, fetch.${mutation} exists; write a store action only for a toast, an optimistic update, or a multi-field write, and put the control that calls it in ${moduleClassName}.Util.tsx.`,
|
|
2148
|
+
message: `Workflow apply does not write store or UI code for ${module}.${mutation}; review whether a screen should call it.`,
|
|
2149
|
+
reason: "Review action surface guidance before manually editing store or UI files."
|
|
2150
|
+
});
|
|
2151
|
+
};
|
|
2152
|
+
var addSliceViewSurfaceInspection = (plan) => {
|
|
2153
|
+
const module = workflowStringInput(plan.inputs.module) ?? "<module>";
|
|
2154
|
+
const slice = workflowStringInput(plan.inputs.slice) ?? "<slice>";
|
|
2155
|
+
const moduleClassName = moduleComponentName(module);
|
|
2156
|
+
return surfaceReview(plan, {
|
|
2157
|
+
code: "add-slice-view-surface-review",
|
|
2158
|
+
target: `*/${moduleSourcePaths(module).zone}`,
|
|
2159
|
+
action: `Fill in the service query stub and add the dictionary .slice() entry. After sync, load fetch.init${moduleClassName}${capitalize2(slice)}() in the page and pass the result to a ${moduleClassName}.Zone as an init prop.`,
|
|
2160
|
+
message: `Workflow apply does not write page or Zone code for ${module}.${slice}; review where the list should render.`,
|
|
2161
|
+
reason: "Review view surface guidance before manually editing Zone or page files."
|
|
2162
|
+
});
|
|
1943
2163
|
};
|
|
1944
2164
|
var createWorkflowStepRegistry = ({
|
|
1945
2165
|
workspace,
|
|
@@ -2032,12 +2252,14 @@ var createWorkflowStepRegistry = ({
|
|
|
2032
2252
|
mutation: workflowStringInput(plan.inputs.mutation)
|
|
2033
2253
|
})),
|
|
2034
2254
|
[workflowStepKey("add-mutation", "update-signal")]: inspect,
|
|
2255
|
+
[workflowStepKey("add-mutation", "update-action-surfaces")]: async (_step, plan) => addMutationActionSurfaceInspection(plan),
|
|
2035
2256
|
[workflowStepKey("add-slice", "update-service-query")]: async (_step, plan) => primitiveReportToWorkflowStepResult(await addSlice({
|
|
2036
2257
|
app: workflowStringInput(plan.inputs.app),
|
|
2037
2258
|
module: workflowStringInput(plan.inputs.module),
|
|
2038
2259
|
slice: workflowStringInput(plan.inputs.slice)
|
|
2039
2260
|
})),
|
|
2040
|
-
[workflowStepKey("add-slice", "update-signal-slice")]: inspect
|
|
2261
|
+
[workflowStepKey("add-slice", "update-signal-slice")]: inspect,
|
|
2262
|
+
[workflowStepKey("add-slice", "connect-view-surfaces")]: async (_step, plan) => addSliceViewSurfaceInspection(plan)
|
|
2041
2263
|
};
|
|
2042
2264
|
};
|
|
2043
2265
|
class WorkflowExecutor {
|
|
@@ -2055,20 +2277,20 @@ class WorkflowExecutor {
|
|
|
2055
2277
|
const postApplyChecks = [];
|
|
2056
2278
|
const recommendations = [...plan.recommendations];
|
|
2057
2279
|
const nextActions = [];
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2280
|
+
const report = () => createWorkflowApplyReport({
|
|
2281
|
+
workflow: plan.workflow,
|
|
2282
|
+
mode: "apply",
|
|
2283
|
+
changedFiles,
|
|
2284
|
+
generatedFiles,
|
|
2285
|
+
recommendedValidationCommands,
|
|
2286
|
+
diagnostics,
|
|
2287
|
+
postApplyChecks,
|
|
2288
|
+
recommendations,
|
|
2289
|
+
nextActions,
|
|
2290
|
+
plan
|
|
2291
|
+
});
|
|
2292
|
+
if (diagnostics.some((diagnostic) => diagnostic.severity === "error"))
|
|
2293
|
+
return report();
|
|
2072
2294
|
recommendedValidationCommands.push(...workflowCommandsForPlan(plan));
|
|
2073
2295
|
nextActions.push(...workflowCommandsForPlan(plan));
|
|
2074
2296
|
for (const step of plan.steps) {
|
|
@@ -2111,22 +2333,11 @@ class WorkflowExecutor {
|
|
|
2111
2333
|
const recommendationDiagnostics = await Promise.all(recommendations.map((recommendation) => checkRecommendationPath(this.workspace, recommendation)));
|
|
2112
2334
|
diagnostics.push(...recommendationDiagnostics.filter((diagnostic) => !!diagnostic));
|
|
2113
2335
|
}
|
|
2114
|
-
return
|
|
2115
|
-
workflow: plan.workflow,
|
|
2116
|
-
mode: "apply",
|
|
2117
|
-
changedFiles,
|
|
2118
|
-
generatedFiles,
|
|
2119
|
-
recommendedValidationCommands,
|
|
2120
|
-
diagnostics,
|
|
2121
|
-
postApplyChecks,
|
|
2122
|
-
recommendations,
|
|
2123
|
-
nextActions,
|
|
2124
|
-
plan
|
|
2125
|
-
});
|
|
2336
|
+
return report();
|
|
2126
2337
|
}
|
|
2127
2338
|
}
|
|
2128
2339
|
// pkgs/@akanjs/devkit/workflow/plan.ts
|
|
2129
|
-
import { capitalize } from "akanjs/common";
|
|
2340
|
+
import { capitalize as capitalize3 } from "akanjs/common";
|
|
2130
2341
|
var surfaceModes = new Set(["infer", "include", "skip"]);
|
|
2131
2342
|
var parseStringList = (value) => {
|
|
2132
2343
|
if (Array.isArray(value)) {
|
|
@@ -2269,7 +2480,7 @@ var createAddFieldRecommendations = (inputs) => {
|
|
|
2269
2480
|
kind: "placement",
|
|
2270
2481
|
target: paths.constant,
|
|
2271
2482
|
confidence: "high",
|
|
2272
|
-
message: `Insert ${field}: field(${normalizedType}) in ${
|
|
2483
|
+
message: `Insert ${field}: field(${normalizedType}) in ${capitalize3(module)}Input.`
|
|
2273
2484
|
},
|
|
2274
2485
|
{
|
|
2275
2486
|
code: "add-field-placement-dictionary",
|
|
@@ -2296,25 +2507,20 @@ var createAddFieldRecommendations = (inputs) => {
|
|
|
2296
2507
|
message: `Template exposure for ${module}.${field} is not selected yet.`
|
|
2297
2508
|
}
|
|
2298
2509
|
] : [],
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
target: paths.constant,
|
|
2314
|
-
confidence: "high",
|
|
2315
|
-
message: `Add ${field} to Light${capitalize(module)} projection fields.`
|
|
2316
|
-
}
|
|
2317
|
-
] : [],
|
|
2510
|
+
includeInLight ? {
|
|
2511
|
+
code: "add-field-light-projection",
|
|
2512
|
+
kind: "placement",
|
|
2513
|
+
target: paths.constant,
|
|
2514
|
+
confidence: "high",
|
|
2515
|
+
message: `Add ${field} to Light${capitalize3(module)} projection fields.`
|
|
2516
|
+
} : {
|
|
2517
|
+
code: "add-field-light-projection-choice",
|
|
2518
|
+
kind: "manual-action",
|
|
2519
|
+
target: paths.constant,
|
|
2520
|
+
action: `Pass includeInLight=true when users should see ${field} in list/card data. Without it, the field can exist on ${capitalize3(module)}Input but stay absent from Light${capitalize3(module)} projections.`,
|
|
2521
|
+
confidence: "medium",
|
|
2522
|
+
message: `${module}.${field} is not selected for list/card projection data.`
|
|
2523
|
+
},
|
|
2318
2524
|
...surfaces && !templateRequested ? [
|
|
2319
2525
|
{
|
|
2320
2526
|
code: "add-field-ui-surface-skip",
|
|
@@ -2329,7 +2535,7 @@ var createAddFieldRecommendations = (inputs) => {
|
|
|
2329
2535
|
code: "add-field-ui-manual-review",
|
|
2330
2536
|
kind: "manual-action",
|
|
2331
2537
|
target: paths.template,
|
|
2332
|
-
action: `After apply, verify what users can see: Template form auto-edit only runs when a generated ${module}Form hook and Layout.Template field list are present. Unit/View cards are not auto-edited, so ${field} may be stored on ${
|
|
2538
|
+
action: `After apply, verify what users can see: Template form auto-edit only runs when a generated ${module}Form hook and Layout.Template field list are present. Unit/View cards are not auto-edited, so ${field} may be stored on ${capitalize3(module)} but not shown in list/card UI until you place it in the local card layout.`,
|
|
2333
2539
|
confidence: "medium",
|
|
2334
2540
|
message: `${app}:${module}.${field} may need UI review for user-visible Template, Unit, and View behavior.`
|
|
2335
2541
|
},
|
|
@@ -2481,235 +2687,6 @@ var createWorkflowPlan = (spec, rawInputs) => {
|
|
|
2481
2687
|
approval: workflowPlanApproval
|
|
2482
2688
|
};
|
|
2483
2689
|
};
|
|
2484
|
-
// pkgs/@akanjs/devkit/workflow/render.ts
|
|
2485
|
-
var renderWorkflowList = (specs) => [
|
|
2486
|
-
"# Akan Workflows",
|
|
2487
|
-
"",
|
|
2488
|
-
...specs.flatMap((spec) => [`- \`${spec.name}\`: ${spec.description}`, ` - When: ${spec.whenToUse}`]),
|
|
2489
|
-
""
|
|
2490
|
-
].join(`
|
|
2491
|
-
`);
|
|
2492
|
-
var renderWorkflowExplain = (spec) => [
|
|
2493
|
-
`# Workflow: ${spec.name}`,
|
|
2494
|
-
"",
|
|
2495
|
-
spec.description,
|
|
2496
|
-
"",
|
|
2497
|
-
"## When To Use",
|
|
2498
|
-
spec.whenToUse,
|
|
2499
|
-
"",
|
|
2500
|
-
"## Inputs",
|
|
2501
|
-
...Object.entries(spec.inputs).map(([name, input]) => `- \`${name}\`${input.required ? " (required)" : ""}: ${input.description}${input.allowedValues ? ` Allowed: ${input.allowedValues.join(", ")}.` : ""}`),
|
|
2502
|
-
"",
|
|
2503
|
-
"## Optional Surfaces",
|
|
2504
|
-
...Object.entries(spec.optionalSurfaces ?? {}).map(([name, mode]) => `- \`${name}\`: ${mode}`),
|
|
2505
|
-
"",
|
|
2506
|
-
"## Steps",
|
|
2507
|
-
...spec.steps.map((step, index) => `${index + 1}. \`${step.id}\` (${step.tool}): ${step.description}`),
|
|
2508
|
-
"",
|
|
2509
|
-
"## Validation",
|
|
2510
|
-
...spec.validation.map((validation) => `- \`${validation.command}\`: ${validation.reason}`),
|
|
2511
|
-
""
|
|
2512
|
-
].join(`
|
|
2513
|
-
`);
|
|
2514
|
-
var renderWorkflowPlan = (plan) => [
|
|
2515
|
-
`# Workflow Plan: ${plan.workflow}`,
|
|
2516
|
-
"",
|
|
2517
|
-
`- Mode: ${plan.mode}`,
|
|
2518
|
-
`- Requires approval: ${plan.requiresApproval}`,
|
|
2519
|
-
`- Approval: ${plan.approval?.meaning ?? "Review this read-only plan before applying workflow mutations."}`,
|
|
2520
|
-
"",
|
|
2521
|
-
"## Inputs",
|
|
2522
|
-
...Object.entries(plan.inputs).map(([name, value]) => `- \`${name}\`: ${Array.isArray(value) ? value.join(", ") : value}`),
|
|
2523
|
-
"",
|
|
2524
|
-
"## Optional Surfaces",
|
|
2525
|
-
...Object.entries(plan.optionalSurfaces).map(([name, mode]) => `- \`${name}\`: ${mode}`),
|
|
2526
|
-
"",
|
|
2527
|
-
"## Steps",
|
|
2528
|
-
...plan.steps.map((step, index) => `${index + 1}. \`${step.id}\` (${step.tool}): ${step.description}`),
|
|
2529
|
-
"",
|
|
2530
|
-
"## Predicted Changes",
|
|
2531
|
-
...plan.predictedChanges.map((change) => {
|
|
2532
|
-
const scope = change.applyScope ? ` (${change.applyScope})` : "";
|
|
2533
|
-
return `- \`${change.action}\`${scope} ${change.target}: ${change.reason}`;
|
|
2534
|
-
}),
|
|
2535
|
-
"",
|
|
2536
|
-
"## Validation",
|
|
2537
|
-
...plan.validation.map((validation) => `- \`${validation.command}\`: ${validation.reason}`),
|
|
2538
|
-
"",
|
|
2539
|
-
"## Diagnostics",
|
|
2540
|
-
...plan.diagnostics.length ? plan.diagnostics.map((diagnostic) => `- [${diagnostic.severity}] ${diagnostic.code}: ${diagnostic.message}`) : ["- none"],
|
|
2541
|
-
"",
|
|
2542
|
-
"## Recommendations",
|
|
2543
|
-
...plan.recommendations.length ? plan.recommendations.map((recommendation) => `- [${recommendation.kind}] ${recommendation.message}`) : ["- none"],
|
|
2544
|
-
""
|
|
2545
|
-
].join(`
|
|
2546
|
-
`);
|
|
2547
|
-
var renderRecommendation = (recommendation) => {
|
|
2548
|
-
const target = recommendation.target ? ` ${recommendation.target}` : "";
|
|
2549
|
-
const action = recommendation.action ? ` Action: ${recommendation.action}` : "";
|
|
2550
|
-
return `- [${recommendation.kind}]${target} ${recommendation.message}${action}`;
|
|
2551
|
-
};
|
|
2552
|
-
var renderDiagnostic = (diagnostic) => `- [${diagnostic.severity}] ${diagnostic.code}: ${diagnostic.message}`;
|
|
2553
|
-
var renderNextAction = (action) => `- \`${action.command}\`: ${action.reason}`;
|
|
2554
|
-
var applySourceStatus = (report) => report.diagnostics.some((diagnostic) => diagnostic.severity === "error" && (diagnostic.failureScope === "source-change" || !diagnostic.failureScope || diagnostic.failureScope === "unknown")) ? "failed" : "passed";
|
|
2555
|
-
var renderWorkflowApplyReport = (report) => {
|
|
2556
|
-
const applySummary = {
|
|
2557
|
-
sourceFilesChanged: report.summary?.sourceFilesChanged ?? report.changedFiles,
|
|
2558
|
-
generatedFilesSynced: report.summary?.generatedFilesSynced ?? report.generatedFiles
|
|
2559
|
-
};
|
|
2560
|
-
const manualReviewItems = [
|
|
2561
|
-
...report.diagnostics.filter((diagnostic) => diagnostic.severity === "warning").map(renderDiagnostic),
|
|
2562
|
-
...report.recommendations.filter((recommendation) => recommendation.kind === "manual-action").map(renderRecommendation)
|
|
2563
|
-
];
|
|
2564
|
-
const validationBlockers = report.diagnostics.filter((diagnostic) => diagnostic.severity === "error" && (diagnostic.failureScope === "workspace-config" || diagnostic.failureScope === "environment")).map(renderDiagnostic);
|
|
2565
|
-
const sourceBlockers = report.diagnostics.filter((diagnostic) => diagnostic.severity === "error" && (diagnostic.failureScope === "source-change" || !diagnostic.failureScope || diagnostic.failureScope === "unknown")).map(renderDiagnostic);
|
|
2566
|
-
return [
|
|
2567
|
-
`# Workflow Apply: ${report.workflow}`,
|
|
2568
|
-
"",
|
|
2569
|
-
`- Mode: ${report.mode}`,
|
|
2570
|
-
`- Status: ${report.status}`,
|
|
2571
|
-
`- Source-change status: ${applySourceStatus(report)}`,
|
|
2572
|
-
`- Workspace status: ${validationBlockers.length ? "blocked" : "not blocked during apply"}`,
|
|
2573
|
-
`- Source files changed: ${applySummary.sourceFilesChanged.length}`,
|
|
2574
|
-
`- Generated files queued for sync: ${applySummary.generatedFilesSynced.length}`,
|
|
2575
|
-
...report.validationTarget ? [`- Validation target: ${report.validationTarget}`] : [],
|
|
2576
|
-
"",
|
|
2577
|
-
"## Apply Checks",
|
|
2578
|
-
...report.postApplyChecks?.length ? report.postApplyChecks.map((check) => `- [${check.status}] ${check.code} ${check.target}: ${check.message}`) : ["- not run"],
|
|
2579
|
-
"",
|
|
2580
|
-
"## Source Change Blockers",
|
|
2581
|
-
...sourceBlockers.length ? sourceBlockers : ["- none"],
|
|
2582
|
-
"",
|
|
2583
|
-
"## Automatically Modified",
|
|
2584
|
-
...applySummary.sourceFilesChanged.length ? applySummary.sourceFilesChanged.map((file) => `- \`${file.action}\` ${file.path}: ${file.reason}`) : ["- none"],
|
|
2585
|
-
"",
|
|
2586
|
-
"## Generated Sync",
|
|
2587
|
-
...applySummary.generatedFilesSynced.length ? applySummary.generatedFilesSynced.map((file) => `- \`${file.action}\` ${file.path}: ${file.reason}`) : ["- none"],
|
|
2588
|
-
"",
|
|
2589
|
-
"## Applied Commands",
|
|
2590
|
-
...report.appliedCommands.length ? report.appliedCommands.map((command) => `- \`${command.command}\`: ${command.reason}`) : ["- none"],
|
|
2591
|
-
"",
|
|
2592
|
-
"## Recommended Validation Commands",
|
|
2593
|
-
...report.recommendedValidationCommands.length ? report.recommendedValidationCommands.map((command) => `- \`${command.command}\`: ${command.reason}`) : ["- none"],
|
|
2594
|
-
"",
|
|
2595
|
-
"## User Review Required",
|
|
2596
|
-
...manualReviewItems.length ? manualReviewItems : ["- none"],
|
|
2597
|
-
"",
|
|
2598
|
-
"## Validation Blockers",
|
|
2599
|
-
...validationBlockers.length ? validationBlockers : report.recommendedValidationCommands.length ? ["- none detected during apply; run validation with the validation target for command-level blockers."] : ["- none"],
|
|
2600
|
-
"",
|
|
2601
|
-
"## Diagnostics",
|
|
2602
|
-
...report.diagnostics.length ? report.diagnostics.map(renderDiagnostic) : ["- none"],
|
|
2603
|
-
"",
|
|
2604
|
-
"## Recommendations",
|
|
2605
|
-
...report.recommendations.length ? report.recommendations.slice(0, 3).map(renderRecommendation) : ["- none"],
|
|
2606
|
-
"",
|
|
2607
|
-
"## Next Actions",
|
|
2608
|
-
...report.nextActions.length ? report.nextActions.slice(0, 3).map(renderNextAction) : ["- none"],
|
|
2609
|
-
""
|
|
2610
|
-
].join(`
|
|
2611
|
-
`);
|
|
2612
|
-
};
|
|
2613
|
-
var renderWorkflowApply = (report, format = "markdown") => format === "json" ? jsonText(report) : renderWorkflowApplyReport(report);
|
|
2614
|
-
var renderWorkflowValidationRunReport = (report) => {
|
|
2615
|
-
const baselineSummary = report.baselineSummary ?? {
|
|
2616
|
-
status: report.baselineDiagnostics?.some((diagnostic) => diagnostic.severity === "error") ? "failed" : "unknown",
|
|
2617
|
-
total: report.baselineDiagnostics?.length ?? 0,
|
|
2618
|
-
totalErrors: report.baselineDiagnostics?.filter((diagnostic) => diagnostic.severity === "error").length ?? 0,
|
|
2619
|
-
totalWarnings: report.baselineDiagnostics?.filter((diagnostic) => diagnostic.severity === "warning").length ?? 0,
|
|
2620
|
-
detailsIncluded: true,
|
|
2621
|
-
knownBlockerCount: report.knownBlockers.filter((blocker) => blocker.known).length,
|
|
2622
|
-
byCode: []
|
|
2623
|
-
};
|
|
2624
|
-
return [
|
|
2625
|
-
`# Workflow Validation: ${report.workflow}`,
|
|
2626
|
-
"",
|
|
2627
|
-
`- Run: ${report.runId}`,
|
|
2628
|
-
`- Status: ${report.status}`,
|
|
2629
|
-
`- Source status: ${report.sourceStatus}`,
|
|
2630
|
-
`- Workspace status: ${report.workspaceStatus}`,
|
|
2631
|
-
`- Validation commands status: ${report.validationCommandsStatus ?? "unknown"}`,
|
|
2632
|
-
`- Baseline status: ${report.baselineStatus ?? baselineSummary.status}`,
|
|
2633
|
-
`- Overall status: ${report.overallStatus}`,
|
|
2634
|
-
"",
|
|
2635
|
-
"## Status Summary",
|
|
2636
|
-
`- Source-change: ${report.summary.sourceChange}`,
|
|
2637
|
-
`- Generated sync: ${report.summary.generatedSync}`,
|
|
2638
|
-
`- Validation commands: ${report.summary.validationCommands ?? "unknown"}`,
|
|
2639
|
-
`- Baseline: ${report.summary.baseline ?? baselineSummary.status}`,
|
|
2640
|
-
`- Workspace config: ${report.summary.workspaceConfig}`,
|
|
2641
|
-
`- Environment: ${report.summary.environment}`,
|
|
2642
|
-
"",
|
|
2643
|
-
"## Source Change Diagnostics",
|
|
2644
|
-
...report.workflowDiagnostics?.length ? report.workflowDiagnostics.map((diagnostic) => `- [${diagnostic.severity}] ${diagnostic.code}: ${diagnostic.message}`) : ["- none"],
|
|
2645
|
-
"",
|
|
2646
|
-
"## Existing Workspace Blockers",
|
|
2647
|
-
`- Status: ${baselineSummary.status}`,
|
|
2648
|
-
`- Errors: ${baselineSummary.totalErrors}`,
|
|
2649
|
-
`- Warnings: ${baselineSummary.totalWarnings}`,
|
|
2650
|
-
...baselineSummary.byCode.length ? baselineSummary.byCode.map((item) => `- [${item.severity}] ${item.code} (${item.count}x): ${item.sampleMessage}`) : ["- none"],
|
|
2651
|
-
...baselineSummary.detailsIncluded ? [] : [
|
|
2652
|
-
"- Baseline details are summarized by default. Re-run validation with includeBaselineDetails=true for full baselineDiagnostics."
|
|
2653
|
-
],
|
|
2654
|
-
"",
|
|
2655
|
-
"## Existing Workspace Blocker Details",
|
|
2656
|
-
...report.baselineDiagnostics?.length ? report.baselineDiagnostics.map((diagnostic) => `- [${diagnostic.severity}] ${diagnostic.code}: ${diagnostic.message}`) : baselineSummary.detailsIncluded ? ["- none"] : ["- omitted"],
|
|
2657
|
-
"",
|
|
2658
|
-
"## Known Blockers",
|
|
2659
|
-
...report.knownBlockers.length ? report.knownBlockers.map((blocker) => {
|
|
2660
|
-
const command = blocker.command ? ` \`${blocker.command}\`` : "";
|
|
2661
|
-
const count = blocker.count > 1 ? ` (${blocker.count}x)` : "";
|
|
2662
|
-
const known = blocker.known ? " known" : "";
|
|
2663
|
-
return `- [${blocker.failureScope}${known}]${command}${count}: ${blocker.message}`;
|
|
2664
|
-
}) : ["- none"],
|
|
2665
|
-
"",
|
|
2666
|
-
"## Commands",
|
|
2667
|
-
...report.commands.length ? report.commands.map((command) => {
|
|
2668
|
-
const scope = command.failureScope ? ` (${command.failureScope})` : "";
|
|
2669
|
-
return `- [${command.status}] \`${command.command}\`${scope}: ${command.reason}`;
|
|
2670
|
-
}) : ["- none"],
|
|
2671
|
-
"",
|
|
2672
|
-
"## Diagnostics",
|
|
2673
|
-
...report.diagnostics.length ? report.diagnostics.map((diagnostic) => `- [${diagnostic.severity}] ${diagnostic.code}: ${diagnostic.message}`) : ["- none"],
|
|
2674
|
-
"",
|
|
2675
|
-
"## Repair Actions",
|
|
2676
|
-
...report.repairActions.length ? report.repairActions.map((action) => `- \`${action.command}\`: ${action.reason}`) : ["- none"],
|
|
2677
|
-
"",
|
|
2678
|
-
"## Next Actions",
|
|
2679
|
-
...report.nextActions.length ? report.nextActions.map((action) => `- \`${action.command}\`: ${action.reason}`) : ["- none"],
|
|
2680
|
-
""
|
|
2681
|
-
].join(`
|
|
2682
|
-
`);
|
|
2683
|
-
};
|
|
2684
|
-
var renderWorkflowValidation = (report, format = "markdown") => format === "json" ? jsonText(report) : renderWorkflowValidationRunReport(report);
|
|
2685
|
-
var renderRepairReportMarkdown = (report) => [
|
|
2686
|
-
`# Akan Repair: ${report.kind}`,
|
|
2687
|
-
"",
|
|
2688
|
-
`- Status: ${report.status}`,
|
|
2689
|
-
`- Target: ${report.target ?? "none"}`,
|
|
2690
|
-
"",
|
|
2691
|
-
"## Commands",
|
|
2692
|
-
...report.commands.length ? report.commands.map((command) => `- [${command.status}] \`${command.command}\`: ${command.reason}`) : ["- none"],
|
|
2693
|
-
"",
|
|
2694
|
-
"## Diagnostics",
|
|
2695
|
-
...report.diagnostics.length ? report.diagnostics.map((diagnostic) => `- [${diagnostic.severity}] ${diagnostic.code}: ${diagnostic.message}`) : ["- none"],
|
|
2696
|
-
"",
|
|
2697
|
-
"## Next Actions",
|
|
2698
|
-
...report.nextActions.length ? report.nextActions.map((action) => `- \`${action.command}\`: ${action.reason}`) : ["- none"],
|
|
2699
|
-
""
|
|
2700
|
-
].join(`
|
|
2701
|
-
`);
|
|
2702
|
-
var renderRepairReport = (report, format = "markdown") => format === "json" ? jsonText(report) : renderRepairReportMarkdown(report);
|
|
2703
|
-
var renderWorkflowRunArtifact = (artifact, format = "markdown") => {
|
|
2704
|
-
if ("kind" in artifact)
|
|
2705
|
-
return renderRepairReport(artifact, format);
|
|
2706
|
-
if ("mode" in artifact && artifact.mode === "validate")
|
|
2707
|
-
return renderWorkflowValidation(artifact, format);
|
|
2708
|
-
if ("mode" in artifact && (artifact.mode === "apply" || artifact.mode === "dry-run")) {
|
|
2709
|
-
return renderWorkflowApply(artifact, format);
|
|
2710
|
-
}
|
|
2711
|
-
return jsonText(artifact);
|
|
2712
|
-
};
|
|
2713
2690
|
// pkgs/@akanjs/devkit/workflow/rolloutGate.ts
|
|
2714
2691
|
var toolingRolloutCandidates = [
|
|
2715
2692
|
{
|
|
@@ -2774,4 +2751,4 @@ for (const candidate of toolingRolloutCandidates) {
|
|
|
2774
2751
|
if (isRestrictedCandidate(candidate))
|
|
2775
2752
|
restrictedCandidates.set(candidate.packageName, candidate);
|
|
2776
2753
|
}
|
|
2777
|
-
export { jsonText, compactDiagnostics, workflowPlanApproval, createWorkflowApplyReport, workflowCommandsForPlan, workflowRunArtifactPath, writeWorkflowRunArtifact, workflowSyncDir, generatedFilePathsForTarget, writeGeneratedSyncState, readWorkflowRunArtifact, createWorkflowBaselineSummary, createWorkflowValidationRunReport, createDryRunWorkflowApplyReport, createRepairReport,
|
|
2754
|
+
export { jsonText, workflowStatus, compactDiagnostics, workflowPlanApproval, createWorkflowApplyReport, workflowCommandsForPlan, workflowPathsForPlan, workflowRunArtifactPath, writeWorkflowRunArtifact, workflowSyncDir, generatedFilePathsForTarget, writeGeneratedSyncState, readWorkflowRunArtifact, createWorkflowBaselineSummary, createWorkflowValidationRunReport, createDryRunWorkflowApplyReport, createRepairReport, sourceFile, moduleComponentName, moduleSourcePaths, generatedFilesForSync, validationCommandsForTarget, nextActionsForTarget, createPrimitiveWriteReport, createPassedPrimitiveReport, scalarChangedFiles, bilingualLabelForField, bilingualDescriptionForField, normalizeFieldType, ensureNamedImport, ensureBaseImport, ensureBaseTypeImport, coerceFieldDefault, fieldExpression, viaBuilderParameterName, insertIntoObject, insertLightProjectionField, insertTemplateField, ensureEnumImport, insertEnumClass, insertDictionaryModelField, hasConstantInputField, hasDictionaryModelField, ensureConstantTypeImport, insertDictionaryEnum, parseValues, hasSourceParseErrors, hasClassMethod, insertClassMethod, hasSignalFactoryEntry, insertSignalFactoryEntry, buildAkanModuleContextIndex, addFieldUiPolicyForType, createWorkflowStepRegistry, WorkflowExecutor, listWorkflowSpecs, getWorkflowSpec, compactWorkflowInputs, createWorkflowPlan, renderWorkflowList, renderWorkflowExplain, renderWorkflowPlan, renderWorkflowApply, renderWorkflowValidation, renderRepairReport, renderWorkflowRunArtifact, renderPrimitiveReport, toolingRolloutGate };
|