diff --git a/.changeset/scoped-llms-duplicate-prefix.md b/.changeset/scoped-llms-duplicate-prefix.md new file mode 100644 index 0000000..685c876 --- /dev/null +++ b/.changeset/scoped-llms-duplicate-prefix.md @@ -0,0 +1,7 @@ +--- +'incur': patch +--- + +Fixed `--llms` and `--llms-full` markdown output when scoped to a command group (e.g. `cli auth --llms`) to no longer duplicate the group prefix in command signatures (`cli auth auth login` → `cli auth login`). + +The scoped name already carries the prefix, so command collection now runs with an empty prefix to match the unscoped and JSON/YAML manifest output. diff --git a/src/Cli.test.ts b/src/Cli.test.ts index bd55fc6..6d6df34 100644 --- a/src/Cli.test.ts +++ b/src/Cli.test.ts @@ -1385,8 +1385,11 @@ describe('--llms', () => { cli.command('ping', { description: 'Health check', run: () => ({}) }) const { output } = await serve(cli, ['auth', '--llms']) - expect(output).toContain('test auth auth login') - expect(output).toContain('test auth auth logout') + expect(output).toContain('test auth login') + expect(output).toContain('test auth logout') + // The scoped prefix must not be duplicated in the command signature. + expect(output).not.toContain('test auth auth login') + expect(output).not.toContain('test auth auth logout') expect(output).not.toContain('ping') }) diff --git a/src/Cli.ts b/src/Cli.ts index d8efef9..11d932b 100644 --- a/src/Cli.ts +++ b/src/Cli.ts @@ -634,7 +634,9 @@ async function serveImpl( if (llmsFull) { if (!formatExplicit || formatFlag === 'md') { const groups = new Map() - const cmds = collectSkillCommands(scopedCommands, prefix, groups, scopedRoot) + // Command names are relative to the scope; `scopedName` already carries + // the prefix, so pass `[]` to avoid prepending it twice. + const cmds = collectSkillCommands(scopedCommands, [], groups, scopedRoot) const scopedName = prefix.length > 0 ? `${name} ${prefix.join(' ')}` : name writeln(Skill.generate(scopedName, cmds, groups)) return @@ -645,7 +647,9 @@ async function serveImpl( if (!formatExplicit || formatFlag === 'md') { const groups = new Map() - const cmds = collectSkillCommands(scopedCommands, prefix, groups, scopedRoot) + // Command names are relative to the scope; `scopedName` already carries + // the prefix, so pass `[]` to avoid prepending it twice. + const cmds = collectSkillCommands(scopedCommands, [], groups, scopedRoot) const scopedName = prefix.length > 0 ? `${name} ${prefix.join(' ')}` : name writeln(Skill.index(scopedName, cmds, scopedDescription)) return diff --git a/src/e2e.test.ts b/src/e2e.test.ts index 61bbb4d..a9432ff 100644 --- a/src/e2e.test.ts +++ b/src/e2e.test.ts @@ -1513,9 +1513,9 @@ describe('--llms', () => { | Command | Description | |---------|-------------| - | \`app auth auth login\` | Log in to the service | - | \`app auth auth logout\` | Log out of the service | - | \`app auth auth status\` | Show authentication status | + | \`app auth login\` | Log in to the service | + | \`app auth logout\` | Log out of the service | + | \`app auth status\` | Show authentication status | Run \`app auth --llms-full\` for full manifest. Run \`app auth --schema\` for argument details. " @@ -1531,9 +1531,9 @@ describe('--llms', () => { | Command | Description | |---------|-------------| - | \`app project deploy project deploy create \` | Create a deployment | - | \`app project deploy project deploy rollback \` | Rollback a deployment | - | \`app project deploy project deploy status \` | Check deployment status | + | \`app project deploy create \` | Create a deployment | + | \`app project deploy rollback \` | Rollback a deployment | + | \`app project deploy status \` | Check deployment status | Run \`app project deploy --llms-full\` for full manifest. Run \`app project deploy --schema\` for argument details. "