11import { GhostSuggestionContext } from "./types"
22import { PromptStrategy } from "./types/PromptStrategy"
3- import { ContextAnalyzer } from "./ContextAnalyzer"
43
54// Import all strategies
65import { UserRequestStrategy } from "./strategies/UserRequestStrategy"
@@ -16,12 +15,10 @@ import { AutoTriggerStrategy } from "./strategies/AutoTriggerStrategy"
1615 */
1716export class PromptStrategyManager {
1817 private strategies : PromptStrategy [ ]
19- private contextAnalyzer : ContextAnalyzer
2018 private debug : boolean
2119
2220 constructor ( options ?: { debug : boolean } ) {
2321 this . debug = options ?. debug ?? false
24- this . contextAnalyzer = new ContextAnalyzer ( )
2522
2623 // Register all strategies in priority order
2724 this . strategies = [
@@ -41,28 +38,11 @@ export class PromptStrategyManager {
4138 * @returns The selected strategy
4239 */
4340 selectStrategy ( context : GhostSuggestionContext ) : PromptStrategy {
44- // Analyze context to understand the situation
45- const analysis = this . contextAnalyzer . analyze ( context )
46-
47- if ( this . debug ) {
48- console . log ( "[PromptStrategyManager] Context analysis:" , {
49- useCase : analysis . useCase ,
50- hasUserInput : analysis . hasUserInput ,
51- hasErrors : analysis . hasErrors ,
52- hasSelection : analysis . hasSelection ,
53- isNewLine : analysis . isNewLine ,
54- isInComment : analysis . isInComment ,
55- isInlineEdit : analysis . isInlineEdit ,
56- } )
57- }
58-
5941 // Find the first strategy that can handle this context
6042 for ( const strategy of this . strategies ) {
6143 if ( strategy . canHandle ( context ) ) {
6244 if ( this . debug ) {
63- console . log (
64- `[PromptStrategyManager] Selected strategy: ${ strategy . name } for use case: ${ analysis . useCase } ` ,
65- )
45+ console . log ( `[PromptStrategyManager] Selected strategy: ${ strategy . name } ` )
6646 }
6747 return strategy
6848 }
0 commit comments