Files
pad/cmd
xarmian 8c9974f6fb feat(cli,mcp): expose 'role update' via CLI and MCP catalog (TASK-1512) (#574)
* feat(cli,mcp): expose 'role update' via CLI and MCP catalog (TASK-1512)

Third of three TASK-1497 capability-spike follow-ups (after #572
and #573). The handlers_agent_roles.go::handleUpdateAgentRole PATCH
handler and the internal/cli/client.go::UpdateAgentRole HTTP client
method already existed. Only the agent-facing surfaces were missing.

- cmd/pad: new 'pad role update <slug-or-uuid>' Cobra subcommand
  with --name / --slug / --description / --icon / --tools /
  --sort-order flags. Uses cmd.Flags().Changed for omit-if-unset.
  Positional arg = lookup ref; --slug = new slug value (rename).
  Empty-string clears for description and icon (the store treats
  *string("") as "clear", matching collection update semantics).

- internal/mcp/catalog_role: new 'update' action + supporting params
  (new_slug, sort_order). The catalog disambiguates lookup-slug
  (in path) from rename-target (in body) with the new_slug input,
  avoiding the conflated-semantics footgun.

- internal/mcp/dispatch_http_routes: new mapRoleUpdate mapper.
  Path uses input.slug for the lookup; body's "slug" key is sourced
  from input.new_slug. String fields use key-presence semantics so
  empty-string clears round-trip to the store.

- Tests cover canonical body (with AgentRoleUpdate round-trip),
  new_slug-to-body-slug mapping, empty-string clearing, and
  required-arg validation.

- README.md + internal/mcp/instructions.md pad_role action lists
  updated to include "update".

Pairs with TASK-1510 + TASK-1511 to complete the workspace-mutation
trio the /pad onboard playbook (TASK-1499) needs to adapt seeded
roles, collections, and schemas to each project's actual shape.

Parent: PLAN-1496.

* fix(cli,mcp): rename role-update flag --slug → --new-slug (Codex round 1)

P1 finding on PR #574: pad_role.update via local stdio MCP was
silently broken. BuildCLIArgs translates MCP property "slug" to the
CLI's positional <slug> AND to the --slug flag (same key reused), so:

  pad_role.update slug=<uuid>
    → pad role update <uuid> --slug <uuid>
    → tries to rename the role's slug to the literal UUID. BAD.

  pad_role.update slug=implementer new_slug=engineer
    → pad role update implementer --slug implementer
    → new_slug ignored entirely, no rename.

The HTTP dispatcher had the disambiguation right (mapRoleUpdate
already mapped MCP new_slug → body slug). The CLI flag name was the
problem.

Renamed --slug to --new-slug. Now MCP "slug" maps to the positional
only (lookup), and MCP "new_slug" maps to --new-slug (rename target).
Both transports symmetric. Updated example in --help, the liveCmdhelpDoc
fake, and the change-detect block.

Parent: PLAN-1496, Codex round 1 on PR #574 / TASK-1512.
2026-05-17 02:33:36 -04:00
..