stageflow 0.13.0 → 0.16.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/dist/agent/activity.d.ts +3 -0
- package/dist/agent/claudeAdapter.js +84 -7
- package/dist/agent/claudeSession.d.ts +3 -0
- package/dist/agent/piAdapter.d.ts +2 -0
- package/dist/agent/piAdapter.js +34 -7
- package/dist/agent/port.d.ts +5 -2
- package/dist/cli/initTemplates.d.ts +1 -1
- package/dist/cli/initTemplates.js +1 -1
- package/dist/cli/migrateYamlCommand.d.ts +18 -0
- package/dist/cli/migrateYamlCommand.js +180 -0
- package/dist/cli/runOutput.js +58 -26
- package/dist/cli/validateCommand.d.ts +1 -0
- package/dist/cli/validateCommand.js +2 -0
- package/dist/cli.js +15 -1
- package/dist/config/browseCatalog.js +1 -1
- package/dist/config/createPipeline.d.ts +1 -1
- package/dist/config/createPipeline.js +23 -11
- package/dist/config/createStage.d.ts +1 -1
- package/dist/config/createStage.js +10 -5
- package/dist/config/legacyYaml.d.ts +28 -0
- package/dist/config/legacyYaml.js +98 -0
- package/dist/config/loadOutcome.d.ts +2 -1
- package/dist/config/loadOutcome.js +4 -1
- package/dist/config/loadPipeline.d.ts +2 -0
- package/dist/config/loadPipeline.js +150 -8
- package/dist/config/loadStage.d.ts +8 -1
- package/dist/config/loadStage.js +138 -29
- package/dist/config/loadStageflowManifest.js +10 -0
- package/dist/config/loadTask.js +14 -0
- package/dist/config/materializeStageModels.d.ts +7 -0
- package/dist/config/materializeStageModels.js +35 -0
- package/dist/config/mergePipelineIncludes.d.ts +5 -1
- package/dist/config/mergePipelineIncludes.js +82 -4
- package/dist/config/migrateYaml.d.ts +19 -0
- package/dist/config/migrateYaml.js +627 -0
- package/dist/config/modelField.d.ts +13 -0
- package/dist/config/modelField.js +16 -0
- package/dist/config/normalizePipelineStageEntry.js +41 -2
- package/dist/config/parseCompletionContract.d.ts +5 -2
- package/dist/config/parseCompletionContract.js +16 -3
- package/dist/config/parsePreEmitChecks.js +4 -0
- package/dist/config/pipelineNeeds.js +3 -3
- package/dist/config/pipelineStageKeys.d.ts +11 -0
- package/dist/config/pipelineStageKeys.js +14 -0
- package/dist/config/printTargetYaml.d.ts +28 -0
- package/dist/config/printTargetYaml.js +243 -0
- package/dist/config/resolveModel.d.ts +20 -0
- package/dist/config/resolveModel.js +35 -0
- package/dist/config/validateCatalog.d.ts +5 -1
- package/dist/config/validateCatalog.js +36 -6
- package/dist/config/validateCompletionContract.js +5 -0
- package/dist/config/yamlDialect.d.ts +29 -0
- package/dist/config/yamlDialect.js +327 -0
- package/dist/envelope/payloadSchema.d.ts +37 -5
- package/dist/envelope/payloadSchema.js +272 -22
- package/dist/mcp/catalogTools.js +1 -0
- package/dist/package-meta.d.ts +1 -1
- package/dist/package-meta.js +1 -1
- package/dist/runstore/pipelineDagSnapshot.js +2 -0
- package/dist/runstore/port.d.ts +11 -0
- package/dist/runstore/runProjection.js +9 -0
- package/dist/runstore/sqlite/SqliteRunStore.js +27 -4
- package/dist/runstore/sqlite/schema.d.ts +1 -1
- package/dist/runstore/sqlite/schema.js +2 -0
- package/dist/runstore/stageExecution.d.ts +3 -0
- package/dist/runstore/stageExecution.js +6 -2
- package/dist/runstore/stageSnapshot.js +11 -0
- package/dist/runtime/completionCheckRunner.d.ts +3 -2
- package/dist/runtime/completionCheckRunner.js +3 -2
- package/dist/runtime/envelopeRouting.d.ts +2 -2
- package/dist/runtime/pipelineRunner.d.ts +3 -0
- package/dist/runtime/pipelineRunner.js +23 -3
- package/dist/runtime/runManager.js +3 -2
- package/dist/runtime/stageAttemptBootstrap.d.ts +2 -2
- package/dist/runtime/stageRunner.d.ts +2 -2
- package/dist/runtime/stageRunner.js +2 -2
- package/dist/runtime/taskInput.d.ts +7 -0
- package/dist/runtime/taskInput.js +60 -0
- package/dist/runtime/verifiedStageExecution.js +3 -0
- package/dist/types/completion.d.ts +6 -0
- package/dist/types/pipeline.d.ts +21 -2
- package/dist/types/preEmitCheck.d.ts +4 -6
- package/dist/types/stage.d.ts +22 -3
- package/dist/types/stageflowManifest.d.ts +2 -0
- package/dist/types/task.d.ts +1 -0
- package/dist/types/usage.d.ts +16 -0
- package/dist/types/usage.js +24 -0
- package/dist/ui/assets/{index-uVHiae8s.css → index-D2Wt8hwH.css} +1 -1
- package/dist/ui/assets/index-XWJovnp7.js +118 -0
- package/dist/ui/index.html +2 -2
- package/package.json +1 -1
- package/skills/stageflow-author/SKILL.md +7 -7
- package/skills/stageflow-author/assets/examples/branch-decision/hotfix.yaml +9 -1
- package/skills/stageflow-author/assets/examples/branch-decision/release-gate.pipeline.yaml +6 -2
- package/skills/stageflow-author/assets/examples/branch-decision/run-tests.yaml +9 -1
- package/skills/stageflow-author/assets/examples/branch-decision/ship.yaml +16 -1
- package/skills/stageflow-author/assets/examples/linear-review/draft.yaml +12 -2
- package/skills/stageflow-author/assets/examples/linear-review/publish.yaml +16 -1
- package/skills/stageflow-author/assets/examples/linear-review/review-loop.pipeline.yaml +11 -2
- package/skills/stageflow-author/assets/examples/linear-review/review.yaml +19 -1
- package/skills/stageflow-author/assets/examples/non-sdlc-digest/gather.yaml +9 -1
- package/skills/stageflow-author/assets/examples/non-sdlc-digest/research-digest.pipeline.yaml +6 -2
- package/skills/stageflow-author/assets/examples/non-sdlc-digest/send.yaml +16 -1
- package/skills/stageflow-author/assets/examples/non-sdlc-digest/summarize.yaml +9 -1
- package/skills/stageflow-author/references/catalog-mapping.md +30 -28
- package/skills/stageflow-author/references/catalog-write-conventions.md +2 -2
- package/skills/stageflow-author/references/stage-prompt-template.md +5 -5
- package/skills/stageflow-session-capture/SKILL.md +1 -1
- package/skills/stageflow-session-capture/assets/example-pipeline/example.pipeline.yaml +2 -1
- package/skills/stageflow-session-capture/assets/example-pipeline/implement.yaml +13 -2
- package/skills/stageflow-session-capture/assets/example-pipeline/research.yaml +18 -2
- package/skills/stageflow-session-capture/references/catalog-authoring.md +2 -2
- package/dist/ui/assets/index-Yzh42vhf.js +0 -118
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { parseAgentField } from "../agent/agentBackend.js";
|
|
3
3
|
import { loadFailure, loadSuccess } from "./loadOutcome.js";
|
|
4
|
+
import { allowLegacyYamlAuthoring, dialectWarningForDocument, legacyAuthoringRejected, presentLegacyKeys, } from "./legacyYaml.js";
|
|
5
|
+
import { parseModelField } from "./modelField.js";
|
|
4
6
|
import { readYamlObject } from "./readYamlObject.js";
|
|
7
|
+
import { classifyYamlDocument, collectDocumentKeys, mixedDialectIssue, } from "./yamlDialect.js";
|
|
5
8
|
function isPlainObject(value) {
|
|
6
9
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7
10
|
}
|
|
@@ -12,7 +15,7 @@ function formatIncludeCycle(stack, nextPath) {
|
|
|
12
15
|
const chain = [...stack, nextPath].map((p) => path.basename(p));
|
|
13
16
|
return chain.join(" → ");
|
|
14
17
|
}
|
|
15
|
-
async function visitPipelineFile(filePath, stack, idLocations, entries) {
|
|
18
|
+
async function visitPipelineFile(filePath, stack, idLocations, entries, warnings) {
|
|
16
19
|
const absPath = normalizePath(filePath);
|
|
17
20
|
if (stack.some((p) => normalizePath(p) === absPath)) {
|
|
18
21
|
const cycleChain = formatIncludeCycle(stack, absPath);
|
|
@@ -38,6 +41,28 @@ async function visitPipelineFile(filePath, stack, idLocations, entries) {
|
|
|
38
41
|
},
|
|
39
42
|
]);
|
|
40
43
|
}
|
|
44
|
+
const dialect = classifyYamlDocument(raw);
|
|
45
|
+
if (dialect === "invalid") {
|
|
46
|
+
return loadFailure([mixedDialectIssue()]);
|
|
47
|
+
}
|
|
48
|
+
const rejected = legacyAuthoringRejected(dialect, absPath, presentLegacyKeys(collectDocumentKeys(raw)));
|
|
49
|
+
if (rejected)
|
|
50
|
+
return loadFailure([rejected]);
|
|
51
|
+
if (allowLegacyYamlAuthoring()) {
|
|
52
|
+
const warning = dialectWarningForDocument(raw, absPath);
|
|
53
|
+
if (warning)
|
|
54
|
+
warnings.push(warning);
|
|
55
|
+
}
|
|
56
|
+
const isFragment = stack.length > 0;
|
|
57
|
+
if (isFragment && raw.schemas !== undefined) {
|
|
58
|
+
return loadFailure([
|
|
59
|
+
{
|
|
60
|
+
code: "pipeline.include_invalid",
|
|
61
|
+
message: `Invalid include in ${absPath}: schemas is only allowed on the pipeline file, not on include fragments`,
|
|
62
|
+
category: "pipeline",
|
|
63
|
+
},
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
41
66
|
const nextStack = [...stack, absPath];
|
|
42
67
|
if (raw.include !== undefined) {
|
|
43
68
|
if (!Array.isArray(raw.include)) {
|
|
@@ -61,7 +86,7 @@ async function visitPipelineFile(filePath, stack, idLocations, entries) {
|
|
|
61
86
|
]);
|
|
62
87
|
}
|
|
63
88
|
const includePath = normalizePath(path.resolve(path.dirname(absPath), item.local));
|
|
64
|
-
const includeResult = await visitPipelineFile(includePath, nextStack, idLocations, entries);
|
|
89
|
+
const includeResult = await visitPipelineFile(includePath, nextStack, idLocations, entries, warnings);
|
|
65
90
|
if (!includeResult.ok)
|
|
66
91
|
return includeResult;
|
|
67
92
|
}
|
|
@@ -136,9 +161,26 @@ export async function mergePipelineStages(rootPath) {
|
|
|
136
161
|
]);
|
|
137
162
|
}
|
|
138
163
|
const agent = agentField.value;
|
|
164
|
+
const modelField = parseModelField(raw.model);
|
|
165
|
+
if (!modelField.ok) {
|
|
166
|
+
return loadFailure([
|
|
167
|
+
{
|
|
168
|
+
code: "pipeline.invalid_model",
|
|
169
|
+
message: `Invalid pipeline ${absRoot}: ${modelField.message}`,
|
|
170
|
+
category: "pipeline",
|
|
171
|
+
pipelineId,
|
|
172
|
+
},
|
|
173
|
+
]);
|
|
174
|
+
}
|
|
175
|
+
const model = modelField.value;
|
|
176
|
+
const schemasOutcome = parsePipelineSchemas(raw.schemas, absRoot, pipelineId);
|
|
177
|
+
if (!schemasOutcome.ok)
|
|
178
|
+
return schemasOutcome;
|
|
179
|
+
const schemas = schemasOutcome.value;
|
|
139
180
|
const idLocations = new Map();
|
|
140
181
|
const entries = [];
|
|
141
|
-
const
|
|
182
|
+
const warnings = [];
|
|
183
|
+
const mergeResult = await visitPipelineFile(absRoot, [], idLocations, entries, warnings);
|
|
142
184
|
if (!mergeResult.ok)
|
|
143
185
|
return mergeResult;
|
|
144
186
|
if (entries.length === 0) {
|
|
@@ -150,5 +192,41 @@ export async function mergePipelineStages(rootPath) {
|
|
|
150
192
|
},
|
|
151
193
|
]);
|
|
152
194
|
}
|
|
153
|
-
return loadSuccess({
|
|
195
|
+
return loadSuccess({
|
|
196
|
+
entries,
|
|
197
|
+
pipelineId,
|
|
198
|
+
...(agent !== undefined ? { agent } : {}),
|
|
199
|
+
...(model !== undefined ? { model } : {}),
|
|
200
|
+
...(schemas !== undefined ? { schemas } : {}),
|
|
201
|
+
warnings,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function parsePipelineSchemas(raw, absPath, pipelineId) {
|
|
205
|
+
if (raw === undefined)
|
|
206
|
+
return loadSuccess(undefined);
|
|
207
|
+
if (!isPlainObject(raw)) {
|
|
208
|
+
return loadFailure([
|
|
209
|
+
{
|
|
210
|
+
code: "pipeline.invalid_shape",
|
|
211
|
+
message: `Invalid pipeline ${absPath}: schemas must be an object`,
|
|
212
|
+
category: "pipeline",
|
|
213
|
+
pipelineId,
|
|
214
|
+
},
|
|
215
|
+
]);
|
|
216
|
+
}
|
|
217
|
+
const schemas = {};
|
|
218
|
+
for (const [name, value] of Object.entries(raw)) {
|
|
219
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
220
|
+
return loadFailure([
|
|
221
|
+
{
|
|
222
|
+
code: "pipeline.invalid_shape",
|
|
223
|
+
message: `Invalid pipeline ${absPath}: schemas.${name} must be an object`,
|
|
224
|
+
category: "pipeline",
|
|
225
|
+
pipelineId,
|
|
226
|
+
},
|
|
227
|
+
]);
|
|
228
|
+
}
|
|
229
|
+
schemas[name] = value;
|
|
230
|
+
}
|
|
231
|
+
return loadSuccess(schemas);
|
|
154
232
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type MigrateYamlWrite = {
|
|
2
|
+
file: string;
|
|
3
|
+
absPath: string;
|
|
4
|
+
content: string;
|
|
5
|
+
};
|
|
6
|
+
export type MigrateYamlPlan = {
|
|
7
|
+
writes: MigrateYamlWrite[];
|
|
8
|
+
skipped: string[];
|
|
9
|
+
errors: string[];
|
|
10
|
+
};
|
|
11
|
+
export declare function catalogKind(raw: Record<string, unknown>, filePath: string): "pipeline" | "stage" | "task" | "unknown";
|
|
12
|
+
export declare function fileDirtyVsHead(absPath: string): boolean;
|
|
13
|
+
export declare function planMigrateYaml(targetPath: string, options?: {
|
|
14
|
+
cwd: string;
|
|
15
|
+
projectRoot?: string;
|
|
16
|
+
}): Promise<MigrateYamlPlan>;
|
|
17
|
+
export declare function applyMigrateYamlPlan(plan: MigrateYamlPlan, testOnly?: {
|
|
18
|
+
beforeRename?: () => Promise<void>;
|
|
19
|
+
}): Promise<void>;
|