@adonis0123/skill-development 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-skill.json +47 -0
- package/README.md +79 -0
- package/SKILL.md +637 -0
- package/install-skill.js +315 -0
- package/package.json +34 -0
- package/references/skill-creator-original.md +209 -0
- package/uninstall-skill.js +191 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
|
|
25
|
+
// shared/src/uninstall-skill.ts
|
|
26
|
+
var import_fs2 = __toESM(require("fs"));
|
|
27
|
+
var import_path2 = __toESM(require("path"));
|
|
28
|
+
|
|
29
|
+
// shared/src/utils.ts
|
|
30
|
+
var import_fs = __toESM(require("fs"));
|
|
31
|
+
var import_path = __toESM(require("path"));
|
|
32
|
+
var import_os = __toESM(require("os"));
|
|
33
|
+
var CWD = process.env.INIT_CWD || process.cwd();
|
|
34
|
+
var DEFAULT_TARGET = {
|
|
35
|
+
name: "claude-code",
|
|
36
|
+
paths: {
|
|
37
|
+
global: ".claude/skills",
|
|
38
|
+
project: ".claude/skills"
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
function getEnabledTargets(config) {
|
|
42
|
+
if (!config.targets) {
|
|
43
|
+
return [DEFAULT_TARGET];
|
|
44
|
+
}
|
|
45
|
+
return Object.entries(config.targets).filter(([_, target]) => target.enabled).map(([name, target]) => ({
|
|
46
|
+
name,
|
|
47
|
+
paths: target.paths
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
function extractSkillName(packageName) {
|
|
51
|
+
if (packageName.startsWith("@")) {
|
|
52
|
+
return packageName.split("/")[1] || packageName;
|
|
53
|
+
}
|
|
54
|
+
return packageName;
|
|
55
|
+
}
|
|
56
|
+
function detectInstallLocation(targetPaths, isGlobal) {
|
|
57
|
+
if (isGlobal) {
|
|
58
|
+
return {
|
|
59
|
+
type: "personal",
|
|
60
|
+
base: import_path.default.join(import_os.default.homedir(), targetPaths.global)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
let projectRoot = CWD;
|
|
64
|
+
while (projectRoot !== import_path.default.dirname(projectRoot)) {
|
|
65
|
+
const hasPackageJson = import_fs.default.existsSync(import_path.default.join(projectRoot, "package.json"));
|
|
66
|
+
const hasGit = import_fs.default.existsSync(import_path.default.join(projectRoot, ".git"));
|
|
67
|
+
const isInNodeModules = projectRoot.includes("/node_modules/") || import_path.default.basename(projectRoot) === "node_modules";
|
|
68
|
+
if ((hasPackageJson || hasGit) && !isInNodeModules) {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
projectRoot = import_path.default.dirname(projectRoot);
|
|
72
|
+
}
|
|
73
|
+
const finalIsInNodeModules = projectRoot.includes("/node_modules/") || import_path.default.basename(projectRoot) === "node_modules";
|
|
74
|
+
if (finalIsInNodeModules) {
|
|
75
|
+
console.warn("\u26A0 Warning: Could not find project root directory, using current directory");
|
|
76
|
+
projectRoot = CWD;
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
type: "project",
|
|
80
|
+
base: import_path.default.join(projectRoot, targetPaths.project)
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function isGlobalInstall() {
|
|
84
|
+
return process.env.npm_config_global === "true";
|
|
85
|
+
}
|
|
86
|
+
function removeDir(dir) {
|
|
87
|
+
if (import_fs.default.existsSync(dir)) {
|
|
88
|
+
import_fs.default.rmSync(dir, { recursive: true, force: true });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function readSkillConfig(dir) {
|
|
92
|
+
const configPath = import_path.default.join(dir, ".claude-skill.json");
|
|
93
|
+
if (!import_fs.default.existsSync(configPath)) {
|
|
94
|
+
throw new Error(".claude-skill.json not found");
|
|
95
|
+
}
|
|
96
|
+
return JSON.parse(import_fs.default.readFileSync(configPath, "utf-8"));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// shared/src/uninstall-skill.ts
|
|
100
|
+
function updateManifest(skillsDir, config) {
|
|
101
|
+
const manifestPath = import_path2.default.join(skillsDir, ".skills-manifest.json");
|
|
102
|
+
if (!import_fs2.default.existsSync(manifestPath)) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const manifest = JSON.parse(import_fs2.default.readFileSync(manifestPath, "utf-8"));
|
|
107
|
+
if (manifest.skills && manifest.skills[config.name]) {
|
|
108
|
+
delete manifest.skills[config.name];
|
|
109
|
+
import_fs2.default.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2));
|
|
110
|
+
console.log(" \u2713 Updated manifest");
|
|
111
|
+
}
|
|
112
|
+
} catch (error) {
|
|
113
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
114
|
+
console.warn(" Warning: Could not update manifest:", message);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function uninstallFromTarget(target, config) {
|
|
118
|
+
console.log(`
|
|
119
|
+
\u{1F5D1}\uFE0F Uninstalling from ${target.name}...`);
|
|
120
|
+
const isGlobal = isGlobalInstall();
|
|
121
|
+
const location = detectInstallLocation(target.paths, isGlobal);
|
|
122
|
+
const skillName = extractSkillName(config.name);
|
|
123
|
+
const skillNameTargetDir = import_path2.default.join(location.base, skillName);
|
|
124
|
+
const fullPackageNameTargetDir = import_path2.default.join(location.base, config.name);
|
|
125
|
+
let removed = false;
|
|
126
|
+
if (import_fs2.default.existsSync(skillNameTargetDir)) {
|
|
127
|
+
removeDir(skillNameTargetDir);
|
|
128
|
+
console.log(` \u2713 Removed skill directory: ${skillName}`);
|
|
129
|
+
removed = true;
|
|
130
|
+
}
|
|
131
|
+
if (import_fs2.default.existsSync(fullPackageNameTargetDir) && fullPackageNameTargetDir !== skillNameTargetDir) {
|
|
132
|
+
removeDir(fullPackageNameTargetDir);
|
|
133
|
+
console.log(` \u2713 Removed skill directory: ${config.name}`);
|
|
134
|
+
removed = true;
|
|
135
|
+
}
|
|
136
|
+
updateManifest(location.base, config);
|
|
137
|
+
if (removed) {
|
|
138
|
+
console.log(` \u2705 Uninstalled from ${target.name}`);
|
|
139
|
+
return true;
|
|
140
|
+
} else {
|
|
141
|
+
console.log(` \u2139\uFE0F Skill was not installed in ${target.name}`);
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
function uninstallSkill() {
|
|
146
|
+
console.log("\u{1F5D1}\uFE0F Uninstalling AI Coding Skill...\n");
|
|
147
|
+
const packageDir = __dirname;
|
|
148
|
+
let config;
|
|
149
|
+
try {
|
|
150
|
+
config = readSkillConfig(packageDir);
|
|
151
|
+
} catch {
|
|
152
|
+
console.warn("Warning: .claude-skill.json not found, skipping cleanup");
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
const enabledTargets = getEnabledTargets(config);
|
|
156
|
+
console.log(`Uninstalling skill "${config.name}" from ${enabledTargets.length} target(s):`);
|
|
157
|
+
enabledTargets.forEach((target) => {
|
|
158
|
+
console.log(` \u2022 ${target.name}`);
|
|
159
|
+
});
|
|
160
|
+
const uninstalledFrom = [];
|
|
161
|
+
for (const target of enabledTargets) {
|
|
162
|
+
try {
|
|
163
|
+
const success = uninstallFromTarget(target, config);
|
|
164
|
+
if (success) {
|
|
165
|
+
uninstalledFrom.push(target.name);
|
|
166
|
+
}
|
|
167
|
+
} catch (error) {
|
|
168
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
169
|
+
console.error(`
|
|
170
|
+
\u274C Failed to uninstall from ${target.name}:`, message);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
console.log("\n" + "=".repeat(60));
|
|
174
|
+
if (uninstalledFrom.length > 0) {
|
|
175
|
+
console.log("\u2705 Uninstallation Complete!");
|
|
176
|
+
console.log("=".repeat(60));
|
|
177
|
+
console.log("\nUninstalled from:");
|
|
178
|
+
uninstalledFrom.forEach((target) => {
|
|
179
|
+
console.log(` \u2022 ${target}`);
|
|
180
|
+
});
|
|
181
|
+
} else {
|
|
182
|
+
console.log("\u2139\uFE0F Skill was not installed");
|
|
183
|
+
console.log("=".repeat(60));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
uninstallSkill();
|
|
188
|
+
} catch (error) {
|
|
189
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
190
|
+
console.error("\n\u26A0\uFE0F Warning during uninstall:", message);
|
|
191
|
+
}
|