@stackmemoryai/stackmemory 0.5.58 → 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/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/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 +3 -3
- package/scripts/initialize.ts +16 -7
- package/scripts/install.sh +14 -62
- package/scripts/status.ts +111 -46
|
@@ -0,0 +1,697 @@
|
|
|
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 { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
7
|
+
import { join, basename, dirname } from "path";
|
|
8
|
+
import { homedir } from "os";
|
|
9
|
+
import Database from "better-sqlite3";
|
|
10
|
+
import { logger } from "../monitoring/logger.js";
|
|
11
|
+
import {
|
|
12
|
+
DatabaseError,
|
|
13
|
+
ProjectError,
|
|
14
|
+
ErrorCode,
|
|
15
|
+
createErrorHandler
|
|
16
|
+
} from "../errors/index.js";
|
|
17
|
+
import { retry } from "../errors/recovery.js";
|
|
18
|
+
class ProjectManager {
|
|
19
|
+
static instance;
|
|
20
|
+
db;
|
|
21
|
+
configPath;
|
|
22
|
+
organizations = /* @__PURE__ */ new Map();
|
|
23
|
+
projectCache = /* @__PURE__ */ new Map();
|
|
24
|
+
currentProject;
|
|
25
|
+
constructor() {
|
|
26
|
+
this.configPath = join(homedir(), ".stackmemory");
|
|
27
|
+
this.ensureDirectoryStructure();
|
|
28
|
+
this.initializeDatabase();
|
|
29
|
+
this.loadOrganizations();
|
|
30
|
+
this.autoDiscoverOrganizations();
|
|
31
|
+
}
|
|
32
|
+
static getInstance() {
|
|
33
|
+
if (!ProjectManager.instance) {
|
|
34
|
+
ProjectManager.instance = new ProjectManager();
|
|
35
|
+
}
|
|
36
|
+
return ProjectManager.instance;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Auto-detect project from current directory
|
|
40
|
+
*/
|
|
41
|
+
async detectProject(projectPath) {
|
|
42
|
+
const path = projectPath || process.cwd();
|
|
43
|
+
const errorHandler = createErrorHandler({
|
|
44
|
+
operation: "detectProject",
|
|
45
|
+
projectPath: path
|
|
46
|
+
});
|
|
47
|
+
try {
|
|
48
|
+
const cached = this.projectCache.get(path);
|
|
49
|
+
if (cached && this.isCacheValid(cached)) {
|
|
50
|
+
return cached;
|
|
51
|
+
}
|
|
52
|
+
const project = await this.analyzeProject(path);
|
|
53
|
+
if (project.gitRemote) {
|
|
54
|
+
project.organization = this.extractOrganization(project.gitRemote);
|
|
55
|
+
project.accountType = this.determineAccountType(
|
|
56
|
+
project.gitRemote,
|
|
57
|
+
project.organization
|
|
58
|
+
);
|
|
59
|
+
project.isPrivate = this.isPrivateRepo(project.gitRemote);
|
|
60
|
+
}
|
|
61
|
+
project.primaryLanguage = this.detectPrimaryLanguage(path);
|
|
62
|
+
project.framework = this.detectFramework(path);
|
|
63
|
+
await retry(() => Promise.resolve(this.saveProject(project)), {
|
|
64
|
+
maxAttempts: 3,
|
|
65
|
+
initialDelay: 100,
|
|
66
|
+
onRetry: (attempt, error) => {
|
|
67
|
+
logger.warn(`Retrying project save (attempt ${attempt})`, {
|
|
68
|
+
projectId: project.id,
|
|
69
|
+
error: error instanceof Error ? error.message : String(error)
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
this.projectCache.set(path, project);
|
|
74
|
+
this.currentProject = project;
|
|
75
|
+
logger.info("Project auto-detected", {
|
|
76
|
+
id: project.id,
|
|
77
|
+
org: project.organization,
|
|
78
|
+
type: project.accountType
|
|
79
|
+
});
|
|
80
|
+
return project;
|
|
81
|
+
} catch (error) {
|
|
82
|
+
const wrappedError = errorHandler(error, {
|
|
83
|
+
projectPath: path,
|
|
84
|
+
operation: "detectProject"
|
|
85
|
+
});
|
|
86
|
+
throw new ProjectError(
|
|
87
|
+
`Failed to detect project at path: ${path}`,
|
|
88
|
+
ErrorCode.PROJECT_INVALID_PATH,
|
|
89
|
+
{
|
|
90
|
+
projectPath: path,
|
|
91
|
+
operation: "detectProject"
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Analyze project directory
|
|
98
|
+
*/
|
|
99
|
+
async analyzeProject(projectPath) {
|
|
100
|
+
const gitInfo = this.getGitInfo(projectPath);
|
|
101
|
+
const projectName = gitInfo.name || basename(projectPath);
|
|
102
|
+
return {
|
|
103
|
+
id: this.generateProjectId(gitInfo.remote || projectPath),
|
|
104
|
+
name: projectName,
|
|
105
|
+
path: projectPath,
|
|
106
|
+
gitRemote: gitInfo.remote,
|
|
107
|
+
organization: void 0,
|
|
108
|
+
accountType: "personal",
|
|
109
|
+
isPrivate: false,
|
|
110
|
+
lastAccessed: /* @__PURE__ */ new Date(),
|
|
111
|
+
metadata: {
|
|
112
|
+
branch: gitInfo.branch,
|
|
113
|
+
lastCommit: gitInfo.lastCommit,
|
|
114
|
+
isDirty: gitInfo.isDirty
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Extract Git information
|
|
120
|
+
*/
|
|
121
|
+
getGitInfo(projectPath) {
|
|
122
|
+
const info = {};
|
|
123
|
+
const errorHandler = createErrorHandler({
|
|
124
|
+
operation: "getGitInfo",
|
|
125
|
+
projectPath
|
|
126
|
+
});
|
|
127
|
+
try {
|
|
128
|
+
info.remote = execSync("git config --get remote.origin.url", {
|
|
129
|
+
cwd: projectPath,
|
|
130
|
+
encoding: "utf-8",
|
|
131
|
+
timeout: 5e3
|
|
132
|
+
// 5 second timeout
|
|
133
|
+
}).trim();
|
|
134
|
+
info.branch = execSync("git branch --show-current", {
|
|
135
|
+
cwd: projectPath,
|
|
136
|
+
encoding: "utf-8",
|
|
137
|
+
timeout: 5e3
|
|
138
|
+
}).trim();
|
|
139
|
+
info.lastCommit = execSync("git log -1 --format=%H", {
|
|
140
|
+
cwd: projectPath,
|
|
141
|
+
encoding: "utf-8",
|
|
142
|
+
timeout: 5e3
|
|
143
|
+
}).trim();
|
|
144
|
+
const status = execSync("git status --porcelain", {
|
|
145
|
+
cwd: projectPath,
|
|
146
|
+
encoding: "utf-8",
|
|
147
|
+
timeout: 5e3
|
|
148
|
+
});
|
|
149
|
+
info.isDirty = status.length > 0;
|
|
150
|
+
const match = info.remote.match(/\/([^\/]+?)(\.git)?$/);
|
|
151
|
+
info.name = match ? match[1] : basename(projectPath);
|
|
152
|
+
} catch (error) {
|
|
153
|
+
logger.debug("Git info extraction failed, using directory name", {
|
|
154
|
+
projectPath,
|
|
155
|
+
error: error instanceof Error ? error.message : String(error)
|
|
156
|
+
});
|
|
157
|
+
info.name = basename(projectPath);
|
|
158
|
+
}
|
|
159
|
+
return info;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Extract organization from Git remote
|
|
163
|
+
*/
|
|
164
|
+
extractOrganization(gitRemote) {
|
|
165
|
+
const githubMatch = gitRemote.match(/github\.com[:/]([^/]+)\//);
|
|
166
|
+
if (githubMatch) return githubMatch[1];
|
|
167
|
+
const gitlabMatch = gitRemote.match(/gitlab\.com[:/]([^/]+)\//);
|
|
168
|
+
if (gitlabMatch) return gitlabMatch[1];
|
|
169
|
+
const bitbucketMatch = gitRemote.match(/bitbucket\.org[:/]([^/]+)\//);
|
|
170
|
+
if (bitbucketMatch) return bitbucketMatch[1];
|
|
171
|
+
const customMatch = gitRemote.match(/@([^:]+)[:/]([^/]+)\//);
|
|
172
|
+
if (customMatch) return customMatch[2];
|
|
173
|
+
return "unknown";
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Determine account type based on patterns
|
|
177
|
+
*/
|
|
178
|
+
determineAccountType(gitRemote, organization) {
|
|
179
|
+
for (const [, org] of this.organizations) {
|
|
180
|
+
if (org.githubOrgs.includes(organization || "")) {
|
|
181
|
+
return org.accountType;
|
|
182
|
+
}
|
|
183
|
+
for (const domain of org.domains) {
|
|
184
|
+
if (gitRemote.includes(domain)) {
|
|
185
|
+
return org.accountType;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if (organization) {
|
|
190
|
+
if (organization.includes("corp") || organization.includes("company") || organization.includes("team") || organization.includes("work")) {
|
|
191
|
+
return "work";
|
|
192
|
+
}
|
|
193
|
+
if (organization.includes("apache") || organization.includes("mozilla") || organization.includes("foundation") || gitRemote.includes("gitlab.freedesktop")) {
|
|
194
|
+
return "opensource";
|
|
195
|
+
}
|
|
196
|
+
const username = this.getCurrentGitUser();
|
|
197
|
+
if (username && organization.toLowerCase() === username.toLowerCase()) {
|
|
198
|
+
return "personal";
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (this.isPrivateRepo(gitRemote)) {
|
|
202
|
+
const currentPath = process.cwd();
|
|
203
|
+
if (currentPath.includes("/work/") || currentPath.includes("/Work/") || currentPath.includes("/company/") || currentPath.includes("/job/")) {
|
|
204
|
+
return "work";
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return "personal";
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Check if repository is private
|
|
211
|
+
*/
|
|
212
|
+
isPrivateRepo(gitRemote) {
|
|
213
|
+
if (gitRemote.startsWith("git@")) {
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
if (gitRemote.includes("@")) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Detect primary programming language
|
|
223
|
+
*/
|
|
224
|
+
detectPrimaryLanguage(projectPath) {
|
|
225
|
+
const checks = [
|
|
226
|
+
{ file: "package.json", language: "JavaScript/TypeScript" },
|
|
227
|
+
{ file: "Cargo.toml", language: "Rust" },
|
|
228
|
+
{ file: "go.mod", language: "Go" },
|
|
229
|
+
{ file: "pom.xml", language: "Java" },
|
|
230
|
+
{ file: "requirements.txt", language: "Python" },
|
|
231
|
+
{ file: "Gemfile", language: "Ruby" },
|
|
232
|
+
{ file: "composer.json", language: "PHP" },
|
|
233
|
+
{ file: "*.csproj", language: "C#" },
|
|
234
|
+
{ file: "Podfile", language: "Swift/Objective-C" }
|
|
235
|
+
];
|
|
236
|
+
for (const check of checks) {
|
|
237
|
+
if (check.file.includes("*")) {
|
|
238
|
+
try {
|
|
239
|
+
const files = execSync(
|
|
240
|
+
`find ${projectPath} -maxdepth 2 -name "${check.file}" 2>/dev/null`,
|
|
241
|
+
{
|
|
242
|
+
encoding: "utf-8"
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
if (files.trim()) return check.language;
|
|
246
|
+
} catch {
|
|
247
|
+
}
|
|
248
|
+
} else if (existsSync(join(projectPath, check.file))) {
|
|
249
|
+
return check.language;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return void 0;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Detect framework
|
|
256
|
+
*/
|
|
257
|
+
detectFramework(projectPath) {
|
|
258
|
+
const packageJsonPath = join(projectPath, "package.json");
|
|
259
|
+
if (existsSync(packageJsonPath)) {
|
|
260
|
+
try {
|
|
261
|
+
const pkg = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
262
|
+
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
263
|
+
if (deps["next"]) return "Next.js";
|
|
264
|
+
if (deps["react"]) return "React";
|
|
265
|
+
if (deps["vue"]) return "Vue";
|
|
266
|
+
if (deps["@angular/core"]) return "Angular";
|
|
267
|
+
if (deps["express"]) return "Express";
|
|
268
|
+
if (deps["fastify"]) return "Fastify";
|
|
269
|
+
if (deps["@nestjs/core"]) return "NestJS";
|
|
270
|
+
} catch {
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (existsSync(join(projectPath, "Cargo.toml"))) {
|
|
274
|
+
const cargo = readFileSync(join(projectPath, "Cargo.toml"), "utf-8");
|
|
275
|
+
if (cargo.includes("actix-web")) return "Actix";
|
|
276
|
+
if (cargo.includes("rocket")) return "Rocket";
|
|
277
|
+
}
|
|
278
|
+
return void 0;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Get current Git user
|
|
282
|
+
*/
|
|
283
|
+
getCurrentGitUser() {
|
|
284
|
+
try {
|
|
285
|
+
const email = execSync("git config --global user.email", {
|
|
286
|
+
encoding: "utf-8"
|
|
287
|
+
}).trim();
|
|
288
|
+
const username = email.split("@")[0];
|
|
289
|
+
return username;
|
|
290
|
+
} catch {
|
|
291
|
+
return void 0;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Generate unique project ID
|
|
296
|
+
*/
|
|
297
|
+
generateProjectId(identifier) {
|
|
298
|
+
const cleaned = identifier.replace(/\.git$/, "").replace(/[^a-zA-Z0-9-]/g, "-").toLowerCase();
|
|
299
|
+
return cleaned.substring(cleaned.length - 50);
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Initialize database
|
|
303
|
+
*/
|
|
304
|
+
initializeDatabase() {
|
|
305
|
+
const dbPath = join(this.configPath, "projects.db");
|
|
306
|
+
const errorHandler = createErrorHandler({
|
|
307
|
+
operation: "initializeDatabase",
|
|
308
|
+
dbPath
|
|
309
|
+
});
|
|
310
|
+
try {
|
|
311
|
+
this.db = new Database(dbPath);
|
|
312
|
+
this.db.exec(`
|
|
313
|
+
CREATE TABLE IF NOT EXISTS projects (
|
|
314
|
+
id TEXT PRIMARY KEY,
|
|
315
|
+
name TEXT NOT NULL,
|
|
316
|
+
path TEXT NOT NULL UNIQUE,
|
|
317
|
+
git_remote TEXT,
|
|
318
|
+
organization TEXT,
|
|
319
|
+
account_type TEXT,
|
|
320
|
+
is_private BOOLEAN,
|
|
321
|
+
primary_language TEXT,
|
|
322
|
+
framework TEXT,
|
|
323
|
+
last_accessed DATETIME,
|
|
324
|
+
metadata JSON,
|
|
325
|
+
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
326
|
+
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
CREATE TABLE IF NOT EXISTS organizations (
|
|
330
|
+
name TEXT PRIMARY KEY,
|
|
331
|
+
type TEXT,
|
|
332
|
+
account_type TEXT,
|
|
333
|
+
config JSON,
|
|
334
|
+
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
CREATE TABLE IF NOT EXISTS project_contexts (
|
|
338
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
339
|
+
project_id TEXT NOT NULL,
|
|
340
|
+
context_type TEXT,
|
|
341
|
+
content TEXT,
|
|
342
|
+
metadata JSON,
|
|
343
|
+
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
344
|
+
FOREIGN KEY (project_id) REFERENCES projects(id)
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
CREATE INDEX IF NOT EXISTS idx_projects_org ON projects(organization);
|
|
348
|
+
CREATE INDEX IF NOT EXISTS idx_projects_type ON projects(account_type);
|
|
349
|
+
CREATE INDEX IF NOT EXISTS idx_contexts_project ON project_contexts(project_id);
|
|
350
|
+
`);
|
|
351
|
+
} catch (error) {
|
|
352
|
+
const dbError = errorHandler(error, {
|
|
353
|
+
dbPath,
|
|
354
|
+
operation: "initializeDatabase"
|
|
355
|
+
});
|
|
356
|
+
throw new DatabaseError(
|
|
357
|
+
"Failed to initialize projects database",
|
|
358
|
+
ErrorCode.DB_MIGRATION_FAILED,
|
|
359
|
+
{
|
|
360
|
+
dbPath,
|
|
361
|
+
configPath: this.configPath,
|
|
362
|
+
operation: "initializeDatabase"
|
|
363
|
+
},
|
|
364
|
+
error instanceof Error ? error : void 0
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Save project to database
|
|
370
|
+
*/
|
|
371
|
+
saveProject(project) {
|
|
372
|
+
try {
|
|
373
|
+
const stmt = this.db.prepare(`
|
|
374
|
+
INSERT OR REPLACE INTO projects
|
|
375
|
+
(id, name, path, git_remote, organization, account_type, is_private,
|
|
376
|
+
primary_language, framework, last_accessed, metadata, updated_at)
|
|
377
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)
|
|
378
|
+
`);
|
|
379
|
+
stmt.run(
|
|
380
|
+
project.id,
|
|
381
|
+
project.name,
|
|
382
|
+
project.path,
|
|
383
|
+
project.gitRemote,
|
|
384
|
+
project.organization,
|
|
385
|
+
project.accountType,
|
|
386
|
+
project.isPrivate ? 1 : 0,
|
|
387
|
+
project.primaryLanguage,
|
|
388
|
+
project.framework,
|
|
389
|
+
project.lastAccessed.toISOString(),
|
|
390
|
+
JSON.stringify(project.metadata)
|
|
391
|
+
);
|
|
392
|
+
} catch (error) {
|
|
393
|
+
throw new DatabaseError(
|
|
394
|
+
`Failed to save project: ${project.name}`,
|
|
395
|
+
ErrorCode.DB_QUERY_FAILED,
|
|
396
|
+
{
|
|
397
|
+
projectId: project.id,
|
|
398
|
+
projectName: project.name,
|
|
399
|
+
projectPath: project.path,
|
|
400
|
+
operation: "saveProject"
|
|
401
|
+
},
|
|
402
|
+
error instanceof Error ? error : void 0
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Load organizations configuration
|
|
408
|
+
*/
|
|
409
|
+
loadOrganizations() {
|
|
410
|
+
const configFile = join(this.configPath, "organizations.json");
|
|
411
|
+
if (existsSync(configFile)) {
|
|
412
|
+
try {
|
|
413
|
+
const config = JSON.parse(readFileSync(configFile, "utf-8"));
|
|
414
|
+
for (const org of config.organizations || []) {
|
|
415
|
+
this.organizations.set(org.name, org);
|
|
416
|
+
}
|
|
417
|
+
} catch (error) {
|
|
418
|
+
logger.error(
|
|
419
|
+
"Failed to load organizations config",
|
|
420
|
+
error instanceof Error ? error : void 0
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Auto-discover organizations from existing projects
|
|
427
|
+
*/
|
|
428
|
+
autoDiscoverOrganizations() {
|
|
429
|
+
const errorHandler = createErrorHandler({
|
|
430
|
+
operation: "autoDiscoverOrganizations"
|
|
431
|
+
});
|
|
432
|
+
try {
|
|
433
|
+
const stmt = this.db.prepare(`
|
|
434
|
+
SELECT DISTINCT organization, account_type, COUNT(*) as project_count
|
|
435
|
+
FROM projects
|
|
436
|
+
WHERE organization IS NOT NULL
|
|
437
|
+
GROUP BY organization, account_type
|
|
438
|
+
`);
|
|
439
|
+
const orgs = stmt.all();
|
|
440
|
+
for (const org of orgs) {
|
|
441
|
+
if (!this.organizations.has(org.organization)) {
|
|
442
|
+
this.organizations.set(org.organization, {
|
|
443
|
+
name: org.organization,
|
|
444
|
+
type: org.account_type === "work" ? "company" : "personal",
|
|
445
|
+
domains: [],
|
|
446
|
+
githubOrgs: [org.organization],
|
|
447
|
+
accountType: org.account_type,
|
|
448
|
+
autoPatterns: []
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
} catch (error) {
|
|
453
|
+
const wrappedError = errorHandler(error, {
|
|
454
|
+
operation: "autoDiscoverOrganizations"
|
|
455
|
+
});
|
|
456
|
+
logger.error(
|
|
457
|
+
"Failed to auto-discover organizations",
|
|
458
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
459
|
+
{
|
|
460
|
+
operation: "autoDiscoverOrganizations"
|
|
461
|
+
}
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Ensure directory structure exists
|
|
467
|
+
*/
|
|
468
|
+
ensureDirectoryStructure() {
|
|
469
|
+
const dirs = [
|
|
470
|
+
this.configPath,
|
|
471
|
+
join(this.configPath, "accounts"),
|
|
472
|
+
join(this.configPath, "accounts", "personal"),
|
|
473
|
+
join(this.configPath, "accounts", "work"),
|
|
474
|
+
join(this.configPath, "accounts", "opensource"),
|
|
475
|
+
join(this.configPath, "accounts", "client"),
|
|
476
|
+
join(this.configPath, "contexts"),
|
|
477
|
+
join(this.configPath, "patterns")
|
|
478
|
+
];
|
|
479
|
+
for (const dir of dirs) {
|
|
480
|
+
if (!existsSync(dir)) {
|
|
481
|
+
mkdirSync(dir, { recursive: true });
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Check if cache is still valid
|
|
487
|
+
*/
|
|
488
|
+
isCacheValid(project) {
|
|
489
|
+
const cacheAge = Date.now() - project.lastAccessed.getTime();
|
|
490
|
+
return cacheAge < 5 * 60 * 1e3;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Get all projects
|
|
494
|
+
*/
|
|
495
|
+
getAllProjects() {
|
|
496
|
+
try {
|
|
497
|
+
const stmt = this.db.prepare(`
|
|
498
|
+
SELECT * FROM projects
|
|
499
|
+
ORDER BY last_accessed DESC
|
|
500
|
+
`);
|
|
501
|
+
const projects = stmt.all();
|
|
502
|
+
return projects.map((p) => ({
|
|
503
|
+
...p,
|
|
504
|
+
isPrivate: p.is_private === 1,
|
|
505
|
+
lastAccessed: new Date(p.last_accessed),
|
|
506
|
+
metadata: JSON.parse(p.metadata || "{}")
|
|
507
|
+
}));
|
|
508
|
+
} catch (error) {
|
|
509
|
+
throw new DatabaseError(
|
|
510
|
+
"Failed to get all projects",
|
|
511
|
+
ErrorCode.DB_QUERY_FAILED,
|
|
512
|
+
{
|
|
513
|
+
operation: "getAllProjects"
|
|
514
|
+
},
|
|
515
|
+
error instanceof Error ? error : void 0
|
|
516
|
+
);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Get projects by organization
|
|
521
|
+
*/
|
|
522
|
+
getProjectsByOrganization(organization) {
|
|
523
|
+
try {
|
|
524
|
+
const stmt = this.db.prepare(`
|
|
525
|
+
SELECT * FROM projects
|
|
526
|
+
WHERE organization = ?
|
|
527
|
+
ORDER BY last_accessed DESC
|
|
528
|
+
`);
|
|
529
|
+
const projects = stmt.all(organization);
|
|
530
|
+
return projects.map((p) => ({
|
|
531
|
+
...p,
|
|
532
|
+
isPrivate: p.is_private === 1,
|
|
533
|
+
lastAccessed: new Date(p.last_accessed),
|
|
534
|
+
metadata: JSON.parse(p.metadata || "{}")
|
|
535
|
+
}));
|
|
536
|
+
} catch (error) {
|
|
537
|
+
throw new DatabaseError(
|
|
538
|
+
`Failed to get projects by organization: ${organization}`,
|
|
539
|
+
ErrorCode.DB_QUERY_FAILED,
|
|
540
|
+
{
|
|
541
|
+
organization,
|
|
542
|
+
operation: "getProjectsByOrganization"
|
|
543
|
+
},
|
|
544
|
+
error instanceof Error ? error : void 0
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Get projects by account type
|
|
550
|
+
*/
|
|
551
|
+
getProjectsByAccountType(accountType) {
|
|
552
|
+
try {
|
|
553
|
+
const stmt = this.db.prepare(`
|
|
554
|
+
SELECT * FROM projects
|
|
555
|
+
WHERE account_type = ?
|
|
556
|
+
ORDER BY last_accessed DESC
|
|
557
|
+
`);
|
|
558
|
+
const projects = stmt.all(accountType);
|
|
559
|
+
return projects.map((p) => ({
|
|
560
|
+
...p,
|
|
561
|
+
isPrivate: p.is_private === 1,
|
|
562
|
+
lastAccessed: new Date(p.last_accessed),
|
|
563
|
+
metadata: JSON.parse(p.metadata || "{}")
|
|
564
|
+
}));
|
|
565
|
+
} catch (error) {
|
|
566
|
+
throw new DatabaseError(
|
|
567
|
+
`Failed to get projects by account type: ${accountType}`,
|
|
568
|
+
ErrorCode.DB_QUERY_FAILED,
|
|
569
|
+
{
|
|
570
|
+
accountType,
|
|
571
|
+
operation: "getProjectsByAccountType"
|
|
572
|
+
},
|
|
573
|
+
error instanceof Error ? error : void 0
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Get current project
|
|
579
|
+
*/
|
|
580
|
+
getCurrentProject() {
|
|
581
|
+
if (!this.currentProject) {
|
|
582
|
+
this.detectProject();
|
|
583
|
+
}
|
|
584
|
+
return this.currentProject;
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Save organization config
|
|
588
|
+
*/
|
|
589
|
+
saveOrganization(org) {
|
|
590
|
+
const errorHandler = createErrorHandler({
|
|
591
|
+
operation: "saveOrganization",
|
|
592
|
+
orgName: org.name
|
|
593
|
+
});
|
|
594
|
+
try {
|
|
595
|
+
this.organizations.set(org.name, org);
|
|
596
|
+
const configFile = join(this.configPath, "organizations.json");
|
|
597
|
+
const config = {
|
|
598
|
+
organizations: Array.from(this.organizations.values())
|
|
599
|
+
};
|
|
600
|
+
writeFileSync(configFile, JSON.stringify(config, null, 2));
|
|
601
|
+
const stmt = this.db.prepare(`
|
|
602
|
+
INSERT OR REPLACE INTO organizations (name, type, account_type, config)
|
|
603
|
+
VALUES (?, ?, ?, ?)
|
|
604
|
+
`);
|
|
605
|
+
stmt.run(org.name, org.type, org.accountType, JSON.stringify(org));
|
|
606
|
+
} catch (error) {
|
|
607
|
+
const wrappedError = errorHandler(error, {
|
|
608
|
+
orgName: org.name,
|
|
609
|
+
operation: "saveOrganization"
|
|
610
|
+
});
|
|
611
|
+
throw new DatabaseError(
|
|
612
|
+
`Failed to save organization: ${org.name}`,
|
|
613
|
+
ErrorCode.DB_QUERY_FAILED,
|
|
614
|
+
{
|
|
615
|
+
orgName: org.name,
|
|
616
|
+
operation: "saveOrganization"
|
|
617
|
+
},
|
|
618
|
+
error instanceof Error ? error : void 0
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Auto-categorize all Git repositories in home directory
|
|
624
|
+
*/
|
|
625
|
+
async scanAndCategorizeAllProjects(basePaths) {
|
|
626
|
+
const paths = basePaths || [
|
|
627
|
+
join(homedir(), "Dev"),
|
|
628
|
+
join(homedir(), "dev"),
|
|
629
|
+
join(homedir(), "Projects"),
|
|
630
|
+
join(homedir(), "projects"),
|
|
631
|
+
join(homedir(), "Work"),
|
|
632
|
+
join(homedir(), "work"),
|
|
633
|
+
join(homedir(), "Documents/GitHub"),
|
|
634
|
+
join(homedir(), "code")
|
|
635
|
+
];
|
|
636
|
+
logger.info("Scanning for Git repositories...");
|
|
637
|
+
for (const basePath of paths) {
|
|
638
|
+
if (!existsSync(basePath)) continue;
|
|
639
|
+
try {
|
|
640
|
+
const gitDirs = execSync(
|
|
641
|
+
`find ${basePath} -type d -name .git -maxdepth 4 2>/dev/null`,
|
|
642
|
+
{ encoding: "utf-8", timeout: 3e4 }
|
|
643
|
+
// 30 second timeout
|
|
644
|
+
).trim().split("\n").filter(Boolean);
|
|
645
|
+
for (const gitDir of gitDirs) {
|
|
646
|
+
const projectPath = dirname(gitDir);
|
|
647
|
+
try {
|
|
648
|
+
await this.detectProject(projectPath);
|
|
649
|
+
logger.info(`Discovered project: ${projectPath}`);
|
|
650
|
+
} catch (error) {
|
|
651
|
+
logger.warn(`Failed to analyze project: ${projectPath}`, {
|
|
652
|
+
projectPath,
|
|
653
|
+
error: error instanceof Error ? error.message : String(error),
|
|
654
|
+
operation: "scanAndCategorizeAllProjects"
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
} catch (error) {
|
|
659
|
+
logger.warn(
|
|
660
|
+
`Failed to scan ${basePath}`,
|
|
661
|
+
error instanceof Error ? { error } : void 0
|
|
662
|
+
);
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
logger.info(`Scan complete. Found ${this.projectCache.size} projects`);
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Generate summary report
|
|
669
|
+
*/
|
|
670
|
+
generateReport() {
|
|
671
|
+
const allProjects = this.getAllProjects();
|
|
672
|
+
const report = {
|
|
673
|
+
total: allProjects.length,
|
|
674
|
+
byAccountType: {},
|
|
675
|
+
byOrganization: {},
|
|
676
|
+
byLanguage: {},
|
|
677
|
+
byFramework: {}
|
|
678
|
+
};
|
|
679
|
+
for (const project of allProjects) {
|
|
680
|
+
report.byAccountType[project.accountType] = (report.byAccountType[project.accountType] || 0) + 1;
|
|
681
|
+
if (project.organization) {
|
|
682
|
+
report.byOrganization[project.organization] = (report.byOrganization[project.organization] || 0) + 1;
|
|
683
|
+
}
|
|
684
|
+
if (project.primaryLanguage) {
|
|
685
|
+
report.byLanguage[project.primaryLanguage] = (report.byLanguage[project.primaryLanguage] || 0) + 1;
|
|
686
|
+
}
|
|
687
|
+
if (project.framework) {
|
|
688
|
+
report.byFramework[project.framework] = (report.byFramework[project.framework] || 0) + 1;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
return JSON.stringify(report, null, 2);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
export {
|
|
695
|
+
ProjectManager
|
|
696
|
+
};
|
|
697
|
+
//# sourceMappingURL=project-manager.js.map
|