/** * Instruction file writer - the single path that turns a template into * CLAUDE.md / AGENTS.md on disk. Used by `specweave init`, `specweave update` * (via update-instructions) and the adapters that ship AGENTS.md. * * - detects the project's build/test/lint commands for the Commands table * - never writes when the merge result is byte-identical * - backs up the previous file to .specweave/backups/..bak */ import { type MergeResult, type TemplateType } from './instruction-file-merger.js'; import { type StackCommands } from './stack-detector.js'; export type InstructionFileName = 'CLAUDE.md' | 'AGENTS.md'; export interface ApplyInstructionOptions { projectPath: string; templatesDir: string; filename: InstructionFileName; projectName: string; /** Defaults to the installed specweave version. */ version?: string; /** Defaults to stack detection on projectPath. */ commands?: StackCommands; /** * Condition flags for `when="…"` template sections. The shipped templates * have none, so this defaults to no flags. */ flags?: Record; /** Compute the result without touching the disk. */ dryRun?: boolean; /** Timestamp for the backup filename (tests). */ now?: Date; } export interface ApplyInstructionResult extends Omit { action: MergeResult['action'] | 'skipped'; filePath: string; backupPath: string | null; } export declare const TEMPLATE_TYPES: Record; export declare const BACKUP_DIR: string; /** `.specweave/backups/CLAUDE.md.2026-09-02T12-00-00.000Z.bak` (Windows-safe: no colons). */ export declare function backupFilePath(projectPath: string, filename: string, now?: Date): string; export declare function applyInstructionTemplate(opts: ApplyInstructionOptions): ApplyInstructionResult; //# sourceMappingURL=instruction-file-writer.d.ts.map