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,65 @@
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
import { CIConfig, DEFAULT_CI_CONFIG } from "../types/config.js";
|
||||
|
||||
const CI_DIR = ".ci";
|
||||
const CONFIG_FILE = "config.json";
|
||||
|
||||
export function getCIConfigPath(projectPath: string): string {
|
||||
return path.join(projectPath, CI_DIR, CONFIG_FILE);
|
||||
}
|
||||
|
||||
export function getCIDir(projectPath: string): string {
|
||||
return path.join(projectPath, CI_DIR);
|
||||
}
|
||||
|
||||
export function ensureCIDir(projectPath: string): void {
|
||||
const ciDir = getCIDir(projectPath);
|
||||
if (!fs.existsSync(ciDir)) {
|
||||
fs.mkdirSync(ciDir, { recursive: true });
|
||||
}
|
||||
const auditDir = path.join(ciDir, "audit");
|
||||
if (!fs.existsSync(auditDir)) {
|
||||
fs.mkdirSync(auditDir, { recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
export function loadConfig(projectPath: string): CIConfig {
|
||||
const configPath = getCIConfigPath(projectPath);
|
||||
if (!fs.existsSync(configPath)) {
|
||||
return { ...DEFAULT_CI_CONFIG };
|
||||
}
|
||||
const raw = fs.readFileSync(configPath, "utf-8");
|
||||
const parsed = JSON.parse(raw);
|
||||
return { ...DEFAULT_CI_CONFIG, ...parsed } as CIConfig;
|
||||
}
|
||||
|
||||
export function saveConfig(projectPath: string, config: CIConfig): void {
|
||||
ensureCIDir(projectPath);
|
||||
const configPath = getCIConfigPath(projectPath);
|
||||
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
|
||||
}
|
||||
|
||||
export function isCIInitialized(projectPath: string): boolean {
|
||||
const ciDir = getCIDir(projectPath);
|
||||
const configPath = getCIConfigPath(projectPath);
|
||||
return fs.existsSync(ciDir) && fs.existsSync(configPath);
|
||||
}
|
||||
|
||||
export function initCI(projectPath: string, config?: Partial<CIConfig>): CIConfig {
|
||||
ensureCIDir(projectPath);
|
||||
const fullConfig: CIConfig = {
|
||||
...DEFAULT_CI_CONFIG,
|
||||
...config,
|
||||
autonomy: { ...DEFAULT_CI_CONFIG.autonomy, ...config?.autonomy },
|
||||
parallelization: {
|
||||
...DEFAULT_CI_CONFIG.parallelization,
|
||||
...config?.parallelization,
|
||||
},
|
||||
verification: { ...DEFAULT_CI_CONFIG.verification, ...config?.verification },
|
||||
security: { ...DEFAULT_CI_CONFIG.security, ...config?.security },
|
||||
git: { ...DEFAULT_CI_CONFIG.git, ...config?.git },
|
||||
};
|
||||
saveConfig(projectPath, fullConfig);
|
||||
return fullConfig;
|
||||
}
|
||||
Reference in New Issue
Block a user