agileflow 4.0.0-alpha.2 → 4.0.0-alpha.21

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 (372) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/content/plugins/accessibility/plugin.yaml +14 -0
  3. package/content/plugins/accessibility/skills/agileflow-accessibility/SKILL.md +392 -0
  4. package/content/plugins/accessibility/skills/agileflow-accessibility/references/aria-patterns.md +528 -0
  5. package/content/plugins/accessibility/skills/agileflow-accessibility/references/testing-checklist.md +457 -0
  6. package/content/plugins/accessibility/skills/agileflow-accessibility/references/wcag-guide.md +683 -0
  7. package/content/plugins/accessibility/skills/agileflow-accessibility/workflows/audit-page.md +310 -0
  8. package/content/plugins/accessibility/skills/agileflow-accessibility/workflows/implement-accessible-component.md +479 -0
  9. package/content/plugins/ads/agents/ads-audit-budget.md +185 -0
  10. package/content/plugins/ads/agents/ads-audit-compliance.md +171 -0
  11. package/content/plugins/ads/agents/ads-audit-creative.md +168 -0
  12. package/content/plugins/ads/agents/ads-audit-google.md +227 -0
  13. package/content/plugins/ads/agents/ads-audit-meta.md +184 -0
  14. package/content/plugins/ads/agents/ads-audit-tracking.md +205 -0
  15. package/content/plugins/ads/agents/ads-consensus.md +410 -0
  16. package/content/plugins/ads/agents/ads-generate.md +152 -0
  17. package/content/plugins/ads/agents/ads-performance-tracker.md +212 -0
  18. package/content/plugins/ads/plugin.yaml +23 -4
  19. package/content/plugins/ads/skills/agileflow-ads/SKILL.md +218 -0
  20. package/content/plugins/ads/skills/agileflow-ads/references/ad-copy-formula-guide.md +131 -0
  21. package/content/plugins/ads/skills/agileflow-ads/references/audience-targeting-guide.md +137 -0
  22. package/content/plugins/ads/skills/agileflow-ads/references/bid-strategy-guide.md +115 -0
  23. package/content/plugins/ads/skills/agileflow-ads/references/platform-benchmarks.md +100 -0
  24. package/content/plugins/ads/skills/agileflow-ads/workflows/audit.md +118 -0
  25. package/content/plugins/ads/skills/agileflow-ads/workflows/generate.md +84 -0
  26. package/content/plugins/audit/agents/a11y-analyzer-aria.md +173 -0
  27. package/content/plugins/audit/agents/a11y-analyzer-forms.md +173 -0
  28. package/content/plugins/audit/agents/a11y-analyzer-keyboard.md +183 -0
  29. package/content/plugins/audit/agents/a11y-analyzer-semantic.md +169 -0
  30. package/content/plugins/audit/agents/a11y-analyzer-visual.md +172 -0
  31. package/content/plugins/audit/agents/a11y-consensus.md +249 -0
  32. package/content/plugins/audit/agents/accessibility.md +558 -0
  33. package/content/plugins/audit/agents/api-quality-analyzer-conventions.md +156 -0
  34. package/content/plugins/audit/agents/api-quality-analyzer-docs.md +184 -0
  35. package/content/plugins/audit/agents/api-quality-analyzer-errors.md +191 -0
  36. package/content/plugins/audit/agents/api-quality-analyzer-pagination.md +179 -0
  37. package/content/plugins/audit/agents/api-quality-analyzer-versioning.md +150 -0
  38. package/content/plugins/audit/agents/api-quality-consensus.md +217 -0
  39. package/content/plugins/audit/agents/api-validator.md +191 -0
  40. package/content/plugins/audit/agents/arch-analyzer-circular.md +156 -0
  41. package/content/plugins/audit/agents/arch-analyzer-complexity.md +193 -0
  42. package/content/plugins/audit/agents/arch-analyzer-coupling.md +152 -0
  43. package/content/plugins/audit/agents/arch-analyzer-layering.md +160 -0
  44. package/content/plugins/audit/agents/arch-analyzer-patterns.md +210 -0
  45. package/content/plugins/audit/agents/arch-consensus.md +228 -0
  46. package/content/plugins/audit/agents/browser-qa.md +342 -0
  47. package/content/plugins/audit/agents/code-reviewer.md +298 -0
  48. package/content/plugins/audit/agents/completeness-analyzer-api.md +199 -0
  49. package/content/plugins/audit/agents/completeness-analyzer-conditional.md +211 -0
  50. package/content/plugins/audit/agents/completeness-analyzer-handlers.md +166 -0
  51. package/content/plugins/audit/agents/completeness-analyzer-imports.md +165 -0
  52. package/content/plugins/audit/agents/completeness-analyzer-routes.md +190 -0
  53. package/content/plugins/audit/agents/completeness-analyzer-state.md +196 -0
  54. package/content/plugins/audit/agents/completeness-analyzer-stubs.md +206 -0
  55. package/content/plugins/audit/agents/completeness-consensus.md +295 -0
  56. package/content/plugins/audit/agents/error-analyzer.md +213 -0
  57. package/content/plugins/audit/agents/flow-analyzer-authorization.md +182 -0
  58. package/content/plugins/audit/agents/flow-analyzer-discovery.md +174 -0
  59. package/content/plugins/audit/agents/flow-analyzer-errors.md +186 -0
  60. package/content/plugins/audit/agents/flow-analyzer-feedback.md +185 -0
  61. package/content/plugins/audit/agents/flow-analyzer-navigation.md +177 -0
  62. package/content/plugins/audit/agents/flow-analyzer-persistence.md +193 -0
  63. package/content/plugins/audit/agents/flow-analyzer-wiring.md +169 -0
  64. package/content/plugins/audit/agents/flow-consensus.md +237 -0
  65. package/content/plugins/audit/agents/legal-analyzer-a11y.md +114 -0
  66. package/content/plugins/audit/agents/legal-analyzer-ai.md +121 -0
  67. package/content/plugins/audit/agents/legal-analyzer-consumer.md +114 -0
  68. package/content/plugins/audit/agents/legal-analyzer-content.md +117 -0
  69. package/content/plugins/audit/agents/legal-analyzer-international.md +119 -0
  70. package/content/plugins/audit/agents/legal-analyzer-licensing.md +119 -0
  71. package/content/plugins/audit/agents/legal-analyzer-privacy.md +112 -0
  72. package/content/plugins/audit/agents/legal-analyzer-security.md +116 -0
  73. package/content/plugins/audit/agents/legal-analyzer-terms.md +115 -0
  74. package/content/plugins/audit/agents/legal-consensus.md +250 -0
  75. package/content/plugins/audit/agents/logic-analyzer-edge.md +179 -0
  76. package/content/plugins/audit/agents/logic-analyzer-flow.md +264 -0
  77. package/content/plugins/audit/agents/logic-analyzer-invariant.md +215 -0
  78. package/content/plugins/audit/agents/logic-analyzer-race.md +280 -0
  79. package/content/plugins/audit/agents/logic-analyzer-type.md +227 -0
  80. package/content/plugins/audit/agents/logic-consensus.md +259 -0
  81. package/content/plugins/audit/agents/perf-analyzer-assets.md +182 -0
  82. package/content/plugins/audit/agents/perf-analyzer-bundle.md +173 -0
  83. package/content/plugins/audit/agents/perf-analyzer-caching.md +170 -0
  84. package/content/plugins/audit/agents/perf-analyzer-compute.md +173 -0
  85. package/content/plugins/audit/agents/perf-analyzer-memory.md +193 -0
  86. package/content/plugins/audit/agents/perf-analyzer-network.md +165 -0
  87. package/content/plugins/audit/agents/perf-analyzer-queries.md +162 -0
  88. package/content/plugins/audit/agents/perf-analyzer-rendering.md +168 -0
  89. package/content/plugins/audit/agents/perf-consensus.md +287 -0
  90. package/content/plugins/audit/agents/qa.md +820 -0
  91. package/content/plugins/audit/agents/quality-analyzer-comments.md +159 -0
  92. package/content/plugins/audit/agents/quality-analyzer-duplication.md +184 -0
  93. package/content/plugins/audit/agents/quality-analyzer-naming.md +160 -0
  94. package/content/plugins/audit/agents/quality-consensus.md +241 -0
  95. package/content/plugins/audit/agents/schema-validator.md +473 -0
  96. package/content/plugins/audit/agents/security-analyzer-api.md +210 -0
  97. package/content/plugins/audit/agents/security-analyzer-auth.md +169 -0
  98. package/content/plugins/audit/agents/security-analyzer-authz.md +180 -0
  99. package/content/plugins/audit/agents/security-analyzer-deps.md +153 -0
  100. package/content/plugins/audit/agents/security-analyzer-infra.md +184 -0
  101. package/content/plugins/audit/agents/security-analyzer-injection.md +155 -0
  102. package/content/plugins/audit/agents/security-analyzer-input.md +201 -0
  103. package/content/plugins/audit/agents/security-analyzer-secrets.md +183 -0
  104. package/content/plugins/audit/agents/security-consensus.md +283 -0
  105. package/content/plugins/audit/agents/test-analyzer-assertions.md +188 -0
  106. package/content/plugins/audit/agents/test-analyzer-coverage.md +189 -0
  107. package/content/plugins/audit/agents/test-analyzer-fragility.md +193 -0
  108. package/content/plugins/audit/agents/test-analyzer-integration.md +161 -0
  109. package/content/plugins/audit/agents/test-analyzer-maintenance.md +180 -0
  110. package/content/plugins/audit/agents/test-analyzer-mocking.md +188 -0
  111. package/content/plugins/audit/agents/test-analyzer-patterns.md +196 -0
  112. package/content/plugins/audit/agents/test-analyzer-structure.md +184 -0
  113. package/content/plugins/audit/agents/test-consensus.md +301 -0
  114. package/content/plugins/audit/agents/testing.md +561 -0
  115. package/content/plugins/audit/agents/ui-validator.md +344 -0
  116. package/content/plugins/audit/plugin.yaml +186 -5
  117. package/content/plugins/audit/skills/agileflow-audit/SKILL.md +113 -0
  118. package/content/plugins/audit/skills/agileflow-audit/references/audit-depth-guide.md +151 -0
  119. package/content/plugins/audit/skills/agileflow-audit/references/dependency-risk-guide.md +139 -0
  120. package/content/plugins/audit/skills/agileflow-audit/references/owasp-top10.md +120 -0
  121. package/content/plugins/audit/skills/agileflow-audit/references/performance-budget-guide.md +143 -0
  122. package/content/plugins/audit/skills/agileflow-audit/references/wcag-criteria.md +117 -0
  123. package/content/plugins/audit/skills/agileflow-audit/workflows/run-audit.md +52 -0
  124. package/content/plugins/audit/skills/agileflow-audit/workflows/tdd.md +66 -0
  125. package/content/plugins/core/agents/adr-writer.md +521 -0
  126. package/content/plugins/core/agents/epic-planner.md +520 -0
  127. package/content/plugins/core/agents/mentor.md +709 -0
  128. package/content/plugins/core/agents/orchestrator.md +776 -0
  129. package/content/plugins/core/agents/team-coordinator.md +334 -0
  130. package/content/plugins/core/agents/team-lead.md +181 -0
  131. package/content/plugins/core/agents/workspace-orchestrator.md +146 -0
  132. package/content/plugins/core/hooks/context-loader.js +31 -4
  133. package/content/plugins/core/hooks/damage-control-bash.js +10 -2
  134. package/content/plugins/core/hooks/damage-control-edit.js +4 -1
  135. package/content/plugins/core/hooks/damage-control-patterns.yaml +1 -1
  136. package/content/plugins/core/hooks/damage-control-write.js +4 -1
  137. package/content/plugins/core/hooks/{pre-compact-state.js → post-compact-state.js} +25 -8
  138. package/content/plugins/core/hooks/preferences-injector.js +352 -0
  139. package/content/plugins/core/plugin.yaml +24 -28
  140. package/content/plugins/core/skills/agileflow-adr/SKILL.md +34 -8
  141. package/content/plugins/core/skills/agileflow-adr/references/madr-format-guide.md +86 -0
  142. package/content/plugins/core/skills/agileflow-adr/workflows/write-adr.md +57 -0
  143. package/content/plugins/core/skills/agileflow-babysit-mentor/SKILL.md +94 -27
  144. package/content/plugins/core/skills/agileflow-babysit-mentor/references/mentor-decision-guide.md +81 -0
  145. package/content/plugins/core/skills/agileflow-babysit-mentor/workflows/mentor-session.md +79 -0
  146. package/content/plugins/core/skills/agileflow-epic-planner/SKILL.md +37 -7
  147. package/content/plugins/core/skills/agileflow-epic-planner/references/epic-sizing-guide.md +81 -0
  148. package/content/plugins/core/skills/agileflow-epic-planner/workflows/plan-epic.md +55 -0
  149. package/content/plugins/core/skills/agileflow-status-updater/SKILL.md +36 -20
  150. package/content/plugins/core/skills/agileflow-status-updater/references/status-transitions.md +89 -0
  151. package/content/plugins/core/skills/agileflow-status-updater/workflows/update-status.md +56 -0
  152. package/content/plugins/core/skills/agileflow-story-writer/SKILL.md +39 -114
  153. package/content/plugins/core/skills/agileflow-story-writer/references/estimation-reference.md +36 -0
  154. package/content/plugins/core/skills/agileflow-story-writer/references/story-template.md +92 -0
  155. package/content/plugins/core/skills/agileflow-story-writer/workflows/write-story.md +138 -0
  156. package/content/plugins/council/agents/council-advocate.md +223 -0
  157. package/content/plugins/council/agents/council-analyst.md +278 -0
  158. package/content/plugins/council/agents/council-compounder.md +204 -0
  159. package/content/plugins/council/agents/council-contrarian.md +217 -0
  160. package/content/plugins/council/agents/council-moonshot.md +217 -0
  161. package/content/plugins/council/agents/council-optimist.md +185 -0
  162. package/content/plugins/council/agents/council-revenue.md +200 -0
  163. package/content/plugins/council/agents/council-technical.md +218 -0
  164. package/content/plugins/council/agents/multi-expert.md +334 -0
  165. package/content/plugins/council/plugin.yaml +23 -4
  166. package/content/plugins/council/skills/agileflow-council/SKILL.md +102 -0
  167. package/content/plugins/council/skills/agileflow-council/references/decision-log-template.md +109 -0
  168. package/content/plugins/council/skills/agileflow-council/references/perspective-guide.md +104 -0
  169. package/content/plugins/council/skills/agileflow-council/references/when-to-convene-guide.md +112 -0
  170. package/content/plugins/council/skills/agileflow-council/workflows/convene.md +73 -0
  171. package/content/plugins/council/skills/agileflow-council/workflows/multi-expert.md +75 -0
  172. package/content/plugins/database/plugin.yaml +14 -0
  173. package/content/plugins/database/skills/agileflow-database/SKILL.md +284 -0
  174. package/content/plugins/database/skills/agileflow-database/references/indexing-guide.md +313 -0
  175. package/content/plugins/database/skills/agileflow-database/references/migration-guide.md +328 -0
  176. package/content/plugins/database/skills/agileflow-database/references/schema-design-guide.md +467 -0
  177. package/content/plugins/database/skills/agileflow-database/workflows/design-schema.md +213 -0
  178. package/content/plugins/database/skills/agileflow-database/workflows/optimize-query.md +253 -0
  179. package/content/plugins/debugging/plugin.yaml +14 -0
  180. package/content/plugins/debugging/skills/agileflow-debug/SKILL.md +236 -0
  181. package/content/plugins/debugging/skills/agileflow-debug/references/common-patterns.md +350 -0
  182. package/content/plugins/debugging/skills/agileflow-debug/references/debugging-strategies.md +328 -0
  183. package/content/plugins/debugging/skills/agileflow-debug/workflows/debug-issue.md +187 -0
  184. package/content/plugins/debugging/skills/agileflow-debug/workflows/reproduce-bug.md +194 -0
  185. package/content/plugins/delivery/agents/ci.md +547 -0
  186. package/content/plugins/delivery/agents/devops.md +789 -0
  187. package/content/plugins/delivery/plugin.yaml +19 -0
  188. package/content/plugins/delivery/skills/agileflow-delivery/SKILL.md +111 -0
  189. package/content/plugins/delivery/skills/agileflow-delivery/references/changelog-format-guide.md +133 -0
  190. package/content/plugins/delivery/skills/agileflow-delivery/references/ci-pipeline-guide.md +158 -0
  191. package/content/plugins/delivery/skills/agileflow-delivery/references/pr-checklist-guide.md +133 -0
  192. package/content/plugins/delivery/skills/agileflow-delivery/references/release-checklist.md +142 -0
  193. package/content/plugins/delivery/skills/agileflow-delivery/workflows/changelog.md +72 -0
  194. package/content/plugins/delivery/skills/agileflow-delivery/workflows/deploy.md +74 -0
  195. package/content/plugins/delivery/skills/agileflow-delivery/workflows/pr.md +75 -0
  196. package/content/plugins/docs/agents/documentation.md +544 -0
  197. package/content/plugins/docs/agents/readme-updater.md +640 -0
  198. package/content/plugins/docs/plugin.yaml +19 -0
  199. package/content/plugins/docs/skills/agileflow-docs/SKILL.md +106 -0
  200. package/content/plugins/docs/skills/agileflow-docs/references/api-doc-template.md +167 -0
  201. package/content/plugins/docs/skills/agileflow-docs/references/doc-types-guide.md +141 -0
  202. package/content/plugins/docs/skills/agileflow-docs/references/readme-template.md +156 -0
  203. package/content/plugins/docs/skills/agileflow-docs/workflows/readme-sync.md +57 -0
  204. package/content/plugins/docs/skills/agileflow-docs/workflows/sync.md +64 -0
  205. package/content/plugins/engineering/agents/api.md +718 -0
  206. package/content/plugins/engineering/agents/codebase-query.md +285 -0
  207. package/content/plugins/engineering/agents/compliance.md +559 -0
  208. package/content/plugins/engineering/agents/database.md +644 -0
  209. package/content/plugins/engineering/agents/integrations.md +644 -0
  210. package/content/plugins/engineering/agents/mobile.md +552 -0
  211. package/content/plugins/engineering/agents/monitoring.md +585 -0
  212. package/content/plugins/engineering/agents/performance.md +529 -0
  213. package/content/plugins/engineering/agents/refactor.md +592 -0
  214. package/content/plugins/engineering/agents/security.md +524 -0
  215. package/content/plugins/engineering/agents/ui.md +1336 -0
  216. package/content/plugins/engineering/plugin.yaml +37 -0
  217. package/content/plugins/engineering/skills/agileflow-engineering/SKILL.md +127 -0
  218. package/content/plugins/engineering/skills/agileflow-engineering/references/code-review-guide.md +126 -0
  219. package/content/plugins/engineering/skills/agileflow-engineering/references/domain-routing-guide.md +89 -0
  220. package/content/plugins/engineering/skills/agileflow-engineering/references/refactoring-guide.md +136 -0
  221. package/content/plugins/engineering/skills/agileflow-engineering/workflows/diagnose.md +63 -0
  222. package/content/plugins/engineering/skills/agileflow-engineering/workflows/impact.md +60 -0
  223. package/content/plugins/ideation/agents/brainstorm-analyzer-features.md +179 -0
  224. package/content/plugins/ideation/agents/brainstorm-analyzer-growth.md +169 -0
  225. package/content/plugins/ideation/agents/brainstorm-analyzer-integration.md +181 -0
  226. package/content/plugins/ideation/agents/brainstorm-analyzer-market.md +150 -0
  227. package/content/plugins/ideation/agents/brainstorm-analyzer-ux.md +180 -0
  228. package/content/plugins/ideation/agents/brainstorm-consensus.md +245 -0
  229. package/content/plugins/ideation/agents/design.md +568 -0
  230. package/content/plugins/ideation/agents/product.md +582 -0
  231. package/content/plugins/ideation/plugin.yaml +31 -0
  232. package/content/plugins/ideation/skills/agileflow-ideation/SKILL.md +109 -0
  233. package/content/plugins/ideation/skills/agileflow-ideation/references/brainstorm-techniques.md +138 -0
  234. package/content/plugins/ideation/skills/agileflow-ideation/references/competitive-analysis-template.md +148 -0
  235. package/content/plugins/ideation/skills/agileflow-ideation/references/feature-prioritization-guide.md +147 -0
  236. package/content/plugins/ideation/skills/agileflow-ideation/references/user-story-patterns.md +152 -0
  237. package/content/plugins/ideation/skills/agileflow-ideation/workflows/features.md +65 -0
  238. package/content/plugins/ideation/skills/agileflow-ideation/workflows/ideate.md +54 -0
  239. package/content/plugins/migration/agents/datamigration.md +757 -0
  240. package/content/plugins/migration/plugin.yaml +17 -0
  241. package/content/plugins/migration/skills/agileflow-migration/SKILL.md +106 -0
  242. package/content/plugins/migration/skills/agileflow-migration/references/data-validation-checklist.md +154 -0
  243. package/content/plugins/migration/skills/agileflow-migration/references/migration-patterns.md +209 -0
  244. package/content/plugins/migration/skills/agileflow-migration/references/rollback-playbook.md +171 -0
  245. package/content/plugins/migration/skills/agileflow-migration/references/version-compatibility-matrix.md +155 -0
  246. package/content/plugins/migration/skills/agileflow-migration/workflows/plan.md +73 -0
  247. package/content/plugins/migration/skills/agileflow-migration/workflows/validate.md +71 -0
  248. package/content/plugins/performance/plugin.yaml +14 -0
  249. package/content/plugins/performance/skills/agileflow-performance/SKILL.md +224 -0
  250. package/content/plugins/performance/skills/agileflow-performance/references/optimization-patterns.md +554 -0
  251. package/content/plugins/performance/skills/agileflow-performance/references/profiling-guide.md +383 -0
  252. package/content/plugins/performance/skills/agileflow-performance/references/web-vitals-guide.md +360 -0
  253. package/content/plugins/performance/skills/agileflow-performance/workflows/improve-web-vitals.md +344 -0
  254. package/content/plugins/performance/skills/agileflow-performance/workflows/profile-and-fix.md +254 -0
  255. package/content/plugins/planning/agents/analytics.md +670 -0
  256. package/content/plugins/planning/agents/rlm-subcore.md +215 -0
  257. package/content/plugins/planning/plugin.yaml +19 -0
  258. package/content/plugins/planning/skills/agileflow-planning/SKILL.md +111 -0
  259. package/content/plugins/planning/skills/agileflow-planning/references/estimation-guide.md +114 -0
  260. package/content/plugins/planning/skills/agileflow-planning/references/rpi-workflow.md +119 -0
  261. package/content/plugins/planning/skills/agileflow-planning/references/sprint-planning-guide.md +145 -0
  262. package/content/plugins/planning/skills/agileflow-planning/workflows/impact.md +63 -0
  263. package/content/plugins/planning/skills/agileflow-planning/workflows/rpi.md +104 -0
  264. package/content/plugins/psychology/plugin.yaml +14 -0
  265. package/content/plugins/psychology/skills/agileflow-retention/SKILL.md +252 -0
  266. package/content/plugins/psychology/skills/agileflow-retention/references/competitor-analysis.md +240 -0
  267. package/content/plugins/psychology/skills/agileflow-retention/references/psychology-models.md +349 -0
  268. package/content/plugins/psychology/skills/agileflow-retention/references/retention-patterns.md +279 -0
  269. package/content/plugins/psychology/skills/agileflow-retention/workflows/design-retention-feature.md +287 -0
  270. package/content/plugins/psychology/skills/agileflow-retention/workflows/retention-audit.md +259 -0
  271. package/content/plugins/refactoring/plugin.yaml +14 -0
  272. package/content/plugins/refactoring/skills/agileflow-refactor/SKILL.md +235 -0
  273. package/content/plugins/refactoring/skills/agileflow-refactor/references/refactoring-patterns.md +405 -0
  274. package/content/plugins/refactoring/skills/agileflow-refactor/references/safety-checks.md +177 -0
  275. package/content/plugins/refactoring/skills/agileflow-refactor/workflows/extract-module.md +226 -0
  276. package/content/plugins/refactoring/skills/agileflow-refactor/workflows/safe-refactor.md +169 -0
  277. package/content/plugins/research/agents/research.md +503 -0
  278. package/content/plugins/research/plugin.yaml +17 -0
  279. package/content/plugins/research/skills/agileflow-research/SKILL.md +110 -0
  280. package/content/plugins/research/skills/agileflow-research/references/knowledge-decay-guide.md +121 -0
  281. package/content/plugins/research/skills/agileflow-research/references/research-prompt-guide.md +141 -0
  282. package/content/plugins/research/skills/agileflow-research/references/synthesis-template.md +154 -0
  283. package/content/plugins/research/skills/agileflow-research/workflows/analyze.md +60 -0
  284. package/content/plugins/research/skills/agileflow-research/workflows/ask.md +64 -0
  285. package/content/plugins/research/skills/agileflow-research/workflows/import.md +66 -0
  286. package/content/plugins/research/skills/agileflow-research/workflows/synthesize.md +66 -0
  287. package/content/plugins/reviews/plugin.yaml +14 -0
  288. package/content/plugins/reviews/skills/agileflow-pr-reviewer/SKILL.md +241 -0
  289. package/content/plugins/reviews/skills/agileflow-pr-reviewer/references/review-checklist.md +200 -0
  290. package/content/plugins/reviews/skills/agileflow-pr-reviewer/references/security-patterns.md +328 -0
  291. package/content/plugins/reviews/skills/agileflow-pr-reviewer/workflows/review-pr.md +153 -0
  292. package/content/plugins/reviews/skills/agileflow-pr-reviewer/workflows/security-review.md +177 -0
  293. package/content/plugins/seo/agents/seo-analyzer-content.md +169 -0
  294. package/content/plugins/seo/agents/seo-analyzer-images.md +198 -0
  295. package/content/plugins/seo/agents/seo-analyzer-performance.md +217 -0
  296. package/content/plugins/seo/agents/seo-analyzer-schema.md +184 -0
  297. package/content/plugins/seo/agents/seo-analyzer-sitemap.md +177 -0
  298. package/content/plugins/seo/agents/seo-analyzer-technical.md +151 -0
  299. package/content/plugins/seo/agents/seo-consensus.md +304 -0
  300. package/content/plugins/seo/plugin.yaml +19 -4
  301. package/content/plugins/seo/skills/agileflow-seo/SKILL.md +188 -0
  302. package/content/plugins/seo/skills/agileflow-seo/references/cwv-thresholds.md +110 -0
  303. package/content/plugins/seo/skills/agileflow-seo/references/eeat-framework.md +144 -0
  304. package/content/plugins/seo/skills/agileflow-seo/references/keyword-research-guide.md +125 -0
  305. package/content/plugins/seo/skills/agileflow-seo/references/schema-types.md +139 -0
  306. package/content/plugins/seo/skills/agileflow-seo/references/technical-seo-checklist.md +139 -0
  307. package/content/plugins/seo/skills/agileflow-seo/workflows/audit.md +98 -0
  308. package/content/plugins/seo/skills/agileflow-seo/workflows/page.md +118 -0
  309. package/content/plugins/testing/plugin.yaml +16 -0
  310. package/content/plugins/testing/skills/agileflow-test-writer/SKILL.md +260 -0
  311. package/content/plugins/testing/skills/agileflow-test-writer/references/coverage-targets.md +239 -0
  312. package/content/plugins/testing/skills/agileflow-test-writer/references/test-patterns.md +420 -0
  313. package/content/plugins/testing/skills/agileflow-test-writer/workflows/add-coverage.md +154 -0
  314. package/content/plugins/testing/skills/agileflow-test-writer/workflows/write-tests-from-ac.md +225 -0
  315. package/package.json +2 -2
  316. package/src/cli/commands/doctor.js +818 -30
  317. package/src/cli/commands/hook.js +17 -14
  318. package/src/cli/commands/launch.js +1454 -0
  319. package/src/cli/commands/learn.js +149 -0
  320. package/src/cli/commands/plugins.js +113 -0
  321. package/src/cli/commands/setup.js +455 -110
  322. package/src/cli/commands/skills.js +324 -0
  323. package/src/cli/commands/status.js +8 -10
  324. package/src/cli/commands/update.js +76 -15
  325. package/src/cli/index.js +90 -26
  326. package/src/cli/wizard/babysit-mode-picker.js +192 -0
  327. package/src/cli/wizard/behaviors-picker.js +208 -54
  328. package/src/cli/wizard/ide-picker.js +40 -28
  329. package/src/cli/wizard/install-scope-picker.js +57 -0
  330. package/src/cli/wizard/launch-alias-picker.js +50 -0
  331. package/src/cli/wizard/launch-cli-picker.js +129 -0
  332. package/src/cli/wizard/launch-tmux-picker.js +133 -0
  333. package/src/cli/wizard/learnings-picker.js +40 -0
  334. package/src/cli/wizard/plugin-picker.js +47 -16
  335. package/src/lib/brand.js +116 -0
  336. package/src/lib/errors.js +120 -0
  337. package/src/lib/path-check.js +39 -0
  338. package/src/runtime/config/defaults.js +22 -17
  339. package/src/runtime/config/loader.js +77 -8
  340. package/src/runtime/config/schema.json +43 -16
  341. package/src/runtime/config/writer.js +3 -1
  342. package/src/runtime/ide/babysit-skill.js +202 -0
  343. package/src/runtime/ide/capabilities.js +84 -29
  344. package/src/runtime/ide/claude-code-content.js +177 -0
  345. package/src/runtime/ide/claude-code-settings.js +67 -29
  346. package/src/runtime/ide/claude-code-skills.js +47 -32
  347. package/src/runtime/ide/codex-config.js +295 -0
  348. package/src/runtime/installer/install.js +252 -24
  349. package/src/runtime/launch/alias-installer.js +191 -0
  350. package/src/runtime/launch/cli-resume.js +244 -0
  351. package/src/runtime/launch/closed-windows.js +338 -0
  352. package/src/runtime/launch/defaults.js +66 -0
  353. package/src/runtime/launch/detect-clis.js +69 -0
  354. package/src/runtime/launch/doctor.js +464 -0
  355. package/src/runtime/launch/exec-wrapper.js +114 -0
  356. package/src/runtime/launch/parallel-session.js +247 -0
  357. package/src/runtime/launch/prefs.js +211 -0
  358. package/src/runtime/launch/project-prefs.js +234 -0
  359. package/src/runtime/launch/resolve-cli.js +56 -0
  360. package/src/runtime/launch/restore.js +152 -0
  361. package/src/runtime/launch/schema.json +75 -0
  362. package/src/runtime/launch/session-lifecycle.js +313 -0
  363. package/src/runtime/launch/session-registry.js +401 -0
  364. package/src/runtime/launch/spawn.js +103 -0
  365. package/src/runtime/launch/tabs.js +350 -0
  366. package/src/runtime/launch/tmux.js +764 -0
  367. package/src/runtime/launch/worktree.js +260 -0
  368. package/src/runtime/plugins/registry.js +16 -11
  369. package/src/runtime/plugins/validator.js +57 -43
  370. package/src/runtime/skills/learnings.js +308 -0
  371. package/content/plugins/core/hooks/babysit-mentor-injector.js +0 -55
  372. package/src/cli/wizard/personalization.js +0 -64
