superpowers-spec 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 (301) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +141 -0
  3. package/agents/code-reviewer.md +48 -0
  4. package/bin/openspec.js +3 -0
  5. package/bin/superpowers.js +3 -0
  6. package/dist/cli/index.d.ts +2 -0
  7. package/dist/cli/index.js +482 -0
  8. package/dist/commands/change.d.ts +35 -0
  9. package/dist/commands/change.js +277 -0
  10. package/dist/commands/completion.d.ts +72 -0
  11. package/dist/commands/completion.js +257 -0
  12. package/dist/commands/config.d.ts +36 -0
  13. package/dist/commands/config.js +552 -0
  14. package/dist/commands/feedback.d.ts +9 -0
  15. package/dist/commands/feedback.js +183 -0
  16. package/dist/commands/schema.d.ts +6 -0
  17. package/dist/commands/schema.js +869 -0
  18. package/dist/commands/show.d.ts +14 -0
  19. package/dist/commands/show.js +132 -0
  20. package/dist/commands/spec.d.ts +15 -0
  21. package/dist/commands/spec.js +225 -0
  22. package/dist/commands/validate.d.ts +24 -0
  23. package/dist/commands/validate.js +294 -0
  24. package/dist/commands/workflow/index.d.ts +17 -0
  25. package/dist/commands/workflow/index.js +12 -0
  26. package/dist/commands/workflow/instructions.d.ts +29 -0
  27. package/dist/commands/workflow/instructions.js +381 -0
  28. package/dist/commands/workflow/new-change.d.ts +11 -0
  29. package/dist/commands/workflow/new-change.js +44 -0
  30. package/dist/commands/workflow/schemas.d.ts +10 -0
  31. package/dist/commands/workflow/schemas.js +34 -0
  32. package/dist/commands/workflow/shared.d.ts +57 -0
  33. package/dist/commands/workflow/shared.js +116 -0
  34. package/dist/commands/workflow/status.d.ts +14 -0
  35. package/dist/commands/workflow/status.js +75 -0
  36. package/dist/commands/workflow/templates.d.ts +16 -0
  37. package/dist/commands/workflow/templates.js +68 -0
  38. package/dist/core/archive.d.ts +11 -0
  39. package/dist/core/archive.js +318 -0
  40. package/dist/core/artifact-graph/graph.d.ts +56 -0
  41. package/dist/core/artifact-graph/graph.js +141 -0
  42. package/dist/core/artifact-graph/index.d.ts +7 -0
  43. package/dist/core/artifact-graph/index.js +13 -0
  44. package/dist/core/artifact-graph/instruction-loader.d.ts +143 -0
  45. package/dist/core/artifact-graph/instruction-loader.js +214 -0
  46. package/dist/core/artifact-graph/resolver.d.ts +81 -0
  47. package/dist/core/artifact-graph/resolver.js +257 -0
  48. package/dist/core/artifact-graph/schema.d.ts +13 -0
  49. package/dist/core/artifact-graph/schema.js +108 -0
  50. package/dist/core/artifact-graph/state.d.ts +12 -0
  51. package/dist/core/artifact-graph/state.js +54 -0
  52. package/dist/core/artifact-graph/types.d.ts +45 -0
  53. package/dist/core/artifact-graph/types.js +43 -0
  54. package/dist/core/available-tools.d.ts +16 -0
  55. package/dist/core/available-tools.js +30 -0
  56. package/dist/core/command-generation/adapters/amazon-q.d.ts +13 -0
  57. package/dist/core/command-generation/adapters/amazon-q.js +26 -0
  58. package/dist/core/command-generation/adapters/antigravity.d.ts +13 -0
  59. package/dist/core/command-generation/adapters/antigravity.js +26 -0
  60. package/dist/core/command-generation/adapters/auggie.d.ts +13 -0
  61. package/dist/core/command-generation/adapters/auggie.js +27 -0
  62. package/dist/core/command-generation/adapters/claude.d.ts +13 -0
  63. package/dist/core/command-generation/adapters/claude.js +50 -0
  64. package/dist/core/command-generation/adapters/cline.d.ts +14 -0
  65. package/dist/core/command-generation/adapters/cline.js +27 -0
  66. package/dist/core/command-generation/adapters/codebuddy.d.ts +13 -0
  67. package/dist/core/command-generation/adapters/codebuddy.js +28 -0
  68. package/dist/core/command-generation/adapters/codex.d.ts +16 -0
  69. package/dist/core/command-generation/adapters/codex.js +39 -0
  70. package/dist/core/command-generation/adapters/continue.d.ts +13 -0
  71. package/dist/core/command-generation/adapters/continue.js +28 -0
  72. package/dist/core/command-generation/adapters/costrict.d.ts +13 -0
  73. package/dist/core/command-generation/adapters/costrict.js +27 -0
  74. package/dist/core/command-generation/adapters/crush.d.ts +13 -0
  75. package/dist/core/command-generation/adapters/crush.js +30 -0
  76. package/dist/core/command-generation/adapters/cursor.d.ts +14 -0
  77. package/dist/core/command-generation/adapters/cursor.js +44 -0
  78. package/dist/core/command-generation/adapters/factory.d.ts +13 -0
  79. package/dist/core/command-generation/adapters/factory.js +27 -0
  80. package/dist/core/command-generation/adapters/gemini.d.ts +13 -0
  81. package/dist/core/command-generation/adapters/gemini.js +26 -0
  82. package/dist/core/command-generation/adapters/github-copilot.d.ts +13 -0
  83. package/dist/core/command-generation/adapters/github-copilot.js +26 -0
  84. package/dist/core/command-generation/adapters/iflow.d.ts +13 -0
  85. package/dist/core/command-generation/adapters/iflow.js +29 -0
  86. package/dist/core/command-generation/adapters/index.d.ts +29 -0
  87. package/dist/core/command-generation/adapters/index.js +29 -0
  88. package/dist/core/command-generation/adapters/kilocode.d.ts +14 -0
  89. package/dist/core/command-generation/adapters/kilocode.js +23 -0
  90. package/dist/core/command-generation/adapters/kiro.d.ts +13 -0
  91. package/dist/core/command-generation/adapters/kiro.js +26 -0
  92. package/dist/core/command-generation/adapters/opencode.d.ts +13 -0
  93. package/dist/core/command-generation/adapters/opencode.js +29 -0
  94. package/dist/core/command-generation/adapters/pi.d.ts +14 -0
  95. package/dist/core/command-generation/adapters/pi.js +41 -0
  96. package/dist/core/command-generation/adapters/qoder.d.ts +13 -0
  97. package/dist/core/command-generation/adapters/qoder.js +30 -0
  98. package/dist/core/command-generation/adapters/qwen.d.ts +13 -0
  99. package/dist/core/command-generation/adapters/qwen.js +26 -0
  100. package/dist/core/command-generation/adapters/roocode.d.ts +14 -0
  101. package/dist/core/command-generation/adapters/roocode.js +27 -0
  102. package/dist/core/command-generation/adapters/windsurf.d.ts +14 -0
  103. package/dist/core/command-generation/adapters/windsurf.js +51 -0
  104. package/dist/core/command-generation/generator.d.ts +21 -0
  105. package/dist/core/command-generation/generator.js +27 -0
  106. package/dist/core/command-generation/index.d.ts +22 -0
  107. package/dist/core/command-generation/index.js +24 -0
  108. package/dist/core/command-generation/registry.d.ts +36 -0
  109. package/dist/core/command-generation/registry.js +92 -0
  110. package/dist/core/command-generation/types.d.ts +56 -0
  111. package/dist/core/command-generation/types.js +8 -0
  112. package/dist/core/completions/command-registry.d.ts +7 -0
  113. package/dist/core/completions/command-registry.js +461 -0
  114. package/dist/core/completions/completion-provider.d.ts +60 -0
  115. package/dist/core/completions/completion-provider.js +102 -0
  116. package/dist/core/completions/factory.d.ts +64 -0
  117. package/dist/core/completions/factory.js +75 -0
  118. package/dist/core/completions/generators/bash-generator.d.ts +32 -0
  119. package/dist/core/completions/generators/bash-generator.js +174 -0
  120. package/dist/core/completions/generators/fish-generator.d.ts +32 -0
  121. package/dist/core/completions/generators/fish-generator.js +157 -0
  122. package/dist/core/completions/generators/powershell-generator.d.ts +33 -0
  123. package/dist/core/completions/generators/powershell-generator.js +207 -0
  124. package/dist/core/completions/generators/zsh-generator.d.ts +44 -0
  125. package/dist/core/completions/generators/zsh-generator.js +250 -0
  126. package/dist/core/completions/installers/bash-installer.d.ts +87 -0
  127. package/dist/core/completions/installers/bash-installer.js +318 -0
  128. package/dist/core/completions/installers/fish-installer.d.ts +43 -0
  129. package/dist/core/completions/installers/fish-installer.js +143 -0
  130. package/dist/core/completions/installers/powershell-installer.d.ts +88 -0
  131. package/dist/core/completions/installers/powershell-installer.js +327 -0
  132. package/dist/core/completions/installers/zsh-installer.d.ts +125 -0
  133. package/dist/core/completions/installers/zsh-installer.js +449 -0
  134. package/dist/core/completions/templates/bash-templates.d.ts +6 -0
  135. package/dist/core/completions/templates/bash-templates.js +24 -0
  136. package/dist/core/completions/templates/fish-templates.d.ts +7 -0
  137. package/dist/core/completions/templates/fish-templates.js +39 -0
  138. package/dist/core/completions/templates/powershell-templates.d.ts +6 -0
  139. package/dist/core/completions/templates/powershell-templates.js +25 -0
  140. package/dist/core/completions/templates/zsh-templates.d.ts +6 -0
  141. package/dist/core/completions/templates/zsh-templates.js +36 -0
  142. package/dist/core/completions/types.d.ts +79 -0
  143. package/dist/core/completions/types.js +2 -0
  144. package/dist/core/config-prompts.d.ts +9 -0
  145. package/dist/core/config-prompts.js +34 -0
  146. package/dist/core/config-schema.d.ts +86 -0
  147. package/dist/core/config-schema.js +213 -0
  148. package/dist/core/config.d.ts +17 -0
  149. package/dist/core/config.js +33 -0
  150. package/dist/core/converters/json-converter.d.ts +6 -0
  151. package/dist/core/converters/json-converter.js +51 -0
  152. package/dist/core/global-config.d.ts +44 -0
  153. package/dist/core/global-config.js +125 -0
  154. package/dist/core/index.d.ts +2 -0
  155. package/dist/core/index.js +3 -0
  156. package/dist/core/init.d.ts +39 -0
  157. package/dist/core/init.js +634 -0
  158. package/dist/core/legacy-cleanup.d.ts +162 -0
  159. package/dist/core/legacy-cleanup.js +512 -0
  160. package/dist/core/list.d.ts +9 -0
  161. package/dist/core/list.js +171 -0
  162. package/dist/core/migration.d.ts +23 -0
  163. package/dist/core/migration.js +108 -0
  164. package/dist/core/parsers/change-parser.d.ts +13 -0
  165. package/dist/core/parsers/change-parser.js +193 -0
  166. package/dist/core/parsers/markdown-parser.d.ts +22 -0
  167. package/dist/core/parsers/markdown-parser.js +187 -0
  168. package/dist/core/parsers/requirement-blocks.d.ts +37 -0
  169. package/dist/core/parsers/requirement-blocks.js +201 -0
  170. package/dist/core/profile-sync-drift.d.ts +38 -0
  171. package/dist/core/profile-sync-drift.js +200 -0
  172. package/dist/core/profiles.d.ts +26 -0
  173. package/dist/core/profiles.js +40 -0
  174. package/dist/core/project-config.d.ts +64 -0
  175. package/dist/core/project-config.js +223 -0
  176. package/dist/core/schemas/base.schema.d.ts +13 -0
  177. package/dist/core/schemas/base.schema.js +13 -0
  178. package/dist/core/schemas/change.schema.d.ts +73 -0
  179. package/dist/core/schemas/change.schema.js +31 -0
  180. package/dist/core/schemas/index.d.ts +4 -0
  181. package/dist/core/schemas/index.js +4 -0
  182. package/dist/core/schemas/spec.schema.d.ts +18 -0
  183. package/dist/core/schemas/spec.schema.js +15 -0
  184. package/dist/core/shared/index.d.ts +8 -0
  185. package/dist/core/shared/index.js +8 -0
  186. package/dist/core/shared/skill-generation.d.ts +49 -0
  187. package/dist/core/shared/skill-generation.js +96 -0
  188. package/dist/core/shared/tool-detection.d.ts +71 -0
  189. package/dist/core/shared/tool-detection.js +158 -0
  190. package/dist/core/specs-apply.d.ts +73 -0
  191. package/dist/core/specs-apply.js +384 -0
  192. package/dist/core/styles/palette.d.ts +7 -0
  193. package/dist/core/styles/palette.js +8 -0
  194. package/dist/core/templates/index.d.ts +8 -0
  195. package/dist/core/templates/index.js +9 -0
  196. package/dist/core/templates/skill-templates.d.ts +19 -0
  197. package/dist/core/templates/skill-templates.js +18 -0
  198. package/dist/core/templates/types.d.ts +19 -0
  199. package/dist/core/templates/types.js +5 -0
  200. package/dist/core/templates/workflows/apply-change.d.ts +10 -0
  201. package/dist/core/templates/workflows/apply-change.js +313 -0
  202. package/dist/core/templates/workflows/archive-change.d.ts +10 -0
  203. package/dist/core/templates/workflows/archive-change.js +271 -0
  204. package/dist/core/templates/workflows/bulk-archive-change.d.ts +10 -0
  205. package/dist/core/templates/workflows/bulk-archive-change.js +488 -0
  206. package/dist/core/templates/workflows/continue-change.d.ts +10 -0
  207. package/dist/core/templates/workflows/continue-change.js +232 -0
  208. package/dist/core/templates/workflows/explore.d.ts +10 -0
  209. package/dist/core/templates/workflows/explore.js +469 -0
  210. package/dist/core/templates/workflows/feedback.d.ts +9 -0
  211. package/dist/core/templates/workflows/feedback.js +108 -0
  212. package/dist/core/templates/workflows/ff-change.d.ts +10 -0
  213. package/dist/core/templates/workflows/ff-change.js +198 -0
  214. package/dist/core/templates/workflows/new-change.d.ts +10 -0
  215. package/dist/core/templates/workflows/new-change.js +143 -0
  216. package/dist/core/templates/workflows/onboard.d.ts +10 -0
  217. package/dist/core/templates/workflows/onboard.js +565 -0
  218. package/dist/core/templates/workflows/propose.d.ts +10 -0
  219. package/dist/core/templates/workflows/propose.js +223 -0
  220. package/dist/core/templates/workflows/sync-specs.d.ts +10 -0
  221. package/dist/core/templates/workflows/sync-specs.js +272 -0
  222. package/dist/core/templates/workflows/verify-change.d.ts +10 -0
  223. package/dist/core/templates/workflows/verify-change.js +332 -0
  224. package/dist/core/update.d.ts +77 -0
  225. package/dist/core/update.js +537 -0
  226. package/dist/core/validation/constants.d.ts +34 -0
  227. package/dist/core/validation/constants.js +40 -0
  228. package/dist/core/validation/types.d.ts +18 -0
  229. package/dist/core/validation/types.js +2 -0
  230. package/dist/core/validation/validator.d.ts +33 -0
  231. package/dist/core/validation/validator.js +409 -0
  232. package/dist/core/view.d.ts +8 -0
  233. package/dist/core/view.js +168 -0
  234. package/dist/index.d.ts +3 -0
  235. package/dist/index.js +3 -0
  236. package/dist/prompts/searchable-multi-select.d.ts +28 -0
  237. package/dist/prompts/searchable-multi-select.js +159 -0
  238. package/dist/telemetry/config.d.ts +32 -0
  239. package/dist/telemetry/config.js +68 -0
  240. package/dist/telemetry/index.d.ts +31 -0
  241. package/dist/telemetry/index.js +180 -0
  242. package/dist/ui/ascii-patterns.d.ts +16 -0
  243. package/dist/ui/ascii-patterns.js +133 -0
  244. package/dist/ui/welcome-screen.d.ts +10 -0
  245. package/dist/ui/welcome-screen.js +146 -0
  246. package/dist/utils/change-metadata.d.ts +51 -0
  247. package/dist/utils/change-metadata.js +147 -0
  248. package/dist/utils/change-utils.d.ts +62 -0
  249. package/dist/utils/change-utils.js +121 -0
  250. package/dist/utils/command-references.d.ts +18 -0
  251. package/dist/utils/command-references.js +20 -0
  252. package/dist/utils/file-system.d.ts +36 -0
  253. package/dist/utils/file-system.js +281 -0
  254. package/dist/utils/index.d.ts +6 -0
  255. package/dist/utils/index.js +9 -0
  256. package/dist/utils/interactive.d.ts +18 -0
  257. package/dist/utils/interactive.js +21 -0
  258. package/dist/utils/item-discovery.d.ts +4 -0
  259. package/dist/utils/item-discovery.js +72 -0
  260. package/dist/utils/match.d.ts +3 -0
  261. package/dist/utils/match.js +22 -0
  262. package/dist/utils/shell-detection.d.ts +20 -0
  263. package/dist/utils/shell-detection.js +41 -0
  264. package/dist/utils/task-progress.d.ts +8 -0
  265. package/dist/utils/task-progress.js +36 -0
  266. package/extension-manifest.json +9 -0
  267. package/hooks/hooks.json +16 -0
  268. package/hooks/run-hook.cmd +46 -0
  269. package/hooks/session-start +51 -0
  270. package/package.json +87 -0
  271. package/schemas/spec-driven/schema.yaml +153 -0
  272. package/schemas/spec-driven/templates/design.md +19 -0
  273. package/schemas/spec-driven/templates/proposal.md +23 -0
  274. package/schemas/spec-driven/templates/spec.md +8 -0
  275. package/schemas/spec-driven/templates/tasks.md +9 -0
  276. package/scripts/postinstall.js +147 -0
  277. package/skills/dispatching-parallel-agents/SKILL.md +113 -0
  278. package/skills/finishing-a-development-branch/SKILL.md +200 -0
  279. package/skills/receiving-code-review/SKILL.md +213 -0
  280. package/skills/requesting-code-review/SKILL.md +73 -0
  281. package/skills/requesting-code-review/code-reviewer.md +146 -0
  282. package/skills/subagent-driven-development/SKILL.md +98 -0
  283. package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
  284. package/skills/subagent-driven-development/implementer-prompt.md +78 -0
  285. package/skills/systematic-debugging/CREATION-LOG.md +119 -0
  286. package/skills/systematic-debugging/SKILL.md +296 -0
  287. package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  288. package/skills/systematic-debugging/condition-based-waiting.md +115 -0
  289. package/skills/systematic-debugging/defense-in-depth.md +122 -0
  290. package/skills/systematic-debugging/find-polluter.sh +63 -0
  291. package/skills/systematic-debugging/root-cause-tracing.md +169 -0
  292. package/skills/systematic-debugging/test-academic.md +14 -0
  293. package/skills/systematic-debugging/test-pressure-1.md +58 -0
  294. package/skills/systematic-debugging/test-pressure-2.md +68 -0
  295. package/skills/systematic-debugging/test-pressure-3.md +69 -0
  296. package/skills/test-driven-development/SKILL.md +356 -0
  297. package/skills/test-driven-development/testing-anti-patterns.md +299 -0
  298. package/skills/using-git-worktrees/SKILL.md +212 -0
  299. package/skills/using-superpowers/SKILL.md +95 -0
  300. package/skills/verification-before-completion/SKILL.md +126 -0
  301. package/skills/writing-skills/SKILL.md +148 -0
