aiwf 0.3.0 → 0.3.2

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 (534) hide show
  1. package/.aiwf/.claude/commands/aiwf/aiwf_compress_aggressive_persona.md +53 -0
  2. package/.aiwf/.claude/commands/aiwf/aiwf_compress_minimal_persona.md +48 -0
  3. package/.aiwf/.claude/commands/aiwf/aiwf_compress_stats.md +79 -0
  4. package/.aiwf/.claude/commands/aiwf/aiwf_compress_with_persona.md +51 -0
  5. package/.aiwf/.claude/commands/aiwf/aiwf_evaluate.md +92 -0
  6. package/.aiwf/00_PROJECT_MANIFEST.md +183 -0
  7. package/.aiwf/01_PROJECT_DOCS/ARCHITECTURE.md +121 -0
  8. package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_ADVANCED_USE_CASES.md +412 -0
  9. package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_API_REFERENCE.md +361 -0
  10. package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_COMMANDS_GUIDE.md +254 -0
  11. package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_FAQ.md +365 -0
  12. package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_SYSTEM_OVERVIEW.md +305 -0
  13. package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_USER_GUIDE.md +416 -0
  14. package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_/354/213/234/354/236/221_/352/260/200/354/235/264/353/223/234.md +247 -0
  15. package/.aiwf/02_REQUIREMENTS/CLAUDE.md +78 -0
  16. package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/M02_milestone_meta.md +34 -0
  17. package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/PRD_Context_Engineering_Enhancement.md +108 -0
  18. package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/SPECS_AI_Persona_System.md +299 -0
  19. package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/SPECS_Feature_Ledger_System.md +330 -0
  20. package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/SPECS_Token_Optimization.md +833 -0
  21. package/.aiwf/03_SPRINTS/CLAUDE.md +83 -0
  22. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/S01_M02_sprint_meta.md +95 -0
  23. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX01_S01_Feature_Ledger_/353/215/260/354/235/264/355/204/260_/352/265/254/354/241/260_/354/204/244/352/263/204.md +111 -0
  24. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX02_S01_Feature_Ledger_CLI_/353/252/205/353/240/271/354/226/264_/352/260/234/353/260/234.md +115 -0
  25. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX03_S01_Git_/354/227/260/353/217/231_Feature_/354/266/224/354/240/201.md +141 -0
  26. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX04_S01_Feature_Ledger_/353/254/270/354/204/234/355/231/224.md +114 -0
  27. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX05_S01_AI_/355/216/230/353/245/264/354/206/214/353/202/230_/353/215/260/354/235/264/355/204/260_/352/265/254/354/241/260_/354/204/244/352/263/204.md +123 -0
  28. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX06_S01_/355/216/230/353/245/264/354/206/214/353/202/230_/352/264/200/353/246/254_/353/252/205/353/240/271/354/226/264_/352/265/254/355/230/204.md +114 -0
  29. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX07_S01_Context_/354/225/225/354/266/225_/354/225/204/355/202/244/355/205/215/354/262/230_/354/204/244/352/263/204.md +114 -0
  30. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX08_S01_/355/206/240/355/201/260_/354/266/224/354/240/201_/354/213/234/354/212/244/355/205/234_/355/224/204/353/241/234/355/206/240/355/203/200/354/236/205.md +112 -0
  31. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX09_S01_/354/225/225/354/266/225_/354/225/214/352/263/240/353/246/254/354/246/230_/355/224/204/353/241/234/355/206/240/355/203/200/354/236/205.md +118 -0
  32. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX10_S01_update_docs_/353/252/205/353/240/271/354/226/264_/353/263/265/352/265/254.md +118 -0
  33. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX11_S01_/355/206/265/355/225/251_/355/205/214/354/212/244/355/212/270_Suite_/352/265/254/354/266/225.md +128 -0
  34. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX12_S01_/354/204/261/353/212/245_/354/265/234/354/240/201/355/231/224_/353/260/217_/353/254/270/354/204/234/355/231/224.md +122 -0
  35. package/.aiwf/03_SPRINTS/S02_M02_ai_enhancement/S02_M02_sprint_meta.md +107 -0
  36. package/.aiwf/03_SPRINTS/S02_M02_ai_enhancement/TX01_S02_AI_/355/216/230/353/245/264/354/206/214/353/202/230_/353/252/205/353/240/271/354/226/264_/352/265/254/355/230/204.md +129 -0
  37. package/.aiwf/03_SPRINTS/S02_M02_ai_enhancement/TX02_S02_/355/216/230/353/245/264/354/206/214/353/202/230_/354/273/250/355/205/215/354/212/244/355/212/270_/354/240/201/354/232/251_/354/213/234/354/212/244/355/205/234.md +152 -0
  38. package/.aiwf/03_SPRINTS/S02_M02_ai_enhancement/TX03_S02_Context_/354/225/225/354/266/225_/354/225/214/352/263/240/353/246/254/354/246/230_/352/265/254/355/230/204.md +186 -0
  39. package/.aiwf/03_SPRINTS/S02_M02_ai_enhancement/TX05_S02_S02_/355/206/265/355/225/251_/355/205/214/354/212/244/355/212/270_/353/260/217_/353/254/270/354/204/234/355/231/224.md +192 -0
  40. package/.aiwf/03_SPRINTS/S02_M02_ai_enhancement/TX4_S02_Feature_Git_/354/227/260/353/217/231_/353/260/217_/354/236/220/353/217/231/355/231/224.md +162 -0
  41. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/S03_FINAL_SPRINT_SUMMARY.md +137 -0
  42. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/S03_M02_sprint_meta.md +106 -0
  43. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/TX14_S03_M02_/353/247/210/354/235/274/354/212/244/355/206/244_/354/265/234/354/242/205_/352/262/200/354/246/235_/353/260/217_/353/254/270/354/204/234/355/231/224.md +214 -0
  44. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/TX15_S03_/352/270/260/353/263/270_/355/224/204/353/241/234/354/240/235/355/212/270_/355/205/234/355/224/214/353/246/277_/352/260/234/353/260/234.md +177 -0
  45. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/TX16_S03_/354/230/244/355/224/204/353/235/274/354/235/270_/355/205/234/355/224/214/353/246/277_/354/272/220/354/213/234_/354/213/234/354/212/244/355/205/234.md +206 -0
  46. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/TX_T13_S03_AI_/353/217/204/352/265/254_/355/206/265/355/225/251_/355/205/234/355/224/214/353/246/277_/352/260/234/353/260/234.md +151 -0
  47. package/.aiwf/04_GENERAL_TASKS/CLAUDE.md +96 -0
  48. package/.aiwf/04_GENERAL_TASKS/TX001_complete_english_translation.md +127 -0
  49. package/.aiwf/05_DOCUMENTATION/performance-report.md +33 -0
  50. package/.aiwf/06_FEATURE_LEDGERS/FEATURE_GIT_INTEGRATION.md +314 -0
  51. package/.aiwf/06_FEATURE_LEDGERS/FEATURE_INTEGRATION_GUIDE.md +227 -0
  52. package/.aiwf/06_FEATURE_LEDGERS/FEATURE_LEDGER_INDEX.md +23 -0
  53. package/.aiwf/06_FEATURE_LEDGERS/FEATURE_SCHEMA.md +205 -0
  54. package/.aiwf/06_FEATURE_LEDGERS/FEATURE_STATE_DIAGRAM.md +190 -0
  55. package/.aiwf/06_FEATURE_LEDGERS/active/FL001_user_authentication_system.md +47 -0
  56. package/.aiwf/06_FEATURE_LEDGERS/active/FL002_user_authentication_system.md +47 -0
  57. package/.aiwf/07_AI_PERSONAS/PERSONA_INDEX.md +57 -0
  58. package/.aiwf/07_AI_PERSONAS/architect/best_practices.md +104 -0
  59. package/.aiwf/07_AI_PERSONAS/architect/context_rules.md +46 -0
  60. package/.aiwf/07_AI_PERSONAS/architect/knowledge_base.md +235 -0
  61. package/.aiwf/07_AI_PERSONAS/backend/best_practices.md +363 -0
  62. package/.aiwf/07_AI_PERSONAS/backend/context_rules.md +61 -0
  63. package/.aiwf/07_AI_PERSONAS/backend/knowledge_base.md +623 -0
  64. package/.aiwf/07_AI_PERSONAS/data_analyst/best_practices.md +32 -0
  65. package/.aiwf/07_AI_PERSONAS/data_analyst/context_rules.md +43 -0
  66. package/.aiwf/07_AI_PERSONAS/data_analyst/knowledge_base.md +36 -0
  67. package/.aiwf/07_AI_PERSONAS/frontend/best_practices.md +31 -0
  68. package/.aiwf/07_AI_PERSONAS/frontend/context_rules.md +43 -0
  69. package/.aiwf/07_AI_PERSONAS/frontend/knowledge_base.md +32 -0
  70. package/.aiwf/07_AI_PERSONAS/security/best_practices.md +63 -0
  71. package/.aiwf/07_AI_PERSONAS/security/context_rules.md +53 -0
  72. package/.aiwf/07_AI_PERSONAS/security/knowledge_base.md +93 -0
  73. package/.aiwf/10_PERSONAS/active.json +1 -0
  74. package/.aiwf/10_PERSONAS/developer.md +37 -0
  75. package/.aiwf/10_STATE_OF_PROJECT/2025-07-09-07-20-solid-progress.md +144 -0
  76. package/.aiwf/98_PROMPTS/SAAS_DEVELOPMENT_GUIDE.md +302 -0
  77. package/.aiwf/98_PROMPTS/github_integration.md +130 -0
  78. package/.aiwf/98_PROMPTS/useful-prompts.md +31 -0
  79. package/.aiwf/98_PROMPTS/vibe-front-prompts.md +89 -0
  80. package/.aiwf/99_TEMPLATES/adr_template.md +49 -0
  81. package/.aiwf/99_TEMPLATES/feature_template.md +263 -0
  82. package/.aiwf/99_TEMPLATES/milestone_meta_template.md +25 -0
  83. package/.aiwf/99_TEMPLATES/project_manifest_template.md +39 -0
  84. package/.aiwf/99_TEMPLATES/sprint_meta_template.md +23 -0
  85. package/.aiwf/99_TEMPLATES/task_template.md +36 -0
  86. package/.aiwf/CLAUDE.md +76 -0
  87. package/.aiwf/ai-tools/README.md +105 -0
  88. package/.aiwf/ai-tools/augment/README.md +371 -0
  89. package/.aiwf/ai-tools/augment/config.json +30 -0
  90. package/.aiwf/ai-tools/augment/template/.augment/aiwf-integration.md +387 -0
  91. package/.aiwf/ai-tools/augment/template/.augment/augment.yaml +347 -0
  92. package/.aiwf/ai-tools/augment/template/augment.config.json +64 -0
  93. package/.aiwf/ai-tools/claude-code/README.md +151 -0
  94. package/.aiwf/ai-tools/claude-code/config.json +28 -0
  95. package/.aiwf/ai-tools/claude-code/template/CLAUDE.md +91 -0
  96. package/.aiwf/ai-tools/cursor/README.md +314 -0
  97. package/.aiwf/ai-tools/cursor/config.json +29 -0
  98. package/.aiwf/ai-tools/cursor/template/.cursorrules +362 -0
  99. package/.aiwf/ai-tools/github-copilot/README.md +195 -0
  100. package/.aiwf/ai-tools/github-copilot/config.json +24 -0
  101. package/.aiwf/ai-tools/github-copilot/template/.github/copilot-instructions.md +202 -0
  102. package/.aiwf/ai-tools/windsurf/README.md +355 -0
  103. package/.aiwf/ai-tools/windsurf/config.json +29 -0
  104. package/.aiwf/ai-tools/windsurf/template/.windsurf/aiwf-rules.md +260 -0
  105. package/.aiwf/ai-tools/windsurf/template/.windsurf/windsurf.config.js +312 -0
  106. package/.aiwf/ai-tools/windsurf/template/windsurf.config.json +63 -0
  107. package/.aiwf/config/language.json +6 -0
  108. package/.aiwf/feature-ledger/FL-001-authentication.json +52 -0
  109. package/.aiwf/feature-ledger/feature-index.json +20 -0
  110. package/.aiwf/personas/analyst.json +44 -0
  111. package/.aiwf/personas/architect/best_practices.md +136 -0
  112. package/.aiwf/personas/architect/knowledge_base.md +377 -0
  113. package/.aiwf/personas/architect.json +44 -0
  114. package/.aiwf/personas/backend/best_practices.md +766 -0
  115. package/.aiwf/personas/backend/knowledge_base.md +1070 -0
  116. package/.aiwf/personas/data_analyst/best_practices.md +594 -0
  117. package/.aiwf/personas/data_analyst/knowledge_base.md +1057 -0
  118. package/.aiwf/personas/developer.json +44 -0
  119. package/.aiwf/personas/evaluation_criteria.json +137 -0
  120. package/.aiwf/personas/frontend/best_practices.md +445 -0
  121. package/.aiwf/personas/frontend/knowledge_base.md +729 -0
  122. package/.aiwf/personas/persona-index.json +31 -0
  123. package/.aiwf/personas/reviewer.json +44 -0
  124. package/.aiwf/personas/security/best_practices.md +307 -0
  125. package/.aiwf/personas/security/knowledge_base.md +498 -0
  126. package/.aiwf/personas/tester.json +44 -0
  127. package/.aiwf/scripts/cache-templates.js +209 -0
  128. package/.aiwf/scripts/create-offline.js +86 -0
  129. package/.aiwf/scripts/create-project.js +151 -0
  130. package/.aiwf/scripts/feature-progress-calculator.cjs +236 -0
  131. package/.aiwf/scripts/git-integration.cjs +391 -0
  132. package/.aiwf/scripts/install-git-hooks.cjs +226 -0
  133. package/.aiwf/scripts/test-commit-parsing.cjs +125 -0
  134. package/.aiwf/scripts/update-feature-status.cjs +198 -0
  135. package/.aiwf/templates/README.md +78 -0
  136. package/.aiwf/templates/api-server/config.json +64 -0
  137. package/.aiwf/templates/api-server/template/.aiwf/config.json +56 -0
  138. package/.aiwf/templates/api-server/template/.aiwf/feature-ledger.json +42 -0
  139. package/.aiwf/templates/api-server/template/.aiwf/personas/backend-engineer.json +40 -0
  140. package/.aiwf/templates/api-server/template/.aiwf/scripts/cli.js +111 -0
  141. package/.aiwf/templates/api-server/template/.env.example +29 -0
  142. package/.aiwf/templates/api-server/template/.eslintrc.json +23 -0
  143. package/.aiwf/templates/api-server/template/README.md +171 -0
  144. package/.aiwf/templates/api-server/template/jest.config.js +26 -0
  145. package/.aiwf/templates/api-server/template/nodemon.json +9 -0
  146. package/.aiwf/templates/api-server/template/package.json +61 -0
  147. package/.aiwf/templates/api-server/template/src/app.ts +60 -0
  148. package/.aiwf/templates/api-server/template/src/config/swagger.ts +38 -0
  149. package/.aiwf/templates/api-server/template/src/controllers/aiwfController.ts +68 -0
  150. package/.aiwf/templates/api-server/template/src/controllers/authController.ts +128 -0
  151. package/.aiwf/templates/api-server/template/src/controllers/statusController.ts +28 -0
  152. package/.aiwf/templates/api-server/template/src/index.ts +28 -0
  153. package/.aiwf/templates/api-server/template/src/middleware/aiwfMiddleware.ts +50 -0
  154. package/.aiwf/templates/api-server/template/src/middleware/authMiddleware.ts +41 -0
  155. package/.aiwf/templates/api-server/template/src/middleware/errorHandler.ts +42 -0
  156. package/.aiwf/templates/api-server/template/src/middleware/notFoundHandler.ts +14 -0
  157. package/.aiwf/templates/api-server/template/src/middleware/requestLogger.ts +20 -0
  158. package/.aiwf/templates/api-server/template/src/routes/aiwf.ts +42 -0
  159. package/.aiwf/templates/api-server/template/src/routes/index.ts +13 -0
  160. package/.aiwf/templates/api-server/template/src/routes/v1/index.ts +67 -0
  161. package/.aiwf/templates/api-server/template/src/utils/logger.ts +37 -0
  162. package/.aiwf/templates/api-server/template/tests/app.test.ts +40 -0
  163. package/.aiwf/templates/api-server/template/tsconfig.json +43 -0
  164. package/.aiwf/templates/npm-library/config.json +61 -0
  165. package/.aiwf/templates/npm-library/template/LICENSE +21 -0
  166. package/.aiwf/templates/npm-library/template/README.md +201 -0
  167. package/.aiwf/templates/npm-library/template/package.json +78 -0
  168. package/.aiwf/templates/web-app/config.json +53 -0
  169. package/.aiwf/templates/web-app/template/.aiwf/config.json +54 -0
  170. package/.aiwf/templates/web-app/template/.aiwf/feature-ledger.json +37 -0
  171. package/.aiwf/templates/web-app/template/.aiwf/personas/fullstack-developer.json +40 -0
  172. package/.aiwf/templates/web-app/template/.aiwf/scripts/cli.js +110 -0
  173. package/.aiwf/templates/web-app/template/.eslintrc.cjs +20 -0
  174. package/.aiwf/templates/web-app/template/README.md +151 -0
  175. package/.aiwf/templates/web-app/template/index.html +14 -0
  176. package/.aiwf/templates/web-app/template/package.json +44 -0
  177. package/.aiwf/templates/web-app/template/postcss.config.js +6 -0
  178. package/.aiwf/templates/web-app/template/public/vite.svg +1 -0
  179. package/.aiwf/templates/web-app/template/src/App.tsx +21 -0
  180. package/.aiwf/templates/web-app/template/src/components/Layout.tsx +57 -0
  181. package/.aiwf/templates/web-app/template/src/components/aiwf/ContextStatus.tsx +107 -0
  182. package/.aiwf/templates/web-app/template/src/components/aiwf/FeatureLedger.tsx +93 -0
  183. package/.aiwf/templates/web-app/template/src/components/aiwf/TokenUsage.tsx +71 -0
  184. package/.aiwf/templates/web-app/template/src/index.css +60 -0
  185. package/.aiwf/templates/web-app/template/src/main.tsx +10 -0
  186. package/.aiwf/templates/web-app/template/src/pages/AiwfDashboard.tsx +60 -0
  187. package/.aiwf/templates/web-app/template/src/pages/HomePage.tsx +89 -0
  188. package/.aiwf/templates/web-app/template/src/pages/NotFound.tsx +25 -0
  189. package/.aiwf/templates/web-app/template/src/stores/aiwfStore.ts +126 -0
  190. package/.aiwf/templates/web-app/template/src/types/global.d.ts +9 -0
  191. package/.aiwf/templates/web-app/template/src/vite-env.d.ts +1 -0
  192. package/.aiwf/templates/web-app/template/tailwind.config.js +30 -0
  193. package/.aiwf/templates/web-app/template/tsconfig.json +37 -0
  194. package/.aiwf/templates/web-app/template/tsconfig.node.json +10 -0
  195. package/.aiwf/templates/web-app/template/vite.config.ts +23 -0
  196. package/.aiwf/test-cache/86c7f9e80251abb8bedd58953ab0d1779e46b4f43ea33b63bffdb778106373b0.json +6 -0
  197. package/.aiwf/test-cache/9e252a90b80fce0585d7ed0646e7a9b4343e109f661f42a3ae678ba1ec5e22c7.json +7 -0
  198. package/.aiwf/test-results-s02.json +36 -0
  199. package/.aiwf/token-data/alerts.json +293 -0
  200. package/.aiwf/token-data/monitor-config.json +12 -0
  201. package/CHANGELOG.md +119 -33
  202. package/CHANGELOG_M02.md +52 -0
  203. package/CLAUDE.md +133 -199
  204. package/README.ko.md +5 -0
  205. package/README.md +31 -5
  206. package/RELEASE_NOTES_M02.md +177 -0
  207. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_create_feature_ledger.md +54 -0
  208. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_default_mode.md +66 -0
  209. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_docs.md +225 -0
  210. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_get_feature_details.md +78 -0
  211. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_link_feature_to_milestone.md +57 -0
  212. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_list_features.md +54 -0
  213. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_architect.md +60 -0
  214. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_backend.md +60 -0
  215. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_data_analyst.md +60 -0
  216. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_frontend.md +60 -0
  217. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_security.md +60 -0
  218. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_status.md +72 -0
  219. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_switch_language.md +160 -0
  220. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_update_feature_status.md +53 -0
  221. package/claude-code/aiwf/en/commands/ai-persona.js +667 -0
  222. package/claude-code/aiwf/en/commands/compress-context.js +355 -0
  223. package/claude-code/aiwf/en/commands/feature-ledger.js +565 -0
  224. package/claude-code/aiwf/en/commands/feature_commit_report.js +370 -0
  225. package/claude-code/aiwf/en/commands/scan_git_history.js +234 -0
  226. package/claude-code/aiwf/en/commands/sync_feature_commits.js +154 -0
  227. package/claude-code/aiwf/en/commands/token-tracking.js +443 -0
  228. package/claude-code/aiwf/en/config/commit-patterns.js +103 -0
  229. package/claude-code/aiwf/en/hooks/install-hooks.sh +100 -0
  230. package/claude-code/aiwf/en/hooks/post-commit +84 -0
  231. package/claude-code/aiwf/en/tests/compression-test-suite.js +1252 -0
  232. package/claude-code/aiwf/en/tests/test-git-integration.js +164 -0
  233. package/claude-code/aiwf/en/tests/token-tracking.test.js +537 -0
  234. package/claude-code/aiwf/en/utils/compression-metrics.js +1031 -0
  235. package/claude-code/aiwf/en/utils/compression-strategies.js +557 -0
  236. package/claude-code/aiwf/en/utils/content-normalizer.js +455 -0
  237. package/claude-code/aiwf/en/utils/context-compressor.js +583 -0
  238. package/claude-code/aiwf/en/utils/feature-updater.js +271 -0
  239. package/claude-code/aiwf/en/utils/git-utils.js +220 -0
  240. package/claude-code/aiwf/en/utils/importance-classifier.js +645 -0
  241. package/claude-code/aiwf/en/utils/information-filter.js +710 -0
  242. package/claude-code/aiwf/en/utils/text-summarizer.js +487 -0
  243. package/claude-code/aiwf/en/utils/token-counter.js +177 -0
  244. package/claude-code/aiwf/en/utils/token-monitor.js +484 -0
  245. package/claude-code/aiwf/en/utils/token-reporter.js +453 -0
  246. package/claude-code/aiwf/en/utils/token-storage.js +433 -0
  247. package/claude-code/aiwf/en/utils/token-tracker.js +283 -0
  248. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/FEATURE_ID_GENERATOR.md +138 -0
  249. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/FEATURE_INDEX.md +186 -0
  250. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/FEATURE_METADATA.md +240 -0
  251. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/FEATURE_WORKFLOW.md +183 -0
  252. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/README.md +94 -0
  253. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/active/FL001_/354/202/254/354/232/251/354/236/220_/354/235/270/354/246/235_/354/213/234/354/212/244/355/205/234.md +154 -0
  254. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/active/FL002_ai_/355/216/230/353/245/264/354/206/214/353/202/230_/354/213/234/354/212/244/355/205/234.md +272 -0
  255. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/completed/FL003_/353/213/244/352/265/255/354/226/264_/353/252/205/353/240/271/354/226/264_/355/221/234/354/244/200/355/231/224.md +266 -0
  256. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/schemas/feature_schema.json +122 -0
  257. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/schemas/feature_validator.cjs +406 -0
  258. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_code_review.md +62 -62
  259. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_commit.md +111 -111
  260. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_aggressive_persona.md +53 -0
  261. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_context.md +116 -0
  262. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_minimal_persona.md +48 -0
  263. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_stats.md +79 -0
  264. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_with_persona.md +51 -0
  265. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_create_feature_ledger.md +54 -0
  266. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_create_general_task.md +106 -106
  267. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_create_milestone_plan.md +127 -127
  268. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_create_sprint_tasks.md +130 -130
  269. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_create_sprints_from_milestone.md +87 -87
  270. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_default_mode.md +44 -0
  271. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_do_task.md +72 -72
  272. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_docs.md +225 -0
  273. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_evaluate.md +92 -0
  274. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_get_feature_details.md +78 -0
  275. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_initialize.md +86 -86
  276. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_issue_create.md +3 -3
  277. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_link_feature_to_milestone.md +57 -0
  278. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_list_features.md +54 -0
  279. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_architect.md +48 -0
  280. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_backend.md +37 -0
  281. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_data_analyst.md +37 -0
  282. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_frontend.md +37 -0
  283. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_security.md +48 -0
  284. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_status.md +50 -0
  285. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_pr_create.md +14 -14
  286. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_prime.md +5 -5
  287. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_project_review.md +39 -39
  288. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_switch_language.md +160 -0
  289. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_test.md +76 -77
  290. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_testing_review.md +120 -120
  291. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_ultrathink_general.md +209 -266
  292. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_update_docs_kr.md +25 -0
  293. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_update_feature_status.md +53 -0
  294. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_yolo.md +226 -226
  295. package/claude-code/aiwf/ko/CLAUDE.md +76 -0
  296. package/claude-code/aiwf/ko/ai-tools/README.md +105 -0
  297. package/claude-code/aiwf/ko/ai-tools/augment/README.md +371 -0
  298. package/claude-code/aiwf/ko/ai-tools/augment/config.json +30 -0
  299. package/claude-code/aiwf/ko/ai-tools/augment/template/.augment/aiwf-integration.md +387 -0
  300. package/claude-code/aiwf/ko/ai-tools/augment/template/.augment/augment.yaml +347 -0
  301. package/claude-code/aiwf/ko/ai-tools/augment/template/augment.config.json +64 -0
  302. package/claude-code/aiwf/ko/ai-tools/claude-code/README.md +151 -0
  303. package/claude-code/aiwf/ko/ai-tools/claude-code/config.json +28 -0
  304. package/claude-code/aiwf/ko/ai-tools/claude-code/template/CLAUDE.md +91 -0
  305. package/claude-code/aiwf/ko/ai-tools/cursor/README.md +314 -0
  306. package/claude-code/aiwf/ko/ai-tools/cursor/config.json +29 -0
  307. package/claude-code/aiwf/ko/ai-tools/cursor/template/.cursorrules +362 -0
  308. package/claude-code/aiwf/ko/ai-tools/github-copilot/README.md +195 -0
  309. package/claude-code/aiwf/ko/ai-tools/github-copilot/config.json +24 -0
  310. package/claude-code/aiwf/ko/ai-tools/github-copilot/template/.github/copilot-instructions.md +202 -0
  311. package/claude-code/aiwf/ko/ai-tools/windsurf/README.md +355 -0
  312. package/claude-code/aiwf/ko/ai-tools/windsurf/config.json +29 -0
  313. package/claude-code/aiwf/ko/ai-tools/windsurf/template/.windsurf/aiwf-rules.md +260 -0
  314. package/claude-code/aiwf/ko/ai-tools/windsurf/template/.windsurf/windsurf.config.js +312 -0
  315. package/claude-code/aiwf/ko/ai-tools/windsurf/template/windsurf.config.json +63 -0
  316. package/claude-code/aiwf/ko/bin/aiwf-create.js +56 -0
  317. package/claude-code/aiwf/ko/bin/aiwf.js +21 -0
  318. package/claude-code/aiwf/ko/commands/ai-persona.js +602 -0
  319. package/claude-code/aiwf/ko/commands/compress-context.js +389 -0
  320. package/claude-code/aiwf/ko/commands/evaluate.js +246 -0
  321. package/claude-code/aiwf/ko/commands/feature-ledger.js +565 -0
  322. package/claude-code/aiwf/ko/commands/feature_commit_report.js +370 -0
  323. package/claude-code/aiwf/ko/commands/persona-context-apply.js +562 -0
  324. package/claude-code/aiwf/ko/commands/scan_git_history.js +234 -0
  325. package/claude-code/aiwf/ko/commands/sync_feature_commits.js +154 -0
  326. package/claude-code/aiwf/ko/commands/token-tracking.js +443 -0
  327. package/claude-code/aiwf/ko/config/commit-patterns.js +103 -0
  328. package/claude-code/aiwf/ko/config/language.json +6 -0
  329. package/claude-code/aiwf/ko/docs/00_PROJECT_MANIFEST.md +183 -0
  330. package/claude-code/aiwf/ko/docs/ARCHITECTURE.md +121 -0
  331. package/claude-code/aiwf/ko/docs/FEATURE_LEDGER_ADVANCED_USE_CASES.md +412 -0
  332. package/claude-code/aiwf/ko/docs/FEATURE_LEDGER_API_REFERENCE.md +361 -0
  333. package/claude-code/aiwf/ko/docs/FEATURE_LEDGER_COMMANDS_GUIDE.md +254 -0
  334. package/claude-code/aiwf/ko/docs/FEATURE_LEDGER_FAQ.md +365 -0
  335. package/claude-code/aiwf/ko/docs/FEATURE_LEDGER_SYSTEM_OVERVIEW.md +305 -0
  336. package/claude-code/aiwf/ko/docs/FEATURE_LEDGER_USER_GUIDE.md +416 -0
  337. package/claude-code/aiwf/ko/docs/FEATURE_LEDGER_/354/213/234/354/236/221_/352/260/200/354/235/264/353/223/234.md +247 -0
  338. package/claude-code/aiwf/ko/feature-ledger/FL-001-authentication.json +52 -0
  339. package/claude-code/aiwf/ko/feature-ledger/feature-index.json +20 -0
  340. package/claude-code/aiwf/ko/hooks/install-hooks.sh +100 -0
  341. package/claude-code/aiwf/ko/hooks/post-commit +84 -0
  342. package/claude-code/aiwf/ko/personas/PERSONA_INDEX.md +57 -0
  343. package/claude-code/aiwf/ko/personas/analyst.json +44 -0
  344. package/claude-code/aiwf/ko/personas/architect/best_practices.md +136 -0
  345. package/claude-code/aiwf/ko/personas/architect/knowledge_base.md +377 -0
  346. package/claude-code/aiwf/ko/personas/architect.json +44 -0
  347. package/claude-code/aiwf/ko/personas/backend/best_practices.md +766 -0
  348. package/claude-code/aiwf/ko/personas/backend/knowledge_base.md +1070 -0
  349. package/claude-code/aiwf/ko/personas/data_analyst/best_practices.md +594 -0
  350. package/claude-code/aiwf/ko/personas/data_analyst/knowledge_base.md +1057 -0
  351. package/claude-code/aiwf/ko/personas/developer.json +44 -0
  352. package/claude-code/aiwf/ko/personas/developer.md +37 -0
  353. package/claude-code/aiwf/ko/personas/evaluation_criteria.json +137 -0
  354. package/claude-code/aiwf/ko/personas/frontend/best_practices.md +445 -0
  355. package/claude-code/aiwf/ko/personas/frontend/knowledge_base.md +729 -0
  356. package/claude-code/aiwf/ko/personas/persona-index.json +31 -0
  357. package/claude-code/aiwf/ko/personas/reviewer.json +44 -0
  358. package/claude-code/aiwf/ko/personas/security/best_practices.md +307 -0
  359. package/claude-code/aiwf/ko/personas/security/knowledge_base.md +498 -0
  360. package/claude-code/aiwf/ko/personas/tester.json +44 -0
  361. package/claude-code/aiwf/ko/scripts/cache-templates.js +209 -0
  362. package/claude-code/aiwf/ko/scripts/create-offline.js +86 -0
  363. package/claude-code/aiwf/ko/scripts/create-project.js +151 -0
  364. package/claude-code/aiwf/ko/scripts/feature-progress-calculator.cjs +236 -0
  365. package/claude-code/aiwf/ko/scripts/git-integration.cjs +391 -0
  366. package/claude-code/aiwf/ko/scripts/install-git-hooks.cjs +226 -0
  367. package/claude-code/aiwf/ko/scripts/test-commit-parsing.cjs +125 -0
  368. package/claude-code/aiwf/ko/scripts/update-feature-status.cjs +198 -0
  369. package/claude-code/aiwf/ko/templates/README.md +78 -0
  370. package/claude-code/aiwf/ko/templates/api-server/config.json +64 -0
  371. package/claude-code/aiwf/ko/templates/api-server/template/.aiwf/config.json +56 -0
  372. package/claude-code/aiwf/ko/templates/api-server/template/.aiwf/feature-ledger.json +42 -0
  373. package/claude-code/aiwf/ko/templates/api-server/template/.aiwf/personas/backend-engineer.json +40 -0
  374. package/claude-code/aiwf/ko/templates/api-server/template/.aiwf/scripts/cli.js +111 -0
  375. package/claude-code/aiwf/ko/templates/api-server/template/.env.example +29 -0
  376. package/claude-code/aiwf/ko/templates/api-server/template/.eslintrc.json +23 -0
  377. package/claude-code/aiwf/ko/templates/api-server/template/README.md +171 -0
  378. package/claude-code/aiwf/ko/templates/api-server/template/jest.config.js +26 -0
  379. package/claude-code/aiwf/ko/templates/api-server/template/nodemon.json +9 -0
  380. package/claude-code/aiwf/ko/templates/api-server/template/package.json +61 -0
  381. package/claude-code/aiwf/ko/templates/api-server/template/src/app.ts +60 -0
  382. package/claude-code/aiwf/ko/templates/api-server/template/src/config/swagger.ts +38 -0
  383. package/claude-code/aiwf/ko/templates/api-server/template/src/controllers/aiwfController.ts +68 -0
  384. package/claude-code/aiwf/ko/templates/api-server/template/src/controllers/authController.ts +128 -0
  385. package/claude-code/aiwf/ko/templates/api-server/template/src/controllers/statusController.ts +28 -0
  386. package/claude-code/aiwf/ko/templates/api-server/template/src/index.ts +28 -0
  387. package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/aiwfMiddleware.ts +50 -0
  388. package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/authMiddleware.ts +41 -0
  389. package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/errorHandler.ts +42 -0
  390. package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/notFoundHandler.ts +14 -0
  391. package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/requestLogger.ts +20 -0
  392. package/claude-code/aiwf/ko/templates/api-server/template/src/routes/aiwf.ts +42 -0
  393. package/claude-code/aiwf/ko/templates/api-server/template/src/routes/index.ts +13 -0
  394. package/claude-code/aiwf/ko/templates/api-server/template/src/routes/v1/index.ts +67 -0
  395. package/claude-code/aiwf/ko/templates/api-server/template/src/utils/logger.ts +37 -0
  396. package/claude-code/aiwf/ko/templates/api-server/template/tests/app.test.ts +40 -0
  397. package/claude-code/aiwf/ko/templates/api-server/template/tsconfig.json +43 -0
  398. package/claude-code/aiwf/ko/templates/npm-library/config.json +61 -0
  399. package/claude-code/aiwf/ko/templates/npm-library/template/LICENSE +21 -0
  400. package/claude-code/aiwf/ko/templates/npm-library/template/README.md +201 -0
  401. package/claude-code/aiwf/ko/templates/npm-library/template/package.json +78 -0
  402. package/claude-code/aiwf/ko/templates/web-app/config.json +53 -0
  403. package/claude-code/aiwf/ko/templates/web-app/template/.aiwf/config.json +54 -0
  404. package/claude-code/aiwf/ko/templates/web-app/template/.aiwf/feature-ledger.json +37 -0
  405. package/claude-code/aiwf/ko/templates/web-app/template/.aiwf/personas/fullstack-developer.json +40 -0
  406. package/claude-code/aiwf/ko/templates/web-app/template/.aiwf/scripts/cli.js +110 -0
  407. package/claude-code/aiwf/ko/templates/web-app/template/.eslintrc.cjs +20 -0
  408. package/claude-code/aiwf/ko/templates/web-app/template/README.md +151 -0
  409. package/claude-code/aiwf/ko/templates/web-app/template/index.html +14 -0
  410. package/claude-code/aiwf/ko/templates/web-app/template/package.json +44 -0
  411. package/claude-code/aiwf/ko/templates/web-app/template/postcss.config.js +6 -0
  412. package/claude-code/aiwf/ko/templates/web-app/template/public/vite.svg +1 -0
  413. package/claude-code/aiwf/ko/templates/web-app/template/src/App.tsx +21 -0
  414. package/claude-code/aiwf/ko/templates/web-app/template/src/components/Layout.tsx +57 -0
  415. package/claude-code/aiwf/ko/templates/web-app/template/src/components/aiwf/ContextStatus.tsx +107 -0
  416. package/claude-code/aiwf/ko/templates/web-app/template/src/components/aiwf/FeatureLedger.tsx +93 -0
  417. package/claude-code/aiwf/ko/templates/web-app/template/src/components/aiwf/TokenUsage.tsx +71 -0
  418. package/claude-code/aiwf/ko/templates/web-app/template/src/index.css +60 -0
  419. package/claude-code/aiwf/ko/templates/web-app/template/src/main.tsx +10 -0
  420. package/claude-code/aiwf/ko/templates/web-app/template/src/pages/AiwfDashboard.tsx +60 -0
  421. package/claude-code/aiwf/ko/templates/web-app/template/src/pages/HomePage.tsx +89 -0
  422. package/claude-code/aiwf/ko/templates/web-app/template/src/pages/NotFound.tsx +25 -0
  423. package/claude-code/aiwf/ko/templates/web-app/template/src/stores/aiwfStore.ts +126 -0
  424. package/claude-code/aiwf/ko/templates/web-app/template/src/types/global.d.ts +9 -0
  425. package/claude-code/aiwf/ko/templates/web-app/template/src/vite-env.d.ts +1 -0
  426. package/claude-code/aiwf/ko/templates/web-app/template/tailwind.config.js +30 -0
  427. package/claude-code/aiwf/ko/templates/web-app/template/tsconfig.json +37 -0
  428. package/claude-code/aiwf/ko/templates/web-app/template/tsconfig.node.json +10 -0
  429. package/claude-code/aiwf/ko/templates/web-app/template/vite.config.ts +23 -0
  430. package/claude-code/aiwf/ko/tests/compression-test-suite.js +1252 -0
  431. package/claude-code/aiwf/ko/tests/test-git-integration.js +164 -0
  432. package/claude-code/aiwf/ko/tests/token-tracking.test.js +537 -0
  433. package/claude-code/aiwf/ko/token-data/alerts.json +293 -0
  434. package/claude-code/aiwf/ko/token-data/monitor-config.json +12 -0
  435. package/claude-code/aiwf/ko/utils/background-monitor.js +223 -0
  436. package/claude-code/aiwf/ko/utils/compression-metrics.js +1031 -0
  437. package/claude-code/aiwf/ko/utils/compression-strategies.js +557 -0
  438. package/claude-code/aiwf/ko/utils/content-normalizer.js +455 -0
  439. package/claude-code/aiwf/ko/utils/context-compressor.js +583 -0
  440. package/claude-code/aiwf/ko/utils/context-rule-parser.js +180 -0
  441. package/claude-code/aiwf/ko/utils/context-token-monitor.js +463 -0
  442. package/claude-code/aiwf/ko/utils/context-update-manager.js +502 -0
  443. package/claude-code/aiwf/ko/utils/feature-updater.js +271 -0
  444. package/claude-code/aiwf/ko/utils/git-utils.js +220 -0
  445. package/claude-code/aiwf/ko/utils/importance-classifier.js +645 -0
  446. package/claude-code/aiwf/ko/utils/information-filter.js +710 -0
  447. package/claude-code/aiwf/ko/utils/persona-aware-compressor.js +598 -0
  448. package/claude-code/aiwf/ko/utils/prompt-injector.js +242 -0
  449. package/claude-code/aiwf/ko/utils/simplified-evaluator.js +119 -0
  450. package/claude-code/aiwf/ko/utils/text-summarizer.js +492 -0
  451. package/claude-code/aiwf/ko/utils/token-counter.js +177 -0
  452. package/claude-code/aiwf/ko/utils/token-monitor.js +484 -0
  453. package/claude-code/aiwf/ko/utils/token-reporter.js +453 -0
  454. package/claude-code/aiwf/ko/utils/token-storage.js +433 -0
  455. package/claude-code/aiwf/ko/utils/token-tracker.js +283 -0
  456. package/docs/AI-WORKFLOW.ko.md +9 -2
  457. package/docs/AI-WORKFLOW.md +9 -2
  458. package/docs/AI_PERSONA_SYSTEM_DESIGN.md +516 -0
  459. package/docs/API_DOCUMENTATION.md +932 -0
  460. package/docs/API_REFERENCE.md +979 -0
  461. package/docs/COMMANDS_GUIDE.ko.md +101 -5
  462. package/docs/COMMANDS_GUIDE.md +289 -5
  463. package/docs/CONTRIBUTING.ko.md +408 -0
  464. package/docs/CONTRIBUTING.md +205 -203
  465. package/docs/EXAMPLES.md +691 -0
  466. package/docs/Enhanced_Installation_Flow_Design.md +498 -0
  467. package/docs/GETTING_STARTED.md +480 -0
  468. package/docs/PERFORMANCE_ARCHITECTURE.md +494 -0
  469. package/docs/PERFORMANCE_GUIDELINES.md +553 -0
  470. package/docs/PRD.ko.md +110 -58
  471. package/docs/PRD.md +110 -58
  472. package/docs/TROUBLESHOOTING.md +721 -0
  473. package/docs/git-feature-integration-guide.md +253 -0
  474. package/docs/guides/ai-personas-guide-ko.md +239 -0
  475. package/docs/guides/ai-personas-guide.md +239 -0
  476. package/docs/guides/context-compression-guide-ko.md +313 -0
  477. package/docs/guides/context-compression-guide.md +313 -0
  478. package/docs/guides/feature-git-integration-guide-ko.md +481 -0
  479. package/docs/guides/feature-git-integration-guide.md +481 -0
  480. package/docs/lightweight-evaluation.md +198 -0
  481. package/docs/m02-dod-checklist.md +125 -0
  482. package/docs/m02-gap-analysis.md +214 -0
  483. package/docs/m02-milestone-completion-report.md +186 -0
  484. package/docs/m02-milestone-executive-summary.md +68 -0
  485. package/docs/offline-template-cache.md +323 -0
  486. package/docs/performance-benchmark-report.md +159 -0
  487. package/docs/persona-aware-compression.md +168 -0
  488. package/docs/reports/S02-sprint-report.md +190 -0
  489. package/docs/usability-test-report.md +170 -0
  490. package/index.js +1349 -21
  491. package/jest.config.js +23 -0
  492. package/language-cli.js +279 -0
  493. package/language-utils.js +330 -0
  494. package/lib/ai-persona-manager.js +711 -0
  495. package/lib/cache-cli.js +459 -0
  496. package/lib/cache-integration.js +401 -0
  497. package/lib/cache-system.js +332 -0
  498. package/lib/context-engine.js +568 -0
  499. package/lib/file-batch-processor.js +401 -0
  500. package/lib/memory-profiler.js +471 -0
  501. package/lib/metrics-collector.js +885 -0
  502. package/lib/offline-detector.js +386 -0
  503. package/lib/performance-benchmark.js +621 -0
  504. package/lib/task-analyzer.js +599 -0
  505. package/lib/template-cache-system.js +559 -0
  506. package/lib/template-downloader.js +467 -0
  507. package/lib/template-manager.js +310 -0
  508. package/lib/template-version-manager.js +491 -0
  509. package/lib/token-optimizer.js +517 -0
  510. package/package.json +17 -6
  511. package/scripts/run-integration-tests.js +317 -0
  512. package/scripts/validate-commands.cjs +338 -0
  513. package/scripts/validate-commands.js +254 -0
  514. package/src/commands/ai-tool.js +383 -0
  515. package/test-token-system.js +88 -0
  516. package/tests/application.test.js +260 -0
  517. package/tests/basic.test.js +62 -0
  518. package/tests/commands.test.js +127 -0
  519. package/tests/installer.test.js +129 -0
  520. package/tests/integration/ai-persona-system.test.js +396 -0
  521. package/tests/integration/ai-persona.test.js +390 -0
  522. package/tests/integration/command-integration.test.js +600 -0
  523. package/tests/integration/context-compression.test.js +361 -0
  524. package/tests/integration/feature-ledger.test.js +226 -0
  525. package/tests/integration/git-integration.test.js +307 -0
  526. package/tests/integration/m02-milestone.test.js +420 -0
  527. package/tests/integration/persona-context-application.test.js +508 -0
  528. package/tests/integration/setup.js +174 -0
  529. package/tests/integration/test-persona-aware-compression.js +93 -0
  530. package/tests/language-utils.test.js +287 -0
  531. package/tests/s02-integration.test.js +422 -0
  532. package/tests/unit/ai-persona-manager.test.js +514 -0
  533. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_prime_context.md +0 -5
  534. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_prime_context.md +0 -8
