feat: add sp CLI — command-line client for the platform REST API#1121
Open
gaurav02081 wants to merge 3 commits into
Open
feat: add sp CLI — command-line client for the platform REST API#1121gaurav02081 wants to merge 3 commits into
gaurav02081 wants to merge 3 commits into
Conversation
sp is an AI- and human-friendly CLI over the platform's /api/v1 REST API. It lets an agent or developer investigate CI runs end-to-end from the terminal (no web frontend): list/show runs, summaries, classified failures, expected-vs-actual diffs, logs, errors, artifacts, samples, regression tests, auth, and a one-shot `investigate` triage command. Output defaults to JSON for agents, with a `-o table` human view. The API address is configurable via --base-url / SP_BASE_URL, so it points at any deployment without code changes. Dependencies are pinned via uv.lock.
Add a DISABLE_GCS escape hatch in run.py so the server can boot for local development and CLI testing without Google Cloud Storage credentials, and guard serve_file_download to fail clearly (503) when the storage bucket is unavailable instead of dereferencing None.
Cover the HTTP client (URL building, error/exit-code mapping, pagination), the failure classifier, the triage helpers, and the command surface via click's CliRunner against a mocked client.
|
Author
|
@canihavesomecoffee Hii , |
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).