diff --git a/packages/cli/src/ui/hooks/useShellCompletion.test.ts b/packages/cli/src/ui/hooks/useShellCompletion.test.ts index 93f7187c0e..dbfa955091 100644 --- a/packages/cli/src/ui/hooks/useShellCompletion.test.ts +++ b/packages/cli/src/ui/hooks/useShellCompletion.test.ts @@ -357,6 +357,10 @@ describe('useShellCompletion utilities', () => { // Very basic sanity check: common commands should be found if (process.platform !== 'win32') { expect(results).toContain('ls'); + } else { + expect(results).toContain('dir'); + expect(results).toContain('cls'); + expect(results).toContain('copy'); } }); diff --git a/packages/cli/src/ui/hooks/useShellCompletion.ts b/packages/cli/src/ui/hooks/useShellCompletion.ts index 41ae17105b..19442af280 100644 --- a/packages/cli/src/ui/hooks/useShellCompletion.ts +++ b/packages/cli/src/ui/hooks/useShellCompletion.ts @@ -182,6 +182,60 @@ export async function scanPathExecutables( const seen = new Set(); const executables: string[] = []; + // Add Windows shell built-ins + if (isWindows) { + const builtins = [ + 'assoc', + 'break', + 'call', + 'cd', + 'chcp', + 'chdir', + 'cls', + 'color', + 'copy', + 'date', + 'del', + 'dir', + 'echo', + 'endlocal', + 'erase', + 'exit', + 'for', + 'ftype', + 'goto', + 'if', + 'md', + 'mkdir', + 'mklink', + 'move', + 'path', + 'pause', + 'popd', + 'prompt', + 'pushd', + 'rd', + 'rem', + 'ren', + 'rename', + 'rmdir', + 'set', + 'setlocal', + 'shift', + 'start', + 'time', + 'title', + 'type', + 'ver', + 'verify', + 'vol', + ]; + for (const builtin of builtins) { + seen.add(builtin); + executables.push(builtin); + } + } + const dirResults = await Promise.all( dirs.map(async (dir) => { if (signal?.aborted) return [];