agent-skill-manager 1.21.0 → 2.0.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.
@@ -11,5 +11,5 @@ import{O as T,U as D}from"./chunk-a26gjzjk.js";import{readdir as M,stat as W,lst
11
11
  `)}var Gz=new Set(["Bash","Write","Edit","NotebookEdit"]),gz=new Set(["WebFetch","WebSearch"]);function kz(z){if(Gz.has(z))return B.red(z);if(gz.has(z))return B.yellow(z);return B.green(z)}function Bz(z){if(z.length===0)return"";return z.map(kz).join(" ")}function Hz(z){let Y=z.filter((Z)=>Gz.has(Z));if(Y.length===0)return null;let $=[];if(Y.includes("Bash"))$.push("execute shell commands");if(Y.includes("Write")||Y.includes("Edit")||Y.includes("NotebookEdit"))$.push("modify files");return`This skill can ${$.join(" and ")}`}async function mz(z){let Y=[],$=(J,X)=>`${K()?B.bold(J+":"):J+":"} ${X}`;if(Y.push($("Name",z.name)),Y.push($("Version",z.version)),Y.push($("Creator",z.creator||"—")),Y.push($("License",z.license||"—")),z.compatibility)Y.push($("Compatibility",z.compatibility));if(z.effort)Y.push($("Effort",k(z.effort)));if(Y.push($("Tool",z.providerLabel)),Y.push($("Scope",z.scope)),Y.push($("Location",z.location)),Y.push($("Path",C(z.path))),Y.push($("Type",z.isSymlink?"symlink":"directory")),z.isSymlink&&z.symlinkTarget)Y.push($("Symlink Target",z.symlinkTarget));let Z=z.fileCount??await i(z.path);if(Y.push($("File Count",String(Z))),z.description)Y.push(""),Y.push($("Description",z.description));if(z.allowedTools&&z.allowedTools.length>0){Y.push(""),Y.push(K()?B.bold("Allowed Tools:"):"Allowed Tools:"),Y.push(` ${Bz(z.allowedTools)}`);let J=Hz(z.allowedTools);if(J)Y.push(` ${K()?B.yellow("⚠"):"!"} ${J}`)}if(z.warnings&&z.warnings.length>0){Y.push(""),Y.push(K()?B.bold("Warnings:"):"Warnings:");for(let J of z.warnings)Y.push(` ${K()?B.yellow("!"):"!"} [${J.category}] ${J.message}`)}return Y.join(`
12
12
  `)}async function EY(z){if(z.length===0)return"No skills found.";if(z.length===1)return mz(z[0]);let Y=[],$=(U,G)=>`${K()?B.bold(U+":"):U+":"} ${G}`,Z=z[0],J=Z.name;if(Y.push(""),Y.push(K()?B.blueBold(` ${J}`):` ${J}`),Y.push(K()?B.dim(" "+"-".repeat(J.length+2)):" "+"-".repeat(J.length+2)),Y.push(""),Y.push($(" Version",Z.version)),Y.push($(" Creator",Z.creator||"—")),Y.push($(" License",Z.license||"—")),Z.compatibility)Y.push($(" Compatibility",Z.compatibility));if(Z.effort)Y.push($(" Effort",k(Z.effort)));let X=Z.fileCount??await i(Z.path);Y.push($(" File Count",String(X)));let L=z.map((U)=>s(U.provider,U.providerLabel)).join(" ");if(Y.push($(" Installed in",L)),Z.description){Y.push(""),Y.push(K()?B.bold(" Description:"):" Description:");let U=Lz(Z.description,72);for(let G of U)Y.push(" "+G)}if(Z.allowedTools&&Z.allowedTools.length>0){Y.push(""),Y.push(K()?B.bold(" Allowed Tools:"):" Allowed Tools:"),Y.push(` ${Bz(Z.allowedTools)}`);let U=Hz(Z.allowedTools);if(U)Y.push(` ${K()?B.yellow("⚠"):"!"} ${U}`)}Y.push("");let H=` Installations (${z.length})`;Y.push(K()?B.bold(H):H);for(let U=0;U<z.length;U++){let G=z[U],O=l(G.provider,G.providerLabel),j=G.isSymlink?"symlink":"directory",A=B.dim(G.scope);if(Y.push(` ${O} (${A}, ${j})`),Y.push(` ${B.dim("Path:")} ${C(G.path)}`),G.isSymlink&&G.symlinkTarget)Y.push(` ${B.dim("Target:")} ${G.symlinkTarget}`)}let Q=z.flatMap((U)=>{if(!U.warnings||U.warnings.length===0)return[];return U.warnings.map((G)=>({...G,provider:U.providerLabel}))});if(Q.length>0){Y.push("");let U=` Warnings (${Q.length})`;Y.push(K()?B.bold(U):U);for(let G of Q){let O=K()?B.yellow("!"):"!";Y.push(` ${O} [${G.category}] ${G.message}`)}}return Y.push(""),Y.join(`
13
13
  `)}function Lz(z,Y){let $=z.split(/\s+/),Z=[],J="";for(let X of $)if(J.length+X.length+1>Y&&J.length>0)Z.push(J),J=X;else J=J?J+" "+X:X;if(J)Z.push(J);return Z}function NY(z){return JSON.stringify(z,null,2)}function SY(z){let Y=[],$=new Set,Z=new Map,J=[];for(let Q of z){let U=Z.get(Q.realPath);if(U){if(Q.isSymlink)continue;if(U.isSymlink)J[J.indexOf(U)]=Q,Z.set(Q.realPath,Q);else J.push(Q)}else Z.set(Q.realPath,Q),J.push(Q)}let X=new Map;for(let Q of J){let U=X.get(Q.dirName)??[];U.push(Q),X.set(Q.dirName,U)}for(let[Q,U]of X)if(new Set(U.map((O)=>O.location)).size>=2){Y.push({key:Q,reason:"same-dirName",instances:U});for(let O of U)$.add(O.path)}let L=new Map;for(let Q of J){if(!Q.name)continue;let U=L.get(Q.name)??[];U.push(Q),L.set(Q.name,U)}for(let[Q,U]of L){if(new Set(U.map((A)=>A.dirName)).size<2)continue;let O=U.filter((A)=>!$.has(A.path));if(O.length<2)continue;if(new Set(O.map((A)=>A.dirName)).size<2)continue;Y.push({key:Q,reason:"same-frontmatterName",instances:O})}Y.sort((Q,U)=>{if(Q.reason!==U.reason)return Q.reason==="same-dirName"?-1:1;return Q.key.localeCompare(U.key)});let H=Y.reduce((Q,U)=>Q+U.instances.length,0);return{scannedAt:new Date().toISOString(),totalSkills:z.length,duplicateGroups:Y,totalDuplicateInstances:H}}function cz(z){return[...z].sort((Y,$)=>{if(Y.scope!==$.scope)return Y.scope==="global"?-1:1;let Z=Y.providerLabel.localeCompare($.providerLabel);if(Z!==0)return Z;return Y.path.localeCompare($.path)})}function uz(z){return z==="same-dirName"?"same dirName":"same name"}function xY(z){if(z.duplicateGroups.length===0)return B.green("No duplicate skills found.");let Y=[];Y.push(""),Y.push(B.bold(` Found ${z.duplicateGroups.length} duplicate group(s) (${z.totalDuplicateInstances} total instances):`)),Y.push("");for(let $ of z.duplicateGroups){Y.push(` ${B.yellow(`"${$.key}"`)} ${B.dim(`(${uz($.reason)})`)}`);let Z=cz($.instances);for(let J=0;J<Z.length;J++){let X=Z[J],L=l(X.provider,X.providerLabel),H=J===0?B.green(" [keep]"):B.dim(" "),Q=B.dim(`(${X.scope})`);Y.push(` ${H} ${L} ${Q} ${B.dim(C(X.path))}`)}Y.push("")}return Y.push(B.dim(` Run ${B.bold("asm audit -y")} to auto-remove duplicates`)),Y.push(""),Y.join(`
14
- `)}function DY(z){return JSON.stringify(z,null,2)}function wY(z){let Y=z.trim();if(!Y)return["vi",[]];let $=[],Z="",J=!1,X=0;while(X<Y.length){let L=Y[X];if(L==='"'){J=!0,X++;while(X<Y.length&&Y[X]!=='"'){if(Y[X]==="\\"&&X+1<Y.length){let H=Y[X+1];if(H==='"'||H==="\\"){Z+=H,X+=2;continue}}Z+=Y[X],X++}X++}else if(L==="'"){J=!0,X++;while(X<Y.length&&Y[X]!=="'")Z+=Y[X],X++;X++}else if(L===" "||L==="\t"){if(Z.length>0||J)$.push(Z),Z="",J=!1;X++}else Z+=L,X++}if(Z.length>0||J)$.push(Z);if($.length===0)return["vi",[]];return[$[0],$.slice(1)]}import{readFileSync as pz}from"fs";import{resolve as dz,dirname as nz}from"path";import{fileURLToPath as oz}from"url";import{execSync as tz}from"child_process";var az=nz(oz(import.meta.url)),Oz="1.21.0";try{let z=pz(dz(az,"../../package.json"),"utf-8");Oz=JSON.parse(z).version}catch{}var e="fe440c5";try{e=tz("git rev-parse --short HEAD",{encoding:"utf-8",stdio:["pipe","pipe","ignore"]}).trim()||e}catch{}var iz=Oz,rz=e,hY=`v${iz} (${rz})`;
14
+ `)}function DY(z){return JSON.stringify(z,null,2)}function wY(z){let Y=z.trim();if(!Y)return["vi",[]];let $=[],Z="",J=!1,X=0;while(X<Y.length){let L=Y[X];if(L==='"'){J=!0,X++;while(X<Y.length&&Y[X]!=='"'){if(Y[X]==="\\"&&X+1<Y.length){let H=Y[X+1];if(H==='"'||H==="\\"){Z+=H,X+=2;continue}}Z+=Y[X],X++}X++}else if(L==="'"){J=!0,X++;while(X<Y.length&&Y[X]!=="'")Z+=Y[X],X++;X++}else if(L===" "||L==="\t"){if(Z.length>0||J)$.push(Z),Z="",J=!1;X++}else Z+=L,X++}if(Z.length>0||J)$.push(Z);if($.length===0)return["vi",[]];return[$[0],$.slice(1)]}import{readFileSync as pz}from"fs";import{resolve as dz,dirname as nz}from"path";import{fileURLToPath as oz}from"url";import{execSync as tz}from"child_process";var az=nz(oz(import.meta.url)),Oz="2.0.0";try{let z=pz(dz(az,"../../package.json"),"utf-8");Oz=JSON.parse(z).version}catch{}var e="822ccf0";try{e=tz("git rev-parse --short HEAD",{encoding:"utf-8",stdio:["pipe","pipe","ignore"]}).trim()||e}catch{}var iz=Oz,rz=e,hY=`v${iz} (${rz})`;
15
15
  export{d as e,n as f,o as g,i as h,XY as i,QY as j,UY as k,bz as l,jY as m,AY as n,KY as o,B as p,k as q,l as r,C as s,IY as t,_Y as u,qY as v,TY as w,Gz as x,gz as y,EY as z,Lz as A,NY as B,SY as C,cz as D,uz as E,xY as F,DY as G,iz as H,hY as I,wY as J};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-skill-manager",
