11import * as vscode from "vscode" ;
2- import {
3- APP_CONFIG ,
4- generativeAiModels ,
5- OLA_ACTIONS ,
6- USER_MESSAGE ,
7- } from "./application/constant" ;
2+ import { APP_CONFIG , generativeAiModels , OLA_ACTIONS , USER_MESSAGE } from "./application/constant" ;
83import { Comments } from "./commands/comment" ;
94import { ExplainCode } from "./commands/explain" ;
105import { FixError } from "./commands/fixError" ;
@@ -24,27 +19,16 @@ import { AnthropicWebViewProvider } from "./providers/anthropic";
2419import { CodeActionsProvider } from "./providers/code-actions" ;
2520import { GeminiWebViewProvider } from "./providers/gemini" ;
2621import { GroqWebViewProvider } from "./providers/groq" ;
27- import { CodeIndexingService } from "./services/code-indexing" ;
2822import { FileUploader } from "./services/file-uploader" ;
2923import { initializeGenerativeAiEnvironment } from "./services/generative-ai-model-manager" ;
3024import { Credentials } from "./services/github-authentication" ;
3125import { getConfigValue } from "./utils/utils" ;
3226
33- const {
34- geminiKey,
35- geminiModel,
36- groqApiKey,
37- groqModel,
38- anthropicApiKey,
39- anthropicModel,
40- grokApiKey,
41- grokModel,
42- } = APP_CONFIG ;
27+ const { geminiKey, geminiModel, groqApiKey, groqModel, anthropicApiKey, anthropicModel, grokApiKey, grokModel } =
28+ APP_CONFIG ;
4329
4430const connectDB = async ( ) => {
45- await dbManager . connect (
46- "file:/Users/olasunkanmioyinlola/Documents/Apps/codebuddy/patterns/aii.db"
47- ) ;
31+ await dbManager . connect ( "file:/Users/olasunkanmi/Documents/Github/codebuddy/patterns/dev.db" ) ;
4832} ;
4933
5034let quickFixCodeAction : vscode . Disposable ;
@@ -54,11 +38,8 @@ export async function activate(context: vscode.ExtensionContext) {
5438 try {
5539 const credentials = new Credentials ( ) ;
5640 await credentials . initialize ( context ) ;
57- const session : vscode . AuthenticationSession | undefined =
58- await credentials . getSession ( ) ;
59- vscode . window . showInformationMessage (
60- `Logged into GitHub as ${ session ?. account . label } `
61- ) ;
41+ const session : vscode . AuthenticationSession | undefined = await credentials . getSession ( ) ;
42+ vscode . window . showInformationMessage ( `Logged into GitHub as ${ session ?. account . label } ` ) ;
6243 Memory . getInstance ( ) ;
6344 await connectDB ( ) ;
6445 // const web = WebSearchService.getInstance();
@@ -95,52 +76,19 @@ export async function activate(context: vscode.ExtensionContext) {
9576 generateCodeChart,
9677 inlineChat,
9778 } = OLA_ACTIONS ;
98- const getComment = new Comments (
99- `${ USER_MESSAGE } generates the code comments...` ,
100- context
101- ) ;
102- const getInLineChat = new InLineChat (
103- `${ USER_MESSAGE } generates a response...` ,
104- context
105- ) ;
106- const generateOptimizeCode = new OptimizeCode (
107- `${ USER_MESSAGE } optimizes the code...` ,
108- context
109- ) ;
110- const generateRefactoredCode = new RefactorCode (
111- `${ USER_MESSAGE } refactors the code...` ,
112- context
113- ) ;
114- const explainCode = new ExplainCode (
115- `${ USER_MESSAGE } explains the code...` ,
116- context
117- ) ;
118- const generateReview = new ReviewCode (
119- `${ USER_MESSAGE } reviews the code...` ,
120- context
121- ) ;
122- const codeChartGenerator = new CodeChartGenerator (
123- `${ USER_MESSAGE } creates the code chart...` ,
124- context
125- ) ;
79+ const getComment = new Comments ( `${ USER_MESSAGE } generates the code comments...` , context ) ;
80+ const getInLineChat = new InLineChat ( `${ USER_MESSAGE } generates a response...` , context ) ;
81+ const generateOptimizeCode = new OptimizeCode ( `${ USER_MESSAGE } optimizes the code...` , context ) ;
82+ const generateRefactoredCode = new RefactorCode ( `${ USER_MESSAGE } refactors the code...` , context ) ;
83+ const explainCode = new ExplainCode ( `${ USER_MESSAGE } explains the code...` , context ) ;
84+ const generateReview = new ReviewCode ( `${ USER_MESSAGE } reviews the code...` , context ) ;
85+ const codeChartGenerator = new CodeChartGenerator ( `${ USER_MESSAGE } creates the code chart...` , context ) ;
12686 const codePattern = fileUpload ;
127- const knowledgeBase = new ReadFromKnowledgeBase (
128- `${ USER_MESSAGE } generate your code pattern...` ,
129- context
130- ) ;
131- const generateCommitMessage = new GenerateCommitMessage (
132- `${ USER_MESSAGE } generates a commit message...` ,
133- context
134- ) ;
135- const generateInterviewQuestions = new InterviewMe (
136- `${ USER_MESSAGE } generates interview questions...` ,
137- context
138- ) ;
87+ const knowledgeBase = new ReadFromKnowledgeBase ( `${ USER_MESSAGE } generate your code pattern...` , context ) ;
88+ const generateCommitMessage = new GenerateCommitMessage ( `${ USER_MESSAGE } generates a commit message...` , context ) ;
89+ const generateInterviewQuestions = new InterviewMe ( `${ USER_MESSAGE } generates interview questions...` , context ) ;
13990
140- const generateUnitTests = new GenerateUnitTest (
141- `${ USER_MESSAGE } generates unit tests...` ,
142- context
143- ) ;
91+ const generateUnitTests = new GenerateUnitTest ( `${ USER_MESSAGE } generates unit tests...` , context ) ;
14492
14593 const actionMap = {
14694 [ comment ] : async ( ) => await getComment . execute ( ) ,
@@ -150,31 +98,23 @@ export async function activate(context: vscode.ExtensionContext) {
15098 [ interviewMe ] : async ( ) => await generateInterviewQuestions . execute ( ) ,
15199 [ generateUnitTest ] : async ( ) => await generateUnitTests . execute ( ) ,
152100 [ fix ] : ( errorMessage : string ) =>
153- new FixError (
154- `${ USER_MESSAGE } finds a solution to the error...` ,
155- context ,
156- errorMessage
157- ) . execute ( errorMessage ) ,
101+ new FixError ( `${ USER_MESSAGE } finds a solution to the error...` , context , errorMessage ) . execute ( errorMessage ) ,
158102 [ explain ] : async ( ) => await explainCode . execute ( ) ,
159103 [ pattern ] : async ( ) => await codePattern . uploadFileHandler ( ) ,
160104 [ knowledge ] : async ( ) => await knowledgeBase . execute ( ) ,
161- [ commitMessage ] : async ( ) =>
162- await generateCommitMessage . execute ( "commitMessage" ) ,
105+ [ commitMessage ] : async ( ) => await generateCommitMessage . execute ( "commitMessage" ) ,
163106 [ generateCodeChart ] : async ( ) => await codeChartGenerator . execute ( ) ,
164107 [ inlineChat ] : async ( ) => await getInLineChat . execute ( ) ,
165108 } ;
166109
167- const subscriptions : vscode . Disposable [ ] = Object . entries ( actionMap ) . map (
168- ( [ action , handler ] ) => vscode . commands . registerCommand ( action , handler )
110+ const subscriptions : vscode . Disposable [ ] = Object . entries ( actionMap ) . map ( ( [ action , handler ] ) =>
111+ vscode . commands . registerCommand ( action , handler )
169112 ) ;
170113
171114 const selectedGenerativeAiModel = getConfigValue ( "generativeAi.option" ) ;
172115
173116 const quickFix = new CodeActionsProvider ( ) ;
174- quickFixCodeAction = vscode . languages . registerCodeActionsProvider (
175- { scheme : "file" , language : "*" } ,
176- quickFix
177- ) ;
117+ quickFixCodeAction = vscode . languages . registerCodeActionsProvider ( { scheme : "file" , language : "*" } , quickFix ) ;
178118
179119 agentEventEmmitter = new EventEmitter ( ) ;
180120
@@ -221,9 +161,7 @@ export async function activate(context: vscode.ExtensionContext) {
221161 }
222162 } catch ( error ) {
223163 Memory . clear ( ) ;
224- vscode . window . showErrorMessage (
225- "An Error occured while setting up generative AI model"
226- ) ;
164+ vscode . window . showErrorMessage ( "An Error occured while setting up generative AI model" ) ;
227165 console . log ( error ) ;
228166 }
229167}
0 commit comments