skill-land 1.6.0 → 1.7.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 +20 -0
- package/package.json +1 -1
- package/skill-land.mjs +43 -3
package/README.md
CHANGED
|
@@ -134,6 +134,21 @@ Where an agent has several directories it reads, `--verify` counts the skill as
|
|
|
134
134
|
it is **complete in any one of them**. Requiring every fallback to hold a copy reports
|
|
135
135
|
working installs as broken.
|
|
136
136
|
|
|
137
|
+
### Leftover files
|
|
138
|
+
|
|
139
|
+
Installing copies over the top and never deletes, so a file dropped from a skill stays on disk
|
|
140
|
+
after a reinstall. `--verify` lists anything in the installed directory that the source does not
|
|
141
|
+
have:
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
OK ~/.codex/skills/pack 3/3 files (verify only)
|
|
145
|
+
WARN ~/.codex/skills/pack 1 leftover file not in the source: scripts/old.sh
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
This is a warning and does not change the exit code, because an installed directory can also hold
|
|
149
|
+
files a person or the agent added, and nothing here can tell those from stale ones. `skill-land`
|
|
150
|
+
never deletes them. It is skipped for a raw `.md` source, which only knows about `SKILL.md`.
|
|
151
|
+
|
|
137
152
|
### Does the agent actually load it? `--discover`
|
|
138
153
|
|
|
139
154
|
Everything above proves the bytes are on disk. It does not prove the agent loads them: it may
|
|
@@ -167,6 +182,11 @@ Verification assumes the installer **copied**. Some installers **rewrite** on in
|
|
|
167
182
|
still report `content matches source` failures, because they genuinely differ from the source.
|
|
168
183
|
`skill-land` reports the difference and does not guess which side is right.
|
|
169
184
|
|
|
185
|
+
**Renamed and removed skills are not detected.** `skill-land` keeps no record of what it installed,
|
|
186
|
+
and the install directory comes from the skill's `name`. After a rename the old directory stays
|
|
187
|
+
next to the new one, and `--verify` only looks at the new one. A skill removed from its source is
|
|
188
|
+
never looked at. There is no uninstall command, so delete the old directory by hand.
|
|
189
|
+
|
|
170
190
|
Tested against: truncated file, wrong skill in the right place, missing file,
|
|
171
191
|
unwritable destination, and a real `npx skills add` install (correctly reported FAIL).
|
|
172
192
|
|
package/package.json
CHANGED
package/skill-land.mjs
CHANGED
|
@@ -35,6 +35,7 @@ const TRUECOLOR = /truecolor|24bit/i.test(process.env.COLORTERM || "");
|
|
|
35
35
|
const paintIf = (code) => (s) => COLOR ? `\x1b[${code}m${s}\x1b[0m` : s;
|
|
36
36
|
const emerald = paintIf(TRUECOLOR ? "38;2;89;195;120" : "38;5;78"); // brand emerald #59C378
|
|
37
37
|
const red = paintIf(TRUECOLOR ? "38;2;239;83;80" : "38;5;203");
|
|
38
|
+
const amber = paintIf(TRUECOLOR ? "38;2;230;170;60" : "38;5;179");
|
|
38
39
|
const status = (ok) => ok ? emerald("OK ") : red("FAIL");
|
|
39
40
|
// Paths under the home directory read as ~/..., the way people type them.
|
|
40
41
|
const tilde = (p) => p === homedir() || p.startsWith(homedir() + "/") ? "~" + p.slice(homedir().length) : p;
|
|
@@ -339,6 +340,26 @@ function verify(target, expected) {
|
|
|
339
340
|
return checks;
|
|
340
341
|
}
|
|
341
342
|
|
|
343
|
+
// Reading back the source's files cannot see a file the source no longer has:
|
|
344
|
+
// reinstalling copies over the top and never deletes, so a script dropped from a
|
|
345
|
+
// skill stays on disk and the install still reads as verified.
|
|
346
|
+
//
|
|
347
|
+
// A warning, not a failure, and never a delete: an installed directory can hold
|
|
348
|
+
// files a person or the agent added, and nothing here can tell those from stale
|
|
349
|
+
// ones. A raw .md source knows only SKILL.md, so it cannot judge the rest at all.
|
|
350
|
+
function findLeftovers(destDir, files) {
|
|
351
|
+
if (src.kind === "raw") return [];
|
|
352
|
+
const known = new Set(files.map((f) => f.rel));
|
|
353
|
+
return collectSkillFiles(destDir, "SKILL.md").filter((rel) => !known.has(rel));
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// Names the files as well as the count: a warning you have to re-run to act on
|
|
357
|
+
// is not much of a warning.
|
|
358
|
+
function leftoverLine(destDir, extras) {
|
|
359
|
+
const more = extras.length > 3 ? ` +${extras.length - 3} more` : "";
|
|
360
|
+
return `${tilde(destDir)} ${extras.length} leftover file${extras.length === 1 ? "" : "s"} not in the source: ${extras.slice(0, 3).join(", ")}${more}`;
|
|
361
|
+
}
|
|
362
|
+
|
|
342
363
|
// ---------------------------------------------------------------- per skill
|
|
343
364
|
|
|
344
365
|
// One skill, every target path: scan, disclose, write, read back. Factored out
|
|
@@ -467,8 +488,9 @@ function runSkill(skillPath, root, quiet) {
|
|
|
467
488
|
|
|
468
489
|
const absent = badFiles.length === files.length
|
|
469
490
|
&& badFiles.every((b) => b.checks.some((c) => c.name === "file exists" && !c.pass));
|
|
470
|
-
|
|
471
|
-
|
|
491
|
+
const extras = verifyOnly ? findLeftovers(destDir, files) : [];
|
|
492
|
+
baseResults.push({ destDir, badFiles, passed: badFiles.length === 0, absent, extras });
|
|
493
|
+
baseSummaries.push({ destDir, passed: badFiles.length === 0, absent, extras,
|
|
472
494
|
n: files.length - badFiles.length });
|
|
473
495
|
}
|
|
474
496
|
|
|
@@ -488,11 +510,15 @@ function runSkill(skillPath, root, quiet) {
|
|
|
488
510
|
if (!quiet) {
|
|
489
511
|
for (const r of baseResults) {
|
|
490
512
|
const n = files.length - r.badFiles.length;
|
|
513
|
+
const warnLeftovers = () => {
|
|
514
|
+
if (r.extras.length) console.log(` ${amber("WARN")} ${leftoverLine(r.destDir, r.extras)}`);
|
|
515
|
+
};
|
|
491
516
|
// Nothing present at all is one fact, not N failures. Listing every
|
|
492
517
|
// absent file buries the directories that are partially installed,
|
|
493
518
|
// which are the ones worth looking at.
|
|
494
519
|
if (r.absent) {
|
|
495
520
|
console.log(` ${red("FAIL")} ${tilde(r.destDir)} not installed${verifyOnly ? " (verify only)" : ""}`);
|
|
521
|
+
warnLeftovers();
|
|
496
522
|
continue;
|
|
497
523
|
}
|
|
498
524
|
console.log(` ${status(r.passed)} ${tilde(r.destDir)} ${n}/${files.length} file${files.length === 1 ? "" : "s"}${verifyOnly ? " (verify only)" : ""}`);
|
|
@@ -501,6 +527,7 @@ function runSkill(skillPath, root, quiet) {
|
|
|
501
527
|
for (const c of b.checks) if (!c.pass) console.log(` ${c.name}: ${c.detail}`);
|
|
502
528
|
}
|
|
503
529
|
if (r.badFiles.length > 10) console.log(` ... and ${r.badFiles.length - 10} more file(s)`);
|
|
530
|
+
warnLeftovers();
|
|
504
531
|
}
|
|
505
532
|
if (verifyOnly && agentPassed && baseResults.some((r) => !r.passed))
|
|
506
533
|
console.log(` note complete in at least one directory ${a.display} reads; that is an install`);
|
|
@@ -524,8 +551,12 @@ function runSkill(skillPath, root, quiet) {
|
|
|
524
551
|
for (const b of baseSummaries.filter((x) => !x.passed)) {
|
|
525
552
|
console.log(` x ${tilde(b.destDir)} ${b.absent ? "not installed" : `${b.n}/${files.length} files`}`);
|
|
526
553
|
}
|
|
554
|
+
for (const b of baseSummaries.filter((x) => x.extras.length)) {
|
|
555
|
+
console.log(` ! ${leftoverLine(b.destDir, b.extras)}`);
|
|
556
|
+
}
|
|
527
557
|
}
|
|
528
|
-
|
|
558
|
+
const leftovers = baseSummaries.reduce((n, b) => n + b.extras.length, 0);
|
|
559
|
+
return { name: skillName, fmName: fm.name, failed: skillFailed, skipped: skillSkipped, leftovers };
|
|
529
560
|
}
|
|
530
561
|
|
|
531
562
|
// ---------------------------------------------------------------- discover
|
|
@@ -713,6 +744,7 @@ if (allSkills && values("--skill").length)
|
|
|
713
744
|
const src = resolveSource(source);
|
|
714
745
|
const tmp = mkdtempSync(join(tmpdir(), "skill-install-"));
|
|
715
746
|
let failed = 0;
|
|
747
|
+
let leftovers = 0;
|
|
716
748
|
const skipped = [];
|
|
717
749
|
const landed = [];
|
|
718
750
|
|
|
@@ -728,6 +760,7 @@ try {
|
|
|
728
760
|
for (const skillPath of skillPaths) {
|
|
729
761
|
const r = runSkill(skillPath, root, quiet);
|
|
730
762
|
failed += r.failed;
|
|
763
|
+
leftovers += r.leftovers || 0;
|
|
731
764
|
if (r.skipped) skipped.push(r.name);
|
|
732
765
|
else if (!r.failed) landed.push(r.fmName || r.name);
|
|
733
766
|
}
|
|
@@ -753,6 +786,13 @@ if (discoverFlag && !dryRun) {
|
|
|
753
786
|
}
|
|
754
787
|
}
|
|
755
788
|
|
|
789
|
+
// Printed before the verdict so a green "verified" is not the last word on a
|
|
790
|
+
// directory that holds more than the source does.
|
|
791
|
+
if (leftovers) {
|
|
792
|
+
console.log(` ${amber("warn")} ${leftovers} leftover file${leftovers === 1 ? "" : "s"} not in the source. They may be stale, or added by you or the agent.`);
|
|
793
|
+
console.log(` The agent can still read them. Nothing was removed; review and delete by hand.\n`);
|
|
794
|
+
}
|
|
795
|
+
|
|
756
796
|
if (failed) {
|
|
757
797
|
console.error(` ${red(`✗ ${failed} install(s) failed verification`)}\n`);
|
|
758
798
|
process.exit(1);
|