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

Method validateByType

src/commands/validate.ts:181–199  ·  view source on GitHub ↗
(root: ResolvedOpenSpecRoot, type: ItemType, id: string, opts: { strict: boolean; json: boolean })

Source from the content-addressed store, hash-verified

179 }
180
181 private async validateByType(root: ResolvedOpenSpecRoot, type: ItemType, id: string, opts: { strict: boolean; json: boolean }): Promise<void> {
182 const validator = new Validator(opts.strict);
183 if (type === 'change') {
184 const changeDir = path.join(root.changesDir, id);
185 const start = Date.now();
186 const report = await validator.validateChangeDeltaSpecs(changeDir);
187 const durationMs = Date.now() - start;
188 this.printReport('change', id, report, durationMs, opts.json, root);
189 // Non-zero exit if invalid (keeps enriched output test semantics)
190 process.exitCode = report.valid ? 0 : 1;
191 return;
192 }
193 const file = path.join(root.specsDir, id, 'spec.md');
194 const start = Date.now();
195 const report = await validator.validateSpec(file);
196 const durationMs = Date.now() - start;
197 this.printReport('spec', id, report, durationMs, opts.json, root);
198 process.exitCode = report.valid ? 0 : 1;
199 }
200
201 private printReport(type: ItemType, id: string, report: { valid: boolean; issues: any[] }, durationMs: number, json: boolean, root: ResolvedOpenSpecRoot): void {
202 if (json) {

Callers 2

validateDirectItemMethod · 0.95

Calls 3

printReportMethod · 0.95
validateSpecMethod · 0.95

Tested by

no test coverage detected