@@ -0,0 +1,492 @@
1
+ import { TokenCounter } from './token-counter.js';
2
+
3
+ /**
4
+ * 텍스트 요약 알고리즘 프로토타입
5
+ */
6
+ export class TextSummarizer {
7
+ constructor() {
8
+ this.tokenCounter = new TokenCounter();
9
+ }
10
+
11
+ /**
12
+ * 텍스트를 요약합니다
13
+ * @param {string} text - 요약할 텍스트
14
+ * @param {Object} options - 요약 옵션
15
+ * @returns {Object} 요약 결과
16
+ */
17
+ summarize(text, options = {}) {
18
+ const {
19
+ targetRatio = 0.3, // 목표 압축률 (30%)
20
+ strategy = 'extractive', // 'extractive' 또는 'abstractive'
21
+ preserveStructure = true, // 구조 유지 여부
22
+ minSentenceLength = 20, // 최소 문장 길이
23
+ maxSentenceLength = 200 // 최대 문장 길이
24
+ } = options;
25
+
26
+ const summary = strategy === 'extractive'
27
+ ? this.extractiveSummarization(text, targetRatio, options)
28
+ : this.abstractiveSummarization(text, targetRatio, options);
29
+
30
+ return {
31
+ original: text,
32
+ summary: summary.content,
33
+ originalTokens: this.tokenCounter.countTokens(text),
34
+ summaryTokens: this.tokenCounter.countTokens(summary.content),
35
+ compressionRatio: summary.compressionRatio,
36
+ keyPoints: summary.keyPoints,
37
+ metadata: summary.metadata
38
+ };
39
+ }
40
+
41
+ /**
42
+ * 추출적 요약 (중요한 문장들을 선택)
43
+ * @param {string} text - 요약할 텍스트
44
+ * @param {number} targetRatio - 목표 압축률
45
+ * @param {Object} options - 옵션
46
+ * @returns {Object} 요약 결과
47
+ */
48
+ extractiveSummarization(text, targetRatio, options) {
49
+ // 1. 텍스트를 문장으로 분할
50
+ const sentences = this.splitIntoSentences(text);
51
+
52
+ // 2. 각 문장의 중요도 계산
53
+ const scoredSentences = this.scoreSentences(sentences);
54
+
55
+ // 3. 중요도에 따라 정렬
56
+ const sortedSentences = scoredSentences.sort((a, b) => b.score - a.score);
57
+
58
+ // 4. 목표 비율에 맞춰 상위 문장 선택
59
+ const targetSentenceCount = Math.ceil(sentences.length * targetRatio);
60
+ const selectedSentences = sortedSentences.slice(0, targetSentenceCount);
61
+
62
+ // 5. 원본 순서대로 재배열
63
+ const finalSentences = selectedSentences.sort((a, b) => a.index - b.index);
64
+
65
+ // 6. 요약 텍스트 생성
66
+ const summaryText = finalSentences.map(s => s.text).join(' ');
67
+
68
+ return {
69
+ content: summaryText,
70
+ compressionRatio: this.calculateCompressionRatio(text, summaryText),
71
+ keyPoints: this.extractKeyPoints(finalSentences),
72
+ metadata: {
73
+ strategy: 'extractive',
74
+ originalSentences: sentences.length,
75
+ selectedSentences: finalSentences.length,
76
+ avgSentenceScore: finalSentences.reduce((sum, s) => sum + s.score, 0) / finalSentences.length
77
+ }
78
+ };
79
+ }
80
+
81
+ /**
82
+ * 추상적 요약 (내용을 재구성)
83
+ * @param {string} text - 요약할 텍스트
84
+ * @param {number} targetRatio - 목표 압축률
85
+ * @param {Object} options - 옵션
86
+ * @returns {Object} 요약 결과
87
+ */
88
+ abstractiveSummarization(text, targetRatio, options) {
89
+ // 1. 주요 개념 추출
90
+ const concepts = this.extractConcepts(text);
91
+
92
+ // 2. 핵심 정보 식별
93
+ const keyInfo = this.identifyKeyInformation(text);
94
+
95
+ // 3. 구조 분석
96
+ const structure = this.analyzeStructure(text);
97
+
98
+ // 4. 요약 생성
99
+ const summaryText = this.generateAbstractSummary(concepts, keyInfo, structure, targetRatio);
100
+
101
+ return {
102
+ content: summaryText,
103
+ compressionRatio: this.calculateCompressionRatio(text, summaryText),
104
+ keyPoints: concepts.slice(0, 5), // 상위 5개 개념
105
+ metadata: {
106
+ strategy: 'abstractive',
107
+ conceptCount: concepts.length,
108
+ keyInfoCount: keyInfo.length,
109
+ structureElements: structure.length
110
+ }
111
+ };
112
+ }
113
+
114
+ /**
115
+ * 텍스트를 문장으로 분할합니다
116
+ * @param {string} text - 분할할 텍스트
117
+ * @returns {Array<string>} 문장 배열
118
+ */
119
+ splitIntoSentences(text) {
120
+ // 마크다운 구조 유지하면서 문장 분할
121
+ const sentences = [];
122
+ const lines = text.split('\n');
123
+
124
+ for (const line of lines) {
125
+ if (line.trim() === '') continue;
126
+
127
+ // 헤더, 목록 항목은 그대로 유지
128
+ if (line.match(/^#{1,6}\s+/) || line.match(/^\s*[-*+]\s+/) || line.match(/^\s*\d+\.\s+/)) {
129
+ sentences.push(line.trim());
130
+ } else {
131
+ // 일반 텍스트는 문장으로 분할
132
+ const lineSentences = line.split(/[.!?]+/).filter(s => s.trim().length > 0);
133
+ sentences.push(...lineSentences.map(s => s.trim() + '.'));
134
+ }
135
+ }
136
+
137
+ return sentences.filter(s => s.length > 10); // 너무 짧은 문장 제거
138
+ }
139
+
140
+ /**
141
+ * 문장들의 중요도를 계산합니다
142
+ * @param {Array<string>} sentences - 문장 배열
143
+ * @returns {Array<Object>} 점수가 매겨진 문장 배열
144
+ */
145
+ scoreSentences(sentences) {
146
+ const scoredSentences = [];
147
+
148
+ // 키워드 빈도 계산
149
+ const wordFreq = this.calculateWordFrequency(sentences.join(' '));
150
+
151
+ // 중요 키워드 정의
152
+ const importantKeywords = [
153
+ 'goal', 'objective', 'requirement', 'critical', 'important', 'key', 'main',
154
+ 'primary', 'essential', 'must', 'should', 'need', 'implement', 'develop',
155
+ 'create', 'build', 'design', 'task', 'subtask', 'acceptance', 'criteria',
156
+ '목표', '목적', '요구사항', '중요', '핵심', '주요', '필수', '구현', '개발',
157
+ '생성', '구축', '설계', '태스크', '하위', '승인', '기준'
158
+ ];
159
+
160
+ sentences.forEach((sentence, index) => {
161
+ let score = 0;
162
+
163
+ // 1. 문장 길이 점수 (너무 짧거나 긴 문장 페널티)
164
+ const length = sentence.length;
165
+ if (length >= 30 && length <= 150) {
166
+ score += 1;
167
+ } else if (length < 30) {
168
+ score -= 0.5;
169
+ }
170
+
171
+ // 2. 중요 키워드 점수
172
+ const lowerSentence = sentence.toLowerCase();
173
+ importantKeywords.forEach(keyword => {
174
+ if (lowerSentence.includes(keyword.toLowerCase())) {
175
+ score += 2;
176
+ }
177
+ });
178
+
179
+ // 3. 단어 빈도 점수
180
+ const words = sentence.toLowerCase().split(/\s+/);
181
+ words.forEach(word => {
182
+ if (wordFreq[word] && wordFreq[word] > 1) {
183
+ score += Math.log(wordFreq[word]);
184
+ }
185
+ });
186
+
187
+ // 4. 위치 점수 (시작과 끝 부분 문장에 높은 점수)
188
+ if (index < sentences.length * 0.3) {
189
+ score += 1; // 시작 부분
190
+ }
191
+ if (index > sentences.length * 0.7) {
192
+ score += 0.5; // 끝 부분
193
+ }
194
+
195
+ // 5. 구조적 중요도 (헤더, 목록 항목)
196
+ if (sentence.match(/^#{1,6}\s+/) || sentence.match(/^\s*[-*+]\s+/)) {
197
+ score += 3;
198
+ }
199
+
200
+ // 6. 숫자 포함 점수 (통계, 메트릭 등)
201
+ if (sentence.match(/\d+/)) {
202
+ score += 0.5;
203
+ }
204
+
205
+ scoredSentences.push({
206
+ text: sentence,
207
+ score,
208
+ index,
209
+ length
210
+ });
211
+ });
212
+
213
+ return scoredSentences;
214
+ }
215
+
216
+ /**
217
+ * 단어 빈도를 계산합니다
218
+ * @param {string} text - 분석할 텍스트
219
+ * @returns {Object} 단어 빈도 객체
220
+ */
221
+ calculateWordFrequency(text) {
222
+ const words = text.toLowerCase().split(/\s+/);
223
+ const frequency = {};
224
+
225
+ // 불용어 제거
226
+ const stopWords = new Set([
227
+ 'the', 'a', 'an', 'and', 'or', 'but', 'in', 'on', 'at', 'to', 'for', 'of',
228
+ 'with', 'by', 'from', 'up', 'about', 'into', 'through', 'during', 'before',
229
+ 'after', 'above', 'below', 'between', 'among', 'is', 'are', 'was', 'were',
230
+ 'be', 'been', 'being', 'have', 'has', 'had', 'do', 'does', 'did', 'will',
231
+ 'would', 'should', 'could', 'can', 'may', 'might', 'must', 'this', 'that',
232
+ 'these', 'those', 'i', 'you', 'he', 'she', 'it', 'we', 'they', 'me', 'him',
233
+ 'her', 'us', 'them', 'my', 'your', 'his', 'its', 'our', 'their',
234
+ '이', '그', '저', '이것', '그것', '저것', '이거', '그거', '저거', '여기',
235
+ '거기', '저기', '이곳', '그곳', '저곳', '는', '은', '을', '를', '이',
236
+ '가', '와', '과', '에', '에서', '으로', '로', '의', '도', '만', '부터',
237
+ '까지', '처럼', '같이', '보다', '한테', '에게', '께', '한', '하나',
238
+ '두', '세', '네', '다섯', '여섯', '일곱', '여덟', '아홉', '열'
239
+ ]);
240
+
241
+ words.forEach(word => {
242
+ const cleanWord = word.replace(/[^\w가-힣]/g, '');
243
+ if (cleanWord.length > 2 && !stopWords.has(cleanWord)) {
244
+ frequency[cleanWord] = (frequency[cleanWord] || 0) + 1;
245
+ }
246
+ });
247
+
248
+ return frequency;
249
+ }
250
+
251
+ /**
252
+ * 핵심 포인트를 추출합니다
253
+ * @param {Array<Object>} sentences - 선택된 문장들
254
+ * @returns {Array<string>} 핵심 포인트 배열
255
+ */
256
+ extractKeyPoints(sentences) {
257
+ const keyPoints = [];
258
+
259
+ sentences.forEach(sentence => {
260
+ const text = sentence.text;
261
+
262
+ // 목표, 요구사항, 기준 등 핵심 정보 추출
263
+ if (text.includes('goal') || text.includes('objective') || text.includes('목표')) {
264
+ keyPoints.push(`목표: ${text.replace(/^[#\s*-]+/, '').trim()}`);
265
+ } else if (text.includes('requirement') || text.includes('요구사항')) {
266
+ keyPoints.push(`요구사항: ${text.replace(/^[#\s*-]+/, '').trim()}`);
267
+ } else if (text.includes('criteria') || text.includes('기준')) {
268
+ keyPoints.push(`기준: ${text.replace(/^[#\s*-]+/, '').trim()}`);
269
+ } else if (text.includes('task') || text.includes('태스크')) {
270
+ keyPoints.push(`태스크: ${text.replace(/^[#\s*-]+/, '').trim()}`);
271
+ }
272
+ });
273
+
274
+ return keyPoints.slice(0, 5); // 상위 5개만 반환
275
+ }
276
+
277
+ /**
278
+ * 주요 개념을 추출합니다
279
+ * @param {string} text - 분석할 텍스트
280
+ * @returns {Array<Object>} 개념 배열
281
+ */
282
+ extractConcepts(text) {
283
+ const concepts = [];
284
+ const lines = text.split('\n');
285
+
286
+ for (const line of lines) {
287
+ // 헤더에서 개념 추출
288
+ const headerMatch = line.match(/^#{1,6}\s+(.+)$/);
289
+ if (headerMatch) {
290
+ concepts.push({
291
+ text: headerMatch[1],
292
+ type: 'header',
293
+ importance: 6 - line.indexOf('#')
294
+ });
295
+ }
296
+
297
+ // 목록 항목에서 개념 추출
298
+ const listMatch = line.match(/^\s*[-*+]\s+(.+)$/);
299
+ if (listMatch) {
300
+ concepts.push({
301
+ text: listMatch[1],
302
+ type: 'list_item',
303
+ importance: 2
304
+ });
305
+ }
306
+ }
307
+
308
+ return concepts.sort((a, b) => b.importance - a.importance);
309
+ }
310
+
311
+ /**
312
+ * 핵심 정보를 식별합니다
313
+ * @param {string} text - 분석할 텍스트
314
+ * @returns {Array<Object>} 핵심 정보 배열
315
+ */
316
+ identifyKeyInformation(text) {
317
+ const keyInfo = [];
318
+ const sentences = this.splitIntoSentences(text);
319
+
320
+ const keyPatterns = [
321
+ /goal|objective|목표|목적/i,
322
+ /requirement|요구사항|조건/i,
323
+ /criteria|기준|조건/i,
324
+ /task|태스크|작업/i,
325
+ /deadline|마감일|기한/i,
326
+ /important|중요|핵심/i,
327
+ /critical|중대|치명적/i,
328
+ /must|필수|반드시/i
329
+ ];
330
+
331
+ sentences.forEach(sentence => {
332
+ keyPatterns.forEach(pattern => {
333
+ if (pattern.test(sentence)) {
334
+ keyInfo.push({
335
+ text: sentence,
336
+ pattern: pattern.source,
337
+ importance: this.calculateImportanceScore(sentence)
338
+ });
339
+ }
340
+ });
341
+ });
342
+
343
+ return keyInfo.sort((a, b) => b.importance - a.importance);
344
+ }
345
+
346
+ /**
347
+ * 구조를 분석합니다
348
+ * @param {string} text - 분석할 텍스트
349
+ * @returns {Array<Object>} 구조 요소 배열
350
+ */
351
+ analyzeStructure(text) {
352
+ const structure = [];
353
+ const lines = text.split('\n');
354
+
355
+ for (let i = 0; i < lines.length; i++) {
356
+ const line = lines[i];
357
+
358
+ // 헤더 구조
359
+ const headerMatch = line.match(/^(#{1,6})\s+(.+)$/);
360
+ if (headerMatch) {
361
+ structure.push({
362
+ type: 'header',
363
+ level: headerMatch[1].length,
364
+ text: headerMatch[2],
365
+ line: i
366
+ });
367
+ }
368
+
369
+ // 목록 구조
370
+ const listMatch = line.match(/^\s*([-*+]|\d+\.)\s+(.+)$/);
371
+ if (listMatch) {
372
+ structure.push({
373
+ type: 'list',
374
+ marker: listMatch[1],
375
+ text: listMatch[2],
376
+ line: i
377
+ });
378
+ }
379
+
380
+ // 코드 블록
381
+ if (line.match(/^```/)) {
382
+ structure.push({
383
+ type: 'code_block',
384
+ line: i
385
+ });
386
+ }
387
+ }
388
+
389
+ return structure;
390
+ }
391
+
392
+ /**
393
+ * 추상적 요약을 생성합니다
394
+ * @param {Array<Object>} concepts - 개념 배열
395
+ * @param {Array<Object>} keyInfo - 핵심 정보 배열
396
+ * @param {Array<Object>} structure - 구조 배열
397
+ * @param {number} targetRatio - 목표 비율
398
+ * @returns {string} 요약 텍스트
399
+ */
400
+ generateAbstractSummary(concepts, keyInfo, structure, targetRatio) {
401
+ const summary = [];
402
+
403
+ // 1. 주요 개념 요약
404
+ const topConcepts = concepts.slice(0, Math.ceil(concepts.length * targetRatio));
405
+ summary.push('## 주요 개념');
406
+ topConcepts.forEach(concept => {
407
+ summary.push(`- ${concept.text}`);
408
+ });
409
+
410
+ // 2. 핵심 정보 요약
411
+ const topKeyInfo = keyInfo.slice(0, Math.ceil(keyInfo.length * targetRatio));
412
+ if (topKeyInfo.length > 0) {
413
+ summary.push('\n## 핵심 정보');
414
+ topKeyInfo.forEach(info => {
415
+ summary.push(`- ${info.text}`);
416
+ });
417
+ }
418
+
419
+ // 3. 구조적 요약
420
+ const headers = structure.filter(s => s.type === 'header' && s.level <= 3);
421
+ if (headers.length > 0) {
422
+ summary.push('\n## 구조');
423
+ headers.forEach(header => {
424
+ summary.push(`${'#'.repeat(header.level + 1)} ${header.text}`);
425
+ });
426
+ }
427
+
428
+ return summary.join('\n');
429
+ }
430
+
431
+ /**
432
+ * 중요도 점수를 계산합니다
433
+ * @param {string} text - 분석할 텍스트
434
+ * @returns {number} 중요도 점수
435
+ */
436
+ calculateImportanceScore(text) {
437
+ let score = 0;
438
+ const lowerText = text.toLowerCase();
439
+
440
+ // 키워드 기반 점수
441
+ const keywordWeights = {
442
+ 'critical': 5, 'important': 4, 'key': 3, 'main': 3, 'primary': 3,
443
+ 'essential': 4, 'must': 4, 'should': 3, 'need': 2, 'goal': 4,
444
+ 'objective': 4, 'requirement': 4, 'criteria': 3, 'task': 2,
445
+ '중요': 4, '핵심': 4, '주요': 3, '필수': 4, '목표': 4, '목적': 4,
446
+ '요구사항': 4, '기준': 3, '태스크': 2, '반드시': 4
447
+ };
448
+
449
+ Object.entries(keywordWeights).forEach(([keyword, weight]) => {
450
+ if (lowerText.includes(keyword)) {
451
+ score += weight;
452
+ }
453
+ });
454
+
455
+ // 길이 기반 점수
456
+ if (text.length > 50 && text.length < 200) {
457
+ score += 1;
458
+ }
459
+
460
+ // 구두점 기반 점수
461
+ if (text.includes('!') || text.includes('?')) {
462
+ score += 1;
463
+ }
464
+
465
+ return score;
466
+ }
467
+
468
+ /**
469
+ * 압축률을 계산합니다
470
+ * @param {string} original - 원본 텍스트
471
+ * @param {string} compressed - 압축된 텍스트
472
+ * @returns {number} 압축률 (백분율)
473
+ */
474
+ calculateCompressionRatio(original, compressed) {
475
+ const originalTokens = this.tokenCounter.countTokens(original);
476
+ const compressedTokens = this.tokenCounter.countTokens(compressed);
477
+
478
+ if (originalTokens === 0) return 0;
479
+ return ((originalTokens - compressedTokens) / originalTokens) * 100;
480
+ }
481
+
482
+ /**
483
+ * 리소스를 정리합니다
484
+ */
485
+ cleanup() {
486
+ if (this.tokenCounter) {
487
+ this.tokenCounter.cleanup();
488
+ }
489
+ }
490
+ }
491
+
492
+ export default TextSummarizer;
@@ -0,0 +1,177 @@
1
+ import tiktoken from 'tiktoken';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+
5
+ /**
6
+ * 토큰 카운팅 및 분석을 위한 유틸리티 클래스
7
+ */
8
+ export class TokenCounter {
9
+ constructor(model = 'gpt-4') {
10
+ this.model = model;
11
+ this.encoder = tiktoken.get_encoding('cl100k_base'); // GPT-4 기본 인코딩
12
+ }
13
+
14
+ /**
15
+ * 텍스트의 토큰 수를 계산합니다
16
+ * @param {string} text - 분석할 텍스트
17
+ * @returns {number} 토큰 수
18
+ */
19
+ countTokens(text) {
20
+ if (!text || typeof text !== 'string') {
21
+ return 0;
22
+ }
23
+
24
+ try {
25
+ return this.encoder.encode(text).length;
26
+ } catch (error) {
27
+ console.error('토큰 카운팅 중 오류 발생:', error);
28
+ return 0;
29
+ }
30
+ }
31
+
32
+ /**
33
+ * 파일의 토큰 수를 계산합니다
34
+ * @param {string} filePath - 파일 경로
35
+ * @returns {number} 토큰 수
36
+ */
37
+ countFileTokens(filePath) {
38
+ try {
39
+ if (!fs.existsSync(filePath)) {
40
+ return 0;
41
+ }
42
+
43
+ const content = fs.readFileSync(filePath, 'utf8');
44
+ return this.countTokens(content);
45
+ } catch (error) {
46
+ console.error(`파일 토큰 카운팅 중 오류 발생 (${filePath}):`, error);
47
+ return 0;
48
+ }
49
+ }
50
+
51
+ /**
52
+ * 디렉토리의 모든 마크다운 파일 토큰 수를 계산합니다
53
+ * @param {string} dirPath - 디렉토리 경로
54
+ * @returns {number} 총 토큰 수
55
+ */
56
+ countDirectoryTokens(dirPath) {
57
+ try {
58
+ const files = this.getMarkdownFiles(dirPath);
59
+ return files.reduce((total, file) => {
60
+ return total + this.countFileTokens(file);
61
+ }, 0);
62
+ } catch (error) {
63
+ console.error(`디렉토리 토큰 카운팅 중 오류 발생 (${dirPath}):`, error);
64
+ return 0;
65
+ }
66
+ }
67
+
68
+ /**
69
+ * 디렉토리에서 마크다운 파일 목록을 가져옵니다
70
+ * @param {string} dirPath - 디렉토리 경로
71
+ * @returns {Array<string>} 마크다운 파일 경로 배열
72
+ */
73
+ getMarkdownFiles(dirPath) {
74
+ const files = [];
75
+
76
+ try {
77
+ if (!fs.existsSync(dirPath)) {
78
+ return files;
79
+ }
80
+
81
+ const entries = fs.readdirSync(dirPath, { withFileTypes: true });
82
+
83
+ for (const entry of entries) {
84
+ const fullPath = path.join(dirPath, entry.name);
85
+
86
+ if (entry.isDirectory()) {
87
+ files.push(...this.getMarkdownFiles(fullPath));
88
+ } else if (entry.isFile() && entry.name.endsWith('.md')) {
89
+ files.push(fullPath);
90
+ }
91
+ }
92
+ } catch (error) {
93
+ console.error(`마크다운 파일 탐색 중 오류 발생 (${dirPath}):`, error);
94
+ }
95
+
96
+ return files;
97
+ }
98
+
99
+ /**
100
+ * 콘텐츠의 토큰 분포를 분석합니다
101
+ * @param {string} content - 분석할 콘텐츠
102
+ * @returns {Array<Object>} 섹션별 토큰 분포 정보
103
+ */
104
+ analyzeTokenDistribution(content) {
105
+ try {
106
+ const sections = this.parseSections(content);
107
+ const totalTokens = this.countTokens(content);
108
+
109
+ return sections.map(section => ({
110
+ name: section.name,
111
+ tokens: this.countTokens(section.content),
112
+ percentage: totalTokens > 0 ? ((this.countTokens(section.content) / totalTokens) * 100).toFixed(1) : 0,
113
+ content: section.content
114
+ }));
115
+ } catch (error) {
116
+ console.error('토큰 분포 분석 중 오류 발생:', error);
117
+ return [];
118
+ }
119
+ }
120
+
121
+ /**
122
+ * 마크다운 콘텐츠를 섹션별로 파싱합니다
123
+ * @param {string} content - 마크다운 콘텐츠
124
+ * @returns {Array<Object>} 섹션 정보 배열
125
+ */
126
+ parseSections(content) {
127
+ const sections = [];
128
+ const lines = content.split('\n');
129
+ let currentSection = null;
130
+ let currentContent = [];
131
+
132
+ for (const line of lines) {
133
+ // 헤더 라인 감지 (# ## ### 등)
134
+ const headerMatch = line.match(/^(#{1,6})\s+(.+)$/);
135
+
136
+ if (headerMatch) {
137
+ // 이전 섹션 저장
138
+ if (currentSection) {
139
+ sections.push({
140
+ name: currentSection,
141
+ content: currentContent.join('\n').trim()
142
+ });
143
+ }
144
+
145
+ // 새 섹션 시작
146
+ currentSection = headerMatch[2];
147
+ currentContent = [line];
148
+ } else {
149
+ // 현재 섹션에 라인 추가
150
+ if (currentSection) {
151
+ currentContent.push(line);
152
+ }
153
+ }
154
+ }
155
+
156
+ // 마지막 섹션 저장
157
+ if (currentSection) {
158
+ sections.push({
159
+ name: currentSection,
160
+ content: currentContent.join('\n').trim()
161
+ });
162
+ }
163
+
164
+ return sections;
165
+ }
166
+
167
+ /**
168
+ * 토큰 카운터 리소스를 정리합니다
169
+ */
170
+ cleanup() {
171
+ if (this.encoder) {
172
+ this.encoder.free();
173
+ }
174
+ }
175
+ }
176
+
177
+ export default TokenCounter;