@hstm-labs/forge-spec-parser
v0.4.0
Published
Specification parsing and validation for Forge — reads product specifications in Markdown, YAML, or JSON format and produces a canonical `ParsedSpecification` model with completeness scoring and cross-reference validation.
Readme
@hstm-labs/forge-spec-parser
Specification parsing and validation for Forge — reads product specifications in Markdown, YAML, or JSON format and produces a canonical ParsedSpecification model with completeness scoring and cross-reference validation.
Installation
npm install @hstm-labs/forge-spec-parserPublic API
Parsing
parseSpec(content, format)— parse specification content into canonical modelloadSpecFile(path)— load and parse a specification filedetectFormat(path)— auto-detect specification formatParserRegistry— plugin registry for format parserscreateDefaultRegistry()— factory for registry with all built-in parsers
Parser Plugins
MarkdownParserPlugin— GFM Markdown with entity/requirement extractionYamlParserPlugin— structured YAML specificationsJsonParserPlugin— structured JSON specificationsmapStructuredSpec()— shared mapper for YAML/JSON formats
Validation
validateSpec(spec)— full validation (schema + completeness + cross-references)validateSchema(spec)— schema validationcheckCompleteness(spec)— 6-dimension completeness scoringvalidateCrossReferences(spec)— entity/requirement reference integrity
Types
ParsedSpecification— canonical specification modelSpecRequirement,SpecEntity,SpecWorkflow— specification componentsValidationReport,ValidationFinding— validation output
Usage
import { loadSpecFile, validateSpec } from '@hstm-labs/forge-spec-parser';
const spec = await loadSpecFile('specs/product-spec.md');
const report = validateSpec(spec);
console.log(`Completeness: ${report.completeness.overall}%`);