@@ -7,7 +7,6 @@
7
7
  * re-prompting (e.g. after manually editing the config).
8
8
  *
9
9
  * - Plugin multiselect via @clack/prompts (skills.sh-style UX)
10
- * - Personalization prompts (tone, ask_level, verbosity)
11
10
  * - Non-interactive path: --yes --plugins <ids>
12
11
  * - Errors (write failure, plugin discovery failure, unknown plugin
13
12
  * ids) produce actionable messages instead of stack traces.
@@ -15,21 +14,33 @@
15
14
  * wizard reruns.
16
15
  */
17
16
  const path = require("path");
17
+ const os = require("os");
18
18
  const prompts = require("@clack/prompts");
19
19
  const pkg = require("../../../package.json");
20
+ const { logoBanner } = require("../../lib/brand.js");
20
21
  const { loadConfig } = require("../../runtime/config/loader.js");
21
22
  const { writeConfig } = require("../../runtime/config/writer.js");
22
23
  const { defaultConfig } = require("../../runtime/config/defaults.js");
23
24
  const { discoverPlugins } = require("../../runtime/plugins/registry.js");
24
25
  const { installPlugins } = require("../../runtime/installer/install.js");
25
26
  const { pickPlugins, buildPluginsMap } = require("../wizard/plugin-picker.js");
