feat(cli): add line number reporting to YAML validation errors #11372
+232
−56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Refs: Slack thread from @Ryan-Amirthan about difficulty locating YAML configuration errors
Adds line number reporting to YAML validation errors for docs.yml, product.yml, and version.yml files. Error messages now use a clean
file:line:format that is clickable in VS Code, JetBrains, and other modern terminals.Before:
After:
The
file:line:format at the start of the message enables click-to-navigate in supported terminals.Changes Made
YamlSourceMapinterface and helper functions tovalidateAgainstJsonSchema.tsfor line number lookupformatErrorMessageWithFilePathto usefile:line:prefix format (removed redundant JSON path suffix)loadDocsWorkspace.tsto create a source map when parsing YAML and pass it to validationvalidateProductConfig.tsandvalidateVersionConfig.tsto accept optional source map parameterDocsConfigFileAstNodeTypesinterface to includeabsoluteFilepathandsourceMapfor version/product filesjs-yaml-source-mapdependency to workspace-loader and docs-validator packagesTesting
Human Review Checklist
file:line:prefix format is clear and clickable in VS Code terminalDocsConfigFileAstNodeTypes(adding requiredabsoluteFilepathandsourceMapfields) don't break existing codeLink to Devin run: https://app.devin.ai/sessions/7dac2f5c0b3e4c9aab5279a854f15db8
Requested by: @Ryan-Amirthan (ryanstep@buildwithfern.com)