neo-cmp-cli 1.15.7 → 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.
- package/dist/package.json.js +1 -1
- package/dist/utils/skillUtils/skillManager.js +1 -1
- package/package.json +1 -1
- package/template/antd-custom-cmp-template/package.json +1 -1
- package/template/asset-manage-template/package.json +1 -1
- package/template/echarts-custom-cmp-template/package.json +1 -1
- package/template/map-custom-cmp-template/package.json +1 -1
- package/template/neo-bi-cmps/package.json +1 -1
- package/template/neo-custom-cmp-template/package.json +1 -1
- package/template/neo-pipeline-cmps/package.json +1 -1
- package/template/neo-web-entity-grid/package.json +1 -1
- package/template/react-custom-cmp-template/package.json +1 -1
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e="1.15.
|
|
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 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,
|
|
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