superpowers-mcp 6.3.9 → 6.4.1

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.
Files changed (53) hide show
  1. package/README.ja.md +43 -74
  2. package/README.ko.md +43 -74
  3. package/README.md +43 -74
  4. package/README.zh-TW.md +43 -74
  5. package/docs/skill-compositions.ja.md +6 -2
  6. package/docs/skill-compositions.ko.md +6 -2
  7. package/docs/skill-compositions.md +5 -1
  8. package/docs/skill-compositions.zh-TW.md +6 -2
  9. package/out/server.js +65 -60
  10. package/out/setup-runner.js +17 -16
  11. package/out/setup.js +17 -16
  12. package/package.json +2 -2
  13. package/skills/brainstorming/visual-companion.md +6 -6
  14. package/skills/diagnosing-superpowers/SKILL.md +120 -0
  15. package/skills/diagnosing-superpowers/prompts/analyst-common.md +38 -0
  16. package/skills/diagnosing-superpowers/prompts/cost-and-time.md +28 -0
  17. package/skills/diagnosing-superpowers/prompts/plan-adherence.md +29 -0
  18. package/skills/diagnosing-superpowers/prompts/quality-evidence.md +26 -0
  19. package/skills/diagnosing-superpowers/prompts/repeated-work.md +30 -0
  20. package/skills/diagnosing-superpowers/prompts/request-conflicts.md +20 -0
  21. package/skills/diagnosing-superpowers/prompts/scrub-audit.md +33 -0
  22. package/skills/diagnosing-superpowers/prompts/scrub.md +29 -0
  23. package/skills/diagnosing-superpowers/prompts/similar-session.md +38 -0
  24. package/skills/diagnosing-superpowers/prompts/skill-timeline.md +30 -0
  25. package/skills/diagnosing-superpowers/prompts/stumbles.md +28 -0
  26. package/skills/diagnosing-superpowers/references/context-safety.md +22 -0
  27. package/skills/diagnosing-superpowers/references/github-issues.md +47 -0
  28. package/skills/diagnosing-superpowers/references/redaction-policy.md +34 -0
  29. package/skills/diagnosing-superpowers/references/session-discovery.md +31 -0
  30. package/skills/diagnosing-superpowers/templates/bundle-README.md +77 -0
  31. package/skills/diagnosing-superpowers/templates/case.md +64 -0
  32. package/skills/diagnosing-superpowers/templates/issue.md +51 -0
  33. package/skills/diagnosing-superpowers/templates/report.md +82 -0
  34. package/skills/executing-plans/SKILL.md +405 -58
  35. package/skills/executing-plans/scripts/task-done +55 -0
  36. package/skills/executing-plans/scripts/task-done.ps1 +83 -0
  37. package/skills/executing-plans/scripts/task-start +30 -0
  38. package/skills/executing-plans/scripts/task-start.ps1 +38 -0
  39. package/skills/requesting-code-review/code-reviewer.md +18 -1
  40. package/skills/subagent-driven-development/SKILL.md +31 -26
  41. package/skills/subagent-driven-development/re-review-prompt.md +1 -1
  42. package/skills/subagent-driven-development/scripts/review-package +4 -0
  43. package/skills/subagent-driven-development/scripts/review-package.ps1 +2 -0
  44. package/skills/subagent-driven-development/scripts/sdd-workspace +9 -5
  45. package/skills/subagent-driven-development/scripts/sdd-workspace.ps1 +10 -0
  46. package/skills/subagent-driven-development/scripts/task-brief +2 -0
  47. package/skills/subagent-driven-development/task-reviewer-prompt.md +2 -2
  48. package/skills/systematic-debugging/root-cause-tracing.md +1 -1
  49. package/skills/using-superpowers/SKILL.md +2 -0
  50. package/skills/using-superpowers/references/claude-code-tools.md +29 -0
  51. package/skills/using-superpowers/references/muse-tools.md +35 -0
  52. package/skills/writing-plans/SKILL.md +23 -12
  53. package/skills/writing-skills/SKILL.md +4 -2
@@ -1,29 +1,30 @@
1
- "use strict";var U=Object.create;var P=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var K=(e,t)=>{for(var r in t)P(e,r,{get:t[r],enumerable:!0})},$=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of J(t))!H.call(e,s)&&s!==r&&P(e,s,{get:()=>t[s],enumerable:!(o=q(t,s))||o.enumerable});return e};var A=(e,t,r)=>(r=e!=null?U(M(e)):{},$(t||!e||!e.__esModule?P(r,"default",{value:e,enumerable:!0}):r,e)),F=e=>$(P({},"__esModule",{value:!0}),e);var Y={};K(Y,{HARNESS_CONFIGS:()=>b,isPlainObject:()=>_,runSetup:()=>N,runSetupCli:()=>V,safeWriteConfig:()=>T,stripJsonComments:()=>W,updateJsonConfig:()=>O,updateYamlConfig:()=>I});module.exports=F(Y);var i=A(require("fs")),n=A(require("path")),x=A(require("os")),D=A(require("crypto")),b={lmstudio:{name:"LM Studio",aliases:["lmstudio","lm-studio"],getConfigPath:(e,t)=>n.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 o=e==="win32"?r||n.join(t,"AppData","Roaming"):e==="darwin"?n.join(t,"Library","Application Support"):n.join(t,".config");return n.join(o,"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,o)=>e==="win32"?n.join(r||n.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?n.join(t,"Library","Application Support","Code","User","mcp.json"):n.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,o)=>e==="win32"?n.join(r||n.join(t,"AppData","Roaming"),"Code - Insiders","User","mcp.json"):e==="darwin"?n.join(t,"Library","Application Support","Code - Insiders","User","mcp.json"):n.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)=>n.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,o)=>{if(e==="win32"){let s=o||n.join(t,"AppData","Local");return n.join(s,"hermes","config.yaml")}return n.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)=>n.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"?n.join(r||n.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?n.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):n.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)=>{let r=n.join(t,".config","devin","mcp_config.json");return i.existsSync(r)?r:n.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)=>n.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 a=n.join(r||n.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(i.existsSync(a))return a;let p=n.join(t,".pi","agent","mcp.json");if(i.existsSync(p))return p;let c=n.join(t,".pi","mcp.json");return i.existsSync(c)?c:p}let o=n.join(t,".pi","agent","mcp.json");if(i.existsSync(o))return o;let s=n.join(t,".pi","mcp.json");return i.existsSync(s)?s:o},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=n.join(t,".qwenpaw","config.json");if(i.existsSync(r))return r;let o=n.join(t,".copaw","config.json");return i.existsSync(o)?o: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 o="";if(e==="win32"?o=n.join(r||n.join(t,"AppData","Roaming"),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):e==="darwin"?o=n.join(t,"Library","Application Support","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):o=n.join(t,".config","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),i.existsSync(o))return o;let s=n.join(t,".cline","data","settings","cline_mcp_settings.json");return i.existsSync(s)?s:o},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kilo:{name:"Kilo Code",aliases:["kilo","kilocode","kilo-code"],getConfigPath:(e,t)=>{let r=n.join(t,".config","kilo","kilo.jsonc");if(i.existsSync(r))return r;let o=n.join(t,".config","kilo","kilo.json");return i.existsSync(o)?o:r},type:"json-mcp",defaultConfig:(e,t)=>({type:"local",command:[e,...t],enabled:!0})},qoder:{name:"Qoder",aliases:["qoder"],getConfigPath:(e,t)=>n.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)=>n.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 o=n.join(r||n.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(i.existsSync(o))return o;let s=n.join(r||n.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return i.existsSync(s)?s:o}else if(e==="darwin"){let o=n.join(t,"Library","Application Support","Trae","User","mcp.json");if(i.existsSync(o))return o;let s=n.join(t,"Library","Application Support","Trae CN","User","mcp.json");return i.existsSync(s)?s:o}else{let o=n.join(t,".config","Trae","User","mcp.json");if(i.existsSync(o))return o;let s=n.join(t,".config","Trae CN","User","mcp.json");return i.existsSync(s)?s:o}},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})}};function _(e){return Object.prototype.toString.call(e)==="[object Object]"}function W(e,t=!1){if(!e)return"";if(!t)try{return JSON.parse(e),e}catch{}let r=e.length,o=[],s=!1,a=!1,p=!1,c=!1,m=-1;for(let f=0;f<r;f++){let u=e[f],h=f+1<r?e[f+1]:"";if(p){(u===`
2
- `||u==="\r")&&(p=!1,o.push(u));continue}if(c){u==="*"&&h==="/"&&(c=!1,f++);continue}if(s){o.push(u),a?a=!1:u==="\\"?a=!0:u==='"'&&(s=!1);continue}if(u==='"'){s=!0,a=!1,m=-1,o.push(u);continue}if(u==="/"&&h==="/"){p=!0,f++;continue}if(u==="/"&&h==="*"){c=!0,f++;continue}if(u===","){m=o.length,o.push(u);continue}if(u==="}"||u==="]"){m!==-1&&(o[m]=" ",m=-1),o.push(u);continue}u!==" "&&u!==" "&&u!==`
3
- `&&u!=="\r"&&(m=-1),o.push(u)}return o.join("")}var R=/\s/;function z(e){for(let t=1;t<e.length;t++){if(e[t]!=="#"||!R.test(e[t-1]))continue;let r=t-1;for(;r>0&&R.test(e[r-1]);)r--;return e.slice(r)}return""}function I(e,t,r,o=!1){let s=e?e.split(/\r?\n/):[],a=s.map((g,y)=>{let w=g.match(/^(\s*)mcp_servers:/);return w?{index:y,indent:w[1],tail:g.slice(w[0].length).trim()}:null}).filter(g=>g!==null);if(a.length>1)throw new Error("Cannot safely update YAML with duplicate mcp_servers keys");if(a.length===1){let g=a[0];if(g.indent!==""||g.tail!==""&&!g.tail.startsWith("#"))throw new Error("Cannot safely update YAML unless mcp_servers is a root-level block mapping")}let p=" ";if(a.length===1)for(let g=a[0].index+1;g<s.length;g++){if(s[g].trim()===""||s[g].trimStart().startsWith("#"))continue;if(/^[^\s]/.test(s[g]))break;let y=s[g].match(/^(\s+)[a-zA-Z0-9_-]+:/);y&&(p=y[1]);break}if(o){let g=[],y=!1,w=0,j=!1,v=0;for(let C=0;C<s.length;C++){let l=s[C],d=l.match(/^(\s*)mcp_servers:\s*(?:#.*)?$/);if(d){y=!0,w=d[1].length,g.push(l);continue}if(y){let S=l.match(/^(\s*)/)?.[1].length||0;if(l.trimStart().startsWith("#")){g.push(l);continue}if(l.trim()!==""&&S<=w)y=!1,j=!1;else{let k=l.match(/^(\s*)superpowers:\s*(?:#.*)?$/);if(k&&k[1]===p){j=!0,v=k[1].length;continue}if(j){if(S>v||l.trim()==="")continue;j=!1}}}g.push(l)}return g.join(`
4
- `)}let c=JSON.stringify(t),m=JSON.stringify(r),f=[`${p}superpowers:`,`${p}${p}command: ${c}`,`${p}${p}args: ${m}`];if(!e||e.trim()==="")return`mcp_servers:
1
+ "use strict";var q=Object.create;var A=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var F=(e,t)=>{for(var r in t)A(e,r,{get:t[r],enumerable:!0})},R=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of M(t))!K.call(e,s)&&s!==r&&A(e,s,{get:()=>t[s],enumerable:!(o=J(t,s))||o.enumerable});return e};var _=(e,t,r)=>(r=e!=null?q(H(e)):{},R(t||!e||!e.__esModule?A(r,"default",{value:e,enumerable:!0}):r,e)),V=e=>R(A({},"__esModule",{value:!0}),e);var Q={};F(Q,{HARNESS_CONFIGS:()=>b,JSON_SERVER_ROOT_KEYS:()=>W,isPlainObject:()=>P,runSetup:()=>U,runSetupCli:()=>G,safeWriteConfig:()=>N,stripJsonComments:()=>I,updateJsonConfig:()=>T,updateYamlConfig:()=>O});module.exports=V(Q);var i=_(require("fs")),n=_(require("path")),x=_(require("os")),D=_(require("crypto")),b={lmstudio:{name:"LM Studio",aliases:["lmstudio","lm-studio"],getConfigPath:(e,t)=>n.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 o=e==="win32"?r||n.join(t,"AppData","Roaming"):e==="darwin"?n.join(t,"Library","Application Support"):n.join(t,".config");return n.join(o,"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,o)=>e==="win32"?n.join(r||n.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?n.join(t,"Library","Application Support","Code","User","mcp.json"):n.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,o)=>e==="win32"?n.join(r||n.join(t,"AppData","Roaming"),"Code - Insiders","User","mcp.json"):e==="darwin"?n.join(t,"Library","Application Support","Code - Insiders","User","mcp.json"):n.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)=>n.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,o)=>{if(e==="win32"){let s=o||n.join(t,"AppData","Local");return n.join(s,"hermes","config.yaml")}return n.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)=>n.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"?n.join(r||n.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?n.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):n.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)=>{let r=n.join(t,".config","devin","mcp_config.json");return i.existsSync(r)?r:n.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)=>n.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 a=n.join(r||n.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(i.existsSync(a))return a;let c=n.join(t,".pi","agent","mcp.json");if(i.existsSync(c))return c;let g=n.join(t,".pi","mcp.json");return i.existsSync(g)?g:c}let o=n.join(t,".pi","agent","mcp.json");if(i.existsSync(o))return o;let s=n.join(t,".pi","mcp.json");return i.existsSync(s)?s:o},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=n.join(t,".qwenpaw","config.json");if(i.existsSync(r))return r;let o=n.join(t,".copaw","config.json");return i.existsSync(o)?o: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 o="";if(e==="win32"?o=n.join(r||n.join(t,"AppData","Roaming"),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):e==="darwin"?o=n.join(t,"Library","Application Support","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):o=n.join(t,".config","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),i.existsSync(o))return o;let s=n.join(t,".cline","data","settings","cline_mcp_settings.json");return i.existsSync(s)?s:o},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kilo:{name:"Kilo Code",aliases:["kilo","kilocode","kilo-code"],getConfigPath:(e,t)=>{let r=n.join(t,".config","kilo","kilo.jsonc");if(i.existsSync(r))return r;let o=n.join(t,".config","kilo","kilo.json");return i.existsSync(o)?o:r},type:"json-mcp",defaultConfig:(e,t)=>({type:"local",command:[e,...t],enabled:!0})},qoder:{name:"Qoder",aliases:["qoder"],getConfigPath:(e,t)=>n.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)=>n.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 o=n.join(r||n.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(i.existsSync(o))return o;let s=n.join(r||n.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return i.existsSync(s)?s:o}else if(e==="darwin"){let o=n.join(t,"Library","Application Support","Trae","User","mcp.json");if(i.existsSync(o))return o;let s=n.join(t,"Library","Application Support","Trae CN","User","mcp.json");return i.existsSync(s)?s:o}else{let o=n.join(t,".config","Trae","User","mcp.json");if(i.existsSync(o))return o;let s=n.join(t,".config","Trae CN","User","mcp.json");return i.existsSync(s)?s:o}},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})}},W=["mcpServers","servers","mcp"];function P(e){return Object.prototype.toString.call(e)==="[object Object]"}function I(e,t=!1){if(!e)return"";if(!t)try{return JSON.parse(e),e}catch{}let r=e.length,o=[],s=!1,a=!1,c=!1,g=!1,h=-1;for(let f=0;f<r;f++){let p=e[f],d=f+1<r?e[f+1]:"";if(c){(p===`
2
+ `||p==="\r")&&(c=!1,o.push(p));continue}if(g){p==="*"&&d==="/"&&(g=!1,f++);continue}if(s){o.push(p),a?a=!1:p==="\\"?a=!0:p==='"'&&(s=!1);continue}if(p==='"'){s=!0,a=!1,h=-1,o.push(p);continue}if(p==="/"&&d==="/"){c=!0,f++;continue}if(p==="/"&&d==="*"){g=!0,f++;continue}if(p===","){h=o.length,o.push(p);continue}if(p==="}"||p==="]"){h!==-1&&(o[h]=" ",h=-1),o.push(p);continue}p!==" "&&p!==" "&&p!==`
3
+ `&&p!=="\r"&&(h=-1),o.push(p)}return o.join("")}var $=/\s/;function z(e){for(let t=1;t<e.length;t++){if(e[t]!=="#"||!$.test(e[t-1]))continue;let r=t-1;for(;r>0&&$.test(e[r-1]);)r--;return e.slice(r)}return""}function O(e,t,r,o=!1){let s=e?e.split(/\r?\n/):[],a=s.map((u,w)=>{let C=u.match(/^(\s*)mcp_servers:/);return C?{index:w,indent:C[1],tail:u.slice(C[0].length).trim()}:null}).filter(u=>u!==null);if(a.length>1)throw new Error("Cannot safely update YAML with duplicate mcp_servers keys");if(a.length===1){let u=a[0];if(u.indent!==""||u.tail!==""&&!u.tail.startsWith("#"))throw new Error("Cannot safely update YAML unless mcp_servers is a root-level block mapping")}let c=" ";if(a.length===1)for(let u=a[0].index+1;u<s.length;u++){if(s[u].trim()===""||s[u].trimStart().startsWith("#"))continue;if(/^[^\s]/.test(s[u]))break;let w=s[u].match(/^(\s+)\S/);w&&(c=w[1]);break}if(o){let u=[],w=!1,C=0,y=!1,S=0;for(let j=0;j<s.length;j++){let l=s[j],m=l.match(/^(\s*)mcp_servers:\s*(?:#.*)?$/);if(m){w=!0,C=m[1].length,u.push(l);continue}if(w){let v=l.match(/^(\s*)/)?.[1].length||0;if(l.trimStart().startsWith("#")){u.push(l);continue}if(l.trim()!==""&&v<=C)w=!1,y=!1;else{let k=l.match(/^(\s*)superpowers:\s*(?:#.*)?$/);if(k&&k[1]===c){y=!0,S=k[1].length;continue}if(y){if(v>S||l.trim()==="")continue;y=!1}}}u.push(l)}return u.join(`
4
+ `)}let g=JSON.stringify(t),h=JSON.stringify(r),f=[`${c}superpowers:`,`${c}${c}command: ${g}`,`${c}${c}args: ${h}`];if(!e||e.trim()==="")return`mcp_servers:
5
5
  ${f.join(`
6
6
  `)}
7
- `;let u=a.length===1?a[0].index:-1;if(u===-1)return`${e.trimEnd()}
7
+ `;let p=a.length===1?a[0].index:-1;if(p===-1)return`${e.trimEnd()}
8
8
 
9
9
  mcp_servers:
10
10
  ${f.join(`
11
11
  `)}
12
- `;let h=-1;for(let g=u+1;g<s.length;g++){let y=s[g];if(/^[^\s#]/.test(y))break;if((y.match(/^(\s*)/)?.[1]||"")===p&&/^\s+superpowers:\s*(?:#.*)?$/.test(y)){h=g;break}}if(h!==-1){let g=s[h].match(/^(\s*)/)?.[1].length||2,y=h+1;for(;y<s.length;){let w=s[y];if((w.match(/^(\s*)/)?.[1].length||0)>g||w.trim()==="")y++;else break}return f[0]+=z(s[h]),s.splice(h,y-h,...f),s.join(`
13
- `)}else return s.splice(u+1,0,...f),s.join(`
14
- `)}function O(e,t,r,o,s=!1,a){let p={};if(e&&e.trim()!=="")try{let f=JSON.parse(e);if(!_(f))throw new Error("Existing JSON root must be an object");p=f}catch{try{let u=W(e,!0),h=JSON.parse(u);if(!_(h))throw new Error("Existing JSON root must be an object");p=h}catch(u){let h=u instanceof Error?u.message:String(u);throw new Error(`Failed to parse existing JSON: ${h}`)}}let c="mcpServers";if(t==="json-servers"?c="servers":t==="json-mcp"&&(c="mcp"),p[c]!==void 0&&!_(p[c]))throw new Error(`Existing JSON field "${c}" must be an object`);p[c]===void 0&&(p[c]={});let m=p[c];return s?delete m.superpowers:a?m.superpowers=a:t==="json-servers"?m.superpowers={command:r,args:o,type:"stdio"}:t==="json-mcp"?m.superpowers={type:"local",command:[r,...o],enabled:!0}:m.superpowers={command:r,args:o},JSON.stringify(p,null,2)+`
15
- `}function T(e,t,r=!1,o=[],s){if(o.length===0)throw new Error("safeWriteConfig requires at least one allowed destination root");let a=e;try{let l=i.lstatSync(e,{throwIfNoEntry:!1});if(l&&l.isSymbolicLink()){try{a=i.realpathSync(e)}catch{let L=i.readlinkSync(e);a=n.resolve(n.dirname(e),L)}let d=n.normalize(n.resolve(a)).toLowerCase(),S=n.normalize(n.resolve(x.tmpdir())).toLowerCase();if(!(d===S||d.startsWith(S+n.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(E=>d===E||d.startsWith(E+n.sep))||d==="/var"||d.startsWith("/var"+n.sep)&&!d.startsWith("/var/folders"+n.sep)||d==="/private/var"||d.startsWith("/private/var"+n.sep)&&!d.startsWith("/private/var/folders"+n.sep)))throw new Error(`Refusing to write to unsafe symlink target: ${a}`)}}catch(l){if(l instanceof Error&&l.message.includes("Refusing to write to unsafe symlink target"))throw l}let p=n.dirname(a);i.existsSync(p)||i.mkdirSync(p,{recursive:!0,mode:448});let c=i.realpathSync(p),m=i.statSync(c);a=n.join(c,n.basename(a));let f=n.normalize(n.resolve(a)).toLowerCase(),u=n.normalize(n.resolve(x.tmpdir())).toLowerCase(),h=f===u||f.startsWith(u+n.sep),y=["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(l=>f===l||f.startsWith(l+n.sep))||f==="/var"||f.startsWith("/var"+n.sep)&&!f.startsWith("/var/folders"+n.sep)||f==="/private/var"||f.startsWith("/private/var"+n.sep)&&!f.startsWith("/private/var/folders"+n.sep);if(!h&&y)throw new Error(`Refusing to write to unsafe configuration target: ${a}`);if(!o.some(l=>{if(!l)return!1;let d=n.resolve(l);try{d=i.realpathSync(d)}catch{}let S=n.relative(d,a);return S!==".."&&!S.startsWith(`..${n.sep}`)&&!n.isAbsolute(S)}))throw new Error(`Refusing to write configuration outside allowed roots: ${a}`);let j=384;if(i.existsSync(a)){try{j=i.statSync(a).mode}catch{}if(r){let l=i.readFileSync(a,"utf8"),d=`${a}.${Date.now()}.bak`;try{i.writeFileSync(d,l,{encoding:"utf8",mode:j})}catch(S){let k=S instanceof Error?S.message:String(S);throw new Error(`Failed to create safe backup before write: ${k}`)}}}let v=D.randomBytes(8).toString("hex"),C=n.join(c,`.tmp.${n.basename(a)}.${process.pid}.${v}`);try{i.writeFileSync(C,t,{encoding:"utf8",mode:j,flag:"wx"});let l=i.existsSync(a);if(s===null&&l)throw new Error("Configuration changed concurrently before it could be created");if(s!=null&&(!l||i.readFileSync(a,"utf8")!==s))throw new Error("Configuration changed concurrently; refusing to overwrite newer content");let d=i.realpathSync(p),S=i.statSync(d);if(d!==c||S.dev!==m.dev||S.ino!==m.ino)throw new Error("Configuration directory changed while writing");i.renameSync(C,a)}catch(l){try{i.existsSync(C)&&i.unlinkSync(C)}catch{}throw l}}async function N(e={}){let t=e.platform||x.platform(),r=e.homeDir||x.homedir(),o=e.appData||process.env.APPDATA,s=e.localAppData||process.env.LOCALAPPDATA,a=!!e.dryRun,p=!!e.remove,c=!!e.bun,m=e.target?e.target.toLowerCase():null,f=c?"bunx":"npx",u=["-y","superpowers-mcp"],h=[];if(!m)throw new Error(`No target client specified. Please specify which client to configure using --target <${Object.keys(b).join("|")}>.`);let g=Object.keys(b).find(w=>w===m||b[w].aliases.includes(m));if(!g)throw new Error(`Unknown harness target: "${m}". Supported targets: ${Object.keys(b).join(", ")}`);let y=[g];for(let w of y){let j=b[w],v=j.getConfigPath(t,r,o,s),C=i.existsSync(v);if(p&&!C){h.push({target:w,name:j.name,path:v,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let l="";C&&(l=i.readFileSync(v,"utf8"));let d="";if(j.type==="yaml")d=I(l,f,u,p);else{let S=typeof j.defaultConfig=="function"?j.defaultConfig(f,u):void 0;d=O(l,j.type,f,u,p,S)}if(l.trim()===d.trim()&&C){h.push({target:w,name:j.name,path:v,status:"up-to-date",message:p?"Already not configured":"Already configured and up-to-date"});continue}a||T(v,d,!!e.backup,[r,o||"",s||""],C?l:null),h.push({target:w,name:j.name,path:v,status:p?"removed":C?"updated":"created",message:a?`[Dry Run] Would ${p?"remove from":C?"update":"create"} ${v}`:`Successfully ${p?"removed from":C?"updated":"configured"}!`})}catch(l){let d=l instanceof Error?l.message:String(l);h.push({target:w,name:j.name,path:v,status:"error",message:d})}}return h}async function V(e=process.argv.slice(2)){let t=!1,r={dryRun:!1,remove:!1,bun:!1,backup:!1,target:null};for(let o=0;o<e.length;o++){let s=e[o];if(!(s==="setup"||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 a=e[o+1];(!a||a.startsWith("-"))&&(console.error(`\u274C Error: Missing value for --target flag.
16
- `),process.exit(1)),r.target=e[++o]}else if(s.startsWith("--target=")){let a=s.split("=")[1];a||(console.error(`\u274C Error: Missing value for --target flag.
17
- `),process.exit(1)),r.target=a}else if(s==="--help"||s==="-h"){G();return}else!s.startsWith("-")&&!r.target&&s!=="setup"?r.target=s:s.startsWith("-")&&(console.error(`\u274C Error: Unknown option "${s}". Use --help for usage.
18
- `),process.exit(1))}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(`
12
+ `;let d=-1;for(let u=p+1;u<s.length;u++){let w=s[u];if(/^[^\s#]/.test(w))break;if((w.match(/^(\s*)/)?.[1]||"")===c&&/^\s+["']?superpowers["']?\s*:\s*(?:#.*)?$/.test(w)){d=u;break}}if(d!==-1){let u=s[d].match(/^(\s*)/)?.[1].length||2,w=d+1;for(;w<s.length;){let S=s[w];if((S.match(/^(\s*)/)?.[1].length||0)>u||S.trim()==="")w++;else break}let C=[],y=-1;for(let S=d+1;S<w;S++){let j=s[S];if(j.trim()==="")continue;let l=j.match(/^(\s*)/)?.[1].length??0;if(!(y!==-1&&l>y)){if(y=-1,l>u&&/^\s*["']?(?:command|args)["']?\s*:/.test(j)){y=l;continue}C.push(j)}}return f[0]+=z(s[d]),s.splice(d,w-d,...f,...C),s.join(`
13
+ `)}else return s.splice(p+1,0,...f),s.join(`
14
+ `)}function T(e,t,r,o,s=!1,a){let c={};if(e&&e.trim()!=="")try{let p=JSON.parse(e);if(!P(p))throw new Error("Existing JSON root must be an object");c=p}catch{try{let d=I(e,!0),u=JSON.parse(d);if(!P(u))throw new Error("Existing JSON root must be an object");c=u}catch(d){let u=d instanceof Error?d.message:String(d);throw new Error(`Failed to parse existing JSON: ${u}`)}}let g=t==="json-servers"?"servers":t==="json-mcp"?"mcp":"mcpServers",h=W.find(p=>P(c[p])&&c[p].superpowers!==void 0)??g;if(c[h]!==void 0&&!P(c[h]))throw new Error(`Existing JSON field "${h}" must be an object`);c[h]===void 0&&(c[h]={});let f=c[h];if(s)delete f.superpowers;else{let p;a?p={...a}:t==="json-servers"?p={command:r,args:o,type:"stdio"}:t==="json-mcp"?p={type:"local",command:[r,...o],enabled:!0}:p={command:r,args:o};let d=f.superpowers;if(!P(d))f.superpowers=p;else{let u={...d,...p};(d.enabled!==void 0||d.disabled!==void 0)&&(d.enabled!==void 0?u.enabled=d.enabled:delete u.enabled),t==="json-mcp"&&Array.isArray(u.command)&&delete u.args,f.superpowers=u}}return JSON.stringify(c,null,2)+`
15
+ `}function N(e,t,r=!1,o=[],s){if(o.length===0)throw new Error("safeWriteConfig requires at least one allowed destination root");let a=e;try{let l=i.lstatSync(e,{throwIfNoEntry:!1});if(l&&l.isSymbolicLink()){try{a=i.realpathSync(e)}catch{let L=i.readlinkSync(e);a=n.resolve(n.dirname(e),L)}let m=n.normalize(n.resolve(a)).toLowerCase(),v=n.normalize(n.resolve(x.tmpdir())).toLowerCase();if(!(m===v||m.startsWith(v+n.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(E=>m===E||m.startsWith(E+n.sep))||m==="/var"||m.startsWith("/var"+n.sep)&&!m.startsWith("/var/folders"+n.sep)||m==="/private/var"||m.startsWith("/private/var"+n.sep)&&!m.startsWith("/private/var/folders"+n.sep)))throw new Error(`Refusing to write to unsafe symlink target: ${a}`)}}catch(l){if(l instanceof Error&&l.message.includes("Refusing to write to unsafe symlink target"))throw l}let c=n.dirname(a);i.existsSync(c)||i.mkdirSync(c,{recursive:!0,mode:448});let g=i.realpathSync(c),h=i.statSync(g);a=n.join(g,n.basename(a));let f=n.normalize(n.resolve(a)).toLowerCase(),p=n.normalize(n.resolve(x.tmpdir())).toLowerCase(),d=f===p||f.startsWith(p+n.sep),w=["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(l=>f===l||f.startsWith(l+n.sep))||f==="/var"||f.startsWith("/var"+n.sep)&&!f.startsWith("/var/folders"+n.sep)||f==="/private/var"||f.startsWith("/private/var"+n.sep)&&!f.startsWith("/private/var/folders"+n.sep);if(!d&&w)throw new Error(`Refusing to write to unsafe configuration target: ${a}`);if(!o.some(l=>{if(!l)return!1;let m=n.resolve(l);try{m=i.realpathSync(m)}catch{}let v=n.relative(m,a);return v!==".."&&!v.startsWith(`..${n.sep}`)&&!n.isAbsolute(v)}))throw new Error(`Refusing to write configuration outside allowed roots: ${a}`);let y=384;if(i.existsSync(a)){try{y=i.statSync(a).mode}catch{}if(r){let l=i.readFileSync(a,"utf8"),m=`${a}.${Date.now()}.bak`;try{i.writeFileSync(m,l,{encoding:"utf8",mode:y})}catch(v){let k=v instanceof Error?v.message:String(v);throw new Error(`Failed to create safe backup before write: ${k}`)}}}let S=D.randomBytes(8).toString("hex"),j=n.join(g,`.tmp.${n.basename(a)}.${process.pid}.${S}`);try{i.writeFileSync(j,t,{encoding:"utf8",mode:y,flag:"wx"});let l=i.existsSync(a);if(s===null&&l)throw new Error("Configuration changed concurrently before it could be created");if(s!=null&&(!l||i.readFileSync(a,"utf8")!==s))throw new Error("Configuration changed concurrently; refusing to overwrite newer content");let m=i.realpathSync(c),v=i.statSync(m);if(m!==g||v.dev!==h.dev||v.ino!==h.ino)throw new Error("Configuration directory changed while writing");i.renameSync(j,a)}catch(l){try{i.existsSync(j)&&i.unlinkSync(j)}catch{}throw l}}async function U(e={}){let t=e.platform||x.platform(),r=e.homeDir||x.homedir(),o=e.appData||process.env.APPDATA,s=e.localAppData||process.env.LOCALAPPDATA,a=!!e.dryRun,c=!!e.remove,g=!!e.bun,h=e.target?e.target.toLowerCase():null,f=g?"bunx":"npx",p=["-y","superpowers-mcp"],d=[];if(!h)throw new Error(`No target client specified. Please specify which client to configure using --target <${Object.keys(b).join("|")}>.`);let u=Object.keys(b).find(C=>C===h||b[C].aliases.includes(h));if(!u)throw new Error(`Unknown harness target: "${h}". Supported targets: ${Object.keys(b).join(", ")}`);let w=[u];for(let C of w){let y=b[C],S=y.getConfigPath(t,r,o,s),j=i.existsSync(S);if(c&&!j){d.push({target:C,name:y.name,path:S,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let l="";j&&(l=i.readFileSync(S,"utf8"));let m="";if(y.type==="yaml")m=O(l,f,p,c);else{let v=typeof y.defaultConfig=="function"?y.defaultConfig(f,p):void 0;m=T(l,y.type,f,p,c,v)}if(l.trim()===m.trim()&&j){d.push({target:C,name:y.name,path:S,status:"up-to-date",message:c?"Already not configured":"Already configured and up-to-date"});continue}a||N(S,m,!!e.backup,[r,o||"",s||""],j?l:null),d.push({target:C,name:y.name,path:S,status:c?"removed":j?"updated":"created",message:a?`[Dry Run] Would ${c?"remove from":j?"update":"create"} ${S}`:`Successfully ${c?"removed from":j?"updated":"configured"}!`})}catch(l){let m=l instanceof Error?l.message:String(l);d.push({target:C,name:y.name,path:S,status:"error",message:m})}}return d}async function G(e=process.argv.slice(2)){let t=!1,r={dryRun:!1,remove:!1,bun:!1,backup:!1,target:null};for(let o=0;o<e.length;o++){let s=e[o];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 a=e[o+1];if(!a||a.startsWith("-")){console.error(`\u274C Error: Missing value for --target flag.
16
+ `),process.exitCode=1;return}r.target=e[++o]}else if(s.startsWith("--target=")){let a=s.split("=")[1];if(!a){console.error(`\u274C Error: Missing value for --target flag.
17
+ `),process.exitCode=1;return}r.target=a}else if(s==="--help"||s==="-h"){Y();return}else if(s.startsWith("-")){console.error(`\u274C Error: Unknown option "${s}". Use --help for usage.
18
+ `),process.exitCode=1;return}else if(!r.target)r.target=s;else{console.error(`\u274C Error: Unexpected argument "${s}". Use --help for usage.
19
+ `),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(`
19
20
  ========================================================`),console.log("\u26A1 Superpowers MCP - Targeted Client Setup"),console.log(`========================================================
20
21
  `),!r.target){console.log(`Please select which AI Agent client you would like to configure:
21
22
  `),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)
22
23
  `),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.
23
24
  `),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.
24
- `);return}try{let o=await N(r),s=0,a=0,p=0;for(let c of o){let m=c.status==="created"||c.status==="updated"||c.status==="removed"?"\u2705":c.status==="up-to-date"?"\u2728":c.status==="skipped"?"\u23ED\uFE0F ":"\u274C";console.log(`${m} [${c.name}] (${c.status})`),console.log(` Path: ${c.path}`),console.log(` Info: ${c.message}
25
- `),c.status==="created"||c.status==="updated"||c.status==="up-to-date"||c.status==="removed"?s++:c.status==="skipped"?a++:c.status==="error"&&p++}console.log("--------------------------------------------------------"),p>0&&(console.error(`\u26A0\uFE0F Setup finished with errors: ${p} failure(s), ${s} succeeded.`),process.exit(1)),console.log(`\u{1F389} Setup complete! ${s} environment(s) ready.`)}catch(o){let s=o instanceof Error?o.message:String(o);console.error(`\u274C Setup failed: ${s}
26
- `),process.exit(1)}}function G(){console.log(`
25
+ `),process.exitCode=1;return}try{let o=await U(r),s=0,a=0,c=0;for(let g of o){let h=g.status==="created"||g.status==="updated"||g.status==="removed"?"\u2705":g.status==="up-to-date"?"\u2728":g.status==="skipped"?"\u23ED\uFE0F ":"\u274C";console.log(`${h} [${g.name}] (${g.status})`),console.log(` Path: ${g.path}`),console.log(` Info: ${g.message}
26
+ `),g.status==="created"||g.status==="updated"||g.status==="up-to-date"||g.status==="removed"?s++:g.status==="skipped"?a++:g.status==="error"&&c++}if(console.log("--------------------------------------------------------"),c>0){console.error(`\u26A0\uFE0F Setup finished with errors: ${c} failure(s), ${s} succeeded.`),process.exitCode=1;return}console.log(`\u{1F389} Setup complete! ${s} environment(s) ready.`)}catch(o){let s=o instanceof Error?o.message:String(o);console.error(`\u274C Setup failed: ${s}
27
+ `),process.exitCode=1}}function Y(){console.log(`
27
28
  Superpowers MCP - Targeted Global Setup
28
29
 
29
30
  Usage:
@@ -67,4 +68,4 @@ Any Directory:
67
68
  Privacy & Safety:
68
69
  Superpowers MCP only touches the client you explicitly choose.
69
70
  It never bulk-modifies your environment without your consent.
70
- `)}0&&(module.exports={HARNESS_CONFIGS,isPlainObject,runSetup,runSetupCli,safeWriteConfig,stripJsonComments,updateJsonConfig,updateYamlConfig});
71
+ `)}0&&(module.exports={HARNESS_CONFIGS,JSON_SERVER_ROOT_KEYS,isPlainObject,runSetup,runSetupCli,safeWriteConfig,stripJsonComments,updateJsonConfig,updateYamlConfig});
package/out/setup.js CHANGED
@@ -1,30 +1,31 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var q=Object.create;var P=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var K=(e,t)=>{for(var r in t)P(e,r,{get:t[r],enumerable:!0})},R=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of M(t))!F.call(e,s)&&s!==r&&P(e,s,{get:()=>t[s],enumerable:!(o=J(t,s))||o.enumerable});return e};var A=(e,t,r)=>(r=e!=null?q(H(e)):{},R(t||!e||!e.__esModule?P(r,"default",{value:e,enumerable:!0}):r,e)),z=e=>R(P({},"__esModule",{value:!0}),e);var Y={};K(Y,{HARNESS_CONFIGS:()=>b,isPlainObject:()=>_,runSetup:()=>L,runSetupCli:()=>$,safeWriteConfig:()=>N,stripJsonComments:()=>I,updateJsonConfig:()=>T,updateYamlConfig:()=>O});module.exports=z(Y);var i=A(require("fs")),n=A(require("path")),x=A(require("os")),W=A(require("crypto")),b={lmstudio:{name:"LM Studio",aliases:["lmstudio","lm-studio"],getConfigPath:(e,t)=>n.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 o=e==="win32"?r||n.join(t,"AppData","Roaming"):e==="darwin"?n.join(t,"Library","Application Support"):n.join(t,".config");return n.join(o,"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,o)=>e==="win32"?n.join(r||n.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?n.join(t,"Library","Application Support","Code","User","mcp.json"):n.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,o)=>e==="win32"?n.join(r||n.join(t,"AppData","Roaming"),"Code - Insiders","User","mcp.json"):e==="darwin"?n.join(t,"Library","Application Support","Code - Insiders","User","mcp.json"):n.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)=>n.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,o)=>{if(e==="win32"){let s=o||n.join(t,"AppData","Local");return n.join(s,"hermes","config.yaml")}return n.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)=>n.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"?n.join(r||n.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?n.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):n.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)=>{let r=n.join(t,".config","devin","mcp_config.json");return i.existsSync(r)?r:n.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)=>n.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 a=n.join(r||n.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(i.existsSync(a))return a;let p=n.join(t,".pi","agent","mcp.json");if(i.existsSync(p))return p;let c=n.join(t,".pi","mcp.json");return i.existsSync(c)?c:p}let o=n.join(t,".pi","agent","mcp.json");if(i.existsSync(o))return o;let s=n.join(t,".pi","mcp.json");return i.existsSync(s)?s:o},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=n.join(t,".qwenpaw","config.json");if(i.existsSync(r))return r;let o=n.join(t,".copaw","config.json");return i.existsSync(o)?o: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 o="";if(e==="win32"?o=n.join(r||n.join(t,"AppData","Roaming"),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):e==="darwin"?o=n.join(t,"Library","Application Support","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):o=n.join(t,".config","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),i.existsSync(o))return o;let s=n.join(t,".cline","data","settings","cline_mcp_settings.json");return i.existsSync(s)?s:o},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kilo:{name:"Kilo Code",aliases:["kilo","kilocode","kilo-code"],getConfigPath:(e,t)=>{let r=n.join(t,".config","kilo","kilo.jsonc");if(i.existsSync(r))return r;let o=n.join(t,".config","kilo","kilo.json");return i.existsSync(o)?o:r},type:"json-mcp",defaultConfig:(e,t)=>({type:"local",command:[e,...t],enabled:!0})},qoder:{name:"Qoder",aliases:["qoder"],getConfigPath:(e,t)=>n.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)=>n.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 o=n.join(r||n.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(i.existsSync(o))return o;let s=n.join(r||n.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return i.existsSync(s)?s:o}else if(e==="darwin"){let o=n.join(t,"Library","Application Support","Trae","User","mcp.json");if(i.existsSync(o))return o;let s=n.join(t,"Library","Application Support","Trae CN","User","mcp.json");return i.existsSync(s)?s:o}else{let o=n.join(t,".config","Trae","User","mcp.json");if(i.existsSync(o))return o;let s=n.join(t,".config","Trae CN","User","mcp.json");return i.existsSync(s)?s:o}},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})}};function _(e){return Object.prototype.toString.call(e)==="[object Object]"}function I(e,t=!1){if(!e)return"";if(!t)try{return JSON.parse(e),e}catch{}let r=e.length,o=[],s=!1,a=!1,p=!1,c=!1,m=-1;for(let f=0;f<r;f++){let u=e[f],h=f+1<r?e[f+1]:"";if(p){(u===`
3
- `||u==="\r")&&(p=!1,o.push(u));continue}if(c){u==="*"&&h==="/"&&(c=!1,f++);continue}if(s){o.push(u),a?a=!1:u==="\\"?a=!0:u==='"'&&(s=!1);continue}if(u==='"'){s=!0,a=!1,m=-1,o.push(u);continue}if(u==="/"&&h==="/"){p=!0,f++;continue}if(u==="/"&&h==="*"){c=!0,f++;continue}if(u===","){m=o.length,o.push(u);continue}if(u==="}"||u==="]"){m!==-1&&(o[m]=" ",m=-1),o.push(u);continue}u!==" "&&u!==" "&&u!==`
4
- `&&u!=="\r"&&(m=-1),o.push(u)}return o.join("")}var D=/\s/;function V(e){for(let t=1;t<e.length;t++){if(e[t]!=="#"||!D.test(e[t-1]))continue;let r=t-1;for(;r>0&&D.test(e[r-1]);)r--;return e.slice(r)}return""}function O(e,t,r,o=!1){let s=e?e.split(/\r?\n/):[],a=s.map((g,y)=>{let w=g.match(/^(\s*)mcp_servers:/);return w?{index:y,indent:w[1],tail:g.slice(w[0].length).trim()}:null}).filter(g=>g!==null);if(a.length>1)throw new Error("Cannot safely update YAML with duplicate mcp_servers keys");if(a.length===1){let g=a[0];if(g.indent!==""||g.tail!==""&&!g.tail.startsWith("#"))throw new Error("Cannot safely update YAML unless mcp_servers is a root-level block mapping")}let p=" ";if(a.length===1)for(let g=a[0].index+1;g<s.length;g++){if(s[g].trim()===""||s[g].trimStart().startsWith("#"))continue;if(/^[^\s]/.test(s[g]))break;let y=s[g].match(/^(\s+)[a-zA-Z0-9_-]+:/);y&&(p=y[1]);break}if(o){let g=[],y=!1,w=0,j=!1,v=0;for(let C=0;C<s.length;C++){let l=s[C],d=l.match(/^(\s*)mcp_servers:\s*(?:#.*)?$/);if(d){y=!0,w=d[1].length,g.push(l);continue}if(y){let S=l.match(/^(\s*)/)?.[1].length||0;if(l.trimStart().startsWith("#")){g.push(l);continue}if(l.trim()!==""&&S<=w)y=!1,j=!1;else{let k=l.match(/^(\s*)superpowers:\s*(?:#.*)?$/);if(k&&k[1]===p){j=!0,v=k[1].length;continue}if(j){if(S>v||l.trim()==="")continue;j=!1}}}g.push(l)}return g.join(`
5
- `)}let c=JSON.stringify(t),m=JSON.stringify(r),f=[`${p}superpowers:`,`${p}${p}command: ${c}`,`${p}${p}args: ${m}`];if(!e||e.trim()==="")return`mcp_servers:
2
+ "use strict";var J=Object.create;var A=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var V=(e,t)=>{for(var r in t)A(e,r,{get:t[r],enumerable:!0})},$=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of H(t))!F.call(e,s)&&s!==r&&A(e,s,{get:()=>t[s],enumerable:!(o=M(t,s))||o.enumerable});return e};var E=(e,t,r)=>(r=e!=null?J(K(e)):{},$(t||!e||!e.__esModule?A(r,"default",{value:e,enumerable:!0}):r,e)),z=e=>$(A({},"__esModule",{value:!0}),e);var Q={};V(Q,{HARNESS_CONFIGS:()=>b,JSON_SERVER_ROOT_KEYS:()=>I,isPlainObject:()=>P,runSetup:()=>L,runSetupCli:()=>R,safeWriteConfig:()=>U,stripJsonComments:()=>O,updateJsonConfig:()=>N,updateYamlConfig:()=>T});module.exports=z(Q);var i=E(require("fs")),n=E(require("path")),x=E(require("os")),W=E(require("crypto")),b={lmstudio:{name:"LM Studio",aliases:["lmstudio","lm-studio"],getConfigPath:(e,t)=>n.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 o=e==="win32"?r||n.join(t,"AppData","Roaming"):e==="darwin"?n.join(t,"Library","Application Support"):n.join(t,".config");return n.join(o,"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,o)=>e==="win32"?n.join(r||n.join(t,"AppData","Roaming"),"Code","User","mcp.json"):e==="darwin"?n.join(t,"Library","Application Support","Code","User","mcp.json"):n.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,o)=>e==="win32"?n.join(r||n.join(t,"AppData","Roaming"),"Code - Insiders","User","mcp.json"):e==="darwin"?n.join(t,"Library","Application Support","Code - Insiders","User","mcp.json"):n.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)=>n.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,o)=>{if(e==="win32"){let s=o||n.join(t,"AppData","Local");return n.join(s,"hermes","config.yaml")}return n.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)=>n.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"?n.join(r||n.join(t,"AppData","Roaming"),"Claude","claude_desktop_config.json"):e==="darwin"?n.join(t,"Library","Application Support","Claude","claude_desktop_config.json"):n.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)=>{let r=n.join(t,".config","devin","mcp_config.json");return i.existsSync(r)?r:n.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)=>n.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 a=n.join(r||n.join(t,"AppData","Roaming"),".pi","agent","mcp.json");if(i.existsSync(a))return a;let c=n.join(t,".pi","agent","mcp.json");if(i.existsSync(c))return c;let g=n.join(t,".pi","mcp.json");return i.existsSync(g)?g:c}let o=n.join(t,".pi","agent","mcp.json");if(i.existsSync(o))return o;let s=n.join(t,".pi","mcp.json");return i.existsSync(s)?s:o},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=n.join(t,".qwenpaw","config.json");if(i.existsSync(r))return r;let o=n.join(t,".copaw","config.json");return i.existsSync(o)?o: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 o="";if(e==="win32"?o=n.join(r||n.join(t,"AppData","Roaming"),"Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):e==="darwin"?o=n.join(t,"Library","Application Support","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"):o=n.join(t,".config","Code","User","globalStorage","saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),i.existsSync(o))return o;let s=n.join(t,".cline","data","settings","cline_mcp_settings.json");return i.existsSync(s)?s:o},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})},kilo:{name:"Kilo Code",aliases:["kilo","kilocode","kilo-code"],getConfigPath:(e,t)=>{let r=n.join(t,".config","kilo","kilo.jsonc");if(i.existsSync(r))return r;let o=n.join(t,".config","kilo","kilo.json");return i.existsSync(o)?o:r},type:"json-mcp",defaultConfig:(e,t)=>({type:"local",command:[e,...t],enabled:!0})},qoder:{name:"Qoder",aliases:["qoder"],getConfigPath:(e,t)=>n.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)=>n.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 o=n.join(r||n.join(t,"AppData","Roaming"),"Trae","User","mcp.json");if(i.existsSync(o))return o;let s=n.join(r||n.join(t,"AppData","Roaming"),"Trae CN","User","mcp.json");return i.existsSync(s)?s:o}else if(e==="darwin"){let o=n.join(t,"Library","Application Support","Trae","User","mcp.json");if(i.existsSync(o))return o;let s=n.join(t,"Library","Application Support","Trae CN","User","mcp.json");return i.existsSync(s)?s:o}else{let o=n.join(t,".config","Trae","User","mcp.json");if(i.existsSync(o))return o;let s=n.join(t,".config","Trae CN","User","mcp.json");return i.existsSync(s)?s:o}},type:"json-mcpServers",defaultConfig:(e,t)=>({command:e,args:t})}},I=["mcpServers","servers","mcp"];function P(e){return Object.prototype.toString.call(e)==="[object Object]"}function O(e,t=!1){if(!e)return"";if(!t)try{return JSON.parse(e),e}catch{}let r=e.length,o=[],s=!1,a=!1,c=!1,g=!1,h=-1;for(let f=0;f<r;f++){let p=e[f],d=f+1<r?e[f+1]:"";if(c){(p===`
3
+ `||p==="\r")&&(c=!1,o.push(p));continue}if(g){p==="*"&&d==="/"&&(g=!1,f++);continue}if(s){o.push(p),a?a=!1:p==="\\"?a=!0:p==='"'&&(s=!1);continue}if(p==='"'){s=!0,a=!1,h=-1,o.push(p);continue}if(p==="/"&&d==="/"){c=!0,f++;continue}if(p==="/"&&d==="*"){g=!0,f++;continue}if(p===","){h=o.length,o.push(p);continue}if(p==="}"||p==="]"){h!==-1&&(o[h]=" ",h=-1),o.push(p);continue}p!==" "&&p!==" "&&p!==`
4
+ `&&p!=="\r"&&(h=-1),o.push(p)}return o.join("")}var D=/\s/;function G(e){for(let t=1;t<e.length;t++){if(e[t]!=="#"||!D.test(e[t-1]))continue;let r=t-1;for(;r>0&&D.test(e[r-1]);)r--;return e.slice(r)}return""}function T(e,t,r,o=!1){let s=e?e.split(/\r?\n/):[],a=s.map((u,w)=>{let C=u.match(/^(\s*)mcp_servers:/);return C?{index:w,indent:C[1],tail:u.slice(C[0].length).trim()}:null}).filter(u=>u!==null);if(a.length>1)throw new Error("Cannot safely update YAML with duplicate mcp_servers keys");if(a.length===1){let u=a[0];if(u.indent!==""||u.tail!==""&&!u.tail.startsWith("#"))throw new Error("Cannot safely update YAML unless mcp_servers is a root-level block mapping")}let c=" ";if(a.length===1)for(let u=a[0].index+1;u<s.length;u++){if(s[u].trim()===""||s[u].trimStart().startsWith("#"))continue;if(/^[^\s]/.test(s[u]))break;let w=s[u].match(/^(\s+)\S/);w&&(c=w[1]);break}if(o){let u=[],w=!1,C=0,y=!1,S=0;for(let j=0;j<s.length;j++){let l=s[j],m=l.match(/^(\s*)mcp_servers:\s*(?:#.*)?$/);if(m){w=!0,C=m[1].length,u.push(l);continue}if(w){let v=l.match(/^(\s*)/)?.[1].length||0;if(l.trimStart().startsWith("#")){u.push(l);continue}if(l.trim()!==""&&v<=C)w=!1,y=!1;else{let k=l.match(/^(\s*)superpowers:\s*(?:#.*)?$/);if(k&&k[1]===c){y=!0,S=k[1].length;continue}if(y){if(v>S||l.trim()==="")continue;y=!1}}}u.push(l)}return u.join(`
5
+ `)}let g=JSON.stringify(t),h=JSON.stringify(r),f=[`${c}superpowers:`,`${c}${c}command: ${g}`,`${c}${c}args: ${h}`];if(!e||e.trim()==="")return`mcp_servers:
6
6
  ${f.join(`
7
7
  `)}
8
- `;let u=a.length===1?a[0].index:-1;if(u===-1)return`${e.trimEnd()}
8
+ `;let p=a.length===1?a[0].index:-1;if(p===-1)return`${e.trimEnd()}
9
9
 
10
10
  mcp_servers:
11
11
  ${f.join(`
12
12
  `)}
13
- `;let h=-1;for(let g=u+1;g<s.length;g++){let y=s[g];if(/^[^\s#]/.test(y))break;if((y.match(/^(\s*)/)?.[1]||"")===p&&/^\s+superpowers:\s*(?:#.*)?$/.test(y)){h=g;break}}if(h!==-1){let g=s[h].match(/^(\s*)/)?.[1].length||2,y=h+1;for(;y<s.length;){let w=s[y];if((w.match(/^(\s*)/)?.[1].length||0)>g||w.trim()==="")y++;else break}return f[0]+=V(s[h]),s.splice(h,y-h,...f),s.join(`
14
- `)}else return s.splice(u+1,0,...f),s.join(`
15
- `)}function T(e,t,r,o,s=!1,a){let p={};if(e&&e.trim()!=="")try{let f=JSON.parse(e);if(!_(f))throw new Error("Existing JSON root must be an object");p=f}catch{try{let u=I(e,!0),h=JSON.parse(u);if(!_(h))throw new Error("Existing JSON root must be an object");p=h}catch(u){let h=u instanceof Error?u.message:String(u);throw new Error(`Failed to parse existing JSON: ${h}`)}}let c="mcpServers";if(t==="json-servers"?c="servers":t==="json-mcp"&&(c="mcp"),p[c]!==void 0&&!_(p[c]))throw new Error(`Existing JSON field "${c}" must be an object`);p[c]===void 0&&(p[c]={});let m=p[c];return s?delete m.superpowers:a?m.superpowers=a:t==="json-servers"?m.superpowers={command:r,args:o,type:"stdio"}:t==="json-mcp"?m.superpowers={type:"local",command:[r,...o],enabled:!0}:m.superpowers={command:r,args:o},JSON.stringify(p,null,2)+`
16
- `}function N(e,t,r=!1,o=[],s){if(o.length===0)throw new Error("safeWriteConfig requires at least one allowed destination root");let a=e;try{let l=i.lstatSync(e,{throwIfNoEntry:!1});if(l&&l.isSymbolicLink()){try{a=i.realpathSync(e)}catch{let U=i.readlinkSync(e);a=n.resolve(n.dirname(e),U)}let d=n.normalize(n.resolve(a)).toLowerCase(),S=n.normalize(n.resolve(x.tmpdir())).toLowerCase();if(!(d===S||d.startsWith(S+n.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(E=>d===E||d.startsWith(E+n.sep))||d==="/var"||d.startsWith("/var"+n.sep)&&!d.startsWith("/var/folders"+n.sep)||d==="/private/var"||d.startsWith("/private/var"+n.sep)&&!d.startsWith("/private/var/folders"+n.sep)))throw new Error(`Refusing to write to unsafe symlink target: ${a}`)}}catch(l){if(l instanceof Error&&l.message.includes("Refusing to write to unsafe symlink target"))throw l}let p=n.dirname(a);i.existsSync(p)||i.mkdirSync(p,{recursive:!0,mode:448});let c=i.realpathSync(p),m=i.statSync(c);a=n.join(c,n.basename(a));let f=n.normalize(n.resolve(a)).toLowerCase(),u=n.normalize(n.resolve(x.tmpdir())).toLowerCase(),h=f===u||f.startsWith(u+n.sep),y=["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(l=>f===l||f.startsWith(l+n.sep))||f==="/var"||f.startsWith("/var"+n.sep)&&!f.startsWith("/var/folders"+n.sep)||f==="/private/var"||f.startsWith("/private/var"+n.sep)&&!f.startsWith("/private/var/folders"+n.sep);if(!h&&y)throw new Error(`Refusing to write to unsafe configuration target: ${a}`);if(!o.some(l=>{if(!l)return!1;let d=n.resolve(l);try{d=i.realpathSync(d)}catch{}let S=n.relative(d,a);return S!==".."&&!S.startsWith(`..${n.sep}`)&&!n.isAbsolute(S)}))throw new Error(`Refusing to write configuration outside allowed roots: ${a}`);let j=384;if(i.existsSync(a)){try{j=i.statSync(a).mode}catch{}if(r){let l=i.readFileSync(a,"utf8"),d=`${a}.${Date.now()}.bak`;try{i.writeFileSync(d,l,{encoding:"utf8",mode:j})}catch(S){let k=S instanceof Error?S.message:String(S);throw new Error(`Failed to create safe backup before write: ${k}`)}}}let v=W.randomBytes(8).toString("hex"),C=n.join(c,`.tmp.${n.basename(a)}.${process.pid}.${v}`);try{i.writeFileSync(C,t,{encoding:"utf8",mode:j,flag:"wx"});let l=i.existsSync(a);if(s===null&&l)throw new Error("Configuration changed concurrently before it could be created");if(s!=null&&(!l||i.readFileSync(a,"utf8")!==s))throw new Error("Configuration changed concurrently; refusing to overwrite newer content");let d=i.realpathSync(p),S=i.statSync(d);if(d!==c||S.dev!==m.dev||S.ino!==m.ino)throw new Error("Configuration directory changed while writing");i.renameSync(C,a)}catch(l){try{i.existsSync(C)&&i.unlinkSync(C)}catch{}throw l}}async function L(e={}){let t=e.platform||x.platform(),r=e.homeDir||x.homedir(),o=e.appData||process.env.APPDATA,s=e.localAppData||process.env.LOCALAPPDATA,a=!!e.dryRun,p=!!e.remove,c=!!e.bun,m=e.target?e.target.toLowerCase():null,f=c?"bunx":"npx",u=["-y","superpowers-mcp"],h=[];if(!m)throw new Error(`No target client specified. Please specify which client to configure using --target <${Object.keys(b).join("|")}>.`);let g=Object.keys(b).find(w=>w===m||b[w].aliases.includes(m));if(!g)throw new Error(`Unknown harness target: "${m}". Supported targets: ${Object.keys(b).join(", ")}`);let y=[g];for(let w of y){let j=b[w],v=j.getConfigPath(t,r,o,s),C=i.existsSync(v);if(p&&!C){h.push({target:w,name:j.name,path:v,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let l="";C&&(l=i.readFileSync(v,"utf8"));let d="";if(j.type==="yaml")d=O(l,f,u,p);else{let S=typeof j.defaultConfig=="function"?j.defaultConfig(f,u):void 0;d=T(l,j.type,f,u,p,S)}if(l.trim()===d.trim()&&C){h.push({target:w,name:j.name,path:v,status:"up-to-date",message:p?"Already not configured":"Already configured and up-to-date"});continue}a||N(v,d,!!e.backup,[r,o||"",s||""],C?l:null),h.push({target:w,name:j.name,path:v,status:p?"removed":C?"updated":"created",message:a?`[Dry Run] Would ${p?"remove from":C?"update":"create"} ${v}`:`Successfully ${p?"removed from":C?"updated":"configured"}!`})}catch(l){let d=l instanceof Error?l.message:String(l);h.push({target:w,name:j.name,path:v,status:"error",message:d})}}return h}async function $(e=process.argv.slice(2)){let t=!1,r={dryRun:!1,remove:!1,bun:!1,backup:!1,target:null};for(let o=0;o<e.length;o++){let s=e[o];if(!(s==="setup"||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 a=e[o+1];(!a||a.startsWith("-"))&&(console.error(`\u274C Error: Missing value for --target flag.
17
- `),process.exit(1)),r.target=e[++o]}else if(s.startsWith("--target=")){let a=s.split("=")[1];a||(console.error(`\u274C Error: Missing value for --target flag.
18
- `),process.exit(1)),r.target=a}else if(s==="--help"||s==="-h"){G();return}else!s.startsWith("-")&&!r.target&&s!=="setup"?r.target=s:s.startsWith("-")&&(console.error(`\u274C Error: Unknown option "${s}". Use --help for usage.
19
- `),process.exit(1))}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(`
13
+ `;let d=-1;for(let u=p+1;u<s.length;u++){let w=s[u];if(/^[^\s#]/.test(w))break;if((w.match(/^(\s*)/)?.[1]||"")===c&&/^\s+["']?superpowers["']?\s*:\s*(?:#.*)?$/.test(w)){d=u;break}}if(d!==-1){let u=s[d].match(/^(\s*)/)?.[1].length||2,w=d+1;for(;w<s.length;){let S=s[w];if((S.match(/^(\s*)/)?.[1].length||0)>u||S.trim()==="")w++;else break}let C=[],y=-1;for(let S=d+1;S<w;S++){let j=s[S];if(j.trim()==="")continue;let l=j.match(/^(\s*)/)?.[1].length??0;if(!(y!==-1&&l>y)){if(y=-1,l>u&&/^\s*["']?(?:command|args)["']?\s*:/.test(j)){y=l;continue}C.push(j)}}return f[0]+=G(s[d]),s.splice(d,w-d,...f,...C),s.join(`
14
+ `)}else return s.splice(p+1,0,...f),s.join(`
15
+ `)}function N(e,t,r,o,s=!1,a){let c={};if(e&&e.trim()!=="")try{let p=JSON.parse(e);if(!P(p))throw new Error("Existing JSON root must be an object");c=p}catch{try{let d=O(e,!0),u=JSON.parse(d);if(!P(u))throw new Error("Existing JSON root must be an object");c=u}catch(d){let u=d instanceof Error?d.message:String(d);throw new Error(`Failed to parse existing JSON: ${u}`)}}let g=t==="json-servers"?"servers":t==="json-mcp"?"mcp":"mcpServers",h=I.find(p=>P(c[p])&&c[p].superpowers!==void 0)??g;if(c[h]!==void 0&&!P(c[h]))throw new Error(`Existing JSON field "${h}" must be an object`);c[h]===void 0&&(c[h]={});let f=c[h];if(s)delete f.superpowers;else{let p;a?p={...a}:t==="json-servers"?p={command:r,args:o,type:"stdio"}:t==="json-mcp"?p={type:"local",command:[r,...o],enabled:!0}:p={command:r,args:o};let d=f.superpowers;if(!P(d))f.superpowers=p;else{let u={...d,...p};(d.enabled!==void 0||d.disabled!==void 0)&&(d.enabled!==void 0?u.enabled=d.enabled:delete u.enabled),t==="json-mcp"&&Array.isArray(u.command)&&delete u.args,f.superpowers=u}}return JSON.stringify(c,null,2)+`
16
+ `}function U(e,t,r=!1,o=[],s){if(o.length===0)throw new Error("safeWriteConfig requires at least one allowed destination root");let a=e;try{let l=i.lstatSync(e,{throwIfNoEntry:!1});if(l&&l.isSymbolicLink()){try{a=i.realpathSync(e)}catch{let q=i.readlinkSync(e);a=n.resolve(n.dirname(e),q)}let m=n.normalize(n.resolve(a)).toLowerCase(),v=n.normalize(n.resolve(x.tmpdir())).toLowerCase();if(!(m===v||m.startsWith(v+n.sep))&&(["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(_=>m===_||m.startsWith(_+n.sep))||m==="/var"||m.startsWith("/var"+n.sep)&&!m.startsWith("/var/folders"+n.sep)||m==="/private/var"||m.startsWith("/private/var"+n.sep)&&!m.startsWith("/private/var/folders"+n.sep)))throw new Error(`Refusing to write to unsafe symlink target: ${a}`)}}catch(l){if(l instanceof Error&&l.message.includes("Refusing to write to unsafe symlink target"))throw l}let c=n.dirname(a);i.existsSync(c)||i.mkdirSync(c,{recursive:!0,mode:448});let g=i.realpathSync(c),h=i.statSync(g);a=n.join(g,n.basename(a));let f=n.normalize(n.resolve(a)).toLowerCase(),p=n.normalize(n.resolve(x.tmpdir())).toLowerCase(),d=f===p||f.startsWith(p+n.sep),w=["/etc","/bin","/sbin","/usr","/root","/sys","/proc","/dev","/private/etc","c:\\windows"].some(l=>f===l||f.startsWith(l+n.sep))||f==="/var"||f.startsWith("/var"+n.sep)&&!f.startsWith("/var/folders"+n.sep)||f==="/private/var"||f.startsWith("/private/var"+n.sep)&&!f.startsWith("/private/var/folders"+n.sep);if(!d&&w)throw new Error(`Refusing to write to unsafe configuration target: ${a}`);if(!o.some(l=>{if(!l)return!1;let m=n.resolve(l);try{m=i.realpathSync(m)}catch{}let v=n.relative(m,a);return v!==".."&&!v.startsWith(`..${n.sep}`)&&!n.isAbsolute(v)}))throw new Error(`Refusing to write configuration outside allowed roots: ${a}`);let y=384;if(i.existsSync(a)){try{y=i.statSync(a).mode}catch{}if(r){let l=i.readFileSync(a,"utf8"),m=`${a}.${Date.now()}.bak`;try{i.writeFileSync(m,l,{encoding:"utf8",mode:y})}catch(v){let k=v instanceof Error?v.message:String(v);throw new Error(`Failed to create safe backup before write: ${k}`)}}}let S=W.randomBytes(8).toString("hex"),j=n.join(g,`.tmp.${n.basename(a)}.${process.pid}.${S}`);try{i.writeFileSync(j,t,{encoding:"utf8",mode:y,flag:"wx"});let l=i.existsSync(a);if(s===null&&l)throw new Error("Configuration changed concurrently before it could be created");if(s!=null&&(!l||i.readFileSync(a,"utf8")!==s))throw new Error("Configuration changed concurrently; refusing to overwrite newer content");let m=i.realpathSync(c),v=i.statSync(m);if(m!==g||v.dev!==h.dev||v.ino!==h.ino)throw new Error("Configuration directory changed while writing");i.renameSync(j,a)}catch(l){try{i.existsSync(j)&&i.unlinkSync(j)}catch{}throw l}}async function L(e={}){let t=e.platform||x.platform(),r=e.homeDir||x.homedir(),o=e.appData||process.env.APPDATA,s=e.localAppData||process.env.LOCALAPPDATA,a=!!e.dryRun,c=!!e.remove,g=!!e.bun,h=e.target?e.target.toLowerCase():null,f=g?"bunx":"npx",p=["-y","superpowers-mcp"],d=[];if(!h)throw new Error(`No target client specified. Please specify which client to configure using --target <${Object.keys(b).join("|")}>.`);let u=Object.keys(b).find(C=>C===h||b[C].aliases.includes(h));if(!u)throw new Error(`Unknown harness target: "${h}". Supported targets: ${Object.keys(b).join(", ")}`);let w=[u];for(let C of w){let y=b[C],S=y.getConfigPath(t,r,o,s),j=i.existsSync(S);if(c&&!j){d.push({target:C,name:y.name,path:S,status:"up-to-date",message:"Already not configured (file does not exist)"});continue}try{let l="";j&&(l=i.readFileSync(S,"utf8"));let m="";if(y.type==="yaml")m=T(l,f,p,c);else{let v=typeof y.defaultConfig=="function"?y.defaultConfig(f,p):void 0;m=N(l,y.type,f,p,c,v)}if(l.trim()===m.trim()&&j){d.push({target:C,name:y.name,path:S,status:"up-to-date",message:c?"Already not configured":"Already configured and up-to-date"});continue}a||U(S,m,!!e.backup,[r,o||"",s||""],j?l:null),d.push({target:C,name:y.name,path:S,status:c?"removed":j?"updated":"created",message:a?`[Dry Run] Would ${c?"remove from":j?"update":"create"} ${S}`:`Successfully ${c?"removed from":j?"updated":"configured"}!`})}catch(l){let m=l instanceof Error?l.message:String(l);d.push({target:C,name:y.name,path:S,status:"error",message:m})}}return d}async function R(e=process.argv.slice(2)){let t=!1,r={dryRun:!1,remove:!1,bun:!1,backup:!1,target:null};for(let o=0;o<e.length;o++){let s=e[o];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 a=e[o+1];if(!a||a.startsWith("-")){console.error(`\u274C Error: Missing value for --target flag.
17
+ `),process.exitCode=1;return}r.target=e[++o]}else if(s.startsWith("--target=")){let a=s.split("=")[1];if(!a){console.error(`\u274C Error: Missing value for --target flag.
18
+ `),process.exitCode=1;return}r.target=a}else if(s==="--help"||s==="-h"){Y();return}else if(s.startsWith("-")){console.error(`\u274C Error: Unknown option "${s}". Use --help for usage.
19
+ `),process.exitCode=1;return}else if(!r.target)r.target=s;else{console.error(`\u274C Error: Unexpected argument "${s}". Use --help for usage.
20
+ `),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(`
20
21
  ========================================================`),console.log("\u26A1 Superpowers MCP - Targeted Client Setup"),console.log(`========================================================
21
22
  `),!r.target){console.log(`Please select which AI Agent client you would like to configure:
22
23
  `),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)
23
24
  `),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.
24
25
  `),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.
25
- `);return}try{let o=await L(r),s=0,a=0,p=0;for(let c of o){let m=c.status==="created"||c.status==="updated"||c.status==="removed"?"\u2705":c.status==="up-to-date"?"\u2728":c.status==="skipped"?"\u23ED\uFE0F ":"\u274C";console.log(`${m} [${c.name}] (${c.status})`),console.log(` Path: ${c.path}`),console.log(` Info: ${c.message}
26
- `),c.status==="created"||c.status==="updated"||c.status==="up-to-date"||c.status==="removed"?s++:c.status==="skipped"?a++:c.status==="error"&&p++}console.log("--------------------------------------------------------"),p>0&&(console.error(`\u26A0\uFE0F Setup finished with errors: ${p} failure(s), ${s} succeeded.`),process.exit(1)),console.log(`\u{1F389} Setup complete! ${s} environment(s) ready.`)}catch(o){let s=o instanceof Error?o.message:String(o);console.error(`\u274C Setup failed: ${s}
27
- `),process.exit(1)}}function G(){console.log(`
26
+ `),process.exitCode=1;return}try{let o=await L(r),s=0,a=0,c=0;for(let g of o){let h=g.status==="created"||g.status==="updated"||g.status==="removed"?"\u2705":g.status==="up-to-date"?"\u2728":g.status==="skipped"?"\u23ED\uFE0F ":"\u274C";console.log(`${h} [${g.name}] (${g.status})`),console.log(` Path: ${g.path}`),console.log(` Info: ${g.message}
27
+ `),g.status==="created"||g.status==="updated"||g.status==="up-to-date"||g.status==="removed"?s++:g.status==="skipped"?a++:g.status==="error"&&c++}if(console.log("--------------------------------------------------------"),c>0){console.error(`\u26A0\uFE0F Setup finished with errors: ${c} failure(s), ${s} succeeded.`),process.exitCode=1;return}console.log(`\u{1F389} Setup complete! ${s} environment(s) ready.`)}catch(o){let s=o instanceof Error?o.message:String(o);console.error(`\u274C Setup failed: ${s}
28
+ `),process.exitCode=1}}function Y(){console.log(`
28
29
  Superpowers MCP - Targeted Global Setup
29
30
 
30
31
  Usage:
@@ -68,4 +69,4 @@ Any Directory:
68
69
  Privacy & Safety:
69
70
  Superpowers MCP only touches the client you explicitly choose.
70
71
  It never bulk-modifies your environment without your consent.
71
- `)}$().catch(e=>{let t=e instanceof Error?e.message:String(e);console.error(`\u274C Fatal error: ${t}`),process.exit(1)});0&&(module.exports={HARNESS_CONFIGS,isPlainObject,runSetup,runSetupCli,safeWriteConfig,stripJsonComments,updateJsonConfig,updateYamlConfig});
72
+ `)}R().catch(e=>{let t=e instanceof Error?e.message:String(e);console.error(`\u274C Fatal error: ${t}`),process.exitCode=1});0&&(module.exports={HARNESS_CONFIGS,JSON_SERVER_ROOT_KEYS,isPlainObject,runSetup,runSetupCli,safeWriteConfig,stripJsonComments,updateJsonConfig,updateYamlConfig});
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "superpowers-mcp",
3
3
  "displayName": "Superpowers MCP",
4
4
  "description": "Superpowers skills library (TDD, debugging, collaboration workflows) as an MCP server for VSCode and Antigravity",
5
- "version": "6.3.9",
5
+ "version": "6.4.1",
6
6
  "engines": {
7
7
  "node": ">=18"
8
8
  },
@@ -47,7 +47,7 @@
47
47
  "build": "node esbuild.js --production",
48
48
  "watch": "node esbuild.js --watch",
49
49
  "pretest": "npm run build",
50
- "test": "node tests/edge_cases_test.js && node tests/run_test.js && node tests/brainstorm_server_test.js && node tests/prompts_compositions_test.js && node tests/upstream_sync_test.js && node tests/mcp_coverage_test.js && node tests/drift_test.js && node tests/setup_test.js",
50
+ "test": "node tests/edge_cases_test.js && node tests/run_test.js && node tests/brainstorm_server_test.js && node tests/prompts_compositions_test.js && node tests/upstream_sync_test.js && node tests/mcp_coverage_test.js && node tests/drift_test.js && node tests/setup_test.js && bash tests/executing-plans/test-task-start.sh && bash tests/executing-plans/test-task-done.sh",
51
51
  "drift": "node scripts/upstream-drift.js --fetch",
52
52
  "drift:record": "node scripts/upstream-drift.js --record",
53
53
  "prepublishOnly": "npm run build"
@@ -35,7 +35,7 @@ The server watches a directory for HTML files and serves the newest one to the b
35
35
  ```bash
