@@ -7,6 +7,7 @@ import * as remoteAction from '../../src/cli/actions/remoteAction.js';
77import * as versionAction from '../../src/cli/actions/versionAction.js' ;
88import { run , runCli } from '../../src/cli/cliRun.js' ;
99import type { CliOptions } from '../../src/cli/types.js' ;
10+ import * as fileStdin from '../../src/core/file/fileStdin.js' ;
1011import * as gitRemoteHandle from '../../src/core/git/gitRemoteHandle.js' ;
1112import type { PackResult } from '../../src/core/packager.js' ;
1213import { logger , type RepomixLogLevel , repomixLogLevels } from '../../src/shared/logger.js' ;
@@ -226,6 +227,39 @@ describe('cliRun', () => {
226227 expect ( defaultAction . runDefaultAction ) . not . toHaveBeenCalled ( ) ;
227228 } ) ;
228229
230+ test ( 'should resolve stdin content before executing default action' , async ( ) => {
231+ vi . spyOn ( fileStdin , 'readContentFromStdin' ) . mockResolvedValue ( 'npm run build failed' ) ;
232+
233+ await runCli ( [ '.' ] , process . cwd ( ) , {
234+ stdinContent : true ,
235+ } ) ;
236+
237+ expect ( defaultAction . runDefaultAction ) . toHaveBeenCalledWith (
238+ [ '.' ] ,
239+ process . cwd ( ) ,
240+ expect . objectContaining ( {
241+ stdinContent : 'npm run build failed' ,
242+ } ) ,
243+ ) ;
244+ } ) ;
245+
246+ test ( 'should resolve stdin content before executing remote action' , async ( ) => {
247+ vi . spyOn ( fileStdin , 'readContentFromStdin' ) . mockResolvedValue ( 'remote build failed' ) ;
248+
249+ await runCli ( [ '.' ] , process . cwd ( ) , {
250+ remote : 'yamadashy/repomix' ,
251+ stdinContent : true ,
252+ } ) ;
253+
254+ expect ( remoteAction . runRemoteAction ) . toHaveBeenCalledWith (
255+ 'yamadashy/repomix' ,
256+ expect . objectContaining ( {
257+ stdinContent : 'remote build failed' ,
258+ } ) ,
259+ ) ;
260+ expect ( defaultAction . runDefaultAction ) . not . toHaveBeenCalled ( ) ;
261+ } ) ;
262+
229263 test ( 'should auto-detect HTTPS URL and execute remote action' , async ( ) => {
230264 await runCli ( [ 'https://github.com/user/repo' ] , process . cwd ( ) , { } ) ;
231265
0 commit comments