feat: add sp CLI — command-line client for the platform REST API (WIP)#1121
Draft
gaurav02081 wants to merge 5 commits into
Draft
feat: add sp CLI — command-line client for the platform REST API (WIP)#1121gaurav02081 wants to merge 5 commits into
gaurav02081 wants to merge 5 commits into
Conversation
Adds the sp_cli package (client, commands, runner, output, classifier, triage) plus test_cli suite and pyproject packaging.
Validated against pulk17:Feature/REST-API-Endpoints (PR CCExtractor#1117): - diff is keyed by media sample_id + regression_id + output_id as PATH segments, not query params on /samples/<id>/diff - the diff route's <sample_id> slot is the media sample id (different from the regression_test_id used by the result-detail route); pull it from detail['sample_id'] instead of reusing the CLI argument - per-output status vocab is pass|fail|missing_output, not 'match'
Aligns the CLI with the mentor's review of the REST API (PR CCExtractor#1117): - new 'sp run approve-baseline' (POST baseline-approval): requires explicit --regression/--output (destructive), maps --remove-variants to the API's remove_variants, resolves the media sample id from result detail (the endpoint's <sample_id> slot is the media sample, not the result id), and carries the cross-platform warning + admin-only note in its help - 'sp run logs' help now states it requires contributor/admin privileges Read-only behaviour is unchanged; approve-baseline is the CLI's only mutating command besides auth.
|
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.




Summary
Adds
sp_cli— an agent- and script-friendly command-line client for the platform's REST API (/api/v1). Emits JSON by default (so it can be driven by scripts and AI agents) with an--output tablemode for humans.Commands
sp health,sp queue— system statussp run ls / show / summary / failures / results / result / diff / logs / errors / approve-baselinesp sample ls / show / history,sp regression lssp auth login / logout,sp investigateHighlights
run failures,investigate): turns raw signals (exit code, output diff) into a triage verdict with a confidence level and a plain-language reason — so a person or an agent learns why a test failed without reading logs.approve-baseline(admin-only, with the cross-platform baseline warning).Status / dependency
Opening as a draft: the CLI consumes the REST API endpoints introduced in #1117, which is not yet merged. The
sp_clipackage and its tests are self-contained (tests mock the HTTP client), so this passes CI independently. I'll mark it ready for review once #1117 lands.Notes
run.pygains aDISABLE_GCS=1environment flag so the app can boot locally without GCS credentials (useful for development and for exercising the CLI).