@@ -16,24 +16,16 @@ export const searchCommand = new Command('search')
1616 . description ( 'Search indexed code semantically' )
1717 . argument ( '<query>' , 'Search query' )
1818 . option ( '-l, --limit <number>' , 'Maximum number of results' , '10' )
19- . option ( '-t, --threshold <number>' , 'Minimum similarity score (0-1) ' , '0.7 ' )
19+ . option ( '-t, --threshold <number>' , 'Minimum similarity score' , '0' )
2020 . option ( '--json' , 'Output results as JSON' , false )
2121 . option ( '-v, --verbose' , 'Show detailed results with signatures and docs' , false )
2222 . action ( async ( query : string , options ) => {
2323 const spinner = ora ( 'Searching...' ) . start ( ) ;
2424
2525 try {
26- // Load config
26+ // Load config (optional — defaults to cwd)
2727 const config = await loadConfig ( ) ;
28- if ( ! config ) {
29- spinner . fail ( 'No config found' ) ;
30- logger . error ( 'Run "dev init" first to initialize dev-agent' ) ;
31- process . exit ( 1 ) ;
32- return ; // TypeScript needs this
33- }
34-
35- // Resolve repository path
36- const repositoryPath = config . repository ?. path || config . repositoryPath || process . cwd ( ) ;
28+ const repositoryPath = config ?. repository ?. path || config ?. repositoryPath || process . cwd ( ) ;
3729 const resolvedRepoPath = path . resolve ( repositoryPath ) ;
3830
3931 // Get centralized storage paths
@@ -45,8 +37,8 @@ export const searchCommand = new Command('search')
4537 const indexer = new RepositoryIndexer ( {
4638 repositoryPath : resolvedRepoPath ,
4739 vectorStorePath : filePaths . vectors ,
48- excludePatterns : config . repository ?. excludePatterns || config . excludePatterns ,
49- languages : config . repository ?. languages || config . languages ,
40+ excludePatterns : config ? .repository ?. excludePatterns || config ? .excludePatterns ,
41+ languages : config ? .repository ?. languages || config ? .languages ,
5042 } ) ;
5143
5244 await indexer . initialize ( ) ;
@@ -65,9 +57,9 @@ export const searchCommand = new Command('search')
6557 if ( results . length === 0 ) {
6658 output . log ( '' ) ;
6759 output . warn ( 'No results found. Try:' ) ;
68- output . log ( ` • Lower threshold: ${ chalk . cyan ( '--threshold 0.5 ' ) } ` ) ;
60+ output . log ( ` • Lower threshold: ${ chalk . cyan ( '--threshold 0.3 ' ) } ` ) ;
6961 output . log ( ` • Different keywords` ) ;
70- output . log ( ` • Refresh index: ${ chalk . cyan ( 'dev update ' ) } ` ) ;
62+ output . log ( ` • Re- index: ${ chalk . cyan ( 'dev index --force ' ) } ` ) ;
7163 output . log ( '' ) ;
7264 return ;
7365 }
0 commit comments