26
- const { personalizationPrompts } = require("../wizard/personalization.js");
27
- const { pickIde } = require("../wizard/ide-picker.js");
27
+ const { pickInstallScope } = require("../wizard/install-scope-picker.js");
28
+ const { pickIdes } = require("../wizard/ide-picker.js");
28
29
  const { pickBehaviors } = require("../wizard/behaviors-picker.js");
30
+ const { pickBabysitMode } = require("../wizard/babysit-mode-picker.js");
31
+ const { pickLearnings } = require("../wizard/learnings-picker.js");
32
+ const { checkStaleArtifacts, applyStaleFix } = require("./doctor.js");
29
33
  const {
30
34
  SUPPORTED_IDES,
31
35
  capabilitiesFor,
36
+ hookEventsForIdes,
32
37
  } = require("../../runtime/ide/capabilities.js");
38
+ const {
39
+ InvalidArgumentError,
40
+ MissingFileError,
41
+ OperationFailedError,
42
+ fail,
43
+ } = require("../../lib/errors.js");
33
44
 
34
45
  /**
35
46
  * Parse a CSV of plugin ids, apply it over the discovered+existing plugin
@@ -62,6 +73,63 @@ function pluginsFromCsv(csv, existingPlugins = {}) {
62
73
  return { plugins, unknownPlugins };
63
74
  }
64
75
 
76
+ /**
77
+ * Normalize requested IDE targets from `--ide`.
78
+ *
79
+ * Accepts a comma-separated list and the special alias `all`.
80
+ *
81
+ * @param {string | undefined} ideOption
82
+ * @param {string[]} fallback
83
+ * @returns {string[]}
84
+ */
85
+ function resolveIdeTargets(ideOption, fallback) {
86
+ const raw = ideOption
87
+ ? String(ideOption)
88
+ .split(",")
89
+ .map((s) => s.trim())
90
+ .filter(Boolean)
91
+ : fallback;
92
+
93
+ if (raw.length === 1 && raw[0] === "all") {
94
+ return [...SUPPORTED_IDES];
95
+ }
96
+
97
+ return raw;
98
+ }
99
+
100
+ /**
101
+ * @param {string | undefined} scopeOption
102
+ * @returns {'project' | 'global'}
103
+ */
104
+ function resolveInstallScope(scopeOption) {
105
+ if (scopeOption === "global") return "global";
106
+ return "project";
107
+ }
108
+
109
+ /**
110
+ * @param {'project' | 'global'} scope
111
+ * @param {string} cwd
112
+ * @returns {{ scope: 'project' | 'global', configRoot: string, agileflowDir: string, ideRoot: string }}
113
+ */
114
+ function installPathsForScope(scope, cwd) {
115
+ if (scope === "global") {
116
+ const home = os.homedir();
117
+ const agileflowDir = path.join(home, ".agileflow");
118
+ return {
119
+ scope,
120
+ configRoot: agileflowDir,
121
+ agileflowDir,
122
+ ideRoot: home,
123
+ };
124
+ }
125
+ return {
126
+ scope,
127
+ configRoot: cwd,
128
+ agileflowDir: path.join(cwd, ".agileflow"),
129
+ ideRoot: cwd,
130
+ };
131
+ }
132
+
65
133
  /**
66
134
  * @param {string} cwd
67
135
  * @param {import('../../runtime/config/defaults.js').AgileflowConfig} config
@@ -78,10 +146,13 @@ async function writeConfigWithFeedback(cwd, config, ctx) {
78
146
  "Check permissions and disk space, then run `agileflow setup` again.",
79
147
  );
80
148
  } else {
81
- // eslint-disable-next-line no-console
82
- console.error(`agileflow setup: failed to write config: ${err.message}`);
83
- // eslint-disable-next-line no-console
84
- console.error("Check permissions and disk space, then retry.");
149
+ fail(
150
+ new OperationFailedError(`could not write config: ${err.message}`, {
151
+ suggestion: "check permissions and disk space, then retry",
152
+ cause: err,
153
+ }),
154
+ { command: "setup" },
155
+ );
85
156
  }
86
157
  process.exit(1);
87
158
  }
@@ -90,12 +161,22 @@ async function writeConfigWithFeedback(cwd, config, ctx) {
90
161
  /**
91
162
  * Run the installer for the given enabled plugin ids and surface failures.
92
163
  * @param {string[]} enabledIds
93
- * @param {string} cwd
94
- * @param {string} ide - target IDE id (gates hook manifest writing)
164
+ * @param {{ agileflowDir: string }} roots
165
+ * @param {string[]} ides - target IDE ids (gates hook manifest + per-IDE skill mirrors)
95
166
  * @param {import('../../runtime/config/defaults.js').Behaviors} behaviors - hook preset toggles
167
+ * @param {boolean} learningsEnabled - global skill learnings toggle
168
+ * @param {import('../../runtime/config/defaults.js').AgileflowConfig} config - merged config passed through to installers
96
169
  * @param {{ interactive: boolean, spinner?: any }} ctx
97
170
  */
