refactor(workspace): extract crates/youtrack-client (YT-17) #60

Merged
nrupard merged 2 commits from refactor/extract-youtrack-client-YT-17 into main 2026-05-27 17:50:53 +02:00
Member

Subtask 2 of the workspace refactor epic (YT-15). Depends on the merged workspace-skeleton subtask (YT-16).

What

Extract the YouTrack core into a new reusable library crate crates/youtrack-client so a future MCP server can depend on the client / API / models without dragging in clap, comfy-table, or the CLI runtime flags. No behavior change to the yt binary; command surface and output are unchanged.

How

Moved into the crate via git mv (history preserved): client.rs (transport, Client, ClientError), models.rs, api.rs (ApiError plus every high-level pub async fn, CreateIssueRequest, DailySyncOptions / DailySyncFailure), query.rs, duration.rs, sprint_resolution.rs. The data-shaped helpers from output.rs (format_millis, parse_ymd_to_ms_utc, presentation, custom_field_presentation, custom_field_value_presentation, extract_assignee_names, author_name, tail) move into the crate's output module with their unit tests. The presentation-only compact_text stays behind in crates/yt-cli/src/yt/output.rs for subtask 4 (YT-19).

crates/youtrack-client/src/lib.rs mirrors the former crate::yt module layout (pub mod api; pub mod models; pub mod client; ...; pub use client::Client;) so command imports rewrite 1:1 to youtrack_client::.... Intra-core crate::yt:: paths collapse to crate:: inside the library.

Library purity

crates/youtrack-client is publish = false and depends only on reqwest, serde, serde_json, thiserror, time, tokio, tracing, url, urlencoding (and wiremock as a dev-dependency). No clap, comfy-table, rpassword, or secrecy: token handling stays a config concern for subtask 3 (YT-18).

Acceptance criteria

  • crates/youtrack-client builds and its tests pass (run as part of the workspace cargo test --all-targets).
  • Crate exposes Client, ClientError, ApiError, all api functions, all models, query, duration, sprint_resolution, and the data-shaped helpers.
  • Crate Cargo.toml has no clap / comfy-table / rpassword dependency.
  • src/commands/ imports reference youtrack_client::...; src/yt/ no longer holds the moved modules (only compact_text remains).
  • just pre-commit green (fmt, clippy -D warnings, build, 96 tests); yt output unchanged.

🤖 Generated with Claude Code

Subtask 2 of the workspace refactor epic (YT-15). Depends on the merged workspace-skeleton subtask (YT-16). ## What Extract the YouTrack core into a new reusable library crate `crates/youtrack-client` so a future MCP server can depend on the client / API / models without dragging in clap, comfy-table, or the CLI runtime flags. No behavior change to the `yt` binary; command surface and output are unchanged. ## How Moved into the crate via `git mv` (history preserved): `client.rs` (transport, `Client`, `ClientError`), `models.rs`, `api.rs` (`ApiError` plus every high-level `pub async fn`, `CreateIssueRequest`, `DailySyncOptions` / `DailySyncFailure`), `query.rs`, `duration.rs`, `sprint_resolution.rs`. The data-shaped helpers from `output.rs` (`format_millis`, `parse_ymd_to_ms_utc`, `presentation`, `custom_field_presentation`, `custom_field_value_presentation`, `extract_assignee_names`, `author_name`, `tail`) move into the crate's `output` module with their unit tests. The presentation-only `compact_text` stays behind in `crates/yt-cli/src/yt/output.rs` for subtask 4 (YT-19). `crates/youtrack-client/src/lib.rs` mirrors the former `crate::yt` module layout (`pub mod api; pub mod models; pub mod client; ...; pub use client::Client;`) so command imports rewrite 1:1 to `youtrack_client::...`. Intra-core `crate::yt::` paths collapse to `crate::` inside the library. ## Library purity `crates/youtrack-client` is `publish = false` and depends only on reqwest, serde, serde_json, thiserror, time, tokio, tracing, url, urlencoding (and wiremock as a dev-dependency). No clap, comfy-table, rpassword, or secrecy: token handling stays a config concern for subtask 3 (YT-18). ## Acceptance criteria - [x] `crates/youtrack-client` builds and its tests pass (run as part of the workspace `cargo test --all-targets`). - [x] Crate exposes `Client`, `ClientError`, `ApiError`, all `api` functions, all `models`, `query`, `duration`, `sprint_resolution`, and the data-shaped helpers. - [x] Crate `Cargo.toml` has no `clap` / `comfy-table` / `rpassword` dependency. - [x] `src/commands/` imports reference `youtrack_client::...`; `src/yt/` no longer holds the moved modules (only `compact_text` remains). - [x] `just pre-commit` green (fmt, clippy -D warnings, build, 96 tests); `yt` output unchanged. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
refactor(workspace): extract crates/youtrack-client (YT-17)
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 26s
a03446de33
Move the YouTrack core out of the binary crate into a new reusable library crate `crates/youtrack-client`, so a future MCP server can depend on the client / API / models without pulling in clap, comfy-table, or the CLI runtime flags. No behavior change to the `yt` binary.

Moved into the crate (git-mv, history preserved): `client.rs` (transport, `Client`, `ClientError`), `models.rs`, `api.rs` (`ApiError` and all high-level helpers), `query.rs`, `duration.rs`, `sprint_resolution.rs`. The data-shaped helpers from `output.rs` (`format_millis`, `parse_ymd_to_ms_utc`, `presentation`, `custom_field_presentation`, `custom_field_value_presentation`, `extract_assignee_names`, `author_name`, `tail`) move too; only the presentation-only `compact_text` stays behind in `crates/yt-cli/src/yt/output.rs` for subtask 4 (YT-19).

`lib.rs` mirrors the former `crate::yt` module layout so command imports rewrite 1:1 to `youtrack_client::...`. Intra-core `crate::yt::` paths become `crate::` inside the library. The crate is `publish = false` and depends only on reqwest, serde, serde_json, thiserror, time, tokio, tracing, url, urlencoding (plus wiremock for tests): no clap, comfy-table, rpassword, or secrecy.

`just pre-commit` green: fmt, clippy -D warnings, build, 96 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
chore(yt-cli): drop thiserror and urlencoding deps
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 25s
Create release / Create release from merged PR (pull_request) Has been skipped
2e9c16b610
Both moved into youtrack-client with the extracted core and have zero remaining uses in crates/yt-cli/src. Removing them keeps the bin crate manifest honest.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
nrupard deleted branch refactor/extract-youtrack-client-YT-17 2026-05-27 17:50:54 +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!60
No description provided.