@winspan/claude-forge 8.39.0 → 8.50.6
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/.claude/CLAUDE.md +17 -0
- package/.eslintrc.js +23 -0
- package/.prettierrc +8 -0
- package/ARCHITECTURE_ISSUES.md +249 -0
- package/CLAUDE.md +265 -0
- package/CLAUDE.md.backup +488 -0
- package/DEVELOPMENT.md +310 -0
- package/dist/claudemd/claudemd-generator.d.ts +38 -3
- package/dist/claudemd/claudemd-generator.d.ts.map +1 -1
- package/dist/claudemd/claudemd-generator.js +629 -11
- package/dist/claudemd/claudemd-generator.js.map +1 -1
- package/dist/claudemd/index.d.ts +2 -2
- package/dist/claudemd/index.d.ts.map +1 -1
- package/dist/claudemd/index.js.map +1 -1
- package/dist/claudemd/resume-manager.d.ts.map +1 -1
- package/dist/claudemd/resume-manager.js +5 -2
- package/dist/claudemd/resume-manager.js.map +1 -1
- package/dist/claudemd/tech-detector.d.ts +1 -0
- package/dist/claudemd/tech-detector.d.ts.map +1 -1
- package/dist/claudemd/tech-detector.js +53 -0
- package/dist/claudemd/tech-detector.js.map +1 -1
- package/dist/cli/commands/claudemd.js +2 -2
- package/dist/cli/commands/claudemd.js.map +1 -1
- package/dist/cli/commands/daemon.d.ts +28 -0
- package/dist/cli/commands/daemon.d.ts.map +1 -1
- package/dist/cli/commands/daemon.js +200 -8
- package/dist/cli/commands/daemon.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +3 -35
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/menu.js +10 -10
- package/dist/cli/commands/menu.js.map +1 -1
- package/dist/cli/commands/skills.d.ts.map +1 -1
- package/dist/cli/commands/skills.js +8 -2
- package/dist/cli/commands/skills.js.map +1 -1
- package/dist/cli/commands/stats.d.ts.map +1 -1
- package/dist/cli/commands/stats.js +0 -17
- package/dist/cli/commands/stats.js.map +1 -1
- package/dist/cli/commands/trace.d.ts +9 -0
- package/dist/cli/commands/trace.d.ts.map +1 -0
- package/dist/cli/commands/trace.js +137 -0
- package/dist/cli/commands/trace.js.map +1 -0
- package/dist/cli/index.js +2 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/core/ai/provider.d.ts +10 -2
- package/dist/core/ai/provider.d.ts.map +1 -1
- package/dist/core/ai/provider.js.map +1 -1
- package/dist/core/ai/types.d.ts +1 -19
- package/dist/core/ai/types.d.ts.map +1 -1
- package/dist/core/ai/types.js +1 -1
- package/dist/core/config.d.ts +2 -1
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +30 -6
- package/dist/core/config.js.map +1 -1
- package/dist/core/constants.d.ts +2 -2
- package/dist/core/constants.js +2 -2
- package/dist/core/constants.js.map +1 -1
- package/dist/core/queue/index.d.ts +52 -0
- package/dist/core/queue/index.d.ts.map +1 -0
- package/dist/core/queue/index.js +176 -0
- package/dist/core/queue/index.js.map +1 -0
- package/dist/core/storage/base.d.ts +33 -0
- package/dist/core/storage/base.d.ts.map +1 -0
- package/dist/core/storage/base.js +211 -0
- package/dist/core/storage/base.js.map +1 -0
- package/dist/core/storage/events.d.ts +52 -0
- package/dist/core/storage/events.d.ts.map +1 -0
- package/dist/core/storage/events.js +201 -0
- package/dist/core/storage/events.js.map +1 -0
- package/dist/core/storage/injections.d.ts +27 -0
- package/dist/core/storage/injections.d.ts.map +1 -0
- package/dist/core/storage/injections.js +51 -0
- package/dist/core/storage/injections.js.map +1 -0
- package/dist/core/storage/maintenance.d.ts +21 -0
- package/dist/core/storage/maintenance.d.ts.map +1 -0
- package/dist/core/storage/maintenance.js +52 -0
- package/dist/core/storage/maintenance.js.map +1 -0
- package/dist/core/storage/routing.d.ts +71 -0
- package/dist/core/storage/routing.d.ts.map +1 -0
- package/dist/core/storage/routing.js +141 -0
- package/dist/core/storage/routing.js.map +1 -0
- package/dist/core/storage/rows.d.ts +0 -47
- package/dist/core/storage/rows.d.ts.map +1 -1
- package/dist/core/storage/schema.sql +74 -136
- package/dist/core/storage/sessions.d.ts +34 -0
- package/dist/core/storage/sessions.d.ts.map +1 -0
- package/dist/core/storage/sessions.js +78 -0
- package/dist/core/storage/sessions.js.map +1 -0
- package/dist/core/storage/skills.d.ts +40 -0
- package/dist/core/storage/skills.d.ts.map +1 -0
- package/dist/core/storage/skills.js +107 -0
- package/dist/core/storage/skills.js.map +1 -0
- package/dist/core/storage/sqlite.d.ts +63 -265
- package/dist/core/storage/sqlite.d.ts.map +1 -1
- package/dist/core/storage/sqlite.js +102 -759
- package/dist/core/storage/sqlite.js.map +1 -1
- package/dist/core/storage/tasks.d.ts +64 -0
- package/dist/core/storage/tasks.d.ts.map +1 -0
- package/dist/core/storage/tasks.js +134 -0
- package/dist/core/storage/tasks.js.map +1 -0
- package/dist/core/storage/token-usage.d.ts +36 -0
- package/dist/core/storage/token-usage.d.ts.map +1 -0
- package/dist/core/storage/token-usage.js +59 -0
- package/dist/core/storage/token-usage.js.map +1 -0
- package/dist/core/types.d.ts +70 -4
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +24 -1
- package/dist/core/types.js.map +1 -1
- package/dist/core/utils/format.d.ts +28 -0
- package/dist/core/utils/format.d.ts.map +1 -0
- package/dist/core/utils/format.js +68 -0
- package/dist/core/utils/format.js.map +1 -0
- package/dist/core/utils/logger.d.ts +6 -1
- package/dist/core/utils/logger.d.ts.map +1 -1
- package/dist/core/utils/logger.js +72 -2
- package/dist/core/utils/logger.js.map +1 -1
- package/dist/core/utils/session.d.ts +16 -0
- package/dist/core/utils/session.d.ts.map +1 -0
- package/dist/core/utils/session.js +25 -0
- package/dist/core/utils/session.js.map +1 -0
- package/dist/core/utils/time.d.ts +22 -0
- package/dist/core/utils/time.d.ts.map +1 -0
- package/dist/core/utils/time.js +38 -0
- package/dist/core/utils/time.js.map +1 -0
- package/dist/daemon/handlers/history-exporter.d.ts.map +1 -1
- package/dist/daemon/handlers/history-exporter.js +6 -4
- package/dist/daemon/handlers/history-exporter.js.map +1 -1
- package/dist/daemon/handlers/post-tool-use.d.ts +5 -12
- package/dist/daemon/handlers/post-tool-use.d.ts.map +1 -1
- package/dist/daemon/handlers/post-tool-use.js +21 -79
- package/dist/daemon/handlers/post-tool-use.js.map +1 -1
- package/dist/daemon/handlers/stop.d.ts +24 -12
- package/dist/daemon/handlers/stop.d.ts.map +1 -1
- package/dist/daemon/handlers/stop.js +141 -42
- package/dist/daemon/handlers/stop.js.map +1 -1
- package/dist/daemon/handlers/user-prompt.d.ts +18 -19
- package/dist/daemon/handlers/user-prompt.d.ts.map +1 -1
- package/dist/daemon/handlers/user-prompt.js +103 -227
- package/dist/daemon/handlers/user-prompt.js.map +1 -1
- package/dist/daemon/index.d.ts +6 -2
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/daemon/index.js +76 -120
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/launchd/com.claude-forge.daemon.plist.template +47 -0
- package/dist/daemon/launchd-installer.d.ts +61 -0
- package/dist/daemon/launchd-installer.d.ts.map +1 -0
- package/dist/daemon/launchd-installer.js +182 -0
- package/dist/daemon/launchd-installer.js.map +1 -0
- package/dist/daemon/lifecycle.d.ts +11 -0
- package/dist/daemon/lifecycle.d.ts.map +1 -1
- package/dist/daemon/lifecycle.js +44 -0
- package/dist/daemon/lifecycle.js.map +1 -1
- package/dist/daemon/router.d.ts +9 -2
- package/dist/daemon/router.d.ts.map +1 -1
- package/dist/daemon/router.js +27 -3
- package/dist/daemon/router.js.map +1 -1
- package/dist/daemon/server.d.ts.map +1 -1
- package/dist/daemon/server.js +6 -5
- package/dist/daemon/server.js.map +1 -1
- package/dist/daemon/services/anti-pattern-detector.d.ts +50 -0
- package/dist/daemon/services/anti-pattern-detector.d.ts.map +1 -0
- package/dist/daemon/services/anti-pattern-detector.js +357 -0
- package/dist/daemon/services/anti-pattern-detector.js.map +1 -0
- package/dist/daemon/services/drift-detector.d.ts +64 -0
- package/dist/daemon/services/drift-detector.d.ts.map +1 -0
- package/dist/daemon/services/drift-detector.js +201 -0
- package/dist/daemon/services/drift-detector.js.map +1 -0
- package/dist/{intelligence → daemon/services}/task-segmenter.d.ts +7 -1
- package/dist/daemon/services/task-segmenter.d.ts.map +1 -0
- package/dist/{intelligence → daemon/services}/task-segmenter.js +29 -6
- package/dist/daemon/services/task-segmenter.js.map +1 -0
- package/dist/daemon/services/weekly-report.d.ts +91 -0
- package/dist/daemon/services/weekly-report.d.ts.map +1 -0
- package/dist/daemon/services/weekly-report.js +327 -0
- package/dist/daemon/services/weekly-report.js.map +1 -0
- package/dist/hooks/hook-lib.sh +81 -0
- package/dist/hooks/notification.sh +7 -3
- package/dist/hooks/post-tool-use.sh +8 -4
- package/dist/hooks/pre-tool-use.sh +7 -4
- package/dist/hooks/stop.sh +1 -1
- package/dist/hooks/user-prompt-submit.sh +8 -9
- package/dist/mcp/server.d.ts +2 -2
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +71 -11
- package/dist/mcp/server.js.map +1 -1
- package/dist/skills/invocation-guard.d.ts +20 -0
- package/dist/skills/invocation-guard.d.ts.map +1 -1
- package/dist/skills/invocation-guard.js +63 -0
- package/dist/skills/invocation-guard.js.map +1 -1
- package/dist/skills/matcher.d.ts.map +1 -1
- package/dist/skills/matcher.js +12 -3
- package/dist/skills/matcher.js.map +1 -1
- package/dist/skills/official/code-simplifier.md +16 -0
- package/dist/skills/official/find-skills.md +23 -0
- package/dist/skills/official/official-api-design.md +17 -0
- package/dist/skills/official/official-architecture-decision.md +20 -0
- package/dist/skills/official/official-bmad.md +118 -0
- package/dist/skills/official/official-db-schema-design.md +16 -0
- package/dist/skills/official/official-debug.md +17 -0
- package/dist/skills/official/official-doc-driven.md +31 -0
- package/dist/skills/official/official-harness-engineering.md +108 -0
- package/dist/skills/official/official-performance-optimization.md +30 -0
- package/dist/skills/official/official-pr-review.md +35 -0
- package/dist/skills/official/official-release-checklist.md +30 -0
- package/dist/skills/official/official-security-hardening.md +26 -0
- package/dist/skills/official/official-spec-driven-design.md +31 -0
- package/dist/skills/official/planning-with-files.md +37 -0
- package/dist/skills/official/ui-ux-pro-max.md +18 -0
- package/dist/skills/official/webapp-testing.md +12 -0
- package/dist/skills/official-skills.d.ts +8 -4
- package/dist/skills/official-skills.d.ts.map +1 -1
- package/dist/skills/official-skills.js +48 -704
- package/dist/skills/official-skills.js.map +1 -1
- package/dist/skills/registry.d.ts +5 -0
- package/dist/skills/registry.d.ts.map +1 -1
- package/dist/skills/registry.js +48 -15
- package/dist/skills/registry.js.map +1 -1
- package/dist/skills/tools/pipeline-suggest.d.ts +30 -0
- package/dist/skills/tools/pipeline-suggest.d.ts.map +1 -0
- package/dist/skills/tools/pipeline-suggest.js +178 -0
- package/dist/skills/tools/pipeline-suggest.js.map +1 -0
- package/dist/skills/tools/skill-invoke.d.ts +2 -0
- package/dist/skills/tools/skill-invoke.d.ts.map +1 -1
- package/dist/skills/tools/skill-invoke.js +5 -2
- package/dist/skills/tools/skill-invoke.js.map +1 -1
- package/dist/web/routes/ai.d.ts.map +1 -1
- package/dist/web/routes/ai.js +16 -22
- package/dist/web/routes/ai.js.map +1 -1
- package/dist/web/routes/drift.d.ts +10 -0
- package/dist/web/routes/drift.d.ts.map +1 -0
- package/dist/web/routes/drift.js +21 -0
- package/dist/web/routes/drift.js.map +1 -0
- package/dist/web/routes/error-handler.d.ts +43 -0
- package/dist/web/routes/error-handler.d.ts.map +1 -0
- package/dist/web/routes/error-handler.js +99 -0
- package/dist/web/routes/error-handler.js.map +1 -0
- package/dist/web/routes/insights.d.ts +9 -0
- package/dist/web/routes/insights.d.ts.map +1 -0
- package/dist/web/routes/insights.js +34 -0
- package/dist/web/routes/insights.js.map +1 -0
- package/dist/web/routes/patch.js +2 -2
- package/dist/web/routes/patch.js.map +1 -1
- package/dist/web/routes/reports.d.ts +10 -0
- package/dist/web/routes/reports.d.ts.map +1 -0
- package/dist/web/routes/reports.js +27 -0
- package/dist/web/routes/reports.js.map +1 -0
- package/dist/web/routes/rules.d.ts +10 -3
- package/dist/web/routes/rules.d.ts.map +1 -1
- package/dist/web/routes/rules.js +80 -95
- package/dist/web/routes/rules.js.map +1 -1
- package/dist/web/routes/sessions.d.ts +1 -2
- package/dist/web/routes/sessions.d.ts.map +1 -1
- package/dist/web/routes/sessions.js +27 -39
- package/dist/web/routes/sessions.js.map +1 -1
- package/dist/web/routes/skill-stats.d.ts.map +1 -1
- package/dist/web/routes/skill-stats.js +38 -0
- package/dist/web/routes/skill-stats.js.map +1 -1
- package/dist/web/routes/skills.d.ts.map +1 -1
- package/dist/web/routes/skills.js +34 -0
- package/dist/web/routes/skills.js.map +1 -1
- package/dist/web/routes/stats.d.ts +7 -0
- package/dist/web/routes/stats.d.ts.map +1 -0
- package/dist/web/routes/stats.js +44 -0
- package/dist/web/routes/stats.js.map +1 -0
- package/dist/web/routes/status.js +1 -1
- package/dist/web/routes/status.js.map +1 -1
- package/dist/web/routes/tasks.d.ts +4 -0
- package/dist/web/routes/tasks.d.ts.map +1 -0
- package/dist/web/routes/tasks.js +181 -0
- package/dist/web/routes/tasks.js.map +1 -0
- package/dist/web/routes/trace.d.ts +10 -0
- package/dist/web/routes/trace.d.ts.map +1 -0
- package/dist/web/routes/trace.js +123 -0
- package/dist/web/routes/trace.js.map +1 -0
- package/dist/web/routes/types.d.ts +1 -14
- package/dist/web/routes/types.d.ts.map +1 -1
- package/dist/web/routes/types.js +8 -17
- package/dist/web/routes/types.js.map +1 -1
- package/dist/web/server.d.ts +1 -9
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +28 -28
- package/dist/web/server.js.map +1 -1
- package/dist/web/static/assets/AIConfig-BQCAQE9D.js +2 -0
- package/dist/web/static/assets/AIConfig-BQCAQE9D.js.map +1 -0
- package/dist/web/static/assets/Dashboard-D7Bo6Kan.js +2 -0
- package/dist/web/static/assets/Dashboard-D7Bo6Kan.js.map +1 -0
- package/dist/web/static/assets/{Drawer-DcU3ln98.js → Drawer-BeHRQxUS.js} +2 -2
- package/dist/web/static/assets/{Drawer-DcU3ln98.js.map → Drawer-BeHRQxUS.js.map} +1 -1
- package/dist/web/static/assets/Events-K_tCY2ti.js +2 -0
- package/dist/web/static/assets/Events-K_tCY2ti.js.map +1 -0
- package/dist/web/static/assets/Reports-BJCmBnc_.js +2 -0
- package/dist/web/static/assets/Reports-BJCmBnc_.js.map +1 -0
- package/dist/web/static/assets/SearchInput-BX2KhMkw.js +2 -0
- package/dist/web/static/assets/SearchInput-BX2KhMkw.js.map +1 -0
- package/dist/web/static/assets/SessionDetail-Bkr-kC7V.js +2 -0
- package/dist/web/static/assets/SessionDetail-Bkr-kC7V.js.map +1 -0
- package/dist/web/static/assets/Sessions-Chx9OCLH.js +2 -0
- package/dist/web/static/assets/Sessions-Chx9OCLH.js.map +1 -0
- package/dist/web/static/assets/Skills-O0GT1i7m.js +2 -0
- package/dist/web/static/assets/Skills-O0GT1i7m.js.map +1 -0
- package/dist/web/static/assets/TaskDetail-5SR8zGzv.js +2 -0
- package/dist/web/static/assets/TaskDetail-5SR8zGzv.js.map +1 -0
- package/dist/web/static/assets/Tasks-DCgDqvOZ.js +2 -0
- package/dist/web/static/assets/Tasks-DCgDqvOZ.js.map +1 -0
- package/dist/web/static/assets/export-L_VBD2p1.js +4 -0
- package/dist/web/static/assets/export-L_VBD2p1.js.map +1 -0
- package/dist/web/static/assets/index-D8AKj26b.css +1 -0
- package/dist/web/static/assets/index-DxIbmNmr.js +3 -0
- package/dist/web/static/assets/index-DxIbmNmr.js.map +1 -0
- package/dist/web/static/assets/{lucide-53bR2rki.js → lucide-fJlPI3H7.js} +68 -38
- package/dist/web/static/assets/lucide-fJlPI3H7.js.map +1 -0
- package/dist/web/static/assets/time-Bxuk0M-C.js +2 -0
- package/dist/web/static/assets/time-Bxuk0M-C.js.map +1 -0
- package/dist/web/static/index.html +3 -3
- package/docs/concurrent-agents.md +129 -0
- package/docs/design/architecture-review-20260516.md +232 -0
- package/docs/design/fix-skills-data-and-set-leak-spec-20260516-1300.md +219 -0
- package/docs/design/hook-failure-queue-spec-20260516-1530.md +204 -0
- package/docs/design/refactor-phase1-spec-20260515-1600.md +543 -0
- package/docs/design/refactor-phase2-spec-20260515-1700.md +424 -0
- package/docs/design/tasks-list-filter-pagination-spec-20260518-0930.md +208 -0
- package/docs/implementation/fix-skills-data-and-set-leak-changelog-20260516-1300.md +104 -0
- package/docs/implementation/hook-failure-queue-changelog-20260516-1530.md +196 -0
- package/docs/implementation/hotfix-daemon-event-reject-20260516-1430.md +56 -0
- package/docs/implementation/refactor-phase1-changelog-20260515-1630.md +354 -0
- package/docs/implementation/refactor-phase2-changelog-20260515-1705.md +421 -0
- package/docs/implementation/tasks-list-filter-pagination-changelog-20260518-0930.md +72 -0
- package/docs/reviews/claudemd-template-sync.md +54 -0
- package/docs/reviews/tasks-filter-pagination.md +80 -0
- package/docs/ruflo-learning-strategy.md +322 -0
- package/docs/skills-deduplication-analysis.md +83 -0
- package/docs/skills-multiformat-support.md +177 -0
- package/docs/skills-third-party.md +183 -0
- package/docs/testing/tasks-filter-pagination-test-report.md +86 -0
- package/forge +321 -0
- package/package.json +28 -62
- package/playwright.config.ts +40 -0
- package/scripts/demo-v2.ts +91 -0
- package/scripts/dev-daemon.sh +232 -0
- package/scripts/dev-web.ts +109 -0
- package/scripts/e2e-mcp-link.ts +423 -0
- package/scripts/e2e-methodology-quality.ts +253 -0
- package/scripts/e2e-routing.ts +456 -0
- package/scripts/e2e-user-methodology.ts +326 -0
- package/scripts/e2e-web-workflows.ts +299 -0
- package/scripts/migrate-legacy-to-dynamic.sql +108 -0
- package/scripts/regenerate-execution-docs.ts +116 -0
- package/scripts/sync-agent-skills.ts +193 -0
- package/scripts/test-hook.sh +71 -0
- package/scripts/verify-skill-loading.ts +62 -0
- package/src/claudemd/claudemd-generator.ts +777 -0
- package/src/claudemd/convention-extractor.ts +69 -0
- package/src/claudemd/index.ts +35 -0
- package/src/claudemd/persona-manager.ts +88 -0
- package/src/claudemd/resume-manager.ts +236 -0
- package/src/claudemd/tech-detector.ts +220 -0
- package/src/cli/commands/claudemd.ts +84 -0
- package/src/cli/commands/config.ts +46 -0
- package/src/cli/commands/daemon.ts +310 -0
- package/src/cli/commands/executions.ts +114 -0
- package/src/cli/commands/init.ts +204 -0
- package/src/cli/commands/logs.ts +181 -0
- package/src/cli/commands/mcp.ts +244 -0
- package/src/cli/commands/menu.ts +356 -0
- package/src/cli/commands/skills.ts +185 -0
- package/src/cli/commands/stats.ts +74 -0
- package/src/cli/commands/status.ts +69 -0
- package/src/cli/commands/template.ts +77 -0
- package/src/cli/commands/trace.ts +164 -0
- package/src/cli/index.ts +42 -0
- package/src/cli/init/hook-manager.ts +132 -0
- package/src/core/ai/provider.ts +308 -0
- package/src/core/ai/types.ts +51 -0
- package/src/core/config.ts +124 -0
- package/src/core/constants.ts +45 -0
- package/src/core/queue/index.ts +193 -0
- package/src/core/storage/base.ts +226 -0
- package/src/core/storage/events.ts +255 -0
- package/src/core/storage/injections.ts +78 -0
- package/src/core/storage/maintenance.ts +59 -0
- package/src/core/storage/migrations/002_add_skill_tracking.sql +6 -0
- package/src/core/storage/migrations/003_add_skill_invocations.sql +23 -0
- package/src/core/storage/performance-indexes.sql +23 -0
- package/src/core/storage/routing.ts +194 -0
- package/src/core/storage/rows.ts +112 -0
- package/src/core/storage/schema.sql +214 -0
- package/src/core/storage/sessions.ts +104 -0
- package/src/core/storage/skills.ts +164 -0
- package/src/core/storage/sqlite.ts +194 -0
- package/src/core/storage/tasks.ts +170 -0
- package/src/core/storage/token-usage.ts +93 -0
- package/src/core/types.ts +154 -0
- package/src/core/utils/error-handler.ts +256 -0
- package/src/core/utils/forge-resume-block.ts +74 -0
- package/src/core/utils/format.ts +69 -0
- package/src/core/utils/logger.ts +119 -0
- package/src/core/utils/lru-cache.ts +50 -0
- package/src/core/utils/path.ts +19 -0
- package/src/core/utils/session.ts +26 -0
- package/src/core/utils/time.ts +37 -0
- package/src/core/utils/token-tracker.ts +97 -0
- package/src/daemon/event-parser.ts +35 -0
- package/src/daemon/handlers/history-exporter.ts +117 -0
- package/src/daemon/handlers/post-tool-use.ts +50 -0
- package/src/daemon/handlers/stop.ts +215 -0
- package/src/daemon/handlers/user-prompt.ts +188 -0
- package/src/daemon/index.ts +278 -0
- package/src/daemon/launchd/com.claude-forge.daemon.plist.template +47 -0
- package/src/daemon/launchd-installer.ts +260 -0
- package/src/daemon/lifecycle.ts +128 -0
- package/src/daemon/router.ts +40 -0
- package/src/daemon/server.ts +209 -0
- package/src/daemon/services/anti-pattern-detector.ts +412 -0
- package/src/daemon/services/drift-detector.ts +232 -0
- package/src/daemon/services/task-segmenter.ts +112 -0
- package/src/daemon/services/weekly-report.ts +454 -0
- package/src/hooks/hook-lib.sh +81 -0
- package/src/hooks/notification.sh +35 -0
- package/src/hooks/post-tool-use.sh +61 -0
- package/src/hooks/pre-tool-use.sh +63 -0
- package/src/hooks/stop.sh +40 -0
- package/src/hooks/user-prompt-submit.sh +69 -0
- package/src/mcp/server.ts +322 -0
- package/src/skills/index.ts +2 -0
- package/src/skills/invocation-guard.ts +177 -0
- package/src/skills/matcher.ts +148 -0
- package/src/skills/official/code-simplifier.md +16 -0
- package/src/skills/official/find-skills.md +23 -0
- package/src/skills/official/official-api-design.md +17 -0
- package/src/skills/official/official-architecture-decision.md +20 -0
- package/src/skills/official/official-bmad.md +118 -0
- package/src/skills/official/official-db-schema-design.md +16 -0
- package/src/skills/official/official-debug.md +17 -0
- package/src/skills/official/official-doc-driven.md +31 -0
- package/src/skills/official/official-harness-engineering.md +108 -0
- package/src/skills/official/official-performance-optimization.md +30 -0
- package/src/skills/official/official-pr-review.md +35 -0
- package/src/skills/official/official-release-checklist.md +30 -0
- package/src/skills/official/official-security-hardening.md +26 -0
- package/src/skills/official/official-spec-driven-design.md +31 -0
- package/src/skills/official/planning-with-files.md +37 -0
- package/src/skills/official/ui-ux-pro-max.md +18 -0
- package/src/skills/official/webapp-testing.md +12 -0
- package/src/skills/official-skills.ts +89 -0
- package/src/skills/registry.ts +355 -0
- package/src/skills/semantic-matcher.ts +231 -0
- package/src/skills/tools/pipeline-suggest.ts +226 -0
- package/src/skills/tools/skill-invoke.ts +168 -0
- package/src/skills/tools/skill-list.ts +59 -0
- package/src/templates/go.yaml +53 -0
- package/src/templates/python.yaml +59 -0
- package/src/templates/react.yaml +55 -0
- package/src/templates/template-manager.ts +170 -0
- package/src/web/auth-middleware.ts +55 -0
- package/src/web/routes/ai.ts +204 -0
- package/src/web/routes/auth.ts +22 -0
- package/src/web/routes/drift.ts +25 -0
- package/src/web/routes/error-handler.ts +120 -0
- package/src/web/routes/events.ts +47 -0
- package/src/web/routes/insights.ts +43 -0
- package/src/web/routes/patch.ts +117 -0
- package/src/web/routes/reports.ts +34 -0
- package/src/web/routes/rules.ts +101 -0
- package/src/web/routes/sessions.ts +262 -0
- package/src/web/routes/skill-stats.ts +132 -0
- package/src/web/routes/skills.ts +349 -0
- package/src/web/routes/static.ts +67 -0
- package/src/web/routes/stats.ts +60 -0
- package/src/web/routes/status.ts +30 -0
- package/src/web/routes/tasks.ts +218 -0
- package/src/web/routes/token-usage.ts +20 -0
- package/src/web/routes/trace.ts +138 -0
- package/src/web/routes/types.ts +56 -0
- package/src/web/server.ts +134 -0
- package/src/web/ssrf-guard.ts +112 -0
- package/src/web/static/index.html +3251 -0
- package/src/web/static/vendor/chart.umd.min.js +20 -0
- package/tests/e2e/dashboard.spec.ts +205 -0
- package/tests/e2e/routing-skill-e2e.test.ts +39 -0
- package/tests/helpers/mock-ai.ts +92 -0
- package/tests/helpers/mock-storage.ts +159 -0
- package/tests/integration/queue-replay.integration.test.ts +193 -0
- package/tests/integration/tasks-filter.integration.test.ts +154 -0
- package/tests/performance/database.benchmark.ts +161 -0
- package/tests/semantic-matcher.test.ts +99 -0
- package/tests/skill-matcher.test.ts +110 -0
- package/tests/unit/ai-provider-retry.test.ts +194 -0
- package/tests/unit/ai-provider-vision.test.ts +224 -0
- package/tests/unit/claudemd-generator.test.ts +68 -0
- package/tests/unit/cli-mcp.test.ts +141 -0
- package/tests/unit/handlers.test.ts +171 -0
- package/tests/unit/invocation-guard.test.ts +125 -0
- package/tests/unit/queue.test.ts +272 -0
- package/tests/unit/router.test.ts +138 -0
- package/tests/unit/security.test.ts +128 -0
- package/tests/unit/skill-invocations-workflow.test.ts +495 -0
- package/tests/unit/skill-registry.test.ts +94 -0
- package/tests/unit/skills/invocation-guard-ttl.test.ts +211 -0
- package/tests/unit/skills/official-skills-loader.test.ts +126 -0
- package/tests/unit/skills/registry-multiformat.test.ts +92 -0
- package/tests/unit/storage/sessions-aggregate.test.ts +435 -0
- package/tests/unit/storage/sqlite-refactor-harness.test.ts +314 -0
- package/tests/unit/storage.test.ts +172 -0
- package/tests/unit/token-usage.test.ts +144 -0
- package/tests/unit/type-guards.test.ts +201 -0
- package/tests/unit/utils/format.test.ts +189 -0
- package/tests/unit/utils/session.test.ts +89 -0
- package/tests/unit/utils/time.test.ts +112 -0
- package/tests/unit/web/routes-auth.test.ts +93 -0
- package/tests/unit/web/routes-events.test.ts +101 -0
- package/tests/unit/web/routes-sessions.test.ts +181 -0
- package/tests/unit/web/routes-skill-stats.test.ts +179 -0
- package/tests/unit/web/routes-stats.test.ts +92 -0
- package/tests/unit/web/routes-tasks.test.ts +351 -0
- package/tsconfig.json +22 -0
- package/vitest.config.ts +21 -0
- package/vitest.integration.config.ts +16 -0
- package/web/CLAUDE.md +20 -0
- package/web/index.html +13 -0
- package/web/package-lock.json +4854 -0
- package/web/package.json +35 -0
- package/web/postcss.config.js +6 -0
- package/web/src/App.tsx +110 -0
- package/web/src/components/CodeBlock.tsx +31 -0
- package/web/src/components/Confirm.tsx +96 -0
- package/web/src/components/Drawer.tsx +60 -0
- package/web/src/components/Layout.tsx +145 -0
- package/web/src/components/MarkdownRenderer.tsx +77 -0
- package/web/src/components/SearchInput.tsx +31 -0
- package/web/src/components/SessionDetailContent.tsx +157 -0
- package/web/src/components/Toast.tsx +92 -0
- package/web/src/index.css +19 -0
- package/web/src/main.tsx +31 -0
- package/web/src/pages/AIConfig.tsx +233 -0
- package/web/src/pages/Dashboard.tsx +572 -0
- package/web/src/pages/Events.tsx +271 -0
- package/web/src/pages/Reports.tsx +428 -0
- package/web/src/pages/SessionDetail.tsx +162 -0
- package/web/src/pages/Sessions.tsx +205 -0
- package/web/src/pages/Skills.tsx +180 -0
- package/web/src/pages/TaskDetail.tsx +511 -0
- package/web/src/pages/Tasks.tsx +150 -0
- package/web/src/utils/auth.ts +59 -0
- package/web/src/utils/export.ts +54 -0
- package/web/src/utils/time.ts +13 -0
- package/web/tailwind.config.js +11 -0
- package/web/tsconfig.json +21 -0
- package/web/tsconfig.node.json +10 -0
- package/web/vite.config.ts +76 -0
- package/winspan-claude-forge-8.43.0.tgz +0 -0
- package/dist/agents/definition.d.ts +0 -62
- package/dist/agents/definition.d.ts.map +0 -1
- package/dist/agents/definition.js +0 -27
- package/dist/agents/definition.js.map +0 -1
- package/dist/agents/distributor.d.ts +0 -23
- package/dist/agents/distributor.d.ts.map +0 -1
- package/dist/agents/distributor.js +0 -85
- package/dist/agents/distributor.js.map +0 -1
- package/dist/agents/index.d.ts +0 -5
- package/dist/agents/index.d.ts.map +0 -1
- package/dist/agents/index.js +0 -5
- package/dist/agents/index.js.map +0 -1
- package/dist/agents/methodologies/agent-builder.d.ts +0 -21
- package/dist/agents/methodologies/agent-builder.d.ts.map +0 -1
- package/dist/agents/methodologies/agent-builder.js +0 -124
- package/dist/agents/methodologies/agent-builder.js.map +0 -1
- package/dist/agents/methodologies/phases/bmad/analyze.d.ts +0 -3
- package/dist/agents/methodologies/phases/bmad/analyze.d.ts.map +0 -1
- package/dist/agents/methodologies/phases/bmad/analyze.js +0 -18
- package/dist/agents/methodologies/phases/bmad/analyze.js.map +0 -1
- package/dist/agents/methodologies/phases/bmad/design.d.ts +0 -3
- package/dist/agents/methodologies/phases/bmad/design.d.ts.map +0 -1
- package/dist/agents/methodologies/phases/bmad/design.js +0 -17
- package/dist/agents/methodologies/phases/bmad/design.js.map +0 -1
- package/dist/agents/methodologies/phases/bmad/implement.d.ts +0 -3
- package/dist/agents/methodologies/phases/bmad/implement.d.ts.map +0 -1
- package/dist/agents/methodologies/phases/bmad/implement.js +0 -16
- package/dist/agents/methodologies/phases/bmad/implement.js.map +0 -1
- package/dist/agents/methodologies/phases/bmad/index.d.ts +0 -6
- package/dist/agents/methodologies/phases/bmad/index.d.ts.map +0 -1
- package/dist/agents/methodologies/phases/bmad/index.js +0 -6
- package/dist/agents/methodologies/phases/bmad/index.js.map +0 -1
- package/dist/agents/methodologies/phases/bmad/review.d.ts +0 -3
- package/dist/agents/methodologies/phases/bmad/review.d.ts.map +0 -1
- package/dist/agents/methodologies/phases/bmad/review.js +0 -16
- package/dist/agents/methodologies/phases/bmad/review.js.map +0 -1
- package/dist/agents/methodologies/phases/bmad/test.d.ts +0 -3
- package/dist/agents/methodologies/phases/bmad/test.d.ts.map +0 -1
- package/dist/agents/methodologies/phases/bmad/test.js +0 -20
- package/dist/agents/methodologies/phases/bmad/test.js.map +0 -1
- package/dist/agents/methodologies/phases/harness/fix.d.ts +0 -3
- package/dist/agents/methodologies/phases/harness/fix.d.ts.map +0 -1
- package/dist/agents/methodologies/phases/harness/fix.js +0 -16
- package/dist/agents/methodologies/phases/harness/fix.js.map +0 -1
- package/dist/agents/methodologies/phases/harness/index.d.ts +0 -6
- package/dist/agents/methodologies/phases/harness/index.d.ts.map +0 -1
- package/dist/agents/methodologies/phases/harness/index.js +0 -6
- package/dist/agents/methodologies/phases/harness/index.js.map +0 -1
- package/dist/agents/methodologies/phases/harness/reproduce.d.ts +0 -3
- package/dist/agents/methodologies/phases/harness/reproduce.d.ts.map +0 -1
- package/dist/agents/methodologies/phases/harness/reproduce.js +0 -19
- package/dist/agents/methodologies/phases/harness/reproduce.js.map +0 -1
- package/dist/agents/methodologies/phases/harness/root-cause.d.ts +0 -3
- package/dist/agents/methodologies/phases/harness/root-cause.d.ts.map +0 -1
- package/dist/agents/methodologies/phases/harness/root-cause.js +0 -20
- package/dist/agents/methodologies/phases/harness/root-cause.js.map +0 -1
- package/dist/agents/methodologies/phases/harness/safety-net.d.ts +0 -3
- package/dist/agents/methodologies/phases/harness/safety-net.d.ts.map +0 -1
- package/dist/agents/methodologies/phases/harness/safety-net.js +0 -16
- package/dist/agents/methodologies/phases/harness/safety-net.js.map +0 -1
- package/dist/agents/methodologies/phases/harness/verify.d.ts +0 -3
- package/dist/agents/methodologies/phases/harness/verify.d.ts.map +0 -1
- package/dist/agents/methodologies/phases/harness/verify.js +0 -21
- package/dist/agents/methodologies/phases/harness/verify.js.map +0 -1
- package/dist/agents/methodologies/presets.d.ts +0 -10
- package/dist/agents/methodologies/presets.d.ts.map +0 -1
- package/dist/agents/methodologies/presets.js +0 -79
- package/dist/agents/methodologies/presets.js.map +0 -1
- package/dist/agents/methodologies/types.d.ts +0 -43
- package/dist/agents/methodologies/types.d.ts.map +0 -1
- package/dist/agents/methodologies/types.js +0 -10
- package/dist/agents/methodologies/types.js.map +0 -1
- package/dist/agents/methodologies/user-config-loader.d.ts +0 -30
- package/dist/agents/methodologies/user-config-loader.d.ts.map +0 -1
- package/dist/agents/methodologies/user-config-loader.js +0 -159
- package/dist/agents/methodologies/user-config-loader.js.map +0 -1
- package/dist/agents/official-agents.d.ts +0 -4
- package/dist/agents/official-agents.d.ts.map +0 -1
- package/dist/agents/official-agents.js +0 -559
- package/dist/agents/official-agents.js.map +0 -1
- package/dist/agents/registry.d.ts +0 -57
- package/dist/agents/registry.d.ts.map +0 -1
- package/dist/agents/registry.js +0 -271
- package/dist/agents/registry.js.map +0 -1
- package/dist/capability/index.d.ts +0 -10
- package/dist/capability/index.d.ts.map +0 -1
- package/dist/capability/index.js +0 -10
- package/dist/capability/index.js.map +0 -1
- package/dist/capability/types.d.ts +0 -10
- package/dist/capability/types.d.ts.map +0 -1
- package/dist/capability/types.js +0 -10
- package/dist/capability/types.js.map +0 -1
- package/dist/cli/commands/agents.d.ts +0 -3
- package/dist/cli/commands/agents.d.ts.map +0 -1
- package/dist/cli/commands/agents.js +0 -62
- package/dist/cli/commands/agents.js.map +0 -1
- package/dist/cli/commands/rules.d.ts +0 -8
- package/dist/cli/commands/rules.d.ts.map +0 -1
- package/dist/cli/commands/rules.js +0 -89
- package/dist/cli/commands/rules.js.map +0 -1
- package/dist/daemon/auto-disable-scheduler.d.ts +0 -53
- package/dist/daemon/auto-disable-scheduler.d.ts.map +0 -1
- package/dist/daemon/auto-disable-scheduler.js +0 -114
- package/dist/daemon/auto-disable-scheduler.js.map +0 -1
- package/dist/daemon/handlers/pre-tool-use.d.ts +0 -30
- package/dist/daemon/handlers/pre-tool-use.d.ts.map +0 -1
- package/dist/daemon/handlers/pre-tool-use.js +0 -173
- package/dist/daemon/handlers/pre-tool-use.js.map +0 -1
- package/dist/daemon/routing-observer.d.ts +0 -42
- package/dist/daemon/routing-observer.d.ts.map +0 -1
- package/dist/daemon/routing-observer.js +0 -264
- package/dist/daemon/routing-observer.js.map +0 -1
- package/dist/daemon/routing-state.d.ts +0 -63
- package/dist/daemon/routing-state.d.ts.map +0 -1
- package/dist/daemon/routing-state.js +0 -223
- package/dist/daemon/routing-state.js.map +0 -1
- package/dist/engine/agent-router.d.ts +0 -142
- package/dist/engine/agent-router.d.ts.map +0 -1
- package/dist/engine/agent-router.js +0 -276
- package/dist/engine/agent-router.js.map +0 -1
- package/dist/engine/context-builder.d.ts +0 -23
- package/dist/engine/context-builder.d.ts.map +0 -1
- package/dist/engine/context-builder.js +0 -63
- package/dist/engine/context-builder.js.map +0 -1
- package/dist/engine/conventions/basic-security.yaml +0 -109
- package/dist/engine/conventions/code-quality.yaml +0 -123
- package/dist/engine/conventions/database-safety.yaml +0 -74
- package/dist/engine/conventions/dependency-safety.yaml +0 -132
- package/dist/engine/conventions/docker-safety.yaml +0 -69
- package/dist/engine/conventions/git-safety.yaml +0 -118
- package/dist/engine/conventions/go-best-practices.yaml +0 -84
- package/dist/engine/conventions/python-best-practices.yaml +0 -96
- package/dist/engine/conventions/react-best-practices.yaml +0 -96
- package/dist/engine/conventions/routing.yaml +0 -378
- package/dist/engine/conventions/strict-security.yaml +0 -30
- package/dist/engine/conventions/ts-quality.yaml +0 -49
- package/dist/engine/dsl/compiler.d.ts +0 -34
- package/dist/engine/dsl/compiler.d.ts.map +0 -1
- package/dist/engine/dsl/compiler.js +0 -702
- package/dist/engine/dsl/compiler.js.map +0 -1
- package/dist/engine/dsl/parser.d.ts +0 -25
- package/dist/engine/dsl/parser.d.ts.map +0 -1
- package/dist/engine/dsl/parser.js +0 -208
- package/dist/engine/dsl/parser.js.map +0 -1
- package/dist/engine/dsl/runtime.d.ts +0 -46
- package/dist/engine/dsl/runtime.d.ts.map +0 -1
- package/dist/engine/dsl/runtime.js +0 -173
- package/dist/engine/dsl/runtime.js.map +0 -1
- package/dist/engine/dsl/types.d.ts +0 -139
- package/dist/engine/dsl/types.d.ts.map +0 -1
- package/dist/engine/dsl/types.js +0 -11
- package/dist/engine/dsl/types.js.map +0 -1
- package/dist/engine/evidence-store.d.ts +0 -44
- package/dist/engine/evidence-store.d.ts.map +0 -1
- package/dist/engine/evidence-store.js +0 -109
- package/dist/engine/evidence-store.js.map +0 -1
- package/dist/engine/experiment-router.d.ts +0 -102
- package/dist/engine/experiment-router.d.ts.map +0 -1
- package/dist/engine/experiment-router.js +0 -289
- package/dist/engine/experiment-router.js.map +0 -1
- package/dist/engine/recommender.d.ts +0 -52
- package/dist/engine/recommender.d.ts.map +0 -1
- package/dist/engine/recommender.js +0 -162
- package/dist/engine/recommender.js.map +0 -1
- package/dist/engine/rule-engine.d.ts +0 -33
- package/dist/engine/rule-engine.d.ts.map +0 -1
- package/dist/engine/rule-engine.js +0 -250
- package/dist/engine/rule-engine.js.map +0 -1
- package/dist/intelligence/classifier.d.ts +0 -75
- package/dist/intelligence/classifier.d.ts.map +0 -1
- package/dist/intelligence/classifier.js +0 -352
- package/dist/intelligence/classifier.js.map +0 -1
- package/dist/intelligence/context-gatherer.d.ts +0 -101
- package/dist/intelligence/context-gatherer.d.ts.map +0 -1
- package/dist/intelligence/context-gatherer.js +0 -417
- package/dist/intelligence/context-gatherer.js.map +0 -1
- package/dist/intelligence/cot-classifier.d.ts +0 -95
- package/dist/intelligence/cot-classifier.d.ts.map +0 -1
- package/dist/intelligence/cot-classifier.js +0 -391
- package/dist/intelligence/cot-classifier.js.map +0 -1
- package/dist/intelligence/distiller.d.ts +0 -22
- package/dist/intelligence/distiller.d.ts.map +0 -1
- package/dist/intelligence/distiller.js +0 -108
- package/dist/intelligence/distiller.js.map +0 -1
- package/dist/intelligence/execution-doc-builder.d.ts +0 -151
- package/dist/intelligence/execution-doc-builder.d.ts.map +0 -1
- package/dist/intelligence/execution-doc-builder.js +0 -1018
- package/dist/intelligence/execution-doc-builder.js.map +0 -1
- package/dist/intelligence/intent-types.d.ts +0 -13
- package/dist/intelligence/intent-types.d.ts.map +0 -1
- package/dist/intelligence/intent-types.js +0 -19
- package/dist/intelligence/intent-types.js.map +0 -1
- package/dist/intelligence/multimodal-parser.d.ts +0 -105
- package/dist/intelligence/multimodal-parser.d.ts.map +0 -1
- package/dist/intelligence/multimodal-parser.js +0 -425
- package/dist/intelligence/multimodal-parser.js.map +0 -1
- package/dist/intelligence/quality-gate.d.ts +0 -45
- package/dist/intelligence/quality-gate.d.ts.map +0 -1
- package/dist/intelligence/quality-gate.js +0 -193
- package/dist/intelligence/quality-gate.js.map +0 -1
- package/dist/intelligence/task-segmenter.d.ts.map +0 -1
- package/dist/intelligence/task-segmenter.js.map +0 -1
- package/dist/web/routes/agents.d.ts +0 -7
- package/dist/web/routes/agents.d.ts.map +0 -1
- package/dist/web/routes/agents.js +0 -209
- package/dist/web/routes/agents.js.map +0 -1
- package/dist/web/routes/execution-trace.d.ts +0 -21
- package/dist/web/routes/execution-trace.d.ts.map +0 -1
- package/dist/web/routes/execution-trace.js +0 -353
- package/dist/web/routes/execution-trace.js.map +0 -1
- package/dist/web/routes/experiments.d.ts +0 -15
- package/dist/web/routes/experiments.d.ts.map +0 -1
- package/dist/web/routes/experiments.js +0 -187
- package/dist/web/routes/experiments.js.map +0 -1
- package/dist/web/routes/routing.d.ts +0 -17
- package/dist/web/routes/routing.d.ts.map +0 -1
- package/dist/web/routes/routing.js +0 -592
- package/dist/web/routes/routing.js.map +0 -1
- package/dist/web/routes/workflows.d.ts +0 -19
- package/dist/web/routes/workflows.d.ts.map +0 -1
- package/dist/web/routes/workflows.js +0 -86
- package/dist/web/routes/workflows.js.map +0 -1
- package/dist/web/static/assets/AIConfig-R5wZ3ZKT.js +0 -2
- package/dist/web/static/assets/AIConfig-R5wZ3ZKT.js.map +0 -1
- package/dist/web/static/assets/Agents-Beg34V1g.js +0 -2
- package/dist/web/static/assets/Agents-Beg34V1g.js.map +0 -1
- package/dist/web/static/assets/CodeBlock--H53gk46.js +0 -2
- package/dist/web/static/assets/CodeBlock--H53gk46.js.map +0 -1
- package/dist/web/static/assets/Dashboard-Cy1xsj1J.js +0 -2
- package/dist/web/static/assets/Dashboard-Cy1xsj1J.js.map +0 -1
- package/dist/web/static/assets/Events-mFhXl4zI.js +0 -2
- package/dist/web/static/assets/Events-mFhXl4zI.js.map +0 -1
- package/dist/web/static/assets/ExecutionTrace-DG901hLR.js +0 -3
- package/dist/web/static/assets/ExecutionTrace-DG901hLR.js.map +0 -1
- package/dist/web/static/assets/MarkdownRenderer-CCIz1MOz.js +0 -2
- package/dist/web/static/assets/MarkdownRenderer-CCIz1MOz.js.map +0 -1
- package/dist/web/static/assets/Routing-B7BFLfjh.js +0 -2
- package/dist/web/static/assets/Routing-B7BFLfjh.js.map +0 -1
- package/dist/web/static/assets/SessionDetail-BT0l4RrK.js +0 -2
- package/dist/web/static/assets/SessionDetail-BT0l4RrK.js.map +0 -1
- package/dist/web/static/assets/Sessions-C6J_HQ_u.js +0 -2
- package/dist/web/static/assets/Sessions-C6J_HQ_u.js.map +0 -1
- package/dist/web/static/assets/Skills-4DQWLaTv.js +0 -2
- package/dist/web/static/assets/Skills-4DQWLaTv.js.map +0 -1
- package/dist/web/static/assets/WorkflowDetail-zhNqUkBE.js +0 -2
- package/dist/web/static/assets/WorkflowDetail-zhNqUkBE.js.map +0 -1
- package/dist/web/static/assets/Workflows-Btvi-lGw.js +0 -2
- package/dist/web/static/assets/Workflows-Btvi-lGw.js.map +0 -1
- package/dist/web/static/assets/export-BQQZLaHV.js +0 -4
- package/dist/web/static/assets/export-BQQZLaHV.js.map +0 -1
- package/dist/web/static/assets/index-Cgr9qMtq.js +0 -3
- package/dist/web/static/assets/index-Cgr9qMtq.js.map +0 -1
- package/dist/web/static/assets/index-CngWb5gC.css +0 -1
- package/dist/web/static/assets/lucide-53bR2rki.js.map +0 -1
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InvocationGuard — Skill 调用防护机制
|
|
3
|
+
*
|
|
4
|
+
* 防止 Agent 陷入无限调用 Skill 的循环,限制:
|
|
5
|
+
* - 单会话总调用次数(默认 10)
|
|
6
|
+
* - 单会话调用深度(默认 3)
|
|
7
|
+
* - 同 session 同 skill 幂等(避免重复调用)
|
|
8
|
+
* - TTL 机制:会话状态 30 分钟后自动过期
|
|
9
|
+
*
|
|
10
|
+
* 状态为进程内存,进程重启会清空;调用链路通常集中在单个会话内,
|
|
11
|
+
* 重启后重建状态是可接受的。
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const MAX_INVOCATIONS_PER_SESSION = 10;
|
|
15
|
+
const MAX_INVOCATION_DEPTH = 3;
|
|
16
|
+
const SESSION_TTL_MS = 30 * 60 * 1000; // 30 minutes
|
|
17
|
+
const CLEANUP_INTERVAL_MS = 5 * 60 * 1000; // 5 minutes
|
|
18
|
+
|
|
19
|
+
export interface SessionInvocations {
|
|
20
|
+
total: number;
|
|
21
|
+
depth: number;
|
|
22
|
+
calledSkills: Set<string>;
|
|
23
|
+
lastAccessTime: number; // Timestamp of last access
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface InvocationCheckResult {
|
|
27
|
+
allowed: boolean;
|
|
28
|
+
reason?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class InvocationGuard {
|
|
32
|
+
private sessions = new Map<string, SessionInvocations>();
|
|
33
|
+
private cleanupTimer: NodeJS.Timeout | null = null;
|
|
34
|
+
|
|
35
|
+
constructor() {
|
|
36
|
+
// Start automatic cleanup timer
|
|
37
|
+
this.startCleanupTimer();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 检查是否允许调用。
|
|
42
|
+
* 不修改状态;调用方决定是否继续后调用 record()。
|
|
43
|
+
*/
|
|
44
|
+
check(sessionId: string, skillId: string): InvocationCheckResult {
|
|
45
|
+
const session = this.sessions.get(sessionId) ?? {
|
|
46
|
+
total: 0,
|
|
47
|
+
depth: 0,
|
|
48
|
+
calledSkills: new Set<string>(),
|
|
49
|
+
lastAccessTime: Date.now(),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// Check if session has expired
|
|
53
|
+
if (Date.now() - session.lastAccessTime > SESSION_TTL_MS) {
|
|
54
|
+
this.sessions.delete(sessionId);
|
|
55
|
+
return { allowed: true }; // Expired session, allow new invocation
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (session.total >= MAX_INVOCATIONS_PER_SESSION) {
|
|
59
|
+
return {
|
|
60
|
+
allowed: false,
|
|
61
|
+
reason: `Reached max invocations per session (${MAX_INVOCATIONS_PER_SESSION})`,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (session.depth >= MAX_INVOCATION_DEPTH) {
|
|
66
|
+
return {
|
|
67
|
+
allowed: false,
|
|
68
|
+
reason: `Reached max invocation depth (${MAX_INVOCATION_DEPTH})`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (session.calledSkills.has(skillId)) {
|
|
73
|
+
return {
|
|
74
|
+
allowed: false,
|
|
75
|
+
reason: `Skill '${skillId}' already invoked in this session (idempotent guard)`,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return { allowed: true };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 记录一次调用开始(递增 total 和 depth,登记 skill)。
|
|
84
|
+
*/
|
|
85
|
+
record(sessionId: string, skillId: string): void {
|
|
86
|
+
const session = this.sessions.get(sessionId) ?? {
|
|
87
|
+
total: 0,
|
|
88
|
+
depth: 0,
|
|
89
|
+
calledSkills: new Set<string>(),
|
|
90
|
+
lastAccessTime: Date.now(),
|
|
91
|
+
};
|
|
92
|
+
session.total += 1;
|
|
93
|
+
session.depth += 1;
|
|
94
|
+
session.calledSkills.add(skillId);
|
|
95
|
+
session.lastAccessTime = Date.now(); // Update access time
|
|
96
|
+
this.sessions.set(sessionId, session);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 调用完成,递减 depth(不清除已调用 skills)。
|
|
101
|
+
*/
|
|
102
|
+
complete(sessionId: string): void {
|
|
103
|
+
const session = this.sessions.get(sessionId);
|
|
104
|
+
if (session) {
|
|
105
|
+
session.depth = Math.max(0, session.depth - 1);
|
|
106
|
+
session.lastAccessTime = Date.now(); // Update access time
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 清理会话(Stop hook 或会话结束时调用)。
|
|
112
|
+
*/
|
|
113
|
+
clear(sessionId: string): void {
|
|
114
|
+
this.sessions.delete(sessionId);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 获取会话统计(调试/观测用)。
|
|
119
|
+
*/
|
|
120
|
+
getStats(sessionId: string): SessionInvocations | null {
|
|
121
|
+
return this.sessions.get(sessionId) ?? null;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 清理过期会话(TTL 机制)。
|
|
126
|
+
*/
|
|
127
|
+
private cleanupExpiredSessions(): void {
|
|
128
|
+
const now = Date.now();
|
|
129
|
+
const expiredSessions: string[] = [];
|
|
130
|
+
|
|
131
|
+
for (const [sessionId, session] of this.sessions.entries()) {
|
|
132
|
+
if (now - session.lastAccessTime > SESSION_TTL_MS) {
|
|
133
|
+
expiredSessions.push(sessionId);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
for (const sessionId of expiredSessions) {
|
|
138
|
+
this.sessions.delete(sessionId);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (expiredSessions.length > 0) {
|
|
142
|
+
// Use console.log instead of logger to avoid circular dependency
|
|
143
|
+
console.log(`[InvocationGuard] Cleaned up ${expiredSessions.length} expired sessions`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 启动自动清理定时器。
|
|
149
|
+
*/
|
|
150
|
+
private startCleanupTimer(): void {
|
|
151
|
+
if (this.cleanupTimer) return;
|
|
152
|
+
|
|
153
|
+
this.cleanupTimer = setInterval(() => {
|
|
154
|
+
this.cleanupExpiredSessions();
|
|
155
|
+
}, CLEANUP_INTERVAL_MS);
|
|
156
|
+
|
|
157
|
+
// Prevent timer from keeping process alive
|
|
158
|
+
this.cleanupTimer.unref();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* 停止自动清理定时器(用于测试或进程关闭)。
|
|
163
|
+
*/
|
|
164
|
+
stopCleanupTimer(): void {
|
|
165
|
+
if (this.cleanupTimer) {
|
|
166
|
+
clearInterval(this.cleanupTimer);
|
|
167
|
+
this.cleanupTimer = null;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* 获取当前会话数量(用于监控)。
|
|
173
|
+
*/
|
|
174
|
+
getSessionCount(): number {
|
|
175
|
+
return this.sessions.size;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { Skill } from './registry.js';
|
|
2
|
+
|
|
3
|
+
export interface MatchContext {
|
|
4
|
+
prompt: string;
|
|
5
|
+
intentKeywords?: string[];
|
|
6
|
+
projectPath?: string;
|
|
7
|
+
recentFiles?: string[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface MatchResult {
|
|
11
|
+
skill: Skill;
|
|
12
|
+
confidence: number; // 0-100
|
|
13
|
+
matchedKeywords: string[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Enhanced keyword matching with word boundary detection
|
|
18
|
+
* Reduces false positives by requiring whole-word matches
|
|
19
|
+
*/
|
|
20
|
+
function matchKeywordStrict(text: string, keyword: string): boolean {
|
|
21
|
+
const textLower = text.toLowerCase();
|
|
22
|
+
const kwLower = keyword.toLowerCase();
|
|
23
|
+
|
|
24
|
+
// For Chinese/multi-word keywords, use simple includes
|
|
25
|
+
if (kwLower.includes(' ') || /[一-龥]/.test(kwLower)) {
|
|
26
|
+
return textLower.includes(kwLower);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// For single English word keywords, require word boundaries
|
|
30
|
+
const regex = new RegExp(`\\b${kwLower.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\b`);
|
|
31
|
+
return regex.test(textLower);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Calculate match confidence score (0-100)
|
|
36
|
+
*/
|
|
37
|
+
export function calculateMatchScore(skill: Skill, context: MatchContext): MatchResult | null {
|
|
38
|
+
const { prompt, intentKeywords = [] } = context;
|
|
39
|
+
const allText = [prompt, ...intentKeywords].join(' ');
|
|
40
|
+
|
|
41
|
+
let matchedKeywords: string[] = [];
|
|
42
|
+
let score = 0;
|
|
43
|
+
|
|
44
|
+
// 1. Keyword matching with flexible scoring
|
|
45
|
+
for (const kw of skill.keywords) {
|
|
46
|
+
if (matchKeywordStrict(allText, kw)) {
|
|
47
|
+
matchedKeywords.push(kw);
|
|
48
|
+
// Base score: 15 points per keyword
|
|
49
|
+
// Bonus for longer keywords (more specific)
|
|
50
|
+
const lengthBonus = Math.min(10, Math.floor(kw.length / 3));
|
|
51
|
+
score += 15 + lengthBonus;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 2. Negative keywords check (disqualify if present)
|
|
56
|
+
const negativeKeywords = getNegativeKeywords(skill.id);
|
|
57
|
+
for (const negKw of negativeKeywords) {
|
|
58
|
+
if (matchKeywordStrict(allText, negKw)) {
|
|
59
|
+
return null; // Disqualify
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// 3. Context bonus (max 30 points)
|
|
64
|
+
const contextBonus = calculateContextBonus(skill, context);
|
|
65
|
+
score += contextBonus;
|
|
66
|
+
|
|
67
|
+
// 4. Fuzzy matching: partial keyword match for longer prompts
|
|
68
|
+
if (matchedKeywords.length === 0 && prompt.length > 50) {
|
|
69
|
+
for (const kw of skill.keywords) {
|
|
70
|
+
if (kw.length >= 3 && allText.toLowerCase().includes(kw.toLowerCase().slice(0, 3))) {
|
|
71
|
+
score = Math.max(score, 25);
|
|
72
|
+
matchedKeywords.push(`~${kw}`);
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Normalize to 0-100
|
|
79
|
+
const confidence = Math.min(100, score);
|
|
80
|
+
|
|
81
|
+
// Threshold: >= 20% confidence is enough to surface a match
|
|
82
|
+
if (confidence < 20) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
skill,
|
|
88
|
+
confidence,
|
|
89
|
+
matchedKeywords,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get negative keywords that disqualify a skill
|
|
95
|
+
*/
|
|
96
|
+
function getNegativeKeywords(skillId: string): string[] {
|
|
97
|
+
const negativeMap: Record<string, string[]> = {
|
|
98
|
+
'official-tdd': ['existing', 'legacy', 'refactor', '重构', '遗留'],
|
|
99
|
+
'official-harness-engineering': ['new feature', '新功能', 'from scratch'],
|
|
100
|
+
'official-debug': ['working', 'works fine', '正常'],
|
|
101
|
+
'official-performance-optimization': ['slow network', 'api timeout', '网络慢'],
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
return negativeMap[skillId] || [];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Calculate context-based bonus score
|
|
109
|
+
*/
|
|
110
|
+
function calculateContextBonus(skill: Skill, context: MatchContext): number {
|
|
111
|
+
let bonus = 0;
|
|
112
|
+
|
|
113
|
+
// File extension matching
|
|
114
|
+
if (context.recentFiles && context.recentFiles.length > 0) {
|
|
115
|
+
const fileExts = context.recentFiles.map(f => f.split('.').pop()?.toLowerCase());
|
|
116
|
+
|
|
117
|
+
if (skill.id === 'official-tdd' && fileExts.some(ext => ext === 'test' || ext === 'spec')) {
|
|
118
|
+
bonus += 20;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (skill.id === 'webapp-testing' && fileExts.some(ext => ['tsx', 'jsx', 'html'].includes(ext || ''))) {
|
|
122
|
+
bonus += 20;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (skill.id === 'official-db-schema-design' && fileExts.some(ext => ext === 'sql')) {
|
|
126
|
+
bonus += 20;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return bonus;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Check if any of the skill's keywords appear in the prompt (case-insensitive).
|
|
135
|
+
* @deprecated Use calculateMatchScore instead
|
|
136
|
+
*/
|
|
137
|
+
export function matchKeywords(prompt: string, skillKeywords: string[]): boolean {
|
|
138
|
+
const promptLower = prompt.toLowerCase();
|
|
139
|
+
return skillKeywords.some(kw => promptLower.includes(kw.toLowerCase()));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Format a skill as a recommendation message for the user.
|
|
144
|
+
*/
|
|
145
|
+
export function formatSkillRecommendation(skill: Skill, confidence?: number): string {
|
|
146
|
+
const confidenceStr = confidence ? ` (${confidence}% 匹配)` : '';
|
|
147
|
+
return `[Forge 技能推荐]${confidenceStr} ${skill.name}\n\n${skill.content}`;
|
|
148
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-simplifier
|
|
3
|
+
description: Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Focuses on recently modified code unless instructed otherwise.
|
|
4
|
+
model: opus
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are an expert code simplification specialist focused on enhancing code clarity, consistency, and maintainability while preserving exact functionality. Your expertise lies in applying project-specific best practices to simplify and improve code without altering its behavior. You prioritize readable, explicit code over overly compact solutions. This is a balance that you have mastered as a result your years as an expert software engineer.
|
|
8
|
+
|
|
9
|
+
You will analyze recently modified code and apply refinements that:
|
|
10
|
+
|
|
11
|
+
1. **Preserve Functionality**: Never change what the code does - only how it does it. All original features, outputs, and behaviors must remain intact.
|
|
12
|
+
|
|
13
|
+
2. **Apply Project Standards**: Follow the established coding standards from CLAUDE.md including:
|
|
14
|
+
|
|
15
|
+
- Use ES modules with proper import sorting and extensions
|
|
16
|
+
- Prefer `
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: find-skills
|
|
3
|
+
description: Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Find Skills
|
|
7
|
+
|
|
8
|
+
This skill helps you discover and install skills from the open agent skills ecosystem.
|
|
9
|
+
|
|
10
|
+
## When to Use This Skill
|
|
11
|
+
|
|
12
|
+
Use this skill when the user:
|
|
13
|
+
|
|
14
|
+
- Asks "how do I do X" where X might be a common task with an existing skill
|
|
15
|
+
- Says "find a skill for X" or "is there a skill for X"
|
|
16
|
+
- Asks "can you do X" where X is a specialized capability
|
|
17
|
+
- Expresses interest in extending agent capabilities
|
|
18
|
+
- Wants to search for tools, templates, or workflows
|
|
19
|
+
- Mentions they wish they had help with a specific domain (design, testing, deployment, etc.)
|
|
20
|
+
|
|
21
|
+
## What is the Skills CLI?
|
|
22
|
+
|
|
23
|
+
The Skills CLI (`
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: official-api-design
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "API 设计规范:RESTful/RPC 接口设计最佳实践"
|
|
5
|
+
tags: [api, rest, design, backend]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# API 设计规范
|
|
9
|
+
|
|
10
|
+
## 设计顺序
|
|
11
|
+
1. 先定义资源和操作(不要先想 URL)
|
|
12
|
+
2. 写 OpenAPI/Protobuf 规格
|
|
13
|
+
3. 用 mock 验证调用方能用
|
|
14
|
+
4. 再实现
|
|
15
|
+
|
|
16
|
+
## RESTful 规范
|
|
17
|
+
- URL 用名词复数:`
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: official-architecture-decision
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "架构决策记录(ADR):结构化记录重要技术决策"
|
|
5
|
+
tags: [architecture, adr, design, decision]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 架构决策记录(ADR)
|
|
9
|
+
|
|
10
|
+
每个重要的技术决策都应该留下可追溯的记录。
|
|
11
|
+
|
|
12
|
+
## 何时写 ADR
|
|
13
|
+
- 技术选型(框架、数据库、消息队列)
|
|
14
|
+
- 系统边界划分
|
|
15
|
+
- 接口协议选择
|
|
16
|
+
- 影响超过 1 个模块的设计决策
|
|
17
|
+
|
|
18
|
+
## ADR 模板
|
|
19
|
+
|
|
20
|
+
`
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: official-bmad
|
|
3
|
+
version: 1.0.1
|
|
4
|
+
description: "BMAD 方法论:四角色敏捷协作指南(完整四阶段流程)"
|
|
5
|
+
tags: [bmad, agile, four-role, collaboration]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# BMAD 方法论(Four-Role Agile)
|
|
9
|
+
|
|
10
|
+
BMAD 是一种四角色敏捷协作模式,适用于复杂功能开发和端到端的用户故事实现。
|
|
11
|
+
|
|
12
|
+
## 核心理念
|
|
13
|
+
|
|
14
|
+
通过明确的角色划分和阶段流程,确保需求、设计、实现和评审的质量。
|
|
15
|
+
|
|
16
|
+
## 四个角色
|
|
17
|
+
|
|
18
|
+
1. **Business(业务/产品经理)**:定义需求和验收标准
|
|
19
|
+
2. **Maker(实现者/开发者)**:编写代码和实现功能
|
|
20
|
+
3. **Architect(架构师)**:设计系统结构和接口
|
|
21
|
+
4. **Developer(开发/集成者)**:集成和测试
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 阶段 1:分析(Analyze)
|
|
26
|
+
|
|
27
|
+
**角色**:Business + Architect
|
|
28
|
+
|
|
29
|
+
**目标**:澄清需求,识别技术约束和依赖。
|
|
30
|
+
|
|
31
|
+
**步骤**:
|
|
32
|
+
1. 澄清需求(用户故事、验收标准)
|
|
33
|
+
2. 识别技术约束和依赖
|
|
34
|
+
3. 评估风险和可行性
|
|
35
|
+
4. 定义输入输出和边界条件
|
|
36
|
+
|
|
37
|
+
**输出**:需求文档(requirements document)
|
|
38
|
+
|
|
39
|
+
**建议**:调用 `researcher` 或 `planner` Agent
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 阶段 2:设计(Design)
|
|
44
|
+
|
|
45
|
+
**角色**:Architect + Developer
|
|
46
|
+
|
|
47
|
+
**目标**:设计技术方案和模块结构。
|
|
48
|
+
|
|
49
|
+
**步骤**:
|
|
50
|
+
1. 设计模块划分和接口
|
|
51
|
+
2. 选择技术栈和工具
|
|
52
|
+
3. 制定实施计划
|
|
53
|
+
4. 设计数据流和架构图
|
|
54
|
+
5. 定义模块间的接口契约
|
|
55
|
+
|
|
56
|
+
**输出**:设计文档(design document)
|
|
57
|
+
|
|
58
|
+
**建议**:调用 `planner` Agent
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 阶段 3:实现(Implement)
|
|
63
|
+
|
|
64
|
+
**角色**:Maker + Developer
|
|
65
|
+
|
|
66
|
+
**目标**:按设计编写代码并集成。
|
|
67
|
+
|
|
68
|
+
**步骤**:
|
|
69
|
+
1. 按设计编写代码
|
|
70
|
+
2. 编写单元测试
|
|
71
|
+
3. 遵循编码规范
|
|
72
|
+
4. 集成到主分支
|
|
73
|
+
5. 编写清晰、可维护的代码
|
|
74
|
+
|
|
75
|
+
**输出**:可运行的代码和测试
|
|
76
|
+
|
|
77
|
+
**建议**:调用 `coder` 或 `feature-developer` Agent
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 阶段 4:评审(Review)
|
|
82
|
+
|
|
83
|
+
**角色**:全员(Tech Lead 主导)
|
|
84
|
+
|
|
85
|
+
**目标**:确保代码质量、安全性和可维护性。
|
|
86
|
+
|
|
87
|
+
**步骤**:
|
|
88
|
+
1. Code review(检查代码质量)
|
|
89
|
+
2. 功能验收(Business 验证是否满足需求)
|
|
90
|
+
3. 技术债评估(Architect 审查架构合理性)
|
|
91
|
+
4. 安全性检查
|
|
92
|
+
5. 性能评估
|
|
93
|
+
|
|
94
|
+
**输出**:评审报告(review report)
|
|
95
|
+
|
|
96
|
+
**建议**:调用 `reviewer` Agent
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 何时使用
|
|
101
|
+
|
|
102
|
+
- 跨职能团队协作
|
|
103
|
+
- 复杂功能需要多角色参与
|
|
104
|
+
- 需要明确的职责划分
|
|
105
|
+
- 用户故事级别的完整功能开发
|
|
106
|
+
- Sprint 迭代开发
|
|
107
|
+
- 端到端(end-to-end)功能实现
|
|
108
|
+
|
|
109
|
+
## 决策规则
|
|
110
|
+
|
|
111
|
+
- **简单功能**(complexity: simple):只需实现阶段
|
|
112
|
+
- **中等功能**(complexity: moderate):设计 + 实现 + 评审
|
|
113
|
+
- **复杂功能**(complexity: complex):完整四阶段流程
|
|
114
|
+
|
|
115
|
+
## 参考
|
|
116
|
+
|
|
117
|
+
- BMAD Framework: https://bmad.dev
|
|
118
|
+
- Four-Role Agile Development Methodology
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: official-db-schema-design
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "数据库 Schema 设计:建模、迁移和演进最佳实践"
|
|
5
|
+
tags: [database, schema, sql, migration]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 数据库 Schema 设计
|
|
9
|
+
|
|
10
|
+
## 设计原则
|
|
11
|
+
- 先建模(ER 图),再建表
|
|
12
|
+
- 每张表只表达一个实体
|
|
13
|
+
- 外键约束在数据库层面强制
|
|
14
|
+
|
|
15
|
+
## 命名规范
|
|
16
|
+
- 表名:snake_case 复数(`
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: official-debug
|
|
3
|
+
version: 1.2.0
|
|
4
|
+
description: "系统化调试工作流:复现、隔离、修复、验证"
|
|
5
|
+
tags: [debug, troubleshooting]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 系统化调试
|
|
9
|
+
|
|
10
|
+
## 步骤
|
|
11
|
+
|
|
12
|
+
1. **复现** — 确认 bug 可稳定复现
|
|
13
|
+
- 记录:环境、输入、期望行为、实际行为
|
|
14
|
+
|
|
15
|
+
2. **隔离** — 缩小根因范围
|
|
16
|
+
- 二分法排查代码路径
|
|
17
|
+
- 检查近期变更(`
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: official-doc-driven
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: "文档驱动开发:先写文档再写代码,保持文档与代码同步"
|
|
5
|
+
tags: [documentation, doc-driven, readme]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# 文档驱动开发
|
|
9
|
+
|
|
10
|
+
## 核心理念
|
|
11
|
+
如果你无法清晰地写出来,说明你还没想清楚。先写文档,逼自己想清楚再动手。
|
|
12
|
+
|
|
13
|
+
## 步骤
|
|
14
|
+
|
|
15
|
+
1. **写 README 先于代码**
|
|
16
|
+
- 描述模块是什么、解决什么问题
|
|
17
|
+
- 写出使用示例(即使 API 还不存在)
|
|
18
|
+
- 示例写起来别扭 = 设计有问题
|
|
19
|
+
|
|
20
|
+
2. **接口文档先于实现**
|
|
21
|
+
- 函数签名 + JSDoc/注释先写
|
|
22
|
+
- 参数、返回值、异常都要说明
|
|
23
|
+
|
|
24
|
+
3. **保持同步**
|
|
25
|
+
- 代码变更时同步更新文档
|
|
26
|
+
- PR 模板加入"文档是否已更新"检查项
|
|
27
|
+
|
|
28
|
+
## 文档层级
|
|
29
|
+
- README:模块概述 + 快速开始
|
|
30
|
+
- ARCHITECTURE.md:系统设计和关键决策
|
|
31
|
+
- 代码注释:解释"为什么",不解释"是什么"
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: official-harness-engineering
|
|
3
|
+
version: 2.0.1
|
|
4
|
+
description: "Harness Engineering:为遗留代码建立测试防护网再安全修改(四阶段完整指南)"
|
|
5
|
+
tags: [harness, testing, legacy, refactor]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Harness Engineering 方法论
|
|
9
|
+
|
|
10
|
+
当需要重构遗留代码(尤其是缺少测试的代码)时,按以下四阶段推进。
|
|
11
|
+
|
|
12
|
+
## 核心理念
|
|
13
|
+
|
|
14
|
+
在修改任何现有代码前,先建立测试防护网(harness),确保改动不破坏现有行为。
|
|
15
|
+
|
|
16
|
+
## 与 TDD 的区别
|
|
17
|
+
- TDD 用于新功能开发(先测试后实现)
|
|
18
|
+
- Harness Engineering 用于改动现有代码(先理解后保护再修改)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 阶段 1:理解现有实现(Understand)
|
|
23
|
+
|
|
24
|
+
**目标**:深入理解代码的当前行为和依赖关系。
|
|
25
|
+
|
|
26
|
+
**步骤**:
|
|
27
|
+
1. 阅读目标代码,识别关键逻辑和边界条件
|
|
28
|
+
2. 绘制依赖关系图(哪些模块依赖这段代码)
|
|
29
|
+
3. 识别潜在的副作用和隐藏依赖
|
|
30
|
+
4. 找到所有入口点和输出点
|
|
31
|
+
5. 记录边界条件和隐含假设
|
|
32
|
+
|
|
33
|
+
**输出**:行为文档(behavior document),记录当前实际行为
|
|
34
|
+
|
|
35
|
+
**建议**:调用 `researcher` Agent 进行深度分析
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## 阶段 2:建立特征测试(Characterize)
|
|
40
|
+
|
|
41
|
+
**目标**:为现有行为建立测试"安全网"。
|
|
42
|
+
|
|
43
|
+
**步骤**:
|
|
44
|
+
1. 编写特征测试(Characterization Tests)— 记录当前行为,无论对错
|
|
45
|
+
2. 覆盖所有已知的输入输出组合
|
|
46
|
+
3. 覆盖所有主要代码路径
|
|
47
|
+
4. 确保测试全绿(即使代码有 bug,先记录现状)
|
|
48
|
+
5. 目标覆盖率 > 80%
|
|
49
|
+
|
|
50
|
+
**关键原则**:
|
|
51
|
+
- 测试描述"代码现在做什么",不是"应该做什么"
|
|
52
|
+
- 全部通过后才能继续下一阶段
|
|
53
|
+
|
|
54
|
+
**建议**:调用 `tester` Agent 编写测试
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 阶段 3:安全重构(Refactor)
|
|
59
|
+
|
|
60
|
+
**目标**:在测试保护下进行重构。
|
|
61
|
+
|
|
62
|
+
**步骤**:
|
|
63
|
+
1. 小步重构(每次改动后立即运行测试)
|
|
64
|
+
2. 消除重复代码、提取函数、改善命名
|
|
65
|
+
3. 保持测试全绿
|
|
66
|
+
4. 每次只改一处,改完立即运行 harness
|
|
67
|
+
5. 测试失败 = 立即回滚,不要积累未验证的变更
|
|
68
|
+
|
|
69
|
+
**重构优先级**:
|
|
70
|
+
- 消除重复代码
|
|
71
|
+
- 提取函数和模块
|
|
72
|
+
- 改善命名和注释
|
|
73
|
+
- 简化复杂逻辑
|
|
74
|
+
|
|
75
|
+
**建议**:调用 `refactor-specialist` Agent 执行重构
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 阶段 4:验证重构结果(Verify)
|
|
80
|
+
|
|
81
|
+
**目标**:确认重构没有破坏功能。
|
|
82
|
+
|
|
83
|
+
**步骤**:
|
|
84
|
+
1. 运行完整测试套件
|
|
85
|
+
2. 手动验证关键路径
|
|
86
|
+
3. Code review
|
|
87
|
+
4. 对比原始行为文档,确认行为一致性
|
|
88
|
+
5. 逐步替换:新行为用新测试覆盖,旧 harness 逐步退役
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 何时使用
|
|
93
|
+
|
|
94
|
+
- 遗留代码缺少测试
|
|
95
|
+
- 代码复杂度高,不敢直接改
|
|
96
|
+
- 需要大规模重构但风险高
|
|
97
|
+
- 接手不熟悉的代码库
|
|
98
|
+
- 修改高风险核心模块
|
|
99
|
+
|
|
100
|
+
## 决策规则
|
|
101
|
+
|
|
102
|
+
- **简单重构**(complexity: simple):跳过理解阶段,直接建立特征测试
|
|
103
|
+
- **中等重构**(complexity: moderate):完整四阶段流程
|
|
104
|
+
- **复杂迁移**(complexity: complex):完整四阶段流程,额外谨慎
|
|
105
|
+
|
|
106
|
+
## 参考
|
|
107
|
+
|
|
108
|
+
- Michael Feathers, *Working Effectively with Legacy Code*
|