feat(tpagectl): implement deployment list subcommand #564

Merged
fuzzy merged 2 commits from feat/cli-deployment-list into main 2026-08-06 03:46:56 +00:00
Owner

What

Implements the deployment list subcommand. CLI-only — the daemon already serves GET /api/v1/sites/{name}/deployments.

  • Site arg (#217): positional SITE or --site flag (one required).
  • GET (#196): /api/v1/sites/{name}/deployments via the client, decoded into a deploymentRecord mirroring the daemon Deployment payload (with yaml tags for snake_case structured output — carries forward the #552 fix).
  • Table (#197): Version, Commit, Deployed At, Status via text/tabwriter.
  • --limit (#198): caps the number of rows when set.
  • --format (#199): table (default), json, yaml.
  • 404 surfaces as a friendly site "X" not found; missing site name errors.

Why

Phase 3 roadmap task #200.

Testing

  • httptest: table columns/rows, --site flag + positional forms, --limit truncation, JSON round-trip, YAML output (snake_case keys), 404, missing arg
  • go test -race ./... passes (18 packages)
  • golangci-lint run clean
  • pre-commit hooks pass (gofmt, go mod tidy, go test)

Breaking Changes

None.

Notes

#199 (--format) was previously implemented for site list; this extends the same pattern to deployment list. The remaining deployment subcommands (get, promote, rollback) are still stubs tracked by their own issues.

Closes #196
Closes #197
Closes #198
Closes #199
Closes #200
Closes #217

## What Implements the `deployment list` subcommand. CLI-only — the daemon already serves `GET /api/v1/sites/{name}/deployments`. - **Site arg** (#217): positional `SITE` or `--site` flag (one required). - **GET** (#196): `/api/v1/sites/{name}/deployments` via the client, decoded into a `deploymentRecord` mirroring the daemon `Deployment` payload (with yaml tags for snake_case structured output — carries forward the #552 fix). - **Table** (#197): Version, Commit, Deployed At, Status via `text/tabwriter`. - **`--limit`** (#198): caps the number of rows when set. - **`--format`** (#199): `table` (default), `json`, `yaml`. - 404 surfaces as a friendly `site "X" not found`; missing site name errors. ## Why Phase 3 roadmap task #200. ## Testing - [x] httptest: table columns/rows, `--site` flag + positional forms, `--limit` truncation, JSON round-trip, YAML output (snake_case keys), 404, missing arg - [x] `go test -race ./...` passes (18 packages) - [x] `golangci-lint run` clean - [x] pre-commit hooks pass (gofmt, go mod tidy, go test) ## Breaking Changes None. ## Notes `#199` (`--format`) was previously implemented for `site list`; this extends the same pattern to `deployment list`. The remaining deployment subcommands (`get`, `promote`, `rollback`) are still stubs tracked by their own issues. Closes #196 Closes #197 Closes #198 Closes #199 Closes #200 Closes #217
Add deployment list: a positional site name or --site flag, GET
/api/v1/sites/{name}/deployments, a table of version, commit, deployed at,
and status, plus --limit to cap results and --format (table, json, yaml).
The deployment record carries yaml tags so structured output uses
snake_case keys matching the API payload. 404 surfaces as a friendly
not-found error.
docs(roadmap): mark deployment list subcommand complete
All checks were successful
Test and Release / lint (pull_request) Successful in 7m18s
Test and Release / test (pull_request) Successful in 7m28s
a3fd501bda
Record completion of the tpagectl deployment list subcommand: positional
site name or --site, GET /api/v1/sites/{name}/deployments, table output,
--limit, and --format.

closes #196
closes #197
closes #198
closes #199
closes #200
closes #217
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-08-06 03:39:00 +00:00
the.auditor left a comment

Summary

deployment list subcommand for tpagectl (CLI-only; daemon endpoint already exists). Verified: go test -race ./... passes (18 packages) and golangci-lint run ./... is clean. Closes #196-200 + #217.

Verified payload parity: deploymentRecord matches the daemon Deployment payload (site_name/version/commit_sha/status/deployed_at) with both JSON and yaml tags, carrying forward the #552 fix.

No blocking issues.

Suggestions (filed as issues)

  1. internal/tpagectl/deployment/list.goprintTable/writeJSON/writeYAML + format dispatch duplicated between the site and deployment packages; the 404→friendly mapping is now a fourth inline copy (extends #561). Filed as #565
  2. internal/tpagectl/deployment/list_test.go – invalid --format branch untested (unlike site list's TestListInvalidFormat), and --limit exceeding the result count uncovered. Filed as #566

Praise

  • resolveSite cleanly handles positional + --site forms
  • --limit truncation is correct given the daemon returns deployments newest-first
  • Table/JSON/YAML all covered, including snake_case YAML keys
  • Friendly 404 message and missing-arg error, consistent with the site commands
## Summary `deployment list` subcommand for tpagectl (CLI-only; daemon endpoint already exists). Verified: `go test -race ./...` passes (18 packages) and `golangci-lint run ./...` is clean. Closes #196-200 + #217. Verified payload parity: `deploymentRecord` matches the daemon `Deployment` payload (site_name/version/commit_sha/status/deployed_at) with both JSON and yaml tags, carrying forward the #552 fix. No blocking issues. ## Suggestions (filed as issues) 1. `internal/tpagectl/deployment/list.go` – `printTable`/`writeJSON`/`writeYAML` + format dispatch duplicated between the `site` and `deployment` packages; the 404→friendly mapping is now a fourth inline copy (extends #561). Filed as #565 2. `internal/tpagectl/deployment/list_test.go` – invalid `--format` branch untested (unlike `site list`'s `TestListInvalidFormat`), and `--limit` exceeding the result count uncovered. Filed as #566 ## Praise - `resolveSite` cleanly handles positional + `--site` forms - `--limit` truncation is correct given the daemon returns deployments newest-first - Table/JSON/YAML all covered, including snake_case YAML keys - Friendly 404 message and missing-arg error, consistent with the site commands
fuzzy merged commit a3fd501bda into main 2026-08-06 03:46:56 +00:00
fuzzy deleted branch feat/cli-deployment-list 2026-08-06 03:46:56 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/thwap-pagesd!564
No description provided.