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:
+49
-49
@@ -1,6 +1,6 @@
|
||||
import { Command } from "commander";
|
||||
import { CIConfig, AutonomyLevel } from "../types/config.js";
|
||||
import { initCI, loadConfig, isCIInitialized, saveConfig } from "../core/config.js";
|
||||
import { CIAgentConfig, AutonomyLevel } from "../types/config.js";
|
||||
import { initCIAgent, loadConfig, isCIAgentInitialized, saveConfig } from "../core/config.js";
|
||||
import { Specification, parseSpecification } from "../types/specification.js";
|
||||
import { saveSpecification } from "../core/clarify.js";
|
||||
import { OrchestratorAgent } from "../agents/orchestrator.js";
|
||||
@@ -21,7 +21,7 @@ import { execSync } from "node:child_process";
|
||||
|
||||
export function createInitCommand(): Command {
|
||||
return new Command("init")
|
||||
.description("Initialize a new CI project from a specification")
|
||||
.description("Initialize a new CIAgent project from a specification")
|
||||
.argument("[specification]", "Inline specification text")
|
||||
.option("-s, --spec <file>", "Specification file path")
|
||||
.option("-c, --clarify", "Start interactive clarify phase", false)
|
||||
@@ -36,9 +36,9 @@ export function createInitCommand(): Command {
|
||||
.action(async (specification, options) => {
|
||||
const projectPath = process.cwd();
|
||||
|
||||
if (isCIInitialized(projectPath)) {
|
||||
console.log("CI project already initialized in this directory.");
|
||||
console.log("Use 'ci run' to execute the pipeline or 'ci status' to check progress.");
|
||||
if (isCIAgentInitialized(projectPath)) {
|
||||
console.log("CIAgent project already initialized in this directory.");
|
||||
console.log("Use 'ciagent run' to execute the pipeline or 'ciagent status' to check progress.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ export function createInitCommand(): Command {
|
||||
}
|
||||
|
||||
const autonomyLevel = options.autonomy as AutonomyLevel;
|
||||
const config: Partial<CIConfig> = {
|
||||
const config: Partial<CIAgentConfig> = {
|
||||
autonomy: {
|
||||
level: autonomyLevel,
|
||||
escalation_hooks: ["deploy", "delete_data", "merge_to_main"],
|
||||
@@ -86,8 +86,8 @@ export function createInitCommand(): Command {
|
||||
},
|
||||
};
|
||||
|
||||
const fullConfig = initCI(projectPath, config);
|
||||
console.log(`✓ CI project initialized (autonomy: ${autonomyLevel})`);
|
||||
const fullConfig = initCIAgent(projectPath, config);
|
||||
console.log(`✓ CIAgent project initialized (autonomy: ${autonomyLevel})`);
|
||||
console.log(` Backend: ${options.backend || "auto"}`);
|
||||
|
||||
if (specText) {
|
||||
@@ -115,15 +115,15 @@ export function createInitCommand(): Command {
|
||||
}
|
||||
}
|
||||
|
||||
console.log("\nConfiguration saved to .ci/config.json");
|
||||
console.log("\nConfiguration saved to .ciagent/config.json");
|
||||
console.log("\nNext steps:");
|
||||
console.log(" ci run --all # Run full pipeline");
|
||||
console.log(" ci run research # Run specific phase");
|
||||
console.log(" ciagent run --all # Run full pipeline");
|
||||
console.log(" ciagent run research # Run specific phase");
|
||||
console.log(" ci status # Check project status");
|
||||
});
|
||||
}
|
||||
|
||||
async function resolveBackendForCommand(config: CIConfig, overrideBackend?: string): Promise<{ backend: import("../backends/types.js").IntelligenceBackend | undefined; error?: string }> {
|
||||
async function resolveBackendForCommand(config: CIAgentConfig, overrideBackend?: string): Promise<{ backend: import("../backends/types.js").IntelligenceBackend | undefined; error?: string }> {
|
||||
const backendConfig = { ...config.backend };
|
||||
if (overrideBackend) {
|
||||
backendConfig.provider = overrideBackend as typeof backendConfig.provider;
|
||||
@@ -168,8 +168,8 @@ export function createRunCommand(): Command {
|
||||
.action(async (phase, options) => {
|
||||
const projectPath = process.cwd();
|
||||
|
||||
if (!isCIInitialized(projectPath)) {
|
||||
console.error("CI project not initialized. Run 'ci init' first.");
|
||||
if (!isCIAgentInitialized(projectPath)) {
|
||||
console.error("CIAgent project not initialized. Run 'ciagent init' first.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ export function createRunCommand(): Command {
|
||||
phase: parseInt(options.phase) || 1,
|
||||
stage: phase || "all",
|
||||
specification: "",
|
||||
config_path: path.join(projectPath, ".ci", "config.json"),
|
||||
config_path: path.join(projectPath, ".ciagent", "config.json"),
|
||||
backend,
|
||||
};
|
||||
|
||||
@@ -196,7 +196,7 @@ export function createRunCommand(): Command {
|
||||
context.specification = spec.raw_content;
|
||||
}
|
||||
|
||||
console.log(`Running CI pipeline...`);
|
||||
console.log(`Running CIAgent pipeline...`);
|
||||
if (options.all) {
|
||||
console.log(" Mode: Full pipeline (all phases)");
|
||||
} else {
|
||||
@@ -226,16 +226,16 @@ export function createQuickCommand(): Command {
|
||||
const projectPath = process.cwd();
|
||||
console.log(`Quick task: ${description}`);
|
||||
|
||||
if (!isCIInitialized(projectPath)) {
|
||||
const config = initCI(projectPath);
|
||||
console.log("Initialized temporary CI project");
|
||||
if (!isCIAgentInitialized(projectPath)) {
|
||||
const config = initCIAgent(projectPath);
|
||||
console.log("Initialized temporary CIAgent project");
|
||||
}
|
||||
|
||||
const config = loadConfig(projectPath);
|
||||
const { backend, error: backendError } = await resolveBackendForCommand(config, options.backend);
|
||||
|
||||
if (!backend) {
|
||||
console.error(`\n✗ "ci quick" requires an intelligence backend.`);
|
||||
console.error(`\n✗ "ciagent quick" requires an intelligence backend.`);
|
||||
if (backendError) console.error(` ${backendError}`);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -249,7 +249,7 @@ export function createQuickCommand(): Command {
|
||||
phase: 0,
|
||||
stage: "all",
|
||||
specification: description,
|
||||
config_path: path.join(projectPath, ".ci", "config.json"),
|
||||
config_path: path.join(projectPath, ".ciagent", "config.json"),
|
||||
backend,
|
||||
};
|
||||
|
||||
@@ -274,8 +274,8 @@ export function createDebugCommand(): Command {
|
||||
.action(async (description, options) => {
|
||||
const projectPath = process.cwd();
|
||||
|
||||
if (!isCIInitialized(projectPath)) {
|
||||
console.error("CI project not initialized. Run 'ci init' first.");
|
||||
if (!isCIAgentInitialized(projectPath)) {
|
||||
console.error("CIAgent project not initialized. Run 'ciagent init' first.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ export function createDebugCommand(): Command {
|
||||
const { backend, error: backendError } = await resolveBackendForCommand(config, options.backend);
|
||||
|
||||
if (!backend) {
|
||||
console.error(`\n✗ "ci debug" requires an intelligence backend.`);
|
||||
console.error(`\n✗ "ciagent debug" requires an intelligence backend.`);
|
||||
if (backendError) console.error(` ${backendError}`);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -300,7 +300,7 @@ export function createDebugCommand(): Command {
|
||||
phase: 0,
|
||||
stage: "debug",
|
||||
specification: description || "",
|
||||
config_path: path.join(projectPath, ".ci", "config.json"),
|
||||
config_path: path.join(projectPath, ".ciagent", "config.json"),
|
||||
backend,
|
||||
};
|
||||
|
||||
@@ -324,8 +324,8 @@ export function createVerifyCommand(): Command {
|
||||
.action(async (phase, options) => {
|
||||
const projectPath = process.cwd();
|
||||
|
||||
if (!isCIInitialized(projectPath)) {
|
||||
console.error("CI project not initialized. Run 'ci init' first.");
|
||||
if (!isCIAgentInitialized(projectPath)) {
|
||||
console.error("CIAgent project not initialized. Run 'ciagent init' first.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -371,8 +371,8 @@ export function createReviewCommand(): Command {
|
||||
.action(async (phase, options) => {
|
||||
const projectPath = process.cwd();
|
||||
|
||||
if (!isCIInitialized(projectPath)) {
|
||||
console.error("CI project not initialized. Run 'ci init' first.");
|
||||
if (!isCIAgentInitialized(projectPath)) {
|
||||
console.error("CIAgent project not initialized. Run 'ciagent init' first.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ export function createReviewCommand(): Command {
|
||||
const { backend, error: backendError } = await resolveBackendForCommand(config, options.backend);
|
||||
|
||||
if (!backend) {
|
||||
console.error(`\n✗ "ci review" requires an intelligence backend.`);
|
||||
console.error(`\n✗ "ciagent review" requires an intelligence backend.`);
|
||||
if (backendError) console.error(` ${backendError}`);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -394,7 +394,7 @@ export function createReviewCommand(): Command {
|
||||
phase: phaseNum,
|
||||
stage: "review",
|
||||
specification: "",
|
||||
config_path: path.join(projectPath, ".ci", "config.json"),
|
||||
config_path: path.join(projectPath, ".ciagent", "config.json"),
|
||||
backend,
|
||||
};
|
||||
|
||||
@@ -415,16 +415,16 @@ export function createStatusCommand(): Command {
|
||||
.action(() => {
|
||||
const projectPath = process.cwd();
|
||||
|
||||
if (!isCIInitialized(projectPath)) {
|
||||
console.log("CI project not initialized in this directory.");
|
||||
console.log("Run 'ci init' to get started.");
|
||||
if (!isCIAgentInitialized(projectPath)) {
|
||||
console.log("CIAgent project not initialized in this directory.");
|
||||
console.log("Run 'ciagent init' to get started.");
|
||||
return;
|
||||
}
|
||||
|
||||
const config = loadConfig(projectPath);
|
||||
const artifacts = new ArtifactManager(projectPath);
|
||||
|
||||
console.log("─── CI Project Status ───");
|
||||
console.log("─── CIAgent Project Status ───");
|
||||
console.log(`\nAutonomy: ${config.autonomy.level}`);
|
||||
console.log(`Model Profile: ${config.model_profile}`);
|
||||
console.log(`Backend: ${config.backend?.provider || "auto"}`);
|
||||
@@ -444,7 +444,7 @@ export function createStatusCommand(): Command {
|
||||
console.log(` ${icon} ${stage}`);
|
||||
}
|
||||
} else {
|
||||
console.log("\nNo pipeline state found. Run 'ci run --all' to start.");
|
||||
console.log("\nNo pipeline state found. Run 'ciagent run --all' to start.");
|
||||
}
|
||||
|
||||
const summary = getAuditSummary(projectPath);
|
||||
@@ -464,15 +464,15 @@ export function createAuditCommand(): Command {
|
||||
.action((options) => {
|
||||
const projectPath = process.cwd();
|
||||
|
||||
if (!isCIInitialized(projectPath)) {
|
||||
console.error("CI project not initialized. Run 'ci init' first.");
|
||||
if (!isCIAgentInitialized(projectPath)) {
|
||||
console.error("CIAgent project not initialized. Run 'ciagent init' first.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const phase = options.phase ? parseInt(options.phase) : undefined;
|
||||
const summary = getAuditSummary(projectPath);
|
||||
|
||||
console.log("─── CI Audit Report ───");
|
||||
console.log("─── CIAgent Audit Report ───");
|
||||
console.log(`\nTotal Decisions: ${summary.total_decisions}`);
|
||||
console.log(`Total Escalations: ${summary.total_escalations}`);
|
||||
console.log(`Phases Audited: ${summary.phases.join(", ") || "none"}`);
|
||||
@@ -517,8 +517,8 @@ export function createClarifyCommand(): Command {
|
||||
.action(async (options) => {
|
||||
const projectPath = process.cwd();
|
||||
|
||||
if (!isCIInitialized(projectPath)) {
|
||||
console.error("CI project not initialized. Run 'ci init' first.");
|
||||
if (!isCIAgentInitialized(projectPath)) {
|
||||
console.error("CIAgent project not initialized. Run 'ciagent init' first.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -526,7 +526,7 @@ export function createClarifyCommand(): Command {
|
||||
const spec = loadSpec(projectPath);
|
||||
|
||||
if (!spec) {
|
||||
console.error("No specification found. Run 'ci init' first.");
|
||||
console.error("No specification found. Run 'ciagent init' first.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -557,8 +557,8 @@ export function createRollbackCommand(): Command {
|
||||
.action(async (target, options) => {
|
||||
const projectPath = process.cwd();
|
||||
|
||||
if (!isCIInitialized(projectPath)) {
|
||||
console.error("CI project not initialized. Run 'ci init' first.");
|
||||
if (!isCIAgentInitialized(projectPath)) {
|
||||
console.error("CIAgent project not initialized. Run 'ciagent init' first.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -650,8 +650,8 @@ export function createShipCommand(): Command {
|
||||
.action(async (phase, options) => {
|
||||
const projectPath = process.cwd();
|
||||
|
||||
if (!isCIInitialized(projectPath)) {
|
||||
console.error("CI project not initialized. Run 'ci init' first.");
|
||||
if (!isCIAgentInitialized(projectPath)) {
|
||||
console.error("CIAgent project not initialized. Run 'ciagent init' first.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -707,7 +707,7 @@ export function createShipCommand(): Command {
|
||||
cwd: projectPath,
|
||||
stdio: "pipe",
|
||||
});
|
||||
execSync(`git tag -a ${version.tag} -m "CI: Phase ${phaseNum} shipped"`, {
|
||||
execSync(`git tag -a ${version.tag} -m "CIAgent: Phase ${phaseNum} shipped"`, {
|
||||
cwd: projectPath,
|
||||
stdio: "pipe",
|
||||
});
|
||||
@@ -730,7 +730,7 @@ export function createShipCommand(): Command {
|
||||
function computeShipVersion(
|
||||
projectPath: string,
|
||||
phaseNum: number,
|
||||
config: CIConfig
|
||||
config: CIAgentConfig
|
||||
): { tag: string; milestoneType: "nfr" | "feature" | "schema-breaking" } {
|
||||
const tags = execSync("git tag -l", { cwd: projectPath, encoding: "utf-8" })
|
||||
.split("\n")
|
||||
|
||||
Reference in New Issue
Block a user