@sk8metal/michi-cli 0.14.1 → 0.20.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 (623) 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 +98 -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/config/env-wizard.d.ts +9 -0
  475. package/dist/src/presentation/interactive/config/env-wizard.d.ts.map +1 -0
  476. package/dist/src/presentation/interactive/config/env-wizard.js +193 -0
  477. package/dist/src/presentation/interactive/config/env-wizard.js.map +1 -0
  478. package/dist/src/presentation/interactive/config/index.d.ts +5 -0
  479. package/dist/src/presentation/interactive/config/index.d.ts.map +1 -0
  480. package/dist/src/presentation/interactive/config/index.js +5 -0
  481. package/dist/src/presentation/interactive/config/index.js.map +1 -0
  482. package/dist/src/presentation/interactive/confirmation.d.ts +24 -0
  483. package/dist/src/presentation/interactive/confirmation.d.ts.map +1 -0
  484. package/dist/src/presentation/interactive/confirmation.js +54 -0
  485. package/dist/src/presentation/interactive/confirmation.js.map +1 -0
  486. package/dist/src/presentation/interactive/index.d.ts +8 -0
  487. package/dist/src/presentation/interactive/index.d.ts.map +1 -0
  488. package/dist/src/presentation/interactive/index.js +11 -0
  489. package/dist/src/presentation/interactive/index.js.map +1 -0
  490. package/dist/src/presentation/interactive/prompts.d.ts +30 -0
  491. package/dist/src/presentation/interactive/prompts.d.ts.map +1 -0
  492. package/dist/src/presentation/interactive/prompts.js +69 -0
  493. package/dist/src/presentation/interactive/prompts.js.map +1 -0
  494. package/dist/src/presentation/interactive/selection.d.ts +31 -0
  495. package/dist/src/presentation/interactive/selection.d.ts.map +1 -0
  496. package/dist/src/presentation/interactive/selection.js +138 -0
  497. package/dist/src/presentation/interactive/selection.js.map +1 -0
  498. package/dist/src/shared/types/errors.d.ts +132 -0
  499. package/dist/src/shared/types/errors.d.ts.map +1 -0
  500. package/dist/src/shared/types/errors.js +61 -0
  501. package/dist/src/shared/types/errors.js.map +1 -0
  502. package/dist/src/shared/types/result.d.ts +53 -0
  503. package/dist/src/shared/types/result.d.ts.map +1 -0
  504. package/dist/src/shared/types/result.js +42 -0
  505. package/dist/src/shared/types/result.js.map +1 -0
  506. package/dist/test-confluence-auth.d.ts +6 -0
  507. package/dist/test-confluence-auth.d.ts.map +1 -0
  508. package/dist/test-confluence-auth.js +128 -0
  509. package/dist/test-confluence-auth.js.map +1 -0
  510. package/docs/MIGRATION.md +513 -0
  511. package/docs/architecture.md +774 -0
  512. package/docs/guides/comprehensive-verification-guide.md +1926 -0
  513. package/docs/guides/interactive-config.md +285 -0
  514. package/docs/onion-architecture-phase0-complete.md +91 -0
  515. package/package.json +6 -6
  516. package/scripts/README.md +148 -0
  517. package/scripts/__tests__/jira-transitions.test.ts +44 -30
  518. package/scripts/__tests__/mermaid-converter.test.ts +2 -2
  519. package/scripts/__tests__/multi-repo-validator.test.ts +62 -62
  520. package/scripts/__tests__/spec-archiver.test.ts +12 -0
  521. package/scripts/__tests__/validate-phase.test.ts +6 -6
  522. package/scripts/build/README.md +24 -0
  523. package/scripts/{copy-static-assets.js → build/copy-static-assets.js} +1 -1
  524. package/scripts/{set-permissions.js → build/set-permissions.js} +1 -1
  525. package/scripts/config/config-schema.ts +43 -302
  526. package/scripts/config-global.ts +3 -2
  527. package/scripts/confluence-sync.ts +17 -538
  528. package/scripts/constants/environments.ts +3 -53
  529. package/scripts/constants/languages.ts +3 -68
  530. package/scripts/constants/test-commands.ts +3 -94
  531. package/scripts/dev-tools/README.md +22 -0
  532. package/scripts/{test-interactive.ts → dev-tools/test-interactive.ts} +4 -3
  533. package/scripts/github-actions-client.ts +18 -256
  534. package/scripts/jira-sync.ts +5 -1270
  535. package/scripts/markdown-to-confluence.ts +5 -5
  536. package/scripts/multi-project-estimate.ts +3 -2
  537. package/scripts/phase-runner.ts +41 -19
  538. package/scripts/pre-flight-check.ts +27 -11
  539. package/scripts/template/__tests__/multi-repo-renderer.test.ts +12 -0
  540. package/scripts/template/multi-repo-renderer.ts +2 -2
  541. package/scripts/test-execution-generator.ts +5 -4
  542. package/scripts/utils/__tests__/config-validator.test.ts +19 -19
  543. package/scripts/utils/__tests__/feature-name-validator.test.ts +13 -13
  544. package/scripts/utils/__tests__/multi-repo-validator.test.ts +34 -34
  545. package/scripts/utils/__tests__/project-analyzer.test.ts +542 -0
  546. package/scripts/utils/__tests__/safe-file-reader.test.ts +208 -0
  547. package/scripts/utils/__tests__/security-validator.test.ts +33 -33
  548. package/scripts/utils/__tests__/validation-result.test.ts +112 -0
  549. package/scripts/utils/aidlc-parser.ts +18 -287
  550. package/scripts/utils/ci-generator.ts +4 -3
  551. package/scripts/utils/config-loader.ts +54 -50
  552. package/scripts/utils/config-validator.ts +89 -80
  553. package/scripts/utils/docker-requirement-detector.ts +5 -4
  554. package/scripts/utils/env-config.ts +59 -40
  555. package/scripts/utils/feature-name-validator.ts +25 -40
  556. package/scripts/utils/interactive-helpers.ts +24 -132
  557. package/scripts/utils/language-detector.ts +4 -3
  558. package/scripts/utils/markdown-parser.ts +18 -373
  559. package/scripts/utils/multi-repo-validator.ts +27 -28
  560. package/scripts/utils/project-analyzer.ts +429 -0
  561. package/scripts/utils/project-detector.ts +6 -5
  562. package/scripts/utils/project-finder.ts +2 -154
  563. package/scripts/utils/project-meta.ts +8 -91
  564. package/scripts/utils/safe-file-reader.ts +158 -0
  565. package/scripts/utils/security-validator.ts +42 -78
  566. package/scripts/utils/spec-archiver.ts +7 -6
  567. package/scripts/utils/spec-updater.ts +12 -6
  568. package/scripts/utils/tasks-converter.ts +2 -2
  569. package/scripts/utils/tasks-format-validator.ts +4 -4
  570. package/scripts/utils/template-applier.ts +4 -3
  571. package/scripts/utils/types/validation.ts +92 -0
  572. package/scripts/validate-phase.ts +51 -23
  573. package/scripts/workflow-orchestrator.ts +16 -251
  574. package/dist/scripts/mermaid-converter.d.ts.map +0 -1
  575. package/dist/scripts/mermaid-converter.js.map +0 -1
  576. package/dist/scripts/resource-dashboard.d.ts +0 -7
  577. package/dist/scripts/resource-dashboard.d.ts.map +0 -1
  578. package/dist/scripts/resource-dashboard.js +0 -157
  579. package/dist/scripts/resource-dashboard.js.map +0 -1
  580. package/dist/scripts/test-interactive.d.ts.map +0 -1
  581. package/dist/scripts/test-interactive.js.map +0 -1
  582. package/dist/scripts/test-new-features.d.ts +0 -5
  583. package/dist/scripts/test-new-features.d.ts.map +0 -1
  584. package/dist/scripts/test-new-features.js +0 -148
  585. package/dist/scripts/test-new-features.js.map +0 -1
  586. package/dist/scripts/test-spec-generator.d.ts +0 -29
  587. package/dist/scripts/test-spec-generator.d.ts.map +0 -1
  588. package/dist/scripts/test-spec-generator.js +0 -493
  589. package/dist/scripts/test-spec-generator.js.map +0 -1
  590. package/dist/scripts/utils/confluence-approval.d.ts +0 -46
  591. package/dist/scripts/utils/confluence-approval.d.ts.map +0 -1
  592. package/dist/scripts/utils/confluence-approval.js +0 -120
  593. package/dist/scripts/utils/confluence-approval.js.map +0 -1
  594. package/dist/scripts/utils/template-finder.d.ts +0 -37
  595. package/dist/scripts/utils/template-finder.d.ts.map +0 -1
  596. package/dist/scripts/utils/template-finder.js +0 -58
  597. package/dist/scripts/utils/template-finder.js.map +0 -1
  598. package/dist/src/commands/multi-repo-add-repo.d.ts.map +0 -1
  599. package/dist/src/commands/multi-repo-add-repo.js.map +0 -1
  600. package/dist/src/commands/multi-repo-ci-status.d.ts.map +0 -1
  601. package/dist/src/commands/multi-repo-ci-status.js.map +0 -1
  602. package/dist/src/commands/multi-repo-confluence-sync.d.ts.map +0 -1
  603. package/dist/src/commands/multi-repo-confluence-sync.js.map +0 -1
  604. package/dist/src/commands/multi-repo-init.d.ts.map +0 -1
  605. package/dist/src/commands/multi-repo-init.js.map +0 -1
  606. package/dist/src/commands/multi-repo-list.d.ts.map +0 -1
  607. package/dist/src/commands/multi-repo-list.js.map +0 -1
  608. package/dist/src/commands/multi-repo-test.d.ts.map +0 -1
  609. package/dist/src/commands/multi-repo-test.js.map +0 -1
  610. package/dist/src/commands/setup-existing.d.ts +0 -22
  611. package/dist/src/commands/setup-existing.d.ts.map +0 -1
  612. package/dist/src/commands/setup-existing.js +0 -606
  613. package/dist/src/commands/setup-existing.js.map +0 -1
  614. package/scripts/__tests__/setup-existing-project.test.ts +0 -244
  615. package/scripts/resource-dashboard.ts +0 -189
  616. package/scripts/test-new-features.ts +0 -171
  617. package/scripts/test-spec-generator.ts +0 -570
  618. package/scripts/utils/confluence-approval.ts +0 -169
  619. package/scripts/utils/template-finder.ts +0 -69
  620. /package/dist/scripts/{mermaid-converter.d.ts → dev-tools/mermaid-converter.d.ts} +0 -0
  621. /package/dist/scripts/{mermaid-converter.js → dev-tools/mermaid-converter.js} +0 -0
  622. /package/dist/scripts/{test-interactive.d.ts → dev-tools/test-interactive.d.ts} +0 -0
  623. /package/scripts/{mermaid-converter.ts → dev-tools/mermaid-converter.ts} +0 -0
