keystone-cli 2.1.7 → 2.1.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keystone-cli",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "description": "A local-first, declarative, agentic workflow orchestrator built on Bun",
5
5
  "type": "module",
6
6
  "bin": {
@@ -37,10 +37,85 @@ steps:
37
37
  outputMapping:
38
38
  files: files
39
39
 
40
+ - id: validate_workflows
41
+ type: shell
42
+ needs: [generate]
43
+ foreach: ${{ steps.generate.outputs.files.filter(f => f.path.endsWith('.yaml') && f.path.includes('workflows')) }}
44
+ run: |
45
+ echo "${{ item.content }}" | npx tsx src/cli.ts validate --stdin --type workflow
46
+ allowFailure: true
47
+ transform: |
48
+ {
49
+ path: item.path,
50
+ content: item.content,
51
+ valid: result.exitCode === 0,
52
+ error: result.exitCode !== 0 ? result.stderr : null
53
+ }
54
+
55
+ - id: repair_workflows
56
+ type: llm
57
+ needs: [validate_workflows]
58
+ foreach: ${{ steps.validate_workflows.output.filter(f => !f.valid) }}
59
+ agent: software-engineer
60
+ prompt: |
61
+ A generated workflow file failed schema validation. Please fix it.
62
+
63
+ File path: ${{ item.path }}
64
+
65
+ Validation error:
66
+ ${{ item.error }}
67
+
68
+ Current content:
69
+ ```yaml
70
+ ${{ item.content }}
71
+ ```
72
+
73
+ The workflow schema requires:
74
+ 1. A top-level `name` field (string, required)
75
+ 2. A top-level `$schema` field pointing to: https://raw.githubusercontent.com/mhingston/keystone-cli/main/schemas/workflow.json
76
+ 3. A `steps` array with at least one step
77
+ 4. Each step must have `id` and `type` fields
78
+
79
+ Return a JSON object with a single "content" field containing the corrected YAML as a string.
80
+ outputSchema:
81
+ type: object
82
+ properties:
83
+ content:
84
+ type: string
85
+ description: The fixed YAML content
86
+ required: [content]
87
+
88
+ - id: merge_files
89
+ type: shell
90
+ needs: [validate_workflows, repair_workflows]
91
+ run: |
92
+ const generated = ${{ JSON.stringify(steps.generate.outputs.files) }};
93
+ const validated = ${{ JSON.stringify(steps.validate_workflows.output) }};
94
+ const repaired = ${{ JSON.stringify(steps.repair_workflows.output) }};
95
+
96
+ const repairedMap = new Map();
97
+ if (Array.isArray(repaired)) {
98
+ repaired.forEach((r, idx) => {
99
+ const validatedItem = validated[idx];
100
+ if (validatedItem) {
101
+ repairedMap.set(validatedItem.path, r.content);
102
+ }
103
+ });
104
+ }
105
+
106
+ const final = generated.map(file => {
107
+ if (repairedMap.has(file.path)) {
108
+ return { ...file, content: repairedMap.get(file.path) };
109
+ }
110
+ return file;
111
+ });
112
+
113
+ return { files: final };
114
+
40
115
  - id: write_files
41
116
  type: file
42
- needs: [generate]
43
- foreach: ${{ steps.generate.outputs.files }}
117
+ needs: [merge_files]
118
+ foreach: ${{ steps.merge_files.output.files }}
44
119
  op: write
45
120
  path: ${{ item.path }}
46
121
  content: ${{ item.content }}
@@ -31,6 +31,13 @@ steps:
31
31
  ${{ item }}
32
32
 
33
33
  Produce the full file content for the given path. Ensure it aligns with the architectural constraints and dependencies defined in the blueprint.
34
+
35
+ IMPORTANT: If generating a workflow file (.yaml in workflows/):
36
+ - MUST include a top-level `$schema` field: $schema: https://raw.githubusercontent.com/mhingston/keystone-cli/main/schemas/workflow.json
37
+ - MUST include a top-level `name` field (string, required)
38
+ - MUST include a `steps` array with at least one step
39
+ - Each step MUST have `id` and `type` fields
40
+
34
41
  Return only JSON with fields: path, content.
35
42
  outputSchema:
36
43
  type: object