aiwf 0.3.7 → 0.3.8

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 (267) hide show
  1. package/.aiwf/00_PROJECT_MANIFEST.md +226 -2
  2. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/S03_M02_sprint_meta.md +112 -0
  3. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T01_S03_new_test_task.md +39 -0
  4. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T02_S03_first_task.md +39 -0
  5. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T03_S03_test_task.md +39 -0
  6. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T04_S03_task_with_special_characters.md +39 -0
  7. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T05_S03_test.md +39 -0
  8. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T06_S03_test_task.md +39 -0
  9. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T07_S03_next_task.md +39 -0
  10. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T08_S03_next_task.md +39 -0
  11. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T09_S03_new_test_task.md +39 -0
  12. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T100_S03_task_with_special_characters.md +39 -0
  13. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T101_S03_test.md +39 -0
  14. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T102_S03_test_task.md +39 -0
  15. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T103_S03_next_task.md +39 -0
  16. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T104_S03_next_task.md +39 -0
  17. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T105_S03_new_test_task.md +39 -0
  18. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T106_S03_first_task.md +39 -0
  19. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T107_S03_test_task.md +39 -0
  20. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T108_S03_task_with_special_characters.md +39 -0
  21. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T109_S03_test.md +39 -0
  22. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T10_S03_first_task.md +39 -0
  23. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T110_S03_test_task.md +39 -0
  24. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T111_S03_next_task.md +39 -0
  25. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T112_S03_next_task.md +39 -0
  26. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T11_S03_test_task.md +39 -0
  27. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T12_S03_task_with_special_characters.md +39 -0
  28. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T13_S03_test.md +39 -0
  29. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T14_S03_test_task.md +39 -0
  30. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T15_S03_next_task.md +39 -0
  31. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T16_S03_next_task.md +39 -0
  32. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T17_S03_new_test_task.md +39 -0
  33. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T18_S03_first_task.md +39 -0
  34. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T19_S03_test_task.md +39 -0
  35. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T20_S03_task_with_special_characters.md +39 -0
  36. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T21_S03_test.md +39 -0
  37. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T22_S03_test_task.md +39 -0
  38. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T23_S03_next_task.md +39 -0
  39. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T24_S03_next_task.md +39 -0
  40. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T25_S03_new_test_task.md +39 -0
  41. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T26_S03_first_task.md +39 -0
  42. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T27_S03_test_task.md +39 -0
  43. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T28_S03_task_with_special_characters.md +39 -0
  44. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T29_S03_test.md +39 -0
  45. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T30_S03_test_task.md +39 -0
  46. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T31_S03_next_task.md +39 -0
  47. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T32_S03_next_task.md +39 -0
  48. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T33_S03_new_test_task.md +39 -0
  49. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T34_S03_first_task.md +39 -0
  50. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T35_S03_test_task.md +39 -0
  51. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T36_S03_task_with_special_characters.md +39 -0
  52. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T37_S03_test.md +39 -0
  53. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T38_S03_test_task.md +39 -0
  54. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T39_S03_next_task.md +39 -0
  55. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T40_S03_next_task.md +39 -0
  56. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T41_S03_new_test_task.md +39 -0
  57. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T42_S03_first_task.md +39 -0
  58. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T43_S03_test_task.md +39 -0
  59. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T44_S03_task_with_special_characters.md +39 -0
  60. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T45_S03_test.md +39 -0
  61. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T46_S03_test_task.md +39 -0
  62. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T47_S03_next_task.md +39 -0
  63. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T48_S03_next_task.md +39 -0
  64. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T49_S03_new_test_task.md +39 -0
  65. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T50_S03_first_task.md +39 -0
  66. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T51_S03_test_task.md +39 -0
  67. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T52_S03_task_with_special_characters.md +39 -0
  68. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T53_S03_test.md +39 -0
  69. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T54_S03_test_task.md +39 -0
  70. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T55_S03_next_task.md +39 -0
  71. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T56_S03_next_task.md +39 -0
  72. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T57_S03_new_test_task.md +39 -0
  73. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T58_S03_first_task.md +39 -0
  74. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T59_S03_test_task.md +39 -0
  75. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T60_S03_task_with_special_characters.md +39 -0
  76. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T61_S03_test.md +39 -0
  77. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T62_S03_test_task.md +39 -0
  78. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T63_S03_next_task.md +39 -0
  79. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T64_S03_next_task.md +39 -0
  80. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T65_S03_new_test_task.md +39 -0
  81. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T66_S03_first_task.md +39 -0
  82. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T67_S03_test_task.md +39 -0
  83. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T68_S03_task_with_special_characters.md +39 -0
  84. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T69_S03_test.md +39 -0
  85. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T70_S03_test_task.md +39 -0
  86. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T71_S03_next_task.md +39 -0
  87. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T72_S03_next_task.md +39 -0
  88. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T73_S03_new_test_task.md +39 -0
  89. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T74_S03_first_task.md +39 -0
  90. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T75_S03_test_task.md +39 -0
  91. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T76_S03_task_with_special_characters.md +39 -0
  92. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T77_S03_test.md +39 -0
  93. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T78_S03_test_task.md +39 -0
  94. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T79_S03_next_task.md +39 -0
  95. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T80_S03_next_task.md +39 -0
  96. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T81_S03_new_test_task.md +39 -0
  97. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T82_S03_first_task.md +39 -0
  98. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T83_S03_test_task.md +39 -0
  99. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T84_S03_task_with_special_characters.md +39 -0
  100. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T85_S03_test.md +39 -0
  101. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T86_S03_test_task.md +39 -0
  102. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T87_S03_next_task.md +39 -0
  103. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T88_S03_next_task.md +39 -0
  104. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T89_S03_new_test_task.md +39 -0
  105. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T90_S03_first_task.md +39 -0
  106. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T91_S03_test_task.md +39 -0
  107. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T92_S03_task_with_special_characters.md +39 -0
  108. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T93_S03_test.md +39 -0
  109. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T94_S03_test_task.md +39 -0
  110. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T95_S03_next_task.md +39 -0
  111. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T96_S03_next_task.md +39 -0
  112. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T97_S03_new_test_task.md +39 -0
  113. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T98_S03_first_task.md +39 -0
  114. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/T99_S03_test_task.md +39 -0
  115. package/.aiwf/test-results-s02.json +5 -5
  116. package/.claude/commands/aiwf/aiwf_compress_aggressive_persona.md +3 -15
  117. package/.claude/commands/aiwf/aiwf_compress_minimal_persona.md +2 -15
  118. package/.claude/commands/aiwf/aiwf_compress_stats.md +2 -51
  119. package/.claude/commands/aiwf/aiwf_compress_with_persona.md +5 -18
  120. package/.claude/commands/aiwf/aiwf_create_feature_ledger.md +1 -1
  121. package/.claude/commands/aiwf/aiwf_default_mode.md +1 -1
  122. package/.claude/commands/aiwf/aiwf_evaluate.md +3 -16
  123. package/.claude/commands/aiwf/aiwf_get_feature_details.md +1 -1
  124. package/.claude/commands/aiwf/aiwf_link_feature_to_milestone.md +1 -1
  125. package/.claude/commands/aiwf/aiwf_list_features.md +1 -1
  126. package/.claude/commands/aiwf/aiwf_switch_language.md +48 -120
  127. package/.claude/commands/aiwf/aiwf_update_feature_status.md +1 -1
  128. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_aggressive_persona.md +2 -2
  129. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_minimal_persona.md +2 -2
  130. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_stats.md +10 -47
  131. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_with_persona.md +2 -2
  132. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_create_feature_ledger.md +1 -1
  133. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_default_mode.md +1 -1
  134. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_evaluate.md +2 -2
  135. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_get_feature_details.md +1 -1
  136. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_link_feature_to_milestone.md +1 -1
  137. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_list_features.md +1 -1
  138. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_architect.md +1 -1
  139. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_backend.md +1 -1
  140. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_data_analyst.md +1 -1
  141. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_frontend.md +1 -1
  142. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_security.md +1 -1
  143. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_status.md +1 -1
  144. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_update_feature_status.md +1 -1
  145. package/package.json +1 -1
  146. package/src/cli/index.js +174 -0
  147. package/src/commands/compress.js +60 -0
  148. package/src/commands/create-project.js +23 -17
  149. package/src/commands/evaluate.js +459 -0
  150. package/src/commands/feature.js +365 -0
  151. package/src/commands/persona.js +37 -16
  152. package/src/commands/token.js +312 -0
  153. package/src/lib/resource-loader.js +250 -0
  154. package/src/lib/resources/commands/ai-persona.js +602 -0
  155. package/src/lib/resources/commands/compress-context.js +389 -0
  156. package/src/lib/resources/commands/evaluate.js +246 -0
  157. package/src/lib/resources/commands/feature-ledger.js +565 -0
  158. package/src/lib/resources/commands/feature_commit_report.js +370 -0
  159. package/src/lib/resources/commands/persona-context-apply.js +562 -0
  160. package/src/lib/resources/commands/scan_git_history.js +234 -0
  161. package/src/lib/resources/commands/sync_feature_commits.js +154 -0
  162. package/src/lib/resources/commands/token-tracking.js +443 -0
  163. package/src/lib/resources/config/commit-patterns.js +103 -0
  164. package/src/lib/resources/config/language.json +6 -0
  165. package/src/lib/resources/personas/PERSONA_INDEX.md +57 -0
  166. package/src/lib/resources/personas/analyst.json +44 -0
  167. package/src/lib/resources/personas/architect/best_practices.md +136 -0
  168. package/src/lib/resources/personas/architect/knowledge_base.md +377 -0
  169. package/src/lib/resources/personas/architect.json +44 -0
  170. package/src/lib/resources/personas/backend/best_practices.md +766 -0
  171. package/src/lib/resources/personas/backend/knowledge_base.md +1070 -0
  172. package/src/lib/resources/personas/data_analyst/best_practices.md +594 -0
  173. package/src/lib/resources/personas/data_analyst/knowledge_base.md +1057 -0
  174. package/src/lib/resources/personas/developer.json +44 -0
  175. package/src/lib/resources/personas/developer.md +37 -0
  176. package/src/lib/resources/personas/evaluation_criteria.json +137 -0
  177. package/src/lib/resources/personas/frontend/best_practices.md +445 -0
  178. package/src/lib/resources/personas/frontend/knowledge_base.md +729 -0
  179. package/src/lib/resources/personas/persona-index.json +31 -0
  180. package/src/lib/resources/personas/reviewer.json +44 -0
  181. package/src/lib/resources/personas/security/best_practices.md +307 -0
  182. package/src/lib/resources/personas/security/knowledge_base.md +498 -0
  183. package/src/lib/resources/personas/tester.json +44 -0
  184. package/src/lib/resources/templates/README.md +78 -0
  185. package/src/lib/resources/templates/api-server/config.json +64 -0
  186. package/src/lib/resources/templates/api-server/template/.aiwf/config.json +56 -0
  187. package/src/lib/resources/templates/api-server/template/.aiwf/feature-ledger.json +42 -0
  188. package/src/lib/resources/templates/api-server/template/.aiwf/personas/backend-engineer.json +40 -0
  189. package/src/lib/resources/templates/api-server/template/.aiwf/scripts/cli.js +111 -0
  190. package/src/lib/resources/templates/api-server/template/.env.example +29 -0
  191. package/src/lib/resources/templates/api-server/template/.eslintrc.json +23 -0
  192. package/src/lib/resources/templates/api-server/template/README.md +171 -0
  193. package/src/lib/resources/templates/api-server/template/jest.config.js +26 -0
  194. package/src/lib/resources/templates/api-server/template/nodemon.json +9 -0
  195. package/src/lib/resources/templates/api-server/template/package.json +61 -0
  196. package/src/lib/resources/templates/api-server/template/src/app.ts +60 -0
  197. package/src/lib/resources/templates/api-server/template/src/config/swagger.ts +38 -0
  198. package/src/lib/resources/templates/api-server/template/src/controllers/aiwfController.ts +68 -0
  199. package/src/lib/resources/templates/api-server/template/src/controllers/authController.ts +128 -0
  200. package/src/lib/resources/templates/api-server/template/src/controllers/statusController.ts +28 -0
  201. package/src/lib/resources/templates/api-server/template/src/index.ts +28 -0
  202. package/src/lib/resources/templates/api-server/template/src/middleware/aiwfMiddleware.ts +50 -0
  203. package/src/lib/resources/templates/api-server/template/src/middleware/authMiddleware.ts +41 -0
  204. package/src/lib/resources/templates/api-server/template/src/middleware/errorHandler.ts +42 -0
  205. package/src/lib/resources/templates/api-server/template/src/middleware/notFoundHandler.ts +14 -0
  206. package/src/lib/resources/templates/api-server/template/src/middleware/requestLogger.ts +20 -0
  207. package/src/lib/resources/templates/api-server/template/src/routes/aiwf.ts +42 -0
  208. package/src/lib/resources/templates/api-server/template/src/routes/index.ts +13 -0
  209. package/src/lib/resources/templates/api-server/template/src/routes/v1/index.ts +67 -0
  210. package/src/lib/resources/templates/api-server/template/src/utils/logger.ts +37 -0
  211. package/src/lib/resources/templates/api-server/template/tests/app.test.ts +40 -0
  212. package/src/lib/resources/templates/api-server/template/tsconfig.json +43 -0
  213. package/src/lib/resources/templates/npm-library/config.json +61 -0
  214. package/src/lib/resources/templates/npm-library/template/LICENSE +21 -0
  215. package/src/lib/resources/templates/npm-library/template/README.md +201 -0
  216. package/src/lib/resources/templates/npm-library/template/package.json +78 -0
  217. package/src/lib/resources/templates/web-app/config.json +53 -0
  218. package/src/lib/resources/templates/web-app/template/.aiwf/config.json +54 -0
  219. package/src/lib/resources/templates/web-app/template/.aiwf/feature-ledger.json +37 -0
  220. package/src/lib/resources/templates/web-app/template/.aiwf/personas/fullstack-developer.json +40 -0
  221. package/src/lib/resources/templates/web-app/template/.aiwf/scripts/cli.js +110 -0
  222. package/src/lib/resources/templates/web-app/template/.eslintrc.cjs +20 -0
  223. package/src/lib/resources/templates/web-app/template/README.md +151 -0
  224. package/src/lib/resources/templates/web-app/template/index.html +14 -0
  225. package/src/lib/resources/templates/web-app/template/package.json +44 -0
  226. package/src/lib/resources/templates/web-app/template/postcss.config.js +6 -0
  227. package/src/lib/resources/templates/web-app/template/public/vite.svg +1 -0
  228. package/src/lib/resources/templates/web-app/template/src/App.tsx +21 -0
  229. package/src/lib/resources/templates/web-app/template/src/components/Layout.tsx +57 -0
  230. package/src/lib/resources/templates/web-app/template/src/components/aiwf/ContextStatus.tsx +107 -0
  231. package/src/lib/resources/templates/web-app/template/src/components/aiwf/FeatureLedger.tsx +93 -0
  232. package/src/lib/resources/templates/web-app/template/src/components/aiwf/TokenUsage.tsx +71 -0
  233. package/src/lib/resources/templates/web-app/template/src/index.css +60 -0
  234. package/src/lib/resources/templates/web-app/template/src/main.tsx +10 -0
  235. package/src/lib/resources/templates/web-app/template/src/pages/AiwfDashboard.tsx +60 -0
  236. package/src/lib/resources/templates/web-app/template/src/pages/HomePage.tsx +89 -0
  237. package/src/lib/resources/templates/web-app/template/src/pages/NotFound.tsx +25 -0
  238. package/src/lib/resources/templates/web-app/template/src/stores/aiwfStore.ts +126 -0
  239. package/src/lib/resources/templates/web-app/template/src/types/global.d.ts +9 -0
  240. package/src/lib/resources/templates/web-app/template/src/vite-env.d.ts +1 -0
  241. package/src/lib/resources/templates/web-app/template/tailwind.config.js +30 -0
  242. package/src/lib/resources/templates/web-app/template/tsconfig.json +37 -0
  243. package/src/lib/resources/templates/web-app/template/tsconfig.node.json +10 -0
  244. package/src/lib/resources/templates/web-app/template/vite.config.ts +23 -0
  245. package/src/lib/resources/utils/background-monitor.js +223 -0
  246. package/src/lib/resources/utils/compression-metrics.js +1031 -0
  247. package/src/lib/resources/utils/compression-strategies.js +557 -0
  248. package/src/lib/resources/utils/content-normalizer.js +455 -0
  249. package/src/lib/resources/utils/context-compressor.js +583 -0
  250. package/src/lib/resources/utils/context-rule-parser.js +180 -0
  251. package/src/lib/resources/utils/context-token-monitor.js +463 -0
  252. package/src/lib/resources/utils/context-update-manager.js +502 -0
  253. package/src/lib/resources/utils/feature-updater.js +271 -0
  254. package/src/lib/resources/utils/git-utils.js +220 -0
  255. package/src/lib/resources/utils/importance-classifier.js +645 -0
  256. package/src/lib/resources/utils/information-filter.js +710 -0
  257. package/src/lib/resources/utils/persona-aware-compressor.js +598 -0
  258. package/src/lib/resources/utils/prompt-injector.js +242 -0
  259. package/src/lib/resources/utils/simplified-evaluator.js +119 -0
  260. package/src/lib/resources/utils/text-summarizer.js +492 -0
  261. package/src/lib/resources/utils/token-counter.js +177 -0
  262. package/src/lib/resources/utils/token-monitor.js +484 -0
  263. package/src/lib/resources/utils/token-reporter.js +453 -0
  264. package/src/lib/resources/utils/token-storage.js +433 -0
  265. package/src/lib/resources/utils/token-tracker.js +283 -0
  266. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_switch_language.md +0 -160
  267. /package/claude-code/aiwf/ko/.claude/commands/aiwf/{aiwf_update_docs_kr.md → aiwf_update_docs.md} +0 -0
