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,235 @@
|
|
|
1
|
+
# Architect Knowledge Base
|
|
2
|
+
|
|
3
|
+
## Architecture Patterns Reference
|
|
4
|
+
|
|
5
|
+
### 1. Microservices Architecture
|
|
6
|
+
```
|
|
7
|
+
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
|
|
8
|
+
│ User Service │ │ Order Service │ │Product Service │
|
|
9
|
+
│ │ │ │ │ │
|
|
10
|
+
│ ┌───────────┐ │ │ ┌───────────┐ │ │ ┌───────────┐ │
|
|
11
|
+
│ │ API │ │ │ │ API │ │ │ │ API │ │
|
|
12
|
+
│ └───────────┘ │ │ └───────────┘ │ │ └───────────┘ │
|
|
13
|
+
│ ┌───────────┐ │ │ ┌───────────┐ │ │ ┌───────────┐ │
|
|
14
|
+
│ │ Database │ │ │ │ Database │ │ │ │ Database │ │
|
|
15
|
+
│ └───────────┘ │ │ └───────────┘ │ │ └───────────┘ │
|
|
16
|
+
└─────────────────┘ └─────────────────┘ └─────────────────┘
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Use Cases**:
|
|
20
|
+
- Large, complex applications
|
|
21
|
+
- Independent team development
|
|
22
|
+
- Different technology stacks per service
|
|
23
|
+
- High scalability requirements
|
|
24
|
+
|
|
25
|
+
### 2. Hexagonal Architecture
|
|
26
|
+
```
|
|
27
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
28
|
+
│ Adapters (Ports) │
|
|
29
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
30
|
+
│ │ Web │ │ API │ │ CLI │ │
|
|
31
|
+
│ │ Interface │ │ Interface │ │ Interface │ │
|
|
32
|
+
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
33
|
+
│ │ │ │ │
|
|
34
|
+
│ ┌─────────────────────────────────────────────────────────┐ │
|
|
35
|
+
│ │ Application Core │ │
|
|
36
|
+
│ │ ┌─────────────────────────────────────────────────┐ │ │
|
|
37
|
+
│ │ │ Business Logic │ │ │
|
|
38
|
+
│ │ └─────────────────────────────────────────────────┘ │ │
|
|
39
|
+
│ │ │ │
|
|
40
|
+
│ └─────────────────────────────────────────────────────────┘ │
|
|
41
|
+
│ │ │ │ │
|
|
42
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
43
|
+
│ │ Database │ │ External │ │ Message │ │
|
|
44
|
+
│ │ Adapter │ │ Service │ │ Queue │ │
|
|
45
|
+
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
46
|
+
└─────────────────────────────────────────────────────────────┘
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. Event-Driven Architecture
|
|
50
|
+
```
|
|
51
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
52
|
+
│ Service │ │ Event │ │ Service │
|
|
53
|
+
│ A │───▶│ Bus │───▶│ B │
|
|
54
|
+
└─────────────┘ └─────────────┘ └─────────────┘
|
|
55
|
+
│
|
|
56
|
+
▼
|
|
57
|
+
┌─────────────┐
|
|
58
|
+
│ Service │
|
|
59
|
+
│ C │
|
|
60
|
+
└─────────────┘
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Technology Stack Recommendations
|
|
64
|
+
|
|
65
|
+
### 1. Web Applications
|
|
66
|
+
```yaml
|
|
67
|
+
Frontend:
|
|
68
|
+
SPA: React, Vue.js, Angular
|
|
69
|
+
SSR: Next.js, Nuxt.js, SvelteKit
|
|
70
|
+
Mobile: React Native, Flutter
|
|
71
|
+
|
|
72
|
+
Backend:
|
|
73
|
+
API: Node.js (Express, Fastify), Python (FastAPI, Django)
|
|
74
|
+
Enterprise: Java (Spring Boot), C# (.NET Core)
|
|
75
|
+
|
|
76
|
+
Database:
|
|
77
|
+
Relational: PostgreSQL, MySQL
|
|
78
|
+
NoSQL: MongoDB, Redis
|
|
79
|
+
Search: Elasticsearch
|
|
80
|
+
|
|
81
|
+
Infrastructure:
|
|
82
|
+
Container: Docker, Kubernetes
|
|
83
|
+
Cloud: AWS, Azure, Google Cloud
|
|
84
|
+
CI/CD: GitHub Actions, GitLab CI
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 2. Data Processing
|
|
88
|
+
```yaml
|
|
89
|
+
Batch Processing:
|
|
90
|
+
- Apache Spark
|
|
91
|
+
- Apache Airflow
|
|
92
|
+
- AWS Batch
|
|
93
|
+
|
|
94
|
+
Stream Processing:
|
|
95
|
+
- Apache Kafka
|
|
96
|
+
- Apache Pulsar
|
|
97
|
+
- AWS Kinesis
|
|
98
|
+
|
|
99
|
+
Analytics:
|
|
100
|
+
- Apache Superset
|
|
101
|
+
- Grafana
|
|
102
|
+
- Tableau
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Performance Optimization Strategies
|
|
106
|
+
|
|
107
|
+
### 1. Caching Layers
|
|
108
|
+
```
|
|
109
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
110
|
+
│ Browser │ │ CDN │ │ Server │
|
|
111
|
+
│ Cache │ │ Cache │ │ Cache │
|
|
112
|
+
└─────────────┘ └─────────────┘ └─────────────┘
|
|
113
|
+
│ │ │
|
|
114
|
+
▼ ▼ ▼
|
|
115
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
116
|
+
│ Application │ │ Application │ │ Database │
|
|
117
|
+
│ Server │ │ Server │ │ Server │
|
|
118
|
+
└─────────────┘ └─────────────┘ └─────────────┘
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 2. Database Optimization
|
|
122
|
+
- **Indexing Strategy**: Create indexes for frequent queries
|
|
123
|
+
- **Query Optimization**: Use EXPLAIN plans to optimize queries
|
|
124
|
+
- **Connection Pooling**: Manage database connections efficiently
|
|
125
|
+
- **Read Replicas**: Distribute read operations
|
|
126
|
+
- **Partitioning**: Split large tables for better performance
|
|
127
|
+
|
|
128
|
+
### 3. Scalability Patterns
|
|
129
|
+
```
|
|
130
|
+
Load Balancer
|
|
131
|
+
│
|
|
132
|
+
┌──┴──┐
|
|
133
|
+
│ │
|
|
134
|
+
▼ ▼
|
|
135
|
+
App App
|
|
136
|
+
Server Server
|
|
137
|
+
│ │
|
|
138
|
+
└──┬──┘
|
|
139
|
+
│
|
|
140
|
+
Database
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Security Architecture Patterns
|
|
144
|
+
|
|
145
|
+
### 1. Zero Trust Architecture
|
|
146
|
+
```
|
|
147
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
148
|
+
│ Security Layer │
|
|
149
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
150
|
+
│ │ Identity & │ │ Device │ │ Network │ │
|
|
151
|
+
│ │ Access │ │ Security │ │ Security │ │
|
|
152
|
+
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
153
|
+
└─────────────────────────────────────────────────────────────┘
|
|
154
|
+
│
|
|
155
|
+
▼
|
|
156
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
157
|
+
│ Application Layer │
|
|
158
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
159
|
+
│ │ API │ │ Web │ │ Mobile │ │
|
|
160
|
+
│ │ Gateway │ │ Portal │ │ App │ │
|
|
161
|
+
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
162
|
+
└─────────────────────────────────────────────────────────────┘
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 2. API Security
|
|
166
|
+
- **Authentication**: OAuth 2.0, JWT tokens
|
|
167
|
+
- **Authorization**: Role-based access control (RBAC)
|
|
168
|
+
- **Rate Limiting**: Prevent abuse and DDoS
|
|
169
|
+
- **Input Validation**: Sanitize all inputs
|
|
170
|
+
- **HTTPS**: Encrypt all communications
|
|
171
|
+
|
|
172
|
+
## Monitoring and Observability
|
|
173
|
+
|
|
174
|
+
### 1. Three Pillars of Observability
|
|
175
|
+
```
|
|
176
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
177
|
+
│ Metrics │ │ Logs │ │ Traces │
|
|
178
|
+
│ │ │ │ │ │
|
|
179
|
+
│ • CPU Usage │ │ • App Logs │ │ • Request │
|
|
180
|
+
│ • Memory │ │ • Error │ │ Flow │
|
|
181
|
+
│ • Response │ │ Logs │ │ • Latency │
|
|
182
|
+
│ Time │ │ • Access │ │ Tracking │
|
|
183
|
+
│ │ │ Logs │ │ │
|
|
184
|
+
└─────────────┘ └─────────────┘ └─────────────┘
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### 2. Alerting Strategy
|
|
188
|
+
- **SLA-based Alerts**: Monitor service level agreements
|
|
189
|
+
- **Anomaly Detection**: Detect unusual patterns
|
|
190
|
+
- **Escalation Policies**: Define who gets notified when
|
|
191
|
+
- **Runbook Integration**: Link alerts to resolution procedures
|
|
192
|
+
|
|
193
|
+
## Common Anti-Patterns to Avoid
|
|
194
|
+
|
|
195
|
+
### 1. Architecture Anti-Patterns
|
|
196
|
+
- **Big Ball of Mud**: Lack of clear structure
|
|
197
|
+
- **Spaghetti Code**: Tangled dependencies
|
|
198
|
+
- **Golden Hammer**: Using one solution for everything
|
|
199
|
+
- **Premature Optimization**: Optimizing before measuring
|
|
200
|
+
- **Vendor Lock-in**: Over-dependence on specific vendors
|
|
201
|
+
|
|
202
|
+
### 2. Design Anti-Patterns
|
|
203
|
+
- **God Object**: One class doing everything
|
|
204
|
+
- **Tight Coupling**: Components too dependent on each other
|
|
205
|
+
- **Circular Dependencies**: Components depending on each other
|
|
206
|
+
- **Interface Bloat**: Too many methods in interfaces
|
|
207
|
+
- **Singleton Abuse**: Overusing singleton pattern
|
|
208
|
+
|
|
209
|
+
## Migration Strategies
|
|
210
|
+
|
|
211
|
+
### 1. Strangler Fig Pattern
|
|
212
|
+
```
|
|
213
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
214
|
+
│ Legacy System │
|
|
215
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
216
|
+
│ │ Module │ │ Module │ │ Module │ │
|
|
217
|
+
│ │ A │ │ B │ │ C │ │
|
|
218
|
+
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
219
|
+
└─────────────────────────────────────────────────────────────┘
|
|
220
|
+
│
|
|
221
|
+
▼ (Gradual Migration)
|
|
222
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
223
|
+
│ New System │
|
|
224
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
225
|
+
│ │ Service │ │ Service │ │ Service │ │
|
|
226
|
+
│ │ A │ │ B │ │ C │ │
|
|
227
|
+
│ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
228
|
+
└─────────────────────────────────────────────────────────────┘
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### 2. Database Migration
|
|
232
|
+
- **Dual Write**: Write to both old and new systems
|
|
233
|
+
- **Event Sourcing**: Capture all changes as events
|
|
234
|
+
- **Blue-Green Deployment**: Switch between environments
|
|
235
|
+
- **Canary Releases**: Gradual rollout to users
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
# Backend Best Practices
|
|
2
|
+
|
|
3
|
+
## API Design Best Practices
|
|
4
|
+
|
|
5
|
+
### 1. RESTful API Design
|
|
6
|
+
```
|
|
7
|
+
GET /users # List all users
|
|
8
|
+
GET /users/{id} # Get specific user
|
|
9
|
+
POST /users # Create new user
|
|
10
|
+
PUT /users/{id} # Update entire user
|
|
11
|
+
PATCH /users/{id} # Partial update
|
|
12
|
+
DELETE /users/{id} # Delete user
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### 2. HTTP Status Codes
|
|
16
|
+
- **200 OK**: Successful GET, PUT, PATCH
|
|
17
|
+
- **201 Created**: Successful POST
|
|
18
|
+
- **204 No Content**: Successful DELETE
|
|
19
|
+
- **400 Bad Request**: Invalid request data
|
|
20
|
+
- **401 Unauthorized**: Authentication required
|
|
21
|
+
- **403 Forbidden**: Access denied
|
|
22
|
+
- **404 Not Found**: Resource not found
|
|
23
|
+
- **422 Unprocessable Entity**: Validation errors
|
|
24
|
+
- **500 Internal Server Error**: Server error
|
|
25
|
+
|
|
26
|
+
### 3. Error Response Format
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"error": {
|
|
30
|
+
"code": "VALIDATION_ERROR",
|
|
31
|
+
"message": "Invalid input data",
|
|
32
|
+
"details": [
|
|
33
|
+
{
|
|
34
|
+
"field": "email",
|
|
35
|
+
"message": "Invalid email format"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Database Best Practices
|
|
43
|
+
|
|
44
|
+
### 1. Schema Design
|
|
45
|
+
```sql
|
|
46
|
+
-- Users table with proper constraints
|
|
47
|
+
CREATE TABLE users (
|
|
48
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
49
|
+
email VARCHAR(255) UNIQUE NOT NULL,
|
|
50
|
+
password_hash VARCHAR(255) NOT NULL,
|
|
51
|
+
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
|
52
|
+
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
|
53
|
+
INDEX idx_users_email (email),
|
|
54
|
+
INDEX idx_users_created_at (created_at)
|
|
55
|
+
);
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 2. Query Optimization
|
|
59
|
+
```sql
|
|
60
|
+
-- Bad: N+1 queries
|
|
61
|
+
SELECT * FROM users;
|
|
62
|
+
-- Then for each user:
|
|
63
|
+
SELECT * FROM orders WHERE user_id = ?;
|
|
64
|
+
|
|
65
|
+
-- Good: Join query
|
|
66
|
+
SELECT u.*, o.*
|
|
67
|
+
FROM users u
|
|
68
|
+
LEFT JOIN orders o ON u.id = o.user_id;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 3. Connection Management
|
|
72
|
+
```javascript
|
|
73
|
+
// Connection pooling example
|
|
74
|
+
const pool = new Pool({
|
|
75
|
+
host: process.env.DB_HOST,
|
|
76
|
+
port: process.env.DB_PORT,
|
|
77
|
+
database: process.env.DB_NAME,
|
|
78
|
+
user: process.env.DB_USER,
|
|
79
|
+
password: process.env.DB_PASSWORD,
|
|
80
|
+
max: 20, // Maximum connections
|
|
81
|
+
idle: 30000, // Idle timeout
|
|
82
|
+
connectionTimeoutMillis: 2000
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Security Best Practices
|
|
87
|
+
|
|
88
|
+
### 1. Authentication & Authorization
|
|
89
|
+
```javascript
|
|
90
|
+
// JWT middleware example
|
|
91
|
+
const authenticateToken = (req, res, next) => {
|
|
92
|
+
const authHeader = req.headers['authorization'];
|
|
93
|
+
const token = authHeader && authHeader.split(' ')[1];
|
|
94
|
+
|
|
95
|
+
if (!token) {
|
|
96
|
+
return res.status(401).json({ error: 'Access token required' });
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
jwt.verify(token, process.env.JWT_SECRET, (err, user) => {
|
|
100
|
+
if (err) {
|
|
101
|
+
return res.status(403).json({ error: 'Invalid token' });
|
|
102
|
+
}
|
|
103
|
+
req.user = user;
|
|
104
|
+
next();
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 2. Input Validation
|
|
110
|
+
```javascript
|
|
111
|
+
const { body, validationResult } = require('express-validator');
|
|
112
|
+
|
|
113
|
+
const validateUser = [
|
|
114
|
+
body('email').isEmail().normalizeEmail(),
|
|
115
|
+
body('password').isLength({ min: 8 }),
|
|
116
|
+
body('name').trim().escape(),
|
|
117
|
+
|
|
118
|
+
(req, res, next) => {
|
|
119
|
+
const errors = validationResult(req);
|
|
120
|
+
if (!errors.isEmpty()) {
|
|
121
|
+
return res.status(422).json({
|
|
122
|
+
error: 'Validation failed',
|
|
123
|
+
details: errors.array()
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
next();
|
|
127
|
+
}
|
|
128
|
+
];
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 3. Rate Limiting
|
|
132
|
+
```javascript
|
|
133
|
+
const rateLimit = require('express-rate-limit');
|
|
134
|
+
|
|
135
|
+
const limiter = rateLimit({
|
|
136
|
+
windowMs: 15 * 60 * 1000, // 15 minutes
|
|
137
|
+
max: 100, // limit each IP to 100 requests per windowMs
|
|
138
|
+
message: 'Too many requests from this IP'
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
app.use('/api/', limiter);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Performance Optimization
|
|
145
|
+
|
|
146
|
+
### 1. Caching Strategy
|
|
147
|
+
```javascript
|
|
148
|
+
const Redis = require('redis');
|
|
149
|
+
const client = Redis.createClient();
|
|
150
|
+
|
|
151
|
+
// Cache with TTL
|
|
152
|
+
const cacheGet = async (key) => {
|
|
153
|
+
const cached = await client.get(key);
|
|
154
|
+
return cached ? JSON.parse(cached) : null;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const cacheSet = async (key, data, ttl = 3600) => {
|
|
158
|
+
await client.setex(key, ttl, JSON.stringify(data));
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// Usage in route
|
|
162
|
+
app.get('/api/users/:id', async (req, res) => {
|
|
163
|
+
const { id } = req.params;
|
|
164
|
+
const cacheKey = `user:${id}`;
|
|
165
|
+
|
|
166
|
+
// Try cache first
|
|
167
|
+
let user = await cacheGet(cacheKey);
|
|
168
|
+
if (!user) {
|
|
169
|
+
user = await db.query('SELECT * FROM users WHERE id = $1', [id]);
|
|
170
|
+
await cacheSet(cacheKey, user);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
res.json(user);
|
|
174
|
+
});
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### 2. Background Jobs
|
|
178
|
+
```javascript
|
|
179
|
+
const Queue = require('bull');
|
|
180
|
+
const emailQueue = new Queue('email processing');
|
|
181
|
+
|
|
182
|
+
// Add job to queue
|
|
183
|
+
emailQueue.add('send-email', {
|
|
184
|
+
to: 'user@example.com',
|
|
185
|
+
subject: 'Welcome!',
|
|
186
|
+
template: 'welcome'
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// Process jobs
|
|
190
|
+
emailQueue.process('send-email', async (job) => {
|
|
191
|
+
const { to, subject, template } = job.data;
|
|
192
|
+
await sendEmail(to, subject, template);
|
|
193
|
+
});
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 3. Database Optimization
|
|
197
|
+
```sql
|
|
198
|
+
-- Create indexes for frequently queried columns
|
|
199
|
+
CREATE INDEX CONCURRENTLY idx_orders_user_id ON orders(user_id);
|
|
200
|
+
CREATE INDEX CONCURRENTLY idx_orders_status ON orders(status);
|
|
201
|
+
CREATE INDEX CONCURRENTLY idx_orders_created_at ON orders(created_at);
|
|
202
|
+
|
|
203
|
+
-- Composite index for complex queries
|
|
204
|
+
CREATE INDEX CONCURRENTLY idx_orders_user_status
|
|
205
|
+
ON orders(user_id, status, created_at);
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Error Handling
|
|
209
|
+
|
|
210
|
+
### 1. Structured Error Handling
|
|
211
|
+
```javascript
|
|
212
|
+
class ApiError extends Error {
|
|
213
|
+
constructor(message, statusCode = 500, code = 'INTERNAL_ERROR') {
|
|
214
|
+
super(message);
|
|
215
|
+
this.statusCode = statusCode;
|
|
216
|
+
this.code = code;
|
|
217
|
+
this.name = 'ApiError';
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Error middleware
|
|
222
|
+
const errorHandler = (err, req, res, next) => {
|
|
223
|
+
if (err instanceof ApiError) {
|
|
224
|
+
return res.status(err.statusCode).json({
|
|
225
|
+
error: {
|
|
226
|
+
code: err.code,
|
|
227
|
+
message: err.message
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Log unexpected errors
|
|
233
|
+
console.error('Unexpected error:', err);
|
|
234
|
+
|
|
235
|
+
res.status(500).json({
|
|
236
|
+
error: {
|
|
237
|
+
code: 'INTERNAL_ERROR',
|
|
238
|
+
message: 'An unexpected error occurred'
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
};
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### 2. Graceful Shutdown
|
|
245
|
+
```javascript
|
|
246
|
+
process.on('SIGTERM', () => {
|
|
247
|
+
console.log('SIGTERM received, shutting down gracefully');
|
|
248
|
+
server.close(() => {
|
|
249
|
+
console.log('Process terminated');
|
|
250
|
+
process.exit(0);
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
process.on('SIGINT', () => {
|
|
255
|
+
console.log('SIGINT received, shutting down gracefully');
|
|
256
|
+
server.close(() => {
|
|
257
|
+
console.log('Process terminated');
|
|
258
|
+
process.exit(0);
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Testing Best Practices
|
|
264
|
+
|
|
265
|
+
### 1. Unit Testing
|
|
266
|
+
```javascript
|
|
267
|
+
// Jest example
|
|
268
|
+
describe('User Service', () => {
|
|
269
|
+
beforeEach(() => {
|
|
270
|
+
// Setup test data
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
test('should create user with valid data', async () => {
|
|
274
|
+
const userData = {
|
|
275
|
+
email: 'test@example.com',
|
|
276
|
+
password: 'securepassword'
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const user = await userService.create(userData);
|
|
280
|
+
|
|
281
|
+
expect(user.email).toBe(userData.email);
|
|
282
|
+
expect(user.password_hash).toBeDefined();
|
|
283
|
+
expect(user.id).toBeDefined();
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### 2. Integration Testing
|
|
289
|
+
```javascript
|
|
290
|
+
// Supertest example
|
|
291
|
+
const request = require('supertest');
|
|
292
|
+
const app = require('../app');
|
|
293
|
+
|
|
294
|
+
describe('User API', () => {
|
|
295
|
+
test('POST /users should create user', async () => {
|
|
296
|
+
const response = await request(app)
|
|
297
|
+
.post('/api/users')
|
|
298
|
+
.send({
|
|
299
|
+
email: 'test@example.com',
|
|
300
|
+
password: 'securepassword'
|
|
301
|
+
})
|
|
302
|
+
.expect(201);
|
|
303
|
+
|
|
304
|
+
expect(response.body.email).toBe('test@example.com');
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Monitoring and Logging
|
|
310
|
+
|
|
311
|
+
### 1. Structured Logging
|
|
312
|
+
```javascript
|
|
313
|
+
const winston = require('winston');
|
|
314
|
+
|
|
315
|
+
const logger = winston.createLogger({
|
|
316
|
+
level: 'info',
|
|
317
|
+
format: winston.format.combine(
|
|
318
|
+
winston.format.timestamp(),
|
|
319
|
+
winston.format.errors({ stack: true }),
|
|
320
|
+
winston.format.json()
|
|
321
|
+
),
|
|
322
|
+
transports: [
|
|
323
|
+
new winston.transports.File({ filename: 'error.log', level: 'error' }),
|
|
324
|
+
new winston.transports.File({ filename: 'combined.log' })
|
|
325
|
+
]
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
// Usage
|
|
329
|
+
logger.info('User created', { userId: user.id, email: user.email });
|
|
330
|
+
logger.error('Database error', { error: err.message, stack: err.stack });
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
### 2. Health Checks
|
|
334
|
+
```javascript
|
|
335
|
+
app.get('/health', async (req, res) => {
|
|
336
|
+
const health = {
|
|
337
|
+
status: 'healthy',
|
|
338
|
+
timestamp: new Date().toISOString(),
|
|
339
|
+
services: {}
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
try {
|
|
343
|
+
// Database health check
|
|
344
|
+
await db.query('SELECT 1');
|
|
345
|
+
health.services.database = 'healthy';
|
|
346
|
+
} catch (error) {
|
|
347
|
+
health.services.database = 'unhealthy';
|
|
348
|
+
health.status = 'degraded';
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
try {
|
|
352
|
+
// Redis health check
|
|
353
|
+
await redis.ping();
|
|
354
|
+
health.services.redis = 'healthy';
|
|
355
|
+
} catch (error) {
|
|
356
|
+
health.services.redis = 'unhealthy';
|
|
357
|
+
health.status = 'degraded';
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const statusCode = health.status === 'healthy' ? 200 : 503;
|
|
361
|
+
res.status(statusCode).json(health);
|
|
362
|
+
});
|
|
363
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Backend Context Rules
|
|
2
|
+
|
|
3
|
+
## Persona Configuration
|
|
4
|
+
```yaml
|
|
5
|
+
persona: backend
|
|
6
|
+
focus:
|
|
7
|
+
- api_design
|
|
8
|
+
- database_optimization
|
|
9
|
+
- caching_strategies
|
|
10
|
+
- message_queuing
|
|
11
|
+
- server_architecture
|
|
12
|
+
priorities:
|
|
13
|
+
- reliability: critical
|
|
14
|
+
- performance: high
|
|
15
|
+
- scalability: high
|
|
16
|
+
- security: high
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Core Principles
|
|
20
|
+
- **API-First Design**: Design APIs before implementation
|
|
21
|
+
- **Data Consistency**: Maintain data integrity across operations
|
|
22
|
+
- **Performance by Design**: Build with performance in mind
|
|
23
|
+
- **Security from Start**: Implement security at every layer
|
|
24
|
+
- **Scalability Planning**: Design for growth from day one
|
|
25
|
+
|
|
26
|
+
## Behavioral Guidelines
|
|
27
|
+
|
|
28
|
+
### 1. API Development
|
|
29
|
+
- Design RESTful APIs following HTTP conventions
|
|
30
|
+
- Use proper HTTP status codes and methods
|
|
31
|
+
- Implement comprehensive error handling
|
|
32
|
+
- Document APIs thoroughly with OpenAPI/Swagger
|
|
33
|
+
- Version APIs from the beginning
|
|
34
|
+
|
|
35
|
+
### 2. Database Design
|
|
36
|
+
- Normalize data structures (at least 3NF)
|
|
37
|
+
- Use appropriate indexes for query optimization
|
|
38
|
+
- Implement proper transaction handling
|
|
39
|
+
- Plan for data migration and schema evolution
|
|
40
|
+
- Consider read/write splitting for scalability
|
|
41
|
+
|
|
42
|
+
### 3. Performance Optimization
|
|
43
|
+
- Implement caching at multiple levels
|
|
44
|
+
- Use connection pooling for database connections
|
|
45
|
+
- Optimize queries based on execution plans
|
|
46
|
+
- Implement asynchronous processing where appropriate
|
|
47
|
+
- Monitor performance metrics continuously
|
|
48
|
+
|
|
49
|
+
## Constraints
|
|
50
|
+
- Never expose sensitive data in logs or API responses
|
|
51
|
+
- Avoid N+1 query problems
|
|
52
|
+
- Don't implement synchronous operations for long-running tasks
|
|
53
|
+
- Never bypass authentication/authorization checks
|
|
54
|
+
- Avoid hardcoding configuration values
|
|
55
|
+
|
|
56
|
+
## Response Patterns
|
|
57
|
+
- Always consider error handling and edge cases
|
|
58
|
+
- Provide concrete code examples
|
|
59
|
+
- Explain trade-offs between different approaches
|
|
60
|
+
- Reference industry standards and best practices
|
|
61
|
+
- Include testing strategies for recommendations
|