fix(issue): resolve link verb via /api/issueLinkTypes (YT-12) #56
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-link-default-type-YT-12"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes YT-12.
yt issue link <SOURCE> <TARGET>(default--type relates) was emittingrelates <TARGET>as the YouTrack command body, which the server rejected withUnknown command: relates <id>because the command-language verb for theRelateslink type isrelates to, notrelates. Same misalignment exists for every standard link type whose displaynamediffers from itssourceToTargetverb (Depend->depends on,Subtask->is subtask of, etc.).run_link_innernow fetches/api/issueLinkTypesand resolves the user-supplied--typevalue to the correct verb before building the/api/commandsbody. The short form (relates,depends) maps tosourceToTarget; the already-qualified long form (relates to,is required for) passes through, with casing normalized to whatever the server returned so the command parser does not choke onRELATES TO. Unknown link-type names now surface a clear error listing the available verbs instead of bubbling up an HTTP 400 from the server.--dry-runpreviews the corrected command body so users can see what would be sent without mutating anything.Test plan
cargo fmt --check,cargo clippy,cargo build,cargo test(viajust pre-commit) all green; 299 unit tests pass including 9 newresolve_link_verbcases covering: short-name -> source-to-target mapping, case-insensitive name match, already-qualified verb pass-through, target-to-source pass-through,depends onround-trip, uppercase normalization, unknown-type error message lists available verbs, empty input rejection, and fallback to lowercased name whensourceToTargetis missing.niceguyit.myjetbrains.com:yt issue link YT-11 MK-16(default--type relates) andyt issue link --type "depends on" YT-11 MK-16both succeed.yt --dry-run issue link YT-11 MK-16prints the corrected command bodyrelates to MK-16without hitting/api/commands.#YT-12