98
- async function runInstallWithFeedback(enabledIds, cwd, ide, behaviors, ctx) {
171
+ async function runInstallWithFeedback(
172
+ enabledIds,
173
+ roots,
174
+ ides,
175
+ behaviors,
176
+ learningsEnabled,
177
+ config,
178
+ ctx,
179
+ ) {
99
180
  // userSelected is "everything except core" — core is always-on via
100
181
  // cannotDisable, the resolver will pull it in.
101
182
  const userSelected = enabledIds.filter((id) => id !== "core");
@@ -103,155 +184,371 @@ async function runInstallWithFeedback(enabledIds, cwd, ide, behaviors, ctx) {
103
184
  return await installPlugins({
104
185
  discovered: discoverPlugins(),
105
186
  userSelected,
106
- agileflowDir: path.join(cwd, ".agileflow"),
187
+ agileflowDir: roots.agileflowDir,
107
188
  cliVersion: pkg.version,
108
- ide,
189
+ ides,
109
190
  behaviors,
191
+ learningsEnabled,
192
+ config,
110
193
  });
111
194
  } catch (err) {
112
195
  if (ctx.interactive) {
113
196
  if (ctx.spinner) ctx.spinner.stop("Install failed");
114
197
  prompts.log.error(`Install failed: ${err.message}`);
115
198
  } else {
116
- // eslint-disable-next-line no-console
117
- console.error(`agileflow setup: install failed: ${err.message}`);
199
+ fail(
200
+ new OperationFailedError(`install failed: ${err.message}`, {
201
+ suggestion:
202
+ "check the error above; re-run with DEBUG=1 for a full stack trace",
203
+ cause: err,
204
+ }),
205
+ { command: "setup" },
206
+ );
118
207
  }
119
208
  process.exit(1);
120
209
  }
121
210
  }
122
211
 
123
212
  /**
124
- * @param {{ yes?: boolean, plugins?: string }} options
213
+ * @param {{ yes?: boolean, plugins?: string, ide?: string, scope?: string }} options
125
214
  */
126
- async function setup(options = {}) {
127
- const cwd = process.cwd();
215
+ /**
216
+ * Detect stale v3 artifacts left behind from older installs and offer
217
+ * cleanup. Runs after the main install completes so the user sees the
218
+ * findings in context.
219
+ *
220
+ * Interactive (no --yes): print the list, ask y/N (default no), apply
221
+ * if confirmed. Non-interactive (--yes): detect but never auto-fix —
222
+ * scripted installs shouldn't surprise users with destructive ops.
223
+ *
224
+ * The `deps` parameter exists for test injection — production callers
225
+ * leave it empty and pick up the real @clack/prompts module.
226
+ *
227
+ * @param {string} cwd
228
+ * @param {{interactive: boolean}} ctx
229
+ * @param {{prompts?: any, checkStaleArtifacts?: any, applyStaleFix?: any}} [deps]
230
+ * @returns {Promise<{summary: string | null}>}
231
+ */
232
+ async function runPostInstallCleanup(cwd, ctx, deps = {}) {
233
+ const p = deps.prompts || prompts;
234
+ const check = deps.checkStaleArtifacts || checkStaleArtifacts;
235
+ const apply = deps.applyStaleFix || applyStaleFix;
236
+
237
+ const issues = await check(cwd);
238
+ if (issues.length === 0) return { summary: null };
239
+
240
+ if (!ctx.interactive) {
241
+ return {
242
+ summary: `! ${issues.length} stale artifact(s) detected — run \`agileflow doctor --fix\` to clean up`,
243
+ };
244
+ }
245
+
246
+ p.log.warn(
247
+ `Found ${issues.length} stale artifact(s) from a previous install:`,
248
+ );
249
+ for (const issue of issues) {
250
+ p.log.message(` • [${issue.kind}] ${issue.message}`);
251
+ }
252
+
253
+ const confirmed = await p.confirm({
254
+ message: `Clean up ${issues.length} stale artifact(s)?`,
255
+ initialValue: false,
256
+ });
257
+ if (p.isCancel(confirmed) || !confirmed) {
258
+ return {
259
+ summary: `! ${issues.length} stale artifact(s) left in place — run \`agileflow doctor --fix\` later`,
260
+ };
261
+ }
262
+
263
+ let fixed = 0;
264
+ let failed = 0;
265
+ for (const issue of issues) {
266
+ // fs.rmSync / unlinkSync can throw on Windows EPERM, EBUSY, or
267
+ // race-deleted paths — guard so a mid-loop throw doesn't bypass
268
+ // the outro with a raw stack trace.
269
+ try {
270
+ const r = apply(issue, cwd);
271
+ if (r.ok) fixed += 1;
272
+ else failed += 1;
273
+ } catch {
274
+ failed += 1;
275
+ }
276
+ }
277
+ if (failed === 0) {
278
+ return { summary: `✓ Cleaned up ${fixed} stale artifact(s)` };
279
+ }
280
+ return {
281
+ summary: `Cleaned ${fixed}/${issues.length}; ${failed} could not be auto-fixed (run \`agileflow doctor --fix\` for details)`,
282
+ };
283
+ }
284
+
285
+ /**
286
+ * Pull base + babysit out of the loaded config. Shared by both flows.
287
+ *
288
+ * @param {Awaited<ReturnType<typeof loadConfig>>} existing
289
+ */
290
+ function deriveBaseFromExisting(existing) {
291
+ const base = existing.source === "file" ? existing.config : defaultConfig();
292
+ const rawBaseBabysit =
293
+ base.plugins &&
294
+ base.plugins.core &&
295
+ base.plugins.core.settings &&
296
+ base.plugins.core.settings.babysit;
297
+ const baseBabysit =
298
+ rawBaseBabysit && typeof rawBaseBabysit === "object"
299
+ ? rawBaseBabysit
300
+ : { mode: typeof rawBaseBabysit === "string" ? rawBaseBabysit : "light" };
301
+ const baseBabysitMode =
302
+ typeof baseBabysit.mode === "string" ? baseBabysit.mode : "light";
303
+ return { base, baseBabysit, baseBabysitMode };
304
+ }
305
+
306
+ /**
307
+ * Non-interactive (`--yes`) setup. Resolves scope/IDEs/plugins entirely
308
+ * from CLI flags or existing config, writes the new config, runs the
309
+ * installer, and surfaces stale-artifact warnings without prompting.
310
+ *
311
+ * Fails fast on bad input (unknown IDE / unknown plugin / unreadable
312
+ * config) — no prompts to fall back to.
313
+ *
314
+ * @param {{ yes?: boolean, plugins?: string, ide?: string, scope?: string }} options
315
+ * @param {string} cwd
316
+ */
317
+ async function setupNonInteractive(options, cwd) {
318
+ const scope = resolveInstallScope(options.scope);
319
+ const roots = installPathsForScope(scope, cwd);
128
320
 
129
- /** @type {Awaited<ReturnType<typeof loadConfig>>} */
130
321
  let existing;
131
322
  try {
132
- existing = await loadConfig(cwd);
323
+ existing = await loadConfig(roots.configRoot);
133
324
  } catch (err) {
134
- if (options.yes) {
135
- // eslint-disable-next-line no-console
136
- console.error(`agileflow setup: ${err.message}`);
137
- process.exit(1);
138
- }
139
- prompts.intro(`agileflow v${pkg.version} setup`);
140
- prompts.log.error(err.message);
141
- prompts.log.info(
142
- "Fix or delete agileflow.config.json and re-run `agileflow setup`.",
325
+ fail(
326
+ new OperationFailedError(err.message, {
327
+ suggestion:
328
+ "fix or delete agileflow.config.json and re-run `agileflow setup`",
329
+ cause: err,
330
+ }),
331
+ { command: "setup" },
143
332
  );
144
- process.exit(1);
333
+ return;
145
334
  }
146
335
 
147
- const base = existing.source === "file" ? existing.config : defaultConfig();
148
-
149
- if (options.yes) {
150
- // Resolve IDE: --ide flag wins, then existing config, then default.
151
- const requestedIde = options.ide || base.ide.primary || "claude-code";
152
- if (!SUPPORTED_IDES.includes(requestedIde)) {
153
- // eslint-disable-next-line no-console
154
- console.error(
155
- `agileflow setup: unknown IDE "${requestedIde}". Supported: ${SUPPORTED_IDES.join(", ")}`,
156
- );
157
- process.exit(1);
158
- }
336
+ const { base, baseBabysit, baseBabysitMode } =
337
+ deriveBaseFromExisting(existing);
159
338
 
160
- const { plugins, unknownPlugins } = pluginsFromCsv(
161
- options.plugins || "core",
162
- base.plugins,
339
+ // Resolve IDE targets: --ide flag (csv) wins, then existing config, then default.
340
+ /** @type {string[]} */
341
+ const requestedIdes = resolveIdeTargets(
342
+ options.ide,
343
+ Array.isArray(base.ide.targets) && base.ide.targets.length
344
+ ? base.ide.targets
345
+ : ["claude-code"],
346
+ );
347
+ const unknownIdes = requestedIdes.filter(
348
+ (id) => !SUPPORTED_IDES.includes(id),
349
+ );
350
+ if (unknownIdes.length) {
351
+ fail(
352
+ new InvalidArgumentError(`unknown IDE(s): ${unknownIdes.join(", ")}`, {
353
+ suggestion: `use one of: ${SUPPORTED_IDES.join(", ")}`,
354
+ }),
355
+ { command: "setup" },
163
356
  );
164
- if (unknownPlugins.length) {
165
- const known = discoverPlugins()
166
- .map((p) => p.id)
167
- .join(", ");
168
- // eslint-disable-next-line no-console
169
- console.error(
170
- `agileflow setup: unknown plugin(s): ${unknownPlugins.join(", ")}`,
171
- );
172
- // eslint-disable-next-line no-console
173
- console.error(`Available plugins: ${known}`);
174
- process.exit(1);
175
- }
357
+ }
176
358
 
177
- const next = {
178
- ...base,
179
- plugins,
180
- ide: { primary: /** @type {any} */ (requestedIde) },
181
- };
182
- const file = await writeConfigWithFeedback(cwd, next, {
183
- interactive: false,
184
- });
185
- const enabled = Object.entries(plugins)
186
- .filter(([, v]) => v && v.enabled)
187
- .map(([id]) => id);
188
-
189
- const installResult = await runInstallWithFeedback(
190
- enabled,
191
- cwd,
192
- requestedIde,
193
- next.behaviors,
194
- { interactive: false },
359
+ const { plugins, unknownPlugins } = pluginsFromCsv(
360
+ options.plugins || "core",
361
+ base.plugins,
362
+ );
363
+ if (unknownPlugins.length) {
364
+ const known = discoverPlugins()
365
+ .map((p) => p.id)
366
+ .join(", ");
367
+ fail(
368
+ new InvalidArgumentError(
369
+ `unknown plugin(s): ${unknownPlugins.join(", ")}`,
370
+ { suggestion: `available plugins: ${known}` },
371
+ ),
372
+ { command: "setup" },
195
373
  );
374
+ }
196
375
 
197
- const caps = capabilitiesFor(requestedIde);
198
- // eslint-disable-next-line no-console
199
- console.log(`✓ Wrote ${file}`);
376
+ const next = {
377
+ ...base,
378
+ plugins,
379
+ install: { scope },
380
+ ide: { targets: /** @type {any} */ (requestedIdes) },
381
+ };
382
+ next.plugins.core = next.plugins.core || { enabled: true };
383
+ next.plugins.core.settings = {
384
+ ...(next.plugins.core.settings || {}),
385
+ babysit: baseBabysit,
386
+ };
387
+ const file = await writeConfigWithFeedback(roots.configRoot, next, {
388
+ interactive: false,
389
+ });
390
+ const enabled = Object.entries(plugins)
391
+ .filter(([, v]) => v && v.enabled)
392
+ .map(([id]) => id);
393
+
394
+ const installResult = await runInstallWithFeedback(
395
+ enabled,
396
+ roots,
397
+ requestedIdes,
398
+ next.behaviors,
399
+ Boolean(next.learnings && next.learnings.enabled),
400
+ next,
401
+ { interactive: false },
402
+ );
403
+
404
+ const anyHooks = requestedIdes.some((id) => capabilitiesFor(id).hooks);
405
+ // eslint-disable-next-line no-console
406
+ console.log(`✓ Wrote ${file}`);
407
+ // eslint-disable-next-line no-console
408
+ console.log(` scope: ${scope}`);
409
+ // eslint-disable-next-line no-console
410
+ console.log(` ides: ${requestedIdes.join(", ")}`);
411
+ // eslint-disable-next-line no-console
412
+ console.log(` skill packs enabled: ${enabled.join(", ")}`);
413
+ // eslint-disable-next-line no-console
414
+ console.log(` babysit mode: ${baseBabysitMode}`);
415
+ if (anyHooks) {
416
+ const activeBehaviors = Object.entries(next.behaviors || {})
417
+ .filter(([, v]) => v)
418
+ .map(([k]) => k);
200
419
  // eslint-disable-next-line no-console
201
420
  console.log(
202
- ` ide: ${requestedIde} (hooks=${caps.hooks ? "on" : "off"}, skills=${caps.skills ? "on" : "off"})`,
421
+ ` behaviors enabled: ${activeBehaviors.length ? activeBehaviors.join(", ") : "(none no hooks will run)"}`,
203
422
  );
423
+ }
424
+ // eslint-disable-next-line no-console
425
+ console.log(
426
+ ` installed: created=${installResult.ops.created} updated=${installResult.ops.updated} unchanged=${installResult.ops.unchanged} preserved=${installResult.ops.preserved} removed=${installResult.ops.removed}`,
427
+ );
428
+ // Scan the resolved install root — for global scope this is
429
+ // ~/.agileflow, not process.cwd().
430
+ const cleanup = await runPostInstallCleanup(roots.ideRoot, {
431
+ interactive: false,
432
+ });
433
+ if (cleanup.summary) {
204
434
  // eslint-disable-next-line no-console
205
- console.log(` plugins enabled: ${enabled.join(", ")}`);
206
- // eslint-disable-next-line no-console
207
- console.log(
208
- ` installed: created=${installResult.ops.created} updated=${installResult.ops.updated} unchanged=${installResult.ops.unchanged} preserved=${installResult.ops.preserved} removed=${installResult.ops.removed}`,
435
+ console.log(` ${cleanup.summary}`);
436
+ }
437
+ }
438
+
439
+ /**
440
+ * Interactive (wizard) setup. Walks the user through scope, IDEs,
441
+ * plugins, behaviors, babysit mode, and learnings, then writes config,
442
+ * installs, and prompts for stale-artifact cleanup before the outro.
443
+ *
444
+ * Errors are surfaced via prompts.log.* with a graceful process.exit(1)
445
+ * — no thrown stack traces.
446
+ *
447
+ * The `deps` parameter exists for test injection — production callers
448
+ * leave it empty and pick up the real @clack/prompts module plus the
449
+ * real picker implementations.
450
+ *
451
+ * @param {{ yes?: boolean, plugins?: string, ide?: string, scope?: string }} options
452
+ * @param {string} cwd
453
+ * @param {{
454
+ * prompts?: any,
455
+ * pickInstallScope?: any,
456
+ * pickIdes?: any,
457
+ * pickPlugins?: any,
458
+ * pickBehaviors?: any,
459
+ * pickBabysitMode?: any,
460
+ * pickLearnings?: any,
461
+ * }} [deps]
462
+ */
463
+ async function setupInteractive(options, cwd, deps = {}) {
464
+ const p = deps.prompts || prompts;
465
+ const doScope = deps.pickInstallScope || pickInstallScope;
466
+ const doIdes = deps.pickIdes || pickIdes;
467
+ const doPlugins = deps.pickPlugins || pickPlugins;
468
+ const doBehaviors = deps.pickBehaviors || pickBehaviors;
469
+ const doBabysit = deps.pickBabysitMode || pickBabysitMode;
470
+ const doLearnings = deps.pickLearnings || pickLearnings;
471
+
472
+ const initialScope = resolveInstallScope(options.scope);
473
+
474
+ // eslint-disable-next-line no-console
475
+ console.log("\n" + logoBanner(pkg.version) + "\n");
476
+ p.intro("agileflow setup");
477
+ const scope = await doScope(initialScope);
478
+ const roots = installPathsForScope(scope, cwd);
479
+
480
+ let existing;
481
+ try {
482
+ existing = await loadConfig(roots.configRoot);
483
+ } catch (err) {
484
+ p.log.error(err.message);
485
+ p.log.info(
486
+ "Fix or delete agileflow.config.json and re-run `agileflow setup`.",
209
487
  );
210
- return;
488
+ process.exit(1);
211
489
  }
212
490
 
213
- prompts.intro(`agileflow v${pkg.version} setup`);
491
+ const { base } = deriveBaseFromExisting(existing);
214
492
 
215
493
  if (existing.source === "file") {
216
- prompts.log.info(
494
+ p.log.info(
217
495
  `Existing config found at ${existing.path} — re-running wizard to update.`,
218
496
  );
219
497
  } else {
220
- prompts.log.info("No existing config — starting from defaults.");
498
+ p.log.info("No existing config — starting from defaults.");
221
499
  }
222
500
 
223
- // Ask the IDE first — affects which features end up enabled later.
224
- const ide = await pickIde(base.ide.primary);
501
+ // Ask the IDE targets first — affects which features end up enabled later.
502
+ const ides = await doIdes(base.ide.targets);
225
503
 
226
504
  let plugins;
227
505
  try {
228
- plugins = await pickPlugins(base);
506
+ plugins = await doPlugins(base);
229
507
  } catch (err) {
230
- prompts.log.error(`Failed to load plugins: ${err.message}`);
231
- prompts.cancel("Setup cannot continue. Fix plugin manifests and retry.");
508
+ p.log.error(`Failed to load plugins: ${err.message}`);
509
+ p.cancel("Setup cannot continue. Fix plugin manifests and retry.");
232
510
  process.exit(1);
233
511
  }
234
- const personalization = await personalizationPrompts(base.personalization);
235
-
236
- // Behavior presets only apply when the target IDE supports hooks.
237
- // Non-claude-code IDEs would ignore the toggles, so don't ask.
238
- const ideCaps = capabilitiesFor(ide);
239
- const behaviors = ideCaps.hooks
240
- ? await pickBehaviors(base.behaviors)
512
+ // Behavior presets only apply when AT LEAST ONE selected IDE supports
513
+ // hooks. Cursor/Windsurf/Codex would ignore the toggles, so skip if
514
+ // none of the targets accept them.
515
+ const targetCaps = ides.map((id) => capabilitiesFor(id));
516
+ const anyHooks = targetCaps.some((c) => c.hooks);
517
+ const supportedHookEvents = hookEventsForIdes(ides);
518
+ const anySkills = targetCaps.some((c) => c.skills);
519
+ const behaviors = anyHooks
520
+ ? await doBehaviors(base.behaviors, supportedHookEvents)
241
521
  : base.behaviors;
242
522
 
523
+ const babysit = await doBabysit(
524
+ base.plugins &&
525
+ base.plugins.core &&
526
+ base.plugins.core.settings &&
527
+ base.plugins.core.settings.babysit,
528
+ );
529
+
530
+ const learnings = anySkills
531
+ ? await doLearnings(base.learnings)
532
+ : base.learnings;
533
+
243
534
  /** @type {import('../../runtime/config/defaults.js').AgileflowConfig} */
244
535
  const next = {
245
536
  ...base,
246
537
  plugins,
247
- personalization,
538
+ install: { scope },
248
539
  behaviors,
249
- ide: { primary: /** @type {any} */ (ide) },
540
+ learnings,
541
+ ide: { targets: /** @type {any} */ (ides) },
542
+ };
543
+ next.plugins.core = next.plugins.core || { enabled: true };
544
+ next.plugins.core.settings = {
545
+ ...(next.plugins.core.settings || {}),
546
+ babysit,
250
547
  };
251
548
 
252
- const writeSpinner = prompts.spinner();
549
+ const writeSpinner = p.spinner();
253
550
  writeSpinner.start("Writing agileflow.config.json");
254
- const file = await writeConfigWithFeedback(cwd, next, {
551
+ const file = await writeConfigWithFeedback(roots.configRoot, next, {
255
552
  interactive: true,
256
553
  spinner: writeSpinner,
257
554
  });
@@ -261,32 +558,80 @@ async function setup(options = {}) {
261
558
  .filter(([, v]) => v && v.enabled)
262
559
  .map(([id]) => id);
263
560
 
264
- const installSpinner = prompts.spinner();
265
- installSpinner.start(`Installing ${enabledList.length} plugin(s)`);
561
+ const installSpinner = p.spinner();
562
+ installSpinner.start(`Installing ${enabledList.length} skill pack(s)`);
266
563
  const installResult = await runInstallWithFeedback(
267
564
  enabledList,
268
- cwd,
269
- ide,
565
+ roots,
566
+ ides,
270
567
  behaviors,
568
+ Boolean(learnings && learnings.enabled),
569
+ next,
271
570
  { interactive: true, spinner: installSpinner },
272
571
  );
273
572
  installSpinner.stop(
274
573
  `Installed: created=${installResult.ops.created} updated=${installResult.ops.updated} unchanged=${installResult.ops.unchanged} preserved=${installResult.ops.preserved} removed=${installResult.ops.removed}`,
275
574
  );
276
575
 
277
- prompts.outro(
576
+ // Stale-artifact check — fires after a successful install so users
577
+ // get prompted at the moment they're paying attention to their
578
+ // install state. Scan the resolved install root so a global-scope
579
+ // install checks ~/.agileflow, not cwd. Forward the injected
580
+ // prompts stub so tests don't hit the real interactive confirm.
581
+ const cleanup = await runPostInstallCleanup(
582
+ roots.ideRoot,
583
+ { interactive: true },
584
+ { prompts: p },
585
+ );
586
+
587
+ // Surface behaviors state in the outro. With behaviors gated, a user
588
+ // who deselected all four ends up with zero hooks running — they
589
+ // need to know that explicitly, not infer it from "X plugins enabled".
590
+ const activeBehaviors = anyHooks
591
+ ? Object.entries(behaviors || {})
592
+ .filter(([, v]) => v)
593
+ .map(([k]) => k)
594
+ : [];
595
+ const behaviorsLine = anyHooks
596
+ ? activeBehaviors.length
597
+ ? `behaviors active: ${activeBehaviors.join(", ")}`
598
+ : "behaviors active: (none — no hooks will run; re-run setup to enable)"
599
+ : `hooks not supported by ${ides.join(", ")} — behaviors skipped`;
600
+
601
+ p.outro(
278
602
  [
279
- `${enabledList.length} plugin(s) enabled: ${enabledList.join(", ")}`,
603
+ `${enabledList.length} skill pack(s) enabled: ${enabledList.join(", ")}`,
604
+ `scope: ${scope}`,
605
+ `babysit mode: ${babysit.mode}`,
606
+ behaviorsLine,
280
607
  installResult.ops.preserved
281
608
  ? `${installResult.ops.preserved} file(s) preserved (your edits) — review .agileflow/_cfg/updates/`
282
609
  : "",
283
- "",
284
- "Phase 3+ will land hooks, Core content, and the publish pipeline.",
610
+ cleanup.summary || "",
285
611
  ]
286
612
  .filter(Boolean)
287
613
  .join("\n"),
288
614
  );
289
615
  }
290
616
 
617
+ /**
618
+ * Dispatcher: pick the interactive wizard or the non-interactive
619
+ * `--yes` path based on the options flag. Both flows are
620
+ * self-contained; this function carries no shared state.
621
+ *
622
+ * @param {{ yes?: boolean, plugins?: string, ide?: string, scope?: string }} options
623
+ */
624
+ async function setup(options = {}) {
625
+ const cwd = process.cwd();
626
+ if (options.yes) return setupNonInteractive(options, cwd);
627
+ return setupInteractive(options, cwd);
628
+ }
629
+
291
630
  module.exports = setup;
631
+ module.exports.setupInteractive = setupInteractive;
632
+ module.exports.setupNonInteractive = setupNonInteractive;
292
633
  module.exports.pluginsFromCsv = pluginsFromCsv;
634
+ module.exports.resolveIdeTargets = resolveIdeTargets;
635
+ module.exports.resolveInstallScope = resolveInstallScope;
636
+ module.exports.installPathsForScope = installPathsForScope;
637
+ module.exports.runPostInstallCleanup = runPostInstallCleanup;