aiwf 0.3.1 → 0.3.3

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 (493) hide show
  1. package/.aiwf/00_PROJECT_MANIFEST.md +183 -0
  2. package/.aiwf/01_PROJECT_DOCS/ARCHITECTURE.md +121 -0
  3. package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_ADVANCED_USE_CASES.md +412 -0
  4. package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_API_REFERENCE.md +361 -0
  5. package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_COMMANDS_GUIDE.md +254 -0
  6. package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_FAQ.md +365 -0
  7. package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_SYSTEM_OVERVIEW.md +305 -0
  8. package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_USER_GUIDE.md +416 -0
  9. 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
  10. package/.aiwf/02_REQUIREMENTS/CLAUDE.md +78 -0
  11. package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/M02_milestone_meta.md +34 -0
  12. package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/PRD_Context_Engineering_Enhancement.md +108 -0
  13. package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/SPECS_AI_Persona_System.md +299 -0
  14. package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/SPECS_Feature_Ledger_System.md +330 -0
  15. package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/SPECS_Token_Optimization.md +833 -0
  16. package/.aiwf/03_SPRINTS/CLAUDE.md +83 -0
  17. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/S01_M02_sprint_meta.md +95 -0
  18. 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
  19. 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
  20. 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
  21. package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX04_S01_Feature_Ledger_/353/254/270/354/204/234/355/231/224.md +114 -0
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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
  29. 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
  30. package/.aiwf/03_SPRINTS/S02_M02_ai_enhancement/S02_M02_sprint_meta.md +107 -0
  31. 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
  32. 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
  33. 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
  34. 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
  35. 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
  36. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/S03_FINAL_SPRINT_SUMMARY.md +137 -0
  37. package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/S03_M02_sprint_meta.md +106 -0
  38. 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
  39. 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
  40. 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
  41. 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
  42. package/.aiwf/04_GENERAL_TASKS/CLAUDE.md +96 -0
  43. package/.aiwf/04_GENERAL_TASKS/TX001_complete_english_translation.md +127 -0
  44. package/.aiwf/05_DOCUMENTATION/performance-report.md +33 -0
  45. package/.aiwf/06_FEATURE_LEDGERS/FEATURE_GIT_INTEGRATION.md +314 -0
  46. package/.aiwf/06_FEATURE_LEDGERS/FEATURE_INTEGRATION_GUIDE.md +227 -0
  47. package/.aiwf/06_FEATURE_LEDGERS/FEATURE_LEDGER_INDEX.md +23 -0
  48. package/.aiwf/06_FEATURE_LEDGERS/FEATURE_SCHEMA.md +205 -0
  49. package/.aiwf/06_FEATURE_LEDGERS/FEATURE_STATE_DIAGRAM.md +190 -0
  50. package/.aiwf/06_FEATURE_LEDGERS/active/FL001_user_authentication_system.md +47 -0
  51. package/.aiwf/06_FEATURE_LEDGERS/active/FL002_user_authentication_system.md +47 -0
  52. package/.aiwf/07_AI_PERSONAS/PERSONA_INDEX.md +57 -0
  53. package/.aiwf/07_AI_PERSONAS/architect/best_practices.md +104 -0
  54. package/.aiwf/07_AI_PERSONAS/architect/context_rules.md +46 -0
  55. package/.aiwf/07_AI_PERSONAS/architect/knowledge_base.md +235 -0
  56. package/.aiwf/07_AI_PERSONAS/backend/best_practices.md +363 -0
  57. package/.aiwf/07_AI_PERSONAS/backend/context_rules.md +61 -0
  58. package/.aiwf/07_AI_PERSONAS/backend/knowledge_base.md +623 -0
  59. package/.aiwf/07_AI_PERSONAS/data_analyst/best_practices.md +32 -0
  60. package/.aiwf/07_AI_PERSONAS/data_analyst/context_rules.md +43 -0
  61. package/.aiwf/07_AI_PERSONAS/data_analyst/knowledge_base.md +36 -0
  62. package/.aiwf/07_AI_PERSONAS/frontend/best_practices.md +31 -0
  63. package/.aiwf/07_AI_PERSONAS/frontend/context_rules.md +43 -0
  64. package/.aiwf/07_AI_PERSONAS/frontend/knowledge_base.md +32 -0
  65. package/.aiwf/07_AI_PERSONAS/security/best_practices.md +63 -0
  66. package/.aiwf/07_AI_PERSONAS/security/context_rules.md +53 -0
  67. package/.aiwf/07_AI_PERSONAS/security/knowledge_base.md +93 -0
  68. package/.aiwf/10_PERSONAS/active.json +1 -0
  69. package/.aiwf/10_PERSONAS/developer.md +37 -0
  70. package/.aiwf/10_STATE_OF_PROJECT/2025-07-09-07-20-solid-progress.md +144 -0
  71. package/.aiwf/98_PROMPTS/SAAS_DEVELOPMENT_GUIDE.md +302 -0
  72. package/.aiwf/98_PROMPTS/github_integration.md +130 -0
  73. package/.aiwf/98_PROMPTS/useful-prompts.md +31 -0
  74. package/.aiwf/98_PROMPTS/vibe-front-prompts.md +89 -0
  75. package/.aiwf/99_TEMPLATES/adr_template.md +49 -0
  76. package/.aiwf/99_TEMPLATES/feature_template.md +263 -0
  77. package/.aiwf/99_TEMPLATES/milestone_meta_template.md +25 -0
  78. package/.aiwf/99_TEMPLATES/project_manifest_template.md +39 -0
  79. package/.aiwf/99_TEMPLATES/sprint_meta_template.md +23 -0
  80. package/.aiwf/99_TEMPLATES/task_template.md +36 -0
  81. package/.aiwf/CLAUDE.md +76 -0
  82. package/.aiwf/ai-tools/README.md +105 -0
  83. package/.aiwf/ai-tools/augment/README.md +371 -0
  84. package/.aiwf/ai-tools/augment/config.json +30 -0
  85. package/.aiwf/ai-tools/augment/template/.augment/aiwf-integration.md +387 -0
  86. package/.aiwf/ai-tools/augment/template/.augment/augment.yaml +347 -0
  87. package/.aiwf/ai-tools/augment/template/augment.config.json +64 -0
  88. package/.aiwf/ai-tools/claude-code/README.md +151 -0
  89. package/.aiwf/ai-tools/claude-code/config.json +28 -0
  90. package/.aiwf/ai-tools/claude-code/template/CLAUDE.md +91 -0
  91. package/.aiwf/ai-tools/cursor/README.md +314 -0
  92. package/.aiwf/ai-tools/cursor/config.json +29 -0
  93. package/.aiwf/ai-tools/cursor/template/.cursorrules +362 -0
  94. package/.aiwf/ai-tools/github-copilot/README.md +195 -0
  95. package/.aiwf/ai-tools/github-copilot/config.json +24 -0
  96. package/.aiwf/ai-tools/github-copilot/template/.github/copilot-instructions.md +202 -0
  97. package/.aiwf/ai-tools/windsurf/README.md +355 -0
  98. package/.aiwf/ai-tools/windsurf/config.json +29 -0
  99. package/.aiwf/ai-tools/windsurf/template/.windsurf/aiwf-rules.md +260 -0
  100. package/.aiwf/ai-tools/windsurf/template/.windsurf/windsurf.config.js +312 -0
  101. package/.aiwf/ai-tools/windsurf/template/windsurf.config.json +63 -0
  102. package/.aiwf/config/language.json +6 -0
  103. package/.aiwf/feature-ledger/FL-001-authentication.json +52 -0
  104. package/.aiwf/feature-ledger/feature-index.json +20 -0
  105. package/.aiwf/installed.flag +1 -0
  106. package/.aiwf/personas/analyst.json +44 -0
  107. package/.aiwf/personas/architect/best_practices.md +136 -0
  108. package/.aiwf/personas/architect/knowledge_base.md +377 -0
  109. package/.aiwf/personas/architect.json +44 -0
  110. package/.aiwf/personas/backend/best_practices.md +766 -0
  111. package/.aiwf/personas/backend/knowledge_base.md +1070 -0
  112. package/.aiwf/personas/data_analyst/best_practices.md +594 -0
  113. package/.aiwf/personas/data_analyst/knowledge_base.md +1057 -0
  114. package/.aiwf/personas/developer.json +44 -0
  115. package/.aiwf/personas/evaluation_criteria.json +137 -0
  116. package/.aiwf/personas/frontend/best_practices.md +445 -0
  117. package/.aiwf/personas/frontend/knowledge_base.md +729 -0
  118. package/.aiwf/personas/persona-index.json +31 -0
  119. package/.aiwf/personas/reviewer.json +44 -0
  120. package/.aiwf/personas/security/best_practices.md +307 -0
  121. package/.aiwf/personas/security/knowledge_base.md +498 -0
  122. package/.aiwf/personas/tester.json +44 -0
  123. package/.aiwf/scripts/cache-templates.js +209 -0
  124. package/.aiwf/scripts/create-offline.js +86 -0
  125. package/.aiwf/scripts/create-project.js +151 -0
  126. package/.aiwf/scripts/feature-progress-calculator.cjs +236 -0
  127. package/.aiwf/scripts/git-integration.cjs +391 -0
  128. package/.aiwf/scripts/install-git-hooks.cjs +226 -0
  129. package/.aiwf/scripts/test-commit-parsing.cjs +125 -0
  130. package/.aiwf/scripts/update-feature-status.cjs +198 -0
  131. package/.aiwf/templates/README.md +78 -0
  132. package/.aiwf/templates/api-server/config.json +64 -0
  133. package/.aiwf/templates/api-server/template/.aiwf/config.json +56 -0
  134. package/.aiwf/templates/api-server/template/.aiwf/feature-ledger.json +42 -0
  135. package/.aiwf/templates/api-server/template/.aiwf/personas/backend-engineer.json +40 -0
  136. package/.aiwf/templates/api-server/template/.aiwf/scripts/cli.js +111 -0
  137. package/.aiwf/templates/api-server/template/.env.example +29 -0
  138. package/.aiwf/templates/api-server/template/.eslintrc.json +23 -0
  139. package/.aiwf/templates/api-server/template/README.md +171 -0
  140. package/.aiwf/templates/api-server/template/jest.config.js +26 -0
  141. package/.aiwf/templates/api-server/template/nodemon.json +9 -0
  142. package/.aiwf/templates/api-server/template/package.json +61 -0
  143. package/.aiwf/templates/api-server/template/src/app.ts +60 -0
  144. package/.aiwf/templates/api-server/template/src/config/swagger.ts +38 -0
  145. package/.aiwf/templates/api-server/template/src/controllers/aiwfController.ts +68 -0
  146. package/.aiwf/templates/api-server/template/src/controllers/authController.ts +128 -0
  147. package/.aiwf/templates/api-server/template/src/controllers/statusController.ts +28 -0
  148. package/.aiwf/templates/api-server/template/src/index.ts +28 -0
  149. package/.aiwf/templates/api-server/template/src/middleware/aiwfMiddleware.ts +50 -0
  150. package/.aiwf/templates/api-server/template/src/middleware/authMiddleware.ts +41 -0
  151. package/.aiwf/templates/api-server/template/src/middleware/errorHandler.ts +42 -0
  152. package/.aiwf/templates/api-server/template/src/middleware/notFoundHandler.ts +14 -0
  153. package/.aiwf/templates/api-server/template/src/middleware/requestLogger.ts +20 -0
  154. package/.aiwf/templates/api-server/template/src/routes/aiwf.ts +42 -0
  155. package/.aiwf/templates/api-server/template/src/routes/index.ts +13 -0
  156. package/.aiwf/templates/api-server/template/src/routes/v1/index.ts +67 -0
  157. package/.aiwf/templates/api-server/template/src/utils/logger.ts +37 -0
  158. package/.aiwf/templates/api-server/template/tests/app.test.ts +40 -0
  159. package/.aiwf/templates/api-server/template/tsconfig.json +43 -0
  160. package/.aiwf/templates/npm-library/config.json +61 -0
  161. package/.aiwf/templates/npm-library/template/LICENSE +21 -0
  162. package/.aiwf/templates/npm-library/template/README.md +201 -0
  163. package/.aiwf/templates/npm-library/template/package.json +78 -0
  164. package/.aiwf/templates/web-app/config.json +53 -0
  165. package/.aiwf/templates/web-app/template/.aiwf/config.json +54 -0
  166. package/.aiwf/templates/web-app/template/.aiwf/feature-ledger.json +37 -0
  167. package/.aiwf/templates/web-app/template/.aiwf/personas/fullstack-developer.json +40 -0
  168. package/.aiwf/templates/web-app/template/.aiwf/scripts/cli.js +110 -0
  169. package/.aiwf/templates/web-app/template/.eslintrc.cjs +20 -0
  170. package/.aiwf/templates/web-app/template/README.md +151 -0
  171. package/.aiwf/templates/web-app/template/index.html +14 -0
  172. package/.aiwf/templates/web-app/template/package.json +44 -0
  173. package/.aiwf/templates/web-app/template/postcss.config.js +6 -0
  174. package/.aiwf/templates/web-app/template/public/vite.svg +1 -0
  175. package/.aiwf/templates/web-app/template/src/App.tsx +21 -0
  176. package/.aiwf/templates/web-app/template/src/components/Layout.tsx +57 -0
  177. package/.aiwf/templates/web-app/template/src/components/aiwf/ContextStatus.tsx +107 -0
  178. package/.aiwf/templates/web-app/template/src/components/aiwf/FeatureLedger.tsx +93 -0
  179. package/.aiwf/templates/web-app/template/src/components/aiwf/TokenUsage.tsx +71 -0
  180. package/.aiwf/templates/web-app/template/src/index.css +60 -0
  181. package/.aiwf/templates/web-app/template/src/main.tsx +10 -0
  182. package/.aiwf/templates/web-app/template/src/pages/AiwfDashboard.tsx +60 -0
  183. package/.aiwf/templates/web-app/template/src/pages/HomePage.tsx +89 -0
  184. package/.aiwf/templates/web-app/template/src/pages/NotFound.tsx +25 -0
  185. package/.aiwf/templates/web-app/template/src/stores/aiwfStore.ts +126 -0
  186. package/.aiwf/templates/web-app/template/src/types/global.d.ts +9 -0
  187. package/.aiwf/templates/web-app/template/src/vite-env.d.ts +1 -0
  188. package/.aiwf/templates/web-app/template/tailwind.config.js +30 -0
  189. package/.aiwf/templates/web-app/template/tsconfig.json +37 -0
  190. package/.aiwf/templates/web-app/template/tsconfig.node.json +10 -0
  191. package/.aiwf/templates/web-app/template/vite.config.ts +23 -0
  192. package/.aiwf/test-cache/86c7f9e80251abb8bedd58953ab0d1779e46b4f43ea33b63bffdb778106373b0.json +6 -0
  193. package/.aiwf/test-cache/9e252a90b80fce0585d7ed0646e7a9b4343e109f661f42a3ae678ba1ec5e22c7.json +7 -0
  194. package/.aiwf/test-results-s02.json +36 -0
  195. package/.aiwf/token-data/alerts.json +293 -0
  196. package/.aiwf/token-data/monitor-config.json +12 -0
  197. package/CHANGELOG.md +95 -11
  198. package/CHANGELOG_M02.md +52 -0
  199. package/CLAUDE.md +135 -0
  200. package/README.ko.md +5 -0
  201. package/README.md +6 -0
  202. package/RELEASE_NOTES_M02.md +177 -0
  203. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_create_feature_ledger.md +54 -0
  204. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_default_mode.md +66 -0
  205. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_get_feature_details.md +78 -0
  206. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_link_feature_to_milestone.md +57 -0
  207. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_list_features.md +54 -0
  208. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_architect.md +60 -0
  209. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_backend.md +60 -0
  210. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_data_analyst.md +60 -0
  211. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_frontend.md +60 -0
  212. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_security.md +60 -0
  213. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_status.md +72 -0
  214. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_update_feature_status.md +53 -0
  215. package/claude-code/aiwf/en/commands/ai-persona.js +667 -0
  216. package/claude-code/aiwf/en/commands/compress-context.js +355 -0
  217. package/claude-code/aiwf/en/commands/feature-ledger.js +565 -0
  218. package/claude-code/aiwf/en/commands/feature_commit_report.js +370 -0
  219. package/claude-code/aiwf/en/commands/scan_git_history.js +234 -0
  220. package/claude-code/aiwf/en/commands/sync_feature_commits.js +154 -0
  221. package/claude-code/aiwf/en/commands/token-tracking.js +443 -0
  222. package/claude-code/aiwf/en/config/commit-patterns.js +103 -0
  223. package/claude-code/aiwf/en/hooks/install-hooks.sh +100 -0
  224. package/claude-code/aiwf/en/hooks/post-commit +84 -0
  225. package/claude-code/aiwf/en/tests/compression-test-suite.js +1252 -0
  226. package/claude-code/aiwf/en/tests/test-git-integration.js +164 -0
  227. package/claude-code/aiwf/en/tests/token-tracking.test.js +537 -0
  228. package/claude-code/aiwf/en/utils/compression-metrics.js +1031 -0
  229. package/claude-code/aiwf/en/utils/compression-strategies.js +557 -0
  230. package/claude-code/aiwf/en/utils/content-normalizer.js +455 -0
  231. package/claude-code/aiwf/en/utils/context-compressor.js +583 -0
  232. package/claude-code/aiwf/en/utils/feature-updater.js +271 -0
  233. package/claude-code/aiwf/en/utils/git-utils.js +220 -0
  234. package/claude-code/aiwf/en/utils/importance-classifier.js +645 -0
  235. package/claude-code/aiwf/en/utils/information-filter.js +710 -0
  236. package/claude-code/aiwf/en/utils/text-summarizer.js +487 -0
  237. package/claude-code/aiwf/en/utils/token-counter.js +177 -0
  238. package/claude-code/aiwf/en/utils/token-monitor.js +484 -0
  239. package/claude-code/aiwf/en/utils/token-reporter.js +453 -0
  240. package/claude-code/aiwf/en/utils/token-storage.js +433 -0
  241. package/claude-code/aiwf/en/utils/token-tracker.js +283 -0
  242. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/FEATURE_ID_GENERATOR.md +138 -0
  243. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/FEATURE_INDEX.md +186 -0
  244. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/FEATURE_METADATA.md +240 -0
  245. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/FEATURE_WORKFLOW.md +183 -0
  246. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/README.md +94 -0
  247. 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
  248. 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
  249. 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
  250. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/schemas/feature_schema.json +122 -0
  251. package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/schemas/feature_validator.cjs +406 -0
  252. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_aggressive_persona.md +53 -0
  253. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_context.md +116 -0
  254. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_minimal_persona.md +48 -0
  255. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_stats.md +79 -0
  256. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_with_persona.md +51 -0
  257. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_create_feature_ledger.md +54 -0
  258. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_default_mode.md +44 -0
  259. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_evaluate.md +92 -0
  260. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_get_feature_details.md +78 -0
  261. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_link_feature_to_milestone.md +57 -0
  262. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_list_features.md +54 -0
  263. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_architect.md +48 -0
  264. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_backend.md +37 -0
  265. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_data_analyst.md +37 -0
  266. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_frontend.md +37 -0
  267. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_security.md +48 -0
  268. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_status.md +50 -0
  269. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_update_docs_kr.md +25 -0
  270. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_update_feature_status.md +53 -0
  271. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_yolo.md +2 -2
  272. package/claude-code/aiwf/ko/CLAUDE.md +76 -0
  273. package/claude-code/aiwf/ko/ai-tools/README.md +105 -0
  274. package/claude-code/aiwf/ko/ai-tools/augment/README.md +371 -0
  275. package/claude-code/aiwf/ko/ai-tools/augment/config.json +30 -0
  276. package/claude-code/aiwf/ko/ai-tools/augment/template/.augment/aiwf-integration.md +387 -0
  277. package/claude-code/aiwf/ko/ai-tools/augment/template/.augment/augment.yaml +347 -0
  278. package/claude-code/aiwf/ko/ai-tools/augment/template/augment.config.json +64 -0
  279. package/claude-code/aiwf/ko/ai-tools/claude-code/README.md +151 -0
  280. package/claude-code/aiwf/ko/ai-tools/claude-code/config.json +28 -0
  281. package/claude-code/aiwf/ko/ai-tools/claude-code/template/CLAUDE.md +91 -0
  282. package/claude-code/aiwf/ko/ai-tools/cursor/README.md +314 -0
  283. package/claude-code/aiwf/ko/ai-tools/cursor/config.json +29 -0
  284. package/claude-code/aiwf/ko/ai-tools/cursor/template/.cursorrules +362 -0
  285. package/claude-code/aiwf/ko/ai-tools/github-copilot/README.md +195 -0
  286. package/claude-code/aiwf/ko/ai-tools/github-copilot/config.json +24 -0
  287. package/claude-code/aiwf/ko/ai-tools/github-copilot/template/.github/copilot-instructions.md +202 -0
  288. package/claude-code/aiwf/ko/ai-tools/windsurf/README.md +355 -0
  289. package/claude-code/aiwf/ko/ai-tools/windsurf/config.json +29 -0
  290. package/claude-code/aiwf/ko/ai-tools/windsurf/template/.windsurf/aiwf-rules.md +260 -0
  291. package/claude-code/aiwf/ko/ai-tools/windsurf/template/.windsurf/windsurf.config.js +312 -0
  292. package/claude-code/aiwf/ko/ai-tools/windsurf/template/windsurf.config.json +63 -0
  293. package/claude-code/aiwf/ko/commands/ai-persona.js +602 -0
  294. package/claude-code/aiwf/ko/commands/compress-context.js +389 -0
  295. package/claude-code/aiwf/ko/commands/evaluate.js +246 -0
  296. package/claude-code/aiwf/ko/commands/feature-ledger.js +565 -0
  297. package/claude-code/aiwf/ko/commands/feature_commit_report.js +370 -0
  298. package/claude-code/aiwf/ko/commands/persona-context-apply.js +562 -0
  299. package/claude-code/aiwf/ko/commands/scan_git_history.js +234 -0
  300. package/claude-code/aiwf/ko/commands/sync_feature_commits.js +154 -0
  301. package/claude-code/aiwf/ko/commands/token-tracking.js +443 -0
  302. package/claude-code/aiwf/ko/config/commit-patterns.js +103 -0
  303. package/claude-code/aiwf/ko/config/language.json +6 -0
  304. package/claude-code/aiwf/ko/feature-ledger/FL-001-authentication.json +52 -0
  305. package/claude-code/aiwf/ko/feature-ledger/feature-index.json +20 -0
  306. package/claude-code/aiwf/ko/hooks/install-hooks.sh +100 -0
  307. package/claude-code/aiwf/ko/hooks/post-commit +84 -0
  308. package/claude-code/aiwf/ko/personas/PERSONA_INDEX.md +57 -0
  309. package/claude-code/aiwf/ko/personas/analyst.json +44 -0
  310. package/claude-code/aiwf/ko/personas/architect/best_practices.md +136 -0
  311. package/claude-code/aiwf/ko/personas/architect/knowledge_base.md +377 -0
  312. package/claude-code/aiwf/ko/personas/architect.json +44 -0
  313. package/claude-code/aiwf/ko/personas/backend/best_practices.md +766 -0
  314. package/claude-code/aiwf/ko/personas/backend/knowledge_base.md +1070 -0
  315. package/claude-code/aiwf/ko/personas/data_analyst/best_practices.md +594 -0
  316. package/claude-code/aiwf/ko/personas/data_analyst/knowledge_base.md +1057 -0
  317. package/claude-code/aiwf/ko/personas/developer.json +44 -0
  318. package/claude-code/aiwf/ko/personas/developer.md +37 -0
  319. package/claude-code/aiwf/ko/personas/evaluation_criteria.json +137 -0
  320. package/claude-code/aiwf/ko/personas/frontend/best_practices.md +445 -0
  321. package/claude-code/aiwf/ko/personas/frontend/knowledge_base.md +729 -0
  322. package/claude-code/aiwf/ko/personas/persona-index.json +31 -0
  323. package/claude-code/aiwf/ko/personas/reviewer.json +44 -0
  324. package/claude-code/aiwf/ko/personas/security/best_practices.md +307 -0
  325. package/claude-code/aiwf/ko/personas/security/knowledge_base.md +498 -0
  326. package/claude-code/aiwf/ko/personas/tester.json +44 -0
  327. package/claude-code/aiwf/ko/scripts/cache-templates.js +209 -0
  328. package/claude-code/aiwf/ko/scripts/create-offline.js +86 -0
  329. package/claude-code/aiwf/ko/scripts/create-project.js +151 -0
  330. package/claude-code/aiwf/ko/scripts/feature-progress-calculator.cjs +236 -0
  331. package/claude-code/aiwf/ko/scripts/git-integration.cjs +391 -0
  332. package/claude-code/aiwf/ko/scripts/install-git-hooks.cjs +226 -0
  333. package/claude-code/aiwf/ko/scripts/test-commit-parsing.cjs +125 -0
  334. package/claude-code/aiwf/ko/scripts/update-feature-status.cjs +198 -0
  335. package/claude-code/aiwf/ko/templates/README.md +78 -0
  336. package/claude-code/aiwf/ko/templates/api-server/config.json +64 -0
  337. package/claude-code/aiwf/ko/templates/api-server/template/.aiwf/config.json +56 -0
  338. package/claude-code/aiwf/ko/templates/api-server/template/.aiwf/feature-ledger.json +42 -0
  339. package/claude-code/aiwf/ko/templates/api-server/template/.aiwf/personas/backend-engineer.json +40 -0
  340. package/claude-code/aiwf/ko/templates/api-server/template/.aiwf/scripts/cli.js +111 -0
  341. package/claude-code/aiwf/ko/templates/api-server/template/.env.example +29 -0
  342. package/claude-code/aiwf/ko/templates/api-server/template/.eslintrc.json +23 -0
  343. package/claude-code/aiwf/ko/templates/api-server/template/README.md +171 -0
  344. package/claude-code/aiwf/ko/templates/api-server/template/jest.config.js +26 -0
  345. package/claude-code/aiwf/ko/templates/api-server/template/nodemon.json +9 -0
  346. package/claude-code/aiwf/ko/templates/api-server/template/package.json +61 -0
  347. package/claude-code/aiwf/ko/templates/api-server/template/src/app.ts +60 -0
  348. package/claude-code/aiwf/ko/templates/api-server/template/src/config/swagger.ts +38 -0
  349. package/claude-code/aiwf/ko/templates/api-server/template/src/controllers/aiwfController.ts +68 -0
  350. package/claude-code/aiwf/ko/templates/api-server/template/src/controllers/authController.ts +128 -0
  351. package/claude-code/aiwf/ko/templates/api-server/template/src/controllers/statusController.ts +28 -0
  352. package/claude-code/aiwf/ko/templates/api-server/template/src/index.ts +28 -0
  353. package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/aiwfMiddleware.ts +50 -0
  354. package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/authMiddleware.ts +41 -0
  355. package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/errorHandler.ts +42 -0
  356. package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/notFoundHandler.ts +14 -0
  357. package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/requestLogger.ts +20 -0
  358. package/claude-code/aiwf/ko/templates/api-server/template/src/routes/aiwf.ts +42 -0
  359. package/claude-code/aiwf/ko/templates/api-server/template/src/routes/index.ts +13 -0
  360. package/claude-code/aiwf/ko/templates/api-server/template/src/routes/v1/index.ts +67 -0
  361. package/claude-code/aiwf/ko/templates/api-server/template/src/utils/logger.ts +37 -0
  362. package/claude-code/aiwf/ko/templates/api-server/template/tests/app.test.ts +40 -0
  363. package/claude-code/aiwf/ko/templates/api-server/template/tsconfig.json +43 -0
  364. package/claude-code/aiwf/ko/templates/npm-library/config.json +61 -0
  365. package/claude-code/aiwf/ko/templates/npm-library/template/LICENSE +21 -0
  366. package/claude-code/aiwf/ko/templates/npm-library/template/README.md +201 -0
  367. package/claude-code/aiwf/ko/templates/npm-library/template/package.json +78 -0
  368. package/claude-code/aiwf/ko/templates/web-app/config.json +53 -0
  369. package/claude-code/aiwf/ko/templates/web-app/template/.aiwf/config.json +54 -0
  370. package/claude-code/aiwf/ko/templates/web-app/template/.aiwf/feature-ledger.json +37 -0
  371. package/claude-code/aiwf/ko/templates/web-app/template/.aiwf/personas/fullstack-developer.json +40 -0
  372. package/claude-code/aiwf/ko/templates/web-app/template/.aiwf/scripts/cli.js +110 -0
  373. package/claude-code/aiwf/ko/templates/web-app/template/.eslintrc.cjs +20 -0
  374. package/claude-code/aiwf/ko/templates/web-app/template/README.md +151 -0
  375. package/claude-code/aiwf/ko/templates/web-app/template/index.html +14 -0
  376. package/claude-code/aiwf/ko/templates/web-app/template/package-lock.json +10022 -0
  377. package/claude-code/aiwf/ko/templates/web-app/template/package.json +44 -0
  378. package/claude-code/aiwf/ko/templates/web-app/template/postcss.config.js +6 -0
  379. package/claude-code/aiwf/ko/templates/web-app/template/public/vite.svg +1 -0
  380. package/claude-code/aiwf/ko/templates/web-app/template/src/App.tsx +21 -0
  381. package/claude-code/aiwf/ko/templates/web-app/template/src/components/Layout.tsx +57 -0
  382. package/claude-code/aiwf/ko/templates/web-app/template/src/components/aiwf/ContextStatus.tsx +107 -0
  383. package/claude-code/aiwf/ko/templates/web-app/template/src/components/aiwf/FeatureLedger.tsx +93 -0
  384. package/claude-code/aiwf/ko/templates/web-app/template/src/components/aiwf/TokenUsage.tsx +71 -0
  385. package/claude-code/aiwf/ko/templates/web-app/template/src/index.css +60 -0
  386. package/claude-code/aiwf/ko/templates/web-app/template/src/main.tsx +10 -0
  387. package/claude-code/aiwf/ko/templates/web-app/template/src/pages/AiwfDashboard.tsx +60 -0
  388. package/claude-code/aiwf/ko/templates/web-app/template/src/pages/HomePage.tsx +89 -0
  389. package/claude-code/aiwf/ko/templates/web-app/template/src/pages/NotFound.tsx +25 -0
  390. package/claude-code/aiwf/ko/templates/web-app/template/src/stores/aiwfStore.ts +126 -0
  391. package/claude-code/aiwf/ko/templates/web-app/template/src/types/global.d.ts +9 -0
  392. package/claude-code/aiwf/ko/templates/web-app/template/src/vite-env.d.ts +1 -0
  393. package/claude-code/aiwf/ko/templates/web-app/template/tailwind.config.js +30 -0
  394. package/claude-code/aiwf/ko/templates/web-app/template/tsconfig.json +37 -0
  395. package/claude-code/aiwf/ko/templates/web-app/template/tsconfig.node.json +10 -0
  396. package/claude-code/aiwf/ko/templates/web-app/template/vite.config.ts +23 -0
  397. package/claude-code/aiwf/ko/tests/compression-test-suite.js +1252 -0
  398. package/claude-code/aiwf/ko/tests/test-git-integration.js +164 -0
  399. package/claude-code/aiwf/ko/tests/token-tracking.test.js +537 -0
  400. package/claude-code/aiwf/ko/token-data/alerts.json +293 -0
  401. package/claude-code/aiwf/ko/token-data/monitor-config.json +12 -0
  402. package/claude-code/aiwf/ko/utils/background-monitor.js +223 -0
  403. package/claude-code/aiwf/ko/utils/compression-metrics.js +1031 -0
  404. package/claude-code/aiwf/ko/utils/compression-strategies.js +557 -0
  405. package/claude-code/aiwf/ko/utils/content-normalizer.js +455 -0
  406. package/claude-code/aiwf/ko/utils/context-compressor.js +583 -0
  407. package/claude-code/aiwf/ko/utils/context-rule-parser.js +180 -0
  408. package/claude-code/aiwf/ko/utils/context-token-monitor.js +463 -0
  409. package/claude-code/aiwf/ko/utils/context-update-manager.js +502 -0
  410. package/claude-code/aiwf/ko/utils/feature-updater.js +271 -0
  411. package/claude-code/aiwf/ko/utils/git-utils.js +220 -0
  412. package/claude-code/aiwf/ko/utils/importance-classifier.js +645 -0
  413. package/claude-code/aiwf/ko/utils/information-filter.js +710 -0
  414. package/claude-code/aiwf/ko/utils/persona-aware-compressor.js +598 -0
  415. package/claude-code/aiwf/ko/utils/prompt-injector.js +242 -0
  416. package/claude-code/aiwf/ko/utils/simplified-evaluator.js +119 -0
  417. package/claude-code/aiwf/ko/utils/text-summarizer.js +492 -0
  418. package/claude-code/aiwf/ko/utils/token-counter.js +177 -0
  419. package/claude-code/aiwf/ko/utils/token-monitor.js +484 -0
  420. package/claude-code/aiwf/ko/utils/token-reporter.js +453 -0
  421. package/claude-code/aiwf/ko/utils/token-storage.js +433 -0
  422. package/claude-code/aiwf/ko/utils/token-tracker.js +283 -0
  423. package/docs/AI_PERSONA_SYSTEM_DESIGN.md +516 -0
  424. package/docs/API_DOCUMENTATION.md +932 -0
  425. package/docs/API_REFERENCE.md +979 -0
  426. package/docs/COMMANDS_GUIDE.ko.md +8 -2
  427. package/docs/COMMANDS_GUIDE.md +196 -2
  428. package/docs/CONTRIBUTING.ko.md +408 -0
  429. package/docs/CONTRIBUTING.md +205 -203
  430. package/docs/EXAMPLES.md +691 -0
  431. package/docs/GETTING_STARTED.md +480 -0
  432. package/docs/PERFORMANCE_ARCHITECTURE.md +494 -0
  433. package/docs/PERFORMANCE_GUIDELINES.md +553 -0
  434. package/docs/TROUBLESHOOTING.md +721 -0
  435. package/docs/git-feature-integration-guide.md +253 -0
  436. package/docs/guides/ai-personas-guide-ko.md +239 -0
  437. package/docs/guides/ai-personas-guide.md +239 -0
  438. package/docs/guides/context-compression-guide-ko.md +313 -0
  439. package/docs/guides/context-compression-guide.md +313 -0
  440. package/docs/guides/feature-git-integration-guide-ko.md +481 -0
  441. package/docs/guides/feature-git-integration-guide.md +481 -0
  442. package/docs/lightweight-evaluation.md +198 -0
  443. package/docs/m02-dod-checklist.md +125 -0
  444. package/docs/m02-gap-analysis.md +214 -0
  445. package/docs/m02-milestone-completion-report.md +186 -0
  446. package/docs/m02-milestone-executive-summary.md +68 -0
  447. package/docs/offline-template-cache.md +323 -0
  448. package/docs/performance-benchmark-report.md +159 -0
  449. package/docs/persona-aware-compression.md +168 -0
  450. package/docs/reports/S02-sprint-report.md +190 -0
  451. package/docs/usability-test-report.md +170 -0
  452. package/index.js +116 -4
  453. package/jest.config.js +20 -1
  454. package/language-utils.js +1 -1
  455. package/lib/ai-persona-manager.js +711 -0
  456. package/lib/cache-cli.js +459 -0
  457. package/lib/cache-integration.js +401 -0
  458. package/lib/cache-system.js +332 -0
  459. package/lib/context-engine.js +568 -0
  460. package/lib/file-batch-processor.js +401 -0
  461. package/lib/memory-profiler.js +471 -0
  462. package/lib/metrics-collector.js +885 -0
  463. package/lib/offline-detector.js +386 -0
  464. package/lib/performance-benchmark.js +621 -0
  465. package/lib/task-analyzer.js +599 -0
  466. package/lib/template-cache-system.js +559 -0
  467. package/lib/template-downloader.js +467 -0
  468. package/lib/template-manager.js +310 -0
  469. package/lib/template-version-manager.js +491 -0
  470. package/lib/token-optimizer.js +517 -0
  471. package/package.json +6 -3
  472. package/scripts/run-integration-tests.js +317 -0
  473. package/src/commands/ai-tool.js +383 -0
  474. package/test-token-system.js +88 -0
  475. package/tests/application.test.js +260 -0
  476. package/tests/basic.test.js +1 -1
  477. package/tests/integration/ai-persona-system.test.js +396 -0
  478. package/tests/integration/ai-persona.test.js +390 -0
  479. package/tests/integration/command-integration.test.js +600 -0
  480. package/tests/integration/context-compression.test.js +361 -0
  481. package/tests/integration/feature-ledger.test.js +226 -0
  482. package/tests/integration/git-integration.test.js +307 -0
  483. package/tests/integration/m02-milestone.test.js +420 -0
  484. package/tests/integration/persona-context-application.test.js +508 -0
  485. package/tests/integration/setup.js +174 -0
  486. package/tests/integration/test-persona-aware-compression.js +93 -0
  487. package/tests/language-utils.test.js +25 -9
  488. package/tests/s02-integration.test.js +422 -0
  489. package/tests/unit/ai-persona-manager.test.js +514 -0
  490. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_language_manager.md +0 -287
  491. package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_language_status.md +0 -246
  492. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_language_manager.md +0 -287
  493. package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_language_status.md +0 -246
