11import * as vscode from 'vscode' ;
22import * as path from 'path' ;
33import * as fs from 'fs' ;
4- import { applyCvbToWorkspace , compressCvb , Cvb , generateCvb } from './cvbManager' ;
4+ import { applyCvbToWorkspace , summaryCvb , Cvb , generateCvb } from './cvbManager' ;
55import { analyzeCode } from './deepseekApi' ;
6- import { getCurrentOperationController , resetCurrentOperationController , clearCurrentOperationController , doUploadCommand , saveAnalyzeCodeResult } from './extension' ;
6+ import { getCurrentOperationController , resetCurrentOperationController , clearCurrentOperationController , doRedesignCommand , saveAnalyzeCodeResult } from './extension' ;
77import { showInputMultiLineBox } from './UIComponents' ;
88import { getOutputChannel } from './extension' ;
99
@@ -60,23 +60,23 @@ export function registerCvbContextMenu(context: vscode.ExtensionContext) {
6060 } ) ;
6161 context . subscriptions . push ( applyCvbCommand ) ;
6262
63- const uploadCvbCommand = vscode . commands . registerCommand ( 'codeReDesign.uploadThisCvb ' , async ( cvb : CvbFile ) => {
63+ const redesignCvbCommand = vscode . commands . registerCommand ( 'codeReDesign.redesignThisCvb ' , async ( cvb : CvbFile ) => {
6464 const filePath = cvb . resourceUri ?. fsPath || "" ;
65- await uploadThisCvb ( filePath ) ;
65+ await redesignThisCvb ( filePath ) ;
6666 } ) ;
67- context . subscriptions . push ( uploadCvbCommand ) ;
67+ context . subscriptions . push ( redesignCvbCommand ) ;
6868
6969 const analyzeCvbCommand = vscode . commands . registerCommand ( 'codeReDesign.analyzeThisCvb' , async ( cvb : CvbFile ) => {
7070 const filePath = cvb . resourceUri ?. fsPath || "" ;
7171 await analyzeThisCvb ( filePath ) ;
7272 } ) ;
7373 context . subscriptions . push ( analyzeCvbCommand ) ;
7474
75- const compressCvbCommand = vscode . commands . registerCommand ( 'codeReDesign.compressThisCvb ' , async ( cvb : CvbFile ) => {
75+ const summaryCvbCommand = vscode . commands . registerCommand ( 'codeReDesign.summaryThisCvb ' , async ( cvb : CvbFile ) => {
7676 const filePath = cvb . resourceUri ?. fsPath || "" ;
77- await compressThisCvb ( filePath ) ;
77+ await summaryThisCvb ( filePath ) ;
7878 } ) ;
79- context . subscriptions . push ( compressCvbCommand ) ;
79+ context . subscriptions . push ( summaryCvbCommand ) ;
8080
8181 const analyzeSingleFileCommand = vscode . commands . registerCommand ( 'codeReDesign.analyzeSingleFile' , async ( uri : vscode . Uri ) => {
8282 const filePath = uri . fsPath || "" ;
@@ -85,12 +85,12 @@ export function registerCvbContextMenu(context: vscode.ExtensionContext) {
8585 } ) ;
8686 context . subscriptions . push ( analyzeSingleFileCommand ) ;
8787
88- const uploadSingleFileCommand = vscode . commands . registerCommand ( 'codeReDesign.uploadSingleFile ' , async ( uri : vscode . Uri ) => {
88+ const redesignSingleFileCommand = vscode . commands . registerCommand ( 'codeReDesign.redesignSingleFile ' , async ( uri : vscode . Uri ) => {
8989 const filePath = uri . fsPath || "" ;
9090 const cvbFile = await generateCvb ( [ filePath ] , "重构单个文件:" + filePath ) ;
91- await uploadThisCvb ( cvbFile ) ;
91+ await redesignThisCvb ( cvbFile ) ;
9292 } ) ;
93- context . subscriptions . push ( uploadSingleFileCommand ) ;
93+ context . subscriptions . push ( redesignSingleFileCommand ) ;
9494
9595 // 注册 TreeDataProvider
9696 const cvbViewProvider = new CvbViewProvider ( ) ;
@@ -311,7 +311,7 @@ function applyThisCvb(filePath: string) {
311311 * 上传 CVB 文件并调用 API
312312 * @param filePath .cvb 文件的路径
313313 */
314- async function uploadThisCvb ( filePath : string ) {
314+ async function redesignThisCvb ( filePath : string ) {
315315/*
316316 // 测试 begin
317317 {
@@ -342,7 +342,7 @@ async function uploadThisCvb(filePath: string) {
342342 return ;
343343 }
344344 const outputChannel = getOutputChannel ( ) ;
345- doUploadCommand ( filePath , userPrompt , outputChannel ) ;
345+ doRedesignCommand ( filePath , userPrompt , outputChannel ) ;
346346}
347347
348348/**
@@ -375,16 +375,16 @@ async function analyzeThisCvb(filePath: string) {
375375 }
376376}
377377
378- function getCompressedFileName ( filePath : string ) : string {
378+ function getSummarizedFileName ( filePath : string ) : string {
379379 const { name, ext } = path . parse ( filePath ) ; // 使用 path.parse 获取文件名和扩展名
380- return path . join ( path . dirname ( filePath ) , `${ name } -compress ${ ext } ` ) ; // 拼接新的完整路径
380+ return path . join ( path . dirname ( filePath ) , `${ name } -summary ${ ext } ` ) ; // 拼接新的完整路径
381381}
382382
383383/**
384384 * 分析 CVB 文件
385385 * @param filePath .cvb 文件的路径
386386 */
387- async function compressThisCvb ( filePath : string ) {
387+ async function summaryThisCvb ( filePath : string ) {
388388 const userRequest = await showInputMultiLineBox ( {
389389 prompt : '输入压缩过程中需要关注的需求' ,
390390 placeHolder : 'e.g., Analyze the code for potential bugs' ,
@@ -400,22 +400,22 @@ async function compressThisCvb(filePath: string) {
400400
401401 resetCurrentOperationController ( ) ;
402402
403- const newCvb = await compressCvb ( cvb , userRequest ) ;
403+ const newCvb = await summaryCvb ( cvb , userRequest ) ;
404404 clearCurrentOperationController ( ) ;
405405
406406 if ( newCvb ) {
407- vscode . window . showInformationMessage ( 'compress cvb success!.' ) ;
407+ vscode . window . showInformationMessage ( 'summary cvb success!.' ) ;
408408 }
409409 else {
410- vscode . window . showInformationMessage ( 'compress cvb failed!.' ) ;
410+ vscode . window . showInformationMessage ( 'summary cvb failed!.' ) ;
411411 return ;
412412 }
413413
414- if ( ! newCvb . getMetaData ( "compressFrom " ) ) {
415- newCvb . setMetaData ( "compressFrom " , filePath ) ;
414+ if ( ! newCvb . getMetaData ( "summaryFrom " ) ) {
415+ newCvb . setMetaData ( "summaryFrom " , filePath ) ;
416416 }
417417
418- filePath = getCompressedFileName ( filePath ) ;
418+ filePath = getSummarizedFileName ( filePath ) ;
419419
420420 fs . writeFileSync ( filePath , newCvb . toString ( ) , 'utf-8' ) ;
421421 vscode . window . showInformationMessage ( `Conversation log saved as: ${ filePath } ` ) ;
0 commit comments