import { mkdir, writeFile } from "node:fs/promises";
import { dirname, join } from "node:path";
export async function writeThreadSuiteContinuitySummary(cwd, inventory, options, synthesis) {
    const path = ".threadwell/continuity/operating-memory.json";
    const absolutePath = join(cwd, path);
    await mkdir(dirname(absolutePath), { recursive: true });
    await writeFile(absolutePath, `${JSON.stringify(createThreadSuiteContinuitySummary(inventory, options, synthesis), null, 2)}\n`, "utf-8");
    return { path, action: "written" };
}
export function createThreadSuiteContinuitySummary(inventory, options, synthesis) {
    return {
        schemaVersion: 1,
        generatedAt: new Date().toISOString(),
        profile: options.profile,
        current_intent: synthesis?.projectPurpose ?? "Bootstrap durable Threadwell project intelligence for this repository.",
        active_lane: "threadsuite",
        next_best_action: options.profile === "complete"
            ? "Review generated context, ADR candidates, and memory capsules before treating inferred facts as authoritative."
            : "Review generated lightweight context before deeper bootstrap work.",
        known_blockers: [],
        recent_validation: ["ThreadSuite inventory completed; command validation not run yet."],
        do_not_repeat: [
            "Do not rediscover generated/vendor/runtime directories skipped by ThreadSuite inventory.",
            "Do not overwrite user-authored continuity or context files without explicit reset.",
        ],
        user_preferences: [
            "Use complete ThreadSuite bootstrap by default.",
            "Use lite profile only when explicitly requested.",
            "Prefer continuity/context/ADR/memory/project-index sources before broad repository exploration.",
        ],
        repo_health: synthesis
            ? `Synthesized architecture: ${synthesis.architecture.style}; validation pending.`
            : `Inventory confidence: ${inventory.confidence}; detected project type: ${inventory.projectType}; validation pending.`,
        primary_sources: [
            "STATE.md",
            "ACTIVE_QUEUE.md",
            "AUTONOMOUS_EXECUTION.md",
            "CONTEXT.md",
            "docs/adr/",
            ".threadwell/project-index.json",
            ".threadwell/continuity/operating-memory.json",
        ],
    };
}
//# sourceMappingURL=continuity-summary.js.map