feat: implement CI (Continuous Intelligence) autonomous engineering harness
Implements the full PRD for CI - a fully autonomous AI-driven software engineering harness derived from Learnship's architecture. Core components: - CI Orchestrator agent with autonomous pipeline (SPECIFY → CLARIFY → RESEARCH → PLAN → EXECUTE → VERIFY → COMPLETE) - Decision Engine with confidence thresholds (high/medium/low) - Clarify Phase with question budget and default acceptance - Escalation Protocol with timeout auto-proceed - Audit Trail system (.ci/audit/) for post-hoc review - Error Recovery with retry, plan revision, and rollback 18 agents (all Learnship agents + Orchestrator): - Autonomous behavioral modifications per PRD §7.1 - Agent registry with factory pattern 11 CLI commands: - ci init, ci run, ci quick, ci debug, ci verify - ci review, ci status, ci audit, ci clarify - ci rollback, ci ship 4-layer verification system: - Structural, Behavioral, Security, Code Quality 3 autonomy levels: full, supervised, guided Compatible with Learnship artifact schemas (.planning/)
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
import { AgentName, PhaseName } from "./config.js";
|
||||
|
||||
export type PipelineStage =
|
||||
| "specify"
|
||||
| "clarify"
|
||||
| "research"
|
||||
| "plan"
|
||||
| "execute"
|
||||
| "verify"
|
||||
| "complete";
|
||||
|
||||
export interface PipelineState {
|
||||
project_path: string;
|
||||
current_stage: PipelineStage;
|
||||
current_phase: number;
|
||||
phases_completed: number[];
|
||||
specification_loaded: boolean;
|
||||
clarify_completed: boolean;
|
||||
research_completed: boolean;
|
||||
plan_completed: boolean;
|
||||
execute_completed: boolean;
|
||||
verify_completed: boolean;
|
||||
errors: PipelineError[];
|
||||
started_at: string;
|
||||
last_updated: string;
|
||||
}
|
||||
|
||||
export interface PipelineError {
|
||||
stage: PipelineStage;
|
||||
phase: number;
|
||||
message: string;
|
||||
timestamp: string;
|
||||
retry_count: number;
|
||||
resolved: boolean;
|
||||
}
|
||||
|
||||
export interface PhaseResult {
|
||||
phase: number;
|
||||
stage: PipelineStage;
|
||||
success: boolean;
|
||||
artifacts_created: string[];
|
||||
decisions_made: number;
|
||||
escalations_raised: number;
|
||||
duration_ms: number;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface OrchestratorResult {
|
||||
success: boolean;
|
||||
pipeline_state: PipelineState;
|
||||
phase_results: PhaseResult[];
|
||||
total_decisions: number;
|
||||
total_escalations: number;
|
||||
total_duration_ms: number;
|
||||
completion_report: string;
|
||||
}
|
||||
|
||||
export const STAGE_ORDER: PipelineStage[] = [
|
||||
"specify",
|
||||
"clarify",
|
||||
"research",
|
||||
"plan",
|
||||
"execute",
|
||||
"verify",
|
||||
"complete",
|
||||
];
|
||||
|
||||
export function getNextStage(current: PipelineStage): PipelineStage | null {
|
||||
const idx = STAGE_ORDER.indexOf(current);
|
||||
if (idx < 0 || idx >= STAGE_ORDER.length - 1) return null;
|
||||
return STAGE_ORDER[idx + 1];
|
||||
}
|
||||
|
||||
export function createInitialPipelineState(
|
||||
project_path: string
|
||||
): PipelineState {
|
||||
return {
|
||||
project_path,
|
||||
current_stage: "specify",
|
||||
current_phase: 0,
|
||||
phases_completed: [],
|
||||
specification_loaded: false,
|
||||
clarify_completed: false,
|
||||
research_completed: false,
|
||||
plan_completed: false,
|
||||
execute_completed: false,
|
||||
verify_completed: false,
|
||||
errors: [],
|
||||
started_at: new Date().toISOString(),
|
||||
last_updated: new Date().toISOString(),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user