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

Function removeSubagent

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

Source from the content-addressed store, hash-verified

76}
77
78async function removeSubagent(
79 name: string,
80 configManager: ConfigManager,
81 skipConfirmation: boolean,
82 forceUserLevel: boolean = false,
83 forceProjectLevel: boolean = false
84): Promise<void> {
85 const installed = await configManager.getInstalledSubagents()
86
87 if (!installed.includes(name)) {
88 logger.warn(`Subagent "${name}" is not installed`)
89 return
90 }
91
92 if (!skipConfirmation) {
93 const { confirm } = await inquirer.prompt([
94 {
95 type: 'confirm',
96 name: 'confirm',
97 message: `Are you sure you want to remove subagent "${name}"?`,
98 default: false
99 }
100 ])
101
102 if (!confirm) {
103 logger.info('Removal cancelled')
104 return
105 }
106 }
107
108 const spinner = logger.spinner(`Removing subagent: ${name}`)
109
110 try {
111 const subagentsPath = await configManager.getSubagentsPath()
112 const filePath = path.join(subagentsPath, `${name}.md`)
113
114 if (await fileExists(filePath)) {
115 await deleteFile(filePath)
116 }
117
118 await configManager.removeInstalledSubagent(name)
119
120 spinner.succeed(`Successfully removed subagent: ${name}`)
121 } catch (error) {
122 spinner.fail('Failed to remove subagent')
123 throw error
124 }
125}
126
127async function removeCommand(
128 name: string,

Callers 2

createRemoveCommandFunction · 0.85

Calls 5

deleteFileFunction · 0.85
getInstalledSubagentsMethod · 0.80
getSubagentsPathMethod · 0.80
fileExistsFunction · 0.50

Tested by

no test coverage detected