@winspan/claude-forge 8.41.0 → 8.51.0
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 +420 -12
- 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 +6 -3
- 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/claudemd/templates/swarm-protocol.md +222 -0
- 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 +204 -12
- package/dist/cli/commands/daemon.js.map +1 -1
- package/dist/cli/commands/executions.d.ts.map +1 -1
- package/dist/cli/commands/executions.js +4 -3
- package/dist/cli/commands/executions.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +5 -37
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/logs.js.map +1 -1
- package/dist/cli/commands/mcp.d.ts.map +1 -1
- package/dist/cli/commands/mcp.js +3 -5
- package/dist/cli/commands/mcp.js.map +1 -1
- package/dist/cli/commands/menu.d.ts.map +1 -1
- package/dist/cli/commands/menu.js +14 -13
- 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 +2 -20
- package/dist/cli/commands/stats.js.map +1 -1
- package/dist/cli/commands/status.js +2 -2
- package/dist/cli/commands/status.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 +125 -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/cli/init/hook-manager.d.ts.map +1 -1
- package/dist/cli/init/hook-manager.js +2 -2
- package/dist/cli/init/hook-manager.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 +2 -2
- 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 +23 -6
- package/dist/core/config.js.map +1 -1
- package/dist/core/constants.d.ts +14 -3
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/constants.js +17 -3
- package/dist/core/constants.js.map +1 -1
- package/dist/core/event-fields.d.ts +16 -0
- package/dist/core/event-fields.d.ts.map +1 -0
- package/dist/core/event-fields.js +19 -0
- package/dist/core/event-fields.js.map +1 -0
- 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 +175 -0
- package/dist/core/queue/index.js.map +1 -0
- package/dist/core/storage/base.d.ts +66 -0
- package/dist/core/storage/base.d.ts.map +1 -0
- package/dist/core/storage/base.js +254 -0
- package/dist/core/storage/base.js.map +1 -0
- package/dist/core/storage/events.d.ts +141 -0
- package/dist/core/storage/events.d.ts.map +1 -0
- package/dist/core/storage/events.js +348 -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 +124 -0
- package/dist/core/storage/routing.d.ts.map +1 -0
- package/dist/core/storage/routing.js +239 -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 +85 -137
- package/dist/core/storage/sessions.d.ts +54 -0
- package/dist/core/storage/sessions.d.ts.map +1 -0
- package/dist/core/storage/sessions.js +137 -0
- package/dist/core/storage/sessions.js.map +1 -0
- package/dist/core/storage/skills.d.ts +63 -0
- package/dist/core/storage/skills.d.ts.map +1 -0
- package/dist/core/storage/skills.js +154 -0
- package/dist/core/storage/skills.js.map +1 -0
- package/dist/core/storage/sqlite.d.ts +97 -266
- package/dist/core/storage/sqlite.d.ts.map +1 -1
- package/dist/core/storage/sqlite.js +196 -764
- package/dist/core/storage/sqlite.js.map +1 -1
- package/dist/core/storage/tasks.d.ts +113 -0
- package/dist/core/storage/tasks.d.ts.map +1 -0
- package/dist/core/storage/tasks.js +276 -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 +83 -6
- 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/error-handler.d.ts.map +1 -1
- package/dist/core/utils/error-handler.js +3 -2
- package/dist/core/utils/error-handler.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/git.d.ts +10 -0
- package/dist/core/utils/git.d.ts.map +1 -0
- package/dist/core/utils/git.js +24 -0
- package/dist/core/utils/git.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 +87 -3
- package/dist/core/utils/logger.js.map +1 -1
- package/dist/core/utils/lru-cache.d.ts +1 -0
- package/dist/core/utils/lru-cache.d.ts.map +1 -1
- package/dist/core/utils/lru-cache.js +3 -0
- package/dist/core/utils/lru-cache.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/core/utils/token-tracker.js +1 -1
- package/dist/core/utils/token-tracker.js.map +1 -1
- package/dist/daemon/event-parser.d.ts.map +1 -1
- package/dist/daemon/event-parser.js +2 -1
- package/dist/daemon/event-parser.js.map +1 -1
- 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 +25 -79
- package/dist/daemon/handlers/post-tool-use.js.map +1 -1
- package/dist/daemon/handlers/stop.d.ts +28 -12
- package/dist/daemon/handlers/stop.d.ts.map +1 -1
- package/dist/daemon/handlers/stop.js +129 -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 +93 -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 +97 -127
- 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 +47 -4
- 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 +6 -4
- package/dist/daemon/server.d.ts.map +1 -1
- package/dist/daemon/server.js +80 -88
- package/dist/daemon/server.js.map +1 -1
- 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 +30 -7
- package/dist/daemon/services/task-segmenter.js.map +1 -0
- package/dist/hooks/hook-lib.sh +118 -0
- package/dist/hooks/notification.sh +9 -5
- package/dist/hooks/post-tool-use.sh +10 -6
- package/dist/hooks/pre-tool-use.sh +9 -6
- package/dist/hooks/stop.sh +10 -7
- package/dist/hooks/user-prompt-submit.sh +10 -11
- 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/web/analytics/anti-pattern-detector.d.ts +49 -0
- package/dist/web/analytics/anti-pattern-detector.d.ts.map +1 -0
- package/dist/web/analytics/anti-pattern-detector.js +318 -0
- package/dist/web/analytics/anti-pattern-detector.js.map +1 -0
- package/dist/web/analytics/drift-detector.d.ts +64 -0
- package/dist/web/analytics/drift-detector.d.ts.map +1 -0
- package/dist/web/analytics/drift-detector.js +198 -0
- package/dist/web/analytics/drift-detector.js.map +1 -0
- package/dist/web/analytics/weekly-report.d.ts +91 -0
- package/dist/web/analytics/weekly-report.d.ts.map +1 -0
- package/dist/web/analytics/weekly-report.js +328 -0
- package/dist/web/analytics/weekly-report.js.map +1 -0
- package/dist/web/auth-middleware.d.ts.map +1 -1
- package/dist/web/auth-middleware.js +1 -2
- package/dist/web/auth-middleware.js.map +1 -1
- package/dist/web/routes/_helpers.d.ts +16 -0
- package/dist/web/routes/_helpers.d.ts.map +1 -0
- package/dist/web/routes/_helpers.js +32 -0
- package/dist/web/routes/_helpers.js.map +1 -0
- 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 +13 -3
- package/dist/web/routes/rules.d.ts.map +1 -1
- package/dist/web/routes/rules.js +58 -97
- 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 +43 -69
- package/dist/web/routes/sessions.js.map +1 -1
- package/dist/web/routes/skill-stats.d.ts +2 -0
- package/dist/web/routes/skill-stats.d.ts.map +1 -1
- package/dist/web/routes/skill-stats.js +41 -39
- 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 +39 -4
- package/dist/web/routes/skills.js.map +1 -1
- package/dist/web/routes/stats.d.ts +11 -0
- package/dist/web/routes/stats.d.ts.map +1 -0
- package/dist/web/routes/stats.js +42 -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 +156 -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 +113 -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 +12 -20
- 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-CdDWzJyO.js +2 -0
- package/dist/web/static/assets/AIConfig-CdDWzJyO.js.map +1 -0
- package/dist/web/static/assets/Dashboard-CoEmmIDt.js +2 -0
- package/dist/web/static/assets/Dashboard-CoEmmIDt.js.map +1 -0
- package/dist/web/static/assets/{Drawer-DcU3ln98.js → Drawer-DdRTzlLB.js} +2 -2
- package/dist/web/static/assets/{Drawer-DcU3ln98.js.map → Drawer-DdRTzlLB.js.map} +1 -1
- package/dist/web/static/assets/Events-DrIq1SUS.js +2 -0
- package/dist/web/static/assets/Events-DrIq1SUS.js.map +1 -0
- package/dist/web/static/assets/Reports-DFBM3MDK.js +2 -0
- package/dist/web/static/assets/Reports-DFBM3MDK.js.map +1 -0
- package/dist/web/static/assets/SearchInput-qCj_jAcf.js +2 -0
- package/dist/web/static/assets/SearchInput-qCj_jAcf.js.map +1 -0
- package/dist/web/static/assets/SessionDetail-CCzwdoT7.js +2 -0
- package/dist/web/static/assets/SessionDetail-CCzwdoT7.js.map +1 -0
- package/dist/web/static/assets/Sessions-FfLYkAw9.js +2 -0
- package/dist/web/static/assets/Sessions-FfLYkAw9.js.map +1 -0
- package/dist/web/static/assets/Skills-C8Gvs3Qa.js +2 -0
- package/dist/web/static/assets/Skills-C8Gvs3Qa.js.map +1 -0
- package/dist/web/static/assets/TaskDetail-BS8pYhaR.js +2 -0
- package/dist/web/static/assets/TaskDetail-BS8pYhaR.js.map +1 -0
- package/dist/web/static/assets/Tasks-CyuhizG8.js +2 -0
- package/dist/web/static/assets/Tasks-CyuhizG8.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-CBX47X8l.js +3 -0
- package/dist/web/static/assets/index-CBX47X8l.js.map +1 -0
- package/dist/web/static/assets/index-DjIoMdoR.css +1 -0
- package/dist/web/static/assets/{lucide-53bR2rki.js → lucide-Bs_edTLa.js} +73 -38
- package/dist/web/static/assets/lucide-Bs_edTLa.js.map +1 -0
- package/dist/web/static/assets/react-router-r79dBVy4.js +20 -0
- package/dist/web/static/assets/{react-router-I-HqunH7.js.map → react-router-r79dBVy4.js.map} +1 -1
- package/dist/web/static/assets/task-title-BhOcemuR.js +2 -0
- package/dist/web/static/assets/task-title-BhOcemuR.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 +4 -4
- 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/h1-storage-aggregation-spec-20260518-1121.md +299 -0
- package/docs/design/h2-getdatabase-encapsulation-spec-20260518-1450.md +191 -0
- package/docs/design/h3-fallback-removal-spec-20260518-1245.md +76 -0
- package/docs/design/h4-index-dedup-spec-20260518-1230.md +109 -0
- package/docs/design/h6-services-migration-spec-20260518-1355.md +82 -0
- package/docs/design/hook-failure-queue-spec-20260516-1530.md +204 -0
- package/docs/design/l1-swarm-protocol-extract-spec-20260518-1605.md +106 -0
- package/docs/design/m10-forge-paths-spec-20260518-1320.md +121 -0
- package/docs/design/m2-m3-tool-input-spec-20260518-1425.md +131 -0
- package/docs/design/m7-routing-event-association-spec-20260518-1545.md +103 -0
- package/docs/design/project-path-gitroot-spec-20260518-1715.md +134 -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/task-active-gc-spec-20260518-1745.md +146 -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/h1-storage-aggregation-changelog-20260518-1121.md +82 -0
- package/docs/implementation/h2-final-changelog-20260518-1530.md +61 -0
- package/docs/implementation/h2-phase1-safety-net-changelog-20260518-1450.md +70 -0
- package/docs/implementation/h2-phase2-operations-changelog-20260518-1450.md +120 -0
- package/docs/implementation/h2-phase3-callsites-changelog-20260518-1450.md +71 -0
- package/docs/implementation/h3-fallback-removal-changelog-20260518-1245.md +71 -0
- package/docs/implementation/h4-index-dedup-changelog-20260518-1230.md +60 -0
- package/docs/implementation/h6-services-migration-changelog-20260518-1355.md +46 -0
- package/docs/implementation/h7-m9-defaults-changelog-20260518-1300.md +46 -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/l1-swarm-protocol-extract-changelog-20260518-1605.md +45 -0
- package/docs/implementation/l3-l4-daemon-perf-changelog-20260518-1410.md +63 -0
- package/docs/implementation/l6-l8-final-cleanup-changelog-20260518-1640.md +38 -0
- package/docs/implementation/m1-m4-m5-l7-cleanup-changelog-20260518-1310.md +58 -0
- package/docs/implementation/m10-forge-paths-changelog-20260518-1320.md +60 -0
- package/docs/implementation/m2-m3-tool-input-changelog-20260518-1425.md +43 -0
- package/docs/implementation/m6-m8-naming-shutdown-changelog-20260518-1340.md +56 -0
- package/docs/implementation/m7-routing-association-changelog-20260518-1545.md +69 -0
- package/docs/implementation/project-path-gitroot-changelog-20260518-1715.md +63 -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/task-active-gc-changelog-20260518-1745.md +35 -0
- package/docs/implementation/task-title-summary-changelog-20260518-1130.md +39 -0
- package/docs/implementation/tasks-detail-back-loses-filters-changelog-20260518-1100.md +22 -0
- package/docs/implementation/tasks-list-filter-pagination-changelog-20260518-0930.md +72 -0
- package/docs/implementation/tasks-page-white-screen-hotfix-changelog-20260518-1015.md +56 -0
- package/docs/reviews/claudemd-template-sync.md +54 -0
- package/docs/reviews/task-title-summary.md +92 -0
- package/docs/reviews/tasks-detail-back-loses-filters.md +58 -0
- package/docs/reviews/tasks-filter-pagination.md +80 -0
- package/docs/reviews/tasks-page-white-screen-hotfix.md +126 -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 +568 -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/claudemd/templates/swarm-protocol.md +222 -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 +115 -0
- package/src/cli/commands/init.ts +204 -0
- package/src/cli/commands/logs.ts +181 -0
- package/src/cli/commands/mcp.ts +242 -0
- package/src/cli/commands/menu.ts +357 -0
- package/src/cli/commands/skills.ts +185 -0
- package/src/cli/commands/stats.ts +73 -0
- package/src/cli/commands/status.ts +69 -0
- package/src/cli/commands/template.ts +77 -0
- package/src/cli/commands/trace.ts +148 -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 +62 -0
- package/src/core/event-fields.ts +32 -0
- package/src/core/queue/index.ts +192 -0
- package/src/core/storage/base.ts +302 -0
- package/src/core/storage/events.ts +434 -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 +322 -0
- package/src/core/storage/rows.ts +112 -0
- package/src/core/storage/schema.sql +224 -0
- package/src/core/storage/sessions.ts +168 -0
- package/src/core/storage/skills.ts +233 -0
- package/src/core/storage/sqlite.ts +293 -0
- package/src/core/storage/tasks.ts +318 -0
- package/src/core/storage/token-usage.ts +93 -0
- package/src/core/types.ts +181 -0
- package/src/core/utils/error-handler.ts +257 -0
- package/src/core/utils/forge-resume-block.ts +74 -0
- package/src/core/utils/format.ts +69 -0
- package/src/core/utils/git.ts +23 -0
- package/src/core/utils/logger.ts +134 -0
- package/src/core/utils/lru-cache.ts +54 -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 +36 -0
- package/src/daemon/handlers/history-exporter.ts +117 -0
- package/src/daemon/handlers/post-tool-use.ts +54 -0
- package/src/daemon/handlers/stop.ts +208 -0
- package/src/daemon/handlers/user-prompt.ts +178 -0
- package/src/daemon/index.ts +292 -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 +196 -0
- package/src/daemon/services/task-segmenter.ts +112 -0
- package/src/hooks/hook-lib.sh +118 -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 +43 -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/analytics/anti-pattern-detector.ts +367 -0
- package/src/web/analytics/drift-detector.ts +219 -0
- package/src/web/analytics/weekly-report.ts +431 -0
- package/src/web/auth-middleware.ts +54 -0
- package/src/web/routes/_helpers.ts +34 -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 +76 -0
- package/src/web/routes/sessions.ts +250 -0
- package/src/web/routes/skill-stats.ts +92 -0
- package/src/web/routes/skills.ts +350 -0
- package/src/web/routes/static.ts +67 -0
- package/src/web/routes/stats.ts +50 -0
- package/src/web/routes/status.ts +30 -0
- package/src/web/routes/tasks.ts +193 -0
- package/src/web/routes/token-usage.ts +20 -0
- package/src/web/routes/trace.ts +126 -0
- package/src/web/routes/types.ts +57 -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/claudemd-generator.test.ts +90 -0
- package/tests/integration/queue-replay.integration.test.ts +193 -0
- package/tests/integration/tasks-filter.integration.test.ts +154 -0
- package/tests/integration/web-analytics.integration.test.ts +133 -0
- package/tests/integration/web-stats.integration.test.ts +135 -0
- package/tests/integration/web-trace.integration.test.ts +175 -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/core/forge-paths.test.ts +99 -0
- package/tests/unit/daemon/post-tool-use.test.ts +121 -0
- package/tests/unit/daemon/stop-handler-behavior-summary.test.ts +202 -0
- package/tests/unit/daemon/task-segmenter-recover.test.ts +84 -0
- package/tests/unit/event-fields.test.ts +88 -0
- package/tests/unit/event-parser.test.ts +55 -0
- package/tests/unit/handlers.test.ts +171 -0
- package/tests/unit/hooks/resolve-project-path.test.ts +122 -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/socket-server.test.ts +183 -0
- package/tests/unit/storage/event-operations-aggregates.test.ts +342 -0
- package/tests/unit/storage/migration-idempotent.test.ts +304 -0
- package/tests/unit/storage/routing-aggregates.test.ts +276 -0
- package/tests/unit/storage/routing.test.ts +117 -0
- package/tests/unit/storage/schema-missing.test.ts +81 -0
- package/tests/unit/storage/session-operations-aggregates.test.ts +120 -0
- package/tests/unit/storage/sessions-aggregate.test.ts +435 -0
- package/tests/unit/storage/skill-operations-counts.test.ts +106 -0
- package/tests/unit/storage/skills-aggregates.test.ts +104 -0
- package/tests/unit/storage/sqlite-refactor-harness.test.ts +314 -0
- package/tests/unit/storage/task-operations-counts.test.ts +46 -0
- package/tests/unit/storage/tasks-getById.test.ts +343 -0
- package/tests/unit/storage/tasks-stale-gc.test.ts +86 -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/navigation-back-contract.test.ts +134 -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-rules.test.ts +182 -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 +385 -0
- package/tests/unit/web/task-title-contract.test.ts +210 -0
- package/tests/unit/web/tasks-component-contract.test.ts +179 -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 +515 -0
- package/web/src/pages/Tasks.tsx +415 -0
- package/web/src/utils/auth.ts +59 -0
- package/web/src/utils/export.ts +54 -0
- package/web/src/utils/navigation.ts +25 -0
- package/web/src/utils/task-title.ts +49 -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 -149
- 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 -19
- 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 -18
- 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 -17
- 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 -17
- 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 -21
- 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 -17
- 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 -20
- 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 -21
- 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 -17
- 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 -22
- 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 -45
- 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 -39
- package/dist/daemon/handlers/pre-tool-use.d.ts.map +0 -1
- package/dist/daemon/handlers/pre-tool-use.js +0 -166
- 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 -64
- package/dist/daemon/routing-state.d.ts.map +0 -1
- package/dist/daemon/routing-state.js +0 -240
- 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/engine/security-gates.d.ts +0 -42
- package/dist/engine/security-gates.d.ts.map +0 -1
- package/dist/engine/security-gates.js +0 -210
- package/dist/engine/security-gates.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
- package/dist/web/static/assets/react-router-I-HqunH7.js +0 -20
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# Tasks 列表筛选 + 分页 — 设计 Spec
|
|
2
|
+
|
|
3
|
+
**日期**: 2026-05-18
|
|
4
|
+
**状态**: Draft(待用户 review)
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 工作流路径
|
|
9
|
+
|
|
10
|
+
**hybrid-feature-with-safety**
|
|
11
|
+
|
|
12
|
+
**理由**:`src/web/routes/` 有 19 个路由文件,`tests/unit/web/` 仅 6 个测试文件,覆盖率约 **32%**(低于 50% 阈值)。实现阶段每个后端改动文件均需配套新增/扩展测试用例。前端为单 HTML 文件无组件测试,route + storage 层必须达到 80% 分支覆盖。
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 1. 目标 + 成功标准
|
|
17
|
+
|
|
18
|
+
让 `GET /api/tasks` 支持完整服务端筛选与分页;前端 tasks 视图新增筛选栏 + 分页组件,URL 同步状态。
|
|
19
|
+
|
|
20
|
+
### 验收用例
|
|
21
|
+
|
|
22
|
+
| # | 场景 | 期望 |
|
|
23
|
+
|---|------|------|
|
|
24
|
+
| A1 | `GET /api/tasks?limit=10&offset=0` | `{ items: [...10], total, has_more }` |
|
|
25
|
+
| A2 | `GET /api/tasks?project=/path/foo` | 仅返回该 project_path 的 tasks |
|
|
26
|
+
| A3 | `?project=a&project=b` | 两个项目 OR 关系 |
|
|
27
|
+
| A4 | `?from=2026-01-01T00:00:00Z&to=2026-01-31T23:59:59Z` | start_time 范围过滤 |
|
|
28
|
+
| A5 | `?search=重构` | title LIKE `%重构%` |
|
|
29
|
+
| A6 | `?limit=201` | clamp 到 200 |
|
|
30
|
+
| A7 | 前端选「24h」+ 搜索「build」 | URL: `?range=24h&search=build&page=1`,刷新保留 |
|
|
31
|
+
| A8 | 点「下一页」 | offset 递增,total 不变 |
|
|
32
|
+
|
|
33
|
+
**非目标**:FTS5 全文检索、status 多选、修改 `/api/tasks/:taskId` 详情接口。
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 2. 后端设计
|
|
38
|
+
|
|
39
|
+
### 2.1 Route 层 `src/web/routes/tasks.ts`
|
|
40
|
+
|
|
41
|
+
**已有**:`limit`(默认 20)、`session`
|
|
42
|
+
**待加**:`offset`、`project`(多值)、`from`、`to`、`search`,返回结构升级
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
QueryParams (Zod):
|
|
46
|
+
limit: number, default 50, max 200, min 1
|
|
47
|
+
offset: number, default 0, min 0
|
|
48
|
+
project: string | string[] // 多值
|
|
49
|
+
from/to: ISO 8601 string, optional
|
|
50
|
+
search: string, optional, maxLength 100
|
|
51
|
+
session: string, optional // 保留
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
返回从 `Task[]` 升级为 `{ items, total, has_more }`。**破坏性变更**:内部 dashboard 无外部消费者,可接受。
|
|
55
|
+
|
|
56
|
+
### 2.2 Storage 层 `src/core/storage/tasks.ts`
|
|
57
|
+
|
|
58
|
+
**关键挑战**:`tasks` 表无 `project_path` 字段,需 JOIN `sessions` 表。
|
|
59
|
+
|
|
60
|
+
```sql
|
|
61
|
+
-- 数据查询
|
|
62
|
+
SELECT t.*, s.project_path
|
|
63
|
+
FROM tasks t
|
|
64
|
+
JOIN sessions s ON t.session_id = s.session_id
|
|
65
|
+
WHERE
|
|
66
|
+
[t.session_id = ?]
|
|
67
|
+
[AND s.project_path IN (?, ?)]
|
|
68
|
+
[AND t.start_time >= ?]
|
|
69
|
+
[AND t.start_time <= ?]
|
|
70
|
+
[AND t.title LIKE ?]
|
|
71
|
+
ORDER BY t.start_time DESC
|
|
72
|
+
LIMIT ? OFFSET ?;
|
|
73
|
+
|
|
74
|
+
-- 总数查询:复用相同 WHERE,不带 LIMIT/OFFSET
|
|
75
|
+
SELECT COUNT(*) FROM tasks t JOIN sessions s ON t.session_id = s.session_id WHERE [...];
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
`TaskRecord` 新增可选字段 `project_path?: string`。
|
|
79
|
+
|
|
80
|
+
### 2.3 索引评估
|
|
81
|
+
|
|
82
|
+
| 查询 | 现有 | 是否够 |
|
|
83
|
+
|------|------|--------|
|
|
84
|
+
| `ORDER BY start_time DESC` | `idx_tasks_start_time` | ✅ |
|
|
85
|
+
| `WHERE session_id = ?` | `idx_tasks_session` | ✅ |
|
|
86
|
+
| `WHERE s.project_path IN (...)` | `idx_sessions_project` | ✅ |
|
|
87
|
+
| `WHERE t.title LIKE '%xxx%'` | 无 | ❌ 全表扫描,但数据量 <10k,可接受 |
|
|
88
|
+
| `WHERE start_time BETWEEN ?` | `idx_tasks_start_time` | ✅ 范围扫描 |
|
|
89
|
+
|
|
90
|
+
**新增**:`CREATE INDEX idx_tasks_start_time_session ON tasks(start_time DESC, session_id)`。
|
|
91
|
+
**不引入 FTS5**(复杂度不值)。
|
|
92
|
+
|
|
93
|
+
### 2.4 新 Endpoint `GET /api/tasks/projects`
|
|
94
|
+
|
|
95
|
+
前端项目下拉需要"所有项目"列表:
|
|
96
|
+
|
|
97
|
+
```sql
|
|
98
|
+
SELECT DISTINCT s.project_path FROM sessions s JOIN tasks t ON t.session_id = s.session_id;
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 3. 前端设计
|
|
104
|
+
|
|
105
|
+
### ⚠️ 重要发现
|
|
106
|
+
|
|
107
|
+
调研显示前端是**原生 HTML + Vanilla JS**(`src/web/static/index.html` 单文件),不是 CLAUDE.md 描述的 React/Vite。当前页面切换通过 `nav(pageName)` + `id="page-xxx"` div 控制。
|
|
108
|
+
|
|
109
|
+
> **请用户确认**:(a) spec 按 Vanilla JS 实施(与现状一致);(b) 顺手迁移到 React(额外大改);(c) CLAUDE.md 该改技术栈描述
|
|
110
|
+
|
|
111
|
+
### 3.2 新增 `#page-tasks` 视图
|
|
112
|
+
|
|
113
|
+
Sidebar 加 "Tasks" 导航项。
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
page-tasks
|
|
117
|
+
├── .toolbar
|
|
118
|
+
│ ├── #tasks-project-filter (多选 select)
|
|
119
|
+
│ ├── #tasks-range-filter (1h/24h/7d/自定义)
|
|
120
|
+
│ ├── #tasks-date-from/to (datetime-local,自定义时显示)
|
|
121
|
+
│ └── #tasks-search (300ms 防抖)
|
|
122
|
+
├── <table id="tasks-table"> 时间 / 标题 / 项目 / 状态 / 事件数
|
|
123
|
+
└── .pagination-bar
|
|
124
|
+
├── "共 N 条,第 X-Y"
|
|
125
|
+
├── 每页 [20/50/100]
|
|
126
|
+
└── [上一页] [下一页]
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### 3.3 URL 状态同步
|
|
130
|
+
|
|
131
|
+
`URLSearchParams` + `history.pushState`:
|
|
132
|
+
|
|
133
|
+
| URL | 控件 |
|
|
134
|
+
|-----|------|
|
|
135
|
+
| `project` | 多选下拉(可重复) |
|
|
136
|
+
| `range` | 1h/24h/7d/custom |
|
|
137
|
+
| `from`/`to` | 自定义时间 |
|
|
138
|
+
| `search` | 搜索框 |
|
|
139
|
+
| `page` | offset = (page-1) * limit |
|
|
140
|
+
| `size` | 20/50/100 |
|
|
141
|
+
|
|
142
|
+
### 3.4 防抖
|
|
143
|
+
|
|
144
|
+
搜索框 `oninput` → setTimeout 300ms → `loadTasks()`,每次键入重置。
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 4. 改动文件清单
|
|
149
|
+
|
|
150
|
+
| 文件 | 改动 | 行数 |
|
|
151
|
+
|------|------|------|
|
|
152
|
+
| `src/core/storage/tasks.ts` | 扩展 filter + COUNT + project_path | +40 |
|
|
153
|
+
| `src/core/storage/schema.sql` | 加复合索引 | +2 |
|
|
154
|
+
| `src/web/routes/tasks.ts` | Zod 解析 + 多参数 + 返回结构 + `/projects` 子路由 | +50 |
|
|
155
|
+
| `src/web/static/index.html` | `#page-tasks` 视图 + JS 函数 + URL 同步 + 防抖 | +200 |
|
|
156
|
+
| `tests/unit/web/routes-tasks.test.ts` | 扩展参数组合用例 | +80 |
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 5. 风险点
|
|
161
|
+
|
|
162
|
+
| 风险 | 缓解 |
|
|
163
|
+
|------|------|
|
|
164
|
+
| tasks 无 project_path,需 JOIN sessions | `TaskRecord` 加可选 `project_path?` |
|
|
165
|
+
| 项目下拉数据来源 | 新增 `/api/tasks/projects` |
|
|
166
|
+
| project_path 太长(绝对路径) | 截断显示最后 2 段,title 属性放完整 |
|
|
167
|
+
| 返回结构破坏性变更 | 搜 index.html 所有 `/api/tasks` 调用点同步更新 |
|
|
168
|
+
| LIKE 性能 | <10k 行可接受,不引入 FTS5 |
|
|
169
|
+
| 前端无组件测试 | 仅 route 集成测试,前端 E2E 手工 |
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 6. 测试策略
|
|
174
|
+
|
|
175
|
+
### 单元测试 `tests/unit/web/routes-tasks.test.ts`
|
|
176
|
+
|
|
177
|
+
- `project` 单值/多值(OR)
|
|
178
|
+
- `from`/`to` 边界
|
|
179
|
+
- `search` LIKE 匹配(SQLite ASCII 不区分大小写)
|
|
180
|
+
- `limit` clamp
|
|
181
|
+
- `offset` 分页 + `has_more` 准确
|
|
182
|
+
- 返回结构 schema
|
|
183
|
+
- `GET /api/tasks/projects` 去重
|
|
184
|
+
|
|
185
|
+
### 集成测试
|
|
186
|
+
|
|
187
|
+
新建 `tests/integration/tasks-filter.test.ts`,真实 SQLite 验证 JOIN + COUNT。
|
|
188
|
+
|
|
189
|
+
### 前端 E2E
|
|
190
|
+
|
|
191
|
+
按 A1-A8 在 dashboard 手工验证 + 截图。
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 7. 执行步骤(自底向上)
|
|
196
|
+
|
|
197
|
+
1. `schema.sql` — 加索引 `idx_tasks_start_time_session`
|
|
198
|
+
2. `storage/tasks.ts` — 扩 filter / JOIN / COUNT / project_path
|
|
199
|
+
3. Storage 单元测试
|
|
200
|
+
4. `routes/tasks.ts` — Zod + 多参数 + 返回结构 + `/projects`
|
|
201
|
+
5. Route 单元测试
|
|
202
|
+
6. `index.html` — `#page-tasks` 视图 + JS + URL 同步 + 防抖
|
|
203
|
+
7. `npm test` + `npx tsc --noEmit`
|
|
204
|
+
8. 按 A1-A8 手工验收
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
**Hybrid-feature-with-safety 工作流**:先 safety-net(扩展 routes-tasks 现有测试,锁定旧 `Task[]` 返回行为)→ design → implement → test → review
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Changelog: Official Skills 数据分离 + UserPromptHandler Set 内存泄漏修复
|
|
2
|
+
|
|
3
|
+
**日期**: 2026-05-16
|
|
4
|
+
**Spec**: `docs/design/fix-skills-data-and-set-leak-spec-20260516-1300.md`
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 实际改动文件清单
|
|
9
|
+
|
|
10
|
+
### 新建文件
|
|
11
|
+
|
|
12
|
+
| 文件路径 | 行数 | 说明 |
|
|
13
|
+
|----------|------|------|
|
|
14
|
+
| `src/skills/official/official-harness-engineering.md` | 91 | Harness Engineering 方法论 |
|
|
15
|
+
| `src/skills/official/official-spec-driven-design.md` | 28 | Spec-Driven Design |
|
|
16
|
+
| `src/skills/official/official-architecture-decision.md` | 22 | ADR 模板(截断版,与原始 content 一致)|
|
|
17
|
+
| `src/skills/official/official-api-design.md` | 19 | API 设计规范(截断版)|
|
|
18
|
+
| `src/skills/official/official-db-schema-design.md` | 19 | DB Schema 设计(截断版)|
|
|
19
|
+
| `src/skills/official/official-pr-review.md` | 32 | PR 审查清单(截断版)|
|
|
20
|
+
| `src/skills/official/official-debug.md` | 18 | 调试工作流(截断版)|
|
|
21
|
+
| `src/skills/official/official-performance-optimization.md` | 30 | 性能优化 |
|
|
22
|
+
| `src/skills/official/official-security-hardening.md` | 27 | 安全加固(截断版)|
|
|
23
|
+
| `src/skills/official/official-release-checklist.md` | 30 | 发布清单 |
|
|
24
|
+
| `src/skills/official/official-doc-driven.md` | 28 | 文档驱动开发 |
|
|
25
|
+
| `src/skills/official/planning-with-files.md` | 35 | Manus 风格任务规划(截断版)|
|
|
26
|
+
| `src/skills/official/code-simplifier.md` | 17 | 代码简化(截断版)|
|
|
27
|
+
| `src/skills/official/find-skills.md` | 24 | 技能发现(截断版)|
|
|
28
|
+
| `src/skills/official/webapp-testing.md` | 12 | Web 应用测试(截断版)|
|
|
29
|
+
| `src/skills/official/ui-ux-pro-max.md` | 19 | UI/UX 设计工具(截断版)|
|
|
30
|
+
| `src/skills/official/official-bmad.md` | 90 | BMAD 方法论 |
|
|
31
|
+
| `tests/unit/skills/official-skills-loader.test.ts` | 113 | loadOfficialSkills 单元测试(7 个 case)|
|
|
32
|
+
|
|
33
|
+
### 修改文件
|
|
34
|
+
|
|
35
|
+
| 文件路径 | 改动 | 说明 |
|
|
36
|
+
|----------|------|------|
|
|
37
|
+
| `src/skills/official-skills.ts` | -700行 +73行 | 删除 OFFICIAL_SKILLS 数组;保留 OfficialSkill 接口和 OFFICIAL_SKILL_KEYWORDS;新增 loadOfficialSkills(builtinDir) |
|
|
38
|
+
| `src/skills/registry.ts` | +30行 | 新增 resolveBuiltinDir(); scan() 第 1 段改用 loadOfficialSkills; import 更新 |
|
|
39
|
+
| `src/cli/commands/skills.ts` | +7行 | 移除 OFFICIAL_SKILLS import;新增 resolveBuiltinDir(); syncSkills 改用 loadOfficialSkills |
|
|
40
|
+
| `src/daemon/handlers/user-prompt.ts` | +40行 | Set 改 Map<string,number>; 新增 MAX_INJECTION_KEYS=1000; hasInjected/markInjected 私有方法; clearSession 公共方法 |
|
|
41
|
+
| `src/daemon/handlers/stop.ts` | +15行 | import UserPromptHandler 类型; 构造函数增加可选参数 userPromptHandler; Step 5 调用 clearSession |
|
|
42
|
+
| `src/daemon/index.ts` | +5行 | 将 userPromptHandler 实例传入 StopHandler 构造函数 |
|
|
43
|
+
| `package.json` | +1行 | build 脚本追加 `mkdir -p dist/skills/official && cp src/skills/official/*.md dist/skills/official/` |
|
|
44
|
+
| `tests/unit/skill-registry.test.ts` | +2行 | 断言数量从 >= 16 改为 >= 17(两处) |
|
|
45
|
+
| `tests/unit/handlers.test.ts` | +92行 | 新增 3 个 UserPromptHandler 测试 case |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 与 Spec 的偏差
|
|
50
|
+
|
|
51
|
+
### 偏差 1:Skill 数量是 17,不是 19
|
|
52
|
+
Spec 说"共 19 个 skill",但 `OFFICIAL_SKILLS` 数组实际只有 17 个条目(缺少 `official-tdd` 和 `official-refactor`,这两个仅在 `OFFICIAL_SKILL_KEYWORDS` 中有 keyword 映射但没有对应的 skill 定义)。实际创建了 17 个 `.md` 文件。测试断言改为 `>= 17`。
|
|
53
|
+
|
|
54
|
+
### 偏差 2:部分 skill 内容截断
|
|
55
|
+
原始 `OFFICIAL_SKILLS` 数组中有 11 个 skill 的 `content` 字段以 `\`` 结尾(截断的 template literal)。这是源码的现有状态(非本次引入)。`.md` 文件完整保留了这些截断内容,与原有行为一致。这些截断是原始数据的一部分,不影响 skill 加载逻辑。
|
|
56
|
+
|
|
57
|
+
### 偏差 3:registry.ts 中 skill 的 path 字段构造
|
|
58
|
+
Spec 建议使用 `resolveBuiltinDir() + '/' + officialSkill.name + '.md'` 作为路径。实际实现中每次调用 `resolveBuiltinDir()` 会重新计算,考虑到这是纯计算无副作用,对性能无影响。若有性能顾虑可缓存该值(已注释在代码中作为 TODO)。
|
|
59
|
+
|
|
60
|
+
### 偏差 4:loadOfficialSkills content 字段包含完整文件(含 frontmatter)
|
|
61
|
+
Spec 中未明确 `content` 字段是否包含 frontmatter。registry 的现有用户 skill 逻辑(`body.trim()`)只包含 body。为保持与原有 OFFICIAL_SKILLS 行为一致(原 content 字段包含 frontmatter),`loadOfficialSkills` 返回的 `content` 字段设为完整文件内容(`raw`),而非仅 body。这样 skill 注入时内容与之前完全一致。
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 测试结果
|
|
66
|
+
|
|
67
|
+
### 执行的测试
|
|
68
|
+
```
|
|
69
|
+
npx vitest run tests/unit/skill-registry.test.ts --reporter=verbose
|
|
70
|
+
npx vitest run tests/unit/skills/ --reporter=verbose
|
|
71
|
+
npx vitest run tests/unit/handlers.test.ts --reporter=verbose
|
|
72
|
+
npx tsc --noEmit
|
|
73
|
+
npm test -- --reporter=dot
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 结果汇总
|
|
77
|
+
|
|
78
|
+
| 测试文件 | 状态 | 测试数 |
|
|
79
|
+
|----------|------|--------|
|
|
80
|
+
| `tests/unit/skill-registry.test.ts` | 全部通过 | 6/6 |
|
|
81
|
+
| `tests/unit/skills/registry-multiformat.test.ts` | 全部通过 | 27/27 |
|
|
82
|
+
| `tests/unit/skills/official-skills-loader.test.ts` | 全部通过 | 7/7 |
|
|
83
|
+
| `tests/unit/handlers.test.ts` | 全部通过 | 7/7(新增 3 个)|
|
|
84
|
+
| `tests/unit/skills/invocation-guard-ttl.test.ts` | 全部通过 | — |
|
|
85
|
+
| TypeScript (`tsc --noEmit`) | 无错误 | — |
|
|
86
|
+
| 全量测试 (`npm test`) | 291/294 通过 | 2 文件失败 |
|
|
87
|
+
|
|
88
|
+
### 预存在的失败(与本次改动无关)
|
|
89
|
+
- `tests/unit/web/routes-tasks.test.ts`(2 个 case 失败):UUID 格式验证错误,与 storage 层有关
|
|
90
|
+
- `tests/unit/storage/sqlite-refactor-harness.test.ts`(1 个 case 失败):`linkEventToTask` 相关,与 storage 层有关
|
|
91
|
+
|
|
92
|
+
注:这两个测试文件在本次改动前就已失败(baseline 状态:3 文件 / 10 个 case 失败;本次改动后:2 文件 / 3 个 case 失败,即我们的改动无意中修复了 skill-registry 相关的计数断言问题)。
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 已知风险 / TODO
|
|
97
|
+
|
|
98
|
+
1. **content 字段含 frontmatter**:registry 的用户 skill 加载使用 `body.trim()`(不含 frontmatter),而 official skill 的 `content` 现在是完整文件内容(含 frontmatter)。两者行为不一致,但与原始 OFFICIAL_SKILLS 数组保持了向后兼容。如需统一,可在后续 PR 中对齐。
|
|
99
|
+
|
|
100
|
+
2. **部分 skill 内容截断**:11 个 skill 的 body 内容被截断(原始代码如此)。这不是本次引入的问题。如需完整内容,需要重新补全对应的 `.md` 文件。
|
|
101
|
+
|
|
102
|
+
3. **syncSkills 命令的 version 比较**:`skills sync` 命令从 `.md` frontmatter 读取版本号做比较。对于截断的 skill,version 字段在 frontmatter 中完整保留,此功能不受影响。
|
|
103
|
+
|
|
104
|
+
4. **resolveBuiltinDir 每次重新计算**:scan() 中多次调用 resolveBuiltinDir(),可以在 scan 开始时缓存到局部变量(低优先级优化)。
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# H1 实施 Changelog
|
|
2
|
+
|
|
3
|
+
**Date**: 2026-05-18 11:21
|
|
4
|
+
**Spec**: `docs/design/h1-storage-aggregation-spec-20260518-1121.md`
|
|
5
|
+
**Status**: 完成
|
|
6
|
+
|
|
7
|
+
## 完成清单
|
|
8
|
+
|
|
9
|
+
- [x] Storage 新方法(7 个):
|
|
10
|
+
- `aggregateRoutingStats({ since_ts, project_path? })` → `RoutingOperations`
|
|
11
|
+
- `aggregateRoutingTrendByDay({ since_ts })` → `RoutingOperations`
|
|
12
|
+
- `aggregateSkillInvocationsBySkill({ since, limit? })` → `SkillOperations`
|
|
13
|
+
- `getTask(taskId)` → `TaskOperations`
|
|
14
|
+
- `queryEventsByTaskId(taskId, opts?)` → `TaskOperations`
|
|
15
|
+
- `queryInjectionsByTaskId(taskId)` → `TaskOperations`
|
|
16
|
+
- `querySkillInvocationsByTaskWindow(taskId, now_ms?)` → `TaskOperations`
|
|
17
|
+
- [x] sqlite.ts facade 转发已加(7 个方法)
|
|
18
|
+
- [x] 索引新增:`idx_routing_events_type_ts` (schema.sql + base.ts runMigrations 同步)
|
|
19
|
+
- [x] Storage 单元测试(3 文件):
|
|
20
|
+
- `tests/unit/storage/routing-aggregates.test.ts`
|
|
21
|
+
- `tests/unit/storage/skills-aggregates.test.ts`
|
|
22
|
+
- `tests/unit/storage/tasks-getById-aggregates.test.ts`
|
|
23
|
+
- [x] Routes 改造(3 文件):
|
|
24
|
+
- `src/web/routes/rules.ts` — hit-rate 改用 `aggregateRoutingStats` + `aggregateSkillInvocationsBySkill`
|
|
25
|
+
- `src/web/routes/skill-stats.ts` — 5 个 endpoint 全部下沉到 SQL 聚合
|
|
26
|
+
- `src/web/routes/tasks.ts` — `/:taskId` PK 直查 + JOIN
|
|
27
|
+
- [x] 路由测试新增:`tests/unit/web/routes-rules.test.ts`(之前缺口)
|
|
28
|
+
|
|
29
|
+
## 关键代码定位
|
|
30
|
+
|
|
31
|
+
### Storage 新方法
|
|
32
|
+
- `src/core/storage/routing.ts` — `aggregateRoutingStats`、`aggregateRoutingTrendByDay`(4 条独立 prepared statement 走索引;trend 用 `strftime('%Y-%m-%d', ts/1000, 'unixepoch')`)
|
|
33
|
+
- `src/core/storage/skills.ts` — `aggregateSkillInvocationsBySkill`(按 `total DESC`)
|
|
34
|
+
- `src/core/storage/tasks.ts` — `getTask` / `queryEventsByTaskId` / `queryInjectionsByTaskId` / `querySkillInvocationsByTaskWindow`(后者用 `task_events` JOIN + `tasks.start_time/end_time` 转 ms 做窗口过滤)
|
|
35
|
+
- `src/core/storage/sqlite.ts` — facade 转发 7 个方法
|
|
36
|
+
- `src/core/storage/schema.sql` 末尾 + `src/core/storage/base.ts` runMigrations — `idx_routing_events_type_ts ON routing_events(routed_to_type, ts DESC)`
|
|
37
|
+
|
|
38
|
+
### Route 改造点
|
|
39
|
+
- `src/web/routes/rules.ts` — `queryRoutingEvents{limit:100000}` + `querySkillInvocations{limit:100000}` JS reduce → `aggregateRoutingStats` + `aggregateSkillInvocationsBySkill`
|
|
40
|
+
- `src/web/routes/skill-stats.ts:16` — `/distribution`:`agg.by_type` + 三桶兜底
|
|
41
|
+
- `src/web/routes/skill-stats.ts:33` — `/frequency`:`agg.by_skill_routed.map(...)`
|
|
42
|
+
- `src/web/routes/skill-stats.ts:43` — `/trend`:`aggregateRoutingTrendByDay` + JS skillRate 计算
|
|
43
|
+
- `src/web/routes/skill-stats.ts:59` — `/invocations`:`aggregateSkillInvocationsBySkill`,`total` 改为 sum 行 total
|
|
44
|
+
- `src/web/routes/skill-stats.ts:76` — `/api/routing/stats`:`agg.obeyed/total/by_agent`
|
|
45
|
+
- `src/web/routes/tasks.ts:59` — `/:taskId`:`getTask` + `queryEventsByTaskId` + `queryInjectionsByTaskId` + `querySkillInvocationsByTaskWindow` 取代旧四段全表扫
|
|
46
|
+
|
|
47
|
+
## 测试结果
|
|
48
|
+
|
|
49
|
+
| 维度 | 数值 |
|
|
50
|
+
|------|------|
|
|
51
|
+
| storage + web unit | 171 通过 / 1 失败(pre-existing) |
|
|
52
|
+
| 全量 `npm test` | **417 通过 / 1 失败 / 418 总** |
|
|
53
|
+
| `npx tsc --noEmit` | **0 errors** |
|
|
54
|
+
|
|
55
|
+
### Pre-existing failure(与 H1 无关,main 分支既有)
|
|
56
|
+
- `tests/unit/storage/sqlite-refactor-harness.test.ts > Task Operations > linkEventToTask associates events with tasks`
|
|
57
|
+
- 报错:`Invalid event data: ... event_id Invalid uuid`
|
|
58
|
+
- 原因:测试中传入的 `event_id` 不是 UUID 格式,与 `events.ts:73` 的 zod 校验不兼容
|
|
59
|
+
- 在 main 分支同样 fail,**未在本次任务范围**,未修
|
|
60
|
+
|
|
61
|
+
## 超出 spec 的改动
|
|
62
|
+
|
|
63
|
+
无。所有改动均严格按 spec 第 3 节执行。响应字段结构未变更(前端 React 组件契约保持):
|
|
64
|
+
- `/distribution` → `{ windowHours, distribution: [{type, count}] }` ✓
|
|
65
|
+
- `/frequency` → `{ windowHours, frequency: [{name, count}] }` ✓
|
|
66
|
+
- `/trend` → `{ windowHours, trend: [{day, skillRate}] }` ✓
|
|
67
|
+
- `/invocations` → `{ days, total, invocations: [{skill_id, total, success, failed}] }` ✓
|
|
68
|
+
- `/api/routing/stats` → `{ days, total, agentCalls, noAgent, agentRate, byAgent }` ✓
|
|
69
|
+
- `/api/tasks/:taskId` → `{ task, userPrompts, injections, timeline, skillInvocations, artifacts }` ✓
|
|
70
|
+
|
|
71
|
+
注:`/invocations` 的 `total` 字段语义不变(旧实现是 `invocations.length` = 原始记录数;新实现是 `sum(rows.total)` = 同样的原始记录数,因 GROUP BY skill_id 后各 group total 之和等于总行数)。
|
|
72
|
+
|
|
73
|
+
## 已知问题
|
|
74
|
+
|
|
75
|
+
- **Pre-existing**:`sqlite-refactor-harness.test.ts > linkEventToTask` — 与 H1 无关,main 分支同样失败。
|
|
76
|
+
- 无其它已知问题。
|
|
77
|
+
|
|
78
|
+
## 回滚提示
|
|
79
|
+
|
|
80
|
+
纯增量改动。如需回滚:
|
|
81
|
+
- revert `src/web/routes/{rules,skill-stats,tasks}.ts` 即可恢复旧行为
|
|
82
|
+
- storage 新方法和索引保留无害(无人调用即无副作用)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# H2 完整实施 Changelog
|
|
2
|
+
|
|
3
|
+
**Date**: 2026-05-18
|
|
4
|
+
**Spec**: `docs/design/h2-getdatabase-encapsulation-spec-20260518-1450.md`
|
|
5
|
+
**Status**: 全 4 Phase 完成
|
|
6
|
+
**Workflow**: refactor-safe(safety-net → 新方法 → 替换 → 收尾)
|
|
7
|
+
|
|
8
|
+
## 四阶段 commit 索引
|
|
9
|
+
|
|
10
|
+
| Phase | Commit | 内容 |
|
|
11
|
+
|---|---|---|
|
|
12
|
+
| 1 | `0b494ed` | safety-net 17 test cases(web-stats / web-trace / stop-handler / web-analytics 增强) |
|
|
13
|
+
| 2 | (上一 commit) | 20 个 Operations 新方法 + 44 个单测 + facade 转发 |
|
|
14
|
+
| 3 | `bf3eb39` | 7 个调用方文件替换 db.prepare() → facade |
|
|
15
|
+
| 4 | (本 commit) | getDatabase jsdoc 警告 + 总 changelog |
|
|
16
|
+
|
|
17
|
+
## 累计影响
|
|
18
|
+
|
|
19
|
+
- **改动 13 个 src 文件,新增 12 个测试文件**
|
|
20
|
+
- **消除 27 处越权 SQL 直写**(spec 调研时 25 处 + 主线程封闭性扫描补 cli/commands/trace.ts 3 处)
|
|
21
|
+
- **新增 20 个 Operations 方法**:EventOperations × 11 + SessionOperations × 4 + TaskOperations × 1 + SkillOperations × 4
|
|
22
|
+
- **新增 61 个测试用例**:safety-net 17 + Operations 单测 44
|
|
23
|
+
|
|
24
|
+
## 命名固化(H1 → H2 一致)
|
|
25
|
+
|
|
26
|
+
- `aggregate*` 聚合(GROUP BY 类)
|
|
27
|
+
- `count*` 计数
|
|
28
|
+
- `query*` 列表查询
|
|
29
|
+
- `get*` 单条查询
|
|
30
|
+
|
|
31
|
+
## 关键决策
|
|
32
|
+
|
|
33
|
+
1. **getDatabase 保留 public**(不改 protected):架构非继承关系,protected 收益小风险大;改用 jsdoc `@internal` 标注 + CLAUDE.md 工作流提醒
|
|
34
|
+
2. **SQL 行为零变更**:所有 SQL 直接搬入 Operations,不做"优化",保证 safety-net 测试零回归
|
|
35
|
+
3. **`LIKE '%error%'` 失败检测保留原 3 个 OR 条件**:与生产匹配
|
|
36
|
+
4. **Phase 2 偏差**:`aggregateToolUsage` 缺 `until` 参数 → Phase 3 改用 `queryEventsByTimeRange + 内存聚合` 兜底,保留 `[since, until)` 语义
|
|
37
|
+
|
|
38
|
+
## 测试结果(最终)
|
|
39
|
+
|
|
40
|
+
- safety-net 集成测试:17/17 ✓
|
|
41
|
+
- Operations 单测:44/44 ✓
|
|
42
|
+
- 现有回归:541/542 通过
|
|
43
|
+
- **唯一失败**:pre-existing `linkEventToTask` (Zod UUID 校验,与 H2 无关)
|
|
44
|
+
- `npx tsc --noEmit`: 0 errors
|
|
45
|
+
|
|
46
|
+
## 残留 `db.prepare` 检查
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
$ grep -rn "db\.prepare" src/web/ src/cli/commands/trace.ts src/daemon/handlers/ --include="*.ts" | grep -v ".test."
|
|
50
|
+
src/web/routes/stats.ts:7: * H2 Phase 3: 替换原 db.prepare 直写 SQL 为 SQLiteStorage facade 聚合方法。
|
|
51
|
+
src/web/routes/trace.ts:95: // H2 Phase 3: 改用 facade 聚合方法,消除 db.prepare 直写。
|
|
52
|
+
src/daemon/handlers/stop.ts:151: // H2 Phase 3: 改用 facade 聚合方法,消除 db.prepare 直写。
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**3 处均为注释**,无 SQL 直写。
|
|
56
|
+
|
|
57
|
+
## 后续 follow-up
|
|
58
|
+
|
|
59
|
+
- **可选**:补完 `aggregateToolUsage` 的 `until` 参数支持,weekly-report 改回单条 SQL
|
|
60
|
+
- **可选**:ESLint 规则禁止 `web/routes/` `web/analytics/` `daemon/handlers/` import storage 后调用 `getDatabase()`
|
|
61
|
+
- **不建议**:把 `getDatabase` 改 protected(架构非继承)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# H2 Phase 1 safety-net Changelog
|
|
2
|
+
|
|
3
|
+
**Date**: 2026-05-18 14:50
|
|
4
|
+
**Spec**: docs/design/h2-getdatabase-encapsulation-spec-20260518-1450.md
|
|
5
|
+
**Status**: Phase 1 完成(Phase 2-4 待后续)
|
|
6
|
+
|
|
7
|
+
## 完成清单
|
|
8
|
+
|
|
9
|
+
- [x] web-stats 集成测试 (`tests/integration/web-stats.integration.test.ts`, 4 cases)
|
|
10
|
+
- [x] web-trace 集成测试 (`tests/integration/web-trace.integration.test.ts`, 6 cases — 全分支覆盖)
|
|
11
|
+
- [x] stop-handler-behavior-summary 单测 (`tests/unit/daemon/stop-handler-behavior-summary.test.ts`, 5 cases)
|
|
12
|
+
- [x] web-analytics 集成测试增强 (+2 value-level cases)
|
|
13
|
+
|
|
14
|
+
## 关键代码定位
|
|
15
|
+
|
|
16
|
+
| 测试文件 | 行号 | 内容 |
|
|
17
|
+
|---|---|---|
|
|
18
|
+
| `tests/integration/web-stats.integration.test.ts:38` | empty database 200 shape |
|
|
19
|
+
| `tests/integration/web-stats.integration.test.ts:60` | totalEvents/totalSessions/toolUsage 聚合 |
|
|
20
|
+
| `tests/integration/web-stats.integration.test.ts:83` | dailyActivity 字段形状 |
|
|
21
|
+
| `tests/integration/web-stats.integration.test.ts:103` | skillInvocations 计数 |
|
|
22
|
+
| `tests/integration/web-trace.integration.test.ts:84-118` | 4 个 4xx 错误分支 |
|
|
23
|
+
| `tests/integration/web-trace.integration.test.ts:120-130` | 200 + 空 sessions[](无 git note)|
|
|
24
|
+
| `tests/integration/web-trace.integration.test.ts:132-167` | 200 + 完整 session 详情(含 event_breakdown)|
|
|
25
|
+
| `tests/unit/daemon/stop-handler-behavior-summary.test.ts:69` | 无事件时不附加 summary |
|
|
26
|
+
| `tests/unit/daemon/stop-handler-behavior-summary.test.ts:82` | tool-only summary |
|
|
27
|
+
| `tests/unit/daemon/stop-handler-behavior-summary.test.ts:110` | Agent 委托计数 + agent 名 |
|
|
28
|
+
| `tests/unit/daemon/stop-handler-behavior-summary.test.ts:141` | skill 调用计数 |
|
|
29
|
+
| `tests/unit/daemon/stop-handler-behavior-summary.test.ts:169` | session 隔离(不串扰)|
|
|
30
|
+
| `tests/integration/web-analytics.integration.test.ts:92` | weekly report value 断言 |
|
|
31
|
+
| `tests/integration/web-analytics.integration.test.ts:107` | insights summary.total = patterns.length |
|
|
32
|
+
|
|
33
|
+
## 测试结果
|
|
34
|
+
|
|
35
|
+
- **新增/增强 safety-net 测试**: 17 passed (4 stats + 6 trace + 5 stop + 2 analytics 增强)
|
|
36
|
+
- **跨 Phase 1 范围全量**:
|
|
37
|
+
- `tests/integration/` + `tests/unit/daemon/`: 33 / 33 passed
|
|
38
|
+
- **tsc**: 0 errors
|
|
39
|
+
- **npm test 全量**: 497 / 498 passed (1 failed = pre-existing `linkEventToTask`)
|
|
40
|
+
|
|
41
|
+
## 实施决策
|
|
42
|
+
|
|
43
|
+
1. **trace 测试覆盖方案**:采用方案 A(tmp git repo)。在 `os.tmpdir()` 用 `execFileSync('git', ...)` 创建真实仓库 + 两次 commit + `git notes add`,覆盖:
|
|
44
|
+
- 缺 `?project` query → 400
|
|
45
|
+
- 相对路径 → 400
|
|
46
|
+
- 非 git 目录 → 400
|
|
47
|
+
- commit 不存在 → 404
|
|
48
|
+
- HEAD 有 commit 但无 note → 200 + 空 sessions[]
|
|
49
|
+
- 有 forge-session note + storage 有对应 events → 200 + 完整 session 详情(event_breakdown 等)
|
|
50
|
+
- **覆盖度高于 spec 最低要求**(spec 只要求 commit 不存在 4xx + 无 note 空 sessions 两条),实际跑得快且稳定。
|
|
51
|
+
2. **stop-handler 测试路径调整**:spec 写 `src/tests/stop-handler-behavior-summary.test.ts`,但 `vitest.config.ts` 只包含 `tests/unit/**` 与 `tests/integration/**`。如放到 `src/tests/` 会被 collect 排除导致永远不跑。改放到 `tests/unit/daemon/stop-handler-behavior-summary.test.ts` 以确保实际生效,已在测试文件顶部 NOTE 注释中说明决策。
|
|
52
|
+
3. **`generateBehaviorSummary` 私有方法访问**:经由 `handle()` 入口 + mock `ResumeManager.save` 捕获最终 resume content 进行断言。比反射访问私有方法更接近生产实际路径,且更稳健。
|
|
53
|
+
4. **web-analytics 增强保守原则**:只加 2 个新 case(weekly value + insights consistency),不重写既有 shape 断言。所有原 case 仍保留并通过。
|
|
54
|
+
5. **fixture 时间戳策略**:weekly-report 按 ISO week 范围过滤事件,所以 fixture 用 `new Date().toISOString()`(当下时间)确保进入 `weekOffset: 0` 窗口;stats endpoint 用 `date('now', '-7 days')`,同样满足。
|
|
55
|
+
|
|
56
|
+
## 待 Phase 2 处理
|
|
57
|
+
|
|
58
|
+
下一步 Phase 2(新增 ~20 个 Operations 方法)的提示:
|
|
59
|
+
|
|
60
|
+
- Phase 2 应在 `src/core/storage/{events,sessions,tasks,skills}.ts` 加方法,**不删旧 SQL**,并行存在。
|
|
61
|
+
- Phase 2 同时增加 4 个新单测文件:`tests/unit/storage/{event,session,skill}-operations-aggregates.test.ts`(spec 表 116 行所列)。
|
|
62
|
+
- Phase 3 才会替换调用方(每文件 1 commit),届时本 Phase 1 的 safety-net 会兜底回归。
|
|
63
|
+
- Phase 4 给 `getDatabase()` 加 jsdoc `@internal` 警告。
|
|
64
|
+
- 改造涉及 `daemon/handlers/stop.ts` 时,本次新加的 `stop-handler-behavior-summary.test.ts` 5 个 case 是关键回归依据。
|
|
65
|
+
- trace 测试包含一次真实 `git init`,单测耗时 ~600ms,未来 Phase 2/3 增加新测试时不必再做 git 操作。
|
|
66
|
+
|
|
67
|
+
## 已知问题
|
|
68
|
+
|
|
69
|
+
- **pre-existing 失败**:`SQLiteStorage - Characterization Tests (Pre-Refactor) > Task Operations > linkEventToTask associates events with tasks` —— Zod uuid 校验失败,与本 Phase 1 改动无关,按纪律不修。
|
|
70
|
+
- **未覆盖**:`cli/commands/trace.ts` 3 段 SQL 暂无对应集成测试(spec 第 71 行已标注"可补")。Phase 2/3 替换 CLI trace 时可考虑加 CLI smoke test,或先依赖 web-trace 同模式断言间接保护。
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# H2 Phase 2 Operations 新方法 Changelog
|
|
2
|
+
|
|
3
|
+
**Date**: 2026-05-18 14:50 (Phase 2)
|
|
4
|
+
**Spec**: docs/design/h2-getdatabase-encapsulation-spec-20260518-1450.md
|
|
5
|
+
**Status**: Phase 2 完成(Phase 3 待替换调用方)
|
|
6
|
+
|
|
7
|
+
## 完成清单
|
|
8
|
+
|
|
9
|
+
- [x] EventOperations 11 方法(events.ts)
|
|
10
|
+
- [x] SessionOperations 4 方法(sessions.ts)
|
|
11
|
+
- [x] TaskOperations 1 方法(tasks.ts)
|
|
12
|
+
- [x] SkillOperations 4 方法(skills.ts)
|
|
13
|
+
- [x] sqlite.ts facade 转发(20 个方法)
|
|
14
|
+
- [x] 4 文件单测(44 个 case 全过)
|
|
15
|
+
- [x] tsc 通过 0 errors
|
|
16
|
+
- [x] 旧 SQL 并行存在(Phase 3 才替换)
|
|
17
|
+
|
|
18
|
+
## 新增方法清单
|
|
19
|
+
|
|
20
|
+
### EventOperations(src/core/storage/events.ts:179-358)
|
|
21
|
+
|
|
22
|
+
| 方法 | SQL 来源 |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `countAllEvents()` | stats.ts:13 |
|
|
25
|
+
| `aggregateToolUsage({ since?, limit?, hook_type? })` | stats.ts:17-21 + weekly-report.ts:214-222 |
|
|
26
|
+
| `aggregateDailyEventCounts({ since, until? })` | stats.ts:28-33 |
|
|
27
|
+
| `aggregateHookTypeBySession(session_id)` | trace.ts:106-109 + cli/trace.ts:115 |
|
|
28
|
+
| `aggregateAgentTypeBySession(session_id)` | trace.ts:111-116 + cli/trace.ts:124 + stop.ts:163-168 |
|
|
29
|
+
| `aggregateToolUsageBySession(session_id)` | stop.ts:154-158 |
|
|
30
|
+
| `countActiveDays({ since, until? })` | drift-detector.ts:154-157 |
|
|
31
|
+
| `aggregateOverviewByRange({ since, until })` | weekly-report.ts:100-109 |
|
|
32
|
+
| `queryDistinctProjects({ since, until })` | weekly-report.ts:111-116 |
|
|
33
|
+
| `aggregateToolFailureRate({ since, until })` | weekly-report.ts:228-244(保留 3 OR LIKE 分支) |
|
|
34
|
+
| `queryFileEditInputs({ since, until, tool_names })` | weekly-report.ts:261-268(内部 IN 展开) |
|
|
35
|
+
| `queryEventsByTimeRange({ since, until? })` | anti-pattern-detector.ts:83-86 |
|
|
36
|
+
|
|
37
|
+
### SessionOperations(src/core/storage/sessions.ts:107-178)
|
|
38
|
+
|
|
39
|
+
| 方法 | SQL 来源 |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `countAllSessions()` | stats.ts:14 |
|
|
42
|
+
| `aggregateDailySessionCounts({ since, until? })` | stats.ts:35-40 |
|
|
43
|
+
| `querySessionsByTimeRange({ since, until? })` | anti-pattern-detector.ts:104-114 |
|
|
44
|
+
| `countSessionsByRange({ since, until? })` | drift-detector.ts:185-187 |
|
|
45
|
+
|
|
46
|
+
### TaskOperations(src/core/storage/tasks.ts:120-131)
|
|
47
|
+
|
|
48
|
+
| 方法 | SQL 来源 |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `countTasksByRange({ since, until? })` | drift-detector.ts:190-192 + weekly-report.ts:118-122 |
|
|
51
|
+
|
|
52
|
+
### SkillOperations(src/core/storage/skills.ts:203-232)
|
|
53
|
+
|
|
54
|
+
| 方法 | SQL 来源 |
|
|
55
|
+
|---|---|
|
|
56
|
+
| `countAllSkillInvocations()` | stats.ts:50 |
|
|
57
|
+
| `countSkillInvocationsBySession(session_id)` | stop.ts:176-178 |
|
|
58
|
+
| `countDistinctSkillsSince(since_ms)` | drift-detector.ts:125-128 |
|
|
59
|
+
| `queryDistinctSkillIdsBySession(session_id)` | trace.ts:118-120 + cli/trace.ts:135 |
|
|
60
|
+
|
|
61
|
+
### sqlite.ts facade(src/core/storage/sqlite.ts:94-160)
|
|
62
|
+
|
|
63
|
+
20 个方法签名严格按 spec,全部 `delegate to this.events / this.sessions / this.tasks / this.skills`。
|
|
64
|
+
|
|
65
|
+
## 关键代码定位
|
|
66
|
+
|
|
67
|
+
- `src/core/storage/events.ts:179-358` — EventOperations 11 新方法
|
|
68
|
+
- `src/core/storage/sessions.ts:107-178` — SessionOperations 4 新方法
|
|
69
|
+
- `src/core/storage/tasks.ts:120-131` — TaskOperations countTasksByRange
|
|
70
|
+
- `src/core/storage/skills.ts:203-232` — SkillOperations 4 新方法
|
|
71
|
+
- `src/core/storage/sqlite.ts:94-160` — facade 转发段
|
|
72
|
+
|
|
73
|
+
## 测试结果
|
|
74
|
+
|
|
75
|
+
- 新增单测: **44 passed / 44**
|
|
76
|
+
- event-operations-aggregates.test.ts: 23 tests
|
|
77
|
+
- session-operations-aggregates.test.ts: 9 tests
|
|
78
|
+
- task-operations-counts.test.ts: 3 tests
|
|
79
|
+
- skill-operations-counts.test.ts: 9 tests
|
|
80
|
+
- 旧 storage 测试回归: 通过(除 pre-existing failure)
|
|
81
|
+
- tsc: **0 errors**
|
|
82
|
+
- npm test: **541 passed / 542**(仅 pre-existing `linkEventToTask` 失败)
|
|
83
|
+
|
|
84
|
+
## 实施决策
|
|
85
|
+
|
|
86
|
+
1. **LIKE '%error%' 失败检测保持原 SQL 三个 OR 分支**
|
|
87
|
+
- `tool_output LIKE '%"error"%' OR LIKE '%"is_error":true%' OR LIKE '%"isError":true%'`
|
|
88
|
+
- 测试覆盖三种 tool_output JSON 形态,确认全部命中
|
|
89
|
+
|
|
90
|
+
2. **时间区间统一 `[since, until)` 半开半闭语义**
|
|
91
|
+
- 调用方负责 ISO 字符串构造(`new Date(since).toISOString()`)
|
|
92
|
+
- until 一律 `<`(与 weekly-report.ts 原 `start_time < ?` 一致)
|
|
93
|
+
- 与 stats.ts 原 `date('now', '-7 days')` 语义不同:新方法不再隐含 now(),调用方计算
|
|
94
|
+
|
|
95
|
+
3. **`queryFileEditInputs` 内部展开 placeholders**
|
|
96
|
+
- tool_names 通过参数注入,避免外部拼 SQL
|
|
97
|
+
- 空 list 直接返回空数组(避免 `IN ()` SQL 错误)
|
|
98
|
+
|
|
99
|
+
4. **`aggregateToolUsage` 合并 stats / weekly-report 两个用例**
|
|
100
|
+
- 通过 `hook_type` 可选过滤 + `since` 可选过滤兼顾两种调用
|
|
101
|
+
- `tool_name IS NOT NULL AND tool_name != ''` 始终生效(stats.ts 原行为)
|
|
102
|
+
|
|
103
|
+
5. **`aggregateAgentTypeBySession` 与 `aggregateToolUsageBySession` 分离**
|
|
104
|
+
- 前者 `tool_name IN ('Agent','Task')` + json_extract subagent_type(stop.ts:163 / trace.ts:111)
|
|
105
|
+
- 后者纯 `tool_name IS NOT NULL`(stop.ts:154)
|
|
106
|
+
- 两段语义不同,分别封装
|
|
107
|
+
|
|
108
|
+
## 待 Phase 3 处理
|
|
109
|
+
|
|
110
|
+
- 替换 src/web/routes/stats.ts(5 段 SQL)
|
|
111
|
+
- 替换 src/web/routes/trace.ts(3 段 SQL)
|
|
112
|
+
- 替换 src/cli/commands/trace.ts(3 段 SQL)
|
|
113
|
+
- 替换 src/daemon/handlers/stop.ts:154-178(3 段 SQL)
|
|
114
|
+
- 替换 src/web/analytics/drift-detector.ts(4 段 SQL)
|
|
115
|
+
- 替换 src/web/analytics/weekly-report.ts(6 段 SQL)
|
|
116
|
+
- 替换 src/web/analytics/anti-pattern-detector.ts(2 段 SQL)
|
|
117
|
+
|
|
118
|
+
## 已知问题
|
|
119
|
+
|
|
120
|
+
- `tests/unit/storage/sqlite-refactor-harness.test.ts > linkEventToTask` pre-existing 失败(与 Phase 2 改动无关,event_id 未传 UUID 导致 zod schema 拒收)
|