bi-superpowers 1.0.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.
Files changed (276) hide show
  1. package/.claude-plugin/marketplace.json +31 -0
  2. package/.claude-plugin/plugin.json +34 -0
  3. package/.claude-plugin/skill-manifest.json +79 -0
  4. package/.mcp.json +13 -0
  5. package/.plugin/plugin.json +14 -0
  6. package/LICENSE +21 -0
  7. package/README.md +849 -0
  8. package/bin/build-plugin.js +97 -0
  9. package/bin/cli.js +891 -0
  10. package/bin/commands/autoupdate.js +128 -0
  11. package/bin/commands/build-desktop.js +368 -0
  12. package/bin/commands/create-from-template.js +165 -0
  13. package/bin/commands/diff.js +435 -0
  14. package/bin/commands/install.js +542 -0
  15. package/bin/commands/lint.js +441 -0
  16. package/bin/commands/mcp-setup.js +255 -0
  17. package/bin/commands/session-update.js +204 -0
  18. package/bin/commands/smoke-test.js +20 -0
  19. package/bin/commands/uninstall.js +611 -0
  20. package/bin/commands/update-check.js +427 -0
  21. package/bin/commands/validate-cases.js +264 -0
  22. package/bin/commands/validate-projects.js +426 -0
  23. package/bin/commands/watch.js +251 -0
  24. package/bin/lib/agents.js +62 -0
  25. package/bin/lib/base-template-smoke.js +299 -0
  26. package/bin/lib/claude-hooks.js +160 -0
  27. package/bin/lib/generators/claude-plugin.js +529 -0
  28. package/bin/lib/generators/index.js +116 -0
  29. package/bin/lib/generators/shared.js +257 -0
  30. package/bin/lib/mcp-config.js +835 -0
  31. package/bin/lib/microsoft-mcp.js +206 -0
  32. package/bin/lib/powerbi-mcp-session.js +140 -0
  33. package/bin/lib/skills.js +164 -0
  34. package/bin/lib/template-scaffold.js +366 -0
  35. package/bin/mcp/powerbi-modeling-launcher.js +42 -0
  36. package/bin/postinstall.js +50 -0
  37. package/bin/utils/mcp-detect.js +346 -0
  38. package/bin/utils/tui.js +314 -0
  39. package/commands/bi-connect.md +520 -0
  40. package/commands/bi-dax.md +464 -0
  41. package/commands/bi-kickoff.md +550 -0
  42. package/commands/bi-modeling.md +485 -0
  43. package/commands/bi-performance.md +521 -0
  44. package/commands/bi-powerquery.md +229 -0
  45. package/commands/bi-refactor.md +249 -0
  46. package/commands/bi-scorecard.md +268 -0
  47. package/commands/bi-start.md +272 -0
  48. package/config.example.json +23 -0
  49. package/config.json +23 -0
  50. package/desktop-extension/manifest.json +30 -0
  51. package/desktop-extension/package.json +10 -0
  52. package/desktop-extension/server.js +137 -0
  53. package/package.json +94 -0
  54. package/skills/bi-connect/SKILL.md +522 -0
  55. package/skills/bi-connect/scripts/update-check.js +427 -0
  56. package/skills/bi-dax/SKILL.md +466 -0
  57. package/skills/bi-dax/scripts/update-check.js +427 -0
  58. package/skills/bi-kickoff/SKILL.md +552 -0
  59. package/skills/bi-kickoff/references/flow.html +78 -0
  60. package/skills/bi-kickoff/references/flow.md +62 -0
  61. package/skills/bi-kickoff/scripts/update-check.js +427 -0
  62. package/skills/bi-modeling/SKILL.md +487 -0
  63. package/skills/bi-modeling/scripts/update-check.js +427 -0
  64. package/skills/bi-performance/SKILL.md +523 -0
  65. package/skills/bi-performance/scripts/install-tabular-editor.ps1 +159 -0
  66. package/skills/bi-performance/scripts/run-bpa.ps1 +265 -0
  67. package/skills/bi-performance/scripts/update-check.js +427 -0
  68. package/skills/bi-powerquery/SKILL.md +231 -0
  69. package/skills/bi-powerquery/references/base-template-data-contract.md +323 -0
  70. package/skills/bi-powerquery/references/power-query-standards.md +74 -0
  71. package/skills/bi-powerquery/scripts/new-powerquery-staging.ps1 +371 -0
  72. package/skills/bi-powerquery/scripts/test-powerquery-contract.ps1 +225 -0
  73. package/skills/bi-powerquery/scripts/update-check.js +427 -0
  74. package/skills/bi-refactor/SKILL.md +251 -0
  75. package/skills/bi-refactor/references/flow.md +27 -0
  76. package/skills/bi-refactor/scripts/update-check.js +427 -0
  77. package/skills/bi-scorecard/SKILL.md +270 -0
  78. package/skills/bi-scorecard/examples/base-template-scorecard-overlay.json +82 -0
  79. package/skills/bi-scorecard/scripts/new-scorecard-blueprint-from-base-template.ps1 +124 -0
  80. package/skills/bi-scorecard/scripts/powerbi-goal-status-rules-api.ps1 +39 -0
  81. package/skills/bi-scorecard/scripts/powerbi-goal-values-api.ps1 +48 -0
  82. package/skills/bi-scorecard/scripts/powerbi-goals-api.ps1 +68 -0
  83. package/skills/bi-scorecard/scripts/powerbi-rest-common.ps1 +197 -0
  84. package/skills/bi-scorecard/scripts/powerbi-scorecards-api.ps1 +53 -0
  85. package/skills/bi-scorecard/scripts/update-check.js +427 -0
  86. package/skills/bi-start/SKILL.md +274 -0
  87. package/skills/bi-start/scripts/update-check.js +427 -0
  88. package/src/content/base.md +197 -0
  89. package/src/content/mcp-requirements.json +57 -0
  90. package/src/content/routing.md +201 -0
  91. package/src/content/skills/bi-connect.md +493 -0
  92. package/src/content/skills/bi-dax.md +437 -0
  93. package/src/content/skills/bi-kickoff/SKILL.md +523 -0
  94. package/src/content/skills/bi-kickoff/references/flow.html +78 -0
  95. package/src/content/skills/bi-kickoff/references/flow.md +62 -0
  96. package/src/content/skills/bi-modeling.md +458 -0
  97. package/src/content/skills/bi-performance/SKILL.md +494 -0
  98. package/src/content/skills/bi-performance/scripts/install-tabular-editor.ps1 +159 -0
  99. package/src/content/skills/bi-performance/scripts/run-bpa.ps1 +265 -0
  100. package/src/content/skills/bi-powerquery/SKILL.md +202 -0
  101. package/src/content/skills/bi-powerquery/references/base-template-data-contract.md +323 -0
  102. package/src/content/skills/bi-powerquery/references/power-query-standards.md +74 -0
  103. package/src/content/skills/bi-powerquery/scripts/new-powerquery-staging.ps1 +371 -0
  104. package/src/content/skills/bi-powerquery/scripts/test-powerquery-contract.ps1 +225 -0
  105. package/src/content/skills/bi-refactor/SKILL.md +222 -0
  106. package/src/content/skills/bi-refactor/references/flow.md +27 -0
  107. package/src/content/skills/bi-scorecard/SKILL.md +241 -0
  108. package/src/content/skills/bi-scorecard/examples/base-template-scorecard-blueprint.expected.json +105 -0
  109. package/src/content/skills/bi-scorecard/examples/base-template-scorecard-overlay.json +82 -0
  110. package/src/content/skills/bi-scorecard/scripts/new-scorecard-blueprint-from-base-template.ps1 +124 -0
  111. package/src/content/skills/bi-scorecard/scripts/powerbi-goal-status-rules-api.ps1 +39 -0
  112. package/src/content/skills/bi-scorecard/scripts/powerbi-goal-values-api.ps1 +48 -0
  113. package/src/content/skills/bi-scorecard/scripts/powerbi-goals-api.ps1 +68 -0
  114. package/src/content/skills/bi-scorecard/scripts/powerbi-rest-common.ps1 +197 -0
  115. package/src/content/skills/bi-scorecard/scripts/powerbi-scorecards-api.ps1 +53 -0
  116. package/src/content/skills/bi-start.md +266 -0
  117. package/templates/base-template/AGENTS.md +33 -0
  118. package/templates/base-template/base-template.Report/.platform +11 -0
  119. package/templates/base-template/base-template.Report/StaticResources/RegisteredResources/BISuperpowers.json +3888 -0
  120. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BaseThemes/CY18SU07.json +177 -0
  121. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BaseThemes/Fluent2-CY26SU03.json +4104 -0
  122. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/AccessibleCityPark.json +26 -0
  123. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/AccessibleDefault.json +26 -0
  124. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/AccessibleNeutral.json +26 -0
  125. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/AccessibleOrchid.json +26 -0
  126. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/AccessibleTidal.json +26 -0
  127. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/Bloom.json +139 -0
  128. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/CityPark.json +40 -0
  129. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/Classroom.json +40 -0
  130. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/ColorblindSafe.json +48 -0
  131. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/CopilotDefault.json +1861 -0
  132. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/Divergent.json +127 -0
  133. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/Electric.json +48 -0
  134. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/Frontier.json +136 -0
  135. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/HighContrast.json +40 -0
  136. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/Highrise.json +41 -0
  137. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/Innovate.json +227 -0
  138. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/NewExecutive.json +41 -0
  139. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/Solar.json +33 -0
  140. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/Storm.json +25 -0
  141. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/Sunset.json +48 -0
  142. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/Temperature.json +33 -0
  143. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/Tidal.json +100 -0
  144. package/templates/base-template/base-template.Report/StaticResources/SharedResources/BuiltInThemes/Twilight.json +40 -0
  145. package/templates/base-template/base-template.Report/definition/bookmarks/1d40d43c7ade66e8603c.bookmark.json +2297 -0
  146. package/templates/base-template/base-template.Report/definition/bookmarks/af068ff51c0ca3089ea7.bookmark.json +2300 -0
  147. package/templates/base-template/base-template.Report/definition/bookmarks/bookmarks.json +11 -0
  148. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/page.json +130 -0
  149. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/0352fd80d074693a65db/mobile.json +11 -0
  150. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/0352fd80d074693a65db/visual.json +669 -0
  151. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/1c5a14bf493697344b68/mobile.json +11 -0
  152. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/1c5a14bf493697344b68/visual.json +723 -0
  153. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/3486cf7624c5b109b4e5/mobile.json +11 -0
  154. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/3486cf7624c5b109b4e5/visual.json +333 -0
  155. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/4d8b989008edc0db28d1/mobile.json +11 -0
  156. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/4d8b989008edc0db28d1/visual.json +109 -0
  157. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/55e10ac7d76a1954f94f/mobile.json +31 -0
  158. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/55e10ac7d76a1954f94f/visual.json +378 -0
  159. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/57f52ecf4490f70e4da1/mobile.json +11 -0
  160. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/57f52ecf4490f70e4da1/visual.json +175 -0
  161. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/5f4d76bbc870118e9840/mobile.json +11 -0
  162. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/5f4d76bbc870118e9840/visual.json +468 -0
  163. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/73629e1abebb7a444b59/mobile.json +11 -0
  164. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/73629e1abebb7a444b59/visual.json +359 -0
  165. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/749cb1388c7e0a88161c/mobile.json +11 -0
  166. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/749cb1388c7e0a88161c/visual.json +690 -0
  167. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/90677f13cea5d1275990/visual.json +17 -0
  168. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/92cf92e3da10493adb78/mobile.json +11 -0
  169. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/92cf92e3da10493adb78/visual.json +468 -0
  170. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/9fe17b1971f68443fc15/mobile.json +10 -0
  171. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/9fe17b1971f68443fc15/visual.json +328 -0
  172. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/a30bd0950630ed94e8a3/mobile.json +11 -0
  173. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/a30bd0950630ed94e8a3/visual.json +578 -0
  174. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/a56e91d9400a835e4814/mobile.json +11 -0
  175. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/a56e91d9400a835e4814/visual.json +432 -0
  176. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/aded24cd205c0b528642/mobile.json +11 -0
  177. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/aded24cd205c0b528642/visual.json +801 -0
  178. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/af34b26f14a8a724c9a9/mobile.json +37 -0
  179. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/af34b26f14a8a724c9a9/visual.json +1318 -0
  180. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/b529688fe5a226643322/visual.json +209 -0
  181. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/c4c6f332d05e72e2eb06/mobile.json +11 -0
  182. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/c4c6f332d05e72e2eb06/visual.json +174 -0
  183. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/fa81f184e2cb0e8b087c/mobile.json +29 -0
  184. package/templates/base-template/base-template.Report/definition/pages/6a4808bb8bb9166f49ff/visuals/fa81f184e2cb0e8b087c/visual.json +241 -0
  185. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/page.json +130 -0
  186. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/07e9c4302e29029c5462/mobile.json +11 -0
  187. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/07e9c4302e29029c5462/visual.json +690 -0
  188. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/109ceede4bc015b0c006/mobile.json +11 -0
  189. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/109ceede4bc015b0c006/visual.json +468 -0
  190. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/118257e006d472277e10/mobile.json +11 -0
  191. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/118257e006d472277e10/visual.json +359 -0
  192. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/2caf02e0137c4a1280cc/mobile.json +11 -0
  193. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/2caf02e0137c4a1280cc/visual.json +669 -0
  194. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/311e76fe3c9edad68204/mobile.json +11 -0
  195. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/311e76fe3c9edad68204/visual.json +109 -0
  196. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/31c21f8cbeb3b208940a/visual.json +209 -0
  197. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/3ab72c25062437149b03/visual.json +17 -0
  198. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/5959867442abcb0ce2b3/mobile.json +11 -0
  199. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/5959867442abcb0ce2b3/visual.json +788 -0
  200. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/5b96e0f88d192b044a13/mobile.json +11 -0
  201. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/5b96e0f88d192b044a13/visual.json +592 -0
  202. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/64e749a63d0786000e22/mobile.json +11 -0
  203. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/64e749a63d0786000e22/visual.json +468 -0
  204. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/7ae1ca604edac6586ad0/mobile.json +11 -0
  205. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/7ae1ca604edac6586ad0/visual.json +1310 -0
  206. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/840300733885141a6603/mobile.json +11 -0
  207. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/840300733885141a6603/visual.json +175 -0
  208. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/a38448cdb203279273d2/mobile.json +11 -0
  209. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/a38448cdb203279273d2/visual.json +516 -0
  210. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/d1e86f213a3841d12e20/visual.json +328 -0
  211. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/d4a484c1bcc8ee3075e2/mobile.json +11 -0
  212. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/d4a484c1bcc8ee3075e2/visual.json +432 -0
  213. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/d87cb5cf06acca19bbb5/mobile.json +11 -0
  214. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/d87cb5cf06acca19bbb5/visual.json +241 -0
  215. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/e243da2677209ed69408/mobile.json +11 -0
  216. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/e243da2677209ed69408/visual.json +174 -0
  217. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/f3aaf24f5b22b67573b0/mobile.json +11 -0
  218. package/templates/base-template/base-template.Report/definition/pages/9a5b670b015cab882629/visuals/f3aaf24f5b22b67573b0/visual.json +333 -0
  219. package/templates/base-template/base-template.Report/definition/pages/pages.json +8 -0
  220. package/templates/base-template/base-template.Report/definition/report.json +89 -0
  221. package/templates/base-template/base-template.Report/definition/version.json +4 -0
  222. package/templates/base-template/base-template.Report/definition.pbir +9 -0
  223. package/templates/base-template/base-template.SemanticModel/.platform +11 -0
  224. package/templates/base-template/base-template.SemanticModel/definition/cultures/es-AR.tmdl +11185 -0
  225. package/templates/base-template/base-template.SemanticModel/definition/database.tmdl +3 -0
  226. package/templates/base-template/base-template.SemanticModel/definition/expressions.tmdl +234 -0
  227. package/templates/base-template/base-template.SemanticModel/definition/functions.tmdl +637 -0
  228. package/templates/base-template/base-template.SemanticModel/definition/model.tmdl +82 -0
  229. package/templates/base-template/base-template.SemanticModel/definition/relationships.tmdl +271 -0
  230. package/templates/base-template/base-template.SemanticModel/definition/tables/Calendario.tmdl +200 -0
  231. package/templates/base-template/base-template.SemanticModel/definition/tables/Campa/303/261as.tmdl +75 -0
  232. package/templates/base-template/base-template.SemanticModel/definition/tables/Canales.tmdl +84 -0
  233. package/templates/base-template/base-template.SemanticModel/definition/tables/Clientes.tmdl +143 -0
  234. package/templates/base-template/base-template.SemanticModel/definition/tables/Devoluciones.tmdl +95 -0
  235. package/templates/base-template/base-template.SemanticModel/definition/tables/Ejecuci/303/263n proyectos.tmdl" +130 -0
  236. package/templates/base-template/base-template.SemanticModel/definition/tables/Entregas.tmdl +122 -0
  237. package/templates/base-template/base-template.SemanticModel/definition/tables/Equipos m/303/251tricas.tmdl" +40 -0
  238. package/templates/base-template/base-template.SemanticModel/definition/tables/Equipos.tmdl +73 -0
  239. package/templates/base-template/base-template.SemanticModel/definition/tables/Horas.tmdl +122 -0
  240. package/templates/base-template/base-template.SemanticModel/definition/tables/Interacciones clientes.tmdl +146 -0
  241. package/templates/base-template/base-template.SemanticModel/definition/tables/Leads.tmdl +119 -0
  242. package/templates/base-template/base-template.SemanticModel/definition/tables/Monedas.tmdl +44 -0
  243. package/templates/base-template/base-template.SemanticModel/definition/tables/Movimientos financieros.tmdl +145 -0
  244. package/templates/base-template/base-template.SemanticModel/definition/tables/M/303/251tricas.tmdl +1294 -0
  245. package/templates/base-template/base-template.SemanticModel/definition/tables/N/303/263mina.tmdl +110 -0
  246. package/templates/base-template/base-template.SemanticModel/definition/tables/Oportunidades.tmdl +135 -0
  247. package/templates/base-template/base-template.SemanticModel/definition/tables/Presupuesto.tmdl +125 -0
  248. package/templates/base-template/base-template.SemanticModel/definition/tables/Productos.tmdl +98 -0
  249. package/templates/base-template/base-template.SemanticModel/definition/tables/Proyectos.tmdl +77 -0
  250. package/templates/base-template/base-template.SemanticModel/definition/tables/Servicios.tmdl +75 -0
  251. package/templates/base-template/base-template.SemanticModel/definition/tables/Tareas proyecto.tmdl +102 -0
  252. package/templates/base-template/base-template.SemanticModel/definition/tables/Tipo de cambio.tmdl +67 -0
  253. package/templates/base-template/base-template.SemanticModel/definition/tables/Ventas.tmdl +180 -0
  254. package/templates/base-template/base-template.SemanticModel/definition/tables/_Aux An/303/241lisis dimensiones.tmdl" +38 -0
  255. package/templates/base-template/base-template.SemanticModel/definition/tables/_Aux Comparaciones.tmdl +227 -0
  256. package/templates/base-template/base-template.SemanticModel/definition/tables/_Aux Compatibilidad m/303/251trica-dimensi/303/263n.tmdl" +68 -0
  257. package/templates/base-template/base-template.SemanticModel/definition/tables/_Aux Modelo configuraci/303/263n.tmdl" +44 -0
  258. package/templates/base-template/base-template.SemanticModel/definition/tables/_Aux Modo fechas.tmdl +36 -0
  259. package/templates/base-template/base-template.SemanticModel/definition/tables/_Aux M/303/251trica-Equipo.tmdl" +102 -0
  260. package/templates/base-template/base-template.SemanticModel/definition/tables/_Aux Overrides m/303/251trica-dimensi/303/263n.tmdl" +54 -0
  261. package/templates/base-template/base-template.SemanticModel/definition/tables/_Aux Per/303/255odos.tmdl" +182 -0
  262. package/templates/base-template/base-template.SemanticModel/definition/tables/_Aux Rango fechas modo.tmdl +36 -0
  263. package/templates/base-template/base-template.SemanticModel/definition/tables/_Aux Rango fechas.tmdl +27 -0
  264. package/templates/base-template/base-template.SemanticModel/definition/tables/_Aux Vista de calendario.tmdl +30 -0
  265. package/templates/base-template/base-template.SemanticModel/definition/tables/_GC C/303/241lculo.tmdl" +70 -0
  266. package/templates/base-template/base-template.SemanticModel/definition/tables/_GC Eje X.tmdl +63 -0
  267. package/templates/base-template/base-template.SemanticModel/definition/tables/_GC M/303/251trica.tmdl" +374 -0
  268. package/templates/base-template/base-template.SemanticModel/definition/tables/_GC Tipo c/303/241lculo.tmdl" +223 -0
  269. package/templates/base-template/base-template.SemanticModel/definition/tables/_PC Dimensi/303/263n.tmdl" +98 -0
  270. package/templates/base-template/base-template.SemanticModel/definition/tables/_PC Eje X.tmdl +68 -0
  271. package/templates/base-template/base-template.SemanticModel/definition/tables//303/223rdenes servicio.tmdl" +151 -0
  272. package/templates/base-template/base-template.SemanticModel/definition.pbism +5 -0
  273. package/templates/base-template/base-template.SemanticModel/diagramLayout.json +568 -0
  274. package/templates/base-template/base-template.pbip +14 -0
  275. package/templates/base-template/template.manifest.json +41 -0
  276. package/theme/BISuperpowers.json +3888 -0
