Public parse api#23
Merged
tob-scott-a merged 2 commits intotrailofbits:mainfrom Apr 24, 2026
Merged
Conversation
be768dd to
90f2f16
Compare
Collaborator
|
I seem to have gotten GitHub into a weird state with the merge conflicts. I'm going to attempt to remediate them, and then merge this. |
Expose a public trailmark.parse module for parse-only workflows and root-package imports. The new API provides parse_file(), parse_directory(), detect_languages(), and supported_languages(), while QueryEngine.from_directory() now delegates to the parse layer instead of owning parser selection logic directly. Keep auto-detection aligned with parser behavior by reusing the shared directory-skip rules from parsers._common, narrowing JavaScript detection to the extensions the parser actually handles, and adding focused tests for parse-only usage, polyglot detection, and README coverage. Update contributor documentation to describe the parse layer in the architecture overview and to point new parser registration at src/trailmark/parse.py.
CI's ruff format --check was failing on two files in this PR: - src/trailmark/__init__.py: extra blank line after the module docstring - src/trailmark/parse.py: missing blank line before supported_languages() Whitespace only; 1038 tests still green, ruff/format/ty clean. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
e51cdbd to
4616aa4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #22:
Expose a public
trailmark.parsemodule for parse-only workflows androot-package imports. The new API provides
parse_file(),parse_directory(),detect_languages(), andsupported_languages(),while
QueryEngine.from_directory()now delegates to the parse layerinstead of owning parser selection logic directly.
Keep auto-detection aligned with parser behavior by reusing the
shared directory-skip rules from
parsers._common, narrowingJavaScript detection to the extensions the parser actually handles,
and adding focused tests for parse-only usage, polyglot detection,
and README coverage.
Update contributor documentation to describe the parse layer in the
architecture overview and to point new parser registration at
src/trailmark/parse.py.