Skip to content

feat(cli): mount generated api operations in subgroups, api <group> <command> - #3141

Merged
leemour merged 1 commit into
mainfrom
feat/api-subgroups
Nov 19, 2026
Merged

leemour merged 1 commit into
mainfrom
feat/api-subgroups

Conversation

@leemour

@leemour leemour commented Nov 19, 2026

Copy link
Copy Markdown
Member

Task

Owner decision NEED-2754 B: a generated CLI's api group stops being one flat list. This PR is the cli-core half. The cli-base half (the manifest's group, names.groups) is WireCatLabs/cli-base#661, merged.

Why

A flat api of 100–500 operations is hard to read and to search. Grouping by resource follows the service's own reference, and one key (api.contacts) can then cover a resource.

What

  • generatedApiCommand mounts an operation whose manifest has a group as api <group> <command>, without the repeated word (contacts-list → api contacts list). It reads group as an optional field, so cli-core keeps working with the published cli-base 0.118 pin. A manifest without groups mounts flat, exactly as before.
  • It refuses a group and an operation that share a name (configuration_error).
  • serviceApiCommand: the key is the path (api.contacts.list). alsoChecks, the delete defaults, --all and the schema loading follow the path through a new configure hook, not a flat name lookup.
  • Old key alias, only tightens: a profile that still names api.contacts-list keeps its hold on that one command. The key is known, so the unknown-key check does not refuse the config. It is checked beside the new key through the keyed guard: deny refuses, ask asks, readonly stops a write. Its allow lifts nothing. Each call warns to rename it. --dry-run shows it as a conditional key.
  • The old path api contacts-list stops working (WC-CMD-8).
  • api list prints the path and a group column. api show takes the quoted path, the old name or the id. It is still one argument, so its MCP input schema does not change.
  • Changelog: changes/feat-api-subgroups.md (Added).

The rule is WC-CMD-33 in cli-base. Design: cli-private plans/2026-11-19-api-subgroups.md (branch plans/hubspot-cli).

Testing

  • New src/cli/service-api-groups.test.ts: mounting, keys by path, the alias (deny, allow under a group deny, readonly on a read and on a write), list and show, --dry-run keys, and the clash refusal.
  • vitest run of src/cli/service-api*, src/cli/bot, src/mcp, profile-site, kit/own-catalogue: 547 pass.
  • typecheck, docs:check, and biome on the changed files.

🤖 Generated with Claude Code

…command>

An operation whose manifest names a group (cli-base names.groups) is
mounted as api <group> <command>, the command without the repeated group
word, and checked against its path: api.contacts.list, with api.contacts
covering the group. alsoChecks, the delete defaults, api list (path and
group) and api show (quoted path, old name or id) follow the path.

A profile that still names the old flat key api.contacts-list keeps its
hold on that one command: the key is known, checked beside the new one
through the keyed guard (deny refuses, ask asks, readonly stops a write),
lifts nothing with allow, and warns to rename it. The old path stops
working (WC-CMD-8). A manifest without groups mounts flat as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leemour
leemour merged commit 3131ac7 into main Nov 19, 2026
70 of 72 checks passed
@leemour
leemour deleted the feat/api-subgroups branch November 19, 2026 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant