neo-cmp-cli 1.15.6 → 1.15.8

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e="1.15.6";const o={version:e};exports.default=o,exports.version=e;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e="1.15.8";const o={version:e};exports.default=o,exports.version=e;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("node:path"),o=require("node:fs"),r=require("node:child_process"),s=require("ora"),t=require("../neoParams.js"),n=require("../common.js"),i=require("open");var a,c;exports.__require=function(){if(c)return a;c=1;const p=e,d=o,{spawn:u}=r,l=s,{consoleTag:m}=t.__require(),{errorLog:$,successLog:g,warningLog:f}=n.__require(),y={codebuddy:{name:"CodeBuddy",apps:["CodeBuddy CN","CodeBuddy","codebuddy"],win32:[{app:{name:"codebuddy"}}],linux:[{app:{name:"codebuddy"}}]},kiro:{name:"Kiro",cli:["kiro"],apps:["Kiro","kiro"],win32:[{app:{name:"kiro"}}],linux:[{app:{name:"kiro"}}]},cursor:{name:"Cursor",cli:["cursor"],apps:["Cursor","cursor"],win32:[{app:{name:"cursor"}}],linux:[{app:{name:"cursor"}}]},vscode:{name:"Visual Studio Code",cli:["code"],apps:["Visual Studio Code","Code"],win32:[{app:{name:"code"}}],linux:[{app:{name:"code"}}]}},h=["codebuddy","kiro","cursor","vscode"],w=function(){const e=process.env.HOME||process.env.USERPROFILE||"",o=["/usr/local/bin","/opt/homebrew/bin",e?p.join(e,".local","bin"):null,e?p.join(e,".local","share"):null].filter(Boolean),r=(process.env.PATH||"").split(p.delimiter).filter(Boolean);return o.forEach(e=>{!r.includes(e)&&d.existsSync(e)&&r.unshift(e)}),r.join(p.delimiter)},_=function(e,o){const r=function(e){if(!e)return"auto";const o=String(e).toLowerCase();return"code"===o?"vscode":o}(e),s="darwin"===o,t=(e,r)=>{const t=[];if(e.cli&&e.cli.length>0&&e.cli.forEach(o=>{t.push({type:"cli",cmd:o,__editorName:e.name,__editorKey:r})}),s)e.apps&&e.apps.length>0&&e.apps.forEach(o=>{t.push({type:"open-app",appName:o,__editorName:e.name,__editorKey:r})}),e.apps&&e.apps.length>0&&t.push({type:"osascript",appName:e.apps[0],__editorName:e.name,__editorKey:r});else{const s=e[o];s&&s.length>0&&s.forEach(o=>{t.push({type:"app",...o,__editorName:e.name,__editorKey:r})})}return t};if("auto"===r){const e=[];return h.forEach(o=>{const r=y[o];r&&e.push(...t(r,o))}),{configs:e,editorName:"编辑器"}}const n=y[r];return n?{configs:t(n,r),editorName:n.name}:{configs:[],editorName:"编辑器"}};return a=async function(e,o){const r=o?p.resolve(o):process.cwd();d.existsSync(r)||($(`目录不存在: ${r}`),process.exit(1));d.statSync(r).isDirectory()||($(`路径不是目录: ${r}`),process.exit(1));const s=process.platform;["darwin","win32","linux"].includes(s)||($(`不支持的操作系统: ${s}`),process.exit(1));const{configs:t,editorName:n}=_(e,s);0===t.length&&($(`不支持的编辑器类型: ${e}`),process.exit(1));const a=l(`${m}正在尝试使用 ${n} 打开项目: ${r}`).start(),c=[],y=async e=>{e>=t.length&&(a.fail(),$("无法打开编辑器,已尝试所有可用方式。"),console.log(""),console.log(` 目标目录: ${r}`),console.log(` 尝试次数: ${c.length}`),c.forEach((e,o)=>{console.log(` [${o+1}] ${e}`)}),console.log(""),console.log(" 请确保已安装 CodeBuddy、Kiro、Cursor 或 Visual Studio Code 其中之一。"),process.exit(1));const o=t[e],s=o.__editorName||"未知编辑器",n={cli:`CLI (${o.cmd})`,"open-app":`open -a "${o.appName}"`,osascript:"AppleScript",app:"应用名称"};let p;switch(a.text=`${m}正在使用 ${s} (${n[o.type]||o.type}) 打开: ${r}`,o.type){case"cli":p=await function(e,o){return new Promise(r=>{const s={...process.env,PATH:w()};let t="";const n=u(e,[o],{env:s,stdio:["ignore","ignore","pipe"],detached:!0});n.stderr.on("data",e=>{t+=e.toString()}),n.on("error",o=>{r({success:!1,error:o,detail:`CLI 命令 "${e}" 启动失败: ${o.message}`})}),n.on("close",o=>{n.unref(),0===o?t.trim()?r({success:!0,warning:t.trim()}):r({success:!0}):r({success:!1,error:new Error(`exit code ${o}`),detail:`CLI 命令 "${e}" 退出码: ${o}${t?", stderr: "+t.trim():""}`})})})}(o.cmd,r);break;case"open-app":p=await function(e,o){return new Promise(r=>{const s=u("open",["-a",e,o],{stdio:["ignore","ignore","pipe"],detached:!0});let t="";s.stderr.on("data",e=>{t+=e.toString()}),s.on("error",o=>{r({success:!1,error:o,detail:`open -a "${e}" 启动失败: ${o.message}`})}),s.on("close",o=>{s.unref(),r(0!==o?{success:!1,error:new Error(`exit code ${o}`),detail:`open -a "${e}" 退出码: ${o}${t?", stderr: "+t.trim():""}`}:{success:!0})})})}(o.appName,r);break;case"osascript":p=await function(e,o){return new Promise(r=>{const s=u("osascript",["-e",`tell application "${e}" to open POSIX file "${o}"`],{stdio:["ignore","pipe","pipe"],detached:!0});let t="",n="";s.stdout.on("data",e=>{t+=e.toString()}),s.stderr.on("data",e=>{n+=e.toString()}),s.on("error",e=>{r({success:!1,error:e,detail:`osascript 启动失败: ${e.message}`})}),s.on("close",o=>{s.unref(),r(0!==o?{success:!1,error:new Error(`osascript exit code ${o}`),detail:`osascript "${e}" 失败: ${n.trim()||t.trim()||"exit "+o}`}:{success:!0})})})}(o.appName,r);break;case"app":p=await function(e,o){const r=i;return new Promise(s=>{r(e,o).then(()=>s({success:!0})).catch(e=>s({success:!1,error:e,detail:`open 包启动失败: ${e.message}`}))})}(r,{app:o.app});break;default:p={success:!1,detail:`未知策略类型: ${o.type}`}}if(p.success){a.stop();const e=n[o.type]||o.type;g(`${m}已成功使用 ${s}(${e})打开项目: ${r}`),p.warning&&f(` ⚠ ${p.warning}`),process.exit(0)}else c.push(`[${s}] ${n[o.type]}: ${p.detail||p.error?.message||"失败"}`),await y(e+1)};await y(0)}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("node:path"),o=require("node:fs"),r=require("node:child_process"),s=require("ora"),n=require("../neoParams.js"),i=require("../common.js"),t=require("open");var a,c;exports.__require=function(){if(c)return a;c=1;const p=e,d=o,{spawn:u}=r,l=s,{consoleTag:m}=n.__require(),{errorLog:g,successLog:$,warningLog:y}=i.__require(),f={codebuddy:{name:"CodeBuddy",cli:["codebuddy","codebuddy-cn"],apps:["CodeBuddy CN","CodeBuddy","codebuddy"],win32:[{app:{name:"CodeBuddy CN"}},{app:{name:"codebuddy"}},{app:{name:"CodeBuddy"}}],linux:[{app:{name:"codebuddy-cn"}},{app:{name:"codebuddy"}}]},kiro:{name:"Kiro",cli:["kiro"],apps:["Kiro","kiro"],win32:[{app:{name:"Kiro"}},{app:{name:"kiro"}}],linux:[{app:{name:"kiro"}}]},cursor:{name:"Cursor",cli:["cursor"],apps:["Cursor","cursor"],win32:[{app:{name:"Cursor"}},{app:{name:"cursor"}}],linux:[{app:{name:"cursor"}}]},vscode:{name:"Visual Studio Code",cli:["code"],apps:["Visual Studio Code","Code"],win32:[{app:{name:"Visual Studio Code"}},{app:{name:"Code"}},{app:{name:"code"}}],linux:[{app:{name:"code"}}]}},h=["codebuddy","kiro","cursor","vscode"],w=function(){const e=process.env.HOME||process.env.USERPROFILE||"",o=process.env.LOCALAPPDATA||"",r=process.platform,s=["/usr/local/bin","/opt/homebrew/bin",e?p.join(e,".local","bin"):null,e?p.join(e,".local","share"):null],n=[o?p.join(o,"Programs","CodeBuddy CN","bin"):null,o?p.join(o,"Programs","CodeBuddy","bin"):null,o?p.join(o,"Programs","Kiro","bin"):null,o?p.join(o,"Programs","Cursor","bin"):null,o?p.join(o,"Programs","Microsoft VS Code","bin"):null,e?p.join(e,"AppData","Roaming","npm"):null],i=("win32"===r?n:s).filter(Boolean),t=(process.env.PATH||"").split(p.delimiter).filter(Boolean);return i.forEach(e=>{!t.includes(e)&&d.existsSync(e)&&t.unshift(e)}),t.join(p.delimiter)},C=function(e,o){const r=function(e){if(!e)return"auto";const o=String(e).toLowerCase();return"code"===o?"vscode":o}(e),s="darwin"===o,n=(e,r)=>{const n=[];if(e.cli&&e.cli.length>0&&e.cli.forEach(o=>{n.push({type:"cli",cmd:o,__editorName:e.name,__editorKey:r})}),s)e.apps&&e.apps.length>0&&e.apps.forEach(o=>{n.push({type:"open-app",appName:o,__editorName:e.name,__editorKey:r})}),e.apps&&e.apps.length>0&&n.push({type:"osascript",appName:e.apps[0],__editorName:e.name,__editorKey:r});else{const s=e[o];s&&s.length>0&&s.forEach(o=>{n.push({type:"app",...o,__editorName:e.name,__editorKey:r})})}return n};if("auto"===r){const e=[];return h.forEach(o=>{const r=f[o];r&&e.push(...n(r,o))}),{configs:e,editorName:"编辑器"}}const i=f[r];return i?{configs:n(i,r),editorName:i.name}:{configs:[],editorName:"编辑器"}};return a=async function(e,o){const r=o?p.resolve(o):process.cwd();d.existsSync(r)||(g(`目录不存在: ${r}`),process.exit(1));d.statSync(r).isDirectory()||(g(`路径不是目录: ${r}`),process.exit(1));const s=process.platform;["darwin","win32","linux"].includes(s)||(g(`不支持的操作系统: ${s}`),process.exit(1));const{configs:n,editorName:i}=C(e,s);0===n.length&&(g(`不支持的编辑器类型: ${e}`),process.exit(1));const a=l(`${m}正在尝试使用 ${i} 打开项目: ${r}`).start(),c=[],f=async e=>{e>=n.length&&(a.fail(),g("无法打开编辑器,已尝试所有可用方式。"),console.log(""),console.log(` 目标目录: ${r}`),console.log(` 尝试次数: ${c.length}`),c.forEach((e,o)=>{console.log(` [${o+1}] ${e}`)}),console.log(""),console.log(" 请确保已安装 CodeBuddy、Kiro、Cursor 或 Visual Studio Code 其中之一。"),process.exit(1));const o=n[e],s=o.__editorName||"未知编辑器",i={cli:`CLI (${o.cmd})`,"open-app":`open -a "${o.appName}"`,osascript:"AppleScript",app:"应用名称"};let p;switch(a.text=`${m}正在使用 ${s} (${i[o.type]||o.type}) 打开: ${r}`,o.type){case"cli":p=await function(e,o){return new Promise(r=>{const s={...process.env,PATH:w()};let n="";const i=u(e,[o],{env:s,stdio:["ignore","ignore","pipe"],detached:!0});i.stderr.on("data",e=>{n+=e.toString()}),i.on("error",o=>{r({success:!1,error:o,detail:`CLI 命令 "${e}" 启动失败: ${o.message}`})}),i.on("close",o=>{i.unref(),0===o?n.trim()?r({success:!0,warning:n.trim()}):r({success:!0}):r({success:!1,error:new Error(`exit code ${o}`),detail:`CLI 命令 "${e}" 退出码: ${o}${n?", stderr: "+n.trim():""}`})})})}(o.cmd,r);break;case"open-app":p=await function(e,o){return new Promise(r=>{const s=u("open",["-a",e,o],{stdio:["ignore","ignore","pipe"],detached:!0});let n="";s.stderr.on("data",e=>{n+=e.toString()}),s.on("error",o=>{r({success:!1,error:o,detail:`open -a "${e}" 启动失败: ${o.message}`})}),s.on("close",o=>{s.unref(),r(0!==o?{success:!1,error:new Error(`exit code ${o}`),detail:`open -a "${e}" 退出码: ${o}${n?", stderr: "+n.trim():""}`}:{success:!0})})})}(o.appName,r);break;case"osascript":p=await function(e,o){return new Promise(r=>{const s=u("osascript",["-e",`tell application "${e}" to open POSIX file "${o}"`],{stdio:["ignore","pipe","pipe"],detached:!0});let n="",i="";s.stdout.on("data",e=>{n+=e.toString()}),s.stderr.on("data",e=>{i+=e.toString()}),s.on("error",e=>{r({success:!1,error:e,detail:`osascript 启动失败: ${e.message}`})}),s.on("close",o=>{s.unref(),r(0!==o?{success:!1,error:new Error(`osascript exit code ${o}`),detail:`osascript "${e}" 失败: ${i.trim()||n.trim()||"exit "+o}`}:{success:!0})})})}(o.appName,r);break;case"app":p=await function(e,o){const r=t;return new Promise(s=>{r(e,o).then(()=>s({success:!0})).catch(e=>s({success:!1,error:e,detail:`open 包启动失败: ${e.message}`}))})}(r,{app:o.app});break;default:p={success:!1,detail:`未知策略类型: ${o.type}`}}if(p.success){a.stop();const e=i[o.type]||o.type;$(`${m}已成功使用 ${s}(${e})打开项目: ${r}`),p.warning&&y(` ⚠ ${p.warning}`),process.exit(0)}else c.push(`[${s}] ${i[o.type]}: ${p.detail||p.error?.message||"失败"}`),await f(e+1)};await f(0)}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("fs-extra"),e=require("node:path"),i=require("node:os"),r=require("axios"),n=require("ora"),s=require("adm-zip"),o=require("chalk"),a=require("../neoParams.js"),c=require("../common.js"),l=require("./skillDirs.js");var u,f;exports.__require=function(){if(f)return u;f=1;const p=t,y=e,m=i,d=r,$=n,g=s,h=o,{consoleTag:w}=a.__require(),{errorLog:S,warningLog:k,successLog:j}=c.__require(),{getSkillDir:x,getProductName:D}=l.__require(),L="https://neo-cmp-docs.netlify.app/skills.zip",q="skills.json",v=["neo-cmp-cli","neo-cmp-dev","vue-to-react","frontend-design"];async function _(t,e,i){await p.ensureDir(e);const r=(await p.readdir(t)).filter(e=>{const i=y.join(t,e);return p.statSync(i).isDirectory()}),n=[],s=[];for(const o of r){if(i&&i.length>0&&!i.includes(o)){s.push(o);continue}const r=y.join(t,o),a=y.join(e,o);await p.remove(a),await p.copy(r,a),n.push(o)}return{copied:n,skipped:s}}async function A(t){try{t&&await p.pathExists(t)&&await p.remove(t)}catch(t){}}async function B(t){t&&(t.text=`${w}正在下载技能包压缩包...`);const{zipFilePath:e,tempDir:i}=await async function(){const t=y.join(m.tmpdir(),"neo-cli-skills");await p.ensureDir(t);const e=y.join(t,`neo-cmp-skills-${Date.now()}.zip`),i=await d.get(L,{responseType:"arraybuffer",timeout:6e4,maxContentLength:1/0,maxBodyLength:1/0,maxRedirects:5,validateStatus:t=>t>=200&&t<400}),r=i.headers&&i.headers["content-type"]||"";if(/text\/html/i.test(r))throw new Error(`下载技能包失败:返回内容类型为 ${r},请确认资源地址是否可访问(${L})。`);let n;return n=Buffer.isBuffer(i.data)?i.data:i.data instanceof ArrayBuffer?Buffer.from(i.data):i.data&&i.data.buffer instanceof ArrayBuffer?Buffer.from(i.data.buffer):Buffer.from(i.data),await p.writeFile(e,n),{zipFilePath:e,tempDir:t}}();t&&(t.text=`${w}正在解压技能包...`);const r=y.join(i,`extracted-${Date.now()}`);try{!function(t,e){const i=new g(t);p.ensureDirSync(e),i.extractAllTo(e,!0)}(e,r)}catch(t){throw new Error(`解压技能包失败:${t.message||t}。请确认下载的资源为有效的 zip 压缩包。`)}const n=function(t){const e=t=>!(!p.existsSync(t)||!p.statSync(t).isDirectory())&&p.readdirSync(t).some(e=>{const i=y.join(t,e);return p.statSync(i).isDirectory()&&(p.existsSync(y.join(i,"SKILL.md"))||p.existsSync(y.join(i,"skill.md")))});if(e(t))return t;const i=p.readdirSync(t).filter(e=>{const i=y.join(t,e);return p.statSync(i).isDirectory()});for(const r of i){const i=y.join(t,r);if(e(i))return i}return t}(r),s=function(t){const e=y.join(t,q);if(!p.existsSync(e))return null;try{const t=p.readFileSync(e,"utf-8"),i=JSON.parse(t);if(!Array.isArray(i))return null;const r=i.map(t=>t&&"string"==typeof t.name?t.name.trim():"").filter(Boolean);return r.length>0?r:null}catch(t){return null}}(n),o=s&&s.length>0?s:v;if(!(await p.readdir(n)).filter(t=>{const e=y.join(n,t);return p.statSync(e).isDirectory()}).some(t=>o.includes(t)))throw new Error(`解压后未在技能包中找到预期的 skill 目录(期望包含:${o.join(", ")})。`);return{skillsRoot:n,tempDir:i,officialSkills:o}}return u={SKILLS_ZIP_URL:L,SKILLS_MANIFEST_FILE:q,DEFAULT_OFFICIAL_SKILLS:v,installSkills:async function(t){const e=D(t),i=x(t),r=$(`${w}准备安装技能包到 ${e}(${i})...`).start();let n;try{const t=await B(r);n=t.tempDir,r.text=`${w}正在安装技能包到 ${e}...`;const{copied:s}=await _(t.skillsRoot,i);if(r.stop(),0===s.length)return void k("技能包中未找到可安装的 skill。");j(`已成功安装技能包到 ${e}!目录:${i}\n已安装的 skills:${s.map(t=>h.cyan(t)).join(", ")}`)}catch(t){S(`安装技能包失败:${t.message||t.msg||t}`,r),process.exit(1)}finally{await A(n)}},updateSkills:async function(t){const e=D(t),i=x(t),r=$(`${w}准备更新技能包到 ${e}(${i})...`).start();let n;try{const t=await B(r);n=t.tempDir;const s=t.officialSkills;r.text=`${w}正在更新 ${e} 的技能包(覆盖式 copy)...`;const{copied:o,skipped:a}=await _(t.skillsRoot,i,s);if(r.stop(),0===o.length)return void k(`未找到可更新的 skill(期望包含:${s.join(", ")}),请确认技能包内容是否完整。`);j(`已成功更新 ${e} 的技能包!目录:${i}\n已更新的 skills:${o.map(t=>h.cyan(t)).join(", ")}`),a.length>0&&console.log(h.gray(`[neo update cli-skills] 跳过的 skills(非官方维护列表):${a.join(", ")}`))}catch(t){S(`更新技能包失败:${t.message||t.msg||t}`,r),process.exit(1)}finally{await A(n)}},removeSkills:async function(t,e=[]){const i=D(t),r=x(t);if(!await p.pathExists(r))return void k(`${i} 的 skill 目录不存在(${r}),无需移除。`);const n=$(`${w}正在从 ${i}(${r})中移除技能包...`).start(),s=[],o=[];try{const t=Array.isArray(e)?e.map(t=>"string"==typeof t?t.trim():"").filter(Boolean):[],a=Array.from(new Set([...v,...t]));for(const t of a){const e=y.join(r,t);await p.pathExists(e)?(await p.remove(e),s.push(t)):o.push(t)}if(n.stop(),0===s.length)return void k(`未在 ${i}(${r})中找到可移除的 skill(期望:${a.join(", ")})。`);j(`已从 ${i} 中移除技能包!目录:${r}\n已移除的 skills:${s.map(t=>h.cyan(t)).join(", ")}`),o.length>0&&console.log(h.gray(`[neo remove cli-skills] 未找到的 skills:${o.join(", ")}`))}catch(t){S(`移除技能包失败:${t.message||t.msg||t}`,n),process.exit(1)}}}};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("fs-extra"),e=require("node:path"),i=require("node:os"),r=require("axios"),n=require("ora"),s=require("adm-zip"),o=require("chalk"),a=require("../neoParams.js"),c=require("../common.js"),l=require("./skillDirs.js");var u,f;exports.__require=function(){if(f)return u;f=1;const p=t,y=e,d=i,m=r,$=n,g=s,h=o,{consoleTag:w}=a.__require(),{errorLog:S,warningLog:k,successLog:j}=c.__require(),{getSkillDir:x,getProductName:D}=l.__require(),L="https://neo-cmp-docs.netlify.app/skills.zip",v="skills.json",q=["neo-cmp-cli","neo-cmp-dev","neo-code-review","vue-to-react","frontend-design"];async function _(t,e,i){await p.ensureDir(e);const r=(await p.readdir(t)).filter(e=>{const i=y.join(t,e);return p.statSync(i).isDirectory()}),n=[],s=[];for(const o of r){if(i&&i.length>0&&!i.includes(o)){s.push(o);continue}const r=y.join(t,o),a=y.join(e,o);await p.remove(a),await p.copy(r,a),n.push(o)}return{copied:n,skipped:s}}async function A(t){try{t&&await p.pathExists(t)&&await p.remove(t)}catch(t){}}async function B(t){t&&(t.text=`${w}正在下载技能包压缩包...`);const{zipFilePath:e,tempDir:i}=await async function(){const t=y.join(d.tmpdir(),"neo-cli-skills");await p.ensureDir(t);const e=y.join(t,`neo-cmp-skills-${Date.now()}.zip`),i=await m.get(L,{responseType:"arraybuffer",timeout:6e4,maxContentLength:1/0,maxBodyLength:1/0,maxRedirects:5,validateStatus:t=>t>=200&&t<400}),r=i.headers&&i.headers["content-type"]||"";if(/text\/html/i.test(r))throw new Error(`下载技能包失败:返回内容类型为 ${r},请确认资源地址是否可访问(${L})。`);let n;return n=Buffer.isBuffer(i.data)?i.data:i.data instanceof ArrayBuffer?Buffer.from(i.data):i.data&&i.data.buffer instanceof ArrayBuffer?Buffer.from(i.data.buffer):Buffer.from(i.data),await p.writeFile(e,n),{zipFilePath:e,tempDir:t}}();t&&(t.text=`${w}正在解压技能包...`);const r=y.join(i,`extracted-${Date.now()}`);try{!function(t,e){const i=new g(t);p.ensureDirSync(e),i.extractAllTo(e,!0)}(e,r)}catch(t){throw new Error(`解压技能包失败:${t.message||t}。请确认下载的资源为有效的 zip 压缩包。`)}const n=function(t){const e=t=>!(!p.existsSync(t)||!p.statSync(t).isDirectory())&&p.readdirSync(t).some(e=>{const i=y.join(t,e);return p.statSync(i).isDirectory()&&(p.existsSync(y.join(i,"SKILL.md"))||p.existsSync(y.join(i,"skill.md")))});if(e(t))return t;const i=p.readdirSync(t).filter(e=>{const i=y.join(t,e);return p.statSync(i).isDirectory()});for(const r of i){const i=y.join(t,r);if(e(i))return i}return t}(r),s=function(t){const e=y.join(t,v);if(!p.existsSync(e))return null;try{const t=p.readFileSync(e,"utf-8"),i=JSON.parse(t);if(!Array.isArray(i))return null;const r=i.map(t=>t&&"string"==typeof t.name?t.name.trim():"").filter(Boolean);return r.length>0?r:null}catch(t){return null}}(n),o=s&&s.length>0?s:q;if(!(await p.readdir(n)).filter(t=>{const e=y.join(n,t);return p.statSync(e).isDirectory()}).some(t=>o.includes(t)))throw new Error(`解压后未在技能包中找到预期的 skill 目录(期望包含:${o.join(", ")})。`);return{skillsRoot:n,tempDir:i,officialSkills:o}}return u={SKILLS_ZIP_URL:L,SKILLS_MANIFEST_FILE:v,DEFAULT_OFFICIAL_SKILLS:q,installSkills:async function(t){const e=D(t),i=x(t),r=$(`${w}准备安装技能包到 ${e}(${i})...`).start();let n;try{const t=await B(r);n=t.tempDir,r.text=`${w}正在安装技能包到 ${e}...`;const{copied:s}=await _(t.skillsRoot,i);if(r.stop(),0===s.length)return void k("技能包中未找到可安装的 skill。");j(`已成功安装技能包到 ${e}!目录:${i}\n已安装的 skills:${s.map(t=>h.cyan(t)).join(", ")}`)}catch(t){S(`安装技能包失败:${t.message||t.msg||t}`,r),process.exit(1)}finally{await A(n)}},updateSkills:async function(t){const e=D(t),i=x(t),r=$(`${w}准备更新技能包到 ${e}(${i})...`).start();let n;try{const t=await B(r);n=t.tempDir;const s=t.officialSkills;r.text=`${w}正在更新 ${e} 的技能包(覆盖式 copy)...`;const{copied:o,skipped:a}=await _(t.skillsRoot,i,s);if(r.stop(),0===o.length)return void k(`未找到可更新的 skill(期望包含:${s.join(", ")}),请确认技能包内容是否完整。`);j(`已成功更新 ${e} 的技能包!目录:${i}\n已更新的 skills:${o.map(t=>h.cyan(t)).join(", ")}`),a.length>0&&console.log(h.gray(`[neo update cli-skills] 跳过的 skills(非官方维护列表):${a.join(", ")}`))}catch(t){S(`更新技能包失败:${t.message||t.msg||t}`,r),process.exit(1)}finally{await A(n)}},removeSkills:async function(t,e=[]){const i=D(t),r=x(t);if(!await p.pathExists(r))return void k(`${i} 的 skill 目录不存在(${r}),无需移除。`);const n=$(`${w}正在从 ${i}(${r})中移除技能包...`).start(),s=[],o=[];try{const t=Array.isArray(e)?e.map(t=>"string"==typeof t?t.trim():"").filter(Boolean):[],a=Array.from(new Set([...q,...t]));for(const t of a){const e=y.join(r,t);await p.pathExists(e)?(await p.remove(e),s.push(t)):o.push(t)}if(n.stop(),0===s.length)return void k(`未在 ${i}(${r})中找到可移除的 skill(期望:${a.join(", ")})。`);j(`已从 ${i} 中移除技能包!目录:${r}\n已移除的 skills:${s.map(t=>h.cyan(t)).join(", ")}`),o.length>0&&console.log(h.gray(`[neo remove cli-skills] 未找到的 skills:${o.join(", ")}`))}catch(t){S(`移除技能包失败:${t.message||t.msg||t}`,n),process.exit(1)}}}};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo-cmp-cli",
3
- "version": "1.15.6",
3
+ "version": "1.15.8",
4
4
  "description": "Neo 自定义组件开发工具,支持react 和 vue2.0技术栈。",
5
5
  "keywords": [
6
6
  "neo-cli",
@@ -48,7 +48,7 @@
48
48
  "@commitlint/config-conventional": "^18.0.0",
49
49
  "@types/react": "^16.9.11",
50
50
  "@types/react-dom": "^16.9.15",
51
- "neo-cmp-cli": "^1.15.6",
51
+ "neo-cmp-cli": "^1.15.8",
52
52
  "husky": "^4.2.5",
53
53
  "lint-staged": "^10.2.9",
54
54
  "prettier": "^2.0.5"
@@ -52,7 +52,7 @@
52
52
  "@types/react": "^16.9.11",
53
53
  "@types/react-dom": "^16.9.15",
54
54
  "@types/axios": "^0.14.0",
55
- "neo-cmp-cli": "^1.15.6",
55
+ "neo-cmp-cli": "^1.15.8",
56
56
  "husky": "^4.2.5",
57
57
  "lint-staged": "^10.2.9",
58
58
  "prettier": "^2.0.5",
@@ -48,7 +48,7 @@
48
48
  "@commitlint/config-conventional": "^18.0.0",
49
49
  "@types/react": "^16.9.11",
50
50
  "@types/react-dom": "^16.9.15",
51
- "neo-cmp-cli": "^1.15.6",
51
+ "neo-cmp-cli": "^1.15.8",
52
52
  "husky": "^4.2.5",
53
53
  "lint-staged": "^10.2.9",
54
54
  "prettier": "^2.0.5",
@@ -47,7 +47,7 @@
47
47
  "@commitlint/config-conventional": "^18.0.0",
48
48
  "@types/react": "^16.9.11",
49
49
  "@types/react-dom": "^16.9.15",
50
- "neo-cmp-cli": "^1.15.6",
50
+ "neo-cmp-cli": "^1.15.8",
51
51
  "husky": "^4.2.5",
52
52
  "lint-staged": "^10.2.9",
53
53
  "prettier": "^2.0.5"
@@ -53,7 +53,7 @@
53
53
  "@types/react-dom": "^16.9.15",
54
54
  "husky": "^4.2.5",
55
55
  "lint-staged": "^10.2.9",
56
- "neo-cmp-cli": "^1.15.6",
56
+ "neo-cmp-cli": "^1.15.8",
57
57
  "prettier": "^2.0.5"
58
58
  },
59
59
  "overrides": {
@@ -17,8 +17,6 @@
17
17
  "pullCmp": "neo pull cmp",
18
18
  "deleteCmp": "neo delete cmp",
19
19
  "preview": "neo preview -n entityForm__c -m online",
20
- "addSkills": "neo add cli-skills",
21
- "removeSkills": "neo remove cli-skills",
22
20
  "format": "prettier --write \"src/**/**/*.{js,jsx,ts,tsx,vue,scss,json}\""
23
21
  },
24
22
  "files": [
@@ -57,7 +55,7 @@
57
55
  "@types/react": "^16.9.11",
58
56
  "@types/react-dom": "^16.9.15",
59
57
  "@types/axios": "^0.14.0",
60
- "neo-cmp-cli": "^1.15.6",
58
+ "neo-cmp-cli": "^1.15.8",
61
59
  "husky": "^4.2.5",
62
60
  "lint-staged": "^10.2.9",
63
61
  "prettier": "^2.0.5"
@@ -53,7 +53,7 @@
53
53
  "@types/react-dom": "^16.9.15",
54
54
  "husky": "^4.2.5",
55
55
  "lint-staged": "^10.2.9",
56
- "neo-cmp-cli": "^1.15.6",
56
+ "neo-cmp-cli": "^1.15.8",
57
57
  "prettier": "^2.0.5"
58
58
  },
59
59
  "overrides": {
@@ -52,7 +52,7 @@
52
52
  "@types/react-dom": "^16.9.15",
53
53
  "husky": "^4.2.5",
54
54
  "lint-staged": "^10.2.9",
55
- "neo-cmp-cli": "^1.15.6",
55
+ "neo-cmp-cli": "^1.15.8",
56
56
  "prettier": "^2.0.5"
57
57
  },
58
58
  "overrides": {
@@ -46,7 +46,7 @@
46
46
  "devDependencies": {
47
47
  "@commitlint/cli": "^18.0.0",
48
48
  "@commitlint/config-conventional": "^18.0.0",
49
- "neo-cmp-cli": "^1.15.6",
49
+ "neo-cmp-cli": "^1.15.8",
50
50
  "husky": "^4.2.5",
51
51
  "lint-staged": "^10.2.9",
52
52
  "prettier": "^2.0.5"