@complexthings/superpowers-agent 8.1.0 → 8.2.0

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,90 @@
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
+ Fix two issues introduced during the shell-to-npm migration, add a Husky pre-commit hook to keep versions synchronized, and update documentation to reflect today's changes. Target version: **8.2.0**.
8
+
9
+ ## Phase 1 — Discover
10
+
11
+ Before writing or modifying anything:
12
+
13
+ 1. Read `git.js` — locate the `checkForUpdates` function and understand its current Git-based logic.
14
+ 2. Read `output.js` — locate the `getLocalVersion` function and understand how it currently resolves the version.
15
+ 3. Read `./package.json` and `.agents/package.json` — note current version values and any relevant fields.
16
+ 4. Check if `husky` is already a dependency or if any `.husky/` directory exists.
17
+ 5. Identify how the CLI is built (confirm `bun i && bun run build` in `.agents/`).
18
+ 6. Read `README.md` and `CHANGELOG.md` to understand their current structure and formatting conventions.
19
+
20
+ ## Phase 2 — Fix: Update Checking
21
+
22
+ The `checkForUpdates` function in `git.js` currently checks the Git repo, which is unreliable post-migration.
23
+
24
+ 1. Create a new function that fetches the latest published version from the npm registry for the package (e.g., `https://registry.npmjs.org/@complexthings/superpowers-agent/latest`).
25
+ 2. Refactor `checkForUpdates` to use the npm registry function instead of the Git repo check.
26
+ 3. Compare the registry version against the locally installed version to determine if an update is available.
27
+
28
+ ## Phase 3 — Fix: Local Version Source
29
+
30
+ The `getLocalVersion` function in `output.js` should read the version from `.agents/package.json` (the Bun-built CLI tool's package manifest).
31
+
32
+ 1. Update `getLocalVersion` to read and parse `.agents/package.json` for its `version` field.
33
+ 2. Remove or replace any previous version resolution logic that no longer applies.
34
+
35
+ ## Phase 4 — Add: Husky Pre-Commit Hook
36
+
37
+ Add a `husky` pre-commit hook that enforces version parity between `./package.json` and `.agents/package.json`.
38
+
39
+ 1. Install `husky` as a dev dependency in the root. Initialize it (`npx husky init` or equivalent).
40
+ 2. Create a pre-commit hook script that does the following:
41
+ - Read `version` from `./package.json` and `.agents/package.json`.
42
+ - If versions match → proceed, no action needed.
43
+ - If versions differ:
44
+ 1. Determine the HIGHEST version (semver comparison).
45
+ 2. Update both `package.json` files to the highest version.
46
+ 3. Run `npm i --package-lock-only` in the repo root to sync `package-lock.json`.
47
+ 4. Run `bun i && bun run build` in `.agents/` to rebuild the CLI with the correct version.
48
+ 5. Stage the changed files (`package.json`, `package-lock.json`, `.agents/package.json`, and build output) into the current commit.
49
+ - Allow the commit to proceed.
50
+
51
+ ## Phase 5 — Update Documentation
52
+
53
+ 1. Update `CHANGELOG.md` for version **8.2.0** dated **2026-03-16**, following the existing format. Document today's changes:
54
+ - Update checking now uses npm registry instead of Git repo
55
+ - `getLocalVersion` now reads from `.agents/package.json`
56
+ - Added Husky pre-commit hook to enforce version parity between root and `.agents/` package manifests
57
+ 2. Update `README.md` to reflect any install, usage, or behavior changes introduced by these fixes. Preserve existing structure — only modify or add sections relevant to today's changes.
58
+ 3. Ensure both `./package.json` and `.agents/package.json` have version set to `8.2.0`.
59
+
60
+ ## Phase 6 — Verify
61
+
62
+ 1. Confirm `checkForUpdates` no longer references Git-based version checking.
63
+ 2. Confirm `getLocalVersion` reads from `.agents/package.json`.
64
+ 3. Simulate a version mismatch between `./package.json` and `.agents/package.json` — run the pre-commit hook manually and verify it syncs versions, updates lockfiles, rebuilds, and stages changes.
65
+ 4. Confirm a matching-version scenario passes the hook with no modifications.
66
+ 5. Confirm both `package.json` files show version `8.2.0`.
67
+ 6. Confirm `CHANGELOG.md` has a `8.2.0` entry and `README.md` reflects current behavior.
68
+
69
+ ## Completion Criteria
70
+
71
+ - `checkForUpdates` fetches latest version from npm registry, not Git
72
+ - `getLocalVersion` reads version from `.agents/package.json`
73
+ - Husky pre-commit hook installed and enforces version parity (highest wins)
74
+ - Hook runs lockfile update and Bun rebuild when versions diverge, then stages all changes
75
+ - Both `package.json` files set to version `8.2.0`
76
+ - `CHANGELOG.md` updated with `8.2.0` entry for 2026-03-16
77
+ - `README.md` updated to reflect current install/usage behavior
78
+ - No regressions in existing CLI functionality
79
+
80
+ ## Agent Instructions
81
+
82
+ - Spawn parallel subagents where tasks are independent; each subagent owns a single concern
83
+ - Use Claude Sonnet 4.6 model for subagents
84
+ - Phase 2 and Phase 3 are independent — run in parallel
85
+ - Phase 4 depends on Phase 1 discovery but is independent of Phases 2–3
86
+ - Phase 5 depends on Phases 2–4 completing (needs final change list)
87
+ - USE `leveraging-cli-tools` skill — use `rg`, `fd`, `jq`, `bat`, `ast-grep` over standard tools
88
+ - Reason from facts only — read actual files before writing or modifying anything
89
+ - Do not guess file contents, dependency structures, or platform behaviors — verify first
90
+ - Concise output only; no padding
@@ -4,48 +4,24 @@ You are working in an agentic coding environment with access to file system tool
4
4
 
5
5
  ## Objective
6
6
 
7
- Convert the existing shell-script-based installer (`./install.sh`, sourced from `https://raw.githubusercontent.com/blueacorninc/superpowers/main/install.sh`) into an npm package published as `@complexthings/superpowers-agent` that installs globally via `npm install -g @complexthings/superpowers-agent`.
8
-
9
- The company now blocks `.sh` files. The npm package must replicate the exact functionality of the current shell script across Mac, Linux, and Windows.
10
-
11
- ## Phase 1 Discover
12
-
13
- Before writing or modifying anything:
14
-
15
- 1. Read `./install.sh` end-to-end. Catalog every action it performs: downloads, symlinks, permission changes, config writes, environment setup, dependency checks, etc.
16
- 2. Read `package.json` (if it exists) and any existing repo structure to understand current state.
17
- 3. Identify platform-specific behaviors in the shell script (e.g., `uname` checks, path conventions, brew/apt usage).
18
- 4. Produce a checklist of every discrete behavior the npm package must replicate. Save to `MIGRATION_CHECKLIST.md`.
19
-
20
- ## Phase 2 Plan
21
-
22
- Based on the checklist from Phase 1:
23
-
24
- 1. Design the npm package structure: `package.json` (name, bin, files, engines, scripts), entry point(s), cross-platform helpers.
25
- 2. Determine how each shell action maps to a Node.js equivalent. Flag anything that cannot be done cross-platform without a native dependency.
26
- 3. Document the plan in `MIGRATION_PLAN.md` before writing implementation code.
27
-
28
- ## Phase 3 — Implement
29
-
30
- 1. Scaffold the npm package (`package.json`, bin entry, README).
31
- 2. Implement the installer logic in Node.js (ESM, `.mjs`). Use `node:` built-ins (`fs`, `path`, `os`, `child_process`) where possible; minimize external dependencies.
32
- 3. Handle platform detection (`process.platform`) for Mac, Linux, and Windows — no shell assumptions.
33
- 4. Ensure `npm install -g @complexthings/superpowers-agent` triggers the equivalent of what `./install.sh` does today via lifecycle scripts or a bin entry.
34
-
35
- ## Phase 4 — Verify
36
-
37
- 1. Run `node <entry>.mjs --help` (or equivalent) to confirm it executes without errors.
38
- 2. Dry-run the install logic if a `--dry-run` flag is feasible — list actions it would take.
39
- 3. Diff the behavior checklist from Phase 1 against the implementation. Flag any gaps.
40
- 4. Confirm `package.json` is valid JSON and `npm pack` succeeds.
41
-
42
- ## Completion Criteria
43
-
44
- - `MIGRATION_CHECKLIST.md` exists with every shell script behavior cataloged
45
- - `package.json` is properly configured with `name`, `bin`, `files`, `engines`
46
- - All shell script functionality is replicated in Node.js with cross-platform support (Mac, Linux, Windows)
47
- - `npm pack` succeeds without errors
48
- - No `.sh` files are required at install time
7
+ I want to fix some issues I've noticed since the migration.
8
+
9
+ Update checking:
10
+ - Right now it uses `checkForUpdates` in `git.js` which checks the Git Repo, but this is unreliable. Instead I'd like it to check the npm registry for the latest published version and compare it to the current version.
11
+ - This will require a new function to fetch the latest version from npm, and then update the existing `checkForUpdates` function to use that instead of the Git Repo.
12
+ Get Local Version:
13
+ - The `getLocalVersion` in `output.js` function should read the version from the `package.json` file in `.agents/pacakge.json` for the bun built superpowers-agent cli tool.
14
+
15
+ Additions I want:
16
+
17
+ - Add `husky` pre-commit hook to the repo:
18
+ - It needs to check the `package.json` file in the root of the repo and the `package.json` file in the `.agents` directory to ensure that their versions match before allowing a commit.
19
+ - IF they don't match
20
+ - THEN it needs to update the version to match in both, HIGHEST version wins
21
+ - THEN it needs to run `npm i --package-lock-only` in the root of the repo to ensure that the `package-lock.json` is updated with the new version for the root package as well.
22
+ - THEN it needs to run `bun i && bun run build` in the `.agents` directory to ensure that the built cli tool is updated with the new version as well.
23
+ - This will ensure that the versions are always in sync and that the built cli tool is always up to date with the version in the `package.json` files.
24
+ - Then add those changes to the commit and allow the commit to proceed.
49
25
 
50
26
  ## Agent Instructions
51
27
 
@@ -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 Bq,dirname as Gq,join as UQ}from"path";import{existsSync as S$}from"fs";import{homedir as o$,platform as tq}from"os";import{join as T,parse as eq,dirname as i$}from"path";import{existsSync as q$}from"fs";import{fileURLToPath as $Q}from"url";var qQ=$Q(import.meta.url),$$=i$(qQ),QQ=()=>{let $=o$();switch(tq()){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")}},XQ=()=>{let $=process.cwd(),Q=eq($).root;while($!==Q){if(q$(T($,".agents")))return $;$=i$($)}return process.cwd()},E={home:o$(),vscodeUserDir:QQ(),projectRoot:XQ(),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($$,"..","..","..","skills");if(q$($)&&q$(T($$,"..","..","..",".github","prompts")))return T($$,"..","..","..");return T(this.home,".agents","superpowers")},get homeSuperpowersSkills(){return T(this.superpowersRepo,"skills")},get isSuperpowersRepo(){let $=T($$,"..","..","..","skills");return q$($)&&q$(T($$,"..","..","..",".github","prompts"))}};import{readFileSync as r$}from"fs";var Q$=($)=>{try{let q=r$($,"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 W=Y.match(/^(\w+):\s*(.*)$/);if(W){let[,H,K]=W,z={name:"name",description:"description",when_to_use:"whenToUse"};if(z[H])X[z[H]]=K.trim()}}}return X}catch{return{name:"",description:"",whenToUse:""}}},s$=($)=>{try{let Q=r$($,"utf8"),q=Q$($),X=Q.split(`
5
- `),Z=!1,Y=!1,W=[];for(let H of X){if(H.trim()==="---"){if(Z){Y=!0;continue}Z=!0;continue}if(Y||!Z)W.push(H)}return{content:W.join(`
6
- `).trim(),frontmatter:q}}catch(Q){throw Error(`Error reading skill file: ${Q.message}`)}};import{existsSync as D$,readdirSync as $q,statSync as qq}from"fs";import{join as j$,relative as IX}from"path";import{readFileSync as YQ,existsSync as ZQ}from"fs";import{join as t$}from"path";var X$=($)=>{let Q=t$($,"skill.json");if(!ZQ(Q))return null;try{let q=YQ(Q,"utf8");return JSON.parse(q)}catch(q){return null}};var R$=($)=>{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\//,"")}},e$=($,Q)=>{let q=X$($);if(!q||!q.helpers||!Array.isArray(q.helpers))return null;let X=q.helpers,Z=Q.toLowerCase(),Y=null,W=0;for(let H of X){let K=H.toLowerCase();if(K===Z){Y=H;break}if(K.includes(Z)){let G=Z.length/K.length;if(G>W)W=G,Y=H}let z=H.split("/").pop().split(".")[0].toLowerCase();if(Z.includes(z)){let G=z.length/Z.length;if(G>W)W=G,Y=H}}return Y?t$($,Y):null},Y$={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 V$=($,Q,q=null)=>{let X=[];if(!D$($))return X;let Z=(Y,W)=>{if(q!==null&&W>q)return;try{let H=$q(Y,{withFileTypes:!0});for(let K of H){if(K.name==="node_modules"||K.name===".git"||K.name.startsWith("."))continue;let z=j$(Y,K.name),G=K.isDirectory();if(K.isSymbolicLink())try{G=qq(z).isDirectory()}catch{continue}if(!G)continue;let V=j$(z,"SKILL.md");if(D$(V))X.push(z);if(q===null||W<q)Z(z,W+1)}}catch{}};return Z($,0),X};var Qq=($,Q)=>{if(!D$($))return[];let q=[],X=Q.toLowerCase().replace(/\\/g,"/"),Z=(Y,W="")=>{try{let H=$q(Y,{withFileTypes:!0});for(let K of H){let z=j$(Y,K.name),G=W?`${W}/${K.name}`:K.name,V=K.isDirectory();if(K.isSymbolicLink())try{V=qq(z).isDirectory()}catch{continue}if(V&&(K.name==="node_modules"||K.name===".git"||K.name.startsWith(".")))continue;if(V)Z(z,G);else if(K.name==="SKILL.md"){let O=W.toLowerCase().replace(/\\/g,"/");if(O===X||O.endsWith("/"+X)||O.endsWith(X))q.push({file:z,path:W})}}}catch(H){}};return Z($),q},Xq=($,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 W=Y$[q].prefix+Z.path;try{let H=Q$(Z.file),K=H.description||H.whenToUse||"(no description)";console.log(` ${W}`),console.log(` ${K}
8
- `)}catch(H){console.log(` ${W}`),console.log(` (unable to read description)
9
- `)}}console.log("Please be more specific. Examples:");for(let Z of Q.slice(0,2)){let Y=Y$[q].prefix;console.log(` superpowers-agent execute ${Y}${Z.path}`)}};import{existsSync as P$}from"fs";import{join as HQ,relative as WQ}from"path";var EQ=($)=>{let{type:Q,path:q}=R$($),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((W)=>({type:Q,dir:W}));else if(E.isSuperpowersRepo&&P$(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:W}of Z){let H=Qq(W,q);if(H.length===1)return{skillFile:H[0].file,sourceType:Y,actualSkillPath:H[0].path};if(H.length>1)Xq(q,H,Y)}return null},d=($)=>{let Q=EQ($);if(Q)return Q;let{type:q,path:X}=R$($),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((H)=>({type:q,dir:H}));else if(E.isSuperpowersRepo&&P$(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:W,dir:H}of Y){if(!P$(H))continue;let K=V$(H,W,null);for(let z of K){let G=X$(z);if(G&&G.aliases&&Array.isArray(G.aliases)){let V=X.toLowerCase();for(let O of G.aliases)if(O.toLowerCase()===V){let B=HQ(z,"SKILL.md"),U=WQ(H,z);return{skillFile:B,sourceType:W,actualSkillPath:U}}}}}return null};import{readFileSync as Yq,writeFileSync as Zq,existsSync as y$}from"fs";import{join as m}from"path";import{execSync as zQ}from"child_process";var f$=()=>({auto_update:!0,last_update_check:null,last_updated_commit:null}),Z$=()=>{let $=m(E.superpowersRepo,".config.json");try{if(!y$($))return f$();let Q=Yq($,"utf8");return{...f$(),...JSON.parse(Q)}}catch{return f$()}},_$=($)=>{let Q=m(E.superpowersRepo,".config.json"),X={...Z$(),...$};try{Zq(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(!y$(Q))return{};try{let q=Yq(Q,"utf8");return JSON.parse(q)}catch(q){return{}}},a=($,Q)=>{let q=Q?m(E.home,".agents"):m(process.cwd(),".agents"),X=m(q,"config.json");try{if(!y$(q))zQ(`mkdir -p "${q}"`,{stdio:"pipe"});return Zq(X,JSON.stringify($,null,2),"utf8"),!0}catch(Z){throw Error(`Failed to write config: ${Z.message}`)}},S=($=!1)=>{return h($).repositories||{}},Hq=($,Q,q)=>{let X=h(q);if(!X.repositories)X.repositories={};X.repositories[$]=Q,a(X,q)};import{readFileSync as KQ}from"fs";import{join as Wq,dirname as BQ}from"path";import{fileURLToPath as GQ}from"url";import{existsSync as VQ}from"fs";import{execSync as _Q}from"child_process";var OQ=GQ(import.meta.url),Eq=BQ(OQ),g=()=>{try{let $=Wq(Eq,"package.json");if(!VQ($))$=Wq(Eq,"..","..","package.json");return JSON.parse(KQ($,"utf8")).version||"5.4.0"}catch($){return"5.4.0"}},R=()=>{let $=g();console.log(`^^SAV:${$}^^`)},zq=async()=>{try{let Q=_Q('curl -sS "https://raw.githubusercontent.com/complexthings/superpowers/main/.agents/package.json"',{encoding:"utf8",timeout:1e4}),q=JSON.parse(Q);if(!q.version)return g();return q.version}catch($){throw Error(`Failed to fetch remote version: ${$.message}`)}},Kq=($,Q)=>{let q=$.split(".").map(Number),X=Q.split(".").map(Number);for(let Z=0;Z<3;Z++){let Y=q[Z]||0,W=X[Z]||0;if(Y>W)return!0;if(Y<W)return!1}return!1};var LQ={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:"}},IQ=($,Q)=>{let q=UQ($,"SKILL.md"),{dir:X,prefix:Z}=LQ[Q],Y=Bq(E[X],$).replace(/\\/g,"/");console.log(`${Z}${Y}`);let{description:W,whenToUse:H}=Q$(q);if(W)console.log(` ${W}`);if(H)console.log(` When to use: ${H}`);console.log("")},l=()=>{R();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=V$(X,q,Z);for(let W of Y){let H=Bq(X,W);if(!$.has(H))$.add(H),IQ(W,q)}}console.log(`Usage:
10
- superpowers-agent execute <skill-name> # Load a specific skill`)},Vq=()=>{R();let $=process.argv[3];if(!$){console.log(`Usage: superpowers-agent execute <skill-name-or-alias>
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(`
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}
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>
11
11
 
12
12
  Examples:
13
13
  superpowers-agent execute brainstorming
@@ -17,26 +17,26 @@ 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=d($);if(!q){console.log(`Error: Skill not found: ${$}
21
21
 
22
- Available skills:`),l();return}let{skillFile:q,sourceType:X}=Q,Z=process.cwd(),Y=q.startsWith(Z),W=S$(E.projectAgentsSkills)||S$(E.projectClaudeSkills);if(Y)console.log(`Open this file with your Read Tool: ${q}
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}
23
23
 
24
24
  <IMPORTANT>
25
25
  USE YOUR Read Tool to process this file. DO NOT use \`cat\` or print commands.
26
- </IMPORTANT>`);else if(W&&X!=="project")console.log(`Open this file with your Read Tool: ${q}
26
+ </IMPORTANT>`);else if(H&&X!=="project")console.log(`Open this file with your Read Tool: ${Q}
27
27
 
28
28
  <IMPORTANT>
29
29
  1. Try using your Read Tool first
30
- 2. If your Read tool fails (file outside workspace), use: cat "${q}"
30
+ 2. If your Read tool fails (file outside workspace), use: cat "${Q}"
31
31
  3. Consider using workspace-local skills for better tool compatibility
32
32
  Run: superpowers-agent setup-skills
33
- </IMPORTANT>`);else console.log(`Open this file with your Read Tool: ${q}
33
+ </IMPORTANT>`);else console.log(`Open this file with your Read Tool: ${Q}
34
34
 
35
35
  <IMPORTANT>
36
36
  1. Try using your Read Tool first
37
- 2. If your Read tool fails (file outside workspace), use: cat "${q}"
37
+ 2. If your Read tool fails (file outside workspace), use: cat "${Q}"
38
38
  3. NEVER skip loading the skill content
39
- </IMPORTANT>`)},_q=()=>{let $=process.argv[3];if(!$){console.log(`Usage: superpowers-agent path <skill-name-or-alias>
39
+ </IMPORTANT>`)},zq=()=>{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=d($);if(!q){console.log(`Error: Skill not found: ${$}
50
50
 
51
- Available skills:`),l();return}let{skillFile:q}=Q;console.log(q)},Oq=()=>{let $=process.argv[3];if(!$){console.log(`Usage: superpowers-agent dir <skill-name>
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>
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=d($);if(!q){console.log(`Error: Skill not found: ${$}
62
62
 
63
- Available skills:`),l();return}let{skillFile:q}=Q,X=Gq(q);console.log(X)},Uq=()=>{R();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:`),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>
64
64
 
65
65
  Examples:
66
66
  superpowers-agent get-helpers block-collection search-block
@@ -72,150 +72,129 @@ 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=d($);if(!Q){console.log(`Error: Skill not found: ${$}
76
76
 
77
- Available skills:`),l();return}let{skillFile:X}=q,Z=Gq(X),Y=X$(Z);if(!Y){console.log(`Error: No skill.json found for skill: ${$}
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: ${$}
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 W=e$(Z,Q);if(!W){console.log(`Error: No helper found matching "${Q}" in skill: ${$}`),console.log(`
80
- Available helpers:`);for(let H of Y.helpers)console.log(` - ${H}`);return}if(!S$(W)){console.log(`Error: Helper file not found: ${W}
81
- Defined in skill.json but missing from filesystem`);return}console.log(W)},Lq=()=>{let $=Z$();console.log("Current configuration:"),console.log(JSON.stringify($,null,2))},Iq=()=>{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=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>
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,_$(X),console.log(`✓ Set ${$} = ${q}`)},vq=()=>{R();let $=S(!0),Q=S(!1),q=[];for(let[Y,W]of Object.entries($))q.push({alias:Y,url:W,source:"global"});for(let[Y,W]of Object.entries(Q)){let H=q.findIndex((K)=>K.alias===Y);if(H>=0)q[H]={alias:Y,url:W,source:"project"};else q.push({alias:Y,url:W,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,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.
89
89
 
90
90
  Add a repository using:
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
- `),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)`)};import{execSync as PQ}from"child_process";import{execSync as p}from"child_process";var vQ=()=>{try{return p("git status --porcelain --untracked-files=no",{cwd:E.superpowersRepo,encoding:"utf8",stdio:"pipe",timeout:3000}).trim().length===0}catch{return!1}},H$=()=>{try{return p("git rev-parse --abbrev-ref HEAD",{cwd:E.superpowersRepo,encoding:"utf8",stdio:"pipe",timeout:3000}).trim()==="main"}catch{return!1}},O$=()=>{try{p("git fetch origin",{cwd:E.superpowersRepo,timeout:5000,stdio:"pipe"});let $=!vQ(),Q=p("git rev-parse HEAD",{cwd:E.superpowersRepo,encoding:"utf8",stdio:"pipe"}).trim(),q=p("git rev-parse origin/main",{cwd:E.superpowersRepo,encoding:"utf8",stdio:"pipe"}).trim();if(Q===q)return{hasUpdates:!1,hasLocalChanges:$,currentCommit:Q,latestCommit:q,commitsBehind:0,changedFiles:[]};let Z=parseInt(p("git rev-list --count HEAD..origin/main",{cwd:E.superpowersRepo,encoding:"utf8",stdio:"pipe"}).trim(),10),W=p("git diff --name-only HEAD origin/main",{cwd:E.superpowersRepo,encoding:"utf8",stdio:"pipe"}).trim().split(`
94
- `).filter((H)=>H.length>0);return{hasUpdates:!0,hasLocalChanges:$,currentCommit:Q,latestCommit:q,commitsBehind:Z,changedFiles:W}}catch{return{hasUpdates:!1,hasLocalChanges:!1,currentCommit:"",latestCommit:"",commitsBehind:0,changedFiles:[],error:!0}}},Jq=($)=>{let Q={".github/prompts/":"copilot-prompts",".cursor/commands/":"cursor-commands","hooks/cursor/":"cursor-hooks",".codex/prompts/":"codex-prompts",".gemini/commands/":"gemini-commands","commands/":"claude-commands",".opencode/command/":"opencode-commands",".opencode/plugins/":"opencode-plugin"},q=new Set;for(let X of $)for(let[Z,Y]of Object.entries(Q))if(X.startsWith(Z))q.add(Y);return Array.from(q)};import{existsSync as wq,readdirSync as JQ}from"fs";import{join as o}from"path";import{execSync as U$}from"child_process";var i=()=>{let $=o(E.superpowersRepo,"hooks","cursor"),Q=o(E.home,".cursor","hooks"),q=o($,"hooks.json"),X=o(E.home,".cursor","hooks.json");if(!wq($)){console.log("⚠️ No Cursor hooks to install (source directory not found).");return}try{if(!wq(Q))U$(`mkdir -p "${Q}"`,{stdio:"pipe"})}catch(W){console.log(`Error creating Cursor hooks directory: ${W.message}`);return}try{U$(`cp "${q}" "${X}"`,{stdio:"pipe"}),console.log(" ✓ Installed hooks.json")}catch(W){console.log(` ✗ Failed to install hooks.json: ${W.message}`);return}let Z;try{Z=JQ($).filter((W)=>W.endsWith(".sh"))}catch(W){console.log(`Error reading hooks directory: ${W.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 W of Z)try{let H=o($,W),K=o(Q,W);U$(`cp "${H}" "${K}"`,{stdio:"pipe"}),U$(`chmod +x "${K}"`,{stdio:"pipe"}),console.log(` ✓ Installed ${W}`),Y++}catch(H){console.log(` ✗ Failed to install ${W}: ${H.message}`)}if(Y>0)console.log(`
95
- Installed ${Y} hook(s) to ${Q}
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
+ `),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(`
98
+ ✓ Installed ${Y} hook(s) to ${q}
96
99
  Cursor will now check for skills before each prompt submission
97
- Restart Cursor for hooks to take effect`)};import{existsSync as g$,readdirSync as ZY,lstatSync as wQ,symlinkSync as Tq,unlinkSync as TQ,mkdirSync as bQ,readlinkSync as AQ}from"fs";import{join as k$,dirname as WY}from"path";import{platform as MQ}from"os";var u$=($)=>{try{return wQ($).isSymbolicLink()}catch{return!1}},NQ=($,Q)=>{try{if(!u$($))return!1;return AQ($)===Q}catch{return!1}},W$=()=>{let $=k$(E.superpowersRepo,".opencode","plugins","superpowers-agent.js"),Q=k$(E.home,".config","opencode","plugins"),q=k$(Q,"superpowers-agent.js");if(console.log("Installing OpenCode plugin symlink..."),!g$($))return console.log("⚠️ Source plugin not found, skipping symlink creation"),console.log(` Expected at: ${$}`),{created:!1,error:"Source plugin not found"};if(NQ(q,$))return console.log("✓ Plugin symlink already exists and is correct"),{created:!1,existed:!0};if(g$(q)&&!u$(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(!g$(Q))try{bQ(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(u$(q))try{TQ(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=MQ();try{if(X==="win32")Tq($,q,"file");else Tq($,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 bq,lstatSync as CQ,symlinkSync as L$,unlinkSync as Aq,mkdirSync as r,readlinkSync as FQ}from"fs";import{join as _,dirname as xQ,basename as RQ}from"path";import{homedir as N,platform as Mq}from"os";var Nq=[{name:"claude",parentDir:()=>_(N(),".claude"),skillsDir:()=>_(N(),".claude","skills"),superpowersTarget:"superpowers"},{name:"copilot",parentDir:()=>_(N(),".copilot"),skillsDir:()=>_(N(),".copilot","skills"),superpowersTarget:"superpowers"},{name:"opencode",parentDir:()=>_(N(),".config","opencode"),skillsDir:()=>_(N(),".config","opencode","skill"),superpowersTarget:"superpowers"},{name:"cursor",parentDir:()=>_(N(),".cursor"),skillsDir:()=>_(N(),".cursor","skills"),superpowersTarget:"superpowers"},{name:"gemini",parentDir:()=>_(N(),".gemini"),skillsDir:()=>_(N(),".gemini","skills"),superpowersTarget:"superpowers"},{name:"codex",parentDir:()=>_(N(),".codex"),skillsDir:()=>_(N(),".codex","skills"),superpowersTarget:"superpowers"}],DQ=[{name:"claude",agentDir:($)=>_($,".claude"),skillsDir:($)=>_($,".claude","skills"),detect:($)=>b(_($,".claude"))},{name:"copilot",agentDir:($)=>_($,".github"),skillsDir:($)=>_($,".github","skills"),detect:($)=>{let Q=b(_($,".github")),q=b(_($,"AGENTS.md"))||b(_($,".agents","AGENTS.md"));return Q&&q}},{name:"opencode",agentDir:($)=>_($,".opencode"),skillsDir:($)=>_($,".opencode","skill"),detect:($)=>{let Q=b(_($,".opencode")),q=b(_($,"AGENTS.md"))||b(_($,".agents","AGENTS.md"))||b(_($,".opencode","AGENTS.md"));return Q&&q}},{name:"cursor",agentDir:($)=>_($,".cursor"),skillsDir:($)=>_($,".cursor","skills"),detect:($)=>b(_($,".cursor"))},{name:"gemini",agentDir:($)=>_($,".gemini"),skillsDir:($)=>_($,".gemini","skills"),detect:($)=>{let Q=b(_($,".gemini")),q=b(_($,"GEMINI.md"))||b(_($,".agents","GEMINI.md"));return Q&&q}},{name:"codex",agentDir:($)=>_($,".codex"),skillsDir:($)=>_($,".codex","skills"),detect:($)=>{let Q=b(_($,".codex")),q=b(_($,"AGENTS.md"))||b(_($,".agents","AGENTS.md"));return Q&&q}}],I$=($)=>{try{return CQ($).isSymbolicLink()}catch{return!1}},Cq=($,Q)=>{try{if(!I$($))return!1;return FQ($)===Q}catch{return!1}},E$=($,Q)=>{if(!b($))return{created:!1,existed:!1,error:`Source does not exist: ${$}`};if(Cq(Q,$))return{created:!1,existed:!0};if(b(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=xQ(Q);if(!b(q))try{r(q,{recursive:!0})}catch(Z){return{created:!1,existed:!1,error:`Failed to create parent directory: ${Z.message}`}}let X=Mq();try{if(X==="win32")L$($,Q,"junction");else L$($,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 Fq=($,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}a(X,!0)};var jQ=($,Q={})=>{let q=E.homeSuperpowersSkills,X=_($.skillsDir(),$.superpowersTarget),Z=E$(q,X);if(Z.created){Fq($.name,X,"superpowers");let Y=q.replace(N(),"~"),W=X.replace(N(),"~");return console.log(` ✓ Created ${W} -> ${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}},xq=($,Q={})=>{let q=E.homePersonalSkills;if(!b(q))return{created:0,existed:0};let X;try{X=bq(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 W=_(q,Y),H=_($.skillsDir(),Y),K=E$(W,H);if(K.created)Fq($.name,H,"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},v$=($={})=>{let{force:Q=!1,forceAgents:q=new Set}=$;for(let X of Nq){let Z=Q||q.has(X.name),Y=X.parentDir(),W=X.skillsDir();if(!b(Y))if(Z)try{r(Y,{recursive:!0}),console.log(`✓ Created ${Y.replace(N(),"~")}`)}catch(H){console.log(`⚠️ Failed to create ${Y.replace(N(),"~")}: ${H.message}`);continue}else{console.log(`⚠️ Skipping ${X.name} (${Y.replace(N(),"~")} not found)`),console.log(" Use --force or --force-<agent> to create directory");continue}if(!b(W))try{r(W,{recursive:!0})}catch(H){console.log(`⚠️ Failed to create skills directory for ${X.name}: ${H.message}`);continue}console.log(`${X.name}:`),jQ(X,$),xq(X,$)}},d$=($={})=>{let{force:Q=!1}=$;for(let q of Nq){let X=q.parentDir(),Z=q.skillsDir();if(!b(X)){if(!Q)continue;try{r(X,{recursive:!0})}catch{continue}}if(!b(Z))try{r(Z,{recursive:!0})}catch{continue}xq(q,$)}};var Rq=($,Q=[])=>{let q;try{q=bq($,{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(_($,Y.name))}if(X)Q.push($);for(let Y of Z)Rq(Y,Q);return Q},J$=()=>{let $=E.homeSuperpowersSkills,Q=E.homePersonalSkills;if(!b($))return{created:0,existed:0,updated:0,errors:[`Skills directory not found: ${$}`]};if(!b(Q))try{r(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=RQ(Z),W=_(Q,Y);if(Cq(W,Z)){X.existed++;continue}if(I$(W))try{Aq(W),X.updated++}catch(K){X.errors.push(`Failed to remove stale symlink ${W}: ${K.message}`);continue}else if(b(W)){X.errors.push(`Skipped ${W}: path exists and is not a symlink`);continue}let H=Mq();try{if(H==="win32")L$(Z,W,"junction");else L$(Z,W,"dir");let K=W.replace(N(),"~"),z=Z.replace(N(),"~");console.log(` ✓ ${K} -> ${z}`),X.created++}catch(K){X.errors.push(`Failed to create symlink ${W}: ${K.message}`)}}return X},Dq=($={})=>{let Q=$.projectRoot||process.cwd(),q=_(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 DQ){if(!Z.detect(Q)){X.skipped++;continue}let Y=Z.skillsDir(Q),W=Z.agentDir(Q);if(!b(W)){X.skipped++;continue}let H=E$(q,Y);if(H.created){let K=Y.replace(Q,".");console.log(` ✓ Created ${K} -> .agents/skills`),X.created++}else if(H.existed)X.existed++;else if(H.error)console.log(` ⚠️ ${Z.name}: ${H.error}`),X.errors.push({platform:Z.name,error:H.error})}return X};var fQ=($)=>{let q={"cursor-hooks":i,"opencode-plugin":W$}[$];if(q)try{return q(),{success:!0,integration:$}}catch(X){return{success:!1,integration:$,error:X.message}}return{success:!1,integration:$,error:"Unknown integration"}},yQ=()=>{console.log("Installing aliases...")},w$=($={})=>{let Q=$.skipReinstall||!1;console.log(`# Checking for Superpowers updates...
98
- `);let q=O$();if(q.error){console.log("⚠️ Could not check for updates (network issue)");return}if(!q.hasUpdates){console.log("✓ Already up to date");return}if(q.hasLocalChanges){console.log(`⚠️ Cannot auto-update: local changes detected
99
- Commit or stash your changes first, then run update again
100
- Or manually update: cd ${E.superpowersRepo} && git pull`);return}if(!H$()){console.log(`⚠️ Not on main branch, skipping auto-update
101
- Switch to main branch first: cd ${E.superpowersRepo} && git checkout main`);return}console.log(`\uD83D\uDCE6 Updating from ${q.currentCommit.substring(0,7)} to ${q.latestCommit.substring(0,7)}
102
- (${q.commitsBehind} new commit${q.commitsBehind>1?"s":""})
103
- `);try{PQ("git pull origin main",{cwd:E.superpowersRepo,stdio:"pipe",timeout:1e4}),console.log("✓ Updated superpowers repository")}catch(H){console.log(`✗ Git pull failed: ${H.message}
104
- Please resolve manually and try again`);return}if(console.log(""),_$({last_updated_commit:q.latestCommit,last_update_check:new Date().toISOString()}),Q){console.log(`ℹ️ Skipping integration reinstall (--no-reinstall flag)
105
-
106
- ✓ Update complete!`);return}let X=Jq(q.changedFiles);if(X.length===0){console.log(`ℹ️ No integration files changed, skipping reinstalls
107
-
108
- ✓ Update complete!`);return}console.log(`\uD83D\uDD04 Reinstalling updated integrations:
109
- `);let Z=[];for(let H of X){let K=fQ(H);if(Z.push(K),K.success)console.log(` ✓ ${H}`);else console.log(` ✗ ${H} (${K.error})`)}console.log(""),console.log(`
110
- ---
111
- `),yQ(),console.log(`
112
- ---
113
- `),console.log(`## Syncing Skill Symlinks
114
- `),v$(),console.log(`
115
- ## Syncing Repo Skills -> ~/.agents/skills/
116
- `);let Y=J$();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(`
117
- ---
118
- `),console.log(`## OpenCode Plugin Symlink
119
- `),W$();let W=Z.filter((H)=>!H.success);if(W.length>0){console.log("⚠️ Update completed with errors:");for(let H of W){console.log(` - ${H.integration} failed to install`);let K=`install-${H.integration}`;console.log(` Run manually: superpowers-agent ${K}`)}}else console.log("✓ Update complete!")},jq=async()=>{R();let $=g();console.log(`Current version: ${$}`);try{let Q=await zq();if(console.log(`Latest version: ${Q}`),Kq(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)}},Pq=()=>{let $=g();console.log($)};import{existsSync as I,readFileSync as k,writeFileSync as t,rmSync as gQ}from"fs";import{join as v,dirname as yq,parse as s}from"path";import{execSync as F}from"child_process";import{platform as kQ}from"os";import{execSync as SQ}from"child_process";var z$=($)=>{try{return SQ(`which ${$}`,{stdio:"pipe",timeout:2000}),!0}catch{return!1}};var L={opencode:{check:()=>z$("opencode"),cli:!0,name:"OpenCode",installUrl:"https://opencode.ai/docs/installation",bootstrapCommand:"install-opencode-commands"},claude:{check:()=>z$("claude"),cli:!0,name:"Claude Code",installUrl:"https://code.claude.com/docs/en/installation",bootstrapCommand:"install-claude-commands"},gemini:{check:()=>z$("gemini"),cli:!0,name:"Gemini",installUrl:"https://cloud.google.com/gemini/docs/cli/install",bootstrapCommand:"install-gemini-commands"},codex:{check:()=>z$("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"}},fq=()=>{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 $};var uQ=()=>{let $=v(E.superpowersRepo,".agents","templates","TOOLS.md.template");if(I($))try{return k($,"utf8").trim()}catch(Q){return"### Using Tools\n\nUse your native skill tool. Fallback: `superpowers-agent find-skills`"}return""},K$=($,Q,q,X=!0)=>{let Z=I($);if(!Z&&!X)return{updated:!1,created:!1,skipped:!0};let Y=uQ(),W=Q.replace(/\{\{TOOL_MAPPINGS\}\}/g,Y),H=new Date().toISOString().split("T")[0];W=W.replace(/\{\{DATE\}\}/g,H),W=W.replace(/\{\{SUPERPOWERS_PATH\}\}/g,E.superpowersRepo);let K=`<!-- SUPERPOWERS_SKILLS_START -->
120
- ${W}
121
- <!-- SUPERPOWERS_SKILLS_END -->`;if(Z){let z=new Date().toISOString().split("T")[0],G=`${$}.backup-${z}`;try{F(`cp "${$}" "${G}"`,{stdio:"pipe"})}catch(J){return{updated:!1,error:!0,message:`Failed to backup: ${J.message}`}}let V;try{V=k($,"utf8")}catch(J){return{updated:!1,error:!0,message:`Failed to read: ${J.message}`}}let O="<!-- SUPERPOWERS_SKILLS_START -->",B="<!-- SUPERPOWERS_SKILLS_END -->",U;if(V.includes(O)&&V.includes(B)){let J=new RegExp(`${O}[\\s\\S]*?${B}`,"g");U=V.replace(J,K)}else{let J=V.match(/^#\s+.+$/m);if(J){let M=V.indexOf(`
122
- `,J.index)+1;U=V.slice(0,M)+`
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 -->
101
+ ${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)+`
123
104
  `+K+`
124
- `+V.slice(M)}else U=K+`
105
+ `+G.slice(M)}else I=K+`
125
106
 
126
- `+V}try{return t($,U,"utf8"),{updated:!0,created:!1,backup:G}}catch(J){return{updated:!1,error:!0,message:`Failed to write: ${J.message}`}}}else try{let z=yq($);if(!I(z))F(`mkdir -p "${z}"`,{stdio:"pipe"});let O=`# ${s($).base.toUpperCase()}
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()}
127
108
 
128
- `+K;return t($,O,"utf8"),{updated:!1,created:!0}}catch(z){return{updated:!1,created:!1,error:!0,message:`Failed to create: ${z.message}`}}},dQ=()=>{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(!I($)){console.log("⚠️ superpowers-agent executable not found");return}if(!I(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(I(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(I(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(`
129
- ⚠️ 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"
130
- `)},mQ=()=>{console.log("Installing Windows aliases..."),console.log("✓ Windows alias installation (implementation pending)")},m$=()=>{let $=kQ();if(console.log(`## Installing Universal Aliases
131
- `),$==="win32")return mQ();else return dQ()},hQ=($)=>{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(!I(Q))return{error:!0,message:"Source template not found"};if(!I(q))return{error:!0,message:"using-superpowers SKILL.md not found"};let W,H;try{W=k(Q,"utf8"),H=k(q,"utf8")}catch(G){return{error:!0,message:`Failed to read source files: ${G.message}`}}let K=W.replace("${content}",H);if(!K.includes("<!-- SUPERPOWERS_-_INSTRUCTIONS_START -->")||!K.includes("<!-- SUPERPOWERS_-_INSTRUCTIONS_END -->"))return{error:!0,message:"Template is missing required markers"};let z=yq(X);try{if(!I(z))F(`mkdir -p "${z}"`,{stdio:"pipe"})}catch(G){return{error:!0,message:`Failed to create .github directory: ${G.message}`}}if(I(X)){let G;try{G=k(X,"utf8")}catch(B){return{error:!0,message:`Failed to read existing file: ${B.message}`}}let V=new Date().toISOString().replace(/[:.]/g,"-"),O=`${X}.backup-${V}`;try{F(`cp "${X}" "${O}"`,{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 t(X,U,"utf8"),{updated:!0,backup:O}}catch(J){return{error:!0,message:`Failed to update: ${J.message}`}}}else{let B=G.trimEnd()+`
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(`
110
+ ⚠️ 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()+`
132
113
 
133
114
  `+K.trim()+`
134
- `;try{return t(X,B,"utf8"),{updated:!0,backup:O}}catch(U){return{error:!0,message:`Failed to append: ${U.message}`}}}}else try{return t(X,K,"utf8"),{created:!0}}catch(G){return{error:!0,message:`Failed to create: ${G.message}`}}},Sq=()=>{R(),console.log(`# Setting up Superpowers skills for this project
135
- `);let $=process.cwd(),Q=v($,".agents"),q=v(Q,"skills"),X=v($,"AGENTS.md"),Z=v(Q,"AGENTS.md"),Y=I(X)?X:Z,W=v(E.superpowersRepo,".agents","templates","AGENTS.md.template");if(!I(W)){console.log(`✗ Error: AGENTS.md template not found
136
- Expected at: ${W}
137
- Please update your Superpowers installation`);return}if(!I(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(!I(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 H=v(Q,"docs"),K=v(H,"SUPERPOWERS.md"),z=v(E.superpowersRepo,".agents","templates","SUPERPOWERS.md.template");if(!I(H))try{F(`mkdir -p "${H}"`,{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 G=I(Y);if(G){let w=new Date().toISOString().split("T")[0],G$=`${Y}.backup-${w}`;try{F(`cp "${Y}" "${G$}"`,{stdio:"pipe"}),console.log(`✓ Backed up existing AGENTS.md to ${s(G$).base}`)}catch(sq){console.log(`✗ Failed to backup AGENTS.md: ${sq.message}`);return}}let V;try{V=k(W,"utf8")}catch(w){console.log(`✗ Failed to read template: ${w.message}`);return}let O=g();if(V=V.replace(/\{\{VERSION\}\}/g,O),I(z))try{let w=k(z,"utf8"),G$=new Date().toISOString().split("T")[0];w=w.replace(/\{\{VERSION\}\}/g,O),w=w.replace(/\{\{DATE\}\}/g,G$),t(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=[],U=v($,".github","copilot-instructions.md"),J=v(E.home,".github","copilot-instructions.md");if(I(U)||I(J)||L.copilot.check())B.push("github-copilot");let M=v($,"CLAUDE.md"),u=v(Q,"CLAUDE.md");if(I(M)||I(u)||L.claude.check())B.push("claude-code");let j=v($,"GEMINI.md"),a$=v(Q,"GEMINI.md");if(I(j)||I(a$)||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(`
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
+ 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(`
138
119
  Detected platforms for project: ${B.join(", ")||"none"}
139
- `);let rq=B.filter((w)=>["github-copilot","cursor","opencode","codex"].includes(w)),e=K$(Y,V,rq,!G);if(e.created)console.log(`✓ Created AGENTS.md with platform tool mappings (${Y===X?"root":".agents/"})`);else if(e.updated)console.log(`✓ Updated AGENTS.md with platform tool mappings (${Y===X?"root":".agents/"})`);else if(e.error)console.log("⚠️ Failed to update AGENTS.md");let F$=I(M)?M:u,P=K$(F$,V,["claude-code"],!1);if(P.created)console.log(`✓ Created CLAUDE.md with Claude Code tool mappings (${F$===M?"root":".agents/"})`);else if(P.updated){if(console.log(`✓ Updated CLAUDE.md with Claude Code tool mappings (${F$===M?"root":".agents/"})`),P.backup)console.log(` Backed up to ${s(P.backup).base}`)}else if(P.skipped)console.log("ℹ️ Skipped CLAUDE.md (does not exist)");else if(P.error)console.log("⚠️ Failed to update CLAUDE.md");let x$=I(j)?j:a$,f=K$(x$,V,["gemini"],!1);if(f.created)console.log(`✓ Created GEMINI.md with Gemini tool mappings (${x$===j?"root":".agents/"})`);else if(f.updated){if(console.log(`✓ Updated GEMINI.md with Gemini tool mappings (${x$===j?"root":".agents/"})`),f.backup)console.log(` Backed up to ${s(f.backup).base}`)}else if(f.skipped)console.log("ℹ️ Skipped GEMINI.md (does not exist)");else if(f.error)console.log("⚠️ Failed to update GEMINI.md");let B$=v($,".github","copilot-instructions.md"),D={skipped:!0};if(B.includes("github-copilot")){if(D=hQ($),D.created)console.log("✓ Created .github/copilot-instructions.md with Superpowers instructions");else if(D.updated){if(console.log("✓ Updated .github/copilot-instructions.md with Superpowers instructions"),D.backup)console.log(` Backed up to ${s(D.backup).base}`)}else if(D.error)console.log(`⚠️ Failed to update .github/copilot-instructions.md: ${D.message||""}`)}else console.log("ℹ️ Skipped .github/copilot-instructions.md (GitHub Copilot not detected)");let l$=!I(X)&&!I(Z);if(I(B$)&&l$){let w=K$(B$,V,["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 ${s(w.backup).base}`)}else if(w.error)console.log("⚠️ Failed to update .github/copilot-instructions.md with tool mappings")}else if(I(B$)&&!l$)console.log("ℹ️ Skipped .github/copilot-instructions.md tool mappings (AGENTS.md exists, using that instead)");else if(!I(B$)&&!B.includes("github-copilot"))console.log("ℹ️ Skipped .github/copilot-instructions.md tool mappings (does not exist)");console.log(`
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(`
140
121
  ## Syncing Project Skill Symlinks
141
- `);let n=Dq({projectRoot:$});if(n.created>0)console.log(`
142
- ✓ 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 y=`
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=`
143
124
  # Setup complete!
144
125
 
145
126
  Your project now has:
146
- - .agents/ directory structure`;if(e.updated||e.created)y+=`
147
- - AGENTS.md with universal skills instructions`;if(P.updated||P.created)y+=`
148
- - CLAUDE.md with Claude Code skills instructions`;if(f.updated||f.created)y+=`
149
- - GEMINI.md with Gemini skills instructions`;if(D.updated||D.created)y+=`
150
- - .github/copilot-instructions.md with Superpowers instructions`;if(n.created>0)y+=`
151
- - ${n.created} project skill symlink(s) to agent directories`;y+=`
152
- - .agents/skills/ ready for project-specific skills`,y+=`
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+=`
153
134
  - .agents/docs/SUPERPOWERS.md for detailed reference
154
- `,console.log(y)},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(I(q))try{gQ(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")},gq=()=>{R(),console.log(`# Superpowers Bootstrap for Agents
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
155
136
  # ==================================
156
- `);let $=process.argv.includes("--no-update"),q=new Set(["copilot","cursor","codex","gemini","claude","opencode"].filter((W)=>process.argv.includes(`--force-${W}`))),X=q.size>0;if(!$){let W=Z$(),H=O$();if(H.error)console.log(`## Update Check
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
157
138
 
158
139
  ⚠️ Could not check for updates (network issue)
159
140
 
160
141
  ---
161
- `);else if(H.hasUpdates)if(W.auto_update&&!H.hasLocalChanges&&H$())console.log(`## Auto-Update
162
- `),w$(),console.log(`
163
- ---
164
- `);else{if(console.log(`## Update Available
165
- `),H.hasLocalChanges)console.log("⚠️ Your superpowers installation is behind the latest version.\n Cannot auto-update: local changes detected\n To update, commit/stash changes then run: `superpowers-agent update`");else if(!H$())console.log("⚠️ Your superpowers installation is behind the latest version.\n Cannot auto-update: not on main branch\n To update, switch to main then run: `superpowers-agent update`");else console.log("⚠️ Your superpowers installation is behind the latest version.\n To update, run: `superpowers-agent update`\n Or enable auto-update: `superpowers-agent config-set auto_update true`");console.log(`
142
+ `);else if(W.hasUpdates)console.log(`## Update Available
143
+ `),console.log(`⚠️ Update available: v${W.localVersion} → v${W.remoteVersion}
144
+ To update, run: \`npm install -g @complexthings/superpowers-agent\``),console.log(`
166
145
  ---
167
- `)}}if(!X)m$(),console.log(`---
146
+ `)}if(!X)g$(),console.log(`---
168
147
  `);if(!X)console.log(`## Cleaning Up Legacy Files
169
- `),pQ(),console.log(`
148
+ `),PQ(),console.log(`
170
149
  ---
171
- `);if(!X||q.has("copilot"))console.log(`## GitHub Copilot Integration
150
+ `);if(!X||Q.has("copilot"))console.log(`## GitHub Copilot Integration
172
151
  `),console.log("✓ Skill symlinks handled in sync step below"),console.log(`
173
152
  ---
174
- `);if(!X||q.has("cursor"))console.log(`## Cursor Integration
175
- `),i(),console.log(`
153
+ `);if(!X||Q.has("cursor"))console.log(`## Cursor Integration
154
+ `),O$(),console.log(`
176
155
  ---
177
- `);if(!X||q.has("codex")){if(console.log(`## OpenAI Codex Integration
178
- `),!L.codex.check())console.log(`⚠️ Skipped (${L.codex.name} CLI not detected)
156
+ `);if(!X||Q.has("codex")){if(console.log(`## OpenAI Codex Integration
157
+ `),!U.codex.check())console.log(`⚠️ Skipped (${U.codex.name} CLI not detected)
179
158
  \uD83D\uDCA1 To enable Codex integration:
180
- 1. Install Codex: ${L.codex.installUrl}
181
- 2. Run: superpowers-agent ${L.codex.bootstrapCommand}`);else console.log("✓ Skill symlinks handled in sync step below");console.log(`
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(`
182
161
  ---
183
- `)}if(!X||q.has("gemini")){if(console.log(`## Gemini Integration
184
- `),!L.gemini.check())console.log(`⚠️ Skipped (${L.gemini.name} CLI not detected)
162
+ `)}if(!X||Q.has("gemini")){if(console.log(`## Gemini Integration
163
+ `),!U.gemini.check())console.log(`⚠️ Skipped (${U.gemini.name} CLI not detected)
185
164
  \uD83D\uDCA1 To enable Gemini integration:
186
- 1. Install Gemini: ${L.gemini.installUrl}
187
- 2. Run: superpowers-agent ${L.gemini.bootstrapCommand}`);else console.log("✓ Skill symlinks handled in sync step below");console.log(`
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(`
188
167
  ---
189
- `)}if(!X||q.has("claude")){if(console.log(`## Claude Code Integration
190
- `),!L.claude.check())console.log(`⚠️ Skipped (${L.claude.name} CLI not detected)
168
+ `)}if(!X||Q.has("claude")){if(console.log(`## Claude Code Integration
169
+ `),!U.claude.check())console.log(`⚠️ Skipped (${U.claude.name} CLI not detected)
191
170
  \uD83D\uDCA1 To enable Claude Code integration:
192
- 1. Install Claude Code: ${L.claude.installUrl}
193
- 2. Run: superpowers-agent ${L.claude.bootstrapCommand}`);else console.log("✓ Skill symlinks handled in sync step below");console.log(`
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(`
194
173
  ---
195
- `)}if(!X||q.has("opencode")){if(console.log(`## OpenCode Integration
196
- `),L.opencode.check())W$();else console.log(`⚠️ Skipped (${L.opencode.name} CLI not detected)
174
+ `)}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)
197
176
  \uD83D\uDCA1 To enable OpenCode integration:
198
- 1. Install OpenCode: ${L.opencode.installUrl}
199
- 2. Run: superpowers-agent ${L.opencode.bootstrapCommand}`);console.log(`
177
+ 1. Install OpenCode: ${U.opencode.installUrl}
178
+ 2. Run: superpowers-agent ${U.opencode.bootstrapCommand}`);console.log(`
200
179
  ---
201
180
  `)}if(!X){console.log(`## Generating Platform-Specific Files
202
- `);let W=fq();console.log(`Detected platforms: ${W.join(", ")||"none"}
203
- `);let H=v(E.superpowersRepo,".agents","templates","AGENTS.md.template"),K="";try{K=k(H,"utf8")}catch(z){console.log(`⚠️ Could not read AGENTS.md template: ${z.message}
204
- `)}if(K){let z=g();K=K.replace(/\{\{VERSION\}\}/g,z);let G=v(E.home,".agents","AGENTS.md"),V=K$(G,K,W,!0);if(V.created)console.log(`✓ Created ${G}`);else if(V.updated)console.log(`✓ Updated ${G}`)}console.log(`
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(`
205
184
  ---
206
185
  `)}console.log(`## Syncing Skill Symlinks
207
- `);let Z=process.argv.includes("--force");v$({force:Z,forceAgents:q}),console.log(`
186
+ `);let Z=process.argv.includes("--force");Fq({force:Z,forceAgents:Q}),console.log(`
208
187
  ## Syncing Repo Skills -> ~/.agents/skills/
209
- `);let Y=J$();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 W of Y.errors)console.log(` ⚠️ ${W}`);else console.log(` ✓ ${Y.existed} skill symlinks already up to date`);console.log(`
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(`
210
189
  ---
211
190
  `),console.log(`# Bootstrap Complete!
212
191
  `),console.log("✓ All integrations installed"),console.log("✓ Skills system ready"),console.log(`✓ Skill symlinks synced
213
- `),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 M$,mkdirSync as eQ,rmSync as $X,cpSync as qX}from"fs";import{join as A,dirname as N$,parse as b$,sep as QX}from"path";import{execSync as C}from"child_process";import{homedir as c}from"os";import{readFileSync as nQ,existsSync as c$,unlinkSync as aQ,lstatSync as lQ,mkdirSync as oQ}from"fs";import{join as iQ,dirname as rQ}from"path";import{join as T$}from"path";import{homedir as cQ}from"os";var h$={github:{name:"github",sourceDir:".github/agents",sourceExt:".agent.md",getDestDir:()=>T$(E.vscodeUserDir,"prompts"),destExt:".agent.md"},opencode:{name:"opencode",sourceDir:".opencode/agents",sourceExt:".md",getDestDir:()=>T$(cQ(),".config","opencode","agents"),destExt:".md"}};function kq($,Q,q){let X=h$[Q];if(!X)return null;return T$($,X.sourceDir,`${q}${X.sourceExt}`)}function uq($,Q){let q=h$[$];if(!q)return null;return T$(q.getDestDir(),`${Q}${q.destExt}`)}function p$(){return Object.keys(h$)}function sQ($){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=p$(),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 tQ($,Q){if(!c$($))return{installed:!1,error:`Source file not found: ${$}`};if(c$(Q))try{if(!lQ(Q).isSymbolicLink())aQ(Q)}catch(X){}oQ(rQ(Q),{recursive:!0});let q=E$($,Q);if(q.error)return{installed:!1,error:q.error};return{installed:!0}}function n$($,Q={}){let q=iQ($,"agents.json");if(!c$(q))return;let X;try{X=JSON.parse(nQ(q,"utf8"))}catch(B){console.log(`
214
- ⚠ Could not parse agents.json: ${B.message}`);return}let Z=sQ(X);if(!Z.valid){console.log(`
215
- ⚠ Invalid agents.json: ${Z.error}`);return}for(let B of Z.skippedPlatforms)console.log(` ⚠ Skipping unknown platform: ${B}`);let Y=X.repository||"unknown",W=X.version,H=Q.isUpdate?"Updating":"Installing",K=Q.isUpdate?"Updated":"Installed";console.log(`
216
- \uD83D\uDCE6 Found agents.json (${Y} v${W})`);let z=p$(),G=0,V=0,O=[];for(let[B,U]of Object.entries(X.agents)){if(!z.includes(B))continue;console.log(`
217
- ${H} ${B} agents:`);for(let J of U){let M=kq($,B,J),u=uq(B,J),j=tQ(M,u);if(j.installed)console.log(` ✓ ${J}`),O.push({platformKey:B,agentName:J,sourcePath:M,destPath:u}),G++;else console.log(` ✗ ${J}: ${j.error}`),V++}}if(O.length>0){let B=h(!0);if(!B.installedAgents)B.installedAgents={};if(!B.installedAgents[Y])B.installedAgents[Y]={version:W,agents:{}};B.installedAgents[Y].version=W;for(let{platformKey:U,agentName:J,sourcePath:M,destPath:u}of O){if(!B.installedAgents[Y].agents[U])B.installedAgents[Y].agents[U]={};B.installedAgents[Y].agents[U][J]={source:M,destination:u,installedAt:new Date().toISOString()}}a(B,!0)}if(G>0)console.log(`
218
- ${K} ${G} agent(s)${V>0?` (${V} failed)`:""}`)}var dq=($,Q)=>{if(Q.type==="local"){let X=$;for(let Z=0;Z<10;Z++){if(x(A(X,"agents.json")))return X;let Y=N$(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(QX)[0];return A($.substring(0,X),".agents","tmp",Y)}return $},mq=($,Q)=>{let q=A(c(),".agents","repos"),X=Q.replace(/^@/,"").replace(/[^a-zA-Z0-9_-]/g,"_"),Z=A(q,X);try{if(eQ(q,{recursive:!0}),x(Z))$X(Z,{recursive:!0,force:!0});return qX($,Z,{recursive:!0}),Z}catch(Y){return console.log(` Warning: Could not persist repository for agents: ${Y.message}`),null}},hq=($)=>{let Q=$.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/tree\/([^/]+)\/(.+)$/);if(Q){let[,Z,Y,W,H]=Q;return{type:"git-tree",repoUrl:`https://github.com/${Z}/${Y}.git`,branch:W,path:H,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},pq=($)=>{let Q=$.includes("--global")||$.includes("-g"),q=$.includes("--project")||$.includes("-p");if(Q)return A(c(),".agents","skills");if(q)return A(process.cwd(),".agents","skills");let X=A(process.cwd(),".agents","config.json"),Z=A(c(),".agents","config.json");for(let Y of[X,Z])if(x(Y))try{if(JSON.parse(M$(Y,"utf8")).installLocation==="project")return A(process.cwd(),".agents","skills")}catch(W){}return A(c(),".agents","skills")},cq=($,Q)=>{let q=A(c(),".agents","tmp",`skill-install-${Date.now()}`);try{if(C(`mkdir -p "${q}"`,{stdio:"pipe"}),Q)C(`git clone --branch ${Q} --depth 1 "${$}" "${q}"`,{stdio:"pipe",timeout:30000});else C(`git clone --depth 1 "${$}" "${q}"`,{stdio:"pipe",timeout:30000});return q}catch(X){try{C(`rm -rf "${q}"`,{stdio:"pipe"})}catch{}throw Error(`Failed to clone repository: ${X.message}`)}},C$=($)=>{let Q=A($,"skill.json");if(!x(Q))return null;try{let q=M$(Q,"utf8");return JSON.parse(q)}catch(q){throw Error(`Failed to read skill.json: ${q.message}`)}},A$=($,Q,q,X)=>{let Z=A($,Q);if(!x(Z)){X.errors.push(`Skill directory not found: ${Q}`);return}let Y=C$(Z);if(!Y){X.errors.push(`No skill.json found in: ${Q}`);return}let W=Y.name||Q,H=A(q,W),K=N$(H);try{C(`mkdir -p "${K}"`,{stdio:"pipe"})}catch(z){X.errors.push(`Failed to create directory ${K}: ${z.message}`);return}try{if(x(H))C(`rm -rf "${H}"`,{stdio:"pipe"});C(`cp -R "${Z}" "${H}"`,{stdio:"pipe"}),X.installed.push({name:W,path:H,title:Y.title||Y.description||W})}catch(z){X.errors.push(`Failed to install ${Q}: ${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 <url-or-path|@alias> [skill-path] [options]
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
+ ⚠ 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]
219
198
 
220
199
  Options:
221
200
  --global, -g Install skills globally in ~/.agents/skills/ (default)
@@ -237,19 +216,19 @@ Description:
237
216
 
238
217
  Repository aliases can be added using:
239
218
  superpowers-agent add-repository <git-url> [--as=@alias]`);return}console.log(`Installing skill(s)...
240
- `);let X=null,Z=null;if(Q.startsWith("@")){let z=Q;Z=$.find((B,U)=>U>0&&!B.startsWith("-")&&B!==z);let G=S(!1),V=S(!0);if(G[z])X=G[z],console.log(`Using project repository alias: ${z}`);else if(V[z])X=V[z],console.log(`Using global repository alias: ${z}`);else{console.log(`Error: Repository alias not found: ${z}`),console.log(`
241
- Available aliases:`);let B={...V,...G};if(Object.keys(B).length===0)console.log(" (none)"),console.log(`
242
- Add a repository using:`),console.log(" superpowers-agent add-repository <git-url>");else for(let[U,J]of Object.entries(B))console.log(` ${U} -> ${J}`);return}let O=x(X);if(Z)if(O)Q=A(X,Z),console.log(`Repository path: ${X}`),console.log(`Skill path: ${Z}
243
- `);else Q=`${X}/tree/main/${Z}`,console.log(`Repository URL: ${X}`),console.log(`Skill path: ${Z}
244
- `);else if(Q=X,O)console.log(`Repository path: ${X}
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}
222
+ `);else q=`${X}/tree/main/${Z}`,console.log(`Repository URL: ${X}`),console.log(`Skill path: ${Z}
223
+ `);else if(q=X,V)console.log(`Repository path: ${X}
245
224
  `);else console.log(`Repository URL: ${X}
246
- `)}let Y=hq(Q);if(!Y){console.log(`Error: Invalid URL or path not found: ${Q}`);return}let W=pq(q);console.log(`Install location: ${W}
247
- `);let H,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(H=cq(Y.repoUrl,Y.branch),K=!0,Y.path){if(H=A(H,Y.path),!x(H))throw Error(`Path not found in repository: ${Y.path}`)}console.log("")}else H=Y.path;let z=C$(H);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
248
- `);for(let B of z.skills)A$(H,B,W,G)}else{let B=z.name||b$(H).base;A$(N$(H),b$(H).base,W,G)}let V=dq(H,Y),O=A(V,"agents.json");if(x(O)){let B=V;if(K){let U;try{U=JSON.parse(M$(O,"utf8"))}catch{}let J=U?.repository||Y.original,M=mq(V,J);if(M)B=M}n$(B,{isUpdate:!1})}if(K&&H)try{let B=H.split("/.agents/tmp/")[0]+"/.agents/tmp/"+H.split("/.agents/tmp/")[1].split("/")[0];C(`rm -rf "${B}"`,{stdio:"pipe"})}catch{}if(console.log(`
249
- **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(`
250
- **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(`
251
- **Syncing skill symlinks...**`),d$()}catch(z){if(K&&H)try{let G=H.split("/.agents/tmp/")[0]+"/.agents/tmp/"+H.split("/.agents/tmp/")[1].split("/")[0];C(`rm -rf "${G}"`,{stdio:"pipe"})}catch{}console.log(`
252
- Error: ${z.message}`)}},aq=()=>{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]
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]
253
232
 
254
233
  Options:
255
234
  --global, -g Update skills globally in ~/.agents/skills/ (default)
@@ -274,19 +253,19 @@ Description:
274
253
 
275
254
  Repository aliases can be added using:
276
255
  superpowers-agent add-repository <git-url> [--as=@alias]`);return}console.log(`Updating skill(s)...
277
- `);let X=null,Z=null;if(Q.startsWith("@")){let z=Q;Z=$.find((B,U)=>U>0&&!B.startsWith("-")&&B!==z);let G=S(!1),V=S(!0);if(G[z])X=G[z],console.log(`Using project repository alias: ${z}`);else if(V[z])X=V[z],console.log(`Using global repository alias: ${z}`);else{console.log(`Error: Repository alias not found: ${z}`),console.log(`
278
- Available aliases:`);let B={...V,...G};if(Object.keys(B).length===0)console.log(" (none)"),console.log(`
279
- Add a repository using:`),console.log(" superpowers-agent add-repository <git-url>");else for(let[U,J]of Object.entries(B))console.log(` ${U} -> ${J}`);return}let O=x(X);if(Z)if(O)Q=A(X,Z),console.log(`Repository path: ${X}`),console.log(`Skill path: ${Z}
280
- `);else Q=`${X}/tree/main/${Z}`,console.log(`Repository URL: ${X}`),console.log(`Skill path: ${Z}
281
- `);else if(Q=X,O)console.log(`Repository path: ${X}
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}
259
+ `);else q=`${X}/tree/main/${Z}`,console.log(`Repository URL: ${X}`),console.log(`Skill path: ${Z}
260
+ `);else if(q=X,V)console.log(`Repository path: ${X}
282
261
  `);else console.log(`Repository URL: ${X}
283
- `)}let Y=hq(Q);if(!Y){console.log(`Error: Invalid URL or path not found: ${Q}`);return}let W=pq(q);console.log(`Install location: ${W}
284
- `);let H,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(H=cq(Y.repoUrl,Y.branch),K=!0,Y.path){if(H=A(H,Y.path),!x(H))throw Error(`Path not found in repository: ${Y.path}`)}console.log("")}else H=Y.path;let z=C$(H);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
285
- `);for(let B of z.skills)A$(H,B,W,G)}else{let B=z.name||b$(H).base;A$(N$(H),b$(H).base,W,G)}let V=dq(H,Y),O=A(V,"agents.json");if(x(O)){let B=V;if(K){let U;try{U=JSON.parse(M$(O,"utf8"))}catch{}let J=U?.repository||Y.original,M=mq(V,J);if(M)B=M}n$(B,{isUpdate:!0})}if(K&&H)try{let B=H.split("/.agents/tmp/")[0]+"/.agents/tmp/"+H.split("/.agents/tmp/")[1].split("/")[0];C(`rm -rf "${B}"`,{stdio:"pipe"})}catch{}if(console.log(`
286
- **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(`
287
- **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(`
288
- **Syncing skill symlinks...**`),d$()}catch(z){if(K&&H)try{let G=H.split("/.agents/tmp/")[0]+"/.agents/tmp/"+H.split("/.agents/tmp/")[1].split("/")[0];C(`rm -rf "${G}"`,{stdio:"pipe"})}catch{}console.log(`
289
- Error: ${z.message}`)}},lq=()=>{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]
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]
290
269
 
291
270
  Options:
292
271
  --global, -g Add repository globally in ~/.agents/config.json (default)
@@ -304,9 +283,9 @@ Description:
304
283
  The repository's skill.json will be read to determine the default alias.
305
284
  Use --as to specify a custom alias.
306
285
  After adding, you can install skills using: superpowers-agent add @alias path/to/skill`);return}console.log(`Adding repository...
307
- `);let X=q.some((z)=>z==="--global"||z==="-g"),Z=q.some((z)=>z==="--project"||z==="-p"),Y=q.find((z)=>z.startsWith("--as=")),W=Y?Y.split("=")[1]:null,H=Z?!1:!0,K;try{console.log(`Cloning repository: ${Q}`),K=A(c(),".agents","tmp",`repo-add-${Date.now()}`),C(`mkdir -p "${K}"`,{stdio:"pipe"}),C(`git clone --depth 1 "${Q}" "${K}"`,{stdio:"pipe",timeout:30000}),console.log("");let z=C$(K);if(!z)throw Error("No skill.json found in repository");let G;if(W)G=W;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.")}Hq(G,Q,H),C(`rm -rf "${K}"`,{stdio:"pipe"});let V=H?"globally":"in project",O=H?A(c(),".agents","config.json"):A(process.cwd(),".agents","config.json");console.log(`✓ Repository added ${V}`),console.log(` Alias: ${G}`),console.log(` URL: ${Q}`),console.log(` Config: ${O}`),console.log(`
308
- You can now install skills using:`),console.log(` superpowers-agent add ${G} <path-to-skill>`)}catch(z){if(K)try{C(`rm -rf "${K}"`,{stdio:"pipe"})}catch{}console.log(`
309
- Error: ${z.message}`)}};import{dirname as XX}from"path";var oq=($)=>{if(!$){console.log(`Usage: superpowers-agent use-skill <skill-name>
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>
310
289
 
311
290
  Examples (smart matching):
312
291
  superpowers-agent use-skill brainstorming # Matches superpowers:collaboration/brainstorming
@@ -321,15 +300,15 @@ Examples (explicit paths):
321
300
  Smart matching:
322
301
  - Type just the skill name or any suffix of the path
323
302
  - Priority: .agents/skills/ > .claude/skills/ > ~/.agents/skills/ > ~/.agents/superpowers/skills/
324
- - 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: ${$}
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: ${$}
325
304
 
326
- Available skills:`),console.log("Run: superpowers-agent find-skills");return}let{skillFile:q,sourceType:X,actualSkillPath:Z}=Q;try{let{content:Y,frontmatter:W}=s$(q),H=Y$[X].prefix+Z,K=XX(q),z=`# ${W.name||H}`;if(W.description)z+=`
327
- # ${W.description}`;if(W.whenToUse)z+=`
328
- # When to use: ${W.whenToUse}`;z+=`
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+=`
306
+ # ${H.description}`;if(H.whenToUse)z+=`
307
+ # When to use: ${H.whenToUse}`;z+=`
329
308
  # Supporting tools and docs are in ${K}
330
309
  # ============================================
331
310
 
332
- ${Y}`,console.log(z)}catch(Y){console.log(Y.message)}};var iq={bootstrap:gq,version:Pq,"check-updates":()=>{jq().catch(($)=>{console.error($.message),process.exit(1)})},update:()=>{let $=process.argv.includes("--no-reinstall");w$({skipReinstall:$})},"config-get":Lq,"config-set":Iq,"setup-skills":Sq,"use-skill":()=>oq(process.argv[3]),execute:Vq,"find-skills":l,add:nq,"add-repository":lq,"list-repositories":vq,pull:aq,dir:Oq,path:_q,"get-helpers":Uq,"install-cursor-hooks":i,"install-aliases":m$,default:()=>{console.log(`Superpowers for Agents
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
333
312
  Usage:
334
313
  superpowers-agent bootstrap [--no-update] [--force] # Run complete bootstrap
335
314
  superpowers-agent version # Show current version
@@ -352,4 +331,4 @@ Usage:
352
331
  superpowers-agent install-aliases # Install universal aliases (superpowers, superpowers-agent)
353
332
 
354
333
  Documentation: https://github.com/complexthings/superpowers
355
- `)}},YX=process.argv[2]||"default",ZX=iq[YX]||iq.default;try{ZX()}catch($){console.error(`Error: ${$.message}`),process.exit(1)}
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)}
package/README.md CHANGED
@@ -6,6 +6,11 @@ A comprehensive skills library of proven techniques, patterns, and workflows for
6
6
 
7
7
  ## What's New
8
8
 
9
+ **v8.2.0 (March 16, 2026):**
10
+
11
+ - **npm registry update checking** — `update` and `check-updates` now query the npm registry instead of the Git repo. Run `npm install -g @complexthings/superpowers-agent` to update.
12
+ - **Version parity hook** — A Husky pre-commit hook ensures `./package.json` and `.agents/package.json` stay in sync, auto-syncing to the highest version and rebuilding the CLI on mismatch.
13
+
9
14
  **v8.0.0 (March 13, 2026):**
10
15
 
11
16
  - **Skills-only delivery** — All per-platform prompt/command files (`.opencode/command/`, `.cursor/commands/`, `.gemini/commands/`, `.github/prompts/`, `.codex/prompts/`, `commands/`) have been removed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complexthings/superpowers-agent",
3
- "version": "8.1.0",
3
+ "version": "8.2.0",
4
4
  "description": "Superpowers agent CLI — skills system for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {