refactor(rebrand): rename & rebrand CI → CIAgent across all source and test files
- Type renames: CIConfig → CIAgentConfig, DEFAULT_CI_CONFIG → DEFAULT_CIAGENT_CONFIG - Type renames: CiMetadata → CIAgentMetadata, ParsedCiCommit → ParsedCIAgentCommit - Function renames: initCI → initCIAgent, isCIInitialized → isCIAgentInitialized - Function renames: extractCiBlock → extractCIAgentBlock, parseCiBlock → parseCIAgentBlock - Class renames: CiFiles → CIAgentFiles - Import paths: ci-files.js → ciagent-files.js - Directory paths: .ci/ → .ciagent/ across all source and test files - Check names: ".ci directory exists" → ".ciagent directory exists" - Check names: "CI config valid" → "CIAgent config valid" - Temp dir names: ci-*-test- → ciagent-*-test- - CLI examples: "ci init" → "ciagent init" - Fix deepMerge infinite recursion bug in config.ts - ---ci---/---/ci--- block markers preserved unchanged - All 31 test suites, 370 tests passing ---ci--- phase: 1 milestone: v0.5 plan: 07 task: 07-01-01 status: execute ---/ci---
This commit is contained in:
@@ -7,7 +7,7 @@ describe("BehavioralVerification", () => {
|
||||
let tempDir: string;
|
||||
|
||||
beforeEach(() => {
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ci-behavioral-test-"));
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ciagent-behavioral-test-"));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -50,7 +50,7 @@ describe("BehavioralVerification", () => {
|
||||
});
|
||||
|
||||
it("passes with REQUIREMENTS.md", async () => {
|
||||
const ciDir = path.join(tempDir, ".ci");
|
||||
const ciDir = path.join(tempDir, ".ciagent");
|
||||
fs.mkdirSync(ciDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(ciDir, "REQUIREMENTS.md"), "# Requirements\n\n| REQ-ID | Requirement | Priority | Phase | Status |\n|--------|-------------|----------|-------|--------|\n| REQ-01 | Must have auth | P0 | 1 | pending |\n");
|
||||
|
||||
@@ -62,7 +62,7 @@ describe("BehavioralVerification", () => {
|
||||
});
|
||||
|
||||
it("skips when no REQUIREMENTS.md or PROJECT.md", async () => {
|
||||
const ciDir = path.join(tempDir, ".ci");
|
||||
const ciDir = path.join(tempDir, ".ciagent");
|
||||
fs.mkdirSync(ciDir, { recursive: true });
|
||||
|
||||
const verifier = new BehavioralVerification();
|
||||
@@ -73,7 +73,7 @@ describe("BehavioralVerification", () => {
|
||||
});
|
||||
|
||||
it("passes with PROJECT.md when no REQUIREMENTS.md", async () => {
|
||||
const ciDir = path.join(tempDir, ".ci");
|
||||
const ciDir = path.join(tempDir, ".ciagent");
|
||||
fs.mkdirSync(ciDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(ciDir, "PROJECT.md"), "# Test\n\n## What This Is\nBuild it\n\n## Requirements\n\n### Active\n\n- [ ] Must have auth\n- [ ] Shall support CRUD\n");
|
||||
|
||||
|
||||
@@ -108,8 +108,8 @@ export class BehavioralVerification extends VerificationLayer {
|
||||
}
|
||||
|
||||
private checkSpecificationRequirements(projectPath: string): VerificationCheck {
|
||||
const reqPath = path.join(projectPath, ".ci", "REQUIREMENTS.md");
|
||||
const projectPath_md = path.join(projectPath, ".ci", "PROJECT.md");
|
||||
const reqPath = path.join(projectPath, ".ciagent", "REQUIREMENTS.md");
|
||||
const projectPath_md = path.join(projectPath, ".ciagent", "PROJECT.md");
|
||||
|
||||
const specPath = reqPath;
|
||||
if (!fs.existsSync(specPath)) {
|
||||
@@ -189,7 +189,7 @@ export class BehavioralVerification extends VerificationLayer {
|
||||
private checkPlanMustHaves(projectPath: string, phase: number): VerificationCheck {
|
||||
const roadmapPath = path.join(
|
||||
projectPath,
|
||||
".ci",
|
||||
".ciagent",
|
||||
"ROADMAP.md"
|
||||
);
|
||||
|
||||
@@ -252,7 +252,7 @@ export class BehavioralVerification extends VerificationLayer {
|
||||
ciBlockRegex.lastIndex = 0;
|
||||
}
|
||||
|
||||
const reqPath = path.join(projectPath, ".ci", "REQUIREMENTS.md");
|
||||
const reqPath = path.join(projectPath, ".ciagent", "REQUIREMENTS.md");
|
||||
if (!fs.existsSync(reqPath)) {
|
||||
return this.check(
|
||||
"Requirement test coverage via git log",
|
||||
|
||||
@@ -7,8 +7,8 @@ describe("VerificationPipeline", () => {
|
||||
let tempDir: string;
|
||||
|
||||
beforeEach(() => {
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ci-pipeline-test-"));
|
||||
const ciDir = path.join(tempDir, ".ci");
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ciagent-pipeline-test-"));
|
||||
const ciDir = path.join(tempDir, ".ciagent");
|
||||
fs.mkdirSync(ciDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(ciDir, "config.json"), JSON.stringify({ autonomy: { level: "full" } }));
|
||||
fs.writeFileSync(path.join(ciDir, "specification.md"), "# Test\n## Objective\nBuild it\n\n## Requirements\n- Feature A\n");
|
||||
|
||||
@@ -7,7 +7,7 @@ describe("QualityVerification", () => {
|
||||
let tempDir: string;
|
||||
|
||||
beforeEach(() => {
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ci-quality-test-"));
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ciagent-quality-test-"));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -7,7 +7,7 @@ describe("SecurityVerification", () => {
|
||||
let tempDir: string;
|
||||
|
||||
beforeEach(() => {
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ci-security-test-"));
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ciagent-security-test-"));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -7,28 +7,28 @@ describe("StructuralVerification", () => {
|
||||
let tempDir: string;
|
||||
|
||||
beforeEach(() => {
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ci-structural-test-"));
|
||||
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "ciagent-structural-test-"));
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fs.rmSync(tempDir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
function setupProjectStructure(hasCIDir = true, hasRoadmap = true, hasCIConfig = true, hasSpec = true) {
|
||||
function setupProjectStructure(hasCIDir = true, hasRoadmap = true, hasCIAgentConfig = true, hasSpec = true) {
|
||||
if (hasCIDir) {
|
||||
const ciDir = path.join(tempDir, ".ci");
|
||||
const ciDir = path.join(tempDir, ".ciagent");
|
||||
fs.mkdirSync(ciDir, { recursive: true });
|
||||
if (hasRoadmap) {
|
||||
fs.writeFileSync(path.join(ciDir, "ROADMAP.md"), "# Roadmap\n\n## Phases\n\n### Phase 1: Init\n**Goal**: Set up project\n**Status**: not_started\n");
|
||||
}
|
||||
}
|
||||
if (hasCIConfig) {
|
||||
const ciDir = path.join(tempDir, ".ci");
|
||||
if (hasCIAgentConfig) {
|
||||
const ciDir = path.join(tempDir, ".ciagent");
|
||||
fs.mkdirSync(ciDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(ciDir, "config.json"), JSON.stringify({ autonomy: { level: "full" } }, null, 2));
|
||||
}
|
||||
if (hasSpec) {
|
||||
const specDir = path.join(tempDir, ".ci");
|
||||
const specDir = path.join(tempDir, ".ciagent");
|
||||
if (!fs.existsSync(specDir)) fs.mkdirSync(specDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(specDir, "specification.md"), "# Project\n## Objective\nBuild a REST API for task management\n\n## Requirements\n- User auth\n- CRUD\n");
|
||||
}
|
||||
@@ -43,13 +43,13 @@ describe("StructuralVerification", () => {
|
||||
expect(result.name).toBe("Structural");
|
||||
expect(result.checks.length).toBeGreaterThan(0);
|
||||
|
||||
const phaseDirCheck = result.checks.find((c) => c.name === ".ci directory exists");
|
||||
const phaseDirCheck = result.checks.find((c) => c.name === ".ciagent directory exists");
|
||||
expect(phaseDirCheck?.status).toBe("pass");
|
||||
|
||||
const planCheck = result.checks.find((c) => c.name === "ROADMAP.md exists");
|
||||
expect(planCheck?.status).toBe("pass");
|
||||
|
||||
const configCheck = result.checks.find((c) => c.name === "CI config valid");
|
||||
const configCheck = result.checks.find((c) => c.name === "CIAgent config valid");
|
||||
expect(configCheck?.status).toBe("pass");
|
||||
|
||||
const specCheck = result.checks.find((c) => c.name === "Specification exists");
|
||||
@@ -61,7 +61,7 @@ describe("StructuralVerification", () => {
|
||||
const verifier = new StructuralVerification();
|
||||
const result = await verifier.verify(tempDir, 1);
|
||||
|
||||
const phaseDirCheck = result.checks.find((c) => c.name === ".ci directory exists");
|
||||
const phaseDirCheck = result.checks.find((c) => c.name === ".ciagent directory exists");
|
||||
expect(phaseDirCheck?.status).toBe("fail");
|
||||
});
|
||||
|
||||
@@ -75,15 +75,15 @@ describe("StructuralVerification", () => {
|
||||
});
|
||||
|
||||
it("fails when CI config has invalid JSON", async () => {
|
||||
const ciDir = path.join(tempDir, ".ci");
|
||||
const ciDir = path.join(tempDir, ".ciagent");
|
||||
fs.mkdirSync(ciDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(ciDir, "config.json"), "not valid json{{{");
|
||||
fs.mkdirSync(path.join(tempDir, ".ci"), { recursive: true });
|
||||
fs.mkdirSync(path.join(tempDir, ".ciagent"), { recursive: true });
|
||||
|
||||
const verifier = new StructuralVerification();
|
||||
const result = await verifier.verify(tempDir, 1);
|
||||
|
||||
const configCheck = result.checks.find((c) => c.name === "CI config valid");
|
||||
const configCheck = result.checks.find((c) => c.name === "CIAgent config valid");
|
||||
expect(configCheck?.status).toBe("fail");
|
||||
});
|
||||
|
||||
@@ -91,7 +91,7 @@ describe("StructuralVerification", () => {
|
||||
const srcDir = path.join(tempDir, "src");
|
||||
fs.mkdirSync(srcDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(srcDir, "app.ts"), "export function main() { /* TODO: implement */ }");
|
||||
const ciDir = path.join(tempDir, ".ci");
|
||||
const ciDir = path.join(tempDir, ".ciagent");
|
||||
fs.mkdirSync(ciDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(ciDir, "config.json"), "{}");
|
||||
fs.writeFileSync(path.join(ciDir, "specification.md"), "# Test\n## Objective\nBuild it");
|
||||
|
||||
@@ -23,7 +23,7 @@ export class StructuralVerification extends VerificationLayer {
|
||||
|
||||
checks.push(this.checkPhaseDir(projectPath, phase));
|
||||
checks.push(this.checkPlanExists(projectPath, phase));
|
||||
checks.push(this.checkCIConfig(projectPath));
|
||||
checks.push(this.checkCIAgentConfig(projectPath));
|
||||
checks.push(this.checkSpecification(projectPath));
|
||||
checks.push(this.checkNoStubs(projectPath));
|
||||
checks.push(this.checkImportsWired(projectPath));
|
||||
@@ -41,47 +41,47 @@ export class StructuralVerification extends VerificationLayer {
|
||||
}
|
||||
|
||||
private checkPhaseDir(projectPath: string, phase: number) {
|
||||
const ciDir = path.join(projectPath, ".ci");
|
||||
const ciDir = path.join(projectPath, ".ciagent");
|
||||
const exists = fs.existsSync(ciDir);
|
||||
return this.check(
|
||||
".ci directory exists",
|
||||
".ciagent directory exists",
|
||||
exists ? "pass" : "fail",
|
||||
exists ? ".ci directory found" : ".ci directory not found",
|
||||
exists ? ".ciagent directory found" : ".ciagent directory not found",
|
||||
ciDir
|
||||
);
|
||||
}
|
||||
|
||||
private checkPlanExists(projectPath: string, phase: number) {
|
||||
const roadmapPath = path.join(projectPath, ".ci", "ROADMAP.md");
|
||||
const roadmapPath = path.join(projectPath, ".ciagent", "ROADMAP.md");
|
||||
const exists = fs.existsSync(roadmapPath);
|
||||
return this.check(
|
||||
"ROADMAP.md exists",
|
||||
exists ? "pass" : "warning",
|
||||
exists ? "ROADMAP.md found" : "ROADMAP.md not found (run 'ci init' first)",
|
||||
exists ? "ROADMAP.md found" : "ROADMAP.md not found (run 'ciagent init' first)",
|
||||
roadmapPath
|
||||
);
|
||||
}
|
||||
|
||||
private checkCIConfig(projectPath: string) {
|
||||
const configPath = path.join(projectPath, ".ci", "config.json");
|
||||
private checkCIAgentConfig(projectPath: string) {
|
||||
const configPath = path.join(projectPath, ".ciagent", "config.json");
|
||||
const exists = fs.existsSync(configPath);
|
||||
if (!exists) {
|
||||
return this.check("CI config exists", "fail", ".ci/config.json not found", configPath);
|
||||
return this.check("CIAgent config exists", "fail", ".ciagent/config.json not found", configPath);
|
||||
}
|
||||
try {
|
||||
const content = fs.readFileSync(configPath, "utf-8");
|
||||
JSON.parse(content);
|
||||
return this.check("CI config valid", "pass", ".ci/config.json is valid JSON");
|
||||
return this.check("CIAgent config valid", "pass", ".ciagent/config.json is valid JSON");
|
||||
} catch (e) {
|
||||
return this.check("CI config valid", "fail", `.ci/config.json has invalid JSON: ${(e as Error).message}`);
|
||||
return this.check("CIAgent config valid", "fail", `.ciagent/config.json has invalid JSON: ${(e as Error).message}`);
|
||||
}
|
||||
}
|
||||
|
||||
private checkSpecification(projectPath: string) {
|
||||
const specPath = path.join(projectPath, ".ci", "specification.md");
|
||||
const specPath = path.join(projectPath, ".ciagent", "specification.md");
|
||||
const exists = fs.existsSync(specPath);
|
||||
if (!exists) {
|
||||
return this.check("Specification exists", "warning", ".ci/specification.md not found — specification may not be loaded yet");
|
||||
return this.check("Specification exists", "warning", ".ciagent/specification.md not found — specification may not be loaded yet");
|
||||
}
|
||||
const content = fs.readFileSync(specPath, "utf-8");
|
||||
if (content.trim().length < 10) {
|
||||
|
||||
Reference in New Issue
Block a user