/** * v2.15.0 slice 002 — AC-3: feedback-promotion service. * * `.peaks/memory/.md` memories with `metadata.type === 'feedback'` * are user-given rules. They are advisory (LLM-readable) until promoted * to at least one enforcement layer (peaks-sop gate / peaks-hooks * PreToolUse / mode-gate hardFloorCategory). This service is the * primitive behind the `peaks feedback promote` and * `peaks feedback check-unpromoted` CLI commands. * * Promotion tracking convention: a feedback memory is considered * "promoted" when one of the following is true: * * (a) The memory file contains an HTML comment near the top of the * body: ``. * Written by `peaks feedback promote` so a single read of the * memory file is enough to determine promotion state. * * (b) A sibling `.peaks/memory/.promotion.json` exists with * `{ layer: "A" | "B" | "C", ... }`. Written as a sidecar for * tooling that prefers machine-readable state over embedded * comments (e.g. `verify-pipeline` Gate H). * * The comment marker is the SOURCE OF TRUTH for human review; the * sidecar is the source of truth for the scanner. Either is enough * to mark a feedback memory as promoted. */ export type PromotionLayer = 'A' | 'B' | 'C'; export declare const PROMOTION_LAYERS: readonly PromotionLayer[]; export type PromotionLayerDetail = { layer: PromotionLayer; label: string; /** One-line description of what kind of rule belongs on this layer. */ description: string; }; export declare const PROMOTION_LAYER_DETAILS: readonly PromotionLayerDetail[]; export type FeedbackMemory = { /** File basename (without `.md`). */ name: string; /** Absolute path to the .md file. */ path: string; /** Parsed frontmatter. */ frontmatter: { name?: string; description?: string; kind?: string; }; /** Body text (after the closing `---`). */ body: string; /** Parsed promotion marker (from comment OR sidecar). null when unpromoted. */ promotion: { layer: PromotionLayer; source: 'comment' | 'sidecar'; detail: string; } | null; }; export type UnpromotedFeedbackEntry = { name: string; path: string; reason: string; }; /** * Parse a single `.peaks/memory/.md` into a FeedbackMemory, or * `null` when the file is missing / unreadable / not a feedback memory. * * The "is this a feedback memory?" check is intentionally narrow: only * frontmatter with `metadata.type === 'feedback'` OR top-level * `type: feedback` qualifies. Other memory kinds (project / rule / * decision / reference / convention / module / lesson) are skipped. */ export declare function parseFeedbackMemory(filePath: string): FeedbackMemory | null; /** * Scan `.peaks/memory/*.md` for feedback memories and return those * that are NOT promoted to any enforcement layer. Pure read; the * CLI command emits the warning list + (with `--strict`) a non-zero * exit code. */ export declare function listUnpromotedFeedback(opts: { projectRoot: string; }): UnpromotedFeedbackEntry[]; /** * Generate the code stub for a given layer. Returns a Markdown * snippet the LLM / human can paste into the appropriate file. Pure * function — does NOT touch disk. The CLI command wraps this with * the disk write / envelope emission. */ export declare function generatePromotionStub(opts: { layer: PromotionLayer; feedbackName: string; feedbackBody: string; }): { snippet: string; targetFiles: string[]; }; export type FeedbackPromoteEnvelope = { name: string; feedbackPath: string; layer: PromotionLayer; layerDetail: string; generatedFiles: string[]; snippet: string; promotedAt: string; promotedBy: string; }; /** * Write the promotion marker + sidecar. Also writes the envelope to * `.peaks/_runtime//rd/feedback-promote-.json` for QA * auditing. Returns the envelope so the CLI can emit it. * * The promotion marker is embedded in the memory file (so it * travels with the file across git history); the sidecar is a * machine-readable mirror. Both are written; either alone is * enough for the scanner. */ export declare function promoteFeedback(opts: { feedbackPath: string; layer: PromotionLayer; promotedBy: string; sessionId: string; projectRoot: string; dryRun?: boolean; }): FeedbackPromoteEnvelope; export declare function isPromotionLayer(value: string): value is PromotionLayer;