36
36
  # Start AFTER the user approves the companion. --open auto-opens their browser on
37
37
  # the first screen; --project-dir persists mockups and enables same-port restart.
38
- scripts/start-server.sh --project-dir /path/to/project --open
38
+ bash scripts/start-server.sh --project-dir /path/to/project --open
39
39
 
40
40
  # Windows PowerShell:
41
41
  scripts/start-server.ps1 --project-dir C:\path\to\project --open
@@ -68,7 +68,7 @@ a restarted server requires the new URL.
68
68
  **Claude Code:**
69
69
  ```bash
70
70
  # Default mode works — the script backgrounds the server itself.
71
- scripts/start-server.sh --project-dir /path/to/project --open
71
+ bash scripts/start-server.sh --project-dir /path/to/project --open
72
72
  ```
73
73
 
74
74
  On Windows, the script auto-detects and switches to foreground mode (which blocks the tool call). Use `run_in_background: true` on the Bash tool call so the server survives across conversation turns, then read `$STATE_DIR/server-info` on the next turn to get the URL and port.
@@ -79,14 +79,14 @@ For native PowerShell, use `scripts/start-server.ps1` with the same flags. It wr
79
79
  ```bash
80
80
  # Codex reaps background processes. The script auto-detects CODEX_CI and
81
81
  # switches to foreground mode. Run it normally — no extra flags needed.
82
- scripts/start-server.sh --project-dir /path/to/project --open
82
+ bash scripts/start-server.sh --project-dir /path/to/project --open
83
83
  ```
