@sk8metal/michi-cli 0.14.1 → 0.19.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 (614) hide show
  1. package/CHANGELOG.md +268 -2
  2. package/README.md +27 -2
  3. package/dist/scripts/config/config-schema.d.ts +5 -333
  4. package/dist/scripts/config/config-schema.d.ts.map +1 -1
  5. package/dist/scripts/config/config-schema.js +6 -233
  6. package/dist/scripts/config/config-schema.js.map +1 -1
  7. package/dist/scripts/config-global.d.ts.map +1 -1
  8. package/dist/scripts/config-global.js +3 -2
  9. package/dist/scripts/config-global.js.map +1 -1
  10. package/dist/scripts/confluence-sync.d.ts +5 -73
  11. package/dist/scripts/confluence-sync.d.ts.map +1 -1
  12. package/dist/scripts/confluence-sync.js +14 -392
  13. package/dist/scripts/confluence-sync.js.map +1 -1
  14. package/dist/scripts/constants/environments.d.ts +3 -30
  15. package/dist/scripts/constants/environments.d.ts.map +1 -1
  16. package/dist/scripts/constants/environments.js +3 -41
  17. package/dist/scripts/constants/environments.js.map +1 -1
  18. package/dist/scripts/constants/languages.d.ts +3 -20
  19. package/dist/scripts/constants/languages.d.ts.map +1 -1
  20. package/dist/scripts/constants/languages.js +3 -50
  21. package/dist/scripts/constants/languages.js.map +1 -1
  22. package/dist/scripts/constants/test-commands.d.ts +3 -33
  23. package/dist/scripts/constants/test-commands.d.ts.map +1 -1
  24. package/dist/scripts/constants/test-commands.js +3 -67
  25. package/dist/scripts/constants/test-commands.js.map +1 -1
  26. package/dist/scripts/dev-tools/mermaid-converter.d.ts.map +1 -0
  27. package/dist/scripts/dev-tools/mermaid-converter.js.map +1 -0
  28. package/dist/scripts/dev-tools/test-interactive.d.ts.map +1 -0
  29. package/dist/scripts/{test-interactive.js → dev-tools/test-interactive.js} +4 -3
  30. package/dist/scripts/dev-tools/test-interactive.js.map +1 -0
  31. package/dist/scripts/github-actions-client.d.ts +5 -75
  32. package/dist/scripts/github-actions-client.d.ts.map +1 -1
  33. package/dist/scripts/github-actions-client.js +4 -178
  34. package/dist/scripts/github-actions-client.js.map +1 -1
  35. package/dist/scripts/jira-sync.d.ts +3 -121
  36. package/dist/scripts/jira-sync.d.ts.map +1 -1
  37. package/dist/scripts/jira-sync.js +5 -879
  38. package/dist/scripts/jira-sync.js.map +1 -1
  39. package/dist/scripts/markdown-to-confluence.d.ts.map +1 -1
  40. package/dist/scripts/markdown-to-confluence.js +2 -2
  41. package/dist/scripts/markdown-to-confluence.js.map +1 -1
  42. package/dist/scripts/multi-project-estimate.d.ts.map +1 -1
  43. package/dist/scripts/multi-project-estimate.js +3 -2
  44. package/dist/scripts/multi-project-estimate.js.map +1 -1
  45. package/dist/scripts/phase-runner.d.ts.map +1 -1
  46. package/dist/scripts/phase-runner.js +34 -18
  47. package/dist/scripts/phase-runner.js.map +1 -1
  48. package/dist/scripts/pre-flight-check.d.ts.map +1 -1
  49. package/dist/scripts/pre-flight-check.js +27 -11
  50. package/dist/scripts/pre-flight-check.js.map +1 -1
  51. package/dist/scripts/template/multi-repo-renderer.js +2 -2
  52. package/dist/scripts/template/multi-repo-renderer.js.map +1 -1
  53. package/dist/scripts/test-execution-generator.d.ts.map +1 -1
  54. package/dist/scripts/test-execution-generator.js +5 -4
  55. package/dist/scripts/test-execution-generator.js.map +1 -1
  56. package/dist/scripts/utils/aidlc-parser.d.ts +5 -82
  57. package/dist/scripts/utils/aidlc-parser.d.ts.map +1 -1
  58. package/dist/scripts/utils/aidlc-parser.js +4 -204
  59. package/dist/scripts/utils/aidlc-parser.js.map +1 -1
  60. package/dist/scripts/utils/ci-generator.d.ts.map +1 -1
  61. package/dist/scripts/utils/ci-generator.js +4 -3
  62. package/dist/scripts/utils/ci-generator.js.map +1 -1
  63. package/dist/scripts/utils/config-loader.d.ts.map +1 -1
  64. package/dist/scripts/utils/config-loader.js +46 -49
  65. package/dist/scripts/utils/config-loader.js.map +1 -1
  66. package/dist/scripts/utils/config-validator.d.ts +9 -10
  67. package/dist/scripts/utils/config-validator.d.ts.map +1 -1
  68. package/dist/scripts/utils/config-validator.js +68 -70
  69. package/dist/scripts/utils/config-validator.js.map +1 -1
  70. package/dist/scripts/utils/docker-requirement-detector.d.ts.map +1 -1
  71. package/dist/scripts/utils/docker-requirement-detector.js +5 -4
  72. package/dist/scripts/utils/docker-requirement-detector.js.map +1 -1
  73. package/dist/scripts/utils/env-config.d.ts.map +1 -1
  74. package/dist/scripts/utils/env-config.js +55 -38
  75. package/dist/scripts/utils/env-config.js.map +1 -1
  76. package/dist/scripts/utils/feature-name-validator.d.ts +4 -9
  77. package/dist/scripts/utils/feature-name-validator.d.ts.map +1 -1
  78. package/dist/scripts/utils/feature-name-validator.js +12 -21
  79. package/dist/scripts/utils/feature-name-validator.js.map +1 -1
  80. package/dist/scripts/utils/interactive-helpers.d.ts +5 -29
  81. package/dist/scripts/utils/interactive-helpers.d.ts.map +1 -1
  82. package/dist/scripts/utils/interactive-helpers.js +5 -89
  83. package/dist/scripts/utils/interactive-helpers.js.map +1 -1
  84. package/dist/scripts/utils/language-detector.d.ts.map +1 -1
  85. package/dist/scripts/utils/language-detector.js +4 -3
  86. package/dist/scripts/utils/language-detector.js.map +1 -1
  87. package/dist/scripts/utils/markdown-parser.d.ts +6 -52
  88. package/dist/scripts/utils/markdown-parser.d.ts.map +1 -1
  89. package/dist/scripts/utils/markdown-parser.js +5 -286
  90. package/dist/scripts/utils/markdown-parser.js.map +1 -1
  91. package/dist/scripts/utils/multi-repo-validator.d.ts +9 -10
  92. package/dist/scripts/utils/multi-repo-validator.d.ts.map +1 -1
  93. package/dist/scripts/utils/multi-repo-validator.js +15 -17
  94. package/dist/scripts/utils/multi-repo-validator.js.map +1 -1
  95. package/dist/scripts/utils/project-analyzer.d.ts +120 -0
  96. package/dist/scripts/utils/project-analyzer.d.ts.map +1 -0
  97. package/dist/scripts/utils/project-analyzer.js +358 -0
  98. package/dist/scripts/utils/project-analyzer.js.map +1 -0
  99. package/dist/scripts/utils/project-detector.d.ts.map +1 -1
  100. package/dist/scripts/utils/project-detector.js +6 -5
  101. package/dist/scripts/utils/project-detector.js.map +1 -1
  102. package/dist/scripts/utils/project-finder.d.ts +1 -21
  103. package/dist/scripts/utils/project-finder.d.ts.map +1 -1
  104. package/dist/scripts/utils/project-finder.js +2 -121
  105. package/dist/scripts/utils/project-finder.js.map +1 -1
  106. package/dist/scripts/utils/project-meta.d.ts +4 -27
  107. package/dist/scripts/utils/project-meta.d.ts.map +1 -1
  108. package/dist/scripts/utils/project-meta.js +3 -67
  109. package/dist/scripts/utils/project-meta.js.map +1 -1
  110. package/dist/scripts/utils/safe-file-reader.d.ts +84 -0
  111. package/dist/scripts/utils/safe-file-reader.d.ts.map +1 -0
  112. package/dist/scripts/utils/safe-file-reader.js +122 -0
  113. package/dist/scripts/utils/safe-file-reader.js.map +1 -0
  114. package/dist/scripts/utils/security-validator.d.ts +8 -19
  115. package/dist/scripts/utils/security-validator.d.ts.map +1 -1
  116. package/dist/scripts/utils/security-validator.js +28 -58
  117. package/dist/scripts/utils/security-validator.js.map +1 -1
  118. package/dist/scripts/utils/spec-archiver.d.ts.map +1 -1
  119. package/dist/scripts/utils/spec-archiver.js +7 -6
  120. package/dist/scripts/utils/spec-archiver.js.map +1 -1
  121. package/dist/scripts/utils/spec-updater.d.ts.map +1 -1
  122. package/dist/scripts/utils/spec-updater.js +10 -7
  123. package/dist/scripts/utils/spec-updater.js.map +1 -1
  124. package/dist/scripts/utils/tasks-converter.js +2 -2
  125. package/dist/scripts/utils/tasks-converter.js.map +1 -1
  126. package/dist/scripts/utils/tasks-format-validator.js +4 -4
  127. package/dist/scripts/utils/tasks-format-validator.js.map +1 -1
  128. package/dist/scripts/utils/template-applier.d.ts.map +1 -1
  129. package/dist/scripts/utils/template-applier.js +4 -3
  130. package/dist/scripts/utils/template-applier.js.map +1 -1
  131. package/dist/scripts/utils/types/validation.d.ts +57 -0
  132. package/dist/scripts/utils/types/validation.d.ts.map +1 -0
  133. package/dist/scripts/utils/types/validation.js +50 -0
  134. package/dist/scripts/utils/types/validation.js.map +1 -0
  135. package/dist/scripts/validate-phase.d.ts +6 -1
  136. package/dist/scripts/validate-phase.d.ts.map +1 -1
  137. package/dist/scripts/validate-phase.js +42 -20
  138. package/dist/scripts/validate-phase.js.map +1 -1
  139. package/dist/scripts/workflow-orchestrator.d.ts +4 -40
  140. package/dist/scripts/workflow-orchestrator.d.ts.map +1 -1
  141. package/dist/scripts/workflow-orchestrator.js +7 -194
  142. package/dist/scripts/workflow-orchestrator.js.map +1 -1
  143. package/dist/src/application/interfaces/config-provider.d.ts +89 -0
  144. package/dist/src/application/interfaces/config-provider.d.ts.map +1 -0
  145. package/dist/src/application/interfaces/config-provider.js +8 -0
  146. package/dist/src/application/interfaces/config-provider.js.map +1 -0
  147. package/dist/src/application/interfaces/external-api.d.ts +80 -0
  148. package/dist/src/application/interfaces/external-api.d.ts.map +1 -0
  149. package/dist/src/application/interfaces/external-api.js +8 -0
  150. package/dist/src/application/interfaces/external-api.js.map +1 -0
  151. package/dist/src/application/interfaces/spec-repository.d.ts +52 -0
  152. package/dist/src/application/interfaces/spec-repository.d.ts.map +1 -0
  153. package/dist/src/application/interfaces/spec-repository.js +8 -0
  154. package/dist/src/application/interfaces/spec-repository.js.map +1 -0
  155. package/dist/src/application/services/spec-service.d.ts +49 -0
  156. package/dist/src/application/services/spec-service.d.ts.map +1 -0
  157. package/dist/src/application/services/spec-service.js +94 -0
  158. package/dist/src/application/services/spec-service.js.map +1 -0
  159. package/dist/src/application/services/workflow-service.d.ts +58 -0
  160. package/dist/src/application/services/workflow-service.d.ts.map +1 -0
  161. package/dist/src/application/services/workflow-service.js +125 -0
  162. package/dist/src/application/services/workflow-service.js.map +1 -0
  163. package/dist/src/application/templates/processor.d.ts +31 -0
  164. package/dist/src/application/templates/processor.d.ts.map +1 -0
  165. package/dist/src/application/templates/processor.js +58 -0
  166. package/dist/src/application/templates/processor.js.map +1 -0
  167. package/dist/src/application/use-cases/spec/archive-spec.d.ts +34 -0
  168. package/dist/src/application/use-cases/spec/archive-spec.d.ts.map +1 -0
  169. package/dist/src/application/use-cases/spec/archive-spec.js +56 -0
  170. package/dist/src/application/use-cases/spec/archive-spec.js.map +1 -0
  171. package/dist/src/application/use-cases/spec/generate-design.d.ts +34 -0
  172. package/dist/src/application/use-cases/spec/generate-design.d.ts.map +1 -0
  173. package/dist/src/application/use-cases/spec/generate-design.js +58 -0
  174. package/dist/src/application/use-cases/spec/generate-design.js.map +1 -0
  175. package/dist/src/application/use-cases/spec/generate-requirements.d.ts +34 -0
  176. package/dist/src/application/use-cases/spec/generate-requirements.d.ts.map +1 -0
  177. package/dist/src/application/use-cases/spec/generate-requirements.js +58 -0
  178. package/dist/src/application/use-cases/spec/generate-requirements.js.map +1 -0
  179. package/dist/src/application/use-cases/spec/generate-tasks.d.ts +34 -0
  180. package/dist/src/application/use-cases/spec/generate-tasks.d.ts.map +1 -0
  181. package/dist/src/application/use-cases/spec/generate-tasks.js +58 -0
  182. package/dist/src/application/use-cases/spec/generate-tasks.js.map +1 -0
  183. package/dist/src/application/use-cases/spec/init-spec.d.ts +48 -0
  184. package/dist/src/application/use-cases/spec/init-spec.d.ts.map +1 -0
  185. package/dist/src/application/use-cases/spec/init-spec.js +121 -0
  186. package/dist/src/application/use-cases/spec/init-spec.js.map +1 -0
  187. package/dist/src/cli.d.ts +6 -7
  188. package/dist/src/cli.d.ts.map +1 -1
  189. package/dist/src/cli.js +6 -745
  190. package/dist/src/cli.js.map +1 -1
  191. package/dist/src/commands/config-validate.js +2 -2
  192. package/dist/src/commands/init.d.ts +6 -21
  193. package/dist/src/commands/init.d.ts.map +1 -1
  194. package/dist/src/commands/init.js +5 -508
  195. package/dist/src/commands/init.js.map +1 -1
  196. package/dist/src/commands/migrate.js +4 -3
  197. package/dist/src/commands/migrate.js.map +1 -1
  198. package/dist/src/commands/spec-archive.d.ts +6 -13
  199. package/dist/src/commands/spec-archive.d.ts.map +1 -1
  200. package/dist/src/commands/spec-archive.js +5 -36
  201. package/dist/src/commands/spec-archive.js.map +1 -1
  202. package/dist/src/commands/spec-list.d.ts +6 -11
  203. package/dist/src/commands/spec-list.d.ts.map +1 -1
  204. package/dist/src/commands/spec-list.js +5 -51
  205. package/dist/src/commands/spec-list.js.map +1 -1
  206. package/dist/src/domain/constants/approval.d.ts +18 -0
  207. package/dist/src/domain/constants/approval.d.ts.map +1 -0
  208. package/dist/src/domain/constants/approval.js +23 -0
  209. package/dist/src/domain/constants/approval.js.map +1 -0
  210. package/dist/src/domain/constants/environments.d.ts +33 -0
  211. package/dist/src/domain/constants/environments.d.ts.map +1 -0
  212. package/dist/src/domain/constants/environments.js +44 -0
  213. package/dist/src/domain/constants/environments.js.map +1 -0
  214. package/dist/src/domain/constants/index.d.ts +12 -0
  215. package/dist/src/domain/constants/index.d.ts.map +1 -0
  216. package/dist/src/domain/constants/index.js +18 -0
  217. package/dist/src/domain/constants/index.js.map +1 -0
  218. package/dist/src/domain/constants/languages.d.ts +23 -0
  219. package/dist/src/domain/constants/languages.d.ts.map +1 -0
  220. package/dist/src/domain/constants/languages.js +53 -0
  221. package/dist/src/domain/constants/languages.js.map +1 -0
  222. package/dist/src/domain/constants/phases.d.ts +32 -0
  223. package/dist/src/domain/constants/phases.d.ts.map +1 -0
  224. package/dist/src/domain/constants/phases.js +52 -0
  225. package/dist/src/domain/constants/phases.js.map +1 -0
  226. package/dist/src/domain/constants/test-commands.d.ts +36 -0
  227. package/dist/src/domain/constants/test-commands.d.ts.map +1 -0
  228. package/dist/src/domain/constants/test-commands.js +70 -0
  229. package/dist/src/domain/constants/test-commands.js.map +1 -0
  230. package/dist/src/domain/constants/validation-rules.d.ts +32 -0
  231. package/dist/src/domain/constants/validation-rules.d.ts.map +1 -0
  232. package/dist/src/domain/constants/validation-rules.js +51 -0
  233. package/dist/src/domain/constants/validation-rules.js.map +1 -0
  234. package/dist/src/domain/entities/spec.d.ts +66 -0
  235. package/dist/src/domain/entities/spec.d.ts.map +1 -0
  236. package/dist/src/domain/entities/spec.js +112 -0
  237. package/dist/src/domain/entities/spec.js.map +1 -0
  238. package/dist/src/domain/entities/task.d.ts +43 -0
  239. package/dist/src/domain/entities/task.d.ts.map +1 -0
  240. package/dist/src/domain/entities/task.js +65 -0
  241. package/dist/src/domain/entities/task.js.map +1 -0
  242. package/dist/src/domain/services/spec-validator.d.ts +46 -0
  243. package/dist/src/domain/services/spec-validator.d.ts.map +1 -0
  244. package/dist/src/domain/services/spec-validator.js +99 -0
  245. package/dist/src/domain/services/spec-validator.js.map +1 -0
  246. package/dist/src/domain/value-objects/feature-name.d.ts +24 -0
  247. package/dist/src/domain/value-objects/feature-name.d.ts.map +1 -0
  248. package/dist/src/domain/value-objects/feature-name.js +36 -0
  249. package/dist/src/domain/value-objects/feature-name.js.map +1 -0
  250. package/dist/src/domain/value-objects/index.d.ts +7 -0
  251. package/dist/src/domain/value-objects/index.d.ts.map +1 -0
  252. package/dist/src/domain/value-objects/index.js +7 -0
  253. package/dist/src/domain/value-objects/index.js.map +1 -0
  254. package/dist/src/infrastructure/config/index.d.ts +5 -0
  255. package/dist/src/infrastructure/config/index.d.ts.map +1 -0
  256. package/dist/src/infrastructure/config/index.js +6 -0
  257. package/dist/src/infrastructure/config/index.js.map +1 -0
  258. package/dist/src/infrastructure/config/schema.d.ts +337 -0
  259. package/dist/src/infrastructure/config/schema.d.ts.map +1 -0
  260. package/dist/src/infrastructure/config/schema.js +237 -0
  261. package/dist/src/infrastructure/config/schema.js.map +1 -0
  262. package/dist/src/infrastructure/external-apis/atlassian/confluence/approval.d.ts +14 -0
  263. package/dist/src/infrastructure/external-apis/atlassian/confluence/approval.d.ts.map +1 -0
  264. package/dist/src/infrastructure/external-apis/atlassian/confluence/approval.js +102 -0
  265. package/dist/src/infrastructure/external-apis/atlassian/confluence/approval.js.map +1 -0
  266. package/dist/src/infrastructure/external-apis/atlassian/confluence/client.d.ts +23 -0
  267. package/dist/src/infrastructure/external-apis/atlassian/confluence/client.d.ts.map +1 -0
  268. package/dist/src/infrastructure/external-apis/atlassian/confluence/client.js +192 -0
  269. package/dist/src/infrastructure/external-apis/atlassian/confluence/client.js.map +1 -0
  270. package/dist/src/infrastructure/external-apis/atlassian/confluence/hierarchy.d.ts +48 -0
  271. package/dist/src/infrastructure/external-apis/atlassian/confluence/hierarchy.d.ts.map +1 -0
  272. package/dist/src/infrastructure/external-apis/atlassian/confluence/hierarchy.js +531 -0
  273. package/dist/src/infrastructure/external-apis/atlassian/confluence/hierarchy.js.map +1 -0
  274. package/dist/src/infrastructure/external-apis/atlassian/confluence/index.d.ts +10 -0
  275. package/dist/src/infrastructure/external-apis/atlassian/confluence/index.d.ts.map +1 -0
  276. package/dist/src/infrastructure/external-apis/atlassian/confluence/index.js +12 -0
  277. package/dist/src/infrastructure/external-apis/atlassian/confluence/index.js.map +1 -0
  278. package/dist/src/infrastructure/external-apis/atlassian/confluence/sync-service.d.ts +13 -0
  279. package/dist/src/infrastructure/external-apis/atlassian/confluence/sync-service.d.ts.map +1 -0
  280. package/dist/src/infrastructure/external-apis/atlassian/confluence/sync-service.js +129 -0
  281. package/dist/src/infrastructure/external-apis/atlassian/confluence/sync-service.js.map +1 -0
  282. package/dist/src/infrastructure/external-apis/atlassian/confluence/types.d.ts +113 -0
  283. package/dist/src/infrastructure/external-apis/atlassian/confluence/types.d.ts.map +1 -0
  284. package/dist/src/infrastructure/external-apis/atlassian/confluence/types.js +5 -0
  285. package/dist/src/infrastructure/external-apis/atlassian/confluence/types.js.map +1 -0
  286. package/dist/src/infrastructure/external-apis/atlassian/jira/adf-converter.d.ts +15 -0
  287. package/dist/src/infrastructure/external-apis/atlassian/jira/adf-converter.d.ts.map +1 -0
  288. package/dist/src/infrastructure/external-apis/atlassian/jira/adf-converter.js +141 -0
  289. package/dist/src/infrastructure/external-apis/atlassian/jira/adf-converter.js.map +1 -0
  290. package/dist/src/infrastructure/external-apis/atlassian/jira/client.d.ts +50 -0
  291. package/dist/src/infrastructure/external-apis/atlassian/jira/client.d.ts.map +1 -0
  292. package/dist/src/infrastructure/external-apis/atlassian/jira/client.js +226 -0
  293. package/dist/src/infrastructure/external-apis/atlassian/jira/client.js.map +1 -0
  294. package/dist/src/infrastructure/external-apis/atlassian/jira/index.d.ts +12 -0
  295. package/dist/src/infrastructure/external-apis/atlassian/jira/index.d.ts.map +1 -0
  296. package/dist/src/infrastructure/external-apis/atlassian/jira/index.js +16 -0
  297. package/dist/src/infrastructure/external-apis/atlassian/jira/index.js.map +1 -0
  298. package/dist/src/infrastructure/external-apis/atlassian/jira/issue-builder.d.ts +49 -0
  299. package/dist/src/infrastructure/external-apis/atlassian/jira/issue-builder.d.ts.map +1 -0
  300. package/dist/src/infrastructure/external-apis/atlassian/jira/issue-builder.js +165 -0
  301. package/dist/src/infrastructure/external-apis/atlassian/jira/issue-builder.js.map +1 -0
  302. package/dist/src/infrastructure/external-apis/atlassian/jira/status-mapper.d.ts +14 -0
  303. package/dist/src/infrastructure/external-apis/atlassian/jira/status-mapper.d.ts.map +1 -0
  304. package/dist/src/infrastructure/external-apis/atlassian/jira/status-mapper.js +110 -0
  305. package/dist/src/infrastructure/external-apis/atlassian/jira/status-mapper.js.map +1 -0
  306. package/dist/src/infrastructure/external-apis/atlassian/jira/sync-service.d.ts +32 -0
  307. package/dist/src/infrastructure/external-apis/atlassian/jira/sync-service.d.ts.map +1 -0
  308. package/dist/src/infrastructure/external-apis/atlassian/jira/sync-service.js +284 -0
  309. package/dist/src/infrastructure/external-apis/atlassian/jira/sync-service.js.map +1 -0
  310. package/dist/src/infrastructure/external-apis/atlassian/jira/types.d.ts +114 -0
  311. package/dist/src/infrastructure/external-apis/atlassian/jira/types.d.ts.map +1 -0
  312. package/dist/src/infrastructure/external-apis/atlassian/jira/types.js +7 -0
  313. package/dist/src/infrastructure/external-apis/atlassian/jira/types.js.map +1 -0
  314. package/dist/src/infrastructure/external-apis/github/client.d.ts +25 -0
  315. package/dist/src/infrastructure/external-apis/github/client.d.ts.map +1 -0
  316. package/dist/src/infrastructure/external-apis/github/client.js +109 -0
  317. package/dist/src/infrastructure/external-apis/github/client.js.map +1 -0
  318. package/dist/src/infrastructure/external-apis/github/index.d.ts +7 -0
  319. package/dist/src/infrastructure/external-apis/github/index.d.ts.map +1 -0
  320. package/dist/src/infrastructure/external-apis/github/index.js +8 -0
  321. package/dist/src/infrastructure/external-apis/github/index.js.map +1 -0
  322. package/dist/src/infrastructure/external-apis/github/types.d.ts +69 -0
  323. package/dist/src/infrastructure/external-apis/github/types.d.ts.map +1 -0
  324. package/dist/src/infrastructure/external-apis/github/types.js +5 -0
  325. package/dist/src/infrastructure/external-apis/github/types.js.map +1 -0
  326. package/dist/src/infrastructure/external-apis/github/utils.d.ts +18 -0
  327. package/dist/src/infrastructure/external-apis/github/utils.d.ts.map +1 -0
  328. package/dist/src/infrastructure/external-apis/github/utils.js +84 -0
  329. package/dist/src/infrastructure/external-apis/github/utils.js.map +1 -0
  330. package/dist/src/infrastructure/filesystem/index.d.ts +6 -0
  331. package/dist/src/infrastructure/filesystem/index.d.ts.map +1 -0
  332. package/dist/src/infrastructure/filesystem/index.js +5 -0
  333. package/dist/src/infrastructure/filesystem/index.js.map +1 -0
  334. package/dist/src/infrastructure/filesystem/project-meta.d.ts +32 -0
  335. package/dist/src/infrastructure/filesystem/project-meta.d.ts.map +1 -0
  336. package/dist/src/infrastructure/filesystem/project-meta.js +75 -0
  337. package/dist/src/infrastructure/filesystem/project-meta.js.map +1 -0
  338. package/dist/src/infrastructure/parsers/aidlc-parser.d.ts +86 -0
  339. package/dist/src/infrastructure/parsers/aidlc-parser.d.ts.map +1 -0
  340. package/dist/src/infrastructure/parsers/aidlc-parser.js +208 -0
  341. package/dist/src/infrastructure/parsers/aidlc-parser.js.map +1 -0
  342. package/dist/src/infrastructure/parsers/index.d.ts +8 -0
  343. package/dist/src/infrastructure/parsers/index.d.ts.map +1 -0
  344. package/dist/src/infrastructure/parsers/index.js +6 -0
  345. package/dist/src/infrastructure/parsers/index.js.map +1 -0
  346. package/dist/src/infrastructure/parsers/markdown-parser.d.ts +51 -0
  347. package/dist/src/infrastructure/parsers/markdown-parser.d.ts.map +1 -0
  348. package/dist/src/infrastructure/parsers/markdown-parser.js +253 -0
  349. package/dist/src/infrastructure/parsers/markdown-parser.js.map +1 -0
  350. package/dist/src/presentation/cli/config.d.ts +12 -0
  351. package/dist/src/presentation/cli/config.d.ts.map +1 -0
  352. package/dist/src/presentation/cli/config.js +22 -0
  353. package/dist/src/presentation/cli/config.js.map +1 -0
  354. package/dist/src/presentation/cli/version.d.ts +10 -0
  355. package/dist/src/presentation/cli/version.d.ts.map +1 -0
  356. package/dist/src/presentation/cli/version.js +41 -0
  357. package/dist/src/presentation/cli/version.js.map +1 -0
  358. package/dist/src/presentation/cli.d.ts +22 -0
  359. package/dist/src/presentation/cli.d.ts.map +1 -0
  360. package/dist/src/presentation/cli.js +85 -0
  361. package/dist/src/presentation/cli.js.map +1 -0
  362. package/dist/src/presentation/commands/config/register.d.ts +11 -0
  363. package/dist/src/presentation/commands/config/register.d.ts.map +1 -0
  364. package/dist/src/presentation/commands/config/register.js +44 -0
  365. package/dist/src/presentation/commands/config/register.js.map +1 -0
  366. package/dist/src/presentation/commands/confluence/register.d.ts +11 -0
  367. package/dist/src/presentation/commands/confluence/register.d.ts.map +1 -0
  368. package/dist/src/presentation/commands/confluence/register.js +32 -0
  369. package/dist/src/presentation/commands/confluence/register.js.map +1 -0
  370. package/dist/src/presentation/commands/confluence/sync.d.ts +17 -0
  371. package/dist/src/presentation/commands/confluence/sync.d.ts.map +1 -0
  372. package/dist/src/presentation/commands/confluence/sync.js +25 -0
  373. package/dist/src/presentation/commands/confluence/sync.js.map +1 -0
  374. package/dist/src/presentation/commands/init/handler.d.ts +10 -0
  375. package/dist/src/presentation/commands/init/handler.d.ts.map +1 -0
  376. package/dist/src/presentation/commands/init/handler.js +64 -0
  377. package/dist/src/presentation/commands/init/handler.js.map +1 -0
  378. package/dist/src/presentation/commands/init/prompts.d.ts +41 -0
  379. package/dist/src/presentation/commands/init/prompts.d.ts.map +1 -0
  380. package/dist/src/presentation/commands/init/prompts.js +119 -0
  381. package/dist/src/presentation/commands/init/prompts.js.map +1 -0
  382. package/dist/src/presentation/commands/init/register.d.ts +11 -0
  383. package/dist/src/presentation/commands/init/register.d.ts.map +1 -0
  384. package/dist/src/presentation/commands/init/register.js +141 -0
  385. package/dist/src/presentation/commands/init/register.js.map +1 -0
  386. package/dist/src/presentation/commands/init/setup.d.ts +26 -0
  387. package/dist/src/presentation/commands/init/setup.d.ts.map +1 -0
  388. package/dist/src/presentation/commands/init/setup.js +196 -0
  389. package/dist/src/presentation/commands/init/setup.js.map +1 -0
  390. package/dist/src/presentation/commands/init/templates.d.ts +19 -0
  391. package/dist/src/presentation/commands/init/templates.d.ts.map +1 -0
  392. package/dist/src/presentation/commands/init/templates.js +140 -0
  393. package/dist/src/presentation/commands/init/templates.js.map +1 -0
  394. package/dist/src/presentation/commands/init/validation.d.ts +21 -0
  395. package/dist/src/presentation/commands/init/validation.d.ts.map +1 -0
  396. package/dist/src/presentation/commands/init/validation.js +65 -0
  397. package/dist/src/presentation/commands/init/validation.js.map +1 -0
  398. package/dist/src/presentation/commands/jira/register.d.ts +11 -0
  399. package/dist/src/presentation/commands/jira/register.d.ts.map +1 -0
  400. package/dist/src/presentation/commands/jira/register.js +75 -0
  401. package/dist/src/presentation/commands/jira/register.js.map +1 -0
  402. package/dist/src/presentation/commands/jira/sync.d.ts +29 -0
  403. package/dist/src/presentation/commands/jira/sync.d.ts.map +1 -0
  404. package/dist/src/presentation/commands/jira/sync.js +37 -0
  405. package/dist/src/presentation/commands/jira/sync.js.map +1 -0
  406. package/dist/src/{commands/multi-repo-add-repo.d.ts → presentation/commands/multi-repo/add-repo.d.ts} +1 -1
  407. package/dist/src/presentation/commands/multi-repo/add-repo.d.ts.map +1 -0
  408. package/dist/src/{commands/multi-repo-add-repo.js → presentation/commands/multi-repo/add-repo.js} +4 -4
  409. package/dist/src/presentation/commands/multi-repo/add-repo.js.map +1 -0
  410. package/dist/src/{commands/multi-repo-ci-status.d.ts → presentation/commands/multi-repo/ci-status.d.ts} +2 -2
  411. package/dist/src/presentation/commands/multi-repo/ci-status.d.ts.map +1 -0
  412. package/dist/src/{commands/multi-repo-ci-status.js → presentation/commands/multi-repo/ci-status.js} +95 -81
  413. package/dist/src/presentation/commands/multi-repo/ci-status.js.map +1 -0
  414. package/dist/src/{commands/multi-repo-confluence-sync.d.ts → presentation/commands/multi-repo/confluence-sync.d.ts} +1 -1
  415. package/dist/src/presentation/commands/multi-repo/confluence-sync.d.ts.map +1 -0
  416. package/dist/src/{commands/multi-repo-confluence-sync.js → presentation/commands/multi-repo/confluence-sync.js} +7 -6
  417. package/dist/src/presentation/commands/multi-repo/confluence-sync.js.map +1 -0
  418. package/dist/src/{commands/multi-repo-init.d.ts → presentation/commands/multi-repo/init.d.ts} +1 -1
  419. package/dist/src/presentation/commands/multi-repo/init.d.ts.map +1 -0
  420. package/dist/src/{commands/multi-repo-init.js → presentation/commands/multi-repo/init.js} +6 -6
  421. package/dist/src/presentation/commands/multi-repo/init.js.map +1 -0
  422. package/dist/src/{commands/multi-repo-list.d.ts → presentation/commands/multi-repo/list.d.ts} +1 -1
  423. package/dist/src/presentation/commands/multi-repo/list.d.ts.map +1 -0
  424. package/dist/src/{commands/multi-repo-list.js → presentation/commands/multi-repo/list.js} +2 -2
  425. package/dist/src/presentation/commands/multi-repo/list.js.map +1 -0
  426. package/dist/src/presentation/commands/multi-repo/register.d.ts +12 -0
  427. package/dist/src/presentation/commands/multi-repo/register.d.ts.map +1 -0
  428. package/dist/src/presentation/commands/multi-repo/register.js +249 -0
  429. package/dist/src/presentation/commands/multi-repo/register.js.map +1 -0
  430. package/dist/src/{commands/multi-repo-test.d.ts → presentation/commands/multi-repo/test.d.ts} +1 -1
  431. package/dist/src/presentation/commands/multi-repo/test.d.ts.map +1 -0
  432. package/dist/src/{commands/multi-repo-test.js → presentation/commands/multi-repo/test.js} +4 -4
  433. package/dist/src/presentation/commands/multi-repo/test.js.map +1 -0
  434. package/dist/src/presentation/commands/phase/register.d.ts +11 -0
  435. package/dist/src/presentation/commands/phase/register.d.ts.map +1 -0
  436. package/dist/src/presentation/commands/phase/register.js +97 -0
  437. package/dist/src/presentation/commands/phase/register.js.map +1 -0
  438. package/dist/src/presentation/commands/spec/archive.d.ts +17 -0
  439. package/dist/src/presentation/commands/spec/archive.d.ts.map +1 -0
  440. package/dist/src/presentation/commands/spec/archive.js +40 -0
  441. package/dist/src/presentation/commands/spec/archive.js.map +1 -0
  442. package/dist/src/presentation/commands/spec/list.d.ts +15 -0
  443. package/dist/src/presentation/commands/spec/list.d.ts.map +1 -0
  444. package/dist/src/presentation/commands/spec/list.js +55 -0
  445. package/dist/src/presentation/commands/spec/list.js.map +1 -0
  446. package/dist/src/presentation/commands/spec/register.d.ts +11 -0
  447. package/dist/src/presentation/commands/spec/register.d.ts.map +1 -0
  448. package/dist/src/presentation/commands/spec/register.js +45 -0
  449. package/dist/src/presentation/commands/spec/register.js.map +1 -0
  450. package/dist/src/presentation/commands/workflow/orchestrator.d.ts +50 -0
  451. package/dist/src/presentation/commands/workflow/orchestrator.d.ts.map +1 -0
  452. package/dist/src/presentation/commands/workflow/orchestrator.js +174 -0
  453. package/dist/src/presentation/commands/workflow/orchestrator.js.map +1 -0
  454. package/dist/src/presentation/commands/workflow/register.d.ts +11 -0
  455. package/dist/src/presentation/commands/workflow/register.d.ts.map +1 -0
  456. package/dist/src/presentation/commands/workflow/register.js +58 -0
  457. package/dist/src/presentation/commands/workflow/register.js.map +1 -0
  458. package/dist/src/presentation/formatters/error-formatter.d.ts +79 -0
  459. package/dist/src/presentation/formatters/error-formatter.d.ts.map +1 -0
  460. package/dist/src/presentation/formatters/error-formatter.js +150 -0
  461. package/dist/src/presentation/formatters/error-formatter.js.map +1 -0
  462. package/dist/src/presentation/formatters/index.d.ts +8 -0
  463. package/dist/src/presentation/formatters/index.d.ts.map +1 -0
  464. package/dist/src/presentation/formatters/index.js +11 -0
  465. package/dist/src/presentation/formatters/index.js.map +1 -0
  466. package/dist/src/presentation/formatters/output-formatter.d.ts +98 -0
  467. package/dist/src/presentation/formatters/output-formatter.d.ts.map +1 -0
  468. package/dist/src/presentation/formatters/output-formatter.js +165 -0
  469. package/dist/src/presentation/formatters/output-formatter.js.map +1 -0
  470. package/dist/src/presentation/formatters/progress-formatter.d.ts +121 -0
  471. package/dist/src/presentation/formatters/progress-formatter.d.ts.map +1 -0
  472. package/dist/src/presentation/formatters/progress-formatter.js +235 -0
  473. package/dist/src/presentation/formatters/progress-formatter.js.map +1 -0
  474. package/dist/src/presentation/interactive/confirmation.d.ts +24 -0
  475. package/dist/src/presentation/interactive/confirmation.d.ts.map +1 -0
  476. package/dist/src/presentation/interactive/confirmation.js +54 -0
  477. package/dist/src/presentation/interactive/confirmation.js.map +1 -0
  478. package/dist/src/presentation/interactive/index.d.ts +8 -0
  479. package/dist/src/presentation/interactive/index.d.ts.map +1 -0
  480. package/dist/src/presentation/interactive/index.js +11 -0
  481. package/dist/src/presentation/interactive/index.js.map +1 -0
  482. package/dist/src/presentation/interactive/prompts.d.ts +31 -0
  483. package/dist/src/presentation/interactive/prompts.d.ts.map +1 -0
  484. package/dist/src/presentation/interactive/prompts.js +71 -0
  485. package/dist/src/presentation/interactive/prompts.js.map +1 -0
  486. package/dist/src/presentation/interactive/selection.d.ts +31 -0
  487. package/dist/src/presentation/interactive/selection.d.ts.map +1 -0
  488. package/dist/src/presentation/interactive/selection.js +138 -0
  489. package/dist/src/presentation/interactive/selection.js.map +1 -0
  490. package/dist/src/shared/types/errors.d.ts +132 -0
  491. package/dist/src/shared/types/errors.d.ts.map +1 -0
  492. package/dist/src/shared/types/errors.js +61 -0
  493. package/dist/src/shared/types/errors.js.map +1 -0
  494. package/dist/src/shared/types/result.d.ts +53 -0
  495. package/dist/src/shared/types/result.d.ts.map +1 -0
  496. package/dist/src/shared/types/result.js +42 -0
  497. package/dist/src/shared/types/result.js.map +1 -0
  498. package/dist/test-confluence-auth.d.ts +6 -0
  499. package/dist/test-confluence-auth.d.ts.map +1 -0
  500. package/dist/test-confluence-auth.js +128 -0
  501. package/dist/test-confluence-auth.js.map +1 -0
  502. package/docs/MIGRATION.md +513 -0
  503. package/docs/architecture.md +774 -0
  504. package/docs/guides/comprehensive-verification-guide.md +1926 -0
  505. package/docs/onion-architecture-phase0-complete.md +91 -0
  506. package/package.json +6 -6
  507. package/scripts/README.md +148 -0
  508. package/scripts/__tests__/jira-transitions.test.ts +44 -30
  509. package/scripts/__tests__/mermaid-converter.test.ts +2 -2
  510. package/scripts/__tests__/multi-repo-validator.test.ts +62 -62
  511. package/scripts/__tests__/spec-archiver.test.ts +12 -0
  512. package/scripts/__tests__/validate-phase.test.ts +6 -6
  513. package/scripts/build/README.md +24 -0
  514. package/scripts/{copy-static-assets.js → build/copy-static-assets.js} +1 -1
  515. package/scripts/{set-permissions.js → build/set-permissions.js} +1 -1
  516. package/scripts/config/config-schema.ts +43 -302
  517. package/scripts/config-global.ts +3 -2
  518. package/scripts/confluence-sync.ts +17 -538
  519. package/scripts/constants/environments.ts +3 -53
  520. package/scripts/constants/languages.ts +3 -68
  521. package/scripts/constants/test-commands.ts +3 -94
  522. package/scripts/dev-tools/README.md +22 -0
  523. package/scripts/{test-interactive.ts → dev-tools/test-interactive.ts} +4 -3
  524. package/scripts/github-actions-client.ts +18 -256
  525. package/scripts/jira-sync.ts +5 -1270
  526. package/scripts/markdown-to-confluence.ts +5 -5
  527. package/scripts/multi-project-estimate.ts +3 -2
  528. package/scripts/phase-runner.ts +41 -19
  529. package/scripts/pre-flight-check.ts +27 -11
  530. package/scripts/template/__tests__/multi-repo-renderer.test.ts +12 -0
  531. package/scripts/template/multi-repo-renderer.ts +2 -2
  532. package/scripts/test-execution-generator.ts +5 -4
  533. package/scripts/utils/__tests__/config-validator.test.ts +19 -19
  534. package/scripts/utils/__tests__/feature-name-validator.test.ts +13 -13
  535. package/scripts/utils/__tests__/multi-repo-validator.test.ts +34 -34
  536. package/scripts/utils/__tests__/project-analyzer.test.ts +542 -0
  537. package/scripts/utils/__tests__/safe-file-reader.test.ts +208 -0
  538. package/scripts/utils/__tests__/security-validator.test.ts +33 -33
  539. package/scripts/utils/__tests__/validation-result.test.ts +112 -0
  540. package/scripts/utils/aidlc-parser.ts +18 -287
  541. package/scripts/utils/ci-generator.ts +4 -3
  542. package/scripts/utils/config-loader.ts +54 -50
  543. package/scripts/utils/config-validator.ts +89 -80
  544. package/scripts/utils/docker-requirement-detector.ts +5 -4
  545. package/scripts/utils/env-config.ts +59 -40
  546. package/scripts/utils/feature-name-validator.ts +25 -40
  547. package/scripts/utils/interactive-helpers.ts +24 -132
  548. package/scripts/utils/language-detector.ts +4 -3
  549. package/scripts/utils/markdown-parser.ts +18 -373
  550. package/scripts/utils/multi-repo-validator.ts +27 -28
  551. package/scripts/utils/project-analyzer.ts +429 -0
  552. package/scripts/utils/project-detector.ts +6 -5
  553. package/scripts/utils/project-finder.ts +2 -154
  554. package/scripts/utils/project-meta.ts +8 -91
  555. package/scripts/utils/safe-file-reader.ts +158 -0
  556. package/scripts/utils/security-validator.ts +42 -78
  557. package/scripts/utils/spec-archiver.ts +7 -6
  558. package/scripts/utils/spec-updater.ts +12 -6
  559. package/scripts/utils/tasks-converter.ts +2 -2
  560. package/scripts/utils/tasks-format-validator.ts +4 -4
  561. package/scripts/utils/template-applier.ts +4 -3
  562. package/scripts/utils/types/validation.ts +92 -0
  563. package/scripts/validate-phase.ts +51 -23
  564. package/scripts/workflow-orchestrator.ts +16 -251
  565. package/dist/scripts/mermaid-converter.d.ts.map +0 -1
  566. package/dist/scripts/mermaid-converter.js.map +0 -1
  567. package/dist/scripts/resource-dashboard.d.ts +0 -7
  568. package/dist/scripts/resource-dashboard.d.ts.map +0 -1
  569. package/dist/scripts/resource-dashboard.js +0 -157
  570. package/dist/scripts/resource-dashboard.js.map +0 -1
  571. package/dist/scripts/test-interactive.d.ts.map +0 -1
  572. package/dist/scripts/test-interactive.js.map +0 -1
  573. package/dist/scripts/test-new-features.d.ts +0 -5
  574. package/dist/scripts/test-new-features.d.ts.map +0 -1
  575. package/dist/scripts/test-new-features.js +0 -148
  576. package/dist/scripts/test-new-features.js.map +0 -1
  577. package/dist/scripts/test-spec-generator.d.ts +0 -29
  578. package/dist/scripts/test-spec-generator.d.ts.map +0 -1
  579. package/dist/scripts/test-spec-generator.js +0 -493
  580. package/dist/scripts/test-spec-generator.js.map +0 -1
  581. package/dist/scripts/utils/confluence-approval.d.ts +0 -46
  582. package/dist/scripts/utils/confluence-approval.d.ts.map +0 -1
  583. package/dist/scripts/utils/confluence-approval.js +0 -120
  584. package/dist/scripts/utils/confluence-approval.js.map +0 -1
  585. package/dist/scripts/utils/template-finder.d.ts +0 -37
  586. package/dist/scripts/utils/template-finder.d.ts.map +0 -1
  587. package/dist/scripts/utils/template-finder.js +0 -58
  588. package/dist/scripts/utils/template-finder.js.map +0 -1
  589. package/dist/src/commands/multi-repo-add-repo.d.ts.map +0 -1
  590. package/dist/src/commands/multi-repo-add-repo.js.map +0 -1
  591. package/dist/src/commands/multi-repo-ci-status.d.ts.map +0 -1
  592. package/dist/src/commands/multi-repo-ci-status.js.map +0 -1
  593. package/dist/src/commands/multi-repo-confluence-sync.d.ts.map +0 -1
  594. package/dist/src/commands/multi-repo-confluence-sync.js.map +0 -1
  595. package/dist/src/commands/multi-repo-init.d.ts.map +0 -1
  596. package/dist/src/commands/multi-repo-init.js.map +0 -1
  597. package/dist/src/commands/multi-repo-list.d.ts.map +0 -1
  598. package/dist/src/commands/multi-repo-list.js.map +0 -1
  599. package/dist/src/commands/multi-repo-test.d.ts.map +0 -1
  600. package/dist/src/commands/multi-repo-test.js.map +0 -1
  601. package/dist/src/commands/setup-existing.d.ts +0 -22
  602. package/dist/src/commands/setup-existing.d.ts.map +0 -1
  603. package/dist/src/commands/setup-existing.js +0 -606
  604. package/dist/src/commands/setup-existing.js.map +0 -1
  605. package/scripts/__tests__/setup-existing-project.test.ts +0 -244
  606. package/scripts/resource-dashboard.ts +0 -189
  607. package/scripts/test-new-features.ts +0 -171
  608. package/scripts/test-spec-generator.ts +0 -570
  609. package/scripts/utils/confluence-approval.ts +0 -169
  610. package/scripts/utils/template-finder.ts +0 -69
  611. /package/dist/scripts/{mermaid-converter.d.ts → dev-tools/mermaid-converter.d.ts} +0 -0
  612. /package/dist/scripts/{mermaid-converter.js → dev-tools/mermaid-converter.js} +0 -0
  613. /package/dist/scripts/{test-interactive.d.ts → dev-tools/test-interactive.d.ts} +0 -0
  614. /package/scripts/{mermaid-converter.ts → dev-tools/mermaid-converter.ts} +0 -0
