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

Method applySpecRules

src/core/validation/validator.ts:290–329  ·  view source on GitHub ↗
(spec: Spec, content: string)

Source from the content-addressed store, hash-verified

288 }
289
290 private applySpecRules(spec: Spec, content: string): ValidationIssue[] {
291 const issues: ValidationIssue[] = [];
292
293 for (const structuralIssue of findMainSpecStructureIssues(content)) {
294 issues.push({
295 level: 'ERROR',
296 path: 'file',
297 line: structuralIssue.line,
298 message: structuralIssue.message,
299 });
300 }
301
302 if (spec.overview.length < MIN_PURPOSE_LENGTH) {
303 issues.push({
304 level: 'WARNING',
305 path: 'overview',
306 message: VALIDATION_MESSAGES.PURPOSE_TOO_BRIEF,
307 });
308 }
309
310 spec.requirements.forEach((req, index) => {
311 if (req.text.length > MAX_REQUIREMENT_TEXT_LENGTH) {
312 issues.push({
313 level: 'INFO',
314 path: `requirements[${index}]`,
315 message: VALIDATION_MESSAGES.REQUIREMENT_TOO_LONG,
316 });
317 }
318
319 if (req.scenarios.length === 0) {
320 issues.push({
321 level: 'WARNING',
322 path: `requirements[${index}].scenarios`,
323 message: `${VALIDATION_MESSAGES.REQUIREMENT_NO_SCENARIOS}. ${VALIDATION_MESSAGES.GUIDE_SCENARIO_FORMAT}`,
324 });
325 }
326 });
327
328 return issues;
329 }
330
331 private applyChangeRules(change: Change, content: string): ValidationIssue[] {
332 const issues: ValidationIssue[] = [];

Callers 2

validateSpecMethod · 0.95
validateSpecContentMethod · 0.95

Calls 1

Tested by

no test coverage detected