diff --git a/src/completion.test.ts b/src/completion.test.ts new file mode 100644 index 00000000..415dc4c5 --- /dev/null +++ b/src/completion.test.ts @@ -0,0 +1,30 @@ +import { describe, expect, it, vi } from 'vitest'; + +const { mockGetRegistry } = vi.hoisted(() => ({ + mockGetRegistry: vi.fn(() => new Map([ + ['github/issues', { site: 'github', name: 'issues' }], + ])), +})); + +vi.mock('./registry.js', () => ({ + getRegistry: mockGetRegistry, +})); + +import { getCompletions } from './completion.js'; + +describe('getCompletions', () => { + it('includes top-level built-ins that are registered outside the site registry', () => { + const completions = getCompletions([], 1); + + expect(completions).toContain('plugin'); + expect(completions).toContain('install'); + expect(completions).toContain('register'); + expect(completions).not.toContain('setup'); + }); + + it('still includes discovered site names', () => { + const completions = getCompletions([], 1); + + expect(completions).toContain('github'); + }); +}); diff --git a/src/completion.ts b/src/completion.ts index 00c031ae..9b58e29c 100644 --- a/src/completion.ts +++ b/src/completion.ts @@ -24,7 +24,9 @@ const BUILTIN_COMMANDS = [ 'generate', 'cascade', 'doctor', - 'setup', + 'plugin', + 'install', + 'register', 'completion', ];