-
Notifications
You must be signed in to change notification settings - Fork 0
Add a Cargo.toml lockfile parser (Rust) #5
Copy link
Copy link
Open
Labels
adapterNew format/source adapter (lockfile or doc source)New format/source adapter (lockfile or doc source)enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomerspythonPython sidecarPython sidecar
Description
Activity
Metadata
Metadata
Assignees
Labels
adapterNew format/source adapter (lockfile or doc source)New format/source adapter (lockfile or doc source)enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomerspythonPython sidecarPython sidecar
Why
DocChat routes retrieval off the concrete versions a project pins. Today it reads Node (
package.json/package-lock.json) and Python (pyproject.toml,requirements.txt) manifests. The README roadmap calls out Rust/Go/Ruby lockfiles as the next formats. This adds Rust.What to do
parse_cargo_toml(path)insidecar/src/docchat_sidecar/lockfiles.py, following the exact shape ofparse_pyproject_toml(returnslist[Pin], empty list on missing/malformed,ValueErrorif the filename is wrong).[dependencies]and[dev-dependencies]fromCargo.toml. Handle both the string formserde = "1.0.188"and the table formserde = { version = "1.0.188", features = [...] }. Prefer the exact version from a siblingCargo.lockwhen present (same "lock wins over range" rule the module docstring describes for npm).__all__and reuse_strip_rangefor range strings.Acceptance criteria
sidecar/tests/test_lockfiles.pymirroring the existing pyproject cases: string dep, table dep,Cargo.lockexact-version win, missing file ->[], wrong filename ->ValueError.uv run ruff check . && uv run ruff format --check . && uv run mypy src && uv run pytestall green.Pointers
lockfiles.py:Pindataclass,parse_pyproject_toml,_strip_range,__all__.tomllibis already imported.New contributor? See CONTRIBUTING.md. Happy to help scope in the comments.