popeye-cli 1.10.0 → 2.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/CHANGELOG.md +59 -0
- package/CONTRIBUTING.md +15 -1
- package/README.md +57 -0
- package/dist/pipeline/artifact-manager.d.ts +47 -0
- package/dist/pipeline/artifact-manager.d.ts.map +1 -0
- package/dist/pipeline/artifact-manager.js +251 -0
- package/dist/pipeline/artifact-manager.js.map +1 -0
- package/dist/pipeline/artifact-validators.d.ts +29 -0
- package/dist/pipeline/artifact-validators.d.ts.map +1 -0
- package/dist/pipeline/artifact-validators.js +173 -0
- package/dist/pipeline/artifact-validators.js.map +1 -0
- package/dist/pipeline/change-request.d.ts +47 -0
- package/dist/pipeline/change-request.d.ts.map +1 -0
- package/dist/pipeline/change-request.js +91 -0
- package/dist/pipeline/change-request.js.map +1 -0
- package/dist/pipeline/check-runner.d.ts +47 -0
- package/dist/pipeline/check-runner.d.ts.map +1 -0
- package/dist/pipeline/check-runner.js +417 -0
- package/dist/pipeline/check-runner.js.map +1 -0
- package/dist/pipeline/command-resolver.d.ts +9 -0
- package/dist/pipeline/command-resolver.d.ts.map +1 -0
- package/dist/pipeline/command-resolver.js +140 -0
- package/dist/pipeline/command-resolver.js.map +1 -0
- package/dist/pipeline/consensus/consensus-runner.d.ts +44 -0
- package/dist/pipeline/consensus/consensus-runner.d.ts.map +1 -0
- package/dist/pipeline/consensus/consensus-runner.js +212 -0
- package/dist/pipeline/consensus/consensus-runner.js.map +1 -0
- package/dist/pipeline/constitution.d.ts +45 -0
- package/dist/pipeline/constitution.d.ts.map +1 -0
- package/dist/pipeline/constitution.js +82 -0
- package/dist/pipeline/constitution.js.map +1 -0
- package/dist/pipeline/gate-engine.d.ts +55 -0
- package/dist/pipeline/gate-engine.d.ts.map +1 -0
- package/dist/pipeline/gate-engine.js +270 -0
- package/dist/pipeline/gate-engine.js.map +1 -0
- package/dist/pipeline/index.d.ts +26 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +35 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/migration.d.ts +15 -0
- package/dist/pipeline/migration.d.ts.map +1 -0
- package/dist/pipeline/migration.js +76 -0
- package/dist/pipeline/migration.js.map +1 -0
- package/dist/pipeline/orchestrator.d.ts +28 -0
- package/dist/pipeline/orchestrator.d.ts.map +1 -0
- package/dist/pipeline/orchestrator.js +238 -0
- package/dist/pipeline/orchestrator.js.map +1 -0
- package/dist/pipeline/packets/audit-report-builder.d.ts +11 -0
- package/dist/pipeline/packets/audit-report-builder.d.ts.map +1 -0
- package/dist/pipeline/packets/audit-report-builder.js +32 -0
- package/dist/pipeline/packets/audit-report-builder.js.map +1 -0
- package/dist/pipeline/packets/consensus-packet-builder.d.ts +35 -0
- package/dist/pipeline/packets/consensus-packet-builder.d.ts.map +1 -0
- package/dist/pipeline/packets/consensus-packet-builder.js +80 -0
- package/dist/pipeline/packets/consensus-packet-builder.js.map +1 -0
- package/dist/pipeline/packets/index.d.ts +12 -0
- package/dist/pipeline/packets/index.d.ts.map +1 -0
- package/dist/pipeline/packets/index.js +8 -0
- package/dist/pipeline/packets/index.js.map +1 -0
- package/dist/pipeline/packets/plan-packet-builder.d.ts +21 -0
- package/dist/pipeline/packets/plan-packet-builder.d.ts.map +1 -0
- package/dist/pipeline/packets/plan-packet-builder.js +27 -0
- package/dist/pipeline/packets/plan-packet-builder.js.map +1 -0
- package/dist/pipeline/packets/rca-packet-builder.d.ts +19 -0
- package/dist/pipeline/packets/rca-packet-builder.d.ts.map +1 -0
- package/dist/pipeline/packets/rca-packet-builder.js +22 -0
- package/dist/pipeline/packets/rca-packet-builder.js.map +1 -0
- package/dist/pipeline/phases/architecture.d.ts +7 -0
- package/dist/pipeline/phases/architecture.d.ts.map +1 -0
- package/dist/pipeline/phases/architecture.js +60 -0
- package/dist/pipeline/phases/architecture.js.map +1 -0
- package/dist/pipeline/phases/audit.d.ts +8 -0
- package/dist/pipeline/phases/audit.d.ts.map +1 -0
- package/dist/pipeline/phases/audit.js +144 -0
- package/dist/pipeline/phases/audit.js.map +1 -0
- package/dist/pipeline/phases/consensus-architecture.d.ts +7 -0
- package/dist/pipeline/phases/consensus-architecture.d.ts.map +1 -0
- package/dist/pipeline/phases/consensus-architecture.js +84 -0
- package/dist/pipeline/phases/consensus-architecture.js.map +1 -0
- package/dist/pipeline/phases/consensus-master-plan.d.ts +7 -0
- package/dist/pipeline/phases/consensus-master-plan.d.ts.map +1 -0
- package/dist/pipeline/phases/consensus-master-plan.js +81 -0
- package/dist/pipeline/phases/consensus-master-plan.js.map +1 -0
- package/dist/pipeline/phases/consensus-role-plans.d.ts +7 -0
- package/dist/pipeline/phases/consensus-role-plans.d.ts.map +1 -0
- package/dist/pipeline/phases/consensus-role-plans.js +85 -0
- package/dist/pipeline/phases/consensus-role-plans.js.map +1 -0
- package/dist/pipeline/phases/done.d.ts +7 -0
- package/dist/pipeline/phases/done.d.ts.map +1 -0
- package/dist/pipeline/phases/done.js +45 -0
- package/dist/pipeline/phases/done.js.map +1 -0
- package/dist/pipeline/phases/implementation.d.ts +8 -0
- package/dist/pipeline/phases/implementation.d.ts.map +1 -0
- package/dist/pipeline/phases/implementation.js +42 -0
- package/dist/pipeline/phases/implementation.js.map +1 -0
- package/dist/pipeline/phases/index.d.ts +20 -0
- package/dist/pipeline/phases/index.d.ts.map +1 -0
- package/dist/pipeline/phases/index.js +19 -0
- package/dist/pipeline/phases/index.js.map +1 -0
- package/dist/pipeline/phases/intake.d.ts +8 -0
- package/dist/pipeline/phases/intake.d.ts.map +1 -0
- package/dist/pipeline/phases/intake.js +40 -0
- package/dist/pipeline/phases/intake.js.map +1 -0
- package/dist/pipeline/phases/phase-context.d.ts +30 -0
- package/dist/pipeline/phases/phase-context.d.ts.map +1 -0
- package/dist/pipeline/phases/phase-context.js +33 -0
- package/dist/pipeline/phases/phase-context.js.map +1 -0
- package/dist/pipeline/phases/production-gate.d.ts +8 -0
- package/dist/pipeline/phases/production-gate.d.ts.map +1 -0
- package/dist/pipeline/phases/production-gate.js +84 -0
- package/dist/pipeline/phases/production-gate.js.map +1 -0
- package/dist/pipeline/phases/qa-validation.d.ts +7 -0
- package/dist/pipeline/phases/qa-validation.d.ts.map +1 -0
- package/dist/pipeline/phases/qa-validation.js +50 -0
- package/dist/pipeline/phases/qa-validation.js.map +1 -0
- package/dist/pipeline/phases/recovery-loop.d.ts +7 -0
- package/dist/pipeline/phases/recovery-loop.d.ts.map +1 -0
- package/dist/pipeline/phases/recovery-loop.js +91 -0
- package/dist/pipeline/phases/recovery-loop.js.map +1 -0
- package/dist/pipeline/phases/review.d.ts +8 -0
- package/dist/pipeline/phases/review.d.ts.map +1 -0
- package/dist/pipeline/phases/review.js +127 -0
- package/dist/pipeline/phases/review.js.map +1 -0
- package/dist/pipeline/phases/role-planning.d.ts +7 -0
- package/dist/pipeline/phases/role-planning.d.ts.map +1 -0
- package/dist/pipeline/phases/role-planning.js +75 -0
- package/dist/pipeline/phases/role-planning.js.map +1 -0
- package/dist/pipeline/phases/stuck.d.ts +7 -0
- package/dist/pipeline/phases/stuck.d.ts.map +1 -0
- package/dist/pipeline/phases/stuck.js +51 -0
- package/dist/pipeline/phases/stuck.js.map +1 -0
- package/dist/pipeline/repo-snapshot.d.ts +24 -0
- package/dist/pipeline/repo-snapshot.d.ts.map +1 -0
- package/dist/pipeline/repo-snapshot.js +343 -0
- package/dist/pipeline/repo-snapshot.js.map +1 -0
- package/dist/pipeline/role-execution-adapter.d.ts +59 -0
- package/dist/pipeline/role-execution-adapter.d.ts.map +1 -0
- package/dist/pipeline/role-execution-adapter.js +159 -0
- package/dist/pipeline/role-execution-adapter.js.map +1 -0
- package/dist/pipeline/skill-loader.d.ts +34 -0
- package/dist/pipeline/skill-loader.d.ts.map +1 -0
- package/dist/pipeline/skill-loader.js +156 -0
- package/dist/pipeline/skill-loader.js.map +1 -0
- package/dist/pipeline/skills/defaults.d.ts +16 -0
- package/dist/pipeline/skills/defaults.d.ts.map +1 -0
- package/dist/pipeline/skills/defaults.js +189 -0
- package/dist/pipeline/skills/defaults.js.map +1 -0
- package/dist/pipeline/type-defs/artifacts.d.ts +202 -0
- package/dist/pipeline/type-defs/artifacts.d.ts.map +1 -0
- package/dist/pipeline/type-defs/artifacts.js +66 -0
- package/dist/pipeline/type-defs/artifacts.js.map +1 -0
- package/dist/pipeline/type-defs/audit.d.ts +256 -0
- package/dist/pipeline/type-defs/audit.d.ts.map +1 -0
- package/dist/pipeline/type-defs/audit.js +54 -0
- package/dist/pipeline/type-defs/audit.js.map +1 -0
- package/dist/pipeline/type-defs/checks.d.ts +81 -0
- package/dist/pipeline/type-defs/checks.d.ts.map +1 -0
- package/dist/pipeline/type-defs/checks.js +38 -0
- package/dist/pipeline/type-defs/checks.js.map +1 -0
- package/dist/pipeline/type-defs/enums.d.ts +43 -0
- package/dist/pipeline/type-defs/enums.d.ts.map +1 -0
- package/dist/pipeline/type-defs/enums.js +55 -0
- package/dist/pipeline/type-defs/enums.js.map +1 -0
- package/dist/pipeline/type-defs/index.d.ts +12 -0
- package/dist/pipeline/type-defs/index.d.ts.map +1 -0
- package/dist/pipeline/type-defs/index.js +12 -0
- package/dist/pipeline/type-defs/index.js.map +1 -0
- package/dist/pipeline/type-defs/packets.d.ts +806 -0
- package/dist/pipeline/type-defs/packets.d.ts.map +1 -0
- package/dist/pipeline/type-defs/packets.js +109 -0
- package/dist/pipeline/type-defs/packets.js.map +1 -0
- package/dist/pipeline/type-defs/snapshot.d.ts +52 -0
- package/dist/pipeline/type-defs/snapshot.d.ts.map +1 -0
- package/dist/pipeline/type-defs/snapshot.js +35 -0
- package/dist/pipeline/type-defs/snapshot.js.map +1 -0
- package/dist/pipeline/type-defs/state.d.ts +449 -0
- package/dist/pipeline/type-defs/state.d.ts.map +1 -0
- package/dist/pipeline/type-defs/state.js +88 -0
- package/dist/pipeline/type-defs/state.js.map +1 -0
- package/dist/pipeline/types.d.ts +16 -0
- package/dist/pipeline/types.d.ts.map +1 -0
- package/dist/pipeline/types.js +16 -0
- package/dist/pipeline/types.js.map +1 -0
- package/dist/types/audit.d.ts +6 -6
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +48 -0
- package/dist/workflow/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/PHASE_GATE_ENGINE_SPEC.md +113 -20
- package/skills/POPEYE_FULL_AUTONOMY_PIPELINE.md +66 -13
- package/src/pipeline/artifact-manager.ts +339 -0
- package/src/pipeline/artifact-validators.ts +224 -0
- package/src/pipeline/change-request.ts +119 -0
- package/src/pipeline/check-runner.ts +504 -0
- package/src/pipeline/command-resolver.ts +168 -0
- package/src/pipeline/consensus/consensus-runner.ts +317 -0
- package/src/pipeline/constitution.ts +109 -0
- package/src/pipeline/gate-engine.ts +347 -0
- package/src/pipeline/index.ts +82 -0
- package/src/pipeline/migration.ts +91 -0
- package/src/pipeline/orchestrator.ts +314 -0
- package/src/pipeline/packets/audit-report-builder.ts +47 -0
- package/src/pipeline/packets/consensus-packet-builder.ts +112 -0
- package/src/pipeline/packets/index.ts +15 -0
- package/src/pipeline/packets/plan-packet-builder.ts +52 -0
- package/src/pipeline/packets/rca-packet-builder.ts +38 -0
- package/src/pipeline/phases/architecture.ts +73 -0
- package/src/pipeline/phases/audit.ts +193 -0
- package/src/pipeline/phases/consensus-architecture.ts +104 -0
- package/src/pipeline/phases/consensus-master-plan.ts +100 -0
- package/src/pipeline/phases/consensus-role-plans.ts +105 -0
- package/src/pipeline/phases/done.ts +68 -0
- package/src/pipeline/phases/implementation.ts +48 -0
- package/src/pipeline/phases/index.ts +21 -0
- package/src/pipeline/phases/intake.ts +54 -0
- package/src/pipeline/phases/phase-context.ts +86 -0
- package/src/pipeline/phases/production-gate.ts +113 -0
- package/src/pipeline/phases/qa-validation.ts +63 -0
- package/src/pipeline/phases/recovery-loop.ts +118 -0
- package/src/pipeline/phases/review.ts +149 -0
- package/src/pipeline/phases/role-planning.ts +92 -0
- package/src/pipeline/phases/stuck.ts +62 -0
- package/src/pipeline/repo-snapshot.ts +395 -0
- package/src/pipeline/role-execution-adapter.ts +238 -0
- package/src/pipeline/skill-loader.ts +192 -0
- package/src/pipeline/skills/defaults.ts +215 -0
- package/src/pipeline/type-defs/artifacts.ts +81 -0
- package/src/pipeline/type-defs/audit.ts +67 -0
- package/src/pipeline/type-defs/checks.ts +47 -0
- package/src/pipeline/type-defs/enums.ts +62 -0
- package/src/pipeline/type-defs/index.ts +12 -0
- package/src/pipeline/type-defs/packets.ts +131 -0
- package/src/pipeline/type-defs/snapshot.ts +55 -0
- package/src/pipeline/type-defs/state.ts +165 -0
- package/src/pipeline/types.ts +16 -0
- package/src/workflow/index.ts +48 -0
- package/tests/pipeline/artifact-manager.test.ts +183 -0
- package/tests/pipeline/artifact-validators.test.ts +207 -0
- package/tests/pipeline/change-request.test.ts +180 -0
- package/tests/pipeline/check-runner.test.ts +157 -0
- package/tests/pipeline/command-resolver.test.ts +159 -0
- package/tests/pipeline/consensus-runner.test.ts +206 -0
- package/tests/pipeline/consensus-scoring.test.ts +163 -0
- package/tests/pipeline/constitution.test.ts +122 -0
- package/tests/pipeline/gate-engine.test.ts +195 -0
- package/tests/pipeline/migration.test.ts +133 -0
- package/tests/pipeline/orchestrator.test.ts +614 -0
- package/tests/pipeline/packets/builders.test.ts +347 -0
- package/tests/pipeline/repo-snapshot.test.ts +189 -0
- package/tests/pipeline/role-execution-adapter.test.ts +299 -0
- package/tests/pipeline/skill-loader.test.ts +186 -0
- package/tests/pipeline/start-env-checks.test.ts +123 -0
- package/tests/pipeline/types.test.ts +156 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill Loader — hybrid system loading from TS defaults + .md overrides.
|
|
3
|
+
* .md files use YAML frontmatter for structured fields (P1-1).
|
|
4
|
+
* If no frontmatter, entire file treated as raw systemPrompt override.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
|
|
10
|
+
import type { PipelineRole } from './types.js';
|
|
11
|
+
import { DEFAULT_SKILLS } from './skills/defaults.js';
|
|
12
|
+
|
|
13
|
+
// ─── Types ───────────────────────────────────────────────
|
|
14
|
+
|
|
15
|
+
export interface SkillDefinition {
|
|
16
|
+
role: PipelineRole;
|
|
17
|
+
version: string;
|
|
18
|
+
systemPrompt: string;
|
|
19
|
+
required_outputs: string[];
|
|
20
|
+
constraints: string[];
|
|
21
|
+
depends_on?: PipelineRole[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ─── Skill Loader ────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
export class SkillLoader {
|
|
27
|
+
private readonly skillsDir: string | undefined;
|
|
28
|
+
private readonly cache = new Map<PipelineRole, SkillDefinition>();
|
|
29
|
+
|
|
30
|
+
constructor(skillsDir?: string) {
|
|
31
|
+
this.skillsDir = skillsDir;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Load skill definition for a role. Merges TS default + .md override. */
|
|
35
|
+
loadSkill(role: PipelineRole): SkillDefinition {
|
|
36
|
+
const cached = this.cache.get(role);
|
|
37
|
+
if (cached) return cached;
|
|
38
|
+
|
|
39
|
+
const defaultSkill = getDefaultSkill(role);
|
|
40
|
+
const override = this.loadMarkdownOverride(role);
|
|
41
|
+
|
|
42
|
+
const merged: SkillDefinition = {
|
|
43
|
+
...defaultSkill,
|
|
44
|
+
...override,
|
|
45
|
+
role, // Always keep the role
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// If override has systemPrompt, use it; otherwise keep default
|
|
49
|
+
if (override?.systemPrompt) {
|
|
50
|
+
merged.systemPrompt = override.systemPrompt;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
this.cache.set(role, merged);
|
|
54
|
+
return merged;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Load all skills for the given roles */
|
|
58
|
+
loadAllSkills(roles: PipelineRole[]): Map<PipelineRole, SkillDefinition> {
|
|
59
|
+
const result = new Map<PipelineRole, SkillDefinition>();
|
|
60
|
+
for (const role of roles) {
|
|
61
|
+
result.set(role, this.loadSkill(role));
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Clear cache (useful after reloading .md files) */
|
|
67
|
+
clearCache(): void {
|
|
68
|
+
this.cache.clear();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** List available .md skill files */
|
|
72
|
+
listAvailableOverrides(): string[] {
|
|
73
|
+
if (!this.skillsDir || !existsSync(this.skillsDir)) return [];
|
|
74
|
+
return readdirSync(this.skillsDir)
|
|
75
|
+
.filter((f) => f.endsWith('.md'))
|
|
76
|
+
.map((f) => f.replace('.md', ''));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// ─── Internal ────────────────────────────────────────────
|
|
80
|
+
|
|
81
|
+
private loadMarkdownOverride(role: PipelineRole): Partial<SkillDefinition> | null {
|
|
82
|
+
if (!this.skillsDir) return null;
|
|
83
|
+
|
|
84
|
+
const mdPath = join(this.skillsDir, `${role}.md`);
|
|
85
|
+
if (!existsSync(mdPath)) return null;
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
const content = readFileSync(mdPath, 'utf-8');
|
|
89
|
+
return parseSkillMarkdown(content);
|
|
90
|
+
} catch {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ─── Default Skill Lookup ────────────────────────────────
|
|
97
|
+
|
|
98
|
+
export function getDefaultSkill(role: PipelineRole): SkillDefinition {
|
|
99
|
+
return DEFAULT_SKILLS[role] ?? {
|
|
100
|
+
role,
|
|
101
|
+
version: '1.0',
|
|
102
|
+
systemPrompt: `You are the ${role} in the Popeye pipeline.`,
|
|
103
|
+
required_outputs: [],
|
|
104
|
+
constraints: [],
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ─── Markdown Parsing ────────────────────────────────────
|
|
109
|
+
|
|
110
|
+
/** Parse skill markdown with optional YAML frontmatter */
|
|
111
|
+
export function parseSkillMarkdown(content: string): Partial<SkillDefinition> {
|
|
112
|
+
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
113
|
+
|
|
114
|
+
if (!frontmatterMatch) {
|
|
115
|
+
// No frontmatter: entire content is systemPrompt
|
|
116
|
+
return { systemPrompt: content.trim() };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const frontmatterRaw = frontmatterMatch[1];
|
|
120
|
+
const body = frontmatterMatch[2].trim();
|
|
121
|
+
|
|
122
|
+
const result: Partial<SkillDefinition> = {};
|
|
123
|
+
|
|
124
|
+
// Parse simple YAML fields (no dependency on yaml library here)
|
|
125
|
+
const lines = frontmatterRaw.split('\n');
|
|
126
|
+
let currentKey = '';
|
|
127
|
+
let currentList: string[] = [];
|
|
128
|
+
|
|
129
|
+
for (const line of lines) {
|
|
130
|
+
const kvMatch = line.match(/^(\w+):\s*(.*)$/);
|
|
131
|
+
if (kvMatch) {
|
|
132
|
+
// Flush previous list
|
|
133
|
+
if (currentKey && currentList.length > 0) {
|
|
134
|
+
setField(result, currentKey, currentList);
|
|
135
|
+
currentList = [];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const [, key, value] = kvMatch;
|
|
139
|
+
currentKey = key;
|
|
140
|
+
|
|
141
|
+
if (value.trim()) {
|
|
142
|
+
setField(result, key, value.trim());
|
|
143
|
+
currentKey = '';
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
const listItemMatch = line.match(/^\s+-\s+(.*)$/);
|
|
147
|
+
if (listItemMatch) {
|
|
148
|
+
currentList.push(listItemMatch[1]);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Flush last list
|
|
154
|
+
if (currentKey && currentList.length > 0) {
|
|
155
|
+
setField(result, currentKey, currentList);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Body is always the systemPrompt
|
|
159
|
+
if (body) {
|
|
160
|
+
result.systemPrompt = body;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function setField(result: Partial<SkillDefinition>, key: string, value: string | string[]): void {
|
|
167
|
+
switch (key) {
|
|
168
|
+
case 'role':
|
|
169
|
+
if (typeof value === 'string') result.role = value as PipelineRole;
|
|
170
|
+
break;
|
|
171
|
+
case 'version':
|
|
172
|
+
if (typeof value === 'string') result.version = value;
|
|
173
|
+
break;
|
|
174
|
+
case 'required_outputs':
|
|
175
|
+
if (Array.isArray(value)) result.required_outputs = value;
|
|
176
|
+
break;
|
|
177
|
+
case 'constraints':
|
|
178
|
+
if (Array.isArray(value)) result.constraints = value;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// ─── Factory ─────────────────────────────────────────────
|
|
184
|
+
|
|
185
|
+
export function resolveSkillsDir(projectDir: string): string {
|
|
186
|
+
return join(projectDir, 'skills');
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export function createSkillLoader(projectDir?: string): SkillLoader {
|
|
190
|
+
const skillsDir = projectDir ? resolveSkillsDir(projectDir) : undefined;
|
|
191
|
+
return new SkillLoader(skillsDir);
|
|
192
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default skill definitions for all 16 pipeline roles.
|
|
3
|
+
* Each contains a system prompt, required outputs, and constraints.
|
|
4
|
+
* These can be overridden by .md files in the project's skills/ directory.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { PipelineRole } from '../types.js';
|
|
8
|
+
|
|
9
|
+
export interface SkillDefinition {
|
|
10
|
+
role: PipelineRole;
|
|
11
|
+
version: string;
|
|
12
|
+
systemPrompt: string;
|
|
13
|
+
required_outputs: string[];
|
|
14
|
+
constraints: string[];
|
|
15
|
+
depends_on?: PipelineRole[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const DEFAULT_SKILLS: Record<PipelineRole, SkillDefinition> = {
|
|
19
|
+
DISPATCHER: {
|
|
20
|
+
role: 'DISPATCHER',
|
|
21
|
+
version: '1.0',
|
|
22
|
+
systemPrompt: `You are the Dispatcher (Popeye). You control phase sequencing, role routing, dependency enforcement, and gate decisions. You never skip phases. You enforce the Constitution. You produce recovery plans when gates fail. You maintain the artifact index and ensure all roles complete their required outputs before transitions.`,
|
|
23
|
+
required_outputs: ['phase_transition', 'recovery_plan'],
|
|
24
|
+
constraints: ['no_phase_skipping', 'constitution_enforcement', 'artifact_verification'],
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
ARCHITECT: {
|
|
28
|
+
role: 'ARCHITECT',
|
|
29
|
+
version: '1.0',
|
|
30
|
+
systemPrompt: `You are the Architect. You define system topology, service boundaries, API contracts, auth models, data ownership, env vars, repo layout, and error handling strategy. Your contracts must be explicit enough for FE/BE to build without guessing. You produce architecture docs and integration contracts. You never write implementation code.`,
|
|
31
|
+
required_outputs: ['architecture_doc', 'api_contracts', 'env_vars', 'repo_layout'],
|
|
32
|
+
constraints: [
|
|
33
|
+
'no_implementation_code',
|
|
34
|
+
'all_contracts_explicit',
|
|
35
|
+
'env_vars_enumerated',
|
|
36
|
+
'integration_points_enumerated',
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
DB_EXPERT: {
|
|
41
|
+
role: 'DB_EXPERT',
|
|
42
|
+
version: '1.0',
|
|
43
|
+
systemPrompt: `You are the DB Expert. You own the database schema, migrations, indexes, and rollback strategy. You define table structures, relationships, constraints, and data types. You produce migration files and rollback scripts. Only you may define or modify the database schema.`,
|
|
44
|
+
required_outputs: ['schema_design', 'migrations', 'rollback_strategy', 'indexes'],
|
|
45
|
+
constraints: [
|
|
46
|
+
'schema_ownership_exclusive',
|
|
47
|
+
'migrations_reversible',
|
|
48
|
+
'indexes_justified',
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
BACKEND_PROGRAMMER: {
|
|
53
|
+
role: 'BACKEND_PROGRAMMER',
|
|
54
|
+
version: '1.0',
|
|
55
|
+
systemPrompt: `You are the Backend Programmer. You implement services, endpoints, business logic, validation, and unit tests according to the approved architecture and API contracts. You follow the DB Expert's schema. You write production-quality code with proper error handling, logging, and test coverage.`,
|
|
56
|
+
required_outputs: ['endpoints', 'services', 'validation', 'unit_tests'],
|
|
57
|
+
constraints: [
|
|
58
|
+
'follow_architecture_contracts',
|
|
59
|
+
'follow_db_schema',
|
|
60
|
+
'no_schema_modifications',
|
|
61
|
+
'production_quality',
|
|
62
|
+
],
|
|
63
|
+
depends_on: ['ARCHITECT', 'DB_EXPERT'],
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
FRONTEND_PROGRAMMER: {
|
|
67
|
+
role: 'FRONTEND_PROGRAMMER',
|
|
68
|
+
version: '1.0',
|
|
69
|
+
systemPrompt: `You are the Frontend Programmer. You implement UI screens, typed API client, auth flows, and error/empty/loading states. You follow the architecture's API contracts. You handle all user-facing states: loading, empty, error, success. You write component tests as defined in the QA plan.`,
|
|
70
|
+
required_outputs: ['screens', 'typed_client', 'auth_flow', 'state_handling'],
|
|
71
|
+
constraints: [
|
|
72
|
+
'follow_api_contracts',
|
|
73
|
+
'all_states_handled',
|
|
74
|
+
'typed_client_required',
|
|
75
|
+
'accessible_ui',
|
|
76
|
+
],
|
|
77
|
+
depends_on: ['ARCHITECT', 'BACKEND_PROGRAMMER'],
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
WEBSITE_PROGRAMMER: {
|
|
81
|
+
role: 'WEBSITE_PROGRAMMER',
|
|
82
|
+
version: '1.0',
|
|
83
|
+
systemPrompt: `You are the Website Programmer. You build marketing/documentation websites. You implement pages with SEO, analytics, and brand alignment. You follow the master plan's website requirements and produce responsive, accessible pages.`,
|
|
84
|
+
required_outputs: ['pages', 'seo_config', 'analytics_setup'],
|
|
85
|
+
constraints: [
|
|
86
|
+
'brand_alignment',
|
|
87
|
+
'seo_required',
|
|
88
|
+
'responsive_design',
|
|
89
|
+
'accessibility_compliance',
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
QA_TESTER: {
|
|
94
|
+
role: 'QA_TESTER',
|
|
95
|
+
version: '1.0',
|
|
96
|
+
systemPrompt: `You are the QA Tester. You produce a test plan with executable tests (not vague "write tests"). You define critical paths, integration tests, regression suites, and the exact commands to run them. After implementation, you validate critical workflows end-to-end and produce a QA validation report.`,
|
|
97
|
+
required_outputs: ['test_plan', 'critical_paths', 'test_commands', 'qa_validation_report'],
|
|
98
|
+
constraints: [
|
|
99
|
+
'executable_tests_only',
|
|
100
|
+
'critical_paths_defined',
|
|
101
|
+
'commands_specified',
|
|
102
|
+
'no_vague_plans',
|
|
103
|
+
],
|
|
104
|
+
depends_on: ['ARCHITECT'],
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
REVIEWER: {
|
|
108
|
+
role: 'REVIEWER',
|
|
109
|
+
version: '1.0',
|
|
110
|
+
systemPrompt: `You are a Reviewer. You independently audit plans and produce structured votes (APPROVE/REJECT/CONDITIONAL). You check plan alignment, evidence references, completeness, and Constitution compliance. You must provide confidence scores and blocking issues when rejecting. You never see other reviewers' outputs during independent review.`,
|
|
111
|
+
required_outputs: ['structured_vote', 'blocking_issues', 'suggestions'],
|
|
112
|
+
constraints: [
|
|
113
|
+
'independent_review',
|
|
114
|
+
'evidence_based',
|
|
115
|
+
'structured_output',
|
|
116
|
+
'constitution_compliance_check',
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
ARBITRATOR: {
|
|
121
|
+
role: 'ARBITRATOR',
|
|
122
|
+
version: '1.0',
|
|
123
|
+
systemPrompt: `You are the Arbitrator. You mediate when reviewers disagree. You produce a binding decision with a merged patch when needed. You resolve conflicts by finding the synthesis that satisfies the Constitution and all valid concerns. Your decisions are final for the current consensus round.`,
|
|
124
|
+
required_outputs: ['binding_decision', 'merged_patch'],
|
|
125
|
+
constraints: [
|
|
126
|
+
'constitution_compliance',
|
|
127
|
+
'binding_decisions',
|
|
128
|
+
'conflict_resolution',
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
DEBUGGER: {
|
|
133
|
+
role: 'DEBUGGER',
|
|
134
|
+
version: '1.0',
|
|
135
|
+
systemPrompt: `You are the Debugger. You produce Root Cause Analysis (RCA) for failures. You identify the precise root cause, origin phase, responsible role, and recommended corrective actions. You specify whether a phase rewind is needed and which phases require re-consensus. You never guess — you trace from evidence.`,
|
|
136
|
+
required_outputs: ['rca_report', 'corrective_actions', 'phase_rewind_recommendation'],
|
|
137
|
+
constraints: [
|
|
138
|
+
'evidence_based_rca',
|
|
139
|
+
'precise_root_cause',
|
|
140
|
+
'no_guessing',
|
|
141
|
+
'phase_rewind_explicit',
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
AUDITOR: {
|
|
146
|
+
role: 'AUDITOR',
|
|
147
|
+
version: '1.0',
|
|
148
|
+
systemPrompt: `You are the Auditor. You perform holistic system verification: integration audit (FE↔BE, BE↔DB), config/env audit, tests/coverage audit, migration audit, basic security audit, and deployment readiness audit. You produce structured findings with severity (P0-P3) and blocking status. No P0/P1 findings may remain open for a PASS.`,
|
|
149
|
+
required_outputs: ['audit_report', 'findings', 'risk_score'],
|
|
150
|
+
constraints: [
|
|
151
|
+
'structured_findings',
|
|
152
|
+
'severity_classification',
|
|
153
|
+
'no_open_p0_p1_for_pass',
|
|
154
|
+
'deployment_path_verified',
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
JOURNALIST: {
|
|
159
|
+
role: 'JOURNALIST',
|
|
160
|
+
version: '1.0',
|
|
161
|
+
systemPrompt: `You are the Journalist. You maintain an immutable record of all approved artifacts under /docs/. You update /docs/INDEX.md after every consensus phase, audit, production gate, and recovery loop. You never overwrite artifacts — new versions create new files. You produce human-readable trace documents.`,
|
|
162
|
+
required_outputs: ['index_update', 'trace_document'],
|
|
163
|
+
constraints: [
|
|
164
|
+
'immutable_artifacts',
|
|
165
|
+
'index_always_current',
|
|
166
|
+
'human_readable_traces',
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
RELEASE_MANAGER: {
|
|
171
|
+
role: 'RELEASE_MANAGER',
|
|
172
|
+
version: '1.0',
|
|
173
|
+
systemPrompt: `You are the Release Manager. You produce release notes, deployment instructions, and rollback plans. You verify all production readiness criteria are met. You ensure the deployment path is documented and reversible.`,
|
|
174
|
+
required_outputs: ['release_notes', 'deployment_instructions', 'rollback_plan'],
|
|
175
|
+
constraints: [
|
|
176
|
+
'deployment_documented',
|
|
177
|
+
'rollback_plan_required',
|
|
178
|
+
'production_criteria_verified',
|
|
179
|
+
],
|
|
180
|
+
},
|
|
181
|
+
|
|
182
|
+
MARKETING_EXPERT: {
|
|
183
|
+
role: 'MARKETING_EXPERT',
|
|
184
|
+
version: '1.0',
|
|
185
|
+
systemPrompt: `You are the Marketing Expert. You provide brand strategy, messaging, positioning, and content direction for marketing materials and website copy. You align all marketing outputs with the product vision from the master plan.`,
|
|
186
|
+
required_outputs: ['brand_guidelines', 'messaging_framework'],
|
|
187
|
+
constraints: [
|
|
188
|
+
'brand_alignment',
|
|
189
|
+
'master_plan_alignment',
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
|
|
193
|
+
SOCIAL_EXPERT: {
|
|
194
|
+
role: 'SOCIAL_EXPERT',
|
|
195
|
+
version: '1.0',
|
|
196
|
+
systemPrompt: `You are the Social Expert. You design social media strategy, content calendars, and engagement plans. You align social presence with the brand guidelines and product launch timeline.`,
|
|
197
|
+
required_outputs: ['social_strategy', 'content_calendar'],
|
|
198
|
+
constraints: [
|
|
199
|
+
'brand_guidelines_adherence',
|
|
200
|
+
'launch_timeline_alignment',
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
UI_UX_SPECIALIST: {
|
|
205
|
+
role: 'UI_UX_SPECIALIST',
|
|
206
|
+
version: '1.0',
|
|
207
|
+
systemPrompt: `You are the UI/UX Specialist. You define user flows, wireframes, design systems, and interaction patterns. You ensure accessibility compliance and consistent user experience across all screens. Your designs inform the Frontend Programmer's implementation.`,
|
|
208
|
+
required_outputs: ['user_flows', 'design_system', 'interaction_patterns'],
|
|
209
|
+
constraints: [
|
|
210
|
+
'accessibility_compliance',
|
|
211
|
+
'consistency_required',
|
|
212
|
+
'design_system_defined',
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Artifact system types — artifact types, refs, entries, dependency edges.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { PipelinePhaseSchema } from './enums.js';
|
|
7
|
+
|
|
8
|
+
// ─── Artifact Types ──────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
export const ArtifactTypeSchema = z.enum([
|
|
11
|
+
'master_plan',
|
|
12
|
+
'architecture',
|
|
13
|
+
'role_plan',
|
|
14
|
+
'consensus',
|
|
15
|
+
'arbitration',
|
|
16
|
+
'audit_report',
|
|
17
|
+
'rca_report',
|
|
18
|
+
'production_readiness',
|
|
19
|
+
'release_notes',
|
|
20
|
+
'deployment',
|
|
21
|
+
'rollback',
|
|
22
|
+
'repo_snapshot',
|
|
23
|
+
'build_check',
|
|
24
|
+
'test_check',
|
|
25
|
+
'lint_check',
|
|
26
|
+
'typecheck_check',
|
|
27
|
+
'placeholder_scan',
|
|
28
|
+
'qa_validation',
|
|
29
|
+
'review_decision',
|
|
30
|
+
'stuck_report',
|
|
31
|
+
'journalist_trace',
|
|
32
|
+
'resolved_commands',
|
|
33
|
+
'constitution',
|
|
34
|
+
'change_request',
|
|
35
|
+
]);
|
|
36
|
+
export type ArtifactType = z.infer<typeof ArtifactTypeSchema>;
|
|
37
|
+
|
|
38
|
+
// ─── Content Type ────────────────────────────────────────
|
|
39
|
+
|
|
40
|
+
export const ContentTypeSchema = z.enum(['markdown', 'json']);
|
|
41
|
+
export type ContentType = z.infer<typeof ContentTypeSchema>;
|
|
42
|
+
|
|
43
|
+
// ─── Artifact Reference ──────────────────────────────────
|
|
44
|
+
|
|
45
|
+
/** Universal pointer between packets and artifacts */
|
|
46
|
+
export const ArtifactRefSchema = z.object({
|
|
47
|
+
artifact_id: z.string(),
|
|
48
|
+
path: z.string(),
|
|
49
|
+
sha256: z.string(),
|
|
50
|
+
version: z.number().int().positive(),
|
|
51
|
+
type: ArtifactTypeSchema,
|
|
52
|
+
});
|
|
53
|
+
export type ArtifactRef = z.infer<typeof ArtifactRefSchema>;
|
|
54
|
+
|
|
55
|
+
// ─── Artifact Entry ──────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
/** Immutable artifact entry stored in pipeline state */
|
|
58
|
+
export const ArtifactEntrySchema = z.object({
|
|
59
|
+
id: z.string(),
|
|
60
|
+
type: ArtifactTypeSchema,
|
|
61
|
+
phase: PipelinePhaseSchema,
|
|
62
|
+
version: z.number().int().positive(),
|
|
63
|
+
path: z.string(),
|
|
64
|
+
sha256: z.string(),
|
|
65
|
+
timestamp: z.string(),
|
|
66
|
+
immutable: z.literal(true),
|
|
67
|
+
content_type: ContentTypeSchema,
|
|
68
|
+
group_id: z.string(),
|
|
69
|
+
previous_id: z.string().optional(),
|
|
70
|
+
});
|
|
71
|
+
export type ArtifactEntry = z.infer<typeof ArtifactEntrySchema>;
|
|
72
|
+
|
|
73
|
+
// ─── Dependency Edge ─────────────────────────────────────
|
|
74
|
+
|
|
75
|
+
/** Dependency edge between artifacts */
|
|
76
|
+
export const DependencyEdgeSchema = z.object({
|
|
77
|
+
from: ArtifactRefSchema,
|
|
78
|
+
to: ArtifactRefSchema,
|
|
79
|
+
relationship: z.enum(['depends_on', 'supersedes', 'references']),
|
|
80
|
+
});
|
|
81
|
+
export type DependencyEdge = z.infer<typeof DependencyEdgeSchema>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audit types — findings, reports, severity classifications.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { PipelineRoleSchema } from './enums.js';
|
|
7
|
+
import { ArtifactRefSchema } from './artifacts.js';
|
|
8
|
+
|
|
9
|
+
// ─── Audit Severity & Category ───────────────────────────
|
|
10
|
+
|
|
11
|
+
export const AuditSeveritySchema = z.enum(['P0', 'P1', 'P2', 'P3']);
|
|
12
|
+
export type AuditSeverity = z.infer<typeof AuditSeveritySchema>;
|
|
13
|
+
|
|
14
|
+
export const AuditCategorySchema = z.enum([
|
|
15
|
+
'integration',
|
|
16
|
+
'config',
|
|
17
|
+
'tests',
|
|
18
|
+
'schema',
|
|
19
|
+
'security',
|
|
20
|
+
'deployment',
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
// ─── Audit Finding ───────────────────────────────────────
|
|
24
|
+
|
|
25
|
+
export const AuditFindingSchema = z.object({
|
|
26
|
+
id: z.string(),
|
|
27
|
+
severity: AuditSeveritySchema,
|
|
28
|
+
category: AuditCategorySchema,
|
|
29
|
+
description: z.string(),
|
|
30
|
+
evidence: z.array(ArtifactRefSchema),
|
|
31
|
+
file_path: z.string().optional(),
|
|
32
|
+
line_number: z.number().int().optional(),
|
|
33
|
+
suggested_owner: PipelineRoleSchema,
|
|
34
|
+
blocking: z.boolean(),
|
|
35
|
+
});
|
|
36
|
+
export type AuditFinding = z.infer<typeof AuditFindingSchema>;
|
|
37
|
+
|
|
38
|
+
// ─── Audit Report ────────────────────────────────────────
|
|
39
|
+
|
|
40
|
+
export const AuditReportSchema = z.object({
|
|
41
|
+
audit_id: z.string(),
|
|
42
|
+
timestamp: z.string(),
|
|
43
|
+
repo_snapshot: ArtifactRefSchema,
|
|
44
|
+
overall_status: z.enum(['PASS', 'FAIL']),
|
|
45
|
+
findings: z.array(AuditFindingSchema),
|
|
46
|
+
system_risk_score: z.number().min(0).max(100),
|
|
47
|
+
recovery_required: z.boolean(),
|
|
48
|
+
});
|
|
49
|
+
export type AuditReport = z.infer<typeof AuditReportSchema>;
|
|
50
|
+
|
|
51
|
+
// ─── Production Readiness ────────────────────────────────
|
|
52
|
+
|
|
53
|
+
export const ProductionReadinessSchema = z.object({
|
|
54
|
+
production_id: z.string(),
|
|
55
|
+
timestamp: z.string(),
|
|
56
|
+
build_status: z.enum(['pass', 'fail', 'skip']),
|
|
57
|
+
test_status: z.enum(['pass', 'fail', 'skip']),
|
|
58
|
+
lint_status: z.enum(['pass', 'fail', 'skip']),
|
|
59
|
+
typecheck_status: z.enum(['pass', 'fail', 'skip']),
|
|
60
|
+
migration_status: z.enum(['pass', 'fail', 'skip', 'n/a']),
|
|
61
|
+
audit_status: z.enum(['PASS', 'FAIL']),
|
|
62
|
+
placeholder_scan_status: z.enum(['pass', 'fail', 'skip']),
|
|
63
|
+
security_status: z.enum(['pass', 'fail', 'skip']),
|
|
64
|
+
unresolved_blockers: z.array(z.string()),
|
|
65
|
+
final_verdict: z.enum(['PASS', 'FAIL']),
|
|
66
|
+
});
|
|
67
|
+
export type ProductionReadiness = z.infer<typeof ProductionReadinessSchema>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gate check types — check definitions and results.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { ArtifactRefSchema } from './artifacts.js';
|
|
7
|
+
|
|
8
|
+
// ─── Gate Check Types ────────────────────────────────────
|
|
9
|
+
|
|
10
|
+
export const GateCheckTypeSchema = z.enum([
|
|
11
|
+
'build',
|
|
12
|
+
'test',
|
|
13
|
+
'lint',
|
|
14
|
+
'typecheck',
|
|
15
|
+
'migration',
|
|
16
|
+
'placeholder_scan',
|
|
17
|
+
'start',
|
|
18
|
+
'env_check',
|
|
19
|
+
]);
|
|
20
|
+
export type GateCheckType = z.infer<typeof GateCheckTypeSchema>;
|
|
21
|
+
|
|
22
|
+
// ─── Gate Check Result ───────────────────────────────────
|
|
23
|
+
|
|
24
|
+
export const GateCheckResultSchema = z.object({
|
|
25
|
+
check_type: GateCheckTypeSchema,
|
|
26
|
+
status: z.enum(['pass', 'fail', 'skip']),
|
|
27
|
+
command: z.string(),
|
|
28
|
+
exit_code: z.number().int(),
|
|
29
|
+
stdout_artifact: ArtifactRefSchema.optional(),
|
|
30
|
+
stderr_summary: z.string().optional(),
|
|
31
|
+
duration_ms: z.number(),
|
|
32
|
+
timestamp: z.string(),
|
|
33
|
+
});
|
|
34
|
+
export type GateCheckResult = z.infer<typeof GateCheckResultSchema>;
|
|
35
|
+
|
|
36
|
+
// ─── Resolved Commands ───────────────────────────────────
|
|
37
|
+
|
|
38
|
+
export const ResolvedCommandsSchema = z.object({
|
|
39
|
+
build: z.string().optional(),
|
|
40
|
+
test: z.string().optional(),
|
|
41
|
+
lint: z.string().optional(),
|
|
42
|
+
typecheck: z.string().optional(),
|
|
43
|
+
migrations: z.string().optional(),
|
|
44
|
+
start: z.string().optional(),
|
|
45
|
+
resolved_from: z.string(),
|
|
46
|
+
});
|
|
47
|
+
export type ResolvedCommands = z.infer<typeof ResolvedCommandsSchema>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline core enums — phase and role definitions.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
|
|
7
|
+
// ─── Pipeline Phases ─────────────────────────────────────
|
|
8
|
+
|
|
9
|
+
export const PipelinePhaseSchema = z.enum([
|
|
10
|
+
'INTAKE',
|
|
11
|
+
'CONSENSUS_MASTER_PLAN',
|
|
12
|
+
'ARCHITECTURE',
|
|
13
|
+
'CONSENSUS_ARCHITECTURE',
|
|
14
|
+
'ROLE_PLANNING',
|
|
15
|
+
'CONSENSUS_ROLE_PLANS',
|
|
16
|
+
'IMPLEMENTATION',
|
|
17
|
+
'QA_VALIDATION',
|
|
18
|
+
'REVIEW',
|
|
19
|
+
'AUDIT',
|
|
20
|
+
'PRODUCTION_GATE',
|
|
21
|
+
'RECOVERY_LOOP',
|
|
22
|
+
'DONE',
|
|
23
|
+
'STUCK',
|
|
24
|
+
]);
|
|
25
|
+
export type PipelinePhase = z.infer<typeof PipelinePhaseSchema>;
|
|
26
|
+
|
|
27
|
+
/** Ordered list of phases for sequential progression */
|
|
28
|
+
export const PIPELINE_PHASE_ORDER: readonly PipelinePhase[] = [
|
|
29
|
+
'INTAKE',
|
|
30
|
+
'CONSENSUS_MASTER_PLAN',
|
|
31
|
+
'ARCHITECTURE',
|
|
32
|
+
'CONSENSUS_ARCHITECTURE',
|
|
33
|
+
'ROLE_PLANNING',
|
|
34
|
+
'CONSENSUS_ROLE_PLANS',
|
|
35
|
+
'IMPLEMENTATION',
|
|
36
|
+
'QA_VALIDATION',
|
|
37
|
+
'REVIEW',
|
|
38
|
+
'AUDIT',
|
|
39
|
+
'PRODUCTION_GATE',
|
|
40
|
+
] as const;
|
|
41
|
+
|
|
42
|
+
// ─── Pipeline Roles ──────────────────────────────────────
|
|
43
|
+
|
|
44
|
+
export const PipelineRoleSchema = z.enum([
|
|
45
|
+
'DISPATCHER',
|
|
46
|
+
'ARCHITECT',
|
|
47
|
+
'DB_EXPERT',
|
|
48
|
+
'BACKEND_PROGRAMMER',
|
|
49
|
+
'FRONTEND_PROGRAMMER',
|
|
50
|
+
'WEBSITE_PROGRAMMER',
|
|
51
|
+
'QA_TESTER',
|
|
52
|
+
'REVIEWER',
|
|
53
|
+
'ARBITRATOR',
|
|
54
|
+
'DEBUGGER',
|
|
55
|
+
'AUDITOR',
|
|
56
|
+
'JOURNALIST',
|
|
57
|
+
'RELEASE_MANAGER',
|
|
58
|
+
'MARKETING_EXPERT',
|
|
59
|
+
'SOCIAL_EXPERT',
|
|
60
|
+
'UI_UX_SPECIALIST',
|
|
61
|
+
]);
|
|
62
|
+
export type PipelineRole = z.infer<typeof PipelineRoleSchema>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline types — barrel re-export.
|
|
3
|
+
* All existing `from '../pipeline/types.js'` imports continue to work.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export * from './enums.js';
|
|
7
|
+
export * from './artifacts.js';
|
|
8
|
+
export * from './packets.js';
|
|
9
|
+
export * from './audit.js';
|
|
10
|
+
export * from './snapshot.js';
|
|
11
|
+
export * from './checks.js';
|
|
12
|
+
export * from './state.js';
|