xc-skills 1.0.4 → 1.1.1
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 +37 -2
- package/dist/cli.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,7 +61,41 @@ xc-skills add https://e.coding.net/your-team/skills.git
|
|
|
61
61
|
xc-skills add . --dir my-rules
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
### 4.
|
|
64
|
+
### 4. 指定输出路径
|
|
65
|
+
|
|
66
|
+
如果你想把技能安装到一个特定的文件夹(而不是默认的 Agent 路径或 `.agent/skills`),可以使用 `--out` 参数:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
xc-skills add . --out ./my-debug-folder
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 5. 查看已安装的技能
|
|
73
|
+
|
|
74
|
+
你可以列出当前项目或全局已安装的所有技能:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# 查看当前项目的技能
|
|
78
|
+
xc-skills list
|
|
79
|
+
|
|
80
|
+
# 查看全局已安装的技能
|
|
81
|
+
xc-skills list -g
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 6. 清理项目技能目录
|
|
85
|
+
|
|
86
|
+
如果你想删除当前项目中安装的所有技能目录(如 `.agent`, `.trae` 等),可以使用 `remove` 命令:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
xc-skills remove
|
|
90
|
+
# 或者使用别名
|
|
91
|
+
xc-skills cleanup
|
|
92
|
+
xc-skills rm
|
|
93
|
+
|
|
94
|
+
# 清理全局目录下的技能
|
|
95
|
+
xc-skills remove --global
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 6. 参数化运行
|
|
65
99
|
|
|
66
100
|
```bash
|
|
67
101
|
# 自动安装所有技能到 Antigravity(跳过交互)
|
|
@@ -74,7 +108,8 @@ xc-skills add . --yes --agent Antigravity --skill *
|
|
|
74
108
|
| --- | --- |
|
|
75
109
|
| `-s, --skill <names>` | 指定要安装的技能名称(逗号分隔,或用 `*` 表示全部) |
|
|
76
110
|
| `-a, --agent <names>` | 指定目标 Agent 名称(逗号分隔,或用 `*` 表示全部) |
|
|
77
|
-
| `-d, --dir <dir>` |
|
|
111
|
+
| `-d, --dir <dir>` | 指定源目录中技能存放的目录名(默认为 `skills`) |
|
|
112
|
+
| `-o, --out <path>` | 指定输出的目标目录路径 |
|
|
78
113
|
| `-y, --yes` | 跳过所有确认和交互步骤,使用默认值 |
|
|
79
114
|
| `-v, --version` | 查看版本号 |
|
|
80
115
|
| `-h, --help` | 查看帮助信息 |
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{cac as P}from"cac";import*as e from"@clack/prompts";import p from"picocolors";import a from"fs-extra";import{join as k,resolve as T,dirname as M,basename as O}from"path";import I from"os";import{execSync as R}from"child_process";import V from"degit";import S from"os";import{join as b}from"path";var w=[{name:"Antigravity",path:b(S.homedir(),".agent/skills"),description:"Custom AI agent for XC development"},{name:"Trae",path:b(S.homedir(),".trae/skills"),description:"Trae AI IDE"},{name:"Codex",path:b(S.homedir(),".codex/skills"),description:"Codex AI assistant"},{name:"Claude Code",path:b(S.homedir(),".claude/skills"),description:"Anthropic Claude Code CLI"}];import y from"fs-extra";import{join as j,dirname as L,basename as F}from"path";import*as D from"@clack/prompts";import G from"picocolors";import N from"os";async function E(c){let{sourceDir:i,targetAgents:u,selectedSkills:l,scope:s,method:v,strategy:g}=c,$=D.spinner();for(let f of u){let r="";if(s==="project"){let o=F(L(f.path));r=j(process.cwd(),o,"skills")}else r=f.path.replace(/^~/,N.homedir());$.start(`\u6B63\u5728\u90E8\u7F72\u5230 ${f.name} (${r})...`);try{g==="overwrite"&&await y.pathExists(r)?await y.emptyDir(r):await y.ensureDir(r);for(let o of l){let h=j(i,o),d=j(r,o);await y.pathExists(d)&&await y.remove(d),v==="symlink"?await y.ensureSymlink(h,d,"dir"):await y.copy(h,d)}$.stop(`\u6210\u529F\u540C\u6B65\u5230: ${f.name} (${s} \u6A21\u5F0F)`)}catch(o){$.stop(`${G.red("\u5931\u8D25")}: ${f.name} - ${o.message}`)}}}var C=P("xc-skills");function W(c){try{let i=k(c,"SKILL.md");if(a.existsSync(i)){let l=a.readFileSync(i,"utf-8").match(/description:\s*['"]?([^'"\n\r]+)['"]?/);return l?l[1].trim():""}}catch{}return""}C.command("add <source>","Add skills from a local directory or GitHub URL").option("-s, --skill <skills>","Specific skills to install").option("-a, --agent <agents>","Specific agents to install to").option("-d, --dir <dir>","The directory name containing skills",{default:"skills"}).option("-y, --yes","Skip confirmation prompts").action(async(c,i)=>{e.intro(`${p.bgCyan(p.black(" xc-skills "))}`);let u="",l=!1,s=k(I.tmpdir(),`xc-skills-${Date.now()}`),v=c.startsWith("http")||c.startsWith("git@")||c.includes("/")&&!a.existsSync(T(process.cwd(),c));if(v){let t=e.spinner();t.start(`\u6B63\u5728\u5C1D\u8BD5\u4E0B\u8F7D\u6280\u80FD\u5E93: ${c}`);let n=!1;try{await V(c,{cache:!1,force:!0,verbose:!1}).clone(s),n=!0,t.stop("\u4E0B\u8F7D\u6210\u529F (degit)")}catch{try{t.message("degit \u4E0D\u652F\u6301\u6B64\u5E73\u53F0\uFF0C\u6B63\u5728\u5C1D\u8BD5\u4F7F\u7528 git clone..."),R(`git clone --depth 1 ${c} ${s}`,{stdio:"ignore"}),a.existsSync(k(s,".git"))&&await a.remove(k(s,".git")),n=!0,t.stop("\u4E0B\u8F7D\u6210\u529F (git clone)")}catch(A){t.stop(p.red(`\u4E0B\u8F7D\u5931\u8D25: ${A.message}`)),process.exit(1)}}n&&(u=s,l=!0)}else u=T(process.cwd(),c);let g=k(u,i.dir);a.existsSync(g)||(e.log.error(`\u627E\u4E0D\u5230\u6280\u80FD\u76EE\u5F55: ${g}`),l&&await a.remove(s),process.exit(1));let f=(await a.readdir(g,{withFileTypes:!0})).filter(t=>t.isDirectory()&&!t.name.startsWith(".")).map(t=>{let n=t.name,m=W(k(g,n));return{name:n,description:m}});f.length===0&&(e.log.error(`\u5728 ${g} \u4E2D\u6CA1\u6709\u627E\u5230\u4EFB\u4F55\u6709\u6548\u7684\u6280\u80FD\u5B50\u76EE\u5F55`),l&&await a.remove(s),process.exit(1));let r=[];i.yes||i.skill==="*"?r=f.map(t=>t.name):i.skill?r=i.skill.split(","):r=await e.multiselect({message:"\u7B2C\u4E00\u6B65\uFF1A\u9009\u62E9\u8981\u5B89\u88C5\u7684\u6280\u80FD (Select skills)",options:f.map(t=>({value:t.name,label:t.name,hint:t.description})),initialValues:[f[0].name]}),e.isCancel(r)&&(l&&await a.remove(s),e.cancel("\u5DF2\u53D6\u6D88"),process.exit(0));let o=[];if(i.yes||i.agent==="*")o=w;else if(i.agent){let t=i.agent.split(",");o=w.filter(n=>t.includes(n.name))}else o=await e.multiselect({message:"\u7B2C\u4E8C\u6B65\uFF1A\u9009\u62E9\u76EE\u6807\u5F00\u53D1\u5DE5\u5177 (Select agents)",options:w.map(t=>({value:t,label:t.name,hint:t.path.replace(I.homedir(),"~")})),initialValues:[w[0]]});e.isCancel(o)&&(l&&await a.remove(s),e.cancel("\u5DF2\u53D6\u6D88"),process.exit(0));let h="project";i.yes||(h=await e.select({message:"\u7B2C\u4E09\u6B65\uFF1A\u9009\u62E9\u5B89\u88C5\u8303\u56F4 (Installation scope)",options:[{value:"project",label:"Project (\u9879\u76EE\u7EA7)",hint:"./.<agent>/skills"},{value:"global",label:"Global (\u5168\u5C40)",hint:"\u5DE5\u5177\u9ED8\u8BA4\u8DEF\u5F84"}]})),e.isCancel(h)&&(l&&await a.remove(s),e.cancel("\u5DF2\u53D6\u6D88"),process.exit(0));let d="symlink";l?d="copy":i.yes||(d=await e.select({message:"\u7B2C\u56DB\u6B65\uFF1A\u9009\u62E9\u5B89\u88C5\u65B9\u5F0F (Installation method)",options:[{value:"symlink",label:"Symlink (\u8F6F\u94FE\u63A5 - \u63A8\u8350)",hint:"\u4E0E\u6E90\u7801\u4FDD\u6301\u5B9E\u65F6\u540C\u6B65"},{value:"copy",label:"Copy (\u7269\u7406\u62F7\u8D1D)",hint:"\u590D\u5236\u6587\u4EF6\u526F\u672C"}]})),e.isCancel(d)&&(l&&await a.remove(s),e.cancel("\u5DF2\u53D6\u6D88"),process.exit(0));let x="merge";if(!i.yes){let t=!1;for(let n of o){let m="";if(h==="project"){let A=O(M(n.path));m=k(process.cwd(),A,"skills")}else m=n.path.replace(/^~/,I.homedir());if(await a.pathExists(m)){t=!0;break}}t&&(x=await e.select({message:"\u68C0\u6D4B\u5230\u76EE\u6807\u76EE\u5F55\u5DF2\u5B58\u5728\uFF0C\u5982\u4F55\u5904\u7406\uFF1F(Handle conflicts)",options:[{value:"merge",label:"Merge (\u5408\u5E76)",hint:"\u53EA\u66F4\u65B0\u9009\u4E2D\u7684\u6280\u80FD\uFF0C\u4FDD\u7559\u5176\u4ED6\u6280\u80FD"},{value:"overwrite",label:"Overwrite (\u8986\u76D6)",hint:"\u6E05\u7A7A\u76EE\u6807\u76EE\u5F55\u540E\u518D\u5B89\u88C5"}]}))}if(e.isCancel(x)&&(l&&await a.remove(s),e.cancel("\u5DF2\u53D6\u6D88"),process.exit(0)),!i.yes){e.log.message(`${p.cyan("\u5B89\u88C5\u7EFC\u8FF0 (Installation Summary)")}`),[`${p.dim("Source:")} ${v?c:"Local"}`,`${p.dim("Skills:")} ${r.join(", ")}`,`${p.dim("Agents:")} ${o.map(m=>m.name).join(", ")}`,`${p.dim("Scope:")} ${h}`,`${p.dim("Method:")} ${d}`,`${p.dim("Strategy:")} ${x}`].forEach(m=>e.log.message(` ${m}`));let n=await e.confirm({message:"\u786E\u8BA4\u5B89\u88C5\uFF1F(Proceed with installation?)",initialValue:!0});(e.isCancel(n)||!n)&&(l&&await a.remove(s),e.cancel("\u5B89\u88C5\u5DF2\u53D6\u6D88"),process.exit(0))}await E({sourceDir:g,targetAgents:o,selectedSkills:r,scope:h,method:d,strategy:x}),l&&await a.remove(s),e.outro(p.green("\u5B89\u88C5\u5B8C\u6210\uFF01(Installation complete)"))});C.help();C.version("1.0.4");C.parse();
|
|
2
|
+
import{cac as L}from"cac";import*as e from"@clack/prompts";import c from"picocolors";import l from"fs-extra";import{join as k,resolve as C,dirname as W,basename as V}from"path";import b from"os";import{execSync as N}from"child_process";import M from"degit";import j from"os";import{join as D}from"path";var x=[{name:"Antigravity",path:D(j.homedir(),".agent/skills"),description:"Custom AI agent for XC development"},{name:"Trae",path:D(j.homedir(),".trae/skills"),description:"Trae AI IDE"},{name:"Codex",path:D(j.homedir(),".codex/skills"),description:"Codex AI assistant"},{name:"Claude Code",path:D(j.homedir(),".claude/skills"),description:"Anthropic Claude Code CLI"}];import v from"fs-extra";import{join as I,dirname as E,basename as R}from"path";import*as P from"@clack/prompts";import F from"picocolors";import G from"os";async function T(f){let{sourceDir:t,targetAgents:y,selectedSkills:i,scope:s,method:g,strategy:p,customRoot:o}=f,r=P.spinner();for(let m of y){let n="";if(o)n=o;else if(s==="project"){let d=R(E(m.path));n=I(process.cwd(),d,"skills")}else n=m.path.replace(/^~/,G.homedir());r.start(`\u6B63\u5728\u90E8\u7F72\u5230 ${m.name} (${n})...`);try{p==="overwrite"&&await v.pathExists(n)?await v.emptyDir(n):await v.ensureDir(n);for(let d of i){let $=I(t,d),w=I(n,d);await v.pathExists(w)&&await v.remove(w),g==="symlink"?await v.ensureSymlink($,w,"dir"):await v.copy($,w)}r.stop(`\u6210\u529F\u540C\u6B65\u5230: ${m.name} (${s==="custom"?"\u81EA\u5B9A\u4E49\u8DEF\u5F84":s+" \u6A21\u5F0F"})`)}catch(d){r.stop(`${F.red("\u5931\u8D25")}: ${m.name} - ${d.message}`)}}}var S=L("xc-skills");function O(f){try{let t=k(f,"SKILL.md");if(l.existsSync(t)){let i=l.readFileSync(t,"utf-8").match(/description:\s*['"]?([^'"\n\r]+)['"]?/);return i?i[1].trim():""}}catch{}return""}S.command("add <source>","Add skills from a local directory or GitHub URL").option("-s, --skill <skills>","Specific skills to install").option("-a, --agent <agents>","Specific agents to install to").option("-d, --dir <dir>","The directory name containing skills",{default:"skills"}).option("-o, --out <path>","Specify a custom output directory").option("-y, --yes","Skip confirmation prompts").action(async(f,t)=>{e.intro(`${c.bgCyan(c.black(" xc-skills "))}`);let y="",i=!1,s=k(b.tmpdir(),`xc-skills-${Date.now()}`),g=f.startsWith("http")||f.startsWith("git@")||f.includes("/")&&!l.existsSync(C(process.cwd(),f));if(g){let a=e.spinner();a.start(`\u6B63\u5728\u5C1D\u8BD5\u4E0B\u8F7D\u6280\u80FD\u5E93: ${f}`);let h=!1;try{await M(f,{cache:!1,force:!0,verbose:!1}).clone(s),h=!0,a.stop("\u4E0B\u8F7D\u6210\u529F (degit)")}catch{try{a.message("degit \u4E0D\u652F\u6301\u6B64\u5E73\u53F0\uFF0C\u6B63\u5728\u5C1D\u8BD5\u4F7F\u7528 git clone..."),N(`git clone --depth 1 ${f} ${s}`,{stdio:"ignore"}),l.existsSync(k(s,".git"))&&await l.remove(k(s,".git")),h=!0,a.stop("\u4E0B\u8F7D\u6210\u529F (git clone)")}catch(A){a.stop(c.red(`\u4E0B\u8F7D\u5931\u8D25: ${A.message}`)),process.exit(1)}}h&&(y=s,i=!0)}else y=C(process.cwd(),f);let p=k(y,t.dir);l.existsSync(p)||(e.log.error(`\u627E\u4E0D\u5230\u6280\u80FD\u76EE\u5F55: ${p}`),i&&await l.remove(s),process.exit(1));let r=(await l.readdir(p,{withFileTypes:!0})).filter(a=>a.isDirectory()&&!a.name.startsWith(".")).map(a=>{let h=a.name,u=O(k(p,h));return{name:h,description:u}});r.length===0&&(e.log.error(`\u5728 ${p} \u4E2D\u6CA1\u6709\u627E\u5230\u4EFB\u4F55\u6709\u6548\u7684\u6280\u80FD\u5B50\u76EE\u5F55`),i&&await l.remove(s),process.exit(1));let m=[];t.yes||t.skill==="*"?m=r.map(a=>a.name):t.skill?m=t.skill.split(","):m=await e.multiselect({message:"\u7B2C\u4E00\u6B65\uFF1A\u9009\u62E9\u8981\u5B89\u88C5\u7684\u6280\u80FD (Select skills)",options:r.map(a=>({value:a.name,label:a.name,hint:a.description})),initialValues:[r[0].name]}),e.isCancel(m)&&(i&&await l.remove(s),e.cancel("\u5DF2\u53D6\u6D88"),process.exit(0));let n=[];if(t.out)n=[{name:"Custom Path",path:C(process.cwd(),t.out)}];else if(t.yes||t.agent==="*")n=x;else if(t.agent){let a=t.agent.split(",");n=x.filter(h=>a.includes(h.name))}else n=await e.multiselect({message:"\u7B2C\u4E8C\u6B65\uFF1A\u9009\u62E9\u76EE\u6807\u5F00\u53D1\u5DE5\u5177 (Select agents)",options:x.map(a=>({value:a,label:a.name,hint:a.path.replace(b.homedir(),"~")})),initialValues:[x[0]]});e.isCancel(n)&&(i&&await l.remove(s),e.cancel("\u5DF2\u53D6\u6D88"),process.exit(0));let d=t.out?"custom":"project";!t.out&&!t.yes&&(d=await e.select({message:"\u7B2C\u4E09\u6B65\uFF1A\u9009\u62E9\u5B89\u88C5\u8303\u56F4 (Installation scope)",options:[{value:"project",label:"Project (\u9879\u76EE\u7EA7)",hint:"./.<agent>/skills"},{value:"global",label:"Global (\u5168\u5C40)",hint:"\u5DE5\u5177\u9ED8\u8BA4\u8DEF\u5F84"}]})),e.isCancel(d)&&(i&&await l.remove(s),e.cancel("\u5DF2\u53D6\u6D88"),process.exit(0));let $="symlink";i?$="copy":t.yes||($=await e.select({message:"\u7B2C\u56DB\u6B65\uFF1A\u9009\u62E9\u5B89\u88C5\u65B9\u5F0F (Installation method)",options:[{value:"symlink",label:"Symlink (\u8F6F\u94FE\u63A5 - \u63A8\u8350)",hint:"\u4E0E\u6E90\u7801\u4FDD\u6301\u5B9E\u65F6\u540C\u6B65"},{value:"copy",label:"Copy (\u7269\u7406\u62F7\u8D1D)",hint:"\u590D\u5236\u6587\u4EF6\u526F\u672C"}]})),e.isCancel($)&&(i&&await l.remove(s),e.cancel("\u5DF2\u53D6\u6D88"),process.exit(0));let w="merge";if(!t.yes){let a=!1;for(let h of n){let u="";if(t.out)u=C(process.cwd(),t.out);else if(d==="project"){let A=V(W(h.path));u=k(process.cwd(),A,"skills")}else u=h.path.replace(/^~/,b.homedir());if(await l.pathExists(u)){a=!0;break}}a&&(w=await e.select({message:"\u68C0\u6D4B\u5230\u76EE\u6807\u76EE\u5F55\u5DF2\u5B58\u5728\uFF0C\u5982\u4F55\u5904\u7406\uFF1F(Handle conflicts)",options:[{value:"merge",label:"Merge (\u5408\u5E76)",hint:"\u53EA\u66F4\u65B0\u9009\u4E2D\u7684\u6280\u80FD\uFF0C\u4FDD\u7559\u5176\u4ED6\u6280\u80FD"},{value:"overwrite",label:"Overwrite (\u8986\u76D6)",hint:"\u6E05\u7A7A\u76EE\u6807\u76EE\u5F55\u540E\u518D\u5B89\u88C5"}]}))}if(e.isCancel(w)&&(i&&await l.remove(s),e.cancel("\u5DF2\u53D6\u6D88"),process.exit(0)),!t.yes){e.log.message(`${c.cyan("\u5B89\u88C5\u7EFC\u8FF0 (Installation Summary)")}`),[`${c.dim("Source:")} ${g?f:"Local"}`,`${c.dim("Skills:")} ${m.join(", ")}`,t.out?`${c.dim("Target:")} ${n[0].path}`:`${c.dim("Agents:")} ${n.map(u=>u.name).join(", ")}`,`${c.dim("Scope:")} ${d}`,`${c.dim("Method:")} ${$}`,`${c.dim("Strategy:")} ${w}`].forEach(u=>e.log.message(` ${u}`));let h=await e.confirm({message:"\u786E\u8BA4\u5B89\u88C5\uFF1F(Proceed with installation?)",initialValue:!0});(e.isCancel(h)||!h)&&(i&&await l.remove(s),e.cancel("\u5B89\u88C5\u5DF2\u53D6\u6D88"),process.exit(0))}await T({sourceDir:p,targetAgents:n,selectedSkills:m,scope:d,method:$,strategy:w,customRoot:t.out?C(process.cwd(),t.out):void 0}),i&&await l.remove(s),e.outro(c.green("\u5B89\u88C5\u5B8C\u6210\uFF01(Installation complete)"))});S.command("remove","Remove installed skills from the current project or global directory").alias("cleanup").alias("rm").option("-g, --global","Remove global skills instead of project skills").action(async f=>{let t=f.global;e.intro(`${c.bgRed(c.white(t?" xc-skills remove (Global) ":" xc-skills remove (Project) "))}`);let y=process.cwd(),i=[];if(t)for(let o of x){let r=o.path.replace(/^~/,b.homedir());if(l.existsSync(r)){let m=(await l.readdir(r,{withFileTypes:!0})).filter(n=>n.isDirectory()&&!n.name.startsWith(".")).map(n=>n.name);i.push({name:o.name,path:r,skills:m})}}else{let o=[".agent",".trae",".claude",".codex"];for(let r of o){let m=k(y,r,"skills");if(l.existsSync(m)){let n=(await l.readdir(m,{withFileTypes:!0})).filter(d=>d.isDirectory()&&!d.name.startsWith(".")).map(d=>d.name);i.push({name:r,path:k(y,r),skills:n})}}}i.length===0&&(e.log.info(t?"\u6CA1\u6709\u53D1\u73B0\u5DF2\u5B89\u88C5\u7684\u5168\u5C40\u6280\u80FD\u76EE\u5F55\u3002":"\u5728\u5F53\u524D\u9879\u76EE\u4E2D\u6CA1\u6709\u53D1\u73B0\u5DF2\u5B89\u88C5\u7684\u6280\u80FD\u76EE\u5F55\u3002"),process.exit(0));let s=await e.multiselect({message:`\u9009\u62E9\u8981\u6E05\u9664\u7684${t?"\u5168\u5C40":"\u9879\u76EE"}\u76EE\u5F55 (Select to remove)`,options:i.map(o=>({value:o.path,label:o.name,hint:o.skills.length>0?`Skills: ${o.skills.join(", ")}`:"(\u7A7A\u76EE\u5F55)"})),initialValues:i.map(o=>o.path)});(e.isCancel(s)||s.length===0)&&(e.cancel("\u64CD\u4F5C\u5DF2\u53D6\u6D88"),process.exit(0));let g=await e.confirm({message:`\u786E\u8BA4\u5220\u9664\u9009\u4E2D\u7684 ${s.length} \u4E2A\u76EE\u5F55\u53CA\u5176\u6240\u6709\u6280\u80FD\uFF1F(Confirm deletion?)`,initialValue:!1});(e.isCancel(g)||!g)&&(e.cancel("\u64CD\u4F5C\u5DF2\u53D6\u6D88"),process.exit(0));let p=e.spinner();for(let o of s){let r=o.replace(b.homedir(),"~");p.start(`\u6B63\u5728\u5220\u9664 ${r}...`);try{await l.remove(o),p.stop(`\u5DF2\u5220\u9664: ${r}`)}catch(m){p.stop(c.red(`\u5220\u9664 ${r} \u5931\u8D25: ${m.message}`))}}e.outro(c.green("\u6E05\u7406\u5B8C\u6210\uFF01"))});S.command("list","List installed skills").alias("ls").option("-g, --global","List global skills instead of project skills").action(async f=>{let t=f.global;e.intro(`${c.bgBlue(c.white(t?" xc-skills list (Global) ":" xc-skills list (Project) "))}`);let y=process.cwd(),i=[];if(t)for(let s of x){let g=s.path.replace(/^~/,b.homedir());if(l.existsSync(g)){let p=(await l.readdir(g,{withFileTypes:!0})).filter(o=>o.isDirectory()&&!o.name.startsWith(".")).map(o=>o.name);i.push({name:s.name,path:g,skills:p})}}else{let s=[".agent",".trae",".claude",".codex"];for(let g of s){let p=k(y,g,"skills");if(l.existsSync(p)){let o=(await l.readdir(p,{withFileTypes:!0})).filter(r=>r.isDirectory()&&!r.name.startsWith(".")).map(r=>r.name);i.push({name:g,path:p,skills:o})}}}if(i.length===0)e.log.info("\u6CA1\u6709\u53D1\u73B0\u5DF2\u5B89\u88C5\u7684\u6280\u80FD\u3002");else for(let s of i)e.log.message(`${c.cyan(s.name)} ${c.dim(`(${s.path.replace(b.homedir(),"~")})`)}`),s.skills.length===0?e.log.message(` ${c.dim("(\u65E0\u6280\u80FD)")}`):e.log.message(` ${s.skills.join(", ")}`),e.log.message("");e.outro("\u67E5\u8BE2\u5B8C\u6BD5\uFF01")});S.help();S.version("1.1.1");S.parse();
|