84
84
 
85
85
  **Gemini CLI:**
86
86
  ```bash
87
87
  # Use --foreground and set is_background: true on your shell tool call
88
88
  # so the process survives across turns
89
- scripts/start-server.sh --project-dir /path/to/project --open --foreground
89
+ bash scripts/start-server.sh --project-dir /path/to/project --open --foreground
90
90
  ```
91
91
 
92
92
  **Copilot CLI:**
@@ -94,7 +94,7 @@ scripts/start-server.sh --project-dir /path/to/project --open --foreground
94
94
  # Use --foreground and start the server via the bash tool with mode: "async"
95
95
  # so the process survives across turns. Capture the returned shellId for
96
96
  # read_bash / stop_bash if you need to interact with it later.
97
- scripts/start-server.sh --project-dir /path/to/project --open --foreground
97
+ bash scripts/start-server.sh --project-dir /path/to/project --open --foreground
98
98
  ```
99
99
 
100
100
  **Other environments:** The server must keep running in the background across conversation turns. If your environment reaps detached processes, use `--foreground` and launch the command with your platform's background execution mechanism.
@@ -289,7 +289,7 @@ If `$STATE_DIR/events` doesn't exist, the user didn't interact with the browser
289
289
  ## Cleaning Up
290
290
 
291
291
  ```bash
