feat(package): on-demand package scan commands (FOU-221)#27
Merged
Conversation
Add the `safedep package scan` command family over the control-plane PackageScanService: run (submit + wait), get, list, and show. - Identity layer resolves a target from the explicit --ecosystem/--name /--version triple (canonical) or a PURL / GitHub URL via dry/api/pb. Ecosystem is mandatory; a resolved UNSPECIFIED is rejected client-side so it never reaches the backend, which needs it to route the scan. - run waits for a verdict by default (backoff poll + spinner), --no-wait submits only. A MALWARE verdict expands the full report inline in table mode; plain/json keep a stable headline shape. Idempotency key derives from the target so repeat runs dedupe; --rescan forces a fresh scan. - get/show address a scan by package-ref (newest for the target) or by --scan-id for agent orchestration. show renders the report with empty sections omitted so non-library components do not show hollow tables. - No new verbs: run/get/list/show are all in the allow-list. - Bumps the safedep/api generated bindings to pick up PackageScanService; updates the jfrog test fake for the widened MalwareAnalysisService client interface that came with the bump. Docs: one page per leaf under docs/cmd, linked from README. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
SafeDep Report SummaryPackage Details
This report is generated by SafeDep Github App |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f0c02f9ae
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Address code review on PR #27: - runScan now returns an error when polling reaches a terminal FAILED status, so `package scan run --wait` exits non-zero as documented instead of rendering a failed scan as success (P1). - run rejects `--save` combined with `--wait=false`: the report only exists after waiting, so the pairing previously produced neither a file nor an error (P2). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reports can carry a very large file-evidence list that makes the decorated table unreadable. The table now truncates file and project evidence to 20 rows with a footer showing the omitted count and pointing at --output json. plain and json output remain complete, so no data is lost for pipelines or programmatic consumers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sahilb315
approved these changes
Jul 23, 2026
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.




What
Adds the
safedep package scancommand family — the CLI surface for SafeDep Cloud's on-demand package scanning (safedep/api#177,PackageScanService).A package is any external software component in a supported ecosystem — OSS libraries, VS Code / OpenVSX extensions, GitHub repositories, and more — hence the deliberately generic
packagedomain noun.Design
--ecosystem/--name/--versiontriple (canonical, forward-compatible) or a PURL / GitHub URL (sugar) viadry/api/pb. Ecosystem is mandatory — the backend routes the scan by it — so a resolvedECOSYSTEM_UNSPECIFIEDis rejected client-side with guidance rather than forwarded.--ecosystemmaps through the generated enum value map, so new ecosystems need at most a dependency bump, never CLI code.runwaits by default (capped backoff poll + spinner in rich mode);--wait=falsesubmits only. AMALWAREverdict expands the full report inline intablemode;plain/jsonkeep a stable headline shape so the agent contract does not change with the verdict. The idempotency key derives from the target so repeat runs dedupe server-side;--rescanforces a fresh scan.get/showtake a package-ref by default (newest scan for the target), with--scan-idas the direct path for agent orchestration.showomits empty report sections so non-library component reports do not render hollow tables.Renderablecontract (table/plain/json) with verdict badges (malware/inconclusive/benign).Verbs
No new verbs:
run,get,list,showare all already in the allow-list.verbs.gounchanged.API bump
Bumps the
safedep/apigenerated bindings to pick upPackageScanService. The same bump widened theMalwareAnalysisServiceclient interface, so the jfrog integration test fake gains the newInternal*methods (test-only change).Docs
One page per leaf under
docs/cmd/, linked from the README command index, per DEVGUIDE.Testing
make build,make test,golangci-lint run ./..., and the convention tests (go test ./internal/cmd/ -run Conventions) all pass locally.🤖 Generated with Claude Code