superpowers-mcp 6.4.3 → 6.4.5
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 +18 -3
- package/README.hi.md +18 -3
- package/README.ja.md +18 -3
- package/README.ko.md +18 -3
- package/README.md +18 -3
- package/README.pt-BR.md +18 -3
- package/README.zh-TW.md +18 -3
- package/docs/skill-compositions.es.md +11 -7
- package/docs/skill-compositions.hi.md +11 -7
- package/docs/skill-compositions.ja.md +11 -7
- package/docs/skill-compositions.ko.md +11 -7
- package/docs/skill-compositions.md +11 -7
- package/docs/skill-compositions.pt-BR.md +11 -7
- package/docs/skill-compositions.zh-TW.md +11 -7
- package/out/server.js +53 -52
- package/out/setup-runner.js +21 -20
- package/out/setup.js +21 -20
- package/package.json +2 -2
- package/scripts/upstream-drift.js +8 -1
- package/skills/writing-plans/SKILL.md +32 -20
- package/skills/writing-plans/skeleton-first-plans.md +3 -2
package/out/setup-runner.js
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`||f==="\r")&&(g=!1,
|
|
3
|
-
`&&f!=="\r"&&(j=-1),
|
|
4
|
-
`)}let
|
|
5
|
-
${
|
|
1
|
+
"use strict";var V=Object.create;var R=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,Q=Object.prototype.hasOwnProperty;var Z=(e,t)=>{for(var r in t)R(e,r,{get:t[r],enumerable:!0})},T=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Y(t))!Q.call(e,s)&&s!==r&&R(e,s,{get:()=>t[s],enumerable:!(n=F(t,s))||n.enumerable});return e};var O=(e,t,r)=>(r=e!=null?V(B(e)):{},T(t||!e||!e.__esModule?R(r,"default",{value:e,enumerable:!0}):r,e)),X=e=>T(R({},"__esModule",{value:!0}),e);var ce={};Z(ce,{HARNESS_CONFIGS:()=>A,JSON_SERVER_ROOT_KEYS:()=>K,isPlainObject:()=>P,runSetup:()=>G,runSetupCli:()=>ae,safeWriteConfig:()=>z,stripJsonComments:()=>L,updateJsonConfig:()=>H,updateTomlConfig:()=>q,updateYamlConfig:()=>U});module.exports=X(ce);var u=O(require("fs")),o=O(require("path")),_=O(require("os")),M=O(require("crypto")),A={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})}},K=["mcpServers","servers","mcp"];function P(e){return Object.prototype.toString.call(e)==="[object Object]"}function L(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],S=l+1<r?e[l+1]:"";if(g){(f===`
|
|
2
|
+
`||f==="\r")&&(g=!1,n.push(f));continue}if(c){f==="*"&&S==="/"&&(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==="/"&&S==="/"){g=!0,l++;continue}if(f==="/"&&S==="*"){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 W=/\s/;function ee(e){for(let t=1;t<e.length;t++){if(e[t]!=="#"||!W.test(e[t-1]))continue;let r=t-1;for(;r>0&&W.test(e[r-1]);)r--;return e.slice(r)}return""}function U(e,t,r,n=!1,s="mcp"){let p=s==="goose"?{rootKey:"extensions",ownedKeys:["cmd","args","type"],freshEntry:(i,d,a)=>[`${i}superpowers:`,`${i}${i}name: "Superpowers"`,`${i}${i}cmd: ${JSON.stringify(d)}`,`${i}${i}args: ${JSON.stringify(a)}`,`${i}${i}enabled: true`,`${i}${i}type: stdio`,`${i}${i}timeout: 300`]}:{rootKey:"mcp_servers",ownedKeys:["command","args"],freshEntry:(i,d,a)=>[`${i}superpowers:`,`${i}${i}command: ${JSON.stringify(d)}`,`${i}${i}args: ${JSON.stringify(a)}`]};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=l.map((i,d)=>{let a=i.match(g);return a?{index:d,indent:a[1],tail:i.slice(a[0].length).trim()}:null}).filter(i=>i!==null),S=f.filter(i=>i.indent==="");if(S.length>1)throw new Error(`Cannot safely update YAML with duplicate ${p.rootKey} keys`);if(S.length===1){let i=S[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(f.length>0)throw new Error(`Cannot safely update YAML unless ${p.rootKey} is a root-level block mapping`);let k=" ";if(S.length===1)for(let i=S[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&&(k=d[1]);break}if(n){let i=[],d=!1,a=0,m=!1,C=0;for(let x=0;x<l.length;x++){let v=l[x],b=v.match(c);if(b){d=!0,a=b[1].length,i.push(v);continue}if(d){let $=v.match(/^(\s*)/)?.[1].length||0;if(v.trimStart().startsWith("#")){i.push(v);continue}if(v.trim()!==""&&$<=a)d=!1,m=!1;else{let N=v.match(/^(\s*)superpowers:\s*(?:#.*)?$/);if(N&&N[1]===k){m=!0,C=N[1].length;continue}if(m){if($>C||v.trim()==="")continue;m=!1}}}i.push(v)}return i.join(`
|
|
4
|
+
`)}let y=p.freshEntry(k,t,r);if(!e||e.trim()==="")return`${p.rootKey}:
|
|
5
|
+
${y.join(`
|
|
6
6
|
`)}
|
|
7
|
-
`;let
|
|
7
|
+
`;let w=S.length===1?S[0].index:-1;if(w===-1)return`${e.trimEnd()}
|
|
8
8
|
|
|
9
9
|
${p.rootKey}:
|
|
10
|
-
${
|
|
10
|
+
${y.join(`
|
|
11
11
|
`)}
|
|
12
|
-
`;let h=-1;for(let i=
|
|
13
|
-
`)}else return l.splice(
|
|
14
|
-
`)}function
|
|
12
|
+
`;let h=-1;for(let i=w+1;i<l.length;i++){let d=l[i];if(/^[^\s#]/.test(d))break;if((d.match(/^(\s*)/)?.[1]||"")===k&&/^\s+["']?superpowers["']?\s*:\s*(?:#.*)?$/.test(d)){h=i;break}}if(h!==-1){let i=l[h].match(/^(\s*)/)?.[1].length||2,d=h+1;for(;d<l.length;){let v=l[d];if((v.match(/^(\s*)/)?.[1].length||0)>i||v.trim()==="")d++;else break}let a=[],m=-1,C=i+k.length;for(let v=h+1;v<d;v++){let b=l[v];if(b.trim()==="")continue;let $=b.match(/^(\s*)/)?.[1].length??0;if(!(m!==-1&&$>m)){if(m=-1,$===C&&j.test(b)){m=$;continue}a.push(b)}}y[0]+=ee(l[h]);let x=y.filter((v,b)=>{if(b===0)return!0;let $=v.match(/^\s*["']?([A-Za-z0-9_-]+)["']?\s*:/);return!$||p.ownedKeys.includes($[1])});return l.splice(h,d-h,...x,...a),l.join(`
|
|
13
|
+
`)}else return l.splice(w+1,0,...y),l.join(`
|
|
14
|
+
`)}function I(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&&W.test(e[s-1]);)s--;return[e.slice(0,s),e.slice(s)]}}return[e,""]}var te=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\]\s*(?:#.*)?$/;function E(e){return e===" "||e===" "||e===`
|
|
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
16
|
${g}
|
|
16
17
|
${c}
|
|
17
18
|
`;return!e||e.trim()===""?a:`${e.trimEnd()}
|
|
18
19
|
|
|
19
|
-
${a}`}let l=p[0],f=l+1;for(;f<s.length&&!(
|
|
20
|
-
`);let k=null,
|
|
21
|
-
`)}function
|
|
20
|
+
${a}`}let l=p[0],f=l+1;for(;f<s.length&&!(J(s[f])&&!ne.test(s[f]));)f++;let S=f;for(let a=l+1;a<f;a++)if(J(s[a])){S=a;break}if(n)return s.slice(0,l).concat(s.slice(f)).join(`
|
|
21
|
+
`);let k=null,y=null,w={};for(let a=l+1;a<S;a++){let[m,C]=I(s[a]),x=re(m);x&&(x.key==="command"?k===null&&(k=j(x.value)):y===null&&(y=j(x.value)),x.key in w||(w[x.key]=C))}if(k===j(JSON.stringify(t))&&y===j(JSON.stringify(r)))return e;let h=[`${g}${w.command??""}`,`${c}${w.args??""}`],i=s.slice(0,l+1),d=!1;for(let a=l+1;a<S;a++){let[m]=I(s[a]);if(oe.test(m)){d||(i.push(...h),d=!0);continue}i.push(s[a])}return d||i.push(...h),i.push(...s.slice(S,f)),i.push(...s.slice(f)),i.join(`
|
|
22
|
+
`)}function D(e,t,r){if(!P(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 H(e,t,r,n,s=!1,p,g){let c={},j=!1;if(e&&e.trim()!=="")try{let y=JSON.parse(e);if(!P(y))throw new Error("Existing JSON root must be an object");c=y}catch(y){try{let w=L(e,!0),h=JSON.parse(w);if(!P(h))throw new Error("Existing JSON root must be an object");c=h,j=w!==e}catch(w){let h=w instanceof Error?w.message:String(w),i=y instanceof Error?y.message:String(y);throw new Error(`Failed to parse existing JSON: ${h} (raw JSON error: ${i})`)}}let l=t==="json-servers"?"servers":t==="json-mcp"?"mcp":"mcpServers";if(g&&g.length>0){let y=g.join(".");for(let i of g){if(typeof i!="string"||i.length===0)throw new Error(`Invalid JSON field "${y}"`);if(i==="__proto__"||i==="constructor"||i==="prototype")throw new Error(`Refusing to use unsafe JSON field "${y}"`);if(!/^[A-Za-z0-9_-]+$/.test(i))throw new Error(`Invalid JSON field "${y}"`)}let w=c;for(let i of g){if(i==="__proto__"||i==="constructor"||i==="prototype")throw new Error(`Refusing to use unsafe JSON field "${y}"`);let d=w[i];if(d===void 0){if(s)return e;w[i]={}}else if(!P(d))throw new Error(`Existing JSON field "${y}" must be an object`);w=w[i]}if(s)delete w.superpowers;else{let i=p?{...p}:{command:r,args:n};w.superpowers=D(w.superpowers,i,t)}let h=JSON.stringify(c,null,2)+`
|
|
22
23
|
`;return j&&h!==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).
|
|
23
|
-
`),h}let f=
|
|
24
|
+
`),h}let f=K.find(y=>P(c[y])&&c[y].superpowers!==void 0)??l;if(c[f]!==void 0&&!P(c[f]))throw new Error(`Existing JSON field "${f}" must be an object`);c[f]===void 0&&(c[f]={});let S=c[f];if(s)delete S.superpowers;else{let y;p?y={...p}:t==="json-servers"?y={command:r,args:n,type:"stdio"}:t==="json-mcp"?y={type:"local",command:[r,...n],enabled:!0}:y={command:r,args:n},S.superpowers=D(S.superpowers,y,t)}let k=JSON.stringify(c,null,2)+`
|
|
24
25
|
`;return j&&k!==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).
|
|
25
|
-
`),k}function
|
|
26
|
-
`),process.exitCode=1;return}r.target=e[++
|
|
27
|
-
`),process.exitCode=1;return}r.target=p}else if(s==="--help"||s==="-h"){
|
|
26
|
+
`),k}function ie(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 z(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 $=u.readlinkSync(e);p=o.resolve(o.dirname(e),$)}let m=o.normalize(o.resolve(p)).toLowerCase(),C=o.normalize(o.resolve(_.tmpdir())).toLowerCase();if(!(m===C||m.startsWith(C+o.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(b=>m===b||m.startsWith(b+o.sep))||m==="/var"||m.startsWith("/var"+o.sep)&&!m.startsWith("/var/folders"+o.sep)||m==="/private/var"||m.startsWith("/private/var"+o.sep)&&!m.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(_.tmpdir())).toLowerCase(),S=l===f||l.startsWith(f+o.sep),y=["/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(!S&&y)throw new Error(`Refusing to write to unsafe configuration target: ${p}`);if(!n.some(a=>{if(!a)return!1;let m=o.resolve(a);try{m=u.realpathSync(m)}catch{}let C=o.relative(m,p);return C!==".."&&!C.startsWith(`..${o.sep}`)&&!o.isAbsolute(C)}))throw new Error(`Refusing to write configuration outside allowed roots: ${p}`);let h=384;if(u.existsSync(p)){try{h=u.statSync(p).mode}catch{}if(r){let a=u.readFileSync(p,"utf8"),m=`${p}.${Date.now()}.bak`;try{u.writeFileSync(m,a,{encoding:"utf8",mode:h})}catch(C){let x=C instanceof Error?C.message:String(C);throw new Error(`Failed to create safe backup before write: ${x}`)}ie(p)}}let i=M.randomBytes(8).toString("hex"),d=o.join(c,`.tmp.${o.basename(p)}.${process.pid}.${i}`);try{u.writeFileSync(d,t,{encoding:"utf8",mode:h,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 m=u.realpathSync(g),C=u.statSync(m);if(m!==c||C.dev!==j.dev||C.ino!==j.ino)throw new Error("Configuration directory changed while writing");u.renameSync(d,p)}catch(a){try{u.existsSync(d)&&u.unlinkSync(d)}catch{}throw a}}async function G(e={}){let t=e.platform||_.platform(),r=e.homeDir||_.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"],S=[];if(!j)throw new Error(`No target client specified. Please specify which client to configure using --target <${Object.keys(A).join("|")}>.`);let k=Object.keys(A).find(w=>w===j||A[w].aliases.includes(j));if(!k)throw new Error(`Unknown harness target: "${j}". Supported targets: ${Object.keys(A).join(", ")}`);let y=[k];for(let w of y){let h=A[w],i=h.getConfigPath(t,r,n,s),d=u.existsSync(i);if(g&&!d){S.push({target:w,name:h.name,path:i,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let a="";d&&(a=u.readFileSync(i,"utf8"));let m="";if(h.type==="yaml")m=U(a,l,f,g,h.yamlProfile);else if(h.type==="toml")m=q(a,l,f,g);else{let C=typeof h.defaultConfig=="function"?h.defaultConfig(l,f):void 0;m=H(a,h.type,l,f,g,C,h.serverPath)}if(a.trim()===m.trim()&&d){S.push({target:w,name:h.name,path:i,status:"up-to-date",message:g?"Already not configured":"Already configured and up-to-date"});continue}p||z(i,m,!!e.backup,[r,n||"",s||""],d?a:null),S.push({target:w,name:h.name,path:i,status:g?"removed":d?"updated":"created",message:p?`[Dry Run] Would ${g?"remove from":d?"update":"create"} ${i}`:`Successfully ${g?"removed from":d?"updated":"configured"}!`})}catch(a){let m=a instanceof Error?a.message:String(a);S.push({target:w,name:h.name,path:i,status:"error",message:m})}}return S}async function ae(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
|
+
`),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"){pe();return}else if(s.startsWith("-")){console.error(`\u274C Error: Unknown option "${s}". Use --help for usage.
|
|
28
29
|
`),process.exitCode=1;return}else if(!r.target)r.target=s;else{console.error(`\u274C Error: Unexpected argument "${s}". Use --help for usage.
|
|
29
30
|
`),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(`
|
|
30
31
|
========================================================`),console.log("\u26A1 Superpowers MCP - Targeted Client Setup"),console.log(`========================================================
|
|
@@ -32,9 +33,9 @@ ${a}`}let l=p[0],f=l+1;for(;f<s.length&&!(W.test(s[f])&&!te.test(s[f]));)f++;let
|
|
|
32
33
|
`),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)
|
|
33
34
|
`),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.
|
|
34
35
|
`),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.
|
|
35
|
-
`),process.exitCode=1;return}try{let
|
|
36
|
-
`),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(
|
|
37
|
-
`),process.exitCode=1}}function
|
|
36
|
+
`),process.exitCode=1;return}try{let n=await G(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
|
+
`),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 pe(){console.log(`
|
|
38
39
|
Superpowers MCP - Targeted Global Setup
|
|
39
40
|
|
|
40
41
|
Usage:
|
package/out/setup.js
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var
|
|
3
|
-
`||f==="\r")&&(g=!1,
|
|
4
|
-
`&&f!=="\r"&&(j=-1),
|
|
5
|
-
`)}let
|
|
6
|
-
${
|
|
2
|
+
"use strict";var V=Object.create;var R=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty;var X=(e,t)=>{for(var r in t)R(e,r,{get:t[r],enumerable:!0})},I=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of B(t))!Z.call(e,s)&&s!==r&&R(e,s,{get:()=>t[s],enumerable:!(n=Y(t,s))||n.enumerable});return e};var O=(e,t,r)=>(r=e!=null?V(Q(e)):{},I(t||!e||!e.__esModule?R(r,"default",{value:e,enumerable:!0}):r,e)),ee=e=>I(R({},"__esModule",{value:!0}),e);var ce={};X(ce,{HARNESS_CONFIGS:()=>A,JSON_SERVER_ROOT_KEYS:()=>L,isPlainObject:()=>P,runSetup:()=>G,runSetupCli:()=>T,safeWriteConfig:()=>F,stripJsonComments:()=>U,updateJsonConfig:()=>z,updateTomlConfig:()=>H,updateYamlConfig:()=>q});module.exports=ee(ce);var u=O(require("fs")),o=O(require("path")),_=O(require("os")),K=O(require("crypto")),A={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})}},L=["mcpServers","servers","mcp"];function P(e){return Object.prototype.toString.call(e)==="[object Object]"}function U(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],S=l+1<r?e[l+1]:"";if(g){(f===`
|
|
3
|
+
`||f==="\r")&&(g=!1,n.push(f));continue}if(c){f==="*"&&S==="/"&&(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==="/"&&S==="/"){g=!0,l++;continue}if(f==="/"&&S==="*"){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 W=/\s/;function te(e){for(let t=1;t<e.length;t++){if(e[t]!=="#"||!W.test(e[t-1]))continue;let r=t-1;for(;r>0&&W.test(e[r-1]);)r--;return e.slice(r)}return""}function q(e,t,r,n=!1,s="mcp"){let p=s==="goose"?{rootKey:"extensions",ownedKeys:["cmd","args","type"],freshEntry:(i,d,a)=>[`${i}superpowers:`,`${i}${i}name: "Superpowers"`,`${i}${i}cmd: ${JSON.stringify(d)}`,`${i}${i}args: ${JSON.stringify(a)}`,`${i}${i}enabled: true`,`${i}${i}type: stdio`,`${i}${i}timeout: 300`]}:{rootKey:"mcp_servers",ownedKeys:["command","args"],freshEntry:(i,d,a)=>[`${i}superpowers:`,`${i}${i}command: ${JSON.stringify(d)}`,`${i}${i}args: ${JSON.stringify(a)}`]};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=l.map((i,d)=>{let a=i.match(g);return a?{index:d,indent:a[1],tail:i.slice(a[0].length).trim()}:null}).filter(i=>i!==null),S=f.filter(i=>i.indent==="");if(S.length>1)throw new Error(`Cannot safely update YAML with duplicate ${p.rootKey} keys`);if(S.length===1){let i=S[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(f.length>0)throw new Error(`Cannot safely update YAML unless ${p.rootKey} is a root-level block mapping`);let k=" ";if(S.length===1)for(let i=S[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&&(k=d[1]);break}if(n){let i=[],d=!1,a=0,m=!1,C=0;for(let x=0;x<l.length;x++){let v=l[x],b=v.match(c);if(b){d=!0,a=b[1].length,i.push(v);continue}if(d){let $=v.match(/^(\s*)/)?.[1].length||0;if(v.trimStart().startsWith("#")){i.push(v);continue}if(v.trim()!==""&&$<=a)d=!1,m=!1;else{let N=v.match(/^(\s*)superpowers:\s*(?:#.*)?$/);if(N&&N[1]===k){m=!0,C=N[1].length;continue}if(m){if($>C||v.trim()==="")continue;m=!1}}}i.push(v)}return i.join(`
|
|
5
|
+
`)}let y=p.freshEntry(k,t,r);if(!e||e.trim()==="")return`${p.rootKey}:
|
|
6
|
+
${y.join(`
|
|
7
7
|
`)}
|
|
8
|
-
`;let
|
|
8
|
+
`;let w=S.length===1?S[0].index:-1;if(w===-1)return`${e.trimEnd()}
|
|
9
9
|
|
|
10
10
|
${p.rootKey}:
|
|
11
|
-
${
|
|
11
|
+
${y.join(`
|
|
12
12
|
`)}
|
|
13
|
-
`;let h=-1;for(let i=
|
|
14
|
-
`)}else return l.splice(
|
|
15
|
-
`)}function
|
|
13
|
+
`;let h=-1;for(let i=w+1;i<l.length;i++){let d=l[i];if(/^[^\s#]/.test(d))break;if((d.match(/^(\s*)/)?.[1]||"")===k&&/^\s+["']?superpowers["']?\s*:\s*(?:#.*)?$/.test(d)){h=i;break}}if(h!==-1){let i=l[h].match(/^(\s*)/)?.[1].length||2,d=h+1;for(;d<l.length;){let v=l[d];if((v.match(/^(\s*)/)?.[1].length||0)>i||v.trim()==="")d++;else break}let a=[],m=-1,C=i+k.length;for(let v=h+1;v<d;v++){let b=l[v];if(b.trim()==="")continue;let $=b.match(/^(\s*)/)?.[1].length??0;if(!(m!==-1&&$>m)){if(m=-1,$===C&&j.test(b)){m=$;continue}a.push(b)}}y[0]+=te(l[h]);let x=y.filter((v,b)=>{if(b===0)return!0;let $=v.match(/^\s*["']?([A-Za-z0-9_-]+)["']?\s*:/);return!$||p.ownedKeys.includes($[1])});return l.splice(h,d-h,...x,...a),l.join(`
|
|
14
|
+
`)}else return l.splice(w+1,0,...y),l.join(`
|
|
15
|
+
`)}function J(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&&W.test(e[s-1]);)s--;return[e.slice(0,s),e.slice(s)]}}return[e,""]}var ne=/^\s*\[\s*mcp_servers\s*\.\s*superpowers\s*\]\s*(?:#.*)?$/;function E(e){return e===" "||e===" "||e===`
|
|
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
17
|
${g}
|
|
17
18
|
${c}
|
|
18
19
|
`;return!e||e.trim()===""?a:`${e.trimEnd()}
|
|
19
20
|
|
|
20
|
-
${a}`}let l=p[0],f=l+1;for(;f<s.length&&!(
|
|
21
|
-
`);let k=null,
|
|
22
|
-
`)}function
|
|
21
|
+
${a}`}let l=p[0],f=l+1;for(;f<s.length&&!(D(s[f])&&!se.test(s[f]));)f++;let S=f;for(let a=l+1;a<f;a++)if(D(s[a])){S=a;break}if(n)return s.slice(0,l).concat(s.slice(f)).join(`
|
|
22
|
+
`);let k=null,y=null,w={};for(let a=l+1;a<S;a++){let[m,C]=J(s[a]),x=oe(m);x&&(x.key==="command"?k===null&&(k=j(x.value)):y===null&&(y=j(x.value)),x.key in w||(w[x.key]=C))}if(k===j(JSON.stringify(t))&&y===j(JSON.stringify(r)))return e;let h=[`${g}${w.command??""}`,`${c}${w.args??""}`],i=s.slice(0,l+1),d=!1;for(let a=l+1;a<S;a++){let[m]=J(s[a]);if(ie.test(m)){d||(i.push(...h),d=!0);continue}i.push(s[a])}return d||i.push(...h),i.push(...s.slice(S,f)),i.push(...s.slice(f)),i.join(`
|
|
23
|
+
`)}function M(e,t,r){if(!P(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 z(e,t,r,n,s=!1,p,g){let c={},j=!1;if(e&&e.trim()!=="")try{let y=JSON.parse(e);if(!P(y))throw new Error("Existing JSON root must be an object");c=y}catch(y){try{let w=U(e,!0),h=JSON.parse(w);if(!P(h))throw new Error("Existing JSON root must be an object");c=h,j=w!==e}catch(w){let h=w instanceof Error?w.message:String(w),i=y instanceof Error?y.message:String(y);throw new Error(`Failed to parse existing JSON: ${h} (raw JSON error: ${i})`)}}let l=t==="json-servers"?"servers":t==="json-mcp"?"mcp":"mcpServers";if(g&&g.length>0){let y=g.join(".");for(let i of g){if(typeof i!="string"||i.length===0)throw new Error(`Invalid JSON field "${y}"`);if(i==="__proto__"||i==="constructor"||i==="prototype")throw new Error(`Refusing to use unsafe JSON field "${y}"`);if(!/^[A-Za-z0-9_-]+$/.test(i))throw new Error(`Invalid JSON field "${y}"`)}let w=c;for(let i of g){if(i==="__proto__"||i==="constructor"||i==="prototype")throw new Error(`Refusing to use unsafe JSON field "${y}"`);let d=w[i];if(d===void 0){if(s)return e;w[i]={}}else if(!P(d))throw new Error(`Existing JSON field "${y}" must be an object`);w=w[i]}if(s)delete w.superpowers;else{let i=p?{...p}:{command:r,args:n};w.superpowers=M(w.superpowers,i,t)}let h=JSON.stringify(c,null,2)+`
|
|
23
24
|
`;return j&&h!==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).
|
|
24
|
-
`),h}let f=L.find(
|
|
25
|
+
`),h}let f=L.find(y=>P(c[y])&&c[y].superpowers!==void 0)??l;if(c[f]!==void 0&&!P(c[f]))throw new Error(`Existing JSON field "${f}" must be an object`);c[f]===void 0&&(c[f]={});let S=c[f];if(s)delete S.superpowers;else{let y;p?y={...p}:t==="json-servers"?y={command:r,args:n,type:"stdio"}:t==="json-mcp"?y={type:"local",command:[r,...n],enabled:!0}:y={command:r,args:n},S.superpowers=M(S.superpowers,y,t)}let k=JSON.stringify(c,null,2)+`
|
|
25
26
|
`;return j&&k!==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).
|
|
26
|
-
`),k}function
|
|
27
|
-
`),process.exitCode=1;return}r.target=e[++
|
|
28
|
-
`),process.exitCode=1;return}r.target=p}else if(s==="--help"||s==="-h"){
|
|
27
|
+
`),k}function ae(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 F(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 $=u.readlinkSync(e);p=o.resolve(o.dirname(e),$)}let m=o.normalize(o.resolve(p)).toLowerCase(),C=o.normalize(o.resolve(_.tmpdir())).toLowerCase();if(!(m===C||m.startsWith(C+o.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(b=>m===b||m.startsWith(b+o.sep))||m==="/var"||m.startsWith("/var"+o.sep)&&!m.startsWith("/var/folders"+o.sep)||m==="/private/var"||m.startsWith("/private/var"+o.sep)&&!m.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(_.tmpdir())).toLowerCase(),S=l===f||l.startsWith(f+o.sep),y=["/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(!S&&y)throw new Error(`Refusing to write to unsafe configuration target: ${p}`);if(!n.some(a=>{if(!a)return!1;let m=o.resolve(a);try{m=u.realpathSync(m)}catch{}let C=o.relative(m,p);return C!==".."&&!C.startsWith(`..${o.sep}`)&&!o.isAbsolute(C)}))throw new Error(`Refusing to write configuration outside allowed roots: ${p}`);let h=384;if(u.existsSync(p)){try{h=u.statSync(p).mode}catch{}if(r){let a=u.readFileSync(p,"utf8"),m=`${p}.${Date.now()}.bak`;try{u.writeFileSync(m,a,{encoding:"utf8",mode:h})}catch(C){let x=C instanceof Error?C.message:String(C);throw new Error(`Failed to create safe backup before write: ${x}`)}ae(p)}}let i=K.randomBytes(8).toString("hex"),d=o.join(c,`.tmp.${o.basename(p)}.${process.pid}.${i}`);try{u.writeFileSync(d,t,{encoding:"utf8",mode:h,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 m=u.realpathSync(g),C=u.statSync(m);if(m!==c||C.dev!==j.dev||C.ino!==j.ino)throw new Error("Configuration directory changed while writing");u.renameSync(d,p)}catch(a){try{u.existsSync(d)&&u.unlinkSync(d)}catch{}throw a}}async function G(e={}){let t=e.platform||_.platform(),r=e.homeDir||_.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"],S=[];if(!j)throw new Error(`No target client specified. Please specify which client to configure using --target <${Object.keys(A).join("|")}>.`);let k=Object.keys(A).find(w=>w===j||A[w].aliases.includes(j));if(!k)throw new Error(`Unknown harness target: "${j}". Supported targets: ${Object.keys(A).join(", ")}`);let y=[k];for(let w of y){let h=A[w],i=h.getConfigPath(t,r,n,s),d=u.existsSync(i);if(g&&!d){S.push({target:w,name:h.name,path:i,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let a="";d&&(a=u.readFileSync(i,"utf8"));let m="";if(h.type==="yaml")m=q(a,l,f,g,h.yamlProfile);else if(h.type==="toml")m=H(a,l,f,g);else{let C=typeof h.defaultConfig=="function"?h.defaultConfig(l,f):void 0;m=z(a,h.type,l,f,g,C,h.serverPath)}if(a.trim()===m.trim()&&d){S.push({target:w,name:h.name,path:i,status:"up-to-date",message:g?"Already not configured":"Already configured and up-to-date"});continue}p||F(i,m,!!e.backup,[r,n||"",s||""],d?a:null),S.push({target:w,name:h.name,path:i,status:g?"removed":d?"updated":"created",message:p?`[Dry Run] Would ${g?"remove from":d?"update":"create"} ${i}`:`Successfully ${g?"removed from":d?"updated":"configured"}!`})}catch(a){let m=a instanceof Error?a.message:String(a);S.push({target:w,name:h.name,path:i,status:"error",message:m})}}return S}async function T(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
|
+
`),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"){pe();return}else if(s.startsWith("-")){console.error(`\u274C Error: Unknown option "${s}". Use --help for usage.
|
|
29
30
|
`),process.exitCode=1;return}else if(!r.target)r.target=s;else{console.error(`\u274C Error: Unexpected argument "${s}". Use --help for usage.
|
|
30
31
|
`),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
32
|
========================================================`),console.log("\u26A1 Superpowers MCP - Targeted Client Setup"),console.log(`========================================================
|
|
@@ -33,9 +34,9 @@ ${a}`}let l=p[0],f=l+1;for(;f<s.length&&!(M.test(s[f])&&!ne.test(s[f]));)f++;let
|
|
|
33
34
|
`),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
35
|
`),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
36
|
`),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
|
|
37
|
-
`),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(
|
|
38
|
-
`),process.exitCode=1}}function
|
|
37
|
+
`),process.exitCode=1;return}try{let n=await G(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
|
+
`),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 pe(){console.log(`
|
|
39
40
|
Superpowers MCP - Targeted Global Setup
|
|
40
41
|
|
|
41
42
|
Usage:
|
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.5",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=18"
|
|
8
8
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
],
|
|
40
40
|
"overrides": {
|
|
41
41
|
"@hono/node-server": "^2.1.1",
|
|
42
|
-
"fast-uri": "^4.1
|
|
42
|
+
"fast-uri": "^4.2.1",
|
|
43
43
|
"hono": "^4.13.7",
|
|
44
44
|
"qs": "^6.16.0"
|
|
45
45
|
},
|
|
@@ -93,11 +93,18 @@ function readBaseline(baselinePath = BASELINE_PATH) {
|
|
|
93
93
|
return parsed;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
/** OS metadata Finder/Explorer drop into folders; never upstream content. */
|
|
97
|
+
const OS_JUNK = new Set([".DS_Store", "Thumbs.db", "desktop.ini"]);
|
|
98
|
+
const isOsJunk = (name) => OS_JUNK.has(name) || name.startsWith("._");
|
|
99
|
+
|
|
96
100
|
/** Walk the fork's skills tree and return the upstream-style paths it covers. */
|
|
97
101
|
function localSkillPaths(skillsDir = SKILLS_DIR) {
|
|
98
102
|
const found = new Set();
|
|
99
103
|
const walk = (dir, relative) => {
|
|
100
104
|
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
105
|
+
if (isOsJunk(entry.name)) {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
101
108
|
const nextRelative = relative ? `${relative}/${entry.name}` : entry.name;
|
|
102
109
|
if (entry.isDirectory()) {
|
|
103
110
|
walk(path.join(dir, entry.name), nextRelative);
|
|
@@ -378,4 +385,4 @@ if (require.main === module) {
|
|
|
378
385
|
});
|
|
379
386
|
}
|
|
380
387
|
|
|
381
|
-
module.exports = { parseArgs, skillNameOf, readBaseline, localSkillPaths, classifyDrift, classifyCoverage, requireCompleteTreeForRecord };
|
|
388
|
+
module.exports = { parseArgs, skillNameOf, isOsJunk, readBaseline, localSkillPaths, classifyDrift, classifyCoverage, requireCompleteTreeForRecord };
|
|
@@ -7,9 +7,7 @@ description: Use when you have a spec or requirements for a multi-step task, bef
|
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
Write
|
|
11
|
-
|
|
12
|
-
Assume they are a skilled developer, but know almost nothing about our toolset or problem domain. Assume they don't know good test design very well.
|
|
10
|
+
Write implementation plans for an engineer who has not seen this codebase or this spec. Assume they write idiomatic code in the project's language once they know the exact interface and the exact test, and that they will make a reasonable choice wherever the plan leaves one open. What they cannot know is what you decided: which files, which names and signatures, which values from the spec, which tests prove each task. Document those. Give them the whole plan as bite-sized tasks. DRY. YAGNI. TDD. Frequent commits.
|
|
13
11
|
|
|
14
12
|
**Announce at start:** "I'm using the writing-plans skill to create the implementation plan."
|
|
15
13
|
|
|
@@ -66,9 +64,9 @@ deliverable needs them; split only where a reviewer could meaningfully
|
|
|
66
64
|
reject one task while approving its neighbor. Each task ends with an
|
|
67
65
|
independently testable deliverable.
|
|
68
66
|
|
|
69
|
-
##
|
|
67
|
+
## Step Granularity
|
|
70
68
|
|
|
71
|
-
**Each step is one action
|
|
69
|
+
**Each step is one action with a checkable result:**
|
|
72
70
|
- "Write the failing test" - step
|
|
73
71
|
- "Run it to make sure it fails" - step
|
|
74
72
|
- "Implement the minimal code to make the test pass" - step
|
|
@@ -147,12 +145,11 @@ def test_specific_behavior():
|
|
|
147
145
|
Run: `pytest tests/path/test.py::test_name -v`
|
|
148
146
|
Expected: FAIL with "function not defined"
|
|
149
147
|
|
|
150
|
-
- [ ] **Step 3:
|
|
148
|
+
- [ ] **Step 3: Implement `function(input: InputType) -> ResultType` in `exact/path/to/file.py`**
|
|
151
149
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
```
|
|
150
|
+
One line on the approach when the signature and the test leave a choice
|
|
151
|
+
(which library call, which data structure); a code block only for an
|
|
152
|
+
algorithm they do not determine.
|
|
156
153
|
|
|
157
154
|
- [ ] **Step 4: Run test to verify it passes**
|
|
158
155
|
|
|
@@ -167,15 +164,28 @@ git commit -m "feat: add specific feature"
|
|
|
167
164
|
```
|
|
168
165
|
````
|
|
169
166
|
|
|
170
|
-
##
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
-
|
|
177
|
-
|
|
178
|
-
-
|
|
167
|
+
## What a Step Contains
|
|
168
|
+
|
|
169
|
+
A step is done when the implementer can write exactly one reasonable thing
|
|
170
|
+
from it. That is the whole requirement: unambiguous, not complete. Each kind
|
|
171
|
+
of step carries what makes it unambiguous and nothing more:
|
|
172
|
+
|
|
173
|
+
- **A test step:** the test's name and its assertions, as code, with the
|
|
174
|
+
spec's exact values in them.
|
|
175
|
+
- **A code step:** the exact signature (name, parameters, return type), the
|
|
176
|
+
file it lives in, and the specific values the spec pins. The implementer
|
|
177
|
+
writes the body. A body appears only for an algorithm the signature and
|
|
178
|
+
tests do not determine, or for exact copy the spec fixes.
|
|
179
|
+
- **A verification step:** the command to run and the output that means it
|
|
180
|
+
passed.
|
|
181
|
+
- **A reference to another task:** that task's Interfaces block says what
|
|
182
|
+
to use; the plan does not repeat that task's code.
|
|
183
|
+
|
|
184
|
+
A plan is the set of decisions the implementer cannot make alone. A plan
|
|
185
|
+
longer than the code it describes has written the code instead. Lines that
|
|
186
|
+
decide nothing ("TBD", "handle edge cases", "add appropriate validation",
|
|
187
|
+
"write tests for the above", a type or function no task defines) are the
|
|
188
|
+
opposite failure, and the self-review catches both.
|
|
179
189
|
|
|
180
190
|
## Self-Review
|
|
181
191
|
|
|
@@ -183,12 +193,14 @@ After writing the complete plan, look at the spec with fresh eyes and check the
|
|
|
183
193
|
|
|
184
194
|
**1. Spec coverage:** Skim each section/requirement in the spec. Can you point to a task that implements it? List any gaps.
|
|
185
195
|
|
|
186
|
-
**2.
|
|
196
|
+
**2. Step scan:** Every step must let the implementer write exactly one reasonable thing, and no step may carry more than that: a line that decides nothing is a gap, a function body the signature and tests already determine is a transcript. Fix both.
|
|
187
197
|
|
|
188
198
|
**3. Type consistency:** Do the types, method signatures, and property names you used in later tasks match what you defined in earlier tasks? A function called `clearLayers()` in Task 3 but `clearFullLayers()` in Task 7 is a bug.
|
|
189
199
|
|
|
190
200
|
**4. Review Focus:** For each input class or failure mode the spec implies, is there a task whose tests exercise it? The five uncovered ones most likely to bite a person go in the Review Focus section, and each line there gets its test added to the owning task. An empty section means you checked and found none, not that you skipped the check.
|
|
191
201
|
|
|
202
|
+
**5. Proportion:** Compare the plan's length to the spec's. A plan several times longer than the spec it implements is a transcript of the program, not a plan. If code blocks are most of the document, replace bodies with signatures, test names and assertions, and check that each step is still unambiguous.
|
|
203
|
+
|
|
192
204
|
If you find issues, fix them inline. No need to re-review — just fix and move on. If you find a spec requirement with no task, add the task.
|
|
193
205
|
|
|
194
206
|
## Execution Handoff
|
|
@@ -117,8 +117,9 @@ are **plan failures** — never write them:
|
|
|
117
117
|
|
|
118
118
|
## Self-Review
|
|
119
119
|
|
|
120
|
-
Run SKILL.md's Self-Review checklist, reading step 2 against
|
|
121
|
-
Contracts" above rather than
|
|
120
|
+
Run SKILL.md's Self-Review checklist, reading step 2 against
|
|
121
|
+
"No Vague Contracts" above rather than against the step template in
|
|
122
|
+
"What a Step Contains".
|
|
122
123
|
|
|
123
124
|
## Red Flags
|
|
124
125
|
|