superpowers-mcp 6.4.5 → 6.4.6
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.es.md +9 -2
- package/README.hi.md +9 -2
- package/README.ja.md +9 -2
- package/README.ko.md +9 -2
- package/README.md +9 -2
- package/README.pt-BR.md +9 -2
- package/README.zh-TW.md +9 -2
- package/out/server.js +77 -73
- package/out/setup-runner.js +27 -23
- package/out/setup.js +28 -24
- package/package.json +3 -2
- package/skills/brainstorming/scripts/server.cjs +7 -2
package/out/setup-runner.js
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`||f==="\r")&&(g=!1,n.push(f));continue}if(c){f==="*"&&
|
|
3
|
-
`&&f!=="\r"&&(j=-1),n.push(f)}return n.join("")}var
|
|
4
|
-
`)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";var Z=Object.create;var T=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var ee=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var se=(e,t)=>{for(var r in t)T(e,r,{get:t[r],enumerable:!0})},K=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ee(t))!ne.call(e,s)&&s!==r&&T(e,s,{get:()=>t[s],enumerable:!(n=X(t,s))||n.enumerable});return e};var I=(e,t,r)=>(r=e!=null?Z(te(e)):{},K(t||!e||!e.__esModule?T(r,"default",{value:e,enumerable:!0}):r,e)),re=e=>K(T({},"__esModule",{value:!0}),e);var de={};se(de,{HARNESS_CONFIGS:()=>W,JSON_SERVER_ROOT_KEYS:()=>z,isPlainObject:()=>A,runSetup:()=>Q,runSetupCli:()=>fe,safeWriteConfig:()=>B,stripJsonComments:()=>G,updateJsonConfig:()=>Y,updateTomlConfig:()=>F,updateYamlConfig:()=>V});module.exports=re(de);var u=I(require("fs")),o=I(require("path")),R=I(require("os")),H=I(require("crypto")),W={lmstudio:{name:"LM Studio",aliases:["lmstudio","lm-studio"],getConfigPath:(e,t)=>o.join(t,".lmstudio","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},roo:{name:"Roo Code (VS Code Desktop)",aliases:["roo","roo-code","roocode"],getConfigPath:(e,t,r)=>{let n=e==="win32"?r||o.join(t,"AppData","Roaming"):e==="darwin"?o.join(t,"Library","Application Support"):o.join(t,".config");return o.join(n,"Code","User","globalStorage","rooveterinaryinc.roo-cline","settings","mcp_settings.json")},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},copilot:{name:"GitHub Copilot (VS Code)",aliases:["vscode","code","copilot"],getConfigPath:(e,t,r,n)=>e==="win32"?o.join(r||o.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?o.join(t,"Library","Application Support","Code","User","mcp.json"):o.join(t,".config","Code","User","mcp.json"),type:"json-servers",defaultConfig:(e,t)=>({command:e,args:t,type:"stdio"})},"copilot-insiders":{name:"GitHub Copilot (VS Code Insiders)",aliases:["vscode-insiders","code-insiders","insiders","insider","vscode-insider","code-insider","copilot-insider"],getConfigPath:(e,t,r,n)=>e==="win32"?o.join(r||o.join(t,"AppData","Roaming"),"Code - Insiders","User","mcp.json"):e==="darwin"?o.join(t,"Library","Application Support","Code - Insiders","User","mcp.json"):o.join(t,".config","Code - Insiders","User","mcp.json"),type:"json-servers",defaultConfig:(e,t)=>({command:e,args:t,type:"stdio"})},cursor:{name:"Cursor",aliases:["cursor"],getConfigPath:(e,t)=>o.join(t,".cursor","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},hermes:{name:"Hermes Desktop / Agent",aliases:["hermes","hermes-desktop"],getConfigPath:(e,t,r,n)=>{if(e==="win32"){let s=n||o.join(t,"AppData","Local");return o.join(s,"hermes","config.yaml")}return o.join(t,".hermes","config.yaml")},type:"yaml",defaultConfig:(e,t)=>({command:e,args:t})},kimi:{name:"Kimi Work / Kimi Code",aliases:["kimi","kimi-work","kimi-code"],getConfigPath:(e,t)=>o.join(t,".kimi-code","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},claude:{name:"Claude Desktop",aliases:["claude","claude-desktop"],getConfigPath:(e,t,r)=>e==="win32"?o.join(r||o.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?o.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):o.join(t,".config","Claude","claude_desktop_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},devin:{name:"Devin Desktop (formerly Windsurf)",aliases:["devin","devin-desktop","windsurf","codeium"],getConfigPath:(e,t,r)=>{let n=e==="win32"&&r?r:o.join(t,".config"),s=o.join(n,"devin","mcp_config.json");return u.existsSync(s)?s:o.join(t,".codeium","windsurf","mcp_config.json")},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},antigravity:{name:"Antigravity (Google DeepMind)",aliases:["antigravity","agy","gemini"],getConfigPath:(e,t)=>o.join(t,".gemini","config","mcp_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},"pi-desktop":{name:"Pi Desktop / Pi Agent",aliases:["pi-desktop","pi","pi-agent"],getConfigPath:(e,t,r)=>{if(e==="win32"){let p=o.join(r||o.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(u.existsSync(p))return p;let g=o.join(t,".pi","agent","mcp.json");if(u.existsSync(g))return g;let c=o.join(t,".pi","mcp.json");return u.existsSync(c)?c:g}let n=o.join(t,".pi","agent","mcp.json");if(u.existsSync(n))return n;let s=o.join(t,".pi","mcp.json");return u.existsSync(s)?s:n},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},qwenpaw:{name:"QwenPaw (Personal Agent Workstation)",aliases:["qwenpaw","qwen-paw","copaw"],getConfigPath:(e,t)=>{let r=o.join(t,".qwenpaw","config.json");if(u.existsSync(r))return r;let n=o.join(t,".copaw","config.json");return u.existsSync(n)?n:r},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},cline:{name:"Cline (VS Code / CLI)",aliases:["cline","claude-dev"],getConfigPath:(e,t,r)=>{let n="";if(e==="win32"?n=o.join(r||o.join(t,"AppData","Roaming"),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):e==="darwin"?n=o.join(t,"Library","Application Support","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):n=o.join(t,".config","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),u.existsSync(n))return n;let s=o.join(t,".cline","data","settings","cline_mcp_settings.json");return u.existsSync(s)?s:n},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kilo:{name:"Kilo Code",aliases:["kilo","kilocode","kilo-code"],getConfigPath:(e,t)=>{let r=o.join(t,".config","kilo","kilo.jsonc");if(u.existsSync(r))return r;let n=o.join(t,".config","kilo","kilo.json");return u.existsSync(n)?n:r},type:"json-mcp",defaultConfig:(e,t)=>({type:"local",command:[e,...t],enabled:!0})},qoder:{name:"Qoder",aliases:["qoder"],getConfigPath:(e,t)=>o.join(t,".qoder","settings.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kiro:{name:"Kiro",aliases:["kiro","kiro-code"],getConfigPath:(e,t)=>o.join(t,".kiro","settings","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},trae:{name:"Trae",aliases:["trae"],getConfigPath:(e,t,r)=>{if(e==="win32"){let n=o.join(r||o.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(u.existsSync(n))return n;let s=o.join(r||o.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return u.existsSync(s)?s:n}else if(e==="darwin"){let n=o.join(t,"Library","Application Support","Trae","User","mcp.json");if(u.existsSync(n))return n;let s=o.join(t,"Library","Application Support","Trae CN","User","mcp.json");return u.existsSync(s)?s:n}else{let n=o.join(t,".config","Trae","User","mcp.json");if(u.existsSync(n))return n;let s=o.join(t,".config","Trae CN","User","mcp.json");return u.existsSync(s)?s:n}},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},codex:{name:"Codex",aliases:["codex"],getConfigPath:(e,t)=>o.join(t,".codex","config.toml"),type:"toml",defaultConfig:(e,t)=>({command:e,args:t})},openclaw:{name:"OpenClaw",aliases:["openclaw","open-claw"],getConfigPath:(e,t)=>o.join(t,".openclaw","openclaw.json"),type:"json-mcpServers",serverPath:["mcp","servers"],defaultConfig:(e,t)=>({command:e,args:t})},goose:{name:"Goose",aliases:["goose"],getConfigPath:(e,t,r)=>e==="win32"?o.join(r||o.join(t,"AppData","Roaming"),"Block","goose","config","config.yaml"):o.join(t,".config","goose","config.yaml"),type:"yaml",yamlProfile:"goose",defaultConfig:(e,t)=>({cmd:e,args:t})}},z=["mcpServers","servers","mcp"];function A(e){return Object.prototype.toString.call(e)==="[object Object]"}function G(e,t=!1){if(!e)return"";if(!t)try{return JSON.parse(e),e}catch{}let r=e.length,n=[],s=!1,p=!1,g=!1,c=!1,j=-1;for(let l=0;l<r;l++){let f=e[l],C=l+1<r?e[l+1]:"";if(g){(f===`
|
|
2
|
+
`||f==="\r")&&(g=!1,n.push(f));continue}if(c){f==="*"&&C==="/"&&(c=!1,l++);continue}if(s){n.push(f),p?p=!1:f==="\\"?p=!0:f==='"'&&(s=!1);continue}if(f==='"'){s=!0,p=!1,j=-1,n.push(f);continue}if(f==="/"&&C==="/"){g=!0,l++;continue}if(f==="/"&&C==="*"){c=!0,l++;continue}if(f===","){j=n.length,n.push(f);continue}if(f==="}"||f==="]"){j!==-1&&(n[j]=" ",j=-1),n.push(f);continue}f!==" "&&f!==" "&&f!==`
|
|
3
|
+
`&&f!=="\r"&&(j=-1),n.push(f)}return n.join("")}var M=/\s/;function oe(e){for(let t=1;t<e.length;t++){if(e[t]!=="#"||!M.test(e[t-1]))continue;let r=t-1;for(;r>0&&M.test(e[r-1]);)r--;return e.slice(r)}return""}function V(e,t,r,n=!1,s="mcp"){let p=s==="goose"?{rootKey:"extensions",ownedKeys:["cmd","args","type"],freshEntry:(i,d,y)=>[`${i}superpowers:`,`${i}${i}name: "Superpowers"`,`${i}${i}cmd: ${JSON.stringify(d)}`,`${i}${i}args: ${JSON.stringify(y)}`,`${i}${i}enabled: true`,`${i}${i}type: stdio`,`${i}${i}timeout: 300`]}:{rootKey:"mcp_servers",ownedKeys:["command","args"],freshEntry:(i,d,y)=>[`${i}superpowers:`,`${i}${i}command: ${JSON.stringify(d)}`,`${i}${i}args: ${JSON.stringify(y)}`]};if(!/^[A-Za-z0-9_-]+$/.test(p.rootKey))throw new Error("Invalid YAML root key");let g=new RegExp(`^(\\s*)["']?${p.rootKey}["']?\\s*:`),c=new RegExp(`^(\\s*)["']?${p.rootKey}["']?\\s*:\\s*(?:#.*)?$`),j=new RegExp(`^\\s*["']?(?:${p.ownedKeys.join("|")})["']?\\s*:`),l=e?e.split(/\r?\n/):[],f=e.includes(`\r
|
|
4
|
+
`)?`\r
|
|
5
|
+
`:`
|
|
6
|
+
`,C=(i,d)=>{let y=i.length,E=0;for(;y>0&&i[y-1]===`
|
|
7
|
+
`&&(d<0||E<d);)y--,y>0&&i[y-1]==="\r"&&y--,E++;return i.slice(0,y)},x=i=>{let d=e.endsWith(`
|
|
8
|
+
`),y=i.split(`
|
|
9
|
+
`).join(f);return d?C(y,1)+f:C(y,-1)},S=l.map((i,d)=>{let y=i.match(g);return y?{index:d,indent:y[1],tail:i.slice(y[0].length).trim()}:null}).filter(i=>i!==null),h=S.filter(i=>i.indent==="");if(h.length>1)throw new Error(`Cannot safely update YAML with duplicate ${p.rootKey} keys`);if(h.length===1){let i=h[0];if(i.tail!==""&&!i.tail.startsWith("#"))throw new Error(`Cannot safely update YAML unless ${p.rootKey} is a root-level block mapping`)}else if(S.length>0)throw new Error(`Cannot safely update YAML unless ${p.rootKey} is a root-level block mapping`);let w=" ";if(h.length===1)for(let i=h[0].index+1;i<l.length;i++){if(l[i].trim()===""||l[i].trimStart().startsWith("#"))continue;if(/^[^\s]/.test(l[i]))break;let d=l[i].match(/^(\s+)\S/);d&&(w=d[1]);break}if(n){let i=[],d=!1,y=0,E=!1,P=0,O=!1,b=-1;for(let $=0;$<l.length;$++){let k=l[$],J=k.match(c);if(J){d=!0,y=J[1].length,b=i.length,i.push(k);continue}if(d){let N=k.match(/^(\s*)/)?.[1].length||0;if(k.trimStart().startsWith("#")){i.push(k);continue}if(k.trim()!==""&&N<=y)d=!1,E=!1;else{let D=k.match(/^(\s*)["']?superpowers["']?\s*:\s*(?:#.*)?$/);if(D&&D[1]===w){E=!0,P=D[1].length,O=!0;continue}if(E){if(N>P||k.trim()==="")continue;E=!1}}}i.push(k)}if(O&&b>=0&&b<i.length){let $=i[b],k=$.match(c);k&&(i.slice(b+1).some(N=>N.trim()!==""&&!N.trimStart().startsWith("#")&&/^\s/.test(N))||(i[b]=$.replace(c,`${k[1]}${p.rootKey}: {}`)))}return x(i.join(`
|
|
10
|
+
`))}let m=p.freshEntry(w,t,r);if(!e||e.trim()==="")return x(`${p.rootKey}:
|
|
11
|
+
${m.join(`
|
|
12
|
+
`)}`);let v=h.length===1?h[0].index:-1;if(v===-1)return x(`${e.trimEnd()}
|
|
8
13
|
|
|
9
14
|
${p.rootKey}:
|
|
10
|
-
${
|
|
11
|
-
`)}
|
|
12
|
-
|
|
13
|
-
`)}
|
|
14
|
-
|
|
15
|
-
`||e==="\r"||e==="\f"||e==="\v"}function J(e){let t=0;for(;t<e.length&&E(e[t]);)t++;if(t>=e.length||e[t]!=="[")return!1;let r=e.lastIndexOf("]");if(r<=t)return!1;let n=r+1;for(;n<e.length&&E(e[n]);)n++;return n>=e.length?!0:e[n]==="#"}var ne=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\./;function se(e){let t=0;for(;t<e.length&&E(e[t]);)t++;if(t>=e.length||e[t]!=="[")return!1;let r=e.lastIndexOf("]");if(r<=t)return!1;let n=r+1;for(;n<e.length&&E(e[n]);)n++;if(n<e.length&&e[n]!=="#")return!1;let s=e.slice(t+1,r);return!s.includes("mcp_servers")||!s.includes("superpowers")?!1:s.includes('"')||s.includes("'")}function re(e){let t=0;for(;t<e.length&&E(e[t]);)t++;let r=null;if(e.startsWith("command",t))r="command",t+=7;else if(e.startsWith("args",t))r="args",t+=4;else return null;for(;t<e.length&&E(e[t]);)t++;if(t>=e.length||e[t]!=="=")return null;for(t++;t<e.length&&E(e[t]);)t++;let n=e.length;for(;n>t&&E(e[n-1]);)n--;return{key:r,value:e.slice(t,n)}}var oe=/^\s*(command|args)\s*=/;function q(e,t,r,n=!1){let s=e?e.split(/\r?\n/):[];for(let a of s)if(/^\s*mcp_servers(?:\s*\.\s*[A-Za-z0-9_-]+)*\s*=/.test(a))throw new Error("Cannot safely update TOML with inline mcp_servers assignment (expected [mcp_servers.superpowers] table)");let p=[];for(let a=0;a<s.length;a++){if(se(s[a]))throw new Error("Cannot safely update TOML with quoted mcp_servers.superpowers table names");te.test(s[a])&&p.push(a)}if(p.length>1)throw new Error("Cannot safely update TOML with duplicate mcp_servers.superpowers tables");let g=`command = ${JSON.stringify(t)}`,c=`args = ${JSON.stringify(r)}`,j=a=>a.replace(/'/g,'"').replace(/\s+/g,"");if(p.length===0){if(n)return e;let a=`[mcp_servers.superpowers]
|
|
15
|
+
${m.join(`
|
|
16
|
+
`)}`);let a=-1;for(let i=v+1;i<l.length;i++){let d=l[i];if(/^[^\s#]/.test(d))break;if((d.match(/^(\s*)/)?.[1]||"")===w&&/^\s+["']?superpowers["']?\s*:\s*(?:#.*)?$/.test(d)){a=i;break}}if(a!==-1){let i=l[a].match(/^(\s*)/)?.[1].length||2,d=a+1;for(;d<l.length;){let b=l[d];if((b.match(/^(\s*)/)?.[1].length||0)>i||b.trim()==="")d++;else break}let y=[],E=-1,P=i+w.length;for(let b=a+1;b<d;b++){let $=l[b];if($.trim()==="")continue;let k=$.match(/^(\s*)/)?.[1].length??0;if(!(E!==-1&&k>E)){if(E=-1,k===P&&j.test($)){E=k;continue}y.push($)}}m[0]+=oe(l[a]);let O=m.filter((b,$)=>{if($===0)return!0;let k=b.match(/^\s*["']?([A-Za-z0-9_-]+)["']?\s*:/);return!k||p.ownedKeys.includes(k[1])});return l.splice(a,d-a,...O,...y),x(l.join(`
|
|
17
|
+
`))}else return l.splice(v+1,0,...m),x(l.join(`
|
|
18
|
+
`))}function L(e){let t=null;for(let r=0;r<e.length;r++){let n=e[r];if(t){if(t==='"'&&n==="\\"&&r+1<e.length){r++;continue}n===t&&(t=null);continue}if(n==='"'||n==="'"){t=n;continue}if(n==="#"){let s=r;for(;s>0&&M.test(e[s-1]);)s--;return[e.slice(0,s),e.slice(s)]}}return[e,""]}var ie=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\]\s*(?:#.*)?$/;function _(e){return e===" "||e===" "||e===`
|
|
19
|
+
`||e==="\r"||e==="\f"||e==="\v"}function U(e){let t=0;for(;t<e.length&&_(e[t]);)t++;if(t>=e.length||e[t]!=="[")return!1;let r=e.lastIndexOf("]");if(r<=t)return!1;let n=r+1;for(;n<e.length&&_(e[n]);)n++;return n>=e.length?!0:e[n]==="#"}var ae=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\./;function pe(e){let t=0;for(;t<e.length&&_(e[t]);)t++;if(t>=e.length||e[t]!=="[")return!1;let r=e.lastIndexOf("]");if(r<=t)return!1;let n=r+1;for(;n<e.length&&_(e[n]);)n++;if(n<e.length&&e[n]!=="#")return!1;let s=e.slice(t+1,r);return!s.includes("mcp_servers")||!s.includes("superpowers")?!1:s.includes('"')||s.includes("'")}function ce(e){let t=0;for(;t<e.length&&_(e[t]);)t++;let r=null;if(e.startsWith("command",t))r="command",t+=7;else if(e.startsWith("args",t))r="args",t+=4;else return null;for(;t<e.length&&_(e[t]);)t++;if(t>=e.length||e[t]!=="=")return null;for(t++;t<e.length&&_(e[t]);)t++;let n=e.length;for(;n>t&&_(e[n-1]);)n--;return{key:r,value:e.slice(t,n)}}var le=/^\s*(command|args)\s*=/;function F(e,t,r,n=!1){let s=e?e.split(/\r?\n/):[];for(let a of s)if(/^\s*mcp_servers(?:\s*\.\s*[A-Za-z0-9_-]+)*\s*=/.test(a))throw new Error("Cannot safely update TOML with inline mcp_servers assignment (expected [mcp_servers.superpowers] table)");let p=[];for(let a=0;a<s.length;a++){if(pe(s[a]))throw new Error("Cannot safely update TOML with quoted mcp_servers.superpowers table names");ie.test(s[a])&&p.push(a)}if(p.length>1)throw new Error("Cannot safely update TOML with duplicate mcp_servers.superpowers tables");let g=`command = ${JSON.stringify(t)}`,c=`args = ${JSON.stringify(r)}`,j=a=>a.replace(/'/g,'"').replace(/\s+/g,"");if(p.length===0){if(n)return e;let a=`[mcp_servers.superpowers]
|
|
16
20
|
${g}
|
|
17
21
|
${c}
|
|
18
22
|
`;return!e||e.trim()===""?a:`${e.trimEnd()}
|
|
19
23
|
|
|
20
|
-
${a}`}let l=p[0],f=l+1;for(;f<s.length&&!(
|
|
21
|
-
`);let
|
|
22
|
-
`)}function
|
|
23
|
-
`;return j&&
|
|
24
|
-
`),
|
|
25
|
-
`;return j&&
|
|
26
|
-
`),
|
|
24
|
+
${a}`}let l=p[0],f=l+1;for(;f<s.length&&!(U(s[f])&&!ae.test(s[f]));)f++;let C=f;for(let a=l+1;a<f;a++)if(U(s[a])){C=a;break}if(n)return s.slice(0,l).concat(s.slice(f)).join(`
|
|
25
|
+
`);let x=null,S=null,h={};for(let a=l+1;a<C;a++){let[i,d]=L(s[a]),y=ce(i);y&&(y.key==="command"?x===null&&(x=j(y.value)):S===null&&(S=j(y.value)),y.key in h||(h[y.key]=d))}if(x===j(JSON.stringify(t))&&S===j(JSON.stringify(r)))return e;let w=[`${g}${h.command??""}`,`${c}${h.args??""}`],m=s.slice(0,l+1),v=!1;for(let a=l+1;a<C;a++){let[i]=L(s[a]);if(le.test(i)){v||(m.push(...w),v=!0);continue}m.push(s[a])}return v||m.push(...w),m.push(...s.slice(C,f)),m.push(...s.slice(f)),m.join(`
|
|
26
|
+
`)}function q(e,t,r){if(!A(e))return t;let n={...e,...t};return(e.enabled!==void 0||e.disabled!==void 0)&&(e.enabled!==void 0?n.enabled=e.enabled:delete n.enabled),r==="json-mcp"&&Array.isArray(n.command)&&delete n.args,n}function Y(e,t,r,n,s=!1,p,g){let c={},j=!1;if(e&&e.trim()!=="")try{let S=JSON.parse(e);if(!A(S))throw new Error("Existing JSON root must be an object");c=S}catch(S){try{let h=G(e,!0),w=JSON.parse(h);if(!A(w))throw new Error("Existing JSON root must be an object");c=w,j=h!==e}catch(h){let w=h instanceof Error?h.message:String(h),m=S instanceof Error?S.message:String(S);throw new Error(`Failed to parse existing JSON: ${w} (raw JSON error: ${m})`)}}let l=t==="json-servers"?"servers":t==="json-mcp"?"mcp":"mcpServers";if(g&&g.length>0){let S=g.join(".");for(let m of g){if(typeof m!="string"||m.length===0)throw new Error(`Invalid JSON field "${S}"`);if(m==="__proto__"||m==="constructor"||m==="prototype")throw new Error(`Refusing to use unsafe JSON field "${S}"`);if(!/^[A-Za-z0-9_-]+$/.test(m))throw new Error(`Invalid JSON field "${S}"`)}let h=c;for(let m of g){if(m==="__proto__"||m==="constructor"||m==="prototype")throw new Error(`Refusing to use unsafe JSON field "${S}"`);let v=h[m];if(v===void 0){if(s)return e;h[m]={}}else if(!A(v))throw new Error(`Existing JSON field "${S}" must be an object`);h=h[m]}if(s)delete h.superpowers;else{let m=p?{...p}:{command:r,args:n};h.superpowers=q(h.superpowers,m,t)}let w=JSON.stringify(c,null,2)+`
|
|
27
|
+
`;return j&&w!==e&&process.stderr.write(`[superpowers-mcp] Warning: JSONC comments/trailing commas in the existing config were removed while updating it (the file is rewritten as plain JSON).
|
|
28
|
+
`),w}let f=z.find(S=>A(c[S])&&c[S].superpowers!==void 0)??l;if(c[f]!==void 0&&!A(c[f]))throw new Error(`Existing JSON field "${f}" must be an object`);c[f]===void 0&&(c[f]={});let C=c[f];if(s)delete C.superpowers;else{let S;p?S={...p}:t==="json-servers"?S={command:r,args:n,type:"stdio"}:t==="json-mcp"?S={type:"local",command:[r,...n],enabled:!0}:S={command:r,args:n},C.superpowers=q(C.superpowers,S,t)}let x=JSON.stringify(c,null,2)+`
|
|
29
|
+
`;return j&&x!==e&&process.stderr.write(`[superpowers-mcp] Warning: JSONC comments/trailing commas in the existing config were removed while updating it (the file is rewritten as plain JSON).
|
|
30
|
+
`),x}function ue(e,t=10){try{let r=o.dirname(e),n=`${o.basename(e)}.`,s=".bak",p=u.readdirSync(r).filter(g=>{if(!g.startsWith(n)||!g.endsWith(s))return!1;let c=g.slice(n.length,g.length-s.length);return/^\d+$/.test(c)}).map(g=>{let c=o.join(r,g);try{return{full:c,mtimeMs:u.statSync(c).mtimeMs}}catch{return{full:c,mtimeMs:0}}}).sort((g,c)=>c.mtimeMs-g.mtimeMs);for(let g of p.slice(t))try{u.unlinkSync(g.full)}catch{}}catch{}}function B(e,t,r=!1,n=[],s){if(n.length===0)throw new Error("safeWriteConfig requires at least one allowed destination root");let p=e;try{let a=u.lstatSync(e,{throwIfNoEntry:!1});if(a&&a.isSymbolicLink()){try{p=u.realpathSync(e)}catch{let O=u.readlinkSync(e);p=o.resolve(o.dirname(e),O)}let i=o.normalize(o.resolve(p)).toLowerCase(),d=o.normalize(o.resolve(R.tmpdir())).toLowerCase();if(!(i===d||i.startsWith(d+o.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(P=>i===P||i.startsWith(P+o.sep))||i==="/var"||i.startsWith("/var"+o.sep)&&!i.startsWith("/var/folders"+o.sep)||i==="/private/var"||i.startsWith("/private/var"+o.sep)&&!i.startsWith("/private/var/folders"+o.sep)))throw new Error(`Refusing to write to unsafe symlink target: ${p}`)}}catch(a){if(a instanceof Error&&a.message.includes("Refusing to write to unsafe symlink target"))throw a}let g=o.dirname(p);u.existsSync(g)||u.mkdirSync(g,{recursive:!0,mode:448});let c=u.realpathSync(g),j=u.statSync(c);p=o.join(c,o.basename(p));let l=o.normalize(o.resolve(p)).toLowerCase(),f=o.normalize(o.resolve(R.tmpdir())).toLowerCase(),C=l===f||l.startsWith(f+o.sep),S=["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(a=>l===a||l.startsWith(a+o.sep))||l==="/var"||l.startsWith("/var"+o.sep)&&!l.startsWith("/var/folders"+o.sep)||l==="/private/var"||l.startsWith("/private/var"+o.sep)&&!l.startsWith("/private/var/folders"+o.sep);if(!C&&S)throw new Error(`Refusing to write to unsafe configuration target: ${p}`);if(!n.some(a=>{if(!a)return!1;let i=o.resolve(a);try{i=u.realpathSync(i)}catch{}let d=o.relative(i,p);return d!==".."&&!d.startsWith(`..${o.sep}`)&&!o.isAbsolute(d)}))throw new Error(`Refusing to write configuration outside allowed roots: ${p}`);let w=384;if(u.existsSync(p)){try{w=u.statSync(p).mode}catch{}if(r){let a=u.readFileSync(p,"utf8"),i=`${p}.${Date.now()}.bak`;try{u.writeFileSync(i,a,{encoding:"utf8",mode:w})}catch(d){let y=d instanceof Error?d.message:String(d);throw new Error(`Failed to create safe backup before write: ${y}`)}ue(p)}}let m=H.randomBytes(8).toString("hex"),v=o.join(c,`.tmp.${o.basename(p)}.${process.pid}.${m}`);try{u.writeFileSync(v,t,{encoding:"utf8",mode:w,flag:"wx"});let a=u.existsSync(p);if(s===null&&a)throw new Error("Configuration changed concurrently before it could be created");if(s!=null&&(!a||u.readFileSync(p,"utf8")!==s))throw new Error("Configuration changed concurrently; refusing to overwrite newer content");let i=u.realpathSync(g),d=u.statSync(i);if(i!==c||d.dev!==j.dev||d.ino!==j.ino)throw new Error("Configuration directory changed while writing");u.renameSync(v,p)}catch(a){try{u.existsSync(v)&&u.unlinkSync(v)}catch{}throw a}}async function Q(e={}){let t=e.platform||R.platform(),r=e.homeDir||R.homedir(),n=e.appData||process.env.APPDATA,s=e.localAppData||process.env.LOCALAPPDATA,p=!!e.dryRun,g=!!e.remove,c=!!e.bun,j=e.target?e.target.toLowerCase():null,l=c?"bunx":"npx",f=["-y","superpowers-mcp"],C=[];if(!j)throw new Error(`No target client specified. Please specify which client to configure using --target <${Object.keys(W).join("|")}>.`);let x=Object.keys(W).find(h=>h===j||W[h].aliases.includes(j));if(!x)throw new Error(`Unknown harness target: "${j}". Supported targets: ${Object.keys(W).join(", ")}`);let S=[x];for(let h of S){let w=W[h],m=w.getConfigPath(t,r,n,s),v=u.existsSync(m);if(g&&!v){C.push({target:h,name:w.name,path:m,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let a="";v&&(a=u.readFileSync(m,"utf8"));let i="";if(w.type==="yaml")i=V(a,l,f,g,w.yamlProfile);else if(w.type==="toml")i=F(a,l,f,g);else{let d=typeof w.defaultConfig=="function"?w.defaultConfig(l,f):void 0;i=Y(a,w.type,l,f,g,d,w.serverPath)}if(a.trim()===i.trim()&&v){C.push({target:h,name:w.name,path:m,status:"up-to-date",message:g?"Already not configured":"Already configured and up-to-date"});continue}p||B(m,i,!!e.backup,[r,n||"",s||""],v?a:null),C.push({target:h,name:w.name,path:m,status:g?"removed":v?"updated":"created",message:p?`[Dry Run] Would ${g?"remove from":v?"update":"create"} ${m}`:`Successfully ${g?"removed from":v?"updated":"configured"}!`})}catch(a){let i=a instanceof Error?a.message:String(a);C.push({target:h,name:w.name,path:m,status:"error",message:i})}}return C}async function fe(e=process.argv.slice(2)){let t=!1,r={dryRun:!1,remove:!1,bun:!1,backup:!1,target:null};for(let n=0;n<e.length;n++){let s=e[n];if(!(s==="setup"||s==="install"||s==="--setup"))if(s==="--print-config")t=!0;else if(s==="--dry-run")r.dryRun=!0;else if(s==="--remove"||s==="--uninstall")r.remove=!0;else if(s==="--bun")r.bun=!0;else if(s==="--backup")r.backup=!0;else if(s==="--target"||s==="-t"){let p=e[n+1];if(!p||p.startsWith("-")){console.error(`\u274C Error: Missing value for --target flag.
|
|
27
31
|
`),process.exitCode=1;return}r.target=e[++n]}else if(s.startsWith("--target=")){let p=s.split("=")[1];if(!p){console.error(`\u274C Error: Missing value for --target flag.
|
|
28
|
-
`),process.exitCode=1;return}r.target=p}else if(s==="--help"||s==="-h"){
|
|
32
|
+
`),process.exitCode=1;return}r.target=p}else if(s==="--help"||s==="-h"){ge();return}else if(s.startsWith("-")){console.error(`\u274C Error: Unknown option "${s}". Use --help for usage.
|
|
29
33
|
`),process.exitCode=1;return}else if(!r.target)r.target=s;else{console.error(`\u274C Error: Unexpected argument "${s}". Use --help for usage.
|
|
30
34
|
`),process.exitCode=1;return}}if(t){if(r.target||r.remove||r.backup||r.dryRun){console.error("--print-config supports only --bun; omit target and file-operation flags."),process.exitCode=1;return}console.log(JSON.stringify({mcpServers:{superpowers:{command:r.bun?"bunx":"npx",args:["-y","superpowers-mcp"]}}},null,2));return}if(console.log(`
|
|
31
35
|
========================================================`),console.log("\u26A1 Superpowers MCP - Targeted Client Setup"),console.log(`========================================================
|
|
@@ -33,9 +37,9 @@ ${a}`}let l=p[0],f=l+1;for(;f<s.length&&!(J(s[f])&&!ne.test(s[f]));)f++;let S=f;
|
|
|
33
37
|
`),console.log(" npx -y superpowers-mcp setup --target lmstudio # LM Studio (~/.lmstudio/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target roo # Roo Code in VS Code Desktop"),console.log(" npx -y superpowers-mcp setup --print-config # JSON for desktop app import"),console.log(" npx -y superpowers-mcp setup --target antigravity # Antigravity (~/.gemini/config/mcp_config.json)"),console.log(" npx -y superpowers-mcp setup --target pi-desktop # Pi Desktop / Pi Agent (~/.pi/agent/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target cursor # Cursor (~/.cursor/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target copilot # GitHub Copilot (VS Code mcp.json)"),console.log(" npx -y superpowers-mcp setup --target copilot-insiders # GitHub Copilot (VS Code Insiders mcp.json)"),console.log(" npx -y superpowers-mcp setup --target hermes # Hermes Desktop / Agent"),console.log(" npx -y superpowers-mcp setup --target kimi # Kimi Work / Kimi Code"),console.log(" npx -y superpowers-mcp setup --target claude # Claude Desktop"),console.log(" npx -y superpowers-mcp setup --target devin # Devin Desktop (formerly Windsurf)"),console.log(" npx -y superpowers-mcp setup --target qwenpaw # QwenPaw / CoPaw (~/.qwenpaw/config.json)"),console.log(" npx -y superpowers-mcp setup --target cline # Cline (~/.../cline_mcp_settings.json)"),console.log(" npx -y superpowers-mcp setup --target kilo # Kilo Code (~/.config/kilo/kilo.jsonc)"),console.log(" npx -y superpowers-mcp setup --target qoder # Qoder (~/.qoder/settings.json)"),console.log(" npx -y superpowers-mcp setup --target kiro # Kiro (~/.kiro/settings/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target trae # Trae (~/.../Trae/User/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target codex # Codex (~/.codex/config.toml)"),console.log(" npx -y superpowers-mcp setup --target openclaw # OpenClaw (~/.openclaw/openclaw.json)"),console.log(` npx -y superpowers-mcp setup --target goose # Goose (~/.config/goose/config.yaml)
|
|
34
38
|
`),console.log("\u{1F4A1} Tip:"),console.log(" You can run this setup command from ANY folder on your system."),console.log(` It automatically targets your global config files (~/...) without needing to clone this repo.
|
|
35
39
|
`),console.log("\u{1F4A1} Privacy & Safety:"),console.log(" Superpowers MCP only configures the specific client you explicitly choose."),console.log(` It will NEVER silently scan or modify unselected environments.
|
|
36
|
-
`),process.exitCode=1;return}try{let n=await
|
|
40
|
+
`),process.exitCode=1;return}try{let n=await Q(r),s=0,p=0,g=0;for(let c of n){let j=c.status==="created"||c.status==="updated"||c.status==="removed"?"\u2705":c.status==="up-to-date"?"\u2728":c.status==="skipped"?"\u23ED\uFE0F ":"\u274C";console.log(`${j} [${c.name}] (${c.status})`),console.log(` Path: ${c.path}`),console.log(` Info: ${c.message}
|
|
37
41
|
`),c.status==="created"||c.status==="updated"||c.status==="up-to-date"||c.status==="removed"?s++:c.status==="skipped"?p++:c.status==="error"&&g++}if(console.log("--------------------------------------------------------"),g>0){console.error(`\u26A0\uFE0F Setup finished with errors: ${g} failure(s), ${s} succeeded.`),process.exitCode=1;return}console.log(`\u{1F389} Setup complete! ${s} environment(s) ready.`)}catch(n){let s=n instanceof Error?n.message:String(n);console.error(`\u274C Setup failed: ${s}
|
|
38
|
-
`),process.exitCode=1}}function
|
|
42
|
+
`),process.exitCode=1}}function ge(){console.log(`
|
|
39
43
|
Superpowers MCP - Targeted Global Setup
|
|
40
44
|
|
|
41
45
|
Usage:
|
package/out/setup.js
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`||f==="\r")&&(g=!1,n.push(f));continue}if(c){f==="*"&&
|
|
4
|
-
`&&f!=="\r"&&(j=-1),n.push(f)}return n.join("")}var
|
|
5
|
-
`)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
"use strict";var X=Object.create;var T=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var ne=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var re=(e,t)=>{for(var r in t)T(e,r,{get:t[r],enumerable:!0})},L=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of te(t))!se.call(e,s)&&s!==r&&T(e,s,{get:()=>t[s],enumerable:!(n=ee(t,s))||n.enumerable});return e};var I=(e,t,r)=>(r=e!=null?X(ne(e)):{},L(t||!e||!e.__esModule?T(r,"default",{value:e,enumerable:!0}):r,e)),oe=e=>L(T({},"__esModule",{value:!0}),e);var de={};re(de,{HARNESS_CONFIGS:()=>W,JSON_SERVER_ROOT_KEYS:()=>F,isPlainObject:()=>A,runSetup:()=>Z,runSetupCli:()=>K,safeWriteConfig:()=>Q,stripJsonComments:()=>G,updateJsonConfig:()=>B,updateTomlConfig:()=>Y,updateYamlConfig:()=>V});module.exports=oe(de);var u=I(require("fs")),o=I(require("path")),R=I(require("os")),z=I(require("crypto")),W={lmstudio:{name:"LM Studio",aliases:["lmstudio","lm-studio"],getConfigPath:(e,t)=>o.join(t,".lmstudio","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},roo:{name:"Roo Code (VS Code Desktop)",aliases:["roo","roo-code","roocode"],getConfigPath:(e,t,r)=>{let n=e==="win32"?r||o.join(t,"AppData","Roaming"):e==="darwin"?o.join(t,"Library","Application Support"):o.join(t,".config");return o.join(n,"Code","User","globalStorage","rooveterinaryinc.roo-cline","settings","mcp_settings.json")},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},copilot:{name:"GitHub Copilot (VS Code)",aliases:["vscode","code","copilot"],getConfigPath:(e,t,r,n)=>e==="win32"?o.join(r||o.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?o.join(t,"Library","Application Support","Code","User","mcp.json"):o.join(t,".config","Code","User","mcp.json"),type:"json-servers",defaultConfig:(e,t)=>({command:e,args:t,type:"stdio"})},"copilot-insiders":{name:"GitHub Copilot (VS Code Insiders)",aliases:["vscode-insiders","code-insiders","insiders","insider","vscode-insider","code-insider","copilot-insider"],getConfigPath:(e,t,r,n)=>e==="win32"?o.join(r||o.join(t,"AppData","Roaming"),"Code - Insiders","User","mcp.json"):e==="darwin"?o.join(t,"Library","Application Support","Code - Insiders","User","mcp.json"):o.join(t,".config","Code - Insiders","User","mcp.json"),type:"json-servers",defaultConfig:(e,t)=>({command:e,args:t,type:"stdio"})},cursor:{name:"Cursor",aliases:["cursor"],getConfigPath:(e,t)=>o.join(t,".cursor","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},hermes:{name:"Hermes Desktop / Agent",aliases:["hermes","hermes-desktop"],getConfigPath:(e,t,r,n)=>{if(e==="win32"){let s=n||o.join(t,"AppData","Local");return o.join(s,"hermes","config.yaml")}return o.join(t,".hermes","config.yaml")},type:"yaml",defaultConfig:(e,t)=>({command:e,args:t})},kimi:{name:"Kimi Work / Kimi Code",aliases:["kimi","kimi-work","kimi-code"],getConfigPath:(e,t)=>o.join(t,".kimi-code","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},claude:{name:"Claude Desktop",aliases:["claude","claude-desktop"],getConfigPath:(e,t,r)=>e==="win32"?o.join(r||o.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?o.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):o.join(t,".config","Claude","claude_desktop_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},devin:{name:"Devin Desktop (formerly Windsurf)",aliases:["devin","devin-desktop","windsurf","codeium"],getConfigPath:(e,t,r)=>{let n=e==="win32"&&r?r:o.join(t,".config"),s=o.join(n,"devin","mcp_config.json");return u.existsSync(s)?s:o.join(t,".codeium","windsurf","mcp_config.json")},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},antigravity:{name:"Antigravity (Google DeepMind)",aliases:["antigravity","agy","gemini"],getConfigPath:(e,t)=>o.join(t,".gemini","config","mcp_config.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},"pi-desktop":{name:"Pi Desktop / Pi Agent",aliases:["pi-desktop","pi","pi-agent"],getConfigPath:(e,t,r)=>{if(e==="win32"){let p=o.join(r||o.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(u.existsSync(p))return p;let g=o.join(t,".pi","agent","mcp.json");if(u.existsSync(g))return g;let c=o.join(t,".pi","mcp.json");return u.existsSync(c)?c:g}let n=o.join(t,".pi","agent","mcp.json");if(u.existsSync(n))return n;let s=o.join(t,".pi","mcp.json");return u.existsSync(s)?s:n},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},qwenpaw:{name:"QwenPaw (Personal Agent Workstation)",aliases:["qwenpaw","qwen-paw","copaw"],getConfigPath:(e,t)=>{let r=o.join(t,".qwenpaw","config.json");if(u.existsSync(r))return r;let n=o.join(t,".copaw","config.json");return u.existsSync(n)?n:r},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},cline:{name:"Cline (VS Code / CLI)",aliases:["cline","claude-dev"],getConfigPath:(e,t,r)=>{let n="";if(e==="win32"?n=o.join(r||o.join(t,"AppData","Roaming"),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):e==="darwin"?n=o.join(t,"Library","Application Support","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):n=o.join(t,".config","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),u.existsSync(n))return n;let s=o.join(t,".cline","data","settings","cline_mcp_settings.json");return u.existsSync(s)?s:n},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kilo:{name:"Kilo Code",aliases:["kilo","kilocode","kilo-code"],getConfigPath:(e,t)=>{let r=o.join(t,".config","kilo","kilo.jsonc");if(u.existsSync(r))return r;let n=o.join(t,".config","kilo","kilo.json");return u.existsSync(n)?n:r},type:"json-mcp",defaultConfig:(e,t)=>({type:"local",command:[e,...t],enabled:!0})},qoder:{name:"Qoder",aliases:["qoder"],getConfigPath:(e,t)=>o.join(t,".qoder","settings.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kiro:{name:"Kiro",aliases:["kiro","kiro-code"],getConfigPath:(e,t)=>o.join(t,".kiro","settings","mcp.json"),type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},trae:{name:"Trae",aliases:["trae"],getConfigPath:(e,t,r)=>{if(e==="win32"){let n=o.join(r||o.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(u.existsSync(n))return n;let s=o.join(r||o.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return u.existsSync(s)?s:n}else if(e==="darwin"){let n=o.join(t,"Library","Application Support","Trae","User","mcp.json");if(u.existsSync(n))return n;let s=o.join(t,"Library","Application Support","Trae CN","User","mcp.json");return u.existsSync(s)?s:n}else{let n=o.join(t,".config","Trae","User","mcp.json");if(u.existsSync(n))return n;let s=o.join(t,".config","Trae CN","User","mcp.json");return u.existsSync(s)?s:n}},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},codex:{name:"Codex",aliases:["codex"],getConfigPath:(e,t)=>o.join(t,".codex","config.toml"),type:"toml",defaultConfig:(e,t)=>({command:e,args:t})},openclaw:{name:"OpenClaw",aliases:["openclaw","open-claw"],getConfigPath:(e,t)=>o.join(t,".openclaw","openclaw.json"),type:"json-mcpServers",serverPath:["mcp","servers"],defaultConfig:(e,t)=>({command:e,args:t})},goose:{name:"Goose",aliases:["goose"],getConfigPath:(e,t,r)=>e==="win32"?o.join(r||o.join(t,"AppData","Roaming"),"Block","goose","config","config.yaml"):o.join(t,".config","goose","config.yaml"),type:"yaml",yamlProfile:"goose",defaultConfig:(e,t)=>({cmd:e,args:t})}},F=["mcpServers","servers","mcp"];function A(e){return Object.prototype.toString.call(e)==="[object Object]"}function G(e,t=!1){if(!e)return"";if(!t)try{return JSON.parse(e),e}catch{}let r=e.length,n=[],s=!1,p=!1,g=!1,c=!1,j=-1;for(let l=0;l<r;l++){let f=e[l],C=l+1<r?e[l+1]:"";if(g){(f===`
|
|
3
|
+
`||f==="\r")&&(g=!1,n.push(f));continue}if(c){f==="*"&&C==="/"&&(c=!1,l++);continue}if(s){n.push(f),p?p=!1:f==="\\"?p=!0:f==='"'&&(s=!1);continue}if(f==='"'){s=!0,p=!1,j=-1,n.push(f);continue}if(f==="/"&&C==="/"){g=!0,l++;continue}if(f==="/"&&C==="*"){c=!0,l++;continue}if(f===","){j=n.length,n.push(f);continue}if(f==="}"||f==="]"){j!==-1&&(n[j]=" ",j=-1),n.push(f);continue}f!==" "&&f!==" "&&f!==`
|
|
4
|
+
`&&f!=="\r"&&(j=-1),n.push(f)}return n.join("")}var M=/\s/;function ie(e){for(let t=1;t<e.length;t++){if(e[t]!=="#"||!M.test(e[t-1]))continue;let r=t-1;for(;r>0&&M.test(e[r-1]);)r--;return e.slice(r)}return""}function V(e,t,r,n=!1,s="mcp"){let p=s==="goose"?{rootKey:"extensions",ownedKeys:["cmd","args","type"],freshEntry:(i,d,y)=>[`${i}superpowers:`,`${i}${i}name: "Superpowers"`,`${i}${i}cmd: ${JSON.stringify(d)}`,`${i}${i}args: ${JSON.stringify(y)}`,`${i}${i}enabled: true`,`${i}${i}type: stdio`,`${i}${i}timeout: 300`]}:{rootKey:"mcp_servers",ownedKeys:["command","args"],freshEntry:(i,d,y)=>[`${i}superpowers:`,`${i}${i}command: ${JSON.stringify(d)}`,`${i}${i}args: ${JSON.stringify(y)}`]};if(!/^[A-Za-z0-9_-]+$/.test(p.rootKey))throw new Error("Invalid YAML root key");let g=new RegExp(`^(\\s*)["']?${p.rootKey}["']?\\s*:`),c=new RegExp(`^(\\s*)["']?${p.rootKey}["']?\\s*:\\s*(?:#.*)?$`),j=new RegExp(`^\\s*["']?(?:${p.ownedKeys.join("|")})["']?\\s*:`),l=e?e.split(/\r?\n/):[],f=e.includes(`\r
|
|
5
|
+
`)?`\r
|
|
6
|
+
`:`
|
|
7
|
+
`,C=(i,d)=>{let y=i.length,E=0;for(;y>0&&i[y-1]===`
|
|
8
|
+
`&&(d<0||E<d);)y--,y>0&&i[y-1]==="\r"&&y--,E++;return i.slice(0,y)},x=i=>{let d=e.endsWith(`
|
|
9
|
+
`),y=i.split(`
|
|
10
|
+
`).join(f);return d?C(y,1)+f:C(y,-1)},S=l.map((i,d)=>{let y=i.match(g);return y?{index:d,indent:y[1],tail:i.slice(y[0].length).trim()}:null}).filter(i=>i!==null),h=S.filter(i=>i.indent==="");if(h.length>1)throw new Error(`Cannot safely update YAML with duplicate ${p.rootKey} keys`);if(h.length===1){let i=h[0];if(i.tail!==""&&!i.tail.startsWith("#"))throw new Error(`Cannot safely update YAML unless ${p.rootKey} is a root-level block mapping`)}else if(S.length>0)throw new Error(`Cannot safely update YAML unless ${p.rootKey} is a root-level block mapping`);let w=" ";if(h.length===1)for(let i=h[0].index+1;i<l.length;i++){if(l[i].trim()===""||l[i].trimStart().startsWith("#"))continue;if(/^[^\s]/.test(l[i]))break;let d=l[i].match(/^(\s+)\S/);d&&(w=d[1]);break}if(n){let i=[],d=!1,y=0,E=!1,P=0,O=!1,b=-1;for(let $=0;$<l.length;$++){let k=l[$],J=k.match(c);if(J){d=!0,y=J[1].length,b=i.length,i.push(k);continue}if(d){let N=k.match(/^(\s*)/)?.[1].length||0;if(k.trimStart().startsWith("#")){i.push(k);continue}if(k.trim()!==""&&N<=y)d=!1,E=!1;else{let D=k.match(/^(\s*)["']?superpowers["']?\s*:\s*(?:#.*)?$/);if(D&&D[1]===w){E=!0,P=D[1].length,O=!0;continue}if(E){if(N>P||k.trim()==="")continue;E=!1}}}i.push(k)}if(O&&b>=0&&b<i.length){let $=i[b],k=$.match(c);k&&(i.slice(b+1).some(N=>N.trim()!==""&&!N.trimStart().startsWith("#")&&/^\s/.test(N))||(i[b]=$.replace(c,`${k[1]}${p.rootKey}: {}`)))}return x(i.join(`
|
|
11
|
+
`))}let m=p.freshEntry(w,t,r);if(!e||e.trim()==="")return x(`${p.rootKey}:
|
|
12
|
+
${m.join(`
|
|
13
|
+
`)}`);let v=h.length===1?h[0].index:-1;if(v===-1)return x(`${e.trimEnd()}
|
|
9
14
|
|
|
10
15
|
${p.rootKey}:
|
|
11
|
-
${
|
|
12
|
-
`)}
|
|
13
|
-
|
|
14
|
-
`)}
|
|
15
|
-
|
|
16
|
-
`||e==="\r"||e==="\f"||e==="\v"}function D(e){let t=0;for(;t<e.length&&E(e[t]);)t++;if(t>=e.length||e[t]!=="[")return!1;let r=e.lastIndexOf("]");if(r<=t)return!1;let n=r+1;for(;n<e.length&&E(e[n]);)n++;return n>=e.length?!0:e[n]==="#"}var se=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\./;function re(e){let t=0;for(;t<e.length&&E(e[t]);)t++;if(t>=e.length||e[t]!=="[")return!1;let r=e.lastIndexOf("]");if(r<=t)return!1;let n=r+1;for(;n<e.length&&E(e[n]);)n++;if(n<e.length&&e[n]!=="#")return!1;let s=e.slice(t+1,r);return!s.includes("mcp_servers")||!s.includes("superpowers")?!1:s.includes('"')||s.includes("'")}function oe(e){let t=0;for(;t<e.length&&E(e[t]);)t++;let r=null;if(e.startsWith("command",t))r="command",t+=7;else if(e.startsWith("args",t))r="args",t+=4;else return null;for(;t<e.length&&E(e[t]);)t++;if(t>=e.length||e[t]!=="=")return null;for(t++;t<e.length&&E(e[t]);)t++;let n=e.length;for(;n>t&&E(e[n-1]);)n--;return{key:r,value:e.slice(t,n)}}var ie=/^\s*(command|args)\s*=/;function H(e,t,r,n=!1){let s=e?e.split(/\r?\n/):[];for(let a of s)if(/^\s*mcp_servers(?:\s*\.\s*[A-Za-z0-9_-]+)*\s*=/.test(a))throw new Error("Cannot safely update TOML with inline mcp_servers assignment (expected [mcp_servers.superpowers] table)");let p=[];for(let a=0;a<s.length;a++){if(re(s[a]))throw new Error("Cannot safely update TOML with quoted mcp_servers.superpowers table names");ne.test(s[a])&&p.push(a)}if(p.length>1)throw new Error("Cannot safely update TOML with duplicate mcp_servers.superpowers tables");let g=`command = ${JSON.stringify(t)}`,c=`args = ${JSON.stringify(r)}`,j=a=>a.replace(/'/g,'"').replace(/\s+/g,"");if(p.length===0){if(n)return e;let a=`[mcp_servers.superpowers]
|
|
16
|
+
${m.join(`
|
|
17
|
+
`)}`);let a=-1;for(let i=v+1;i<l.length;i++){let d=l[i];if(/^[^\s#]/.test(d))break;if((d.match(/^(\s*)/)?.[1]||"")===w&&/^\s+["']?superpowers["']?\s*:\s*(?:#.*)?$/.test(d)){a=i;break}}if(a!==-1){let i=l[a].match(/^(\s*)/)?.[1].length||2,d=a+1;for(;d<l.length;){let b=l[d];if((b.match(/^(\s*)/)?.[1].length||0)>i||b.trim()==="")d++;else break}let y=[],E=-1,P=i+w.length;for(let b=a+1;b<d;b++){let $=l[b];if($.trim()==="")continue;let k=$.match(/^(\s*)/)?.[1].length??0;if(!(E!==-1&&k>E)){if(E=-1,k===P&&j.test($)){E=k;continue}y.push($)}}m[0]+=ie(l[a]);let O=m.filter((b,$)=>{if($===0)return!0;let k=b.match(/^\s*["']?([A-Za-z0-9_-]+)["']?\s*:/);return!k||p.ownedKeys.includes(k[1])});return l.splice(a,d-a,...O,...y),x(l.join(`
|
|
18
|
+
`))}else return l.splice(v+1,0,...m),x(l.join(`
|
|
19
|
+
`))}function U(e){let t=null;for(let r=0;r<e.length;r++){let n=e[r];if(t){if(t==='"'&&n==="\\"&&r+1<e.length){r++;continue}n===t&&(t=null);continue}if(n==='"'||n==="'"){t=n;continue}if(n==="#"){let s=r;for(;s>0&&M.test(e[s-1]);)s--;return[e.slice(0,s),e.slice(s)]}}return[e,""]}var ae=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\]\s*(?:#.*)?$/;function _(e){return e===" "||e===" "||e===`
|
|
20
|
+
`||e==="\r"||e==="\f"||e==="\v"}function q(e){let t=0;for(;t<e.length&&_(e[t]);)t++;if(t>=e.length||e[t]!=="[")return!1;let r=e.lastIndexOf("]");if(r<=t)return!1;let n=r+1;for(;n<e.length&&_(e[n]);)n++;return n>=e.length?!0:e[n]==="#"}var pe=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\./;function ce(e){let t=0;for(;t<e.length&&_(e[t]);)t++;if(t>=e.length||e[t]!=="[")return!1;let r=e.lastIndexOf("]");if(r<=t)return!1;let n=r+1;for(;n<e.length&&_(e[n]);)n++;if(n<e.length&&e[n]!=="#")return!1;let s=e.slice(t+1,r);return!s.includes("mcp_servers")||!s.includes("superpowers")?!1:s.includes('"')||s.includes("'")}function le(e){let t=0;for(;t<e.length&&_(e[t]);)t++;let r=null;if(e.startsWith("command",t))r="command",t+=7;else if(e.startsWith("args",t))r="args",t+=4;else return null;for(;t<e.length&&_(e[t]);)t++;if(t>=e.length||e[t]!=="=")return null;for(t++;t<e.length&&_(e[t]);)t++;let n=e.length;for(;n>t&&_(e[n-1]);)n--;return{key:r,value:e.slice(t,n)}}var ue=/^\s*(command|args)\s*=/;function Y(e,t,r,n=!1){let s=e?e.split(/\r?\n/):[];for(let a of s)if(/^\s*mcp_servers(?:\s*\.\s*[A-Za-z0-9_-]+)*\s*=/.test(a))throw new Error("Cannot safely update TOML with inline mcp_servers assignment (expected [mcp_servers.superpowers] table)");let p=[];for(let a=0;a<s.length;a++){if(ce(s[a]))throw new Error("Cannot safely update TOML with quoted mcp_servers.superpowers table names");ae.test(s[a])&&p.push(a)}if(p.length>1)throw new Error("Cannot safely update TOML with duplicate mcp_servers.superpowers tables");let g=`command = ${JSON.stringify(t)}`,c=`args = ${JSON.stringify(r)}`,j=a=>a.replace(/'/g,'"').replace(/\s+/g,"");if(p.length===0){if(n)return e;let a=`[mcp_servers.superpowers]
|
|
17
21
|
${g}
|
|
18
22
|
${c}
|
|
19
23
|
`;return!e||e.trim()===""?a:`${e.trimEnd()}
|
|
20
24
|
|
|
21
|
-
${a}`}let l=p[0],f=l+1;for(;f<s.length&&!(
|
|
22
|
-
`);let
|
|
23
|
-
`)}function
|
|
24
|
-
`;return j&&
|
|
25
|
-
`),
|
|
26
|
-
`;return j&&
|
|
27
|
-
`),
|
|
25
|
+
${a}`}let l=p[0],f=l+1;for(;f<s.length&&!(q(s[f])&&!pe.test(s[f]));)f++;let C=f;for(let a=l+1;a<f;a++)if(q(s[a])){C=a;break}if(n)return s.slice(0,l).concat(s.slice(f)).join(`
|
|
26
|
+
`);let x=null,S=null,h={};for(let a=l+1;a<C;a++){let[i,d]=U(s[a]),y=le(i);y&&(y.key==="command"?x===null&&(x=j(y.value)):S===null&&(S=j(y.value)),y.key in h||(h[y.key]=d))}if(x===j(JSON.stringify(t))&&S===j(JSON.stringify(r)))return e;let w=[`${g}${h.command??""}`,`${c}${h.args??""}`],m=s.slice(0,l+1),v=!1;for(let a=l+1;a<C;a++){let[i]=U(s[a]);if(ue.test(i)){v||(m.push(...w),v=!0);continue}m.push(s[a])}return v||m.push(...w),m.push(...s.slice(C,f)),m.push(...s.slice(f)),m.join(`
|
|
27
|
+
`)}function H(e,t,r){if(!A(e))return t;let n={...e,...t};return(e.enabled!==void 0||e.disabled!==void 0)&&(e.enabled!==void 0?n.enabled=e.enabled:delete n.enabled),r==="json-mcp"&&Array.isArray(n.command)&&delete n.args,n}function B(e,t,r,n,s=!1,p,g){let c={},j=!1;if(e&&e.trim()!=="")try{let S=JSON.parse(e);if(!A(S))throw new Error("Existing JSON root must be an object");c=S}catch(S){try{let h=G(e,!0),w=JSON.parse(h);if(!A(w))throw new Error("Existing JSON root must be an object");c=w,j=h!==e}catch(h){let w=h instanceof Error?h.message:String(h),m=S instanceof Error?S.message:String(S);throw new Error(`Failed to parse existing JSON: ${w} (raw JSON error: ${m})`)}}let l=t==="json-servers"?"servers":t==="json-mcp"?"mcp":"mcpServers";if(g&&g.length>0){let S=g.join(".");for(let m of g){if(typeof m!="string"||m.length===0)throw new Error(`Invalid JSON field "${S}"`);if(m==="__proto__"||m==="constructor"||m==="prototype")throw new Error(`Refusing to use unsafe JSON field "${S}"`);if(!/^[A-Za-z0-9_-]+$/.test(m))throw new Error(`Invalid JSON field "${S}"`)}let h=c;for(let m of g){if(m==="__proto__"||m==="constructor"||m==="prototype")throw new Error(`Refusing to use unsafe JSON field "${S}"`);let v=h[m];if(v===void 0){if(s)return e;h[m]={}}else if(!A(v))throw new Error(`Existing JSON field "${S}" must be an object`);h=h[m]}if(s)delete h.superpowers;else{let m=p?{...p}:{command:r,args:n};h.superpowers=H(h.superpowers,m,t)}let w=JSON.stringify(c,null,2)+`
|
|
28
|
+
`;return j&&w!==e&&process.stderr.write(`[superpowers-mcp] Warning: JSONC comments/trailing commas in the existing config were removed while updating it (the file is rewritten as plain JSON).
|
|
29
|
+
`),w}let f=F.find(S=>A(c[S])&&c[S].superpowers!==void 0)??l;if(c[f]!==void 0&&!A(c[f]))throw new Error(`Existing JSON field "${f}" must be an object`);c[f]===void 0&&(c[f]={});let C=c[f];if(s)delete C.superpowers;else{let S;p?S={...p}:t==="json-servers"?S={command:r,args:n,type:"stdio"}:t==="json-mcp"?S={type:"local",command:[r,...n],enabled:!0}:S={command:r,args:n},C.superpowers=H(C.superpowers,S,t)}let x=JSON.stringify(c,null,2)+`
|
|
30
|
+
`;return j&&x!==e&&process.stderr.write(`[superpowers-mcp] Warning: JSONC comments/trailing commas in the existing config were removed while updating it (the file is rewritten as plain JSON).
|
|
31
|
+
`),x}function fe(e,t=10){try{let r=o.dirname(e),n=`${o.basename(e)}.`,s=".bak",p=u.readdirSync(r).filter(g=>{if(!g.startsWith(n)||!g.endsWith(s))return!1;let c=g.slice(n.length,g.length-s.length);return/^\d+$/.test(c)}).map(g=>{let c=o.join(r,g);try{return{full:c,mtimeMs:u.statSync(c).mtimeMs}}catch{return{full:c,mtimeMs:0}}}).sort((g,c)=>c.mtimeMs-g.mtimeMs);for(let g of p.slice(t))try{u.unlinkSync(g.full)}catch{}}catch{}}function Q(e,t,r=!1,n=[],s){if(n.length===0)throw new Error("safeWriteConfig requires at least one allowed destination root");let p=e;try{let a=u.lstatSync(e,{throwIfNoEntry:!1});if(a&&a.isSymbolicLink()){try{p=u.realpathSync(e)}catch{let O=u.readlinkSync(e);p=o.resolve(o.dirname(e),O)}let i=o.normalize(o.resolve(p)).toLowerCase(),d=o.normalize(o.resolve(R.tmpdir())).toLowerCase();if(!(i===d||i.startsWith(d+o.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(P=>i===P||i.startsWith(P+o.sep))||i==="/var"||i.startsWith("/var"+o.sep)&&!i.startsWith("/var/folders"+o.sep)||i==="/private/var"||i.startsWith("/private/var"+o.sep)&&!i.startsWith("/private/var/folders"+o.sep)))throw new Error(`Refusing to write to unsafe symlink target: ${p}`)}}catch(a){if(a instanceof Error&&a.message.includes("Refusing to write to unsafe symlink target"))throw a}let g=o.dirname(p);u.existsSync(g)||u.mkdirSync(g,{recursive:!0,mode:448});let c=u.realpathSync(g),j=u.statSync(c);p=o.join(c,o.basename(p));let l=o.normalize(o.resolve(p)).toLowerCase(),f=o.normalize(o.resolve(R.tmpdir())).toLowerCase(),C=l===f||l.startsWith(f+o.sep),S=["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(a=>l===a||l.startsWith(a+o.sep))||l==="/var"||l.startsWith("/var"+o.sep)&&!l.startsWith("/var/folders"+o.sep)||l==="/private/var"||l.startsWith("/private/var"+o.sep)&&!l.startsWith("/private/var/folders"+o.sep);if(!C&&S)throw new Error(`Refusing to write to unsafe configuration target: ${p}`);if(!n.some(a=>{if(!a)return!1;let i=o.resolve(a);try{i=u.realpathSync(i)}catch{}let d=o.relative(i,p);return d!==".."&&!d.startsWith(`..${o.sep}`)&&!o.isAbsolute(d)}))throw new Error(`Refusing to write configuration outside allowed roots: ${p}`);let w=384;if(u.existsSync(p)){try{w=u.statSync(p).mode}catch{}if(r){let a=u.readFileSync(p,"utf8"),i=`${p}.${Date.now()}.bak`;try{u.writeFileSync(i,a,{encoding:"utf8",mode:w})}catch(d){let y=d instanceof Error?d.message:String(d);throw new Error(`Failed to create safe backup before write: ${y}`)}fe(p)}}let m=z.randomBytes(8).toString("hex"),v=o.join(c,`.tmp.${o.basename(p)}.${process.pid}.${m}`);try{u.writeFileSync(v,t,{encoding:"utf8",mode:w,flag:"wx"});let a=u.existsSync(p);if(s===null&&a)throw new Error("Configuration changed concurrently before it could be created");if(s!=null&&(!a||u.readFileSync(p,"utf8")!==s))throw new Error("Configuration changed concurrently; refusing to overwrite newer content");let i=u.realpathSync(g),d=u.statSync(i);if(i!==c||d.dev!==j.dev||d.ino!==j.ino)throw new Error("Configuration directory changed while writing");u.renameSync(v,p)}catch(a){try{u.existsSync(v)&&u.unlinkSync(v)}catch{}throw a}}async function Z(e={}){let t=e.platform||R.platform(),r=e.homeDir||R.homedir(),n=e.appData||process.env.APPDATA,s=e.localAppData||process.env.LOCALAPPDATA,p=!!e.dryRun,g=!!e.remove,c=!!e.bun,j=e.target?e.target.toLowerCase():null,l=c?"bunx":"npx",f=["-y","superpowers-mcp"],C=[];if(!j)throw new Error(`No target client specified. Please specify which client to configure using --target <${Object.keys(W).join("|")}>.`);let x=Object.keys(W).find(h=>h===j||W[h].aliases.includes(j));if(!x)throw new Error(`Unknown harness target: "${j}". Supported targets: ${Object.keys(W).join(", ")}`);let S=[x];for(let h of S){let w=W[h],m=w.getConfigPath(t,r,n,s),v=u.existsSync(m);if(g&&!v){C.push({target:h,name:w.name,path:m,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let a="";v&&(a=u.readFileSync(m,"utf8"));let i="";if(w.type==="yaml")i=V(a,l,f,g,w.yamlProfile);else if(w.type==="toml")i=Y(a,l,f,g);else{let d=typeof w.defaultConfig=="function"?w.defaultConfig(l,f):void 0;i=B(a,w.type,l,f,g,d,w.serverPath)}if(a.trim()===i.trim()&&v){C.push({target:h,name:w.name,path:m,status:"up-to-date",message:g?"Already not configured":"Already configured and up-to-date"});continue}p||Q(m,i,!!e.backup,[r,n||"",s||""],v?a:null),C.push({target:h,name:w.name,path:m,status:g?"removed":v?"updated":"created",message:p?`[Dry Run] Would ${g?"remove from":v?"update":"create"} ${m}`:`Successfully ${g?"removed from":v?"updated":"configured"}!`})}catch(a){let i=a instanceof Error?a.message:String(a);C.push({target:h,name:w.name,path:m,status:"error",message:i})}}return C}async function K(e=process.argv.slice(2)){let t=!1,r={dryRun:!1,remove:!1,bun:!1,backup:!1,target:null};for(let n=0;n<e.length;n++){let s=e[n];if(!(s==="setup"||s==="install"||s==="--setup"))if(s==="--print-config")t=!0;else if(s==="--dry-run")r.dryRun=!0;else if(s==="--remove"||s==="--uninstall")r.remove=!0;else if(s==="--bun")r.bun=!0;else if(s==="--backup")r.backup=!0;else if(s==="--target"||s==="-t"){let p=e[n+1];if(!p||p.startsWith("-")){console.error(`\u274C Error: Missing value for --target flag.
|
|
28
32
|
`),process.exitCode=1;return}r.target=e[++n]}else if(s.startsWith("--target=")){let p=s.split("=")[1];if(!p){console.error(`\u274C Error: Missing value for --target flag.
|
|
29
|
-
`),process.exitCode=1;return}r.target=p}else if(s==="--help"||s==="-h"){
|
|
33
|
+
`),process.exitCode=1;return}r.target=p}else if(s==="--help"||s==="-h"){ge();return}else if(s.startsWith("-")){console.error(`\u274C Error: Unknown option "${s}". Use --help for usage.
|
|
30
34
|
`),process.exitCode=1;return}else if(!r.target)r.target=s;else{console.error(`\u274C Error: Unexpected argument "${s}". Use --help for usage.
|
|
31
35
|
`),process.exitCode=1;return}}if(t){if(r.target||r.remove||r.backup||r.dryRun){console.error("--print-config supports only --bun; omit target and file-operation flags."),process.exitCode=1;return}console.log(JSON.stringify({mcpServers:{superpowers:{command:r.bun?"bunx":"npx",args:["-y","superpowers-mcp"]}}},null,2));return}if(console.log(`
|
|
32
36
|
========================================================`),console.log("\u26A1 Superpowers MCP - Targeted Client Setup"),console.log(`========================================================
|
|
@@ -34,9 +38,9 @@ ${a}`}let l=p[0],f=l+1;for(;f<s.length&&!(D(s[f])&&!se.test(s[f]));)f++;let S=f;
|
|
|
34
38
|
`),console.log(" npx -y superpowers-mcp setup --target lmstudio # LM Studio (~/.lmstudio/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target roo # Roo Code in VS Code Desktop"),console.log(" npx -y superpowers-mcp setup --print-config # JSON for desktop app import"),console.log(" npx -y superpowers-mcp setup --target antigravity # Antigravity (~/.gemini/config/mcp_config.json)"),console.log(" npx -y superpowers-mcp setup --target pi-desktop # Pi Desktop / Pi Agent (~/.pi/agent/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target cursor # Cursor (~/.cursor/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target copilot # GitHub Copilot (VS Code mcp.json)"),console.log(" npx -y superpowers-mcp setup --target copilot-insiders # GitHub Copilot (VS Code Insiders mcp.json)"),console.log(" npx -y superpowers-mcp setup --target hermes # Hermes Desktop / Agent"),console.log(" npx -y superpowers-mcp setup --target kimi # Kimi Work / Kimi Code"),console.log(" npx -y superpowers-mcp setup --target claude # Claude Desktop"),console.log(" npx -y superpowers-mcp setup --target devin # Devin Desktop (formerly Windsurf)"),console.log(" npx -y superpowers-mcp setup --target qwenpaw # QwenPaw / CoPaw (~/.qwenpaw/config.json)"),console.log(" npx -y superpowers-mcp setup --target cline # Cline (~/.../cline_mcp_settings.json)"),console.log(" npx -y superpowers-mcp setup --target kilo # Kilo Code (~/.config/kilo/kilo.jsonc)"),console.log(" npx -y superpowers-mcp setup --target qoder # Qoder (~/.qoder/settings.json)"),console.log(" npx -y superpowers-mcp setup --target kiro # Kiro (~/.kiro/settings/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target trae # Trae (~/.../Trae/User/mcp.json)"),console.log(" npx -y superpowers-mcp setup --target codex # Codex (~/.codex/config.toml)"),console.log(" npx -y superpowers-mcp setup --target openclaw # OpenClaw (~/.openclaw/openclaw.json)"),console.log(` npx -y superpowers-mcp setup --target goose # Goose (~/.config/goose/config.yaml)
|
|
35
39
|
`),console.log("\u{1F4A1} Tip:"),console.log(" You can run this setup command from ANY folder on your system."),console.log(` It automatically targets your global config files (~/...) without needing to clone this repo.
|
|
36
40
|
`),console.log("\u{1F4A1} Privacy & Safety:"),console.log(" Superpowers MCP only configures the specific client you explicitly choose."),console.log(` It will NEVER silently scan or modify unselected environments.
|
|
37
|
-
`),process.exitCode=1;return}try{let n=await
|
|
41
|
+
`),process.exitCode=1;return}try{let n=await Z(r),s=0,p=0,g=0;for(let c of n){let j=c.status==="created"||c.status==="updated"||c.status==="removed"?"\u2705":c.status==="up-to-date"?"\u2728":c.status==="skipped"?"\u23ED\uFE0F ":"\u274C";console.log(`${j} [${c.name}] (${c.status})`),console.log(` Path: ${c.path}`),console.log(` Info: ${c.message}
|
|
38
42
|
`),c.status==="created"||c.status==="updated"||c.status==="up-to-date"||c.status==="removed"?s++:c.status==="skipped"?p++:c.status==="error"&&g++}if(console.log("--------------------------------------------------------"),g>0){console.error(`\u26A0\uFE0F Setup finished with errors: ${g} failure(s), ${s} succeeded.`),process.exitCode=1;return}console.log(`\u{1F389} Setup complete! ${s} environment(s) ready.`)}catch(n){let s=n instanceof Error?n.message:String(n);console.error(`\u274C Setup failed: ${s}
|
|
39
|
-
`),process.exitCode=1}}function
|
|
43
|
+
`),process.exitCode=1}}function ge(){console.log(`
|
|
40
44
|
Superpowers MCP - Targeted Global Setup
|
|
41
45
|
|
|
42
46
|
Usage:
|
|
@@ -84,4 +88,4 @@ Any Directory:
|
|
|
84
88
|
Privacy & Safety:
|
|
85
89
|
Superpowers MCP only touches the client you explicitly choose.
|
|
86
90
|
It never bulk-modifies your environment without your consent.
|
|
87
|
-
`)}
|
|
91
|
+
`)}K().catch(e=>{let t=e instanceof Error?e.message:String(e);console.error(`\u274C Fatal error: ${t}`),process.exitCode=1});0&&(module.exports={HARNESS_CONFIGS,JSON_SERVER_ROOT_KEYS,isPlainObject,runSetup,runSetupCli,safeWriteConfig,stripJsonComments,updateJsonConfig,updateTomlConfig,updateYamlConfig});
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "superpowers-mcp",
|
|
3
3
|
"displayName": "Superpowers MCP",
|
|
4
4
|
"description": "Superpowers skills library (TDD, debugging, collaboration workflows) as an MCP server for VSCode and Antigravity",
|
|
5
|
-
"version": "6.4.
|
|
5
|
+
"version": "6.4.6",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18"
|
|
8
8
|
},
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"@hono/node-server": "^2.1.1",
|
|
42
42
|
"fast-uri": "^4.2.1",
|
|
43
43
|
"hono": "^4.13.7",
|
|
44
|
+
"proxy-addr": "^2.0.8",
|
|
44
45
|
"qs": "^6.16.0"
|
|
45
46
|
},
|
|
46
47
|
"scripts": {
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"prepublishOnly": "npm run build"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
57
|
+
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
57
58
|
"@types/node": "^20.0.0",
|
|
58
59
|
"esbuild": "^0.28.1",
|
|
59
60
|
"typescript": "^5.6.0"
|
|
@@ -334,7 +334,10 @@ function isFullDocument(html) {
|
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
function wrapInFrame(content) {
|
|
337
|
-
|
|
337
|
+
// Replacer function, not a string: agent-authored HTML routinely contains
|
|
338
|
+
// `$&`, `$'`, `$`` or `$$`, which String.replace expands as substitution
|
|
339
|
+
// tokens, mangling or truncating the rendered screen.
|
|
340
|
+
return renderBranding(frameTemplate).replace('<!-- CONTENT -->', () => content);
|
|
338
341
|
}
|
|
339
342
|
|
|
340
343
|
function ensurePrivateDirectory(directory) {
|
|
@@ -679,7 +682,9 @@ function handleRequest(req, res) {
|
|
|
679
682
|
const injection = helperInjection(nonce);
|
|
680
683
|
|
|
681
684
|
if (html.includes('</body>')) {
|
|
682
|
-
|
|
685
|
+
// Function replacer for the same reason as wrapInFrame: the injected
|
|
686
|
+
// helper script is substitution-token safe only by convention.
|
|
687
|
+
html = html.replace('</body>', () => injection + '\n</body>');
|
|
683
688
|
} else {
|
|
684
689
|
html += injection;
|
|
685
690
|
}
|