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.
- package/.aiwf/.claude/commands/aiwf/aiwf_compress_aggressive_persona.md +53 -0
- package/.aiwf/.claude/commands/aiwf/aiwf_compress_minimal_persona.md +48 -0
- package/.aiwf/.claude/commands/aiwf/aiwf_compress_stats.md +79 -0
- package/.aiwf/.claude/commands/aiwf/aiwf_compress_with_persona.md +51 -0
- package/.aiwf/.claude/commands/aiwf/aiwf_evaluate.md +92 -0
- package/.aiwf/00_PROJECT_MANIFEST.md +183 -0
- package/.aiwf/01_PROJECT_DOCS/ARCHITECTURE.md +121 -0
- package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_ADVANCED_USE_CASES.md +412 -0
- package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_API_REFERENCE.md +361 -0
- package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_COMMANDS_GUIDE.md +254 -0
- package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_FAQ.md +365 -0
- package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_SYSTEM_OVERVIEW.md +305 -0
- package/.aiwf/01_PROJECT_DOCS/FEATURE_LEDGER_USER_GUIDE.md +416 -0
- 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
- package/.aiwf/02_REQUIREMENTS/CLAUDE.md +78 -0
- package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/M02_milestone_meta.md +34 -0
- package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/PRD_Context_Engineering_Enhancement.md +108 -0
- package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/SPECS_AI_Persona_System.md +299 -0
- package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/SPECS_Feature_Ledger_System.md +330 -0
- package/.aiwf/02_REQUIREMENTS/M02_Context_Engineering_Enhancement/SPECS_Token_Optimization.md +833 -0
- package/.aiwf/03_SPRINTS/CLAUDE.md +83 -0
- package/.aiwf/03_SPRINTS/S01_M02_context_foundation/S01_M02_sprint_meta.md +95 -0
- 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
- 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
- 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
- package/.aiwf/03_SPRINTS/S01_M02_context_foundation/TX04_S01_Feature_Ledger_/353/254/270/354/204/234/355/231/224.md +114 -0
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/.aiwf/03_SPRINTS/S02_M02_ai_enhancement/S02_M02_sprint_meta.md +107 -0
- 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
- 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
- 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
- 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
- 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
- package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/S03_FINAL_SPRINT_SUMMARY.md +137 -0
- package/.aiwf/03_SPRINTS/S03_M02_ecosystem_integration/S03_M02_sprint_meta.md +106 -0
- 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
- 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
- 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
- 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
- package/.aiwf/04_GENERAL_TASKS/CLAUDE.md +96 -0
- package/.aiwf/04_GENERAL_TASKS/TX001_complete_english_translation.md +127 -0
- package/.aiwf/05_DOCUMENTATION/performance-report.md +33 -0
- package/.aiwf/06_FEATURE_LEDGERS/FEATURE_GIT_INTEGRATION.md +314 -0
- package/.aiwf/06_FEATURE_LEDGERS/FEATURE_INTEGRATION_GUIDE.md +227 -0
- package/.aiwf/06_FEATURE_LEDGERS/FEATURE_LEDGER_INDEX.md +23 -0
- package/.aiwf/06_FEATURE_LEDGERS/FEATURE_SCHEMA.md +205 -0
- package/.aiwf/06_FEATURE_LEDGERS/FEATURE_STATE_DIAGRAM.md +190 -0
- package/.aiwf/06_FEATURE_LEDGERS/active/FL001_user_authentication_system.md +47 -0
- package/.aiwf/06_FEATURE_LEDGERS/active/FL002_user_authentication_system.md +47 -0
- package/.aiwf/07_AI_PERSONAS/PERSONA_INDEX.md +57 -0
- package/.aiwf/07_AI_PERSONAS/architect/best_practices.md +104 -0
- package/.aiwf/07_AI_PERSONAS/architect/context_rules.md +46 -0
- package/.aiwf/07_AI_PERSONAS/architect/knowledge_base.md +235 -0
- package/.aiwf/07_AI_PERSONAS/backend/best_practices.md +363 -0
- package/.aiwf/07_AI_PERSONAS/backend/context_rules.md +61 -0
- package/.aiwf/07_AI_PERSONAS/backend/knowledge_base.md +623 -0
- package/.aiwf/07_AI_PERSONAS/data_analyst/best_practices.md +32 -0
- package/.aiwf/07_AI_PERSONAS/data_analyst/context_rules.md +43 -0
- package/.aiwf/07_AI_PERSONAS/data_analyst/knowledge_base.md +36 -0
- package/.aiwf/07_AI_PERSONAS/frontend/best_practices.md +31 -0
- package/.aiwf/07_AI_PERSONAS/frontend/context_rules.md +43 -0
- package/.aiwf/07_AI_PERSONAS/frontend/knowledge_base.md +32 -0
- package/.aiwf/07_AI_PERSONAS/security/best_practices.md +63 -0
- package/.aiwf/07_AI_PERSONAS/security/context_rules.md +53 -0
- package/.aiwf/07_AI_PERSONAS/security/knowledge_base.md +93 -0
- package/.aiwf/10_PERSONAS/active.json +1 -0
- package/.aiwf/10_PERSONAS/developer.md +37 -0
- package/.aiwf/10_STATE_OF_PROJECT/2025-07-09-07-20-solid-progress.md +144 -0
- package/.aiwf/98_PROMPTS/SAAS_DEVELOPMENT_GUIDE.md +302 -0
- package/.aiwf/98_PROMPTS/github_integration.md +130 -0
- package/.aiwf/98_PROMPTS/useful-prompts.md +31 -0
- package/.aiwf/98_PROMPTS/vibe-front-prompts.md +89 -0
- package/.aiwf/99_TEMPLATES/adr_template.md +49 -0
- package/.aiwf/99_TEMPLATES/feature_template.md +263 -0
- package/.aiwf/99_TEMPLATES/milestone_meta_template.md +25 -0
- package/.aiwf/99_TEMPLATES/project_manifest_template.md +39 -0
- package/.aiwf/99_TEMPLATES/sprint_meta_template.md +23 -0
- package/.aiwf/99_TEMPLATES/task_template.md +36 -0
- package/.aiwf/CLAUDE.md +76 -0
- package/.aiwf/ai-tools/README.md +105 -0
- package/.aiwf/ai-tools/augment/README.md +371 -0
- package/.aiwf/ai-tools/augment/config.json +30 -0
- package/.aiwf/ai-tools/augment/template/.augment/aiwf-integration.md +387 -0
- package/.aiwf/ai-tools/augment/template/.augment/augment.yaml +347 -0
- package/.aiwf/ai-tools/augment/template/augment.config.json +64 -0
- package/.aiwf/ai-tools/claude-code/README.md +151 -0
- package/.aiwf/ai-tools/claude-code/config.json +28 -0
- package/.aiwf/ai-tools/claude-code/template/CLAUDE.md +91 -0
- package/.aiwf/ai-tools/cursor/README.md +314 -0
- package/.aiwf/ai-tools/cursor/config.json +29 -0
- package/.aiwf/ai-tools/cursor/template/.cursorrules +362 -0
- package/.aiwf/ai-tools/github-copilot/README.md +195 -0
- package/.aiwf/ai-tools/github-copilot/config.json +24 -0
- package/.aiwf/ai-tools/github-copilot/template/.github/copilot-instructions.md +202 -0
- package/.aiwf/ai-tools/windsurf/README.md +355 -0
- package/.aiwf/ai-tools/windsurf/config.json +29 -0
- package/.aiwf/ai-tools/windsurf/template/.windsurf/aiwf-rules.md +260 -0
- package/.aiwf/ai-tools/windsurf/template/.windsurf/windsurf.config.js +312 -0
- package/.aiwf/ai-tools/windsurf/template/windsurf.config.json +63 -0
- package/.aiwf/config/language.json +6 -0
- package/.aiwf/feature-ledger/FL-001-authentication.json +52 -0
- package/.aiwf/feature-ledger/feature-index.json +20 -0
- package/.aiwf/personas/analyst.json +44 -0
- package/.aiwf/personas/architect/best_practices.md +136 -0
- package/.aiwf/personas/architect/knowledge_base.md +377 -0
- package/.aiwf/personas/architect.json +44 -0
- package/.aiwf/personas/backend/best_practices.md +766 -0
- package/.aiwf/personas/backend/knowledge_base.md +1070 -0
- package/.aiwf/personas/data_analyst/best_practices.md +594 -0
- package/.aiwf/personas/data_analyst/knowledge_base.md +1057 -0
- package/.aiwf/personas/developer.json +44 -0
- package/.aiwf/personas/evaluation_criteria.json +137 -0
- package/.aiwf/personas/frontend/best_practices.md +445 -0
- package/.aiwf/personas/frontend/knowledge_base.md +729 -0
- package/.aiwf/personas/persona-index.json +31 -0
- package/.aiwf/personas/reviewer.json +44 -0
- package/.aiwf/personas/security/best_practices.md +307 -0
- package/.aiwf/personas/security/knowledge_base.md +498 -0
- package/.aiwf/personas/tester.json +44 -0
- package/.aiwf/scripts/cache-templates.js +209 -0
- package/.aiwf/scripts/create-offline.js +86 -0
- package/.aiwf/scripts/create-project.js +151 -0
- package/.aiwf/scripts/feature-progress-calculator.cjs +236 -0
- package/.aiwf/scripts/git-integration.cjs +391 -0
- package/.aiwf/scripts/install-git-hooks.cjs +226 -0
- package/.aiwf/scripts/test-commit-parsing.cjs +125 -0
- package/.aiwf/scripts/update-feature-status.cjs +198 -0
- package/.aiwf/templates/README.md +78 -0
- package/.aiwf/templates/api-server/config.json +64 -0
- package/.aiwf/templates/api-server/template/.aiwf/config.json +56 -0
- package/.aiwf/templates/api-server/template/.aiwf/feature-ledger.json +42 -0
- package/.aiwf/templates/api-server/template/.aiwf/personas/backend-engineer.json +40 -0
- package/.aiwf/templates/api-server/template/.aiwf/scripts/cli.js +111 -0
- package/.aiwf/templates/api-server/template/.env.example +29 -0
- package/.aiwf/templates/api-server/template/.eslintrc.json +23 -0
- package/.aiwf/templates/api-server/template/README.md +171 -0
- package/.aiwf/templates/api-server/template/jest.config.js +26 -0
- package/.aiwf/templates/api-server/template/nodemon.json +9 -0
- package/.aiwf/templates/api-server/template/package.json +61 -0
- package/.aiwf/templates/api-server/template/src/app.ts +60 -0
- package/.aiwf/templates/api-server/template/src/config/swagger.ts +38 -0
- package/.aiwf/templates/api-server/template/src/controllers/aiwfController.ts +68 -0
- package/.aiwf/templates/api-server/template/src/controllers/authController.ts +128 -0
- package/.aiwf/templates/api-server/template/src/controllers/statusController.ts +28 -0
- package/.aiwf/templates/api-server/template/src/index.ts +28 -0
- package/.aiwf/templates/api-server/template/src/middleware/aiwfMiddleware.ts +50 -0
- package/.aiwf/templates/api-server/template/src/middleware/authMiddleware.ts +41 -0
- package/.aiwf/templates/api-server/template/src/middleware/errorHandler.ts +42 -0
- package/.aiwf/templates/api-server/template/src/middleware/notFoundHandler.ts +14 -0
- package/.aiwf/templates/api-server/template/src/middleware/requestLogger.ts +20 -0
- package/.aiwf/templates/api-server/template/src/routes/aiwf.ts +42 -0
- package/.aiwf/templates/api-server/template/src/routes/index.ts +13 -0
- package/.aiwf/templates/api-server/template/src/routes/v1/index.ts +67 -0
- package/.aiwf/templates/api-server/template/src/utils/logger.ts +37 -0
- package/.aiwf/templates/api-server/template/tests/app.test.ts +40 -0
- package/.aiwf/templates/api-server/template/tsconfig.json +43 -0
- package/.aiwf/templates/npm-library/config.json +61 -0
- package/.aiwf/templates/npm-library/template/LICENSE +21 -0
- package/.aiwf/templates/npm-library/template/README.md +201 -0
- package/.aiwf/templates/npm-library/template/package.json +78 -0
- package/.aiwf/templates/web-app/config.json +53 -0
- package/.aiwf/templates/web-app/template/.aiwf/config.json +54 -0
- package/.aiwf/templates/web-app/template/.aiwf/feature-ledger.json +37 -0
- package/.aiwf/templates/web-app/template/.aiwf/personas/fullstack-developer.json +40 -0
- package/.aiwf/templates/web-app/template/.aiwf/scripts/cli.js +110 -0
- package/.aiwf/templates/web-app/template/.eslintrc.cjs +20 -0
- package/.aiwf/templates/web-app/template/README.md +151 -0
- package/.aiwf/templates/web-app/template/index.html +14 -0
- package/.aiwf/templates/web-app/template/package.json +44 -0
- package/.aiwf/templates/web-app/template/postcss.config.js +6 -0
- package/.aiwf/templates/web-app/template/public/vite.svg +1 -0
- package/.aiwf/templates/web-app/template/src/App.tsx +21 -0
- package/.aiwf/templates/web-app/template/src/components/Layout.tsx +57 -0
- package/.aiwf/templates/web-app/template/src/components/aiwf/ContextStatus.tsx +107 -0
- package/.aiwf/templates/web-app/template/src/components/aiwf/FeatureLedger.tsx +93 -0
- package/.aiwf/templates/web-app/template/src/components/aiwf/TokenUsage.tsx +71 -0
- package/.aiwf/templates/web-app/template/src/index.css +60 -0
- package/.aiwf/templates/web-app/template/src/main.tsx +10 -0
- package/.aiwf/templates/web-app/template/src/pages/AiwfDashboard.tsx +60 -0
- package/.aiwf/templates/web-app/template/src/pages/HomePage.tsx +89 -0
- package/.aiwf/templates/web-app/template/src/pages/NotFound.tsx +25 -0
- package/.aiwf/templates/web-app/template/src/stores/aiwfStore.ts +126 -0
- package/.aiwf/templates/web-app/template/src/types/global.d.ts +9 -0
- package/.aiwf/templates/web-app/template/src/vite-env.d.ts +1 -0
- package/.aiwf/templates/web-app/template/tailwind.config.js +30 -0
- package/.aiwf/templates/web-app/template/tsconfig.json +37 -0
- package/.aiwf/templates/web-app/template/tsconfig.node.json +10 -0
- package/.aiwf/templates/web-app/template/vite.config.ts +23 -0
- package/.aiwf/test-cache/86c7f9e80251abb8bedd58953ab0d1779e46b4f43ea33b63bffdb778106373b0.json +6 -0
- package/.aiwf/test-cache/9e252a90b80fce0585d7ed0646e7a9b4343e109f661f42a3ae678ba1ec5e22c7.json +7 -0
- package/.aiwf/test-results-s02.json +36 -0
- package/.aiwf/token-data/alerts.json +293 -0
- package/.aiwf/token-data/monitor-config.json +12 -0
- package/CHANGELOG.md +119 -33
- package/CHANGELOG_M02.md +52 -0
- package/CLAUDE.md +133 -199
- package/README.ko.md +5 -0
- package/README.md +31 -5
- package/RELEASE_NOTES_M02.md +177 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_create_feature_ledger.md +54 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_default_mode.md +66 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_docs.md +225 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_get_feature_details.md +78 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_link_feature_to_milestone.md +57 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_list_features.md +54 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_architect.md +60 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_backend.md +60 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_data_analyst.md +60 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_frontend.md +60 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_security.md +60 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_persona_status.md +72 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_switch_language.md +160 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_update_feature_status.md +53 -0
- package/claude-code/aiwf/en/commands/ai-persona.js +667 -0
- package/claude-code/aiwf/en/commands/compress-context.js +355 -0
- package/claude-code/aiwf/en/commands/feature-ledger.js +565 -0
- package/claude-code/aiwf/en/commands/feature_commit_report.js +370 -0
- package/claude-code/aiwf/en/commands/scan_git_history.js +234 -0
- package/claude-code/aiwf/en/commands/sync_feature_commits.js +154 -0
- package/claude-code/aiwf/en/commands/token-tracking.js +443 -0
- package/claude-code/aiwf/en/config/commit-patterns.js +103 -0
- package/claude-code/aiwf/en/hooks/install-hooks.sh +100 -0
- package/claude-code/aiwf/en/hooks/post-commit +84 -0
- package/claude-code/aiwf/en/tests/compression-test-suite.js +1252 -0
- package/claude-code/aiwf/en/tests/test-git-integration.js +164 -0
- package/claude-code/aiwf/en/tests/token-tracking.test.js +537 -0
- package/claude-code/aiwf/en/utils/compression-metrics.js +1031 -0
- package/claude-code/aiwf/en/utils/compression-strategies.js +557 -0
- package/claude-code/aiwf/en/utils/content-normalizer.js +455 -0
- package/claude-code/aiwf/en/utils/context-compressor.js +583 -0
- package/claude-code/aiwf/en/utils/feature-updater.js +271 -0
- package/claude-code/aiwf/en/utils/git-utils.js +220 -0
- package/claude-code/aiwf/en/utils/importance-classifier.js +645 -0
- package/claude-code/aiwf/en/utils/information-filter.js +710 -0
- package/claude-code/aiwf/en/utils/text-summarizer.js +487 -0
- package/claude-code/aiwf/en/utils/token-counter.js +177 -0
- package/claude-code/aiwf/en/utils/token-monitor.js +484 -0
- package/claude-code/aiwf/en/utils/token-reporter.js +453 -0
- package/claude-code/aiwf/en/utils/token-storage.js +433 -0
- package/claude-code/aiwf/en/utils/token-tracker.js +283 -0
- package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/FEATURE_ID_GENERATOR.md +138 -0
- package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/FEATURE_INDEX.md +186 -0
- package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/FEATURE_METADATA.md +240 -0
- package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/FEATURE_WORKFLOW.md +183 -0
- package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/README.md +94 -0
- 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
- 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
- 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
- package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/schemas/feature_schema.json +122 -0
- package/claude-code/aiwf/ko/.aiwf/06_FEATURE_LEDGERS/schemas/feature_validator.cjs +406 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_code_review.md +62 -62
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_commit.md +111 -111
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_aggressive_persona.md +53 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_context.md +116 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_minimal_persona.md +48 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_stats.md +79 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_compress_with_persona.md +51 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_create_feature_ledger.md +54 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_create_general_task.md +106 -106
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_create_milestone_plan.md +127 -127
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_create_sprint_tasks.md +130 -130
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_create_sprints_from_milestone.md +87 -87
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_default_mode.md +44 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_do_task.md +72 -72
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_docs.md +225 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_evaluate.md +92 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_get_feature_details.md +78 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_initialize.md +86 -86
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_issue_create.md +3 -3
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_link_feature_to_milestone.md +57 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_list_features.md +54 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_architect.md +48 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_backend.md +37 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_data_analyst.md +37 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_frontend.md +37 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_security.md +48 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_persona_status.md +50 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_pr_create.md +14 -14
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_prime.md +5 -5
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_project_review.md +39 -39
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_switch_language.md +160 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_test.md +76 -77
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_testing_review.md +120 -120
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_ultrathink_general.md +209 -266
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_update_docs_kr.md +25 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_update_feature_status.md +53 -0
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_yolo.md +226 -226
- package/claude-code/aiwf/ko/CLAUDE.md +76 -0
- package/claude-code/aiwf/ko/ai-tools/README.md +105 -0
- package/claude-code/aiwf/ko/ai-tools/augment/README.md +371 -0
- package/claude-code/aiwf/ko/ai-tools/augment/config.json +30 -0
- package/claude-code/aiwf/ko/ai-tools/augment/template/.augment/aiwf-integration.md +387 -0
- package/claude-code/aiwf/ko/ai-tools/augment/template/.augment/augment.yaml +347 -0
- package/claude-code/aiwf/ko/ai-tools/augment/template/augment.config.json +64 -0
- package/claude-code/aiwf/ko/ai-tools/claude-code/README.md +151 -0
- package/claude-code/aiwf/ko/ai-tools/claude-code/config.json +28 -0
- package/claude-code/aiwf/ko/ai-tools/claude-code/template/CLAUDE.md +91 -0
- package/claude-code/aiwf/ko/ai-tools/cursor/README.md +314 -0
- package/claude-code/aiwf/ko/ai-tools/cursor/config.json +29 -0
- package/claude-code/aiwf/ko/ai-tools/cursor/template/.cursorrules +362 -0
- package/claude-code/aiwf/ko/ai-tools/github-copilot/README.md +195 -0
- package/claude-code/aiwf/ko/ai-tools/github-copilot/config.json +24 -0
- package/claude-code/aiwf/ko/ai-tools/github-copilot/template/.github/copilot-instructions.md +202 -0
- package/claude-code/aiwf/ko/ai-tools/windsurf/README.md +355 -0
- package/claude-code/aiwf/ko/ai-tools/windsurf/config.json +29 -0
- package/claude-code/aiwf/ko/ai-tools/windsurf/template/.windsurf/aiwf-rules.md +260 -0
- package/claude-code/aiwf/ko/ai-tools/windsurf/template/.windsurf/windsurf.config.js +312 -0
- package/claude-code/aiwf/ko/ai-tools/windsurf/template/windsurf.config.json +63 -0
- package/claude-code/aiwf/ko/bin/aiwf-create.js +56 -0
- package/claude-code/aiwf/ko/bin/aiwf.js +21 -0
- package/claude-code/aiwf/ko/commands/ai-persona.js +602 -0
- package/claude-code/aiwf/ko/commands/compress-context.js +389 -0
- package/claude-code/aiwf/ko/commands/evaluate.js +246 -0
- package/claude-code/aiwf/ko/commands/feature-ledger.js +565 -0
- package/claude-code/aiwf/ko/commands/feature_commit_report.js +370 -0
- package/claude-code/aiwf/ko/commands/persona-context-apply.js +562 -0
- package/claude-code/aiwf/ko/commands/scan_git_history.js +234 -0
- package/claude-code/aiwf/ko/commands/sync_feature_commits.js +154 -0
- package/claude-code/aiwf/ko/commands/token-tracking.js +443 -0
- package/claude-code/aiwf/ko/config/commit-patterns.js +103 -0
- package/claude-code/aiwf/ko/config/language.json +6 -0
- package/claude-code/aiwf/ko/docs/00_PROJECT_MANIFEST.md +183 -0
- package/claude-code/aiwf/ko/docs/ARCHITECTURE.md +121 -0
- package/claude-code/aiwf/ko/docs/FEATURE_LEDGER_ADVANCED_USE_CASES.md +412 -0
- package/claude-code/aiwf/ko/docs/FEATURE_LEDGER_API_REFERENCE.md +361 -0
- package/claude-code/aiwf/ko/docs/FEATURE_LEDGER_COMMANDS_GUIDE.md +254 -0
- package/claude-code/aiwf/ko/docs/FEATURE_LEDGER_FAQ.md +365 -0
- package/claude-code/aiwf/ko/docs/FEATURE_LEDGER_SYSTEM_OVERVIEW.md +305 -0
- package/claude-code/aiwf/ko/docs/FEATURE_LEDGER_USER_GUIDE.md +416 -0
- 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
- package/claude-code/aiwf/ko/feature-ledger/FL-001-authentication.json +52 -0
- package/claude-code/aiwf/ko/feature-ledger/feature-index.json +20 -0
- package/claude-code/aiwf/ko/hooks/install-hooks.sh +100 -0
- package/claude-code/aiwf/ko/hooks/post-commit +84 -0
- package/claude-code/aiwf/ko/personas/PERSONA_INDEX.md +57 -0
- package/claude-code/aiwf/ko/personas/analyst.json +44 -0
- package/claude-code/aiwf/ko/personas/architect/best_practices.md +136 -0
- package/claude-code/aiwf/ko/personas/architect/knowledge_base.md +377 -0
- package/claude-code/aiwf/ko/personas/architect.json +44 -0
- package/claude-code/aiwf/ko/personas/backend/best_practices.md +766 -0
- package/claude-code/aiwf/ko/personas/backend/knowledge_base.md +1070 -0
- package/claude-code/aiwf/ko/personas/data_analyst/best_practices.md +594 -0
- package/claude-code/aiwf/ko/personas/data_analyst/knowledge_base.md +1057 -0
- package/claude-code/aiwf/ko/personas/developer.json +44 -0
- package/claude-code/aiwf/ko/personas/developer.md +37 -0
- package/claude-code/aiwf/ko/personas/evaluation_criteria.json +137 -0
- package/claude-code/aiwf/ko/personas/frontend/best_practices.md +445 -0
- package/claude-code/aiwf/ko/personas/frontend/knowledge_base.md +729 -0
- package/claude-code/aiwf/ko/personas/persona-index.json +31 -0
- package/claude-code/aiwf/ko/personas/reviewer.json +44 -0
- package/claude-code/aiwf/ko/personas/security/best_practices.md +307 -0
- package/claude-code/aiwf/ko/personas/security/knowledge_base.md +498 -0
- package/claude-code/aiwf/ko/personas/tester.json +44 -0
- package/claude-code/aiwf/ko/scripts/cache-templates.js +209 -0
- package/claude-code/aiwf/ko/scripts/create-offline.js +86 -0
- package/claude-code/aiwf/ko/scripts/create-project.js +151 -0
- package/claude-code/aiwf/ko/scripts/feature-progress-calculator.cjs +236 -0
- package/claude-code/aiwf/ko/scripts/git-integration.cjs +391 -0
- package/claude-code/aiwf/ko/scripts/install-git-hooks.cjs +226 -0
- package/claude-code/aiwf/ko/scripts/test-commit-parsing.cjs +125 -0
- package/claude-code/aiwf/ko/scripts/update-feature-status.cjs +198 -0
- package/claude-code/aiwf/ko/templates/README.md +78 -0
- package/claude-code/aiwf/ko/templates/api-server/config.json +64 -0
- package/claude-code/aiwf/ko/templates/api-server/template/.aiwf/config.json +56 -0
- package/claude-code/aiwf/ko/templates/api-server/template/.aiwf/feature-ledger.json +42 -0
- package/claude-code/aiwf/ko/templates/api-server/template/.aiwf/personas/backend-engineer.json +40 -0
- package/claude-code/aiwf/ko/templates/api-server/template/.aiwf/scripts/cli.js +111 -0
- package/claude-code/aiwf/ko/templates/api-server/template/.env.example +29 -0
- package/claude-code/aiwf/ko/templates/api-server/template/.eslintrc.json +23 -0
- package/claude-code/aiwf/ko/templates/api-server/template/README.md +171 -0
- package/claude-code/aiwf/ko/templates/api-server/template/jest.config.js +26 -0
- package/claude-code/aiwf/ko/templates/api-server/template/nodemon.json +9 -0
- package/claude-code/aiwf/ko/templates/api-server/template/package.json +61 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/app.ts +60 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/config/swagger.ts +38 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/controllers/aiwfController.ts +68 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/controllers/authController.ts +128 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/controllers/statusController.ts +28 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/index.ts +28 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/aiwfMiddleware.ts +50 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/authMiddleware.ts +41 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/errorHandler.ts +42 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/notFoundHandler.ts +14 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/middleware/requestLogger.ts +20 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/routes/aiwf.ts +42 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/routes/index.ts +13 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/routes/v1/index.ts +67 -0
- package/claude-code/aiwf/ko/templates/api-server/template/src/utils/logger.ts +37 -0
- package/claude-code/aiwf/ko/templates/api-server/template/tests/app.test.ts +40 -0
- package/claude-code/aiwf/ko/templates/api-server/template/tsconfig.json +43 -0
- package/claude-code/aiwf/ko/templates/npm-library/config.json +61 -0
- package/claude-code/aiwf/ko/templates/npm-library/template/LICENSE +21 -0
- package/claude-code/aiwf/ko/templates/npm-library/template/README.md +201 -0
- package/claude-code/aiwf/ko/templates/npm-library/template/package.json +78 -0
- package/claude-code/aiwf/ko/templates/web-app/config.json +53 -0
- package/claude-code/aiwf/ko/templates/web-app/template/.aiwf/config.json +54 -0
- package/claude-code/aiwf/ko/templates/web-app/template/.aiwf/feature-ledger.json +37 -0
- package/claude-code/aiwf/ko/templates/web-app/template/.aiwf/personas/fullstack-developer.json +40 -0
- package/claude-code/aiwf/ko/templates/web-app/template/.aiwf/scripts/cli.js +110 -0
- package/claude-code/aiwf/ko/templates/web-app/template/.eslintrc.cjs +20 -0
- package/claude-code/aiwf/ko/templates/web-app/template/README.md +151 -0
- package/claude-code/aiwf/ko/templates/web-app/template/index.html +14 -0
- package/claude-code/aiwf/ko/templates/web-app/template/package.json +44 -0
- package/claude-code/aiwf/ko/templates/web-app/template/postcss.config.js +6 -0
- package/claude-code/aiwf/ko/templates/web-app/template/public/vite.svg +1 -0
- package/claude-code/aiwf/ko/templates/web-app/template/src/App.tsx +21 -0
- package/claude-code/aiwf/ko/templates/web-app/template/src/components/Layout.tsx +57 -0
- package/claude-code/aiwf/ko/templates/web-app/template/src/components/aiwf/ContextStatus.tsx +107 -0
- package/claude-code/aiwf/ko/templates/web-app/template/src/components/aiwf/FeatureLedger.tsx +93 -0
- package/claude-code/aiwf/ko/templates/web-app/template/src/components/aiwf/TokenUsage.tsx +71 -0
- package/claude-code/aiwf/ko/templates/web-app/template/src/index.css +60 -0
- package/claude-code/aiwf/ko/templates/web-app/template/src/main.tsx +10 -0
- package/claude-code/aiwf/ko/templates/web-app/template/src/pages/AiwfDashboard.tsx +60 -0
- package/claude-code/aiwf/ko/templates/web-app/template/src/pages/HomePage.tsx +89 -0
- package/claude-code/aiwf/ko/templates/web-app/template/src/pages/NotFound.tsx +25 -0
- package/claude-code/aiwf/ko/templates/web-app/template/src/stores/aiwfStore.ts +126 -0
- package/claude-code/aiwf/ko/templates/web-app/template/src/types/global.d.ts +9 -0
- package/claude-code/aiwf/ko/templates/web-app/template/src/vite-env.d.ts +1 -0
- package/claude-code/aiwf/ko/templates/web-app/template/tailwind.config.js +30 -0
- package/claude-code/aiwf/ko/templates/web-app/template/tsconfig.json +37 -0
- package/claude-code/aiwf/ko/templates/web-app/template/tsconfig.node.json +10 -0
- package/claude-code/aiwf/ko/templates/web-app/template/vite.config.ts +23 -0
- package/claude-code/aiwf/ko/tests/compression-test-suite.js +1252 -0
- package/claude-code/aiwf/ko/tests/test-git-integration.js +164 -0
- package/claude-code/aiwf/ko/tests/token-tracking.test.js +537 -0
- package/claude-code/aiwf/ko/token-data/alerts.json +293 -0
- package/claude-code/aiwf/ko/token-data/monitor-config.json +12 -0
- package/claude-code/aiwf/ko/utils/background-monitor.js +223 -0
- package/claude-code/aiwf/ko/utils/compression-metrics.js +1031 -0
- package/claude-code/aiwf/ko/utils/compression-strategies.js +557 -0
- package/claude-code/aiwf/ko/utils/content-normalizer.js +455 -0
- package/claude-code/aiwf/ko/utils/context-compressor.js +583 -0
- package/claude-code/aiwf/ko/utils/context-rule-parser.js +180 -0
- package/claude-code/aiwf/ko/utils/context-token-monitor.js +463 -0
- package/claude-code/aiwf/ko/utils/context-update-manager.js +502 -0
- package/claude-code/aiwf/ko/utils/feature-updater.js +271 -0
- package/claude-code/aiwf/ko/utils/git-utils.js +220 -0
- package/claude-code/aiwf/ko/utils/importance-classifier.js +645 -0
- package/claude-code/aiwf/ko/utils/information-filter.js +710 -0
- package/claude-code/aiwf/ko/utils/persona-aware-compressor.js +598 -0
- package/claude-code/aiwf/ko/utils/prompt-injector.js +242 -0
- package/claude-code/aiwf/ko/utils/simplified-evaluator.js +119 -0
- package/claude-code/aiwf/ko/utils/text-summarizer.js +492 -0
- package/claude-code/aiwf/ko/utils/token-counter.js +177 -0
- package/claude-code/aiwf/ko/utils/token-monitor.js +484 -0
- package/claude-code/aiwf/ko/utils/token-reporter.js +453 -0
- package/claude-code/aiwf/ko/utils/token-storage.js +433 -0
- package/claude-code/aiwf/ko/utils/token-tracker.js +283 -0
- package/docs/AI-WORKFLOW.ko.md +9 -2
- package/docs/AI-WORKFLOW.md +9 -2
- package/docs/AI_PERSONA_SYSTEM_DESIGN.md +516 -0
- package/docs/API_DOCUMENTATION.md +932 -0
- package/docs/API_REFERENCE.md +979 -0
- package/docs/COMMANDS_GUIDE.ko.md +101 -5
- package/docs/COMMANDS_GUIDE.md +289 -5
- package/docs/CONTRIBUTING.ko.md +408 -0
- package/docs/CONTRIBUTING.md +205 -203
- package/docs/EXAMPLES.md +691 -0
- package/docs/Enhanced_Installation_Flow_Design.md +498 -0
- package/docs/GETTING_STARTED.md +480 -0
- package/docs/PERFORMANCE_ARCHITECTURE.md +494 -0
- package/docs/PERFORMANCE_GUIDELINES.md +553 -0
- package/docs/PRD.ko.md +110 -58
- package/docs/PRD.md +110 -58
- package/docs/TROUBLESHOOTING.md +721 -0
- package/docs/git-feature-integration-guide.md +253 -0
- package/docs/guides/ai-personas-guide-ko.md +239 -0
- package/docs/guides/ai-personas-guide.md +239 -0
- package/docs/guides/context-compression-guide-ko.md +313 -0
- package/docs/guides/context-compression-guide.md +313 -0
- package/docs/guides/feature-git-integration-guide-ko.md +481 -0
- package/docs/guides/feature-git-integration-guide.md +481 -0
- package/docs/lightweight-evaluation.md +198 -0
- package/docs/m02-dod-checklist.md +125 -0
- package/docs/m02-gap-analysis.md +214 -0
- package/docs/m02-milestone-completion-report.md +186 -0
- package/docs/m02-milestone-executive-summary.md +68 -0
- package/docs/offline-template-cache.md +323 -0
- package/docs/performance-benchmark-report.md +159 -0
- package/docs/persona-aware-compression.md +168 -0
- package/docs/reports/S02-sprint-report.md +190 -0
- package/docs/usability-test-report.md +170 -0
- package/index.js +1349 -21
- package/jest.config.js +23 -0
- package/language-cli.js +279 -0
- package/language-utils.js +330 -0
- package/lib/ai-persona-manager.js +711 -0
- package/lib/cache-cli.js +459 -0
- package/lib/cache-integration.js +401 -0
- package/lib/cache-system.js +332 -0
- package/lib/context-engine.js +568 -0
- package/lib/file-batch-processor.js +401 -0
- package/lib/memory-profiler.js +471 -0
- package/lib/metrics-collector.js +885 -0
- package/lib/offline-detector.js +386 -0
- package/lib/performance-benchmark.js +621 -0
- package/lib/task-analyzer.js +599 -0
- package/lib/template-cache-system.js +559 -0
- package/lib/template-downloader.js +467 -0
- package/lib/template-manager.js +310 -0
- package/lib/template-version-manager.js +491 -0
- package/lib/token-optimizer.js +517 -0
- package/package.json +17 -6
- package/scripts/run-integration-tests.js +317 -0
- package/scripts/validate-commands.cjs +338 -0
- package/scripts/validate-commands.js +254 -0
- package/src/commands/ai-tool.js +383 -0
- package/test-token-system.js +88 -0
- package/tests/application.test.js +260 -0
- package/tests/basic.test.js +62 -0
- package/tests/commands.test.js +127 -0
- package/tests/installer.test.js +129 -0
- package/tests/integration/ai-persona-system.test.js +396 -0
- package/tests/integration/ai-persona.test.js +390 -0
- package/tests/integration/command-integration.test.js +600 -0
- package/tests/integration/context-compression.test.js +361 -0
- package/tests/integration/feature-ledger.test.js +226 -0
- package/tests/integration/git-integration.test.js +307 -0
- package/tests/integration/m02-milestone.test.js +420 -0
- package/tests/integration/persona-context-application.test.js +508 -0
- package/tests/integration/setup.js +174 -0
- package/tests/integration/test-persona-aware-compression.js +93 -0
- package/tests/language-utils.test.js +287 -0
- package/tests/s02-integration.test.js +422 -0
- package/tests/unit/ai-persona-manager.test.js +514 -0
- package/claude-code/aiwf/en/.claude/commands/aiwf/aiwf_prime_context.md +0 -5
- package/claude-code/aiwf/ko/.claude/commands/aiwf/aiwf_prime_context.md +0 -8
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
# Backend Knowledge Base
|
|
2
|
+
|
|
3
|
+
## Technology Stack Reference
|
|
4
|
+
|
|
5
|
+
### 1. Node.js Backend
|
|
6
|
+
```javascript
|
|
7
|
+
// Express.js Application Structure
|
|
8
|
+
const express = require('express');
|
|
9
|
+
const helmet = require('helmet');
|
|
10
|
+
const cors = require('cors');
|
|
11
|
+
const rateLimit = require('express-rate-limit');
|
|
12
|
+
|
|
13
|
+
const app = express();
|
|
14
|
+
|
|
15
|
+
// Security middleware
|
|
16
|
+
app.use(helmet());
|
|
17
|
+
app.use(cors());
|
|
18
|
+
|
|
19
|
+
// Rate limiting
|
|
20
|
+
const limiter = rateLimit({
|
|
21
|
+
windowMs: 15 * 60 * 1000, // 15 minutes
|
|
22
|
+
max: 100 // limit each IP to 100 requests per windowMs
|
|
23
|
+
});
|
|
24
|
+
app.use(limiter);
|
|
25
|
+
|
|
26
|
+
// Body parsing
|
|
27
|
+
app.use(express.json({ limit: '10mb' }));
|
|
28
|
+
app.use(express.urlencoded({ extended: true }));
|
|
29
|
+
|
|
30
|
+
// Routes
|
|
31
|
+
app.use('/api/users', require('./routes/users'));
|
|
32
|
+
app.use('/api/orders', require('./routes/orders'));
|
|
33
|
+
|
|
34
|
+
// Error handling
|
|
35
|
+
app.use((err, req, res, next) => {
|
|
36
|
+
console.error(err.stack);
|
|
37
|
+
res.status(500).json({ error: 'Something went wrong!' });
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
module.exports = app;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Python FastAPI
|
|
44
|
+
```python
|
|
45
|
+
from fastapi import FastAPI, HTTPException, Depends
|
|
46
|
+
from pydantic import BaseModel
|
|
47
|
+
from typing import Optional
|
|
48
|
+
import uvicorn
|
|
49
|
+
|
|
50
|
+
app = FastAPI(title="My API", version="1.0.0")
|
|
51
|
+
|
|
52
|
+
class UserCreate(BaseModel):
|
|
53
|
+
email: str
|
|
54
|
+
password: str
|
|
55
|
+
name: Optional[str] = None
|
|
56
|
+
|
|
57
|
+
class User(BaseModel):
|
|
58
|
+
id: int
|
|
59
|
+
email: str
|
|
60
|
+
name: Optional[str] = None
|
|
61
|
+
|
|
62
|
+
class Config:
|
|
63
|
+
orm_mode = True
|
|
64
|
+
|
|
65
|
+
@app.post("/users/", response_model=User)
|
|
66
|
+
async def create_user(user: UserCreate):
|
|
67
|
+
# Database logic here
|
|
68
|
+
return {"id": 1, "email": user.email, "name": user.name}
|
|
69
|
+
|
|
70
|
+
@app.get("/users/{user_id}", response_model=User)
|
|
71
|
+
async def get_user(user_id: int):
|
|
72
|
+
# Database logic here
|
|
73
|
+
if user_id not in users_db:
|
|
74
|
+
raise HTTPException(status_code=404, detail="User not found")
|
|
75
|
+
return users_db[user_id]
|
|
76
|
+
|
|
77
|
+
if __name__ == "__main__":
|
|
78
|
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 3. Java Spring Boot
|
|
82
|
+
```java
|
|
83
|
+
@RestController
|
|
84
|
+
@RequestMapping("/api/users")
|
|
85
|
+
public class UserController {
|
|
86
|
+
|
|
87
|
+
@Autowired
|
|
88
|
+
private UserService userService;
|
|
89
|
+
|
|
90
|
+
@PostMapping
|
|
91
|
+
public ResponseEntity<User> createUser(@RequestBody @Valid UserCreateRequest request) {
|
|
92
|
+
User user = userService.createUser(request);
|
|
93
|
+
return ResponseEntity.status(HttpStatus.CREATED).body(user);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@GetMapping("/{id}")
|
|
97
|
+
public ResponseEntity<User> getUser(@PathVariable Long id) {
|
|
98
|
+
User user = userService.findById(id);
|
|
99
|
+
if (user == null) {
|
|
100
|
+
return ResponseEntity.notFound().build();
|
|
101
|
+
}
|
|
102
|
+
return ResponseEntity.ok(user);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@ExceptionHandler(ValidationException.class)
|
|
106
|
+
public ResponseEntity<ErrorResponse> handleValidation(ValidationException e) {
|
|
107
|
+
ErrorResponse error = new ErrorResponse("VALIDATION_ERROR", e.getMessage());
|
|
108
|
+
return ResponseEntity.badRequest().body(error);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Database Patterns
|
|
114
|
+
|
|
115
|
+
### 1. Repository Pattern
|
|
116
|
+
```javascript
|
|
117
|
+
// User Repository
|
|
118
|
+
class UserRepository {
|
|
119
|
+
constructor(database) {
|
|
120
|
+
this.db = database;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async findById(id) {
|
|
124
|
+
const query = 'SELECT * FROM users WHERE id = $1';
|
|
125
|
+
const result = await this.db.query(query, [id]);
|
|
126
|
+
return result.rows[0];
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async findByEmail(email) {
|
|
130
|
+
const query = 'SELECT * FROM users WHERE email = $1';
|
|
131
|
+
const result = await this.db.query(query, [email]);
|
|
132
|
+
return result.rows[0];
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async create(userData) {
|
|
136
|
+
const { email, password_hash, name } = userData;
|
|
137
|
+
const query = `
|
|
138
|
+
INSERT INTO users (email, password_hash, name)
|
|
139
|
+
VALUES ($1, $2, $3)
|
|
140
|
+
RETURNING *
|
|
141
|
+
`;
|
|
142
|
+
const result = await this.db.query(query, [email, password_hash, name]);
|
|
143
|
+
return result.rows[0];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async update(id, userData) {
|
|
147
|
+
const fields = Object.keys(userData);
|
|
148
|
+
const values = Object.values(userData);
|
|
149
|
+
const setClause = fields.map((field, index) => `${field} = $${index + 2}`).join(', ');
|
|
150
|
+
|
|
151
|
+
const query = `
|
|
152
|
+
UPDATE users
|
|
153
|
+
SET ${setClause}, updated_at = NOW()
|
|
154
|
+
WHERE id = $1
|
|
155
|
+
RETURNING *
|
|
156
|
+
`;
|
|
157
|
+
const result = await this.db.query(query, [id, ...values]);
|
|
158
|
+
return result.rows[0];
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async delete(id) {
|
|
162
|
+
const query = 'DELETE FROM users WHERE id = $1 RETURNING *';
|
|
163
|
+
const result = await this.db.query(query, [id]);
|
|
164
|
+
return result.rows[0];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 2. Active Record Pattern
|
|
170
|
+
```javascript
|
|
171
|
+
// User Model with Active Record
|
|
172
|
+
class User extends Model {
|
|
173
|
+
static get tableName() {
|
|
174
|
+
return 'users';
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
static get jsonSchema() {
|
|
178
|
+
return {
|
|
179
|
+
type: 'object',
|
|
180
|
+
required: ['email', 'password_hash'],
|
|
181
|
+
properties: {
|
|
182
|
+
id: { type: 'integer' },
|
|
183
|
+
email: { type: 'string', format: 'email' },
|
|
184
|
+
password_hash: { type: 'string' },
|
|
185
|
+
name: { type: 'string' },
|
|
186
|
+
created_at: { type: 'string', format: 'date-time' },
|
|
187
|
+
updated_at: { type: 'string', format: 'date-time' }
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async $beforeInsert() {
|
|
193
|
+
this.created_at = new Date().toISOString();
|
|
194
|
+
this.updated_at = new Date().toISOString();
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
async $beforeUpdate() {
|
|
198
|
+
this.updated_at = new Date().toISOString();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
static get relationMappings() {
|
|
202
|
+
return {
|
|
203
|
+
orders: {
|
|
204
|
+
relation: Model.HasManyRelation,
|
|
205
|
+
modelClass: Order,
|
|
206
|
+
join: {
|
|
207
|
+
from: 'users.id',
|
|
208
|
+
to: 'orders.user_id'
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## API Documentation
|
|
217
|
+
|
|
218
|
+
### 1. OpenAPI Specification
|
|
219
|
+
```yaml
|
|
220
|
+
openapi: 3.0.0
|
|
221
|
+
info:
|
|
222
|
+
title: User Management API
|
|
223
|
+
version: 1.0.0
|
|
224
|
+
description: API for managing users
|
|
225
|
+
|
|
226
|
+
paths:
|
|
227
|
+
/users:
|
|
228
|
+
post:
|
|
229
|
+
summary: Create a new user
|
|
230
|
+
requestBody:
|
|
231
|
+
required: true
|
|
232
|
+
content:
|
|
233
|
+
application/json:
|
|
234
|
+
schema:
|
|
235
|
+
$ref: '#/components/schemas/UserCreate'
|
|
236
|
+
responses:
|
|
237
|
+
'201':
|
|
238
|
+
description: User created successfully
|
|
239
|
+
content:
|
|
240
|
+
application/json:
|
|
241
|
+
schema:
|
|
242
|
+
$ref: '#/components/schemas/User'
|
|
243
|
+
'400':
|
|
244
|
+
description: Invalid input
|
|
245
|
+
content:
|
|
246
|
+
application/json:
|
|
247
|
+
schema:
|
|
248
|
+
$ref: '#/components/schemas/Error'
|
|
249
|
+
|
|
250
|
+
/users/{id}:
|
|
251
|
+
get:
|
|
252
|
+
summary: Get user by ID
|
|
253
|
+
parameters:
|
|
254
|
+
- name: id
|
|
255
|
+
in: path
|
|
256
|
+
required: true
|
|
257
|
+
schema:
|
|
258
|
+
type: integer
|
|
259
|
+
responses:
|
|
260
|
+
'200':
|
|
261
|
+
description: User found
|
|
262
|
+
content:
|
|
263
|
+
application/json:
|
|
264
|
+
schema:
|
|
265
|
+
$ref: '#/components/schemas/User'
|
|
266
|
+
'404':
|
|
267
|
+
description: User not found
|
|
268
|
+
|
|
269
|
+
components:
|
|
270
|
+
schemas:
|
|
271
|
+
User:
|
|
272
|
+
type: object
|
|
273
|
+
properties:
|
|
274
|
+
id:
|
|
275
|
+
type: integer
|
|
276
|
+
email:
|
|
277
|
+
type: string
|
|
278
|
+
format: email
|
|
279
|
+
name:
|
|
280
|
+
type: string
|
|
281
|
+
created_at:
|
|
282
|
+
type: string
|
|
283
|
+
format: date-time
|
|
284
|
+
|
|
285
|
+
UserCreate:
|
|
286
|
+
type: object
|
|
287
|
+
required:
|
|
288
|
+
- email
|
|
289
|
+
- password
|
|
290
|
+
properties:
|
|
291
|
+
email:
|
|
292
|
+
type: string
|
|
293
|
+
format: email
|
|
294
|
+
password:
|
|
295
|
+
type: string
|
|
296
|
+
minLength: 8
|
|
297
|
+
name:
|
|
298
|
+
type: string
|
|
299
|
+
|
|
300
|
+
Error:
|
|
301
|
+
type: object
|
|
302
|
+
properties:
|
|
303
|
+
code:
|
|
304
|
+
type: string
|
|
305
|
+
message:
|
|
306
|
+
type: string
|
|
307
|
+
details:
|
|
308
|
+
type: array
|
|
309
|
+
items:
|
|
310
|
+
type: object
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Message Queue Patterns
|
|
314
|
+
|
|
315
|
+
### 1. Redis Queue
|
|
316
|
+
```javascript
|
|
317
|
+
const Queue = require('bull');
|
|
318
|
+
const redis = require('redis');
|
|
319
|
+
|
|
320
|
+
// Create queue
|
|
321
|
+
const emailQueue = new Queue('email processing', {
|
|
322
|
+
redis: {
|
|
323
|
+
host: 'localhost',
|
|
324
|
+
port: 6379
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
// Producer - Add jobs to queue
|
|
329
|
+
const sendWelcomeEmail = async (userId) => {
|
|
330
|
+
await emailQueue.add('send-welcome-email', {
|
|
331
|
+
userId,
|
|
332
|
+
template: 'welcome'
|
|
333
|
+
}, {
|
|
334
|
+
delay: 5000, // 5 second delay
|
|
335
|
+
attempts: 3,
|
|
336
|
+
backoff: 'exponential'
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
// Consumer - Process jobs
|
|
341
|
+
emailQueue.process('send-welcome-email', async (job) => {
|
|
342
|
+
const { userId, template } = job.data;
|
|
343
|
+
|
|
344
|
+
try {
|
|
345
|
+
const user = await getUserById(userId);
|
|
346
|
+
await emailService.send(user.email, template);
|
|
347
|
+
|
|
348
|
+
job.progress(100);
|
|
349
|
+
} catch (error) {
|
|
350
|
+
throw new Error(`Failed to send email: ${error.message}`);
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
// Event handlers
|
|
355
|
+
emailQueue.on('completed', (job) => {
|
|
356
|
+
console.log(`Job ${job.id} completed`);
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
emailQueue.on('failed', (job, err) => {
|
|
360
|
+
console.error(`Job ${job.id} failed: ${err.message}`);
|
|
361
|
+
});
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### 2. RabbitMQ
|
|
365
|
+
```javascript
|
|
366
|
+
const amqp = require('amqplib');
|
|
367
|
+
|
|
368
|
+
class RabbitMQService {
|
|
369
|
+
constructor() {
|
|
370
|
+
this.connection = null;
|
|
371
|
+
this.channel = null;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
async connect() {
|
|
375
|
+
this.connection = await amqp.connect('amqp://localhost');
|
|
376
|
+
this.channel = await this.connection.createChannel();
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
async publishToQueue(queue, message) {
|
|
380
|
+
await this.channel.assertQueue(queue, { durable: true });
|
|
381
|
+
|
|
382
|
+
const buffer = Buffer.from(JSON.stringify(message));
|
|
383
|
+
await this.channel.sendToQueue(queue, buffer, { persistent: true });
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
async consumeFromQueue(queue, callback) {
|
|
387
|
+
await this.channel.assertQueue(queue, { durable: true });
|
|
388
|
+
await this.channel.prefetch(1);
|
|
389
|
+
|
|
390
|
+
await this.channel.consume(queue, async (msg) => {
|
|
391
|
+
if (msg) {
|
|
392
|
+
try {
|
|
393
|
+
const content = JSON.parse(msg.content.toString());
|
|
394
|
+
await callback(content);
|
|
395
|
+
this.channel.ack(msg);
|
|
396
|
+
} catch (error) {
|
|
397
|
+
console.error('Error processing message:', error);
|
|
398
|
+
this.channel.nack(msg, false, false);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
## Caching Strategies
|
|
407
|
+
|
|
408
|
+
### 1. Redis Caching
|
|
409
|
+
```javascript
|
|
410
|
+
const redis = require('redis');
|
|
411
|
+
const client = redis.createClient();
|
|
412
|
+
|
|
413
|
+
// Cache aside pattern
|
|
414
|
+
const getUserFromCache = async (userId) => {
|
|
415
|
+
const cacheKey = `user:${userId}`;
|
|
416
|
+
const cached = await client.get(cacheKey);
|
|
417
|
+
|
|
418
|
+
if (cached) {
|
|
419
|
+
return JSON.parse(cached);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// Fetch from database
|
|
423
|
+
const user = await db.query('SELECT * FROM users WHERE id = $1', [userId]);
|
|
424
|
+
|
|
425
|
+
// Cache for 1 hour
|
|
426
|
+
await client.setex(cacheKey, 3600, JSON.stringify(user));
|
|
427
|
+
|
|
428
|
+
return user;
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
// Cache invalidation
|
|
432
|
+
const invalidateUserCache = async (userId) => {
|
|
433
|
+
const cacheKey = `user:${userId}`;
|
|
434
|
+
await client.del(cacheKey);
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
// Write-through cache
|
|
438
|
+
const updateUser = async (userId, userData) => {
|
|
439
|
+
const user = await db.query(
|
|
440
|
+
'UPDATE users SET name = $1, updated_at = NOW() WHERE id = $2 RETURNING *',
|
|
441
|
+
[userData.name, userId]
|
|
442
|
+
);
|
|
443
|
+
|
|
444
|
+
// Update cache
|
|
445
|
+
const cacheKey = `user:${userId}`;
|
|
446
|
+
await client.setex(cacheKey, 3600, JSON.stringify(user));
|
|
447
|
+
|
|
448
|
+
return user;
|
|
449
|
+
};
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### 2. Application-Level Caching
|
|
453
|
+
```javascript
|
|
454
|
+
const NodeCache = require('node-cache');
|
|
455
|
+
const cache = new NodeCache({ stdTTL: 600 }); // 10 minutes default TTL
|
|
456
|
+
|
|
457
|
+
// Memory cache with TTL
|
|
458
|
+
const getCachedData = (key) => {
|
|
459
|
+
return cache.get(key);
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
const setCachedData = (key, data, ttl = 600) => {
|
|
463
|
+
cache.set(key, data, ttl);
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
// Cache with callback
|
|
467
|
+
const getOrSetCache = async (key, callback, ttl = 600) => {
|
|
468
|
+
let data = cache.get(key);
|
|
469
|
+
|
|
470
|
+
if (!data) {
|
|
471
|
+
data = await callback();
|
|
472
|
+
cache.set(key, data, ttl);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
return data;
|
|
476
|
+
};
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
## Performance Monitoring
|
|
480
|
+
|
|
481
|
+
### 1. Application Metrics
|
|
482
|
+
```javascript
|
|
483
|
+
const promClient = require('prom-client');
|
|
484
|
+
|
|
485
|
+
// Create metrics
|
|
486
|
+
const httpRequestDuration = new promClient.Histogram({
|
|
487
|
+
name: 'http_request_duration_seconds',
|
|
488
|
+
help: 'Duration of HTTP requests in seconds',
|
|
489
|
+
labelNames: ['method', 'route', 'status_code']
|
|
490
|
+
});
|
|
491
|
+
|
|
492
|
+
const httpRequestsTotal = new promClient.Counter({
|
|
493
|
+
name: 'http_requests_total',
|
|
494
|
+
help: 'Total number of HTTP requests',
|
|
495
|
+
labelNames: ['method', 'route', 'status_code']
|
|
496
|
+
});
|
|
497
|
+
|
|
498
|
+
// Middleware to track metrics
|
|
499
|
+
const metricsMiddleware = (req, res, next) => {
|
|
500
|
+
const start = Date.now();
|
|
501
|
+
|
|
502
|
+
res.on('finish', () => {
|
|
503
|
+
const duration = (Date.now() - start) / 1000;
|
|
504
|
+
const labels = {
|
|
505
|
+
method: req.method,
|
|
506
|
+
route: req.route?.path || req.path,
|
|
507
|
+
status_code: res.statusCode
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
httpRequestDuration.labels(labels).observe(duration);
|
|
511
|
+
httpRequestsTotal.labels(labels).inc();
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
next();
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
// Metrics endpoint
|
|
518
|
+
app.get('/metrics', (req, res) => {
|
|
519
|
+
res.set('Content-Type', promClient.register.contentType);
|
|
520
|
+
res.end(promClient.register.metrics());
|
|
521
|
+
});
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
### 2. Database Query Monitoring
|
|
525
|
+
```javascript
|
|
526
|
+
const { Pool } = require('pg');
|
|
527
|
+
|
|
528
|
+
class MonitoredPool extends Pool {
|
|
529
|
+
async query(text, params) {
|
|
530
|
+
const start = Date.now();
|
|
531
|
+
|
|
532
|
+
try {
|
|
533
|
+
const result = await super.query(text, params);
|
|
534
|
+
const duration = Date.now() - start;
|
|
535
|
+
|
|
536
|
+
// Log slow queries
|
|
537
|
+
if (duration > 1000) {
|
|
538
|
+
console.warn(`Slow query (${duration}ms):`, text);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
return result;
|
|
542
|
+
} catch (error) {
|
|
543
|
+
console.error('Database query error:', error);
|
|
544
|
+
throw error;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
const pool = new MonitoredPool({
|
|
550
|
+
host: process.env.DB_HOST,
|
|
551
|
+
port: process.env.DB_PORT,
|
|
552
|
+
database: process.env.DB_NAME,
|
|
553
|
+
user: process.env.DB_USER,
|
|
554
|
+
password: process.env.DB_PASSWORD
|
|
555
|
+
});
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
## Common Patterns and Solutions
|
|
559
|
+
|
|
560
|
+
### 1. Circuit Breaker Pattern
|
|
561
|
+
```javascript
|
|
562
|
+
class CircuitBreaker {
|
|
563
|
+
constructor(threshold = 5, timeout = 60000) {
|
|
564
|
+
this.threshold = threshold;
|
|
565
|
+
this.timeout = timeout;
|
|
566
|
+
this.failures = 0;
|
|
567
|
+
this.state = 'CLOSED'; // CLOSED, OPEN, HALF_OPEN
|
|
568
|
+
this.nextAttempt = Date.now();
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
async execute(fn) {
|
|
572
|
+
if (this.state === 'OPEN') {
|
|
573
|
+
if (Date.now() < this.nextAttempt) {
|
|
574
|
+
throw new Error('Circuit breaker is OPEN');
|
|
575
|
+
}
|
|
576
|
+
this.state = 'HALF_OPEN';
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
try {
|
|
580
|
+
const result = await fn();
|
|
581
|
+
this.reset();
|
|
582
|
+
return result;
|
|
583
|
+
} catch (error) {
|
|
584
|
+
this.recordFailure();
|
|
585
|
+
throw error;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
recordFailure() {
|
|
590
|
+
this.failures++;
|
|
591
|
+
if (this.failures >= this.threshold) {
|
|
592
|
+
this.state = 'OPEN';
|
|
593
|
+
this.nextAttempt = Date.now() + this.timeout;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
reset() {
|
|
598
|
+
this.failures = 0;
|
|
599
|
+
this.state = 'CLOSED';
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
### 2. Retry Pattern
|
|
605
|
+
```javascript
|
|
606
|
+
const retry = async (fn, maxRetries = 3, delay = 1000) => {
|
|
607
|
+
for (let i = 0; i < maxRetries; i++) {
|
|
608
|
+
try {
|
|
609
|
+
return await fn();
|
|
610
|
+
} catch (error) {
|
|
611
|
+
if (i === maxRetries - 1) throw error;
|
|
612
|
+
|
|
613
|
+
// Exponential backoff
|
|
614
|
+
await new Promise(resolve => setTimeout(resolve, delay * Math.pow(2, i)));
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
// Usage
|
|
620
|
+
const result = await retry(async () => {
|
|
621
|
+
return await externalAPICall();
|
|
622
|
+
}, 3, 1000);
|
|
623
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Data Analyst Best Practices
|
|
2
|
+
|
|
3
|
+
## Data Processing
|
|
4
|
+
- ETL pipeline design
|
|
5
|
+
- Data validation and cleaning
|
|
6
|
+
- Schema design and normalization
|
|
7
|
+
- Data versioning and lineage
|
|
8
|
+
|
|
9
|
+
## Statistical Analysis
|
|
10
|
+
- Descriptive statistics
|
|
11
|
+
- Hypothesis testing
|
|
12
|
+
- Regression analysis
|
|
13
|
+
- Time series analysis
|
|
14
|
+
|
|
15
|
+
## Machine Learning
|
|
16
|
+
- Feature engineering
|
|
17
|
+
- Model selection and validation
|
|
18
|
+
- Cross-validation techniques
|
|
19
|
+
- Model deployment strategies
|
|
20
|
+
|
|
21
|
+
## Visualization
|
|
22
|
+
- Exploratory data analysis
|
|
23
|
+
- Dashboard design
|
|
24
|
+
- Interactive visualizations
|
|
25
|
+
- Storytelling with data
|
|
26
|
+
|
|
27
|
+
## Tools and Technologies
|
|
28
|
+
- Python (pandas, numpy, scikit-learn)
|
|
29
|
+
- R for statistical analysis
|
|
30
|
+
- SQL for data querying
|
|
31
|
+
- Tableau/Power BI for visualization
|
|
32
|
+
- Apache Spark for big data
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Data Analyst Context Rules
|
|
2
|
+
|
|
3
|
+
## Persona Configuration
|
|
4
|
+
```yaml
|
|
5
|
+
persona: data_analyst
|
|
6
|
+
focus:
|
|
7
|
+
- data_pipelines
|
|
8
|
+
- statistical_analysis
|
|
9
|
+
- machine_learning
|
|
10
|
+
- visualization
|
|
11
|
+
- etl_processes
|
|
12
|
+
priorities:
|
|
13
|
+
- accuracy: critical
|
|
14
|
+
- insights: high
|
|
15
|
+
- performance: medium
|
|
16
|
+
- automation: medium
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Core Principles
|
|
20
|
+
- **Data Quality First**: Ensure data accuracy and completeness
|
|
21
|
+
- **Statistical Rigor**: Use appropriate statistical methods
|
|
22
|
+
- **Reproducible Analysis**: Document all analysis steps
|
|
23
|
+
- **Visual Storytelling**: Create meaningful visualizations
|
|
24
|
+
- **Scalable Solutions**: Design for data growth
|
|
25
|
+
|
|
26
|
+
## Behavioral Guidelines
|
|
27
|
+
- Focus on data quality and validation
|
|
28
|
+
- Use appropriate statistical methods
|
|
29
|
+
- Create clear visualizations
|
|
30
|
+
- Document analysis methodology
|
|
31
|
+
- Consider data privacy and ethics
|
|
32
|
+
|
|
33
|
+
## Constraints
|
|
34
|
+
- Never ignore data quality issues
|
|
35
|
+
- Don't draw conclusions without proper statistical backing
|
|
36
|
+
- Avoid overfitting models
|
|
37
|
+
- Don't compromise on data privacy
|
|
38
|
+
|
|
39
|
+
## Response Patterns
|
|
40
|
+
- Provide statistical backing for recommendations
|
|
41
|
+
- Include visualization examples
|
|
42
|
+
- Reference data science best practices
|
|
43
|
+
- Consider data pipeline architecture
|