// packages/plugin-awf/src/utils/install-manifest.ts
// Simple install manifest for debugging and auditing
// v4: Records install profile, MCP awareness, and tier2 skip status
import { writeFileSync, mkdirSync } from "node:fs";
import { join } from "node:path";
import { AWF_VERSION } from "../constants.js";
const AGENT_DIR = ".agent";
/**
 * Write a simple install manifest to .agent/.manifest.json
 * Used for debugging and auditing — NOT for rollback (use `init --force` instead)
 */
export function writeManifest(rootDir, config) {
    try {
        const agentDir = join(rootDir, AGENT_DIR);
        mkdirSync(agentDir, { recursive: true });
        const manifest = {
            version: AWF_VERSION,
            installedAt: new Date().toISOString(),
            ...config,
        };
        writeFileSync(join(agentDir, ".manifest.json"), JSON.stringify(manifest, null, 2), "utf-8");
    }
    catch {
        // Non-critical — don't fail install if manifest write fails
    }
}
