-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall-skill.js
More file actions
32 lines (25 loc) · 948 Bytes
/
uninstall-skill.js
File metadata and controls
32 lines (25 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const os = require('os')
const config = require('./.claude-skill.json')
const skillName = config.name
const isGlobal = process.env.npm_config_global === 'true'
const basePath = isGlobal
? path.join(os.homedir(), '.claude', 'skills')
: path.join(process.cwd(), '.claude', 'skills')
const skillPath = path.join(basePath, skillName)
try {
if (fs.existsSync(skillPath)) {
fs.rmSync(skillPath, { recursive: true, force: true })
}
const manifestPath = path.join(basePath, '.skills-manifest.json')
if (fs.existsSync(manifestPath)) {
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'))
delete manifest[skillName]
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2))
}
console.log(`\u2713 Skill "${skillName}" uninstalled`)
} catch (err) {
console.error(`Failed to uninstall skill "${skillName}":`, err.message)
}