Skip to content

Commit 4c59aab

Browse files
committed
refactor: implement refactored command structure for custom commands and file management
- Renamed command files to follow a consistent naming convention: `addCustomCommand` to `add-custom-command`, `addToCody` to `add-to-cody`, and `providerCommands` to `provider-commands`. - Introduced new command implementations for adding custom commands and managing file additions, enhancing modularity and maintainability. - Added comprehensive unit tests for the new command functionalities, ensuring robust error handling and user feedback.
1 parent 0ef437e commit 4c59aab

7 files changed

+10
-8
lines changed

src/commands/__tests__/addCustomCommand.test.ts renamed to src/commands/__tests__/add-custom-command.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as sinon from 'sinon'
33
import * as vscode from 'vscode'
44
import { CustomCommandService } from '../../services/customCommand.service'
55
import { CustomCommandsWebview } from '../../views/CustomCommandsWebview'
6-
import { addCustomCommand, editCustomCommand } from '../addCustomCommand'
6+
import { addCustomCommand, editCustomCommand } from '../add-custom-command'
77

88
suite('Add Custom Command Tests', () => {
99
let sandbox: sinon.SinonSandbox

src/commands/__tests__/addToCody.test.ts renamed to src/commands/__tests__/add-to-cody.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import * as llmModule from '../../core/llm'
99
import * as llmUtils from '../../core/llm/utils'
1010
import { TelemetryService } from '../../services/telemetry.service'
1111
import * as workspaceConfigUtils from '../../utils/workspace-config'
12-
import { addFile, addFilesSmart, addFolder, addSelection } from '../addToCody'
13-
import * as providerCommands from '../providerCommands'
12+
import { addFile, addFilesSmart, addFolder, addSelection } from '../add-to-cody'
13+
import * as providerCommands from '../provider-commands'
1414

1515
suite('Add to Cody Commands Tests', () => {
1616
let sandbox: sinon.SinonSandbox

src/commands/__tests__/providerCommands.test.ts renamed to src/commands/__tests__/provider-commands.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as vscode from 'vscode'
44
import * as llmModule from '../../core/llm'
55
import { CONFIG_KEYS, SUPPORTED_PROVIDERS } from '../../core/llm/constants'
66
import * as workspaceConfigUtils from '../../utils/workspace-config'
7-
import { selectLLM, selectProvider } from '../providerCommands'
7+
import { selectLLM, selectProvider } from '../provider-commands'
88

99
suite('Provider Commands Tests', () => {
1010
let sandbox: sinon.SinonSandbox
File renamed without changes.

src/commands/addToCody.ts renamed to src/commands/add-to-cody.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import { createCompletionRequestMessages, parseLLMResponse } from '../core/llm/u
99
import { TelemetryService } from '../services/telemetry.service'
1010
import { getSuccessCount } from '../utils'
1111
import { getProviderConfig } from '../utils/workspace-config'
12-
import { selectProvider } from './providerCommands'
12+
import { selectProvider } from './provider-commands'
13+
14+
let telemetryServiceInstance: TelemetryService | null = null
1315

1416
export async function addFile(folderUri: vscode.Uri) {
1517
const telemetry = TelemetryService.getInstance()
File renamed without changes.

src/extension.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Import VS Code API and necessary modules
22
import * as vscode from 'vscode'
33
// Import custom command handlers
4-
import { addCustomCommand, editCustomCommand } from './commands/addCustomCommand'
5-
import { addFile, addFilesSmart, addFolder, addSelection } from './commands/addToCody'
6-
import { selectLLM, selectProvider } from './commands/providerCommands'
4+
import { addCustomCommand, editCustomCommand } from './commands/add-custom-command'
5+
import { addFile, addFilesSmart, addFolder, addSelection } from './commands/add-to-cody'
6+
import { selectLLM, selectProvider } from './commands/provider-commands'
77
// Import services and views
88
import { CustomCommandService } from './services/customCommand.service'
99
import { TelemetryService } from './services/telemetry.service'

0 commit comments

Comments
 (0)