Skip to content

Public parse api#23

Merged
tob-scott-a merged 2 commits intotrailofbits:mainfrom
hughpyle:public-parse-api
Apr 24, 2026
Merged

Public parse api#23
tob-scott-a merged 2 commits intotrailofbits:mainfrom
hughpyle:public-parse-api

Conversation

@hughpyle
Copy link
Copy Markdown
Contributor

@hughpyle hughpyle commented Apr 23, 2026

Fixes #22:

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.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 23, 2026

CLA assistant check
All committers have signed the CLA.

@tob-scott-a
Copy link
Copy Markdown
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.

hughpyle and others added 2 commits April 23, 2026 21:04
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>
@tob-scott-a tob-scott-a merged commit f13faed into trailofbits:main Apr 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Want a clean CodeGraph "public API"

3 participants