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

Method enrichTopLevelError

src/core/validation/validator.ts:358–370  ·  view source on GitHub ↗
(itemId: string, baseMessage: string)

Source from the content-addressed store, hash-verified

356 }
357
358 private enrichTopLevelError(itemId: string, baseMessage: string): string {
359 const msg = baseMessage.trim();
360 if (msg === VALIDATION_MESSAGES.CHANGE_NO_DELTAS) {
361 return `${msg}. ${VALIDATION_MESSAGES.GUIDE_NO_DELTAS}`;
362 }
363 if (msg.includes('Spec must have a Purpose section') || msg.includes('Spec must have a Requirements section')) {
364 return `${msg}. ${VALIDATION_MESSAGES.GUIDE_MISSING_SPEC_SECTIONS}`;
365 }
366 if (msg.includes('Change must have a Why section') || msg.includes('Change must have a What Changes section')) {
367 return `${msg}. ${VALIDATION_MESSAGES.GUIDE_MISSING_CHANGE_SECTIONS}`;
368 }
369 return msg;
370 }
371
372 private extractNameFromPath(filePath: string): string {
373 const normalizedPath = FileSystemUtils.toPosixPath(filePath);

Callers 4

validateSpecMethod · 0.95
validateSpecContentMethod · 0.95
validateChangeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected