@stackmemoryai/stackmemory 0.5.57 → 0.5.59
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/bin/codex-smd +6 -0
- package/dist/cli/codex-sm-danger.js +21 -0
- package/dist/cli/codex-sm-danger.js.map +7 -0
- package/dist/cli/commands/handoff.js +33 -3
- package/dist/cli/commands/handoff.js.map +2 -2
- package/dist/cli/commands/search.js +20 -3
- package/dist/cli/commands/search.js.map +2 -2
- package/dist/core/database/sqlite-adapter.js +13 -3
- package/dist/core/database/sqlite-adapter.js.map +2 -2
- package/dist/core/errors/error-utils.js +208 -0
- package/dist/core/errors/error-utils.js.map +7 -0
- package/dist/core/errors/index.js +13 -4
- package/dist/core/errors/index.js.map +2 -2
- package/dist/core/merge/unified-merge-resolver.js +303 -0
- package/dist/core/merge/unified-merge-resolver.js.map +7 -0
- package/dist/core/monitoring/logger.js +61 -9
- package/dist/core/monitoring/logger.js.map +2 -2
- package/dist/core/security/index.js +35 -0
- package/dist/core/security/index.js.map +7 -0
- package/dist/core/security/input-sanitizer.js +321 -0
- package/dist/core/security/input-sanitizer.js.map +7 -0
- package/dist/core/session/enhanced-handoff.js +136 -2
- package/dist/core/session/enhanced-handoff.js.map +3 -3
- package/dist/integrations/linear/client.js +5 -1
- package/dist/integrations/linear/client.js.map +2 -2
- package/dist/integrations/mcp/remote-server.js +27 -36
- package/dist/integrations/mcp/remote-server.js.map +2 -2
- package/dist/integrations/mcp/server.js +44 -29
- package/dist/integrations/mcp/server.js.map +3 -3
- package/dist/scripts/benchmark-performance.js +48 -0
- package/dist/scripts/benchmark-performance.js.map +7 -0
- package/dist/scripts/check-redis.js +42 -0
- package/dist/scripts/check-redis.js.map +7 -0
- package/dist/scripts/initialize.js +116 -0
- package/dist/scripts/initialize.js.map +7 -0
- package/dist/scripts/list-linear-tasks.js +124 -0
- package/dist/scripts/list-linear-tasks.js.map +7 -0
- package/dist/scripts/measure-handoff-impact.js +340 -0
- package/dist/scripts/measure-handoff-impact.js.map +7 -0
- package/dist/scripts/query-chromadb.js +160 -0
- package/dist/scripts/query-chromadb.js.map +7 -0
- package/dist/scripts/show-linear-summary.js +119 -0
- package/dist/scripts/show-linear-summary.js.map +7 -0
- package/dist/scripts/simple-swarm-demo.js +90 -0
- package/dist/scripts/simple-swarm-demo.js.map +7 -0
- package/dist/scripts/status.js +155 -0
- package/dist/scripts/status.js.map +7 -0
- package/dist/scripts/test-chromadb-sync.js +192 -0
- package/dist/scripts/test-chromadb-sync.js.map +7 -0
- package/dist/scripts/test-ralph-iteration-fix.js +86 -0
- package/dist/scripts/test-ralph-iteration-fix.js.map +7 -0
- package/dist/scripts/test-ralph-iterations.js +121 -0
- package/dist/scripts/test-ralph-iterations.js.map +7 -0
- package/dist/scripts/test-redis-storage.js +389 -0
- package/dist/scripts/test-redis-storage.js.map +7 -0
- package/dist/scripts/test-simple-ralph-state-sync.js +115 -0
- package/dist/scripts/test-simple-ralph-state-sync.js.map +7 -0
- package/dist/scripts/test-swarm-fixes.js +125 -0
- package/dist/scripts/test-swarm-fixes.js.map +7 -0
- package/dist/scripts/test-swarm-tui.js +23 -0
- package/dist/scripts/test-swarm-tui.js.map +7 -0
- package/dist/scripts/test-tui-shortcuts.js +52 -0
- package/dist/scripts/test-tui-shortcuts.js.map +7 -0
- package/dist/scripts/validate-tui-shortcuts.js +60 -0
- package/dist/scripts/validate-tui-shortcuts.js.map +7 -0
- package/dist/src/agents/core/agent-task-manager.js +527 -0
- package/dist/src/agents/core/agent-task-manager.js.map +7 -0
- package/dist/src/agents/verifiers/base-verifier.js +133 -0
- package/dist/src/agents/verifiers/base-verifier.js.map +7 -0
- package/dist/src/agents/verifiers/formatter-verifier.js +130 -0
- package/dist/src/agents/verifiers/formatter-verifier.js.map +7 -0
- package/dist/src/agents/verifiers/llm-judge.js +252 -0
- package/dist/src/agents/verifiers/llm-judge.js.map +7 -0
- package/dist/src/cli/auto-detect.js +321 -0
- package/dist/src/cli/auto-detect.js.map +7 -0
- package/dist/src/cli/claude-sm-danger.js +21 -0
- package/dist/src/cli/claude-sm-danger.js.map +7 -0
- package/dist/src/cli/claude-sm.js +1156 -0
- package/dist/src/cli/claude-sm.js.map +7 -0
- package/dist/src/cli/codex-sm-danger.js +21 -0
- package/dist/src/cli/codex-sm-danger.js.map +7 -0
- package/dist/src/cli/codex-sm.js +349 -0
- package/dist/src/cli/codex-sm.js.map +7 -0
- package/dist/src/cli/commands/api.js +232 -0
- package/dist/src/cli/commands/api.js.map +7 -0
- package/dist/src/cli/commands/auto-background.js +180 -0
- package/dist/src/cli/commands/auto-background.js.map +7 -0
- package/dist/src/cli/commands/cleanup-processes.js +68 -0
- package/dist/src/cli/commands/cleanup-processes.js.map +7 -0
- package/dist/src/cli/commands/clear.js +202 -0
- package/dist/src/cli/commands/clear.js.map +7 -0
- package/dist/src/cli/commands/config.js +445 -0
- package/dist/src/cli/commands/config.js.map +7 -0
- package/dist/src/cli/commands/context-rehydrate.js +751 -0
- package/dist/src/cli/commands/context-rehydrate.js.map +7 -0
- package/dist/src/cli/commands/context.js +343 -0
- package/dist/src/cli/commands/context.js.map +7 -0
- package/dist/src/cli/commands/daemon.js +392 -0
- package/dist/src/cli/commands/daemon.js.map +7 -0
- package/dist/src/cli/commands/dashboard.js +210 -0
- package/dist/src/cli/commands/dashboard.js.map +7 -0
- package/dist/src/cli/commands/db.js +147 -0
- package/dist/src/cli/commands/db.js.map +7 -0
- package/dist/src/cli/commands/decision.js +266 -0
- package/dist/src/cli/commands/decision.js.map +7 -0
- package/dist/src/cli/commands/discovery.js +279 -0
- package/dist/src/cli/commands/discovery.js.map +7 -0
- package/dist/src/cli/commands/handoff.js +624 -0
- package/dist/src/cli/commands/handoff.js.map +7 -0
- package/dist/src/cli/commands/hooks.js +298 -0
- package/dist/src/cli/commands/hooks.js.map +7 -0
- package/dist/src/cli/commands/linear.js +529 -0
- package/dist/src/cli/commands/linear.js.map +7 -0
- package/dist/src/cli/commands/log.js +169 -0
- package/dist/src/cli/commands/log.js.map +7 -0
- package/dist/src/cli/commands/login.js +172 -0
- package/dist/src/cli/commands/login.js.map +7 -0
- package/dist/src/cli/commands/migrate.js +240 -0
- package/dist/src/cli/commands/migrate.js.map +7 -0
- package/dist/src/cli/commands/model.js +533 -0
- package/dist/src/cli/commands/model.js.map +7 -0
- package/dist/src/cli/commands/onboard.js +536 -0
- package/dist/src/cli/commands/onboard.js.map +7 -0
- package/dist/src/cli/commands/projects.js +199 -0
- package/dist/src/cli/commands/projects.js.map +7 -0
- package/dist/src/cli/commands/ralph.js +909 -0
- package/dist/src/cli/commands/ralph.js.map +7 -0
- package/dist/src/cli/commands/retrieval.js +248 -0
- package/dist/src/cli/commands/retrieval.js.map +7 -0
- package/dist/src/cli/commands/search.js +173 -0
- package/dist/src/cli/commands/search.js.map +7 -0
- package/dist/src/cli/commands/service.js +749 -0
- package/dist/src/cli/commands/service.js.map +7 -0
- package/dist/src/cli/commands/session.js +200 -0
- package/dist/src/cli/commands/session.js.map +7 -0
- package/dist/src/cli/commands/settings.js +306 -0
- package/dist/src/cli/commands/settings.js.map +7 -0
- package/dist/src/cli/commands/setup.js +701 -0
- package/dist/src/cli/commands/setup.js.map +7 -0
- package/dist/src/cli/commands/shell.js +249 -0
- package/dist/src/cli/commands/shell.js.map +7 -0
- package/dist/src/cli/commands/signup.js +50 -0
- package/dist/src/cli/commands/signup.js.map +7 -0
- package/dist/src/cli/commands/skills.js +470 -0
- package/dist/src/cli/commands/skills.js.map +7 -0
- package/dist/src/cli/commands/sms-notify.js +795 -0
- package/dist/src/cli/commands/sms-notify.js.map +7 -0
- package/dist/src/cli/commands/storage-tier.js +183 -0
- package/dist/src/cli/commands/storage-tier.js.map +7 -0
- package/dist/src/cli/commands/sweep.js +249 -0
- package/dist/src/cli/commands/sweep.js.map +7 -0
- package/dist/src/cli/commands/tasks.js +213 -0
- package/dist/src/cli/commands/tasks.js.map +7 -0
- package/dist/src/cli/commands/worktree.js +319 -0
- package/dist/src/cli/commands/worktree.js.map +7 -0
- package/dist/src/cli/index.js +594 -0
- package/dist/src/cli/index.js.map +7 -0
- package/dist/src/cli/opencode-sm.js +448 -0
- package/dist/src/cli/opencode-sm.js.map +7 -0
- package/dist/src/cli/utils/viewer.js +96 -0
- package/dist/src/cli/utils/viewer.js.map +7 -0
- package/dist/src/core/config/config-manager.js +398 -0
- package/dist/src/core/config/config-manager.js.map +7 -0
- package/dist/src/core/config/feature-flags.js +76 -0
- package/dist/src/core/config/feature-flags.js.map +7 -0
- package/dist/src/core/config/storage-config.js +115 -0
- package/dist/src/core/config/storage-config.js.map +7 -0
- package/dist/src/core/config/types.js +144 -0
- package/dist/src/core/config/types.js.map +7 -0
- package/dist/src/core/context/auto-context.js +80 -0
- package/dist/src/core/context/auto-context.js.map +7 -0
- package/dist/src/core/context/dual-stack-manager.js +870 -0
- package/dist/src/core/context/dual-stack-manager.js.map +7 -0
- package/dist/src/core/context/enhanced-rehydration.js +994 -0
- package/dist/src/core/context/enhanced-rehydration.js.map +7 -0
- package/dist/src/core/context/frame-database.js +479 -0
- package/dist/src/core/context/frame-database.js.map +7 -0
- package/dist/src/core/context/frame-digest.js +250 -0
- package/dist/src/core/context/frame-digest.js.map +7 -0
- package/dist/src/core/context/frame-handoff-manager.js +778 -0
- package/dist/src/core/context/frame-handoff-manager.js.map +7 -0
- package/dist/src/core/context/frame-lifecycle-hooks.js +119 -0
- package/dist/src/core/context/frame-lifecycle-hooks.js.map +7 -0
- package/dist/src/core/context/frame-recovery.js +302 -0
- package/dist/src/core/context/frame-recovery.js.map +7 -0
- package/dist/src/core/context/frame-stack.js +314 -0
- package/dist/src/core/context/frame-stack.js.map +7 -0
- package/dist/src/core/context/frame-types.js +5 -0
- package/dist/src/core/context/frame-types.js.map +7 -0
- package/dist/src/core/context/index.js +25 -0
- package/dist/src/core/context/index.js.map +7 -0
- package/dist/src/core/context/permission-manager.js +185 -0
- package/dist/src/core/context/permission-manager.js.map +7 -0
- package/dist/src/core/context/recursive-context-manager.js +592 -0
- package/dist/src/core/context/recursive-context-manager.js.map +7 -0
- package/dist/src/core/context/refactored-frame-manager.js +754 -0
- package/dist/src/core/context/refactored-frame-manager.js.map +7 -0
- package/dist/src/core/context/shared-context-layer.js +621 -0
- package/dist/src/core/context/shared-context-layer.js.map +7 -0
- package/dist/src/core/context/stack-merge-resolver.js +749 -0
- package/dist/src/core/context/stack-merge-resolver.js.map +7 -0
- package/dist/src/core/context/validation.js +130 -0
- package/dist/src/core/context/validation.js.map +7 -0
- package/dist/src/core/database/batch-operations.js +384 -0
- package/dist/src/core/database/batch-operations.js.map +7 -0
- package/dist/src/core/database/connection-pool.js +330 -0
- package/dist/src/core/database/connection-pool.js.map +7 -0
- package/dist/src/core/database/database-adapter.js +60 -0
- package/dist/src/core/database/database-adapter.js.map +7 -0
- package/dist/src/core/database/migration-manager.js +614 -0
- package/dist/src/core/database/migration-manager.js.map +7 -0
- package/dist/src/core/database/query-cache.js +298 -0
- package/dist/src/core/database/query-cache.js.map +7 -0
- package/dist/src/core/database/query-router.js +430 -0
- package/dist/src/core/database/query-router.js.map +7 -0
- package/dist/src/core/database/sqlite-adapter.js +738 -0
- package/dist/src/core/database/sqlite-adapter.js.map +7 -0
- package/dist/src/core/digest/enhanced-hybrid-digest.js +277 -0
- package/dist/src/core/digest/enhanced-hybrid-digest.js.map +7 -0
- package/dist/src/core/digest/frame-digest-integration.js +176 -0
- package/dist/src/core/digest/frame-digest-integration.js.map +7 -0
- package/dist/src/core/digest/hybrid-digest-generator.js +553 -0
- package/dist/src/core/digest/hybrid-digest-generator.js.map +7 -0
- package/dist/src/core/digest/index.js +9 -0
- package/dist/src/core/digest/index.js.map +7 -0
- package/dist/src/core/digest/types.js +25 -0
- package/dist/src/core/digest/types.js.map +7 -0
- package/dist/src/core/errors/error-utils.js +208 -0
- package/dist/src/core/errors/error-utils.js.map +7 -0
- package/dist/src/core/errors/index.js +521 -0
- package/dist/src/core/errors/index.js.map +7 -0
- package/dist/src/core/errors/recovery.js +269 -0
- package/dist/src/core/errors/recovery.js.map +7 -0
- package/dist/src/core/execution/parallel-executor.js +258 -0
- package/dist/src/core/execution/parallel-executor.js.map +7 -0
- package/dist/src/core/frame/workflow-templates.js +319 -0
- package/dist/src/core/frame/workflow-templates.js.map +7 -0
- package/dist/src/core/merge/conflict-detector.js +431 -0
- package/dist/src/core/merge/conflict-detector.js.map +7 -0
- package/dist/src/core/merge/index.js +9 -0
- package/dist/src/core/merge/index.js.map +7 -0
- package/dist/src/core/merge/resolution-engine.js +558 -0
- package/dist/src/core/merge/resolution-engine.js.map +7 -0
- package/dist/src/core/merge/stack-diff.js +532 -0
- package/dist/src/core/merge/stack-diff.js.map +7 -0
- package/dist/src/core/merge/types.js +5 -0
- package/dist/src/core/merge/types.js.map +7 -0
- package/dist/src/core/merge/unified-merge-resolver.js +303 -0
- package/dist/src/core/merge/unified-merge-resolver.js.map +7 -0
- package/dist/src/core/models/fallback-monitor.js +232 -0
- package/dist/src/core/models/fallback-monitor.js.map +7 -0
- package/dist/src/core/models/model-router.js +340 -0
- package/dist/src/core/models/model-router.js.map +7 -0
- package/dist/src/core/monitoring/error-handler.js +49 -0
- package/dist/src/core/monitoring/error-handler.js.map +7 -0
- package/dist/src/core/monitoring/logger.js +202 -0
- package/dist/src/core/monitoring/logger.js.map +7 -0
- package/dist/src/core/monitoring/metrics.js +172 -0
- package/dist/src/core/monitoring/metrics.js.map +7 -0
- package/dist/src/core/monitoring/progress-tracker.js +189 -0
- package/dist/src/core/monitoring/progress-tracker.js.map +7 -0
- package/dist/src/core/monitoring/session-monitor.js +300 -0
- package/dist/src/core/monitoring/session-monitor.js.map +7 -0
- package/dist/src/core/performance/context-cache.js +273 -0
- package/dist/src/core/performance/context-cache.js.map +7 -0
- package/dist/src/core/performance/index.js +11 -0
- package/dist/src/core/performance/index.js.map +7 -0
- package/dist/src/core/performance/lazy-context-loader.js +327 -0
- package/dist/src/core/performance/lazy-context-loader.js.map +7 -0
- package/dist/src/core/performance/monitor.js +221 -0
- package/dist/src/core/performance/monitor.js.map +7 -0
- package/dist/src/core/performance/optimized-frame-context.js +345 -0
- package/dist/src/core/performance/optimized-frame-context.js.map +7 -0
- package/dist/src/core/performance/performance-benchmark.js +277 -0
- package/dist/src/core/performance/performance-benchmark.js.map +7 -0
- package/dist/src/core/performance/performance-profiler.js +370 -0
- package/dist/src/core/performance/performance-profiler.js.map +7 -0
- package/dist/src/core/performance/streaming-jsonl-parser.js +195 -0
- package/dist/src/core/performance/streaming-jsonl-parser.js.map +7 -0
- package/dist/src/core/persistence/postgres-adapter.js +349 -0
- package/dist/src/core/persistence/postgres-adapter.js.map +7 -0
- package/dist/src/core/projects/project-isolation.js +201 -0
- package/dist/src/core/projects/project-isolation.js.map +7 -0
- package/dist/src/core/projects/project-manager.js +697 -0
- package/dist/src/core/projects/project-manager.js.map +7 -0
- package/dist/src/core/query/query-parser.js +370 -0
- package/dist/src/core/query/query-parser.js.map +7 -0
- package/dist/src/core/query/query-templates.js +321 -0
- package/dist/src/core/query/query-templates.js.map +7 -0
- package/dist/src/core/retrieval/context-retriever.js +479 -0
- package/dist/src/core/retrieval/context-retriever.js.map +7 -0
- package/dist/src/core/retrieval/index.js +8 -0
- package/dist/src/core/retrieval/index.js.map +7 -0
- package/dist/src/core/retrieval/llm-context-retrieval.js +613 -0
- package/dist/src/core/retrieval/llm-context-retrieval.js.map +7 -0
- package/dist/src/core/retrieval/llm-provider.js +151 -0
- package/dist/src/core/retrieval/llm-provider.js.map +7 -0
- package/dist/src/core/retrieval/retrieval-audit.js +236 -0
- package/dist/src/core/retrieval/retrieval-audit.js.map +7 -0
- package/dist/src/core/retrieval/summary-generator.js +589 -0
- package/dist/src/core/retrieval/summary-generator.js.map +7 -0
- package/dist/src/core/retrieval/types.js +21 -0
- package/dist/src/core/retrieval/types.js.map +7 -0
- package/dist/src/core/security/index.js +35 -0
- package/dist/src/core/security/index.js.map +7 -0
- package/dist/src/core/security/input-sanitizer.js +321 -0
- package/dist/src/core/security/input-sanitizer.js.map +7 -0
- package/dist/src/core/session/clear-survival.js +465 -0
- package/dist/src/core/session/clear-survival.js.map +7 -0
- package/dist/src/core/session/enhanced-handoff.js +792 -0
- package/dist/src/core/session/enhanced-handoff.js.map +7 -0
- package/dist/src/core/session/handoff-generator.js +343 -0
- package/dist/src/core/session/handoff-generator.js.map +7 -0
- package/dist/src/core/session/index.js +15 -0
- package/dist/src/core/session/index.js.map +7 -0
- package/dist/src/core/session/session-manager.js +347 -0
- package/dist/src/core/session/session-manager.js.map +7 -0
- package/dist/src/core/skills/index.js +7 -0
- package/dist/src/core/skills/index.js.map +7 -0
- package/dist/src/core/skills/skill-storage.js +764 -0
- package/dist/src/core/skills/skill-storage.js.map +7 -0
- package/dist/src/core/skills/types.js +193 -0
- package/dist/src/core/skills/types.js.map +7 -0
- package/dist/src/core/storage/chromadb-adapter.js +354 -0
- package/dist/src/core/storage/chromadb-adapter.js.map +7 -0
- package/dist/src/core/storage/infinite-storage.js +510 -0
- package/dist/src/core/storage/infinite-storage.js.map +7 -0
- package/dist/src/core/storage/remote-storage.js +489 -0
- package/dist/src/core/storage/remote-storage.js.map +7 -0
- package/dist/src/core/storage/two-tier-storage.js +766 -0
- package/dist/src/core/storage/two-tier-storage.js.map +7 -0
- package/dist/src/core/trace/cli-trace-wrapper.js +132 -0
- package/dist/src/core/trace/cli-trace-wrapper.js.map +7 -0
- package/dist/src/core/trace/db-trace-wrapper.js +247 -0
- package/dist/src/core/trace/db-trace-wrapper.js.map +7 -0
- package/dist/src/core/trace/debug-trace.js +417 -0
- package/dist/src/core/trace/debug-trace.js.map +7 -0
- package/dist/src/core/trace/index.js +109 -0
- package/dist/src/core/trace/index.js.map +7 -0
- package/dist/src/core/trace/linear-api-wrapper.js +178 -0
- package/dist/src/core/trace/linear-api-wrapper.js.map +7 -0
- package/dist/src/core/trace/trace-detector.js +528 -0
- package/dist/src/core/trace/trace-detector.js.map +7 -0
- package/dist/src/core/trace/trace-store.js +345 -0
- package/dist/src/core/trace/trace-store.js.map +7 -0
- package/dist/src/core/trace/types.js +77 -0
- package/dist/src/core/trace/types.js.map +7 -0
- package/dist/src/core/types.js +5 -0
- package/dist/src/core/types.js.map +7 -0
- package/dist/src/core/utils/async-mutex.js +114 -0
- package/dist/src/core/utils/async-mutex.js.map +7 -0
- package/dist/src/core/utils/compression.js +83 -0
- package/dist/src/core/utils/compression.js.map +7 -0
- package/dist/src/core/utils/update-checker.js +218 -0
- package/dist/src/core/utils/update-checker.js.map +7 -0
- package/dist/src/core/worktree/worktree-manager.js +465 -0
- package/dist/src/core/worktree/worktree-manager.js.map +7 -0
- package/dist/src/daemon/daemon-config.js +149 -0
- package/dist/src/daemon/daemon-config.js.map +7 -0
- package/dist/src/daemon/services/context-service.js +122 -0
- package/dist/src/daemon/services/context-service.js.map +7 -0
- package/dist/src/daemon/services/linear-service.js +136 -0
- package/dist/src/daemon/services/linear-service.js.map +7 -0
- package/dist/src/daemon/session-daemon.js +312 -0
- package/dist/src/daemon/session-daemon.js.map +7 -0
- package/dist/src/daemon/unified-daemon.js +276 -0
- package/dist/src/daemon/unified-daemon.js.map +7 -0
- package/dist/src/features/analytics/api/analytics-api.js +287 -0
- package/dist/src/features/analytics/api/analytics-api.js.map +7 -0
- package/dist/src/features/analytics/core/analytics-service.js +282 -0
- package/dist/src/features/analytics/core/analytics-service.js.map +7 -0
- package/dist/src/features/analytics/index.js +18 -0
- package/dist/src/features/analytics/index.js.map +7 -0
- package/dist/src/features/analytics/queries/metrics-queries.js +277 -0
- package/dist/src/features/analytics/queries/metrics-queries.js.map +7 -0
- package/dist/src/features/analytics/types/metrics.js +5 -0
- package/dist/src/features/analytics/types/metrics.js.map +7 -0
- package/dist/src/features/browser/browser-mcp.js +492 -0
- package/dist/src/features/browser/browser-mcp.js.map +7 -0
- package/dist/src/features/sweep/index.js +20 -0
- package/dist/src/features/sweep/index.js.map +7 -0
- package/dist/src/features/sweep/prediction-client.js +155 -0
- package/dist/src/features/sweep/prediction-client.js.map +7 -0
- package/dist/src/features/sweep/prompt-builder.js +85 -0
- package/dist/src/features/sweep/prompt-builder.js.map +7 -0
- package/dist/src/features/sweep/pty-wrapper.js +171 -0
- package/dist/src/features/sweep/pty-wrapper.js.map +7 -0
- package/dist/src/features/sweep/state-watcher.js +87 -0
- package/dist/src/features/sweep/state-watcher.js.map +7 -0
- package/dist/src/features/sweep/status-bar.js +88 -0
- package/dist/src/features/sweep/status-bar.js.map +7 -0
- package/dist/src/features/sweep/sweep-server-manager.js +226 -0
- package/dist/src/features/sweep/sweep-server-manager.js.map +7 -0
- package/dist/src/features/sweep/tab-interceptor.js +38 -0
- package/dist/src/features/sweep/tab-interceptor.js.map +7 -0
- package/dist/src/features/sweep/types.js +18 -0
- package/dist/src/features/sweep/types.js.map +7 -0
- package/dist/src/features/tasks/linear-task-manager.js +487 -0
- package/dist/src/features/tasks/linear-task-manager.js.map +7 -0
- package/dist/src/features/tasks/task-aware-context.js +410 -0
- package/dist/src/features/tasks/task-aware-context.js.map +7 -0
- package/dist/src/features/tui/simple-monitor.js +116 -0
- package/dist/src/features/tui/simple-monitor.js.map +7 -0
- package/dist/src/features/tui/swarm-monitor.js +648 -0
- package/dist/src/features/tui/swarm-monitor.js.map +7 -0
- package/dist/src/features/web/client/stores/task-store.js +26 -0
- package/dist/src/features/web/client/stores/task-store.js.map +7 -0
- package/dist/src/features/web/server/index.js +194 -0
- package/dist/src/features/web/server/index.js.map +7 -0
- package/dist/src/hooks/auto-background.js +151 -0
- package/dist/src/hooks/auto-background.js.map +7 -0
- package/dist/src/hooks/claude-code-whatsapp-hook.js +197 -0
- package/dist/src/hooks/claude-code-whatsapp-hook.js.map +7 -0
- package/dist/src/hooks/config.js +150 -0
- package/dist/src/hooks/config.js.map +7 -0
- package/dist/src/hooks/daemon.js +364 -0
- package/dist/src/hooks/daemon.js.map +7 -0
- package/dist/src/hooks/events.js +58 -0
- package/dist/src/hooks/events.js.map +7 -0
- package/dist/src/hooks/index.js +12 -0
- package/dist/src/hooks/index.js.map +7 -0
- package/dist/src/hooks/linear-task-picker.js +186 -0
- package/dist/src/hooks/linear-task-picker.js.map +7 -0
- package/dist/src/hooks/schemas.js +197 -0
- package/dist/src/hooks/schemas.js.map +7 -0
- package/dist/src/hooks/secure-fs.js +49 -0
- package/dist/src/hooks/secure-fs.js.map +7 -0
- package/dist/src/hooks/security-logger.js +155 -0
- package/dist/src/hooks/security-logger.js.map +7 -0
- package/dist/src/hooks/session-summary.js +222 -0
- package/dist/src/hooks/session-summary.js.map +7 -0
- package/dist/src/hooks/sms-action-runner.js +371 -0
- package/dist/src/hooks/sms-action-runner.js.map +7 -0
- package/dist/src/hooks/sms-notify.js +506 -0
- package/dist/src/hooks/sms-notify.js.map +7 -0
- package/dist/src/hooks/sms-watcher.js +93 -0
- package/dist/src/hooks/sms-watcher.js.map +7 -0
- package/dist/src/hooks/sms-webhook.js +555 -0
- package/dist/src/hooks/sms-webhook.js.map +7 -0
- package/dist/src/hooks/whatsapp-commands.js +479 -0
- package/dist/src/hooks/whatsapp-commands.js.map +7 -0
- package/dist/src/hooks/whatsapp-scheduler.js +317 -0
- package/dist/src/hooks/whatsapp-scheduler.js.map +7 -0
- package/dist/src/hooks/whatsapp-sync.js +409 -0
- package/dist/src/hooks/whatsapp-sync.js.map +7 -0
- package/dist/src/index.js +25 -0
- package/dist/src/index.js.map +7 -0
- package/dist/src/integrations/anthropic/client.js +263 -0
- package/dist/src/integrations/anthropic/client.js.map +7 -0
- package/dist/src/integrations/claude-code/agent-bridge.js +768 -0
- package/dist/src/integrations/claude-code/agent-bridge.js.map +7 -0
- package/dist/src/integrations/claude-code/enhanced-pre-clear-hooks.js +459 -0
- package/dist/src/integrations/claude-code/enhanced-pre-clear-hooks.js.map +7 -0
- package/dist/src/integrations/claude-code/lifecycle-hooks.js +254 -0
- package/dist/src/integrations/claude-code/lifecycle-hooks.js.map +7 -0
- package/dist/src/integrations/claude-code/post-task-hooks.js +545 -0
- package/dist/src/integrations/claude-code/post-task-hooks.js.map +7 -0
- package/dist/src/integrations/claude-code/subagent-client-stub.js +20 -0
- package/dist/src/integrations/claude-code/subagent-client-stub.js.map +7 -0
- package/dist/src/integrations/claude-code/subagent-client.js +511 -0
- package/dist/src/integrations/claude-code/subagent-client.js.map +7 -0
- package/dist/src/integrations/claude-code/task-coordinator.js +360 -0
- package/dist/src/integrations/claude-code/task-coordinator.js.map +7 -0
- package/dist/src/integrations/linear/auth.js +337 -0
- package/dist/src/integrations/linear/auth.js.map +7 -0
- package/dist/src/integrations/linear/auto-sync.js +258 -0
- package/dist/src/integrations/linear/auto-sync.js.map +7 -0
- package/dist/src/integrations/linear/client.js +634 -0
- package/dist/src/integrations/linear/client.js.map +7 -0
- package/dist/src/integrations/linear/config.js +130 -0
- package/dist/src/integrations/linear/config.js.map +7 -0
- package/dist/src/integrations/linear/migration.js +361 -0
- package/dist/src/integrations/linear/migration.js.map +7 -0
- package/dist/src/integrations/linear/oauth-server.js +454 -0
- package/dist/src/integrations/linear/oauth-server.js.map +7 -0
- package/dist/src/integrations/linear/rest-client.js +213 -0
- package/dist/src/integrations/linear/rest-client.js.map +7 -0
- package/dist/src/integrations/linear/sync-manager.js +236 -0
- package/dist/src/integrations/linear/sync-manager.js.map +7 -0
- package/dist/src/integrations/linear/sync-service.js +231 -0
- package/dist/src/integrations/linear/sync-service.js.map +7 -0
- package/dist/src/integrations/linear/sync.js +782 -0
- package/dist/src/integrations/linear/sync.js.map +7 -0
- package/dist/src/integrations/linear/types.js +5 -0
- package/dist/src/integrations/linear/types.js.map +7 -0
- package/dist/src/integrations/linear/unified-sync.js +589 -0
- package/dist/src/integrations/linear/unified-sync.js.map +7 -0
- package/dist/src/integrations/linear/webhook-handler.js +219 -0
- package/dist/src/integrations/linear/webhook-handler.js.map +7 -0
- package/dist/src/integrations/linear/webhook-server.js +218 -0
- package/dist/src/integrations/linear/webhook-server.js.map +7 -0
- package/dist/src/integrations/linear/webhook.js +291 -0
- package/dist/src/integrations/linear/webhook.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/code-execution-handlers.js +266 -0
- package/dist/src/integrations/mcp/handlers/code-execution-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/context-handlers.js +257 -0
- package/dist/src/integrations/mcp/handlers/context-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/discovery-handlers.js +497 -0
- package/dist/src/integrations/mcp/handlers/discovery-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/index.js +166 -0
- package/dist/src/integrations/mcp/handlers/index.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/linear-handlers.js +247 -0
- package/dist/src/integrations/mcp/handlers/linear-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/skill-handlers.js +529 -0
- package/dist/src/integrations/mcp/handlers/skill-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/task-handlers.js +239 -0
- package/dist/src/integrations/mcp/handlers/task-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/handlers/trace-handlers.js +308 -0
- package/dist/src/integrations/mcp/handlers/trace-handlers.js.map +7 -0
- package/dist/src/integrations/mcp/index.js +23 -0
- package/dist/src/integrations/mcp/index.js.map +7 -0
- package/dist/src/integrations/mcp/middleware/tool-scoring.js +356 -0
- package/dist/src/integrations/mcp/middleware/tool-scoring.js.map +7 -0
- package/dist/src/integrations/mcp/refactored-server.js +374 -0
- package/dist/src/integrations/mcp/refactored-server.js.map +7 -0
- package/dist/src/integrations/mcp/remote-server.js +682 -0
- package/dist/src/integrations/mcp/remote-server.js.map +7 -0
- package/dist/src/integrations/mcp/schemas.js +147 -0
- package/dist/src/integrations/mcp/schemas.js.map +7 -0
- package/dist/src/integrations/mcp/server.js +1975 -0
- package/dist/src/integrations/mcp/server.js.map +7 -0
- package/dist/src/integrations/mcp/tool-definitions-code.js +125 -0
- package/dist/src/integrations/mcp/tool-definitions-code.js.map +7 -0
- package/dist/src/integrations/mcp/tool-definitions.js +702 -0
- package/dist/src/integrations/mcp/tool-definitions.js.map +7 -0
- package/dist/src/integrations/ralph/bridge/ralph-stackmemory-bridge.js +860 -0
- package/dist/src/integrations/ralph/bridge/ralph-stackmemory-bridge.js.map +7 -0
- package/dist/src/integrations/ralph/context/context-budget-manager.js +301 -0
- package/dist/src/integrations/ralph/context/context-budget-manager.js.map +7 -0
- package/dist/src/integrations/ralph/context/stackmemory-context-loader.js +360 -0
- package/dist/src/integrations/ralph/context/stackmemory-context-loader.js.map +7 -0
- package/dist/src/integrations/ralph/coordination/enhanced-coordination.js +410 -0
- package/dist/src/integrations/ralph/coordination/enhanced-coordination.js.map +7 -0
- package/dist/src/integrations/ralph/index.js +18 -0
- package/dist/src/integrations/ralph/index.js.map +7 -0
- package/dist/src/integrations/ralph/learning/pattern-learner.js +401 -0
- package/dist/src/integrations/ralph/learning/pattern-learner.js.map +7 -0
- package/dist/src/integrations/ralph/lifecycle/iteration-lifecycle.js +448 -0
- package/dist/src/integrations/ralph/lifecycle/iteration-lifecycle.js.map +7 -0
- package/dist/src/integrations/ralph/monitoring/swarm-dashboard.js +294 -0
- package/dist/src/integrations/ralph/monitoring/swarm-dashboard.js.map +7 -0
- package/dist/src/integrations/ralph/monitoring/swarm-registry.js +108 -0
- package/dist/src/integrations/ralph/monitoring/swarm-registry.js.map +7 -0
- package/dist/src/integrations/ralph/orchestration/multi-loop-orchestrator.js +463 -0
- package/dist/src/integrations/ralph/orchestration/multi-loop-orchestrator.js.map +7 -0
- package/dist/src/integrations/ralph/patterns/compounding-engineering-pattern.js +400 -0
- package/dist/src/integrations/ralph/patterns/compounding-engineering-pattern.js.map +7 -0
- package/dist/src/integrations/ralph/patterns/extended-coherence-sessions.js +473 -0
- package/dist/src/integrations/ralph/patterns/extended-coherence-sessions.js.map +7 -0
- package/dist/src/integrations/ralph/patterns/oracle-worker-pattern.js +388 -0
- package/dist/src/integrations/ralph/patterns/oracle-worker-pattern.js.map +7 -0
- package/dist/src/integrations/ralph/performance/performance-optimizer.js +358 -0
- package/dist/src/integrations/ralph/performance/performance-optimizer.js.map +7 -0
- package/dist/src/integrations/ralph/recovery/crash-recovery.js +462 -0
- package/dist/src/integrations/ralph/recovery/crash-recovery.js.map +7 -0
- package/dist/src/integrations/ralph/state/state-reconciler.js +404 -0
- package/dist/src/integrations/ralph/state/state-reconciler.js.map +7 -0
- package/dist/src/integrations/ralph/swarm/git-workflow-manager.js +428 -0
- package/dist/src/integrations/ralph/swarm/git-workflow-manager.js.map +7 -0
- package/dist/src/integrations/ralph/swarm/swarm-coordinator.js +996 -0
- package/dist/src/integrations/ralph/swarm/swarm-coordinator.js.map +7 -0
- package/dist/src/integrations/ralph/types.js +5 -0
- package/dist/src/integrations/ralph/types.js.map +7 -0
- package/dist/src/integrations/ralph/visualization/ralph-debugger.js +585 -0
- package/dist/src/integrations/ralph/visualization/ralph-debugger.js.map +7 -0
- package/dist/src/mcp/stackmemory-mcp-server.js +554 -0
- package/dist/src/mcp/stackmemory-mcp-server.js.map +7 -0
- package/dist/src/middleware/exponential-rate-limiter.js +289 -0
- package/dist/src/middleware/exponential-rate-limiter.js.map +7 -0
- package/dist/src/models/user.model.js +358 -0
- package/dist/src/models/user.model.js.map +7 -0
- package/dist/src/servers/production/auth-middleware.js +528 -0
- package/dist/src/servers/production/auth-middleware.js.map +7 -0
- package/dist/src/services/config-service.js +65 -0
- package/dist/src/services/config-service.js.map +7 -0
- package/dist/src/services/context-service.js +194 -0
- package/dist/src/services/context-service.js.map +7 -0
- package/dist/src/skills/api-discovery.js +354 -0
- package/dist/src/skills/api-discovery.js.map +7 -0
- package/dist/src/skills/api-skill.js +475 -0
- package/dist/src/skills/api-skill.js.map +7 -0
- package/dist/src/skills/claude-skills.js +1061 -0
- package/dist/src/skills/claude-skills.js.map +7 -0
- package/dist/src/skills/dashboard-launcher.js +216 -0
- package/dist/src/skills/dashboard-launcher.js.map +7 -0
- package/dist/src/skills/recursive-agent-orchestrator.js +575 -0
- package/dist/src/skills/recursive-agent-orchestrator.js.map +7 -0
- package/dist/src/skills/repo-ingestion-skill.js +609 -0
- package/dist/src/skills/repo-ingestion-skill.js.map +7 -0
- package/dist/src/skills/unified-rlm-orchestrator.js +404 -0
- package/dist/src/skills/unified-rlm-orchestrator.js.map +7 -0
- package/dist/src/types/task.js +5 -0
- package/dist/src/types/task.js.map +7 -0
- package/dist/src/utils/env.js +50 -0
- package/dist/src/utils/env.js.map +7 -0
- package/dist/src/utils/formatting.js +62 -0
- package/dist/src/utils/formatting.js.map +7 -0
- package/dist/src/utils/process-cleanup.js +136 -0
- package/dist/src/utils/process-cleanup.js.map +7 -0
- package/package.json +4 -3
- package/scripts/create-cleanup-issues.js +302 -0
- package/scripts/demos/browser-test.ts +39 -0
- package/scripts/demos/ralph-integration-demo.ts +244 -0
- package/scripts/demos/trace-demo.ts +214 -0
- package/scripts/demos/trace-detector.demo.ts +171 -0
- package/scripts/demos/trace-test.ts +67 -0
- package/scripts/initialize.ts +16 -7
- package/scripts/install.sh +14 -62
- package/scripts/status.ts +111 -46
- package/scripts/test-claude-config.sh +123 -0
- package/scripts/validate-claude-config.sh +155 -0
|
@@ -0,0 +1,792 @@
|
|
|
1
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
2
|
+
import { dirname as __pathDirname } from 'path';
|
|
3
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
4
|
+
const __dirname = __pathDirname(__filename);
|
|
5
|
+
import { execSync } from "child_process";
|
|
6
|
+
import {
|
|
7
|
+
existsSync,
|
|
8
|
+
readFileSync,
|
|
9
|
+
readdirSync,
|
|
10
|
+
statSync,
|
|
11
|
+
writeFileSync,
|
|
12
|
+
mkdirSync
|
|
13
|
+
} from "fs";
|
|
14
|
+
import { basename, join } from "path";
|
|
15
|
+
import { homedir, tmpdir } from "os";
|
|
16
|
+
import { globSync } from "glob";
|
|
17
|
+
let countTokens;
|
|
18
|
+
try {
|
|
19
|
+
const tokenizer = await import("@anthropic-ai/tokenizer");
|
|
20
|
+
countTokens = tokenizer.countTokens;
|
|
21
|
+
} catch {
|
|
22
|
+
countTokens = (text) => Math.ceil(text.length / 3.5);
|
|
23
|
+
}
|
|
24
|
+
function loadSessionDecisions(projectRoot) {
|
|
25
|
+
const storePath = join(projectRoot, ".stackmemory", "session-decisions.json");
|
|
26
|
+
if (existsSync(storePath)) {
|
|
27
|
+
try {
|
|
28
|
+
const store = JSON.parse(readFileSync(storePath, "utf-8"));
|
|
29
|
+
return store.decisions || [];
|
|
30
|
+
} catch {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
function loadReviewFeedback(projectRoot) {
|
|
37
|
+
const storePath = join(projectRoot, ".stackmemory", "review-feedback.json");
|
|
38
|
+
if (existsSync(storePath)) {
|
|
39
|
+
try {
|
|
40
|
+
const store = JSON.parse(
|
|
41
|
+
readFileSync(storePath, "utf-8")
|
|
42
|
+
);
|
|
43
|
+
const cutoff = Date.now() - 24 * 60 * 60 * 1e3;
|
|
44
|
+
return store.feedbacks.filter(
|
|
45
|
+
(f) => new Date(f.timestamp).getTime() > cutoff
|
|
46
|
+
);
|
|
47
|
+
} catch {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
function saveReviewFeedback(projectRoot, feedbacks) {
|
|
54
|
+
const dir = join(projectRoot, ".stackmemory");
|
|
55
|
+
if (!existsSync(dir)) {
|
|
56
|
+
mkdirSync(dir, { recursive: true });
|
|
57
|
+
}
|
|
58
|
+
const storePath = join(dir, "review-feedback.json");
|
|
59
|
+
let existing = [];
|
|
60
|
+
if (existsSync(storePath)) {
|
|
61
|
+
try {
|
|
62
|
+
const store2 = JSON.parse(
|
|
63
|
+
readFileSync(storePath, "utf-8")
|
|
64
|
+
);
|
|
65
|
+
existing = store2.feedbacks || [];
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const seen = /* @__PURE__ */ new Set();
|
|
70
|
+
const merged = [];
|
|
71
|
+
for (const f of [...feedbacks, ...existing]) {
|
|
72
|
+
const key = `${f.source}:${f.keyPoints[0] || ""}`;
|
|
73
|
+
if (!seen.has(key)) {
|
|
74
|
+
seen.add(key);
|
|
75
|
+
merged.push(f);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const store = {
|
|
79
|
+
feedbacks: merged.slice(0, 20),
|
|
80
|
+
lastUpdated: (/* @__PURE__ */ new Date()).toISOString()
|
|
81
|
+
};
|
|
82
|
+
writeFileSync(storePath, JSON.stringify(store, null, 2));
|
|
83
|
+
}
|
|
84
|
+
function findAgentOutputDirs(projectRoot) {
|
|
85
|
+
const dirs = [];
|
|
86
|
+
const tmpBase = process.env["TMPDIR"] || tmpdir() || "/tmp";
|
|
87
|
+
const projectPathEncoded = projectRoot.replace(/\//g, "-").replace(/^-/, "");
|
|
88
|
+
const pattern1 = join(tmpBase, "claude", `*${projectPathEncoded}*`, "tasks");
|
|
89
|
+
try {
|
|
90
|
+
const matches = globSync(pattern1);
|
|
91
|
+
dirs.push(...matches);
|
|
92
|
+
} catch {
|
|
93
|
+
}
|
|
94
|
+
if (tmpBase !== "/private/tmp") {
|
|
95
|
+
const pattern2 = join(
|
|
96
|
+
"/private/tmp",
|
|
97
|
+
"claude",
|
|
98
|
+
`*${projectPathEncoded}*`,
|
|
99
|
+
"tasks"
|
|
100
|
+
);
|
|
101
|
+
try {
|
|
102
|
+
const matches = globSync(pattern2);
|
|
103
|
+
dirs.push(...matches);
|
|
104
|
+
} catch {
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const homeClaudeDir = join(homedir(), ".claude", "projects");
|
|
108
|
+
if (existsSync(homeClaudeDir)) {
|
|
109
|
+
try {
|
|
110
|
+
const projectDirs = readdirSync(homeClaudeDir);
|
|
111
|
+
for (const d of projectDirs) {
|
|
112
|
+
const tasksDir = join(homeClaudeDir, d, "tasks");
|
|
113
|
+
if (existsSync(tasksDir)) {
|
|
114
|
+
dirs.push(tasksDir);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
} catch {
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return [...new Set(dirs)];
|
|
121
|
+
}
|
|
122
|
+
class EnhancedHandoffGenerator {
|
|
123
|
+
projectRoot;
|
|
124
|
+
claudeProjectsDir;
|
|
125
|
+
constructor(projectRoot) {
|
|
126
|
+
this.projectRoot = projectRoot;
|
|
127
|
+
this.claudeProjectsDir = join(homedir(), ".claude", "projects");
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Generate a high-efficacy handoff
|
|
131
|
+
*/
|
|
132
|
+
async generate() {
|
|
133
|
+
const handoff = {
|
|
134
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
135
|
+
project: basename(this.projectRoot),
|
|
136
|
+
branch: this.getCurrentBranch(),
|
|
137
|
+
activeWork: await this.extractActiveWork(),
|
|
138
|
+
decisions: await this.extractDecisions(),
|
|
139
|
+
architecture: await this.extractArchitecture(),
|
|
140
|
+
blockers: await this.extractBlockers(),
|
|
141
|
+
reviewFeedback: await this.extractReviewFeedback(),
|
|
142
|
+
nextActions: await this.extractNextActions(),
|
|
143
|
+
codePatterns: await this.extractCodePatterns(),
|
|
144
|
+
estimatedTokens: 0
|
|
145
|
+
};
|
|
146
|
+
const markdown = this.toMarkdown(handoff);
|
|
147
|
+
handoff.estimatedTokens = countTokens(markdown);
|
|
148
|
+
return handoff;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Extract what we're currently building from git and recent files
|
|
152
|
+
*/
|
|
153
|
+
async extractActiveWork() {
|
|
154
|
+
const recentCommits = this.getRecentCommits(5);
|
|
155
|
+
const recentFiles = this.getRecentlyModifiedFiles(10);
|
|
156
|
+
let description = "Unknown - check git log for context";
|
|
157
|
+
let status = "in_progress";
|
|
158
|
+
if (recentCommits.length > 0) {
|
|
159
|
+
const lastCommit = recentCommits[0];
|
|
160
|
+
if (lastCommit.includes("feat:") || lastCommit.includes("implement")) {
|
|
161
|
+
description = lastCommit.replace(/^[a-f0-9]+\s+/, "");
|
|
162
|
+
} else if (lastCommit.includes("fix:")) {
|
|
163
|
+
description = "Bug fix: " + lastCommit.replace(/^[a-f0-9]+\s+/, "");
|
|
164
|
+
} else if (lastCommit.includes("chore:") || lastCommit.includes("refactor:")) {
|
|
165
|
+
description = lastCommit.replace(/^[a-f0-9]+\s+/, "");
|
|
166
|
+
} else {
|
|
167
|
+
description = lastCommit.replace(/^[a-f0-9]+\s+/, "");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const gitStatus = this.getGitStatus();
|
|
171
|
+
if (gitStatus.includes("conflict")) {
|
|
172
|
+
status = "blocked";
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
description,
|
|
176
|
+
status,
|
|
177
|
+
keyFiles: recentFiles.slice(0, 5),
|
|
178
|
+
progress: recentCommits.length > 0 ? `${recentCommits.length} commits in current session` : void 0
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Extract decisions from session store, git commits, and decision logs
|
|
183
|
+
*/
|
|
184
|
+
async extractDecisions() {
|
|
185
|
+
const decisions = [];
|
|
186
|
+
const sessionDecisions = loadSessionDecisions(this.projectRoot);
|
|
187
|
+
for (const d of sessionDecisions) {
|
|
188
|
+
decisions.push({
|
|
189
|
+
what: d.what,
|
|
190
|
+
why: d.why,
|
|
191
|
+
alternatives: d.alternatives
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
const commits = this.getRecentCommits(20);
|
|
195
|
+
for (const commit of commits) {
|
|
196
|
+
if (commit.toLowerCase().includes("use ") || commit.toLowerCase().includes("switch to ") || commit.toLowerCase().includes("default to ") || commit.toLowerCase().includes("make ") && commit.toLowerCase().includes("optional")) {
|
|
197
|
+
const commitText = commit.replace(/^[a-f0-9]+\s+/, "");
|
|
198
|
+
if (!decisions.some((d) => d.what.includes(commitText.slice(0, 30)))) {
|
|
199
|
+
decisions.push({
|
|
200
|
+
what: commitText,
|
|
201
|
+
why: "See commit for details"
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
const decisionsFile = join(
|
|
207
|
+
this.projectRoot,
|
|
208
|
+
".stackmemory",
|
|
209
|
+
"decisions.md"
|
|
210
|
+
);
|
|
211
|
+
if (existsSync(decisionsFile)) {
|
|
212
|
+
const content = readFileSync(decisionsFile, "utf-8");
|
|
213
|
+
const parsed = this.parseDecisionsFile(content);
|
|
214
|
+
decisions.push(...parsed);
|
|
215
|
+
}
|
|
216
|
+
return decisions.slice(0, 10);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Parse a decisions.md file
|
|
220
|
+
*/
|
|
221
|
+
parseDecisionsFile(content) {
|
|
222
|
+
const decisions = [];
|
|
223
|
+
const lines = content.split("\n");
|
|
224
|
+
let currentDecision = null;
|
|
225
|
+
for (const line of lines) {
|
|
226
|
+
if (line.startsWith("## ") || line.startsWith("### ")) {
|
|
227
|
+
if (currentDecision) {
|
|
228
|
+
decisions.push(currentDecision);
|
|
229
|
+
}
|
|
230
|
+
currentDecision = { what: line.replace(/^#+\s+/, ""), why: "" };
|
|
231
|
+
} else if (currentDecision && line.toLowerCase().includes("rationale:")) {
|
|
232
|
+
currentDecision.why = line.replace(/rationale:\s*/i, "").trim();
|
|
233
|
+
} else if (currentDecision && line.toLowerCase().includes("why:")) {
|
|
234
|
+
currentDecision.why = line.replace(/why:\s*/i, "").trim();
|
|
235
|
+
} else if (currentDecision && line.toLowerCase().includes("alternatives:")) {
|
|
236
|
+
currentDecision.alternatives = [];
|
|
237
|
+
} else if (currentDecision?.alternatives && line.trim().startsWith("-")) {
|
|
238
|
+
currentDecision.alternatives.push(line.replace(/^\s*-\s*/, "").trim());
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (currentDecision) {
|
|
242
|
+
decisions.push(currentDecision);
|
|
243
|
+
}
|
|
244
|
+
return decisions;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Extract architecture context from key files
|
|
248
|
+
*/
|
|
249
|
+
async extractArchitecture() {
|
|
250
|
+
const keyComponents = [];
|
|
251
|
+
const patterns = [];
|
|
252
|
+
const recentFiles = this.getRecentlyModifiedFiles(20);
|
|
253
|
+
const codeFiles = recentFiles.filter(
|
|
254
|
+
(f) => f.endsWith(".ts") || f.endsWith(".js") || f.endsWith(".tsx")
|
|
255
|
+
);
|
|
256
|
+
for (const file of codeFiles.slice(0, 8)) {
|
|
257
|
+
const purpose = this.inferFilePurpose(file);
|
|
258
|
+
if (purpose) {
|
|
259
|
+
keyComponents.push({ file, purpose });
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (codeFiles.some((f) => f.includes("/daemon/"))) {
|
|
263
|
+
patterns.push("Daemon/background process pattern");
|
|
264
|
+
}
|
|
265
|
+
if (codeFiles.some((f) => f.includes("/cli/"))) {
|
|
266
|
+
patterns.push("CLI command pattern");
|
|
267
|
+
}
|
|
268
|
+
if (codeFiles.some((f) => f.includes(".test.") || f.includes("__tests__"))) {
|
|
269
|
+
patterns.push("Test files present");
|
|
270
|
+
}
|
|
271
|
+
if (codeFiles.some((f) => f.includes("/core/"))) {
|
|
272
|
+
patterns.push("Core/domain separation");
|
|
273
|
+
}
|
|
274
|
+
return { keyComponents, patterns };
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Infer purpose from file name and path
|
|
278
|
+
*/
|
|
279
|
+
inferFilePurpose(filePath) {
|
|
280
|
+
const name = basename(filePath).replace(/\.(ts|js|tsx)$/, "");
|
|
281
|
+
const path = filePath.toLowerCase();
|
|
282
|
+
if (path.includes("daemon")) return "Background daemon/service";
|
|
283
|
+
if (path.includes("cli/command")) return "CLI command handler";
|
|
284
|
+
if (path.includes("config")) return "Configuration management";
|
|
285
|
+
if (path.includes("storage")) return "Data storage layer";
|
|
286
|
+
if (path.includes("handoff")) return "Session handoff logic";
|
|
287
|
+
if (path.includes("service")) return "Service orchestration";
|
|
288
|
+
if (path.includes("manager")) return "Resource/state management";
|
|
289
|
+
if (path.includes("handler")) return "Event/request handler";
|
|
290
|
+
if (path.includes("util") || path.includes("helper"))
|
|
291
|
+
return "Utility functions";
|
|
292
|
+
if (path.includes("types") || path.includes("interface"))
|
|
293
|
+
return "Type definitions";
|
|
294
|
+
if (path.includes("test")) return null;
|
|
295
|
+
if (name.includes("-")) {
|
|
296
|
+
return name.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
297
|
+
}
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Extract blockers from git status and recent errors
|
|
302
|
+
*/
|
|
303
|
+
async extractBlockers() {
|
|
304
|
+
const blockers = [];
|
|
305
|
+
const gitStatus = this.getGitStatus();
|
|
306
|
+
if (gitStatus.includes("UU ") || gitStatus.includes("both modified")) {
|
|
307
|
+
blockers.push({
|
|
308
|
+
issue: "Merge conflict detected",
|
|
309
|
+
attempted: ["Check git status for affected files"],
|
|
310
|
+
status: "open"
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
try {
|
|
314
|
+
const testResult = execSync("npm test 2>&1 || true", {
|
|
315
|
+
encoding: "utf-8",
|
|
316
|
+
cwd: this.projectRoot,
|
|
317
|
+
timeout: 3e4
|
|
318
|
+
});
|
|
319
|
+
if (testResult.includes("FAIL") || testResult.includes("failed")) {
|
|
320
|
+
const failCount = (testResult.match(/(\d+) failed/i) || ["", "?"])[1];
|
|
321
|
+
blockers.push({
|
|
322
|
+
issue: `Test failures: ${failCount} tests failing`,
|
|
323
|
+
attempted: ["Run npm test for details"],
|
|
324
|
+
status: "open"
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
} catch {
|
|
328
|
+
}
|
|
329
|
+
try {
|
|
330
|
+
const lintResult = execSync("npm run lint 2>&1 || true", {
|
|
331
|
+
encoding: "utf-8",
|
|
332
|
+
cwd: this.projectRoot,
|
|
333
|
+
timeout: 3e4
|
|
334
|
+
});
|
|
335
|
+
if (lintResult.includes("error") && !lintResult.includes("0 errors")) {
|
|
336
|
+
blockers.push({
|
|
337
|
+
issue: "Lint errors present",
|
|
338
|
+
attempted: ["Run npm run lint for details"],
|
|
339
|
+
status: "open"
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
} catch {
|
|
343
|
+
}
|
|
344
|
+
return blockers;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Extract review feedback from agent output files and persisted storage
|
|
348
|
+
*/
|
|
349
|
+
async extractReviewFeedback() {
|
|
350
|
+
const feedback = [];
|
|
351
|
+
const newFeedbacks = [];
|
|
352
|
+
const outputDirs = findAgentOutputDirs(this.projectRoot);
|
|
353
|
+
for (const tmpDir of outputDirs) {
|
|
354
|
+
if (!existsSync(tmpDir)) continue;
|
|
355
|
+
try {
|
|
356
|
+
const files = readdirSync(tmpDir).filter((f) => f.endsWith(".output"));
|
|
357
|
+
const recentFiles = files.map((f) => ({
|
|
358
|
+
name: f,
|
|
359
|
+
path: join(tmpDir, f),
|
|
360
|
+
stat: statSync(join(tmpDir, f))
|
|
361
|
+
})).filter((f) => Date.now() - f.stat.mtimeMs < 36e5).sort((a, b) => b.stat.mtimeMs - a.stat.mtimeMs).slice(0, 3);
|
|
362
|
+
for (const file of recentFiles) {
|
|
363
|
+
const content = readFileSync(file.path, "utf-8");
|
|
364
|
+
const extracted = this.extractKeyPointsFromReview(content);
|
|
365
|
+
if (extracted.keyPoints.length > 0) {
|
|
366
|
+
feedback.push(extracted);
|
|
367
|
+
newFeedbacks.push({
|
|
368
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
369
|
+
source: extracted.source,
|
|
370
|
+
keyPoints: extracted.keyPoints,
|
|
371
|
+
actionItems: extracted.actionItems,
|
|
372
|
+
sourceFile: file.name
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
} catch {
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
if (newFeedbacks.length > 0) {
|
|
380
|
+
saveReviewFeedback(this.projectRoot, newFeedbacks);
|
|
381
|
+
}
|
|
382
|
+
if (feedback.length === 0) {
|
|
383
|
+
const stored = loadReviewFeedback(this.projectRoot);
|
|
384
|
+
for (const s of stored.slice(0, 3)) {
|
|
385
|
+
feedback.push({
|
|
386
|
+
source: s.source,
|
|
387
|
+
keyPoints: s.keyPoints,
|
|
388
|
+
actionItems: s.actionItems
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return feedback.length > 0 ? feedback : void 0;
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Extract key points from a review output
|
|
396
|
+
*/
|
|
397
|
+
extractKeyPointsFromReview(content) {
|
|
398
|
+
const keyPoints = [];
|
|
399
|
+
const actionItems = [];
|
|
400
|
+
let source = "Agent Review";
|
|
401
|
+
if (content.includes("Product Manager") || content.includes("product-manager")) {
|
|
402
|
+
source = "Product Manager";
|
|
403
|
+
} else if (content.includes("Staff Architect") || content.includes("staff-architect")) {
|
|
404
|
+
source = "Staff Architect";
|
|
405
|
+
}
|
|
406
|
+
const lines = content.split("\n");
|
|
407
|
+
let inRecommendations = false;
|
|
408
|
+
let inActionItems = false;
|
|
409
|
+
for (const line of lines) {
|
|
410
|
+
const trimmed = line.trim();
|
|
411
|
+
if (trimmed.toLowerCase().includes("recommendation") || trimmed.toLowerCase().includes("key finding")) {
|
|
412
|
+
inRecommendations = true;
|
|
413
|
+
inActionItems = false;
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
if (trimmed.toLowerCase().includes("action") || trimmed.toLowerCase().includes("next step") || trimmed.toLowerCase().includes("priority")) {
|
|
417
|
+
inActionItems = true;
|
|
418
|
+
inRecommendations = false;
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
421
|
+
if (trimmed.startsWith("- ") || trimmed.startsWith("* ") || /^\d+\.\s/.test(trimmed)) {
|
|
422
|
+
const point = trimmed.replace(/^[-*]\s+/, "").replace(/^\d+\.\s+/, "");
|
|
423
|
+
if (point.length > 10 && point.length < 200) {
|
|
424
|
+
if (inActionItems) {
|
|
425
|
+
actionItems.push(point);
|
|
426
|
+
} else if (inRecommendations) {
|
|
427
|
+
keyPoints.push(point);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
return {
|
|
433
|
+
source,
|
|
434
|
+
keyPoints: keyPoints.slice(0, 5),
|
|
435
|
+
actionItems: actionItems.slice(0, 5)
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Extract next actions from todo state and git
|
|
440
|
+
*/
|
|
441
|
+
async extractNextActions() {
|
|
442
|
+
const actions = [];
|
|
443
|
+
const gitStatus = this.getGitStatus();
|
|
444
|
+
if (gitStatus.trim()) {
|
|
445
|
+
actions.push("Commit pending changes");
|
|
446
|
+
}
|
|
447
|
+
const recentFiles = this.getRecentlyModifiedFiles(5);
|
|
448
|
+
for (const file of recentFiles) {
|
|
449
|
+
try {
|
|
450
|
+
const fullPath = join(this.projectRoot, file);
|
|
451
|
+
if (existsSync(fullPath)) {
|
|
452
|
+
const content = readFileSync(fullPath, "utf-8");
|
|
453
|
+
const todos = content.match(/\/\/\s*TODO:?\s*.+/gi) || [];
|
|
454
|
+
for (const todo of todos.slice(0, 2)) {
|
|
455
|
+
actions.push(todo.replace(/\/\/\s*TODO:?\s*/i, "TODO: "));
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
} catch {
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
const tasksFile = join(this.projectRoot, ".stackmemory", "tasks.json");
|
|
462
|
+
if (existsSync(tasksFile)) {
|
|
463
|
+
try {
|
|
464
|
+
const tasks = JSON.parse(readFileSync(tasksFile, "utf-8"));
|
|
465
|
+
const pending = tasks.filter(
|
|
466
|
+
(t) => t.status === "pending" || t.status === "in_progress"
|
|
467
|
+
);
|
|
468
|
+
for (const task of pending.slice(0, 3)) {
|
|
469
|
+
actions.push(task.title || task.description);
|
|
470
|
+
}
|
|
471
|
+
} catch {
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
return actions.slice(0, 8);
|
|
475
|
+
}
|
|
476
|
+
/**
|
|
477
|
+
* Extract established code patterns
|
|
478
|
+
*/
|
|
479
|
+
async extractCodePatterns() {
|
|
480
|
+
const patterns = [];
|
|
481
|
+
const eslintConfig = join(this.projectRoot, "eslint.config.js");
|
|
482
|
+
if (existsSync(eslintConfig)) {
|
|
483
|
+
const content = readFileSync(eslintConfig, "utf-8");
|
|
484
|
+
if (content.includes("argsIgnorePattern")) {
|
|
485
|
+
patterns.push("Underscore prefix for unused vars (_var)");
|
|
486
|
+
}
|
|
487
|
+
if (content.includes("ignores") && content.includes("test")) {
|
|
488
|
+
patterns.push("Test files excluded from lint");
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
const tsconfig = join(this.projectRoot, "tsconfig.json");
|
|
492
|
+
if (existsSync(tsconfig)) {
|
|
493
|
+
const content = readFileSync(tsconfig, "utf-8");
|
|
494
|
+
if (content.includes('"strict": true')) {
|
|
495
|
+
patterns.push("TypeScript strict mode enabled");
|
|
496
|
+
}
|
|
497
|
+
if (content.includes("ES2022") || content.includes("ESNext")) {
|
|
498
|
+
patterns.push("ESM module system");
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return patterns;
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* Get recent git commits
|
|
505
|
+
*/
|
|
506
|
+
getRecentCommits(count) {
|
|
507
|
+
try {
|
|
508
|
+
const result = execSync(`git log --oneline -${count}`, {
|
|
509
|
+
encoding: "utf-8",
|
|
510
|
+
cwd: this.projectRoot
|
|
511
|
+
});
|
|
512
|
+
return result.trim().split("\n").filter(Boolean);
|
|
513
|
+
} catch {
|
|
514
|
+
return [];
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Get current git branch
|
|
519
|
+
*/
|
|
520
|
+
getCurrentBranch() {
|
|
521
|
+
try {
|
|
522
|
+
return execSync("git rev-parse --abbrev-ref HEAD", {
|
|
523
|
+
encoding: "utf-8",
|
|
524
|
+
cwd: this.projectRoot
|
|
525
|
+
}).trim();
|
|
526
|
+
} catch {
|
|
527
|
+
return "unknown";
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Get git status
|
|
532
|
+
*/
|
|
533
|
+
getGitStatus() {
|
|
534
|
+
try {
|
|
535
|
+
return execSync("git status --short", {
|
|
536
|
+
encoding: "utf-8",
|
|
537
|
+
cwd: this.projectRoot
|
|
538
|
+
});
|
|
539
|
+
} catch {
|
|
540
|
+
return "";
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Get recently modified files
|
|
545
|
+
*/
|
|
546
|
+
getRecentlyModifiedFiles(count) {
|
|
547
|
+
try {
|
|
548
|
+
const result = execSync(
|
|
549
|
+
`git diff --name-only HEAD~10 HEAD 2>/dev/null || git diff --name-only`,
|
|
550
|
+
{
|
|
551
|
+
encoding: "utf-8",
|
|
552
|
+
cwd: this.projectRoot
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
return result.trim().split("\n").filter(Boolean).slice(0, count);
|
|
556
|
+
} catch {
|
|
557
|
+
return [];
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Convert handoff to markdown (verbose format)
|
|
562
|
+
*/
|
|
563
|
+
toMarkdown(handoff) {
|
|
564
|
+
const lines = [];
|
|
565
|
+
lines.push(`# Session Handoff - ${handoff.timestamp.split("T")[0]}`);
|
|
566
|
+
lines.push("");
|
|
567
|
+
lines.push(`**Project**: ${handoff.project}`);
|
|
568
|
+
lines.push(`**Branch**: ${handoff.branch}`);
|
|
569
|
+
lines.push("");
|
|
570
|
+
lines.push("## Active Work");
|
|
571
|
+
lines.push(`- **Building**: ${handoff.activeWork.description}`);
|
|
572
|
+
lines.push(`- **Status**: ${handoff.activeWork.status}`);
|
|
573
|
+
if (handoff.activeWork.keyFiles.length > 0) {
|
|
574
|
+
lines.push(`- **Key files**: ${handoff.activeWork.keyFiles.join(", ")}`);
|
|
575
|
+
}
|
|
576
|
+
if (handoff.activeWork.progress) {
|
|
577
|
+
lines.push(`- **Progress**: ${handoff.activeWork.progress}`);
|
|
578
|
+
}
|
|
579
|
+
lines.push("");
|
|
580
|
+
if (handoff.decisions.length > 0) {
|
|
581
|
+
lines.push("## Key Decisions");
|
|
582
|
+
for (const d of handoff.decisions) {
|
|
583
|
+
lines.push(`1. **${d.what}**`);
|
|
584
|
+
if (d.why) {
|
|
585
|
+
lines.push(` - Rationale: ${d.why}`);
|
|
586
|
+
}
|
|
587
|
+
if (d.alternatives && d.alternatives.length > 0) {
|
|
588
|
+
lines.push(
|
|
589
|
+
` - Alternatives considered: ${d.alternatives.join(", ")}`
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
lines.push("");
|
|
594
|
+
}
|
|
595
|
+
if (handoff.architecture.keyComponents.length > 0) {
|
|
596
|
+
lines.push("## Architecture Context");
|
|
597
|
+
for (const c of handoff.architecture.keyComponents) {
|
|
598
|
+
lines.push(`- \`${c.file}\`: ${c.purpose}`);
|
|
599
|
+
}
|
|
600
|
+
if (handoff.architecture.patterns.length > 0) {
|
|
601
|
+
lines.push("");
|
|
602
|
+
lines.push("**Patterns**: " + handoff.architecture.patterns.join(", "));
|
|
603
|
+
}
|
|
604
|
+
lines.push("");
|
|
605
|
+
}
|
|
606
|
+
if (handoff.blockers.length > 0) {
|
|
607
|
+
lines.push("## Blockers");
|
|
608
|
+
for (const b of handoff.blockers) {
|
|
609
|
+
lines.push(`- **${b.issue}** [${b.status}]`);
|
|
610
|
+
if (b.attempted.length > 0) {
|
|
611
|
+
lines.push(` - Tried: ${b.attempted.join(", ")}`);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
lines.push("");
|
|
615
|
+
}
|
|
616
|
+
if (handoff.reviewFeedback && handoff.reviewFeedback.length > 0) {
|
|
617
|
+
lines.push("## Review Feedback");
|
|
618
|
+
for (const r of handoff.reviewFeedback) {
|
|
619
|
+
lines.push(`### ${r.source}`);
|
|
620
|
+
if (r.keyPoints.length > 0) {
|
|
621
|
+
lines.push("**Key Points**:");
|
|
622
|
+
for (const p of r.keyPoints) {
|
|
623
|
+
lines.push(`- ${p}`);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
if (r.actionItems.length > 0) {
|
|
627
|
+
lines.push("**Action Items**:");
|
|
628
|
+
for (const a of r.actionItems) {
|
|
629
|
+
lines.push(`- ${a}`);
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
lines.push("");
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
if (handoff.nextActions.length > 0) {
|
|
636
|
+
lines.push("## Next Actions");
|
|
637
|
+
for (const a of handoff.nextActions) {
|
|
638
|
+
lines.push(`1. ${a}`);
|
|
639
|
+
}
|
|
640
|
+
lines.push("");
|
|
641
|
+
}
|
|
642
|
+
if (handoff.codePatterns && handoff.codePatterns.length > 0) {
|
|
643
|
+
lines.push("## Established Patterns");
|
|
644
|
+
for (const p of handoff.codePatterns) {
|
|
645
|
+
lines.push(`- ${p}`);
|
|
646
|
+
}
|
|
647
|
+
lines.push("");
|
|
648
|
+
}
|
|
649
|
+
lines.push("---");
|
|
650
|
+
lines.push(`*Estimated tokens: ~${handoff.estimatedTokens}*`);
|
|
651
|
+
lines.push(`*Generated at ${handoff.timestamp}*`);
|
|
652
|
+
return lines.join("\n");
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Convert handoff to compact format (~50% smaller)
|
|
656
|
+
* Optimized for minimal context window usage
|
|
657
|
+
*/
|
|
658
|
+
toCompact(handoff) {
|
|
659
|
+
const lines = [];
|
|
660
|
+
lines.push(`# Handoff: ${handoff.project}@${handoff.branch}`);
|
|
661
|
+
const status = handoff.activeWork.status === "in_progress" ? "WIP" : handoff.activeWork.status;
|
|
662
|
+
lines.push(`## Work: ${handoff.activeWork.description} [${status}]`);
|
|
663
|
+
if (handoff.activeWork.keyFiles.length > 0) {
|
|
664
|
+
const files = handoff.activeWork.keyFiles.slice(0, 5).map((f) => basename(f)).join(", ");
|
|
665
|
+
const progress = handoff.activeWork.progress ? ` (${handoff.activeWork.progress.replace(" in current session", "")})` : "";
|
|
666
|
+
lines.push(`Files: ${files}${progress}`);
|
|
667
|
+
}
|
|
668
|
+
if (handoff.decisions.length > 0) {
|
|
669
|
+
lines.push("");
|
|
670
|
+
lines.push("## Decisions");
|
|
671
|
+
for (const d of handoff.decisions.slice(0, 7)) {
|
|
672
|
+
const what = d.what.length > 40 ? d.what.slice(0, 37) + "..." : d.what;
|
|
673
|
+
const why = d.why ? ` \u2192 ${d.why.slice(0, 50)}` : "";
|
|
674
|
+
lines.push(`- ${what}${why}`);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
if (handoff.blockers.length > 0) {
|
|
678
|
+
lines.push("");
|
|
679
|
+
lines.push("## Blockers");
|
|
680
|
+
for (const b of handoff.blockers) {
|
|
681
|
+
const status2 = b.status === "open" ? "!" : "\u2713";
|
|
682
|
+
const tried = b.attempted.length > 0 ? ` \u2192 ${b.attempted[0]}` : "";
|
|
683
|
+
lines.push(`${status2} ${b.issue}${tried}`);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
if (handoff.reviewFeedback && handoff.reviewFeedback.length > 0) {
|
|
687
|
+
lines.push("");
|
|
688
|
+
lines.push("## Feedback");
|
|
689
|
+
for (const r of handoff.reviewFeedback.slice(0, 2)) {
|
|
690
|
+
lines.push(`[${r.source}]`);
|
|
691
|
+
for (const p of r.keyPoints.slice(0, 3)) {
|
|
692
|
+
lines.push(`- ${p.slice(0, 60)}`);
|
|
693
|
+
}
|
|
694
|
+
for (const a of r.actionItems.slice(0, 2)) {
|
|
695
|
+
lines.push(`\u2192 ${a.slice(0, 60)}`);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
if (handoff.nextActions.length > 0) {
|
|
700
|
+
lines.push("");
|
|
701
|
+
lines.push("## Next");
|
|
702
|
+
for (const a of handoff.nextActions.slice(0, 3)) {
|
|
703
|
+
lines.push(`- ${a.slice(0, 60)}`);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
lines.push("");
|
|
707
|
+
lines.push(`---`);
|
|
708
|
+
lines.push(
|
|
709
|
+
`~${handoff.estimatedTokens} tokens | ${handoff.timestamp.split("T")[0]}`
|
|
710
|
+
);
|
|
711
|
+
return lines.join("\n");
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Convert handoff to ultra-compact pipe-delimited format (~90% smaller)
|
|
715
|
+
* Optimized for minimal token usage while preserving critical context
|
|
716
|
+
* Target: ~100-150 tokens
|
|
717
|
+
*/
|
|
718
|
+
toUltraCompact(handoff) {
|
|
719
|
+
const lines = [];
|
|
720
|
+
const status = handoff.activeWork.status === "in_progress" ? "WIP" : handoff.activeWork.status;
|
|
721
|
+
const commitCount = handoff.activeWork.progress?.match(/(\d+)/)?.[1] || "0";
|
|
722
|
+
lines.push(
|
|
723
|
+
`[H]${handoff.project}@${handoff.branch}|${status}|${commitCount}c`
|
|
724
|
+
);
|
|
725
|
+
if (handoff.activeWork.keyFiles.length > 0) {
|
|
726
|
+
const files = handoff.activeWork.keyFiles.slice(0, 5).map((f) => basename(f).replace(/\.(ts|js|tsx|jsx)$/, "")).join(",");
|
|
727
|
+
lines.push(`[F]${files}`);
|
|
728
|
+
}
|
|
729
|
+
if (handoff.decisions.length > 0) {
|
|
730
|
+
const decisions = handoff.decisions.slice(0, 5).map((d) => {
|
|
731
|
+
const what = d.what.slice(0, 25).replace(/\|/g, "/");
|
|
732
|
+
const why = d.why ? `\u2192${d.why.slice(0, 20)}` : "";
|
|
733
|
+
return `${what}${why}`;
|
|
734
|
+
}).join("|");
|
|
735
|
+
lines.push(`[D]${decisions}`);
|
|
736
|
+
}
|
|
737
|
+
if (handoff.blockers.length > 0) {
|
|
738
|
+
const blockers = handoff.blockers.slice(0, 3).map((b) => {
|
|
739
|
+
const marker = b.status === "open" ? "!" : "\u2713";
|
|
740
|
+
const issue = b.issue.slice(0, 20).replace(/\|/g, "/");
|
|
741
|
+
const tried = b.attempted.length > 0 ? `\u2192${b.attempted[0].slice(0, 15)}` : "";
|
|
742
|
+
return `${marker}${issue}${tried}`;
|
|
743
|
+
}).join("|");
|
|
744
|
+
lines.push(`[B]${blockers}`);
|
|
745
|
+
}
|
|
746
|
+
if (handoff.nextActions.length > 0) {
|
|
747
|
+
const actions = handoff.nextActions.slice(0, 3).map((a) => a.slice(0, 25).replace(/\|/g, "/")).join("|");
|
|
748
|
+
lines.push(`[N]${actions}`);
|
|
749
|
+
}
|
|
750
|
+
const ultraCompactContent = lines.join("\n");
|
|
751
|
+
const tokens = countTokens(ultraCompactContent);
|
|
752
|
+
lines.push(`~${tokens}t|${handoff.timestamp.split("T")[0]}`);
|
|
753
|
+
return lines.join("\n");
|
|
754
|
+
}
|
|
755
|
+
/**
|
|
756
|
+
* Auto-select format based on context budget and content complexity
|
|
757
|
+
* Returns: 'ultra' | 'compact' | 'verbose'
|
|
758
|
+
*/
|
|
759
|
+
selectFormat(handoff, contextBudget) {
|
|
760
|
+
if (contextBudget !== void 0) {
|
|
761
|
+
if (contextBudget < 500) return "ultra";
|
|
762
|
+
if (contextBudget < 2e3) return "compact";
|
|
763
|
+
return "verbose";
|
|
764
|
+
}
|
|
765
|
+
const complexity = handoff.decisions.length + handoff.blockers.length + (handoff.reviewFeedback?.length || 0) * 2 + handoff.nextActions.length;
|
|
766
|
+
if (complexity <= 3 && handoff.activeWork.keyFiles.length <= 3) {
|
|
767
|
+
return "ultra";
|
|
768
|
+
}
|
|
769
|
+
if (complexity > 8 || handoff.reviewFeedback && handoff.reviewFeedback.length > 1) {
|
|
770
|
+
return "verbose";
|
|
771
|
+
}
|
|
772
|
+
return "compact";
|
|
773
|
+
}
|
|
774
|
+
/**
|
|
775
|
+
* Generate handoff in auto-selected format
|
|
776
|
+
*/
|
|
777
|
+
toAutoFormat(handoff, contextBudget) {
|
|
778
|
+
const format = this.selectFormat(handoff, contextBudget);
|
|
779
|
+
switch (format) {
|
|
780
|
+
case "ultra":
|
|
781
|
+
return this.toUltraCompact(handoff);
|
|
782
|
+
case "verbose":
|
|
783
|
+
return this.toMarkdown(handoff);
|
|
784
|
+
default:
|
|
785
|
+
return this.toCompact(handoff);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
export {
|
|
790
|
+
EnhancedHandoffGenerator
|
|
791
|
+
};
|
|
792
|
+
//# sourceMappingURL=enhanced-handoff.js.map
|