@@ -7,16 +7,9 @@ import { RootCommand } from '../src/t.js';
77
88const noop = ( ) => { } ;
99
10- const isTabDebug = Boolean ( process . env . TAB_DEBUG ) ;
1110const isPowerShellEnv =
1211 process . platform === 'win32' && Boolean ( process . env . PSModulePath ) ;
1312
14- function tabDebugLog ( ...args : unknown [ ] ) {
15- if ( isTabDebug ) {
16- console . error ( '[TAB_DEBUG]' , ...args ) ;
17- }
18- }
19-
2013function debugLog ( ...args : unknown [ ] ) {
2114 if ( process . env . DEBUG ) {
2215 console . error ( '[DEBUG]' , ...args ) ;
@@ -38,7 +31,6 @@ function runCompletionCommand(
3831 completionArgs . length === 0 ? [ '' ] : completionArgs ;
3932
4033 const args = [ ...leadingArgs , 'complete' , '--' , ...safeCompletionArgs ] ;
41- tabDebugLog ( 'spawn completion:' , command , args ) ;
4234
4335 // PowerShell: prefer invoking via powershell.exe so .ps1 shims are resolved.
4436 if ( isPowerShellEnv && path . extname ( command ) === '' ) {
@@ -47,12 +39,6 @@ function runCompletionCommand(
4739
4840 const result = spawnSync ( command , args , completionSpawnOptions ) ;
4941
50- tabDebugLog ( 'spawn result:' , {
51- status : result . status ,
52- error : result . error ?. message ,
53- stdout : result . stdout ,
54- } ) ;
55-
5642 // If the direct spawn fails on Windows, retry via PowerShell as a safety net.
5743 if (
5844 getErrnoCode ( result . error ) === 'ENOENT' &&
@@ -84,8 +70,6 @@ function runCompletionViaPowerShell(command: string, args: string[]): string {
8470 const psArgs = args . map ( powerShellQuote ) ;
8571 const psCommand = `& ${ command } ${ psArgs . join ( ' ' ) } ` . trimEnd ( ) ;
8672
87- tabDebugLog ( 'powershell exec:' , psCommand ) ;
88-
8973 const psResult = spawnSync (
9074 'powershell.exe' ,
9175 [
@@ -99,12 +83,6 @@ function runCompletionViaPowerShell(command: string, args: string[]): string {
9983 completionSpawnOptions
10084 ) ;
10185
102- tabDebugLog ( 'powershell exec result:' , {
103- status : psResult . status ,
104- error : psResult . error ?. message ,
105- stdout : psResult . stdout ,
106- } ) ;
107-
10886 if ( psResult . error ) {
10987 throw psResult . error ;
11088 }
@@ -132,18 +110,13 @@ async function checkCliHasCompletions(
132110 const result = runCompletionCommand ( cliName , [ ] , [ ] ) ;
133111 if ( result ) return true ;
134112 } catch {
135- tabDebugLog ( 'checkCliHasCompletions direct call failed for' , cliName ) ;
136113 noop ( ) ;
137114 }
138115
139116 try {
140117 const result = runCompletionCommand ( packageManager , [ cliName ] , [ ] ) ;
141118 return ! ! result ;
142119 } catch {
143- tabDebugLog (
144- 'checkCliHasCompletions package-manager call failed for' ,
145- cliName
146- ) ;
147120 return false ;
148121 }
149122}
@@ -159,19 +132,13 @@ async function getCliCompletions(
159132 return result . split ( '\n' ) . filter ( Boolean ) ;
160133 }
161134 } catch {
162- tabDebugLog ( 'getCliCompletions direct call failed for' , cliName , args ) ;
163135 noop ( ) ;
164136 }
165137
166138 try {
167139 const result = runCompletionCommand ( packageManager , [ cliName ] , args ) ;
168140 return result . split ( '\n' ) . filter ( Boolean ) ;
169141 } catch {
170- tabDebugLog (
171- 'getCliCompletions package-manager call failed for' ,
172- cliName ,
173- args
174- ) ;
175142 return [ ] ;
176143 }
177144}
0 commit comments