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,56 @@
|
||||
import * as fs from "node:fs";
|
||||
import * as path from "node:path";
|
||||
|
||||
export function fileExists(filePath: string): boolean {
|
||||
return fs.existsSync(filePath);
|
||||
}
|
||||
|
||||
export function ensureDir(dirPath: string): void {
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
fs.mkdirSync(dirPath, { recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
export function readFile(filePath: string): string | null {
|
||||
if (!fs.existsSync(filePath)) return null;
|
||||
return fs.readFileSync(filePath, "utf-8");
|
||||
}
|
||||
|
||||
export function writeFile(filePath: string, content: string): void {
|
||||
const dir = path.dirname(filePath);
|
||||
ensureDir(dir);
|
||||
fs.writeFileSync(filePath, content, "utf-8");
|
||||
}
|
||||
|
||||
export function readJSON<T>(filePath: string): T | null {
|
||||
const content = readFile(filePath);
|
||||
if (!content) return null;
|
||||
return JSON.parse(content) as T;
|
||||
}
|
||||
|
||||
export function writeJSON(filePath: string, data: unknown): void {
|
||||
writeFile(filePath, JSON.stringify(data, null, 2));
|
||||
}
|
||||
|
||||
export function listFiles(dirPath: string, pattern?: RegExp): string[] {
|
||||
if (!fs.existsSync(dirPath)) return [];
|
||||
const files = fs.readdirSync(dirPath);
|
||||
if (pattern) return files.filter((f) => pattern.test(f));
|
||||
return files;
|
||||
}
|
||||
|
||||
export function copyFile(src: string, dest: string): void {
|
||||
ensureDir(path.dirname(dest));
|
||||
fs.copyFileSync(src, dest);
|
||||
}
|
||||
|
||||
export function getProjectRoot(startPath?: string): string {
|
||||
let current = startPath || process.cwd();
|
||||
while (current !== path.dirname(current)) {
|
||||
if (fs.existsSync(path.join(current, ".ci"))) return current;
|
||||
if (fs.existsSync(path.join(current, ".git"))) return current;
|
||||
if (fs.existsSync(path.join(current, "package.json"))) return current;
|
||||
current = path.dirname(current);
|
||||
}
|
||||
return startPath || process.cwd();
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./file.js";
|
||||
Reference in New Issue
Block a user