neo-cmp-cli 1.15.6 → 1.15.7
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
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.7";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"),
|
|
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)}};
|
package/package.json
CHANGED
|
@@ -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": [
|