MCPcopy Index your code
hub / github.com/liuup/claude-code-analysis / deleteAgentFromFile

Function deleteAgentFromFile

src/components/agents/agentFileUtils.ts:241–258  ·  view source on GitHub ↗
(
  agent: AgentDefinition,
)

Source from the content-addressed store, hash-verified

239 * Deletes an agent file
240 */
241export async function deleteAgentFromFile(
242 agent: AgentDefinition,
243): Promise<void> {
244 if (agent.source === 'built-in') {
245 throw new Error('Cannot delete built-in agents')
246 }
247
248 const filePath = getActualAgentFilePath(agent)
249
250 try {
251 await unlink(filePath)
252 } catch (e: unknown) {
253 const code = getErrnoCode(e)
254 if (code !== 'ENOENT') {
255 throw e
256 }
257 }
258}
259
260async function writeFileAndFlush(
261 filePath: string,

Callers 1

AgentsMenuFunction · 0.85

Calls 3

getActualAgentFilePathFunction · 0.85
unlinkFunction · 0.85
getErrnoCodeFunction · 0.85

Tested by

no test coverage detected