Skip to content

fix(generate): include runnable parent commands in discovery files#80

Merged
leodido merged 1 commit into
mainfrom
leox/phase4-runnable-discovery
Apr 6, 2026
Merged

fix(generate): include runnable parent commands in discovery files#80
leodido merged 1 commit into
mainfrom
leox/phase4-runnable-discovery

Conversation

@leodido
Copy link
Copy Markdown
Owner

@leodido leodido commented Apr 6, 2026

Summary

Fix discovery generation so directly invokable parent commands are documented alongside leaf commands.

What Changed

  • switched generator discovery from a leaf-only heuristic to Cobra's runnable-command check
  • included runnable parent commands in llms.txt sections and SKILL trigger generation
  • kept the SKILL frontmatter action-oriented by skipping the root command summary as a trigger phrase
  • added regression tests for commands that are runnable while also owning subcommands
  • regenerated the dogfooded examples/full discovery files

Why

The previous implementation treated only leaf commands with RunE as callable. That caused Phase 4 discovery output to omit valid Cobra commands like full srv, which is directly invokable even though it also has a version subcommand. As a result, generated discovery files could under-report the CLI surface presented to agents.

Impact

Agents consuming generated discovery files now see runnable parent commands, not just leaves. This makes llms.txt and SKILL output better aligned with real Cobra execution semantics and with the actual example CLI behavior.

Validation

  • go test ./...
  • go test ./generate -run 'TestLLMsTxt_RunnableParentIncluded|TestSkill_DescriptionIncludesRunnableParent|TestSkill_DescriptionSkipsRootCommandTrigger' -v
  • GOCACHE=/tmp/structcli-go-generate go generate ./examples/full
@leodido leodido self-assigned this Apr 6, 2026
@leodido leodido marked this pull request as ready for review April 6, 2026 14:47
@leodido leodido merged commit c476d47 into main Apr 6, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant