@petersobhy/ai-toolkit 1.8.4 → 1.9.0
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/index.js +16 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -79,9 +79,8 @@ async function installSkill(name) {
|
|
|
79
79
|
const skillContent = await get(`${RAW_BASE}/${SKILLS_PATH}/${name}/SKILL.md`);
|
|
80
80
|
fs.mkdirSync(INSTALL_DIR, { recursive: true });
|
|
81
81
|
fs.writeFileSync(path.join(INSTALL_DIR, `${name}.md`), skillContent);
|
|
82
|
-
console.log(` ✓ ${name}.md → ${INSTALL_DIR}`);
|
|
83
82
|
|
|
84
|
-
// Install companion scripts → ~/.
|
|
83
|
+
// Install companion scripts → ~/.ai-toolkit/scripts/<name>/
|
|
85
84
|
const scripts = entries.filter(e =>
|
|
86
85
|
e.type === 'file' &&
|
|
87
86
|
e.name !== 'SKILL.md' &&
|
|
@@ -94,13 +93,23 @@ async function installSkill(name) {
|
|
|
94
93
|
for (const script of scripts) {
|
|
95
94
|
const content = await get(`${RAW_BASE}/${SKILLS_PATH}/${name}/${script.name}`);
|
|
96
95
|
fs.writeFileSync(path.join(scriptDir, script.name), content);
|
|
97
|
-
console.log(` ✓ ${script.name} → ${scriptDir}`);
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
98
|
|
|
99
|
+
console.log(` ✓ ${name}`);
|
|
101
100
|
return true;
|
|
102
101
|
}
|
|
103
102
|
|
|
103
|
+
function printSetupHints(names, manifest) {
|
|
104
|
+
const hints = names.map(n => [n, manifest[n]?.setupHint]).filter(([, h]) => h);
|
|
105
|
+
if (hints.length === 0) return;
|
|
106
|
+
const pad = Math.max(...hints.map(([n]) => n.length));
|
|
107
|
+
console.log('\nSetup required:');
|
|
108
|
+
for (const [name, hint] of hints) {
|
|
109
|
+
console.log(` ${name.padEnd(pad)} → ${hint}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
104
113
|
async function cmdAdd(args) {
|
|
105
114
|
const all = args.includes('--all');
|
|
106
115
|
const names = all ? await listAvailable() : args.filter(a => !a.startsWith('-'));
|
|
@@ -111,8 +120,10 @@ async function cmdAdd(args) {
|
|
|
111
120
|
process.exit(1);
|
|
112
121
|
}
|
|
113
122
|
|
|
123
|
+
const manifest = await fetchManifest();
|
|
114
124
|
console.log(all ? `Installing all ${names.length} skills...\n` : `Installing ${names.length} skill(s)...\n`);
|
|
115
125
|
for (const name of names) await installSkill(name);
|
|
126
|
+
printSetupHints(names, manifest);
|
|
116
127
|
console.log('\nRestart Claude Code to activate installed skills.');
|
|
117
128
|
}
|
|
118
129
|
|
|
@@ -122,8 +133,10 @@ async function cmdUpdate() {
|
|
|
122
133
|
console.log('No skills installed. Run: ai-toolkit add --all');
|
|
123
134
|
return;
|
|
124
135
|
}
|
|
136
|
+
const manifest = await fetchManifest();
|
|
125
137
|
console.log(`Updating ${installed.length} installed skill(s)...\n`);
|
|
126
138
|
for (const name of installed) await installSkill(name);
|
|
139
|
+
printSetupHints(installed, manifest);
|
|
127
140
|
console.log('\nRestart Claude Code to activate updated skills.');
|
|
128
141
|
}
|
|
129
142
|
|