MCPcopy
hub / github.com/Fission-AI/OpenSpec / parseSpec

Method parseSpec

src/core/parsers/markdown-parser.ts:74–99  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

72 }
73
74 parseSpec(name: string): Spec {
75 const sections = this.parseSections();
76 const purpose = this.findSection(sections, 'Purpose')?.content || '';
77
78 const requirementsSection = this.findSection(sections, 'Requirements');
79
80 if (!purpose) {
81 throw new Error('Spec must have a Purpose section');
82 }
83
84 if (!requirementsSection) {
85 throw new Error('Spec must have a Requirements section');
86 }
87
88 const requirements = this.parseRequirements(requirementsSection);
89
90 return {
91 name,
92 overview: purpose.trim(),
93 requirements,
94 metadata: {
95 version: '1.0.0',
96 format: 'openspec',
97 },
98 };
99 }
100
101 parseChange(name: string): Change {
102 const sections = this.parseSections();

Callers 8

parseSpecFromFileFunction · 0.95
getSpecsDataMethod · 0.95
executeMethod · 0.95
validateSpecMethod · 0.95
validateSpecContentMethod · 0.95
convertSpecToJsonMethod · 0.95

Calls 3

parseSectionsMethod · 0.95
findSectionMethod · 0.95
parseRequirementsMethod · 0.95

Tested by

no test coverage detected