@zeyue0329/xiaoma-cli 1.0.8 → 1.0.9

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 (315) hide show
  1. package/CHANGELOG.md +686 -0
  2. package/LICENSE +6 -1
  3. package/README.md +173 -460
  4. package/common/tasks/create-doc.md +3 -1
  5. package/common/tasks/execute-checklist.md +2 -7
  6. package/common/utils/bmad-doc-template.md +7 -5
  7. package/common/utils/workflow-management.md +2 -0
  8. package/dist/agents/analyst.txt +1143 -1118
  9. package/dist/agents/architect.txt +1555 -1531
  10. package/dist/agents/dev.txt +170 -22
  11. package/dist/agents/pm.txt +1103 -1106
  12. package/dist/agents/po.txt +329 -334
  13. package/dist/agents/qa.txt +1773 -154
  14. package/dist/agents/sm.txt +101 -102
  15. package/dist/agents/ux-expert.txt +93 -91
  16. package/dist/agents/xiaoma-master.txt +745 -673
  17. package/dist/agents/xiaoma-orchestrator.txt +107 -77
  18. package/dist/expansion-packs/bmad-2d-phaser-game-dev/agents/game-designer.txt +2386 -0
  19. package/dist/expansion-packs/bmad-2d-phaser-game-dev/agents/game-developer.txt +1627 -0
  20. package/dist/expansion-packs/bmad-2d-phaser-game-dev/agents/game-sm.txt +822 -0
  21. package/dist/expansion-packs/bmad-2d-phaser-game-dev/teams/phaser-2d-nodejs-game-team.txt +11008 -0
  22. package/dist/expansion-packs/bmad-2d-unity-game-dev/agents/game-architect.txt +4031 -0
  23. package/dist/expansion-packs/bmad-2d-unity-game-dev/agents/game-designer.txt +3717 -0
  24. package/dist/expansion-packs/bmad-2d-unity-game-dev/agents/game-developer.txt +456 -0
  25. package/dist/expansion-packs/bmad-2d-unity-game-dev/agents/game-sm.txt +982 -0
  26. package/dist/expansion-packs/bmad-2d-unity-game-dev/teams/unity-2d-game-team.txt +15450 -0
  27. package/dist/expansion-packs/bmad-creative-writing/agents/beta-reader.txt +921 -0
  28. package/dist/expansion-packs/bmad-creative-writing/agents/book-critic.txt +81 -0
  29. package/dist/expansion-packs/bmad-creative-writing/agents/character-psychologist.txt +886 -0
  30. package/dist/expansion-packs/bmad-creative-writing/agents/cover-designer.txt +85 -0
  31. package/dist/expansion-packs/bmad-creative-writing/agents/dialog-specialist.txt +903 -0
  32. package/dist/expansion-packs/bmad-creative-writing/agents/editor.txt +837 -0
  33. package/dist/expansion-packs/bmad-creative-writing/agents/genre-specialist.txt +989 -0
  34. package/dist/expansion-packs/bmad-creative-writing/agents/narrative-designer.txt +888 -0
  35. package/dist/expansion-packs/bmad-creative-writing/agents/plot-architect.txt +1173 -0
  36. package/dist/expansion-packs/bmad-creative-writing/agents/world-builder.txt +914 -0
  37. package/dist/expansion-packs/bmad-creative-writing/teams/agent-team.txt +6511 -0
  38. package/dist/expansion-packs/bmad-infrastructure-devops/agents/infra-devops-platform.txt +2087 -0
  39. package/dist/teams/team-all.txt +5710 -3857
  40. package/dist/teams/team-fullstack.txt +3242 -3157
  41. package/dist/teams/team-ide-minimal.txt +2330 -534
  42. package/dist/teams/team-no-ui.txt +2935 -2857
  43. package/docs/GUIDING-PRINCIPLES.md +91 -0
  44. package/docs/core-architecture.md +219 -0
  45. package/docs/enhanced-ide-development-workflow.md +248 -0
  46. package/docs/expansion-packs.md +200 -0
  47. package/docs/how-to-contribute-with-pull-requests.md +158 -0
  48. package/docs/user-guide.md +530 -0
  49. package/docs/versioning-and-releases.md +155 -0
  50. package/docs/versions.md +48 -0
  51. package/docs/working-in-the-brownfield.md +597 -0
  52. package/expansion-packs/bmad-2d-phaser-game-dev/agent-teams/phaser-2d-nodejs-game-team.yaml +14 -0
  53. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-designer.md +73 -0
  54. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-developer.md +80 -0
  55. package/expansion-packs/bmad-2d-phaser-game-dev/agents/game-sm.md +66 -0
  56. package/expansion-packs/bmad-2d-phaser-game-dev/checklists/game-design-checklist.md +203 -0
  57. package/expansion-packs/bmad-2d-phaser-game-dev/checklists/game-story-dod-checklist.md +162 -0
  58. package/expansion-packs/bmad-2d-phaser-game-dev/config.yaml +9 -0
  59. package/expansion-packs/bmad-2d-phaser-game-dev/data/bmad-kb.md +252 -0
  60. package/expansion-packs/bmad-2d-phaser-game-dev/data/development-guidelines.md +649 -0
  61. package/expansion-packs/bmad-2d-phaser-game-dev/tasks/advanced-elicitation.md +112 -0
  62. package/expansion-packs/bmad-2d-phaser-game-dev/tasks/create-game-story.md +218 -0
  63. package/expansion-packs/bmad-2d-phaser-game-dev/tasks/game-design-brainstorming.md +292 -0
  64. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-architecture-tmpl.yaml +614 -0
  65. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-brief-tmpl.yaml +357 -0
  66. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-design-doc-tmpl.yaml +344 -0
  67. package/expansion-packs/bmad-2d-phaser-game-dev/templates/game-story-tmpl.yaml +254 -0
  68. package/expansion-packs/bmad-2d-phaser-game-dev/templates/level-design-doc-tmpl.yaml +485 -0
  69. package/expansion-packs/bmad-2d-phaser-game-dev/workflows/game-dev-greenfield.yaml +184 -0
  70. package/expansion-packs/bmad-2d-phaser-game-dev/workflows/game-prototype.yaml +176 -0
  71. package/expansion-packs/bmad-2d-unity-game-dev/agent-teams/unity-2d-game-team.yaml +15 -0
  72. package/expansion-packs/bmad-2d-unity-game-dev/agents/game-architect.md +82 -0
  73. package/expansion-packs/bmad-2d-unity-game-dev/agents/game-designer.md +79 -0
  74. package/expansion-packs/bmad-2d-unity-game-dev/agents/game-developer.md +80 -0
  75. package/expansion-packs/bmad-2d-unity-game-dev/agents/game-sm.md +67 -0
  76. package/expansion-packs/bmad-2d-unity-game-dev/checklists/game-architect-checklist.md +393 -0
  77. package/expansion-packs/bmad-2d-unity-game-dev/checklists/game-change-checklist.md +205 -0
  78. package/expansion-packs/bmad-2d-unity-game-dev/checklists/game-design-checklist.md +203 -0
  79. package/expansion-packs/bmad-2d-unity-game-dev/checklists/game-story-dod-checklist.md +126 -0
  80. package/expansion-packs/bmad-2d-unity-game-dev/config.yaml +7 -0
  81. package/expansion-packs/bmad-2d-unity-game-dev/data/bmad-kb.md +771 -0
  82. package/expansion-packs/bmad-2d-unity-game-dev/data/development-guidelines.md +588 -0
  83. package/expansion-packs/bmad-2d-unity-game-dev/tasks/advanced-elicitation.md +112 -0
  84. package/expansion-packs/bmad-2d-unity-game-dev/tasks/correct-course-game.md +143 -0
  85. package/expansion-packs/bmad-2d-unity-game-dev/tasks/create-game-story.md +186 -0
  86. package/expansion-packs/bmad-2d-unity-game-dev/tasks/game-design-brainstorming.md +292 -0
  87. package/expansion-packs/bmad-2d-unity-game-dev/tasks/validate-game-story.md +202 -0
  88. package/expansion-packs/bmad-2d-unity-game-dev/templates/game-architecture-tmpl.yaml +1031 -0
  89. package/expansion-packs/bmad-2d-unity-game-dev/templates/game-brief-tmpl.yaml +357 -0
  90. package/expansion-packs/bmad-2d-unity-game-dev/templates/game-design-doc-tmpl.yaml +706 -0
  91. package/expansion-packs/bmad-2d-unity-game-dev/templates/game-story-tmpl.yaml +257 -0
  92. package/expansion-packs/bmad-2d-unity-game-dev/templates/level-design-doc-tmpl.yaml +485 -0
  93. package/expansion-packs/bmad-2d-unity-game-dev/workflows/game-dev-greenfield.yaml +184 -0
  94. package/expansion-packs/bmad-2d-unity-game-dev/workflows/game-prototype.yaml +176 -0
  95. package/expansion-packs/bmad-creative-writing/README.md +146 -0
  96. package/expansion-packs/bmad-creative-writing/agent-teams/agent-team.yaml +20 -0
  97. package/expansion-packs/bmad-creative-writing/agents/beta-reader.md +94 -0
  98. package/expansion-packs/bmad-creative-writing/agents/book-critic.md +40 -0
  99. package/expansion-packs/bmad-creative-writing/agents/character-psychologist.md +93 -0
  100. package/expansion-packs/bmad-creative-writing/agents/cover-designer.md +46 -0
  101. package/expansion-packs/bmad-creative-writing/agents/dialog-specialist.md +92 -0
  102. package/expansion-packs/bmad-creative-writing/agents/editor.md +93 -0
  103. package/expansion-packs/bmad-creative-writing/agents/genre-specialist.md +95 -0
  104. package/expansion-packs/bmad-creative-writing/agents/narrative-designer.md +93 -0
  105. package/expansion-packs/bmad-creative-writing/agents/plot-architect.md +95 -0
  106. package/expansion-packs/bmad-creative-writing/agents/world-builder.md +94 -0
  107. package/expansion-packs/bmad-creative-writing/checklists/beta-feedback-closure-checklist.md +23 -0
  108. package/expansion-packs/bmad-creative-writing/checklists/character-consistency-checklist.md +23 -0
  109. package/expansion-packs/bmad-creative-writing/checklists/comedic-timing-checklist.md +23 -0
  110. package/expansion-packs/bmad-creative-writing/checklists/cyberpunk-aesthetic-checklist.md +23 -0
  111. package/expansion-packs/bmad-creative-writing/checklists/ebook-formatting-checklist.md +21 -0
  112. package/expansion-packs/bmad-creative-writing/checklists/epic-poetry-meter-checklist.md +23 -0
  113. package/expansion-packs/bmad-creative-writing/checklists/fantasy-magic-system-checklist.md +23 -0
  114. package/expansion-packs/bmad-creative-writing/checklists/foreshadowing-payoff-checklist.md +22 -0
  115. package/expansion-packs/bmad-creative-writing/checklists/genre-tropes-checklist.md +22 -0
  116. package/expansion-packs/bmad-creative-writing/checklists/historical-accuracy-checklist.md +23 -0
  117. package/expansion-packs/bmad-creative-writing/checklists/horror-suspense-checklist.md +23 -0
  118. package/expansion-packs/bmad-creative-writing/checklists/kdp-cover-ready-checklist.md +25 -0
  119. package/expansion-packs/bmad-creative-writing/checklists/line-edit-quality-checklist.md +23 -0
  120. package/expansion-packs/bmad-creative-writing/checklists/marketing-copy-checklist.md +23 -0
  121. package/expansion-packs/bmad-creative-writing/checklists/mystery-clue-trail-checklist.md +23 -0
  122. package/expansion-packs/bmad-creative-writing/checklists/orbital-mechanics-checklist.md +23 -0
  123. package/expansion-packs/bmad-creative-writing/checklists/plot-structure-checklist.md +59 -0
  124. package/expansion-packs/bmad-creative-writing/checklists/publication-readiness-checklist.md +23 -0
  125. package/expansion-packs/bmad-creative-writing/checklists/romance-emotional-beats-checklist.md +23 -0
  126. package/expansion-packs/bmad-creative-writing/checklists/scene-quality-checklist.md +23 -0
  127. package/expansion-packs/bmad-creative-writing/checklists/scifi-technology-plausibility-checklist.md +22 -0
  128. package/expansion-packs/bmad-creative-writing/checklists/sensitivity-representation-checklist.md +23 -0
  129. package/expansion-packs/bmad-creative-writing/checklists/steampunk-gadget-checklist.md +23 -0
  130. package/expansion-packs/bmad-creative-writing/checklists/thriller-pacing-stakes-checklist.md +23 -0
  131. package/expansion-packs/bmad-creative-writing/checklists/timeline-continuity-checklist.md +23 -0
  132. package/expansion-packs/bmad-creative-writing/checklists/world-building-continuity-checklist.md +23 -0
  133. package/expansion-packs/bmad-creative-writing/checklists/ya-appropriateness-checklist.md +23 -0
  134. package/expansion-packs/bmad-creative-writing/config.yaml +12 -0
  135. package/expansion-packs/bmad-creative-writing/data/bmad-kb.md +209 -0
  136. package/expansion-packs/bmad-creative-writing/data/story-structures.md +67 -0
  137. package/expansion-packs/bmad-creative-writing/docs/brief.md +212 -0
  138. package/expansion-packs/bmad-creative-writing/tasks/advanced-elicitation.md +119 -0
  139. package/expansion-packs/bmad-creative-writing/tasks/analyze-reader-feedback.md +23 -0
  140. package/expansion-packs/bmad-creative-writing/tasks/analyze-story-structure.md +67 -0
  141. package/expansion-packs/bmad-creative-writing/tasks/assemble-kdp-package.md +29 -0
  142. package/expansion-packs/bmad-creative-writing/tasks/brainstorm-premise.md +23 -0
  143. package/expansion-packs/bmad-creative-writing/tasks/build-world.md +24 -0
  144. package/expansion-packs/bmad-creative-writing/tasks/character-depth-pass.md +22 -0
  145. package/expansion-packs/bmad-creative-writing/tasks/create-doc.md +103 -0
  146. package/expansion-packs/bmad-creative-writing/tasks/create-draft-section.md +26 -0
  147. package/expansion-packs/bmad-creative-writing/tasks/critical-review.md +26 -0
  148. package/expansion-packs/bmad-creative-writing/tasks/develop-character.md +24 -0
  149. package/expansion-packs/bmad-creative-writing/tasks/execute-checklist.md +88 -0
  150. package/expansion-packs/bmad-creative-writing/tasks/expand-premise.md +23 -0
  151. package/expansion-packs/bmad-creative-writing/tasks/expand-synopsis.md +23 -0
  152. package/expansion-packs/bmad-creative-writing/tasks/final-polish.md +23 -0
  153. package/expansion-packs/bmad-creative-writing/tasks/generate-cover-brief.md +25 -0
  154. package/expansion-packs/bmad-creative-writing/tasks/generate-cover-prompts.md +26 -0
  155. package/expansion-packs/bmad-creative-writing/tasks/generate-scene-list.md +23 -0
  156. package/expansion-packs/bmad-creative-writing/tasks/incorporate-feedback.md +25 -0
  157. package/expansion-packs/bmad-creative-writing/tasks/outline-scenes.md +23 -0
  158. package/expansion-packs/bmad-creative-writing/tasks/provide-feedback.md +24 -0
  159. package/expansion-packs/bmad-creative-writing/tasks/publish-chapter.md +23 -0
  160. package/expansion-packs/bmad-creative-writing/tasks/quick-feedback.md +22 -0
  161. package/expansion-packs/bmad-creative-writing/tasks/select-next-arc.md +23 -0
  162. package/expansion-packs/bmad-creative-writing/tasks/workshop-dialog.md +64 -0
  163. package/expansion-packs/bmad-creative-writing/templates/beta-feedback-form.yaml +97 -0
  164. package/expansion-packs/bmad-creative-writing/templates/chapter-draft-tmpl.yaml +82 -0
  165. package/expansion-packs/bmad-creative-writing/templates/character-profile-tmpl.yaml +92 -0
  166. package/expansion-packs/bmad-creative-writing/templates/cover-design-brief-tmpl.yaml +98 -0
  167. package/expansion-packs/bmad-creative-writing/templates/premise-brief-tmpl.yaml +78 -0
  168. package/expansion-packs/bmad-creative-writing/templates/scene-list-tmpl.yaml +55 -0
  169. package/expansion-packs/bmad-creative-writing/templates/story-outline-tmpl.yaml +96 -0
  170. package/expansion-packs/bmad-creative-writing/templates/world-guide-tmpl.yaml +89 -0
  171. package/expansion-packs/bmad-creative-writing/workflows/book-cover-design-workflow.md +218 -0
  172. package/expansion-packs/bmad-creative-writing/workflows/novel-greenfield-workflow.yaml +56 -0
  173. package/expansion-packs/bmad-creative-writing/workflows/novel-serial-workflow.yaml +50 -0
  174. package/expansion-packs/bmad-creative-writing/workflows/novel-snowflake-workflow.yaml +69 -0
  175. package/expansion-packs/bmad-creative-writing/workflows/novel-writing.yaml +91 -0
  176. package/expansion-packs/bmad-creative-writing/workflows/screenplay-development.yaml +85 -0
  177. package/expansion-packs/bmad-creative-writing/workflows/series-planning.yaml +78 -0
  178. package/expansion-packs/bmad-creative-writing/workflows/short-story-creation.yaml +64 -0
  179. package/expansion-packs/bmad-infrastructure-devops/README.md +147 -0
  180. package/expansion-packs/bmad-infrastructure-devops/agents/infra-devops-platform.md +73 -0
  181. package/expansion-packs/bmad-infrastructure-devops/checklists/infrastructure-checklist.md +486 -0
  182. package/expansion-packs/bmad-infrastructure-devops/config.yaml +10 -0
  183. package/expansion-packs/bmad-infrastructure-devops/data/bmad-kb.md +307 -0
  184. package/expansion-packs/bmad-infrastructure-devops/tasks/review-infrastructure.md +161 -0
  185. package/expansion-packs/bmad-infrastructure-devops/tasks/validate-infrastructure.md +155 -0
  186. package/expansion-packs/bmad-infrastructure-devops/templates/infrastructure-architecture-tmpl.yaml +425 -0
  187. package/expansion-packs/bmad-infrastructure-devops/templates/infrastructure-platform-from-arch-tmpl.yaml +630 -0
  188. package/implement-fork-friendly-ci.sh +229 -0
  189. package/package.json +75 -45
  190. package/prettier.config.mjs +32 -0
  191. package/test.md +1 -0
  192. package/tools/builders/web-builder.js +128 -129
  193. package/tools/bump-all-versions.js +42 -33
  194. package/tools/bump-expansion-version.js +23 -16
  195. package/tools/cli.js +15 -15
  196. package/tools/flattener/aggregate.js +76 -0
  197. package/tools/flattener/binary.js +80 -0
  198. package/tools/flattener/discovery.js +71 -0
  199. package/tools/flattener/files.js +35 -0
  200. package/tools/flattener/ignoreRules.js +176 -0
  201. package/tools/flattener/main.js +458 -460
  202. package/tools/flattener/projectRoot.js +206 -0
  203. package/tools/flattener/prompts.js +44 -0
  204. package/tools/flattener/stats.helpers.js +395 -0
  205. package/tools/flattener/stats.js +80 -0
  206. package/tools/flattener/test-matrix.js +413 -0
  207. package/tools/flattener/xml.js +88 -0
  208. package/tools/installer/README.md +1 -1
  209. package/tools/installer/bin/xiaoma.js +377 -137
  210. package/tools/installer/config/ide-agent-config.yaml +3 -3
  211. package/tools/installer/config/install.config.yaml +73 -22
  212. package/tools/installer/lib/config-loader.js +48 -44
  213. package/tools/installer/lib/file-manager.js +91 -116
  214. package/tools/installer/lib/ide-base-setup.js +57 -56
  215. package/tools/installer/lib/ide-setup.js +816 -407
  216. package/tools/installer/lib/installer.js +915 -690
  217. package/tools/installer/lib/memory-profiler.js +54 -53
  218. package/tools/installer/lib/module-manager.js +19 -15
  219. package/tools/installer/lib/resource-locator.js +26 -28
  220. package/tools/installer/package-lock.json +67 -56
  221. package/tools/installer/package.json +24 -23
  222. package/tools/lib/dependency-resolver.js +30 -34
  223. package/tools/lib/yaml-utils.js +7 -7
  224. package/tools/md-assets/web-agent-startup-instructions.md +1 -1
  225. package/tools/preview-release-notes.js +66 -0
  226. package/tools/setup-hooks.sh +37 -0
  227. package/tools/shared/bannerArt.js +105 -0
  228. package/tools/sync-installer-version.js +7 -9
  229. package/tools/sync-version.sh +23 -0
  230. package/tools/update-expansion-version.js +14 -15
  231. package/tools/upgraders/v3-to-v4-upgrader.js +208 -299
  232. package/tools/version-bump.js +41 -26
  233. package/tools/xiaoma-npx-wrapper.js +11 -11
  234. package/tools/yaml-format.js +56 -43
  235. package/xiaoma-core/agent-teams/team-all.yaml +2 -1
  236. package/xiaoma-core/agent-teams/team-fullstack.yaml +1 -0
  237. package/xiaoma-core/agent-teams/team-ide-minimal.yaml +1 -0
  238. package/xiaoma-core/agent-teams/team-no-ui.yaml +1 -0
  239. package/xiaoma-core/agents/analyst.md +20 -17
  240. package/xiaoma-core/agents/architect.md +15 -14
  241. package/xiaoma-core/agents/dev.md +23 -18
  242. package/xiaoma-core/agents/pm.md +18 -15
  243. package/xiaoma-core/agents/po.md +13 -10
  244. package/xiaoma-core/agents/qa.md +46 -24
  245. package/xiaoma-core/agents/sm.md +11 -8
  246. package/xiaoma-core/agents/ux-expert.md +10 -7
  247. package/xiaoma-core/agents/xiaoma-master.md +24 -22
  248. package/xiaoma-core/agents/xiaoma-orchestrator.md +30 -33
  249. package/xiaoma-core/checklists/architect-checklist.md +2 -5
  250. package/xiaoma-core/checklists/change-checklist.md +4 -2
  251. package/xiaoma-core/checklists/pm-checklist.md +2 -5
  252. package/xiaoma-core/checklists/po-master-checklist.md +2 -9
  253. package/xiaoma-core/checklists/story-dod-checklist.md +2 -7
  254. package/xiaoma-core/checklists/story-draft-checklist.md +2 -3
  255. package/xiaoma-core/core-config.yaml +4 -1
  256. package/xiaoma-core/data/{xiaoma-kb.md → bmad-kb.md} +43 -37
  257. package/xiaoma-core/data/brainstorming-techniques.md +2 -0
  258. package/xiaoma-core/data/elicitation-methods.md +22 -0
  259. package/xiaoma-core/data/technical-preferences.md +2 -0
  260. package/xiaoma-core/data/test-levels-framework.md +148 -0
  261. package/xiaoma-core/data/test-priorities-matrix.md +174 -0
  262. package/xiaoma-core/tasks/advanced-elicitation.md +2 -0
  263. package/xiaoma-core/tasks/apply-qa-fixes.md +150 -0
  264. package/xiaoma-core/tasks/brownfield-create-epic.md +2 -0
  265. package/xiaoma-core/tasks/brownfield-create-story.md +2 -0
  266. package/xiaoma-core/tasks/correct-course.md +2 -0
  267. package/xiaoma-core/tasks/create-brownfield-story.md +14 -4
  268. package/xiaoma-core/tasks/create-deep-research-prompt.md +2 -11
  269. package/xiaoma-core/tasks/create-next-story.md +3 -1
  270. package/xiaoma-core/tasks/document-project.md +17 -13
  271. package/xiaoma-core/tasks/facilitate-brainstorming-session.md +5 -3
  272. package/xiaoma-core/tasks/generate-ai-frontend-prompt.md +2 -0
  273. package/xiaoma-core/tasks/index-docs.md +2 -6
  274. package/xiaoma-core/tasks/kb-mode-interaction.md +17 -15
  275. package/xiaoma-core/tasks/nfr-assess.md +345 -0
  276. package/xiaoma-core/tasks/qa-gate.md +163 -0
  277. package/xiaoma-core/tasks/review-story.md +245 -74
  278. package/xiaoma-core/tasks/risk-profile.md +355 -0
  279. package/xiaoma-core/tasks/shard-doc.md +2 -2
  280. package/xiaoma-core/tasks/test-design.md +176 -0
  281. package/xiaoma-core/tasks/trace-requirements.md +266 -0
  282. package/xiaoma-core/tasks/validate-next-story.md +2 -0
  283. package/xiaoma-core/templates/architecture-tmpl.yaml +50 -49
  284. package/xiaoma-core/templates/brainstorming-output-tmpl.yaml +5 -5
  285. package/xiaoma-core/templates/brownfield-architecture-tmpl.yaml +32 -31
  286. package/xiaoma-core/templates/brownfield-prd-tmpl.yaml +14 -13
  287. package/xiaoma-core/templates/competitor-analysis-tmpl.yaml +20 -6
  288. package/xiaoma-core/templates/front-end-architecture-tmpl.yaml +22 -9
  289. package/xiaoma-core/templates/front-end-spec-tmpl.yaml +25 -24
  290. package/xiaoma-core/templates/fullstack-architecture-tmpl.yaml +123 -104
  291. package/xiaoma-core/templates/market-research-tmpl.yaml +3 -2
  292. package/xiaoma-core/templates/prd-tmpl.yaml +10 -9
  293. package/xiaoma-core/templates/project-brief-tmpl.yaml +5 -4
  294. package/xiaoma-core/templates/qa-gate-tmpl.yaml +103 -0
  295. package/xiaoma-core/templates/story-tmpl.yaml +13 -12
  296. package/xiaoma-core/workflows/brownfield-fullstack.yaml +13 -12
  297. package/xiaoma-core/workflows/brownfield-service.yaml +5 -4
  298. package/xiaoma-core/workflows/brownfield-ui.yaml +5 -4
  299. package/xiaoma-core/workflows/greenfield-fullstack.yaml +7 -6
  300. package/xiaoma-core/workflows/greenfield-service.yaml +5 -4
  301. package/xiaoma-core/workflows/greenfield-ui.yaml +6 -5
  302. package/.releaserc.json +0 -18
  303. package/.vscode/settings.json +0 -44
  304. package/XiaoMa-Web/345/244/232/346/231/272/350/203/275/344/275/2230-1/351/241/271/347/233/256/345/274/200/345/217/221/345/256/214/346/225/264/346/214/207/345/215/227.md +0 -977
  305. package/XiaoMa-Web/347/216/260/346/234/211/351/241/271/347/233/256/351/234/200/346/261/202/345/274/200/345/217/221/345/256/214/346/225/264/346/214/207/345/215/227.md +0 -873
  306. package/XiaoMa-Web/347/272/257/345/211/215/347/253/257/351/241/271/347/233/256Claude-Code/345/274/200/345/217/221/345/256/214/346/225/264/346/214/207/345/215/227.md +0 -372
  307. package/XiaoMa-Web/351/241/271/347/233/256/346/200/273/347/273/223/346/212/245/345/221/212.md +0 -310
  308. package/dist/agents/dev-cn.txt +0 -428
  309. package/docs/quick-start.md +0 -179
  310. package/tools/bmad-npx-wrapper.js +0 -39
  311. package/tools/semantic-release-sync-installer.js +0 -30
  312. package/xiaoma-core/bmad-core/user-guide.md +0 -0
  313. package/xiaoma-core/enhanced-ide-development-workflow.md +0 -43
  314. package/xiaoma-core/user-guide.md +0 -251
  315. package/xiaoma-core/working-in-the-brownfield.md +0 -364