3
- "version": "1.21.0",
3
+ "version": "2.0.0",
4
4
  "description": "Interactive TUI for managing installed skills for AI coding agents (Claude Code, Codex, OpenClaw, and more)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,17 +19,18 @@
19
19
  "build": "bun run scripts/build.ts",
20
20
  "preindex": "bun run scripts/preindex.ts",
21
21
  "build:website": "bun scripts/build-catalog.ts",
22
- "prepublishOnly": "bun run build"
22
+ "prepublishOnly": "bun run build",
23
+ "postinstall": "node scripts/postinstall.cjs"
23
24
  },
24
25
  "files": [
25
26
  "dist/",
26
27
  "data/",
28
+ "scripts/postinstall.cjs",
27
29
  "README.md",
28
30
  "LICENSE"
29
31
  ],
30
32
  "dependencies": {
31
33
  "@opentui/core": "0.1.87",
32
- "skillgrade": "^0.1.3",
33
34
  "yaml": "^2.8.3"
34
35
  },
35
36
  "engines": {
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Runs after `npm install -g agent-skill-manager`.
4
+ *
5
+ * Walks PATH for duplicate `asm` binaries so users catch npm-vs-bun shadowing
6
+ * before the stale install silently outruns the new one. Never fails the
7
+ * install — any unexpected error is swallowed.
8
+ *
9
+ * Skipped by default under CI and inside nested/production-dep installs;
10
+ * `ASM_SKIP_POSTINSTALL=1` also disables it explicitly.
11
+ */
12
+
13
+ "use strict";
14
+
15
+ try {
16
+ // Only run for global installs. Local/dev installs and CI can skip.
17
+ const isGlobal =
18
+ process.env.npm_config_global === "true" ||
19
+ process.env.npm_config_global === "1";
20
+ if (
21
+ process.env.ASM_SKIP_POSTINSTALL ||
22
+ process.env.CI ||
23
+ !isGlobal
24
+ ) {
25
+ process.exit(0);
26
+ }
27
+
28
+ const fs = require("fs");
29
+ const path = require("path");
30
+
31
+ const BIN = "asm";
32
+ const DELIM = path.delimiter;
33
+ const pathEnv = process.env.PATH || "";
34
+
35
+ const seenReal = new Set();
36
+ const hits = [];
37
+
38
+ for (const raw of pathEnv.split(DELIM)) {
39
+ const dir = raw.trim();
40
+ if (!dir) continue;
41
+ const candidate = path.resolve(dir, BIN);
42
+ let stats;
43
+ try {
44
+ stats = fs.statSync(candidate);
45
+ } catch {
46
+ continue;
47
+ }
48
+ if (!stats.isFile()) continue;
49
+ try {
50
+ fs.accessSync(candidate, fs.constants.X_OK);
51
+ } catch {
52
+ continue;
53
+ }
54
+ let real;
55
+ try {
56
+ real = fs.realpathSync(candidate);
57
+ } catch {
58
+ real = candidate;
59
+ }
60
+ if (seenReal.has(real)) continue;
61
+ seenReal.add(real);
62
+ hits.push({ path: candidate, real });
63
+ }
64
+
65
+ if (hits.length <= 1) process.exit(0);
66
+
67
+ const [resolved, ...shadowed] = hits;
68
+ process.stderr.write(
69
+ `\n[agent-skill-manager] Warning: ${hits.length} \`asm\` binaries on PATH — the fresh install may be shadowed.\n`,
70
+ );
71
+ process.stderr.write(` resolved: ${resolved.path}\n`);
72
+ for (const other of shadowed) {
73
+ process.stderr.write(` shadowed: ${other.path}\n`);
74
+ }
75
+ process.stderr.write(
76
+ " Pick one package manager (npm OR bun) and remove the other install.\n",
77
+ );
78
+ process.stderr.write(
79
+ " See: https://github.com/luongnv89/agent-skill-manager#troubleshooting\n\n",
80
+ );
81
+ process.exit(0);
82
+ } catch {
83
+ // Never fail the install.
84
+ process.exit(0);
85
+ }