/** * OpenSpec Format Generator * * Takes structured LLM outputs and formats them into clean OpenSpec-compatible * specification files. */ import type { PipelineResult } from './spec-pipeline.js'; import type { DependencyGraphResult } from '../analyzer/dependency-graph.js'; import type { MappingArtifact } from './mapping-generator.js'; /** * Generated spec file */ export interface GeneratedSpec { path: string; content: string; domain: string; type: 'overview' | 'domain' | 'architecture' | 'api' | 'adr'; } /** * Generator options */ export interface GeneratorOptions { /** Version string for headers */ version?: string; /** Output style */ style?: 'minimal' | 'detailed'; /** Include confidence indicators */ includeConfidence?: boolean; /** Include technical notes */ includeTechnicalNotes?: boolean; /** Maximum line width for wrapping */ maxLineWidth?: number; /** Dependency graph for cross-domain dependency sections */ depGraph?: DependencyGraphResult; } /** * OpenSpec Format Generator */ export declare class OpenSpecFormatGenerator { private options; constructor(options?: GeneratorOptions); /** * Generate all spec files from pipeline result. * Pass mappingArtifact to annotate each Requirement with `> Implementation: file:line`. */ generateSpecs(result: PipelineResult, mappingArtifact?: MappingArtifact): GeneratedSpec[]; /** * Group entities, services, and endpoints by domain */ private groupByDomain; /** * Infer domain from name and location */ private inferDomain; /** * Generate the overview spec */ private generateOverviewSpec; /** * Generate a domain spec */ private generateDomainSpec; /** * Generate the architecture spec */ private generateArchitectureSpec; /** * Generate the API spec */ private generateApiSpec; /** * Emit `> Implementation: \`file:line\`` after a Requirement header when a * high-confidence mapping entry exists. Mutates `lines` in-place. */ private emitImplementationHint; /** * Build `## Dependencies` section for a domain spec using depGraph edges. * Returns an empty array if no depGraph or no cross-domain edges found. */ private buildDependencySection; /** * Infer a openlore-test annotation from scenario name and THEN clause. * Returns null when no annotation is worth emitting (all defaults). */ private inferTestAnnotation; /** * Add a scenario to the lines array */ private addScenario; /** * Format a requirement name (PascalCase, no spaces) */ private formatRequirementName; /** * Format a relationship for display */ private formatRelationship; /** * Format project category for display */ private formatCategory; /** * Format architecture pattern for display */ private formatArchitecture; /** * Capitalize first letter */ private capitalize; /** * Wrap text at max line width */ private wrapText; } /** * Validation result */ export interface ValidationResult { valid: boolean; errors: string[]; warnings: string[]; } /** * Validate a generated spec against OpenSpec conventions */ export declare function validateSpec(content: string): ValidationResult; /** * Generate OpenSpec files from pipeline result */ export declare function generateOpenSpecs(result: PipelineResult, options?: GeneratorOptions): GeneratedSpec[]; //# sourceMappingURL=openspec-format-generator.d.ts.map