@@ -1,11 +1,9 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const path = require('path');
1
+ const fs = require('node:fs');
2
+ const path = require('node:path');
5
3
  const yaml = require('js-yaml');
6
4
 
7
- const args = process.argv.slice(2);
8
- const bumpType = args[0] || 'minor'; // default to minor
5
+ const arguments_ = process.argv.slice(2);
6
+ const bumpType = arguments_[0] || 'minor'; // default to minor
9
7
 
10
8
  if (!['major', 'minor', 'patch'].includes(bumpType)) {
11
9
  console.log('Usage: node bump-all-versions.js [major|minor|patch]');
@@ -15,22 +13,26 @@ if (!['major', 'minor', 'patch'].includes(bumpType)) {
15
13
 
16
14
  function bumpVersion(currentVersion, type) {
17
15
  const [major, minor, patch] = currentVersion.split('.').map(Number);
18
-
16
+
19
17
  switch (type) {
20
- case 'major':
18
+ case 'major': {
21
19
  return `${major + 1}.0.0`;
22
- case 'minor':
20
+ }
21
+ case 'minor': {
23
22
  return `${major}.${minor + 1}.0`;
24
- case 'patch':
23
+ }
24
+ case 'patch': {
25
25
  return `${major}.${minor}.${patch + 1}`;
26
- default:
26
+ }
27
+ default: {
27
28
  return currentVersion;
29
+ }
28
30
  }
29
31
  }
30
32
 
31
33
  async function bumpAllVersions() {
32
34
  const updatedItems = [];
33
-
35
+
34
36
  // First, bump the core version (package.json)
35
37
  const packagePath = path.join(__dirname, '..', 'package.json');
36
38
  try {
@@ -38,69 +40,76 @@ async function bumpAllVersions() {
38
40
  const packageJson = JSON.parse(packageContent);
39
41
  const oldCoreVersion = packageJson.version || '1.0.0';
40
42
  const newCoreVersion = bumpVersion(oldCoreVersion, bumpType);
41
-
43
+
42
44
  packageJson.version = newCoreVersion;
43
-
45
+
44
46
  fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2) + '\n');
45
-
46
- updatedItems.push({ type: 'core', name: 'BMad Core', oldVersion: oldCoreVersion, newVersion: newCoreVersion });
47
+
48
+ updatedItems.push({
49
+ type: 'core',
50
+ name: 'BMad Core',
51
+ oldVersion: oldCoreVersion,
52
+ newVersion: newCoreVersion,
53
+ });
47
54
  console.log(`✓ BMad Core (package.json): ${oldCoreVersion} → ${newCoreVersion}`);
48
55
  } catch (error) {
49
56
  console.error(`✗ Failed to update BMad Core: ${error.message}`);
50
57
  }
51
-
58
+
52
59
  // Then, bump all expansion packs
53
60
  const expansionPacksDir = path.join(__dirname, '..', 'expansion-packs');
54
-
61
+
55
62
  try {
56
63
  const entries = fs.readdirSync(expansionPacksDir, { withFileTypes: true });
57
-
64
+
58
65
  for (const entry of entries) {
59
66
  if (entry.isDirectory() && !entry.name.startsWith('.') && entry.name !== 'README.md') {
60
67
  const packId = entry.name;
61
68
  const configPath = path.join(expansionPacksDir, packId, 'config.yaml');
62
-
69
+
63
70
  if (fs.existsSync(configPath)) {
64
71
  try {
65
72
  const configContent = fs.readFileSync(configPath, 'utf8');
66
73
  const config = yaml.load(configContent);
67
74
  const oldVersion = config.version || '1.0.0';
68
75
  const newVersion = bumpVersion(oldVersion, bumpType);
69
-
76
+
70
77
  config.version = newVersion;
71
-
78
+
72
79
  const updatedYaml = yaml.dump(config, { indent: 2 });
73
80
  fs.writeFileSync(configPath, updatedYaml);
74
-
81
+
75
82
  updatedItems.push({ type: 'expansion', name: packId, oldVersion, newVersion });
76
83
  console.log(`✓ ${packId}: ${oldVersion} → ${newVersion}`);
77
-
78
84
  } catch (error) {
79
85
  console.error(`✗ Failed to update ${packId}: ${error.message}`);
80
86
  }
81
87
  }
82
88
  }
83
89
  }
84
-
90
+
85
91
  if (updatedItems.length > 0) {
86
- const coreCount = updatedItems.filter(i => i.type === 'core').length;
87
- const expansionCount = updatedItems.filter(i => i.type === 'expansion').length;
88
-
89
- console.log(`\n✓ Successfully bumped ${updatedItems.length} item(s) with ${bumpType} version bump`);
92
+ const coreCount = updatedItems.filter((index) => index.type === 'core').length;
93
+ const expansionCount = updatedItems.filter((index) => index.type === 'expansion').length;
94
+
95
+ console.log(
96
+ `\n✓ Successfully bumped ${updatedItems.length} item(s) with ${bumpType} version bump`,
97
+ );
90
98
  if (coreCount > 0) console.log(` - ${coreCount} core`);
91
99
  if (expansionCount > 0) console.log(` - ${expansionCount} expansion pack(s)`);
92
-
100
+
93
101
  console.log('\nNext steps:');
94
102
  console.log('1. Test the changes');
95
- console.log('2. Commit: git add -A && git commit -m "chore: bump all versions (' + bumpType + ')"');
103
+ console.log(
104
+ '2. Commit: git add -A && git commit -m "chore: bump all versions (' + bumpType + ')"',
105
+ );
96
106
  } else {
97
107
  console.log('No items found to update');
98
108
  }
99
-
100
109
  } catch (error) {
101
110
  console.error('Error reading expansion packs directory:', error.message);
102
111
  process.exit(1);
103
112
  }
104
113
  }
105
114
 
106
- bumpAllVersions();
115
+ bumpAllVersions();
@@ -1,17 +1,15 @@
1
- #!/usr/bin/env node
2
-
3
1
  // Load required modules
4
- const fs = require('fs');
5
- const path = require('path');
2
+ const fs = require('node:fs');
3
+ const path = require('node:path');
6
4
  const yaml = require('js-yaml');
7
5
 
8
6
  // Parse CLI arguments
9
- const args = process.argv.slice(2);
10
- const packId = args[0];
11
- const bumpType = args[1] || 'minor';
7
+ const arguments_ = process.argv.slice(2);
8
+ const packId = arguments_[0];
9
+ const bumpType = arguments_[1] || 'minor';
12
10
 
13
11
  // Validate arguments
14
- if (!packId || args.length > 2) {
12
+ if (!packId || arguments_.length > 2) {
15
13
  console.log('Usage: node bump-expansion-version.js <expansion-pack-id> [major|minor|patch]');
16
14
  console.log('Default: minor');
17
15
  console.log('Example: node bump-expansion-version.js bmad-creator-tools patch');
@@ -28,10 +26,18 @@ function bumpVersion(currentVersion, type) {
28
26
  const [major, minor, patch] = currentVersion.split('.').map(Number);
29
27
 
30
28
  switch (type) {
31
- case 'major': return `${major + 1}.0.0`;
32
- case 'minor': return `${major}.${minor + 1}.0`;
33
- case 'patch': return `${major}.${minor}.${patch + 1}`;
34
- default: return currentVersion;
29
+ case 'major': {
30
+ return `${major + 1}.0.0`;
31
+ }
32
+ case 'minor': {
33
+ return `${major}.${minor + 1}.0`;
34
+ }
35
+ case 'patch': {
36
+ return `${major}.${minor}.${patch + 1}`;
37
+ }
38
+ default: {
39
+ return currentVersion;
40
+ }
35
41
  }
36
42
  }
37
43
 
@@ -47,11 +53,11 @@ async function updateVersion() {
47
53
  const packsDir = path.join(__dirname, '..', 'expansion-packs');
48
54
  const entries = fs.readdirSync(packsDir, { withFileTypes: true });
49
55
 
50
- entries.forEach(entry => {
56
+ for (const entry of entries) {
51
57
  if (entry.isDirectory() && !entry.name.startsWith('.')) {
52
58
  console.log(` - ${entry.name}`);
53
59
  }
54
- });
60
+ }
55
61
 
56
62
  process.exit(1);
57
63
  }
@@ -72,8 +78,9 @@ async function updateVersion() {
72
78
  console.log(`\n✓ Successfully bumped ${packId} with ${bumpType} version bump`);
73
79
  console.log('\nNext steps:');
74
80
  console.log(`1. Test the changes`);
75
- console.log(`2. Commit: git add -A && git commit -m "chore: bump ${packId} version (${bumpType})"`);
76
-
81
+ console.log(
82
+ `2. Commit: git add -A && git commit -m "chore: bump ${packId} version (${bumpType})"`,
83
+ );
77
84
  } catch (error) {
78
85
  console.error('Error updating version:', error.message);
79
86
  process.exit(1);
package/tools/cli.js CHANGED
@@ -1,16 +1,14 @@
1
- #!/usr/bin/env node
2
-
3
1
  const { Command } = require('commander');
4
2
  const WebBuilder = require('./builders/web-builder');
5
3
  const V3ToV4Upgrader = require('./upgraders/v3-to-v4-upgrader');
6
4
  const IdeSetup = require('./installer/lib/ide-setup');
7
- const path = require('path');
5
+ const path = require('node:path');
8
6
 
9
7
  const program = new Command();
10
8
 
11
9
  program
12
- .name('xiaoma-build')
13
- .description('XiaoMa-Method build tool for creating web bundles')
10
+ .name('bmad-build')
11
+ .description('BMAD-METHOD™ build tool for creating web bundles')
14
12
  .version('4.0.0');
15
13
 
16
14
  program
@@ -23,7 +21,7 @@ program
23
21
  .option('--no-clean', 'Skip cleaning output directories')
24
22
  .action(async (options) => {
25
23
  const builder = new WebBuilder({
26
- rootDir: process.cwd()
24
+ rootDir: process.cwd(),
27
25
  });
28
26
 
29
27
  try {
@@ -66,7 +64,7 @@ program
66
64
  .option('--no-clean', 'Skip cleaning output directories')
67
65
  .action(async (options) => {
68
66
  const builder = new WebBuilder({
69
- rootDir: process.cwd()
67
+ rootDir: process.cwd(),
70
68
  });
71
69
 
72
70
  try {
@@ -92,7 +90,8 @@ program
92
90
  const builder = new WebBuilder({ rootDir: process.cwd() });
93
91
  const agents = await builder.resolver.listAgents();
94
92
  console.log('Available agents:');
95
- agents.forEach(agent => console.log(` - ${agent}`));
93
+ for (const agent of agents) console.log(` - ${agent}`);
94
+ process.exit(0);
96
95
  });
97
96
 
98
97
  program
@@ -102,7 +101,8 @@ program
102
101
  const builder = new WebBuilder({ rootDir: process.cwd() });
103
102
  const expansions = await builder.listExpansionPacks();
104
103
  console.log('Available expansion packs:');
105
- expansions.forEach(expansion => console.log(` - ${expansion}`));
104
+ for (const expansion of expansions) console.log(` - ${expansion}`);
105
+ process.exit(0);
106
106
  });
107
107
 
108
108
  program
@@ -114,19 +114,19 @@ program
114
114
  // Validate by attempting to build all agents and teams
115
115
  const agents = await builder.resolver.listAgents();
116
116
  const teams = await builder.resolver.listTeams();
117
-
117
+
118
118
  console.log('Validating agents...');
119
119
  for (const agent of agents) {
120
120
  await builder.resolver.resolveAgentDependencies(agent);
121
121
  console.log(` ✓ ${agent}`);
122
122
  }
123
-
123
+
124
124
  console.log('\nValidating teams...');
125
125
  for (const team of teams) {
126
126
  await builder.resolver.resolveTeamDependencies(team);
127
127
  console.log(` ✓ ${team}`);
128
128
  }
129
-
129
+
130
130
  console.log('\nAll configurations are valid!');
131
131
  } catch (error) {
132
132
  console.error('Validation failed:', error.message);
@@ -136,7 +136,7 @@ program
136
136
 
137
137
  program
138
138
  .command('upgrade')
139
- .description('Upgrade a XiaoMa-Method V3 project to V4')
139
+ .description('Upgrade a BMAD-METHOD™ V3 project to V4')
140
140
  .option('-p, --project <path>', 'Path to V3 project (defaults to current directory)')
141
141
  .option('--dry-run', 'Show what would be changed without making changes')
142
142
  .option('--no-backup', 'Skip creating backup (not recommended)')
@@ -145,8 +145,8 @@ program
145
145
  await upgrader.upgrade({
146
146
  projectPath: options.project,
147
147
  dryRun: options.dryRun,
148
- backup: options.backup
148
+ backup: options.backup,
149
149
  });
150
150
  });
151
151
 
152
- program.parse();
152
+ program.parse();
@@ -0,0 +1,76 @@
1
+ const fs = require('fs-extra');
2
+ const path = require('node:path');
3
+ const os = require('node:os');
4
+ const { isBinaryFile } = require('./binary.js');
5
+
6
+ /**
7
+ * Aggregate file contents with bounded concurrency.
8
+ * Returns text files, binary files (with size), and errors.
9
+ * @param {string[]} files absolute file paths
10
+ * @param {string} rootDir
11
+ * @param {{ text?: string, warn?: (msg: string) => void } | null} spinner
12
+ */
13
+ async function aggregateFileContents(files, rootDir, spinner = null) {
14
+ const results = {
15
+ textFiles: [],
16
+ binaryFiles: [],
17
+ errors: [],
18
+ totalFiles: files.length,
19
+ processedFiles: 0,
20
+ };
21
+
22
+ // Automatic concurrency selection based on CPU count and workload size.
23
+ // - Base on 2x logical CPUs, clamped to [2, 64]
24
+ // - For very small workloads, avoid excessive parallelism
25
+ const cpuCount = os.cpus && Array.isArray(os.cpus()) ? os.cpus().length : os.cpus?.length || 4;
26
+ let concurrency = Math.min(64, Math.max(2, (Number(cpuCount) || 4) * 2));
27
+ if (files.length > 0 && files.length < concurrency) {
28
+ concurrency = Math.max(1, Math.min(concurrency, Math.ceil(files.length / 2)));
29
+ }
30
+
31
+ async function processOne(filePath) {
32
+ try {
33
+ const relativePath = path.relative(rootDir, filePath);
34
+ if (spinner) {
35
+ spinner.text = `Processing: ${relativePath} (${results.processedFiles + 1}/${results.totalFiles})`;
36
+ }
37
+
38
+ const binary = await isBinaryFile(filePath);
39
+ if (binary) {
40
+ const { size } = await fs.stat(filePath);
41
+ results.binaryFiles.push({ path: relativePath, absolutePath: filePath, size });
42
+ } else {
43
+ const content = await fs.readFile(filePath, 'utf8');
44
+ results.textFiles.push({
45
+ path: relativePath,
46
+ absolutePath: filePath,
47
+ content,
48
+ size: content.length,
49
+ lines: content.split('\n').length,
50
+ });
51
+ }
52
+ } catch (error) {
53
+ const relativePath = path.relative(rootDir, filePath);
54
+ const errorInfo = { path: relativePath, absolutePath: filePath, error: error.message };
55
+ results.errors.push(errorInfo);
56
+ if (spinner) {
57
+ spinner.warn(`Warning: Could not read file ${relativePath}: ${error.message}`);
58
+ } else {
59
+ console.warn(`Warning: Could not read file ${relativePath}: ${error.message}`);
60
+ }
61
+ } finally {
62
+ results.processedFiles++;
63
+ }
64
+ }
65
+
66
+ for (let index = 0; index < files.length; index += concurrency) {
67
+ const slice = files.slice(index, index + concurrency);
68
+ await Promise.all(slice.map(processOne));
69
+ }
70
+
71
+ return results;
72
+ }
73
+
74
+ module.exports = {
75
+ aggregateFileContents,
76
+ };
@@ -0,0 +1,80 @@
1
+ const fsp = require('node:fs/promises');
2
+ const path = require('node:path');
3
+ const { Buffer } = require('node:buffer');
4
+
5
+ /**
6
+ * Efficiently determine if a file is binary without reading the whole file.
7
+ * - Fast path by extension for common binaries
8
+ * - Otherwise read a small prefix and check for NUL bytes
9
+ * @param {string} filePath
10
+ * @returns {Promise<boolean>}
11
+ */
12
+ async function isBinaryFile(filePath) {
13
+ try {
14
+ const stats = await fsp.stat(filePath);
15
+ if (stats.isDirectory()) {
16
+ throw new Error('EISDIR: illegal operation on a directory');
17
+ }
18
+
19
+ const binaryExtensions = new Set([
20
+ '.jpg',
21
+ '.jpeg',
22
+ '.png',
23
+ '.gif',
24
+ '.bmp',
25
+ '.ico',
26
+ '.svg',
27
+ '.pdf',
28
+ '.doc',
29
+ '.docx',
30
+ '.xls',
31
+ '.xlsx',
32
+ '.ppt',
33
+ '.pptx',
34
+ '.zip',
35
+ '.tar',
36
+ '.gz',
37
+ '.rar',
38
+ '.7z',
39
+ '.exe',
40
+ '.dll',
41
+ '.so',
42
+ '.dylib',
43
+ '.mp3',
44
+ '.mp4',
45
+ '.avi',
46
+ '.mov',
47
+ '.wav',
48
+ '.ttf',
49
+ '.otf',
50
+ '.woff',
51
+ '.woff2',
52
+ '.bin',
53
+ '.dat',
54
+ '.db',
55
+ '.sqlite',
56
+ ]);
57
+
58
+ const extension = path.extname(filePath).toLowerCase();
59
+ if (binaryExtensions.has(extension)) return true;
60
+ if (stats.size === 0) return false;
61
+
62
+ const sampleSize = Math.min(4096, stats.size);
63
+ const fd = await fsp.open(filePath, 'r');
64
+ try {
65
+ const buffer = Buffer.allocUnsafe(sampleSize);
66
+ const { bytesRead } = await fd.read(buffer, 0, sampleSize, 0);
67
+ const slice = bytesRead === sampleSize ? buffer : buffer.subarray(0, bytesRead);
68
+ return slice.includes(0);
69
+ } finally {
70
+ await fd.close();
71
+ }
72
+ } catch (error) {
73
+ console.warn(`Warning: Could not determine if file is binary: ${filePath} - ${error.message}`);
74
+ return false;
75
+ }
76
+ }
77
+
78
+ module.exports = {
79
+ isBinaryFile,
80
+ };
@@ -0,0 +1,71 @@
1
+ const path = require('node:path');
2
+ const { execFile } = require('node:child_process');
3
+ const { promisify } = require('node:util');
4
+ const { glob } = require('glob');
5
+ const { loadIgnore } = require('./ignoreRules.js');
6
+
7
+ const pExecFile = promisify(execFile);
8
+
9
+ async function isGitRepo(rootDir) {
10
+ try {
11
+ const { stdout } = await pExecFile('git', ['rev-parse', '--is-inside-work-tree'], {
12
+ cwd: rootDir,
13
+ });
14
+ return (
15
+ String(stdout || '')
16
+ .toString()
17
+ .trim() === 'true'
18
+ );
19
+ } catch {
20
+ return false;
21
+ }
22
+ }
23
+
24
+ async function gitListFiles(rootDir) {
25
+ try {
26
+ const { stdout } = await pExecFile('git', ['ls-files', '-co', '--exclude-standard'], {
27
+ cwd: rootDir,
28
+ });
29
+ return String(stdout || '')
30
+ .split(/\r?\n/)
31
+ .map((s) => s.trim())
32
+ .filter(Boolean);
33
+ } catch {
34
+ return [];
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Discover files under rootDir.
40
+ * - Prefer git ls-files when available for speed/correctness
41
+ * - Fallback to glob and apply unified ignore rules
42
+ * @param {string} rootDir
43
+ * @param {object} [options]
44
+ * @param {boolean} [options.preferGit=true]
45
+ * @returns {Promise<string[]>} absolute file paths
46
+ */
47
+ async function discoverFiles(rootDir, options = {}) {
48
+ const { preferGit = true } = options;
49
+ const { filter } = await loadIgnore(rootDir);
50
+
51
+ // Try git first
52
+ if (preferGit && (await isGitRepo(rootDir))) {
53
+ const relFiles = await gitListFiles(rootDir);
54
+ const filteredRel = relFiles.filter((p) => filter(p));
55
+ return filteredRel.map((p) => path.resolve(rootDir, p));
56
+ }
57
+
58
+ // Glob fallback
59
+ const globbed = await glob('**/*', {
60
+ cwd: rootDir,
61
+ nodir: true,
62
+ dot: true,
63
+ follow: false,
64
+ });
65
+ const filteredRel = globbed.filter((p) => filter(p));
66
+ return filteredRel.map((p) => path.resolve(rootDir, p));
67
+ }
68
+
69
+ module.exports = {
70
+ discoverFiles,
71
+ };
@@ -0,0 +1,35 @@
1
+ const path = require('node:path');
2
+ const discovery = require('./discovery.js');
3
+ const ignoreRules = require('./ignoreRules.js');
4
+ const { isBinaryFile } = require('./binary.js');
5
+ const { aggregateFileContents } = require('./aggregate.js');
6
+
7
+ // Backward-compatible signature; delegate to central loader
8
+ async function parseGitignore(gitignorePath) {
9
+ return await ignoreRules.parseGitignore(gitignorePath);
10
+ }
11
+
12
+ async function discoverFiles(rootDir) {
13
+ try {
14
+ // Delegate to discovery module which respects .gitignore and defaults
15
+ return await discovery.discoverFiles(rootDir, { preferGit: true });
16
+ } catch (error) {
17
+ console.error('Error discovering files:', error.message);
18
+ return [];
19
+ }
20
+ }
21
+
22
+ async function filterFiles(files, rootDir) {
23
+ const { filter } = await ignoreRules.loadIgnore(rootDir);
24
+ const relativeFiles = files.map((f) => path.relative(rootDir, f));
25
+ const filteredRelative = relativeFiles.filter((p) => filter(p));
26
+ return filteredRelative.map((p) => path.resolve(rootDir, p));
27
+ }
28
+
29
+ module.exports = {
30
+ parseGitignore,
31
+ discoverFiles,
32
+ isBinaryFile,
33
+ aggregateFileContents,
34
+ filterFiles,
35
+ };