@@ -0,0 +1,774 @@
1
+ # Architecture Guide
2
+
3
+ Michi CLIプロジェクトのアーキテクチャガイドラインです。本プロジェクトはオニオンアーキテクチャの4層構造を採用し、明確な層分離と依存関係管理を実現しています。
4
+
5
+ ## 目次
6
+
7
+ 1. [概要](#概要)
8
+ 2. [層構造](#層構造)
9
+ 3. [依存関係ルール](#依存関係ルール)
10
+ 4. [ファイル配置規則](#ファイル配置規則)
11
+ 5. [scripts/ディレクトリ](#scriptsディレクトリ)
12
+ 6. [層選択フローチャート](#層選択フローチャート)
13
+ 7. [実践ガイド](#実践ガイド)
14
+
15
+ ---
16
+
17
+ ## 概要
18
+
19
+ ### アーキテクチャパターン
20
+
21
+ Michiは**オニオンアーキテクチャ(4層構造)**を採用しています:
22
+
23
+ ```
24
+ ┌─────────────────────────────────────────┐
25
+ │ Presentation Layer (CLI) │ ← ユーザーインターフェース
26
+ ├─────────────────────────────────────────┤
27
+ │ Application Layer (Use Cases) │ ← ビジネスロジック調整
28
+ ├─────────────────────────────────────────┤
29
+ │ Infrastructure Layer (External APIs) │ ← 外部サービス統合
30
+ ├─────────────────────────────────────────┤
31
+ │ Domain Layer (Business Logic) │ ← コアビジネスルール
32
+ └─────────────────────────────────────────┘
33
+ ```
34
+
35
+ ### ハイブリッドアプローチ
36
+
37
+ 本プロジェクトは、業界標準に準拠した**ハイブリッドアプローチ**を採用しています:
38
+
39
+ - **`src/` ディレクトリ**: すべてのプロダクションコード(4層構造)
40
+ - **`scripts/` ディレクトリ**: ビルドツール・開発ツール専用(層構造なし)
41
+
42
+ この分離により、プロダクションコードとビルド/開発ツールの責務を明確にしています。
43
+
44
+ ---
45
+
46
+ ## 層構造
47
+
48
+ ### 1. Domain Layer(ドメイン層)
49
+
50
+ **責務**: コアビジネスロジック、エンティティ、値オブジェクト、ドメインサービス、定数定義
51
+
52
+ **配置場所**: `src/domain/`
53
+
54
+ **特徴**:
55
+ - **外部依存ゼロ** - 他の層やサードパーティライブラリに依存しない
56
+ - プロジェクト固有のビジネスルールのみを含む
57
+ - 最も安定した層(変更頻度が低い)
58
+
59
+ **含むもの**:
60
+ - エンティティ(`entities/`)
61
+ - `Spec`: 仕様ドキュメント
62
+ - `Task`: 実装タスク
63
+ - `Project`: プロジェクト情報
64
+ - 値オブジェクト(`value-objects/`)
65
+ - `FeatureName`: 機能名
66
+ - `TaskStatus`: タスクステータス
67
+ - `PhaseIdentifier`: フェーズ識別子
68
+ - ドメインサービス(`services/`)
69
+ - `SpecValidator`: 仕様検証
70
+ - `TaskOrchestrator`: タスク調整
71
+ - 定数(`constants/`)
72
+ - `DEFAULT_VALUES`: デフォルト値
73
+ - `PHASE_CONSTANTS`: フェーズ定数
74
+
75
+ **例**:
76
+ ```typescript
77
+ // src/domain/entities/spec.ts
78
+ export class Spec {
79
+ constructor(
80
+ public readonly featureName: FeatureName,
81
+ public readonly phase: PhaseIdentifier,
82
+ public readonly language: string
83
+ ) {}
84
+
85
+ isReadyForImplementation(): boolean {
86
+ return this.phase === 'implementation-in-progress';
87
+ }
88
+ }
89
+ ```
90
+
91
+ ---
92
+
93
+ ### 2. Application Layer(アプリケーション層)
94
+
95
+ **責務**: ユースケース、アプリケーションサービス、DTO、ワークフロー、テンプレート処理
96
+
97
+ **配置場所**: `src/application/`
98
+
99
+ **特徴**:
100
+ - **Domain層のみに依存** - Infrastructure層に依存しない
101
+ - ビジネスロジックを調整・組み合わせる
102
+ - 外部APIやUIとは疎結合
103
+
104
+ **含むもの**:
105
+ - ユースケース(`use-cases/`)
106
+ - `InitSpecUseCase`: 仕様初期化
107
+ - `GenerateDesignUseCase`: 設計書生成
108
+ - `ExecuteTasksUseCase`: タスク実行
109
+ - アプリケーションサービス(`services/`)
110
+ - `TemplateProcessor`: テンプレート処理
111
+ - `WorkflowOrchestrator`: ワークフロー調整
112
+ - `TaskGenerator`: タスク生成
113
+ - DTO(`dto/`)
114
+ - `SpecDto`: 仕様データ転送オブジェクト
115
+ - `TaskDto`: タスクデータ転送オブジェクト
116
+ - インターフェース(`interfaces/`)
117
+ - `ISpecRepository`: 仕様リポジトリ
118
+ - `IFileWriter`: ファイル書き込み
119
+ - `ITemplateEngine`: テンプレートエンジン
120
+
121
+ **例**:
122
+ ```typescript
123
+ // src/application/use-cases/init-spec.ts
124
+ import { Spec } from '@domain/entities/spec';
125
+ import { ISpecRepository } from '@application/interfaces/spec-repository';
126
+
127
+ export class InitSpecUseCase {
128
+ constructor(private specRepo: ISpecRepository) {}
129
+
130
+ async execute(featureName: string, description: string): Promise<Spec> {
131
+ // ドメインロジック使用
132
+ const spec = new Spec(featureName, 'requirements', 'ja');
133
+
134
+ // リポジトリ保存(Infrastructure層が実装)
135
+ await this.specRepo.save(spec);
136
+
137
+ return spec;
138
+ }
139
+ }
140
+ ```
141
+
142
+ ---
143
+
144
+ ### 3. Infrastructure Layer(インフラストラクチャ層)
145
+
146
+ **責務**: 外部API、データベース、ファイルシステム、サードパーティライブラリとの統合、設定管理
147
+
148
+ **配置場所**: `src/infrastructure/`
149
+
150
+ **特徴**:
151
+ - **Application層のインターフェースを実装** - 疎結合を維持
152
+ - Domain層とApplication層に依存できる
153
+ - 外部依存の具体的な実装を含む
154
+
155
+ **含むもの**:
156
+ - 外部API統合(`external-apis/`)
157
+ - `atlassian/jira/`: JIRA API
158
+ - `atlassian/confluence/`: Confluence API
159
+ - `github/`: GitHub API
160
+ - 設定管理(`config/`)
161
+ - `ConfigLoader`: 環境変数・設定ファイル読み込み
162
+ - `EnvValidator`: 環境変数検証
163
+ - ファイルシステム(`file-system/`)
164
+ - `FileReader`: ファイル読み込み
165
+ - `FileWriter`: ファイル書き込み(`IFileWriter`実装)
166
+ - `DirectoryManager`: ディレクトリ管理
167
+ - パーサー(`parsers/`)
168
+ - `MarkdownParser`: Markdown解析
169
+ - `JsonParser`: JSON解析
170
+ - `TemplateParser`: テンプレート解析
171
+
172
+ **例**:
173
+ ```typescript
174
+ // src/infrastructure/file-system/file-writer.ts
175
+ import { IFileWriter } from '@application/interfaces/file-writer';
176
+
177
+ export class FileWriter implements IFileWriter {
178
+ async write(path: string, content: string): Promise<void> {
179
+ await fs.promises.writeFile(path, content, 'utf-8');
180
+ }
181
+ }
182
+ ```
183
+
184
+ ---
185
+
186
+ ### 4. Presentation Layer(プレゼンテーション層)
187
+
188
+ **責務**: CLIインターフェース、コマンドハンドラー、入出力フォーマッタ、対話型プロンプト
189
+
190
+ **配置場所**: `src/presentation/`
191
+
192
+ **特徴**:
193
+ - **すべての層に依存できる** - 最外層
194
+ - ユーザーとの接点を担当
195
+ - Commander.js、Inquirer.jsなどのUIライブラリ使用
196
+
197
+ **含むもの**:
198
+ - CLIエントリポイント(`cli.ts`)
199
+ - コマンドハンドラー(`commands/`)
200
+ - `init/`: プロジェクト初期化
201
+ - `confluence/`: Confluence統合
202
+ - `jira/`: JIRA統合
203
+ - `multi-repo/`: Multi-Repo管理
204
+ - フォーマッタ(`formatters/`)
205
+ - `ConsoleFormatter`: コンソール出力
206
+ - `MarkdownFormatter`: Markdown出力
207
+ - `JsonFormatter`: JSON出力
208
+ - 対話型UI(`interactive/`)
209
+ - `Prompter`: ユーザー入力プロンプト
210
+ - `ProgressBar`: 進捗表示
211
+
212
+ **例**:
213
+ ```typescript
214
+ // src/presentation/commands/init/init-command.ts
215
+ import { InitSpecUseCase } from '@application/use-cases/init-spec';
216
+ import { ConsoleFormatter } from '@presentation/formatters/console-formatter';
217
+
218
+ export class InitCommand {
219
+ constructor(
220
+ private initSpec: InitSpecUseCase,
221
+ private formatter: ConsoleFormatter
222
+ ) {}
223
+
224
+ async execute(featureName: string, description: string): Promise<void> {
225
+ const spec = await this.initSpec.execute(featureName, description);
226
+ this.formatter.success(`仕様 ${spec.featureName} を作成しました`);
227
+ }
228
+ }
229
+ ```
230
+
231
+ ---
232
+
233
+ ### 5. Shared Layer(共通層)
234
+
235
+ **責務**: すべての層で使用される共通ユーティリティ、エラー型
236
+
237
+ **配置場所**: `src/shared/`
238
+
239
+ **特徴**:
240
+ - **外部依存なし** - 純粋なTypeScriptコードのみ
241
+ - 層に依存しない汎用的な機能
242
+
243
+ **含むもの**:
244
+ - ユーティリティ(`utils/`)
245
+ - `StringUtils`: 文字列操作
246
+ - `ArrayUtils`: 配列操作
247
+ - `DateUtils`: 日付操作
248
+ - エラー型(`errors/`)
249
+ - `DomainError`: ドメインエラー基底クラス
250
+ - `ApplicationError`: アプリケーションエラー
251
+ - `InfrastructureError`: インフラエラー
252
+
253
+ ---
254
+
255
+ ## 依存関係ルール
256
+
257
+ ### 基本原則
258
+
259
+ 依存関係は**内側から外側に向かう一方向**です:
260
+
261
+ ```
262
+ Presentation → Application → Domain
263
+ ↓ ↓
264
+ Infrastructure → Application
265
+ ```
266
+
267
+ ### 詳細ルール
268
+
269
+ | 層 | 依存できる層 |
270
+ |----|------------|
271
+ | **Domain** | `shared/` のみ(外部ライブラリ禁止) |
272
+ | **Application** | `domain/`, `shared/` のみ |
273
+ | **Infrastructure** | `application/`(インターフェースのみ), `domain/`, `shared/` |
274
+ | **Presentation** | すべての層に依存可 |
275
+ | **Shared** | 外部依存なし |
276
+
277
+ ### 禁止事項
278
+
279
+ ❌ **Domain層から他の層へのインポート**
280
+ ```typescript
281
+ // ❌ NG: Domain層からApplication層をインポート
282
+ import { InitSpecUseCase } from '@application/use-cases/init-spec';
283
+ ```
284
+
285
+ ❌ **Application層からInfrastructure層の具体実装をインポート**
286
+ ```typescript
287
+ // ❌ NG: Application層からInfrastructure層の具体クラスをインポート
288
+ import { FileWriter } from '@infrastructure/file-system/file-writer';
289
+
290
+ // ✅ OK: インターフェースを使用
291
+ import { IFileWriter } from '@application/interfaces/file-writer';
292
+ ```
293
+
294
+ ❌ **循環依存**
295
+ ```typescript
296
+ // ❌ NG: A → B → A の循環
297
+ // src/domain/entities/spec.ts
298
+ import { Task } from './task';
299
+
300
+ // src/domain/entities/task.ts
301
+ import { Spec } from './spec'; // 循環依存!
302
+ ```
303
+
304
+ ### 検証方法
305
+
306
+ 依存関係ルールは**ts-arch**により自動検証されます:
307
+
308
+ ```bash
309
+ # アーキテクチャテスト実行
310
+ npm run test:arch
311
+
312
+ # CI/CDで自動実行
313
+ # .github/workflows/ci.yml の architecture ジョブ
314
+ ```
315
+
316
+ 違反が検出された場合、ビルドが失敗します:
317
+
318
+ ```
319
+ ❌ Architecture test failed:
320
+ Domain layer should not depend on Application layer
321
+ Violation: src/domain/entities/spec.ts imports from @application/use-cases/init-spec
322
+ ```
323
+
324
+ ---
325
+
326
+ ## ファイル配置規則
327
+
328
+ ### パスエイリアス
329
+
330
+ TypeScriptパスエイリアスを使用してインポートを簡潔に記述します:
331
+
332
+ ```typescript
333
+ // tsconfig.json で定義
334
+ {
335
+ "paths": {
336
+ "@domain/*": ["./src/domain/*"],
337
+ "@application/*": ["./src/application/*"],
338
+ "@infrastructure/*": ["./src/infrastructure/*"],
339
+ "@presentation/*": ["./src/presentation/*"],
340
+ "@shared/*": ["./src/shared/*"],
341
+ "@kiro/*": ["./.kiro/*"]
342
+ }
343
+ }
344
+ ```
345
+
346
+ **使用例**:
347
+ ```typescript
348
+ // 相対パスではなくエイリアス使用
349
+ import { Spec } from '@domain/entities/spec';
350
+ import { InitSpecUseCase } from '@application/use-cases/init-spec';
351
+ import { FileWriter } from '@infrastructure/file-system/file-writer';
352
+ ```
353
+
354
+ ### ディレクトリ構造
355
+
356
+ ```
357
+ src/
358
+ ├── domain/ # Domain層
359
+ │ ├── entities/ # エンティティ
360
+ │ ├── value-objects/ # 値オブジェクト
361
+ │ ├── services/ # ドメインサービス
362
+ │ └── constants/ # 定数
363
+
364
+ ├── application/ # Application層
365
+ │ ├── use-cases/ # ユースケース
366
+ │ ├── services/ # アプリケーションサービス
367
+ │ ├── dto/ # データ転送オブジェクト
368
+ │ ├── interfaces/ # インターフェース定義
369
+ │ └── workflows/ # ワークフロー
370
+
371
+ ├── infrastructure/ # Infrastructure層
372
+ │ ├── external-apis/ # 外部API統合
373
+ │ │ ├── atlassian/
374
+ │ │ │ ├── jira/
375
+ │ │ │ └── confluence/
376
+ │ │ └── github/
377
+ │ ├── file-system/ # ファイルシステム
378
+ │ ├── config/ # 設定管理
379
+ │ └── parsers/ # パーサー
380
+
381
+ ├── presentation/ # Presentation層
382
+ │ ├── cli.ts # CLIエントリポイント
383
+ │ ├── commands/ # コマンドハンドラー
384
+ │ ├── formatters/ # 出力フォーマッタ
385
+ │ └── interactive/ # 対話型UI
386
+
387
+ └── shared/ # Shared層
388
+ ├── utils/ # ユーティリティ
389
+ └── errors/ # エラー型
390
+ ```
391
+
392
+ ### 命名規則
393
+
394
+ | 種類 | 規則 | 例 |
395
+ |------|------|-----|
396
+ | エンティティ | PascalCase | `Spec`, `Task`, `Project` |
397
+ | 値オブジェクト | PascalCase | `FeatureName`, `TaskStatus` |
398
+ | ユースケース | `{動詞}{名詞}UseCase` | `InitSpecUseCase`, `GenerateDesignUseCase` |
399
+ | サービス | `{名詞}Service` | `SpecValidator`, `TaskOrchestrator` |
400
+ | インターフェース | `I{名詞}` | `ISpecRepository`, `IFileWriter` |
401
+ | DTO | `{名詞}Dto` | `SpecDto`, `TaskDto` |
402
+ | コマンド | `{名詞}Command` | `InitCommand`, `DesignCommand` |
403
+
404
+ ---
405
+
406
+ ## scripts/ディレクトリ
407
+
408
+ ### 重要原則
409
+
410
+ ⚠️ **scripts/はビルド・開発ツール専用です。プロダクションコードは含めないでください。**
411
+
412
+ すべてのプロダクションコード(CLIツール本体の実装)は`src/`の適切な層に配置します。
413
+
414
+ ### scripts/の構造
415
+
416
+ ```
417
+ scripts/
418
+ ├── build/ # ビルド関連スクリプト
419
+ │ ├── copy-static-assets.js
420
+ │ └── set-permissions.js
421
+
422
+ ├── dev-tools/ # 開発支援ツール
423
+ │ ├── test-interactive.ts
424
+ │ └── mermaid-converter.ts
425
+
426
+ ├── utils/ # 共通ユーティリティ
427
+ │ ├── env-loader.js
428
+ │ ├── config-loader.ts
429
+ │ └── safe-file-reader.ts
430
+
431
+ ├── config/ # 設定ファイル・スキーマ
432
+ └── constants/ # 定数定義
433
+ ```
434
+
435
+ ### 配置ガイドライン
436
+
437
+ | 種類 | 配置先 | 理由 |
438
+ |------|--------|------|
439
+ | **プロダクションコード** | `src/` | CLIツール本体の実装 |
440
+ | **ビルドスクリプト** | `scripts/build/` | ビルド時にのみ実行 |
441
+ | **開発ツール** | `scripts/dev-tools/` | 開発者が手動実行 |
442
+ | **テストヘルパー** | `scripts/__tests__/` | テスト専用 |
443
+
444
+ **判断基準**:
445
+ - `npm run build`で実行される → `scripts/build/`
446
+ - 開発者が手動実行する開発ツール → `scripts/dev-tools/`
447
+ - CLIコマンドとして公開される機能 → `src/presentation/commands/`
448
+ - 外部API統合 → `src/infrastructure/external-apis/`
449
+ - ビジネスロジック → `src/domain/` または `src/application/`
450
+
451
+ ### Entry Points(エントリーポイント)
452
+
453
+ scripts/ルートにあるEntry Pointsは、`src/`の実装を呼び出す薄いラッパーです:
454
+
455
+ ```typescript
456
+ // scripts/confluence-sync.ts (Entry Point)
457
+ import { ConfluenceSyncCommand } from '@presentation/commands/confluence/sync-command';
458
+
459
+ async function main() {
460
+ const command = new ConfluenceSyncCommand();
461
+ await command.execute(process.argv[2], process.argv[3]);
462
+ }
463
+
464
+ main();
465
+ ```
466
+
467
+ 実装本体は`src/presentation/commands/confluence/`にあります。
468
+
469
+ ---
470
+
471
+ ## 層選択フローチャート
472
+
473
+ 新しいファイルを作成する際、以下のフローチャートに従って適切な層を選択してください:
474
+
475
+ ```mermaid
476
+ flowchart TD
477
+ Start([新しいファイルを作成])
478
+
479
+ Start --> Q1{ビルド・開発<br/>ツールか?}
480
+ Q1 -->|Yes| Build[scripts/build/<br/>or<br/>scripts/dev-tools/]
481
+ Q1 -->|No| Q2{ユーザーと<br/>直接やり取りするか?}
482
+
483
+ Q2 -->|Yes| Presentation[Presentation層<br/>src/presentation/]
484
+ Q2 -->|No| Q3{外部サービスと<br/>統合するか?}
485
+
486
+ Q3 -->|Yes| Infrastructure[Infrastructure層<br/>src/infrastructure/]
487
+ Q3 -->|No| Q4{ビジネスロジックを<br/>調整するか?}
488
+
489
+ Q4 -->|Yes| Application[Application層<br/>src/application/]
490
+ Q4 -->|No| Q5{コアビジネスルールか?}
491
+
492
+ Q5 -->|Yes| Domain[Domain層<br/>src/domain/]
493
+ Q5 -->|No| Shared[Shared層<br/>src/shared/]
494
+
495
+ Build --> End([配置完了])
496
+ Presentation --> End
497
+ Infrastructure --> End
498
+ Application --> End
499
+ Domain --> End
500
+ Shared --> End
501
+ ```
502
+
503
+ ### 判断ポイント
504
+
505
+ **1. ビルド・開発ツールか?**
506
+ - ✅ Yes: `npm run build`で実行される、または開発者が手動実行するツール
507
+ - → `scripts/build/` または `scripts/dev-tools/`
508
+ - ❌ No: プロダクションコード → 次の質問へ
509
+
510
+ **2. ユーザーと直接やり取りするか?**
511
+ - ✅ Yes: CLIコマンド、プロンプト、出力フォーマット
512
+ - → `src/presentation/`
513
+ - ❌ No: 内部処理 → 次の質問へ
514
+
515
+ **3. 外部サービスと統合するか?**
516
+ - ✅ Yes: 外部API、ファイルシステム、データベース、サードパーティライブラリ
517
+ - → `src/infrastructure/`
518
+ - ❌ No: 外部依存なし → 次の質問へ
519
+
520
+ **4. ビジネスロジックを調整するか?**
521
+ - ✅ Yes: ユースケース、ワークフロー、複数ドメインサービスの組み合わせ
522
+ - → `src/application/`
523
+ - ❌ No: 単一責務 → 次の質問へ
524
+
525
+ **5. コアビジネスルールか?**
526
+ - ✅ Yes: エンティティ、値オブジェクト、ドメインサービス、定数
527
+ - → `src/domain/`
528
+ - ❌ No: 汎用的なユーティリティ
529
+ - → `src/shared/`
530
+
531
+ ---
532
+
533
+ ## 実践ガイド
534
+
535
+ ### ケーススタディ1: 新しいCLIコマンド追加
536
+
537
+ **要件**: `/kiro:spec-validate <feature-name>` コマンドを追加
538
+
539
+ **実装手順**:
540
+
541
+ 1. **Domain層**: バリデーションロジック
542
+ ```typescript
543
+ // src/domain/services/spec-validator.ts
544
+ export class SpecValidator {
545
+ validate(spec: Spec): ValidationResult {
546
+ // コアビジネスルール
547
+ if (!spec.featureName.isValid()) {
548
+ return { valid: false, errors: ['Invalid feature name'] };
549
+ }
550
+ return { valid: true, errors: [] };
551
+ }
552
+ }
553
+ ```
554
+
555
+ 2. **Application層**: ユースケース
556
+ ```typescript
557
+ // src/application/use-cases/validate-spec.ts
558
+ export class ValidateSpecUseCase {
559
+ constructor(
560
+ private specRepo: ISpecRepository,
561
+ private validator: SpecValidator
562
+ ) {}
563
+
564
+ async execute(featureName: string): Promise<ValidationResult> {
565
+ const spec = await this.specRepo.findByFeatureName(featureName);
566
+ return this.validator.validate(spec);
567
+ }
568
+ }
569
+ ```
570
+
571
+ 3. **Infrastructure層**: リポジトリ実装
572
+ ```typescript
573
+ // src/infrastructure/repositories/spec-repository.ts
574
+ export class SpecRepository implements ISpecRepository {
575
+ async findByFeatureName(name: string): Promise<Spec> {
576
+ const data = await fs.promises.readFile(`.kiro/specs/${name}/spec.json`);
577
+ return JSON.parse(data.toString());
578
+ }
579
+ }
580
+ ```
581
+
582
+ 4. **Presentation層**: コマンドハンドラー
583
+ ```typescript
584
+ // src/presentation/commands/validate/validate-command.ts
585
+ export class ValidateCommand {
586
+ constructor(
587
+ private validateSpec: ValidateSpecUseCase,
588
+ private formatter: ConsoleFormatter
589
+ ) {}
590
+
591
+ async execute(featureName: string): Promise<void> {
592
+ const result = await this.validateSpec.execute(featureName);
593
+ if (result.valid) {
594
+ this.formatter.success('Validation passed');
595
+ } else {
596
+ this.formatter.error(result.errors);
597
+ }
598
+ }
599
+ }
600
+ ```
601
+
602
+ 5. **Presentation層**: CLI登録
603
+ ```typescript
604
+ // src/presentation/cli.ts
605
+ import { ValidateCommand } from './commands/validate/validate-command';
606
+
607
+ program
608
+ .command('spec:validate <feature-name>')
609
+ .action(async (featureName) => {
610
+ const command = new ValidateCommand(/* DI */);
611
+ await command.execute(featureName);
612
+ });
613
+ ```
614
+
615
+ ---
616
+
617
+ ### ケーススタディ2: 外部API統合追加
618
+
619
+ **要件**: Slack通知機能を追加
620
+
621
+ **実装手順**:
622
+
623
+ 1. **Application層**: インターフェース定義
624
+ ```typescript
625
+ // src/application/interfaces/notification-service.ts
626
+ export interface INotificationService {
627
+ notify(message: string): Promise<void>;
628
+ }
629
+ ```
630
+
631
+ 2. **Infrastructure層**: Slack実装
632
+ ```typescript
633
+ // src/infrastructure/external-apis/slack/slack-notifier.ts
634
+ import { INotificationService } from '@application/interfaces/notification-service';
635
+
636
+ export class SlackNotifier implements INotificationService {
637
+ async notify(message: string): Promise<void> {
638
+ await axios.post(process.env.SLACK_WEBHOOK_URL!, { text: message });
639
+ }
640
+ }
641
+ ```
642
+
643
+ 3. **Application層**: 通知ユースケース
644
+ ```typescript
645
+ // src/application/use-cases/notify-completion.ts
646
+ export class NotifyCompletionUseCase {
647
+ constructor(private notifier: INotificationService) {}
648
+
649
+ async execute(featureName: string): Promise<void> {
650
+ await this.notifier.notify(`Feature ${featureName} completed!`);
651
+ }
652
+ }
653
+ ```
654
+
655
+ 4. **Presentation層**: 既存コマンドに統合
656
+ ```typescript
657
+ // src/presentation/commands/impl/impl-command.ts
658
+ export class ImplCommand {
659
+ constructor(
660
+ private executeTask: ExecuteTasksUseCase,
661
+ private notifyCompletion: NotifyCompletionUseCase
662
+ ) {}
663
+
664
+ async execute(featureName: string): Promise<void> {
665
+ await this.executeTask.execute(featureName);
666
+ await this.notifyCompletion.execute(featureName);
667
+ }
668
+ }
669
+ ```
670
+
671
+ ---
672
+
673
+ ### ベストプラクティス
674
+
675
+ #### 1. インターフェース駆動設計
676
+
677
+ Application層でインターフェースを定義し、Infrastructure層で実装します:
678
+
679
+ ```typescript
680
+ // ✅ Good: Application層がインターフェースに依存
681
+ export class InitSpecUseCase {
682
+ constructor(private writer: IFileWriter) {}
683
+ }
684
+
685
+ // ❌ Bad: Application層が具体実装に依存
686
+ import { FileWriter } from '@infrastructure/file-system/file-writer';
687
+ export class InitSpecUseCase {
688
+ constructor(private writer: FileWriter) {}
689
+ }
690
+ ```
691
+
692
+ #### 2. 依存性注入
693
+
694
+ コンストラクタ注入を使用して疎結合を実現します:
695
+
696
+ ```typescript
697
+ // Presentation層で依存関係を組み立て
698
+ const fileWriter = new FileWriter();
699
+ const specRepo = new SpecRepository(fileWriter);
700
+ const initSpec = new InitSpecUseCase(specRepo);
701
+ const command = new InitCommand(initSpec, new ConsoleFormatter());
702
+ ```
703
+
704
+ #### 3. エラーハンドリング
705
+
706
+ 各層で適切なエラー型を使用します:
707
+
708
+ ```typescript
709
+ // Domain層
710
+ export class DomainError extends Error {
711
+ constructor(message: string) {
712
+ super(message);
713
+ this.name = 'DomainError';
714
+ }
715
+ }
716
+
717
+ // Application層
718
+ export class ApplicationError extends Error {
719
+ constructor(message: string) {
720
+ super(message);
721
+ this.name = 'ApplicationError';
722
+ }
723
+ }
724
+
725
+ // Infrastructure層
726
+ export class InfrastructureError extends Error {
727
+ constructor(message: string) {
728
+ super(message);
729
+ this.name = 'InfrastructureError';
730
+ }
731
+ }
732
+ ```
733
+
734
+ #### 4. テスト戦略
735
+
736
+ 各層に応じたテスト戦略を採用します:
737
+
738
+ | 層 | テスト種別 | フォーカス |
739
+ |----|-----------|----------|
740
+ | Domain | ユニットテスト | ビジネスロジックの正確性 |
741
+ | Application | ユニットテスト | ユースケースフロー |
742
+ | Infrastructure | 統合テスト | 外部サービス連携 |
743
+ | Presentation | E2Eテスト | ユーザーフロー |
744
+
745
+ ---
746
+
747
+ ## まとめ
748
+
749
+ ### 重要ポイント
750
+
751
+ 1. **4層構造を遵守する**: Domain → Application → Infrastructure → Presentation
752
+ 2. **依存関係は一方向**: 内側から外側へ
753
+ 3. **Domain層は純粋に保つ**: 外部依存ゼロ
754
+ 4. **scripts/はビルド・開発ツール専用**: プロダクションコードは `src/` に配置
755
+ 5. **インターフェース駆動設計**: Application層でインターフェース定義、Infrastructure層で実装
756
+ 6. **ts-archで自動検証**: 依存関係ルール違反を検出
757
+
758
+ ### 参考資料
759
+
760
+ - [Design Document](.kiro/specs/onion-architecture/design.md) - 詳細設計
761
+ - [Requirements Document](.kiro/specs/onion-architecture/requirements.md) - 要件定義
762
+ - [Migration Guide](./MIGRATION.md) - 移行ガイド
763
+ - [scripts/README.md](../scripts/README.md) - scripts/ディレクトリガイド
764
+
765
+ ### サポート
766
+
767
+ 質問や不明点がある場合:
768
+ - [GitHub Issues](https://github.com/sk8metalme/michi/issues)
769
+ - [Architecture Discussion](https://github.com/sk8metalme/michi/discussions)
770
+
771
+ ---
772
+
773
+ **Last Updated**: 2026-01-01
774
+ **Version**: 0.19.0