@@ -0,0 +1,361 @@
1
+ /**
2
+ * Context 압축/복원 시스템 통합 테스트
3
+ */
4
+
5
+ import { testUtils, testFixtures } from './setup.js';
6
+ import fs from 'fs/promises';
7
+ import path from 'path';
8
+ import { fileURLToPath } from 'url';
9
+
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = path.dirname(__filename);
12
+
13
+ describe('Context 압축/복원 시스템 통합 테스트', () => {
14
+ let testProjectDir;
15
+ let aiwfDir;
16
+
17
+ beforeEach(async () => {
18
+ testProjectDir = await testUtils.createTempDir('context-compression-');
19
+ aiwfDir = await testUtils.createTestProjectStructure(testProjectDir);
20
+ });
21
+
22
+ afterEach(async () => {
23
+ await testUtils.cleanupTempDir(testProjectDir);
24
+ });
25
+
26
+ describe('토큰 사용량 추적 테스트', () => {
27
+ test('토큰 카운팅 시뮬레이션', () => {
28
+ // 간단한 토큰 카운팅 함수 시뮬레이션
29
+ const countTokens = (text) => {
30
+ // 실제로는 tiktoken 라이브러리를 사용하지만, 테스트용으로 간단히 구현
31
+ return text.split(/\s+/).length;
32
+ };
33
+
34
+ const testTexts = [
35
+ 'This is a simple test.',
36
+ 'Context compression is essential for AI optimization.',
37
+ 'Feature Ledger 시스템을 구현하여 프로젝트 관리 효율성을 높인다.'
38
+ ];
39
+
40
+ testTexts.forEach(text => {
41
+ const tokenCount = countTokens(text);
42
+ expect(tokenCount).toBeGreaterThan(0);
43
+ expect(typeof tokenCount).toBe('number');
44
+ });
45
+ });
46
+
47
+ test('토큰 사용량 히스토리 추적', async () => {
48
+ const tokenHistoryPath = path.join(aiwfDir, 'token_history.json');
49
+
50
+ const tokenHistory = [
51
+ { timestamp: '2025-07-09T01:00:00Z', operation: 'compress', inputTokens: 1000, outputTokens: 600, compression: 0.4 },
52
+ { timestamp: '2025-07-09T01:15:00Z', operation: 'decompress', inputTokens: 600, outputTokens: 1000, compression: 0.0 },
53
+ { timestamp: '2025-07-09T01:30:00Z', operation: 'compress', inputTokens: 1500, outputTokens: 750, compression: 0.5 }
54
+ ];
55
+
56
+ await fs.writeFile(tokenHistoryPath, JSON.stringify(tokenHistory, null, 2));
57
+
58
+ const history = await testUtils.readJsonFile(tokenHistoryPath);
59
+ expect(history).toHaveLength(3);
60
+
61
+ // 압축률 계산 검증
62
+ const compressOperations = history.filter(op => op.operation === 'compress');
63
+ const avgCompression = compressOperations.reduce((sum, op) => sum + op.compression, 0) / compressOperations.length;
64
+
65
+ expect(avgCompression).toBeCloseTo(0.45, 2);
66
+ });
67
+ });
68
+
69
+ describe('Context 압축 알고리즘 테스트', () => {
70
+ test('기본 압축 알고리즘 시뮬레이션', () => {
71
+ // 간단한 압축 알고리즘 시뮬레이션
72
+ const compressContext = (context) => {
73
+ // 1. 중복 단어 제거
74
+ const words = context.split(/\s+/);
75
+ const uniqueWords = [...new Set(words)];
76
+
77
+ // 2. 불필요한 접속사 제거
78
+ const stopWords = ['the', 'a', 'an', 'and', 'or', 'but', 'in', 'on', 'at', 'to', 'for', 'of', 'with', 'by'];
79
+ const filteredWords = uniqueWords.filter(word => !stopWords.includes(word.toLowerCase()));
80
+
81
+ // 3. 압축된 텍스트 생성
82
+ const compressed = filteredWords.join(' ');
83
+
84
+ return {
85
+ original: context,
86
+ compressed: compressed,
87
+ originalLength: context.length,
88
+ compressedLength: compressed.length,
89
+ compressionRatio: (context.length - compressed.length) / context.length
90
+ };
91
+ };
92
+
93
+ const testContext = 'This is a test context with many repeated words and unnecessary filler words that can be compressed for efficiency.';
94
+ const result = compressContext(testContext);
95
+
96
+ expect(result.compressedLength).toBeLessThan(result.originalLength);
97
+ expect(result.compressionRatio).toBeGreaterThan(0);
98
+ expect(result.compressed).not.toContain('the');
99
+ expect(result.compressed).not.toContain('and');
100
+ });
101
+
102
+ test('압축 레벨별 테스트', () => {
103
+ const compressWithLevel = (text, level) => {
104
+ const words = text.split(/\s+/);
105
+
106
+ switch (level) {
107
+ case 'low':
108
+ // 단순 공백 정리
109
+ return text.replace(/\s+/g, ' ').trim();
110
+ case 'medium':
111
+ // 중복 단어 제거
112
+ return [...new Set(words)].join(' ');
113
+ case 'high':
114
+ // 핵심 키워드만 유지
115
+ return words.filter((word, index) => index % 2 === 0).join(' ');
116
+ default:
117
+ return text;
118
+ }
119
+ };
120
+
121
+ const testText = 'Feature Ledger system implementation for project management efficiency enhancement';
122
+
123
+ const lowCompressed = compressWithLevel(testText, 'low');
124
+ const mediumCompressed = compressWithLevel(testText, 'medium');
125
+ const highCompressed = compressWithLevel(testText, 'high');
126
+
127
+ expect(lowCompressed.length).toBeLessThanOrEqual(testText.length);
128
+ expect(mediumCompressed.length).toBeLessThanOrEqual(lowCompressed.length);
129
+ expect(highCompressed.length).toBeLessThanOrEqual(mediumCompressed.length);
130
+ });
131
+ });
132
+
133
+ describe('Context 복원 시스템 테스트', () => {
134
+ test('압축된 Context 복원 시뮬레이션', () => {
135
+ // 압축/복원 시스템 시뮬레이션
136
+ const contextSystem = {
137
+ compress: (text) => {
138
+ const words = text.split(/\s+/);
139
+ const keyWords = words.filter(word => word.length > 3);
140
+ return {
141
+ compressed: keyWords.join(' '),
142
+ metadata: {
143
+ originalLength: text.length,
144
+ removedWords: words.filter(word => word.length <= 3),
145
+ compressionTime: new Date().toISOString()
146
+ }
147
+ };
148
+ },
149
+
150
+ decompress: (compressed, metadata) => {
151
+ // 간단한 복원 시뮬레이션
152
+ return `[DECOMPRESSED] ${compressed.compressed}`;
153
+ }
154
+ };
155
+
156
+ const originalText = 'This is a test of the context compression and decompression system';
157
+ const compressed = contextSystem.compress(originalText);
158
+ const decompressed = contextSystem.decompress(compressed, compressed.metadata);
159
+
160
+ expect(compressed.compressed).toBeTruthy();
161
+ expect(compressed.metadata.originalLength).toBe(originalText.length);
162
+ expect(decompressed).toContain('[DECOMPRESSED]');
163
+ });
164
+
165
+ test('Context 무결성 검증', () => {
166
+ const verifyContextIntegrity = (original, restored) => {
167
+ // 핵심 키워드 추출
168
+ const extractKeywords = (text) => {
169
+ return text.toLowerCase()
170
+ .split(/\s+/)
171
+ .filter(word => word.length > 3)
172
+ .slice(0, 10); // 상위 10개 키워드
173
+ };
174
+
175
+ const originalKeywords = extractKeywords(original);
176
+ const restoredKeywords = extractKeywords(restored);
177
+
178
+ // 키워드 일치율 계산
179
+ const matchingKeywords = originalKeywords.filter(keyword =>
180
+ restoredKeywords.includes(keyword)
181
+ );
182
+
183
+ const integrityScore = matchingKeywords.length / originalKeywords.length;
184
+
185
+ return {
186
+ integrityScore,
187
+ matchingKeywords,
188
+ originalKeywords,
189
+ restoredKeywords
190
+ };
191
+ };
192
+
193
+ const originalContext = 'Feature Ledger system implementation with comprehensive testing suite for project management efficiency';
194
+ const restoredContext = 'Feature Ledger system implementation comprehensive testing suite project management efficiency';
195
+
196
+ const integrity = verifyContextIntegrity(originalContext, restoredContext);
197
+
198
+ expect(integrity.integrityScore).toBeGreaterThan(0.8);
199
+ expect(integrity.matchingKeywords).toContain('feature');
200
+ expect(integrity.matchingKeywords).toContain('system');
201
+ expect(integrity.matchingKeywords).toContain('implementation');
202
+ });
203
+ });
204
+
205
+ describe('압축 성능 최적화 테스트', () => {
206
+ test('압축 속도 성능 테스트', async () => {
207
+ const performanceTest = async (textSize) => {
208
+ const testText = 'Performance test data '.repeat(textSize);
209
+
210
+ const startTime = Date.now();
211
+
212
+ // 간단한 압축 알고리즘 시뮬레이션
213
+ const compressed = testText
214
+ .split(/\s+/)
215
+ .filter((word, index) => index % 2 === 0)
216
+ .join(' ');
217
+
218
+ const endTime = Date.now();
219
+ const duration = endTime - startTime;
220
+
221
+ return {
222
+ inputSize: testText.length,
223
+ outputSize: compressed.length,
224
+ compressionRatio: (testText.length - compressed.length) / testText.length,
225
+ duration: duration
226
+ };
227
+ };
228
+
229
+ const smallTest = await performanceTest(10);
230
+ const mediumTest = await performanceTest(100);
231
+ const largeTest = await performanceTest(1000);
232
+
233
+ expect(smallTest.duration).toBeLessThan(100);
234
+ expect(mediumTest.duration).toBeLessThan(200);
235
+ expect(largeTest.duration).toBeLessThan(500);
236
+
237
+ // 압축률이 일정 수준 이상이어야 함
238
+ expect(smallTest.compressionRatio).toBeGreaterThan(0.3);
239
+ expect(mediumTest.compressionRatio).toBeGreaterThan(0.3);
240
+ expect(largeTest.compressionRatio).toBeGreaterThan(0.3);
241
+ });
242
+
243
+ test('메모리 사용량 최적화 테스트', () => {
244
+ const memoryEfficientCompress = (text) => {
245
+ // 스트림 기반 압축 시뮬레이션
246
+ const result = [];
247
+ const words = text.split(/\s+/);
248
+
249
+ for (let i = 0; i < words.length; i += 10) {
250
+ const chunk = words.slice(i, i + 10);
251
+ const processedChunk = chunk.filter(word => word.length > 2).join(' ');
252
+ result.push(processedChunk);
253
+ }
254
+
255
+ return result.join(' ');
256
+ };
257
+
258
+ const largeText = 'This is a large text for memory optimization testing. '.repeat(1000);
259
+ const compressed = memoryEfficientCompress(largeText);
260
+
261
+ expect(compressed.length).toBeLessThan(largeText.length);
262
+ expect(typeof compressed).toBe('string');
263
+ });
264
+ });
265
+
266
+ describe('Context 압축 설정 관리 테스트', () => {
267
+ test('압축 설정 파일 생성 및 읽기', async () => {
268
+ const configPath = path.join(aiwfDir, 'compression_config.json');
269
+
270
+ const config = {
271
+ compressionLevel: 'medium',
272
+ maxTokens: 4000,
273
+ preserveCodeBlocks: true,
274
+ preserveLinks: true,
275
+ compressionRatio: 0.5,
276
+ algorithms: ['keyword-extraction', 'duplicate-removal', 'stopword-filtering']
277
+ };
278
+
279
+ await fs.writeFile(configPath, JSON.stringify(config, null, 2));
280
+
281
+ const loadedConfig = await testUtils.readJsonFile(configPath);
282
+ expect(loadedConfig.compressionLevel).toBe('medium');
283
+ expect(loadedConfig.maxTokens).toBe(4000);
284
+ expect(loadedConfig.algorithms).toContain('keyword-extraction');
285
+ expect(loadedConfig.algorithms).toHaveLength(3);
286
+ });
287
+
288
+ test('압축 설정 검증', () => {
289
+ const validateConfig = (config) => {
290
+ const errors = [];
291
+
292
+ if (!['low', 'medium', 'high'].includes(config.compressionLevel)) {
293
+ errors.push('Invalid compression level');
294
+ }
295
+
296
+ if (config.maxTokens <= 0) {
297
+ errors.push('Max tokens must be positive');
298
+ }
299
+
300
+ if (config.compressionRatio < 0 || config.compressionRatio > 1) {
301
+ errors.push('Compression ratio must be between 0 and 1');
302
+ }
303
+
304
+ return errors;
305
+ };
306
+
307
+ const validConfig = {
308
+ compressionLevel: 'medium',
309
+ maxTokens: 4000,
310
+ compressionRatio: 0.5
311
+ };
312
+
313
+ const invalidConfig = {
314
+ compressionLevel: 'invalid',
315
+ maxTokens: -100,
316
+ compressionRatio: 1.5
317
+ };
318
+
319
+ expect(validateConfig(validConfig)).toHaveLength(0);
320
+ expect(validateConfig(invalidConfig)).toHaveLength(3);
321
+ });
322
+ });
323
+
324
+ describe('실시간 압축 시스템 테스트', () => {
325
+ test('스트리밍 압축 시뮬레이션', async () => {
326
+ const streamingCompress = async function* (textStream) {
327
+ for await (const chunk of textStream) {
328
+ // 청크 단위로 압축
329
+ const compressed = chunk.split(/\s+/)
330
+ .filter(word => word.length > 2)
331
+ .join(' ');
332
+
333
+ yield compressed;
334
+ }
335
+ };
336
+
337
+ // 테스트용 스트림 생성
338
+ const testStream = async function* () {
339
+ const chunks = [
340
+ 'This is the first chunk of text',
341
+ 'This is the second chunk with more content',
342
+ 'Final chunk for testing purposes'
343
+ ];
344
+
345
+ for (const chunk of chunks) {
346
+ yield chunk;
347
+ }
348
+ };
349
+
350
+ const results = [];
351
+ for await (const compressed of streamingCompress(testStream())) {
352
+ results.push(compressed);
353
+ }
354
+
355
+ expect(results).toHaveLength(3);
356
+ expect(results[0]).toContain('This');
357
+ expect(results[0]).toContain('first');
358
+ expect(results[0]).toContain('chunk');
359
+ });
360
+ });
361
+ });
@@ -0,0 +1,226 @@
1
+ /**
2
+ * Feature Ledger 시스템 통합 테스트
3
+ */
4
+
5
+ import { testUtils, testFixtures } from './setup.js';
6
+ import fs from 'fs/promises';
7
+ import path from 'path';
8
+ import { fileURLToPath } from 'url';
9
+
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = path.dirname(__filename);
12
+
13
+ describe('Feature Ledger 시스템 통합 테스트', () => {
14
+ let testProjectDir;
15
+ let featureLedgerDir;
16
+
17
+ beforeEach(async () => {
18
+ testProjectDir = await testUtils.createTempDir('feature-ledger-');
19
+ const aiwfDir = await testUtils.createTestProjectStructure(testProjectDir);
20
+ featureLedgerDir = path.join(aiwfDir, '06_FEATURE_LEDGERS');
21
+ });
22
+
23
+ afterEach(async () => {
24
+ await testUtils.cleanupTempDir(testProjectDir);
25
+ });
26
+
27
+ describe('Feature Ledger CRUD 기능 테스트', () => {
28
+ test('Feature Ledger 생성 테스트', async () => {
29
+ const feature = testFixtures.featureLedger;
30
+ const featureFilePath = path.join(featureLedgerDir, `${feature.id}.md`);
31
+
32
+ // Feature Ledger 파일 생성
33
+ const content = `---
34
+ id: ${feature.id}
35
+ title: ${feature.title}
36
+ description: ${feature.description}
37
+ status: ${feature.status}
38
+ priority: ${feature.priority}
39
+ milestone: ${feature.milestone}
40
+ created_at: ${feature.created_at}
41
+ updated_at: ${feature.updated_at}
42
+ ---
43
+
44
+ # Feature: ${feature.title}
45
+
46
+ ## Description
47
+ ${feature.description}
48
+
49
+ ## Status
50
+ ${feature.status}
51
+
52
+ ## Priority
53
+ ${feature.priority}
54
+ `;
55
+
56
+ await fs.writeFile(featureFilePath, content);
57
+
58
+ // 파일 생성 확인
59
+ expect(await testUtils.fileExists(featureFilePath)).toBe(true);
60
+
61
+ // 파일 내용 검증
62
+ const parsedContent = await testUtils.parseMarkdownFile(featureFilePath);
63
+ expect(parsedContent.metadata.id).toBe(feature.id);
64
+ expect(parsedContent.metadata.title).toBe(feature.title);
65
+ expect(parsedContent.metadata.status).toBe(feature.status);
66
+ });
67
+
68
+ test('Feature Ledger 읽기 테스트', async () => {
69
+ const feature = testFixtures.featureLedger;
70
+ const featureFilePath = path.join(featureLedgerDir, `${feature.id}.md`);
71
+
72
+ // 테스트 데이터 생성
73
+ const content = `---
74
+ id: ${feature.id}
75
+ title: ${feature.title}
76
+ status: ${feature.status}
77
+ ---
78
+
79
+ # Feature: ${feature.title}
80
+ `;
81
+
82
+ await fs.writeFile(featureFilePath, content);
83
+
84
+ // 파일 읽기 및 파싱
85
+ const parsedContent = await testUtils.parseMarkdownFile(featureFilePath);
86
+
87
+ expect(parsedContent.metadata.id).toBe(feature.id);
88
+ expect(parsedContent.metadata.title).toBe(feature.title);
89
+ expect(parsedContent.metadata.status).toBe(feature.status);
90
+ expect(parsedContent.body).toContain(`# Feature: ${feature.title}`);
91
+ });
92
+
93
+ test('Feature Ledger 업데이트 테스트', async () => {
94
+ const feature = testFixtures.featureLedger;
95
+ const featureFilePath = path.join(featureLedgerDir, `${feature.id}.md`);
96
+
97
+ // 초기 파일 생성
98
+ const initialContent = `---
99
+ id: ${feature.id}
100
+ title: ${feature.title}
101
+ status: planned
102
+ ---
103
+
104
+ # Feature: ${feature.title}
105
+ `;
106
+
107
+ await fs.writeFile(featureFilePath, initialContent);
108
+
109
+ // 상태 업데이트
110
+ const updatedContent = `---
111
+ id: ${feature.id}
112
+ title: ${feature.title}
113
+ status: in_progress
114
+ ---
115
+
116
+ # Feature: ${feature.title}
117
+ `;
118
+
119
+ await fs.writeFile(featureFilePath, updatedContent);
120
+
121
+ // 업데이트 검증
122
+ const parsedContent = await testUtils.parseMarkdownFile(featureFilePath);
123
+ expect(parsedContent.metadata.status).toBe('in_progress');
124
+ });
125
+
126
+ test('Feature Ledger 삭제 테스트', async () => {
127
+ const feature = testFixtures.featureLedger;
128
+ const featureFilePath = path.join(featureLedgerDir, `${feature.id}.md`);
129
+
130
+ // 파일 생성
131
+ await fs.writeFile(featureFilePath, `---
132
+ id: ${feature.id}
133
+ title: ${feature.title}
134
+ ---
135
+
136
+ # Feature: ${feature.title}
137
+ `);
138
+
139
+ // 파일 존재 확인
140
+ expect(await testUtils.fileExists(featureFilePath)).toBe(true);
141
+
142
+ // 파일 삭제
143
+ await fs.unlink(featureFilePath);
144
+
145
+ // 삭제 확인
146
+ expect(await testUtils.fileExists(featureFilePath)).toBe(false);
147
+ });
148
+ });
149
+
150
+ describe('Feature Ledger 디렉토리 구조 테스트', () => {
151
+ test('Feature Ledger 디렉토리 존재 확인', async () => {
152
+ expect(await testUtils.dirExists(featureLedgerDir)).toBe(true);
153
+ });
154
+
155
+ test('Feature Ledger 목록 조회 테스트', async () => {
156
+ // 여러 Feature Ledger 파일 생성
157
+ const features = [
158
+ { ...testFixtures.featureLedger, id: 'FEATURE_001' },
159
+ { ...testFixtures.featureLedger, id: 'FEATURE_002' },
160
+ { ...testFixtures.featureLedger, id: 'FEATURE_003' }
161
+ ];
162
+
163
+ for (const feature of features) {
164
+ const featureFilePath = path.join(featureLedgerDir, `${feature.id}.md`);
165
+ await fs.writeFile(featureFilePath, `---
166
+ id: ${feature.id}
167
+ title: ${feature.title}
168
+ ---
169
+
170
+ # Feature: ${feature.title}
171
+ `);
172
+ }
173
+
174
+ // 디렉토리 목록 조회
175
+ const files = await fs.readdir(featureLedgerDir);
176
+ const mdFiles = files.filter(file => file.endsWith('.md'));
177
+
178
+ expect(mdFiles.length).toBe(3);
179
+ expect(mdFiles).toContain('FEATURE_001.md');
180
+ expect(mdFiles).toContain('FEATURE_002.md');
181
+ expect(mdFiles).toContain('FEATURE_003.md');
182
+ });
183
+ });
184
+
185
+ describe('Feature Ledger 데이터 무결성 테스트', () => {
186
+ test('잘못된 형식의 Feature Ledger 파일 처리', async () => {
187
+ const invalidFeaturePath = path.join(featureLedgerDir, 'invalid_feature.md');
188
+
189
+ // 잘못된 형식의 파일 생성
190
+ const invalidContent = `
191
+ # Invalid Feature
192
+
193
+ This is not a valid feature ledger format.
194
+ `;
195
+
196
+ await fs.writeFile(invalidFeaturePath, invalidContent);
197
+
198
+ // 파싱 시도
199
+ const parsedContent = await testUtils.parseMarkdownFile(invalidFeaturePath);
200
+
201
+ // 메타데이터가 비어있어야 함
202
+ expect(Object.keys(parsedContent.metadata)).toHaveLength(0);
203
+ expect(parsedContent.body).toContain('# Invalid Feature');
204
+ });
205
+
206
+ test('필수 필드 누락 검증', async () => {
207
+ const incompleteFeaturePath = path.join(featureLedgerDir, 'incomplete_feature.md');
208
+
209
+ // 필수 필드가 누락된 파일
210
+ const incompleteContent = `---
211
+ title: Incomplete Feature
212
+ ---
213
+
214
+ # Feature: Incomplete Feature
215
+ `;
216
+
217
+ await fs.writeFile(incompleteFeaturePath, incompleteContent);
218
+
219
+ const parsedContent = await testUtils.parseMarkdownFile(incompleteFeaturePath);
220
+
221
+ // id 필드가 없어야 함
222
+ expect(parsedContent.metadata.id).toBeUndefined();
223
+ expect(parsedContent.metadata.title).toBe('Incomplete Feature');
224
+ });
225
+ });
226
+ });