@@ -118,7 +118,7 @@ async function getRepositoryDiff(api) {
118118 */
119119async function generateCommitMessageWithLLM ( endpoint , model , diff ) {
120120 const trimmed =
121- diff . length > 60_000 ? `${ diff . slice ( 0 , 60_000 ) } \n... [truncated]` : diff ;
121+ diff . length > 60_000 ? `${ diff . slice ( 0 , 60_000 ) } \n [truncated]` : diff ;
122122 const system = SYSTEM_PROMPT ;
123123 const user = USER_PROMPT_TEMPLATE . replace ( "{{DIFF}}" , trimmed ) ;
124124
@@ -187,6 +187,7 @@ function stripOuterCodeFence(text) {
187187
188188/**
189189 * Generate and set the commit message for the active repository.
190+ * Logs progress using console debug/info/error messages.
190191 *
191192 * @returns {Promise<void> } Nothing.
192193 */
@@ -195,6 +196,7 @@ async function generateAndApplyCommitMessage() {
195196 if ( ! api ) {
196197 throw new Error ( "VS Code Git extension not available." ) ;
197198 }
199+ console . debug ( "[llm-commit-msg] Preparing diff" ) ;
198200 let { repo, diff } = await getRepositoryDiff ( api ) ;
199201 if ( typeof diff !== "string" ) {
200202 // Ensure a string diff by falling back to shell git.
@@ -206,6 +208,7 @@ async function generateAndApplyCommitMessage() {
206208 "No changes to generate a commit message from. Stage changes first." ,
207209 ) ;
208210 }
211+ console . debug ( "[llm-commit-msg] Loading settings" ) ;
209212 const config = vscode . workspace . getConfiguration ( "llmCommitMsg" ) ;
210213 /** @type {string | undefined } */
211214 const endpoint = config . get ( "endpoint" ) ;
@@ -216,14 +219,18 @@ async function generateAndApplyCommitMessage() {
216219 "LLM Commit Message settings are not configured. Please set endpoint and model in Settings." ,
217220 ) ;
218221 }
222+ console . info ( `[llm-commit-msg] Contacting LLM with details: endpoint=${ endpoint } model=${ model } ` ) ;
219223 const message = await generateCommitMessageWithLLM ( endpoint , model , diff ) ;
224+ console . debug ( "[llm-commit-msg] Applying message" ) ;
220225 if ( repo ?. inputBox ) {
221226 repo . inputBox . value = message ;
227+ console . info ( "[llm-commit-msg] Commit message applied to Source Control input box." ) ;
222228 } else {
223229 await vscode . env . clipboard . writeText ( message ) ;
224230 vscode . window . showInformationMessage (
225231 "Commit message copied to clipboard (no repository input box found)." ,
226232 ) ;
233+ console . info ( "[llm-commit-msg] Commit message copied to clipboard (no input box)." ) ;
227234 }
228235}
229236
@@ -240,23 +247,29 @@ function activate(context) {
240247 const disposable = vscode . commands . registerCommand (
241248 "llm-commit-msg.generateCommitMessage" ,
242249 async ( ) => {
243- await vscode . window . withProgress (
244- {
245- location : vscode . ProgressLocation . Notification ,
246- title : "Generating commit message with LLM..." ,
247- cancellable : false ,
248- } ,
249- async ( ) => {
250- try {
251- await generateAndApplyCommitMessage ( ) ;
252- vscode . window . showInformationMessage ( "Generated commit message." ) ;
253- } catch ( error ) {
254- const msg = error instanceof Error ? error . message : String ( error ) ;
255- vscode . window . showErrorMessage ( msg ) ;
256- }
257- } ,
258- ) ;
250+ const start = Date . now ( ) ;
251+ let errorMsg ;
252+
253+ try {
254+ await generateAndApplyCommitMessage ( ) ;
255+ } catch ( error ) {
256+ errorMsg = error instanceof Error ? error . message : String ( error ) ;
257+ }
258+
259+ const elapsedMs = Date . now ( ) - start ;
260+ const seconds = Math . max ( 0 , Math . round ( elapsedMs / 100 ) / 10 ) ;
261+
262+ if ( errorMsg ) {
263+ vscode . window . showErrorMessage (
264+ `Generate commit message - failure (${ seconds } s). Error: ${ errorMsg } `
265+ ) ;
266+ } else {
267+ vscode . window . showInformationMessage (
268+ `Generate commit message - success (${ seconds } s)`
269+ ) ;
270+ }
259271 } ,
272+
260273 ) ;
261274
262275 context . subscriptions . push ( disposable ) ;
0 commit comments