claude-flow-novice 2.0.4 → 2.0.5
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/src/cli/commands/guidance.js +668 -487
- package/dist/src/cli/commands/index-validate.js +29 -18
- package/dist/src/cli/commands/mcp-troubleshoot.js +282 -230
- package/dist/src/cli/commands/neural-goal-init.js +125 -92
- package/dist/src/cli/commands/swarm-exec.js +393 -317
- package/dist/src/cli/commands/validate-framework.js +1100 -983
- package/dist/src/cli/commands/validate.js +223 -144
- package/dist/src/cli/main.js +1 -1
- package/dist/src/cli/simple-commands/__tests__/agent.test.js +277 -265
- package/dist/src/cli/simple-commands/__tests__/memory.test.js +7 -6
- package/dist/src/cli/simple-commands/__tests__/swarm.test.js +356 -373
- package/dist/src/cli/simple-commands/__tests__/task.test.js +7 -6
- package/dist/src/cli/simple-commands/agent.js +193 -157
- package/dist/src/cli/simple-commands/analysis.js +446 -336
- package/dist/src/cli/simple-commands/automation-executor.js +1339 -1095
- package/dist/src/cli/simple-commands/automation.js +469 -481
- package/dist/src/cli/simple-commands/batch-manager.js +313 -261
- package/dist/src/cli/simple-commands/claude-telemetry.js +267 -241
- package/dist/src/cli/simple-commands/claude-track.js +90 -68
- package/dist/src/cli/simple-commands/concurrent-display.js +320 -266
- package/dist/src/cli/simple-commands/config.js +290 -245
- package/dist/src/cli/simple-commands/coordination.js +234 -182
- package/dist/src/cli/simple-commands/enhanced-ui-views.js +615 -812
- package/dist/src/cli/simple-commands/enhanced-webui-complete.js +981 -922
- package/dist/src/cli/simple-commands/fix-hook-variables.js +294 -274
- package/dist/src/cli/simple-commands/github/gh-coordinator.js +457 -378
- package/dist/src/cli/simple-commands/github/github-api.js +574 -535
- package/dist/src/cli/simple-commands/github/init.js +303 -276
- package/dist/src/cli/simple-commands/github.js +247 -222
- package/dist/src/cli/simple-commands/goal.js +63 -51
- package/dist/src/cli/simple-commands/hive-mind/auto-save-middleware.js +278 -208
- package/dist/src/cli/simple-commands/hive-mind/communication.js +696 -601
- package/dist/src/cli/simple-commands/hive-mind/core.js +979 -907
- package/dist/src/cli/simple-commands/hive-mind/db-optimizer.js +655 -406
- package/dist/src/cli/simple-commands/hive-mind/mcp-wrapper.js +1245 -1125
- package/dist/src/cli/simple-commands/hive-mind/memory.js +1090 -854
- package/dist/src/cli/simple-commands/hive-mind/performance-optimizer.js +574 -459
- package/dist/src/cli/simple-commands/hive-mind/performance-test.js +347 -263
- package/dist/src/cli/simple-commands/hive-mind/queen.js +768 -727
- package/dist/src/cli/simple-commands/hive-mind/session-manager.js +1049 -745
- package/dist/src/cli/simple-commands/hive-mind-optimize.js +283 -227
- package/dist/src/cli/simple-commands/hive-mind-wizard.js +217 -174
- package/dist/src/cli/simple-commands/hive-mind.js +2282 -1841
- package/dist/src/cli/simple-commands/hive.js +79 -90
- package/dist/src/cli/simple-commands/hook-safety.js +521 -431
- package/dist/src/cli/simple-commands/hooks/session-start-soul.js +254 -203
- package/dist/src/cli/simple-commands/hooks.js +1204 -1064
- package/dist/src/cli/simple-commands/init/agent-copier.js +319 -294
- package/dist/src/cli/simple-commands/init/batch-init.js +562 -496
- package/dist/src/cli/simple-commands/init/claude-commands/claude-flow-commands.js +19 -13
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-claude-flow-commands.js +19 -13
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-slash-commands.js +88 -61
- package/dist/src/cli/simple-commands/init/claude-commands/optimized-sparc-commands.js +150 -125
- package/dist/src/cli/simple-commands/init/claude-commands/slash-commands.js +49 -42
- package/dist/src/cli/simple-commands/init/claude-commands/sparc-commands.js +61 -43
- package/dist/src/cli/simple-commands/init/copy-revised-templates.js +147 -141
- package/dist/src/cli/simple-commands/init/executable-wrapper.js +44 -31
- package/dist/src/cli/simple-commands/init/gitignore-updater.js +90 -64
- package/dist/src/cli/simple-commands/init/help.js +107 -104
- package/dist/src/cli/simple-commands/init/hive-mind-init.js +528 -509
- package/dist/src/cli/simple-commands/init/index.js +1759 -1510
- package/dist/src/cli/simple-commands/init/performance-monitor.js +317 -234
- package/dist/src/cli/simple-commands/init/rollback/backup-manager.js +504 -441
- package/dist/src/cli/simple-commands/init/rollback/index.js +364 -289
- package/dist/src/cli/simple-commands/init/rollback/recovery-manager.js +728 -652
- package/dist/src/cli/simple-commands/init/rollback/rollback-executor.js +481 -416
- package/dist/src/cli/simple-commands/init/rollback/state-tracker.js +448 -369
- package/dist/src/cli/simple-commands/init/sparc/roo-readme.js +2 -1
- package/dist/src/cli/simple-commands/init/sparc/roomodes-config.js +99 -122
- package/dist/src/cli/simple-commands/init/sparc/workflows.js +37 -32
- package/dist/src/cli/simple-commands/init/sparc-structure.js +62 -55
- package/dist/src/cli/simple-commands/init/template-copier.js +533 -421
- package/dist/src/cli/simple-commands/init/templates/coordination-md.js +6 -3
- package/dist/src/cli/simple-commands/init/templates/enhanced-templates.js +318 -344
- package/dist/src/cli/simple-commands/init/templates/github-safe-enhanced.js +218 -173
- package/dist/src/cli/simple-commands/init/templates/github-safe.js +75 -65
- package/dist/src/cli/simple-commands/init/templates/memory-bank-md.js +6 -3
- package/dist/src/cli/simple-commands/init/templates/readme-files.js +4 -2
- package/dist/src/cli/simple-commands/init/templates/safe-hook-patterns.js +230 -187
- package/dist/src/cli/simple-commands/init/templates/sparc-modes.js +80 -53
- package/dist/src/cli/simple-commands/init/templates/verification-claude-md.js +85 -101
- package/dist/src/cli/simple-commands/init/validation/config-validator.js +330 -283
- package/dist/src/cli/simple-commands/init/validation/health-checker.js +561 -495
- package/dist/src/cli/simple-commands/init/validation/index.js +358 -302
- package/dist/src/cli/simple-commands/init/validation/mode-validator.js +359 -308
- package/dist/src/cli/simple-commands/init/validation/post-init-validator.js +366 -389
- package/dist/src/cli/simple-commands/init/validation/pre-init-validator.js +268 -270
- package/dist/src/cli/simple-commands/init/validation/test-runner.js +447 -427
- package/dist/src/cli/simple-commands/init.js +2 -1
- package/dist/src/cli/simple-commands/mcp-health.js +158 -131
- package/dist/src/cli/simple-commands/mcp-integration-layer.js +634 -533
- package/dist/src/cli/simple-commands/mcp.js +400 -345
- package/dist/src/cli/simple-commands/memory-consolidation.js +537 -426
- package/dist/src/cli/simple-commands/memory.js +311 -247
- package/dist/src/cli/simple-commands/migrate-hooks.js +46 -39
- package/dist/src/cli/simple-commands/monitor.js +363 -294
- package/dist/src/cli/simple-commands/neural.js +65 -51
- package/dist/src/cli/simple-commands/pair-autofix-only.js +662 -538
- package/dist/src/cli/simple-commands/pair-basic.js +656 -528
- package/dist/src/cli/simple-commands/pair-old.js +543 -430
- package/dist/src/cli/simple-commands/pair-working.js +751 -615
- package/dist/src/cli/simple-commands/pair.js +751 -615
- package/dist/src/cli/simple-commands/performance-hooks.js +111 -83
- package/dist/src/cli/simple-commands/performance-metrics.js +433 -348
- package/dist/src/cli/simple-commands/process-ui-enhanced.js +787 -708
- package/dist/src/cli/simple-commands/process-ui.js +254 -230
- package/dist/src/cli/simple-commands/realtime-update-system.js +611 -525
- package/dist/src/cli/simple-commands/sparc/architecture.js +1530 -1704
- package/dist/src/cli/simple-commands/sparc/commands.js +516 -438
- package/dist/src/cli/simple-commands/sparc/completion.js +1481 -1224
- package/dist/src/cli/simple-commands/sparc/coordinator.js +978 -913
- package/dist/src/cli/simple-commands/sparc/index.js +298 -241
- package/dist/src/cli/simple-commands/sparc/phase-base.js +390 -314
- package/dist/src/cli/simple-commands/sparc/pseudocode.js +869 -965
- package/dist/src/cli/simple-commands/sparc/refinement.js +1273 -980
- package/dist/src/cli/simple-commands/sparc/specification.js +645 -559
- package/dist/src/cli/simple-commands/sparc-modes/architect.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/ask.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/code.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/debug.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/devops.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/docs-writer.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/generic.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/index.js +55 -47
- package/dist/src/cli/simple-commands/sparc-modes/integration.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/mcp.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/monitoring.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/optimization.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/security-review.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/sparc-orchestrator.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/spec-pseudocode.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/supabase-admin.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/swarm.js +87 -101
- package/dist/src/cli/simple-commands/sparc-modes/tdd.js +1 -1
- package/dist/src/cli/simple-commands/sparc-modes/tutorial.js +1 -1
- package/dist/src/cli/simple-commands/sparc.js +493 -465
- package/dist/src/cli/simple-commands/start-ui.js +132 -108
- package/dist/src/cli/simple-commands/start-wrapper.js +268 -240
- package/dist/src/cli/simple-commands/start.js +1 -1
- package/dist/src/cli/simple-commands/status.js +275 -254
- package/dist/src/cli/simple-commands/stream-chain-clean.js +171 -128
- package/dist/src/cli/simple-commands/stream-chain-fixed.js +82 -61
- package/dist/src/cli/simple-commands/stream-chain-real.js +331 -267
- package/dist/src/cli/simple-commands/stream-chain-working.js +263 -211
- package/dist/src/cli/simple-commands/stream-chain.js +318 -260
- package/dist/src/cli/simple-commands/stream-processor.js +315 -290
- package/dist/src/cli/simple-commands/swarm-executor.js +222 -189
- package/dist/src/cli/simple-commands/swarm-metrics-integration.js +300 -208
- package/dist/src/cli/simple-commands/swarm-ui.js +703 -623
- package/dist/src/cli/simple-commands/swarm-webui-integration.js +286 -258
- package/dist/src/cli/simple-commands/swarm.js +1082 -887
- package/dist/src/cli/simple-commands/task.js +206 -161
- package/dist/src/cli/simple-commands/timestamp-fix.js +89 -59
- package/dist/src/cli/simple-commands/token-tracker.js +316 -258
- package/dist/src/cli/simple-commands/tool-execution-framework.js +519 -433
- package/dist/src/cli/simple-commands/train-and-stream.js +331 -275
- package/dist/src/cli/simple-commands/training-pipeline.js +725 -619
- package/dist/src/cli/simple-commands/training.js +227 -170
- package/dist/src/cli/simple-commands/verification-hooks.js +284 -261
- package/dist/src/cli/simple-commands/verification-integration.js +417 -389
- package/dist/src/cli/simple-commands/verification-training-integration.js +606 -486
- package/dist/src/cli/simple-commands/verification.js +513 -493
- package/dist/src/cli/simple-commands/web-server.js +836 -766
- package/dist/src/cli/simple-commands/webui-validator.js +124 -106
- package/dist/src/coordination/byzantine-memory-channels.js +25 -1
- package/dist/src/coordination/event-bus/demo-wasm-integration.js +251 -212
- package/dist/src/coordination/event-bus/qe-event-bus.js +748 -608
- package/dist/src/coordination/event-bus/qe-event-bus.test.js +454 -379
- package/dist/src/coordination/iteration-tracker.js +454 -363
- package/dist/src/index.js +384 -35
- package/dist/src/mcp/DEPRECATED.js +60 -46
- package/dist/src/mcp/fixes/mcp-error-fixes.js +134 -115
- package/dist/src/mcp/implementations/agent-tracker.js +128 -114
- package/dist/src/mcp/implementations/daa-tools.js +350 -292
- package/dist/src/mcp/implementations/workflow-tools.js +361 -329
- package/dist/src/mcp/mcp-config-manager.js +1331 -1183
- package/dist/src/mcp/mcp-server-novice-simplified.js +17 -11
- package/dist/src/mcp/mcp-server-novice.js +17 -11
- package/dist/src/mcp/mcp-server-sdk.js +17 -11
- package/dist/src/mcp/mcp-server.js +1484 -1620
- package/dist/src/mcp/ruv-swarm-wrapper.js +239 -209
- package/dist/src/memory/advanced-serializer.js +589 -609
- package/dist/src/memory/enhanced-examples.js +305 -220
- package/dist/src/memory/enhanced-memory.js +336 -295
- package/dist/src/memory/enhanced-session-serializer.js +492 -408
- package/dist/src/memory/fallback-memory-system.js +1021 -900
- package/dist/src/memory/fallback-store.js +131 -93
- package/dist/src/memory/high-performance-serialization.js +730 -592
- package/dist/src/memory/in-memory-store.js +213 -161
- package/dist/src/memory/index.js +157 -123
- package/dist/src/memory/lock-free-structures.js +764 -578
- package/dist/src/memory/memory-mapped-persistence.js +766 -585
- package/dist/src/memory/memory-pressure-manager.js +707 -569
- package/dist/src/memory/migration.js +445 -358
- package/dist/src/memory/shared-memory.js +768 -641
- package/dist/src/memory/sqlite-store.js +325 -245
- package/dist/src/memory/sqlite-wrapper.js +151 -122
- package/dist/src/memory/swarm-memory.js +603 -470
- package/dist/src/memory/test-example.js +134 -126
- package/dist/src/memory/ultra-fast-memory-store.js +821 -622
- package/dist/src/memory/unified-memory-manager.js +437 -356
- package/dist/src/swarm/CodeRefactoringSwarm.js +952 -777
- package/dist/src/utils/__tests__/github-cli-safety-wrapper.test.js +400 -332
- package/dist/src/utils/error-handler.js +2 -36
- package/dist/src/utils/github-cli-safe.js +64 -56
- package/dist/src/utils/github-cli-safety-wrapper.js +546 -451
- package/dist/src/utils/npx-isolated-cache.js +119 -104
- package/dist/src/utils/preference-manager.js +652 -622
- package/dist/src/utils/timezone-utils.js +105 -86
- package/dist/src/web/api/apm-routes.js +353 -0
- package/dist/src/web/api/config/api-config.js +184 -0
- package/dist/src/web/api/middleware/auth.js +203 -0
- package/dist/src/web/api/middleware/cache.js +273 -0
- package/dist/src/web/api/middleware/error-handler.js +257 -0
- package/dist/src/web/api/middleware/request-logger.js +215 -0
- package/dist/src/web/api/middleware/validation.js +323 -0
- package/dist/src/web/api/routes/events.js +463 -0
- package/dist/src/web/api/routes/hierarchy.js +300 -0
- package/dist/src/web/api/routes/index.js +12 -0
- package/dist/src/web/api/routes/metrics.js +559 -0
- package/dist/src/web/api/routes/parallel-status.js +359 -0
- package/dist/src/web/api/routes/status.js +448 -0
- package/dist/src/web/api/server.js +462 -0
- package/dist/src/web/dashboard/hooks/useWebSocket.js +383 -0
- package/dist/src/web/dashboard/index.js +85 -0
- package/dist/src/web/dashboard/realtime/CustomSyncManager.js +439 -0
- package/dist/src/web/dashboard/realtime/NativeWebSocketManager.js +323 -0
- package/dist/src/web/dashboard/realtime/PerformanceBenchmark.js +527 -0
- package/dist/src/web/dashboard/realtime/RealtimeCommunicationManager.js +474 -0
- package/dist/src/web/dashboard/realtime/RealtimeServer.js +666 -0
- package/dist/src/web/dashboard/realtime/SSEManager.js +426 -0
- package/dist/src/web/dashboard/types.js +4 -0
- package/dist/src/web/messaging/agent-status-tracker.js +453 -0
- package/dist/src/web/messaging/human-intervention-system.js +305 -0
- package/dist/src/web/messaging/message-filter.js +302 -0
- package/dist/src/web/messaging/swarm-message-router.js +324 -0
- package/dist/src/web/messaging/transparency-logger.js +421 -0
- package/dist/src/web/portal-server.js +460 -0
- package/dist/src/web/server.js +322 -0
- package/dist/src/web/websocket/apm-websocket-handler.js +453 -0
- package/dist/src/web/websocket/websocket-manager.js +780 -0
- package/package.json +5 -3
- package/dist/src/cli/minimal-main.js +0 -22
- package/dist/src/enterprise/analytics-manager.js +0 -1135
- package/dist/src/enterprise/audit-manager.js +0 -1115
- package/dist/src/enterprise/cloud-manager.js +0 -891
- package/dist/src/enterprise/deployment-manager.js +0 -966
- package/dist/src/enterprise/index.js +0 -6
- package/dist/src/enterprise/project-manager.js +0 -584
- package/dist/src/enterprise/security-manager.js +0 -991
- package/dist/src/migration/index.js +0 -92
- package/dist/src/migration/logger.js +0 -121
- package/dist/src/migration/migration-analyzer.js +0 -268
- package/dist/src/migration/migration-runner.js +0 -522
- package/dist/src/migration/migration-validator.js +0 -285
- package/dist/src/migration/progress-reporter.js +0 -150
- package/dist/src/migration/rollback-manager.js +0 -321
- package/dist/src/migration/tests/migration-system.test.js +0 -7
- package/dist/src/migration/types.js +0 -3
- package/dist/src/swarm/__tests__/integration.test.js +0 -227
- package/dist/src/swarm/__tests__/prompt-copier.test.js +0 -344
- package/dist/src/swarm/advanced-orchestrator.js +0 -1095
- package/dist/src/swarm/claude-code-interface.js +0 -961
- package/dist/src/swarm/claude-flow-executor.js +0 -229
- package/dist/src/swarm/consensus-coordinator.js +0 -475
- package/dist/src/swarm/coordinator.js +0 -2993
- package/dist/src/swarm/direct-executor.js +0 -1180
- package/dist/src/swarm/error-recovery/advanced-error-detection.js +0 -691
- package/dist/src/swarm/error-recovery/automated-recovery-workflows.js +0 -998
- package/dist/src/swarm/error-recovery/error-recovery-coordinator.js +0 -1197
- package/dist/src/swarm/error-recovery/recovery-monitoring.js +0 -772
- package/dist/src/swarm/error-recovery/resilience-architecture.js +0 -714
- package/dist/src/swarm/error-recovery/self-healing-mechanisms.js +0 -1319
- package/dist/src/swarm/error-recovery/test-error-recovery-effectiveness.js +0 -808
- package/dist/src/swarm/executor-v2.js +0 -322
- package/dist/src/swarm/executor.js +0 -815
- package/dist/src/swarm/hive-mind-integration.js +0 -703
- package/dist/src/swarm/index.js +0 -41
- package/dist/src/swarm/json-output-aggregator.js +0 -267
- package/dist/src/swarm/large-scale-coordinator.js +0 -542
- package/dist/src/swarm/mcp-integration-wrapper.js +0 -628
- package/dist/src/swarm/memory.js +0 -1117
- package/dist/src/swarm/optimizations/__tests__/optimization.test.js +0 -348
- package/dist/src/swarm/optimizations/async-file-manager.js +0 -285
- package/dist/src/swarm/optimizations/circular-buffer.js +0 -162
- package/dist/src/swarm/optimizations/connection-pool.js +0 -244
- package/dist/src/swarm/optimizations/index.js +0 -28
- package/dist/src/swarm/optimizations/optimized-executor.js +0 -320
- package/dist/src/swarm/optimizations/ttl-map.js +0 -234
- package/dist/src/swarm/prompt-cli.js +0 -200
- package/dist/src/swarm/prompt-copier-enhanced.js +0 -202
- package/dist/src/swarm/prompt-copier.js +0 -381
- package/dist/src/swarm/prompt-manager.js +0 -295
- package/dist/src/swarm/prompt-utils.js +0 -310
- package/dist/src/swarm/result-aggregator.js +0 -718
- package/dist/src/swarm/sparc-executor.js +0 -1568
- package/dist/src/swarm/strategies/auto.js +0 -758
- package/dist/src/swarm/strategies/base.js +0 -128
- package/dist/src/swarm/strategies/research.js +0 -914
- package/dist/src/swarm/strategies/strategy-metrics-patch.js +0 -2
- package/dist/src/swarm/types.js +0 -52
- package/dist/src/swarm/workers/copy-worker.js +0 -56
- package/dist/src/validators/epic-config-schema.js +0 -214
- package/dist/src/validators/index.js +0 -10
- package/dist/src/validators/swarm-init-validator.js +0 -259
- package/dist/src/validators/todowrite-batching-validator.js +0 -215
- package/dist/src/validators/todowrite-integration.js +0 -187
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/documentSymbols/browser/documentSymbols.js +0 -23
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +0 -57
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +0 -401
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +0 -181
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorContribution.js +0 -44
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +0 -157
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/dropOrPasteInto/browser/edit.js +0 -71
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/editorState/browser/editorState.js +0 -112
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findController.js +0 -990
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findDecorations.js +0 -296
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findModel.js +0 -488
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findOptionsWidget.js +0 -138
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findState.js +0 -243
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/find/browser/findWidget.js +0 -1177
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/folding.js +0 -1093
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +0 -133
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingModel.js +0 -538
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/folding/browser/foldingRanges.js +0 -351
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +0 -49
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/format.js +0 -360
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/formatActions.js +0 -263
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/format/browser/formattingEdit.js +0 -54
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.js +0 -149
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/hover/browser/contentHover.js +0 -874
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/inlineCompletions/browser/commandIds.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/inlineCompletions/browser/commands.js +0 -199
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/linesOperations/browser/copyLinesCommand.js +0 -70
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/quickAccess/browser/commandsQuickAccess.js +0 -26
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/quickAccess/browser/editorNavigationQuickAccess.js +0 -153
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +0 -33
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/semanticTokens/browser/documentSemanticTokens.js +0 -354
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/smartSelect/browser/bracketSelections.js +0 -146
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/suggest/browser/completionModel.js +0 -224
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +0 -119
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/edcore.main.js +0 -14
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.all.js +0 -63
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.api.js +0 -55
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.main.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/editor.worker.js +0 -25
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/editor/standalone/browser/colorizer.js +0 -118
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/language/css/css.worker.js +0 -36869
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/language/css/cssMode.js +0 -2035
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/browser/accessibilityService.js +0 -88
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/accessibility/common/accessibility.js +0 -9
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/action.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/action/common/actionCommonCategories.js +0 -13
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionList.js +0 -276
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/browser/actionWidget.js +0 -248
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actionWidget/common/actionWidget.js +0 -5
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/actions/common/actions.js +0 -409
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/audioCues/browser/audioCueService.js +0 -176
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/browser/clipboardService.js +0 -141
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/clipboard/common/clipboardService.js +0 -6
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/commands/common/commands.js +0 -80
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configuration.js +0 -86
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationModels.js +0 -554
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurationRegistry.js +0 -317
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/configuration/common/configurations.js +0 -41
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/browser/contextKeyService.js +0 -432
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkey.js +0 -1547
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextkey/common/contextkeys.js +0 -18
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuHandler.js +0 -124
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextMenuService.js +0 -101
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextView.js +0 -7
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/contextview/browser/contextViewService.js +0 -72
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dialogs/common/dialogs.js +0 -2
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/dnd/browser/dnd.js +0 -36
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/editor/common/editor.js +0 -17
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/environment/common/environment.js +0 -2
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/extensions/common/extensions.js +0 -47
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/files/common/files.js +0 -9
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +0 -105
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/descriptors.js +0 -11
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/instantiation/common/extensions.js +0 -15
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/abstractKeybindingService.js +0 -277
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/keybinding/common/baseResolvedKeybinding.js +0 -53
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +0 -354
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/browser/defaultStyles.js +0 -162
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/esm/vs/platform/theme/common/colorRegistry.js +0 -482
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/abap/abap.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/apex/apex.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/azcli/azcli.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bat/bat.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/bicep/bicep.js +0 -11
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cameligo/cameligo.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/clojure/clojure.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/coffee/coffee.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cpp/cpp.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/csharp/csharp.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/csp/csp.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/css/css.js +0 -12
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/cypher/cypher.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/dart/dart.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/dockerfile/dockerfile.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/ecl/ecl.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/elixir/elixir.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/basic-languages/flow9/flow9.js +0 -10
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.js +0 -745
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.de.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.es.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.fr.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.it.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ja.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ko.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.ru.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.zh-cn.js +0 -31
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/editor/editor.main.nls.zh-tw.js +0 -29
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/language/css/cssMode.js +0 -13
- package/dist/src/web/frontend/node_modules/.monaco-editor-MndU045b/min/vs/language/css/cssWorker.js +0 -81
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/cli.js +0 -64
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/example.js +0 -36
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/index.js +0 -205
- package/dist/src/web/frontend/node_modules/.multicast-dns-iKseM9bB/test.js +0 -260
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.browser.js +0 -34
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.js +0 -35
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/async/index.native.js +0 -26
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/index.browser.js +0 -34
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/index.js +0 -45
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/nanoid.js +0 -1
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/non-secure/index.js +0 -21
- package/dist/src/web/frontend/node_modules/.nanoid-PAMEV9Hd/url-alphabet/index.js +0 -3
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/bin/nodemon.js +0 -16
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/cli/index.js +0 -49
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/cli/parse.js +0 -230
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/command.js +0 -43
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/defaults.js +0 -34
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/exec.js +0 -234
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/index.js +0 -93
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/config/load.js +0 -225
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/help/index.js +0 -27
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/index.js +0 -1
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/index.js +0 -4
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/match.js +0 -287
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/run.js +0 -562
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/signals.js +0 -34
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/monitor/watch.js +0 -244
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/nodemon.js +0 -317
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/add.js +0 -89
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/index.js +0 -53
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/rules/parse.js +0 -43
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/spawn.js +0 -74
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/bus.js +0 -44
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/clone.js +0 -40
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/colour.js +0 -26
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/index.js +0 -103
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/log.js +0 -82
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/utils/merge.js +0 -47
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/lib/version.js +0 -100
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/brace-expansion/index.js +0 -201
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/has-flag/index.js +0 -8
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/minimatch/minimatch.js +0 -947
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/supports-color/browser.js +0 -5
- package/dist/src/web/frontend/node_modules/.nodemon-QcvNKhKT/node_modules/supports-color/index.js +0 -131
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/bin/pidtree.js +0 -128
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/index.js +0 -49
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/bin.js +0 -61
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/get.js +0 -45
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/pidtree.js +0 -104
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/ps.js +0 -47
- package/dist/src/web/frontend/node_modules/.pidtree-icfat3SQ/lib/wmic.js +0 -49
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/doc.js +0 -1270
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/acorn.js +0 -15
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/angular.js +0 -2
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/babel.js +0 -15
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/estree.js +0 -36
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/flow.js +0 -19
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/glimmer.js +0 -29
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/graphql.js +0 -29
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/html.js +0 -22
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/markdown.js +0 -63
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/meriyah.js +0 -4
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/postcss.js +0 -54
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/typescript.js +0 -20
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/plugins/yaml.js +0 -160
- package/dist/src/web/frontend/node_modules/.prettier-ApZm3b7s/standalone.js +0 -34
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/bin/react-scripts.js +0 -58
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/env.js +0 -112
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/getHttpsConfig.js +0 -74
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/babelTransform.js +0 -37
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/cssTransform.js +0 -22
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/jest/fileTransform.js +0 -40
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/modules.js +0 -142
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/paths.js +0 -153
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpack/persistentCache/createEnvironmentHash.js +0 -9
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpack.config.js +0 -796
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/config/webpackDevServer.config.js +0 -135
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/scripts/build.js +0 -225
- package/dist/src/web/frontend/node_modules/.react-scripts-OTANyoRb/scripts/eject.js +0 -340
|
@@ -1,1129 +1,1269 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
printSuccess,
|
|
3
|
+
printError,
|
|
4
|
+
printWarning,
|
|
5
|
+
execRuvSwarmHook,
|
|
6
|
+
checkRuvSwarmAvailable,
|
|
7
|
+
} from '../utils.js';
|
|
8
|
+
import { SqliteMemoryStore } from '../../memory/sqlite-store.js';
|
|
9
|
+
import { executeSessionStartSoulHook, executeSessionEndSoulHook } from './hooks/session-start-soul.js';
|
|
10
|
+
import { enhancedPostEditHook } from '../../hooks/enhanced-post-edit-pipeline.js';
|
|
11
|
+
|
|
4
12
|
// Initialize memory store
|
|
5
13
|
let memoryStore = null;
|
|
14
|
+
|
|
6
15
|
async function getMemoryStore() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
16
|
+
if (!memoryStore) {
|
|
17
|
+
memoryStore = new SqliteMemoryStore();
|
|
18
|
+
await memoryStore.initialize();
|
|
19
|
+
}
|
|
20
|
+
return memoryStore;
|
|
12
21
|
}
|
|
22
|
+
|
|
13
23
|
// Simple ID generator
|
|
14
24
|
function generateId(prefix = 'id') {
|
|
15
|
-
|
|
25
|
+
return `${prefix}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
16
26
|
}
|
|
27
|
+
|
|
17
28
|
export async function hooksAction(subArgs, flags) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
29
|
+
const subcommand = subArgs[0];
|
|
30
|
+
const options = flags;
|
|
31
|
+
|
|
32
|
+
if (options.help || options.h || !subcommand) {
|
|
33
|
+
showHooksHelp();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
switch (subcommand) {
|
|
39
|
+
// Pre-Operation Hooks
|
|
40
|
+
case 'pre-task':
|
|
41
|
+
await preTaskCommand(subArgs, flags);
|
|
42
|
+
break;
|
|
43
|
+
case 'pre-edit':
|
|
44
|
+
await preEditCommand(subArgs, flags);
|
|
45
|
+
break;
|
|
46
|
+
case 'pre-bash':
|
|
47
|
+
case 'pre-command': // Support both names for compatibility
|
|
48
|
+
await preBashCommand(subArgs, flags);
|
|
49
|
+
break;
|
|
50
|
+
|
|
51
|
+
// Post-Operation Hooks
|
|
52
|
+
case 'post-task':
|
|
53
|
+
await postTaskCommand(subArgs, flags);
|
|
54
|
+
break;
|
|
55
|
+
case 'post-edit':
|
|
56
|
+
await postEditCommand(subArgs, flags);
|
|
57
|
+
break;
|
|
58
|
+
case 'post-bash':
|
|
59
|
+
case 'post-command': // Support both names for compatibility
|
|
60
|
+
await postBashCommand(subArgs, flags);
|
|
61
|
+
break;
|
|
62
|
+
case 'post-search':
|
|
63
|
+
await postSearchCommand(subArgs, flags);
|
|
64
|
+
break;
|
|
65
|
+
|
|
66
|
+
// MCP Integration Hooks
|
|
67
|
+
case 'mcp-initialized':
|
|
68
|
+
await mcpInitializedCommand(subArgs, flags);
|
|
69
|
+
break;
|
|
70
|
+
case 'agent-spawned':
|
|
71
|
+
await agentSpawnedCommand(subArgs, flags);
|
|
72
|
+
break;
|
|
73
|
+
case 'task-orchestrated':
|
|
74
|
+
await taskOrchestratedCommand(subArgs, flags);
|
|
75
|
+
break;
|
|
76
|
+
case 'neural-trained':
|
|
77
|
+
await neuralTrainedCommand(subArgs, flags);
|
|
78
|
+
break;
|
|
79
|
+
|
|
80
|
+
// Session Hooks
|
|
81
|
+
case 'session-start':
|
|
82
|
+
await sessionStartCommand(subArgs, flags);
|
|
83
|
+
break;
|
|
84
|
+
case 'session-end':
|
|
85
|
+
await sessionEndCommand(subArgs, flags);
|
|
86
|
+
break;
|
|
87
|
+
case 'session-restore':
|
|
88
|
+
await sessionRestoreCommand(subArgs, flags);
|
|
89
|
+
break;
|
|
90
|
+
case 'notify':
|
|
91
|
+
await notifyCommand(subArgs, flags);
|
|
92
|
+
break;
|
|
93
|
+
|
|
94
|
+
default:
|
|
95
|
+
printError(`Unknown hooks command: ${subcommand}`);
|
|
21
96
|
showHooksHelp();
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
switch(subcommand){
|
|
26
|
-
// Pre-Operation Hooks
|
|
27
|
-
case 'pre-task':
|
|
28
|
-
await preTaskCommand(subArgs, flags);
|
|
29
|
-
break;
|
|
30
|
-
case 'pre-edit':
|
|
31
|
-
await preEditCommand(subArgs, flags);
|
|
32
|
-
break;
|
|
33
|
-
case 'pre-bash':
|
|
34
|
-
case 'pre-command':
|
|
35
|
-
await preBashCommand(subArgs, flags);
|
|
36
|
-
break;
|
|
37
|
-
// Post-Operation Hooks
|
|
38
|
-
case 'post-task':
|
|
39
|
-
await postTaskCommand(subArgs, flags);
|
|
40
|
-
break;
|
|
41
|
-
case 'post-edit':
|
|
42
|
-
await postEditCommand(subArgs, flags);
|
|
43
|
-
break;
|
|
44
|
-
case 'post-bash':
|
|
45
|
-
case 'post-command':
|
|
46
|
-
await postBashCommand(subArgs, flags);
|
|
47
|
-
break;
|
|
48
|
-
case 'post-search':
|
|
49
|
-
await postSearchCommand(subArgs, flags);
|
|
50
|
-
break;
|
|
51
|
-
// MCP Integration Hooks
|
|
52
|
-
case 'mcp-initialized':
|
|
53
|
-
await mcpInitializedCommand(subArgs, flags);
|
|
54
|
-
break;
|
|
55
|
-
case 'agent-spawned':
|
|
56
|
-
await agentSpawnedCommand(subArgs, flags);
|
|
57
|
-
break;
|
|
58
|
-
case 'task-orchestrated':
|
|
59
|
-
await taskOrchestratedCommand(subArgs, flags);
|
|
60
|
-
break;
|
|
61
|
-
case 'neural-trained':
|
|
62
|
-
await neuralTrainedCommand(subArgs, flags);
|
|
63
|
-
break;
|
|
64
|
-
// Session Hooks
|
|
65
|
-
case 'session-start':
|
|
66
|
-
await sessionStartCommand(subArgs, flags);
|
|
67
|
-
break;
|
|
68
|
-
case 'session-end':
|
|
69
|
-
await sessionEndCommand(subArgs, flags);
|
|
70
|
-
break;
|
|
71
|
-
case 'session-restore':
|
|
72
|
-
await sessionRestoreCommand(subArgs, flags);
|
|
73
|
-
break;
|
|
74
|
-
case 'notify':
|
|
75
|
-
await notifyCommand(subArgs, flags);
|
|
76
|
-
break;
|
|
77
|
-
default:
|
|
78
|
-
printError(`Unknown hooks command: ${subcommand}`);
|
|
79
|
-
showHooksHelp();
|
|
80
|
-
}
|
|
81
|
-
} catch (err) {
|
|
82
|
-
printError(`Hooks command failed: ${err.message}`);
|
|
83
97
|
}
|
|
98
|
+
} catch (err) {
|
|
99
|
+
printError(`Hooks command failed: ${err.message}`);
|
|
100
|
+
}
|
|
84
101
|
}
|
|
102
|
+
|
|
85
103
|
// ===== PRE-OPERATION HOOKS =====
|
|
104
|
+
|
|
86
105
|
async function preTaskCommand(subArgs, flags) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
106
|
+
const options = flags;
|
|
107
|
+
const description = options.description || 'Unnamed task';
|
|
108
|
+
const taskId = options['task-id'] || options.taskId || generateId('task');
|
|
109
|
+
const agentId = options['agent-id'] || options.agentId;
|
|
110
|
+
const autoSpawnAgents = options['auto-spawn-agents'] !== 'false';
|
|
111
|
+
|
|
112
|
+
console.log(`🔄 Executing pre-task hook...`);
|
|
113
|
+
console.log(`📋 Task: ${description}`);
|
|
114
|
+
console.log(`🆔 Task ID: ${taskId}`);
|
|
115
|
+
if (agentId) console.log(`🤖 Agent: ${agentId}`);
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
const store = await getMemoryStore();
|
|
119
|
+
const taskData = {
|
|
120
|
+
taskId,
|
|
121
|
+
description,
|
|
122
|
+
agentId,
|
|
123
|
+
autoSpawnAgents,
|
|
124
|
+
status: 'started',
|
|
125
|
+
startedAt: new Date().toISOString(),
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
await store.store(`task:${taskId}`, taskData, {
|
|
129
|
+
namespace: 'hooks:pre-task',
|
|
130
|
+
metadata: { hookType: 'pre-task', agentId },
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
await store.store(
|
|
134
|
+
`task-index:${Date.now()}`,
|
|
135
|
+
{
|
|
136
|
+
taskId,
|
|
137
|
+
description,
|
|
138
|
+
timestamp: new Date().toISOString(),
|
|
139
|
+
},
|
|
140
|
+
{ namespace: 'task-index' },
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
console.log(` 💾 Saved to .swarm/memory.db`);
|
|
144
|
+
|
|
145
|
+
// Execute ruv-swarm hook if available (with timeout for npx scenarios)
|
|
96
146
|
try {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
await
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
await store.store(`task-index:${Date.now()}`, {
|
|
114
|
-
taskId,
|
|
115
|
-
description,
|
|
116
|
-
timestamp: new Date().toISOString()
|
|
117
|
-
}, {
|
|
118
|
-
namespace: 'task-index'
|
|
147
|
+
const checkPromise = checkRuvSwarmAvailable();
|
|
148
|
+
const timeoutPromise = new Promise((_, reject) =>
|
|
149
|
+
setTimeout(() => reject(new Error('Timeout')), 3000),
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
const isAvailable = await Promise.race([checkPromise, timeoutPromise]);
|
|
153
|
+
|
|
154
|
+
if (isAvailable) {
|
|
155
|
+
console.log(`\n🔄 Executing ruv-swarm pre-task hook...`);
|
|
156
|
+
const hookResult = await execRuvSwarmHook('pre-task', {
|
|
157
|
+
description,
|
|
158
|
+
'task-id': taskId,
|
|
159
|
+
'auto-spawn-agents': autoSpawnAgents,
|
|
160
|
+
...(agentId ? { 'agent-id': agentId } : {}),
|
|
119
161
|
});
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
description,
|
|
133
|
-
'task-id': taskId,
|
|
134
|
-
'auto-spawn-agents': autoSpawnAgents,
|
|
135
|
-
...agentId ? {
|
|
136
|
-
'agent-id': agentId
|
|
137
|
-
} : {}
|
|
138
|
-
});
|
|
139
|
-
if (hookResult.success) {
|
|
140
|
-
await store.store(`task:${taskId}:ruv-output`, {
|
|
141
|
-
output: hookResult.output,
|
|
142
|
-
timestamp: new Date().toISOString()
|
|
143
|
-
}, {
|
|
144
|
-
namespace: 'hooks:ruv-swarm'
|
|
145
|
-
});
|
|
146
|
-
printSuccess(`✅ Pre-task hook completed successfully`);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
} catch (err) {
|
|
150
|
-
// Skip ruv-swarm hook if it times out or fails
|
|
151
|
-
console.log(`\n⚠️ Skipping ruv-swarm hook (${err.message})`);
|
|
162
|
+
|
|
163
|
+
if (hookResult.success) {
|
|
164
|
+
await store.store(
|
|
165
|
+
`task:${taskId}:ruv-output`,
|
|
166
|
+
{
|
|
167
|
+
output: hookResult.output,
|
|
168
|
+
timestamp: new Date().toISOString(),
|
|
169
|
+
},
|
|
170
|
+
{ namespace: 'hooks:ruv-swarm' },
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
printSuccess(`✅ Pre-task hook completed successfully`);
|
|
152
174
|
}
|
|
153
|
-
|
|
154
|
-
// Close the memory store to prevent hanging
|
|
155
|
-
if (memoryStore && memoryStore.close) {
|
|
156
|
-
memoryStore.close();
|
|
157
|
-
}
|
|
158
|
-
// Force exit after a short delay to ensure cleanup
|
|
159
|
-
setTimeout(()=>{
|
|
160
|
-
process.exit(0);
|
|
161
|
-
}, 100);
|
|
175
|
+
}
|
|
162
176
|
} catch (err) {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
177
|
+
// Skip ruv-swarm hook if it times out or fails
|
|
178
|
+
console.log(`\n⚠️ Skipping ruv-swarm hook (${err.message})`);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
console.log(`\n🎯 TASK PREPARATION COMPLETE`);
|
|
182
|
+
|
|
183
|
+
// Close the memory store to prevent hanging
|
|
184
|
+
if (memoryStore && memoryStore.close) {
|
|
185
|
+
memoryStore.close();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Force exit after a short delay to ensure cleanup
|
|
189
|
+
setTimeout(() => {
|
|
190
|
+
process.exit(0);
|
|
191
|
+
}, 100);
|
|
192
|
+
} catch (err) {
|
|
193
|
+
printError(`Pre-task hook failed: ${err.message}`);
|
|
194
|
+
|
|
195
|
+
// Close the memory store on error too
|
|
196
|
+
if (memoryStore && memoryStore.close) {
|
|
197
|
+
memoryStore.close();
|
|
172
198
|
}
|
|
199
|
+
|
|
200
|
+
// Force exit after a short delay to ensure cleanup
|
|
201
|
+
setTimeout(() => {
|
|
202
|
+
process.exit(1);
|
|
203
|
+
}, 100);
|
|
204
|
+
}
|
|
173
205
|
}
|
|
206
|
+
|
|
174
207
|
async function preEditCommand(subArgs, flags) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
timestamp: new Date().toISOString(),
|
|
263
|
-
editId: generateId('edit'),
|
|
264
|
-
autoAssignAgents,
|
|
265
|
-
loadContext,
|
|
266
|
-
assignedAgentType,
|
|
267
|
-
recommendedAgent,
|
|
268
|
-
contextData
|
|
269
|
-
};
|
|
270
|
-
await store.store(`edit:${editData.editId}:pre`, editData, {
|
|
271
|
-
namespace: 'hooks:pre-edit',
|
|
272
|
-
metadata: {
|
|
273
|
-
hookType: 'pre-edit',
|
|
274
|
-
file,
|
|
275
|
-
agentType: assignedAgentType
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
// Store agent recommendation if enabled
|
|
279
|
-
if (autoAssignAgents && recommendedAgent) {
|
|
280
|
-
await store.store(`agent-recommendation:${file}`, recommendedAgent, {
|
|
281
|
-
namespace: 'agent-assignments',
|
|
282
|
-
ttl: 3600
|
|
283
|
-
});
|
|
208
|
+
const options = flags;
|
|
209
|
+
const file = options.file || 'unknown-file';
|
|
210
|
+
const operation = options.operation || 'edit';
|
|
211
|
+
const autoAssignAgents = options['auto-assign-agents'] || false;
|
|
212
|
+
const loadContext = options['load-context'] || false;
|
|
213
|
+
|
|
214
|
+
console.log(`📝 Executing pre-edit hook...`);
|
|
215
|
+
console.log(`📄 File: ${file}`);
|
|
216
|
+
console.log(`⚙️ Operation: ${operation}`);
|
|
217
|
+
if (autoAssignAgents) console.log(`🤖 Auto-assign agents: ENABLED`);
|
|
218
|
+
if (loadContext) console.log(`🔄 Load context: ENABLED`);
|
|
219
|
+
|
|
220
|
+
try {
|
|
221
|
+
const store = await getMemoryStore();
|
|
222
|
+
|
|
223
|
+
// Auto-assign agents based on file type
|
|
224
|
+
let assignedAgentType = 'general';
|
|
225
|
+
let recommendedAgent = null;
|
|
226
|
+
|
|
227
|
+
if (autoAssignAgents) {
|
|
228
|
+
const path = await import('path');
|
|
229
|
+
const ext = path.extname(file).toLowerCase();
|
|
230
|
+
|
|
231
|
+
const agentMapping = {
|
|
232
|
+
'.js': 'javascript-developer',
|
|
233
|
+
'.ts': 'typescript-developer',
|
|
234
|
+
'.py': 'python-developer',
|
|
235
|
+
'.go': 'golang-developer',
|
|
236
|
+
'.rs': 'rust-developer',
|
|
237
|
+
'.java': 'java-developer',
|
|
238
|
+
'.cpp': 'cpp-developer',
|
|
239
|
+
'.c': 'c-developer',
|
|
240
|
+
'.css': 'frontend-developer',
|
|
241
|
+
'.html': 'frontend-developer',
|
|
242
|
+
'.vue': 'frontend-developer',
|
|
243
|
+
'.react': 'frontend-developer',
|
|
244
|
+
'.md': 'technical-writer',
|
|
245
|
+
'.yml': 'devops-engineer',
|
|
246
|
+
'.yaml': 'devops-engineer',
|
|
247
|
+
'.json': 'config-specialist',
|
|
248
|
+
'.sql': 'database-expert',
|
|
249
|
+
'.sh': 'system-admin',
|
|
250
|
+
'.dockerfile': 'devops-engineer',
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
assignedAgentType = agentMapping[ext] || 'general-developer';
|
|
254
|
+
recommendedAgent = {
|
|
255
|
+
type: assignedAgentType,
|
|
256
|
+
file: file,
|
|
257
|
+
extension: ext,
|
|
258
|
+
recommended: true,
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
console.log(` 🤖 Recommended agent: ${assignedAgentType}`);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Load context if requested
|
|
265
|
+
let contextData = null;
|
|
266
|
+
if (loadContext) {
|
|
267
|
+
try {
|
|
268
|
+
// Check if file exists and get basic info
|
|
269
|
+
const fs = await import('fs');
|
|
270
|
+
const path = await import('path');
|
|
271
|
+
|
|
272
|
+
if (fs.existsSync(file)) {
|
|
273
|
+
const stats = fs.statSync(file);
|
|
274
|
+
const dirname = path.dirname(file);
|
|
275
|
+
const basename = path.basename(file);
|
|
276
|
+
|
|
277
|
+
contextData = {
|
|
278
|
+
fileExists: true,
|
|
279
|
+
size: stats.size,
|
|
280
|
+
modified: stats.mtime,
|
|
281
|
+
directory: dirname,
|
|
282
|
+
filename: basename,
|
|
283
|
+
isDirectory: stats.isDirectory(),
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
console.log(` 📁 Context loaded: ${basename} (${stats.size} bytes)`);
|
|
287
|
+
} else {
|
|
288
|
+
contextData = {
|
|
289
|
+
fileExists: false,
|
|
290
|
+
willCreate: true,
|
|
291
|
+
directory: path.dirname(file),
|
|
292
|
+
filename: path.basename(file),
|
|
293
|
+
};
|
|
294
|
+
console.log(` 📁 Context: New file will be created`);
|
|
284
295
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
296
|
+
} catch (err) {
|
|
297
|
+
console.log(` ⚠️ Warning: Could not load context for ${file}`);
|
|
298
|
+
contextData = { error: err.message };
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const editData = {
|
|
303
|
+
file,
|
|
304
|
+
operation,
|
|
305
|
+
timestamp: new Date().toISOString(),
|
|
306
|
+
editId: generateId('edit'),
|
|
307
|
+
autoAssignAgents,
|
|
308
|
+
loadContext,
|
|
309
|
+
assignedAgentType,
|
|
310
|
+
recommendedAgent,
|
|
311
|
+
contextData,
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
await store.store(`edit:${editData.editId}:pre`, editData, {
|
|
315
|
+
namespace: 'hooks:pre-edit',
|
|
316
|
+
metadata: { hookType: 'pre-edit', file, agentType: assignedAgentType },
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
// Store agent recommendation if enabled
|
|
320
|
+
if (autoAssignAgents && recommendedAgent) {
|
|
321
|
+
await store.store(`agent-recommendation:${file}`, recommendedAgent, {
|
|
322
|
+
namespace: 'agent-assignments',
|
|
323
|
+
ttl: 3600, // 1 hour
|
|
324
|
+
});
|
|
289
325
|
}
|
|
326
|
+
|
|
327
|
+
console.log(` 💾 Pre-edit state saved to .swarm/memory.db`);
|
|
328
|
+
printSuccess(`✅ Pre-edit hook completed`);
|
|
329
|
+
} catch (err) {
|
|
330
|
+
printError(`Pre-edit hook failed: ${err.message}`);
|
|
331
|
+
}
|
|
290
332
|
}
|
|
333
|
+
|
|
291
334
|
async function preBashCommand(subArgs, flags) {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
console.log(` 💾 Command logged to .swarm/memory.db`);
|
|
365
|
-
console.log(` 🔒 Safety check: ${safetyResult.toUpperCase()}`);
|
|
366
|
-
printSuccess(`✅ Pre-bash hook completed`);
|
|
367
|
-
} catch (err) {
|
|
368
|
-
printError(`Pre-bash hook failed: ${err.message}`);
|
|
335
|
+
const options = flags;
|
|
336
|
+
const command = options.command || subArgs.slice(1).join(' ') || '';
|
|
337
|
+
const workingDir = options.cwd || process.cwd();
|
|
338
|
+
const validateSafety =
|
|
339
|
+
options['validate-safety'] === true ||
|
|
340
|
+
options['validate-safety'] === 'true' ||
|
|
341
|
+
options.validate === true ||
|
|
342
|
+
options.validate === 'true' ||
|
|
343
|
+
false;
|
|
344
|
+
const prepareResources =
|
|
345
|
+
options['prepare-resources'] === true || options['prepare-resources'] === 'true' || false;
|
|
346
|
+
|
|
347
|
+
console.log(`🔧 Executing pre-bash hook...`);
|
|
348
|
+
console.log(`📜 Command: ${command}`);
|
|
349
|
+
console.log(`📁 Working dir: ${workingDir}`);
|
|
350
|
+
if (validateSafety) console.log(`🔒 Safety validation: ENABLED`);
|
|
351
|
+
if (prepareResources) console.log(`🛠️ Resource preparation: ENABLED`);
|
|
352
|
+
|
|
353
|
+
try {
|
|
354
|
+
const store = await getMemoryStore();
|
|
355
|
+
let safetyResult = 'skipped';
|
|
356
|
+
|
|
357
|
+
if (validateSafety) {
|
|
358
|
+
// Basic safety validation
|
|
359
|
+
const dangerousCommands = [
|
|
360
|
+
'rm -rf /',
|
|
361
|
+
'rm -rf .',
|
|
362
|
+
'rm -rf *',
|
|
363
|
+
'format',
|
|
364
|
+
'fdisk',
|
|
365
|
+
'mkfs',
|
|
366
|
+
'curl * | bash',
|
|
367
|
+
'wget * | sh',
|
|
368
|
+
'eval',
|
|
369
|
+
'exec',
|
|
370
|
+
'chmod 777',
|
|
371
|
+
];
|
|
372
|
+
|
|
373
|
+
const isDangerous =
|
|
374
|
+
command && typeof command === 'string' && command.length > 0
|
|
375
|
+
? dangerousCommands.some((dangerous) =>
|
|
376
|
+
command.toLowerCase().includes(dangerous.toLowerCase()),
|
|
377
|
+
)
|
|
378
|
+
: false;
|
|
379
|
+
|
|
380
|
+
safetyResult = isDangerous ? 'dangerous' : 'safe';
|
|
381
|
+
|
|
382
|
+
if (isDangerous) {
|
|
383
|
+
console.log(` ⚠️ Safety check: DANGEROUS COMMAND DETECTED`);
|
|
384
|
+
console.log(` 🚫 Command blocked for safety`);
|
|
385
|
+
printError(`Command blocked due to safety validation: ${command}`);
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
if (prepareResources) {
|
|
391
|
+
// Resource preparation - create working directory if needed
|
|
392
|
+
const fs = await import('fs');
|
|
393
|
+
const path = await import('path');
|
|
394
|
+
|
|
395
|
+
if (!fs.existsSync(workingDir)) {
|
|
396
|
+
fs.mkdirSync(workingDir, { recursive: true });
|
|
397
|
+
console.log(` 📁 Created working directory: ${workingDir}`);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// Check available disk space
|
|
401
|
+
try {
|
|
402
|
+
const stats = fs.statSync(workingDir);
|
|
403
|
+
console.log(` 💾 Working directory prepared`);
|
|
404
|
+
} catch (err) {
|
|
405
|
+
console.log(` ⚠️ Warning: Could not check working directory`);
|
|
406
|
+
}
|
|
369
407
|
}
|
|
408
|
+
|
|
409
|
+
const bashData = {
|
|
410
|
+
command,
|
|
411
|
+
workingDir,
|
|
412
|
+
timestamp: new Date().toISOString(),
|
|
413
|
+
bashId: generateId('bash'),
|
|
414
|
+
safety: safetyResult,
|
|
415
|
+
validationEnabled: validateSafety,
|
|
416
|
+
resourcesPrepped: prepareResources,
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
await store.store(`bash:${bashData.bashId}:pre`, bashData, {
|
|
420
|
+
namespace: 'hooks:pre-bash',
|
|
421
|
+
metadata: { hookType: 'pre-bash', command, safety: safetyResult },
|
|
422
|
+
});
|
|
423
|
+
|
|
424
|
+
console.log(` 💾 Command logged to .swarm/memory.db`);
|
|
425
|
+
console.log(` 🔒 Safety check: ${safetyResult.toUpperCase()}`);
|
|
426
|
+
printSuccess(`✅ Pre-bash hook completed`);
|
|
427
|
+
} catch (err) {
|
|
428
|
+
printError(`Pre-bash hook failed: ${err.message}`);
|
|
429
|
+
}
|
|
370
430
|
}
|
|
431
|
+
|
|
371
432
|
// ===== POST-OPERATION HOOKS =====
|
|
433
|
+
|
|
372
434
|
async function postTaskCommand(subArgs, flags) {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
printError(`Post-task hook failed: ${err.message}`);
|
|
435
|
+
const options = flags;
|
|
436
|
+
const taskId = options['task-id'] || options.taskId || generateId('task');
|
|
437
|
+
const analyzePerformance = options['analyze-performance'] !== 'false';
|
|
438
|
+
|
|
439
|
+
console.log(`🏁 Executing post-task hook...`);
|
|
440
|
+
console.log(`🆔 Task ID: ${taskId}`);
|
|
441
|
+
|
|
442
|
+
try {
|
|
443
|
+
const store = await getMemoryStore();
|
|
444
|
+
const taskData = await store.retrieve(`task:${taskId}`, {
|
|
445
|
+
namespace: 'hooks:pre-task',
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
const completedData = {
|
|
449
|
+
...(taskData || {}),
|
|
450
|
+
status: 'completed',
|
|
451
|
+
completedAt: new Date().toISOString(),
|
|
452
|
+
duration: taskData ? Date.now() - new Date(taskData.startedAt).getTime() : null,
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
await store.store(`task:${taskId}:completed`, completedData, {
|
|
456
|
+
namespace: 'hooks:post-task',
|
|
457
|
+
metadata: { hookType: 'post-task' },
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
if (analyzePerformance && completedData.duration) {
|
|
461
|
+
const metrics = {
|
|
462
|
+
taskId,
|
|
463
|
+
duration: completedData.duration,
|
|
464
|
+
durationHuman: `${(completedData.duration / 1000).toFixed(2)}s`,
|
|
465
|
+
timestamp: new Date().toISOString(),
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
await store.store(`metrics:${taskId}`, metrics, {
|
|
469
|
+
namespace: 'performance',
|
|
470
|
+
});
|
|
471
|
+
console.log(` 📊 Performance: ${metrics.durationHuman}`);
|
|
411
472
|
}
|
|
473
|
+
|
|
474
|
+
console.log(` 💾 Task completion saved to .swarm/memory.db`);
|
|
475
|
+
printSuccess(`✅ Post-task hook completed`);
|
|
476
|
+
} catch (err) {
|
|
477
|
+
printError(`Post-task hook failed: ${err.message}`);
|
|
478
|
+
}
|
|
412
479
|
}
|
|
480
|
+
|
|
413
481
|
async function postEditCommand(subArgs, flags) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
reason: 'No formatter available'
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
}
|
|
472
|
-
// Update memory with edit context
|
|
473
|
-
let memoryUpdate = null;
|
|
474
|
-
if (updateMemory) {
|
|
475
|
-
const editContext = {
|
|
476
|
-
file,
|
|
477
|
-
editedAt: new Date().toISOString(),
|
|
478
|
-
editId: generateId('edit'),
|
|
479
|
-
formatted: formatResult?.attempted || false,
|
|
480
|
-
fileSize: fs.existsSync(file) ? fs.statSync(file).size : 0,
|
|
481
|
-
directory: path.dirname(file),
|
|
482
|
-
basename: path.basename(file)
|
|
483
|
-
};
|
|
484
|
-
memoryUpdate = editContext;
|
|
485
|
-
// Store in coordination namespace
|
|
486
|
-
await store.store(`edit-context:${editContext.editId}`, editContext, {
|
|
487
|
-
namespace: 'coordination',
|
|
488
|
-
metadata: {
|
|
489
|
-
type: 'edit-context',
|
|
490
|
-
file
|
|
491
|
-
}
|
|
492
|
-
});
|
|
493
|
-
console.log(` 🧠 Edit context stored in memory`);
|
|
494
|
-
}
|
|
495
|
-
// Train neural patterns if requested
|
|
496
|
-
let neuralTraining = null;
|
|
497
|
-
if (trainNeural) {
|
|
498
|
-
// Simulate neural training with file patterns
|
|
499
|
-
const ext = path.extname(file).toLowerCase();
|
|
500
|
-
const basename = path.basename(file);
|
|
501
|
-
const editTime = new Date().toISOString();
|
|
502
|
-
const patterns = {
|
|
503
|
-
fileType: ext,
|
|
504
|
-
fileName: basename,
|
|
505
|
-
editTime,
|
|
506
|
-
confidence: Math.random() * 0.5 + 0.5,
|
|
507
|
-
patterns: [
|
|
508
|
-
`${ext}_edit_pattern`,
|
|
509
|
-
`${basename}_modification`,
|
|
510
|
-
`edit_${Date.now()}_sequence`
|
|
511
|
-
]
|
|
512
|
-
};
|
|
513
|
-
neuralTraining = patterns;
|
|
514
|
-
await store.store(`neural-pattern:${generateId('pattern')}`, patterns, {
|
|
515
|
-
namespace: 'neural-training',
|
|
516
|
-
metadata: {
|
|
517
|
-
type: 'edit-pattern',
|
|
518
|
-
file,
|
|
519
|
-
extension: ext
|
|
520
|
-
}
|
|
521
|
-
});
|
|
522
|
-
console.log(` 🤖 Neural patterns trained (${(patterns.confidence * 100).toFixed(1)}% confidence)`);
|
|
523
|
-
}
|
|
524
|
-
const editData = {
|
|
525
|
-
file,
|
|
526
|
-
memoryKey,
|
|
527
|
-
timestamp: new Date().toISOString(),
|
|
528
|
-
editId: generateId('edit'),
|
|
529
|
-
format,
|
|
530
|
-
updateMemory,
|
|
531
|
-
trainNeural,
|
|
532
|
-
formatResult,
|
|
533
|
-
memoryUpdate,
|
|
534
|
-
neuralTraining
|
|
482
|
+
const options = flags;
|
|
483
|
+
const file = options.file || 'unknown-file';
|
|
484
|
+
let memoryKey = options['memory-key'] || options.memoryKey;
|
|
485
|
+
|
|
486
|
+
// Handle case where memory-key is passed as a boolean flag without value
|
|
487
|
+
if (memoryKey === true) {
|
|
488
|
+
// Generate a default memory key based on the file path and timestamp
|
|
489
|
+
const path = await import('path');
|
|
490
|
+
const basename = path.basename(file);
|
|
491
|
+
memoryKey = `edit:${basename}:${Date.now()}`;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
const format = options.format || false;
|
|
495
|
+
const updateMemory = options['update-memory'] || false;
|
|
496
|
+
const trainNeural = options['train-neural'] || false;
|
|
497
|
+
|
|
498
|
+
console.log(`📝 Executing post-edit hook...`);
|
|
499
|
+
console.log(`📄 File: ${file}`);
|
|
500
|
+
if (memoryKey) console.log(`💾 Memory key: ${memoryKey}`);
|
|
501
|
+
if (format) console.log(`🎨 Auto-format: ENABLED`);
|
|
502
|
+
if (updateMemory) console.log(`🧠 Memory update: ENABLED`);
|
|
503
|
+
if (trainNeural) console.log(`🤖 Neural training: ENABLED`);
|
|
504
|
+
|
|
505
|
+
try {
|
|
506
|
+
const store = await getMemoryStore();
|
|
507
|
+
const path = await import('path');
|
|
508
|
+
const fs = await import('fs');
|
|
509
|
+
|
|
510
|
+
// Auto-format file if requested
|
|
511
|
+
let formatResult = null;
|
|
512
|
+
if (format && fs.existsSync(file)) {
|
|
513
|
+
const ext = path.extname(file).toLowerCase();
|
|
514
|
+
const formatters = {
|
|
515
|
+
'.js': 'prettier',
|
|
516
|
+
'.ts': 'prettier',
|
|
517
|
+
'.json': 'prettier',
|
|
518
|
+
'.css': 'prettier',
|
|
519
|
+
'.html': 'prettier',
|
|
520
|
+
'.py': 'black',
|
|
521
|
+
'.go': 'gofmt',
|
|
522
|
+
'.rs': 'rustfmt',
|
|
523
|
+
'.java': 'google-java-format',
|
|
524
|
+
'.cpp': 'clang-format',
|
|
525
|
+
'.c': 'clang-format',
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
const formatter = formatters[ext];
|
|
529
|
+
if (formatter) {
|
|
530
|
+
console.log(` 🎨 Auto-formatting with ${formatter}...`);
|
|
531
|
+
formatResult = {
|
|
532
|
+
formatter,
|
|
533
|
+
extension: ext,
|
|
534
|
+
attempted: true,
|
|
535
|
+
timestamp: new Date().toISOString(),
|
|
535
536
|
};
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
if (memoryKey && typeof memoryKey === 'string') {
|
|
545
|
-
await store.store(memoryKey, {
|
|
546
|
-
file,
|
|
547
|
-
editedAt: new Date().toISOString(),
|
|
548
|
-
editId: editData.editId,
|
|
549
|
-
enhanced: true,
|
|
550
|
-
formatResult,
|
|
551
|
-
memoryUpdate,
|
|
552
|
-
neuralTraining
|
|
553
|
-
}, {
|
|
554
|
-
namespace: 'coordination'
|
|
555
|
-
});
|
|
556
|
-
}
|
|
557
|
-
const historyKey = `file-history:${file.replace(/\//g, '_')}:${Date.now()}`;
|
|
558
|
-
await store.store(historyKey, {
|
|
559
|
-
file,
|
|
560
|
-
editId: editData.editId,
|
|
561
|
-
timestamp: new Date().toISOString(),
|
|
562
|
-
enhanced: true,
|
|
563
|
-
features: {
|
|
564
|
-
format,
|
|
565
|
-
updateMemory,
|
|
566
|
-
trainNeural
|
|
567
|
-
}
|
|
568
|
-
}, {
|
|
569
|
-
namespace: 'file-history'
|
|
570
|
-
});
|
|
571
|
-
console.log(` 💾 Post-edit data saved to .swarm/memory.db`);
|
|
572
|
-
printSuccess(`✅ Post-edit hook completed`);
|
|
573
|
-
} catch (err) {
|
|
574
|
-
printError(`Post-edit hook failed: ${err.message}`);
|
|
537
|
+
} else {
|
|
538
|
+
console.log(` ⚠️ No formatter available for ${ext}`);
|
|
539
|
+
formatResult = {
|
|
540
|
+
extension: ext,
|
|
541
|
+
attempted: false,
|
|
542
|
+
reason: 'No formatter available',
|
|
543
|
+
};
|
|
544
|
+
}
|
|
575
545
|
}
|
|
546
|
+
|
|
547
|
+
// Update memory with edit context
|
|
548
|
+
let memoryUpdate = null;
|
|
549
|
+
if (updateMemory) {
|
|
550
|
+
const editContext = {
|
|
551
|
+
file,
|
|
552
|
+
editedAt: new Date().toISOString(),
|
|
553
|
+
editId: generateId('edit'),
|
|
554
|
+
formatted: formatResult?.attempted || false,
|
|
555
|
+
fileSize: fs.existsSync(file) ? fs.statSync(file).size : 0,
|
|
556
|
+
directory: path.dirname(file),
|
|
557
|
+
basename: path.basename(file),
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
memoryUpdate = editContext;
|
|
561
|
+
|
|
562
|
+
// Store in coordination namespace
|
|
563
|
+
await store.store(`edit-context:${editContext.editId}`, editContext, {
|
|
564
|
+
namespace: 'coordination',
|
|
565
|
+
metadata: { type: 'edit-context', file },
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
console.log(` 🧠 Edit context stored in memory`);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
// Train neural patterns if requested
|
|
572
|
+
let neuralTraining = null;
|
|
573
|
+
if (trainNeural) {
|
|
574
|
+
// Simulate neural training with file patterns
|
|
575
|
+
const ext = path.extname(file).toLowerCase();
|
|
576
|
+
const basename = path.basename(file);
|
|
577
|
+
const editTime = new Date().toISOString();
|
|
578
|
+
|
|
579
|
+
const patterns = {
|
|
580
|
+
fileType: ext,
|
|
581
|
+
fileName: basename,
|
|
582
|
+
editTime,
|
|
583
|
+
confidence: Math.random() * 0.5 + 0.5, // 50-100% confidence
|
|
584
|
+
patterns: [
|
|
585
|
+
`${ext}_edit_pattern`,
|
|
586
|
+
`${basename}_modification`,
|
|
587
|
+
`edit_${Date.now()}_sequence`,
|
|
588
|
+
],
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
neuralTraining = patterns;
|
|
592
|
+
|
|
593
|
+
await store.store(`neural-pattern:${generateId('pattern')}`, patterns, {
|
|
594
|
+
namespace: 'neural-training',
|
|
595
|
+
metadata: { type: 'edit-pattern', file, extension: ext },
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
console.log(
|
|
599
|
+
` 🤖 Neural patterns trained (${(patterns.confidence * 100).toFixed(1)}% confidence)`,
|
|
600
|
+
);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
const editData = {
|
|
604
|
+
file,
|
|
605
|
+
memoryKey,
|
|
606
|
+
timestamp: new Date().toISOString(),
|
|
607
|
+
editId: generateId('edit'),
|
|
608
|
+
format,
|
|
609
|
+
updateMemory,
|
|
610
|
+
trainNeural,
|
|
611
|
+
formatResult,
|
|
612
|
+
memoryUpdate,
|
|
613
|
+
neuralTraining,
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
await store.store(`edit:${editData.editId}:post`, editData, {
|
|
617
|
+
namespace: 'hooks:post-edit',
|
|
618
|
+
metadata: { hookType: 'post-edit', file, formatted: formatResult?.attempted || false },
|
|
619
|
+
});
|
|
620
|
+
|
|
621
|
+
if (memoryKey && typeof memoryKey === 'string') {
|
|
622
|
+
await store.store(
|
|
623
|
+
memoryKey,
|
|
624
|
+
{
|
|
625
|
+
file,
|
|
626
|
+
editedAt: new Date().toISOString(),
|
|
627
|
+
editId: editData.editId,
|
|
628
|
+
enhanced: true,
|
|
629
|
+
formatResult,
|
|
630
|
+
memoryUpdate,
|
|
631
|
+
neuralTraining,
|
|
632
|
+
},
|
|
633
|
+
{ namespace: 'coordination' },
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
const historyKey = `file-history:${file.replace(/\//g, '_')}:${Date.now()}`;
|
|
638
|
+
await store.store(
|
|
639
|
+
historyKey,
|
|
640
|
+
{
|
|
641
|
+
file,
|
|
642
|
+
editId: editData.editId,
|
|
643
|
+
timestamp: new Date().toISOString(),
|
|
644
|
+
enhanced: true,
|
|
645
|
+
features: {
|
|
646
|
+
format,
|
|
647
|
+
updateMemory,
|
|
648
|
+
trainNeural,
|
|
649
|
+
},
|
|
650
|
+
},
|
|
651
|
+
{ namespace: 'file-history' },
|
|
652
|
+
);
|
|
653
|
+
|
|
654
|
+
console.log(` 💾 Post-edit data saved to .swarm/memory.db`);
|
|
655
|
+
printSuccess(`✅ Post-edit hook completed`);
|
|
656
|
+
} catch (err) {
|
|
657
|
+
printError(`Post-edit hook failed: ${err.message}`);
|
|
658
|
+
}
|
|
576
659
|
}
|
|
660
|
+
|
|
577
661
|
async function postBashCommand(subArgs, flags) {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
trackMetrics,
|
|
617
|
-
storeResults,
|
|
618
|
-
metrics
|
|
619
|
-
};
|
|
620
|
-
await store.store(`bash:${bashData.bashId}:post`, bashData, {
|
|
621
|
-
namespace: 'hooks:post-bash',
|
|
622
|
-
metadata: {
|
|
623
|
-
hookType: 'post-bash',
|
|
624
|
-
command,
|
|
625
|
-
exitCode,
|
|
626
|
-
success: parseInt(exitCode) === 0
|
|
627
|
-
}
|
|
628
|
-
});
|
|
629
|
-
// Store detailed results if enabled
|
|
630
|
-
if (storeResults) {
|
|
631
|
-
await store.store(`command-results:${bashData.bashId}`, {
|
|
632
|
-
command,
|
|
633
|
-
exitCode,
|
|
634
|
-
output,
|
|
635
|
-
timestamp: new Date().toISOString(),
|
|
636
|
-
fullOutput: true
|
|
637
|
-
}, {
|
|
638
|
-
namespace: 'command-results'
|
|
639
|
-
});
|
|
640
|
-
console.log(` 💾 Full command results stored`);
|
|
641
|
-
}
|
|
642
|
-
// Store metrics if enabled
|
|
643
|
-
if (trackMetrics && metrics) {
|
|
644
|
-
await store.store(`command-metrics:${bashData.bashId}`, metrics, {
|
|
645
|
-
namespace: 'performance-metrics'
|
|
646
|
-
});
|
|
647
|
-
// Update running metrics
|
|
648
|
-
const existingMetrics = await store.retrieve('command-metrics-summary', {
|
|
649
|
-
namespace: 'performance-metrics'
|
|
650
|
-
}) || {
|
|
651
|
-
totalCommands: 0,
|
|
652
|
-
successRate: 0,
|
|
653
|
-
avgDuration: 0
|
|
654
|
-
};
|
|
655
|
-
existingMetrics.totalCommands += 1;
|
|
656
|
-
existingMetrics.successRate = (existingMetrics.successRate * (existingMetrics.totalCommands - 1) + (metrics.success ? 1 : 0)) / existingMetrics.totalCommands;
|
|
657
|
-
existingMetrics.avgDuration = (existingMetrics.avgDuration * (existingMetrics.totalCommands - 1) + metrics.duration) / existingMetrics.totalCommands;
|
|
658
|
-
existingMetrics.lastUpdated = new Date().toISOString();
|
|
659
|
-
await store.store('command-metrics-summary', existingMetrics, {
|
|
660
|
-
namespace: 'performance-metrics'
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
// Update command history
|
|
664
|
-
await store.store(`command-history:${Date.now()}`, {
|
|
665
|
-
command,
|
|
666
|
-
exitCode,
|
|
667
|
-
timestamp: new Date().toISOString(),
|
|
668
|
-
success: parseInt(exitCode) === 0,
|
|
669
|
-
hasMetrics: trackMetrics,
|
|
670
|
-
hasResults: storeResults
|
|
671
|
-
}, {
|
|
672
|
-
namespace: 'command-history'
|
|
673
|
-
});
|
|
674
|
-
console.log(` 💾 Command execution logged to .swarm/memory.db`);
|
|
675
|
-
printSuccess(`✅ Post-bash hook completed`);
|
|
676
|
-
} catch (err) {
|
|
677
|
-
printError(`Post-bash hook failed: ${err.message}`);
|
|
662
|
+
const options = flags;
|
|
663
|
+
const command = options.command || subArgs.slice(1).join(' ');
|
|
664
|
+
const exitCode = options['exit-code'] || '0';
|
|
665
|
+
const output = options.output || '';
|
|
666
|
+
const trackMetrics = options['track-metrics'] || false;
|
|
667
|
+
const storeResults = options['store-results'] || false;
|
|
668
|
+
const duration = options.duration || 0;
|
|
669
|
+
|
|
670
|
+
console.log(`🔧 Executing post-bash hook...`);
|
|
671
|
+
console.log(`📜 Command: ${command}`);
|
|
672
|
+
console.log(`📊 Exit code: ${exitCode}`);
|
|
673
|
+
if (trackMetrics) console.log(`📊 Metrics tracking: ENABLED`);
|
|
674
|
+
if (storeResults) console.log(`💾 Results storage: ENABLED`);
|
|
675
|
+
|
|
676
|
+
try {
|
|
677
|
+
const store = await getMemoryStore();
|
|
678
|
+
const startTime = Date.now();
|
|
679
|
+
|
|
680
|
+
// Calculate performance metrics if enabled
|
|
681
|
+
let metrics = null;
|
|
682
|
+
if (trackMetrics) {
|
|
683
|
+
const commandLength = command.length;
|
|
684
|
+
const outputLength = output.length;
|
|
685
|
+
const success = parseInt(exitCode) === 0;
|
|
686
|
+
|
|
687
|
+
metrics = {
|
|
688
|
+
commandLength,
|
|
689
|
+
outputLength,
|
|
690
|
+
success,
|
|
691
|
+
duration: parseInt(duration) || 0,
|
|
692
|
+
exitCode: parseInt(exitCode),
|
|
693
|
+
timestamp: new Date().toISOString(),
|
|
694
|
+
complexity: commandLength > 100 ? 'high' : commandLength > 50 ? 'medium' : 'low',
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
console.log(
|
|
698
|
+
` 📊 Command metrics: ${commandLength} chars, ${outputLength} output, ${success ? 'SUCCESS' : 'FAILED'}`,
|
|
699
|
+
);
|
|
678
700
|
}
|
|
701
|
+
|
|
702
|
+
const bashData = {
|
|
703
|
+
command,
|
|
704
|
+
exitCode,
|
|
705
|
+
output: storeResults ? output.substring(0, 5000) : output.substring(0, 1000), // Store more if requested
|
|
706
|
+
timestamp: new Date().toISOString(),
|
|
707
|
+
bashId: generateId('bash'),
|
|
708
|
+
trackMetrics,
|
|
709
|
+
storeResults,
|
|
710
|
+
metrics,
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
await store.store(`bash:${bashData.bashId}:post`, bashData, {
|
|
714
|
+
namespace: 'hooks:post-bash',
|
|
715
|
+
metadata: { hookType: 'post-bash', command, exitCode, success: parseInt(exitCode) === 0 },
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
// Store detailed results if enabled
|
|
719
|
+
if (storeResults) {
|
|
720
|
+
await store.store(
|
|
721
|
+
`command-results:${bashData.bashId}`,
|
|
722
|
+
{
|
|
723
|
+
command,
|
|
724
|
+
exitCode,
|
|
725
|
+
output,
|
|
726
|
+
timestamp: new Date().toISOString(),
|
|
727
|
+
fullOutput: true,
|
|
728
|
+
},
|
|
729
|
+
{ namespace: 'command-results' },
|
|
730
|
+
);
|
|
731
|
+
|
|
732
|
+
console.log(` 💾 Full command results stored`);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
// Store metrics if enabled
|
|
736
|
+
if (trackMetrics && metrics) {
|
|
737
|
+
await store.store(`command-metrics:${bashData.bashId}`, metrics, {
|
|
738
|
+
namespace: 'performance-metrics',
|
|
739
|
+
});
|
|
740
|
+
|
|
741
|
+
// Update running metrics
|
|
742
|
+
const existingMetrics = (await store.retrieve('command-metrics-summary', {
|
|
743
|
+
namespace: 'performance-metrics',
|
|
744
|
+
})) || { totalCommands: 0, successRate: 0, avgDuration: 0 };
|
|
745
|
+
|
|
746
|
+
existingMetrics.totalCommands += 1;
|
|
747
|
+
existingMetrics.successRate =
|
|
748
|
+
(existingMetrics.successRate * (existingMetrics.totalCommands - 1) +
|
|
749
|
+
(metrics.success ? 1 : 0)) /
|
|
750
|
+
existingMetrics.totalCommands;
|
|
751
|
+
existingMetrics.avgDuration =
|
|
752
|
+
(existingMetrics.avgDuration * (existingMetrics.totalCommands - 1) + metrics.duration) /
|
|
753
|
+
existingMetrics.totalCommands;
|
|
754
|
+
existingMetrics.lastUpdated = new Date().toISOString();
|
|
755
|
+
|
|
756
|
+
await store.store('command-metrics-summary', existingMetrics, {
|
|
757
|
+
namespace: 'performance-metrics',
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
// Update command history
|
|
762
|
+
await store.store(
|
|
763
|
+
`command-history:${Date.now()}`,
|
|
764
|
+
{
|
|
765
|
+
command,
|
|
766
|
+
exitCode,
|
|
767
|
+
timestamp: new Date().toISOString(),
|
|
768
|
+
success: parseInt(exitCode) === 0,
|
|
769
|
+
hasMetrics: trackMetrics,
|
|
770
|
+
hasResults: storeResults,
|
|
771
|
+
},
|
|
772
|
+
{ namespace: 'command-history' },
|
|
773
|
+
);
|
|
774
|
+
|
|
775
|
+
console.log(` 💾 Command execution logged to .swarm/memory.db`);
|
|
776
|
+
printSuccess(`✅ Post-bash hook completed`);
|
|
777
|
+
} catch (err) {
|
|
778
|
+
printError(`Post-bash hook failed: ${err.message}`);
|
|
779
|
+
}
|
|
679
780
|
}
|
|
781
|
+
|
|
680
782
|
async function postSearchCommand(subArgs, flags) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
783
|
+
const options = flags;
|
|
784
|
+
const query = options.query || subArgs.slice(1).join(' ');
|
|
785
|
+
const resultCount = options['result-count'] || '0';
|
|
786
|
+
const searchType = options.type || 'general';
|
|
787
|
+
|
|
788
|
+
console.log(`🔍 Executing post-search hook...`);
|
|
789
|
+
console.log(`🔎 Query: ${query}`);
|
|
790
|
+
console.log(`📊 Results: ${resultCount}`);
|
|
791
|
+
|
|
792
|
+
try {
|
|
793
|
+
const store = await getMemoryStore();
|
|
794
|
+
const searchData = {
|
|
795
|
+
query,
|
|
796
|
+
resultCount: parseInt(resultCount),
|
|
797
|
+
searchType,
|
|
798
|
+
timestamp: new Date().toISOString(),
|
|
799
|
+
searchId: generateId('search'),
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
await store.store(`search:${searchData.searchId}`, searchData, {
|
|
803
|
+
namespace: 'hooks:post-search',
|
|
804
|
+
metadata: { hookType: 'post-search', query },
|
|
805
|
+
});
|
|
806
|
+
|
|
807
|
+
// Cache search for future use
|
|
808
|
+
await store.store(
|
|
809
|
+
`search-cache:${query}`,
|
|
810
|
+
{
|
|
811
|
+
resultCount: searchData.resultCount,
|
|
812
|
+
cachedAt: new Date().toISOString(),
|
|
813
|
+
},
|
|
814
|
+
{ namespace: 'search-cache', ttl: 3600 },
|
|
815
|
+
); // 1 hour TTL
|
|
816
|
+
|
|
817
|
+
console.log(` 💾 Search results cached to .swarm/memory.db`);
|
|
818
|
+
printSuccess(`✅ Post-search hook completed`);
|
|
819
|
+
} catch (err) {
|
|
820
|
+
printError(`Post-search hook failed: ${err.message}`);
|
|
821
|
+
}
|
|
717
822
|
}
|
|
823
|
+
|
|
718
824
|
// ===== MCP INTEGRATION HOOKS =====
|
|
825
|
+
|
|
719
826
|
async function mcpInitializedCommand(subArgs, flags) {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
}
|
|
827
|
+
const options = flags;
|
|
828
|
+
const serverName = options.server || 'claude-flow';
|
|
829
|
+
const sessionId = options['session-id'] || generateId('mcp-session');
|
|
830
|
+
|
|
831
|
+
console.log(`🔌 Executing mcp-initialized hook...`);
|
|
832
|
+
console.log(`💻 Server: ${serverName}`);
|
|
833
|
+
console.log(`🆔 Session: ${sessionId}`);
|
|
834
|
+
|
|
835
|
+
try {
|
|
836
|
+
const store = await getMemoryStore();
|
|
837
|
+
const mcpData = {
|
|
838
|
+
serverName,
|
|
839
|
+
sessionId,
|
|
840
|
+
initializedAt: new Date().toISOString(),
|
|
841
|
+
status: 'active',
|
|
842
|
+
};
|
|
843
|
+
|
|
844
|
+
await store.store(`mcp:${sessionId}`, mcpData, {
|
|
845
|
+
namespace: 'hooks:mcp-initialized',
|
|
846
|
+
metadata: { hookType: 'mcp-initialized', server: serverName },
|
|
847
|
+
});
|
|
848
|
+
|
|
849
|
+
console.log(` 💾 MCP session saved to .swarm/memory.db`);
|
|
850
|
+
printSuccess(`✅ MCP initialized hook completed`);
|
|
851
|
+
} catch (err) {
|
|
852
|
+
printError(`MCP initialized hook failed: ${err.message}`);
|
|
853
|
+
}
|
|
746
854
|
}
|
|
855
|
+
|
|
747
856
|
async function agentSpawnedCommand(subArgs, flags) {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
857
|
+
const options = flags;
|
|
858
|
+
const agentType = options.type || 'generic';
|
|
859
|
+
const agentName = options.name || generateId('agent');
|
|
860
|
+
const swarmId = options['swarm-id'] || 'default';
|
|
861
|
+
|
|
862
|
+
console.log(`🤖 Executing agent-spawned hook...`);
|
|
863
|
+
console.log(`📛 Agent: ${agentName}`);
|
|
864
|
+
console.log(`🏷️ Type: ${agentType}`);
|
|
865
|
+
|
|
866
|
+
try {
|
|
867
|
+
const store = await getMemoryStore();
|
|
868
|
+
const agentData = {
|
|
869
|
+
agentName,
|
|
870
|
+
agentType,
|
|
871
|
+
swarmId,
|
|
872
|
+
spawnedAt: new Date().toISOString(),
|
|
873
|
+
status: 'active',
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
await store.store(`agent:${agentName}`, agentData, {
|
|
877
|
+
namespace: 'hooks:agent-spawned',
|
|
878
|
+
metadata: { hookType: 'agent-spawned', type: agentType },
|
|
879
|
+
});
|
|
880
|
+
|
|
881
|
+
// Update agent roster
|
|
882
|
+
await store.store(
|
|
883
|
+
`agent-roster:${Date.now()}`,
|
|
884
|
+
{
|
|
885
|
+
agentName,
|
|
886
|
+
action: 'spawned',
|
|
887
|
+
timestamp: new Date().toISOString(),
|
|
888
|
+
},
|
|
889
|
+
{ namespace: 'agent-roster' },
|
|
890
|
+
);
|
|
891
|
+
|
|
892
|
+
console.log(` 💾 Agent registered to .swarm/memory.db`);
|
|
893
|
+
printSuccess(`✅ Agent spawned hook completed`);
|
|
894
|
+
} catch (err) {
|
|
895
|
+
printError(`Agent spawned hook failed: ${err.message}`);
|
|
896
|
+
}
|
|
784
897
|
}
|
|
898
|
+
|
|
785
899
|
async function taskOrchestratedCommand(subArgs, flags) {
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
}
|
|
900
|
+
const options = flags;
|
|
901
|
+
const taskId = options['task-id'] || generateId('orchestrated-task');
|
|
902
|
+
const strategy = options.strategy || 'balanced';
|
|
903
|
+
const priority = options.priority || 'medium';
|
|
904
|
+
|
|
905
|
+
console.log(`🎭 Executing task-orchestrated hook...`);
|
|
906
|
+
console.log(`🆔 Task: ${taskId}`);
|
|
907
|
+
console.log(`📊 Strategy: ${strategy}`);
|
|
908
|
+
|
|
909
|
+
try {
|
|
910
|
+
const store = await getMemoryStore();
|
|
911
|
+
const orchestrationData = {
|
|
912
|
+
taskId,
|
|
913
|
+
strategy,
|
|
914
|
+
priority,
|
|
915
|
+
orchestratedAt: new Date().toISOString(),
|
|
916
|
+
status: 'orchestrated',
|
|
917
|
+
};
|
|
918
|
+
|
|
919
|
+
await store.store(`orchestration:${taskId}`, orchestrationData, {
|
|
920
|
+
namespace: 'hooks:task-orchestrated',
|
|
921
|
+
metadata: { hookType: 'task-orchestrated', strategy },
|
|
922
|
+
});
|
|
923
|
+
|
|
924
|
+
console.log(` 💾 Orchestration saved to .swarm/memory.db`);
|
|
925
|
+
printSuccess(`✅ Task orchestrated hook completed`);
|
|
926
|
+
} catch (err) {
|
|
927
|
+
printError(`Task orchestrated hook failed: ${err.message}`);
|
|
928
|
+
}
|
|
814
929
|
}
|
|
930
|
+
|
|
815
931
|
async function neuralTrainedCommand(subArgs, flags) {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
}
|
|
932
|
+
const options = flags;
|
|
933
|
+
const modelName = options.model || 'default-neural';
|
|
934
|
+
const accuracy = options.accuracy || '0.0';
|
|
935
|
+
const patterns = options.patterns || '0';
|
|
936
|
+
|
|
937
|
+
console.log(`🧠 Executing neural-trained hook...`);
|
|
938
|
+
console.log(`🤖 Model: ${modelName}`);
|
|
939
|
+
console.log(`📊 Accuracy: ${accuracy}%`);
|
|
940
|
+
|
|
941
|
+
try {
|
|
942
|
+
const store = await getMemoryStore();
|
|
943
|
+
const trainingData = {
|
|
944
|
+
modelName,
|
|
945
|
+
accuracy: parseFloat(accuracy),
|
|
946
|
+
patternsLearned: parseInt(patterns),
|
|
947
|
+
trainedAt: new Date().toISOString(),
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
await store.store(`neural:${modelName}:${Date.now()}`, trainingData, {
|
|
951
|
+
namespace: 'hooks:neural-trained',
|
|
952
|
+
metadata: { hookType: 'neural-trained', model: modelName },
|
|
953
|
+
});
|
|
954
|
+
|
|
955
|
+
console.log(` 💾 Training results saved to .swarm/memory.db`);
|
|
956
|
+
printSuccess(`✅ Neural trained hook completed`);
|
|
957
|
+
} catch (err) {
|
|
958
|
+
printError(`Neural trained hook failed: ${err.message}`);
|
|
959
|
+
}
|
|
843
960
|
}
|
|
961
|
+
|
|
844
962
|
// ===== SESSION HOOKS =====
|
|
963
|
+
|
|
845
964
|
async function sessionStartCommand(subArgs, flags) {
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
}
|
|
869
|
-
|
|
965
|
+
const options = flags;
|
|
966
|
+
const silent = options.silent || false;
|
|
967
|
+
const generateMissing = options['generate-missing'] !== 'false';
|
|
968
|
+
const fallbackToDefault = options['fallback-to-default'] !== 'false';
|
|
969
|
+
|
|
970
|
+
console.log(`🚀 Executing session-start hook...`);
|
|
971
|
+
if (generateMissing) console.log(`🔄 Auto-generate missing soul: ENABLED`);
|
|
972
|
+
if (fallbackToDefault) console.log(`📄 Fallback to default: ENABLED`);
|
|
973
|
+
|
|
974
|
+
try {
|
|
975
|
+
const result = await executeSessionStartSoulHook({
|
|
976
|
+
silent,
|
|
977
|
+
generateMissing,
|
|
978
|
+
fallbackToDefault
|
|
979
|
+
});
|
|
980
|
+
|
|
981
|
+
if (result.success) {
|
|
982
|
+
console.log(` 💾 Soul integration: ${result.action.toUpperCase()}`);
|
|
983
|
+
if (result.contentLength) {
|
|
984
|
+
console.log(` 📊 Content loaded: ${result.contentLength} characters`);
|
|
985
|
+
}
|
|
986
|
+
printSuccess(`✅ Session-start hook completed`);
|
|
987
|
+
} else {
|
|
988
|
+
printError(`Session-start hook failed: ${result.error}`);
|
|
870
989
|
}
|
|
990
|
+
} catch (err) {
|
|
991
|
+
printError(`Session-start hook failed: ${err.message}`);
|
|
992
|
+
}
|
|
871
993
|
}
|
|
994
|
+
|
|
872
995
|
async function sessionEndCommand(subArgs, flags) {
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
996
|
+
const options = flags;
|
|
997
|
+
const generateSummary = options['generate-summary'] !== 'false';
|
|
998
|
+
const persistState = options['persist-state'] !== 'false';
|
|
999
|
+
const exportMetrics = options['export-metrics'] || false;
|
|
1000
|
+
|
|
1001
|
+
console.log(`🔚 Executing session-end hook...`);
|
|
1002
|
+
if (generateSummary) console.log(`📊 Summary generation: ENABLED`);
|
|
1003
|
+
if (persistState) console.log(`💾 State persistence: ENABLED`);
|
|
1004
|
+
if (exportMetrics) console.log(`📈 Metrics export: ENABLED`);
|
|
1005
|
+
|
|
1006
|
+
try {
|
|
1007
|
+
const store = await getMemoryStore();
|
|
1008
|
+
const tasks = await store.list({ namespace: 'task-index', limit: 1000 });
|
|
1009
|
+
const edits = await store.list({ namespace: 'file-history', limit: 1000 });
|
|
1010
|
+
const commands = await store.list({ namespace: 'command-history', limit: 1000 });
|
|
1011
|
+
const agents = await store.list({ namespace: 'agent-roster', limit: 1000 });
|
|
1012
|
+
|
|
1013
|
+
// Calculate session metrics
|
|
1014
|
+
let metrics = null;
|
|
1015
|
+
if (exportMetrics) {
|
|
1016
|
+
const now = new Date();
|
|
1017
|
+
const sessionStart = Math.min(
|
|
1018
|
+
...tasks.map((t) => new Date(t.value.timestamp || now).getTime()),
|
|
1019
|
+
...edits.map((e) => new Date(e.value.timestamp || now).getTime()),
|
|
1020
|
+
...commands.map((c) => new Date(c.value.timestamp || now).getTime()),
|
|
1021
|
+
);
|
|
1022
|
+
|
|
1023
|
+
const duration = now.getTime() - sessionStart;
|
|
1024
|
+
const successfulCommands = commands.filter((c) => c.value.success !== false).length;
|
|
1025
|
+
const commandSuccessRate = commands.length > 0 ? successfulCommands / commands.length : 1;
|
|
1026
|
+
|
|
1027
|
+
metrics = {
|
|
1028
|
+
sessionDuration: duration,
|
|
1029
|
+
sessionDurationHuman: `${Math.round(duration / 1000 / 60)} minutes`,
|
|
1030
|
+
totalTasks: tasks.length,
|
|
1031
|
+
totalEdits: edits.length,
|
|
1032
|
+
totalCommands: commands.length,
|
|
1033
|
+
uniqueAgents: agents.length,
|
|
1034
|
+
commandSuccessRate: Math.round(commandSuccessRate * 100),
|
|
1035
|
+
avgTasksPerMinute: Math.round((tasks.length / (duration / 1000 / 60)) * 100) / 100,
|
|
1036
|
+
avgEditsPerMinute: Math.round((edits.length / (duration / 1000 / 60)) * 100) / 100,
|
|
1037
|
+
timestamp: now.toISOString(),
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
const sessionData = {
|
|
1042
|
+
endedAt: new Date().toISOString(),
|
|
1043
|
+
totalTasks: tasks.length,
|
|
1044
|
+
totalEdits: edits.length,
|
|
1045
|
+
totalCommands: commands.length,
|
|
1046
|
+
uniqueAgents: agents.length,
|
|
1047
|
+
sessionId: generateId('session'),
|
|
1048
|
+
generateSummary,
|
|
1049
|
+
persistState,
|
|
1050
|
+
exportMetrics,
|
|
1051
|
+
metrics,
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
await store.store(`session:${sessionData.sessionId}`, sessionData, {
|
|
1055
|
+
namespace: 'sessions',
|
|
1056
|
+
metadata: { hookType: 'session-end' },
|
|
1057
|
+
});
|
|
1058
|
+
|
|
1059
|
+
// Persist detailed state if requested
|
|
1060
|
+
if (persistState) {
|
|
1061
|
+
const detailedState = {
|
|
1062
|
+
sessionId: sessionData.sessionId,
|
|
1063
|
+
tasks: tasks.slice(0, 100), // Limit to prevent memory issues
|
|
1064
|
+
edits: edits.slice(0, 100),
|
|
1065
|
+
commands: commands.slice(0, 100),
|
|
1066
|
+
agents: agents.slice(0, 50),
|
|
1067
|
+
persistedAt: new Date().toISOString(),
|
|
1068
|
+
fullState: true,
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1071
|
+
await store.store(`session-state:${sessionData.sessionId}`, detailedState, {
|
|
1072
|
+
namespace: 'session-states',
|
|
1073
|
+
metadata: { type: 'full-state', sessionId: sessionData.sessionId },
|
|
1074
|
+
});
|
|
1075
|
+
|
|
1076
|
+
console.log(` 💾 Full session state persisted`);
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
// Export metrics if requested
|
|
1080
|
+
if (exportMetrics && metrics) {
|
|
1081
|
+
await store.store(`session-metrics:${sessionData.sessionId}`, metrics, {
|
|
1082
|
+
namespace: 'session-metrics',
|
|
1083
|
+
metadata: { type: 'performance-metrics', sessionId: sessionData.sessionId },
|
|
1084
|
+
});
|
|
1085
|
+
|
|
1086
|
+
console.log(` 📈 Session metrics exported`);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
if (generateSummary) {
|
|
1090
|
+
console.log(`\n📊 SESSION SUMMARY:`);
|
|
1091
|
+
console.log(` 📋 Tasks: ${sessionData.totalTasks}`);
|
|
1092
|
+
console.log(` ✏️ Edits: ${sessionData.totalEdits}`);
|
|
1093
|
+
console.log(` 🔧 Commands: ${sessionData.totalCommands}`);
|
|
1094
|
+
console.log(` 🤖 Agents: ${sessionData.uniqueAgents}`);
|
|
1095
|
+
|
|
1096
|
+
if (metrics) {
|
|
1097
|
+
console.log(` ⏱️ Duration: ${metrics.sessionDurationHuman}`);
|
|
1098
|
+
console.log(` 📈 Success Rate: ${metrics.commandSuccessRate}%`);
|
|
1099
|
+
console.log(` 🏃 Tasks/min: ${metrics.avgTasksPerMinute}`);
|
|
1100
|
+
console.log(` ✏️ Edits/min: ${metrics.avgEditsPerMinute}`);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
console.log(` 💾 Session saved to .swarm/memory.db`);
|
|
1105
|
+
|
|
1106
|
+
// Clean up soul context files
|
|
881
1107
|
try {
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
namespace: 'task-index',
|
|
885
|
-
limit: 1000
|
|
886
|
-
});
|
|
887
|
-
const edits = await store.list({
|
|
888
|
-
namespace: 'file-history',
|
|
889
|
-
limit: 1000
|
|
890
|
-
});
|
|
891
|
-
const commands = await store.list({
|
|
892
|
-
namespace: 'command-history',
|
|
893
|
-
limit: 1000
|
|
894
|
-
});
|
|
895
|
-
const agents = await store.list({
|
|
896
|
-
namespace: 'agent-roster',
|
|
897
|
-
limit: 1000
|
|
898
|
-
});
|
|
899
|
-
// Calculate session metrics
|
|
900
|
-
let metrics = null;
|
|
901
|
-
if (exportMetrics) {
|
|
902
|
-
const now = new Date();
|
|
903
|
-
const sessionStart = Math.min(...tasks.map((t)=>new Date(t.value.timestamp || now).getTime()), ...edits.map((e)=>new Date(e.value.timestamp || now).getTime()), ...commands.map((c)=>new Date(c.value.timestamp || now).getTime()));
|
|
904
|
-
const duration = now.getTime() - sessionStart;
|
|
905
|
-
const successfulCommands = commands.filter((c)=>c.value.success !== false).length;
|
|
906
|
-
const commandSuccessRate = commands.length > 0 ? successfulCommands / commands.length : 1;
|
|
907
|
-
metrics = {
|
|
908
|
-
sessionDuration: duration,
|
|
909
|
-
sessionDurationHuman: `${Math.round(duration / 1000 / 60)} minutes`,
|
|
910
|
-
totalTasks: tasks.length,
|
|
911
|
-
totalEdits: edits.length,
|
|
912
|
-
totalCommands: commands.length,
|
|
913
|
-
uniqueAgents: agents.length,
|
|
914
|
-
commandSuccessRate: Math.round(commandSuccessRate * 100),
|
|
915
|
-
avgTasksPerMinute: Math.round(tasks.length / (duration / 1000 / 60) * 100) / 100,
|
|
916
|
-
avgEditsPerMinute: Math.round(edits.length / (duration / 1000 / 60) * 100) / 100,
|
|
917
|
-
timestamp: now.toISOString()
|
|
918
|
-
};
|
|
919
|
-
}
|
|
920
|
-
const sessionData = {
|
|
921
|
-
endedAt: new Date().toISOString(),
|
|
922
|
-
totalTasks: tasks.length,
|
|
923
|
-
totalEdits: edits.length,
|
|
924
|
-
totalCommands: commands.length,
|
|
925
|
-
uniqueAgents: agents.length,
|
|
926
|
-
sessionId: generateId('session'),
|
|
927
|
-
generateSummary,
|
|
928
|
-
persistState,
|
|
929
|
-
exportMetrics,
|
|
930
|
-
metrics
|
|
931
|
-
};
|
|
932
|
-
await store.store(`session:${sessionData.sessionId}`, sessionData, {
|
|
933
|
-
namespace: 'sessions',
|
|
934
|
-
metadata: {
|
|
935
|
-
hookType: 'session-end'
|
|
936
|
-
}
|
|
937
|
-
});
|
|
938
|
-
// Persist detailed state if requested
|
|
939
|
-
if (persistState) {
|
|
940
|
-
const detailedState = {
|
|
941
|
-
sessionId: sessionData.sessionId,
|
|
942
|
-
tasks: tasks.slice(0, 100),
|
|
943
|
-
edits: edits.slice(0, 100),
|
|
944
|
-
commands: commands.slice(0, 100),
|
|
945
|
-
agents: agents.slice(0, 50),
|
|
946
|
-
persistedAt: new Date().toISOString(),
|
|
947
|
-
fullState: true
|
|
948
|
-
};
|
|
949
|
-
await store.store(`session-state:${sessionData.sessionId}`, detailedState, {
|
|
950
|
-
namespace: 'session-states',
|
|
951
|
-
metadata: {
|
|
952
|
-
type: 'full-state',
|
|
953
|
-
sessionId: sessionData.sessionId
|
|
954
|
-
}
|
|
955
|
-
});
|
|
956
|
-
console.log(` 💾 Full session state persisted`);
|
|
957
|
-
}
|
|
958
|
-
// Export metrics if requested
|
|
959
|
-
if (exportMetrics && metrics) {
|
|
960
|
-
await store.store(`session-metrics:${sessionData.sessionId}`, metrics, {
|
|
961
|
-
namespace: 'session-metrics',
|
|
962
|
-
metadata: {
|
|
963
|
-
type: 'performance-metrics',
|
|
964
|
-
sessionId: sessionData.sessionId
|
|
965
|
-
}
|
|
966
|
-
});
|
|
967
|
-
console.log(` 📈 Session metrics exported`);
|
|
968
|
-
}
|
|
969
|
-
if (generateSummary) {
|
|
970
|
-
console.log(`\n📊 SESSION SUMMARY:`);
|
|
971
|
-
console.log(` 📋 Tasks: ${sessionData.totalTasks}`);
|
|
972
|
-
console.log(` ✏️ Edits: ${sessionData.totalEdits}`);
|
|
973
|
-
console.log(` 🔧 Commands: ${sessionData.totalCommands}`);
|
|
974
|
-
console.log(` 🤖 Agents: ${sessionData.uniqueAgents}`);
|
|
975
|
-
if (metrics) {
|
|
976
|
-
console.log(` ⏱️ Duration: ${metrics.sessionDurationHuman}`);
|
|
977
|
-
console.log(` 📈 Success Rate: ${metrics.commandSuccessRate}%`);
|
|
978
|
-
console.log(` 🏃 Tasks/min: ${metrics.avgTasksPerMinute}`);
|
|
979
|
-
console.log(` ✏️ Edits/min: ${metrics.avgEditsPerMinute}`);
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
console.log(` 💾 Session saved to .swarm/memory.db`);
|
|
983
|
-
// Clean up soul context files
|
|
984
|
-
try {
|
|
985
|
-
await executeSessionEndSoulHook();
|
|
986
|
-
console.log(` 🧹 Soul context cleanup completed`);
|
|
987
|
-
} catch (err) {
|
|
988
|
-
console.log(` ⚠️ Soul cleanup warning: ${err.message}`);
|
|
989
|
-
}
|
|
990
|
-
if (memoryStore) {
|
|
991
|
-
memoryStore.close();
|
|
992
|
-
memoryStore = null;
|
|
993
|
-
}
|
|
994
|
-
printSuccess(`✅ Session-end hook completed`);
|
|
1108
|
+
await executeSessionEndSoulHook();
|
|
1109
|
+
console.log(` 🧹 Soul context cleanup completed`);
|
|
995
1110
|
} catch (err) {
|
|
996
|
-
|
|
1111
|
+
console.log(` ⚠️ Soul cleanup warning: ${err.message}`);
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
if (memoryStore) {
|
|
1115
|
+
memoryStore.close();
|
|
1116
|
+
memoryStore = null;
|
|
997
1117
|
}
|
|
1118
|
+
|
|
1119
|
+
printSuccess(`✅ Session-end hook completed`);
|
|
1120
|
+
} catch (err) {
|
|
1121
|
+
printError(`Session-end hook failed: ${err.message}`);
|
|
1122
|
+
}
|
|
998
1123
|
}
|
|
1124
|
+
|
|
999
1125
|
async function sessionRestoreCommand(subArgs, flags) {
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
}
|
|
1038
|
-
|
|
1126
|
+
const options = flags;
|
|
1127
|
+
const sessionId = options['session-id'] || 'latest';
|
|
1128
|
+
|
|
1129
|
+
console.log(`🔄 Executing session-restore hook...`);
|
|
1130
|
+
console.log(`🆔 Session: ${sessionId}`);
|
|
1131
|
+
|
|
1132
|
+
try {
|
|
1133
|
+
const store = await getMemoryStore();
|
|
1134
|
+
|
|
1135
|
+
// Find session to restore
|
|
1136
|
+
let sessionData;
|
|
1137
|
+
if (sessionId === 'latest') {
|
|
1138
|
+
const sessions = await store.list({ namespace: 'sessions', limit: 1 });
|
|
1139
|
+
sessionData = sessions[0]?.value;
|
|
1140
|
+
} else {
|
|
1141
|
+
sessionData = await store.retrieve(`session:${sessionId}`, { namespace: 'sessions' });
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
if (sessionData) {
|
|
1145
|
+
console.log(`\n📊 RESTORED SESSION:`);
|
|
1146
|
+
console.log(` 🆔 ID: ${sessionData.sessionId || 'unknown'}`);
|
|
1147
|
+
console.log(` 📋 Tasks: ${sessionData.totalTasks || 0}`);
|
|
1148
|
+
console.log(` ✏️ Edits: ${sessionData.totalEdits || 0}`);
|
|
1149
|
+
console.log(` ⏰ Ended: ${sessionData.endedAt || 'unknown'}`);
|
|
1150
|
+
|
|
1151
|
+
// Store restoration event
|
|
1152
|
+
await store.store(
|
|
1153
|
+
`session-restore:${Date.now()}`,
|
|
1154
|
+
{
|
|
1155
|
+
restoredSessionId: sessionData.sessionId || sessionId,
|
|
1156
|
+
restoredAt: new Date().toISOString(),
|
|
1157
|
+
},
|
|
1158
|
+
{ namespace: 'session-events' },
|
|
1159
|
+
);
|
|
1160
|
+
|
|
1161
|
+
console.log(` 💾 Session restored from .swarm/memory.db`);
|
|
1162
|
+
printSuccess(`✅ Session restore completed`);
|
|
1163
|
+
} else {
|
|
1164
|
+
printWarning(`No session found with ID: ${sessionId}`);
|
|
1039
1165
|
}
|
|
1166
|
+
} catch (err) {
|
|
1167
|
+
printError(`Session restore hook failed: ${err.message}`);
|
|
1168
|
+
}
|
|
1040
1169
|
}
|
|
1170
|
+
|
|
1041
1171
|
async function notifyCommand(subArgs, flags) {
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1172
|
+
const options = flags;
|
|
1173
|
+
const message = options.message || subArgs.slice(1).join(' ');
|
|
1174
|
+
const level = options.level || 'info';
|
|
1175
|
+
const swarmStatus = options['swarm-status'] || 'active';
|
|
1176
|
+
|
|
1177
|
+
console.log(`📢 Executing notify hook...`);
|
|
1178
|
+
console.log(`💬 Message: ${message}`);
|
|
1179
|
+
console.log(`📊 Level: ${level}`);
|
|
1180
|
+
|
|
1181
|
+
try {
|
|
1182
|
+
const store = await getMemoryStore();
|
|
1183
|
+
const notificationData = {
|
|
1184
|
+
message,
|
|
1185
|
+
level,
|
|
1186
|
+
swarmStatus,
|
|
1187
|
+
timestamp: new Date().toISOString(),
|
|
1188
|
+
notifyId: generateId('notify'),
|
|
1189
|
+
};
|
|
1190
|
+
|
|
1191
|
+
await store.store(`notification:${notificationData.notifyId}`, notificationData, {
|
|
1192
|
+
namespace: 'hooks:notify',
|
|
1193
|
+
metadata: { hookType: 'notify', level },
|
|
1194
|
+
});
|
|
1195
|
+
|
|
1196
|
+
// Display notification
|
|
1197
|
+
const icon = level === 'error' ? '❌' : level === 'warning' ? '⚠️' : '✅';
|
|
1198
|
+
console.log(`\n${icon} NOTIFICATION:`);
|
|
1199
|
+
console.log(` ${message}`);
|
|
1200
|
+
console.log(` 🐝 Swarm: ${swarmStatus}`);
|
|
1201
|
+
|
|
1202
|
+
console.log(`\n 💾 Notification saved to .swarm/memory.db`);
|
|
1203
|
+
printSuccess(`✅ Notify hook completed`);
|
|
1204
|
+
} catch (err) {
|
|
1205
|
+
printError(`Notify hook failed: ${err.message}`);
|
|
1206
|
+
}
|
|
1075
1207
|
}
|
|
1208
|
+
|
|
1076
1209
|
function showHooksHelp() {
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1210
|
+
console.log('Claude Flow Hooks (with .swarm/memory.db persistence):\n');
|
|
1211
|
+
|
|
1212
|
+
console.log('Pre-Operation Hooks:');
|
|
1213
|
+
console.log(' pre-task Execute before starting a task');
|
|
1214
|
+
console.log(' pre-edit Validate before file modifications');
|
|
1215
|
+
console.log(' --auto-assign-agents Auto-assign agents based on file type');
|
|
1216
|
+
console.log(' --load-context Load file context');
|
|
1217
|
+
console.log(' pre-bash Check command safety (alias: pre-command)');
|
|
1218
|
+
console.log(' pre-command Same as pre-bash');
|
|
1219
|
+
console.log(' --validate-safety Enable safety validation');
|
|
1220
|
+
console.log(' --prepare-resources Prepare execution resources');
|
|
1221
|
+
|
|
1222
|
+
console.log('\nPost-Operation Hooks:');
|
|
1223
|
+
console.log(' post-task Execute after completing a task');
|
|
1224
|
+
console.log(' post-edit Auto-format and log edits');
|
|
1225
|
+
console.log(' --format Auto-format code');
|
|
1226
|
+
console.log(' --update-memory Update agent memory');
|
|
1227
|
+
console.log(' --train-neural Train neural patterns');
|
|
1228
|
+
console.log(' post-bash Log command execution (alias: post-command)');
|
|
1229
|
+
console.log(' post-command Same as post-bash');
|
|
1230
|
+
console.log(' --track-metrics Track performance metrics');
|
|
1231
|
+
console.log(' --store-results Store detailed results');
|
|
1232
|
+
console.log(' post-search Cache search results');
|
|
1233
|
+
|
|
1234
|
+
console.log('\nMCP Integration Hooks:');
|
|
1235
|
+
console.log(' mcp-initialized Persist MCP configuration');
|
|
1236
|
+
console.log(' agent-spawned Update agent roster');
|
|
1237
|
+
console.log(' task-orchestrated Monitor task progress');
|
|
1238
|
+
console.log(' neural-trained Save pattern improvements');
|
|
1239
|
+
|
|
1240
|
+
console.log('\nSession Hooks:');
|
|
1241
|
+
console.log(' session-start Load project soul into Claude Code session');
|
|
1242
|
+
console.log(' --generate-missing Auto-generate missing claude-soul.md');
|
|
1243
|
+
console.log(' --fallback-to-default Use minimal soul if generation fails');
|
|
1244
|
+
console.log(' --silent Run without output');
|
|
1245
|
+
console.log(' session-end Generate summary and save state');
|
|
1246
|
+
console.log(' --generate-summary Generate session summary');
|
|
1247
|
+
console.log(' --persist-state Persist session state');
|
|
1248
|
+
console.log(' --export-metrics Export performance metrics');
|
|
1249
|
+
console.log(' session-restore Load previous session state');
|
|
1250
|
+
console.log(' notify Custom notifications');
|
|
1251
|
+
|
|
1252
|
+
console.log('\nExamples:');
|
|
1253
|
+
console.log(' hooks session-start --generate-missing true --silent false');
|
|
1254
|
+
console.log(' hooks pre-command --command "npm test" --validate-safety true');
|
|
1255
|
+
console.log(' hooks pre-edit --file "src/app.js" --auto-assign-agents true');
|
|
1256
|
+
console.log(' hooks post-command --command "build" --track-metrics true');
|
|
1257
|
+
console.log(' hooks post-edit --file "src/app.js" --format true --train-neural true');
|
|
1258
|
+
console.log(' hooks session-end --generate-summary true --export-metrics true');
|
|
1259
|
+
console.log(' hooks agent-spawned --name "CodeReviewer" --type "reviewer"');
|
|
1260
|
+
console.log(' hooks notify --message "Build completed" --level "success"');
|
|
1261
|
+
|
|
1262
|
+
console.log('\nCompatibility:');
|
|
1263
|
+
console.log(' • pre-command and pre-bash are aliases');
|
|
1264
|
+
console.log(' • post-command and post-bash are aliases');
|
|
1265
|
+
console.log(' • Both --dash-case and camelCase parameters supported');
|
|
1266
|
+
console.log(' • All parameters from settings.json template supported');
|
|
1128
1267
|
}
|
|
1268
|
+
|
|
1129
1269
|
export default hooksAction;
|