feat: Discover OpenCLI subcommands progressively - #62
Draft
boblail wants to merge 1 commit into
Draft
Conversation
A large CLI shouldn't have to enumerate its entire command tree in one --help-opencli response. When a subcommand's entry in its parent's document lists no children but declares the option --help-opencli, Exoskeleton now defers discovery: Subcommands() invokes the subcommand with --help-opencli (e.g. `tool sub --help-opencli`) and parses its document, recursively and on demand. Deferral surfaces two latent bugs, both fixed here: - describeOpenCLI's cache key was the executable's path alone, so a subcommand's document would collide with its root's. The key now includes the subcommand's arguments. - toCommands built sibling args with append() on a shared slice, so siblings four levels deep could overwrite each other's backing array. Args are now allocated exactly per command. Summary() also no longer triggers discovery when the summary is already known from the parent's document, so rendering a menu of a deferred subcommand's siblings stays free of exec calls. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
boblail
force-pushed
the
lail/opencli-progressive-discovery
branch
from
August 19, 2026 00:25
90fb134 to
3f18b0c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #63.
A large CLI shouldn't have to enumerate its entire command tree in one
--help-opencliresponse. When a subcommand's entry in its parent's OpenCLI document lists no children but declares the option--help-opencli,Subcommands()now discovers its subcommands on demand by invoking it (e.g.tool sub --help-opencli), recursively and respectingWithMaxDepth.Summary()prefers a summary already known from the parent's document, so menus of a deferred subcommand's siblings stay free of exec calls.Also fixes two latent bugs surfaced by deferral:
describeOpenCLI's cache key collided between a root and its subcommands (keyed by path alone), andtoCommandsbuilt sibling args on a shared backing array, corrupting args four levels deep. No behavioural changes for CLIs that don't declare--help-openclion a subcommand.🤖 Generated with Claude Code