import type { ToolDefinition } from "./types.js"; /** * `PATCH /api/v1/repositories/:id` as a tool — shipped in the platform * (`specguard/config/routes.rb`, `Api::V1::UserRepositoriesController#update`, * SPGD-878, PR #266). * * == Why this tool exists at all * * Before it, the only way to change a repository's `org/repo` name through the * bridge was `remove_repository` plus `add_repository` — which destroys every * API key, every run and every intent on the repository, because that is what * remove does. The platform's rename endpoint keeps all of it; this tool is * the bridge's one-line path to that. * * == Authorization is OWNER-ONLY — deliberately narrower than delete * * The controller gates through `current_repository(:owner)`, NOT the * `repo.delete` capability fork `remove_repository` authorizes through — so a * member granted `repo.delete` may DESTROY the repository but may NOT rename * it. The asymmetry is the platform's, and the description carries it rather * than papering over it. * * == The grant precondition * * The owner check redeems a browser-issued grant that is valid for seven days; * a nil or stale one is a 403 whose own sentence names the fix (re-grant via * the browser). The bridge surfaces that sentence verbatim and adds no * client-side grant handling — the server is the gate. * * == The body is top-level `{github_full_name}` — NOT nested * * `update_params` permits `github_full_name` at the TOP level, not under a * `repository` key; a nested body is silently empty to the server. And a taken * name is a 400 (`render_bad_request`, the `taken` branch), not a 409 — this * description says so because it is the one answer an agent is most likely to * mispredict. * * == The 200 body is the receipt shape — WITHOUT the list's `latest_run` * * `{repository: serialize(...)}` — the same serializer `list_repositories` * serves, so the response needs no reshaping and gets none. But the entry is * a rename receipt, not a list entry: it carries the identity fields and * `delivery_health`, and `latest_run` is ABSENT — an absent key, never a * null — deliberately: naming `latest_run` in a receipt would assert "CI has * never reported" about a repository the endpoint knows was untouched by the * rename. `list_repositories` is the only surface of the two that serves a * run summary (present-and-null there when CI has never reported). */ declare const renameRepository: ToolDefinition; export default renameRepository;