ref:main

Add `anvil issue link` / `links` / `unlink` commands #4

closed Opened by cole.christensen@gmail.com

Links

Related
  • 🔒 private issue

Problem

There is no way to manage issue cross-references from the CLI today. The server tracks real typed links (:blocks, :parent_of, :duplicate_of, :relates_to, with cross-repo support and auth/cycle/redaction rules), but the only ways to touch them are the web picker or relation phrases buried in issue bodies.

Proposal

Add three new subcommands under anvil issue:

anvil issue links <NUMBER> [--repo <ORG/REPO>]
anvil issue link <NUMBER> --kind <KIND> --target <REF> [--repo <ORG/REPO>]
anvil issue unlink <NUMBER> <LINK_ID> [--repo <ORG/REPO>]
  • <KIND>blocks | parent-of | duplicate-of | relates-to (hyphenated for CLI ergonomics).
  • <REF> accepts #N (same-repo as source) or org/repo#N (cross-repo), matching what Anvil.Markdown.RefParser already recognizes.
  • anvil issue links renders each group (blocks / blocked_by / parent / children / duplicate_of / duplicates / related) with short link id, target, state.
  • Redacted entries render as (private) — link <ID>.
  • Standard --repo override and table/json output.

Depends on

fangorn/anvil#61 — REST API for issue links. Blocked on that shipping and being deployed to anvil.fangorn.io.

Acceptance criteria

  • anvil issue links <N> lists grouped links for a same-repo issue.
  • anvil issue link <N> --kind blocks --target '#5' creates a same-repo link.
  • anvil issue link <N> --kind relates-to --target 'org/repo#7' creates a cross-repo link.
  • anvil issue unlink <N> <LINK_ID> removes a link.
  • anvil issue link --help enumerates valid kinds.
  • Cycle / self-link / forbidden errors are surfaced with useful messages.
  • Dogfooded: this issue’s own PR opens a cross-ref to fangorn/anvil#61 via the new CLI.