drt-method 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 (299) hide show
  1. package/AGENTS.md +45 -0
  2. package/GETTING-STARTED.md +269 -0
  3. package/README.md +233 -0
  4. package/drt-method-1.0.0.tgz +0 -0
  5. package/drt-modules.yaml +1 -0
  6. package/package.json +51 -0
  7. package/scripts/install-from-github.ps1 +22 -0
  8. package/scripts/install-from-github.sh +17 -0
  9. package/src/core-skills/drt-advanced-elicitation/SKILL.md +142 -0
  10. package/src/core-skills/drt-advanced-elicitation/methods.csv +72 -0
  11. package/src/core-skills/drt-brainstorming/SKILL.md +80 -0
  12. package/src/core-skills/drt-brainstorming/assets/brain-icons.json +166 -0
  13. package/src/core-skills/drt-brainstorming/assets/brain-methods.csv +109 -0
  14. package/src/core-skills/drt-brainstorming/assets/brain-selector.html +326 -0
  15. package/src/core-skills/drt-brainstorming/customize.toml +84 -0
  16. package/src/core-skills/drt-brainstorming/references/converge.md +24 -0
  17. package/src/core-skills/drt-brainstorming/references/finalize.md +26 -0
  18. package/src/core-skills/drt-brainstorming/references/headless.md +54 -0
  19. package/src/core-skills/drt-brainstorming/references/in-chat-techniques.md +18 -0
  20. package/src/core-skills/drt-brainstorming/references/mode-autonomous.md +10 -0
  21. package/src/core-skills/drt-brainstorming/references/mode-facilitator.md +11 -0
  22. package/src/core-skills/drt-brainstorming/references/mode-partner.md +16 -0
  23. package/src/core-skills/drt-brainstorming/references/resume.md +5 -0
  24. package/src/core-skills/drt-brainstorming/scripts/brain.py +740 -0
  25. package/src/core-skills/drt-customize/SKILL.md +111 -0
  26. package/src/core-skills/drt-customize/scripts/list_customizable_skills.py +231 -0
  27. package/src/core-skills/drt-editorial-review-prose/SKILL.md +86 -0
  28. package/src/core-skills/drt-editorial-review-structure/SKILL.md +179 -0
  29. package/src/core-skills/drt-forge-idea/SKILL.md +107 -0
  30. package/src/core-skills/drt-forge-idea/customize.toml +42 -0
  31. package/src/core-skills/drt-forge-idea/scripts/resolve_personas.py +270 -0
  32. package/src/core-skills/drt-help/SKILL.md +75 -0
  33. package/src/core-skills/drt-index-docs/SKILL.md +66 -0
  34. package/src/core-skills/drt-party-mode/SKILL.md +60 -0
  35. package/src/core-skills/drt-party-mode/customize.toml +211 -0
  36. package/src/core-skills/drt-party-mode/references/create-party.md +70 -0
  37. package/src/core-skills/drt-party-mode/references/mode-agent-team.md +13 -0
  38. package/src/core-skills/drt-party-mode/references/mode-auto.md +13 -0
  39. package/src/core-skills/drt-party-mode/references/mode-subagent.md +31 -0
  40. package/src/core-skills/drt-party-mode/references/party-memory.md +51 -0
  41. package/src/core-skills/drt-party-mode/scripts/resolve_party.py +272 -0
  42. package/src/core-skills/drt-review-adversarial-general/SKILL.md +37 -0
  43. package/src/core-skills/drt-review-edge-case-hunter/SKILL.md +73 -0
  44. package/src/core-skills/drt-review-edge-case-hunter/references/deletion-check.md +14 -0
  45. package/src/core-skills/drt-review-verification-gap/SKILL.md +106 -0
  46. package/src/core-skills/drt-shard-doc/SKILL.md +105 -0
  47. package/src/core-skills/drt-spec/SKILL.md +160 -0
  48. package/src/core-skills/drt-spec/assets/headless-schemas.md +33 -0
  49. package/src/core-skills/drt-spec/assets/spec-template.md +49 -0
  50. package/src/core-skills/drt-spec/assets/stories-schema.md +44 -0
  51. package/src/core-skills/drt-spec/customize.toml +53 -0
  52. package/src/core-skills/module-help.csv +14 -0
  53. package/src/core-skills/module.yaml +33 -0
  54. package/src/drt-skills/1-analysis/drt-agent-analyst/SKILL.md +76 -0
  55. package/src/drt-skills/1-analysis/drt-agent-analyst/customize.toml +90 -0
  56. package/src/drt-skills/1-analysis/drt-agent-tech-writer/SKILL.md +76 -0
  57. package/src/drt-skills/1-analysis/drt-agent-tech-writer/customize.toml +81 -0
  58. package/src/drt-skills/1-analysis/drt-agent-tech-writer/explain-concept.md +20 -0
  59. package/src/drt-skills/1-analysis/drt-agent-tech-writer/mermaid-gen.md +20 -0
  60. package/src/drt-skills/1-analysis/drt-agent-tech-writer/validate-doc.md +19 -0
  61. package/src/drt-skills/1-analysis/drt-agent-tech-writer/write-document.md +20 -0
  62. package/src/drt-skills/1-analysis/drt-document-project/SKILL.md +62 -0
  63. package/src/drt-skills/1-analysis/drt-document-project/checklist.md +245 -0
  64. package/src/drt-skills/1-analysis/drt-document-project/customize.toml +41 -0
  65. package/src/drt-skills/1-analysis/drt-document-project/documentation-requirements.csv +12 -0
  66. package/src/drt-skills/1-analysis/drt-document-project/instructions.md +128 -0
  67. package/src/drt-skills/1-analysis/drt-document-project/templates/deep-dive-template.md +345 -0
  68. package/src/drt-skills/1-analysis/drt-document-project/templates/index-template.md +169 -0
  69. package/src/drt-skills/1-analysis/drt-document-project/templates/project-overview-template.md +103 -0
  70. package/src/drt-skills/1-analysis/drt-document-project/templates/project-scan-report-schema.json +160 -0
  71. package/src/drt-skills/1-analysis/drt-document-project/templates/source-tree-template.md +135 -0
  72. package/src/drt-skills/1-analysis/drt-document-project/workflows/deep-dive-instructions.md +300 -0
  73. package/src/drt-skills/1-analysis/drt-document-project/workflows/deep-dive-workflow.md +34 -0
  74. package/src/drt-skills/1-analysis/drt-document-project/workflows/full-scan-instructions.md +1111 -0
  75. package/src/drt-skills/1-analysis/drt-document-project/workflows/full-scan-workflow.md +34 -0
  76. package/src/drt-skills/1-analysis/drt-prfaq/SKILL.md +135 -0
  77. package/src/drt-skills/1-analysis/drt-prfaq/agents/artifact-analyzer.md +60 -0
  78. package/src/drt-skills/1-analysis/drt-prfaq/agents/web-researcher.md +49 -0
  79. package/src/drt-skills/1-analysis/drt-prfaq/assets/prfaq-template.md +62 -0
  80. package/src/drt-skills/1-analysis/drt-prfaq/bmad-manifest.json +16 -0
  81. package/src/drt-skills/1-analysis/drt-prfaq/customize.toml +41 -0
  82. package/src/drt-skills/1-analysis/drt-prfaq/references/customer-faq.md +55 -0
  83. package/src/drt-skills/1-analysis/drt-prfaq/references/internal-faq.md +51 -0
  84. package/src/drt-skills/1-analysis/drt-prfaq/references/press-release.md +60 -0
  85. package/src/drt-skills/1-analysis/drt-prfaq/references/verdict.md +83 -0
  86. package/src/drt-skills/1-analysis/drt-product-brief/SKILL.md +91 -0
  87. package/src/drt-skills/1-analysis/drt-product-brief/assets/brief-template.md +41 -0
  88. package/src/drt-skills/1-analysis/drt-product-brief/customize.toml +99 -0
  89. package/src/drt-skills/1-analysis/research/drt-domain-research/SKILL.md +96 -0
  90. package/src/drt-skills/1-analysis/research/drt-domain-research/customize.toml +41 -0
  91. package/src/drt-skills/1-analysis/research/drt-domain-research/domain-steps/step-01-init.md +137 -0
  92. package/src/drt-skills/1-analysis/research/drt-domain-research/domain-steps/step-02-domain-analysis.md +229 -0
  93. package/src/drt-skills/1-analysis/research/drt-domain-research/domain-steps/step-03-competitive-landscape.md +238 -0
  94. package/src/drt-skills/1-analysis/research/drt-domain-research/domain-steps/step-04-regulatory-focus.md +206 -0
  95. package/src/drt-skills/1-analysis/research/drt-domain-research/domain-steps/step-05-technical-trends.md +234 -0
  96. package/src/drt-skills/1-analysis/research/drt-domain-research/domain-steps/step-06-research-synthesis.md +450 -0
  97. package/src/drt-skills/1-analysis/research/drt-domain-research/research.template.md +29 -0
  98. package/src/drt-skills/1-analysis/research/drt-market-research/SKILL.md +96 -0
  99. package/src/drt-skills/1-analysis/research/drt-market-research/customize.toml +41 -0
  100. package/src/drt-skills/1-analysis/research/drt-market-research/research.template.md +29 -0
  101. package/src/drt-skills/1-analysis/research/drt-market-research/steps/step-01-init.md +184 -0
  102. package/src/drt-skills/1-analysis/research/drt-market-research/steps/step-02-customer-behavior.md +239 -0
  103. package/src/drt-skills/1-analysis/research/drt-market-research/steps/step-03-customer-pain-points.md +251 -0
  104. package/src/drt-skills/1-analysis/research/drt-market-research/steps/step-04-customer-decisions.md +261 -0
  105. package/src/drt-skills/1-analysis/research/drt-market-research/steps/step-05-competitive-analysis.md +173 -0
  106. package/src/drt-skills/1-analysis/research/drt-market-research/steps/step-06-research-completion.md +484 -0
  107. package/src/drt-skills/1-analysis/research/drt-technical-research/SKILL.md +96 -0
  108. package/src/drt-skills/1-analysis/research/drt-technical-research/customize.toml +41 -0
  109. package/src/drt-skills/1-analysis/research/drt-technical-research/research.template.md +29 -0
  110. package/src/drt-skills/1-analysis/research/drt-technical-research/technical-steps/step-01-init.md +137 -0
  111. package/src/drt-skills/1-analysis/research/drt-technical-research/technical-steps/step-02-technical-overview.md +239 -0
  112. package/src/drt-skills/1-analysis/research/drt-technical-research/technical-steps/step-03-integration-patterns.md +248 -0
  113. package/src/drt-skills/1-analysis/research/drt-technical-research/technical-steps/step-04-architectural-patterns.md +202 -0
  114. package/src/drt-skills/1-analysis/research/drt-technical-research/technical-steps/step-05-implementation-research.md +233 -0
  115. package/src/drt-skills/1-analysis/research/drt-technical-research/technical-steps/step-06-research-synthesis.md +493 -0
  116. package/src/drt-skills/2-plan-workflows/drt-agent-pm/SKILL.md +76 -0
  117. package/src/drt-skills/2-plan-workflows/drt-agent-pm/customize.toml +75 -0
  118. package/src/drt-skills/2-plan-workflows/drt-agent-ux-designer/SKILL.md +76 -0
  119. package/src/drt-skills/2-plan-workflows/drt-agent-ux-designer/customize.toml +60 -0
  120. package/src/drt-skills/2-plan-workflows/drt-create-prd/SKILL.md +30 -0
  121. package/src/drt-skills/2-plan-workflows/drt-create-prd/customize.toml +41 -0
  122. package/src/drt-skills/2-plan-workflows/drt-edit-prd/SKILL.md +30 -0
  123. package/src/drt-skills/2-plan-workflows/drt-edit-prd/customize.toml +42 -0
  124. package/src/drt-skills/2-plan-workflows/drt-prd/SKILL.md +92 -0
  125. package/src/drt-skills/2-plan-workflows/drt-prd/assets/headless-schemas.md +76 -0
  126. package/src/drt-skills/2-plan-workflows/drt-prd/assets/prd-template.md +165 -0
  127. package/src/drt-skills/2-plan-workflows/drt-prd/assets/prd-validation-checklist.md +135 -0
  128. package/src/drt-skills/2-plan-workflows/drt-prd/assets/validation-report-template.html +325 -0
  129. package/src/drt-skills/2-plan-workflows/drt-prd/customize.toml +147 -0
  130. package/src/drt-skills/2-plan-workflows/drt-prd/references/headless.md +39 -0
  131. package/src/drt-skills/2-plan-workflows/drt-prd/references/validate.md +97 -0
  132. package/src/drt-skills/2-plan-workflows/drt-ux/SKILL.md +90 -0
  133. package/src/drt-skills/2-plan-workflows/drt-ux/assets/color-themes.md +9 -0
  134. package/src/drt-skills/2-plan-workflows/drt-ux/assets/design-directions.md +9 -0
  135. package/src/drt-skills/2-plan-workflows/drt-ux/assets/design-example-editorial.md +158 -0
  136. package/src/drt-skills/2-plan-workflows/drt-ux/assets/design-example-mobile.md +93 -0
  137. package/src/drt-skills/2-plan-workflows/drt-ux/assets/design-example-shadcn.md +109 -0
  138. package/src/drt-skills/2-plan-workflows/drt-ux/assets/excalidraw-wireframe.md +19 -0
  139. package/src/drt-skills/2-plan-workflows/drt-ux/assets/experience-example-mobile.md +112 -0
  140. package/src/drt-skills/2-plan-workflows/drt-ux/assets/experience-example-shadcn.md +133 -0
  141. package/src/drt-skills/2-plan-workflows/drt-ux/assets/headless-schemas.md +84 -0
  142. package/src/drt-skills/2-plan-workflows/drt-ux/assets/key-screens.md +29 -0
  143. package/src/drt-skills/2-plan-workflows/drt-ux/assets/validation-report-template.html +319 -0
  144. package/src/drt-skills/2-plan-workflows/drt-ux/customize.toml +100 -0
  145. package/src/drt-skills/2-plan-workflows/drt-ux/references/creative-tools.md +19 -0
  146. package/src/drt-skills/2-plan-workflows/drt-ux/references/design-md-spec.md +50 -0
  147. package/src/drt-skills/2-plan-workflows/drt-ux/references/headless.md +37 -0
  148. package/src/drt-skills/2-plan-workflows/drt-ux/references/validate.md +115 -0
  149. package/src/drt-skills/2-plan-workflows/drt-validate-prd/SKILL.md +30 -0
  150. package/src/drt-skills/2-plan-workflows/drt-validate-prd/customize.toml +42 -0
  151. package/src/drt-skills/3-solutioning/drt-agent-architect/SKILL.md +76 -0
  152. package/src/drt-skills/3-solutioning/drt-agent-architect/customize.toml +65 -0
  153. package/src/drt-skills/3-solutioning/drt-architecture/SKILL.md +85 -0
  154. package/src/drt-skills/3-solutioning/drt-architecture/assets/spine-template.md +79 -0
  155. package/src/drt-skills/3-solutioning/drt-architecture/customize.toml +100 -0
  156. package/src/drt-skills/3-solutioning/drt-architecture/references/headless.md +26 -0
  157. package/src/drt-skills/3-solutioning/drt-architecture/references/reviewer-gate.md +13 -0
  158. package/src/drt-skills/3-solutioning/drt-architecture/scripts/lint_spine.py +257 -0
  159. package/src/drt-skills/3-solutioning/drt-check-implementation-readiness/SKILL.md +91 -0
  160. package/src/drt-skills/3-solutioning/drt-check-implementation-readiness/customize.toml +41 -0
  161. package/src/drt-skills/3-solutioning/drt-check-implementation-readiness/steps/step-01-document-discovery.md +179 -0
  162. package/src/drt-skills/3-solutioning/drt-check-implementation-readiness/steps/step-02-prd-analysis.md +168 -0
  163. package/src/drt-skills/3-solutioning/drt-check-implementation-readiness/steps/step-03-epic-coverage-validation.md +169 -0
  164. package/src/drt-skills/3-solutioning/drt-check-implementation-readiness/steps/step-04-ux-alignment.md +129 -0
  165. package/src/drt-skills/3-solutioning/drt-check-implementation-readiness/steps/step-05-epic-quality-review.md +241 -0
  166. package/src/drt-skills/3-solutioning/drt-check-implementation-readiness/steps/step-06-final-assessment.md +132 -0
  167. package/src/drt-skills/3-solutioning/drt-check-implementation-readiness/templates/readiness-report-template.md +4 -0
  168. package/src/drt-skills/3-solutioning/drt-create-architecture/SKILL.md +30 -0
  169. package/src/drt-skills/3-solutioning/drt-create-architecture/customize.toml +41 -0
  170. package/src/drt-skills/3-solutioning/drt-create-epics-and-stories/SKILL.md +93 -0
  171. package/src/drt-skills/3-solutioning/drt-create-epics-and-stories/customize.toml +41 -0
  172. package/src/drt-skills/3-solutioning/drt-create-epics-and-stories/steps/step-01-validate-prerequisites.md +263 -0
  173. package/src/drt-skills/3-solutioning/drt-create-epics-and-stories/steps/step-02-design-epics.md +242 -0
  174. package/src/drt-skills/3-solutioning/drt-create-epics-and-stories/steps/step-03-create-stories.md +255 -0
  175. package/src/drt-skills/3-solutioning/drt-create-epics-and-stories/steps/step-04-final-validation.md +143 -0
  176. package/src/drt-skills/3-solutioning/drt-create-epics-and-stories/templates/epics-template.md +61 -0
  177. package/src/drt-skills/3-solutioning/drt-generate-project-context/SKILL.md +81 -0
  178. package/src/drt-skills/3-solutioning/drt-generate-project-context/customize.toml +41 -0
  179. package/src/drt-skills/3-solutioning/drt-generate-project-context/project-context-template.md +21 -0
  180. package/src/drt-skills/3-solutioning/drt-generate-project-context/steps/step-01-discover.md +186 -0
  181. package/src/drt-skills/3-solutioning/drt-generate-project-context/steps/step-02-generate.md +321 -0
  182. package/src/drt-skills/3-solutioning/drt-generate-project-context/steps/step-03-complete.md +284 -0
  183. package/src/drt-skills/4-implementation/drt-agent-dev/SKILL.md +76 -0
  184. package/src/drt-skills/4-implementation/drt-agent-dev/customize.toml +95 -0
  185. package/src/drt-skills/4-implementation/drt-checkpoint-preview/SKILL.md +68 -0
  186. package/src/drt-skills/4-implementation/drt-checkpoint-preview/customize.toml +41 -0
  187. package/src/drt-skills/4-implementation/drt-checkpoint-preview/generate-trail.md +38 -0
  188. package/src/drt-skills/4-implementation/drt-checkpoint-preview/step-01-orientation.md +105 -0
  189. package/src/drt-skills/4-implementation/drt-checkpoint-preview/step-02-walkthrough.md +89 -0
  190. package/src/drt-skills/4-implementation/drt-checkpoint-preview/step-03-detail-pass.md +106 -0
  191. package/src/drt-skills/4-implementation/drt-checkpoint-preview/step-04-testing.md +74 -0
  192. package/src/drt-skills/4-implementation/drt-checkpoint-preview/step-05-wrapup.md +30 -0
  193. package/src/drt-skills/4-implementation/drt-code-review/SKILL.md +90 -0
  194. package/src/drt-skills/4-implementation/drt-code-review/customize.toml +93 -0
  195. package/src/drt-skills/4-implementation/drt-code-review/steps/step-01-gather-context.md +84 -0
  196. package/src/drt-skills/4-implementation/drt-code-review/steps/step-02-review.md +32 -0
  197. package/src/drt-skills/4-implementation/drt-code-review/steps/step-03-triage.md +50 -0
  198. package/src/drt-skills/4-implementation/drt-code-review/steps/step-04-present.md +132 -0
  199. package/src/drt-skills/4-implementation/drt-correct-course/SKILL.md +301 -0
  200. package/src/drt-skills/4-implementation/drt-correct-course/checklist.md +288 -0
  201. package/src/drt-skills/4-implementation/drt-correct-course/customize.toml +41 -0
  202. package/src/drt-skills/4-implementation/drt-create-story/SKILL.md +432 -0
  203. package/src/drt-skills/4-implementation/drt-create-story/checklist.md +357 -0
  204. package/src/drt-skills/4-implementation/drt-create-story/customize.toml +41 -0
  205. package/src/drt-skills/4-implementation/drt-create-story/discover-inputs.md +88 -0
  206. package/src/drt-skills/4-implementation/drt-create-story/template.md +49 -0
  207. package/src/drt-skills/4-implementation/drt-dev-auto/SKILL.md +123 -0
  208. package/src/drt-skills/4-implementation/drt-dev-auto/compile-epic-context.md +62 -0
  209. package/src/drt-skills/4-implementation/drt-dev-auto/customize.toml +108 -0
  210. package/src/drt-skills/4-implementation/drt-dev-auto/spec-template.md +98 -0
  211. package/src/drt-skills/4-implementation/drt-dev-auto/step-01-clarify-and-route.md +84 -0
  212. package/src/drt-skills/4-implementation/drt-dev-auto/step-02-plan.md +31 -0
  213. package/src/drt-skills/4-implementation/drt-dev-auto/step-03-implement.md +42 -0
  214. package/src/drt-skills/4-implementation/drt-dev-auto/step-04-review.md +95 -0
  215. package/src/drt-skills/4-implementation/drt-dev-story/SKILL.md +500 -0
  216. package/src/drt-skills/4-implementation/drt-dev-story/checklist.md +80 -0
  217. package/src/drt-skills/4-implementation/drt-dev-story/customize.toml +41 -0
  218. package/src/drt-skills/4-implementation/drt-implement-task/SKILL.md +101 -0
  219. package/src/drt-skills/4-implementation/drt-implement-task/assets/task-spec-template.md +60 -0
  220. package/src/drt-skills/4-implementation/drt-implement-task/customize.toml +17 -0
  221. package/src/drt-skills/4-implementation/drt-implement-task/steps/step-01-gather-intent.md +42 -0
  222. package/src/drt-skills/4-implementation/drt-implement-task/steps/step-02-plan-and-approve.md +43 -0
  223. package/src/drt-skills/4-implementation/drt-implement-task/steps/step-03-confirm-dependencies.md +38 -0
  224. package/src/drt-skills/4-implementation/drt-implement-task/steps/step-04-implement.md +42 -0
  225. package/src/drt-skills/4-implementation/drt-implement-task/steps/step-05-qc-test.md +31 -0
  226. package/src/drt-skills/4-implementation/drt-implement-task/steps/step-06-quality-review.md +30 -0
  227. package/src/drt-skills/4-implementation/drt-implement-task/steps/step-07-fix-findings.md +33 -0
  228. package/src/drt-skills/4-implementation/drt-implement-task/steps/step-08-complete.md +35 -0
  229. package/src/drt-skills/4-implementation/drt-qa-generate-e2e-tests/SKILL.md +176 -0
  230. package/src/drt-skills/4-implementation/drt-qa-generate-e2e-tests/checklist.md +33 -0
  231. package/src/drt-skills/4-implementation/drt-qa-generate-e2e-tests/customize.toml +41 -0
  232. package/src/drt-skills/4-implementation/drt-quick-dev/SKILL.md +13 -0
  233. package/src/drt-skills/4-implementation/drt-quick-dev/compile-epic-context.md +62 -0
  234. package/src/drt-skills/4-implementation/drt-quick-dev/customize.toml +83 -0
  235. package/src/drt-skills/4-implementation/drt-quick-dev/render.js +206 -0
  236. package/src/drt-skills/4-implementation/drt-quick-dev/spec-template.md +89 -0
  237. package/src/drt-skills/4-implementation/drt-quick-dev/step-01-clarify-and-route.md +103 -0
  238. package/src/drt-skills/4-implementation/drt-quick-dev/step-02-plan.md +47 -0
  239. package/src/drt-skills/4-implementation/drt-quick-dev/step-03-implement.md +45 -0
  240. package/src/drt-skills/4-implementation/drt-quick-dev/step-04-review.md +55 -0
  241. package/src/drt-skills/4-implementation/drt-quick-dev/step-05-present.md +78 -0
  242. package/src/drt-skills/4-implementation/drt-quick-dev/step-oneshot.md +78 -0
  243. package/src/drt-skills/4-implementation/drt-quick-dev/sync-sprint-status.md +19 -0
  244. package/src/drt-skills/4-implementation/drt-quick-dev/workflow.md +85 -0
  245. package/src/drt-skills/4-implementation/drt-retrospective/SKILL.md +1527 -0
  246. package/src/drt-skills/4-implementation/drt-retrospective/customize.toml +41 -0
  247. package/src/drt-skills/4-implementation/drt-sprint-planning/SKILL.md +319 -0
  248. package/src/drt-skills/4-implementation/drt-sprint-planning/checklist.md +34 -0
  249. package/src/drt-skills/4-implementation/drt-sprint-planning/customize.toml +41 -0
  250. package/src/drt-skills/4-implementation/drt-sprint-planning/sprint-status-template.yaml +69 -0
  251. package/src/drt-skills/4-implementation/drt-sprint-status/SKILL.md +311 -0
  252. package/src/drt-skills/4-implementation/drt-sprint-status/customize.toml +41 -0
  253. package/src/drt-skills/module-help.csv +32 -0
  254. package/src/drt-skills/module.yaml +95 -0
  255. package/src/scripts/lib/load-toml.js +43 -0
  256. package/src/scripts/lib/merge-utils.js +89 -0
  257. package/src/scripts/memlog.js +184 -0
  258. package/src/scripts/package.json +7 -0
  259. package/src/scripts/resolve-config.js +56 -0
  260. package/src/scripts/resolve-customization.js +77 -0
  261. package/tools/installer/cli-utils.js +53 -0
  262. package/tools/installer/commands/install.js +149 -0
  263. package/tools/installer/commands/status.js +65 -0
  264. package/tools/installer/commands/uninstall.js +167 -0
  265. package/tools/installer/core/config.js +73 -0
  266. package/tools/installer/core/existing-install.js +121 -0
  267. package/tools/installer/core/install-paths.js +132 -0
  268. package/tools/installer/core/installer.js +1762 -0
  269. package/tools/installer/core/legacy-warnings.js +151 -0
  270. package/tools/installer/core/manifest-generator.js +859 -0
  271. package/tools/installer/core/manifest.js +433 -0
  272. package/tools/installer/core/uv-check.js +97 -0
  273. package/tools/installer/core/wsl-node-check.js +109 -0
  274. package/tools/installer/drt-cli.js +104 -0
  275. package/tools/installer/file-ops.js +204 -0
  276. package/tools/installer/fs-native.js +116 -0
  277. package/tools/installer/ide/_config-driven.js +972 -0
  278. package/tools/installer/ide/manager.js +324 -0
  279. package/tools/installer/ide/platform-codes.js +80 -0
  280. package/tools/installer/ide/platform-codes.yaml +343 -0
  281. package/tools/installer/ide/shared/installed-skills.js +50 -0
  282. package/tools/installer/ide/shared/path-utils.js +217 -0
  283. package/tools/installer/ide/shared/skill-manifest.js +57 -0
  284. package/tools/installer/install-messages.yaml +29 -0
  285. package/tools/installer/list-options.js +210 -0
  286. package/tools/installer/message-loader.js +83 -0
  287. package/tools/installer/modules/channel-plan.js +203 -0
  288. package/tools/installer/modules/channel-resolver.js +241 -0
  289. package/tools/installer/modules/custom-module-manager.js +918 -0
  290. package/tools/installer/modules/external-manager.js +667 -0
  291. package/tools/installer/modules/module-help-schema.js +13 -0
  292. package/tools/installer/modules/official-modules.js +2257 -0
  293. package/tools/installer/modules/plugin-resolver.js +398 -0
  294. package/tools/installer/modules/version-resolver.js +336 -0
  295. package/tools/installer/project-root.js +224 -0
  296. package/tools/installer/prompts.js +852 -0
  297. package/tools/installer/set-overrides.js +330 -0
  298. package/tools/installer/ui.js +2090 -0
  299. package/tools/installer/yaml-format.js +245 -0
@@ -0,0 +1,972 @@
1
+ const path = require('node:path');
2
+ const fs = require('../fs-native');
3
+ const yaml = require('yaml');
4
+ const prompts = require('../prompts');
5
+ const csv = require('csv-parse/sync');
6
+ const { DRT_FOLDER_NAME } = require('./shared/path-utils');
7
+ const { getInstalledCanonicalIds, isDrtOwnedEntry } = require('./shared/installed-skills');
8
+
9
+ // Reserved OpenCode slash commands. A skill whose canonicalId collides with
10
+ // one of these is skipped during command-pointer generation so it doesn't
11
+ // shadow a built-in.
12
+ const RESERVED_OPENCODE_COMMANDS = new Set([
13
+ 'review',
14
+ 'commit',
15
+ 'init',
16
+ 'help',
17
+ 'skills',
18
+ 'fast',
19
+ 'compact',
20
+ 'clear',
21
+ 'undo',
22
+ 'redo',
23
+ 'edit',
24
+ 'editor',
25
+ 'exit',
26
+ 'quit',
27
+ 'theme',
28
+ 'config',
29
+ 'model',
30
+ 'session',
31
+ ]);
32
+
33
+ // Wrap a description for safe insertion into single-line YAML frontmatter.
34
+ // Leaves plain values untouched; double-quotes (and escapes) anything that
35
+ // could break YAML parsing or span multiple lines.
36
+ function yamlSafeSingleLine(value) {
37
+ const collapsed = String(value)
38
+ .replaceAll(/[\r\n]+/g, ' ')
39
+ .trim();
40
+ const needsQuoting = /[:#'"\\]/.test(collapsed) || /^[!&*?|>%@`[{]/.test(collapsed);
41
+ if (!needsQuoting) return collapsed;
42
+ const escaped = collapsed.replaceAll('\\', '\\\\').replaceAll('"', String.raw`\"`);
43
+ return `"${escaped}"`;
44
+ }
45
+
46
+ // Validate that a canonicalId is a safe basename — no path separators, no
47
+ // parent-dir traversal, no leading dots, only the character set we expect.
48
+ // Defense-in-depth: the manifest is trusted today, but the value flows
49
+ // directly into a file path and a malformed entry should not write outside
50
+ // the commands directory.
51
+ function isSafeCanonicalId(value) {
52
+ return typeof value === 'string' && /^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/.test(value) && !value.includes('..');
53
+ }
54
+
55
+ // Default body template for command pointer files. Used when a platform's
56
+ // installer config doesn't override `commands_body_template`. Matches
57
+ // OpenCode's native `@skills/<id>` skill-reference syntax.
58
+ const DEFAULT_COMMANDS_BODY_TEMPLATE = '@skills/{canonicalId}';
59
+
60
+ // Is this skill a persona agent (vs. a workflow/tool/standalone skill)?
61
+ // Used by platforms that surface only persona agents (e.g. Copilot's Custom
62
+ // Agents picker). Signal: the skill's source `customize.toml` has an
63
+ // `[agent]` section. This is the actual configuration source of truth —
64
+ // every DRT persona is configured via [agent] in its customize.toml,
65
+ // every workflow uses [workflow], every standalone skill has no
66
+ // customize.toml at all. Verified against the full installed manifest:
67
+ // catches exactly the 20 description-confirmed personas across BMM, CIS,
68
+ // GDS, WDS, TEA, and correctly excludes meta-skills like
69
+ // `drt-agent-builder` (a skill-builder workflow whose canonical id
70
+ // contains `-agent-` but which has no [agent] section because it isn't a
71
+ // persona itself).
72
+ //
73
+ // Reading the source toml — at install time the source skill directory
74
+ // (resolved from manifest record.path) still exists; cleanup runs later
75
+ // in the install flow.
76
+ async function isAgentSkill(record, drtDir) {
77
+ if (!record?.path || !drtDir) return false;
78
+ const drtFolderName = path.basename(drtDir);
79
+ const drtPrefix = drtFolderName + '/';
80
+ const relativePath = record.path.startsWith(drtPrefix) ? record.path.slice(drtPrefix.length) : record.path;
81
+ const tomlPath = path.join(drtDir, path.dirname(relativePath), 'customize.toml');
82
+ if (!(await fs.pathExists(tomlPath))) return false;
83
+ try {
84
+ const content = await fs.readFile(tomlPath, 'utf8');
85
+ return /^\[agent\]/m.test(content);
86
+ } catch {
87
+ return false;
88
+ }
89
+ }
90
+
91
+ // Resolve placeholders in a body template. Supported placeholders:
92
+ // {canonicalId} — the skill's canonical id
93
+ // {target_dir} — the platform's skill install directory (e.g. .agents/skills)
94
+ // {project-root} — left as a literal placeholder for the model/tool to expand
95
+ // at runtime; consistent with PR #1769's templates.
96
+ function expandBodyTemplate(template, { canonicalId, targetDir }) {
97
+ return template.replaceAll('{canonicalId}', canonicalId).replaceAll('{target_dir}', targetDir);
98
+ }
99
+
100
+ // The exact body the installer would generate for a given description and
101
+ // canonicalId, given the platform's body template. Centralised so both the
102
+ // write and the freshness-check paths agree on the canonical form.
103
+ function buildCommandPointerBody(description, canonicalId, { template, targetDir }) {
104
+ const bodyText = expandBodyTemplate(template, { canonicalId, targetDir });
105
+ return `---\ndescription: ${yamlSafeSingleLine(description)}\n---\n\n${bodyText}\n`;
106
+ }
107
+
108
+ // Heuristic: does an existing pointer file look like our generator's output
109
+ // (and therefore safe to refresh) versus a user-modified file (which we
110
+ // preserve)? We check the body shape rather than full equality so that
111
+ // description-only edits in the manifest can propagate without trampling
112
+ // hand edits to the body.
113
+ function looksLikeGeneratorOutput(content, canonicalId, { template, targetDir }) {
114
+ if (typeof content !== 'string') return false;
115
+ const trimmed = content.trim();
116
+ const expectedTail = expandBodyTemplate(template, { canonicalId, targetDir }).trim();
117
+ // Must end with the exact body our generator writes (post-expansion).
118
+ if (!trimmed.endsWith(expectedTail)) return false;
119
+ // Must start with frontmatter containing exactly one description: line.
120
+ const fmMatch = trimmed.match(/^---\n([\S\s]*?)\n---\n/);
121
+ if (!fmMatch) return false;
122
+ const fmLines = fmMatch[1].split('\n').filter((l) => l.length > 0);
123
+ if (fmLines.length !== 1) return false;
124
+ if (!fmLines[0].startsWith('description:')) return false;
125
+ return true;
126
+ }
127
+
128
+ /**
129
+ * Config-driven IDE setup handler
130
+ *
131
+ * This class provides a standardized way to install DRT artifacts to IDEs
132
+ * based on configuration in platform-codes.yaml. It eliminates the need for
133
+ * individual installer files for each IDE.
134
+ *
135
+ * Features:
136
+ * - Config-driven from platform-codes.yaml
137
+ * - Verbatim skill installation from skill-manifest.csv
138
+ * - IDE-specific marker removal (copilot-instructions, kilo modes, rovodev prompts)
139
+ */
140
+ class ConfigDrivenIdeSetup {
141
+ constructor(platformCode, platformConfig) {
142
+ this.name = platformCode;
143
+ this.displayName = platformConfig.name || platformCode;
144
+ this.preferred = platformConfig.preferred || false;
145
+ this.platformConfig = platformConfig;
146
+ this.installerConfig = platformConfig.installer || null;
147
+ this.drtFolderName = DRT_FOLDER_NAME;
148
+
149
+ // Set configDir from target_dir so detect() works
150
+ this.configDir = this.installerConfig?.target_dir || null;
151
+ }
152
+
153
+ setDrtFolderName(drtFolderName) {
154
+ this.drtFolderName = drtFolderName;
155
+ }
156
+
157
+ /**
158
+ * Detect whether this IDE already has configuration in the project.
159
+ * Checks for drt-prefixed entries in target_dir.
160
+ * @param {string} projectDir - Project directory
161
+ * @returns {Promise<boolean>}
162
+ */
163
+ async detect(projectDir) {
164
+ if (!this.configDir) return false;
165
+
166
+ const root = projectDir || process.cwd();
167
+ const dir = path.join(root, this.configDir);
168
+ if (!(await fs.pathExists(dir))) return false;
169
+
170
+ let entries;
171
+ try {
172
+ entries = await fs.readdir(dir);
173
+ } catch {
174
+ return false;
175
+ }
176
+
177
+ const drtDir = await this._findDrtDir(root);
178
+ const canonicalIds = await getInstalledCanonicalIds(drtDir);
179
+ return entries.some((e) => isDrtOwnedEntry(e, canonicalIds));
180
+ }
181
+
182
+ /**
183
+ * Main setup method - called by IdeManager
184
+ * @param {string} projectDir - Project directory
185
+ * @param {string} drtDir - DRT installation directory
186
+ * @param {Object} options - Setup options
187
+ * @returns {Promise<Object>} Setup result
188
+ */
189
+ async setup(projectDir, drtDir, options = {}) {
190
+ // Check for DRT files in ancestor directories that would cause duplicates
191
+ if (this.installerConfig?.ancestor_conflict_check) {
192
+ const conflict = await this.findAncestorConflict(projectDir);
193
+ if (conflict) {
194
+ await prompts.log.error(
195
+ `Found existing DRT skills in ancestor installation: ${conflict}\n` +
196
+ ` ${this.name} inherits skills from parent directories, so this would cause duplicates.\n` +
197
+ ` Please remove the DRT files from that directory first:\n` +
198
+ ` rm -rf "${conflict}"/_drt*`,
199
+ );
200
+ return {
201
+ success: false,
202
+ reason: 'ancestor-conflict',
203
+ error: `Ancestor conflict: ${conflict}`,
204
+ conflictDir: conflict,
205
+ };
206
+ }
207
+ }
208
+
209
+ if (!options.silent) await prompts.log.info(`Setting up ${this.name}...`);
210
+
211
+ // Clean up any old DRT installation first
212
+ await this.cleanup(projectDir, options, drtDir);
213
+
214
+ if (!this.installerConfig) {
215
+ return { success: false, reason: 'no-config' };
216
+ }
217
+
218
+ // When a peer platform in the same install batch owns this target_dir,
219
+ // skip the skill write — the peer has already populated it. Command
220
+ // pointers, however, write to a separate per-IDE directory and must
221
+ // still be generated for this IDE; they are not deduped across peers.
222
+ if (options.skipTarget) {
223
+ const results = { skills: 0, sharedTargetHandledByPeer: true };
224
+ if (this.installerConfig.commands_target_dir) {
225
+ results.commands = await this.installCommandPointers(projectDir, drtDir, this.installerConfig, options);
226
+ }
227
+ return { success: true, results };
228
+ }
229
+
230
+ if (this.installerConfig.target_dir) {
231
+ return this.installToTarget(projectDir, drtDir, this.installerConfig, options);
232
+ }
233
+
234
+ return { success: false, reason: 'invalid-config' };
235
+ }
236
+
237
+ /**
238
+ * Install to a single target directory
239
+ * @param {string} projectDir - Project directory
240
+ * @param {string} drtDir - DRT installation directory
241
+ * @param {Object} config - Installation configuration
242
+ * @param {Object} options - Setup options
243
+ * @returns {Promise<Object>} Installation result
244
+ */
245
+ async installToTarget(projectDir, drtDir, config, options) {
246
+ const { target_dir } = config;
247
+ const targetPath = path.join(projectDir, target_dir);
248
+ await fs.ensureDir(targetPath);
249
+
250
+ this.skillWriteTracker = new Set();
251
+ const results = { skills: 0 };
252
+
253
+ results.skills = await this.installVerbatimSkills(projectDir, drtDir, targetPath, config);
254
+ results.skillDirectories = this.skillWriteTracker.size;
255
+
256
+ if (config.commands_target_dir) {
257
+ results.commands = await this.installCommandPointers(projectDir, drtDir, config, options);
258
+ }
259
+
260
+ await this.printSummary(results, target_dir, options);
261
+ this.skillWriteTracker = null;
262
+ return { success: true, results };
263
+ }
264
+
265
+ /**
266
+ * Generate per-skill command pointer files for IDEs that surface commands
267
+ * separately from skills (e.g. OpenCode's `.opencode/commands/<name>.md`).
268
+ *
269
+ * Each pointer is a tiny markdown file whose body is `@skills/<canonicalId>`
270
+ * so invoking `/<canonicalId>` routes the user straight to the skill instead
271
+ * of forcing them through a `/skills` menu.
272
+ *
273
+ * Skips:
274
+ * - Names that collide with reserved built-in slash commands.
275
+ * - canonicalIds that aren't safe basename-only identifiers (defense
276
+ * against path traversal even though the manifest is currently trusted).
277
+ * - Existing files whose body looks user-modified (preserves hand edits);
278
+ * pointer files matching the generator pattern get overwritten so that
279
+ * description changes in skill-manifest.csv propagate on re-install.
280
+ *
281
+ * Per-file write failures are recorded and reported but do not abort the
282
+ * rest of the install — pointer files are a non-essential adjunct to the
283
+ * skill copy that already succeeded.
284
+ *
285
+ * @param {string} projectDir
286
+ * @param {string} drtDir
287
+ * @param {Object} config - Installer config; reads commands_target_dir.
288
+ * @param {Object} options - Setup options. forceCommands overwrites existing
289
+ * files unconditionally (including hand-modified ones).
290
+ * @returns {Promise<Object>} { created, updated, skippedExisting, skippedCollision, skippedInvalidId, writeFailures, fallbackDescription }
291
+ */
292
+ async installCommandPointers(projectDir, drtDir, config, options = {}) {
293
+ const result = {
294
+ created: 0,
295
+ updated: 0,
296
+ skippedExisting: 0,
297
+ skippedCollision: 0,
298
+ skippedInvalidId: 0,
299
+ skippedFiltered: 0,
300
+ writeFailures: 0,
301
+ fallbackDescription: 0,
302
+ };
303
+
304
+ const csvPath = path.join(drtDir, '_config', 'skill-manifest.csv');
305
+ if (!(await fs.pathExists(csvPath))) return result;
306
+
307
+ const commandsPath = path.join(projectDir, config.commands_target_dir);
308
+ await fs.ensureDir(commandsPath);
309
+
310
+ // Per-platform pointer-file shape, all overrideable in platform-codes.yaml.
311
+ const extension = config.commands_extension || '.md';
312
+ const template = config.commands_body_template || DEFAULT_COMMANDS_BODY_TEMPLATE;
313
+ const targetDir = config.target_dir;
314
+ const filter = config.commands_filter || null;
315
+
316
+ const csvContent = await fs.readFile(csvPath, 'utf8');
317
+ const records = csv.parse(csvContent, { columns: true, skip_empty_lines: true });
318
+
319
+ for (const record of records) {
320
+ const canonicalId = record.canonicalId;
321
+ if (!canonicalId) continue;
322
+
323
+ // Defensive basename validation. canonicalId comes from a trusted
324
+ // manifest today, but the value flows directly into a file path —
325
+ // reject anything that could escape commands_target_dir.
326
+ if (!isSafeCanonicalId(canonicalId)) {
327
+ result.skippedInvalidId++;
328
+ continue;
329
+ }
330
+
331
+ // Optional per-platform filter: surfaces that should only show
332
+ // persona agents (e.g. Copilot's Custom Agents picker) skip
333
+ // workflow/tool skills here so the picker isn't cluttered with
334
+ // 90+ unrelated entries.
335
+ if (filter === 'agents-only' && !(await isAgentSkill(record, drtDir))) {
336
+ result.skippedFiltered++;
337
+ continue;
338
+ }
339
+
340
+ // Reserved-name guard is OpenCode-specific. Other adapters that opt
341
+ // into commands_target_dir later should declare their own reserved
342
+ // set rather than inheriting OpenCode's.
343
+ if (this.name === 'opencode' && RESERVED_OPENCODE_COMMANDS.has(canonicalId)) {
344
+ result.skippedCollision++;
345
+ continue;
346
+ }
347
+
348
+ let description = (record.description || '').trim();
349
+ if (!description) {
350
+ description = `Run the ${canonicalId} skill`;
351
+ result.fallbackDescription++;
352
+ }
353
+
354
+ const body = buildCommandPointerBody(description, canonicalId, { template, targetDir });
355
+ const commandFile = path.join(commandsPath, `${canonicalId}${extension}`);
356
+
357
+ // If a pointer file already exists, decide whether to overwrite based
358
+ // on whether it looks like generator output (description-only diff) or
359
+ // a user-modified file. forceCommands overrides this protection.
360
+ if (!options.forceCommands && (await fs.pathExists(commandFile))) {
361
+ let existing;
362
+ try {
363
+ existing = await fs.readFile(commandFile, 'utf8');
364
+ } catch {
365
+ // Treat unreadable as user-owned and skip — safer than overwriting.
366
+ result.skippedExisting++;
367
+ continue;
368
+ }
369
+
370
+ if (existing === body) {
371
+ // No-op idempotent re-run.
372
+ result.skippedExisting++;
373
+ continue;
374
+ }
375
+ if (looksLikeGeneratorOutput(existing, canonicalId, { template, targetDir })) {
376
+ // Description (or other generated bit) has changed; refresh in place.
377
+ try {
378
+ await fs.writeFile(commandFile, body, 'utf8');
379
+ result.updated++;
380
+ } catch (error) {
381
+ result.writeFailures++;
382
+ if (!options.silent) {
383
+ await prompts.log.warn(`Failed to update command pointer ${canonicalId}${extension}: ${error.message}`);
384
+ }
385
+ }
386
+ continue;
387
+ }
388
+ // Hand-modified pointer — preserve it.
389
+ result.skippedExisting++;
390
+ continue;
391
+ }
392
+
393
+ try {
394
+ await fs.writeFile(commandFile, body, 'utf8');
395
+ result.created++;
396
+ } catch (error) {
397
+ result.writeFailures++;
398
+ if (!options.silent) {
399
+ await prompts.log.warn(`Failed to write command pointer ${canonicalId}${extension}: ${error.message}`);
400
+ }
401
+ }
402
+ }
403
+
404
+ return result;
405
+ }
406
+
407
+ /**
408
+ * Install verbatim native SKILL.md directories from skill-manifest.csv.
409
+ * Copies the entire source directory as-is into the IDE skill directory.
410
+ * The source SKILL.md is used directly — no frontmatter transformation or file generation.
411
+ * @param {string} projectDir - Project directory
412
+ * @param {string} drtDir - DRT installation directory
413
+ * @param {string} targetPath - Target skills directory
414
+ * @param {Object} config - Installation configuration
415
+ * @returns {Promise<number>} Count of skills installed
416
+ */
417
+ async installVerbatimSkills(projectDir, drtDir, targetPath, config) {
418
+ const drtFolderName = path.basename(drtDir);
419
+ const drtPrefix = drtFolderName + '/';
420
+ const csvPath = path.join(drtDir, '_config', 'skill-manifest.csv');
421
+
422
+ if (!(await fs.pathExists(csvPath))) return 0;
423
+
424
+ const csvContent = await fs.readFile(csvPath, 'utf8');
425
+ const records = csv.parse(csvContent, {
426
+ columns: true,
427
+ skip_empty_lines: true,
428
+ });
429
+
430
+ let count = 0;
431
+
432
+ for (const record of records) {
433
+ const canonicalId = record.canonicalId;
434
+ if (!canonicalId) continue;
435
+
436
+ // Derive source directory from path column
437
+ // path is like "_drt/bmm/workflows/drt-quick-flow/drt-quick-dev-new-preview/SKILL.md"
438
+ // Strip drtFolderName prefix and join with drtDir, then get dirname
439
+ const relativePath = record.path.startsWith(drtPrefix) ? record.path.slice(drtPrefix.length) : record.path;
440
+ const sourceFile = path.join(drtDir, relativePath);
441
+ const sourceDir = path.dirname(sourceFile);
442
+
443
+ if (!(await fs.pathExists(sourceDir))) continue;
444
+
445
+ // Clean target before copy to prevent stale files
446
+ const skillDir = path.join(targetPath, canonicalId);
447
+ await fs.remove(skillDir);
448
+ await fs.ensureDir(skillDir);
449
+ this.skillWriteTracker?.add(canonicalId);
450
+
451
+ // Copy all skill files, filtering OS/editor artifacts recursively
452
+ const skipPatterns = new Set(['.DS_Store', 'Thumbs.db', 'desktop.ini']);
453
+ const skipSuffixes = ['~', '.swp', '.swo', '.bak'];
454
+ const filter = (src) => {
455
+ const name = path.basename(src);
456
+ if (src === sourceDir) return true;
457
+ if (skipPatterns.has(name)) return false;
458
+ if (name.startsWith('.') && name !== '.gitkeep') return false;
459
+ if (skipSuffixes.some((s) => name.endsWith(s))) return false;
460
+ return true;
461
+ };
462
+ await fs.copy(sourceDir, skillDir, { filter });
463
+
464
+ count++;
465
+ }
466
+
467
+ return count;
468
+ }
469
+
470
+ /**
471
+ * Print installation summary
472
+ * @param {Object} results - Installation results
473
+ * @param {string} targetDir - Target directory (relative)
474
+ */
475
+ async printSummary(results, targetDir, options = {}) {
476
+ if (options.silent) return;
477
+ const count = results.skillDirectories || results.skills || 0;
478
+ if (count > 0) {
479
+ await prompts.log.success(`${this.name} configured: ${count} skills → ${targetDir}`);
480
+ }
481
+ const cmd = results.commands;
482
+ if (cmd && (cmd.created > 0 || cmd.updated > 0) && this.installerConfig?.commands_target_dir) {
483
+ const total = cmd.created + cmd.updated;
484
+ const detail = cmd.updated > 0 ? `${cmd.created} new, ${cmd.updated} refreshed` : `${total}`;
485
+ await prompts.log.success(`${this.name} commands: ${detail} → ${this.installerConfig.commands_target_dir}`);
486
+ if (cmd.skippedCollision > 0) {
487
+ await prompts.log.message(` (${cmd.skippedCollision} skipped — name collides with reserved slash command)`);
488
+ }
489
+ if (cmd.writeFailures > 0) {
490
+ await prompts.log.warn(` (${cmd.writeFailures} pointer writes failed — see warnings above)`);
491
+ }
492
+ }
493
+ }
494
+
495
+ /**
496
+ * Cleanup IDE configuration
497
+ * @param {string} projectDir - Project directory
498
+ */
499
+ async cleanup(projectDir, options = {}, drtDir = null) {
500
+ const resolvedDrtDir = drtDir || (await this._findDrtDir(projectDir));
501
+
502
+ // Build removal set: previously installed skills + removals.txt entries
503
+ let removalSet;
504
+ if (options.previousSkillIds) {
505
+ // Install/update flow: use pre-captured skill IDs (before manifest was overwritten)
506
+ removalSet = new Set(options.previousSkillIds);
507
+ if (resolvedDrtDir) {
508
+ const removals = await this.loadRemovalLists(resolvedDrtDir);
509
+ for (const entry of removals) removalSet.add(entry);
510
+ }
511
+ } else if (resolvedDrtDir) {
512
+ // Uninstall flow: read from current skill-manifest.csv + removals.txt
513
+ removalSet = await this._buildUninstallSet(resolvedDrtDir);
514
+ } else {
515
+ removalSet = new Set();
516
+ }
517
+
518
+ // Strip DRT markers from copilot-instructions.md if present
519
+ if (this.name === 'github-copilot') {
520
+ await this.cleanupCopilotInstructions(projectDir, options);
521
+ }
522
+
523
+ // Strip DRT modes from .kilocodemodes if present
524
+ if (this.name === 'kilo') {
525
+ await this.cleanupKiloModes(projectDir, options);
526
+ }
527
+
528
+ // Strip DRT entries from .rovodev/prompts.yml if present
529
+ if (this.name === 'rovo-dev') {
530
+ await this.cleanupRovoDevPrompts(projectDir, options);
531
+ }
532
+
533
+ // Clean generated command pointer files in commands_target_dir.
534
+ // Mirrors target_dir cleanup so uninstalls and skill removals don't
535
+ // leave dangling /<canonicalId> commands pointing at missing skills.
536
+ // Runs regardless of skipTarget — command pointers live in a per-IDE
537
+ // directory and are not deduped across peers, so a peer-owned shared
538
+ // skills directory does not protect this IDE's command pointers from
539
+ // cleanup. The "currently active" set is passed so install-flow cleanup
540
+ // (where removalSet contains skills that will be re-added moments later)
541
+ // doesn't trample hand-edited pointers; install-flow cleanup will only
542
+ // delete pointers for skills that are not in the new manifest.
543
+ if (this.installerConfig?.commands_target_dir) {
544
+ // In the install/update flow (signal: previousSkillIds was passed),
545
+ // spare pointers whose canonicalId is still in the manifest so hand
546
+ // edits survive a routine reinstall. In the uninstall flow (no
547
+ // previousSkillIds — full uninstall or per-IDE removal via
548
+ // cleanupByList), don't spare anything; the IDE itself is going away,
549
+ // so its pointers should go with it.
550
+ const isInstallFlow = !!options.previousSkillIds;
551
+ const activeSkillIds = isInstallFlow ? await this._readActiveSkillIds(resolvedDrtDir) : new Set();
552
+ const extension = this.installerConfig.commands_extension || '.md';
553
+ await this.cleanupCommandPointers(
554
+ projectDir,
555
+ this.installerConfig.commands_target_dir,
556
+ options,
557
+ removalSet,
558
+ activeSkillIds,
559
+ extension,
560
+ );
561
+ }
562
+
563
+ // Skip target_dir cleanup when a peer platform owns this directory
564
+ // (set during dedup'd install or when uninstalling one of several
565
+ // platforms that share the same target_dir).
566
+ if (options.skipTarget) return;
567
+
568
+ // Clean current target directory
569
+ if (this.installerConfig?.target_dir) {
570
+ await this.cleanupTarget(projectDir, this.installerConfig.target_dir, options, removalSet);
571
+ }
572
+ }
573
+
574
+ /**
575
+ * Find the _drt directory in a project
576
+ * @param {string} projectDir - Project directory
577
+ * @returns {string|null} Path to drt dir or null
578
+ */
579
+ async _findDrtDir(projectDir) {
580
+ const drtDir = path.join(projectDir, DRT_FOLDER_NAME);
581
+ return (await fs.pathExists(drtDir)) ? drtDir : null;
582
+ }
583
+
584
+ /**
585
+ * Build the full set of entries to remove for uninstall.
586
+ * Reads skill-manifest.csv to know exactly what was installed, plus removal lists.
587
+ * @param {string} drtDir - DRT installation directory
588
+ * @returns {Set<string>} Set of entries to remove
589
+ */
590
+ async _buildUninstallSet(drtDir) {
591
+ const removals = await this.loadRemovalLists(drtDir);
592
+
593
+ // Also add all currently installed skills from skill-manifest.csv
594
+ const csvPath = path.join(drtDir, '_config', 'skill-manifest.csv');
595
+ try {
596
+ if (await fs.pathExists(csvPath)) {
597
+ const content = await fs.readFile(csvPath, 'utf8');
598
+ const records = csv.parse(content, { columns: true, skip_empty_lines: true });
599
+ for (const record of records) {
600
+ if (record.canonicalId) {
601
+ removals.add(record.canonicalId);
602
+ }
603
+ }
604
+ }
605
+ } catch {
606
+ // If we can't read the manifest, we still have the removal lists
607
+ }
608
+
609
+ return removals;
610
+ }
611
+
612
+ /**
613
+ * Load removal lists from all module sources in the drt directory.
614
+ * Each module can have an optional removals.txt listing entries to remove.
615
+ * @param {string} drtDir - DRT installation directory
616
+ * @returns {Set<string>} Set of entries to remove
617
+ */
618
+ async loadRemovalLists(drtDir) {
619
+ const removals = new Set();
620
+ const { getProjectRoot } = require('../project-root');
621
+
622
+ // Read project-level removals.txt (covers core and bmm)
623
+ const projectRemovalsPath = path.join(getProjectRoot(), 'removals.txt');
624
+ await this._readRemovalFile(projectRemovalsPath, removals);
625
+
626
+ // Read per-module removals.txt from installed module directories
627
+ try {
628
+ const entries = await fs.readdir(drtDir);
629
+ for (const entry of entries) {
630
+ if (entry.startsWith('_')) continue;
631
+ const removalPath = path.join(drtDir, entry, 'removals.txt');
632
+ await this._readRemovalFile(removalPath, removals);
633
+ }
634
+ } catch {
635
+ // drtDir may not exist yet on fresh install
636
+ }
637
+
638
+ return removals;
639
+ }
640
+
641
+ /**
642
+ * Read a removals.txt file and add entries to the set
643
+ * @param {string} filePath - Path to removals.txt
644
+ * @param {Set<string>} removals - Set to add entries to
645
+ */
646
+ async _readRemovalFile(filePath, removals) {
647
+ try {
648
+ if (await fs.pathExists(filePath)) {
649
+ const content = await fs.readFile(filePath, 'utf8');
650
+ for (const line of content.split('\n')) {
651
+ const trimmed = line.trim();
652
+ if (trimmed && !trimmed.startsWith('#')) {
653
+ removals.add(trimmed);
654
+ }
655
+ }
656
+ }
657
+ } catch {
658
+ // Optional file — ignore errors
659
+ }
660
+ }
661
+
662
+ /**
663
+ * Cleanup generated command pointer files for entries in removalSet.
664
+ * Symmetric counterpart to installCommandPointers — removes
665
+ * `<canonicalId><extension>` files whose canonicalId is in the set. Removes
666
+ * the commands directory entirely if it ends up empty.
667
+ * @param {string} projectDir
668
+ * @param {string} commandsTargetDir - Relative dir (e.g. .opencode/commands)
669
+ * @param {Object} options
670
+ * @param {Set<string>} removalSet - canonicalIds whose pointer files to remove
671
+ * @param {Set<string>} [activeSkillIds] - canonicalIds present in the
672
+ * current manifest. Pointers for IDs in this set are spared so an
673
+ * install-flow cleanup (where removalSet === previousSkillIds and the
674
+ * same skills are about to be re-installed) doesn't wipe hand-edited
675
+ * pointer files. Pass an empty set or omit to delete every match in
676
+ * removalSet (uninstall flow).
677
+ * @param {string} [extension] - Pointer file extension (default '.md');
678
+ * matches the platform's commands_extension config value so cleanup
679
+ * correctly identifies pointer files for IDEs whose convention isn't .md
680
+ * (e.g. Copilot's `.agent.md`).
681
+ */
682
+ async cleanupCommandPointers(
683
+ projectDir,
684
+ commandsTargetDir,
685
+ options = {},
686
+ removalSet = new Set(),
687
+ activeSkillIds = new Set(),
688
+ extension = '.md',
689
+ ) {
690
+ if (!removalSet || removalSet.size === 0) return;
691
+
692
+ const commandsPath = path.join(projectDir, commandsTargetDir);
693
+ if (!(await fs.pathExists(commandsPath))) return;
694
+
695
+ let entries;
696
+ try {
697
+ entries = await fs.readdir(commandsPath);
698
+ } catch {
699
+ return;
700
+ }
701
+
702
+ for (const entry of entries) {
703
+ if (!entry.endsWith(extension)) continue;
704
+ const canonicalId = entry.slice(0, -extension.length);
705
+ if (!removalSet.has(canonicalId)) continue;
706
+ // Spare pointers for skills that are still in the manifest; the
707
+ // install pass will refresh them in place if their content has gone
708
+ // stale, while preserving hand edits.
709
+ if (activeSkillIds.has(canonicalId)) continue;
710
+ try {
711
+ await fs.remove(path.join(commandsPath, entry));
712
+ } catch {
713
+ // Skip files we can't remove.
714
+ }
715
+ }
716
+
717
+ // Remove the commands directory if we emptied it.
718
+ try {
719
+ const remaining = await fs.readdir(commandsPath);
720
+ if (remaining.length === 0) {
721
+ await fs.remove(commandsPath);
722
+ }
723
+ } catch {
724
+ // Directory may already be gone.
725
+ }
726
+ }
727
+
728
+ /**
729
+ * Read the canonicalIds currently present in the skill-manifest.csv.
730
+ * Used by cleanup to distinguish "re-install of an existing skill"
731
+ * (preserve pointer) from "skill truly being removed" (delete pointer).
732
+ * @param {string|null} drtDir
733
+ * @returns {Promise<Set<string>>}
734
+ */
735
+ async _readActiveSkillIds(drtDir) {
736
+ const ids = new Set();
737
+ if (!drtDir) return ids;
738
+ const csvPath = path.join(drtDir, '_config', 'skill-manifest.csv');
739
+ if (!(await fs.pathExists(csvPath))) return ids;
740
+ try {
741
+ const content = await fs.readFile(csvPath, 'utf8');
742
+ const records = csv.parse(content, { columns: true, skip_empty_lines: true });
743
+ for (const record of records) {
744
+ if (record.canonicalId) ids.add(record.canonicalId);
745
+ }
746
+ } catch {
747
+ // Manifest unreadable — return an empty set so cleanup falls back to
748
+ // the conservative "delete what removalSet says" behavior.
749
+ }
750
+ return ids;
751
+ }
752
+
753
+ /**
754
+ * Cleanup a specific target directory.
755
+ * When removalSet is provided, only removes entries in that set.
756
+ * When removalSet is null (legacy dirs), removes all drt-prefixed entries.
757
+ * @param {string} projectDir - Project directory
758
+ * @param {string} targetDir - Target directory to clean
759
+ * @param {Object} options - Cleanup options
760
+ * @param {Set<string>|null} removalSet - Entries to remove, or null for legacy prefix matching
761
+ */
762
+ async cleanupTarget(projectDir, targetDir, options = {}, removalSet = new Set()) {
763
+ const targetPath = path.join(projectDir, targetDir);
764
+
765
+ if (!(await fs.pathExists(targetPath))) {
766
+ return;
767
+ }
768
+
769
+ if (removalSet && removalSet.size === 0) {
770
+ return;
771
+ }
772
+
773
+ let entries;
774
+ try {
775
+ entries = await fs.readdir(targetPath);
776
+ } catch {
777
+ return;
778
+ }
779
+
780
+ if (!entries || !Array.isArray(entries)) {
781
+ return;
782
+ }
783
+
784
+ let removedCount = 0;
785
+
786
+ for (const entry of entries) {
787
+ if (!entry || typeof entry !== 'string') continue;
788
+
789
+ // Always preserve drt-os-* utility skills regardless of cleanup mode
790
+ if (entry.startsWith('drt-os-')) continue;
791
+
792
+ // Surgical removal from set, or fallback to manifest+prefix detection when null
793
+ const shouldRemove = removalSet ? removalSet.has(entry) : isDrtOwnedEntry(entry, null);
794
+
795
+ if (shouldRemove) {
796
+ try {
797
+ await fs.remove(path.join(targetPath, entry));
798
+ removedCount++;
799
+ } catch {
800
+ // Skip entries that can't be removed
801
+ }
802
+ }
803
+ }
804
+
805
+ // Only log cleanup when it's not a routine reinstall (legacy dir cleanup or actual removals)
806
+ // Suppress for current target_dir since it's always cleaned before a fresh write
807
+
808
+ // Remove empty directory after cleanup
809
+ if (removedCount > 0) {
810
+ try {
811
+ const remaining = await fs.readdir(targetPath);
812
+ if (remaining.length === 0) {
813
+ await fs.remove(targetPath);
814
+ }
815
+ } catch {
816
+ // Directory may already be gone or in use
817
+ }
818
+ }
819
+ }
820
+
821
+ /**
822
+ * Strip DRT-owned content from .github/copilot-instructions.md.
823
+ * The old custom installer injected content between <!-- DRT:START --> and <!-- DRT:END --> markers.
824
+ * Deletes the file if nothing remains. Restores .bak backup if one exists.
825
+ */
826
+ async cleanupCopilotInstructions(projectDir, options = {}) {
827
+ const filePath = path.join(projectDir, '.github', 'copilot-instructions.md');
828
+
829
+ if (!(await fs.pathExists(filePath))) return;
830
+
831
+ try {
832
+ const content = await fs.readFile(filePath, 'utf8');
833
+ const startIdx = content.indexOf('<!-- DRT:START -->');
834
+ const endIdx = content.indexOf('<!-- DRT:END -->');
835
+
836
+ if (startIdx === -1 || endIdx === -1 || endIdx <= startIdx) return;
837
+
838
+ const cleaned = content.slice(0, startIdx) + content.slice(endIdx + '<!-- DRT:END -->'.length);
839
+
840
+ if (cleaned.trim().length === 0) {
841
+ await fs.remove(filePath);
842
+ const backupPath = `${filePath}.bak`;
843
+ if (await fs.pathExists(backupPath)) {
844
+ await fs.rename(backupPath, filePath);
845
+ if (!options.silent) await prompts.log.message(' Restored copilot-instructions.md from backup');
846
+ }
847
+ } else {
848
+ await fs.writeFile(filePath, cleaned, 'utf8');
849
+ const backupPath = `${filePath}.bak`;
850
+ if (await fs.pathExists(backupPath)) await fs.remove(backupPath);
851
+ }
852
+
853
+ if (!options.silent) await prompts.log.message(' Cleaned DRT markers from copilot-instructions.md');
854
+ } catch {
855
+ if (!options.silent) await prompts.log.warn(' Warning: Could not clean DRT markers from copilot-instructions.md');
856
+ }
857
+ }
858
+
859
+ /**
860
+ * Strip DRT-owned modes from .kilocodemodes.
861
+ * The old custom kilo.js installer added modes with slug starting with 'drt-'.
862
+ * Parses YAML, filters out DRT modes, rewrites. Leaves file as-is on parse failure.
863
+ */
864
+ async cleanupKiloModes(projectDir, options = {}) {
865
+ const kiloModesPath = path.join(projectDir, '.kilocodemodes');
866
+
867
+ if (!(await fs.pathExists(kiloModesPath))) return;
868
+
869
+ const content = await fs.readFile(kiloModesPath, 'utf8');
870
+
871
+ let config;
872
+ try {
873
+ config = yaml.parse(content) || {};
874
+ } catch {
875
+ if (!options.silent) await prompts.log.warn(' Warning: Could not parse .kilocodemodes for cleanup');
876
+ return;
877
+ }
878
+
879
+ if (!Array.isArray(config.customModes)) return;
880
+
881
+ const originalCount = config.customModes.length;
882
+ config.customModes = config.customModes.filter((mode) => mode && (!mode.slug || !mode.slug.startsWith('drt-')));
883
+ const removedCount = originalCount - config.customModes.length;
884
+
885
+ if (removedCount > 0) {
886
+ try {
887
+ await fs.writeFile(kiloModesPath, yaml.stringify(config, { lineWidth: 0 }));
888
+ if (!options.silent) await prompts.log.message(` Removed ${removedCount} DRT modes from .kilocodemodes`);
889
+ } catch {
890
+ if (!options.silent) await prompts.log.warn(' Warning: Could not write .kilocodemodes during cleanup');
891
+ }
892
+ }
893
+ }
894
+
895
+ /**
896
+ * Strip DRT-owned entries from .rovodev/prompts.yml.
897
+ * The old custom rovodev.js installer registered workflows in prompts.yml.
898
+ * Parses YAML, filters out entries with name starting with 'drt-', rewrites.
899
+ * Removes the file if no entries remain.
900
+ */
901
+ async cleanupRovoDevPrompts(projectDir, options = {}) {
902
+ const promptsPath = path.join(projectDir, '.rovodev', 'prompts.yml');
903
+
904
+ if (!(await fs.pathExists(promptsPath))) return;
905
+
906
+ const content = await fs.readFile(promptsPath, 'utf8');
907
+
908
+ let config;
909
+ try {
910
+ config = yaml.parse(content) || {};
911
+ } catch {
912
+ if (!options.silent) await prompts.log.warn(' Warning: Could not parse prompts.yml for cleanup');
913
+ return;
914
+ }
915
+
916
+ if (!Array.isArray(config.prompts)) return;
917
+
918
+ const originalCount = config.prompts.length;
919
+ config.prompts = config.prompts.filter((entry) => entry && (!entry.name || !entry.name.startsWith('drt-')));
920
+ const removedCount = originalCount - config.prompts.length;
921
+
922
+ if (removedCount > 0) {
923
+ try {
924
+ if (config.prompts.length === 0) {
925
+ await fs.remove(promptsPath);
926
+ } else {
927
+ await fs.writeFile(promptsPath, yaml.stringify(config, { lineWidth: 0 }));
928
+ }
929
+ if (!options.silent) await prompts.log.message(` Removed ${removedCount} DRT entries from prompts.yml`);
930
+ } catch {
931
+ if (!options.silent) await prompts.log.warn(' Warning: Could not write prompts.yml during cleanup');
932
+ }
933
+ }
934
+ }
935
+
936
+ /**
937
+ * Check ancestor directories for existing DRT files in the same target_dir.
938
+ * IDEs like Claude Code inherit commands from parent directories, so an existing
939
+ * installation in an ancestor would cause duplicate commands.
940
+ * @param {string} projectDir - Project directory being installed to
941
+ * @returns {Promise<string|null>} Path to conflicting directory, or null if clean
942
+ */
943
+ async findAncestorConflict(projectDir) {
944
+ const targetDir = this.installerConfig?.target_dir;
945
+ if (!targetDir) return null;
946
+
947
+ const resolvedProject = await fs.realpath(path.resolve(projectDir));
948
+ let current = path.dirname(resolvedProject);
949
+ const root = path.parse(current).root;
950
+
951
+ while (current !== root && current.length > root.length) {
952
+ const candidatePath = path.join(current, targetDir);
953
+ try {
954
+ if (await fs.pathExists(candidatePath)) {
955
+ const entries = await fs.readdir(candidatePath);
956
+ const ancestorDrtDir = await this._findDrtDir(current);
957
+ const canonicalIds = await getInstalledCanonicalIds(ancestorDrtDir);
958
+ if (entries.some((e) => isDrtOwnedEntry(e, canonicalIds))) {
959
+ return candidatePath;
960
+ }
961
+ }
962
+ } catch {
963
+ // Can't read directory — skip
964
+ }
965
+ current = path.dirname(current);
966
+ }
967
+
968
+ return null;
969
+ }
970
+ }
971
+
972
+ module.exports = { ConfigDrivenIdeSetup };