Repository navigation
feat(cli): oa check, the dependencies of a lockfile against a repository - #476
Merged
Merged
Conversation
oa check <repo> --lockfile FILE reads the package versions a composer.lock, package-lock.json or npm-shrinkwrap.json pins and asks the repository about them through POST /availability, at most 1000 per request. It prints what is not available with the reason and exits 1 when a dependency is held or not found (or unknown, with --fail-on-unknown); --format json prints every result with a summary, --no-dev skips development-only dependencies. pkg/lockfile (standard library only) parses both formats: composer.lock packages and packages-dev without path packages; package-lock.json lockfileVersion 2/3 packages (an alias by its name field; links, bundled packages, workspace folders and git or file sources left out) and the lockfileVersion 1 dependency tree (npm: aliases, depth bounded). The output is sorted and each name and version appears once. FuzzComposerLock and FuzzPackageLock assert that invariant and that parsing is deterministic. Refs openartifact#471. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The fixtures pinned real packages at old versions (vite 5.1.4, express 4.18.2, ...). Trivy's fs scan reads lockfiles anywhere in the tree and its gate fails on their known vulnerabilities. The parsers only need the shape, so the fixtures now name acme packages on example.test hosts. Co-Authored-By: Claude Fable 5.2 <[email protected]>
# Conflicts: # docs/getting-started/upgrading.md
# Conflicts: # docs/getting-started/upgrading.md
orcamedia
added a commit
to openartifact/openartifact-agent-plugin
that referenced
this pull request
Nov 13, 2026
Version 0.2.0: the `check-lockfile` skill, using the `check_dependencies` tool that landed in openartifact/openartifact#473. ## What the skill tells the agent 1. **Find the repository** the project installs from, the `/repos/<name>` in its package manager config. A group is fine, since `check_dependencies` answers for one. 2. **Extract the pinned versions with `jq`**, not by reading the lockfile into context. The filters apply the rules of `oa check` (openartifact/openartifact#476): path packages, links, bundled packages, workspace folders, and git or file dependencies are left out. There are instructions for when `jq` is missing, and for lockfileVersion 1. 3. **Call `check_dependencies`** with at most 1000 entries per call. 4. **Report by status:** - `held`, with the reason, rule id or `until` time, and the deciding repository; - `not_found`; - `unknown`, explained as "the proxy hasn't cached this package yet", not as a block. 5. **Suggest fixes that respect the registry**, with no public-registry fallback, handing off to `check-dependency` for an available version. Servers without the tool (any release before #473) get a check of the direct dependencies through `check_availability`, and the agent says the whole lockfile couldn't be checked. ## Checked - I ran both `jq` commands exactly as written in the skill against the parser fixtures of #476. They return the same lists as the Go parser (4 and 5 dependencies). - End to end against a server built from current `main`: the extracted list from a `composer.lock` went to `check_dependencies` on a Composer group. Guzzle 6.5.8 came back held ("EOL, use 7.x"), 7.8.1 available, and two uncached packages unknown. - `scripts/check-plugin.py` passes and `reuse lint` reports compliance. CI's Agent Skills job validates the new skill. Not tested: a full agent session using the skill. The tool is on `main` but not in a server release yet. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Areef <[email protected]> Co-authored-by: Claude Fable 5.2 <[email protected]>
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.
Second PR of #471:
oa check, starting withcomposer.lockandpackage-lock.jsonas agreed. It uses the batch endpoint from #473.Command
composer.lock,package-lock.jsonornpm-shrinkwrap.json. Shell completion offers.lockand.jsonfiles. Lockfiles are capped at 64 MiB.--format jsonprints every result withsummary,kindanddevper entry.1when anything is held or not found, also unknown with--fail-on-unknown, otherwise0, likeoa gate.--no-devleaves out development-only dependencies.gate.Parsers (
pkg/lockfile, standard library only)packagesandpackages-dev. Path-repository packages are skipped, and metapackages without adistare kept.packagesmap. Only entries undernode_modules/count; the root and workspace folders are skipped. An alias is named by itsnamefield. Links,inBundle, and git or file sources are skipped.devanddevOptionalmark development dependencies.dependenciestree (depth bounded at 256).npm:aliases are resolved; bundled entries and git/github/file versions are skipped.Fuzz targets:
FuzzComposerLockandFuzzPackageLock, seeded from the test fixtures. They assert that output is non-empty, sorted and unique, that npm versions are registry versions, and that parsing is deterministic. Locally each ran 30 s (about 15M execs each) without a failure. The fixtures are covered inREUSE.toml.Tests
KindOf.oa check: runs the real binary against a fake server:--fail-on-unknown;--no-dev;--lockfile, an unknown file name, an invalid lockfile, and a 403 from the server (an error, not a verdict).pathpackage was skipped, and the development dependencyguzzle 7.8.1was available.Checks
golangci-lint run ./...passes.go test -short -racepasses forinternal/oacliandpkg/lockfile, along withgo test ./tests/(the guard on the binary's imports).make deadcodeandmake docs-check(CLI reference regenerated) pass, the-tags noai,nomcpbuild passes, andreuse lintreports compliance.Docs: a "Check dependencies before installing" section in
docs/integrations/ci.md, and an Unreleased upgrade note.More lockfile parsers (
poetry.lock/requirements.txt,go.sum,Cargo.lock, ...) will come in later PRs, one per format, each with a fuzz target.🤖 Generated with Claude Code