Skip to content

Support yarn.lock and pnpm-lock.yaml in the Node lockfile reader #8

Description

@AshwinUgale

Why

_read_lockfile only understands npm's package-lock.json (schema v1/v2/v3). Yarn and pnpm users silently fall back to the approximate range-strip path, so they get less precise version pinning than npm users.

What to do

  • Extend the resolution in parse_package_json (in sidecar/src/docchat_sidecar/lockfiles.py) so that when package-lock.json is absent it also checks for yarn.lock and pnpm-lock.yaml in the same dir and reads exact versions from them.
  • pnpm-lock.yaml is YAML (add a parser dep via uv add only if needed, or parse the small subset you need); yarn.lock is a custom format - a small line parser for the "name@range:" -> version "x.y.z" blocks is enough.
  • Set Pin.source accordingly so the UI can still flag provenance.

Acceptance criteria

  • Tests with fixture yarn.lock and pnpm-lock.yaml snippets proving exact versions win over the manifest range.
  • Full sidecar check pipeline green.

Pointers

  • _read_lockfile and parse_package_json in lockfiles.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    adapterNew format/source adapter (lockfile or doc source)enhancementNew feature or requestgood first issueGood for newcomerspythonPython sidecar

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions