Skip to content

fix: avoid duplicate group prefix in scoped --llms output#159

Open
Ryan-Ouyang wants to merge 1 commit into
wevm:mainfrom
Ryan-Ouyang:ryanouyang/fix-scoped-llms-duplicate-prefix
Open

fix: avoid duplicate group prefix in scoped --llms output#159
Ryan-Ouyang wants to merge 1 commit into
wevm:mainfrom
Ryan-Ouyang:ryanouyang/fix-scoped-llms-duplicate-prefix

Conversation

@Ryan-Ouyang
Copy link
Copy Markdown

Problem

When --llms / --llms-full (markdown) is scoped to a command group, the group prefix is applied twice — producing command signatures like:

$ cli auth --llms
| `cli auth auth login`  | ... |
| `cli auth auth logout` | ... |

instead of the correct cli auth login. This affects every group, whether built as a sub-Cli or generated from an OpenAPI spec, and shows up in both --llms and --llms-full.

Root cause

In the scoped --llms markdown branches, the prefix is double-counted: it's folded into scopedName and passed into collectSkillCommands, which bakes it into each cmd.name (path = [...prefix, name]). Skill.index/Skill.generate then render ${scopedName} ${cmd.name}.

The unscoped call sites (and the JSON/YAML manifest path, which doesn't prepend scopedName) already pass [], which is why root cli --llms and --format json were correct.

Fix

Pass [] to collectSkillCommands in the two scoped markdown branches so command names stay relative to the already-prefixed scopedName.

Tests

  • Updated Cli.test.ts scopes to subtree — it previously asserted the buggy test auth auth login output (which is why this slipped through). It now asserts test auth login plus negative assertions against the duplicated form.
  • Regenerated the two e2e.test.ts inline snapshots that had captured the doubled output.
  • Full suite green, lint + types clean.

🤖 Generated with Claude Code

When `--llms`/`--llms-full` is scoped to a command group, the prefix was
applied twice — once via `scopedName` and again via `collectSkillCommands`,
producing signatures like `cli auth auth login` instead of `cli auth login`.

Pass an empty prefix to `collectSkillCommands` in the scoped markdown paths
so command names stay relative to the already-prefixed `scopedName`, matching
the unscoped and JSON/YAML manifest behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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