292
- scripts/stop-server.sh $SESSION_DIR
292
+ bash scripts/stop-server.sh $SESSION_DIR
293
293
 
294
294
  # Windows PowerShell:
295
295
  scripts/stop-server.ps1 $SESSION_DIR
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: diagnosing-superpowers
3
+ description: Use when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.
4
+ ---
5
+
6
+ # Diagnosing Superpowers
7
+
8
+ ## Overview
9
+
10
+ Pin down with your human partner what went wrong in a session, read the
11
+ transcripts on disk, and report what happened with evidence. You report;
12
+ you do not diagnose superpowers. Whoever triages the bundle or the issue
13
+ decides whether superpowers changes.
14
+
15
+ **Core principle:** Every finding cites `path:line`. No citation, no
16
+ finding. Every number comes from the transcript or from a command you ran,
17
+ never from memory.
18
+
19
+ ## Workflow
20
+
21
+ Create a todo per step. Steps 5–7 run only on their stated condition.
22
+
23
+ 1. **Problem intake.** Ask one question at a time until you can write a
24
+ statement naming the session(s), the turn range if known, what your
25
+ partner expected, what happened, and the observable they care about
26
+ (wall-clock, tokens, repeated actions, one specific action). "It took
27
+ too long" is a complaint, not a problem statement. Note whether the
28
+ goal is a superpowers bug report.
29
+ 2. **Locate.** Resolve each session to verified absolute filesystem paths using
30
+ `references/session-discovery.md`. Confirm a past session by quoting its
31
+ first prompt and timestamp, and list every candidate you rejected with the
32
+ reason, or "none". Enumerate subagent transcripts. Create
33
+ `~/.superpowers/diagnosing-superpowers/<session-id>/`, tell your
34
+ partner the path, and fill `templates/case.md` there, following its
35
+ provenance rules for environment and skill observations.
36
+ 3. **Triage.** Read the region around the reported problem yourself. Then
37
+ dispatch one analyst subagent per dimension in parallel, each given the
38
+ case file path, `prompts/analyst-common.md`, and one dimension file from
39
+ `prompts/`: `skill-timeline.md`,
40
+ `plan-adherence.md`, `repeated-work.md`, `stumbles.md`,
41
+ `quality-evidence.md`, `request-conflicts.md`, `cost-and-time.md`.
42
+ Split a dimension by turn range when the transcript is long. Discard
43
+ any returned finding without `path:line`.
44
+ 4. **Report.** Fill every section of `templates/report.md` in order, write
45
+ it to the workspace, show it, and give the path. Check what cited content
46
+ actually proves and preserve the supporting case; a symlink alias is not a
47
+ redundant copy.
48
+ 5. **GitHub issues** — when report §7 says possible or likely, or your
49
+ partner asks. Search open and closed issues for the symptoms per
50
+ `references/github-issues.md`. Show matches and suggest adding the
51
+ report to the closest. If none match, fill `templates/issue.md`, write
52
+ it to the workspace, show the exact text, and create the issue only
53
+ after approval. `gh` cannot attach files; if a bundle exists, give
54
+ your partner its path to attach in the browser.
55
+ 6. **Export** — only when your partner asks for a bundle; never build one
56
+ unprompted. If the intake goal was a bug report, say once that a
57
+ scrubbed bundle is available on request, then wait. Ask the redaction
58
+ level, stating what each includes: skeleton (no tool-result bodies),
59
+ evidence (bodies only for cited events), full. Build the bundle per
60
+ `templates/bundle-README.md`, dispatch `prompts/scrub.md`, then
61
+ `prompts/scrub-audit.md`, repeating both until the audit returns CLEAN.
62
+ Complete the bundle template's evidence check and reconciliation before
63
+ showing the final scrub log, file list, and privacy and evidence outcomes.
64
+ Archive (`zip -r` or `tar -czf`) only after approval. With the archive
65
+ path, state what it contains, point at the scrub log for replacements, and
66
+ say scrubbing can miss things: they must review every file before sharing.
67
+ 7. **Similar sessions** — when asked. Turn confirmed findings into a
68
+ signature, list candidates by mtime and size, find marker line numbers,
69
+ dispatch `prompts/similar-session.md` per candidate in parallel, and
70
+ append report §9.
71
+
72
+ ## Quick reference
73
+
74
+ All seven analysts always run. This table says which region to read
75
+ yourself in step 3 and which findings to lead with in the verdict.
76
+
77
+ | Complaint | Read first, lead with |
78
+ |---|---|
79
+ | "It took too long" | cost-and-time, stumbles |
80
+ | "Why did it do this extra work?" | repeated-work, plan-adherence |
81
+ | "Why is it so expensive?" | cost-and-time |
82
+ | "What the hell is it doing?" (still running) | skill-timeline; note in-progress in coverage |
83
+ | "It ignored the plan" | plan-adherence, compaction lines first |
84
+ | "Skill X never fired" | skill-timeline |
85
+
86
+ ## Hard rules
87
+
88
+ - **Context safety.** One transcript line can be a megabyte. Follow
89
+ `references/context-safety.md` on every session file, every time.
90
+ - **Read-only.** Never modify, move, or delete a session file.
91
+ - **Exact paths to subagents.** A subagent's "current session" is its
92
+ own. Pass absolute paths and ids.
93
+ - **Human prompts only.** Hook output, system reminders, and tool results
94
+ are not your partner's words. In a subagent transcript, "user" is the
95
+ parent agent.
96
+ - **No superpowers diagnosis.** Report §7 states involvement and stops.
97
+ Never name a defect in a skill or propose a change. Your partner
98
+ pressing for a fix does not waive this; point at the issue step and
99
+ mention that a bundle is available on request. No advice to your
100
+ partner either.
101
+ - **Approval gates.** No archive before your partner has seen the scrub
102
+ log and file list. No issue or comment before they approve the exact
103
+ text.
104
+ - **Intake before analysis.** Nothing in steps 2–7 starts until your
105
+ partner has answered. If they are away, write the questions and stop.
106
+ A statement you reconstructed for them is not an answer. An
107
+ already-scoped request — one specific event, what is running now, or
108
+ the analysis to run — is itself the statement: answer it, then ask.
109
+ A whole-session "why" is a complaint.
110
+
111
+ ## Red Flags
112
+
113
+ | Thought | Reality |
114
+ |---------|---------|
115
+ | "The problem is obvious, skip intake" | The problem statement scopes everything. Ask. |
116
+ | "They're away, so I'll reconstruct the statement" | You cannot reconstruct what they wanted. Write the questions and stop. |
117
+ | "I'll sweep everything now and ask at the end" | An unscoped sweep spends their budget on the wrong question. Ask first. |
118
+ | "They want a bug report, so I'll build the bundle now" | The bundle is their session data, packaged. Build it only when they ask for it. |
119
+ | "Small, targeted edit, no restructuring needed" | Not your call, however small. Report the evidence; the triager decides. |
120
+ | "The price per token is well known" | Numbers you did not compute from the transcript are invented. Cite or drop. |
@@ -0,0 +1,38 @@
1
+ You are an analyst subagent. You read a coding-agent session transcript on
2
+ disk and return findings with evidence. You do not fix anything, you do not
3
+ modify any file under the session store, and you do not say what
4
+ superpowers should change.
5
+
6
+ Inputs (from your dispatcher):
7
+ - CASE: absolute path of the case file. Read it first. It names the session
8
+ files, the discovered sources and record meanings to use, and the
9
+ context-safety rules you must follow. Use the recorded meanings rather than
10
+ repeating discovery or assuming a harness format.
11
+ - RANGE (optional): a turn range or line range. If present, analyze only
12
+ that range and say so in your Checked line.
13
+
14
+ Context safety: follow `references/context-safety.md`, named in CASE, on
15
+ every file before reading it, and extract fields with the recorded commands or
16
+ queries. "The current session" is not a thing you can look at: use only the
17
+ paths in CASE.
18
+
19
+ Human prompts are the records the case file identifies as human-typed. Hook
20
+ output, system reminders, and tool results are not human prompts. In a subagent
21
+ transcript, "user" is the parent agent.
22
+
23
+ Return format (nothing else):
24
+
25
+ ```
26
+ ## <Dimension> findings
27
+
28
+ - finding: <one sentence, what happened>
29
+ evidence: <absolute path>:<line> — "<quote, at most 200 characters>"
30
+ turns: <first human turn>–<last human turn>
31
+ confidence: high | medium | low
32
+
33
+ Checked: <what you examined: files, line ranges, commands used>
34
+ ```
35
+
36
+ The dispatcher discards any finding without a `path:line`, so do not
37
+ write one. If you found nothing, return `- none found` and the Checked
38
+ line.
@@ -0,0 +1,28 @@
1
+ Read `prompts/analyst-common.md` first; it gives your role, inputs,
2
+ context-safety rules, and the return format. This file adds the dimension.
3
+
4
+ Dimension: Cost and time
5
+
6
+ Account for where tokens and wall-clock went.
7
+
8
+ 1. Tokens. Use only the usage records and counter meanings established in the
9
+ case file. State whether each counter is incremental or cumulative before
10
+ calculating totals; difference cumulative observations without turning a
11
+ missing observation into zero. Report the five turns with the largest
12
+ supported totals and the supported totals per associated session.
13
+ 2. Wall-clock. Use the evidenced timestamp fields, event boundaries, and units
14
+ recorded in the case file. Report the five longest supported turns and any
15
+ gap longer than ten minutes between consecutive events (idle, waiting on an
16
+ associated session, or waiting on your human partner; say which only when
17
+ the records show it).
18
+ 3. Largest tool results: use the case file's evidenced tool-result records to
19
+ report the ten largest results with their tool and turn. Measure records
20
+ before extracting bounded content.
21
+ 4. Compactions: count and locate records whose meaning as compaction events was
22
+ established during discovery. Report available before/after counters and
23
+ what the session was doing when each fired; mark unsupported fields absent.
24
+ 5. Associated sessions: count them and report supported usage, duration, and
25
+ dispatching turn for each.
26
+ 6. Report the turns, subagents, tools, or repeats that dominate the
27
+ totals, with numbers. Do not speculate about why a
28
+ turn was expensive beyond what the transcript shows.