MCPcopy
hub / github.com/davepoon/buildwithclaude / removeCommand

Function removeCommand

packages/bwc-cli/src/commands/remove.ts:127–174  ·  view source on GitHub ↗
(
  name: string,
  configManager: ConfigManager,
  skipConfirmation: boolean,
  forceUserLevel: boolean = false,
  forceProjectLevel: boolean = false
)

Source from the content-addressed store, hash-verified

125}
126
127async function removeCommand(
128 name: string,
129 configManager: ConfigManager,
130 skipConfirmation: boolean,
131 forceUserLevel: boolean = false,
132 forceProjectLevel: boolean = false
133): Promise<void> {
134 const installed = await configManager.getInstalledCommands()
135
136 if (!installed.includes(name)) {
137 logger.warn(`Command "${name}" is not installed`)
138 return
139 }
140
141 if (!skipConfirmation) {
142 const { confirm } = await inquirer.prompt([
143 {
144 type: 'confirm',
145 name: 'confirm',
146 message: `Are you sure you want to remove command "${name}"?`,
147 default: false
148 }
149 ])
150
151 if (!confirm) {
152 logger.info('Removal cancelled')
153 return
154 }
155 }
156
157 const spinner = logger.spinner(`Removing command: ${name}`)
158
159 try {
160 const commandsPath = await configManager.getCommandsPath()
161 const filePath = path.join(commandsPath, `${name}.md`)
162
163 if (await fileExists(filePath)) {
164 await deleteFile(filePath)
165 }
166
167 await configManager.removeInstalledCommand(name)
168
169 spinner.succeed(`Successfully removed command: ${name}`)
170 } catch (error) {
171 spinner.fail('Failed to remove command')
172 throw error
173 }
174}
175
176async function removeMCPServer(
177 name: string,

Callers 2

createRemoveCommandFunction · 0.85
interactiveRemoveCommandFunction · 0.85

Calls 5

deleteFileFunction · 0.85
getInstalledCommandsMethod · 0.80
getCommandsPathMethod · 0.80
fileExistsFunction · 0.50

Tested by

no test coverage detected