@@ -1,96 +1,13 @@
1
1
  /**
2
2
  * プロジェクトメタデータ読み込みユーティリティ
3
- */
4
-
5
- import { readFileSync, existsSync } from 'fs';
6
- import { resolve } from 'path';
7
-
8
- export interface ProjectMetadata {
9
- projectId: string;
10
- projectName: string;
11
- jiraProjectKey: string;
12
- confluenceLabels: string[];
13
- status: 'active' | 'inactive' | 'completed';
14
- team: string[];
15
- stakeholders: string[];
16
- repository: string;
17
- description?: string;
18
- }
19
-
20
- /**
21
- * .kiro/project.json を読み込む
22
- */
23
- export function loadProjectMeta(projectRoot: string = process.cwd()): ProjectMetadata {
24
- const projectJsonPath = resolve(projectRoot, '.kiro/project.json');
25
-
26
- if (!existsSync(projectJsonPath)) {
27
- throw new Error(`Project metadata not found: ${projectJsonPath}`);
28
- }
29
-
30
- try {
31
- const content = readFileSync(projectJsonPath, 'utf-8');
32
- const meta = JSON.parse(content) as ProjectMetadata;
33
-
34
- // 必須フィールドのバリデーション
35
- const requiredFields: (keyof ProjectMetadata)[] = [
36
- 'projectId',
37
- 'projectName',
38
- 'jiraProjectKey',
39
- 'confluenceLabels'
40
- ];
41
-
42
- for (const field of requiredFields) {
43
- if (!meta[field]) {
44
- throw new Error(`Required field missing in project.json: ${field}`);
45
- }
46
- }
47
-
48
- return meta;
49
- } catch (error) {
50
- if (error instanceof SyntaxError) {
51
- throw new Error(`Invalid JSON in ${projectJsonPath}: ${error.message}`);
52
- }
53
- throw error;
54
- }
55
- }
56
-
57
- /**
58
- * プロジェクトメタデータを表示用にフォーマット
59
- */
60
- export function formatProjectInfo(meta: ProjectMetadata): string {
61
- return `
62
- Project: ${meta.projectName} (${meta.projectId})
63
- JIRA: ${meta.jiraProjectKey}
64
- Labels: ${meta.confluenceLabels.join(', ')}
65
- Status: ${meta.status}
66
- Team: ${meta.team.join(', ')}
67
- `.trim();
68
- }
69
-
70
- /**
71
- * GitHub リポジトリ情報を取得
72
- * repository フィールドから owner/repo 形式を抽出
73
3
  *
74
- * @param projectRoot プロジェクトルートディレクトリ(デフォルト: カレントディレクトリ)
75
- * @returns owner/repo 形式のリポジトリ情報
76
- * @throws リポジトリ情報が見つからない、または無効な形式の場合
4
+ * このファイルは後方互換性のための再エクスポートです。
5
+ * 実装は src/infrastructure/filesystem/project-meta.ts に移行されました。
77
6
  */
