@lchase/kiln 0.3.0 → 0.4.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/README.md +10 -6
- package/assets/serve.css +404 -185
- package/assets/serve.js +361 -0
- package/dist/attention.js +254 -0
- package/dist/board.js +326 -0
- package/dist/cli.js +30 -6
- package/dist/config.js +3 -1
- package/dist/driver.js +299 -25
- package/dist/reconcile.js +59 -20
- package/dist/reliability.js +441 -0
- package/dist/report.js +108 -4
- package/dist/schemas.js +14 -1
- package/dist/serve-page.js +295 -159
- package/dist/serve.js +36 -14
- package/dist/workflow.js +67 -0
- package/package.json +1 -1
package/dist/workflow.js
CHANGED
|
@@ -81,6 +81,73 @@ export function workflowInputs(workflowYaml, input) {
|
|
|
81
81
|
}
|
|
82
82
|
return out;
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Leaf step ids under the root `steps:` block, in file order.
|
|
86
|
+
* A step that contains nested `- id:` entries is a loop or map container
|
|
87
|
+
* and is omitted; its nested ids are the ones a run actually starts.
|
|
88
|
+
*/
|
|
89
|
+
export function workflowLeafSteps(yaml) {
|
|
90
|
+
const lines = yaml.split("\n");
|
|
91
|
+
let inSteps = false;
|
|
92
|
+
const nodes = [];
|
|
93
|
+
for (const line of lines) {
|
|
94
|
+
if (!inSteps) {
|
|
95
|
+
if (line === "steps:" || line.startsWith("steps:"))
|
|
96
|
+
inSteps = true;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
if (/^\S/.test(line))
|
|
100
|
+
break;
|
|
101
|
+
const match = /^(\s*)- id:\s*([A-Za-z0-9._-]+)\s*(?:#.*)?$/.exec(line);
|
|
102
|
+
if (!match?.[2])
|
|
103
|
+
continue;
|
|
104
|
+
nodes.push({ id: match[2], indent: match[1]?.length ?? 0 });
|
|
105
|
+
}
|
|
106
|
+
const leaves = [];
|
|
107
|
+
for (let index = 0; index < nodes.length; index += 1) {
|
|
108
|
+
const node = nodes[index];
|
|
109
|
+
const next = nodes[index + 1];
|
|
110
|
+
if (!node)
|
|
111
|
+
continue;
|
|
112
|
+
if (next && next.indent > node.indent)
|
|
113
|
+
continue;
|
|
114
|
+
leaves.push(node.id);
|
|
115
|
+
}
|
|
116
|
+
return leaves;
|
|
117
|
+
}
|
|
118
|
+
/** Leaf step ids from a yak `workflow.json` `steps` array. Loop and map containers expand to their body. */
|
|
119
|
+
export function leafStepIds(steps) {
|
|
120
|
+
if (!Array.isArray(steps))
|
|
121
|
+
return [];
|
|
122
|
+
const ids = [];
|
|
123
|
+
for (const step of steps) {
|
|
124
|
+
if (typeof step !== "object" || step === null || !("id" in step))
|
|
125
|
+
continue;
|
|
126
|
+
const id = step.id;
|
|
127
|
+
if (typeof id !== "string" || id.length === 0)
|
|
128
|
+
continue;
|
|
129
|
+
const kind = "kind" in step ? step.kind : undefined;
|
|
130
|
+
if (kind === "loop" && "body" in step) {
|
|
131
|
+
ids.push(...leafStepIds(step.body));
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (kind === "map" && "step" in step) {
|
|
135
|
+
ids.push(...leafStepIds([step.step]));
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
ids.push(id);
|
|
139
|
+
}
|
|
140
|
+
return ids;
|
|
141
|
+
}
|
|
142
|
+
/** Leaf steps of a packaged workflow. An unknown name is an empty plan, not an error. */
|
|
143
|
+
export function workflowStepPlan(name) {
|
|
144
|
+
if (!WORKFLOW_NAME.test(name))
|
|
145
|
+
return [];
|
|
146
|
+
const path = join(packageRoot(), "workflows", `${name}.yaml`);
|
|
147
|
+
if (!existsSync(path))
|
|
148
|
+
return [];
|
|
149
|
+
return workflowLeafSteps(readFileSync(path, "utf8"));
|
|
150
|
+
}
|
|
84
151
|
/** True when the workflow runs the repo test command. Investigation does not. */
|
|
85
152
|
export function workflowNeedsTestCommand(workflowYaml) {
|
|
86
153
|
return /\bKILN_TEST\b/.test(workflowYaml) || workflowYaml.includes("KILN_VERIFY_WRAPPER");
|