skill-land 1.5.0 → 1.6.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/README.md +4 -0
- package/package.json +1 -1
- package/skill-land.mjs +99 -14
package/README.md
CHANGED
|
@@ -364,3 +364,7 @@ global install, which is what drives the warning note.
|
|
|
364
364
|
Install and verify only. No registry, no publishing, no per-platform content
|
|
365
365
|
transforms. One `SKILL.md` works across all of these agents; the failure mode here is
|
|
366
366
|
a wrong-path bug, not a content-format problem.
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
Made by [@magithar](https://x.com/magithar). Follow along for new skills and tools.
|
package/package.json
CHANGED
package/skill-land.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { execFileSync } from "child_process";
|
|
|
13
13
|
import { createHash } from "crypto";
|
|
14
14
|
import {
|
|
15
15
|
cpSync, existsSync, mkdirSync, mkdtempSync, readdirSync,
|
|
16
|
-
readFileSync, realpathSync, rmSync, statSync,
|
|
16
|
+
readFileSync, realpathSync, rmSync, statSync, writeFileSync,
|
|
17
17
|
} from "fs";
|
|
18
18
|
import { homedir, tmpdir } from "os";
|
|
19
19
|
import { basename, dirname, join, relative, resolve } from "path";
|
|
@@ -28,6 +28,17 @@ const fmtBytes = (n) => n < 1024 ? `${n} B`
|
|
|
28
28
|
: n < 1024 * 1024 ? `${(n / 1024).toFixed(1)} kB` : `${(n / 1024 / 1024).toFixed(1)} MB`;
|
|
29
29
|
const die = (msg) => { console.error(`\n error ${msg}\n`); process.exit(1); };
|
|
30
30
|
|
|
31
|
+
// Status words in color for a person at a terminal; piped output and tests get
|
|
32
|
+
// the plain text, so anything matching on "OK" or "FAIL" is unaffected.
|
|
33
|
+
const COLOR = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
34
|
+
const TRUECOLOR = /truecolor|24bit/i.test(process.env.COLORTERM || "");
|
|
35
|
+
const paintIf = (code) => (s) => COLOR ? `\x1b[${code}m${s}\x1b[0m` : s;
|
|
36
|
+
const emerald = paintIf(TRUECOLOR ? "38;2;89;195;120" : "38;5;78"); // brand emerald #59C378
|
|
37
|
+
const red = paintIf(TRUECOLOR ? "38;2;239;83;80" : "38;5;203");
|
|
38
|
+
const status = (ok) => ok ? emerald("OK ") : red("FAIL");
|
|
39
|
+
// Paths under the home directory read as ~/..., the way people type them.
|
|
40
|
+
const tilde = (p) => p === homedir() || p.startsWith(homedir() + "/") ? "~" + p.slice(homedir().length) : p;
|
|
41
|
+
|
|
31
42
|
// ---------------------------------------------------------------- source
|
|
32
43
|
|
|
33
44
|
// Accepts: owner/repo | https://github.com/owner/repo | raw .md URL | local path
|
|
@@ -377,7 +388,7 @@ function runSkill(skillPath, root, quiet) {
|
|
|
377
388
|
if (quiet) {
|
|
378
389
|
process.stdout.write(` ${(fm.name || basename(dirname(skillPath))).slice(0, 28).padEnd(30)}`);
|
|
379
390
|
} else {
|
|
380
|
-
console.log(`\n source ${src.label}`);
|
|
391
|
+
console.log(`\n source ${tilde(src.label)}`);
|
|
381
392
|
console.log(` skill ${fm.name || "(no frontmatter name)"} [${files.length} file${files.length === 1 ? "" : "s"}, ${fmtBytes(totalBytes)}, SKILL.md sha ${files[0].hash.slice(0,12)}]`);
|
|
382
393
|
console.log(` from ${skillPath.replace(root, ".")}`);
|
|
383
394
|
}
|
|
@@ -426,7 +437,7 @@ function runSkill(skillPath, root, quiet) {
|
|
|
426
437
|
targetCount++;
|
|
427
438
|
if (dryRun) {
|
|
428
439
|
if (quiet) continue;
|
|
429
|
-
console.log(` would write ${destDir} (${files.length} file${files.length === 1 ? "" : "s"}, ${fmtBytes(totalBytes)})`);
|
|
440
|
+
console.log(` would write ${tilde(destDir)} (${files.length} file${files.length === 1 ? "" : "s"}, ${fmtBytes(totalBytes)})`);
|
|
430
441
|
continue;
|
|
431
442
|
}
|
|
432
443
|
|
|
@@ -481,10 +492,10 @@ function runSkill(skillPath, root, quiet) {
|
|
|
481
492
|
// absent file buries the directories that are partially installed,
|
|
482
493
|
// which are the ones worth looking at.
|
|
483
494
|
if (r.absent) {
|
|
484
|
-
console.log(` FAIL ${r.destDir} not installed${verifyOnly ? " (verify only)" : ""}`);
|
|
495
|
+
console.log(` ${red("FAIL")} ${tilde(r.destDir)} not installed${verifyOnly ? " (verify only)" : ""}`);
|
|
485
496
|
continue;
|
|
486
497
|
}
|
|
487
|
-
console.log(` ${r.passed
|
|
498
|
+
console.log(` ${status(r.passed)} ${tilde(r.destDir)} ${n}/${files.length} file${files.length === 1 ? "" : "s"}${verifyOnly ? " (verify only)" : ""}`);
|
|
488
499
|
for (const b of r.badFiles.slice(0, 10)) {
|
|
489
500
|
console.log(` x ${b.rel}`);
|
|
490
501
|
for (const c of b.checks) if (!c.pass) console.log(` ${c.name}: ${c.detail}`);
|
|
@@ -507,11 +518,11 @@ function runSkill(skillPath, root, quiet) {
|
|
|
507
518
|
if (quiet) {
|
|
508
519
|
const nf = `${files.length} file${files.length === 1 ? "" : "s"}`;
|
|
509
520
|
if (dryRun) console.log(`-- ${targetCount} target${targetCount === 1 ? "" : "s"}, ${nf} (dry run)`);
|
|
510
|
-
else console.log(`${skillFailed
|
|
521
|
+
else console.log(`${status(!skillFailed)} ${nf}`);
|
|
511
522
|
// Per directory, not per file. Flattening 3 paths x 148 files into one list
|
|
512
523
|
// buries the only thing that is actionable: which directory is wrong, and how.
|
|
513
524
|
for (const b of baseSummaries.filter((x) => !x.passed)) {
|
|
514
|
-
console.log(` x ${b.destDir} ${b.absent ? "not installed" : `${b.n}/${files.length} files`}`);
|
|
525
|
+
console.log(` x ${tilde(b.destDir)} ${b.absent ? "not installed" : `${b.n}/${files.length} files`}`);
|
|
515
526
|
}
|
|
516
527
|
}
|
|
517
528
|
return { name: skillName, fmName: fm.name, failed: skillFailed, skipped: skillSkipped };
|
|
@@ -558,7 +569,7 @@ function discover(agent, names) {
|
|
|
558
569
|
const disabled = found && new RegExp(`(^|\\s)${n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")} \\[Disabled\\]`, "m").test(out);
|
|
559
570
|
const ok = found && !disabled;
|
|
560
571
|
if (!ok) missing++;
|
|
561
|
-
console.log(` ${ok
|
|
572
|
+
console.log(` ${status(ok)} ${n} ${disabled ? "listed but disabled" : found ? "listed" : "not in the skill list of a fresh session"}`);
|
|
562
573
|
}
|
|
563
574
|
if (!a.discover.deterministic)
|
|
564
575
|
console.log(` note ${a.display} has no plain skill listing; this asks the model, so treat a FAIL as a lead, not proof`);
|
|
@@ -567,10 +578,75 @@ function discover(agent, names) {
|
|
|
567
578
|
return missing;
|
|
568
579
|
}
|
|
569
580
|
|
|
581
|
+
// ---------------------------------------------------------------- first run
|
|
582
|
+
|
|
583
|
+
// Shown once per machine, only to a person at a terminal: piped output, CI logs
|
|
584
|
+
// and the test harness never see it. The marker lives beside nothing else we
|
|
585
|
+
// write, and failing to write it never fails an install.
|
|
586
|
+
// Capitals drawn as scanlines: each "▀" is a bar with a dark gap under it.
|
|
587
|
+
const WORDMARK = [
|
|
588
|
+
"▀▀▀▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀▀▀▀ ▀▀▀ ▀▀ ▀▀▀▀▀▀",
|
|
589
|
+
"▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀",
|
|
590
|
+
"▀▀▀▀▀▀▀ ▀▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀▀▀▀ ▀▀ ▀▀▀▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀",
|
|
591
|
+
" ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀",
|
|
592
|
+
"▀▀▀▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀▀▀ ▀▀▀▀▀▀",
|
|
593
|
+
];
|
|
594
|
+
|
|
595
|
+
function firstRunBanner() {
|
|
596
|
+
if (!process.stdout.isTTY || process.env.CI) return;
|
|
597
|
+
const dir = join(process.env.XDG_CONFIG_HOME || join(homedir(), ".config"), "skill-land");
|
|
598
|
+
const marker = join(dir, "welcomed");
|
|
599
|
+
if (existsSync(marker)) return;
|
|
600
|
+
try { mkdirSync(dir, { recursive: true }); writeFileSync(marker, new Date().toISOString() + "\n"); }
|
|
601
|
+
catch { return; } // can't remember we showed it, so don't show it on every run
|
|
602
|
+
const color = !process.env.NO_COLOR;
|
|
603
|
+
const fit = (process.stdout.columns || 80) >= 80;
|
|
604
|
+
// Rows fade from light mint at the top to brand emerald #59C378 at the bottom.
|
|
605
|
+
// Without 24-bit color (macOS Terminal sets no COLORTERM) the same fade uses
|
|
606
|
+
// the nearest 256-color steps, ending on 78 (#5FD787).
|
|
607
|
+
const truecolor = /truecolor|24bit/i.test(process.env.COLORTERM || "");
|
|
608
|
+
const TOP = [200, 245, 214], EMERALD = [89, 195, 120];
|
|
609
|
+
const FADE_256 = [194, 158, 121, 114, 78];
|
|
610
|
+
const shade = (r) => !truecolor ? `38;5;${FADE_256[r]}`
|
|
611
|
+
: "38;2;" + TOP.map((t, i) => Math.round(t + (EMERALD[i] - t) * r / (WORDMARK.length - 1))).join(";");
|
|
612
|
+
const paint = (code, s) => color ? `\x1b[${code}m${s}\x1b[0m` : s;
|
|
613
|
+
const green = (s) => paint(shade(WORDMARK.length - 1), s);
|
|
614
|
+
// Tagline in muted off-white (#B4B4AC; 256-color 249) so it reads on dark backgrounds.
|
|
615
|
+
const muted = (s) => paint(truecolor ? "38;2;180;180;172" : "38;5;249", s);
|
|
616
|
+
const dim = (s) => paint("2;" + shade(WORDMARK.length - 1), s);
|
|
617
|
+
const { version } = JSON.parse(readFileSync(join(HERE, "package.json"), "utf-8"));
|
|
618
|
+
console.log();
|
|
619
|
+
if (fit) WORDMARK.forEach((row, r) => console.log(" " + paint(shade(r), row)));
|
|
620
|
+
else console.log(" " + green("SKILL-LAND"));
|
|
621
|
+
console.log("\n " + muted("install skills · where they belong · ") + dim(`v${version}`));
|
|
622
|
+
// Full https:// URL so every terminal, macOS Terminal included, makes it clickable.
|
|
623
|
+
console.log("\n " + muted("made by ") + green("magithar"));
|
|
624
|
+
console.log(" " + muted("contact ") + green("https://x.com/magithar"));
|
|
625
|
+
}
|
|
626
|
+
|
|
570
627
|
// ---------------------------------------------------------------- main
|
|
571
628
|
|
|
572
629
|
const argv = process.argv.slice(2);
|
|
573
|
-
|
|
630
|
+
firstRunBanner();
|
|
631
|
+
// Bare `skill-land` is what a newcomer types first: show the three commands that
|
|
632
|
+
// matter, not the whole option reference.
|
|
633
|
+
if (!argv.length) {
|
|
634
|
+
console.log(`
|
|
635
|
+
Get started
|
|
636
|
+
|
|
637
|
+
1. Pick your agent skill-land --list
|
|
638
|
+
2. Install a skill skill-land owner/repo --for claude-code
|
|
639
|
+
3. Check it landed skill-land owner/repo --for claude-code --verify
|
|
640
|
+
|
|
641
|
+
Every file is copied, then read back. If anything didn't land,
|
|
642
|
+
skill-land says so and exits with an error.
|
|
643
|
+
|
|
644
|
+
All options: skill-land --help
|
|
645
|
+
`);
|
|
646
|
+
process.exit(0);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
if (argv.includes("-h") || argv.includes("--help")) {
|
|
574
650
|
console.log(`
|
|
575
651
|
skill-land <source> --for <agent> [options]
|
|
576
652
|
|
|
@@ -597,12 +673,13 @@ if (!argv.length || argv.includes("-h") || argv.includes("--help")) {
|
|
|
597
673
|
}
|
|
598
674
|
|
|
599
675
|
if (argv.includes("--list")) {
|
|
600
|
-
console.log("\n agent directory
|
|
676
|
+
console.log("\n agent skills directory npx skills");
|
|
601
677
|
console.log(" " + "-".repeat(70));
|
|
602
678
|
for (const [k, a] of Object.entries(AGENTS)) {
|
|
603
|
-
console.log(` ${k.padEnd(17)} ${a.global.padEnd(38)} ${a.broken ? "
|
|
679
|
+
console.log(` ${k.padEnd(17)} ${a.global.padEnd(38)} ${a.broken ? "wrong dir" : "ok"}`);
|
|
604
680
|
}
|
|
605
|
-
console.log();
|
|
681
|
+
console.log("\n wrong dir `npx skills add -a <agent> -g` writes to ~/.agents/skills, which");
|
|
682
|
+
console.log(" this agent never reads. skill-land installs to the directory above.\n");
|
|
606
683
|
process.exit(0);
|
|
607
684
|
}
|
|
608
685
|
|
|
@@ -677,7 +754,15 @@ if (discoverFlag && !dryRun) {
|
|
|
677
754
|
}
|
|
678
755
|
|
|
679
756
|
if (failed) {
|
|
680
|
-
console.error(` ${failed} install(s) failed verification\n`);
|
|
757
|
+
console.error(` ${red(`✗ ${failed} install(s) failed verification`)}\n`);
|
|
681
758
|
process.exit(1);
|
|
682
759
|
}
|
|
683
|
-
|
|
760
|
+
// Close on the outcome in plain words: what is ready, and for which agent.
|
|
761
|
+
if (!dryRun) {
|
|
762
|
+
const verdict = verifyOnly ? "verified existing install" : "verified";
|
|
763
|
+
const who = targets.map((t) => AGENTS[t].display).join(", ");
|
|
764
|
+
const what = landed.length === 1 ? `${landed[0]} is` : `${landed.length} skills are`;
|
|
765
|
+
console.log(landed.length
|
|
766
|
+
? ` ${emerald(`✓ ${verdict}`)} ${what} ${verifyOnly ? "installed" : "ready"} for ${who}\n`
|
|
767
|
+
: ` ${verdict}\n`);
|
|
768
|
+
}
|