findskill 0.1.1 → 0.1.3
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 +56 -16
- package/package.json +11 -3
package/dist/index.js
CHANGED
|
@@ -11320,11 +11320,11 @@ function getInstalledSkills(skillsDir) {
|
|
|
11320
11320
|
const dir = getSkillsDir(skillsDir);
|
|
11321
11321
|
if (!existsSync(dir))
|
|
11322
11322
|
return [];
|
|
11323
|
-
return readdirSync(dir).filter((f4) => f4.
|
|
11323
|
+
return readdirSync(dir, { withFileTypes: true }).filter((f4) => f4.isDirectory() && existsSync(join(dir, f4.name, "SKILL.md"))).map((f4) => f4.name);
|
|
11324
11324
|
}
|
|
11325
11325
|
function isSkillInstalled(name, skillsDir) {
|
|
11326
11326
|
const dir = getSkillsDir(skillsDir);
|
|
11327
|
-
return existsSync(join(dir,
|
|
11327
|
+
return existsSync(join(dir, name, "SKILL.md"));
|
|
11328
11328
|
}
|
|
11329
11329
|
|
|
11330
11330
|
// src/commands/search.ts
|
|
@@ -11383,27 +11383,61 @@ var infoCommand = new Command("info").description("Show detailed information abo
|
|
|
11383
11383
|
|
|
11384
11384
|
// src/commands/install.ts
|
|
11385
11385
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
11386
|
-
import {
|
|
11386
|
+
import { execSync } from "child_process";
|
|
11387
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, cpSync, rmSync } from "fs";
|
|
11387
11388
|
import { join as join2 } from "path";
|
|
11389
|
+
import { tmpdir } from "os";
|
|
11390
|
+
function parseGitHubUrl(url) {
|
|
11391
|
+
const match = url.match(/github\.com\/([^/]+)\/([^/]+)\/(blob|tree)\/([^/]+)\/(.+)/);
|
|
11392
|
+
if (!match)
|
|
11393
|
+
return null;
|
|
11394
|
+
const [, owner, repo, , branch, path] = match;
|
|
11395
|
+
return {
|
|
11396
|
+
repoUrl: `https://github.com/${owner}/${repo}.git`,
|
|
11397
|
+
branch,
|
|
11398
|
+
path
|
|
11399
|
+
};
|
|
11400
|
+
}
|
|
11388
11401
|
var installCommand = new Command("install").description("Install a skill to your skills directory").argument("<name>", "Skill name or ID").option("--path <path>", "Custom skills directory").option("-f, --force", "Overwrite if already installed").action(async (name, options) => {
|
|
11389
11402
|
const skillsDir = getSkillsDir(options.path);
|
|
11390
11403
|
const spinner = ora("Fetching skill...").start();
|
|
11391
11404
|
try {
|
|
11392
11405
|
const skill = await getSkill(name);
|
|
11406
|
+
const destDir = join2(skillsDir, skill.name);
|
|
11393
11407
|
if (isSkillInstalled(skill.name, options.path) && !options.force) {
|
|
11394
11408
|
spinner.stop();
|
|
11395
11409
|
consola.warn(`Skill "${skill.name}" is already installed. Use --force to overwrite.`);
|
|
11396
11410
|
return;
|
|
11397
11411
|
}
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
|
|
11412
|
+
const parsed = parseGitHubUrl(skill.github_url);
|
|
11413
|
+
if (!parsed) {
|
|
11414
|
+
spinner.stop();
|
|
11415
|
+
consola.error("Invalid GitHub URL format");
|
|
11416
|
+
process.exit(1);
|
|
11417
|
+
}
|
|
11418
|
+
spinner.text = "Cloning skill folder...";
|
|
11419
|
+
const tempDir = join2(tmpdir(), `findskill-${Date.now()}`);
|
|
11420
|
+
mkdirSync2(tempDir, { recursive: true });
|
|
11421
|
+
try {
|
|
11422
|
+
execSync(`git clone --filter=blob:none --sparse --branch ${parsed.branch} --depth 1 ${parsed.repoUrl} .`, { cwd: tempDir, stdio: "pipe" });
|
|
11423
|
+
execSync(`git sparse-checkout set ${parsed.path}`, { cwd: tempDir, stdio: "pipe" });
|
|
11424
|
+
const sourceDir = join2(tempDir, parsed.path);
|
|
11425
|
+
if (!existsSync2(sourceDir)) {
|
|
11426
|
+
throw new Error("Skill folder not found in repository");
|
|
11427
|
+
}
|
|
11428
|
+
if (existsSync2(destDir) && options.force) {
|
|
11429
|
+
rmSync(destDir, { recursive: true });
|
|
11430
|
+
}
|
|
11431
|
+
mkdirSync2(destDir, { recursive: true });
|
|
11432
|
+
cpSync(sourceDir, destDir, { recursive: true });
|
|
11433
|
+
spinner.stop();
|
|
11434
|
+
console.log("");
|
|
11435
|
+
console.log(import_picocolors4.default.green(` ✓ Installed ${import_picocolors4.default.bold(skill.name)}`));
|
|
11436
|
+
console.log(import_picocolors4.default.dim(` ${destDir}`));
|
|
11437
|
+
console.log("");
|
|
11438
|
+
} finally {
|
|
11439
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
11440
|
+
}
|
|
11407
11441
|
} catch (error) {
|
|
11408
11442
|
spinner.stop();
|
|
11409
11443
|
consola.error("Install failed:", error instanceof Error ? error.message : "Unknown error");
|
|
@@ -11435,7 +11469,7 @@ var listCommand = new Command("list").description("List installed skills").optio
|
|
|
11435
11469
|
|
|
11436
11470
|
// src/commands/update.ts
|
|
11437
11471
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
11438
|
-
import { writeFileSync
|
|
11472
|
+
import { writeFileSync } from "fs";
|
|
11439
11473
|
import { join as join3 } from "path";
|
|
11440
11474
|
var updateCommand = new Command("update").description("Update installed skills to latest versions").argument("[name]", "Specific skill to update (optional)").option("--path <path>", "Custom skills directory").action(async (name, options) => {
|
|
11441
11475
|
const skillsDir = getSkillsDir(options.path);
|
|
@@ -11455,7 +11489,7 @@ var updateCommand = new Command("update").description("Update installed skills t
|
|
|
11455
11489
|
const skill = await getSkill(skillName);
|
|
11456
11490
|
const content = await getSkillContent(skillName);
|
|
11457
11491
|
const filePath = join3(skillsDir, `${skill.name}.md`);
|
|
11458
|
-
|
|
11492
|
+
writeFileSync(filePath, content);
|
|
11459
11493
|
spinner.succeed(import_picocolors6.default.green(` Updated ${skillName}`));
|
|
11460
11494
|
updated++;
|
|
11461
11495
|
} catch (error) {
|
|
@@ -11475,7 +11509,7 @@ var updateCommand = new Command("update").description("Update installed skills t
|
|
|
11475
11509
|
|
|
11476
11510
|
// src/commands/submit.ts
|
|
11477
11511
|
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
11478
|
-
var submitCommand = new Command("submit").description("Submit a new skill from a GitHub URL").argument("<github-url>", "GitHub URL to a
|
|
11512
|
+
var submitCommand = new Command("submit").description("Submit a new skill from a GitHub URL").argument("<github-url>", "GitHub URL to a SKILL.md file").action(async (githubUrl) => {
|
|
11479
11513
|
if (!githubUrl.includes("github.com") && !githubUrl.includes("gist.github")) {
|
|
11480
11514
|
consola.error("Please provide a valid GitHub or Gist URL.");
|
|
11481
11515
|
process.exit(1);
|
|
@@ -11497,12 +11531,18 @@ var submitCommand = new Command("submit").description("Submit a new skill from a
|
|
|
11497
11531
|
|
|
11498
11532
|
// src/index.ts
|
|
11499
11533
|
var program2 = new Command;
|
|
11500
|
-
program2.name("findskill").description("CLI for discovering and installing
|
|
11534
|
+
program2.name("findskill").description("CLI for discovering and installing SKILL.md format skills").version("0.1.0").addCommand(searchCommand).addCommand(infoCommand).addCommand(installCommand).addCommand(listCommand).addCommand(updateCommand).addCommand(submitCommand);
|
|
11501
11535
|
program2.action(() => {
|
|
11502
11536
|
console.log("");
|
|
11503
11537
|
console.log(import_picocolors8.default.bold(import_picocolors8.default.cyan(" findskill.md")));
|
|
11504
11538
|
console.log(import_picocolors8.default.dim(" Discover and install skills for Claude"));
|
|
11505
11539
|
console.log("");
|
|
11506
11540
|
program2.outputHelp();
|
|
11541
|
+
console.log("");
|
|
11542
|
+
console.log(import_picocolors8.default.yellow(" Tip:"), "Install the", import_picocolors8.default.cyan("use-findskill"), "skill to teach your agent to");
|
|
11543
|
+
console.log(" automatically search for skills when it encounters new problems.");
|
|
11544
|
+
console.log("");
|
|
11545
|
+
console.log(import_picocolors8.default.dim(" npx findskill install use-findskill"));
|
|
11546
|
+
console.log("");
|
|
11507
11547
|
});
|
|
11508
11548
|
program2.parse();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "findskill",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "CLI for discovering and installing
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "CLI for discovering and installing SKILL.md format skills",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"findskill": "./dist/index.js"
|
|
@@ -26,7 +26,15 @@
|
|
|
26
26
|
"@types/bun": "^1.1.6",
|
|
27
27
|
"typescript": "^5.5.0"
|
|
28
28
|
},
|
|
29
|
-
"keywords": [
|
|
29
|
+
"keywords": [
|
|
30
|
+
"skill",
|
|
31
|
+
"cli",
|
|
32
|
+
"claude",
|
|
33
|
+
"ai",
|
|
34
|
+
"skills",
|
|
35
|
+
"findskill",
|
|
36
|
+
"SKILL.md"
|
|
37
|
+
],
|
|
30
38
|
"author": "alentodorov",
|
|
31
39
|
"license": "MIT",
|
|
32
40
|
"repository": {
|