@@ -0,0 +1,634 @@
1
+ /**
2
+ * Init Command
3
+ *
4
+ * Sets up Superpowers with Agent Skills and /sp:* slash commands.
5
+ * This is the unified setup command that replaces both the old init and experimental commands.
6
+ */
7
+ import path from 'path';
8
+ import { fileURLToPath } from 'url';
9
+ import chalk from 'chalk';
10
+ import ora from 'ora';
11
+ import * as fs from 'fs';
12
+ import { createRequire } from 'module';
13
+ import { FileSystemUtils } from '../utils/file-system.js';
14
+ import { transformToHyphenCommands } from '../utils/command-references.js';
15
+ import { AI_TOOLS, SUPERPOWERS_DIR_NAME, } from './config.js';
16
+ import { PALETTE } from './styles/palette.js';
17
+ import { isInteractive } from '../utils/interactive.js';
18
+ import { serializeConfig } from './config-prompts.js';
19
+ import { generateCommands, CommandAdapterRegistry, } from './command-generation/index.js';
20
+ import { detectLegacyArtifacts, cleanupLegacyArtifacts, formatCleanupSummary, formatDetectionSummary, } from './legacy-cleanup.js';
21
+ import { getToolsWithSkillsDir, getToolStates, getSkillTemplates, getCommandContents, generateSkillContent, } from './shared/index.js';
22
+ import { getGlobalConfig } from './global-config.js';
23
+ import { getProfileWorkflows, ALL_WORKFLOWS } from './profiles.js';
24
+ import { getAvailableTools } from './available-tools.js';
25
+ import { migrateIfNeeded } from './migration.js';
26
+ const require = createRequire(import.meta.url);
27
+ const { version: SUPERPOWERS_VERSION } = require('../../package.json');
28
+ // -----------------------------------------------------------------------------
29
+ // Constants
30
+ // -----------------------------------------------------------------------------
31
+ const DEFAULT_SCHEMA = 'spec-driven';
32
+ const PROGRESS_SPINNER = {
33
+ interval: 80,
34
+ frames: ['░░░', '▒░░', '▒▒░', '▒▒▒', '▓▒▒', '▓▓▒', '▓▓▓', '▒▓▓', '░▒▓'],
35
+ };
36
+ const WORKFLOW_TO_SKILL_DIR = {
37
+ 'explore': 'superpowers-explore',
38
+ 'new': 'superpowers-new-change',
39
+ 'continue': 'superpowers-continue-change',
40
+ 'apply': 'superpowers-apply-change',
41
+ 'ff': 'superpowers-ff-change',
42
+ 'sync': 'superpowers-sync-specs',
43
+ 'archive': 'superpowers-archive-change',
44
+ 'bulk-archive': 'superpowers-bulk-archive-change',
45
+ 'verify': 'superpowers-verify-change',
46
+ 'onboard': 'superpowers-onboard',
47
+ 'propose': 'superpowers-propose',
48
+ };
49
+ // -----------------------------------------------------------------------------
50
+ // Init Command Class
51
+ // -----------------------------------------------------------------------------
52
+ export class InitCommand {
53
+ toolsArg;
54
+ force;
55
+ interactiveOption;
56
+ profileOverride;
57
+ constructor(options = {}) {
58
+ this.toolsArg = options.tools;
59
+ this.force = options.force ?? false;
60
+ this.interactiveOption = options.interactive;
61
+ this.profileOverride = options.profile;
62
+ }
63
+ async execute(targetPath) {
64
+ const projectPath = path.resolve(targetPath);
65
+ const superpowersDir = SUPERPOWERS_DIR_NAME;
66
+ const superpowersPath = path.join(projectPath, superpowersDir);
67
+ // Validation happens silently in the background
68
+ const extendMode = await this.validate(projectPath, superpowersPath);
69
+ // Check for legacy artifacts and handle cleanup
70
+ await this.handleLegacyCleanup(projectPath, extendMode);
71
+ // Detect available tools in the project (task 7.1)
72
+ const detectedTools = getAvailableTools(projectPath);
73
+ // Migration check: migrate existing projects to profile system (task 7.3)
74
+ if (extendMode) {
75
+ migrateIfNeeded(projectPath, detectedTools);
76
+ }
77
+ // Show animated welcome screen (interactive mode only)
78
+ const canPrompt = this.canPromptInteractively();
79
+ if (canPrompt) {
80
+ const { showWelcomeScreen } = await import('../ui/welcome-screen.js');
81
+ await showWelcomeScreen();
82
+ }
83
+ // Validate profile override early so invalid values fail before tool setup.
84
+ // The resolved value is consumed later when generation reads effective config.
85
+ this.resolveProfileOverride();
86
+ // Get tool states before processing
87
+ const toolStates = getToolStates(projectPath);
88
+ // Get tool selection (pass detected tools for pre-selection)
89
+ const selectedToolIds = await this.getSelectedTools(toolStates, extendMode, detectedTools, projectPath);
90
+ // Validate selected tools
91
+ const validatedTools = this.validateTools(selectedToolIds, toolStates);
92
+ // Create directory structure and config
93
+ await this.createDirectoryStructure(superpowersPath, extendMode);
94
+ // Generate skills and commands for each tool
95
+ const results = await this.generateSkillsAndCommands(projectPath, validatedTools);
96
+ // Create config.yaml if needed
97
+ const configStatus = await this.createConfig(superpowersPath, extendMode);
98
+ // Display success message
99
+ this.displaySuccessMessage(projectPath, validatedTools, results, configStatus);
100
+ }
101
+ // ═══════════════════════════════════════════════════════════
102
+ // VALIDATION & SETUP
103
+ // ═══════════════════════════════════════════════════════════
104
+ async validate(projectPath, superpowersPath) {
105
+ const extendMode = await FileSystemUtils.directoryExists(superpowersPath);
106
+ // Check write permissions
107
+ if (!(await FileSystemUtils.ensureWritePermissions(projectPath))) {
108
+ throw new Error(`Insufficient permissions to write to ${projectPath}`);
109
+ }
110
+ return extendMode;
111
+ }
112
+ canPromptInteractively() {
113
+ if (this.interactiveOption === false)
114
+ return false;
115
+ if (this.toolsArg !== undefined)
116
+ return false;
117
+ return isInteractive({ interactive: this.interactiveOption });
118
+ }
119
+ resolveProfileOverride() {
120
+ if (this.profileOverride === undefined) {
121
+ return undefined;
122
+ }
123
+ if (this.profileOverride === 'core' || this.profileOverride === 'custom') {
124
+ return this.profileOverride;
125
+ }
126
+ throw new Error(`Invalid profile "${this.profileOverride}". Available profiles: core, custom`);
127
+ }
128
+ // ═══════════════════════════════════════════════════════════
129
+ // LEGACY CLEANUP
130
+ // ═══════════════════════════════════════════════════════════
131
+ async handleLegacyCleanup(projectPath, extendMode) {
132
+ // Detect legacy artifacts
133
+ const detection = await detectLegacyArtifacts(projectPath);
134
+ if (!detection.hasLegacyArtifacts) {
135
+ return; // No legacy artifacts found
136
+ }
137
+ // Show what was detected
138
+ console.log();
139
+ console.log(formatDetectionSummary(detection));
140
+ console.log();
141
+ const canPrompt = this.canPromptInteractively();
142
+ if (this.force || !canPrompt) {
143
+ // --force flag or non-interactive mode: proceed with cleanup automatically.
144
+ // Legacy slash commands are 100% Superpowers-managed, and config file cleanup
145
+ // only removes markers (never deletes files), so auto-cleanup is safe.
146
+ await this.performLegacyCleanup(projectPath, detection);
147
+ return;
148
+ }
149
+ // Interactive mode: prompt for confirmation
150
+ const { confirm } = await import('@inquirer/prompts');
151
+ const shouldCleanup = await confirm({
152
+ message: 'Upgrade and clean up legacy files?',
153
+ default: true,
154
+ });
155
+ if (!shouldCleanup) {
156
+ console.log(chalk.dim('Initialization cancelled.'));
157
+ console.log(chalk.dim('Run with --force to skip this prompt, or manually remove legacy files.'));
158
+ process.exit(0);
159
+ }
160
+ await this.performLegacyCleanup(projectPath, detection);
161
+ }
162
+ async performLegacyCleanup(projectPath, detection) {
163
+ const spinner = ora('Cleaning up legacy files...').start();
164
+ const result = await cleanupLegacyArtifacts(projectPath, detection);
165
+ spinner.succeed('Legacy files cleaned up');
166
+ const summary = formatCleanupSummary(result);
167
+ if (summary) {
168
+ console.log();
169
+ console.log(summary);
170
+ }
171
+ console.log();
172
+ }
173
+ // ═══════════════════════════════════════════════════════════
174
+ // TOOL SELECTION
175
+ // ═══════════════════════════════════════════════════════════
176
+ async getSelectedTools(toolStates, extendMode, detectedTools, projectPath) {
177
+ // Check for --tools flag first
178
+ const nonInteractiveSelection = this.resolveToolsArg();
179
+ if (nonInteractiveSelection !== null) {
180
+ return nonInteractiveSelection;
181
+ }
182
+ const validTools = getToolsWithSkillsDir();
183
+ const detectedToolIds = new Set(detectedTools.map((t) => t.value));
184
+ const configuredToolIds = new Set([...toolStates.entries()]
185
+ .filter(([, status]) => status.configured)
186
+ .map(([toolId]) => toolId));
187
+ const shouldPreselectDetected = !extendMode && configuredToolIds.size === 0;
188
+ const canPrompt = this.canPromptInteractively();
189
+ // Non-interactive mode: use detected tools as fallback (task 7.8)
190
+ if (!canPrompt) {
191
+ if (detectedToolIds.size > 0) {
192
+ return [...detectedToolIds];
193
+ }
194
+ throw new Error(`No tools detected and no --tools flag provided. Valid tools:\n ${validTools.join('\n ')}\n\nUse --tools all, --tools none, or --tools claude,cursor,...`);
195
+ }
196
+ if (validTools.length === 0) {
197
+ throw new Error(`No tools available for skill generation.`);
198
+ }
199
+ // Interactive mode: show searchable multi-select
200
+ const { searchableMultiSelect } = await import('../prompts/searchable-multi-select.js');
201
+ // Build choices: pre-select configured tools; keep detected tools visible but unselected.
202
+ const sortedChoices = validTools
203
+ .map((toolId) => {
204
+ const tool = AI_TOOLS.find((t) => t.value === toolId);
205
+ const status = toolStates.get(toolId);
206
+ const configured = status?.configured ?? false;
207
+ const detected = detectedToolIds.has(toolId);
208
+ return {
209
+ name: tool?.name || toolId,
210
+ value: toolId,
211
+ configured,
212
+ detected: detected && !configured,
213
+ preSelected: configured || (shouldPreselectDetected && detected && !configured),
214
+ };
215
+ })
216
+ .sort((a, b) => {
217
+ // Configured tools first, then detected (not configured), then everything else.
218
+ if (a.configured && !b.configured)
219
+ return -1;
220
+ if (!a.configured && b.configured)
221
+ return 1;
222
+ if (a.detected && !b.detected)
223
+ return -1;
224
+ if (!a.detected && b.detected)
225
+ return 1;
226
+ return 0;
227
+ });
228
+ const configuredNames = validTools
229
+ .filter((toolId) => configuredToolIds.has(toolId))
230
+ .map((toolId) => AI_TOOLS.find((t) => t.value === toolId)?.name || toolId);
231
+ if (configuredNames.length > 0) {
232
+ console.log(`Superpowers configured: ${configuredNames.join(', ')} (pre-selected)`);
233
+ }
234
+ const detectedOnlyNames = detectedTools
235
+ .filter((tool) => !configuredToolIds.has(tool.value))
236
+ .map((tool) => tool.name);
237
+ if (detectedOnlyNames.length > 0) {
238
+ const detectionLabel = shouldPreselectDetected
239
+ ? 'pre-selected for first-time setup'
240
+ : 'not pre-selected';
241
+ console.log(`Detected tool directories: ${detectedOnlyNames.join(', ')} (${detectionLabel})`);
242
+ }
243
+ const selectedTools = await searchableMultiSelect({
244
+ message: `Select tools to set up (${validTools.length} available)`,
245
+ pageSize: 15,
246
+ choices: sortedChoices,
247
+ validate: (selected) => selected.length > 0 || 'Select at least one tool',
248
+ });
249
+ if (selectedTools.length === 0) {
250
+ throw new Error('At least one tool must be selected');
251
+ }
252
+ return selectedTools;
253
+ }
254
+ resolveToolsArg() {
255
+ if (typeof this.toolsArg === 'undefined') {
256
+ return null;
257
+ }
258
+ const raw = this.toolsArg.trim();
259
+ if (raw.length === 0) {
260
+ throw new Error('The --tools option requires a value. Use "all", "none", or a comma-separated list of tool IDs.');
261
+ }
262
+ const availableTools = getToolsWithSkillsDir();
263
+ const availableSet = new Set(availableTools);
264
+ const availableList = ['all', 'none', ...availableTools].join(', ');
265
+ const lowerRaw = raw.toLowerCase();
266
+ if (lowerRaw === 'all') {
267
+ return availableTools;
268
+ }
269
+ if (lowerRaw === 'none') {
270
+ return [];
271
+ }
272
+ const tokens = raw
273
+ .split(',')
274
+ .map((token) => token.trim())
275
+ .filter((token) => token.length > 0);
276
+ if (tokens.length === 0) {
277
+ throw new Error('The --tools option requires at least one tool ID when not using "all" or "none".');
278
+ }
279
+ const normalizedTokens = tokens.map((token) => token.toLowerCase());
280
+ if (normalizedTokens.some((token) => token === 'all' || token === 'none')) {
281
+ throw new Error('Cannot combine reserved values "all" or "none" with specific tool IDs.');
282
+ }
283
+ const invalidTokens = tokens.filter((_token, index) => !availableSet.has(normalizedTokens[index]));
284
+ if (invalidTokens.length > 0) {
285
+ throw new Error(`Invalid tool(s): ${invalidTokens.join(', ')}. Available values: ${availableList}`);
286
+ }
287
+ // Deduplicate while preserving order
288
+ const deduped = [];
289
+ for (const token of normalizedTokens) {
290
+ if (!deduped.includes(token)) {
291
+ deduped.push(token);
292
+ }
293
+ }
294
+ return deduped;
295
+ }
296
+ validateTools(toolIds, toolStates) {
297
+ const validatedTools = [];
298
+ for (const toolId of toolIds) {
299
+ const tool = AI_TOOLS.find((t) => t.value === toolId);
300
+ if (!tool) {
301
+ const validToolIds = getToolsWithSkillsDir();
302
+ throw new Error(`Unknown tool '${toolId}'. Valid tools:\n ${validToolIds.join('\n ')}`);
303
+ }
304
+ if (!tool.skillsDir) {
305
+ const validToolsWithSkills = getToolsWithSkillsDir();
306
+ throw new Error(`Tool '${toolId}' does not support skill generation.\nTools with skill generation support:\n ${validToolsWithSkills.join('\n ')}`);
307
+ }
308
+ const preState = toolStates.get(tool.value);
309
+ validatedTools.push({
310
+ value: tool.value,
311
+ name: tool.name,
312
+ skillsDir: tool.skillsDir,
313
+ wasConfigured: preState?.configured ?? false,
314
+ });
315
+ }
316
+ return validatedTools;
317
+ }
318
+ // ═══════════════════════════════════════════════════════════
319
+ // DIRECTORY STRUCTURE
320
+ // ═══════════════════════════════════════════════════════════
321
+ async createDirectoryStructure(superpowersPath, extendMode) {
322
+ if (extendMode) {
323
+ // In extend mode, just ensure directories exist without spinner
324
+ const directories = [
325
+ superpowersPath,
326
+ path.join(superpowersPath, 'specs'),
327
+ path.join(superpowersPath, 'changes'),
328
+ path.join(superpowersPath, 'changes', 'archive'),
329
+ ];
330
+ for (const dir of directories) {
331
+ await FileSystemUtils.createDirectory(dir);
332
+ }
333
+ return;
334
+ }
335
+ const spinner = this.startSpinner('Creating Superpowers structure...');
336
+ const directories = [
337
+ superpowersPath,
338
+ path.join(superpowersPath, 'specs'),
339
+ path.join(superpowersPath, 'changes'),
340
+ path.join(superpowersPath, 'changes', 'archive'),
341
+ ];
342
+ for (const dir of directories) {
343
+ await FileSystemUtils.createDirectory(dir);
344
+ }
345
+ spinner.stopAndPersist({
346
+ symbol: PALETTE.white('▌'),
347
+ text: PALETTE.white('Superpowers structure created'),
348
+ });
349
+ }
350
+ // ═══════════════════════════════════════════════════════════
351
+ // SKILL & COMMAND GENERATION
352
+ // ═══════════════════════════════════════════════════════════
353
+ async generateSkillsAndCommands(projectPath, tools) {
354
+ const createdTools = [];
355
+ const refreshedTools = [];
356
+ const failedTools = [];
357
+ const commandsSkipped = [];
358
+ let removedCommandCount = 0;
359
+ let removedSkillCount = 0;
360
+ // Read global config for profile and delivery settings (use --profile override if set)
361
+ const globalConfig = getGlobalConfig();
362
+ const profile = this.resolveProfileOverride() ?? globalConfig.profile ?? 'core';
363
+ const delivery = globalConfig.delivery ?? 'both';
364
+ const workflows = getProfileWorkflows(profile, globalConfig.workflows);
365
+ // Get skill and command templates filtered by profile workflows
366
+ const shouldGenerateSkills = delivery !== 'commands';
367
+ const shouldGenerateCommands = delivery !== 'skills';
368
+ const skillTemplates = shouldGenerateSkills ? getSkillTemplates(workflows) : [];
369
+ const commandContents = shouldGenerateCommands ? getCommandContents(workflows) : [];
370
+ // Process each tool
371
+ for (const tool of tools) {
372
+ const spinner = ora(`Setting up ${tool.name}...`).start();
373
+ try {
374
+ // Generate skill files if delivery includes skills
375
+ if (shouldGenerateSkills) {
376
+ // Use tool-specific skillsDir
377
+ const skillsDir = path.join(projectPath, tool.skillsDir, 'skills');
378
+ // Create skill directories and SKILL.md files
379
+ for (const { template, dirName } of skillTemplates) {
380
+ const skillDir = path.join(skillsDir, dirName);
381
+ const skillFile = path.join(skillDir, 'SKILL.md');
382
+ // Generate SKILL.md content with YAML frontmatter including generatedBy
383
+ // Use hyphen-based command references for OpenCode
384
+ const transformer = tool.value === 'opencode' ? transformToHyphenCommands : undefined;
385
+ const skillContent = generateSkillContent(template, SUPERPOWERS_VERSION, transformer);
386
+ // Write the skill file
387
+ await FileSystemUtils.writeFile(skillFile, skillContent);
388
+ }
389
+ }
390
+ if (!shouldGenerateSkills) {
391
+ const skillsDir = path.join(projectPath, tool.skillsDir, 'skills');
392
+ removedSkillCount += await this.removeSkillDirs(skillsDir);
393
+ }
394
+ // Generate commands if delivery includes commands
395
+ if (shouldGenerateCommands) {
396
+ const adapter = CommandAdapterRegistry.get(tool.value);
397
+ if (adapter) {
398
+ const generatedCommands = generateCommands(commandContents, adapter);
399
+ for (const cmd of generatedCommands) {
400
+ const commandFile = path.isAbsolute(cmd.path) ? cmd.path : path.join(projectPath, cmd.path);
401
+ await FileSystemUtils.writeFile(commandFile, cmd.fileContent);
402
+ }
403
+ }
404
+ else {
405
+ commandsSkipped.push(tool.value);
406
+ }
407
+ }
408
+ if (!shouldGenerateCommands) {
409
+ removedCommandCount += await this.removeCommandFiles(projectPath, tool.value);
410
+ }
411
+ // Copy bundled static assets (skills, and hooks/agents for Claude)
412
+ await this.copyBundledAssets(projectPath, tool);
413
+ spinner.succeed(`Setup complete for ${tool.name}`);
414
+ if (tool.wasConfigured) {
415
+ refreshedTools.push(tool);
416
+ }
417
+ else {
418
+ createdTools.push(tool);
419
+ }
420
+ }
421
+ catch (error) {
422
+ spinner.fail(`Failed for ${tool.name}`);
423
+ failedTools.push({ name: tool.name, error: error });
424
+ }
425
+ }
426
+ return {
427
+ createdTools,
428
+ refreshedTools,
429
+ failedTools,
430
+ commandsSkipped,
431
+ removedCommandCount,
432
+ removedSkillCount,
433
+ };
434
+ }
435
+ // ═══════════════════════════════════════════════════════════
436
+ // CONFIG FILE
437
+ // ═══════════════════════════════════════════════════════════
438
+ async createConfig(superpowersPath, extendMode) {
439
+ const configPath = path.join(superpowersPath, 'config.yaml');
440
+ const configYmlPath = path.join(superpowersPath, 'config.yml');
441
+ const configYamlExists = fs.existsSync(configPath);
442
+ const configYmlExists = fs.existsSync(configYmlPath);
443
+ if (configYamlExists || configYmlExists) {
444
+ return 'exists';
445
+ }
446
+ // In non-interactive mode without --force, skip config creation
447
+ if (!this.canPromptInteractively() && !this.force) {
448
+ return 'skipped';
449
+ }
450
+ try {
451
+ const yamlContent = serializeConfig({ schema: DEFAULT_SCHEMA });
452
+ await FileSystemUtils.writeFile(configPath, yamlContent);
453
+ return 'created';
454
+ }
455
+ catch {
456
+ return 'skipped';
457
+ }
458
+ }
459
+ // ═══════════════════════════════════════════════════════════
460
+ // UI & OUTPUT
461
+ // ═══════════════════════════════════════════════════════════
462
+ displaySuccessMessage(projectPath, tools, results, configStatus) {
463
+ console.log();
464
+ console.log(chalk.bold('Superpowers Setup Complete'));
465
+ console.log();
466
+ // Show created vs refreshed tools
467
+ if (results.createdTools.length > 0) {
468
+ console.log(`Created: ${results.createdTools.map((t) => t.name).join(', ')}`);
469
+ }
470
+ if (results.refreshedTools.length > 0) {
471
+ console.log(`Refreshed: ${results.refreshedTools.map((t) => t.name).join(', ')}`);
472
+ }
473
+ // Show counts (respecting profile filter)
474
+ const successfulTools = [...results.createdTools, ...results.refreshedTools];
475
+ if (successfulTools.length > 0) {
476
+ const globalConfig = getGlobalConfig();
477
+ const profile = this.profileOverride ?? globalConfig.profile ?? 'core';
478
+ const delivery = globalConfig.delivery ?? 'both';
479
+ const workflows = getProfileWorkflows(profile, globalConfig.workflows);
480
+ const toolDirs = [...new Set(successfulTools.map((t) => t.skillsDir))].join(', ');
481
+ const skillCount = delivery !== 'commands' ? getSkillTemplates(workflows).length : 0;
482
+ const commandCount = delivery !== 'skills' ? getCommandContents(workflows).length : 0;
483
+ if (skillCount > 0 && commandCount > 0) {
484
+ console.log(`${skillCount} skills and ${commandCount} commands in ${toolDirs}/`);
485
+ }
486
+ else if (skillCount > 0) {
487
+ console.log(`${skillCount} skills in ${toolDirs}/`);
488
+ }
489
+ else if (commandCount > 0) {
490
+ console.log(`${commandCount} commands in ${toolDirs}/`);
491
+ }
492
+ }
493
+ // Show failures
494
+ if (results.failedTools.length > 0) {
495
+ console.log(chalk.red(`Failed: ${results.failedTools.map((f) => `${f.name} (${f.error.message})`).join(', ')}`));
496
+ }
497
+ // Show skipped commands
498
+ if (results.commandsSkipped.length > 0) {
499
+ console.log(chalk.dim(`Commands skipped for: ${results.commandsSkipped.join(', ')} (no adapter)`));
500
+ }
501
+ if (results.removedCommandCount > 0) {
502
+ console.log(chalk.dim(`Removed: ${results.removedCommandCount} command files (delivery: skills)`));
503
+ }
504
+ if (results.removedSkillCount > 0) {
505
+ console.log(chalk.dim(`Removed: ${results.removedSkillCount} skill directories (delivery: commands)`));
506
+ }
507
+ // Config status
508
+ if (configStatus === 'created') {
509
+ console.log(`Config: superpowers/config.yaml (schema: ${DEFAULT_SCHEMA})`);
510
+ }
511
+ else if (configStatus === 'exists') {
512
+ // Show actual filename (config.yaml or config.yml)
513
+ const configYaml = path.join(projectPath, SUPERPOWERS_DIR_NAME, 'config.yaml');
514
+ const configYml = path.join(projectPath, SUPERPOWERS_DIR_NAME, 'config.yml');
515
+ const configName = fs.existsSync(configYaml) ? 'config.yaml' : fs.existsSync(configYml) ? 'config.yml' : 'config.yaml';
516
+ console.log(`Config: superpowers/${configName} (exists)`);
517
+ }
518
+ else {
519
+ console.log(chalk.dim(`Config: skipped (non-interactive mode)`));
520
+ }
521
+ // Getting started (task 7.6: show propose if in profile)
522
+ const globalCfg = getGlobalConfig();
523
+ const activeProfile = this.profileOverride ?? globalCfg.profile ?? 'core';
524
+ const activeWorkflows = [...getProfileWorkflows(activeProfile, globalCfg.workflows)];
525
+ console.log();
526
+ if (activeWorkflows.includes('propose')) {
527
+ console.log(chalk.bold('Getting started:'));
528
+ console.log(' Start your first change: /sp:propose "your idea"');
529
+ }
530
+ else if (activeWorkflows.includes('new')) {
531
+ console.log(chalk.bold('Getting started:'));
532
+ console.log(' Start your first change: /sp:new "your idea"');
533
+ }
534
+ else {
535
+ console.log("Done. Run 'superpowers config profile' to configure your workflows.");
536
+ }
537
+ // Links
538
+ console.log();
539
+ console.log(`Learn more: ${chalk.cyan('https://github.com/momoshenchi/Superpowers-with-Spec')}`);
540
+ console.log(`Feedback: ${chalk.cyan('https://github.com/momoshenchi/Superpowers-with-Spec/issues')}`);
541
+ // Restart instruction if any tools were configured
542
+ if (results.createdTools.length > 0 || results.refreshedTools.length > 0) {
543
+ console.log();
544
+ console.log(chalk.white('Restart your IDE for slash commands to take effect.'));
545
+ }
546
+ console.log();
547
+ }
548
+ startSpinner(text) {
549
+ return ora({
550
+ text,
551
+ stream: process.stdout,
552
+ color: 'gray',
553
+ spinner: PROGRESS_SPINNER,
554
+ }).start();
555
+ }
556
+ async removeSkillDirs(skillsDir) {
557
+ let removed = 0;
558
+ for (const workflow of ALL_WORKFLOWS) {
559
+ const dirName = WORKFLOW_TO_SKILL_DIR[workflow];
560
+ if (!dirName)
561
+ continue;
562
+ const skillDir = path.join(skillsDir, dirName);
563
+ try {
564
+ if (fs.existsSync(skillDir)) {
565
+ await fs.promises.rm(skillDir, { recursive: true, force: true });
566
+ removed++;
567
+ }
568
+ }
569
+ catch {
570
+ // Ignore errors
571
+ }
572
+ }
573
+ return removed;
574
+ }
575
+ async copyBundledAssets(projectPath, tool) {
576
+ // Resolve package root from dist/core/init.js → dist/core → dist → package root
577
+ const pkgRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
578
+ // Copy bundled static skills
579
+ const bundledSkillsDir = path.join(pkgRoot, 'skills');
580
+ if (fs.existsSync(bundledSkillsDir)) {
581
+ const destSkillsDir = path.join(projectPath, tool.skillsDir, 'skills');
582
+ await this.copyDir(bundledSkillsDir, destSkillsDir);
583
+ }
584
+ // Copy hooks and agents for tools that support them (Claude Code and Codex)
585
+ if (tool.value === 'claude' || tool.value === 'codex') {
586
+ const toolRoot = path.join(projectPath, tool.skillsDir);
587
+ const bundledHooksDir = path.join(pkgRoot, 'hooks');
588
+ if (fs.existsSync(bundledHooksDir)) {
589
+ const destHooksDir = path.join(toolRoot, 'hooks');
590
+ await this.copyDir(bundledHooksDir, destHooksDir);
591
+ }
592
+ const bundledAgentsDir = path.join(pkgRoot, 'agents');
593
+ if (fs.existsSync(bundledAgentsDir)) {
594
+ const destAgentsDir = path.join(toolRoot, 'agents');
595
+ await this.copyDir(bundledAgentsDir, destAgentsDir);
596
+ }
597
+ }
598
+ }
599
+ async copyDir(src, dest) {
600
+ await fs.promises.mkdir(dest, { recursive: true });
601
+ const entries = await fs.promises.readdir(src, { withFileTypes: true });
602
+ for (const entry of entries) {
603
+ const srcPath = path.join(src, entry.name);
604
+ const destPath = path.join(dest, entry.name);
605
+ if (entry.isDirectory()) {
606
+ await this.copyDir(srcPath, destPath);
607
+ }
608
+ else {
609
+ await fs.promises.copyFile(srcPath, destPath);
610
+ }
611
+ }
612
+ }
613
+ async removeCommandFiles(projectPath, toolId) {
614
+ let removed = 0;
615
+ const adapter = CommandAdapterRegistry.get(toolId);
616
+ if (!adapter)
617
+ return 0;
618
+ for (const workflow of ALL_WORKFLOWS) {
619
+ const cmdPath = adapter.getFilePath(workflow);
620
+ const fullPath = path.isAbsolute(cmdPath) ? cmdPath : path.join(projectPath, cmdPath);
621
+ try {
622
+ if (fs.existsSync(fullPath)) {
623
+ await fs.promises.unlink(fullPath);
624
+ removed++;
625
+ }
626
+ }
627
+ catch {
628
+ // Ignore errors
629
+ }
630
+ }
631
+ return removed;
632
+ }
633
+ }
634
+ //# sourceMappingURL=init.js.map