@@ -0,0 +1,453 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { TokenStorage } from './token-storage.js';
4
+ import { TokenCounter } from './token-counter.js';
5
+
6
+ /**
7
+ * 토큰 사용량 보고서를 생성하고 포맷팅하는 클래스
8
+ */
9
+ export class TokenReporter {
10
+ constructor() {
11
+ this.storage = new TokenStorage();
12
+ this.counter = new TokenCounter();
13
+ }
14
+
15
+ /**
16
+ * 프로젝트 전체 토큰 분석 보고서를 생성합니다
17
+ * @param {string} projectPath - 프로젝트 경로
18
+ * @returns {Object} 프로젝트 토큰 분석 보고서
19
+ */
20
+ generateProjectAnalysisReport(projectPath = '.') {
21
+ try {
22
+ const report = {
23
+ generatedAt: new Date().toISOString(),
24
+ projectPath,
25
+ analysis: {
26
+ totalTokens: 0,
27
+ fileBreakdown: {},
28
+ directoryBreakdown: {},
29
+ compressionOpportunities: [],
30
+ recommendations: []
31
+ }
32
+ };
33
+
34
+ // 주요 AIWF 디렉토리 분석
35
+ const directories = [
36
+ '.aiwf/01_PROJECT_DOCS',
37
+ '.aiwf/02_REQUIREMENTS',
38
+ '.aiwf/03_SPRINTS',
39
+ '.aiwf/04_GENERAL_TASKS',
40
+ '.aiwf/05_COMPLETED_TASKS',
41
+ '.aiwf/06_FEATURE_LEDGERS',
42
+ '.aiwf/07_AI_PERSONAS'
43
+ ];
44
+
45
+ // 각 디렉토리별 토큰 수 분석
46
+ for (const dir of directories) {
47
+ const dirPath = path.join(projectPath, dir);
48
+ if (fs.existsSync(dirPath)) {
49
+ const tokens = this.counter.countDirectoryTokens(dirPath);
50
+ report.analysis.directoryBreakdown[dir] = {
51
+ tokens,
52
+ percentage: 0, // 나중에 계산
53
+ files: this.getFileAnalysis(dirPath)
54
+ };
55
+ report.analysis.totalTokens += tokens;
56
+ }
57
+ }
58
+
59
+ // 퍼센티지 계산
60
+ Object.keys(report.analysis.directoryBreakdown).forEach(dir => {
61
+ const breakdown = report.analysis.directoryBreakdown[dir];
62
+ breakdown.percentage = report.analysis.totalTokens > 0
63
+ ? ((breakdown.tokens / report.analysis.totalTokens) * 100).toFixed(1)
64
+ : 0;
65
+ });
66
+
67
+ // 압축 기회 식별
68
+ report.analysis.compressionOpportunities = this.identifyCompressionOpportunities(
69
+ report.analysis.directoryBreakdown
70
+ );
71
+
72
+ // 권장사항 생성
73
+ report.analysis.recommendations = this.generateRecommendations(
74
+ report.analysis.totalTokens,
75
+ report.analysis.compressionOpportunities
76
+ );
77
+
78
+ return report;
79
+ } catch (error) {
80
+ console.error('프로젝트 분석 보고서 생성 중 오류 발생:', error);
81
+ return null;
82
+ }
83
+ }
84
+
85
+ /**
86
+ * 디렉토리 내 파일별 토큰 분석을 수행합니다
87
+ * @param {string} dirPath - 디렉토리 경로
88
+ * @returns {Array<Object>} 파일별 분석 결과
89
+ */
90
+ getFileAnalysis(dirPath) {
91
+ try {
92
+ const files = this.counter.getMarkdownFiles(dirPath);
93
+ const analysis = [];
94
+
95
+ for (const file of files) {
96
+ const tokens = this.counter.countFileTokens(file);
97
+ const relativePath = path.relative(process.cwd(), file);
98
+
99
+ analysis.push({
100
+ path: relativePath,
101
+ tokens,
102
+ size: fs.statSync(file).size,
103
+ tokensPerByte: tokens > 0 ? (tokens / fs.statSync(file).size).toFixed(3) : 0
104
+ });
105
+ }
106
+
107
+ return analysis.sort((a, b) => b.tokens - a.tokens);
108
+ } catch (error) {
109
+ console.error('파일 분석 중 오류 발생:', error);
110
+ return [];
111
+ }
112
+ }
113
+
114
+ /**
115
+ * 압축 기회를 식별합니다
116
+ * @param {Object} directoryBreakdown - 디렉토리별 분석 결과
117
+ * @returns {Array<Object>} 압축 기회 목록
118
+ */
119
+ identifyCompressionOpportunities(directoryBreakdown) {
120
+ const opportunities = [];
121
+
122
+ try {
123
+ // 대용량 디렉토리 식별
124
+ const largeDirectories = Object.entries(directoryBreakdown)
125
+ .filter(([_, data]) => data.tokens > 5000)
126
+ .sort((a, b) => b[1].tokens - a[1].tokens);
127
+
128
+ for (const [dir, data] of largeDirectories) {
129
+ opportunities.push({
130
+ type: 'large_directory',
131
+ target: dir,
132
+ currentTokens: data.tokens,
133
+ description: `대용량 디렉토리 (${data.tokens} 토큰)`,
134
+ potentialSavings: Math.round(data.tokens * 0.3),
135
+ priority: data.tokens > 10000 ? 'high' : 'medium'
136
+ });
137
+ }
138
+
139
+ // 반복 콘텐츠 식별
140
+ opportunities.push({
141
+ type: 'repetitive_content',
142
+ target: 'all',
143
+ description: '반복되는 템플릿 및 보일러플레이트 콘텐츠',
144
+ potentialSavings: Math.round(Object.values(directoryBreakdown).reduce((sum, data) => sum + data.tokens, 0) * 0.15),
145
+ priority: 'medium'
146
+ });
147
+
148
+ // 완료된 태스크 압축
149
+ if (directoryBreakdown['.aiwf/05_COMPLETED_TASKS']) {
150
+ opportunities.push({
151
+ type: 'completed_tasks',
152
+ target: '.aiwf/05_COMPLETED_TASKS',
153
+ currentTokens: directoryBreakdown['.aiwf/05_COMPLETED_TASKS'].tokens,
154
+ description: '완료된 태스크 아카이브',
155
+ potentialSavings: Math.round(directoryBreakdown['.aiwf/05_COMPLETED_TASKS'].tokens * 0.6),
156
+ priority: 'low'
157
+ });
158
+ }
159
+ } catch (error) {
160
+ console.error('압축 기회 식별 중 오류 발생:', error);
161
+ }
162
+
163
+ return opportunities.sort((a, b) => {
164
+ const priorityOrder = { high: 3, medium: 2, low: 1 };
165
+ return priorityOrder[b.priority] - priorityOrder[a.priority];
166
+ });
167
+ }
168
+
169
+ /**
170
+ * 권장사항을 생성합니다
171
+ * @param {number} totalTokens - 총 토큰 수
172
+ * @param {Array<Object>} opportunities - 압축 기회 목록
173
+ * @returns {Array<Object>} 권장사항 목록
174
+ */
175
+ generateRecommendations(totalTokens, opportunities) {
176
+ const recommendations = [];
177
+
178
+ try {
179
+ // 총 토큰 수에 따른 권장사항
180
+ if (totalTokens > 50000) {
181
+ recommendations.push({
182
+ type: 'aggressive_compression',
183
+ priority: 'high',
184
+ title: '적극적 압축 모드 권장',
185
+ description: `프로젝트 크기가 ${totalTokens.toLocaleString()} 토큰으로 매우 큽니다. 적극적 압축 모드를 사용하여 50-70% 압축을 권장합니다.`,
186
+ action: 'aiwf compress --mode aggressive --level 4'
187
+ });
188
+ } else if (totalTokens > 20000) {
189
+ recommendations.push({
190
+ type: 'balanced_compression',
191
+ priority: 'medium',
192
+ title: '균형 압축 모드 권장',
193
+ description: `프로젝트 크기가 ${totalTokens.toLocaleString()} 토큰입니다. 균형 압축 모드를 사용하여 30-50% 압축을 권장합니다.`,
194
+ action: 'aiwf compress --mode balanced --level 3'
195
+ });
196
+ }
197
+
198
+ // 압축 기회 기반 권장사항
199
+ const highPriorityOpportunities = opportunities.filter(op => op.priority === 'high');
200
+ if (highPriorityOpportunities.length > 0) {
201
+ recommendations.push({
202
+ type: 'targeted_compression',
203
+ priority: 'high',
204
+ title: '특정 디렉토리 압축 권장',
205
+ description: `${highPriorityOpportunities.length}개의 대용량 디렉토리가 식별되었습니다.`,
206
+ action: 'aiwf compress --target-directories'
207
+ });
208
+ }
209
+
210
+ // 정기적 정리 권장사항
211
+ recommendations.push({
212
+ type: 'regular_cleanup',
213
+ priority: 'low',
214
+ title: '정기적 프로젝트 정리',
215
+ description: '오래된 로그, 완료된 태스크 등을 정기적으로 정리하여 토큰 사용량을 최적화하세요.',
216
+ action: 'aiwf cleanup --older-than 30d'
217
+ });
218
+
219
+ // 토큰 모니터링 권장사항
220
+ recommendations.push({
221
+ type: 'monitoring',
222
+ priority: 'medium',
223
+ title: '토큰 사용량 모니터링 설정',
224
+ description: '토큰 사용량을 실시간으로 모니터링하고 임계값을 설정하세요.',
225
+ action: 'aiwf token-monitor --enable --threshold 10000'
226
+ });
227
+ } catch (error) {
228
+ console.error('권장사항 생성 중 오류 발생:', error);
229
+ }
230
+
231
+ return recommendations.sort((a, b) => {
232
+ const priorityOrder = { high: 3, medium: 2, low: 1 };
233
+ return priorityOrder[b.priority] - priorityOrder[a.priority];
234
+ });
235
+ }
236
+
237
+ /**
238
+ * 사용량 보고서를 생성합니다
239
+ * @param {string} type - 보고서 타입
240
+ * @returns {Object} 사용량 보고서
241
+ */
242
+ generateUsageReport(type = 'daily') {
243
+ try {
244
+ const report = this.storage.generateUsageReport(type);
245
+
246
+ if (!report) {
247
+ return null;
248
+ }
249
+
250
+ // 보고서 포맷팅
251
+ const formattedReport = {
252
+ ...report,
253
+ formatted: {
254
+ summary: this.formatSummary(report.summary),
255
+ dailyUsage: this.formatDailyUsage(report.dailyUsage),
256
+ topCommands: this.formatTopCommands(report.topCommands),
257
+ compressionStats: this.formatCompressionStats(report.compressionStats),
258
+ trends: this.formatTrends(report.trends)
259
+ }
260
+ };
261
+
262
+ return formattedReport;
263
+ } catch (error) {
264
+ console.error('사용량 보고서 생성 중 오류 발생:', error);
265
+ return null;
266
+ }
267
+ }
268
+
269
+ /**
270
+ * 요약 정보를 포맷팅합니다
271
+ * @param {Object} summary - 요약 정보
272
+ * @returns {Object} 포맷팅된 요약 정보
273
+ */
274
+ formatSummary(summary) {
275
+ return {
276
+ totalTokens: summary.totalTokens.toLocaleString(),
277
+ totalSessions: summary.totalSessions.toLocaleString(),
278
+ avgTokensPerSession: summary.avgTokensPerSession.toLocaleString(),
279
+ efficiency: summary.avgTokensPerSession > 1000 ? 'High' :
280
+ summary.avgTokensPerSession > 500 ? 'Medium' : 'Low'
281
+ };
282
+ }
283
+
284
+ /**
285
+ * 일일 사용량을 포맷팅합니다
286
+ * @param {Object} dailyUsage - 일일 사용량
287
+ * @returns {Array<Object>} 포맷팅된 일일 사용량
288
+ */
289
+ formatDailyUsage(dailyUsage) {
290
+ return Object.entries(dailyUsage)
291
+ .map(([date, usage]) => ({
292
+ date,
293
+ tokens: usage.tokens.toLocaleString(),
294
+ sessions: usage.sessions,
295
+ commands: usage.commands,
296
+ avgTokensPerSession: usage.sessions > 0 ?
297
+ Math.round(usage.tokens / usage.sessions).toLocaleString() : '0'
298
+ }))
299
+ .sort((a, b) => new Date(b.date) - new Date(a.date));
300
+ }
301
+
302
+ /**
303
+ * 상위 명령어를 포맷팅합니다
304
+ * @param {Array<Object>} topCommands - 상위 명령어 목록
305
+ * @returns {Array<Object>} 포맷팅된 상위 명령어 목록
306
+ */
307
+ formatTopCommands(topCommands) {
308
+ return topCommands.map(cmd => ({
309
+ command: cmd.command,
310
+ count: cmd.count.toLocaleString(),
311
+ totalTokens: cmd.totalTokens.toLocaleString(),
312
+ avgTokens: cmd.avgTokens.toLocaleString(),
313
+ efficiency: cmd.avgTokens > 1000 ? 'High' :
314
+ cmd.avgTokens > 500 ? 'Medium' : 'Low'
315
+ }));
316
+ }
317
+
318
+ /**
319
+ * 압축 통계를 포맷팅합니다
320
+ * @param {Object} compressionStats - 압축 통계
321
+ * @returns {Object} 포맷팅된 압축 통계
322
+ */
323
+ formatCompressionStats(compressionStats) {
324
+ return {
325
+ totalOriginal: compressionStats.totalOriginal.toLocaleString(),
326
+ totalCompressed: compressionStats.totalCompressed.toLocaleString(),
327
+ totalSaved: compressionStats.totalSaved.toLocaleString(),
328
+ avgRatio: compressionStats.avgRatio.toFixed(1) + '%',
329
+ efficiency: compressionStats.avgRatio > 50 ? 'High' :
330
+ compressionStats.avgRatio > 25 ? 'Medium' : 'Low'
331
+ };
332
+ }
333
+
334
+ /**
335
+ * 트렌드를 포맷팅합니다
336
+ * @param {Object} trends - 트렌드 정보
337
+ * @returns {Object} 포맷팅된 트렌드 정보
338
+ */
339
+ formatTrends(trends) {
340
+ const trendEmoji = {
341
+ increasing: '📈',
342
+ decreasing: '📉',
343
+ stable: '➡️',
344
+ insufficient_data: '❓',
345
+ error: '❌'
346
+ };
347
+
348
+ return {
349
+ trend: trends.trend,
350
+ emoji: trendEmoji[trends.trend] || '❓',
351
+ change: trends.change > 0 ? `+${trends.change}%` : `${trends.change}%`,
352
+ recentAvg: trends.recentAvg?.toLocaleString() || '0',
353
+ olderAvg: trends.olderAvg?.toLocaleString() || '0',
354
+ description: this.getTrendDescription(trends.trend, trends.change)
355
+ };
356
+ }
357
+
358
+ /**
359
+ * 트렌드 설명을 생성합니다
360
+ * @param {string} trend - 트렌드
361
+ * @param {number} change - 변화율
362
+ * @returns {string} 트렌드 설명
363
+ */
364
+ getTrendDescription(trend, change) {
365
+ switch (trend) {
366
+ case 'increasing':
367
+ return `토큰 사용량이 ${Math.abs(change)}% 증가하고 있습니다`;
368
+ case 'decreasing':
369
+ return `토큰 사용량이 ${Math.abs(change)}% 감소하고 있습니다`;
370
+ case 'stable':
371
+ return '토큰 사용량이 안정적입니다';
372
+ case 'insufficient_data':
373
+ return '분석할 데이터가 부족합니다';
374
+ default:
375
+ return '트렌드 분석에 오류가 발생했습니다';
376
+ }
377
+ }
378
+
379
+ /**
380
+ * 보고서를 콘솔에 출력합니다
381
+ * @param {Object} report - 보고서 데이터
382
+ */
383
+ printReport(report) {
384
+ try {
385
+ console.log('\n=== 토큰 사용량 보고서 ===');
386
+ console.log(`생성일시: ${new Date(report.generatedAt).toLocaleString()}`);
387
+ console.log(`보고서 타입: ${report.type}`);
388
+ console.log(`기간: ${report.period.start} ~ ${report.period.end}`);
389
+
390
+ if (report.formatted) {
391
+ console.log('\n--- 요약 ---');
392
+ console.log(`총 토큰: ${report.formatted.summary.totalTokens}`);
393
+ console.log(`총 세션: ${report.formatted.summary.totalSessions}`);
394
+ console.log(`세션당 평균 토큰: ${report.formatted.summary.avgTokensPerSession}`);
395
+ console.log(`효율성: ${report.formatted.summary.efficiency}`);
396
+
397
+ console.log('\n--- 트렌드 ---');
398
+ console.log(`${report.formatted.trends.emoji} ${report.formatted.trends.description}`);
399
+ console.log(`변화율: ${report.formatted.trends.change}`);
400
+
401
+ if (report.formatted.topCommands.length > 0) {
402
+ console.log('\n--- 상위 명령어 ---');
403
+ report.formatted.topCommands.slice(0, 5).forEach((cmd, idx) => {
404
+ console.log(`${idx + 1}. ${cmd.command}: ${cmd.totalTokens} 토큰 (${cmd.count}회)`);
405
+ });
406
+ }
407
+
408
+ if (report.formatted.compressionStats.totalOriginal > 0) {
409
+ console.log('\n--- 압축 통계 ---');
410
+ console.log(`원본: ${report.formatted.compressionStats.totalOriginal} 토큰`);
411
+ console.log(`압축: ${report.formatted.compressionStats.totalCompressed} 토큰`);
412
+ console.log(`절약: ${report.formatted.compressionStats.totalSaved} 토큰`);
413
+ console.log(`압축률: ${report.formatted.compressionStats.avgRatio}`);
414
+ }
415
+ }
416
+
417
+ console.log('\n========================\n');
418
+ } catch (error) {
419
+ console.error('보고서 출력 중 오류 발생:', error);
420
+ }
421
+ }
422
+
423
+ /**
424
+ * 보고서를 파일로 저장합니다
425
+ * @param {Object} report - 보고서 데이터
426
+ * @param {string} filename - 파일명
427
+ */
428
+ saveReportToFile(report, filename) {
429
+ try {
430
+ const reportDir = '.aiwf/token-data/reports';
431
+ if (!fs.existsSync(reportDir)) {
432
+ fs.mkdirSync(reportDir, { recursive: true });
433
+ }
434
+
435
+ const filepath = path.join(reportDir, filename);
436
+ fs.writeFileSync(filepath, JSON.stringify(report, null, 2));
437
+ console.log(`보고서가 ${filepath}에 저장되었습니다.`);
438
+ } catch (error) {
439
+ console.error('보고서 저장 중 오류 발생:', error);
440
+ }
441
+ }
442
+
443
+ /**
444
+ * 리소스를 정리합니다
445
+ */
446
+ cleanup() {
447
+ if (this.counter) {
448
+ this.counter.cleanup();
449
+ }
450
+ }
451
+ }
452
+
453
+ export default TokenReporter;