78
- export function getRepositoryInfo(projectRoot: string = process.cwd()): string {
79
- const meta = loadProjectMeta(projectRoot);
80
-
81
- if (!meta.repository) {
82
- throw new Error('Repository information not found in project.json');
83
- }
84
-
85
- // URL形式から owner/repo を抽出
86
- // 例: https://github.com/owner/repo.git -> owner/repo
87
- // 例: git@github.com:owner/repo.git -> owner/repo
88
- const match = meta.repository.match(/github\.com[:/]([\w-]+\/[\w-]+)(\.git)?/);
89
-
90
- if (!match) {
91
- throw new Error(`Invalid GitHub repository format: ${meta.repository}`);
92
- }
93
-
94
- return match[1];
95
- }
96
7
 
8
+ export type { ProjectMetadata } from '../../src/infrastructure/filesystem/project-meta.js';
9
+ export {
10
+ loadProjectMeta,
11
+ formatProjectInfo,
12
+ getRepositoryInfo,
13
+ } from '../../src/infrastructure/filesystem/project-meta.js';
@@ -0,0 +1,158 @@
1
+ /**
2
+ * safeReadFile - ファイル読み込み処理の統合ユーティリティ
3
+ * 一貫したエラーハンドリングとResult型を提供
4
+ */
5
+
6
+ import { readFileSync, existsSync } from 'fs';
7
+ import type { Result } from './types/validation.js';
8
+ import { success, failure } from './types/validation.js';
9
+
10
+ /**
11
+ * JSON value type - represents any valid JSON value
12
+ */
13
+ export type JsonValue =
14
+ | string
15
+ | number
16
+ | boolean
17
+ | null
18
+ | JsonValue[]
19
+ | { [key: string]: JsonValue };
20
+
21
+ /**
22
+ * File read error types
23
+ */
24
+ export type FileReadError =
25
+ | { type: 'FileNotFound'; path: string }
26
+ | { type: 'PermissionDenied'; path: string }
27
+ | { type: 'InvalidJSON'; path: string; cause: string }
28
+ | { type: 'ReadError'; path: string; cause: string };
29
+
30
+ /**
31
+ * Safe file reader with Result type
32
+ *
33
+ * @param filePath - Path to the file to read
34
+ * @param encoding - File encoding (default: 'utf-8')
35
+ * @returns Result<string, FileReadError> - File content or error
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const result = safeReadFile('/path/to/file.txt');
40
+ * if (result.success) {
41
+ * console.log(result.value);
42
+ * } else {
43
+ * console.error(result.errors[0].type);
44
+ * }
45
+ * ```
46
+ */
47
+ export function safeReadFile(
48
+ filePath: string,
49
+ encoding: BufferEncoding = 'utf-8'
50
+ ): Result<string, FileReadError> {
51
+ // Check file existence
52
+ if (!existsSync(filePath)) {
53
+ return failure([{
54
+ type: 'FileNotFound',
55
+ path: filePath
56
+ }]);
57
+ }
58
+
59
+ try {
60
+ const content = readFileSync(filePath, encoding);
61
+ return success(content);
62
+ } catch (error) {
63
+ // Check for permission errors
64
+ if (error instanceof Error && error.message.includes('EACCES')) {
65
+ return failure([{
66
+ type: 'PermissionDenied',
67
+ path: filePath
68
+ }]);
69
+ }
70
+
71
+ // Generic read error
72
+ return failure([{
73
+ type: 'ReadError',
74
+ path: filePath,
75
+ cause: error instanceof Error ? error.message : String(error)
76
+ }]);
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Safe JSON file reader with Result type
82
+ *
83
+ * @param filePath - Path to the JSON file to read
84
+ * @returns Result<any, FileReadError> - Parsed JSON object or error
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * const result = safeReadJsonFile('/path/to/config.json');
89
+ * if (result.success) {
90
+ * const config = result.value;
91
+ * } else {
92
+ * console.error(result.errors[0].type);
93
+ * }
94
+ * ```
95
+ */
96
+ export function safeReadJsonFile<T = JsonValue>(
97
+ filePath: string
98
+ ): Result<T, FileReadError> {
99
+ // First, read the file
100
+ const readResult = safeReadFile(filePath);
101
+
102
+ if (!readResult.success) {
103
+ return readResult as Result<T, FileReadError>;
104
+ }
105
+
106
+ // Then, parse JSON
107
+ try {
108
+ const parsed = JSON.parse(readResult.value as string) as T;
109
+ return success(parsed);
110
+ } catch (error) {
111
+ return failure([{
112
+ type: 'InvalidJSON',
113
+ path: filePath,
114
+ cause: error instanceof Error ? error.message : String(error)
115
+ }]);
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Safe file reader that throws on error (for compatibility with existing code)
121
+ *
122
+ * @param filePath - Path to the file to read
123
+ * @param encoding - File encoding (default: 'utf-8')
124
+ * @returns string - File content
125
+ * @throws Error if file cannot be read
126
+ *
127
+ * @example
128
+ * ```typescript
129
+ * try {
130
+ * const content = safeReadFileOrThrow('/path/to/file.txt');
131
+ * console.log(content);
132
+ * } catch (error) {
133
+ * console.error('Failed to read file:', error);
134
+ * }
135
+ * ```
136
+ */
137
+ export function safeReadFileOrThrow(
138
+ filePath: string,
139
+ encoding: BufferEncoding = 'utf-8'
140
+ ): string {
141
+ const result = safeReadFile(filePath, encoding);
142
+
143
+ if (!result.success) {
144
+ const error = result.errors[0];
145
+ switch (error.type) {
146
+ case 'FileNotFound':
147
+ throw new Error(`File not found: ${error.path}`);
148
+ case 'PermissionDenied':
149
+ throw new Error(`Permission denied: ${error.path}`);
150
+ case 'InvalidJSON':
151
+ throw new Error(`Invalid JSON in ${error.path}: ${error.cause}`);
152
+ case 'ReadError':
153
+ throw new Error(`Failed to read ${error.path}: ${error.cause}`);
154
+ }
155
+ }
156
+
157
+ return result.value as string;
158
+ }
@@ -5,27 +5,19 @@
5
5
  * 環境変数やAPIトークンなど機密情報のバリデーションとセキュリティチェックを行います。
6
6
  */
7
7
 
8
- import { statSync } from 'fs';
9
-
10
- /**
11
- * バリデーション結果
12
- */
13
- export interface ValidationResult {
14
- isValid: boolean;
15
- errors: string[];
16
- warnings: string[];
17
- }
8
+ import type { Result } from './types/validation.js';
9
+ import { success, failure } from './types/validation.js';
18
10
 
19
11
  /**
20
12
  * APIトークン形式の検証
21
13
  */
22
- export function validateAtlassianToken(token: string): ValidationResult {
14
+ export function validateAtlassianToken(token: string): Result<boolean, string> {
23
15
  const errors: string[] = [];
24
16
  const warnings: string[] = [];
25
17
 
26
18
  if (!token || token.trim() === '') {
27
19
  errors.push('Atlassian API token is empty');
28
- return { isValid: false, errors, warnings };
20
+ return failure(errors, warnings);
29
21
  }
30
22
 
31
23
  if (token.includes(' ')) {
@@ -40,17 +32,17 @@ export function validateAtlassianToken(token: string): ValidationResult {
40
32
  warnings.push('Atlassian API token seems too short (expected >20 characters)');
41
33
  }
42
34
 
43
- return {
44
- isValid: errors.length === 0,
45
- errors,
46
- warnings,
47
- };
35
+ if (errors.length > 0) {
36
+ return failure(errors, warnings);
37
+ }
38
+
39
+ return success(true, warnings);
48
40
  }
49
41
 
50
42
  /**
51
43
  * GitHub Personal Access Token の検証
52
44
  */
53
- export function validateGitHubToken(token: string): ValidationResult {
45
+ export function validateGitHubToken(token: string): Result<boolean, string> {
54
46
  const errors: string[] = [];
55
47
  const warnings: string[] = [];
56
48
 
@@ -66,17 +58,17 @@ export function validateGitHubToken(token: string): ValidationResult {
66
58
  warnings.push('GitHub token seems too short');
67
59
  }
68
60
 
69
- return {
70
- isValid: errors.length === 0,
71
- errors,
72
- warnings,
73
- };
61
+ if (errors.length > 0) {
62
+ return failure(errors, warnings);
63
+ }
64
+
65
+ return success(true, warnings);
74
66
  }
75
67
 
76
68
  /**
77
69
  * メールアドレス形式の検証
78
70
  */
79
- export function validateEmail(email: string): ValidationResult {
71
+ export function validateEmail(email: string): Result<boolean, string> {
80
72
  const errors: string[] = [];
81
73
  const warnings: string[] = [];
82
74
 
@@ -95,17 +87,17 @@ export function validateEmail(email: string): ValidationResult {
95
87
  }
96
88
  }
97
89
 
98
- return {
99
- isValid: errors.length === 0,
100
- errors,
101
- warnings,
102
- };
90
+ if (errors.length > 0) {
91
+ return failure(errors, warnings);
92
+ }
93
+
94
+ return success(true, warnings);
103
95
  }
104
96
 
105
97
  /**
106
98
  * URL形式の検証
107
99
  */
108
- export function validateUrl(url: string, expectedDomain?: string): ValidationResult {
100
+ export function validateUrl(url: string, expectedDomain?: string): Result<boolean, string> {
109
101
  const errors: string[] = [];
110
102
  const warnings: string[] = [];
111
103
 
@@ -135,25 +127,25 @@ export function validateUrl(url: string, expectedDomain?: string): ValidationRes
135
127
  }
136
128
  }
137
129
 
138
- return {
139
- isValid: errors.length === 0,
140
- errors,
141
- warnings,
142
- };
130
+ if (errors.length > 0) {
131
+ return failure(errors, warnings);
132
+ }
133
+
134
+ return success(true, warnings);
143
135
  }
144
136
 
145
137
  /**
146
138
  * Atlassian URL の検証
147
139
  */
148
- export function validateAtlassianUrl(url: string): ValidationResult {
140
+ export function validateAtlassianUrl(url: string): Result<boolean, string> {
149
141
  const result = validateUrl(url, 'atlassian.net');
150
142
 
151
- if (result.isValid) {
143
+ if (result.success) {
152
144
  try {
153
145
  const parsedUrl = new URL(url);
154
146
  if (!parsedUrl.hostname.endsWith('.atlassian.net')) {
155
- result.errors.push('Atlassian URL must end with .atlassian.net');
156
- result.isValid = false;
147
+ const errors = [...result.errors, 'Atlassian URL must end with .atlassian.net'];
148
+ return failure(errors, result.warnings);
157
149
  }
158
150
  } catch {
159
151
  // Already handled in validateUrl
@@ -166,7 +158,7 @@ export function validateAtlassianUrl(url: string): ValidationResult {
166
158
  /**
167
159
  * GitHub リポジトリ URL の検証
168
160
  */
169
- export function validateGitHubRepositoryUrl(url: string): ValidationResult {
161
+ export function validateGitHubRepositoryUrl(url: string): Result<boolean, string> {
170
162
  const errors: string[] = [];
171
163
  const warnings: string[] = [];
172
164
 
@@ -188,11 +180,11 @@ export function validateGitHubRepositoryUrl(url: string): ValidationResult {
188
180
  }
189
181
  }
190
182
 
191
- return {
192
- isValid: errors.length === 0,
193
- errors,
194
- warnings,
195
- };
183
+ if (errors.length > 0) {
184
+ return failure(errors, warnings);
185
+ }
186
+
187
+ return success(true, warnings);
196
188
  }
197
189
 
198
190
  /**
@@ -207,7 +199,7 @@ export interface EnvValidationConfig {
207
199
  repositoryUrl?: string;
208
200
  }
209
201
 
210
- export function validateEnvironmentConfig(config: EnvValidationConfig): ValidationResult {
202
+ export function validateEnvironmentConfig(config: EnvValidationConfig): Result<boolean, string> {
211
203
  const allErrors: string[] = [];
212
204
  const allWarnings: string[] = [];
213
205
 
@@ -249,38 +241,10 @@ export function validateEnvironmentConfig(config: EnvValidationConfig): Validati
249
241
  allWarnings.push(...result.warnings.map((w) => `repository: ${w}`));
250
242
  }
251
243
 
252
- return {
253
- isValid: allErrors.length === 0,
254
- errors: allErrors,
255
- warnings: allWarnings,
256
- };
257
- }
258
-
259
- /**
260
- * ファイルパーミッションの検証(Unix系のみ)
261
- */
262
- export function validateFilePermissions(filePath: string, expectedMode: number = 0o600): ValidationResult {
263
- const errors: string[] = [];
264
- const warnings: string[] = [];
265
-
266
- try {
267
- const stats = statSync(filePath);
268
- const actualMode = stats.mode & 0o777;
269
-
270
- if (actualMode !== expectedMode) {
271
- const actualOctal = actualMode.toString(8);
272
- const expectedOctal = expectedMode.toString(8);
273
- warnings.push(
274
- `File permissions are ${actualOctal} but should be ${expectedOctal} for security. Run: chmod ${expectedOctal} ${filePath}`,
275
- );
276
- }
277
- } catch (error) {
278
- errors.push(`Failed to check file permissions: ${error instanceof Error ? error.message : error}`);
244
+ if (allErrors.length > 0) {
245
+ return failure(allErrors, allWarnings);
279
246
  }
280
247
 
281
- return {
282
- isValid: errors.length === 0,
283
- errors,
284
- warnings,
285
- };
248
+ return success(true, allWarnings);
286
249
  }
250
+
@@ -3,9 +3,10 @@
3
3
  * 完了した仕様書を .kiro/specs/archive/ に移動する
4
4
  */
5
5
 
6
- import { existsSync, renameSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'fs';
6
+ import { existsSync, renameSync, mkdirSync, readdirSync, writeFileSync } from 'fs';
7
7
  import { resolve } from 'path';
8
8
  import { validateFeatureName as validateFeatureNameStrict } from './feature-name-validator.js';
9
+ import { safeReadFileOrThrow } from './safe-file-reader.js';
9
10
 
10
11
  export interface ArchiveResult {
11
12
  success: boolean;
@@ -45,7 +46,7 @@ function validateFeatureName(featureName: string): void {
45
46
 
46
47
  // kebab-case形式の厳密な検証(既存のバリデータを使用)
47
48
  const result = validateFeatureNameStrict(featureName);
48
- if (!result.valid) {
49
+ if (!result.success) {
49
50
  throw new Error(result.errors.join('\n'));
50
51
  }
51
52
  }
@@ -79,7 +80,7 @@ export function canArchiveSpec(
79
80
  }
80
81
 
81
82
  try {
82
- const specContent = JSON.parse(readFileSync(specJsonPath, 'utf-8'));
83
+ const specContent = JSON.parse(safeReadFileOrThrow(specJsonPath));
83
84
 
84
85
  // 既にアーカイブ済みかチェック
85
86
  if (specContent.archived) {
@@ -151,7 +152,7 @@ export function archiveSpec(
151
152
 
152
153
  // spec.json に archived 情報を追加
153
154
  const specJsonPath = resolve(targetDir, 'spec.json');
154
- const spec = JSON.parse(readFileSync(specJsonPath, 'utf-8'));
155
+ const spec = JSON.parse(safeReadFileOrThrow(specJsonPath, 'utf-8'));
155
156
  spec.archived = {
156
157
  at: new Date().toISOString(),
157
158
  reason: options?.reason,
@@ -208,7 +209,7 @@ export function listSpecs(
208
209
  const specPath = resolve(archiveDir, archivedEntry.name, 'spec.json');
209
210
  if (existsSync(specPath)) {
210
211
  try {
211
- const spec = JSON.parse(readFileSync(specPath, 'utf-8'));
212
+ const spec = JSON.parse(safeReadFileOrThrow(specPath, 'utf-8'));
212
213
  const files = readdirSync(resolve(archiveDir, archivedEntry.name));
213
214
 
214
215
  specs.push({
@@ -240,7 +241,7 @@ export function listSpecs(
240
241
  const specPath = resolve(specsDir, entry.name, 'spec.json');
241
242
  if (existsSync(specPath)) {
242
243
  try {
243
- const spec = JSON.parse(readFileSync(specPath, 'utf-8'));
244
+ const spec = JSON.parse(safeReadFileOrThrow(specPath, 'utf-8'));
244
245
  const files = readdirSync(resolve(specsDir, entry.name));
245
246
 
246
247
  specs.push({
@@ -3,7 +3,8 @@
3
3
  * Confluence/JIRA 同期後に spec.json を更新する
4
4
  */
5
5
 
6
- import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
6
+ import { writeFileSync, existsSync, mkdirSync } from 'fs';
7
+ import { safeReadJsonFile } from './safe-file-reader.js';
7
8
  import { resolve } from 'path';
8
9
 
9
10
  /**
@@ -94,11 +95,14 @@ export function loadSpecJson(featureName: string, projectRoot: string = process.
94
95
  };
95
96
  }
96
97
 
97
- try {
98
- const content = readFileSync(specPath, 'utf-8');
99
- return JSON.parse(content);
100
- } catch (error) {
101
- console.warn(`⚠️ Failed to load spec.json from ${specPath}: ${error instanceof Error ? error.message : 'Unknown error'}`);
98
+ const result = safeReadJsonFile<SpecJson>(specPath);
99
+
100
+ if (!result.success) {
101
+ const errorType = result.errors[0].type;
102
+ const errorMsg = errorType === 'InvalidJSON'
103
+ ? `Invalid JSON: ${result.errors[0].cause}`
104
+ : errorType;
105
+ console.warn(`⚠️ Failed to load spec.json from ${specPath}: ${errorMsg}`);
102
106
  return {
103
107
  featureName,
104
108
  confluence: {},
@@ -106,6 +110,8 @@ export function loadSpecJson(featureName: string, projectRoot: string = process.
106
110
  milestones: {},
107
111
  };
108
112
  }
113
+
114
+ return result.value!;
109
115
  }
110
116
 
111
117
  /**
@@ -15,12 +15,12 @@ import {
15
15
  isAIDLCFormat,
16
16
  getAIDLCStats,
17
17
  } from './aidlc-parser.js';
18
- import { readFileSync } from 'fs';
19
18
  import {
20
19
  getWeekdayNotation,
21
20
  getWeekdayRangeNotation,
22
21
  ensureBusinessDay,
23
22
  } from './business-days.js';
23
+ import { safeReadFileOrThrow } from './safe-file-reader.js';
24
24
 
25
25
  /**
26
26
  * 変換オプション
@@ -551,7 +551,7 @@ export function convertTasksFile(
551
551
  options: ConversionOptions = {},
552
552
  ): ConversionResult {
553
553
  // ファイル読み込み
554
- const content = readFileSync(inputPath, 'utf-8');
554
+ const content = safeReadFileOrThrow(inputPath);
555
555
 
556
556
  // AI-DLC形式かチェック
557
557
  if (!isAIDLCFormat(content)) {
@@ -6,7 +6,7 @@
6
6
  * - 旧6-Phase構造(Phase 0-5)も互換性のためサポート
7
7
  */
8
8
 
9
- import { readFileSync } from 'fs';
9
+ import { safeReadFileOrThrow } from './safe-file-reader.js';
10
10
 
11
11
  /**
12
12
  * tasks.mdのフォーマットを検証
@@ -18,7 +18,7 @@ export function validateTasksFormat(tasksPath: string): void {
18
18
  let content: string;
19
19
 
20
20
  try {
21
- content = readFileSync(tasksPath, 'utf-8');
21
+ content = safeReadFileOrThrow(tasksPath);
22
22
  } catch (error) {
23
23
  throw new Error(
24
24
  `Failed to read tasks.md: ${error instanceof Error ? error.message : 'Unknown error'}`,
@@ -153,7 +153,7 @@ export function isValidTasksFormat(tasksPath: string): boolean {
153
153
  */
154
154
  export function countPhases(tasksPath: string): number {
155
155
  try {
156
- const content = readFileSync(tasksPath, 'utf-8');
156
+ const content = safeReadFileOrThrow(tasksPath);
157
157
  const phasePattern = /## Phase \d+:/g;
158
158
  const matches = content.match(phasePattern);
159
159
  return matches ? matches.length : 0;
@@ -170,7 +170,7 @@ export function countPhases(tasksPath: string): number {
170
170
  */
171
171
  export function countStories(tasksPath: string): number {
172
172
  try {
173
- const content = readFileSync(tasksPath, 'utf-8');
173
+ const content = safeReadFileOrThrow(tasksPath);
174
174
  const storyPattern = /### Story \d+\.\d+:/g;
175
175
  const matches = content.match(storyPattern);
176
176
  return matches ? matches.length : 0;
@@ -3,7 +3,8 @@
3
3
  * テスト仕様書テンプレートにデータを適用
4
4
  */
5
5
 
6
- import { readFileSync, existsSync } from 'fs';
6
+ import { existsSync } from 'fs';
7
+ import { safeReadFileOrThrow } from './safe-file-reader.js';
7
8
  import { join, dirname } from 'path';
8
9
  import { fileURLToPath } from 'url';
9
10
  import type { Component, Flow, Requirement } from './markdown-parser.js';
@@ -64,13 +65,13 @@ export function loadTestSpecTemplate(testType: string, projectRoot: string = pro
64
65
  );
65
66
 
66
67
  if (existsSync(michiTemplatePath)) {
67
- return readFileSync(michiTemplatePath, 'utf-8');
68
+ return safeReadFileOrThrow(michiTemplatePath, 'utf-8');
68
69
  }
69
70
 
70
71
  throw new Error(`テンプレートが見つかりません: ${testType}-test-spec-template.md`);
71
72
  }
72
73
 
73
- return readFileSync(templatePath, 'utf-8');
74
+ return safeReadFileOrThrow(templatePath, 'utf-8');
74
75
  }
75
76
 
76
77
  /**