superpowers-mcp 6.4.8 → 6.4.10
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 +17 -2
- package/README.hi.md +17 -2
- package/README.ja.md +17 -2
- package/README.ko.md +17 -2
- package/README.md +20 -5
- package/README.pt-BR.md +17 -2
- package/README.zh-TW.md +17 -2
- package/out/server.js +161 -142
- package/out/setup-runner.js +35 -35
- package/out/setup.js +36 -36
- package/package.json +3 -3
- package/skills/brainstorming/scripts/server.cjs +30 -2
- package/skills/brainstorming/scripts/start-server.ps1 +2 -2
- package/skills/brainstorming/scripts/start-server.sh +2 -2
- package/skills/subagent-driven-development/scripts/sdd-workspace.ps1 +3 -1
package/out/setup.js
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`||
|
|
4
|
-
`&&
|
|
5
|
-
`&&
|
|
2
|
+
"use strict";var fe=Object.create;var V=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var we=(e,t)=>{for(var s in t)V(e,s,{get:t[s],enumerable:!0})},ee=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of de(t))!he.call(e,r)&&r!==s&&V(e,r,{get:()=>t[r],enumerable:!(n=ge(t,r))||n.enumerable});return e};var U=(e,t,s)=>(s=e!=null?fe(me(e)):{},ee(t||!e||!e.__esModule?V(s,"default",{value:e,enumerable:!0}):s,e)),ye=e=>ee(V({},"__esModule",{value:!0}),e);var Ke={};we(Ke,{runSetupCli:()=>X});module.exports=ye(Ke);var ue=U(require("path"));var f=U(require("fs")),o=U(require("path")),K=U(require("os")),Q=U(require("crypto"));function T(e){let t=process.env.XDG_CONFIG_HOME;if(t&&t.trim()!==""){if(t.startsWith("~")||!o.isAbsolute(t))throw new Error(`XDG_CONFIG_HOME must be an absolute path, got: ${t}`);return t}return o.join(e,".config")}var H={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,s)=>{let n=e==="win32"?s||o.join(t,"AppData","Roaming"):e==="darwin"?o.join(t,"Library","Application Support"):T(t);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,s,n)=>e==="win32"?o.join(s||o.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?o.join(t,"Library","Application Support","Code","User","mcp.json"):o.join(T(t),"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,s,n)=>e==="win32"?o.join(s||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(t),"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,s,n)=>{if(e==="win32"){let r=n||o.join(t,"AppData","Local");return o.join(r,"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,s)=>e==="win32"?o.join(s||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(t),"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,s)=>{let n=e==="win32"?s||o.join(t,"AppData","Roaming"):T(t),r=o.join(n,"devin","mcp_config.json");return f.existsSync(r)?r: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,s)=>{if(e==="win32"){let c=o.join(s||o.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(f.existsSync(c))return c;let l=o.join(t,".pi","agent","mcp.json");if(f.existsSync(l))return l;let p=o.join(t,".pi","mcp.json");return f.existsSync(p)?p:l}let n=o.join(t,".pi","agent","mcp.json");if(f.existsSync(n))return n;let r=o.join(t,".pi","mcp.json");return f.existsSync(r)?r: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 s=o.join(t,".qwenpaw","config.json");if(f.existsSync(s))return s;let n=o.join(t,".copaw","config.json");return f.existsSync(n)?n:s},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},cline:{name:"Cline (VS Code / CLI)",aliases:["cline","claude-dev"],getConfigPath:(e,t,s)=>{let n="";if(e==="win32"?n=o.join(s||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(t),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),f.existsSync(n))return n;let r=o.join(t,".cline","data","settings","cline_mcp_settings.json");return f.existsSync(r)?r:n},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kilo:{name:"Kilo Code",aliases:["kilo","kilocode","kilo-code"],getConfigPath:(e,t,s)=>{if(e==="win32"){let c=s||o.join(t,"AppData","Roaming"),l=o.join(c,"Kilo","kilo.jsonc");if(f.existsSync(l))return l;let p=o.join(c,"Kilo","kilo.json");return f.existsSync(p)?p:l}let n=o.join(T(t),"kilo","kilo.jsonc");if(f.existsSync(n))return n;let r=o.join(T(t),"kilo","kilo.json");return f.existsSync(r)?r:n},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,s)=>{if(e==="win32"){let n=o.join(s||o.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(f.existsSync(n))return n;let r=o.join(s||o.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return f.existsSync(r)?r:n}else if(e==="darwin"){let n=o.join(t,"Library","Application Support","Trae","User","mcp.json");if(f.existsSync(n))return n;let r=o.join(t,"Library","Application Support","Trae CN","User","mcp.json");return f.existsSync(r)?r:n}else{let n=o.join(T(t),"Trae","User","mcp.json");if(f.existsSync(n))return n;let r=o.join(T(t),"Trae CN","User","mcp.json");return f.existsSync(r)?r: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,s)=>e==="win32"?o.join(s||o.join(t,"AppData","Roaming"),"Block","goose","config","config.yaml"):o.join(T(t),"goose","config.yaml"),type:"yaml",yamlProfile:"goose",defaultConfig:(e,t)=>({cmd:e,args:t})}},te=["mcpServers","servers","mcp"];function D(e){return Object.prototype.toString.call(e)==="[object Object]"}function le(e,t=!1){if(!e)return"";if(!t)try{return JSON.parse(e),e}catch{}let s=e.length,n=[],r=!1,c=!1,l=!1,p=!1,C=-1;for(let d=0;d<s;d++){let y=e[d],A=d+1<s?e[d+1]:"";if(l){(y===`
|
|
3
|
+
`||y==="\r")&&(l=!1,n.push(y));continue}if(p){y==="*"&&A==="/"&&(p=!1,d++);continue}if(r){n.push(y),c?c=!1:y==="\\"?c=!0:y==='"'&&(r=!1);continue}if(y==='"'){r=!0,c=!1,C=-1,n.push(y);continue}if(y==="/"&&A==="/"){l=!0,d++;continue}if(y==="/"&&A==="*"){p=!0,d++;continue}if(y===","){let $=-1;for(let g=n.length-1;g>=0;g--){let h=n[g];if(h!==" "&&h!==" "&&h!==`
|
|
4
|
+
`&&h!=="\r"){$=g;break}}let _=$===-1?"":n[$];_!==""&&_!=="{"&&_!=="["&&_!==","?C=n.length:C=-1,n.push(y);continue}if(y==="}"||y==="]"){C!==-1&&(n[C]=" ",C=-1),n.push(y);continue}y!==" "&&y!==" "&&y!==`
|
|
5
|
+
`&&y!=="\r"&&(C=-1),n.push(y)}return n.join("")}function Se(e){if(!e||e.trim()==="")return!1;try{return JSON.parse(e),!1}catch{try{return JSON.parse(le(e,!0)),!0}catch{return!1}}}var z=/\s/;function je(e){let t=!1,s=!1;for(let n=0;n<e.length;n++){let r=e[n];if(s){ce.test(r)&&(s=!1,t=!1);continue}if(r===":")t=!0;else{if(t&&z.test(r))continue;t&&r==="#"?s=!0:t=!1}}return t||s}function F(e){let t=null,s=!1;for(let n=0;n<e.length;n++){let r=e[n];if(t!==null){s?s=!1:t==='"'&&r==="\\"?s=!0:r===t&&(t=null);continue}if(r==='"'||r==="'"){t=r;continue}if(r!=="#"||n===0||!z.test(e[n-1]))continue;let c=n-1;for(;c>0&&z.test(e[c-1]);)c--;return e.slice(c)}return""}var ne=/\s+/y;function Y(e,t){ne.lastIndex=t;let s=ne.exec(e);return s===null?t:t+s[0].length}var ce=/[\n\r\u2028\u2029]/;function Z(e){let t=0,s=0;for(let n=0;n<e.length;n++)e[n]===`
|
|
6
6
|
`&&(n>0&&e[n-1]==="\r"?t++:s++);return t>s?`\r
|
|
7
7
|
`:`
|
|
8
8
|
`}function se(e,t){let s=JSON.stringify(e,null,2),n=t?Z(t):`
|
|
9
9
|
`;return(n===`
|
|
10
10
|
`?s:s.split(`
|
|
11
|
-
`).join(n))+n}function B(e){let t=
|
|
12
|
-
`&&(
|
|
13
|
-
`).join(
|
|
14
|
-
`),-1)===
|
|
15
|
-
`),-1))return e;let
|
|
16
|
-
`;
|
|
11
|
+
`).join(n))+n}function B(e){let t=Y(e,0),s=t,n=e[s]==='"'||e[s]==="'"?e[s]:null;if(n!==null&&s++,!e.startsWith("superpowers",s))return null;if(s+=11,n!==null){if(e[s]!==n)return null;s++}else if(e[s]==='"'||e[s]==="'")return null;if(s=Y(e,s),e[s]!==":")return null;if(s=Y(e,s+1),e[s]==="{"){let r=s+1,c=null;for(;r<e.length;){let l=e[r];if(c){if(c==='"'&&l==="\\"){r+=2;continue}l===c&&(c=null)}else if(l==='"'||l==="'")c=l;else if(l==="}")break;r++}if(r>=e.length)return null;s=Y(e,r+1)}return s!==e.length&&(e[s]!=="#"||!z.test(e[s-1])||ce.test(e.slice(s+1)))?null:e.slice(0,t)}function be(e,t,s,n=!1,r="mcp"){let c=r==="goose"?{rootKey:"extensions",ownedKeys:["cmd","args","type"],freshEntry:(a,u,i)=>[`${a}superpowers:`,`${a}${a}cmd: ${JSON.stringify(u)}`,`${a}${a}args: ${JSON.stringify(i)}`,`${a}${a}type: stdio`,`${a}${a}name: "Superpowers"`,`${a}${a}enabled: true`,`${a}${a}timeout: 300`]}:{rootKey:"mcp_servers",ownedKeys:["command","args"],freshEntry:(a,u,i)=>[`${a}superpowers:`,`${a}${a}command: ${JSON.stringify(u)}`,`${a}${a}args: ${JSON.stringify(i)}`]};if(!/^[A-Za-z0-9_-]+$/.test(c.rootKey))throw new Error("Invalid YAML root key");let l=new RegExp(`^(\\s*)["']?${c.rootKey}["']?\\s*:`),p=new RegExp(`^(\\s*)["']?${c.rootKey}["']?\\s*:\\s*(?:#.*)?$`),C=new RegExp(`^\\s*["']?(?:${c.ownedKeys.join("|")})["']?\\s*:`),d=e?e.split(/\r?\n/):[],y=Z(e),A=(a,u)=>{let i=a.length,m=0;for(;i>0&&a[i-1]===`
|
|
12
|
+
`&&(u<0||m<u);)i--,i>0&&a[i-1]==="\r"&&i--,m++;return a.slice(0,i)},$=a=>{let u=a.split(`
|
|
13
|
+
`).join(y);if(A(u.replace(/\r\n/g,`
|
|
14
|
+
`),-1)===A(e.replace(/\r\n/g,`
|
|
15
|
+
`),-1))return e;let i=0;for(let m=e.length-1;m>=0&&e[m]===`
|
|
16
|
+
`;m--)i++;return i===0?A(u,-1):A(u,-1)+y.repeat(i)},_=d.map((a,u)=>{let i=a.match(l);return i?{index:u,indent:i[1],tail:a.slice(i[0].length).trim()}:null}).filter(a=>a!==null),g=_.filter(a=>a.indent==="");if(g.length>1)throw new Error(`Cannot safely update YAML with duplicate ${c.rootKey} keys`);let h=a=>{if(a.startsWith("#"))return"";let u=F(a);return(u?a.slice(0,a.length-u.length):a).trim()};if(g.length===1){let a=g[0],u=h(a.tail),i=u==="{}"||u==="{ }";if(a.tail!==""&&!a.tail.startsWith("#")&&!i)throw new Error(`Cannot safely update YAML unless ${c.rootKey} is a root-level block mapping`)}else if(_.length>0){if(n)return e;throw new Error(`Cannot safely update YAML unless ${c.rootKey} is a root-level block mapping`)}let j=" ";if(g.length===1)for(let a=g[0].index+1;a<d.length;a++){if(d[a].trim()===""||d[a].trimStart().startsWith("#"))continue;if(/^[^\s]/.test(d[a]))break;let u=d[a].match(/^(\s+)\S/);u&&(j=u[1]);break}if(n){let a=[],u=!1,i=0,m=!1,w=0,S=!1,O=!1,E=-1;for(let k=0;k<d.length;k++){let v=d[k],I=v.match(p);if(I){if(I[1].length===0){i=0,u=!0,E=a.length,a.push(v);continue}if(!u){a.push(v);continue}}if(u){let N=v.match(/^(\s*)/)?.[1].length||0;if(v.trimStart().startsWith("#")){a.push(v);continue}if(v.trim()!==""&&N<=i)u=!1,m=!1;else{let W=B(v);if(W!==null&&W===j){m=!0,w=W.length,S=!0;continue}if(W!==null&&(O=!0),m){if(v.trim()===""){a.push(v);continue}if(N>w)continue;m=!1}}}a.push(v)}if(S&&E>=0&&E<a.length){let k=a[E],v=k.match(p);if(v){let I=v[1].length,N=!1;for(let W=E+1;W<a.length;W++){let L=a[W];if(L.trim()===""||L.trimStart().startsWith("#"))continue;if((L.match(/^(\s*)/)?.[1].length??0)<=I)break;N=!0;break}N||(a[E]=k.replace(p,`${v[1]}${c.rootKey}: {}`)+F(k))}}return S&&O&&process.stderr.write(`[superpowers-mcp] Warning: removed ${c.rootKey}.superpowers but left at least one same-named entry with an unexpected indentation in place; inspect the file for duplicates.
|
|
17
17
|
`),$(a.join(`
|
|
18
|
-
`))}let
|
|
19
|
-
${
|
|
20
|
-
`)}`)+
|
|
18
|
+
`))}let b=c.freshEntry(j,t,s);if(!e||e.trim()==="")return $(`${c.rootKey}:
|
|
19
|
+
${b.join(`
|
|
20
|
+
`)}`)+y;let x=g.length===1?g[0].index:-1;if(x===-1)return $(`${e.trimEnd()}
|
|
21
21
|
|
|
22
22
|
${c.rootKey}:
|
|
23
|
-
${
|
|
24
|
-
`)}`);let P=g.length===1?
|
|
25
|
-
`))}else return
|
|
26
|
-
`))}function q(e){let t=0;for(;t<e.length;){let s=e[t];if(s==='"'||s==="'"){if(e.startsWith(s.repeat(3),t)){let r=e.indexOf(s.repeat(3),t+3);if(r===-1)throw new Error("Cannot safely update TOML with multiline strings");t=r+3;continue}let n=s;for(t++;t<e.length&&e[t]!==n;)n==='"'&&e[t]==="\\"&&t++,t++;t++;continue}if(s==="#"){let n=t;for(;n>0&&
|
|
27
|
-
`||e==="\r"||e==="\f"||e==="\v"}function re(e){let[t]=q(e),s=0;for(;s<t.length&&M(t[s]);)s++;if(s>=t.length||t[s]!=="[")return!1;let n=t.lastIndexOf("]");if(n<=s)return!1;let r=n+1;for(;r<t.length&&M(t[r]);)r++;if(r>=t.length||t[r]==="#")return!0;let c=t.slice(r),l=c.indexOf("#");return!(l===-1?c:c.slice(0,l)).trim().includes("=")}var
|
|
28
|
-
`&&(
|
|
29
|
-
`).join(c);if(l(
|
|
23
|
+
${b.join(`
|
|
24
|
+
`)}`);let P=g.length===1?h(g[0].tail):"";if(P==="{}"||P==="{ }"){let a=d[x],u=a.match(l)?.[0].length??0,i=a.slice(u);d[x]=(a.slice(0,u)+i.slice(i.indexOf(P)+P.length)).trimEnd()}let R=[];if(x!==-1)for(let a=x+1;a<d.length;a++){let u=d[a];if(/^[^\s#]/.test(u))break;if(B(u)!==null&&(u.match(/^(\s*)/)?.[1]||"")!==j)throw new Error(`Cannot safely update YAML with ${c.rootKey}.superpowers at an unexpected indentation`)}for(let a=x+1;a<d.length;a++){let u=d[a];if(/^[^\s#]/.test(u))break;(u.match(/^(\s*)/)?.[1]||"")===j&&B(u)!==null&&R.push(a)}for(let a=R.length-1;a>=1;a--){let u=R[a],i=d[u].match(/^(\s*)/)?.[1].length,m=i===void 0?2:i,w=u+1;for(;w<d.length;){let S=d[w];if((S.match(/^(\s*)/)?.[1].length||0)>m||S.trim()==="")w++;else break}d.splice(u,w-u)}let J=R.length>0?R[0]:-1;if(J!==-1){let a=d[J].match(/^(\s*)/)?.[1].length,u=a===void 0?2:a,i=J+1;for(;i<d.length;){let E=d[i];if((E.match(/^(\s*)/)?.[1].length||0)>u||E.trim()==="")i++;else break}let m=[],w=-1,S=[];for(let E=J+1;E<i;E++){let k=d[E];if(k.trim()===""){m.push(k);continue}let v=k.match(/^(\s*)/)?.[1].length??0;if(!(w!==-1&&v>w)){for(w=-1;S.length>0&&v<=S[S.length-1];)S.pop();if(C.test(k)&&S.length===0){w=v;continue}!k.trimStart().startsWith("#")&&je(k)&&S.push(v),m.push(k)}}b[0]+=F(d[J]);let O=b.filter((E,k)=>{if(k===0)return!0;let v=E.match(/^\s*["']?([A-Za-z0-9_-]+)["']?\s*:/);return!v||c.ownedKeys.includes(v[1])});return d.splice(J,i-J,...O,...m),$(d.join(`
|
|
25
|
+
`))}else return d.splice(x+1,0,...b),$(d.join(`
|
|
26
|
+
`))}function q(e){let t=0;for(;t<e.length;){let s=e[t];if(s==='"'||s==="'"){if(e.startsWith(s.repeat(3),t)){let r=e.indexOf(s.repeat(3),t+3);if(r===-1)throw new Error("Cannot safely update TOML with multiline strings");t=r+3;continue}let n=s;for(t++;t<e.length&&e[t]!==n;)n==='"'&&e[t]==="\\"&&t++,t++;t++;continue}if(s==="#"){let n=t;for(;n>0&&z.test(e[n-1]);)n--;return[e.slice(0,n),e.slice(n)]}t++}return[e,""]}var ke=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\]\s*(?:#.*)?$/;function M(e){return e===" "||e===" "||e===`
|
|
27
|
+
`||e==="\r"||e==="\f"||e==="\v"}function re(e){let[t]=q(e),s=0;for(;s<t.length&&M(t[s]);)s++;if(s>=t.length||t[s]!=="[")return!1;let n=t.lastIndexOf("]");if(n<=s)return!1;let r=n+1;for(;r<t.length&&M(t[r]);)r++;if(r>=t.length||t[r]==="#")return!0;let c=t.slice(r),l=c.indexOf("#");return!(l===-1?c:c.slice(0,l)).trim().includes("=")}var ve=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\./,Ce=/^\s*\[\[\s*mcp_servers\s*\.\s*superpowers\s*\]\]/,xe=/^\s*\[\[\s*mcp_servers\s*\.\s*superpowers\s*\./;function Ee(e){let t=0;for(;t<e.length&&M(e[t]);)t++;if(t>=e.length||e[t]!=="[")return!1;let s=e.lastIndexOf("]");if(s<=t)return!1;let n=s+1;for(;n<e.length&&M(e[n]);)n++;if(n<e.length&&e[n]!=="#")return!1;let r=e.slice(t+1,s);return!r.includes("mcp_servers")||!r.includes("superpowers")?!1:r.includes('"')||r.includes("'")}function $e(e){let t=0;for(;t<e.length&&M(e[t]);)t++;let s=null;if(e.startsWith("command",t))s="command",t+=7;else if(e.startsWith("args",t))s="args",t+=4;else return null;for(;t<e.length&&M(e[t]);)t++;if(t>=e.length||e[t]!=="=")return null;for(t++;t<e.length&&M(e[t]);)t++;let n=e.length;for(;n>t&&M(e[n-1]);)n--;return{key:s,value:e.slice(t,n)}}function _e(e){let t=0;for(;t<e.length&&M(e[t]);)t++;let s=()=>{if(e[t]==='"'||e[t]==="'"){let c=e[t],l=e.indexOf(c,t+1);if(l===-1)return null;let p=e.slice(t+1,l);return t=l+1,p}let n=t;for(;n<e.length&&/[A-Za-z0-9_-]/.test(e[n]);)n++;if(n===t)return null;let r=e.slice(t,n);return t=n,r};if(s()!=="mcp_servers")return!1;for(;;){let n=t;for(;n<e.length&&M(e[n]);)n++;if(e[n]!==".")break;for(t=n+1;t<e.length&&M(e[t]);)t++;let r=s();if(r===null||r==="")return!1}for(;t<e.length&&M(e[t]);)t++;return e[t]==="="}function Oe(e){let t=e.trim();if(t.startsWith("'''")||t.startsWith('"""'))return e;let s="",n=0;for(;n<e.length;){let r=e[n];if(r==='"'){let c=n+1,l=!1;for(;c<e.length;){if(l)l=!1;else if(e[c]==="\\")l=!0;else if(e[c]==='"')break;c++}let p=Math.min(c+1,e.length);s+=e.slice(n,p),n=p}else if(r==="'"){let c=e.indexOf("'",n+1);if(c===-1){s+=r,n++;continue}s+=JSON.stringify(e.slice(n+1,c)),n=c+1}else s+=r,n++}return s}var Re=/^\s*(command|args)\s*=/;function oe(e){let t=0,s=0;for(;s<e.length;){let n=e[s];if(n==='"'||n==="'"){if(e.startsWith(n.repeat(3),s)){let c=e.indexOf(n.repeat(3),s+3);if(c===-1)return!0;s=c+3;continue}let r=n;for(s++;s<e.length&&e[s]!==r;)r==='"'&&e[s]==="\\"&&s++,s++;if(s>=e.length)return!0;s++;continue}n==="["||n==="{"?t++:(n==="]"||n==="}")&&t--,s++}return t>0}function Ae(e,t,s,n=!1){let r=e?e.split(/\r?\n/):[],c=Z(e),l=(i,m)=>{let w=i.length,S=0;for(;w>0&&i[w-1]===`
|
|
28
|
+
`&&(m<0||S<m);)w--,w>0&&i[w-1]==="\r"&&w--,S++;return i.slice(0,w)},p=i=>{let m=i.split(`
|
|
29
|
+
`).join(c);if(l(m.replace(/\r\n/g,`
|
|
30
30
|
`),-1)===l(e.replace(/\r\n/g,`
|
|
31
|
-
`),-1))return e;let
|
|
32
|
-
`;
|
|
33
|
-
`))}if(
|
|
34
|
-
`||
|
|
35
|
-
`))}}}if(C.length===0){let
|
|
36
|
-
${
|
|
31
|
+
`),-1))return e;let w=0;for(let S=e.length-1;S>=0&&e[S]===`
|
|
32
|
+
`;S--)w++;return w===0?l(m,-1):l(m,-1)+c.repeat(w)};for(let i of r)if(_e(i))throw new Error("Cannot safely update TOML with inline mcp_servers assignment (expected [mcp_servers.superpowers] table)");let C=[],d=[];for(let i=0;i<r.length;i++){if(Ee(r[i]))throw new Error("Cannot safely update TOML with quoted mcp_servers.superpowers table names");Ce.test(r[i])&&d.push(i),ke.test(r[i])&&C.push(i)}if(C.length>1)throw new Error("Cannot safely update TOML with duplicate mcp_servers.superpowers tables");let y=i=>{let m=i+1;for(;m<r.length&&!(re(r[m])&&!ve.test(r[m])&&!xe.test(r[m]));)m++;return m};if(n){let i=[...C,...d].map(w=>[w,y(w)]).sort((w,S)=>w[0]-S[0]);if(i.length===0)return e;let m=new Set;for(let[w,S]of i)for(let O=w;O<S;O++)m.add(O);return p(r.filter((w,S)=>!m.has(S)).join(`
|
|
33
|
+
`))}if(d.length>0)throw new Error("Cannot safely update TOML: [[mcp_servers.superpowers]] is an array-of-tables, which cannot coexist with a [mcp_servers.superpowers] table. Remove it first.");let A=`command = ${JSON.stringify(t)}`,$=`args = ${JSON.stringify(s)}`,_=i=>{let m=Oe(i),w="",S=!1,O=!1;for(let E=0;E<m.length;E++){let k=m[E];if(S)w+=k,O?O=!1:k==="\\"?O=!0:k==='"'&&(S=!1);else if(k==='"')S=!0,w+=k;else{if(k===" "||k===" "||k===`
|
|
34
|
+
`||k==="\r"||k==="\f"||k==="\v")continue;w+=k}}return w};if(C.length===0){let i=-1;for(let m=0;m<r.length;m++)if(/^\s*\[\s*mcp_servers\s*\]\s*(?:#.*)?$/.test(r[m])){i=m;break}if(i!==-1){let m=y(i),w={},S=!1,O={},E={};for(let k=i+1;k<m;k++){let[v,I]=q(r[k]),N=/^\s*["']?superpowers["']?\s*\.\s*["']?(command|args)["']?\s*=/.exec(v);if(!N)continue;let W=v.slice(N[0].length).trim();if(oe(W))throw new Error(`Cannot safely update TOML: superpowers.${N[1]} under [mcp_servers] spans multiple lines. Put it on a single line and re-run.`);N[1]in w?S=!0:(w[N[1]]=k,E[N[1]]=_(W),O[N[1]]=I)}if(Object.keys(w).length>0){if(!S&&E.command===_(JSON.stringify(t))&&E.args===_(JSON.stringify(s)))return e;let k=`superpowers.command = ${JSON.stringify(t)}${O.command??""}`,v=`superpowers.args = ${JSON.stringify(s)}${O.args??""}`,I=r.slice(0,i+1),N=!1;for(let W=i+1;W<m;W++){let[L]=q(r[W]);if(/^\s*["']?superpowers["']?\s*\.\s*["']?(command|args)["']?\s*=/.test(L)){N||(I.push(k,v),N=!0);continue}I.push(r[W])}return N||I.push(k,v),I.push(...r.slice(m)),p(I.join(`
|
|
35
|
+
`))}}}if(C.length===0){let i=`[mcp_servers.superpowers]
|
|
36
|
+
${A}
|
|
37
37
|
${$}
|
|
38
|
-
`;return!e||e.trim()===""?
|
|
38
|
+
`;return!e||e.trim()===""?i:p(`${e.trimEnd()}
|
|
39
39
|
|
|
40
|
-
${
|
|
41
|
-
`))}function ie(e,t,s){if(!D(e)){if(e===void 0)return t;throw new Error('Existing "superpowers" entry must be an object')}let n={...e,...t};return(e.enabled!==void 0||e.disabled!==void 0)&&(e.enabled!==void 0?(n.enabled=e.enabled,delete n.disabled):delete n.enabled),s==="json-mcp"&&Array.isArray(n.command)&&delete n.args,n}function
|
|
42
|
-
`),j)}let $=te.filter(g=>D(
|
|
43
|
-
`),
|
|
44
|
-
`)),
|
|
40
|
+
${i}`)}let g=C[0],h=y(g),j=h;for(let i=g+1;i<h;i++)if(re(r[i])){j=i;break}let b=null,x=null,P=!1,R={};for(let i=g+1;i<j;i++){let[m,w]=q(r[i]),S=$e(m);if(S){if(oe(S.value))throw new Error(`Cannot safely update TOML: ${S.key} under [mcp_servers.superpowers] spans multiple lines. Put it on a single line and re-run.`);S.key==="command"?b===null?b=_(S.value):P=!0:x===null?x=_(S.value):P=!0,S.key in R||(R[S.key]=w)}}if(!P&&b===_(JSON.stringify(t))&&x===_(JSON.stringify(s)))return e;let J=[`${A}${R.command??""}`,`${$}${R.args??""}`],a=r.slice(0,g+1),u=!1;for(let i=g+1;i<j;i++){let[m]=q(r[i]);if(Re.test(m)){u||(a.push(...J),u=!0);continue}a.push(r[i])}return u||a.push(...J),a.push(...r.slice(j,h)),a.push(...r.slice(h)),p(a.join(`
|
|
41
|
+
`))}function ie(e,t,s){if(!D(e)){if(e===void 0)return t;throw new Error('Existing "superpowers" entry must be an object')}let n={...e,...t};return(e.enabled!==void 0||e.disabled!==void 0)&&(e.enabled!==void 0?(n.enabled=e.enabled,delete n.disabled):delete n.enabled),s==="json-mcp"&&Array.isArray(n.command)&&delete n.args,n}function Pe(e,t,s,n,r=!1,c,l){let p={},C=!1;e.charCodeAt(0)===65279&&(e=e.slice(1));let d=null;if(e&&e.trim()!==""){try{let g=JSON.parse(e);if(!D(g))throw new Error("Existing JSON root must be an object");p=g}catch(g){try{let h=le(e,!0),j=JSON.parse(h);if(!D(j))throw new Error("Existing JSON root must be an object");p=j,C=h!==e}catch(h){let j=h instanceof Error?h.message:String(h),b=g instanceof Error?g.message:String(g);throw new Error(`Failed to parse existing JSON: ${j} (raw JSON error: ${b})`)}}d=JSON.stringify(p)}let y=t==="json-servers"?"servers":t==="json-mcp"?"mcp":"mcpServers";if(l&&l.length>0){let g=l.join(".");for(let b of l){if(typeof b!="string"||b.length===0)throw new Error(`Invalid JSON field "${g}"`);if(b==="__proto__"||b==="constructor"||b==="prototype")throw new Error(`Refusing to use unsafe JSON field "${g}"`);if(!/^[A-Za-z0-9_-]+$/.test(b))throw new Error(`Invalid JSON field "${g}"`)}let h=p;for(let b of l){if(b==="__proto__"||b==="constructor"||b==="prototype")throw new Error(`Refusing to use unsafe JSON field "${g}"`);let x=h[b];if(x===void 0){if(r)return e;h[b]={}}else if(!D(x))throw new Error(`Existing JSON field "${g}" must be an object`);h=h[b]}if(r){if(h.superpowers===void 0)return e;delete h.superpowers}else{let b=c?{...c}:{command:s,args:n};h.superpowers=ie(h.superpowers,b,t)}let j=se(p,e);return d!==null&&JSON.stringify(p)===d?e:(C&&j!==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).
|
|
42
|
+
`),j)}let $=te.filter(g=>D(p[g])).filter(g=>g===y||p[g].superpowers!==void 0);if($.length===0&&$.push(y),p[y]!==void 0&&!D(p[y]))throw new Error(`Existing JSON field "${y}" must be an object`);if(p[y]===void 0&&$.includes(y)&&(p[y]={}),r){let g=!1;for(let h of te){let j=p[h];D(j)&&j.superpowers!==void 0&&(delete j.superpowers,g=!0)}if(!g)return e}else{let g;c?g={...c}:t==="json-servers"?g={command:s,args:n,type:"stdio"}:t==="json-mcp"?g={type:"local",command:[s,...n],enabled:!0}:g={command:s,args:n};for(let h of $){let j=p[h];j.superpowers=ie(j.superpowers,g,t)}}let _=se(p,e);return d!==null&&JSON.stringify(p)===d?e:(C&&_!==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).
|
|
43
|
+
`),_)}function Ie(e,t=10){try{let s=o.dirname(e),n=`${o.basename(e)}.`,r=".bak",c=f.readdirSync(s).filter(l=>{if(!l.startsWith(n)||!l.endsWith(r))return!1;let p=l.slice(n.length,l.length-r.length);return/^\d+(?:\.[0-9a-f]+)?$/.test(p)}).map(l=>{let p=o.join(s,l);try{return{full:p,mtimeMs:f.statSync(p).mtimeMs}}catch{return{full:p,mtimeMs:0}}}).sort((l,p)=>p.mtimeMs-l.mtimeMs);for(let l of c.slice(t))try{f.unlinkSync(l.full)}catch{}}catch{}}function Ne(e){let t=o.normalize(o.resolve(e));try{return f.realpathSync(t)}catch{let s=t;for(;;){let n=o.dirname(s);if(n===s)return t;try{let r=f.realpathSync(n);return o.join(r,o.relative(n,t))}catch{s=n}}}}function ae(e,t,s){let n=Ne(e);return t.some(r=>{if(!r)return!1;let c=o.resolve(r);try{c=f.realpathSync(c)}catch{}let l=o.relative(s(c),s(n));return l!==".."&&!l.startsWith(`..${o.sep}`)&&!o.isAbsolute(l)})}function We(e,t,s=!1,n=[],r,c=K.platform()){let l=u=>c==="win32"||c==="darwin"?u.toLowerCase():u;if(n.length===0)throw new Error("safeWriteConfig requires at least one allowed destination root");let p=e,C=!1;try{let u=f.lstatSync(e,{throwIfNoEntry:!1});if(u&&u.isSymbolicLink()){C=!0;try{p=f.realpathSync(e)}catch{let I=f.readlinkSync(e);p=o.resolve(o.dirname(e),I)}let i=l(o.normalize(o.resolve(p))),m=l(o.normalize(o.resolve(K.tmpdir())));if(!(i===m||i.startsWith(m+o.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(v=>i===v||i.startsWith(v+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}`);let O=l(o.normalize(o.resolve(K.homedir())));if([".ssh",".gnupg",".aws",".pki",`.config${o.sep}gh`].some(v=>{let I=`${O}${o.sep}${l(v)}`;return i===I||i.startsWith(I+o.sep)}))throw new Error(`Refusing to write to sensitive symlink target: ${p}`)}}catch(u){if(u instanceof Error&&(u.message.includes("Refusing to write to unsafe symlink target")||u.message.includes("sensitive symlink target")))throw u;if(C){let i=u instanceof Error?u.message:String(u);throw new Error(`Cannot safely resolve symlink target for ${e}: ${i}`)}}let d=o.dirname(p),y=["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"],A=u=>y.some(i=>u===i||u.startsWith(i+o.sep))||u==="/var"||u.startsWith("/var"+o.sep)&&!u.startsWith("/var/folders"+o.sep)||u==="/private/var"||u.startsWith("/private/var"+o.sep)&&!u.startsWith("/private/var/folders"+o.sep);{let u=l(o.normalize(o.resolve(p)));if(A(u))throw new Error(`Refusing to write to unsafe configuration target: ${p}`);if(!ae(p,n,l))throw new Error(`Refusing to write configuration outside allowed roots: ${p}`)}if(!f.existsSync(d)){f.mkdirSync(d,{recursive:!0,mode:448});try{f.chmodSync(d,448)}catch{}}let $=f.realpathSync(d),_=f.statSync($);p=o.join($,o.basename(p));let g=l(o.normalize(o.resolve(p))),h=l(o.normalize(o.resolve(K.tmpdir()))),j=g===h||g.startsWith(h+o.sep),b=A(g);if(!j&&b)throw new Error(`Refusing to write to unsafe configuration target: ${p}`);if(!ae(p,n,l))throw new Error(`Refusing to write configuration outside allowed roots: ${p}`);let P=384,R=f.existsSync(p);if(R)try{P=f.statSync(p).mode&384,P===0&&(P=384)}catch{}let J=Q.randomBytes(8).toString("hex"),a=o.join($,`.tmp.${o.basename(p)}.${process.pid}.${J}`);try{f.writeFileSync(a,t,{encoding:"utf8",mode:P,flag:"wx"});let u=f.existsSync(p);if(r===null&&u)throw new Error("Configuration changed concurrently before it could be created");if(r!=null&&(!u||f.readFileSync(p,"utf8")!==r))throw new Error("Configuration changed concurrently; refusing to overwrite newer content");let i=f.realpathSync(d),m=f.statSync(i);if(i!==$||m.dev!==_.dev||m.ino!==_.ino)throw new Error("Configuration directory changed while writing");if(s&&R){let w=f.readFileSync(p,"utf8"),S=`${p}.${Date.now()}.${Q.randomBytes(4).toString("hex")}.bak`;try{f.writeFileSync(S,w,{encoding:"utf8",mode:P,flag:"wx"})}catch(O){let E=O instanceof Error?O.message:String(O);throw new Error(`Failed to create safe backup before write: ${E}`)}Ie(p)}f.renameSync(a,p)}catch(u){try{f.existsSync(a)&&f.unlinkSync(a)}catch{}throw u}}var G=5*1024*1024;async function Je(e={}){let t=e.platform||K.platform(),s=e.homeDir||K.homedir(),n=e.appData||process.env.APPDATA,r=e.localAppData||process.env.LOCALAPPDATA,c=!!e.dryRun,l=!!e.remove,p=!!e.bun,C=e.target?e.target.toLowerCase():null,d=p?"bunx":"npx",y=p?["superpowers-mcp"]:["-y","superpowers-mcp"],A=[];if(!C)throw new Error(`No target client specified. Please specify which client to configure using --target <${Object.keys(H).join("|")}>.`);let $=Object.keys(H).find(g=>g===C||H[g].aliases.includes(C));if(!$)throw new Error(`Unknown harness target: "${C}". Supported targets: ${Object.keys(H).join(", ")}`);let _=[$];for(let g of _){let h=H[g],j="";try{j=h.getConfigPath(t,s,n,r);let b=f.existsSync(j);if(l&&!b){A.push({target:g,name:h.name,path:j,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}let x="";if(b){let R=f.statSync(j);if(R.size>G)throw new Error(`Refusing to read oversized config file ${j} (${R.size} bytes, limit ${G} bytes)`);if(x=f.readFileSync(j,"utf8"),x.length>G)throw new Error(`Refusing to read oversized config file ${j} (length ${x.length} exceeds limit ${G} bytes)`)}let P="";if(h.type==="yaml")P=be(x,d,y,l,h.yamlProfile);else if(h.type==="toml")P=Ae(x,d,y,l);else{let R=typeof h.defaultConfig=="function"?h.defaultConfig(d,y):void 0;P=Pe(x,h.type,d,y,l,R,h.serverPath)}if(x===P&&b){A.push({target:g,name:h.name,path:j,status:"up-to-date",message:l?"Already not configured":"Already configured and up-to-date"});continue}if(!c){let R=!!e.backup;!R&&b&&h.type.startsWith("json")&&(j.endsWith(".jsonc")||Se(x))&&(R=!0,process.stderr.write(`[superpowers-mcp] Warning: ${j} contains JSONC comments that the rewrite will strip; creating a backup anyway (recommend passing --backup).
|
|
44
|
+
`)),We(j,P,R,[...new Set([s,n||"",r||"",T(s)])],b?x:null,t)}A.push({target:g,name:h.name,path:j,status:l?"removed":b?"updated":"created",message:c?`[Dry Run] Would ${l?"remove from":b?"update":"create"} ${j}`:`Successfully ${l?"removed from":b?"updated":"configured"}!`})}catch(b){let x=b instanceof Error?b.message:String(b);A.push({target:g,name:h.name,path:j,status:"error",message:x})}}return A}async function X(e=process.argv.slice(2)){let t=!1,s={dryRun:!1,remove:!1,bun:!1,backup:!1,target:null};for(let n=0;n<e.length;n++){let r=e[n];if(!(r==="setup"||r==="install"||r==="--setup"))if(r==="--print-config")t=!0;else if(r==="--dry-run")s.dryRun=!0;else if(r==="--remove"||r==="--uninstall")s.remove=!0;else if(r==="--bun")s.bun=!0;else if(r==="--backup")s.backup=!0;else if(r==="--target"||r==="-t"){let c=e[n+1];if(!c||c.startsWith("-")){console.error(`\u274C Error: Missing value for --target flag.
|
|
45
45
|
`),process.exitCode=1;return}if(s.target!==null){console.error(`\u274C Error: --target was specified more than once. Configure one client per invocation.
|
|
46
46
|
`),process.exitCode=1;return}s.target=e[++n]}else if(r.startsWith("--target=")){let c=r.slice(r.indexOf("=")+1);if(!c){console.error(`\u274C Error: Missing value for --target flag.
|
|
47
47
|
`),process.exitCode=1;return}if(s.target!==null){console.error(`\u274C Error: --target was specified more than once. Configure one client per invocation.
|
|
48
|
-
`),process.exitCode=1;return}s.target=c}else if(r==="--help"||r==="-h"){
|
|
48
|
+
`),process.exitCode=1;return}s.target=c}else if(r==="--help"||r==="-h"){Te();return}else if(r.startsWith("-")){console.error(`\u274C Error: Unknown option "${r}". Use --help for usage.
|
|
49
49
|
`),process.exitCode=1;return}else if(!s.target)s.target=r;else{console.error(`\u274C Error: Unexpected argument "${r}". Use --help for usage.
|
|
50
50
|
`),process.exitCode=1;return}}if(t){if(s.target||s.remove||s.backup||s.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:s.bun?"bunx":"npx",args:s.bun?["superpowers-mcp"]:["-y","superpowers-mcp"]}}},null,2));return}if(console.log(`
|
|
51
51
|
========================================================`),console.log("\u26A1 Superpowers MCP - Targeted Client Setup"),console.log(`========================================================
|
|
@@ -53,9 +53,9 @@ ${o}`)}let g=C[0],w=S(g),j=w;for(let o=g+1;o<w;o++)if(re(r[o])){j=o;break}let k=
|
|
|
53
53
|
`),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)
|
|
54
54
|
`),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.
|
|
55
55
|
`),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.
|
|
56
|
-
`),process.exitCode=1;return}try{let n=await
|
|
56
|
+
`),process.exitCode=1;return}try{let n=await Je(s),r=0,c=0;for(let l of n){let p=l.status==="created"||l.status==="updated"||l.status==="removed"?"\u2705":l.status==="up-to-date"?"\u2728":"\u274C";console.log(`${p} [${l.name}] (${l.status})`),console.log(` Path: ${l.path}`),console.log(` Info: ${l.message}
|
|
57
57
|
`),l.status==="created"||l.status==="updated"||l.status==="up-to-date"||l.status==="removed"?r++:l.status==="error"&&c++}if(console.log("--------------------------------------------------------"),c>0){console.error(`\u26A0\uFE0F Setup finished with errors: ${c} failure(s), ${r} succeeded.`),process.exitCode=1;return}console.log(`\u{1F389} Setup complete! ${r} environment(s) ready.`)}catch(n){let r=n instanceof Error?n.message:String(n);console.error(`\u274C Setup failed: ${r}
|
|
58
|
-
`),process.exitCode=1}}function
|
|
58
|
+
`),process.exitCode=1}}function Te(){console.log(`
|
|
59
59
|
Superpowers MCP - Targeted Global Setup
|
|
60
60
|
|
|
61
61
|
Usage:
|
|
@@ -103,4 +103,4 @@ Any Directory:
|
|
|
103
103
|
Privacy & Safety:
|
|
104
104
|
Superpowers MCP only touches the client you explicitly choose.
|
|
105
105
|
It never bulk-modifies your environment without your consent.
|
|
106
|
-
`)}var
|
|
106
|
+
`)}var Me=process.argv[1]??"",pe=ue.basename(Me).toLowerCase();(pe==="setup.js"||pe==="setup-cli.js")&&X().catch(e=>{console.error(e),process.exitCode=1});0&&(module.exports={runSetupCli});
|
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.10",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18"
|
|
8
8
|
},
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
59
|
-
"@types/node": "^
|
|
59
|
+
"@types/node": "^26.6.6",
|
|
60
60
|
"esbuild": "^0.28.1",
|
|
61
|
-
"typescript": "^
|
|
61
|
+
"typescript": "^7.0.2"
|
|
62
62
|
}
|
|
63
63
|
}
|
|
@@ -49,6 +49,18 @@ function encodeFrame(opcode, payload) {
|
|
|
49
49
|
return Buffer.concat([header, payload]);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
// Total byte length of the frame whose header starts `buffer`, or one byte more
|
|
53
|
+
// than we have when the header itself is still incomplete. Only called after
|
|
54
|
+
// decodeFrame() returned null (frame incomplete and header valid).
|
|
55
|
+
function expectedFrameLength(buffer) {
|
|
56
|
+
if (buffer.length < 2) return buffer.length + 1;
|
|
57
|
+
const len7 = buffer[1] & 0x7F;
|
|
58
|
+
if (len7 < 126) return 2 + 4 + len7;
|
|
59
|
+
if (len7 === 126) return buffer.length < 4 ? buffer.length + 1 : 4 + 4 + buffer.readUInt16BE(2);
|
|
60
|
+
if (buffer.length < 10) return buffer.length + 1;
|
|
61
|
+
return 10 + 4 + Number(buffer.readBigUInt64BE(2));
|
|
62
|
+
}
|
|
63
|
+
|
|
52
64
|
function decodeFrame(buffer) {
|
|
53
65
|
if (buffer.length < 2) return null;
|
|
54
66
|
|
|
@@ -777,6 +789,12 @@ function handleUpgrade(req, socket) {
|
|
|
777
789
|
);
|
|
778
790
|
|
|
779
791
|
let buffer = Buffer.alloc(0);
|
|
792
|
+
// Chunks received while a frame is still incomplete. They are only merged
|
|
793
|
+
// into `buffer` once enough bytes have arrived to finish the pending frame,
|
|
794
|
+
// so a large frame trickling in doesn't re-copy the whole buffer per chunk.
|
|
795
|
+
let pendingChunks = [];
|
|
796
|
+
let pendingBytes = 0;
|
|
797
|
+
let awaitBytes = 0;
|
|
780
798
|
let closed = false;
|
|
781
799
|
let partialFrameTimer = null;
|
|
782
800
|
let fragmentedOpcode = null;
|
|
@@ -818,11 +836,20 @@ function handleUpgrade(req, socket) {
|
|
|
818
836
|
// frames — a peer could otherwise keep writing events (and extending
|
|
819
837
|
// its activity influence) in the window before destruction.
|
|
820
838
|
if (closed) return;
|
|
821
|
-
buffer
|
|
822
|
-
if (buffer.length > MAX_FRAME_PAYLOAD_BYTES + 14) {
|
|
839
|
+
if (buffer.length + pendingBytes + chunk.length > MAX_FRAME_PAYLOAD_BYTES + 14) {
|
|
823
840
|
closeSocket(1009);
|
|
824
841
|
return;
|
|
825
842
|
}
|
|
843
|
+
pendingChunks.push(chunk);
|
|
844
|
+
pendingBytes += chunk.length;
|
|
845
|
+
if (buffer.length + pendingBytes < awaitBytes) {
|
|
846
|
+
armPartialFrameTimer();
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
buffer = Buffer.concat([buffer, ...pendingChunks], buffer.length + pendingBytes);
|
|
850
|
+
pendingChunks = [];
|
|
851
|
+
pendingBytes = 0;
|
|
852
|
+
awaitBytes = 0;
|
|
826
853
|
while (buffer.length > 0) {
|
|
827
854
|
let result;
|
|
828
855
|
try {
|
|
@@ -832,6 +859,7 @@ function handleUpgrade(req, socket) {
|
|
|
832
859
|
return;
|
|
833
860
|
}
|
|
834
861
|
if (!result) {
|
|
862
|
+
awaitBytes = expectedFrameLength(buffer);
|
|
835
863
|
armPartialFrameTimer();
|
|
836
864
|
return;
|
|
837
865
|
}
|
|
@@ -322,7 +322,7 @@ $process = Start-Process `
|
|
|
322
322
|
Set-Content -Path $pidFile -Value ([string]$process.Id) -NoNewline -Encoding ascii
|
|
323
323
|
Protect-PathForCurrentUser -Path $pidFile
|
|
324
324
|
|
|
325
|
-
$deadline = (Get-Date).AddSeconds(
|
|
325
|
+
$deadline = (Get-Date).AddSeconds(15)
|
|
326
326
|
$reported = $false
|
|
327
327
|
while ((Get-Date) -lt $deadline) {
|
|
328
328
|
if ($process.HasExited) {
|
|
@@ -340,6 +340,6 @@ while ((Get-Date) -lt $deadline) {
|
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
if (-not $reported) {
|
|
343
|
-
Write-JsonError "Server failed to start within
|
|
343
|
+
Write-JsonError "Server failed to start within 15 seconds"
|
|
344
344
|
exit 1
|
|
345
345
|
}
|
|
@@ -296,7 +296,7 @@ disown "$SERVER_PID" 2>/dev/null
|
|
|
296
296
|
echo "$SERVER_PID" > "$PID_FILE"
|
|
297
297
|
|
|
298
298
|
# Wait for server-started message (check log file)
|
|
299
|
-
for _ in {1..
|
|
299
|
+
for _ in {1..150}; do
|
|
300
300
|
if grep -q "server-started" "$LOG_FILE" 2>/dev/null; then
|
|
301
301
|
# Verify server is still alive after a short window (catches process reapers)
|
|
302
302
|
alive="true"
|
|
@@ -318,5 +318,5 @@ for _ in {1..50}; do
|
|
|
318
318
|
done
|
|
319
319
|
|
|
320
320
|
# Timeout - server didn't start
|
|
321
|
-
echo '{"error": "Server failed to start within
|
|
321
|
+
echo '{"error": "Server failed to start within 15 seconds"}'
|
|
322
322
|
exit 1
|
|
@@ -67,7 +67,9 @@ function Get-PhysicalDirectoryPath($path) {
|
|
|
67
67
|
$orig = Get-Location
|
|
68
68
|
try {
|
|
69
69
|
Set-Location -LiteralPath $path
|
|
70
|
-
|
|
70
|
+
# Some distros ship both /usr/bin/pwd and /bin/pwd; .Source would then be
|
|
71
|
+
# an array that stringifies to a bogus "a b" path. Take the first match.
|
|
72
|
+
$pwdCmd = @(Get-Command -Type Application pwd -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty Source)[0]
|
|
71
73
|
if ($pwdCmd) {
|
|
72
74
|
return (& $pwdCmd -P).Trim()
|
|
73
75
|
} else {
|