coreapi commands: centralize the per-command preamble

main

Commit

Soph3mo ago

The org/project/repo/grant RunE bodies each repeated the same invariant: silence usage on error, build the control-plane client, map the API error to a problem-detail SilentError, render JSON. Extract that into two helpers in corecmd.go:

  • runCoreJSON(cmd, fn) — for reads/creates that render their result
  • runCore(cmd, fn) — for delete/revoke/remove that print a message

Each command now supplies only its API call and the value to render, dropping ~4 lines of identical plumbing across 14 call sites and giving the client-construction + error-mapping contract a single home.

renderCoreError stays the central mapper; the command closures return coreapi errors verbatim so it can extract the RFC 7807 detail via errors.As. Declared that intent to the linter once via wrapcheck.ignore-package-globs for internal/coreapi rather than wrapping at each site only to immediately unwrap.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com Entire-Checkpoint: 98cefce8818f

Checkpoints

Integrate EntireDB Commands into CLI

Claude CodeOpus 4.7[1m]
View session
Checkpoint 1