package/bin/cli.js ADDED
@@ -0,0 +1,891 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * BI Agent Superpowers — Command Line Interface
5
+ * ==============================================
6
+ *
7
+ * Main entry point for the `super` CLI. Provides commands to install
8
+ * skills and MCP servers into AI coding agents, and to generate the
9
+ * native Claude Code plugin into a project.
10
+ *
11
+ * Architecture:
12
+ * - Skills are authored once in src/content/skills/ and copied out to
13
+ * each supported agent by `super install`.
14
+ * - `super kickoff` optionally generates a local Claude Code plugin tree in a
15
+ * user project (skills + commands + MCP config).
16
+ * - `super recharge` regenerates an existing local Claude Code plugin after edits.
17
+ *
18
+ * Supported agents: Claude Code, GitHub Copilot, Codex, Gemini CLI, Kilo Code.
19
+ * License: MIT. This project is fully open source — no activation, no keys.
20
+ *
21
+ * @module cli
22
+ * @author Lucas Sanchez (@luquimbo)
23
+ * @license MIT
24
+ */
25
+
26
+ const fs = require('fs');
27
+ const path = require('path');
28
+ const { execSync } = require('child_process');
29
+ const { loadSkills } = require('./lib/skills');
30
+
31
+ // Optional lib import — may not be available during npm install phase.
32
+ let generators;
33
+ try {
34
+ generators = require('./lib/generators');
35
+ } catch (_) {
36
+ // Silent fallback; commands will report a useful error when invoked.
37
+ }
38
+
39
+ // Optional command imports — each module may fail to load during npm
40
+ // install before dependencies are wired up. The CLI still renders `help`
41
+ // and `version` because those are hoisted, module-free functions.
42
+ let lintCommand;
43
+ let diffCommand;
44
+ let watchCommand;
45
+ let mcpSetupCommand;
46
+ let buildDesktopCommand;
47
+ let installCommand;
48
+ let uninstallCommand;
49
+ let autoupdateCommand;
50
+ let validateCasesCommand;
51
+ let validateProjectsCommand;
52
+ let smokeTestCommand;
53
+ let createFromTemplateCommand;
54
+ let tui;
55
+ try {
56
+ lintCommand = require('./commands/lint'); // checkup: skill file validation
57
+ diffCommand = require('./commands/diff'); // scan: diff source vs generated
58
+ watchCommand = require('./commands/watch'); // sentinel: watch + auto regen
59
+ mcpSetupCommand = require('./commands/mcp-setup'); // MCP server configuration
60
+ buildDesktopCommand = require('./commands/build-desktop'); // .mcpb for Claude Desktop
61
+ installCommand = require('./commands/install'); // multi-agent skill + MCP installer
62
+ uninstallCommand = require('./commands/uninstall'); // multi-agent skill + MCP remover
63
+ autoupdateCommand = require('./commands/autoupdate'); // opt-in SessionStart self-update hook
64
+ validateCasesCommand = require('./commands/validate-cases'); // validation playbook discovery
65
+ validateProjectsCommand = require('./commands/validate-projects'); // repo/project validation harness
66
+ smokeTestCommand = require('./commands/smoke-test'); // live base-template smoke test
67
+ createFromTemplateCommand = require('./commands/create-from-template'); // PBIP scaffold from templates/
68
+ tui = require('./utils/tui'); // colors, tables, boxes for CLI output
69
+ } catch (_) {
70
+ // Expected during `npm install` — modules become available after deps are linked.
71
+ }
72
+
73
+ // ============================================
74
+ // CONFIGURATION CONSTANTS
75
+ // ============================================
76
+
77
+ /** Package version (read from package.json at runtime) */
78
+ const VERSION = require('../package.json').version;
79
+
80
+ /**
81
+ * Skill and command counts used by the help text and dry-run previews.
82
+ * Pulled dynamically from the generator so we never hardcode outdated totals.
83
+ */
84
+ let COMMAND_COUNT = 0;
85
+ let TOTAL_SKILL_COUNT = 0;
86
+ try {
87
+ const { COMMAND_SKILLS, REFERENCE_SKILLS } = require('./lib/generators/claude-plugin');
88
+ COMMAND_COUNT = COMMAND_SKILLS.size;
89
+ TOTAL_SKILL_COUNT = COMMAND_SKILLS.size + REFERENCE_SKILLS.size;
90
+ } catch (_) {
91
+ // Fallback during npm install phase — values stay at 0 until the module loads.
92
+ }
93
+
94
+ /** Absolute path to the installed package directory (one level above bin/) */
95
+ const PACKAGE_DIR = path.dirname(__dirname);
96
+
97
+ /** Directory containing the authoring source for each skill */
98
+ const SKILLS_DIR = path.join(PACKAGE_DIR, 'src', 'content', 'skills');
99
+
100
+ /** Project-local config file name used by kickoff/recharge */
101
+ const CONFIG_FILE = '.bi-superpowers.json';
102
+
103
+ /** npm package name for the upgrade command */
104
+ const PACKAGE_NAME = 'bi-superpowers';
105
+
106
+ /** Default tool set generated by kickoff (currently only the Claude Code plugin) */
107
+ const DEFAULT_TOOLS = ['claude-plugin'];
108
+
109
+ /** Generator registry (populated from lib/generators if available) */
110
+ const AI_TOOLS = generators ? generators.AI_TOOLS : {};
111
+
112
+ // ============================================
113
+ // COMMAND ROUTING
114
+ // ============================================
115
+ // Commands are registered in two phases to avoid temporal-dead-zone errors.
116
+ // Phase 1: hoisted function declarations (help, version, about, kickoff...)
117
+ // go directly into the object literal below.
118
+ // Phase 2: wrapper-based commands that depend on createCommandWrapper
119
+ // (defined further below) are attached imperatively.
120
+ const commands = {
121
+ // Core commands — hoisted functions, safe to reference here.
122
+ help: showHelp,
123
+ version: showVersion,
124
+ about: showInfo,
125
+
126
+ // Primary flow — also hoisted functions.
127
+ kickoff: initProject,
128
+ recharge: syncProject,
129
+ upgrade: updatePackage,
130
+ powers: listAgents,
131
+
132
+ // Legacy aliases kept for backwards compatibility.
133
+ init: initProject,
134
+ sync: syncProject,
135
+ update: updatePackage,
136
+ list: listAgents,
137
+ info: showInfo,
138
+ };
139
+
140
+ /**
141
+ * Main entry point — parses CLI arguments and routes to the handler.
142
+ */
143
+ function main() {
144
+ const args = process.argv.slice(2);
145
+ let command = args[0] || 'help';
146
+
147
+ // Accept the conventional flag forms so `--help`/`--version` work like any CLI.
148
+ if (command === '--help' || command === '-h') command = 'help';
149
+ else if (command === '--version' || command === '-v') command = 'version';
150
+
151
+ if (commands[command]) {
152
+ commands[command](args.slice(1));
153
+ } else {
154
+ console.error(`Unknown command: ${command}`);
155
+ showHelp();
156
+ process.exit(1);
157
+ }
158
+ }
159
+
160
+ function showHelp() {
161
+ console.log(`
162
+ BI Agent Superpowers v${VERSION}
163
+ ================================
164
+
165
+ Open-source toolkit for Power BI Desktop development across 5 AI coding agents:
166
+ Claude Code · GitHub Copilot · Codex · Gemini CLI · Kilo Code.
167
+
168
+ Quick Start:
169
+ super install --all --yes # Install skills + MCPs user-level for all agents
170
+ super powers # List the skills and MCPs available
171
+
172
+ Usage:
173
+ super <command> [options]
174
+
175
+ Primary commands:
176
+ install Install ${TOTAL_SKILL_COUNT || 'the'} skills + 2 MCPs user-level across your AI agents
177
+ uninstall Remove the skills + 2 MCPs from your AI agents
178
+ kickoff [path] Optional: generate a repo-local Claude Code plugin
179
+ recharge [path] Optional: regenerate an existing repo-local Claude Code plugin
180
+ create-from-template Scaffold a new PBIP project from templates/<name>/ into pbip-files/
181
+ build-desktop Build the .mcpb extension for Claude Desktop
182
+ mcp-setup Refresh MCP config for an existing Claude Code local plugin
183
+ powers List available skills and MCPs
184
+ smoke-test Run the live base-template smoke test
185
+ upgrade Update to the latest version on npm
186
+ autoupdate <on|off> Toggle silent self-update on session start (Claude Code)
187
+ about Show installation info
188
+ help Show this help
189
+
190
+ Developer tools:
191
+ checkup [file] Lint/validate skill source files
192
+ scan Diff between source skills and generated plugin
193
+ sentinel Watch skill sources and auto-regenerate
194
+ validate-cases List, print, or live-run validation playbooks
195
+ validate-projects Validate public fixtures + local private project references
196
+
197
+ Options:
198
+ --dry-run Preview changes without writing files (kickoff, recharge)
199
+
200
+ Examples:
201
+ super install # Interactive installer for all agents
202
+ super install --all --yes # Non-interactive install for every agent
203
+ super install -a codex # Install user-level skills + MCPs for Codex
204
+ super install -a claude-code # Install only for Claude Code
205
+ super kickoff # Claude Code only: create local plugin files
206
+ super kickoff ./my-project # Claude Code only: initialize in a repo
207
+ super kickoff --dry-run # Preview local Claude Code plugin files
208
+ super recharge # Regenerate existing local Claude Code plugin
209
+ super build-desktop # Build .mcpb for Claude Desktop
210
+ super build-desktop --output dist
211
+ super mcp-setup # Existing local Claude Code plugin only
212
+ super smoke-test # Run the live Desktop smoke test directly
213
+ super validate-cases # List the repo playbooks or print one playbook
214
+ super validate-cases --case base-template-smoke-test --live # Run the live Desktop smoke test
215
+ super validate-projects # Developer QA against validation/ descriptors
216
+ super create-from-template --list # List bundled templates
217
+ super create-from-template --template base-template --name bi-personal # Scaffold from base template
218
+ super create-from-template --template base-template --name bi-personal --dry-run # Preview only
219
+
220
+ Open source — MIT licensed.
221
+ Documentation: https://bi-superpowers.dev
222
+ `);
223
+ }
224
+
225
+ function showVersion() {
226
+ console.log(`BI Agent Superpowers v${VERSION}`);
227
+ }
228
+
229
+ function showInfo() {
230
+ const skillCount = getSkillFiles().length;
231
+ const aiToolsList = Object.entries(AI_TOOLS)
232
+ .map(([, v]) => ` - ${v.name}`)
233
+ .join('\n');
234
+
235
+ console.log(`
236
+ BI Agent Superpowers — Installation Info
237
+ ========================================
238
+
239
+ Version: ${VERSION}
240
+ Author: Lucas Sanchez (@luquimbo)
241
+ Package dir: ${PACKAGE_DIR}
242
+ Skills: ${skillCount} available
243
+ License: MIT (open source)
244
+
245
+ Supported AI agents:
246
+ - Claude Code (native plugin + MCP)
247
+ - GitHub Copilot (agent skills + MCP)
248
+ - Codex (OpenAI) (agent skills + MCP)
249
+ - Gemini CLI (agent skills + MCP)
250
+ - Kilo Code (agent skills + MCP)
251
+
252
+ Plugin generators:
253
+ ${aiToolsList}
254
+
255
+ GitHub: https://github.com/luquimbo/bi-superpowers
256
+ `);
257
+ }
258
+
259
+ // ============================================
260
+ // SKILL FILE MANAGEMENT
261
+ // ============================================
262
+
263
+ /**
264
+ * Load all skill source files from the package.
265
+ * @returns {Array<{name: string, path: string, content: string}>}
266
+ */
267
+ function getSkillFiles() {
268
+ return loadSkills({ packageDir: PACKAGE_DIR });
269
+ }
270
+
271
+ /**
272
+ * Extract lightweight metadata (title, triggers, identity) from a skill's
273
+ * markdown content. Delegates to the generators module when available.
274
+ */
275
+ function parseSkillMetadata(content) {
276
+ if (generators && generators.parseSkillMetadata) {
277
+ return generators.parseSkillMetadata(content);
278
+ }
279
+ // Minimal fallback when the module isn't loaded yet.
280
+ const metadata = { title: '', triggers: [], identity: '' };
281
+ const titleMatch = content.match(/^#\s+(.+)/m);
282
+ if (titleMatch) metadata.title = titleMatch[1];
283
+ return metadata;
284
+ }
285
+
286
+ // ============================================
287
+ // PROJECT INITIALIZATION (kickoff / recharge)
288
+ // ============================================
289
+
290
+ /**
291
+ * `super kickoff` — generate an optional local Claude Code plugin in the target directory.
292
+ *
293
+ * What it does:
294
+ * 1. Generates .claude-plugin/, .mcp.json, commands/, skills/ in the target.
295
+ * 2. Writes .bi-superpowers.json tracking tool selections.
296
+ * 3. Copies a default config.json template if none exists yet.
297
+ *
298
+ * Supports --dry-run to preview without writing files.
299
+ *
300
+ * @param {string[]} args - CLI arguments (first positional = target dir)
301
+ */
302
+ async function initProject(args) {
303
+ const dryRun = hasDryRunFlag(args);
304
+ const cleanArgs = removeDryRunFlag(args);
305
+ const targetDir = cleanArgs[0] ? path.resolve(cleanArgs[0]) : process.cwd();
306
+
307
+ const skills = getSkillFiles();
308
+
309
+ console.log(`
310
+ BI Agent Superpowers v${VERSION}
311
+ ================================
312
+ Claude Code local plugin setup
313
+
314
+ Initializing in: ${targetDir}
315
+ Skills available: ${skills.length}
316
+
317
+ This is not the multi-agent install path. For Codex, GitHub Copilot,
318
+ Gemini CLI, Kilo Code, and user-level Claude Code installs, run:
319
+
320
+ super install --all --yes
321
+
322
+ kickoff writes repo-local Claude Code plugin files only.
323
+ `);
324
+
325
+ if (dryRun) {
326
+ if (tui) {
327
+ tui.dryRunNotice();
328
+ } else {
329
+ console.log('══════════════════════════════════════');
330
+ console.log(' DRY RUN MODE');
331
+ console.log(' No files will be created or modified');
332
+ console.log('══════════════════════════════════════\n');
333
+ }
334
+ }
335
+
336
+ const selectedTools = [...DEFAULT_TOOLS];
337
+
338
+ console.log('Plugin output:');
339
+ console.log(' • .claude-plugin/plugin.json');
340
+ console.log(' • .mcp.json');
341
+ console.log(` • commands/ (${COMMAND_COUNT} slash commands)`);
342
+ console.log(` • skills/ (${TOTAL_SKILL_COUNT} SKILL.md files)\n`);
343
+
344
+ if (dryRun) {
345
+ console.log('[DRY RUN] Would create the following files:\n');
346
+ previewGeneration(targetDir, selectedTools, skills);
347
+ previewProjectConfigJson(targetDir);
348
+ console.log('\nRun without --dry-run to apply changes.');
349
+ return;
350
+ }
351
+
352
+ saveToolConfig(targetDir, selectedTools);
353
+ ensureProjectConfigJson(targetDir);
354
+
355
+ console.log('');
356
+ for (const tool of selectedTools) {
357
+ await generateForTool(tool, targetDir, skills);
358
+ }
359
+
360
+ showCompletionMessage(targetDir, selectedTools, skills.length);
361
+ }
362
+
363
+ /**
364
+ * `super recharge` — regenerate an existing local Claude Code plugin without prompts.
365
+ *
366
+ * Re-reads the saved tool preferences from .bi-superpowers.json (or falls
367
+ * back to the default toolset) and regenerates everything. Useful after:
368
+ * - editing files in src/content/skills/
369
+ * - bumping the package version
370
+ * - adding new supported tools
371
+ *
372
+ * @param {string[]} args - CLI arguments (first positional = target dir)
373
+ */
374
+ async function syncProject(args) {
375
+ const dryRun = hasDryRunFlag(args);
376
+ const cleanArgs = removeDryRunFlag(args);
377
+ const targetDir = cleanArgs[0] ? path.resolve(cleanArgs[0]) : process.cwd();
378
+
379
+ const skills = getSkillFiles();
380
+
381
+ console.log(`
382
+ BI Agent Superpowers — Sync
383
+ ===========================
384
+ Regenerating configs from ${skills.length} skills...
385
+ `);
386
+
387
+ if (dryRun) {
388
+ if (tui) {
389
+ tui.dryRunNotice();
390
+ } else {
391
+ console.log('══════════════════════════════════════');
392
+ console.log(' DRY RUN MODE');
393
+ console.log(' No files will be created or modified');
394
+ console.log('══════════════════════════════════════\n');
395
+ }
396
+ }
397
+
398
+ if (!hasProjectLocalPlugin(targetDir)) {
399
+ console.log(`
400
+ This repo does not contain a local Claude Code plugin generated by super kickoff.
401
+
402
+ For Codex, GitHub Copilot, Gemini CLI, Kilo Code, and user-level Claude Code
403
+ installs, refresh the user-level install instead:
404
+
405
+ super install --all --yes
406
+
407
+ If you intentionally want repo-local Claude Code plugin files, run:
408
+
409
+ super kickoff
410
+ `);
411
+ process.exitCode = 2;
412
+ return;
413
+ }
414
+
415
+ const config = loadToolConfig(targetDir);
416
+ const selectedTools = ensurePluginTool(config.tools || [...DEFAULT_TOOLS]);
417
+
418
+ if (dryRun) {
419
+ console.log('[DRY RUN] Would regenerate the following files:\n');
420
+ previewGeneration(targetDir, selectedTools, skills);
421
+ console.log('\nRun without --dry-run to apply changes.');
422
+ return;
423
+ }
424
+
425
+ for (const tool of selectedTools) {
426
+ await generateForTool(tool, targetDir, skills);
427
+ }
428
+
429
+ console.log(`
430
+ Done. Plugin regenerated for: ${selectedTools.map((t) => AI_TOOLS[t].name).join(', ')}
431
+
432
+ If you modified skills in src/content/skills/, your Claude Code plugin is now up to date.
433
+
434
+ Tip: run 'super build-desktop' to rebuild the Claude Desktop MCPB extension.
435
+ `);
436
+ }
437
+
438
+ /**
439
+ * Delegate to the generators module to preview what would be written.
440
+ */
441
+ function previewGeneration(targetDir, tools, skills) {
442
+ if (generators) {
443
+ generators.previewGeneration(targetDir, tools, skills, CONFIG_FILE);
444
+ }
445
+ }
446
+
447
+ /**
448
+ * Ensure the tool list always includes the Claude Code plugin as the
449
+ * primary target. Deduplicates and preserves order.
450
+ */
451
+ function ensurePluginTool(tools = []) {
452
+ const normalized = Array.from(new Set((tools || []).filter(Boolean)));
453
+ if (!normalized.includes('claude-plugin')) {
454
+ normalized.unshift('claude-plugin');
455
+ }
456
+ return normalized;
457
+ }
458
+
459
+ /**
460
+ * Build the options object passed into individual generators.
461
+ * `library/` is no longer shipped by this package. Keep local project
462
+ * library references unchanged only when the target repo provides them.
463
+ */
464
+ function getGenerationOptions(targetDir) {
465
+ const usePluginRootLauncher = path.resolve(targetDir) === PACKAGE_DIR;
466
+ const libraryPrefix = fs.existsSync(path.join(targetDir, 'library')) ? 'library' : null;
467
+
468
+ return {
469
+ packageDir: PACKAGE_DIR,
470
+ version: VERSION,
471
+ usePluginRootLauncher,
472
+ libraryPrefix,
473
+ };
474
+ }
475
+
476
+ /**
477
+ * Write .bi-superpowers.json with the current tool selection and metadata.
478
+ */
479
+ function saveToolConfig(targetDir, tools) {
480
+ const configPath = path.join(targetDir, CONFIG_FILE);
481
+ const normalizedTools = ensurePluginTool(tools);
482
+ const config = {
483
+ tools: normalizedTools,
484
+ plugin: {
485
+ name: 'bi-superpowers',
486
+ enabled: true,
487
+ },
488
+ version: VERSION,
489
+ lastSync: new Date().toISOString(),
490
+ };
491
+ fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
492
+ }
493
+
494
+ /**
495
+ * Log what config.json the kickoff would create (dry-run only).
496
+ */
497
+ function previewProjectConfigJson(targetDir) {
498
+ const projectConfigPath = path.join(targetDir, 'config.json');
499
+ if (fs.existsSync(projectConfigPath)) {
500
+ return;
501
+ }
502
+ if (tui) {
503
+ tui.info(`Would create: ${tui.formatPath(projectConfigPath)}`);
504
+ } else {
505
+ console.log(`[DRY RUN] Would create: ${projectConfigPath}`);
506
+ }
507
+ }
508
+
509
+ /**
510
+ * Copy the package's config.json template into the target directory
511
+ * unless one already exists there.
512
+ * @returns {{created: boolean, path: string, reason?: string, error?: string}}
513
+ */
514
+ function ensureProjectConfigJson(targetDir) {
515
+ const projectConfigPath = path.join(targetDir, 'config.json');
516
+ if (fs.existsSync(projectConfigPath)) {
517
+ return { created: false, path: projectConfigPath, reason: 'already-exists' };
518
+ }
519
+
520
+ const templatePath = path.join(PACKAGE_DIR, 'config.json');
521
+ if (!fs.existsSync(templatePath)) {
522
+ if (process.env.DEBUG === 'true') {
523
+ console.error(`[DEBUG] Missing config.json template at: ${templatePath}`);
524
+ }
525
+ return { created: false, path: projectConfigPath, reason: 'template-missing' };
526
+ }
527
+
528
+ try {
529
+ fs.copyFileSync(templatePath, projectConfigPath);
530
+ return { created: true, path: projectConfigPath };
531
+ } catch (e) {
532
+ if (process.env.DEBUG === 'true') {
533
+ console.error(`[DEBUG] Failed to create config.json: ${e.message}`);
534
+ }
535
+ return { created: false, path: projectConfigPath, reason: 'copy-failed', error: e.message };
536
+ }
537
+ }
538
+
539
+ /**
540
+ * Load the previously saved tool selection from .bi-superpowers.json.
541
+ * Falls back to the default toolset if the file is missing or invalid.
542
+ */
543
+ function loadToolConfig(targetDir) {
544
+ const configPath = path.join(targetDir, CONFIG_FILE);
545
+ if (fs.existsSync(configPath)) {
546
+ try {
547
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
548
+ config.tools = ensurePluginTool(config.tools || []);
549
+ if (!config.plugin) {
550
+ config.plugin = { name: 'bi-superpowers', enabled: true };
551
+ }
552
+ return config;
553
+ } catch (_) {
554
+ return {};
555
+ }
556
+ }
557
+ return {
558
+ tools: [...DEFAULT_TOOLS],
559
+ plugin: { name: 'bi-superpowers', enabled: true },
560
+ };
561
+ }
562
+
563
+ function hasProjectLocalPlugin(targetDir) {
564
+ return (
565
+ fs.existsSync(path.join(targetDir, CONFIG_FILE)) ||
566
+ fs.existsSync(path.join(targetDir, '.claude-plugin', 'plugin.json'))
567
+ );
568
+ }
569
+
570
+ /**
571
+ * Dispatch to the tool-specific generator.
572
+ */
573
+ async function generateForTool(tool, targetDir, skills) {
574
+ if (generators) {
575
+ await generators.generateForTool(tool, targetDir, skills, getGenerationOptions(targetDir));
576
+ }
577
+ }
578
+
579
+ function showCompletionMessage(targetDir, tools, skillCount) {
580
+ console.log(`
581
+ ════════════════════════════════════════════════════════════
582
+ BI Agent Superpowers configured successfully!
583
+ ════════════════════════════════════════════════════════════
584
+
585
+ Skills: ${skillCount} skills generated
586
+
587
+ Note: this is a repo-local Claude Code plugin only.
588
+ Codex, GitHub Copilot, Gemini CLI, Kilo Code, and user-level Claude Code
589
+ installs use: super install --all --yes
590
+
591
+ ────────────────────────────────────────────────────────────
592
+ CLAUDE CODE
593
+ ────────────────────────────────────────────────────────────
594
+
595
+ Plugin files:
596
+ ${path.join(targetDir, '.claude-plugin', 'plugin.json')}
597
+ ${path.join(targetDir, '.mcp.json')}
598
+ ${path.join(targetDir, 'commands')}/ (${COMMAND_COUNT} slash commands)
599
+ ${path.join(targetDir, 'skills')}/ (${skillCount} SKILL.md)
600
+
601
+ To run with Claude Code:
602
+
603
+ claude --plugin-dir ${targetDir}
604
+
605
+ ────────────────────────────────────────────────────────────
606
+ CLAUDE DESKTOP
607
+ ────────────────────────────────────────────────────────────
608
+
609
+ To build the Desktop extension:
610
+
611
+ super build-desktop --output dist
612
+
613
+ Then double-click dist/bi-superpowers.mcpb to install.
614
+
615
+ ────────────────────────────────────────────────────────────
616
+
617
+ Regenerate after edits: super recharge
618
+
619
+ ════════════════════════════════════════════════════════════
620
+ `);
621
+ }
622
+
623
+ /**
624
+ * Detect the package manager the user ran from the npm_config_user_agent.
625
+ * Returns the pm name ('npm', 'pnpm', 'yarn', 'bun') and the install command
626
+ * string appropriate for a global install to @latest.
627
+ *
628
+ * Exported (via module.exports) so tests can exercise the detection without
629
+ * spawning a real install.
630
+ */
631
+ function getUpgradeCommand(userAgent) {
632
+ const agent = userAgent || '';
633
+ let pm = 'npm';
634
+ if (agent.includes('pnpm')) pm = 'pnpm';
635
+ else if (agent.includes('yarn')) pm = 'yarn';
636
+ else if (agent.includes('bun')) pm = 'bun';
637
+
638
+ const cmd =
639
+ pm === 'yarn'
640
+ ? `yarn global add ${PACKAGE_NAME}@latest`
641
+ : `${pm} install -g ${PACKAGE_NAME}@latest`;
642
+
643
+ return { pm, cmd };
644
+ }
645
+
646
+ /**
647
+ * `super upgrade` — reinstall the package at the latest version.
648
+ *
649
+ * After the reinstall, prints a "next steps" block with the refresh paths
650
+ * for marketplace installs, user-profile installs, and project-local
651
+ * plugins generated by `super kickoff`, so users know how to propagate
652
+ * the new skills into their agents. We
653
+ * intentionally don't auto-chain into `super install`:
654
+ * - Claude Code users who installed via the plugin marketplace refresh
655
+ * from inside Claude Code (`/plugin update bi-superpowers`), they don't
656
+ * need `super install`.
657
+ * - npm users want to be able to opt out of re-propagation (e.g. testing
658
+ * a version before rolling it across all agents).
659
+ */
660
+ /**
661
+ * Wipe ~/.bi-superpowers/update-state.json after a successful upgrade so
662
+ * the new version starts with a clean cache (no stale snooze TTL, no
663
+ * cached "latest" from the previous version). Best-effort: any failure
664
+ * is swallowed — the reset is a convenience, not a correctness gate.
665
+ *
666
+ * Separate function + exported so tests can exercise it without spawning
667
+ * a real `super upgrade`.
668
+ */
669
+ function resetUpdateCheckStateAfterUpgrade(homeDir) {
670
+ try {
671
+ const { resetState } = require('./commands/update-check');
672
+ resetState(path.join(homeDir, '.bi-superpowers'));
673
+ return true;
674
+ } catch (_) {
675
+ return false;
676
+ }
677
+ }
678
+
679
+ function getUpgradeRefreshSteps() {
680
+ return [
681
+ {
682
+ label: 'Claude Code (installed via marketplace):',
683
+ command: '/plugin update bi-superpowers',
684
+ },
685
+ {
686
+ label: 'Skills installed in your user profile (npm + super install):',
687
+ command: 'super install --all --yes',
688
+ },
689
+ {
690
+ label:
691
+ 'Project-local Claude Code plugin (run inside each repo where you used super kickoff):',
692
+ command: 'super recharge',
693
+ },
694
+ ];
695
+ }
696
+
697
+ function updatePackage() {
698
+ console.log(`Updating ${PACKAGE_NAME}...\n`);
699
+
700
+ try {
701
+ const { cmd } = getUpgradeCommand(process.env.npm_config_user_agent);
702
+ console.log(`Running: ${cmd}\n`);
703
+ execSync(cmd, { stdio: 'inherit' });
704
+ console.log('\n✓ CLI upgraded.');
705
+
706
+ // Clear the update-check cache + snooze state so the newly-installed
707
+ // version gets a fresh read on next skill invocation.
708
+ resetUpdateCheckStateAfterUpgrade(require('os').homedir());
709
+
710
+ console.log('\nNext step — refresh the skills + MCPs in your agents:\n');
711
+ for (const step of getUpgradeRefreshSteps()) {
712
+ console.log(` ${step.label}`);
713
+ console.log(` ${step.command}`);
714
+ console.log('');
715
+ }
716
+ console.log(
717
+ 'If you only wanted the CLI updated (e.g. developing locally), you can skip the above.'
718
+ );
719
+ } catch (error) {
720
+ console.error('Update failed:', error.message);
721
+ console.log(`\nTry manually: npm install -g ${PACKAGE_NAME}@latest`);
722
+ process.exit(1);
723
+ }
724
+ }
725
+
726
+ /**
727
+ * `super powers` — list the available skills (and their titles).
728
+ */
729
+ function listAgents() {
730
+ const skills = getSkillFiles();
731
+
732
+ console.log(`
733
+ BI Agent Superpowers — Skills
734
+ =============================
735
+ Single Source of Truth: ${skills.length} skills (open source)
736
+ `);
737
+
738
+ console.log('Skills:');
739
+ for (const skill of skills) {
740
+ const meta = parseSkillMetadata(skill.content);
741
+ console.log(` /${skill.name.padEnd(20)} ${meta.title || ''}`);
742
+ }
743
+ console.log('');
744
+
745
+ console.log('Supported AI tools:');
746
+ Object.entries(AI_TOOLS).forEach(([, cfg]) => {
747
+ console.log(` • ${cfg.name}`);
748
+ });
749
+ console.log('');
750
+
751
+ console.log("Run 'super recharge' to regenerate configs after editing skills.");
752
+ }
753
+
754
+ // ============================================
755
+ // COMMAND WRAPPERS
756
+ // ============================================
757
+
758
+ /**
759
+ * Shared config object passed into every command module.
760
+ */
761
+ function getCommandConfig() {
762
+ return {
763
+ skillsDir: SKILLS_DIR,
764
+ packageDir: PACKAGE_DIR,
765
+ version: VERSION,
766
+ };
767
+ }
768
+
769
+ /**
770
+ * Factory that wraps a command module with a consistent "missing module"
771
+ * error so every non-core command fails the same way during `npm install`.
772
+ */
773
+ function createCommandWrapper(commandModule, commandName) {
774
+ return (args) => {
775
+ if (!commandModule) {
776
+ console.error(`${commandName} command not available. Try reinstalling the package.`);
777
+ process.exit(1);
778
+ }
779
+ commandModule(args, getCommandConfig());
780
+ };
781
+ }
782
+
783
+ // Wrapper instances — created after createCommandWrapper is defined.
784
+ const runLint = createCommandWrapper(lintCommand, 'Lint');
785
+ const runDiff = createCommandWrapper(diffCommand, 'Diff');
786
+ const runMcpSetup = createCommandWrapper(mcpSetupCommand, 'MCP setup');
787
+ const runBuildDesktop = createCommandWrapper(buildDesktopCommand, 'Build Desktop');
788
+ const runInstall = createCommandWrapper(installCommand, 'Install');
789
+ const runUninstall = createCommandWrapper(uninstallCommand, 'Uninstall');
790
+ const runAutoupdate = createCommandWrapper(autoupdateCommand, 'Autoupdate');
791
+ const runValidateCases = createCommandWrapper(validateCasesCommand, 'Validate cases');
792
+ const runValidateProjects = createCommandWrapper(validateProjectsCommand, 'Validate projects');
793
+ const runSmokeTest = createCommandWrapper(smokeTestCommand, 'Smoke test');
794
+ const runCreateFromTemplate = createCommandWrapper(
795
+ createFromTemplateCommand,
796
+ 'Create from template'
797
+ );
798
+
799
+ // Register wrapper-based commands into the command map (phase 2).
800
+ commands.install = runInstall;
801
+ commands.uninstall = runUninstall;
802
+ commands.autoupdate = runAutoupdate;
803
+ commands.checkup = runLint;
804
+ commands.scan = runDiff;
805
+ commands.sentinel = runWatch;
806
+ commands['mcp-setup'] = runMcpSetup;
807
+ commands.mcp = runMcpSetup;
808
+ commands['build-desktop'] = runBuildDesktop;
809
+ commands['smoke-test'] = runSmokeTest;
810
+ commands['validate-cases'] = runValidateCases;
811
+ commands['validate-projects'] = runValidateProjects;
812
+ commands['create-from-template'] = runCreateFromTemplate;
813
+ commands.lint = runLint;
814
+ commands.diff = runDiff;
815
+ commands.watch = runWatch;
816
+
817
+ /**
818
+ * `super sentinel` — watch skill sources and auto-regenerate the plugin.
819
+ * Needs extra context (a reference to the sync function) so it has its
820
+ * own wrapper instead of using createCommandWrapper.
821
+ */
822
+ function runWatch(args) {
823
+ if (!watchCommand) {
824
+ console.error('Watch command not available. Try reinstalling the package.');
825
+ process.exit(1);
826
+ }
827
+
828
+ watchCommand(args, getCommandConfig(), createWatchCliModule());
829
+ }
830
+
831
+ /**
832
+ * Build the tiny adapter used by `super sentinel`.
833
+ * It intentionally delegates through generateForTool(), the same path as
834
+ * kickoff/recharge, so regenerated plugin files keep the real package version,
835
+ * library prefix, and MCP launcher mode.
836
+ *
837
+ * @param {Object} [deps] - Test seams
838
+ * @param {Function} [deps.getSkillFilesFn] - Skill loader
839
+ * @param {Function} [deps.generateForToolFn] - Tool generator
840
+ * @returns {{syncProjectInternal: Function}} Watch command adapter
841
+ */
842
+ function createWatchCliModule(deps = {}) {
843
+ const getSkillFilesFn = deps.getSkillFilesFn || getSkillFiles;
844
+ const generateForToolFn = deps.generateForToolFn || generateForTool;
845
+
846
+ return {
847
+ syncProjectInternal: async (targetDir, tools) => {
848
+ const skills = getSkillFilesFn();
849
+ for (const tool of tools) {
850
+ await generateForToolFn(tool, targetDir, skills);
851
+ }
852
+ },
853
+ };
854
+ }
855
+
856
+ /**
857
+ * Check if --dry-run (or -n) is present in the argument list.
858
+ */
859
+ function hasDryRunFlag(args) {
860
+ return args.includes('--dry-run') || args.includes('-n');
861
+ }
862
+
863
+ /**
864
+ * Strip the --dry-run / -n flag from the argument list.
865
+ */
866
+ function removeDryRunFlag(args) {
867
+ return args.filter((a) => a !== '--dry-run' && a !== '-n');
868
+ }
869
+
870
+ // ============================================
871
+ // EXPORT FOR INTERNAL USE
872
+ // ============================================
873
+
874
+ module.exports = {
875
+ getSkillFiles,
876
+ loadToolConfig,
877
+ saveToolConfig,
878
+ getUpgradeCommand,
879
+ getUpgradeRefreshSteps,
880
+ resetUpdateCheckStateAfterUpgrade,
881
+ createWatchCliModule,
882
+ getGenerationOptions,
883
+ AI_TOOLS,
884
+ SKILLS_DIR,
885
+ VERSION,
886
+ };
887
+
888
+ // Only run main() when invoked as the binary (not when required from tests).
889
+ if (require.main === module) {
890
+ main();
891
+ }