Skip to content

Epic: gh-style commands for Source Cooperative #21

Description

@alukach

Tracks the CLI half of source-cooperative/source.coop#588.

Goal

source-coop becomes to Source Cooperative what gh is to GitHub: every task a person can do in the web UI can be done from a terminal or a script. The CLI already handles login (OIDC with PKCE) and STS credentials. This epic adds commands on top of the /api/v1 endpoints that the source.coop epic builds. Those endpoints enforce exactly the same validation as the web UI, so the CLI validates nothing itself: it sends the request and shows the API's field_errors.

Conveniences, modeled on gh

  • source-coop api <method> <path> [-f key=value] [--input file]: the gh api equivalent. It works with any endpoint as soon as the endpoint ships, before a dedicated command exists. Build it first.
  • --json <fields> and --jq <expr> on every read, and a table when output is a TTY.
  • --web opens the matching source.coop page.
  • account/product shorthand, e.g. source-coop product view radiant/landcover.
  • Interactive prompts for missing required arguments when a TTY is attached, and none otherwise.
  • Authentication through the existing cached login, or a service account's API key (feat: exchange a service account's API key without a browser #20), sent as Authorization: Bearer.
  • --help and any generated request types come from the published OpenAPI document at source.coop/api/openapi.

Commands

Each command group depends on the source.coop sub-issue that ships its endpoints.

repo info (#16) folds into product view --json once the product endpoints land.

Docs

docs.source.coop docs/using-source/ gains a CLI path wherever a flow gets one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions