@sysvv/ai-skill 1.6.1 → 1.6.2
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/dist/index.js +29 -68
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { fileURLToPath } from "node:url";
|
|
|
7
7
|
import { findSkillFiles } from "./core/registry.js";
|
|
8
8
|
import { parseSkillFile } from "./core/frontmatter.js";
|
|
9
9
|
import { loadSkill } from "./core/skill.js";
|
|
10
|
-
import { loadMcp, writeMcp
|
|
10
|
+
import { loadMcp, writeMcp } from "./core/mcp.js";
|
|
11
11
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
12
12
|
// ── ANSI ────────────────────────────────────────────────────────────────
|
|
13
13
|
const ANSI = {
|
|
@@ -173,74 +173,43 @@ async function installSkills(agent) {
|
|
|
173
173
|
console.log(`\n Skills instaladas em ${ANSI.bold}${destBase}/${ANSI.reset}\n`);
|
|
174
174
|
}
|
|
175
175
|
// ── Clear ───────────────────────────────────────────────────────────────
|
|
176
|
+
/** Todas as pastas/arquivos que o CLI pode criar, por agent */
|
|
177
|
+
const AGENT_ROOTS = {
|
|
178
|
+
claude: [".claude", ".mcp.json"],
|
|
179
|
+
codex: [".codex"],
|
|
180
|
+
gemini: [".gemini"],
|
|
181
|
+
copilot: [".github", ".vscode"],
|
|
182
|
+
};
|
|
176
183
|
async function clearFlow() {
|
|
177
184
|
// Descobre o que existe
|
|
178
|
-
const
|
|
179
|
-
const
|
|
180
|
-
for (const [agent,
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
if (await fs.pathExists(mcpFull)) {
|
|
189
|
-
foundMcps.push({ agent, file: mcpFull });
|
|
185
|
+
const found = [];
|
|
186
|
+
const seen = new Set();
|
|
187
|
+
for (const [agent, paths] of Object.entries(AGENT_ROOTS)) {
|
|
188
|
+
for (const p of paths) {
|
|
189
|
+
if (seen.has(p))
|
|
190
|
+
continue;
|
|
191
|
+
seen.add(p);
|
|
192
|
+
const full = path.resolve(p);
|
|
193
|
+
if (await fs.pathExists(full)) {
|
|
194
|
+
found.push({ label: `${agent} → ${p}`, fullPath: full });
|
|
190
195
|
}
|
|
191
196
|
}
|
|
192
197
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (!hasSkills && !hasMcps) {
|
|
196
|
-
console.log(" Nenhuma skill ou MCP instalado.\n");
|
|
198
|
+
if (found.length === 0) {
|
|
199
|
+
console.log(" Nenhuma pasta ou arquivo de agent encontrado.\n");
|
|
197
200
|
return;
|
|
198
201
|
}
|
|
199
|
-
// Mostra o que
|
|
200
|
-
console.log(` ${RED}⚠${ANSI.reset}
|
|
201
|
-
|
|
202
|
-
console.log(` ${ANSI.
|
|
203
|
-
for (const s of foundSkills) {
|
|
204
|
-
console.log(` ${ANSI.dim}${s.dir}${ANSI.reset}`);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
if (hasMcps) {
|
|
208
|
-
if (hasSkills)
|
|
209
|
-
console.log('');
|
|
210
|
-
console.log(` ${ANSI.bold}MCPs${ANSI.reset}`);
|
|
211
|
-
for (const m of foundMcps) {
|
|
212
|
-
console.log(` ${ANSI.dim}${m.file}${ANSI.reset}`);
|
|
213
|
-
}
|
|
202
|
+
// Mostra o que vai ser removido
|
|
203
|
+
console.log(` ${RED}⚠${ANSI.reset} Será removido:\n`);
|
|
204
|
+
for (const f of found) {
|
|
205
|
+
console.log(` ${RED}✖${ANSI.reset} ${ANSI.dim}${f.fullPath}${ANSI.reset}`);
|
|
214
206
|
}
|
|
215
207
|
console.log('');
|
|
216
|
-
const choices = [];
|
|
217
|
-
if (hasSkills && hasMcps) {
|
|
218
|
-
choices.push({ name: `${RED}Tudo${ANSI.reset} ${ANSI.dim}(skills + MCPs)${ANSI.reset}`, value: "all" }, { name: `Apenas Skills`, value: "skills" }, { name: `Apenas MCPs`, value: "mcps" });
|
|
219
|
-
}
|
|
220
|
-
else if (hasSkills) {
|
|
221
|
-
choices.push({ name: `Apagar Skills`, value: "skills" });
|
|
222
|
-
}
|
|
223
|
-
else {
|
|
224
|
-
choices.push({ name: `Apagar MCPs`, value: "mcps" });
|
|
225
|
-
}
|
|
226
|
-
const { action } = await inquirer.prompt([
|
|
227
|
-
{
|
|
228
|
-
type: "list",
|
|
229
|
-
name: "action",
|
|
230
|
-
message: "O que deseja remover?",
|
|
231
|
-
choices,
|
|
232
|
-
theme: sysTheme
|
|
233
|
-
}
|
|
234
|
-
]);
|
|
235
|
-
const removeSkills = action === "all" || action === "skills";
|
|
236
|
-
const removeMcps = action === "all" || action === "mcps";
|
|
237
|
-
// Confirmação
|
|
238
|
-
const target = action === "all" ? "skills e MCPs" : action === "skills" ? "skills" : "MCPs";
|
|
239
208
|
const { confirm } = await inquirer.prompt([
|
|
240
209
|
{
|
|
241
210
|
type: "confirm",
|
|
242
211
|
name: "confirm",
|
|
243
|
-
message:
|
|
212
|
+
message: "Confirma a remoção de TUDO?",
|
|
244
213
|
default: false,
|
|
245
214
|
theme: sysTheme
|
|
246
215
|
}
|
|
@@ -250,19 +219,11 @@ async function clearFlow() {
|
|
|
250
219
|
return;
|
|
251
220
|
}
|
|
252
221
|
console.log('');
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
console.log(` ${RED}✖${ANSI.reset} ${ANSI.dim}${s.dir}${ANSI.reset}`);
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
if (removeMcps) {
|
|
260
|
-
for (const m of foundMcps) {
|
|
261
|
-
await fs.remove(m.file);
|
|
262
|
-
console.log(` ${RED}✖${ANSI.reset} ${ANSI.dim}${m.file}${ANSI.reset}`);
|
|
263
|
-
}
|
|
222
|
+
for (const f of found) {
|
|
223
|
+
await fs.remove(f.fullPath);
|
|
224
|
+
console.log(` ${RED}✖${ANSI.reset} ${ANSI.dim}${f.fullPath}${ANSI.reset} removido`);
|
|
264
225
|
}
|
|
265
|
-
console.log("\n
|
|
226
|
+
console.log("\n Projeto limpo.\n");
|
|
266
227
|
}
|
|
267
228
|
// ── Main ────────────────────────────────────────────────────────────────
|
|
268
229
|
async function main() {
|