@complexthings/superpowers-agent 8.2.0 → 8.2.2

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.
@@ -0,0 +1,62 @@
1
+ # Post-Migration Fixes — Round Three
2
+
3
+ You are working in an agentic coding environment with access to file system tools, web fetching, subagents, and skills.
4
+
5
+ ## Objective
6
+
7
+ Fix the double `.git` suffix bug in the `add` command's repository cloning logic.
8
+
9
+ **TARGET_VERSION: 8.2.2**
10
+
11
+ ## Problem
12
+
13
+ When a repository URL already ends in `.git`, the clone step appends `.git` again, producing an invalid URL:
14
+ ```
15
+ Input: https://github.com/BlueAcornInc/skills.git
16
+ Cloned: https://github.com/BlueAcornInc/skills.git.git ← broken
17
+ ```
18
+
19
+ This breaks `superpowers-agent add @baici` after `superpowers-agent add-repository` registers a `.git`-suffixed URL.
20
+
21
+ ## Phase 1 — Discover
22
+
23
+ Before writing or modifying anything:
24
+
25
+ 1. Read `~/.agents/config.json` — understand how repository URLs and aliases are stored. Note if a previously registered repo with the bad URL is already present (this will interfere with testing).
26
+ 2. Read the `add-repository` command implementation — understand how it stores the repository URL.
27
+ 3. Read the `add` command implementation — trace the full path from alias resolution → URL construction → `git clone` invocation. Identify exactly where `.git` is appended.
28
+ 4. Check for any other commands that construct Git clone URLs — the same bug may exist elsewhere.
29
+
30
+ ## Phase 2 — Fix
31
+
32
+ 1. Fix the URL construction so it does not append `.git` if the URL already ends with `.git`.
33
+ 2. Apply the same fix to any other code paths identified in Phase 1 that construct clone URLs.
34
+ 3. Ensure URLs without `.git` suffix still work correctly (both forms are valid Git URLs).
35
+
36
+ ## Phase 3 — Verify
37
+
38
+ 1. Before testing, check `~/.agents/config.json` for any stale or malformed repository entries from previous failed attempts. Remove them if present so they don't interfere with validation.
39
+ 2. Confirm the clone URL is correct for inputs both with and without `.git` suffix.
40
+ 3. Search the codebase for any other instances of `.git` suffix appending that could produce the same bug.
41
+ 4. Set version to `8.2.2` in both `./package.json` and `.agents/package.json`.
42
+
43
+ ## Known Testing Gotcha
44
+
45
+ `~/.agents/config.json` persists previously registered repositories. If a repo was added before this fix, the stored URL may already contain the double `.git`. Clear the relevant entry from `~/.agents/config.json` before re-testing `add-repository` and `add` commands.
46
+
47
+ ## Completion Criteria
48
+
49
+ - Repository URLs ending in `.git` are not double-suffixed during clone
50
+ - Repository URLs without `.git` continue to work correctly
51
+ - No other code paths in the codebase have the same double-suffix bug
52
+ - Both `./package.json` and `.agents/package.json` set to version `8.2.2`
53
+ - No regressions in existing CLI functionality
54
+
55
+ ## Agent Instructions
56
+
57
+ - Spawn parallel subagents where tasks are independent; each subagent owns a single concern
58
+ - Use Claude Sonnet 4.6 model for subagents
59
+ - USE `leveraging-cli-tools` skill — use `rg`, `fd`, `jq`, `bat`, `ast-grep` over standard tools
60
+ - Reason from facts only — read actual files before writing or modifying anything
61
+ - Do not guess file contents, dependency structures, or platform behaviors — verify first
62
+ - Concise output only; no padding
@@ -0,0 +1,37 @@
1
+ # Post-Migration Fixes: Update Checking, Version Source, Husky Hook, and Docs
2
+
3
+ You are working in an agentic coding environment with access to file system tools, web fetching, subagents, and skills.
4
+
5
+ ## Objective
6
+
7
+ TARGET_VERSION: **8.2.1**.
8
+
9
+ FIX the following issues:
10
+
11
+ I installed the new version and noticed some issues that need to be fixed:
12
+
13
+ 1. Version Checking is broken:
14
+ - `superpowers-agent version` returns `0.0.0`
15
+ 2. `superpowers-agent bootstrap` command is broken:
16
+ - Running `superpowers-agent bootstrap` is broken because most things look for `~/.agents/superpowers` directory which doesn't exist anymore since it's now installed as an npm package and not as a shell script that puts it in `~/.agents/superpowers`
17
+ 3. `superpowers-agent update` command is broken:
18
+ - Running `superpowers-agent update` is also broken for the same reason as above, it looks for the old directory structure that doesn't exist anymore. It should run the new update process `npm install -g @complexthings/superpowers-agent` instead to update the global npm package, after checking the npm registry for the latest version and comparing it to the current version to see if an update is actually needed before running the install command.
19
+ 4. `superpowers-agent check-updates` command is broken:
20
+ - It returns `0.0.0` for current version
21
+
22
+ ## Completion Criteria
23
+
24
+ - Both `package.json` (`./package.json` & `.agents/package.json`) files set to version `<TARGET_VERSION>`
25
+ - No regressions in existing CLI functionality
26
+
27
+ ## Agent Instructions
28
+
29
+ - Spawn parallel subagents where tasks are independent; each subagent owns a single concern
30
+ - Use Claude Sonnet 4.6 model for subagents
31
+ - Phase 2 and Phase 3 are independent — run in parallel
32
+ - Phase 4 depends on Phase 1 discovery but is independent of Phases 2–3
33
+ - Phase 5 depends on Phases 2–4 completing (needs final change list)
34
+ - USE `leveraging-cli-tools` skill — use `rg`, `fd`, `jq`, `bat`, `ast-grep` over standard tools
35
+ - Reason from facts only — read actual files before writing or modifying anything
36
+ - Do not guess file contents, dependency structures, or platform behaviors — verify first
37
+ - Concise output only; no padding
@@ -1,13 +1,13 @@
1
1
  #!/bin/sh
2
2
  // 2>/dev/null; exec "$(command -v bun 2>/dev/null || echo node)" "$0" "$@"
3
- import{relative as Hq,dirname as Wq,join as GQ}from"path";import{existsSync as D$}from"fs";import{homedir as c$,platform as oq}from"os";import{join as T,parse as rq,dirname as n$}from"path";import{existsSync as e}from"fs";import{fileURLToPath as sq}from"url";var tq=sq(import.meta.url),t=n$(tq),eq=()=>{let $=c$();switch(oq()){case"darwin":return T($,"Library","Application Support","Code","User");case"win32":return T($,"AppData","Roaming","Code","User");case"linux":return T($,".config","Code","User");default:return T($,".config","Code","User")}},$Q=()=>{let $=process.cwd(),q=rq($).root;while($!==q){if(e(T($,".agents")))return $;$=n$($)}return process.cwd()},E={home:c$(),vscodeUserDir:eq(),projectRoot:$Q(),get projectClaudeSkills(){return T(this.projectRoot,".claude","skills")},get projectAgentsSkills(){return T(this.projectRoot,".agents","skills")},get projectCopilotSkills(){return T(this.projectRoot,".copilot","skills")},get projectOpencodeSkills(){return T(this.projectRoot,".opencode","skill")},get projectCursorSkills(){return T(this.projectRoot,".cursor","skills")},get projectGeminiSkills(){return T(this.projectRoot,".gemini","skills")},get projectCodexSkills(){return T(this.projectRoot,".codex","skills")},get projectSkillsDir(){return T(this.projectRoot,"skills")},get homePersonalSkills(){return T(this.home,".agents","skills")},get homeClaudeSkills(){return T(this.home,".claude","skills")},get homeCopilotSkills(){return T(this.home,".copilot","skills")},get homeOpencodeSkills(){return T(this.home,".config","opencode","skill")},get homeCursorSkills(){return T(this.home,".cursor","skills")},get homeGeminiSkills(){return T(this.home,".gemini","skills")},get homeCodexSkills(){return T(this.home,".codex","skills")},get bootstrap(){return T(this.projectRoot,".agents","superpowers-bootstrap.md")},get superpowersRepo(){let $=T(t,"..","..","..","skills");if(e($)&&e(T(t,"..","..","..",".github","prompts")))return T(t,"..","..","..");return T(this.home,".agents","superpowers")},get homeSuperpowersSkills(){return T(this.superpowersRepo,"skills")},get isSuperpowersRepo(){let $=T(t,"..","..","..","skills");return e($)&&e(T(t,"..","..","..",".github","prompts"))}};import{readFileSync as a$}from"fs";var $$=($)=>{try{let Q=a$($,"utf8").split(`
4
- `),X={name:"",description:"",whenToUse:""},Z=!1;for(let Y of Q){if(Y.trim()==="---"){if(Z)break;Z=!0;continue}if(Z){let H=Y.match(/^(\w+):\s*(.*)$/);if(H){let[,W,K]=H,z={name:"name",description:"description",when_to_use:"whenToUse"};if(z[W])X[z[W]]=K.trim()}}}return X}catch{return{name:"",description:"",whenToUse:""}}},l$=($)=>{try{let q=a$($,"utf8"),Q=$$($),X=q.split(`
3
+ import{relative as Wq,dirname as Eq,join as _Q}from"path";import{existsSync as f$}from"fs";import{homedir as a$,platform as rq}from"os";import{join as I,parse as sq,dirname as l$}from"path";import{existsSync as f}from"fs";import{fileURLToPath as tq}from"url";var eq=tq(import.meta.url),E$=l$(eq),$Q=()=>{let $=a$();switch(rq()){case"darwin":return I($,"Library","Application Support","Code","User");case"win32":return I($,"AppData","Roaming","Code","User");case"linux":return I($,".config","Code","User");default:return I($,".config","Code","User")}},qQ=()=>{let $=process.cwd(),q=sq($).root;while($!==q){if(f(I($,".agents")))return $;$=l$($)}return process.cwd()},E={home:a$(),vscodeUserDir:$Q(),projectRoot:qQ(),get projectClaudeSkills(){return I(this.projectRoot,".claude","skills")},get projectAgentsSkills(){return I(this.projectRoot,".agents","skills")},get projectCopilotSkills(){return I(this.projectRoot,".copilot","skills")},get projectOpencodeSkills(){return I(this.projectRoot,".opencode","skill")},get projectCursorSkills(){return I(this.projectRoot,".cursor","skills")},get projectGeminiSkills(){return I(this.projectRoot,".gemini","skills")},get projectCodexSkills(){return I(this.projectRoot,".codex","skills")},get projectSkillsDir(){return I(this.projectRoot,"skills")},get homePersonalSkills(){return I(this.home,".agents","skills")},get homeClaudeSkills(){return I(this.home,".claude","skills")},get homeCopilotSkills(){return I(this.home,".copilot","skills")},get homeOpencodeSkills(){return I(this.home,".config","opencode","skill")},get homeCursorSkills(){return I(this.home,".cursor","skills")},get homeGeminiSkills(){return I(this.home,".gemini","skills")},get homeCodexSkills(){return I(this.home,".codex","skills")},get bootstrap(){return I(this.projectRoot,".agents","superpowers-bootstrap.md")},get superpowersRepo(){let $=I(E$,"..","..","..");if(f(I($,"skills"))&&f(I($,".agents","superpowers-agent")))return $;let q=I(E$,"..");if(f(I(q,"skills"))&&f(I(q,".agents","superpowers-agent")))return q;return I(this.home,".agents","superpowers")},get homeSuperpowersSkills(){return I(this.superpowersRepo,"skills")},get isSuperpowersRepo(){let $=I(E$,"..","..","..");if(f(I($,"skills"))&&f(I($,".agents","superpowers-agent")))return!0;let q=I(E$,"..");return f(I(q,"skills"))&&f(I(q,".agents","superpowers-agent"))}};import{readFileSync as i$}from"fs";var e=($)=>{try{let Q=i$($,"utf8").split(`
4
+ `),X={name:"",description:"",whenToUse:""},Z=!1;for(let Y of Q){if(Y.trim()==="---"){if(Z)break;Z=!0;continue}if(Z){let H=Y.match(/^(\w+):\s*(.*)$/);if(H){let[,W,K]=H,z={name:"name",description:"description",when_to_use:"whenToUse"};if(z[W])X[z[W]]=K.trim()}}}return X}catch{return{name:"",description:"",whenToUse:""}}},o$=($)=>{try{let q=i$($,"utf8"),Q=e($),X=q.split(`
5
5
  `),Z=!1,Y=!1,H=[];for(let W of X){if(W.trim()==="---"){if(Z){Y=!0;continue}Z=!0;continue}if(Y||!Z)H.push(W)}return{content:H.join(`
6
- `).trim(),frontmatter:Q}}catch(q){throw Error(`Error reading skill file: ${q.message}`)}};import{existsSync as C$,readdirSync as r$,statSync as s$}from"fs";import{join as N$,relative as BX}from"path";import{readFileSync as qQ,existsSync as QQ}from"fs";import{join as i$}from"path";var q$=($)=>{let q=i$($,"skill.json");if(!QQ(q))return null;try{let Q=qQ(q,"utf8");return JSON.parse(Q)}catch(Q){return null}};var M$=($)=>{if($.startsWith("superpowers:"))return{type:"superpowers",path:$.substring(12).replace(/^skills\//,"")};if($.startsWith("claude:"))return{type:"claude",path:$.substring(7).replace(/^skills\//,"")};if($.startsWith("copilot:"))return{type:"copilot",path:$.substring(8).replace(/^skills\//,"")};if($.startsWith("opencode:"))return{type:"opencode",path:$.substring(9).replace(/^skills\//,"")};if($.startsWith("cursor:"))return{type:"cursor",path:$.substring(7).replace(/^skills\//,"")};if($.startsWith("gemini:"))return{type:"gemini",path:$.substring(7).replace(/^skills\//,"")};return{type:null,path:$.replace(/^skills\//,"")}},o$=($,q)=>{let Q=q$($);if(!Q||!Q.helpers||!Array.isArray(Q.helpers))return null;let X=Q.helpers,Z=q.toLowerCase(),Y=null,H=0;for(let W of X){let K=W.toLowerCase();if(K===Z){Y=W;break}if(K.includes(Z)){let _=Z.length/K.length;if(_>H)H=_,Y=W}let z=W.split("/").pop().split(".")[0].toLowerCase();if(Z.includes(z)){let _=z.length/Z.length;if(_>H)H=_,Y=W}}return Y?i$($,Y):null},Q$={project:{dir:"projectAgentsSkills",prefix:""},claude:{dir:"projectClaudeSkills",prefix:"claude:"},copilot:{dir:"projectCopilotSkills",prefix:"copilot:"},opencode:{dir:"projectOpencodeSkills",prefix:"opencode:"},cursor:{dir:"projectCursorSkills",prefix:"cursor:"},gemini:{dir:"projectGeminiSkills",prefix:"gemini:"},personal:{dir:"homePersonalSkills",prefix:""},personalClaude:{dir:"homeClaudeSkills",prefix:"claude:"},personalCopilot:{dir:"homeCopilotSkills",prefix:"copilot:"},personalOpencode:{dir:"homeOpencodeSkills",prefix:"opencode:"},personalCursor:{dir:"homeCursorSkills",prefix:"cursor:"},personalGemini:{dir:"homeGeminiSkills",prefix:"gemini:"},superpowers:{dir:"homeSuperpowersSkills",prefix:"superpowers:"}};var z$=($,q,Q=null)=>{let X=[];if(!C$($))return X;let Z=(Y,H)=>{if(Q!==null&&H>Q)return;try{let W=r$(Y,{withFileTypes:!0});for(let K of W){if(K.name==="node_modules"||K.name===".git"||K.name.startsWith("."))continue;let z=N$(Y,K.name),_=K.isDirectory();if(K.isSymbolicLink())try{_=s$(z).isDirectory()}catch{continue}if(!_)continue;let G=N$(z,"SKILL.md");if(C$(G))X.push(z);if(Q===null||H<Q)Z(z,H+1)}}catch{}};return Z($,0),X};var t$=($,q)=>{if(!C$($))return[];let Q=[],X=q.toLowerCase().replace(/\\/g,"/"),Z=(Y,H="")=>{try{let W=r$(Y,{withFileTypes:!0});for(let K of W){let z=N$(Y,K.name),_=H?`${H}/${K.name}`:K.name,G=K.isDirectory();if(K.isSymbolicLink())try{G=s$(z).isDirectory()}catch{continue}if(G&&(K.name==="node_modules"||K.name===".git"||K.name.startsWith(".")))continue;if(G)Z(z,_);else if(K.name==="SKILL.md"){let V=H.toLowerCase().replace(/\\/g,"/");if(V===X||V.endsWith("/"+X)||V.endsWith(X))Q.push({file:z,path:H})}}}catch(W){}};return Z($),Q},e$=($,q,Q)=>{let X={project:"project skills (.agents/skills/)",claude:"claude skills (.claude/skills/)",copilot:"copilot skills (.copilot/skills/)",opencode:"opencode skills (.opencode/skill/)",cursor:"cursor skills (.cursor/skills/)",gemini:"gemini skills (.gemini/skills/)",personal:"personal skills (~/.agents/skills/)",personalClaude:"personal claude skills (~/.claude/skills/)",personalCopilot:"personal copilot skills (~/.copilot/skills/)",personalOpencode:"personal opencode skills (~/.config/opencode/skill/)",personalCursor:"personal cursor skills (~/.cursor/skills/)",personalGemini:"personal gemini skills (~/.gemini/skills/)",superpowers:"superpowers skills (~/.agents/superpowers/skills/)"}[Q];console.log(`Error: Multiple skills match "${$}" in ${X}:
7
- `);for(let Z of q){let H=Q$[Q].prefix+Z.path;try{let W=$$(Z.file),K=W.description||W.whenToUse||"(no description)";console.log(` ${H}`),console.log(` ${K}
6
+ `).trim(),frontmatter:Q}}catch(q){throw Error(`Error reading skill file: ${q.message}`)}};import{existsSync as C$,readdirSync as t$,statSync as e$}from"fs";import{join as N$,relative as GX}from"path";import{readFileSync as QQ,existsSync as XQ}from"fs";import{join as r$}from"path";var $$=($)=>{let q=r$($,"skill.json");if(!XQ(q))return null;try{let Q=QQ(q,"utf8");return JSON.parse(Q)}catch(Q){return null}};var M$=($)=>{if($.startsWith("superpowers:"))return{type:"superpowers",path:$.substring(12).replace(/^skills\//,"")};if($.startsWith("claude:"))return{type:"claude",path:$.substring(7).replace(/^skills\//,"")};if($.startsWith("copilot:"))return{type:"copilot",path:$.substring(8).replace(/^skills\//,"")};if($.startsWith("opencode:"))return{type:"opencode",path:$.substring(9).replace(/^skills\//,"")};if($.startsWith("cursor:"))return{type:"cursor",path:$.substring(7).replace(/^skills\//,"")};if($.startsWith("gemini:"))return{type:"gemini",path:$.substring(7).replace(/^skills\//,"")};return{type:null,path:$.replace(/^skills\//,"")}},s$=($,q)=>{let Q=$$($);if(!Q||!Q.helpers||!Array.isArray(Q.helpers))return null;let X=Q.helpers,Z=q.toLowerCase(),Y=null,H=0;for(let W of X){let K=W.toLowerCase();if(K===Z){Y=W;break}if(K.includes(Z)){let G=Z.length/K.length;if(G>H)H=G,Y=W}let z=W.split("/").pop().split(".")[0].toLowerCase();if(Z.includes(z)){let G=z.length/Z.length;if(G>H)H=G,Y=W}}return Y?r$($,Y):null},q$={project:{dir:"projectAgentsSkills",prefix:""},claude:{dir:"projectClaudeSkills",prefix:"claude:"},copilot:{dir:"projectCopilotSkills",prefix:"copilot:"},opencode:{dir:"projectOpencodeSkills",prefix:"opencode:"},cursor:{dir:"projectCursorSkills",prefix:"cursor:"},gemini:{dir:"projectGeminiSkills",prefix:"gemini:"},personal:{dir:"homePersonalSkills",prefix:""},personalClaude:{dir:"homeClaudeSkills",prefix:"claude:"},personalCopilot:{dir:"homeCopilotSkills",prefix:"copilot:"},personalOpencode:{dir:"homeOpencodeSkills",prefix:"opencode:"},personalCursor:{dir:"homeCursorSkills",prefix:"cursor:"},personalGemini:{dir:"homeGeminiSkills",prefix:"gemini:"},superpowers:{dir:"homeSuperpowersSkills",prefix:"superpowers:"}};var z$=($,q,Q=null)=>{let X=[];if(!C$($))return X;let Z=(Y,H)=>{if(Q!==null&&H>Q)return;try{let W=t$(Y,{withFileTypes:!0});for(let K of W){if(K.name==="node_modules"||K.name===".git"||K.name.startsWith("."))continue;let z=N$(Y,K.name),G=K.isDirectory();if(K.isSymbolicLink())try{G=e$(z).isDirectory()}catch{continue}if(!G)continue;let _=N$(z,"SKILL.md");if(C$(_))X.push(z);if(Q===null||H<Q)Z(z,H+1)}}catch{}};return Z($,0),X};var $q=($,q)=>{if(!C$($))return[];let Q=[],X=q.toLowerCase().replace(/\\/g,"/"),Z=(Y,H="")=>{try{let W=t$(Y,{withFileTypes:!0});for(let K of W){let z=N$(Y,K.name),G=H?`${H}/${K.name}`:K.name,_=K.isDirectory();if(K.isSymbolicLink())try{_=e$(z).isDirectory()}catch{continue}if(_&&(K.name==="node_modules"||K.name===".git"||K.name.startsWith(".")))continue;if(_)Z(z,G);else if(K.name==="SKILL.md"){let V=H.toLowerCase().replace(/\\/g,"/");if(V===X||V.endsWith("/"+X)||V.endsWith(X))Q.push({file:z,path:H})}}}catch(W){}};return Z($),Q},qq=($,q,Q)=>{let X={project:"project skills (.agents/skills/)",claude:"claude skills (.claude/skills/)",copilot:"copilot skills (.copilot/skills/)",opencode:"opencode skills (.opencode/skill/)",cursor:"cursor skills (.cursor/skills/)",gemini:"gemini skills (.gemini/skills/)",personal:"personal skills (~/.agents/skills/)",personalClaude:"personal claude skills (~/.claude/skills/)",personalCopilot:"personal copilot skills (~/.copilot/skills/)",personalOpencode:"personal opencode skills (~/.config/opencode/skill/)",personalCursor:"personal cursor skills (~/.cursor/skills/)",personalGemini:"personal gemini skills (~/.gemini/skills/)",superpowers:"superpowers skills (~/.agents/superpowers/skills/)"}[Q];console.log(`Error: Multiple skills match "${$}" in ${X}:
7
+ `);for(let Z of q){let H=q$[Q].prefix+Z.path;try{let W=e(Z.file),K=W.description||W.whenToUse||"(no description)";console.log(` ${H}`),console.log(` ${K}
8
8
  `)}catch(W){console.log(` ${H}`),console.log(` (unable to read description)
9
- `)}}console.log("Please be more specific. Examples:");for(let Z of q.slice(0,2)){let Y=Q$[Q].prefix;console.log(` superpowers-agent execute ${Y}${Z.path}`)}};import{existsSync as F$}from"fs";import{join as XQ,relative as YQ}from"path";var ZQ=($)=>{let{type:q,path:Q}=M$($),X={superpowers:[E.homeSuperpowersSkills],claude:[E.projectClaudeSkills,E.homeClaudeSkills],copilot:[E.projectCopilotSkills,E.homeCopilotSkills],opencode:[E.projectOpencodeSkills,E.homeOpencodeSkills],gemini:[E.projectGeminiSkills,E.homeGeminiSkills],project:[E.projectAgentsSkills],personal:[E.homePersonalSkills]},Z;if(q)Z=(X[q]||[]).map((H)=>({type:q,dir:H}));else if(E.isSuperpowersRepo&&F$(E.projectSkillsDir))Z=[{type:"project",dir:E.projectSkillsDir},{type:"project",dir:E.projectAgentsSkills},{type:"claude",dir:E.projectClaudeSkills},{type:"copilot",dir:E.projectCopilotSkills},{type:"opencode",dir:E.projectOpencodeSkills},{type:"gemini",dir:E.projectGeminiSkills},{type:"personal",dir:E.homePersonalSkills},{type:"personalClaude",dir:E.homeClaudeSkills},{type:"personalCopilot",dir:E.homeCopilotSkills},{type:"personalOpencode",dir:E.homeOpencodeSkills},{type:"personalGemini",dir:E.homeGeminiSkills},{type:"superpowers",dir:E.homeSuperpowersSkills}];else Z=[{type:"project",dir:E.projectAgentsSkills},{type:"claude",dir:E.projectClaudeSkills},{type:"copilot",dir:E.projectCopilotSkills},{type:"opencode",dir:E.projectOpencodeSkills},{type:"gemini",dir:E.projectGeminiSkills},{type:"personal",dir:E.homePersonalSkills},{type:"personalClaude",dir:E.homeClaudeSkills},{type:"personalCopilot",dir:E.homeCopilotSkills},{type:"personalOpencode",dir:E.homeOpencodeSkills},{type:"personalGemini",dir:E.homeGeminiSkills},{type:"superpowers",dir:E.homeSuperpowersSkills}];for(let{type:Y,dir:H}of Z){let W=t$(H,Q);if(W.length===1)return{skillFile:W[0].file,sourceType:Y,actualSkillPath:W[0].path};if(W.length>1)e$(Q,W,Y)}return null},d=($)=>{let q=ZQ($);if(q)return q;let{type:Q,path:X}=M$($),Z={superpowers:[E.homeSuperpowersSkills],claude:[E.projectClaudeSkills,E.homeClaudeSkills],copilot:[E.projectCopilotSkills,E.homeCopilotSkills],opencode:[E.projectOpencodeSkills,E.homeOpencodeSkills],gemini:[E.projectGeminiSkills,E.homeGeminiSkills],project:[E.projectAgentsSkills],personal:[E.homePersonalSkills]},Y;if(Q)Y=(Z[Q]||[]).map((W)=>({type:Q,dir:W}));else if(E.isSuperpowersRepo&&F$(E.projectSkillsDir))Y=[{type:"project",dir:E.projectSkillsDir},{type:"project",dir:E.projectAgentsSkills},{type:"claude",dir:E.projectClaudeSkills},{type:"copilot",dir:E.projectCopilotSkills},{type:"opencode",dir:E.projectOpencodeSkills},{type:"gemini",dir:E.projectGeminiSkills},{type:"personal",dir:E.homePersonalSkills},{type:"personalClaude",dir:E.homeClaudeSkills},{type:"personalCopilot",dir:E.homeCopilotSkills},{type:"personalOpencode",dir:E.homeOpencodeSkills},{type:"personalGemini",dir:E.homeGeminiSkills},{type:"superpowers",dir:E.homeSuperpowersSkills}];else Y=[{type:"project",dir:E.projectAgentsSkills},{type:"claude",dir:E.projectClaudeSkills},{type:"copilot",dir:E.projectCopilotSkills},{type:"opencode",dir:E.projectOpencodeSkills},{type:"gemini",dir:E.projectGeminiSkills},{type:"personal",dir:E.homePersonalSkills},{type:"personalClaude",dir:E.homeClaudeSkills},{type:"personalCopilot",dir:E.homeCopilotSkills},{type:"personalOpencode",dir:E.homeOpencodeSkills},{type:"personalGemini",dir:E.homeGeminiSkills},{type:"superpowers",dir:E.homeSuperpowersSkills}];for(let{type:H,dir:W}of Y){if(!F$(W))continue;let K=z$(W,H,null);for(let z of K){let _=q$(z);if(_&&_.aliases&&Array.isArray(_.aliases)){let G=X.toLowerCase();for(let V of _.aliases)if(V.toLowerCase()===G){let B=XQ(z,"SKILL.md"),I=YQ(W,z);return{skillFile:B,sourceType:H,actualSkillPath:I}}}}}return null};import{readFileSync as $q,writeFileSync as qq,existsSync as R$}from"fs";import{join as m}from"path";import{execSync as HQ}from"child_process";var x$=()=>({auto_update:!0,last_update_check:null,last_updated_commit:null}),X$=()=>{let $=m(E.superpowersRepo,".config.json");try{if(!R$($))return x$();let q=$q($,"utf8");return{...x$(),...JSON.parse(q)}}catch{return x$()}},Qq=($)=>{let q=m(E.superpowersRepo,".config.json"),X={...X$(),...$};try{qq(q,JSON.stringify(X,null,2))}catch(Z){console.log(`Warning: couldn't save config: ${Z.message}`)}},h=($)=>{let q=$?m(E.home,".agents","config.json"):m(process.cwd(),".agents","config.json");if(!R$(q))return{};try{let Q=$q(q,"utf8");return JSON.parse(Q)}catch(Q){return{}}},n=($,q)=>{let Q=q?m(E.home,".agents"):m(process.cwd(),".agents"),X=m(Q,"config.json");try{if(!R$(Q))HQ(`mkdir -p "${Q}"`,{stdio:"pipe"});return qq(X,JSON.stringify($,null,2),"utf8"),!0}catch(Z){throw Error(`Failed to write config: ${Z.message}`)}},g=($=!1)=>{return h($).repositories||{}},Xq=($,q,Q)=>{let X=h(Q);if(!X.repositories)X.repositories={};X.repositories[$]=q,n(X,Q)};import{readFileSync as WQ}from"fs";import{join as Yq,dirname as EQ}from"path";import{fileURLToPath as zQ}from"url";import{existsSync as KQ}from"fs";import{execSync as BQ}from"child_process";var _Q=zQ(import.meta.url),Zq=EQ(_Q),R=()=>{try{let $=Yq(Zq,"package.json");if(!KQ($))$=Yq(Zq,"..","..","package.json");return JSON.parse(WQ($,"utf8")).version||"0.0.0"}catch{return"0.0.0"}},D=()=>{let $=R();console.log(`^^SAV:${$}^^`)},K$=async()=>{try{let q=BQ('curl -sS "https://registry.npmjs.org/@complexthings/superpowers-agent/latest"',{encoding:"utf8",timeout:1e4}),Q=JSON.parse(q);if(!Q.version)return R();return Q.version}catch($){throw Error(`Failed to fetch remote version: ${$.message}`)}},B$=($,q)=>{let Q=$.split(".").map(Number),X=q.split(".").map(Number);for(let Z=0;Z<3;Z++){let Y=Q[Z]||0,H=X[Z]||0;if(Y>H)return!0;if(Y<H)return!1}return!1};var OQ={project:{dir:"projectAgentsSkills",prefix:""},claude:{dir:"projectClaudeSkills",prefix:"claude:"},copilot:{dir:"projectCopilotSkills",prefix:"copilot:"},opencode:{dir:"projectOpencodeSkills",prefix:"opencode:"},gemini:{dir:"projectGeminiSkills",prefix:"gemini:"},personal:{dir:"homePersonalSkills",prefix:""},personalClaude:{dir:"homeClaudeSkills",prefix:"claude:"},personalCopilot:{dir:"homeCopilotSkills",prefix:"copilot:"},personalOpencode:{dir:"homeOpencodeSkills",prefix:"opencode:"},personalGemini:{dir:"homeGeminiSkills",prefix:"gemini:"},superpowers:{dir:"homeSuperpowersSkills",prefix:"superpowers:"}},VQ=($,q)=>{let Q=GQ($,"SKILL.md"),{dir:X,prefix:Z}=OQ[q],Y=Hq(E[X],$).replace(/\\/g,"/");console.log(`${Z}${Y}`);let{description:H,whenToUse:W}=$$(Q);if(H)console.log(` ${H}`);if(W)console.log(` When to use: ${W}`);console.log("")},a=()=>{D();let $=new Set,q=[{type:"project",dir:E.projectAgentsSkills,maxDepth:null},{type:"claude",dir:E.projectClaudeSkills,maxDepth:null},{type:"copilot",dir:E.projectCopilotSkills,maxDepth:null},{type:"opencode",dir:E.projectOpencodeSkills,maxDepth:null},{type:"gemini",dir:E.projectGeminiSkills,maxDepth:null},{type:"personal",dir:E.homePersonalSkills,maxDepth:null},{type:"personalClaude",dir:E.homeClaudeSkills,maxDepth:null},{type:"personalCopilot",dir:E.homeCopilotSkills,maxDepth:null},{type:"personalOpencode",dir:E.homeOpencodeSkills,maxDepth:null},{type:"personalGemini",dir:E.homeGeminiSkills,maxDepth:null},{type:"superpowers",dir:E.homeSuperpowersSkills,maxDepth:null}];for(let{type:Q,dir:X,maxDepth:Z}of q){let Y=z$(X,Q,Z);for(let H of Y){let W=Hq(X,H);if(!$.has(W))$.add(W),VQ(H,Q)}}console.log(`Usage:
10
- superpowers-agent execute <skill-name> # Load a specific skill`)},Eq=()=>{D();let $=process.argv[3];if(!$){console.log(`Usage: superpowers-agent execute <skill-name-or-alias>
9
+ `)}}console.log("Please be more specific. Examples:");for(let Z of q.slice(0,2)){let Y=q$[Q].prefix;console.log(` superpowers-agent execute ${Y}${Z.path}`)}};import{existsSync as F$}from"fs";import{join as YQ,relative as ZQ}from"path";var HQ=($)=>{let{type:q,path:Q}=M$($),X={superpowers:[E.homeSuperpowersSkills],claude:[E.projectClaudeSkills,E.homeClaudeSkills],copilot:[E.projectCopilotSkills,E.homeCopilotSkills],opencode:[E.projectOpencodeSkills,E.homeOpencodeSkills],gemini:[E.projectGeminiSkills,E.homeGeminiSkills],project:[E.projectAgentsSkills],personal:[E.homePersonalSkills]},Z;if(q)Z=(X[q]||[]).map((H)=>({type:q,dir:H}));else if(E.isSuperpowersRepo&&F$(E.projectSkillsDir))Z=[{type:"project",dir:E.projectSkillsDir},{type:"project",dir:E.projectAgentsSkills},{type:"claude",dir:E.projectClaudeSkills},{type:"copilot",dir:E.projectCopilotSkills},{type:"opencode",dir:E.projectOpencodeSkills},{type:"gemini",dir:E.projectGeminiSkills},{type:"personal",dir:E.homePersonalSkills},{type:"personalClaude",dir:E.homeClaudeSkills},{type:"personalCopilot",dir:E.homeCopilotSkills},{type:"personalOpencode",dir:E.homeOpencodeSkills},{type:"personalGemini",dir:E.homeGeminiSkills},{type:"superpowers",dir:E.homeSuperpowersSkills}];else Z=[{type:"project",dir:E.projectAgentsSkills},{type:"claude",dir:E.projectClaudeSkills},{type:"copilot",dir:E.projectCopilotSkills},{type:"opencode",dir:E.projectOpencodeSkills},{type:"gemini",dir:E.projectGeminiSkills},{type:"personal",dir:E.homePersonalSkills},{type:"personalClaude",dir:E.homeClaudeSkills},{type:"personalCopilot",dir:E.homeCopilotSkills},{type:"personalOpencode",dir:E.homeOpencodeSkills},{type:"personalGemini",dir:E.homeGeminiSkills},{type:"superpowers",dir:E.homeSuperpowersSkills}];for(let{type:Y,dir:H}of Z){let W=$q(H,Q);if(W.length===1)return{skillFile:W[0].file,sourceType:Y,actualSkillPath:W[0].path};if(W.length>1)qq(Q,W,Y)}return null},m=($)=>{let q=HQ($);if(q)return q;let{type:Q,path:X}=M$($),Z={superpowers:[E.homeSuperpowersSkills],claude:[E.projectClaudeSkills,E.homeClaudeSkills],copilot:[E.projectCopilotSkills,E.homeCopilotSkills],opencode:[E.projectOpencodeSkills,E.homeOpencodeSkills],gemini:[E.projectGeminiSkills,E.homeGeminiSkills],project:[E.projectAgentsSkills],personal:[E.homePersonalSkills]},Y;if(Q)Y=(Z[Q]||[]).map((W)=>({type:Q,dir:W}));else if(E.isSuperpowersRepo&&F$(E.projectSkillsDir))Y=[{type:"project",dir:E.projectSkillsDir},{type:"project",dir:E.projectAgentsSkills},{type:"claude",dir:E.projectClaudeSkills},{type:"copilot",dir:E.projectCopilotSkills},{type:"opencode",dir:E.projectOpencodeSkills},{type:"gemini",dir:E.projectGeminiSkills},{type:"personal",dir:E.homePersonalSkills},{type:"personalClaude",dir:E.homeClaudeSkills},{type:"personalCopilot",dir:E.homeCopilotSkills},{type:"personalOpencode",dir:E.homeOpencodeSkills},{type:"personalGemini",dir:E.homeGeminiSkills},{type:"superpowers",dir:E.homeSuperpowersSkills}];else Y=[{type:"project",dir:E.projectAgentsSkills},{type:"claude",dir:E.projectClaudeSkills},{type:"copilot",dir:E.projectCopilotSkills},{type:"opencode",dir:E.projectOpencodeSkills},{type:"gemini",dir:E.projectGeminiSkills},{type:"personal",dir:E.homePersonalSkills},{type:"personalClaude",dir:E.homeClaudeSkills},{type:"personalCopilot",dir:E.homeCopilotSkills},{type:"personalOpencode",dir:E.homeOpencodeSkills},{type:"personalGemini",dir:E.homeGeminiSkills},{type:"superpowers",dir:E.homeSuperpowersSkills}];for(let{type:H,dir:W}of Y){if(!F$(W))continue;let K=z$(W,H,null);for(let z of K){let G=$$(z);if(G&&G.aliases&&Array.isArray(G.aliases)){let _=X.toLowerCase();for(let V of G.aliases)if(V.toLowerCase()===_){let B=YQ(z,"SKILL.md"),U=ZQ(W,z);return{skillFile:B,sourceType:H,actualSkillPath:U}}}}}return null};import{readFileSync as Qq,writeFileSync as Xq,existsSync as R$}from"fs";import{join as h}from"path";import{execSync as WQ}from"child_process";var x$=()=>({auto_update:!0,last_update_check:null,last_updated_commit:null}),Q$=()=>{let $=h(E.superpowersRepo,".config.json");try{if(!R$($))return x$();let q=Qq($,"utf8");return{...x$(),...JSON.parse(q)}}catch{return x$()}},Yq=($)=>{let q=h(E.superpowersRepo,".config.json"),X={...Q$(),...$};try{Xq(q,JSON.stringify(X,null,2))}catch(Z){console.log(`Warning: couldn't save config: ${Z.message}`)}},p=($)=>{let q=$?h(E.home,".agents","config.json"):h(process.cwd(),".agents","config.json");if(!R$(q))return{};try{let Q=Qq(q,"utf8");return JSON.parse(Q)}catch(Q){return{}}},a=($,q)=>{let Q=q?h(E.home,".agents"):h(process.cwd(),".agents"),X=h(Q,"config.json");try{if(!R$(Q))WQ(`mkdir -p "${Q}"`,{stdio:"pipe"});return Xq(X,JSON.stringify($,null,2),"utf8"),!0}catch(Z){throw Error(`Failed to write config: ${Z.message}`)}},k=($=!1)=>{return p($).repositories||{}},Zq=($,q,Q)=>{let X=p(Q);if(!X.repositories)X.repositories={};X.repositories[$]=q,a(X,Q)};import{readFileSync as EQ}from"fs";import{join as D$,dirname as zQ}from"path";import{fileURLToPath as KQ}from"url";import{existsSync as Hq}from"fs";import{execSync as BQ}from"child_process";var GQ=KQ(import.meta.url),j$=zQ(GQ),R=()=>{try{let $=D$(j$,"package.json");if(!Hq($))$=D$(j$,"..","package.json");if(!Hq($))$=D$(j$,"..","..","package.json");return JSON.parse(EQ($,"utf8")).version||"0.0.0"}catch{return"0.0.0"}},D=()=>{let $=R();console.log(`^^SAV:${$}^^`)},K$=async()=>{try{let q=BQ('curl -sS "https://registry.npmjs.org/@complexthings/superpowers-agent/latest"',{encoding:"utf8",timeout:1e4}),Q=JSON.parse(q);if(!Q.version)return R();return Q.version}catch($){throw Error(`Failed to fetch remote version: ${$.message}`)}},B$=($,q)=>{let Q=$.split(".").map(Number),X=q.split(".").map(Number);for(let Z=0;Z<3;Z++){let Y=Q[Z]||0,H=X[Z]||0;if(Y>H)return!0;if(Y<H)return!1}return!1};var OQ={project:{dir:"projectAgentsSkills",prefix:""},claude:{dir:"projectClaudeSkills",prefix:"claude:"},copilot:{dir:"projectCopilotSkills",prefix:"copilot:"},opencode:{dir:"projectOpencodeSkills",prefix:"opencode:"},gemini:{dir:"projectGeminiSkills",prefix:"gemini:"},personal:{dir:"homePersonalSkills",prefix:""},personalClaude:{dir:"homeClaudeSkills",prefix:"claude:"},personalCopilot:{dir:"homeCopilotSkills",prefix:"copilot:"},personalOpencode:{dir:"homeOpencodeSkills",prefix:"opencode:"},personalGemini:{dir:"homeGeminiSkills",prefix:"gemini:"},superpowers:{dir:"homeSuperpowersSkills",prefix:"superpowers:"}},VQ=($,q)=>{let Q=_Q($,"SKILL.md"),{dir:X,prefix:Z}=OQ[q],Y=Wq(E[X],$).replace(/\\/g,"/");console.log(`${Z}${Y}`);let{description:H,whenToUse:W}=e(Q);if(H)console.log(` ${H}`);if(W)console.log(` When to use: ${W}`);console.log("")},l=()=>{D();let $=new Set,q=[{type:"project",dir:E.projectAgentsSkills,maxDepth:null},{type:"claude",dir:E.projectClaudeSkills,maxDepth:null},{type:"copilot",dir:E.projectCopilotSkills,maxDepth:null},{type:"opencode",dir:E.projectOpencodeSkills,maxDepth:null},{type:"gemini",dir:E.projectGeminiSkills,maxDepth:null},{type:"personal",dir:E.homePersonalSkills,maxDepth:null},{type:"personalClaude",dir:E.homeClaudeSkills,maxDepth:null},{type:"personalCopilot",dir:E.homeCopilotSkills,maxDepth:null},{type:"personalOpencode",dir:E.homeOpencodeSkills,maxDepth:null},{type:"personalGemini",dir:E.homeGeminiSkills,maxDepth:null},{type:"superpowers",dir:E.homeSuperpowersSkills,maxDepth:null}];for(let{type:Q,dir:X,maxDepth:Z}of q){let Y=z$(X,Q,Z);for(let H of Y){let W=Wq(X,H);if(!$.has(W))$.add(W),VQ(H,Q)}}console.log(`Usage:
10
+ superpowers-agent execute <skill-name> # Load a specific skill`)},zq=()=>{D();let $=process.argv[3];if(!$){console.log(`Usage: superpowers-agent execute <skill-name-or-alias>
11
11
 
12
12
  Examples:
13
13
  superpowers-agent execute brainstorming
@@ -17,9 +17,9 @@ Examples:
17
17
 
18
18
  Description:
19
19
  Instructs the agent to execute the specified skill.
20
- Supports skill aliases defined in skill.json files.`);return}let q=d($);if(!q){console.log(`Error: Skill not found: ${$}
20
+ Supports skill aliases defined in skill.json files.`);return}let q=m($);if(!q){console.log(`Error: Skill not found: ${$}
21
21
 
22
- Available skills:`),a();return}let{skillFile:Q,sourceType:X}=q,Z=process.cwd(),Y=Q.startsWith(Z),H=D$(E.projectAgentsSkills)||D$(E.projectClaudeSkills);if(Y)console.log(`Open this file with your Read Tool: ${Q}
22
+ Available skills:`),l();return}let{skillFile:Q,sourceType:X}=q,Z=process.cwd(),Y=Q.startsWith(Z),H=f$(E.projectAgentsSkills)||f$(E.projectClaudeSkills);if(Y)console.log(`Open this file with your Read Tool: ${Q}
23
23
 
24
24
  <IMPORTANT>
25
25
  USE YOUR Read Tool to process this file. DO NOT use \`cat\` or print commands.
@@ -36,7 +36,7 @@ USE YOUR Read Tool to process this file. DO NOT use \`cat\` or print commands.
36
36
  1. Try using your Read Tool first
37
37
  2. If your Read tool fails (file outside workspace), use: cat "${Q}"
38
38
  3. NEVER skip loading the skill content
39
- </IMPORTANT>`)},zq=()=>{let $=process.argv[3];if(!$){console.log(`Usage: superpowers-agent path <skill-name-or-alias>
39
+ </IMPORTANT>`)},Kq=()=>{let $=process.argv[3];if(!$){console.log(`Usage: superpowers-agent path <skill-name-or-alias>
40
40
 
41
41
  Examples:
42
42
  superpowers-agent path brainstorming
@@ -46,9 +46,9 @@ Examples:
46
46
 
47
47
  Description:
48
48
  Outputs the file system path of the specified SKILL.md file.
49
- Supports skill aliases defined in skill.json files.`);return}let q=d($);if(!q){console.log(`Error: Skill not found: ${$}
49
+ Supports skill aliases defined in skill.json files.`);return}let q=m($);if(!q){console.log(`Error: Skill not found: ${$}
50
50
 
51
- Available skills:`),a();return}let{skillFile:Q}=q;console.log(Q)},Kq=()=>{let $=process.argv[3];if(!$){console.log(`Usage: superpowers-agent dir <skill-name>
51
+ Available skills:`),l();return}let{skillFile:Q}=q;console.log(Q)},Bq=()=>{let $=process.argv[3];if(!$){console.log(`Usage: superpowers-agent dir <skill-name>
52
52
 
53
53
  Examples:
54
54
  superpowers-agent dir brainstorming
@@ -58,9 +58,9 @@ Examples:
58
58
 
59
59
  Description:
60
60
  Returns the directory path where the specified skill is located.
61
- Supports skill aliases defined in skill.json files.`);return}let q=d($);if(!q){console.log(`Error: Skill not found: ${$}
61
+ Supports skill aliases defined in skill.json files.`);return}let q=m($);if(!q){console.log(`Error: Skill not found: ${$}
62
62
 
63
- Available skills:`),a();return}let{skillFile:Q}=q,X=Wq(Q);console.log(X)},Bq=()=>{D();let $=process.argv[3],q=process.argv[4];if(!$||!q){console.log(`Usage: superpowers-agent get-helpers <skill-name> <helper-search-term>
63
+ Available skills:`),l();return}let{skillFile:Q}=q,X=Eq(Q);console.log(X)},Gq=()=>{D();let $=process.argv[3],q=process.argv[4];if(!$||!q){console.log(`Usage: superpowers-agent get-helpers <skill-name> <helper-search-term>
64
64
 
65
65
  Examples:
66
66
  superpowers-agent get-helpers block-collection search-block
@@ -72,69 +72,71 @@ Description:
72
72
  Returns the full path to the best matching helper file.
73
73
 
74
74
  The command uses the skill's aliases if available, so you can use
75
- short names like "block-collection" instead of the full path.`);return}let Q=d($);if(!Q){console.log(`Error: Skill not found: ${$}
75
+ short names like "block-collection" instead of the full path.`);return}let Q=m($);if(!Q){console.log(`Error: Skill not found: ${$}
76
76
 
77
- Available skills:`),a();return}let{skillFile:X}=Q,Z=Wq(X),Y=q$(Z);if(!Y){console.log(`Error: No skill.json found for skill: ${$}
77
+ Available skills:`),l();return}let{skillFile:X}=Q,Z=Eq(X),Y=$$(Z);if(!Y){console.log(`Error: No skill.json found for skill: ${$}
78
78
  Location: ${Z}`);return}if(!Y.helpers||!Array.isArray(Y.helpers)||Y.helpers.length===0){console.log(`Error: No helpers defined in skill.json for skill: ${$}
79
- Location: ${Z}`);return}let H=o$(Z,q);if(!H){console.log(`Error: No helper found matching "${q}" in skill: ${$}`),console.log(`
80
- Available helpers:`);for(let W of Y.helpers)console.log(` - ${W}`);return}if(!D$(H)){console.log(`Error: Helper file not found: ${H}
81
- Defined in skill.json but missing from filesystem`);return}console.log(H)},_q=()=>{let $=X$();console.log("Current configuration:"),console.log(JSON.stringify($,null,2))},Gq=()=>{let $=process.argv[3],q=process.argv[4];if(!$||q===void 0){console.log(`Usage: .agents/superpowers-agent config-set <key> <value>
79
+ Location: ${Z}`);return}let H=s$(Z,q);if(!H){console.log(`Error: No helper found matching "${q}" in skill: ${$}`),console.log(`
80
+ Available helpers:`);for(let W of Y.helpers)console.log(` - ${W}`);return}if(!f$(H)){console.log(`Error: Helper file not found: ${H}
81
+ Defined in skill.json but missing from filesystem`);return}console.log(H)},_q=()=>{let $=Q$();console.log("Current configuration:"),console.log(JSON.stringify($,null,2))},Oq=()=>{let $=process.argv[3],q=process.argv[4];if(!$||q===void 0){console.log(`Usage: .agents/superpowers-agent config-set <key> <value>
82
82
 
83
83
  Available keys:
84
84
  auto_update (true/false) - Enable/disable automatic updates during bootstrap
85
85
 
86
86
  Examples:
87
87
  .agents/superpowers-agent config-set auto_update false
88
- .agents/superpowers-agent config-set auto_update true`);return}let Q=q;if(q==="true")Q=!0;else if(q==="false")Q=!1;let X={};X[$]=Q,Qq(X),console.log(`✓ Set ${$} = ${Q}`)},Oq=()=>{D();let $=g(!0),q=g(!1),Q=[];for(let[Y,H]of Object.entries($))Q.push({alias:Y,url:H,source:"global"});for(let[Y,H]of Object.entries(q)){let W=Q.findIndex((K)=>K.alias===Y);if(W>=0)Q[W]={alias:Y,url:H,source:"project"};else Q.push({alias:Y,url:H,source:"project"})}if(Q.length===0){console.log(`No repository aliases configured.
88
+ .agents/superpowers-agent config-set auto_update true`);return}let Q=q;if(q==="true")Q=!0;else if(q==="false")Q=!1;let X={};X[$]=Q,Yq(X),console.log(`✓ Set ${$} = ${Q}`)},Vq=()=>{D();let $=k(!0),q=k(!1),Q=[];for(let[Y,H]of Object.entries($))Q.push({alias:Y,url:H,source:"global"});for(let[Y,H]of Object.entries(q)){let W=Q.findIndex((K)=>K.alias===Y);if(W>=0)Q[W]={alias:Y,url:H,source:"project"};else Q.push({alias:Y,url:H,source:"project"})}if(Q.length===0){console.log(`No repository aliases configured.
89
89
 
90
90
  Add a repository using:
91
91
  superpowers-agent add-repository <git-url> [--as=@alias]`);return}let X=Math.max(5,...Q.map((Y)=>Y.alias.length)),Z=Math.max(3,...Q.map((Y)=>Y.url.length));console.log(`Repositories:
92
92
  `),console.log(`${"Alias".padEnd(X)} ${"URL".padEnd(Z)} Source`);for(let Y of Q)console.log(`${Y.alias.padEnd(X)} ${Y.url.padEnd(Z)} (${Y.source})`);console.log(`
93
- Total: ${Q.length} repository alias(es)`)};var _$=async()=>{try{let $=R(),q=await K$();return{hasUpdates:B$(q,$),localVersion:$,remoteVersion:q}}catch{return{hasUpdates:!1,localVersion:R(),remoteVersion:"",error:!0}}};var j$=async()=>{console.log(`# Checking for Superpowers updates...
94
- `);let $=await _$();if($.error){console.log("⚠️ Could not check for updates (network issue)");return}if(!$.hasUpdates){console.log(`✓ Already up to date (v${$.localVersion})`);return}console.log(`\uD83D\uDCE6 Update available: v${$.localVersion} → v${$.remoteVersion}
95
- `),console.log(` Run the following to update:
96
- `),console.log(` npm install -g @complexthings/superpowers-agent
97
- `)},Vq=async()=>{D();let $=R();console.log(`Current version: ${$}`);try{let q=await K$();if(console.log(`Latest version: ${q}`),B$(q,$))console.log("Update available: Yes"),process.exit(1);else console.log("You are up to date"),process.exit(0)}catch(q){console.log(`Error checking for updates: ${q.message}`),process.exit(1)}},Iq=()=>{let $=R();console.log($)};import{existsSync as L,readFileSync as k,writeFileSync as r,rmSync as RQ}from"fs";import{join as v,dirname as jq,parse as o}from"path";import{execSync as F}from"child_process";import{platform as DQ}from"os";import{execSync as IQ}from"child_process";var Y$=($)=>{try{return IQ(`which ${$}`,{stdio:"pipe",timeout:2000}),!0}catch{return!1}};var U={opencode:{check:()=>Y$("opencode"),cli:!0,name:"OpenCode",installUrl:"https://opencode.ai/docs/installation",bootstrapCommand:"install-opencode-commands"},claude:{check:()=>Y$("claude"),cli:!0,name:"Claude Code",installUrl:"https://code.claude.com/docs/en/installation",bootstrapCommand:"install-claude-commands"},gemini:{check:()=>Y$("gemini"),cli:!0,name:"Gemini",installUrl:"https://cloud.google.com/gemini/docs/cli/install",bootstrapCommand:"install-gemini-commands"},codex:{check:()=>Y$("codex"),cli:!0,name:"Codex",installUrl:"https://developers.openai.com/codex/docs/installation",bootstrapCommand:"install-codex-prompts"},cursor:{check:()=>!0,cli:!1,name:"Cursor",bootstrapCommand:"install-cursor-commands"},copilot:{check:()=>!0,cli:!1,name:"GitHub Copilot",bootstrapCommand:"install-copilot-prompts"}},Uq=()=>{let $=[];if(U.copilot.check())$.push("github-copilot");if(U.cursor.check())$.push("cursor");if(U.claude.check())$.push("claude-code");if(U.opencode.check())$.push("opencode");if(U.gemini.check())$.push("gemini");if(U.codex.check())$.push("codex");return $};import{existsSync as Lq,readdirSync as UQ}from"fs";import{join as l}from"path";import{execSync as G$}from"child_process";var O$=()=>{let $=l(E.superpowersRepo,"hooks","cursor"),q=l(E.home,".cursor","hooks"),Q=l($,"hooks.json"),X=l(E.home,".cursor","hooks.json");if(!Lq($)){console.log("⚠️ No Cursor hooks to install (source directory not found).");return}try{if(!Lq(q))G$(`mkdir -p "${q}"`,{stdio:"pipe"})}catch(H){console.log(`Error creating Cursor hooks directory: ${H.message}`);return}try{G$(`cp "${Q}" "${X}"`,{stdio:"pipe"}),console.log(" ✓ Installed hooks.json")}catch(H){console.log(` ✗ Failed to install hooks.json: ${H.message}`);return}let Z;try{Z=UQ($).filter((H)=>H.endsWith(".sh"))}catch(H){console.log(`Error reading hooks directory: ${H.message}`);return}if(Z.length===0){console.log("⚠️ No hook scripts found to install.");return}console.log("Installing Cursor hooks...");let Y=0;for(let H of Z)try{let W=l($,H),K=l(q,H);G$(`cp "${W}" "${K}"`,{stdio:"pipe"}),G$(`chmod +x "${K}"`,{stdio:"pipe"}),console.log(` ✓ Installed ${H}`),Y++}catch(W){console.log(` ✗ Failed to install ${H}: ${W.message}`)}if(Y>0)console.log(`
93
+ Total: ${Q.length} repository alias(es)`)};var G$=async()=>{try{let $=R(),q=await K$();return{hasUpdates:B$(q,$),localVersion:$,remoteVersion:q}}catch{return{hasUpdates:!1,localVersion:R(),remoteVersion:"",error:!0}}};import{execSync as IQ}from"child_process";var P$=async({skipReinstall:$=!1}={})=>{console.log(`# Checking for Superpowers updates...
94
+ `);let q=await G$();if(q.error){console.log("⚠️ Could not check for updates (network issue)");return}if(!q.hasUpdates){console.log(`✓ Already up to date (v${q.localVersion})`);return}if(console.log(`\uD83D\uDCE6 Update available: v${q.localVersion} → v${q.remoteVersion}
95
+ `),$){console.log(" Skipping install (--no-reinstall flag set)"),console.log(` Run manually: npm install -g @complexthings/superpowers-agent
96
+ `);return}console.log(` Installing update...
97
+ `);try{IQ("npm install -g @complexthings/superpowers-agent",{stdio:"inherit"}),console.log(`
98
+ ✓ Update complete!`)}catch(Q){console.log(`
99
+ ✗ Update failed: ${Q.message}`),console.log(" Try running manually: npm install -g @complexthings/superpowers-agent"),process.exit(1)}},Iq=async()=>{D();let $=R();console.log(`Current version: ${$}`);try{let q=await K$();if(console.log(`Latest version: ${q}`),B$(q,$))console.log("Update available: Yes"),process.exit(1);else console.log("You are up to date"),process.exit(0)}catch(q){console.log(`Error checking for updates: ${q.message}`),process.exit(1)}},Uq=()=>{let $=R();console.log($)};import{existsSync as J,readFileSync as u,writeFileSync as s,rmSync as DQ}from"fs";import{join as v,dirname as fq,parse as r}from"path";import{execSync as F}from"child_process";import{platform as jQ}from"os";import{execSync as UQ}from"child_process";var X$=($)=>{try{return UQ(`which ${$}`,{stdio:"pipe",timeout:2000}),!0}catch{return!1}};var L={opencode:{check:()=>X$("opencode"),cli:!0,name:"OpenCode",installUrl:"https://opencode.ai/docs/installation",bootstrapCommand:"install-opencode-commands"},claude:{check:()=>X$("claude"),cli:!0,name:"Claude Code",installUrl:"https://code.claude.com/docs/en/installation",bootstrapCommand:"install-claude-commands"},gemini:{check:()=>X$("gemini"),cli:!0,name:"Gemini",installUrl:"https://cloud.google.com/gemini/docs/cli/install",bootstrapCommand:"install-gemini-commands"},codex:{check:()=>X$("codex"),cli:!0,name:"Codex",installUrl:"https://developers.openai.com/codex/docs/installation",bootstrapCommand:"install-codex-prompts"},cursor:{check:()=>!0,cli:!1,name:"Cursor",bootstrapCommand:"install-cursor-commands"},copilot:{check:()=>!0,cli:!1,name:"GitHub Copilot",bootstrapCommand:"install-copilot-prompts"}},Lq=()=>{let $=[];if(L.copilot.check())$.push("github-copilot");if(L.cursor.check())$.push("cursor");if(L.claude.check())$.push("claude-code");if(L.opencode.check())$.push("opencode");if(L.gemini.check())$.push("gemini");if(L.codex.check())$.push("codex");return $};import{existsSync as Jq,readdirSync as LQ}from"fs";import{join as i}from"path";import{execSync as _$}from"child_process";var O$=()=>{let $=i(E.superpowersRepo,"hooks","cursor"),q=i(E.home,".cursor","hooks"),Q=i($,"hooks.json"),X=i(E.home,".cursor","hooks.json");if(!Jq($)){console.log("⚠️ No Cursor hooks to install (source directory not found).");return}try{if(!Jq(q))_$(`mkdir -p "${q}"`,{stdio:"pipe"})}catch(H){console.log(`Error creating Cursor hooks directory: ${H.message}`);return}try{_$(`cp "${Q}" "${X}"`,{stdio:"pipe"}),console.log(" ✓ Installed hooks.json")}catch(H){console.log(` ✗ Failed to install hooks.json: ${H.message}`);return}let Z;try{Z=LQ($).filter((H)=>H.endsWith(".sh"))}catch(H){console.log(`Error reading hooks directory: ${H.message}`);return}if(Z.length===0){console.log("⚠️ No hook scripts found to install.");return}console.log("Installing Cursor hooks...");let Y=0;for(let H of Z)try{let W=i($,H),K=i(q,H);_$(`cp "${W}" "${K}"`,{stdio:"pipe"}),_$(`chmod +x "${K}"`,{stdio:"pipe"}),console.log(` ✓ Installed ${H}`),Y++}catch(W){console.log(` ✗ Failed to install ${H}: ${W.message}`)}if(Y>0)console.log(`
98
100
  ✓ Installed ${Y} hook(s) to ${q}
99
101
  Cursor will now check for skills before each prompt submission
100
- Restart Cursor for hooks to take effect`)};import{existsSync as f$,readdirSync as YY,lstatSync as LQ,symlinkSync as vq,unlinkSync as vQ,mkdirSync as JQ,readlinkSync as wQ}from"fs";import{join as y$,dirname as HY}from"path";import{platform as TQ}from"os";var S$=($)=>{try{return LQ($).isSymbolicLink()}catch{return!1}},bQ=($,q)=>{try{if(!S$($))return!1;return wQ($)===q}catch{return!1}},Jq=()=>{let $=y$(E.superpowersRepo,".opencode","plugins","superpowers-agent.js"),q=y$(E.home,".config","opencode","plugins"),Q=y$(q,"superpowers-agent.js");if(console.log("Installing OpenCode plugin symlink..."),!f$($))return console.log("⚠️ Source plugin not found, skipping symlink creation"),console.log(` Expected at: ${$}`),{created:!1,error:"Source plugin not found"};if(bQ(Q,$))return console.log("✓ Plugin symlink already exists and is correct"),{created:!1,existed:!0};if(f$(Q)&&!S$(Q))return console.log("⚠️ Warning: A file already exists at the destination path"),console.log(` Path: ${Q}`),console.log(" Skipping symlink creation to avoid overwriting existing file"),console.log(" To use superpowers-agent plugin, manually remove or rename the existing file"),{created:!1,error:"File already exists at destination"};if(!f$(q))try{JQ(q,{recursive:!0}),console.log(`✓ Created ${q.replace(E.home,"~")}`)}catch(Z){return console.log(`⚠️ Failed to create plugins directory: ${Z.message}`),{created:!1,error:`Failed to create directory: ${Z.message}`}}if(S$(Q))try{vQ(Q)}catch(Z){return console.log(`⚠️ Failed to remove existing symlink: ${Z.message}`),{created:!1,error:`Failed to remove existing symlink: ${Z.message}`}}let X=TQ();try{if(X==="win32")vq($,Q,"file");else vq($,Q);let Z=$.replace(E.home,"~"),Y=Q.replace(E.home,"~");return console.log(`✓ Created symlink: ${Y}`),console.log(` -> ${Z}`),{created:!0}}catch(Z){if(X==="win32"&&Z.code==="EPERM")return console.log("⚠️ Windows requires Developer Mode or admin privileges for symlinks"),console.log(" Enable Developer Mode: Settings > Update & Security > For developers"),{created:!1,error:"Windows symlink permission denied"};return console.log(`⚠️ Failed to create symlink: ${Z.message}`),{created:!1,error:`Failed to create symlink: ${Z.message}`}}};import{existsSync as b,readdirSync as wq,lstatSync as AQ,symlinkSync as V$,unlinkSync as Tq,mkdirSync as i,readlinkSync as MQ}from"fs";import{join as O,dirname as CQ,basename as NQ}from"path";import{homedir as C,platform as bq}from"os";var Aq=[{name:"claude",parentDir:()=>O(C(),".claude"),skillsDir:()=>O(C(),".claude","skills"),superpowersTarget:"superpowers"},{name:"copilot",parentDir:()=>O(C(),".copilot"),skillsDir:()=>O(C(),".copilot","skills"),superpowersTarget:"superpowers"},{name:"opencode",parentDir:()=>O(C(),".config","opencode"),skillsDir:()=>O(C(),".config","opencode","skill"),superpowersTarget:"superpowers"},{name:"cursor",parentDir:()=>O(C(),".cursor"),skillsDir:()=>O(C(),".cursor","skills"),superpowersTarget:"superpowers"},{name:"gemini",parentDir:()=>O(C(),".gemini"),skillsDir:()=>O(C(),".gemini","skills"),superpowersTarget:"superpowers"},{name:"codex",parentDir:()=>O(C(),".codex"),skillsDir:()=>O(C(),".codex","skills"),superpowersTarget:"superpowers"}],FQ=[{name:"claude",agentDir:($)=>O($,".claude"),skillsDir:($)=>O($,".claude","skills"),detect:($)=>b(O($,".claude"))},{name:"copilot",agentDir:($)=>O($,".github"),skillsDir:($)=>O($,".github","skills"),detect:($)=>{let q=b(O($,".github")),Q=b(O($,"AGENTS.md"))||b(O($,".agents","AGENTS.md"));return q&&Q}},{name:"opencode",agentDir:($)=>O($,".opencode"),skillsDir:($)=>O($,".opencode","skill"),detect:($)=>{let q=b(O($,".opencode")),Q=b(O($,"AGENTS.md"))||b(O($,".agents","AGENTS.md"))||b(O($,".opencode","AGENTS.md"));return q&&Q}},{name:"cursor",agentDir:($)=>O($,".cursor"),skillsDir:($)=>O($,".cursor","skills"),detect:($)=>b(O($,".cursor"))},{name:"gemini",agentDir:($)=>O($,".gemini"),skillsDir:($)=>O($,".gemini","skills"),detect:($)=>{let q=b(O($,".gemini")),Q=b(O($,"GEMINI.md"))||b(O($,".agents","GEMINI.md"));return q&&Q}},{name:"codex",agentDir:($)=>O($,".codex"),skillsDir:($)=>O($,".codex","skills"),detect:($)=>{let q=b(O($,".codex")),Q=b(O($,"AGENTS.md"))||b(O($,".agents","AGENTS.md"));return q&&Q}}],I$=($)=>{try{return AQ($).isSymbolicLink()}catch{return!1}},Mq=($,q)=>{try{if(!I$($))return!1;return MQ($)===q}catch{return!1}},Z$=($,q)=>{if(!b($))return{created:!1,existed:!1,error:`Source does not exist: ${$}`};if(Mq(q,$))return{created:!1,existed:!0};if(b(q)||I$(q))if(I$(q))try{Tq(q)}catch(Z){return{created:!1,existed:!1,error:`Failed to remove existing symlink: ${Z.message}`}}else return{created:!1,existed:!1,error:`Target exists and is not a symlink: ${q}`};let Q=CQ(q);if(!b(Q))try{i(Q,{recursive:!0})}catch(Z){return{created:!1,existed:!1,error:`Failed to create parent directory: ${Z.message}`}}let X=bq();try{if(X==="win32")V$($,q,"junction");else V$($,q,"dir");return{created:!0,existed:!1}}catch(Z){if(X==="win32"&&Z.code==="EPERM")return{created:!1,existed:!1,error:"Windows requires Developer Mode or admin privileges for symlinks. Enable Developer Mode: Settings > Update & Security > For developers"};return{created:!1,existed:!1,error:`Failed to create symlink: ${Z.message}`}}};var Cq=($,q,Q="skills")=>{let X=h(!0);if(!X.symlinks)X.symlinks={};if(!X.symlinks[$])X.symlinks[$]={superpowers:null,skills:[]};if(Q==="superpowers")X.symlinks[$].superpowers=q;else{let Z=X.symlinks[$].skills||[];if(!Z.includes(q))Z.push(q),X.symlinks[$].skills=Z}n(X,!0)};var xQ=($,q={})=>{let Q=E.homeSuperpowersSkills,X=O($.skillsDir(),$.superpowersTarget),Z=Z$(Q,X);if(Z.created){Cq($.name,X,"superpowers");let Y=Q.replace(C(),"~"),H=X.replace(C(),"~");return console.log(` ✓ Created ${H} -> ${Y}`),{created:!0}}else if(Z.existed)return{created:!1,existed:!0};else if(Z.error)return console.log(` ⚠️ ${$.name} superpowers: ${Z.error}`),{created:!1,error:Z.error};return{created:!1}},Nq=($,q={})=>{let Q=E.homePersonalSkills;if(!b(Q))return{created:0,existed:0};let X;try{X=wq(Q,{withFileTypes:!0}).filter((Y)=>Y.isDirectory()&&!Y.name.startsWith(".")).map((Y)=>Y.name)}catch{return{created:0,existed:0}}if(X.length===0)return{created:0,existed:0};let Z={created:0,existed:0,names:[]};for(let Y of X){let H=O(Q,Y),W=O($.skillsDir(),Y),K=Z$(H,W);if(K.created)Cq($.name,W,"skills"),Z.created++,Z.names.push(Y);else if(K.existed)Z.existed++;else if(K.error)console.log(` ⚠️ ${Y}: ${K.error}`)}if(Z.created>0)console.log(` ✓ Synced ${Z.created} personal skill(s): ${Z.names.join(", ")}`);return Z},Fq=($={})=>{let{force:q=!1,forceAgents:Q=new Set}=$;for(let X of Aq){let Z=q||Q.has(X.name),Y=X.parentDir(),H=X.skillsDir();if(!b(Y))if(Z)try{i(Y,{recursive:!0}),console.log(`✓ Created ${Y.replace(C(),"~")}`)}catch(W){console.log(`⚠️ Failed to create ${Y.replace(C(),"~")}: ${W.message}`);continue}else{console.log(`⚠️ Skipping ${X.name} (${Y.replace(C(),"~")} not found)`),console.log(" Use --force or --force-<agent> to create directory");continue}if(!b(H))try{i(H,{recursive:!0})}catch(W){console.log(`⚠️ Failed to create skills directory for ${X.name}: ${W.message}`);continue}console.log(`${X.name}:`),xQ(X,$),Nq(X,$)}},P$=($={})=>{let{force:q=!1}=$;for(let Q of Aq){let X=Q.parentDir(),Z=Q.skillsDir();if(!b(X)){if(!q)continue;try{i(X,{recursive:!0})}catch{continue}}if(!b(Z))try{i(Z,{recursive:!0})}catch{continue}Nq(Q,$)}};var xq=($,q=[])=>{let Q;try{Q=wq($,{withFileTypes:!0})}catch{return q}let X=!1,Z=[];for(let Y of Q){if(!Y.isDirectory()&&Y.name==="SKILL.md")X=!0;if(Y.isDirectory()&&!Y.name.startsWith("."))Z.push(O($,Y.name))}if(X)q.push($);for(let Y of Z)xq(Y,q);return q},Rq=()=>{let $=E.homeSuperpowersSkills,q=E.homePersonalSkills;if(!b($))return{created:0,existed:0,updated:0,errors:[`Skills directory not found: ${$}`]};if(!b(q))try{i(q,{recursive:!0})}catch(Z){return{created:0,existed:0,updated:0,errors:[`Failed to create ${q}: ${Z.message}`]}}let Q=xq($),X={created:0,existed:0,updated:0,errors:[]};for(let Z of Q){let Y=NQ(Z),H=O(q,Y);if(Mq(H,Z)){X.existed++;continue}if(I$(H))try{Tq(H),X.updated++}catch(K){X.errors.push(`Failed to remove stale symlink ${H}: ${K.message}`);continue}else if(b(H)){X.errors.push(`Skipped ${H}: path exists and is not a symlink`);continue}let W=bq();try{if(W==="win32")V$(Z,H,"junction");else V$(Z,H,"dir");let K=H.replace(C(),"~"),z=Z.replace(C(),"~");console.log(` ✓ ${K} -> ${z}`),X.created++}catch(K){X.errors.push(`Failed to create symlink ${H}: ${K.message}`)}}return X},Dq=($={})=>{let q=$.projectRoot||process.cwd(),Q=O(q,".agents","skills");if(!b(Q))return{created:0,existed:0,skipped:0,errors:[]};let X={created:0,existed:0,skipped:0,errors:[]};for(let Z of FQ){if(!Z.detect(q)){X.skipped++;continue}let Y=Z.skillsDir(q),H=Z.agentDir(q);if(!b(H)){X.skipped++;continue}let W=Z$(Q,Y);if(W.created){let K=Y.replace(q,".");console.log(` ✓ Created ${K} -> .agents/skills`),X.created++}else if(W.existed)X.existed++;else if(W.error)console.log(` ⚠️ ${Z.name}: ${W.error}`),X.errors.push({platform:Z.name,error:W.error})}return X};var jQ=()=>{let $=v(E.superpowersRepo,".agents","templates","TOOLS.md.template");if(L($))try{return k($,"utf8").trim()}catch(q){return"### Using Tools\n\nUse your native skill tool. Fallback: `superpowers-agent find-skills`"}return""},H$=($,q,Q,X=!0)=>{let Z=L($);if(!Z&&!X)return{updated:!1,created:!1,skipped:!0};let Y=jQ(),H=q.replace(/\{\{TOOL_MAPPINGS\}\}/g,Y),W=new Date().toISOString().split("T")[0];H=H.replace(/\{\{DATE\}\}/g,W),H=H.replace(/\{\{SUPERPOWERS_PATH\}\}/g,E.superpowersRepo);let K=`<!-- SUPERPOWERS_SKILLS_START -->
102
+ Restart Cursor for hooks to take effect`)};import{existsSync as y$,readdirSync as HY,lstatSync as JQ,symlinkSync as vq,unlinkSync as vQ,mkdirSync as wQ,readlinkSync as TQ}from"fs";import{join as S$,dirname as EY}from"path";import{platform as AQ}from"os";var g$=($)=>{try{return JQ($).isSymbolicLink()}catch{return!1}},bQ=($,q)=>{try{if(!g$($))return!1;return TQ($)===q}catch{return!1}},wq=()=>{let $=S$(E.superpowersRepo,".opencode","plugins","superpowers-agent.js"),q=S$(E.home,".config","opencode","plugins"),Q=S$(q,"superpowers-agent.js");if(console.log("Installing OpenCode plugin symlink..."),!y$($))return console.log("⚠️ Source plugin not found, skipping symlink creation"),console.log(` Expected at: ${$}`),{created:!1,error:"Source plugin not found"};if(bQ(Q,$))return console.log("✓ Plugin symlink already exists and is correct"),{created:!1,existed:!0};if(y$(Q)&&!g$(Q))return console.log("⚠️ Warning: A file already exists at the destination path"),console.log(` Path: ${Q}`),console.log(" Skipping symlink creation to avoid overwriting existing file"),console.log(" To use superpowers-agent plugin, manually remove or rename the existing file"),{created:!1,error:"File already exists at destination"};if(!y$(q))try{wQ(q,{recursive:!0}),console.log(`✓ Created ${q.replace(E.home,"~")}`)}catch(Z){return console.log(`⚠️ Failed to create plugins directory: ${Z.message}`),{created:!1,error:`Failed to create directory: ${Z.message}`}}if(g$(Q))try{vQ(Q)}catch(Z){return console.log(`⚠️ Failed to remove existing symlink: ${Z.message}`),{created:!1,error:`Failed to remove existing symlink: ${Z.message}`}}let X=AQ();try{if(X==="win32")vq($,Q,"file");else vq($,Q);let Z=$.replace(E.home,"~"),Y=Q.replace(E.home,"~");return console.log(`✓ Created symlink: ${Y}`),console.log(` -> ${Z}`),{created:!0}}catch(Z){if(X==="win32"&&Z.code==="EPERM")return console.log("⚠️ Windows requires Developer Mode or admin privileges for symlinks"),console.log(" Enable Developer Mode: Settings > Update & Security > For developers"),{created:!1,error:"Windows symlink permission denied"};return console.log(`⚠️ Failed to create symlink: ${Z.message}`),{created:!1,error:`Failed to create symlink: ${Z.message}`}}};import{existsSync as A,readdirSync as Tq,lstatSync as MQ,symlinkSync as V$,unlinkSync as Aq,mkdirSync as o,readlinkSync as CQ}from"fs";import{join as O,dirname as NQ,basename as FQ}from"path";import{homedir as C,platform as bq}from"os";var Mq=[{name:"claude",parentDir:()=>O(C(),".claude"),skillsDir:()=>O(C(),".claude","skills"),superpowersTarget:"superpowers"},{name:"copilot",parentDir:()=>O(C(),".copilot"),skillsDir:()=>O(C(),".copilot","skills"),superpowersTarget:"superpowers"},{name:"opencode",parentDir:()=>O(C(),".config","opencode"),skillsDir:()=>O(C(),".config","opencode","skill"),superpowersTarget:"superpowers"},{name:"cursor",parentDir:()=>O(C(),".cursor"),skillsDir:()=>O(C(),".cursor","skills"),superpowersTarget:"superpowers"},{name:"gemini",parentDir:()=>O(C(),".gemini"),skillsDir:()=>O(C(),".gemini","skills"),superpowersTarget:"superpowers"},{name:"codex",parentDir:()=>O(C(),".codex"),skillsDir:()=>O(C(),".codex","skills"),superpowersTarget:"superpowers"}],xQ=[{name:"claude",agentDir:($)=>O($,".claude"),skillsDir:($)=>O($,".claude","skills"),detect:($)=>A(O($,".claude"))},{name:"copilot",agentDir:($)=>O($,".github"),skillsDir:($)=>O($,".github","skills"),detect:($)=>{let q=A(O($,".github")),Q=A(O($,"AGENTS.md"))||A(O($,".agents","AGENTS.md"));return q&&Q}},{name:"opencode",agentDir:($)=>O($,".opencode"),skillsDir:($)=>O($,".opencode","skill"),detect:($)=>{let q=A(O($,".opencode")),Q=A(O($,"AGENTS.md"))||A(O($,".agents","AGENTS.md"))||A(O($,".opencode","AGENTS.md"));return q&&Q}},{name:"cursor",agentDir:($)=>O($,".cursor"),skillsDir:($)=>O($,".cursor","skills"),detect:($)=>A(O($,".cursor"))},{name:"gemini",agentDir:($)=>O($,".gemini"),skillsDir:($)=>O($,".gemini","skills"),detect:($)=>{let q=A(O($,".gemini")),Q=A(O($,"GEMINI.md"))||A(O($,".agents","GEMINI.md"));return q&&Q}},{name:"codex",agentDir:($)=>O($,".codex"),skillsDir:($)=>O($,".codex","skills"),detect:($)=>{let q=A(O($,".codex")),Q=A(O($,"AGENTS.md"))||A(O($,".agents","AGENTS.md"));return q&&Q}}],I$=($)=>{try{return MQ($).isSymbolicLink()}catch{return!1}},Cq=($,q)=>{try{if(!I$($))return!1;return CQ($)===q}catch{return!1}},Y$=($,q)=>{if(!A($))return{created:!1,existed:!1,error:`Source does not exist: ${$}`};if(Cq(q,$))return{created:!1,existed:!0};if(A(q)||I$(q))if(I$(q))try{Aq(q)}catch(Z){return{created:!1,existed:!1,error:`Failed to remove existing symlink: ${Z.message}`}}else return{created:!1,existed:!1,error:`Target exists and is not a symlink: ${q}`};let Q=NQ(q);if(!A(Q))try{o(Q,{recursive:!0})}catch(Z){return{created:!1,existed:!1,error:`Failed to create parent directory: ${Z.message}`}}let X=bq();try{if(X==="win32")V$($,q,"junction");else V$($,q,"dir");return{created:!0,existed:!1}}catch(Z){if(X==="win32"&&Z.code==="EPERM")return{created:!1,existed:!1,error:"Windows requires Developer Mode or admin privileges for symlinks. Enable Developer Mode: Settings > Update & Security > For developers"};return{created:!1,existed:!1,error:`Failed to create symlink: ${Z.message}`}}};var Nq=($,q,Q="skills")=>{let X=p(!0);if(!X.symlinks)X.symlinks={};if(!X.symlinks[$])X.symlinks[$]={superpowers:null,skills:[]};if(Q==="superpowers")X.symlinks[$].superpowers=q;else{let Z=X.symlinks[$].skills||[];if(!Z.includes(q))Z.push(q),X.symlinks[$].skills=Z}a(X,!0)};var RQ=($,q={})=>{let Q=E.homeSuperpowersSkills,X=O($.skillsDir(),$.superpowersTarget),Z=Y$(Q,X);if(Z.created){Nq($.name,X,"superpowers");let Y=Q.replace(C(),"~"),H=X.replace(C(),"~");return console.log(` ✓ Created ${H} -> ${Y}`),{created:!0}}else if(Z.existed)return{created:!1,existed:!0};else if(Z.error)return console.log(` ⚠️ ${$.name} superpowers: ${Z.error}`),{created:!1,error:Z.error};return{created:!1}},Fq=($,q={})=>{let Q=E.homePersonalSkills;if(!A(Q))return{created:0,existed:0};let X;try{X=Tq(Q,{withFileTypes:!0}).filter((Y)=>Y.isDirectory()&&!Y.name.startsWith(".")).map((Y)=>Y.name)}catch{return{created:0,existed:0}}if(X.length===0)return{created:0,existed:0};let Z={created:0,existed:0,names:[]};for(let Y of X){let H=O(Q,Y),W=O($.skillsDir(),Y),K=Y$(H,W);if(K.created)Nq($.name,W,"skills"),Z.created++,Z.names.push(Y);else if(K.existed)Z.existed++;else if(K.error)console.log(` ⚠️ ${Y}: ${K.error}`)}if(Z.created>0)console.log(` ✓ Synced ${Z.created} personal skill(s): ${Z.names.join(", ")}`);return Z},xq=($={})=>{let{force:q=!1,forceAgents:Q=new Set}=$;for(let X of Mq){let Z=q||Q.has(X.name),Y=X.parentDir(),H=X.skillsDir();if(!A(Y))if(Z)try{o(Y,{recursive:!0}),console.log(`✓ Created ${Y.replace(C(),"~")}`)}catch(W){console.log(`⚠️ Failed to create ${Y.replace(C(),"~")}: ${W.message}`);continue}else{console.log(`⚠️ Skipping ${X.name} (${Y.replace(C(),"~")} not found)`),console.log(" Use --force or --force-<agent> to create directory");continue}if(!A(H))try{o(H,{recursive:!0})}catch(W){console.log(`⚠️ Failed to create skills directory for ${X.name}: ${W.message}`);continue}console.log(`${X.name}:`),RQ(X,$),Fq(X,$)}},k$=($={})=>{let{force:q=!1}=$;for(let Q of Mq){let X=Q.parentDir(),Z=Q.skillsDir();if(!A(X)){if(!q)continue;try{o(X,{recursive:!0})}catch{continue}}if(!A(Z))try{o(Z,{recursive:!0})}catch{continue}Fq(Q,$)}};var Rq=($,q=[])=>{let Q;try{Q=Tq($,{withFileTypes:!0})}catch{return q}let X=!1,Z=[];for(let Y of Q){if(!Y.isDirectory()&&Y.name==="SKILL.md")X=!0;if(Y.isDirectory()&&!Y.name.startsWith("."))Z.push(O($,Y.name))}if(X)q.push($);for(let Y of Z)Rq(Y,q);return q},Dq=()=>{let $=E.homeSuperpowersSkills,q=E.homePersonalSkills;if(!A($))return{created:0,existed:0,updated:0,errors:[`Skills directory not found: ${$}`]};if(!A(q))try{o(q,{recursive:!0})}catch(Z){return{created:0,existed:0,updated:0,errors:[`Failed to create ${q}: ${Z.message}`]}}let Q=Rq($),X={created:0,existed:0,updated:0,errors:[]};for(let Z of Q){let Y=FQ(Z),H=O(q,Y);if(Cq(H,Z)){X.existed++;continue}if(I$(H))try{Aq(H),X.updated++}catch(K){X.errors.push(`Failed to remove stale symlink ${H}: ${K.message}`);continue}else if(A(H)){X.errors.push(`Skipped ${H}: path exists and is not a symlink`);continue}let W=bq();try{if(W==="win32")V$(Z,H,"junction");else V$(Z,H,"dir");let K=H.replace(C(),"~"),z=Z.replace(C(),"~");console.log(` ✓ ${K} -> ${z}`),X.created++}catch(K){X.errors.push(`Failed to create symlink ${H}: ${K.message}`)}}return X},jq=($={})=>{let q=$.projectRoot||process.cwd(),Q=O(q,".agents","skills");if(!A(Q))return{created:0,existed:0,skipped:0,errors:[]};let X={created:0,existed:0,skipped:0,errors:[]};for(let Z of xQ){if(!Z.detect(q)){X.skipped++;continue}let Y=Z.skillsDir(q),H=Z.agentDir(q);if(!A(H)){X.skipped++;continue}let W=Y$(Q,Y);if(W.created){let K=Y.replace(q,".");console.log(` ✓ Created ${K} -> .agents/skills`),X.created++}else if(W.existed)X.existed++;else if(W.error)console.log(` ⚠️ ${Z.name}: ${W.error}`),X.errors.push({platform:Z.name,error:W.error})}return X};var fQ=()=>{let $=v(E.superpowersRepo,".agents","templates","TOOLS.md.template");if(J($))try{return u($,"utf8").trim()}catch(q){return"### Using Tools\n\nUse your native skill tool. Fallback: `superpowers-agent find-skills`"}return""},Z$=($,q,Q,X=!0)=>{let Z=J($);if(!Z&&!X)return{updated:!1,created:!1,skipped:!0};let Y=fQ(),H=q.replace(/\{\{TOOL_MAPPINGS\}\}/g,Y),W=new Date().toISOString().split("T")[0];H=H.replace(/\{\{DATE\}\}/g,W),H=H.replace(/\{\{SUPERPOWERS_PATH\}\}/g,E.superpowersRepo);let K=`<!-- SUPERPOWERS_SKILLS_START -->
101
103
  ${H}
102
- <!-- SUPERPOWERS_SKILLS_END -->`;if(Z){let z=new Date().toISOString().split("T")[0],_=`${$}.backup-${z}`;try{F(`cp "${$}" "${_}"`,{stdio:"pipe"})}catch(J){return{updated:!1,error:!0,message:`Failed to backup: ${J.message}`}}let G;try{G=k($,"utf8")}catch(J){return{updated:!1,error:!0,message:`Failed to read: ${J.message}`}}let V="<!-- SUPERPOWERS_SKILLS_START -->",B="<!-- SUPERPOWERS_SKILLS_END -->",I;if(G.includes(V)&&G.includes(B)){let J=new RegExp(`${V}[\\s\\S]*?${B}`,"g");I=G.replace(J,K)}else{let J=G.match(/^#\s+.+$/m);if(J){let M=G.indexOf(`
103
- `,J.index)+1;I=G.slice(0,M)+`
104
+ <!-- SUPERPOWERS_SKILLS_END -->`;if(Z){let z=new Date().toISOString().split("T")[0],G=`${$}.backup-${z}`;try{F(`cp "${$}" "${G}"`,{stdio:"pipe"})}catch(w){return{updated:!1,error:!0,message:`Failed to backup: ${w.message}`}}let _;try{_=u($,"utf8")}catch(w){return{updated:!1,error:!0,message:`Failed to read: ${w.message}`}}let V="<!-- SUPERPOWERS_SKILLS_START -->",B="<!-- SUPERPOWERS_SKILLS_END -->",U;if(_.includes(V)&&_.includes(B)){let w=new RegExp(`${V}[\\s\\S]*?${B}`,"g");U=_.replace(w,K)}else{let w=_.match(/^#\s+.+$/m);if(w){let M=_.indexOf(`
105
+ `,w.index)+1;U=_.slice(0,M)+`
104
106
  `+K+`
105
- `+G.slice(M)}else I=K+`
107
+ `+_.slice(M)}else U=K+`
106
108
 
107
- `+G}try{return r($,I,"utf8"),{updated:!0,created:!1,backup:_}}catch(J){return{updated:!1,error:!0,message:`Failed to write: ${J.message}`}}}else try{let z=jq($);if(!L(z))F(`mkdir -p "${z}"`,{stdio:"pipe"});let V=`# ${o($).base.toUpperCase()}
109
+ `+_}try{return s($,U,"utf8"),{updated:!0,created:!1,backup:G}}catch(w){return{updated:!1,error:!0,message:`Failed to write: ${w.message}`}}}else try{let z=fq($);if(!J(z))F(`mkdir -p "${z}"`,{stdio:"pipe"});let V=`# ${r($).base.toUpperCase()}
108
110
 
109
- `+K;return r($,V,"utf8"),{updated:!1,created:!0}}catch(z){return{updated:!1,created:!1,error:!0,message:`Failed to create: ${z.message}`}}},fQ=()=>{console.log("Installing Unix aliases...");let $=v(E.superpowersRepo,".agents","superpowers-agent"),q=v(E.home,".local","bin"),Q=v(q,"superpowers-agent"),X=v(q,"superpowers");if(!L($)){console.log("⚠️ superpowers-agent executable not found");return}if(!L(q))try{F(`mkdir -p "${q}"`,{stdio:"pipe"}),console.log(`✓ Created ${q}`)}catch(Y){console.log(`⚠️ Failed to create ${q}: ${Y.message}`);return}try{if(L(Q))F(`rm "${Q}"`,{stdio:"pipe"});F(`ln -s "${$}" "${Q}"`,{stdio:"pipe"}),console.log(`✓ Created symlink: superpowers-agent -> ${$}`)}catch(Y){console.log(`⚠️ Failed to create superpowers-agent symlink: ${Y.message}`)}try{if(L(X))F(`rm "${X}"`,{stdio:"pipe"});F(`ln -s "${$}" "${X}"`,{stdio:"pipe"}),console.log(`✓ Created symlink: superpowers -> ${$}`)}catch(Y){console.log(`⚠️ Failed to create superpowers symlink: ${Y.message}`)}if(!(process.env.PATH||"").includes(q))console.log(`
111
+ `+K;return s($,V,"utf8"),{updated:!1,created:!0}}catch(z){return{updated:!1,created:!1,error:!0,message:`Failed to create: ${z.message}`}}},PQ=()=>{console.log("Installing Unix aliases...");let $=v(E.superpowersRepo,".agents","superpowers-agent"),q=v(E.home,".local","bin"),Q=v(q,"superpowers-agent"),X=v(q,"superpowers");if(!J($)){console.log("⚠️ superpowers-agent executable not found");return}if(!J(q))try{F(`mkdir -p "${q}"`,{stdio:"pipe"}),console.log(`✓ Created ${q}`)}catch(Y){console.log(`⚠️ Failed to create ${q}: ${Y.message}`);return}try{if(J(Q))F(`rm "${Q}"`,{stdio:"pipe"});F(`ln -s "${$}" "${Q}"`,{stdio:"pipe"}),console.log(`✓ Created symlink: superpowers-agent -> ${$}`)}catch(Y){console.log(`⚠️ Failed to create superpowers-agent symlink: ${Y.message}`)}try{if(J(X))F(`rm "${X}"`,{stdio:"pipe"});F(`ln -s "${$}" "${X}"`,{stdio:"pipe"}),console.log(`✓ Created symlink: superpowers -> ${$}`)}catch(Y){console.log(`⚠️ Failed to create superpowers symlink: ${Y.message}`)}if(!(process.env.PATH||"").includes(q))console.log(`
110
112
  ⚠️ Warning: ${q} is not in your PATH`),console.log(" Add this to your shell profile (~/.bashrc, ~/.zshrc, etc.):"),console.log(` export PATH="$HOME/.local/bin:$PATH"
111
- `)},yQ=()=>{console.log("Installing Windows aliases..."),console.log("✓ Windows alias installation (implementation pending)")},g$=()=>{let $=DQ();if(console.log(`## Installing Universal Aliases
112
- `),$==="win32")return yQ();else return fQ()},SQ=($)=>{let q=v(E.superpowersRepo,".github","copilot-instructions.md"),Q=v(E.superpowersRepo,"skills","meta","using-superpowers","SKILL.md"),X=v($,".github","copilot-instructions.md"),Z="<!-- SUPERPOWERS_-_INSTRUCTIONS_START -->",Y="<!-- SUPERPOWERS_-_INSTRUCTIONS_END -->";if(!L(q))return{error:!0,message:"Source template not found"};if(!L(Q))return{error:!0,message:"using-superpowers SKILL.md not found"};let H,W;try{H=k(q,"utf8"),W=k(Q,"utf8")}catch(_){return{error:!0,message:`Failed to read source files: ${_.message}`}}let K=H.replace("${content}",W);if(!K.includes("<!-- SUPERPOWERS_-_INSTRUCTIONS_START -->")||!K.includes("<!-- SUPERPOWERS_-_INSTRUCTIONS_END -->"))return{error:!0,message:"Template is missing required markers"};let z=jq(X);try{if(!L(z))F(`mkdir -p "${z}"`,{stdio:"pipe"})}catch(_){return{error:!0,message:`Failed to create .github directory: ${_.message}`}}if(L(X)){let _;try{_=k(X,"utf8")}catch(B){return{error:!0,message:`Failed to read existing file: ${B.message}`}}let G=new Date().toISOString().replace(/[:.]/g,"-"),V=`${X}.backup-${G}`;try{F(`cp "${X}" "${V}"`,{stdio:"pipe"})}catch(B){return{error:!0,message:`Failed to backup: ${B.message}`}}if(_.includes("<!-- SUPERPOWERS_-_INSTRUCTIONS_START -->")&&_.includes("<!-- SUPERPOWERS_-_INSTRUCTIONS_END -->")){let B=new RegExp("<!-- SUPERPOWERS_-_INSTRUCTIONS_START -->[\\s\\S]*?<!-- SUPERPOWERS_-_INSTRUCTIONS_END -->","g"),I=_.replace(B,K.trim());try{return r(X,I,"utf8"),{updated:!0,backup:V}}catch(J){return{error:!0,message:`Failed to update: ${J.message}`}}}else{let B=_.trimEnd()+`
113
+ `)},yQ=()=>{console.log("Installing Windows aliases..."),console.log("✓ Windows alias installation (implementation pending)")},u$=()=>{let $=jQ();if(console.log(`## Installing Universal Aliases
114
+ `),$==="win32")return yQ();else return PQ()},SQ=($)=>{let q=v(E.superpowersRepo,".github","copilot-instructions.md"),Q=v(E.superpowersRepo,"skills","meta","using-superpowers","SKILL.md"),X=v($,".github","copilot-instructions.md"),Z="<!-- SUPERPOWERS_-_INSTRUCTIONS_START -->",Y="<!-- SUPERPOWERS_-_INSTRUCTIONS_END -->";if(!J(q))return{error:!0,message:"Source template not found"};if(!J(Q))return{error:!0,message:"using-superpowers SKILL.md not found"};let H,W;try{H=u(q,"utf8"),W=u(Q,"utf8")}catch(G){return{error:!0,message:`Failed to read source files: ${G.message}`}}let K=H.replace("${content}",W);if(!K.includes("<!-- SUPERPOWERS_-_INSTRUCTIONS_START -->")||!K.includes("<!-- SUPERPOWERS_-_INSTRUCTIONS_END -->"))return{error:!0,message:"Template is missing required markers"};let z=fq(X);try{if(!J(z))F(`mkdir -p "${z}"`,{stdio:"pipe"})}catch(G){return{error:!0,message:`Failed to create .github directory: ${G.message}`}}if(J(X)){let G;try{G=u(X,"utf8")}catch(B){return{error:!0,message:`Failed to read existing file: ${B.message}`}}let _=new Date().toISOString().replace(/[:.]/g,"-"),V=`${X}.backup-${_}`;try{F(`cp "${X}" "${V}"`,{stdio:"pipe"})}catch(B){return{error:!0,message:`Failed to backup: ${B.message}`}}if(G.includes("<!-- SUPERPOWERS_-_INSTRUCTIONS_START -->")&&G.includes("<!-- SUPERPOWERS_-_INSTRUCTIONS_END -->")){let B=new RegExp("<!-- SUPERPOWERS_-_INSTRUCTIONS_START -->[\\s\\S]*?<!-- SUPERPOWERS_-_INSTRUCTIONS_END -->","g"),U=G.replace(B,K.trim());try{return s(X,U,"utf8"),{updated:!0,backup:V}}catch(w){return{error:!0,message:`Failed to update: ${w.message}`}}}else{let B=G.trimEnd()+`
113
115
 
114
116
  `+K.trim()+`
115
- `;try{return r(X,B,"utf8"),{updated:!0,backup:V}}catch(I){return{error:!0,message:`Failed to append: ${I.message}`}}}}else try{return r(X,K,"utf8"),{created:!0}}catch(_){return{error:!0,message:`Failed to create: ${_.message}`}}},fq=()=>{D(),console.log(`# Setting up Superpowers skills for this project
116
- `);let $=process.cwd(),q=v($,".agents"),Q=v(q,"skills"),X=v($,"AGENTS.md"),Z=v(q,"AGENTS.md"),Y=L(X)?X:Z,H=v(E.superpowersRepo,".agents","templates","AGENTS.md.template");if(!L(H)){console.log(`✗ Error: AGENTS.md template not found
117
+ `;try{return s(X,B,"utf8"),{updated:!0,backup:V}}catch(U){return{error:!0,message:`Failed to append: ${U.message}`}}}}else try{return s(X,K,"utf8"),{created:!0}}catch(G){return{error:!0,message:`Failed to create: ${G.message}`}}},Pq=()=>{D(),console.log(`# Setting up Superpowers skills for this project
118
+ `);let $=process.cwd(),q=v($,".agents"),Q=v(q,"skills"),X=v($,"AGENTS.md"),Z=v(q,"AGENTS.md"),Y=J(X)?X:Z,H=v(E.superpowersRepo,".agents","templates","AGENTS.md.template");if(!J(H)){console.log(`✗ Error: AGENTS.md template not found
117
119
  Expected at: ${H}
118
- Please update your Superpowers installation`);return}if(!L(q))try{F(`mkdir -p "${q}"`,{stdio:"pipe"}),console.log("✓ Created .agents/ directory")}catch(w){console.log(`✗ Failed to create .agents/ directory: ${w.message}`);return}else console.log("✓ .agents/ directory exists");if(!L(Q))try{F(`mkdir -p "${Q}"`,{stdio:"pipe"}),F(`touch "${v(Q,".gitkeep")}"`,{stdio:"pipe"}),console.log("✓ Created .agents/skills/ directory")}catch(w){console.log(`✗ Failed to create skills directory: ${w.message}`);return}else console.log("✓ .agents/skills/ directory exists");let W=v(q,"docs"),K=v(W,"SUPERPOWERS.md"),z=v(E.superpowersRepo,".agents","templates","SUPERPOWERS.md.template");if(!L(W))try{F(`mkdir -p "${W}"`,{stdio:"pipe"}),console.log("✓ Created .agents/docs/ directory")}catch(w){console.log(`⚠️ Failed to create docs directory: ${w.message}`)}else console.log("✓ .agents/docs/ directory exists");let _=L(Y);if(_){let w=new Date().toISOString().split("T")[0],E$=`${Y}.backup-${w}`;try{F(`cp "${Y}" "${E$}"`,{stdio:"pipe"}),console.log(`✓ Backed up existing AGENTS.md to ${o(E$).base}`)}catch(iq){console.log(`✗ Failed to backup AGENTS.md: ${iq.message}`);return}}let G;try{G=k(H,"utf8")}catch(w){console.log(`✗ Failed to read template: ${w.message}`);return}let V=R();if(G=G.replace(/\{\{VERSION\}\}/g,V),L(z))try{let w=k(z,"utf8"),E$=new Date().toISOString().split("T")[0];w=w.replace(/\{\{VERSION\}\}/g,V),w=w.replace(/\{\{DATE\}\}/g,E$),r(K,w,"utf8"),console.log("✓ Created .agents/docs/SUPERPOWERS.md")}catch(w){console.log(`⚠️ Failed to create SUPERPOWERS.md: ${w.message}`)}else console.log("⚠️ SUPERPOWERS.md.template not found");let B=[],I=v($,".github","copilot-instructions.md"),J=v(E.home,".github","copilot-instructions.md");if(L(I)||L(J)||U.copilot.check())B.push("github-copilot");let M=v($,"CLAUDE.md"),u=v(q,"CLAUDE.md");if(L(M)||L(u)||U.claude.check())B.push("claude-code");let f=v($,"GEMINI.md"),h$=v(q,"GEMINI.md");if(L(f)||L(h$)||U.gemini.check())B.push("gemini");if(U.cursor.check())B.push("cursor");if(U.opencode.check())B.push("opencode");if(U.codex.check())B.push("codex");console.log(`
120
+ Please update your Superpowers installation`);return}if(!J(q))try{F(`mkdir -p "${q}"`,{stdio:"pipe"}),console.log("✓ Created .agents/ directory")}catch(T){console.log(`✗ Failed to create .agents/ directory: ${T.message}`);return}else console.log("✓ .agents/ directory exists");if(!J(Q))try{F(`mkdir -p "${Q}"`,{stdio:"pipe"}),F(`touch "${v(Q,".gitkeep")}"`,{stdio:"pipe"}),console.log("✓ Created .agents/skills/ directory")}catch(T){console.log(`✗ Failed to create skills directory: ${T.message}`);return}else console.log("✓ .agents/skills/ directory exists");let W=v(q,"docs"),K=v(W,"SUPERPOWERS.md"),z=v(E.superpowersRepo,".agents","templates","SUPERPOWERS.md.template");if(!J(W))try{F(`mkdir -p "${W}"`,{stdio:"pipe"}),console.log("✓ Created .agents/docs/ directory")}catch(T){console.log(`⚠️ Failed to create docs directory: ${T.message}`)}else console.log("✓ .agents/docs/ directory exists");let G=J(Y);if(G){let T=new Date().toISOString().split("T")[0],W$=`${Y}.backup-${T}`;try{F(`cp "${Y}" "${W$}"`,{stdio:"pipe"}),console.log(`✓ Backed up existing AGENTS.md to ${r(W$).base}`)}catch(oq){console.log(`✗ Failed to backup AGENTS.md: ${oq.message}`);return}}let _;try{_=u(H,"utf8")}catch(T){console.log(`✗ Failed to read template: ${T.message}`);return}let V=R();if(_=_.replace(/\{\{VERSION\}\}/g,V),J(z))try{let T=u(z,"utf8"),W$=new Date().toISOString().split("T")[0];T=T.replace(/\{\{VERSION\}\}/g,V),T=T.replace(/\{\{DATE\}\}/g,W$),s(K,T,"utf8"),console.log("✓ Created .agents/docs/SUPERPOWERS.md")}catch(T){console.log(`⚠️ Failed to create SUPERPOWERS.md: ${T.message}`)}else console.log("⚠️ SUPERPOWERS.md.template not found");let B=[],U=v($,".github","copilot-instructions.md"),w=v(E.home,".github","copilot-instructions.md");if(J(U)||J(w)||L.copilot.check())B.push("github-copilot");let M=v($,"CLAUDE.md"),d=v(q,"CLAUDE.md");if(J(M)||J(d)||L.claude.check())B.push("claude-code");let P=v($,"GEMINI.md"),c$=v(q,"GEMINI.md");if(J(P)||J(c$)||L.gemini.check())B.push("gemini");if(L.cursor.check())B.push("cursor");if(L.opencode.check())B.push("opencode");if(L.codex.check())B.push("codex");console.log(`
119
121
  Detected platforms for project: ${B.join(", ")||"none"}
120
- `);let lq=B.filter((w)=>["github-copilot","cursor","opencode","codex"].includes(w)),s=H$(Y,G,lq,!_);if(s.created)console.log(`✓ Created AGENTS.md with platform tool mappings (${Y===X?"root":".agents/"})`);else if(s.updated)console.log(`✓ Updated AGENTS.md with platform tool mappings (${Y===X?"root":".agents/"})`);else if(s.error)console.log("⚠️ Failed to update AGENTS.md");let b$=L(M)?M:u,y=H$(b$,G,["claude-code"],!1);if(y.created)console.log(`✓ Created CLAUDE.md with Claude Code tool mappings (${b$===M?"root":".agents/"})`);else if(y.updated){if(console.log(`✓ Updated CLAUDE.md with Claude Code tool mappings (${b$===M?"root":".agents/"})`),y.backup)console.log(` Backed up to ${o(y.backup).base}`)}else if(y.skipped)console.log("ℹ️ Skipped CLAUDE.md (does not exist)");else if(y.error)console.log("⚠️ Failed to update CLAUDE.md");let A$=L(f)?f:h$,S=H$(A$,G,["gemini"],!1);if(S.created)console.log(`✓ Created GEMINI.md with Gemini tool mappings (${A$===f?"root":".agents/"})`);else if(S.updated){if(console.log(`✓ Updated GEMINI.md with Gemini tool mappings (${A$===f?"root":".agents/"})`),S.backup)console.log(` Backed up to ${o(S.backup).base}`)}else if(S.skipped)console.log("ℹ️ Skipped GEMINI.md (does not exist)");else if(S.error)console.log("⚠️ Failed to update GEMINI.md");let W$=v($,".github","copilot-instructions.md"),j={skipped:!0};if(B.includes("github-copilot")){if(j=SQ($),j.created)console.log("✓ Created .github/copilot-instructions.md with Superpowers instructions");else if(j.updated){if(console.log("✓ Updated .github/copilot-instructions.md with Superpowers instructions"),j.backup)console.log(` Backed up to ${o(j.backup).base}`)}else if(j.error)console.log(`⚠️ Failed to update .github/copilot-instructions.md: ${j.message||""}`)}else console.log("ℹ️ Skipped .github/copilot-instructions.md (GitHub Copilot not detected)");let p$=!L(X)&&!L(Z);if(L(W$)&&p$){let w=H$(W$,G,["github-copilot"],!1);if(w.updated){if(console.log("✓ Updated .github/copilot-instructions.md with GitHub Copilot tool mappings"),w.backup)console.log(` Backed up to ${o(w.backup).base}`)}else if(w.error)console.log("⚠️ Failed to update .github/copilot-instructions.md with tool mappings")}else if(L(W$)&&!p$)console.log("ℹ️ Skipped .github/copilot-instructions.md tool mappings (AGENTS.md exists, using that instead)");else if(!L(W$)&&!B.includes("github-copilot"))console.log("ℹ️ Skipped .github/copilot-instructions.md tool mappings (does not exist)");console.log(`
122
+ `);let iq=B.filter((T)=>["github-copilot","cursor","opencode","codex"].includes(T)),t=Z$(Y,_,iq,!G);if(t.created)console.log(`✓ Created AGENTS.md with platform tool mappings (${Y===X?"root":".agents/"})`);else if(t.updated)console.log(`✓ Updated AGENTS.md with platform tool mappings (${Y===X?"root":".agents/"})`);else if(t.error)console.log("⚠️ Failed to update AGENTS.md");let A$=J(M)?M:d,y=Z$(A$,_,["claude-code"],!1);if(y.created)console.log(`✓ Created CLAUDE.md with Claude Code tool mappings (${A$===M?"root":".agents/"})`);else if(y.updated){if(console.log(`✓ Updated CLAUDE.md with Claude Code tool mappings (${A$===M?"root":".agents/"})`),y.backup)console.log(` Backed up to ${r(y.backup).base}`)}else if(y.skipped)console.log("ℹ️ Skipped CLAUDE.md (does not exist)");else if(y.error)console.log("⚠️ Failed to update CLAUDE.md");let b$=J(P)?P:c$,S=Z$(b$,_,["gemini"],!1);if(S.created)console.log(`✓ Created GEMINI.md with Gemini tool mappings (${b$===P?"root":".agents/"})`);else if(S.updated){if(console.log(`✓ Updated GEMINI.md with Gemini tool mappings (${b$===P?"root":".agents/"})`),S.backup)console.log(` Backed up to ${r(S.backup).base}`)}else if(S.skipped)console.log("ℹ️ Skipped GEMINI.md (does not exist)");else if(S.error)console.log("⚠️ Failed to update GEMINI.md");let H$=v($,".github","copilot-instructions.md"),j={skipped:!0};if(B.includes("github-copilot")){if(j=SQ($),j.created)console.log("✓ Created .github/copilot-instructions.md with Superpowers instructions");else if(j.updated){if(console.log("✓ Updated .github/copilot-instructions.md with Superpowers instructions"),j.backup)console.log(` Backed up to ${r(j.backup).base}`)}else if(j.error)console.log(`⚠️ Failed to update .github/copilot-instructions.md: ${j.message||""}`)}else console.log("ℹ️ Skipped .github/copilot-instructions.md (GitHub Copilot not detected)");let n$=!J(X)&&!J(Z);if(J(H$)&&n$){let T=Z$(H$,_,["github-copilot"],!1);if(T.updated){if(console.log("✓ Updated .github/copilot-instructions.md with GitHub Copilot tool mappings"),T.backup)console.log(` Backed up to ${r(T.backup).base}`)}else if(T.error)console.log("⚠️ Failed to update .github/copilot-instructions.md with tool mappings")}else if(J(H$)&&!n$)console.log("ℹ️ Skipped .github/copilot-instructions.md tool mappings (AGENTS.md exists, using that instead)");else if(!J(H$)&&!B.includes("github-copilot"))console.log("ℹ️ Skipped .github/copilot-instructions.md tool mappings (does not exist)");console.log(`
121
123
  ## Syncing Project Skill Symlinks
122
- `);let c=Dq({projectRoot:$});if(c.created>0)console.log(`
123
- ✓ Created ${c.created} project skill symlink(s)`);else if(c.existed>0)console.log("ℹ️ Project skill symlinks already exist");else if(c.errors.length>0)console.log("⚠️ Some symlinks could not be created");else console.log("ℹ️ No agent directories detected for symlinking");let P=`
124
+ `);let n=jq({projectRoot:$});if(n.created>0)console.log(`
125
+ ✓ Created ${n.created} project skill symlink(s)`);else if(n.existed>0)console.log("ℹ️ Project skill symlinks already exist");else if(n.errors.length>0)console.log("⚠️ Some symlinks could not be created");else console.log("ℹ️ No agent directories detected for symlinking");let g=`
124
126
  # Setup complete!
125
127
 
126
128
  Your project now has:
127
- - .agents/ directory structure`;if(s.updated||s.created)P+=`
128
- - AGENTS.md with universal skills instructions`;if(y.updated||y.created)P+=`
129
- - CLAUDE.md with Claude Code skills instructions`;if(S.updated||S.created)P+=`
130
- - GEMINI.md with Gemini skills instructions`;if(j.updated||j.created)P+=`
131
- - .github/copilot-instructions.md with Superpowers instructions`;if(c.created>0)P+=`
132
- - ${c.created} project skill symlink(s) to agent directories`;P+=`
133
- - .agents/skills/ ready for project-specific skills`,P+=`
129
+ - .agents/ directory structure`;if(t.updated||t.created)g+=`
130
+ - AGENTS.md with universal skills instructions`;if(y.updated||y.created)g+=`
131
+ - CLAUDE.md with Claude Code skills instructions`;if(S.updated||S.created)g+=`
132
+ - GEMINI.md with Gemini skills instructions`;if(j.updated||j.created)g+=`
133
+ - .github/copilot-instructions.md with Superpowers instructions`;if(n.created>0)g+=`
134
+ - ${n.created} project skill symlink(s) to agent directories`;g+=`
135
+ - .agents/skills/ ready for project-specific skills`,g+=`
134
136
  - .agents/docs/SUPERPOWERS.md for detailed reference
135
- `,console.log(P)},PQ=()=>{let $=[...["brainstorming.prompt.md","execute-plan.prompt.md","write-plan.prompt.md","setup-skills.prompt.md","create-meta-prompt.md","finding-skills.prompt.md","skills.prompt.md","use-skill.prompt.md","using-a-skill.prompt.md"].map((Q)=>v(E.vscodeUserDir,"prompts",Q)),...["brainstorming.md","create-meta-prompt.md","execute-plan.md","finding-skills.md","skills.md","use-skill.md","using-a-skill.md","write-plan.md","setup-skills.md"].map((Q)=>v(E.home,".cursor","commands",Q)),...["brainstorm.md","create-meta-prompt.md","execute-plan.md","finding-skills.md","skills.md","use-skill.md","using-a-skill.md","write-plan.md","setup-skills.md"].map((Q)=>v(E.home,".claude","commands",Q)),...["brainstorm.md","create-meta-prompt.md","execute-plan.md","finding-skills.md","skills.md","use-skill.md","using-a-skill.md","write-plan.md","setup-skills.md"].map((Q)=>v(E.home,".config","opencode","command",Q)),...["brainstorm.md","create-meta-prompt.md","execute-plan.md","finding-skills.md","skills.md","use-skill.md","using-a-skill.md","write-plan.md","setup-skills.md"].map((Q)=>v(E.home,".codex","prompts",Q)),...["brainstorm-with-superpowers.toml","create-meta-prompt.toml","execute-plan.toml","finding-skills.toml","skills.toml","use-skill.toml","using-a-skill.toml","write-plan.toml","setup-skills.toml"].map((Q)=>v(E.home,".gemini","commands",Q))],q=0;for(let Q of $)if(L(Q))try{RQ(Q),q++}catch(X){console.log(` ⚠️ Could not remove ${Q}: ${X.message}`)}if(q>0)console.log(`✓ Removed ${q} legacy prompt/command file${q!==1?"s":""}`);else console.log("✓ No legacy prompt/command files found")},yq=async()=>{D(),console.log(`# Superpowers Bootstrap for Agents
137
+ `,console.log(g)},gQ=()=>{let $=[...["brainstorming.prompt.md","execute-plan.prompt.md","write-plan.prompt.md","setup-skills.prompt.md","create-meta-prompt.md","finding-skills.prompt.md","skills.prompt.md","use-skill.prompt.md","using-a-skill.prompt.md"].map((Q)=>v(E.vscodeUserDir,"prompts",Q)),...["brainstorming.md","create-meta-prompt.md","execute-plan.md","finding-skills.md","skills.md","use-skill.md","using-a-skill.md","write-plan.md","setup-skills.md"].map((Q)=>v(E.home,".cursor","commands",Q)),...["brainstorm.md","create-meta-prompt.md","execute-plan.md","finding-skills.md","skills.md","use-skill.md","using-a-skill.md","write-plan.md","setup-skills.md"].map((Q)=>v(E.home,".claude","commands",Q)),...["brainstorm.md","create-meta-prompt.md","execute-plan.md","finding-skills.md","skills.md","use-skill.md","using-a-skill.md","write-plan.md","setup-skills.md"].map((Q)=>v(E.home,".config","opencode","command",Q)),...["brainstorm.md","create-meta-prompt.md","execute-plan.md","finding-skills.md","skills.md","use-skill.md","using-a-skill.md","write-plan.md","setup-skills.md"].map((Q)=>v(E.home,".codex","prompts",Q)),...["brainstorm-with-superpowers.toml","create-meta-prompt.toml","execute-plan.toml","finding-skills.toml","skills.toml","use-skill.toml","using-a-skill.toml","write-plan.toml","setup-skills.toml"].map((Q)=>v(E.home,".gemini","commands",Q))],q=0;for(let Q of $)if(J(Q))try{DQ(Q),q++}catch(X){console.log(` ⚠️ Could not remove ${Q}: ${X.message}`)}if(q>0)console.log(`✓ Removed ${q} legacy prompt/command file${q!==1?"s":""}`);else console.log("✓ No legacy prompt/command files found")},yq=async()=>{D(),console.log(`# Superpowers Bootstrap for Agents
136
138
  # ==================================
137
- `);let $=process.argv.includes("--no-update"),Q=new Set(["copilot","cursor","codex","gemini","claude","opencode"].filter((H)=>process.argv.includes(`--force-${H}`))),X=Q.size>0;if(!$){let H=X$(),W=await _$();if(W.error)console.log(`## Update Check
139
+ `);let $=process.argv.includes("--no-update"),Q=new Set(["copilot","cursor","codex","gemini","claude","opencode"].filter((H)=>process.argv.includes(`--force-${H}`))),X=Q.size>0;if(!$){let H=Q$(),W=await G$();if(W.error)console.log(`## Update Check
138
140
 
139
141
  ⚠️ Could not check for updates (network issue)
140
142
 
@@ -143,9 +145,9 @@ Your project now has:
143
145
  `),console.log(`⚠️ Update available: v${W.localVersion} → v${W.remoteVersion}
144
146
  To update, run: \`npm install -g @complexthings/superpowers-agent\``),console.log(`
145
147
  ---
146
- `)}if(!X)g$(),console.log(`---
148
+ `)}if(!X)u$(),console.log(`---
147
149
  `);if(!X)console.log(`## Cleaning Up Legacy Files
148
- `),PQ(),console.log(`
150
+ `),gQ(),console.log(`
149
151
  ---
150
152
  `);if(!X||Q.has("copilot"))console.log(`## GitHub Copilot Integration
151
153
  `),console.log("✓ Skill symlinks handled in sync step below"),console.log(`
@@ -154,47 +156,47 @@ Your project now has:
154
156
  `),O$(),console.log(`
155
157
  ---
156
158
  `);if(!X||Q.has("codex")){if(console.log(`## OpenAI Codex Integration
157
- `),!U.codex.check())console.log(`⚠️ Skipped (${U.codex.name} CLI not detected)
159
+ `),!L.codex.check())console.log(`⚠️ Skipped (${L.codex.name} CLI not detected)
158
160
  \uD83D\uDCA1 To enable Codex integration:
159
- 1. Install Codex: ${U.codex.installUrl}
160
- 2. Run: superpowers-agent ${U.codex.bootstrapCommand}`);else console.log("✓ Skill symlinks handled in sync step below");console.log(`
161
+ 1. Install Codex: ${L.codex.installUrl}
162
+ 2. Run: superpowers-agent ${L.codex.bootstrapCommand}`);else console.log("✓ Skill symlinks handled in sync step below");console.log(`
161
163
  ---
162
164
  `)}if(!X||Q.has("gemini")){if(console.log(`## Gemini Integration
163
- `),!U.gemini.check())console.log(`⚠️ Skipped (${U.gemini.name} CLI not detected)
165
+ `),!L.gemini.check())console.log(`⚠️ Skipped (${L.gemini.name} CLI not detected)
164
166
  \uD83D\uDCA1 To enable Gemini integration:
165
- 1. Install Gemini: ${U.gemini.installUrl}
166
- 2. Run: superpowers-agent ${U.gemini.bootstrapCommand}`);else console.log("✓ Skill symlinks handled in sync step below");console.log(`
167
+ 1. Install Gemini: ${L.gemini.installUrl}
168
+ 2. Run: superpowers-agent ${L.gemini.bootstrapCommand}`);else console.log("✓ Skill symlinks handled in sync step below");console.log(`
167
169
  ---
168
170
  `)}if(!X||Q.has("claude")){if(console.log(`## Claude Code Integration
169
- `),!U.claude.check())console.log(`⚠️ Skipped (${U.claude.name} CLI not detected)
171
+ `),!L.claude.check())console.log(`⚠️ Skipped (${L.claude.name} CLI not detected)
170
172
  \uD83D\uDCA1 To enable Claude Code integration:
171
- 1. Install Claude Code: ${U.claude.installUrl}
172
- 2. Run: superpowers-agent ${U.claude.bootstrapCommand}`);else console.log("✓ Skill symlinks handled in sync step below");console.log(`
173
+ 1. Install Claude Code: ${L.claude.installUrl}
174
+ 2. Run: superpowers-agent ${L.claude.bootstrapCommand}`);else console.log("✓ Skill symlinks handled in sync step below");console.log(`
173
175
  ---
174
176
  `)}if(!X||Q.has("opencode")){if(console.log(`## OpenCode Integration
175
- `),U.opencode.check())Jq();else console.log(`⚠️ Skipped (${U.opencode.name} CLI not detected)
177
+ `),L.opencode.check())wq();else console.log(`⚠️ Skipped (${L.opencode.name} CLI not detected)
176
178
  \uD83D\uDCA1 To enable OpenCode integration:
177
- 1. Install OpenCode: ${U.opencode.installUrl}
178
- 2. Run: superpowers-agent ${U.opencode.bootstrapCommand}`);console.log(`
179
+ 1. Install OpenCode: ${L.opencode.installUrl}
180
+ 2. Run: superpowers-agent ${L.opencode.bootstrapCommand}`);console.log(`
179
181
  ---
180
182
  `)}if(!X){console.log(`## Generating Platform-Specific Files
181
- `);let H=Uq();console.log(`Detected platforms: ${H.join(", ")||"none"}
182
- `);let W=v(E.superpowersRepo,".agents","templates","AGENTS.md.template"),K="";try{K=k(W,"utf8")}catch(z){console.log(`⚠️ Could not read AGENTS.md template: ${z.message}
183
- `)}if(K){let z=R();K=K.replace(/\{\{VERSION\}\}/g,z);let _=v(E.home,".agents","AGENTS.md"),G=H$(_,K,H,!0);if(G.created)console.log(`✓ Created ${_}`);else if(G.updated)console.log(`✓ Updated ${_}`)}console.log(`
183
+ `);let H=Lq();console.log(`Detected platforms: ${H.join(", ")||"none"}
184
+ `);let W=v(E.superpowersRepo,".agents","templates","AGENTS.md.template"),K="";try{K=u(W,"utf8")}catch(z){console.log(`⚠️ Could not read AGENTS.md template: ${z.message}
185
+ `)}if(K){let z=R();K=K.replace(/\{\{VERSION\}\}/g,z);let G=v(E.home,".agents","AGENTS.md"),_=Z$(G,K,H,!0);if(_.created)console.log(`✓ Created ${G}`);else if(_.updated)console.log(`✓ Updated ${G}`)}console.log(`
184
186
  ---
185
187
  `)}console.log(`## Syncing Skill Symlinks
186
- `);let Z=process.argv.includes("--force");Fq({force:Z,forceAgents:Q}),console.log(`
188
+ `);let Z=process.argv.includes("--force");xq({force:Z,forceAgents:Q}),console.log(`
187
189
  ## Syncing Repo Skills -> ~/.agents/skills/
188
- `);let Y=Rq();if(Y.created>0||Y.updated>0)console.log(` ✓ ${Y.created} created, ${Y.updated} updated, ${Y.existed} already current`);else if(Y.errors.length>0)for(let H of Y.errors)console.log(` ⚠️ ${H}`);else console.log(` ✓ ${Y.existed} skill symlinks already up to date`);console.log(`
190
+ `);let Y=Dq();if(Y.created>0||Y.updated>0)console.log(` ✓ ${Y.created} created, ${Y.updated} updated, ${Y.existed} already current`);else if(Y.errors.length>0)for(let H of Y.errors)console.log(` ⚠️ ${H}`);else console.log(` ✓ ${Y.existed} skill symlinks already up to date`);console.log(`
189
191
  ---
190
192
  `),console.log(`# Bootstrap Complete!
191
193
  `),console.log("✓ All integrations installed"),console.log("✓ Skills system ready"),console.log(`✓ Skill symlinks synced
192
- `),console.log("Next steps:"),console.log(" - Run `superpowers-agent find-skills` to see available skills"),console.log(" - Run `superpowers-agent setup-skills` in your project directory")};import{existsSync as x,readFileSync as J$,mkdirSync as aQ,rmSync as lQ,cpSync as iQ}from"fs";import{join as A,dirname as w$,parse as L$,sep as oQ}from"path";import{execSync as N}from"child_process";import{homedir as p}from"os";import{readFileSync as kQ,existsSync as d$,unlinkSync as uQ,lstatSync as dQ,mkdirSync as mQ}from"fs";import{join as hQ,dirname as pQ}from"path";import{join as U$}from"path";import{homedir as gQ}from"os";var k$={github:{name:"github",sourceDir:".github/agents",sourceExt:".agent.md",getDestDir:()=>U$(E.vscodeUserDir,"prompts"),destExt:".agent.md"},opencode:{name:"opencode",sourceDir:".opencode/agents",sourceExt:".md",getDestDir:()=>U$(gQ(),".config","opencode","agents"),destExt:".md"}};function Sq($,q,Q){let X=k$[q];if(!X)return null;return U$($,X.sourceDir,`${Q}${X.sourceExt}`)}function Pq($,q){let Q=k$[$];if(!Q)return null;return U$(Q.getDestDir(),`${q}${Q.destExt}`)}function u$(){return Object.keys(k$)}function cQ($){if(!$||typeof $!=="object")return{valid:!1,error:"agents.json must be a JSON object"};if(!$.version||typeof $.version!=="string")return{valid:!1,error:'agents.json must have a "version" string field'};if(!$.agents||typeof $.agents!=="object")return{valid:!1,error:'agents.json must have an "agents" object field'};let q=u$(),Q=[];for(let[X,Z]of Object.entries($.agents)){if(!q.includes(X)){Q.push(X);continue}if(!Array.isArray(Z))return{valid:!1,error:`agents.${X} must be an array of agent names`};for(let Y of Z)if(typeof Y!=="string")return{valid:!1,error:`agents.${X} must contain only string agent names`}}return{valid:!0,data:$,skippedPlatforms:Q}}function nQ($,q){if(!d$($))return{installed:!1,error:`Source file not found: ${$}`};if(d$(q))try{if(!dQ(q).isSymbolicLink())uQ(q)}catch(X){}mQ(pQ(q),{recursive:!0});let Q=Z$($,q);if(Q.error)return{installed:!1,error:Q.error};return{installed:!0}}function m$($,q={}){let Q=hQ($,"agents.json");if(!d$(Q))return;let X;try{X=JSON.parse(kQ(Q,"utf8"))}catch(B){console.log(`
193
- ⚠ Could not parse agents.json: ${B.message}`);return}let Z=cQ(X);if(!Z.valid){console.log(`
194
+ `),console.log("Next steps:"),console.log(" - Run `superpowers-agent find-skills` to see available skills"),console.log(" - Run `superpowers-agent setup-skills` in your project directory")};import{existsSync as x,readFileSync as v$,mkdirSync as lQ,rmSync as iQ,cpSync as oQ}from"fs";import{join as b,dirname as w$,parse as L$,sep as rQ}from"path";import{execSync as N}from"child_process";import{homedir as c}from"os";import{readFileSync as uQ,existsSync as h$,unlinkSync as dQ,lstatSync as mQ,mkdirSync as hQ}from"fs";import{join as pQ,dirname as cQ}from"path";import{join as U$}from"path";import{homedir as kQ}from"os";var d$={github:{name:"github",sourceDir:".github/agents",sourceExt:".agent.md",getDestDir:()=>U$(E.vscodeUserDir,"prompts"),destExt:".agent.md"},opencode:{name:"opencode",sourceDir:".opencode/agents",sourceExt:".md",getDestDir:()=>U$(kQ(),".config","opencode","agents"),destExt:".md"}};function Sq($,q,Q){let X=d$[q];if(!X)return null;return U$($,X.sourceDir,`${Q}${X.sourceExt}`)}function gq($,q){let Q=d$[$];if(!Q)return null;return U$(Q.getDestDir(),`${q}${Q.destExt}`)}function m$(){return Object.keys(d$)}function nQ($){if(!$||typeof $!=="object")return{valid:!1,error:"agents.json must be a JSON object"};if(!$.version||typeof $.version!=="string")return{valid:!1,error:'agents.json must have a "version" string field'};if(!$.agents||typeof $.agents!=="object")return{valid:!1,error:'agents.json must have an "agents" object field'};let q=m$(),Q=[];for(let[X,Z]of Object.entries($.agents)){if(!q.includes(X)){Q.push(X);continue}if(!Array.isArray(Z))return{valid:!1,error:`agents.${X} must be an array of agent names`};for(let Y of Z)if(typeof Y!=="string")return{valid:!1,error:`agents.${X} must contain only string agent names`}}return{valid:!0,data:$,skippedPlatforms:Q}}function aQ($,q){if(!h$($))return{installed:!1,error:`Source file not found: ${$}`};if(h$(q))try{if(!mQ(q).isSymbolicLink())dQ(q)}catch(X){}hQ(cQ(q),{recursive:!0});let Q=Y$($,q);if(Q.error)return{installed:!1,error:Q.error};return{installed:!0}}function p$($,q={}){let Q=pQ($,"agents.json");if(!h$(Q))return;let X;try{X=JSON.parse(uQ(Q,"utf8"))}catch(B){console.log(`
195
+ ⚠ Could not parse agents.json: ${B.message}`);return}let Z=nQ(X);if(!Z.valid){console.log(`
194
196
  ⚠ Invalid agents.json: ${Z.error}`);return}for(let B of Z.skippedPlatforms)console.log(` ⚠ Skipping unknown platform: ${B}`);let Y=X.repository||"unknown",H=X.version,W=q.isUpdate?"Updating":"Installing",K=q.isUpdate?"Updated":"Installed";console.log(`
195
- \uD83D\uDCE6 Found agents.json (${Y} v${H})`);let z=u$(),_=0,G=0,V=[];for(let[B,I]of Object.entries(X.agents)){if(!z.includes(B))continue;console.log(`
196
- ${W} ${B} agents:`);for(let J of I){let M=Sq($,B,J),u=Pq(B,J),f=nQ(M,u);if(f.installed)console.log(` ✓ ${J}`),V.push({platformKey:B,agentName:J,sourcePath:M,destPath:u}),_++;else console.log(` ✗ ${J}: ${f.error}`),G++}}if(V.length>0){let B=h(!0);if(!B.installedAgents)B.installedAgents={};if(!B.installedAgents[Y])B.installedAgents[Y]={version:H,agents:{}};B.installedAgents[Y].version=H;for(let{platformKey:I,agentName:J,sourcePath:M,destPath:u}of V){if(!B.installedAgents[Y].agents[I])B.installedAgents[Y].agents[I]={};B.installedAgents[Y].agents[I][J]={source:M,destination:u,installedAt:new Date().toISOString()}}n(B,!0)}if(_>0)console.log(`
197
- ${K} ${_} agent(s)${G>0?` (${G} failed)`:""}`)}var gq=($,q)=>{if(q.type==="local"){let X=$;for(let Z=0;Z<10;Z++){if(x(A(X,"agents.json")))return X;let Y=w$(X);if(Y===X)break;X=Y}return $}let Q=A(".agents","tmp");if($.includes(Q)){let X=$.indexOf(Q),Y=$.substring(X+Q.length+1).split(oQ)[0];return A($.substring(0,X),".agents","tmp",Y)}return $},kq=($,q)=>{let Q=A(p(),".agents","repos"),X=q.replace(/^@/,"").replace(/[^a-zA-Z0-9_-]/g,"_"),Z=A(Q,X);try{if(aQ(Q,{recursive:!0}),x(Z))lQ(Z,{recursive:!0,force:!0});return iQ($,Z,{recursive:!0}),Z}catch(Y){return console.log(` Warning: Could not persist repository for agents: ${Y.message}`),null}},uq=($)=>{let q=$.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)$/);if(q){let[,Z,Y,H,W]=q;return{type:"git-tree",repoUrl:`https://github.com/${Z}/${Y}.git`,branch:H,path:W,original:$}}let Q=$.match(/^git@github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/);if(Q){let[,Z,Y]=Q;return{type:"git-repo",repoUrl:`git@github.com:${Z}/${Y}.git`,branch:null,path:null,original:$}}let X=$.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)(?:\.git)?$/);if(X){let[,Z,Y]=X;return{type:"git-repo",repoUrl:`https://github.com/${Z}/${Y}.git`,branch:null,path:null,original:$}}if(x($))return{type:"local",path:$,original:$};return null},dq=($)=>{let q=$.includes("--global")||$.includes("-g"),Q=$.includes("--project")||$.includes("-p");if(q)return A(p(),".agents","skills");if(Q)return A(process.cwd(),".agents","skills");let X=A(process.cwd(),".agents","config.json"),Z=A(p(),".agents","config.json");for(let Y of[X,Z])if(x(Y))try{if(JSON.parse(J$(Y,"utf8")).installLocation==="project")return A(process.cwd(),".agents","skills")}catch(H){}return A(p(),".agents","skills")},mq=($,q)=>{let Q=A(p(),".agents","tmp",`skill-install-${Date.now()}`);try{if(N(`mkdir -p "${Q}"`,{stdio:"pipe"}),q)N(`git clone --branch ${q} --depth 1 "${$}" "${Q}"`,{stdio:"pipe",timeout:30000});else N(`git clone --depth 1 "${$}" "${Q}"`,{stdio:"pipe",timeout:30000});return Q}catch(X){try{N(`rm -rf "${Q}"`,{stdio:"pipe"})}catch{}throw Error(`Failed to clone repository: ${X.message}`)}},T$=($)=>{let q=A($,"skill.json");if(!x(q))return null;try{let Q=J$(q,"utf8");return JSON.parse(Q)}catch(Q){throw Error(`Failed to read skill.json: ${Q.message}`)}},v$=($,q,Q,X)=>{let Z=A($,q);if(!x(Z)){X.errors.push(`Skill directory not found: ${q}`);return}let Y=T$(Z);if(!Y){X.errors.push(`No skill.json found in: ${q}`);return}let H=Y.name||q,W=A(Q,H),K=w$(W);try{N(`mkdir -p "${K}"`,{stdio:"pipe"})}catch(z){X.errors.push(`Failed to create directory ${K}: ${z.message}`);return}try{if(x(W))N(`rm -rf "${W}"`,{stdio:"pipe"});N(`cp -R "${Z}" "${W}"`,{stdio:"pipe"}),X.installed.push({name:H,path:W,title:Y.title||Y.description||H})}catch(z){X.errors.push(`Failed to install ${q}: ${z.message}`)}},hq=()=>{let $=process.argv.slice(3),q=$.find((z)=>!z.startsWith("-")),Q=$.filter((z)=>z.startsWith("-"));if(!q){console.log(`Usage: superpowers-agent add <url-or-path|@alias> [skill-path] [options]
197
+ \uD83D\uDCE6 Found agents.json (${Y} v${H})`);let z=m$(),G=0,_=0,V=[];for(let[B,U]of Object.entries(X.agents)){if(!z.includes(B))continue;console.log(`
198
+ ${W} ${B} agents:`);for(let w of U){let M=Sq($,B,w),d=gq(B,w),P=aQ(M,d);if(P.installed)console.log(` ✓ ${w}`),V.push({platformKey:B,agentName:w,sourcePath:M,destPath:d}),G++;else console.log(` ✗ ${w}: ${P.error}`),_++}}if(V.length>0){let B=p(!0);if(!B.installedAgents)B.installedAgents={};if(!B.installedAgents[Y])B.installedAgents[Y]={version:H,agents:{}};B.installedAgents[Y].version=H;for(let{platformKey:U,agentName:w,sourcePath:M,destPath:d}of V){if(!B.installedAgents[Y].agents[U])B.installedAgents[Y].agents[U]={};B.installedAgents[Y].agents[U][w]={source:M,destination:d,installedAt:new Date().toISOString()}}a(B,!0)}if(G>0)console.log(`
199
+ ${K} ${G} agent(s)${_>0?` (${_} failed)`:""}`)}var kq=($,q)=>{if(q.type==="local"){let X=$;for(let Z=0;Z<10;Z++){if(x(b(X,"agents.json")))return X;let Y=w$(X);if(Y===X)break;X=Y}return $}let Q=b(".agents","tmp");if($.includes(Q)){let X=$.indexOf(Q),Y=$.substring(X+Q.length+1).split(rQ)[0];return b($.substring(0,X),".agents","tmp",Y)}return $},uq=($,q)=>{let Q=b(c(),".agents","repos"),X=q.replace(/^@/,"").replace(/[^a-zA-Z0-9_-]/g,"_"),Z=b(Q,X);try{if(lQ(Q,{recursive:!0}),x(Z))iQ(Z,{recursive:!0,force:!0});return oQ($,Z,{recursive:!0}),Z}catch(Y){return console.log(` Warning: Could not persist repository for agents: ${Y.message}`),null}},dq=($)=>{let q=$.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)$/);if(q){let[,Z,Y,H,W]=q;return{type:"git-tree",repoUrl:`https://github.com/${Z}/${Y}.git`,branch:H,path:W,original:$}}let Q=$.match(/^git@github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/);if(Q){let[,Z,Y]=Q;return{type:"git-repo",repoUrl:`git@github.com:${Z}/${Y}.git`,branch:null,path:null,original:$}}let X=$.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/);if(X){let[,Z,Y]=X;return{type:"git-repo",repoUrl:`https://github.com/${Z}/${Y}.git`,branch:null,path:null,original:$}}if(x($))return{type:"local",path:$,original:$};return null},mq=($)=>{let q=$.includes("--global")||$.includes("-g"),Q=$.includes("--project")||$.includes("-p");if(q)return b(c(),".agents","skills");if(Q)return b(process.cwd(),".agents","skills");let X=b(process.cwd(),".agents","config.json"),Z=b(c(),".agents","config.json");for(let Y of[X,Z])if(x(Y))try{if(JSON.parse(v$(Y,"utf8")).installLocation==="project")return b(process.cwd(),".agents","skills")}catch(H){}return b(c(),".agents","skills")},hq=($,q)=>{let Q=b(c(),".agents","tmp",`skill-install-${Date.now()}`);try{if(N(`mkdir -p "${Q}"`,{stdio:"pipe"}),q)N(`git clone --branch ${q} --depth 1 "${$}" "${Q}"`,{stdio:"pipe",timeout:30000});else N(`git clone --depth 1 "${$}" "${Q}"`,{stdio:"pipe",timeout:30000});return Q}catch(X){try{N(`rm -rf "${Q}"`,{stdio:"pipe"})}catch{}throw Error(`Failed to clone repository: ${X.message}`)}},T$=($)=>{let q=b($,"skill.json");if(!x(q))return null;try{let Q=v$(q,"utf8");return JSON.parse(Q)}catch(Q){throw Error(`Failed to read skill.json: ${Q.message}`)}},J$=($,q,Q,X)=>{let Z=b($,q);if(!x(Z)){X.errors.push(`Skill directory not found: ${q}`);return}let Y=T$(Z);if(!Y){X.errors.push(`No skill.json found in: ${q}`);return}let H=Y.name||q,W=b(Q,H),K=w$(W);try{N(`mkdir -p "${K}"`,{stdio:"pipe"})}catch(z){X.errors.push(`Failed to create directory ${K}: ${z.message}`);return}try{if(x(W))N(`rm -rf "${W}"`,{stdio:"pipe"});N(`cp -R "${Z}" "${W}"`,{stdio:"pipe"}),X.installed.push({name:H,path:W,title:Y.title||Y.description||H})}catch(z){X.errors.push(`Failed to install ${q}: ${z.message}`)}},pq=()=>{let $=process.argv.slice(3),q=$.find((z)=>!z.startsWith("-")),Q=$.filter((z)=>z.startsWith("-"));if(!q){console.log(`Usage: superpowers-agent add <url-or-path|@alias> [skill-path] [options]
198
200
 
199
201
  Options:
200
202
  --global, -g Install skills globally in ~/.agents/skills/ (default)
@@ -216,19 +218,19 @@ Description:
216
218
 
217
219
  Repository aliases can be added using:
218
220
  superpowers-agent add-repository <git-url> [--as=@alias]`);return}console.log(`Installing skill(s)...
219
- `);let X=null,Z=null;if(q.startsWith("@")){let z=q;Z=$.find((B,I)=>I>0&&!B.startsWith("-")&&B!==z);let _=g(!1),G=g(!0);if(_[z])X=_[z],console.log(`Using project repository alias: ${z}`);else if(G[z])X=G[z],console.log(`Using global repository alias: ${z}`);else{console.log(`Error: Repository alias not found: ${z}`),console.log(`
220
- Available aliases:`);let B={...G,..._};if(Object.keys(B).length===0)console.log(" (none)"),console.log(`
221
- Add a repository using:`),console.log(" superpowers-agent add-repository <git-url>");else for(let[I,J]of Object.entries(B))console.log(` ${I} -> ${J}`);return}let V=x(X);if(Z)if(V)q=A(X,Z),console.log(`Repository path: ${X}`),console.log(`Skill path: ${Z}
221
+ `);let X=null,Z=null;if(q.startsWith("@")){let z=q;Z=$.find((B,U)=>U>0&&!B.startsWith("-")&&B!==z);let G=k(!1),_=k(!0);if(G[z])X=G[z],console.log(`Using project repository alias: ${z}`);else if(_[z])X=_[z],console.log(`Using global repository alias: ${z}`);else{console.log(`Error: Repository alias not found: ${z}`),console.log(`
222
+ Available aliases:`);let B={..._,...G};if(Object.keys(B).length===0)console.log(" (none)"),console.log(`
223
+ Add a repository using:`),console.log(" superpowers-agent add-repository <git-url>");else for(let[U,w]of Object.entries(B))console.log(` ${U} -> ${w}`);return}let V=x(X);if(Z)if(V)q=b(X,Z),console.log(`Repository path: ${X}`),console.log(`Skill path: ${Z}
222
224
  `);else q=`${X}/tree/main/${Z}`,console.log(`Repository URL: ${X}`),console.log(`Skill path: ${Z}
223
225
  `);else if(q=X,V)console.log(`Repository path: ${X}
224
226
  `);else console.log(`Repository URL: ${X}
225
- `)}let Y=uq(q);if(!Y){console.log(`Error: Invalid URL or path not found: ${q}`);return}let H=dq(Q);console.log(`Install location: ${H}
226
- `);let W,K=!1;try{if(Y.type==="git-repo"||Y.type==="git-tree"){if(console.log(`Cloning repository: ${Y.repoUrl}`),Y.branch)console.log(`Branch: ${Y.branch}`);if(W=mq(Y.repoUrl,Y.branch),K=!0,Y.path){if(W=A(W,Y.path),!x(W))throw Error(`Path not found in repository: ${Y.path}`)}console.log("")}else W=Y.path;let z=T$(W);if(!z)throw Error("No skill.json found in source directory");let _={installed:[],errors:[],source:Y.original};if(z.skills&&Array.isArray(z.skills)){console.log(`Found ${z.skills.length} skill(s) to install
227
- `);for(let B of z.skills)v$(W,B,H,_)}else{let B=z.name||L$(W).base;v$(w$(W),L$(W).base,H,_)}let G=gq(W,Y),V=A(G,"agents.json");if(x(V)){let B=G;if(K){let I;try{I=JSON.parse(J$(V,"utf8"))}catch{}let J=I?.repository||Y.original,M=kq(G,J);if(M)B=M}m$(B,{isUpdate:!1})}if(K&&W)try{let B=W.split("/.agents/tmp/")[0]+"/.agents/tmp/"+W.split("/.agents/tmp/")[1].split("/")[0];N(`rm -rf "${B}"`,{stdio:"pipe"})}catch{}if(console.log(`
228
- **Successfully installed skills:**`),console.log(`- Source: ${_.source}`),_.installed.length>0)for(let B of _.installed)console.log(` - Installed: ${B.name} at ${B.path}`),console.log(` ${B.title}`);if(_.errors.length>0){console.log(`
229
- **Errors:**`);for(let B of _.errors)console.log(` - ${B}`)}if(_.installed.length===0&&_.errors.length===0)console.log(" No skills were installed");if(_.installed.length>0)console.log(`
230
- **Syncing skill symlinks...**`),P$()}catch(z){if(K&&W)try{let _=W.split("/.agents/tmp/")[0]+"/.agents/tmp/"+W.split("/.agents/tmp/")[1].split("/")[0];N(`rm -rf "${_}"`,{stdio:"pipe"})}catch{}console.log(`
231
- Error: ${z.message}`)}},pq=()=>{let $=process.argv.slice(3),q=$.find((z)=>!z.startsWith("-")),Q=$.filter((z)=>z.startsWith("-"));if(!q){console.log(`Usage: superpowers-agent pull <url-or-path|@alias> [skill-path] [options]
227
+ `)}let Y=dq(q);if(!Y){console.log(`Error: Invalid URL or path not found: ${q}`);return}let H=mq(Q);console.log(`Install location: ${H}
228
+ `);let W,K=!1;try{if(Y.type==="git-repo"||Y.type==="git-tree"){if(console.log(`Cloning repository: ${Y.repoUrl}`),Y.branch)console.log(`Branch: ${Y.branch}`);if(W=hq(Y.repoUrl,Y.branch),K=!0,Y.path){if(W=b(W,Y.path),!x(W))throw Error(`Path not found in repository: ${Y.path}`)}console.log("")}else W=Y.path;let z=T$(W);if(!z)throw Error("No skill.json found in source directory");let G={installed:[],errors:[],source:Y.original};if(z.skills&&Array.isArray(z.skills)){console.log(`Found ${z.skills.length} skill(s) to install
229
+ `);for(let B of z.skills)J$(W,B,H,G)}else{let B=z.name||L$(W).base;J$(w$(W),L$(W).base,H,G)}let _=kq(W,Y),V=b(_,"agents.json");if(x(V)){let B=_;if(K){let U;try{U=JSON.parse(v$(V,"utf8"))}catch{}let w=U?.repository||Y.original,M=uq(_,w);if(M)B=M}p$(B,{isUpdate:!1})}if(K&&W)try{let B=W.split("/.agents/tmp/")[0]+"/.agents/tmp/"+W.split("/.agents/tmp/")[1].split("/")[0];N(`rm -rf "${B}"`,{stdio:"pipe"})}catch{}if(console.log(`
230
+ **Successfully installed skills:**`),console.log(`- Source: ${G.source}`),G.installed.length>0)for(let B of G.installed)console.log(` - Installed: ${B.name} at ${B.path}`),console.log(` ${B.title}`);if(G.errors.length>0){console.log(`
231
+ **Errors:**`);for(let B of G.errors)console.log(` - ${B}`)}if(G.installed.length===0&&G.errors.length===0)console.log(" No skills were installed");if(G.installed.length>0)console.log(`
232
+ **Syncing skill symlinks...**`),k$()}catch(z){if(K&&W)try{let G=W.split("/.agents/tmp/")[0]+"/.agents/tmp/"+W.split("/.agents/tmp/")[1].split("/")[0];N(`rm -rf "${G}"`,{stdio:"pipe"})}catch{}console.log(`
233
+ Error: ${z.message}`)}},cq=()=>{let $=process.argv.slice(3),q=$.find((z)=>!z.startsWith("-")),Q=$.filter((z)=>z.startsWith("-"));if(!q){console.log(`Usage: superpowers-agent pull <url-or-path|@alias> [skill-path] [options]
232
234
 
233
235
  Options:
234
236
  --global, -g Update skills globally in ~/.agents/skills/ (default)
@@ -253,19 +255,19 @@ Description:
253
255
 
254
256
  Repository aliases can be added using:
255
257
  superpowers-agent add-repository <git-url> [--as=@alias]`);return}console.log(`Updating skill(s)...
256
- `);let X=null,Z=null;if(q.startsWith("@")){let z=q;Z=$.find((B,I)=>I>0&&!B.startsWith("-")&&B!==z);let _=g(!1),G=g(!0);if(_[z])X=_[z],console.log(`Using project repository alias: ${z}`);else if(G[z])X=G[z],console.log(`Using global repository alias: ${z}`);else{console.log(`Error: Repository alias not found: ${z}`),console.log(`
257
- Available aliases:`);let B={...G,..._};if(Object.keys(B).length===0)console.log(" (none)"),console.log(`
258
- Add a repository using:`),console.log(" superpowers-agent add-repository <git-url>");else for(let[I,J]of Object.entries(B))console.log(` ${I} -> ${J}`);return}let V=x(X);if(Z)if(V)q=A(X,Z),console.log(`Repository path: ${X}`),console.log(`Skill path: ${Z}
258
+ `);let X=null,Z=null;if(q.startsWith("@")){let z=q;Z=$.find((B,U)=>U>0&&!B.startsWith("-")&&B!==z);let G=k(!1),_=k(!0);if(G[z])X=G[z],console.log(`Using project repository alias: ${z}`);else if(_[z])X=_[z],console.log(`Using global repository alias: ${z}`);else{console.log(`Error: Repository alias not found: ${z}`),console.log(`
259
+ Available aliases:`);let B={..._,...G};if(Object.keys(B).length===0)console.log(" (none)"),console.log(`
260
+ Add a repository using:`),console.log(" superpowers-agent add-repository <git-url>");else for(let[U,w]of Object.entries(B))console.log(` ${U} -> ${w}`);return}let V=x(X);if(Z)if(V)q=b(X,Z),console.log(`Repository path: ${X}`),console.log(`Skill path: ${Z}
259
261
  `);else q=`${X}/tree/main/${Z}`,console.log(`Repository URL: ${X}`),console.log(`Skill path: ${Z}
260
262
  `);else if(q=X,V)console.log(`Repository path: ${X}
261
263
  `);else console.log(`Repository URL: ${X}
262
- `)}let Y=uq(q);if(!Y){console.log(`Error: Invalid URL or path not found: ${q}`);return}let H=dq(Q);console.log(`Install location: ${H}
263
- `);let W,K=!1;try{if(Y.type==="git-repo"||Y.type==="git-tree"){if(console.log(`Cloning repository: ${Y.repoUrl}`),Y.branch)console.log(`Branch: ${Y.branch}`);if(W=mq(Y.repoUrl,Y.branch),K=!0,Y.path){if(W=A(W,Y.path),!x(W))throw Error(`Path not found in repository: ${Y.path}`)}console.log("")}else W=Y.path;let z=T$(W);if(!z)throw Error("No skill.json found in source directory");let _={installed:[],errors:[],source:Y.original};if(z.skills&&Array.isArray(z.skills)){console.log(`Found ${z.skills.length} skill(s) to update
264
- `);for(let B of z.skills)v$(W,B,H,_)}else{let B=z.name||L$(W).base;v$(w$(W),L$(W).base,H,_)}let G=gq(W,Y),V=A(G,"agents.json");if(x(V)){let B=G;if(K){let I;try{I=JSON.parse(J$(V,"utf8"))}catch{}let J=I?.repository||Y.original,M=kq(G,J);if(M)B=M}m$(B,{isUpdate:!0})}if(K&&W)try{let B=W.split("/.agents/tmp/")[0]+"/.agents/tmp/"+W.split("/.agents/tmp/")[1].split("/")[0];N(`rm -rf "${B}"`,{stdio:"pipe"})}catch{}if(console.log(`
265
- **Successfully updated skills:**`),console.log(`- Source: ${_.source}`),_.installed.length>0)for(let B of _.installed)console.log(` - Updated: ${B.name} at ${B.path}`),console.log(` ${B.title}`);if(_.errors.length>0){console.log(`
266
- **Errors:**`);for(let B of _.errors)console.log(` - ${B}`)}if(_.installed.length===0&&_.errors.length===0)console.log(" No skills were updated");if(_.installed.length>0)console.log(`
267
- **Syncing skill symlinks...**`),P$()}catch(z){if(K&&W)try{let _=W.split("/.agents/tmp/")[0]+"/.agents/tmp/"+W.split("/.agents/tmp/")[1].split("/")[0];N(`rm -rf "${_}"`,{stdio:"pipe"})}catch{}console.log(`
268
- Error: ${z.message}`)}},cq=()=>{let $=process.argv.slice(3),q=$.find((z)=>!z.startsWith("-")),Q=$.filter((z)=>z.startsWith("-"));if(!q){console.log(`Usage: superpowers-agent add-repository <git-url> [options]
264
+ `)}let Y=dq(q);if(!Y){console.log(`Error: Invalid URL or path not found: ${q}`);return}let H=mq(Q);console.log(`Install location: ${H}
265
+ `);let W,K=!1;try{if(Y.type==="git-repo"||Y.type==="git-tree"){if(console.log(`Cloning repository: ${Y.repoUrl}`),Y.branch)console.log(`Branch: ${Y.branch}`);if(W=hq(Y.repoUrl,Y.branch),K=!0,Y.path){if(W=b(W,Y.path),!x(W))throw Error(`Path not found in repository: ${Y.path}`)}console.log("")}else W=Y.path;let z=T$(W);if(!z)throw Error("No skill.json found in source directory");let G={installed:[],errors:[],source:Y.original};if(z.skills&&Array.isArray(z.skills)){console.log(`Found ${z.skills.length} skill(s) to update
266
+ `);for(let B of z.skills)J$(W,B,H,G)}else{let B=z.name||L$(W).base;J$(w$(W),L$(W).base,H,G)}let _=kq(W,Y),V=b(_,"agents.json");if(x(V)){let B=_;if(K){let U;try{U=JSON.parse(v$(V,"utf8"))}catch{}let w=U?.repository||Y.original,M=uq(_,w);if(M)B=M}p$(B,{isUpdate:!0})}if(K&&W)try{let B=W.split("/.agents/tmp/")[0]+"/.agents/tmp/"+W.split("/.agents/tmp/")[1].split("/")[0];N(`rm -rf "${B}"`,{stdio:"pipe"})}catch{}if(console.log(`
267
+ **Successfully updated skills:**`),console.log(`- Source: ${G.source}`),G.installed.length>0)for(let B of G.installed)console.log(` - Updated: ${B.name} at ${B.path}`),console.log(` ${B.title}`);if(G.errors.length>0){console.log(`
268
+ **Errors:**`);for(let B of G.errors)console.log(` - ${B}`)}if(G.installed.length===0&&G.errors.length===0)console.log(" No skills were updated");if(G.installed.length>0)console.log(`
269
+ **Syncing skill symlinks...**`),k$()}catch(z){if(K&&W)try{let G=W.split("/.agents/tmp/")[0]+"/.agents/tmp/"+W.split("/.agents/tmp/")[1].split("/")[0];N(`rm -rf "${G}"`,{stdio:"pipe"})}catch{}console.log(`
270
+ Error: ${z.message}`)}},nq=()=>{let $=process.argv.slice(3),q=$.find((z)=>!z.startsWith("-")),Q=$.filter((z)=>z.startsWith("-"));if(!q){console.log(`Usage: superpowers-agent add-repository <git-url> [options]
269
271
 
270
272
  Options:
271
273
  --global, -g Add repository globally in ~/.agents/config.json (default)
@@ -283,9 +285,9 @@ Description:
283
285
  The repository's skill.json will be read to determine the default alias.
284
286
  Use --as to specify a custom alias.
285
287
  After adding, you can install skills using: superpowers-agent add @alias path/to/skill`);return}console.log(`Adding repository...
286
- `);let X=Q.some((z)=>z==="--global"||z==="-g"),Z=Q.some((z)=>z==="--project"||z==="-p"),Y=Q.find((z)=>z.startsWith("--as=")),H=Y?Y.split("=")[1]:null,W=Z?!1:!0,K;try{console.log(`Cloning repository: ${q}`),K=A(p(),".agents","tmp",`repo-add-${Date.now()}`),N(`mkdir -p "${K}"`,{stdio:"pipe"}),N(`git clone --depth 1 "${q}" "${K}"`,{stdio:"pipe",timeout:30000}),console.log("");let z=T$(K);if(!z)throw Error("No skill.json found in repository");let _;if(H)_=H;else if(z.repository)_=z.repository;else{let B=q.match(/\/([^/]+?)(?:\.git)?$/);if(B)_="@"+B[1];else throw Error("Could not determine repository alias. Use --as=@alias to specify manually.")}Xq(_,q,W),N(`rm -rf "${K}"`,{stdio:"pipe"});let G=W?"globally":"in project",V=W?A(p(),".agents","config.json"):A(process.cwd(),".agents","config.json");console.log(`✓ Repository added ${G}`),console.log(` Alias: ${_}`),console.log(` URL: ${q}`),console.log(` Config: ${V}`),console.log(`
287
- You can now install skills using:`),console.log(` superpowers-agent add ${_} <path-to-skill>`)}catch(z){if(K)try{N(`rm -rf "${K}"`,{stdio:"pipe"})}catch{}console.log(`
288
- Error: ${z.message}`)}};import{dirname as rQ}from"path";var nq=($)=>{if(!$){console.log(`Usage: superpowers-agent use-skill <skill-name>
288
+ `);let X=Q.some((z)=>z==="--global"||z==="-g"),Z=Q.some((z)=>z==="--project"||z==="-p"),Y=Q.find((z)=>z.startsWith("--as=")),H=Y?Y.split("=")[1]:null,W=Z?!1:!0,K;try{console.log(`Cloning repository: ${q}`),K=b(c(),".agents","tmp",`repo-add-${Date.now()}`),N(`mkdir -p "${K}"`,{stdio:"pipe"}),N(`git clone --depth 1 "${q}" "${K}"`,{stdio:"pipe",timeout:30000}),console.log("");let z=T$(K);if(!z)throw Error("No skill.json found in repository");let G;if(H)G=H;else if(z.repository)G=z.repository;else{let B=q.match(/\/([^/]+?)(?:\.git)?$/);if(B)G="@"+B[1];else throw Error("Could not determine repository alias. Use --as=@alias to specify manually.")}Zq(G,q,W),N(`rm -rf "${K}"`,{stdio:"pipe"});let _=W?"globally":"in project",V=W?b(c(),".agents","config.json"):b(process.cwd(),".agents","config.json");console.log(`✓ Repository added ${_}`),console.log(` Alias: ${G}`),console.log(` URL: ${q}`),console.log(` Config: ${V}`),console.log(`
289
+ You can now install skills using:`),console.log(` superpowers-agent add ${G} <path-to-skill>`)}catch(z){if(K)try{N(`rm -rf "${K}"`,{stdio:"pipe"})}catch{}console.log(`
290
+ Error: ${z.message}`)}};import{dirname as sQ}from"path";var aq=($)=>{if(!$){console.log(`Usage: superpowers-agent use-skill <skill-name>
289
291
 
290
292
  Examples (smart matching):
291
293
  superpowers-agent use-skill brainstorming # Matches superpowers:collaboration/brainstorming
@@ -300,15 +302,15 @@ Examples (explicit paths):
300
302
  Smart matching:
301
303
  - Type just the skill name or any suffix of the path
302
304
  - Priority: .agents/skills/ > .claude/skills/ > ~/.agents/skills/ > ~/.agents/superpowers/skills/
303
- - If multiple skills match at same priority, you'll see them with descriptions`);return}let q=d($);if(!q){console.log(`Error: Skill not found: ${$}
305
+ - If multiple skills match at same priority, you'll see them with descriptions`);return}let q=m($);if(!q){console.log(`Error: Skill not found: ${$}
304
306
 
305
- Available skills:`),console.log("Run: superpowers-agent find-skills");return}let{skillFile:Q,sourceType:X,actualSkillPath:Z}=q;try{let{content:Y,frontmatter:H}=l$(Q),W=Q$[X].prefix+Z,K=rQ(Q),z=`# ${H.name||W}`;if(H.description)z+=`
307
+ Available skills:`),console.log("Run: superpowers-agent find-skills");return}let{skillFile:Q,sourceType:X,actualSkillPath:Z}=q;try{let{content:Y,frontmatter:H}=o$(Q),W=q$[X].prefix+Z,K=sQ(Q),z=`# ${H.name||W}`;if(H.description)z+=`
306
308
  # ${H.description}`;if(H.whenToUse)z+=`
307
309
  # When to use: ${H.whenToUse}`;z+=`
308
310
  # Supporting tools and docs are in ${K}
309
311
  # ============================================
310
312
 
311
- ${Y}`,console.log(z)}catch(Y){console.log(Y.message)}};var aq={bootstrap:yq,version:Iq,"check-updates":()=>{Vq().catch(($)=>{console.error($.message),process.exit(1)})},update:()=>{let $=process.argv.includes("--no-reinstall");j$({skipReinstall:$})},"config-get":_q,"config-set":Gq,"setup-skills":fq,"use-skill":()=>nq(process.argv[3]),execute:Eq,"find-skills":a,add:hq,"add-repository":cq,"list-repositories":Oq,pull:pq,dir:Kq,path:zq,"get-helpers":Bq,"install-cursor-hooks":O$,"install-aliases":g$,default:()=>{console.log(`Superpowers for Agents
313
+ ${Y}`,console.log(z)}catch(Y){console.log(Y.message)}};var lq={bootstrap:yq,version:Uq,"check-updates":()=>{Iq().catch(($)=>{console.error($.message),process.exit(1)})},update:()=>{let $=process.argv.includes("--no-reinstall");P$({skipReinstall:$})},"config-get":_q,"config-set":Oq,"setup-skills":Pq,"use-skill":()=>aq(process.argv[3]),execute:zq,"find-skills":l,add:pq,"add-repository":nq,"list-repositories":Vq,pull:cq,dir:Bq,path:Kq,"get-helpers":Gq,"install-cursor-hooks":O$,"install-aliases":u$,default:()=>{console.log(`Superpowers for Agents
312
314
  Usage:
313
315
  superpowers-agent bootstrap [--no-update] [--force] # Run complete bootstrap
314
316
  superpowers-agent version # Show current version
@@ -331,4 +333,4 @@ Usage:
331
333
  superpowers-agent install-aliases # Install universal aliases (superpowers, superpowers-agent)
332
334
 
333
335
  Documentation: https://github.com/complexthings/superpowers
334
- `)}},sQ=process.argv[2]||"default",tQ=aq[sQ]||aq.default;try{let $=tQ();if($&&typeof $.then==="function")$.catch((q)=>{console.error(`Error: ${q.message}`),process.exit(1)})}catch($){console.error(`Error: ${$.message}`),process.exit(1)}
336
+ `)}},tQ=process.argv[2]||"default",eQ=lq[tQ]||lq.default;try{let $=eQ();if($&&typeof $.then==="function")$.catch((q)=>{console.error(`Error: ${q.message}`),process.exit(1)})}catch($){console.error(`Error: ${$.message}`),process.exit(1)}
package/README.md CHANGED
@@ -85,13 +85,16 @@ Install Superpowers globally with one command:
85
85
 
86
86
  ```bash
87
87
  npm install -g @complexthings/superpowers-agent
88
+ superpowers-agent bootstrap
88
89
  ```
89
90
 
90
- The installer will:
91
- 1. Install to `~/.agents/superpowers` (global, works everywhere)
92
- 2. Set up universal aliases: `superpowers` and `superpowers-agent`
93
- 3. Sync skill symlinks for all detected agents
94
- 4. Optionally update project files (AGENTS.md)
91
+ ## Migration to Superpower Agent `^8.0.0`
92
+
93
+ ```bash
94
+ rm -rf ~/.local/bin/superpowers-agent ~/.local/bin/superpowers ~/.agents/superpowers
95
+ npm install -g @complexthings/superpowers-agent
96
+ superpowers-agent bootstrap
97
+ ```
95
98
 
96
99
  **After installation, you can use Superpowers from anywhere:**
97
100
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complexthings/superpowers-agent",
3
- "version": "8.2.0",
3
+ "version": "8.2.2",
4
4
  "description": "Superpowers agent CLI — skills system for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {