feat(board): implement board list (PR 1/5) #12

Merged
David merged 1 commit from feat/yt-client-and-board-list into main 2026-05-13 22:54:22 +02:00
Owner

Summary

First of five PRs porting the remaining stubbed subcommands to real implementations. This one lays the foundation and ships board list end-to-end.

  • New src/yt/ module with a Client wrapper around reqwest (Bearer auth, Accept: application/json, 10s timeout, non-2xx mapped to ClientError::Status with the response body).
  • AgileBoard model in src/yt/models.rs.
  • board list calls GET /api/agiles?fields=id,name, renders a comfy-table (BOARD NAME | ID), and supports --json for pretty-printed array output.
  • Missing url/token guard: refuses to run and points the user at auth login.
  • Wiremock-backed tests cover request shape, JSON output, HTTP error propagation, missing-credentials guard, plus client unit tests for 2xx decode, array decode, error mapping, and base-URL normalization.

The client and model surface stay deliberately minimal: helpers, POST support, and additional models are added in follow-up PRs only as each command needs them.

Sequence

This is PR 1 of 5:

  1. (this PR) Foundation + board list.
  2. Listings: sprint list, sprint current, list (with query builder).
  3. Single-issue read: issue inspect, issue sprint show.
  4. Mutations: issue comment, issue set-state, issue set-estimation, issue sprint set (reintroduces POST helpers + extended models).
  5. Work + composite: work add, work check, issue daily-sync.

Each PR ships its own unit tests; no PR depends on later work.

Verification

  • cargo fmt --check clean.
  • cargo clippy --all-targets -- -D warnings clean.
  • cargo test --all-targets: 22 tests pass (8 new, all existing still pass).
  • youtrack-cli board list --help shows the new --json flag with help text.

Test plan

  • After merge, run youtrack-cli board list against a real YouTrack instance: confirms the table renders board name + ID.
  • youtrack-cli board list --json produces a parseable JSON array (jq it).
  • On a host without ~/.config/youtrack-cli/config.yaml, youtrack-cli board list exits with a clear "run auth login" hint.
## Summary First of five PRs porting the remaining stubbed subcommands to real implementations. This one lays the foundation and ships `board list` end-to-end. - New `src/yt/` module with a `Client` wrapper around reqwest (Bearer auth, `Accept: application/json`, 10s timeout, non-2xx mapped to `ClientError::Status` with the response body). - `AgileBoard` model in `src/yt/models.rs`. - `board list` calls `GET /api/agiles?fields=id,name`, renders a `comfy-table` (BOARD NAME | ID), and supports `--json` for pretty-printed array output. - Missing url/token guard: refuses to run and points the user at `auth login`. - Wiremock-backed tests cover request shape, JSON output, HTTP error propagation, missing-credentials guard, plus client unit tests for 2xx decode, array decode, error mapping, and base-URL normalization. The client and model surface stay deliberately minimal: helpers, POST support, and additional models are added in follow-up PRs only as each command needs them. ## Sequence This is PR 1 of 5: 1. **(this PR)** Foundation + `board list`. 2. Listings: `sprint list`, `sprint current`, `list` (with query builder). 3. Single-issue read: `issue inspect`, `issue sprint show`. 4. Mutations: `issue comment`, `issue set-state`, `issue set-estimation`, `issue sprint set` (reintroduces POST helpers + extended models). 5. Work + composite: `work add`, `work check`, `issue daily-sync`. Each PR ships its own unit tests; no PR depends on later work. ## Verification - `cargo fmt --check` clean. - `cargo clippy --all-targets -- -D warnings` clean. - `cargo test --all-targets`: 22 tests pass (8 new, all existing still pass). - `youtrack-cli board list --help` shows the new `--json` flag with help text. ## Test plan - [ ] After merge, run `youtrack-cli board list` against a real YouTrack instance: confirms the table renders board name + ID. - [ ] `youtrack-cli board list --json` produces a parseable JSON array (`jq` it). - [ ] On a host without `~/.config/youtrack-cli/config.yaml`, `youtrack-cli board list` exits with a clear "run `auth login`" hint.
feat(board): implement board list against a real YT API client
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 23s
Create release / Create release from merged PR (pull_request) Has been skipped
0503e42127
Adds the foundational HTTP client wrapper in src/yt/ (`Client::new`, `get_json`) and the first port of a YouTrack subcommand: `board list`. The client speaks JSON with `Authorization: Bearer <token>` and `Accept: application/json`, surfaces non-2xx responses with status + body so users can see what YouTrack actually said, and uses a 10s timeout matching the Go CLI. `board list` calls `GET /api/agiles?fields=id,name`, then either renders a comfy-table (BOARD NAME | ID) or emits `--json` as a pretty-printed array. When the loaded config is missing url or token, the command refuses to run and points at `auth login`. Tests use wiremock to cover the request shape (path + fields= + Authorization header), JSON output, HTTP error propagation, and the missing-credentials guard, plus client-level unit tests for 2xx decode, array decode, error mapping, and trailing-slash base URL handling. This is the first of five PRs porting the remaining stubbed commands; the model and client surface stay minimal here and grow in follow-up PRs as each command needs them.
David merged commit db79ff6358 into main 2026-05-13 22:54:22 +02:00
David deleted branch feat/yt-client-and-board-list 2026-05-13 22:54:22 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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
pandoras-box/youtrack-cli!12
No description provided.