Skip to content

feat(commands): add mountSubCommands for flat sub-command grafting#36

Merged
THEROER merged 1 commit into
mainfrom
feat/commands-mount-subcommands
Jul 9, 2026
Merged

feat(commands): add mountSubCommands for flat sub-command grafting#36
THEROER merged 1 commit into
mainfrom
feat/commands-mount-subcommands

Conversation

@THEROER

@THEROER THEROER commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Adds MagicCommand.mountSubCommands(cmd): grafts another command's sub-commands into this tree at the same level (/root <sub>), unlike mount(cmd) which nests under the source name (/root <cmd-name> <sub>).

Use case: let a plugin contribute top-level sub-commands to a shared root command it does not own — define them as @SubCommand methods on a carrier class, flat-mount that carrier into a copy of the root, re-register. The source command's own bare execute is intentionally not carried over — only its sub-commands.

Covered by new cases in MagicCommandCompositionTest (flat graft + copy-then-remount). Tests pass locally.

🤖 Generated with Claude Code

mountSubCommands(cmd) grafts another command's sub-commands into this command
tree at the same level (/root <sub>), unlike mount(cmd) which nests them under
the source name (/root <cmd-name> <sub>). Lets a plugin contribute top-level
sub-commands to a shared root it does not own. The source command's own bare
execute is intentionally not carried over. Covered by MagicCommandCompositionTest.
@THEROER THEROER merged commit 5f38968 into main Jul 9, 2026
1 of 2 checks passed
@THEROER THEROER deleted the feat/commands-mount-subcommands branch July 10, 2026 02:19
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