kynjal-cli 3.1.3 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/agents/core/coder.md +1 -1
- package/.claude/agents/core/planner.md +2 -2
- package/.claude/agents/core/researcher.md +1 -1
- package/.claude/agents/core/reviewer.md +1 -1
- package/.claude/agents/core/tester.md +1 -1
- package/.claude/agents/data/data-ml-model.md +4 -4
- package/.claude/agents/development/dev-backend-api.md +4 -4
- package/.claude/agents/documentation/docs-api-openapi.md +4 -4
- package/.claude/agents/github/code-review-swarm.md +2 -2
- package/.claude/agents/github/issue-tracker.md +2 -2
- package/.claude/agents/github/pr-manager.md +2 -2
- package/.claude/agents/github/release-manager.md +2 -2
- package/.claude/agents/github/workflow-automation.md +2 -2
- package/.claude/agents/sparc/architecture.md +3 -3
- package/.claude/agents/sparc/pseudocode.md +2 -2
- package/.claude/agents/sparc/refinement.md +3 -3
- package/.claude/agents/sparc/specification.md +2 -2
- package/.claude/agents/swarm/adaptive-coordinator.md +1 -1
- package/.claude/agents/swarm/hierarchical-coordinator.md +1 -1
- package/.claude/agents/swarm/mesh-coordinator.md +1 -1
- package/.claude/agents/templates/base-template-generator.md +25 -4
- package/.claude/agents/templates/sparc-coordinator.md +3 -3
- package/.claude/helpers/auto-commit.sh +1 -1
- package/.claude/helpers/auto-memory-hook.mjs +27 -9
- package/.claude/helpers/hook-handler.cjs +58 -18
- package/.claude/helpers/statusline.cjs +14 -33
- package/.claude/helpers/statusline.js +3 -3
- package/.claude/settings.json +9 -9
- package/.claude/skills/reasoningbank-intelligence/SKILL.md +2 -2
- package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
- package/README.md +383 -170
- package/bin/cli.js +6 -6
- package/bin/mcp-server.js +1 -1
- package/bin/preinstall.cjs +2 -0
- package/dist/src/appliance/gguf-engine.js +664 -0
- package/dist/src/appliance/gguf-engine.js.map +1 -0
- package/dist/src/appliance/ruvllm-bridge.js +492 -0
- package/dist/src/appliance/ruvllm-bridge.js.map +1 -0
- package/dist/src/appliance/rvfa-builder.js +383 -0
- package/dist/src/appliance/rvfa-builder.js.map +1 -0
- package/dist/src/appliance/rvfa-distribution.js +533 -0
- package/dist/src/appliance/rvfa-distribution.js.map +1 -0
- package/dist/src/appliance/rvfa-format.js +465 -0
- package/dist/src/appliance/rvfa-format.js.map +1 -0
- package/dist/src/appliance/rvfa-runner.js +373 -0
- package/dist/src/appliance/rvfa-runner.js.map +1 -0
- package/dist/src/appliance/rvfa-signing.js +469 -0
- package/dist/src/appliance/rvfa-signing.js.map +1 -0
- package/dist/src/benchmarks/pretrain/index.js +542 -331
- package/dist/src/benchmarks/pretrain/index.js.map +1 -1
- package/dist/src/commands/agent.d.ts.map +1 -1
- package/dist/src/commands/agent.js +725 -502
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze.js +1548 -1218
- package/dist/src/commands/analyze.js.map +1 -1
- package/dist/src/commands/appliance-advanced.d.ts +9 -0
- package/dist/src/commands/appliance-advanced.d.ts.map +1 -0
- package/dist/src/commands/appliance-advanced.js +324 -0
- package/dist/src/commands/appliance-advanced.js.map +1 -0
- package/dist/src/commands/appliance.d.ts +8 -0
- package/dist/src/commands/appliance.d.ts.map +1 -0
- package/dist/src/commands/appliance.js +581 -0
- package/dist/src/commands/appliance.js.map +1 -0
- package/dist/src/commands/benchmark.js +523 -372
- package/dist/src/commands/benchmark.js.map +1 -1
- package/dist/src/commands/claims.js +364 -274
- package/dist/src/commands/claims.js.map +1 -1
- package/dist/src/commands/cleanup.d.ts +13 -0
- package/dist/src/commands/cleanup.d.ts.map +1 -0
- package/dist/src/commands/cleanup.js +262 -0
- package/dist/src/commands/cleanup.js.map +1 -0
- package/dist/src/commands/completions.js +118 -477
- package/dist/src/commands/completions.js.map +1 -1
- package/dist/src/commands/config.js +303 -237
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/daemon.d.ts.map +1 -1
- package/dist/src/commands/daemon.js +597 -425
- package/dist/src/commands/daemon.js.map +1 -1
- package/dist/src/commands/deployment.js +275 -194
- package/dist/src/commands/deployment.js.map +1 -1
- package/dist/src/commands/doctor.d.ts.map +1 -1
- package/dist/src/commands/doctor.js +690 -460
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/embeddings.js +1543 -1293
- package/dist/src/commands/embeddings.js.map +1 -1
- package/dist/src/commands/guidance.js +596 -449
- package/dist/src/commands/guidance.js.map +1 -1
- package/dist/src/commands/hive-mind.js +938 -854
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +3677 -2570
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.js +322 -122
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.d.ts +1 -1
- package/dist/src/commands/init.d.ts.map +1 -1
- package/dist/src/commands/init.js +943 -787
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/issues.js +558 -383
- package/dist/src/commands/issues.js.map +1 -1
- package/dist/src/commands/mcp.d.ts.map +1 -1
- package/dist/src/commands/mcp.js +605 -475
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory.d.ts.map +1 -1
- package/dist/src/commands/memory.js +1031 -814
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/migrate.js +347 -282
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/neural.d.ts.map +1 -1
- package/dist/src/commands/neural.js +1563 -1283
- package/dist/src/commands/neural.js.map +1 -1
- package/dist/src/commands/performance.js +643 -497
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/plugins.js +841 -668
- package/dist/src/commands/plugins.js.map +1 -1
- package/dist/src/commands/process.js +447 -392
- package/dist/src/commands/process.js.map +1 -1
- package/dist/src/commands/progress.js +256 -162
- package/dist/src/commands/progress.js.map +1 -1
- package/dist/src/commands/providers.js +220 -150
- package/dist/src/commands/providers.js.map +1 -1
- package/dist/src/commands/route.js +665 -520
- package/dist/src/commands/route.js.map +1 -1
- package/dist/src/commands/ruvector/backup.js +651 -505
- package/dist/src/commands/ruvector/backup.js.map +1 -1
- package/dist/src/commands/ruvector/benchmark.js +401 -349
- package/dist/src/commands/ruvector/benchmark.js.map +1 -1
- package/dist/src/commands/ruvector/import.js +267 -225
- package/dist/src/commands/ruvector/import.js.map +1 -1
- package/dist/src/commands/ruvector/index.js +75 -37
- package/dist/src/commands/ruvector/index.js.map +1 -1
- package/dist/src/commands/ruvector/init.js +359 -336
- package/dist/src/commands/ruvector/init.js.map +1 -1
- package/dist/src/commands/ruvector/migrate.js +322 -335
- package/dist/src/commands/ruvector/migrate.js.map +1 -1
- package/dist/src/commands/ruvector/optimize.js +431 -375
- package/dist/src/commands/ruvector/optimize.js.map +1 -1
- package/dist/src/commands/ruvector/setup.js +117 -703
- package/dist/src/commands/ruvector/setup.js.map +1 -1
- package/dist/src/commands/ruvector/status.js +419 -364
- package/dist/src/commands/ruvector/status.js.map +1 -1
- package/dist/src/commands/security.d.ts.map +1 -1
- package/dist/src/commands/security.js +610 -456
- package/dist/src/commands/security.js.map +1 -1
- package/dist/src/commands/session.d.ts +1 -1
- package/dist/src/commands/session.js +627 -505
- package/dist/src/commands/session.js.map +1 -1
- package/dist/src/commands/start.d.ts +1 -1
- package/dist/src/commands/start.js +368 -271
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.d.ts +1 -1
- package/dist/src/commands/status.d.ts.map +1 -1
- package/dist/src/commands/status.js +492 -379
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/swarm.js +488 -408
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/task.d.ts +1 -1
- package/dist/src/commands/task.js +539 -424
- package/dist/src/commands/task.js.map +1 -1
- package/dist/src/commands/transfer-store.js +412 -322
- package/dist/src/commands/transfer-store.js.map +1 -1
- package/dist/src/commands/update.js +291 -196
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/workflow.js +486 -386
- package/dist/src/commands/workflow.js.map +1 -1
- package/dist/src/config-adapter.js +40 -39
- package/dist/src/config-adapter.js.map +1 -1
- package/dist/src/index.js +416 -312
- package/dist/src/index.js.map +1 -1
- package/dist/src/infrastructure/in-memory-repositories.js +507 -246
- package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
- package/dist/src/init/claudemd-generator.js +78 -368
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.js +1019 -1345
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.js +60 -635
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/init/index.d.ts +1 -1
- package/dist/src/init/index.d.ts.map +1 -1
- package/dist/src/init/index.js +1 -1
- package/dist/src/init/index.js.map +1 -1
- package/dist/src/init/mcp-generator.d.ts +0 -1
- package/dist/src/init/mcp-generator.d.ts.map +1 -1
- package/dist/src/init/mcp-generator.js +62 -42
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/init/settings-generator.d.ts.map +1 -1
- package/dist/src/init/settings-generator.js +167 -100
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.d.ts +16 -8
- package/dist/src/init/statusline-generator.d.ts.map +1 -1
- package/dist/src/init/statusline-generator.js +20 -1300
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/init/types.d.ts +15 -5
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +66 -76
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/mcp-client.js +130 -76
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.js +758 -445
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +492 -391
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/agentdb-tools.d.ts +30 -0
- package/dist/src/mcp-tools/agentdb-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/agentdb-tools.js +758 -0
- package/dist/src/mcp-tools/agentdb-tools.js.map +1 -0
- package/dist/src/mcp-tools/analyze-tools.js +236 -172
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
- package/dist/src/mcp-tools/auto-install.js +142 -80
- package/dist/src/mcp-tools/auto-install.js.map +1 -1
- package/dist/src/mcp-tools/browser-tools.js +375 -252
- package/dist/src/mcp-tools/browser-tools.js.map +1 -1
- package/dist/src/mcp-tools/claims-tools.js +565 -473
- package/dist/src/mcp-tools/claims-tools.js.map +1 -1
- package/dist/src/mcp-tools/config-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +284 -190
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.js +600 -349
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
- package/dist/src/mcp-tools/daa-tools.js +367 -289
- package/dist/src/mcp-tools/daa-tools.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +693 -582
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/github-tools.js +312 -261
- package/dist/src/mcp-tools/github-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +718 -423
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +2726 -1978
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/index.d.ts +2 -0
- package/dist/src/mcp-tools/index.d.ts.map +1 -1
- package/dist/src/mcp-tools/index.js +2 -0
- package/dist/src/mcp-tools/index.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +514 -329
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +428 -326
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +480 -420
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/mcp-tools/progress-tools.js +278 -204
- package/dist/src/mcp-tools/progress-tools.js.map +1 -1
- package/dist/src/mcp-tools/ruvllm-tools.d.ts +9 -0
- package/dist/src/mcp-tools/ruvllm-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/ruvllm-tools.js +399 -0
- package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -0
- package/dist/src/mcp-tools/security-tools.js +429 -297
- package/dist/src/mcp-tools/security-tools.js.map +1 -1
- package/dist/src/mcp-tools/session-tools.js +234 -185
- package/dist/src/mcp-tools/session-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.d.ts +2 -1
- package/dist/src/mcp-tools/swarm-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +303 -64
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/system-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/system-tools.js +352 -200
- package/dist/src/mcp-tools/system-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/task-tools.js +357 -189
- package/dist/src/mcp-tools/task-tools.js.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.js +196 -148
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.js +333 -186
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts +9 -0
- package/dist/src/mcp-tools/wasm-agent-tools.d.ts.map +1 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js +377 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -0
- package/dist/src/mcp-tools/workflow-tools.d.ts.map +1 -1
- package/dist/src/mcp-tools/workflow-tools.js +471 -335
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
- package/dist/src/memory/ewc-consolidation.js +345 -173
- package/dist/src/memory/ewc-consolidation.js.map +1 -1
- package/dist/src/memory/intelligence.js +841 -359
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.js +1964 -0
- package/dist/src/memory/memory-bridge.js.map +1 -0
- package/dist/src/memory/memory-initializer.js +1895 -1602
- package/dist/src/memory/memory-initializer.js.map +1 -1
- package/dist/src/memory/sona-optimizer.js +329 -199
- package/dist/src/memory/sona-optimizer.js.map +1 -1
- package/dist/src/output.d.ts +2 -2
- package/dist/src/output.d.ts.map +1 -1
- package/dist/src/output.js +273 -242
- package/dist/src/output.js.map +1 -1
- package/dist/src/parser.js +217 -124
- package/dist/src/parser.js.map +1 -1
- package/dist/src/plugins/manager.js +531 -278
- package/dist/src/plugins/manager.js.map +1 -1
- package/dist/src/plugins/store/discovery.js +362 -275
- package/dist/src/plugins/store/discovery.js.map +1 -1
- package/dist/src/plugins/store/index.js +105 -48
- package/dist/src/plugins/store/index.js.map +1 -1
- package/dist/src/plugins/store/search.js +107 -69
- package/dist/src/plugins/store/search.js.map +1 -1
- package/dist/src/plugins/tests/demo-plugin-store.js +160 -113
- package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
- package/dist/src/plugins/tests/standalone-test.js +223 -172
- package/dist/src/plugins/tests/standalone-test.js.map +1 -1
- package/dist/src/plugins/tests/test-plugin-store.js +228 -190
- package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
- package/dist/src/production/circuit-breaker.js +126 -62
- package/dist/src/production/circuit-breaker.js.map +1 -1
- package/dist/src/production/error-handler.js +156 -86
- package/dist/src/production/error-handler.js.map +1 -1
- package/dist/src/production/monitoring.js +220 -139
- package/dist/src/production/monitoring.js.map +1 -1
- package/dist/src/production/rate-limiter.js +93 -74
- package/dist/src/production/rate-limiter.js.map +1 -1
- package/dist/src/production/retry.js +167 -75
- package/dist/src/production/retry.js.map +1 -1
- package/dist/src/prompt.js +560 -436
- package/dist/src/prompt.js.map +1 -1
- package/dist/src/runtime/headless.js +289 -200
- package/dist/src/runtime/headless.js.map +1 -1
- package/dist/src/ruvector/agent-wasm.js +511 -0
- package/dist/src/ruvector/agent-wasm.js.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +232 -145
- package/dist/src/ruvector/ast-analyzer.js.map +1 -1
- package/dist/src/ruvector/coverage-router.js +419 -287
- package/dist/src/ruvector/coverage-router.js.map +1 -1
- package/dist/src/ruvector/coverage-tools.js +101 -56
- package/dist/src/ruvector/coverage-tools.js.map +1 -1
- package/dist/src/ruvector/diff-classifier.js +451 -324
- package/dist/src/ruvector/diff-classifier.js.map +1 -1
- package/dist/src/ruvector/enhanced-model-router.js +337 -251
- package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
- package/dist/src/ruvector/flash-attention.js +254 -223
- package/dist/src/ruvector/flash-attention.js.map +1 -1
- package/dist/src/ruvector/graph-analyzer.js +680 -486
- package/dist/src/ruvector/graph-analyzer.js.map +1 -1
- package/dist/src/ruvector/index.js +113 -27
- package/dist/src/ruvector/index.js.map +1 -1
- package/dist/src/ruvector/lora-adapter.js +248 -155
- package/dist/src/ruvector/lora-adapter.js.map +1 -1
- package/dist/src/ruvector/model-router.js +248 -175
- package/dist/src/ruvector/model-router.js.map +1 -1
- package/dist/src/ruvector/moe-router.js +286 -228
- package/dist/src/ruvector/moe-router.js.map +1 -1
- package/dist/src/ruvector/q-learning-router.js +338 -257
- package/dist/src/ruvector/q-learning-router.js.map +1 -1
- package/dist/src/ruvector/ruvllm-wasm.js +527 -0
- package/dist/src/ruvector/ruvllm-wasm.js.map +1 -0
- package/dist/src/ruvector/semantic-router.js +67 -60
- package/dist/src/ruvector/semantic-router.js.map +1 -1
- package/dist/src/ruvector/vector-db.js +205 -119
- package/dist/src/ruvector/vector-db.js.map +1 -1
- package/dist/src/services/agentic-flow-bridge.js +168 -0
- package/dist/src/services/agentic-flow-bridge.js.map +1 -0
- package/dist/src/services/claim-service.js +940 -615
- package/dist/src/services/claim-service.js.map +1 -1
- package/dist/src/services/container-worker-pool.js +669 -399
- package/dist/src/services/container-worker-pool.js.map +1 -1
- package/dist/src/services/headless-worker-executor.js +467 -441
- package/dist/src/services/headless-worker-executor.js.map +1 -1
- package/dist/src/services/index.d.ts +5 -5
- package/dist/src/services/index.d.ts.map +1 -1
- package/dist/src/services/index.js +4 -4
- package/dist/src/services/index.js.map +1 -1
- package/dist/src/services/registry-api.js +201 -93
- package/dist/src/services/registry-api.js.map +1 -1
- package/dist/src/services/ruvector-training.js +414 -144
- package/dist/src/services/ruvector-training.js.map +1 -1
- package/dist/src/services/worker-daemon.js +928 -531
- package/dist/src/services/worker-daemon.js.map +1 -1
- package/dist/src/services/worker-queue.js +550 -331
- package/dist/src/services/worker-queue.js.map +1 -1
- package/dist/src/suggest.js +55 -45
- package/dist/src/suggest.js.map +1 -1
- package/dist/src/transfer/anonymization/index.js +37 -29
- package/dist/src/transfer/anonymization/index.js.map +1 -1
- package/dist/src/transfer/deploy-seraphine.d.ts +1 -1
- package/dist/src/transfer/deploy-seraphine.js +156 -129
- package/dist/src/transfer/deploy-seraphine.js.map +1 -1
- package/dist/src/transfer/export.js +142 -84
- package/dist/src/transfer/export.js.map +1 -1
- package/dist/src/transfer/index.d.ts +1 -1
- package/dist/src/transfer/index.d.ts.map +1 -1
- package/dist/src/transfer/index.js +2 -0
- package/dist/src/transfer/index.js.map +1 -1
- package/dist/src/transfer/ipfs/client.js +337 -179
- package/dist/src/transfer/ipfs/client.js.map +1 -1
- package/dist/src/transfer/ipfs/upload.js +434 -290
- package/dist/src/transfer/ipfs/upload.js.map +1 -1
- package/dist/src/transfer/models/seraphine.js +58 -58
- package/dist/src/transfer/models/seraphine.js.map +1 -1
- package/dist/src/transfer/serialization/cfp.js +37 -33
- package/dist/src/transfer/serialization/cfp.js.map +1 -1
- package/dist/src/transfer/storage/gcs.js +248 -139
- package/dist/src/transfer/storage/gcs.js.map +1 -1
- package/dist/src/transfer/store/discovery.js +353 -243
- package/dist/src/transfer/store/discovery.js.map +1 -1
- package/dist/src/transfer/store/download.js +365 -243
- package/dist/src/transfer/store/download.js.map +1 -1
- package/dist/src/transfer/store/index.js +130 -63
- package/dist/src/transfer/store/index.js.map +1 -1
- package/dist/src/transfer/store/publish.js +258 -184
- package/dist/src/transfer/store/publish.js.map +1 -1
- package/dist/src/transfer/store/registry.js +73 -51
- package/dist/src/transfer/store/registry.js.map +1 -1
- package/dist/src/transfer/store/search.js +96 -64
- package/dist/src/transfer/store/search.js.map +1 -1
- package/dist/src/transfer/store/tests/standalone-test.js +231 -174
- package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
- package/dist/src/transfer/test-seraphine.js +130 -95
- package/dist/src/transfer/test-seraphine.js.map +1 -1
- package/dist/src/transfer/tests/test-store.js +239 -194
- package/dist/src/transfer/tests/test-store.js.map +1 -1
- package/dist/src/types.js +56 -27
- package/dist/src/types.js.map +1 -1
- package/dist/src/update/checker.js +183 -106
- package/dist/src/update/checker.js.map +1 -1
- package/dist/src/update/executor.js +198 -135
- package/dist/src/update/executor.js.map +1 -1
- package/dist/src/update/index.js +85 -38
- package/dist/src/update/index.js.map +1 -1
- package/dist/src/update/rate-limiter.js +31 -19
- package/dist/src/update/rate-limiter.js.map +1 -1
- package/dist/src/update/validator.js +64 -38
- package/dist/src/update/validator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -10
- package/.claude/agents/custom/accessibility-auditor.yaml +0 -56
- package/.claude/agents/custom/design-architect.yaml +0 -48
- package/.claude/agents/custom/ui-developer.yaml +0 -46
- package/.claude/agents/custom/ux-researcher.yaml +0 -60
- package/dist/src/benchmarks/pretrain/index.d.ts +0 -58
- package/dist/src/benchmarks/pretrain/index.d.ts.map +0 -1
- package/dist/src/commands/index.d.ts +0 -108
- package/dist/src/commands/index.d.ts.map +0 -1
- package/dist/src/config-adapter.d.ts +0 -15
- package/dist/src/config-adapter.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -76
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/infrastructure/in-memory-repositories.d.ts +0 -68
- package/dist/src/infrastructure/in-memory-repositories.d.ts.map +0 -1
- package/dist/src/init/claudemd-generator.d.ts +0 -25
- package/dist/src/init/claudemd-generator.d.ts.map +0 -1
- package/dist/src/init/executor.d.ts +0 -41
- package/dist/src/init/executor.d.ts.map +0 -1
- package/dist/src/init/helpers-generator.d.ts +0 -60
- package/dist/src/init/helpers-generator.d.ts.map +0 -1
- package/dist/src/mcp-client.d.ts +0 -92
- package/dist/src/mcp-client.d.ts.map +0 -1
- package/dist/src/mcp-server.d.ts +0 -161
- package/dist/src/mcp-server.d.ts.map +0 -1
- package/dist/src/mcp-tools/auto-install.d.ts +0 -83
- package/dist/src/mcp-tools/auto-install.d.ts.map +0 -1
- package/dist/src/mcp-tools/types.d.ts +0 -31
- package/dist/src/mcp-tools/types.d.ts.map +0 -1
- package/dist/src/memory/ewc-consolidation.d.ts +0 -271
- package/dist/src/memory/ewc-consolidation.d.ts.map +0 -1
- package/dist/src/memory/intelligence.d.ts +0 -285
- package/dist/src/memory/intelligence.d.ts.map +0 -1
- package/dist/src/memory/memory-initializer.d.ts +0 -396
- package/dist/src/memory/memory-initializer.d.ts.map +0 -1
- package/dist/src/memory/sona-optimizer.d.ts +0 -227
- package/dist/src/memory/sona-optimizer.d.ts.map +0 -1
- package/dist/src/parser.d.ts +0 -41
- package/dist/src/parser.d.ts.map +0 -1
- package/dist/src/plugins/manager.d.ts +0 -133
- package/dist/src/plugins/manager.d.ts.map +0 -1
- package/dist/src/plugins/store/discovery.d.ts +0 -88
- package/dist/src/plugins/store/discovery.d.ts.map +0 -1
- package/dist/src/plugins/store/index.d.ts +0 -76
- package/dist/src/plugins/store/index.d.ts.map +0 -1
- package/dist/src/plugins/store/search.d.ts +0 -46
- package/dist/src/plugins/store/search.d.ts.map +0 -1
- package/dist/src/plugins/store/types.d.ts +0 -274
- package/dist/src/plugins/store/types.d.ts.map +0 -1
- package/dist/src/production/circuit-breaker.d.ts +0 -101
- package/dist/src/production/circuit-breaker.d.ts.map +0 -1
- package/dist/src/production/error-handler.d.ts +0 -92
- package/dist/src/production/error-handler.d.ts.map +0 -1
- package/dist/src/production/monitoring.d.ts +0 -161
- package/dist/src/production/monitoring.d.ts.map +0 -1
- package/dist/src/production/rate-limiter.d.ts +0 -80
- package/dist/src/production/rate-limiter.d.ts.map +0 -1
- package/dist/src/production/retry.d.ts +0 -48
- package/dist/src/production/retry.d.ts.map +0 -1
- package/dist/src/prompt.d.ts +0 -44
- package/dist/src/prompt.d.ts.map +0 -1
- package/dist/src/runtime/headless.d.ts +0 -60
- package/dist/src/runtime/headless.d.ts.map +0 -1
- package/dist/src/ruvector/ast-analyzer.d.ts +0 -67
- package/dist/src/ruvector/ast-analyzer.d.ts.map +0 -1
- package/dist/src/ruvector/coverage-router.d.ts +0 -160
- package/dist/src/ruvector/coverage-router.d.ts.map +0 -1
- package/dist/src/ruvector/diff-classifier.d.ts +0 -175
- package/dist/src/ruvector/diff-classifier.d.ts.map +0 -1
- package/dist/src/ruvector/enhanced-model-router.d.ts +0 -146
- package/dist/src/ruvector/enhanced-model-router.d.ts.map +0 -1
- package/dist/src/ruvector/flash-attention.d.ts +0 -195
- package/dist/src/ruvector/flash-attention.d.ts.map +0 -1
- package/dist/src/ruvector/graph-analyzer.d.ts +0 -187
- package/dist/src/ruvector/graph-analyzer.d.ts.map +0 -1
- package/dist/src/ruvector/index.d.ts +0 -34
- package/dist/src/ruvector/index.d.ts.map +0 -1
- package/dist/src/ruvector/lora-adapter.d.ts +0 -218
- package/dist/src/ruvector/lora-adapter.d.ts.map +0 -1
- package/dist/src/ruvector/model-router.d.ts +0 -220
- package/dist/src/ruvector/model-router.d.ts.map +0 -1
- package/dist/src/ruvector/moe-router.d.ts +0 -206
- package/dist/src/ruvector/moe-router.d.ts.map +0 -1
- package/dist/src/ruvector/q-learning-router.d.ts +0 -211
- package/dist/src/ruvector/q-learning-router.d.ts.map +0 -1
- package/dist/src/ruvector/semantic-router.d.ts +0 -77
- package/dist/src/ruvector/semantic-router.d.ts.map +0 -1
- package/dist/src/ruvector/vector-db.d.ts +0 -69
- package/dist/src/ruvector/vector-db.d.ts.map +0 -1
- package/dist/src/services/claim-service.d.ts +0 -204
- package/dist/src/services/claim-service.d.ts.map +0 -1
- package/dist/src/services/container-worker-pool.d.ts +0 -197
- package/dist/src/services/container-worker-pool.d.ts.map +0 -1
- package/dist/src/services/headless-worker-executor.d.ts +0 -304
- package/dist/src/services/headless-worker-executor.d.ts.map +0 -1
- package/dist/src/services/registry-api.d.ts +0 -58
- package/dist/src/services/registry-api.d.ts.map +0 -1
- package/dist/src/services/ruvector-training.d.ts +0 -213
- package/dist/src/services/ruvector-training.d.ts.map +0 -1
- package/dist/src/services/worker-daemon.d.ts +0 -203
- package/dist/src/services/worker-daemon.d.ts.map +0 -1
- package/dist/src/services/worker-queue.d.ts +0 -194
- package/dist/src/services/worker-queue.d.ts.map +0 -1
- package/dist/src/suggest.d.ts +0 -53
- package/dist/src/suggest.d.ts.map +0 -1
- package/dist/src/transfer/export.d.ts +0 -25
- package/dist/src/transfer/export.d.ts.map +0 -1
- package/dist/src/transfer/ipfs/client.d.ts +0 -109
- package/dist/src/transfer/ipfs/client.d.ts.map +0 -1
- package/dist/src/transfer/ipfs/upload.d.ts +0 -95
- package/dist/src/transfer/ipfs/upload.d.ts.map +0 -1
- package/dist/src/transfer/models/seraphine.d.ts +0 -72
- package/dist/src/transfer/models/seraphine.d.ts.map +0 -1
- package/dist/src/transfer/serialization/cfp.d.ts +0 -49
- package/dist/src/transfer/serialization/cfp.d.ts.map +0 -1
- package/dist/src/transfer/storage/gcs.d.ts +0 -82
- package/dist/src/transfer/storage/gcs.d.ts.map +0 -1
- package/dist/src/transfer/store/discovery.d.ts +0 -84
- package/dist/src/transfer/store/discovery.d.ts.map +0 -1
- package/dist/src/transfer/store/download.d.ts +0 -70
- package/dist/src/transfer/store/download.d.ts.map +0 -1
- package/dist/src/transfer/store/index.d.ts +0 -84
- package/dist/src/transfer/store/index.d.ts.map +0 -1
- package/dist/src/transfer/store/publish.d.ts +0 -76
- package/dist/src/transfer/store/publish.d.ts.map +0 -1
- package/dist/src/transfer/store/search.d.ts +0 -54
- package/dist/src/transfer/store/search.d.ts.map +0 -1
- package/dist/src/transfer/types.d.ts +0 -245
- package/dist/src/transfer/types.d.ts.map +0 -1
- package/dist/src/types.d.ts +0 -198
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/update/checker.d.ts +0 -34
- package/dist/src/update/checker.d.ts.map +0 -1
- package/dist/src/update/executor.d.ts +0 -32
- package/dist/src/update/executor.d.ts.map +0 -1
- package/dist/src/update/index.d.ts +0 -33
- package/dist/src/update/index.d.ts.map +0 -1
- package/dist/src/update/rate-limiter.d.ts +0 -20
- package/dist/src/update/rate-limiter.d.ts.map +0 -1
- package/dist/src/update/validator.d.ts +0 -17
- package/dist/src/update/validator.d.ts.map +0 -1
|
@@ -2,6 +2,42 @@
|
|
|
2
2
|
* V3 CLI RuVector Backup Command
|
|
3
3
|
* Backup and restore for RuVector PostgreSQL data
|
|
4
4
|
*/
|
|
5
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
15
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
16
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
17
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
18
|
+
function step(op) {
|
|
19
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
20
|
+
while (_) try {
|
|
21
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
22
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
23
|
+
switch (op[0]) {
|
|
24
|
+
case 0: case 1: t = op; break;
|
|
25
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
26
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
27
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
28
|
+
default:
|
|
29
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
30
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
31
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
32
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
33
|
+
if (t[2]) _.ops.pop();
|
|
34
|
+
_.trys.pop(); continue;
|
|
35
|
+
}
|
|
36
|
+
op = body.call(thisArg, _);
|
|
37
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
38
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
39
|
+
}
|
|
40
|
+
};
|
|
5
41
|
import { output } from '../../output.js';
|
|
6
42
|
import { confirm, input } from '../../prompt.js';
|
|
7
43
|
/**
|
|
@@ -15,7 +51,7 @@ function getConnectionConfig(ctx) {
|
|
|
15
51
|
user: ctx.flags.user || process.env.PGUSER || 'postgres',
|
|
16
52
|
password: ctx.flags.password || process.env.PGPASSWORD || '',
|
|
17
53
|
ssl: ctx.flags.ssl || process.env.PGSSLMODE === 'require',
|
|
18
|
-
schema: ctx.flags.schema || 'claude_flow'
|
|
54
|
+
schema: ctx.flags.schema || 'claude_flow'
|
|
19
55
|
};
|
|
20
56
|
}
|
|
21
57
|
/**
|
|
@@ -24,15 +60,15 @@ function getConnectionConfig(ctx) {
|
|
|
24
60
|
function formatBytes(bytes) {
|
|
25
61
|
if (bytes === 0)
|
|
26
62
|
return '0 B';
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
63
|
+
var k = 1024;
|
|
64
|
+
var sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
65
|
+
var i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
30
66
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
|
31
67
|
}
|
|
32
68
|
/**
|
|
33
69
|
* RuVector backup subcommand
|
|
34
70
|
*/
|
|
35
|
-
|
|
71
|
+
var backupSubcommand = {
|
|
36
72
|
name: 'create',
|
|
37
73
|
description: 'Create a backup of RuVector data',
|
|
38
74
|
options: [
|
|
@@ -41,78 +77,78 @@ const backupSubcommand = {
|
|
|
41
77
|
short: 'o',
|
|
42
78
|
description: 'Output file path',
|
|
43
79
|
type: 'string',
|
|
44
|
-
required: true
|
|
80
|
+
required: true
|
|
45
81
|
},
|
|
46
82
|
{
|
|
47
83
|
name: 'tables',
|
|
48
84
|
short: 't',
|
|
49
85
|
description: 'Specific tables (comma-separated)',
|
|
50
|
-
type: 'string'
|
|
86
|
+
type: 'string'
|
|
51
87
|
},
|
|
52
88
|
{
|
|
53
89
|
name: 'format',
|
|
54
90
|
short: 'f',
|
|
55
91
|
description: 'Output format',
|
|
56
92
|
type: 'string',
|
|
57
|
-
default: 'sql',
|
|
58
|
-
choices: ['sql', 'json', 'csv']
|
|
93
|
+
"default": 'sql',
|
|
94
|
+
choices: ['sql', 'json', 'csv']
|
|
59
95
|
},
|
|
60
96
|
{
|
|
61
97
|
name: 'compress',
|
|
62
98
|
short: 'c',
|
|
63
99
|
description: 'Compress output (gzip)',
|
|
64
100
|
type: 'boolean',
|
|
65
|
-
default: false
|
|
101
|
+
"default": false
|
|
66
102
|
},
|
|
67
103
|
{
|
|
68
104
|
name: 'include-indexes',
|
|
69
105
|
description: 'Include index definitions',
|
|
70
106
|
type: 'boolean',
|
|
71
|
-
default: true
|
|
107
|
+
"default": true
|
|
72
108
|
},
|
|
73
109
|
{
|
|
74
110
|
name: 'host',
|
|
75
111
|
short: 'h',
|
|
76
112
|
description: 'PostgreSQL host',
|
|
77
113
|
type: 'string',
|
|
78
|
-
default: 'localhost'
|
|
114
|
+
"default": 'localhost'
|
|
79
115
|
},
|
|
80
116
|
{
|
|
81
117
|
name: 'port',
|
|
82
118
|
short: 'p',
|
|
83
119
|
description: 'PostgreSQL port',
|
|
84
120
|
type: 'number',
|
|
85
|
-
default: 5432
|
|
121
|
+
"default": 5432
|
|
86
122
|
},
|
|
87
123
|
{
|
|
88
124
|
name: 'database',
|
|
89
125
|
short: 'd',
|
|
90
126
|
description: 'Database name',
|
|
91
|
-
type: 'string'
|
|
127
|
+
type: 'string'
|
|
92
128
|
},
|
|
93
129
|
{
|
|
94
130
|
name: 'user',
|
|
95
131
|
short: 'u',
|
|
96
132
|
description: 'Database user',
|
|
97
|
-
type: 'string'
|
|
133
|
+
type: 'string'
|
|
98
134
|
},
|
|
99
135
|
{
|
|
100
136
|
name: 'password',
|
|
101
137
|
description: 'Database password',
|
|
102
|
-
type: 'string'
|
|
138
|
+
type: 'string'
|
|
103
139
|
},
|
|
104
140
|
{
|
|
105
141
|
name: 'ssl',
|
|
106
142
|
description: 'Enable SSL',
|
|
107
143
|
type: 'boolean',
|
|
108
|
-
default: false
|
|
144
|
+
"default": false
|
|
109
145
|
},
|
|
110
146
|
{
|
|
111
147
|
name: 'schema',
|
|
112
148
|
short: 's',
|
|
113
149
|
description: 'Schema name',
|
|
114
150
|
type: 'string',
|
|
115
|
-
default: 'claude_flow'
|
|
151
|
+
"default": 'claude_flow'
|
|
116
152
|
},
|
|
117
153
|
],
|
|
118
154
|
examples: [
|
|
@@ -120,246 +156,275 @@ const backupSubcommand = {
|
|
|
120
156
|
{ command: 'claude-flow ruvector backup create -o backup.json --format json', description: 'Create JSON backup' },
|
|
121
157
|
{ command: 'claude-flow ruvector backup create -o backup.sql.gz --compress', description: 'Compressed backup' },
|
|
122
158
|
],
|
|
123
|
-
action:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
if (
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
if (typeof val === 'string')
|
|
273
|
-
return `'${val.replace(/'/g, "''")}'`;
|
|
274
|
-
if (typeof val === 'object')
|
|
275
|
-
return `'${JSON.stringify(val).replace(/'/g, "''")}'`;
|
|
276
|
-
return String(val);
|
|
277
|
-
});
|
|
278
|
-
lines.push(`INSERT INTO ${config.schema}.${table.name} (${table.columns.join(', ')}) VALUES (${values.join(', ')});`);
|
|
279
|
-
}
|
|
159
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
160
|
+
var config, outputPath, tablesFilter, format, compress, includeIndexes, spinner, fs, path, promisify, pg, _a, client, tables, tablesResult, backupData, totalRows, _i, tables_1, tableName, columnsResult, columns, dataResult, indexResult, content, lines, _b, _c, table, _loop_1, _d, _e, row, _f, _g, idx, lines, _h, _j, table, _loop_2, _k, _l, row, zlib, gzip, compressed, fileSize, error_1;
|
|
161
|
+
return __generator(this, function (_m) {
|
|
162
|
+
switch (_m.label) {
|
|
163
|
+
case 0:
|
|
164
|
+
config = getConnectionConfig(ctx);
|
|
165
|
+
outputPath = ctx.flags.output;
|
|
166
|
+
tablesFilter = ctx.flags.tables;
|
|
167
|
+
format = ctx.flags.format || 'sql';
|
|
168
|
+
compress = ctx.flags.compress;
|
|
169
|
+
includeIndexes = ctx.flags['include-indexes'] !== false;
|
|
170
|
+
output.writeln();
|
|
171
|
+
output.writeln(output.bold('RuVector Backup'));
|
|
172
|
+
output.writeln(output.dim('='.repeat(60)));
|
|
173
|
+
output.writeln();
|
|
174
|
+
if (!config.database) {
|
|
175
|
+
output.printError('Database name is required. Use --database or -d flag, or set PGDATABASE env.');
|
|
176
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
177
|
+
}
|
|
178
|
+
if (!(!outputPath && ctx.interactive)) return [3 /*break*/, 2];
|
|
179
|
+
return [4 /*yield*/, input({
|
|
180
|
+
message: 'Output file path:',
|
|
181
|
+
"default": "ruvector_backup_" + new Date().toISOString().split('T')[0] + "." + format,
|
|
182
|
+
validate: function (v) { return v.length > 0 || 'Output path is required'; }
|
|
183
|
+
})];
|
|
184
|
+
case 1:
|
|
185
|
+
outputPath = _m.sent();
|
|
186
|
+
_m.label = 2;
|
|
187
|
+
case 2:
|
|
188
|
+
if (!outputPath) {
|
|
189
|
+
output.printError('Output path is required. Use --output or -o flag.');
|
|
190
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
191
|
+
}
|
|
192
|
+
spinner = output.createSpinner({ text: 'Connecting to PostgreSQL...', spinner: 'dots' });
|
|
193
|
+
spinner.start();
|
|
194
|
+
_m.label = 3;
|
|
195
|
+
case 3:
|
|
196
|
+
_m.trys.push([3, 27, , 28]);
|
|
197
|
+
return [4 /*yield*/, import('fs')];
|
|
198
|
+
case 4:
|
|
199
|
+
fs = _m.sent();
|
|
200
|
+
return [4 /*yield*/, import('path')];
|
|
201
|
+
case 5:
|
|
202
|
+
path = _m.sent();
|
|
203
|
+
return [4 /*yield*/, import('util')];
|
|
204
|
+
case 6:
|
|
205
|
+
promisify = (_m.sent()).promisify;
|
|
206
|
+
pg = null;
|
|
207
|
+
_m.label = 7;
|
|
208
|
+
case 7:
|
|
209
|
+
_m.trys.push([7, 9, , 10]);
|
|
210
|
+
return [4 /*yield*/, import('pg')];
|
|
211
|
+
case 8:
|
|
212
|
+
pg = _m.sent();
|
|
213
|
+
return [3 /*break*/, 10];
|
|
214
|
+
case 9:
|
|
215
|
+
_a = _m.sent();
|
|
216
|
+
spinner.fail('PostgreSQL driver not found');
|
|
217
|
+
output.printError('Install pg package: npm install pg');
|
|
218
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
219
|
+
case 10:
|
|
220
|
+
client = new pg.Client({
|
|
221
|
+
host: config.host,
|
|
222
|
+
port: config.port,
|
|
223
|
+
database: config.database,
|
|
224
|
+
user: config.user,
|
|
225
|
+
password: config.password,
|
|
226
|
+
ssl: config.ssl ? { rejectUnauthorized: false } : false
|
|
227
|
+
});
|
|
228
|
+
return [4 /*yield*/, client.connect()];
|
|
229
|
+
case 11:
|
|
230
|
+
_m.sent();
|
|
231
|
+
spinner.succeed('Connected to PostgreSQL');
|
|
232
|
+
// Get tables to backup
|
|
233
|
+
spinner.setText('Discovering tables...');
|
|
234
|
+
spinner.start();
|
|
235
|
+
tables = [];
|
|
236
|
+
if (!tablesFilter) return [3 /*break*/, 12];
|
|
237
|
+
tables = tablesFilter.split(',').map(function (t) { return t.trim(); });
|
|
238
|
+
return [3 /*break*/, 14];
|
|
239
|
+
case 12: return [4 /*yield*/, client.query("\n SELECT table_name FROM information_schema.tables\n WHERE table_schema = $1 AND table_type = 'BASE TABLE'\n ORDER BY table_name\n ", [config.schema])];
|
|
240
|
+
case 13:
|
|
241
|
+
tablesResult = _m.sent();
|
|
242
|
+
tables = tablesResult.rows.map(function (r) { return r.table_name; });
|
|
243
|
+
_m.label = 14;
|
|
244
|
+
case 14:
|
|
245
|
+
spinner.succeed("Found " + tables.length + " tables to backup");
|
|
246
|
+
backupData = {
|
|
247
|
+
metadata: {
|
|
248
|
+
backupDate: new Date().toISOString(),
|
|
249
|
+
database: config.database,
|
|
250
|
+
schema: config.schema,
|
|
251
|
+
format: format,
|
|
252
|
+
version: '1.0.0'
|
|
253
|
+
},
|
|
254
|
+
schema: config.schema,
|
|
255
|
+
tables: [],
|
|
256
|
+
indexes: []
|
|
257
|
+
};
|
|
258
|
+
totalRows = 0;
|
|
259
|
+
_i = 0, tables_1 = tables;
|
|
260
|
+
_m.label = 15;
|
|
261
|
+
case 15:
|
|
262
|
+
if (!(_i < tables_1.length)) return [3 /*break*/, 19];
|
|
263
|
+
tableName = tables_1[_i];
|
|
264
|
+
spinner.setText("Exporting " + tableName + "...");
|
|
265
|
+
spinner.start();
|
|
266
|
+
return [4 /*yield*/, client.query("\n SELECT column_name, data_type\n FROM information_schema.columns\n WHERE table_schema = $1 AND table_name = $2\n ORDER BY ordinal_position\n ", [config.schema, tableName])];
|
|
267
|
+
case 16:
|
|
268
|
+
columnsResult = _m.sent();
|
|
269
|
+
columns = columnsResult.rows.map(function (r) { return r.column_name; });
|
|
270
|
+
return [4 /*yield*/, client.query("\n SELECT * FROM " + config.schema + "." + tableName + "\n ")];
|
|
271
|
+
case 17:
|
|
272
|
+
dataResult = _m.sent();
|
|
273
|
+
backupData.tables.push({
|
|
274
|
+
name: tableName,
|
|
275
|
+
columns: columns,
|
|
276
|
+
rows: dataResult.rows
|
|
277
|
+
});
|
|
278
|
+
totalRows += dataResult.rows.length;
|
|
279
|
+
spinner.setText("Exporting " + tableName + "... (" + dataResult.rows.length + " rows)");
|
|
280
|
+
_m.label = 18;
|
|
281
|
+
case 18:
|
|
282
|
+
_i++;
|
|
283
|
+
return [3 /*break*/, 15];
|
|
284
|
+
case 19:
|
|
285
|
+
spinner.succeed("Exported " + totalRows.toLocaleString() + " rows from " + tables.length + " tables");
|
|
286
|
+
if (!includeIndexes) return [3 /*break*/, 21];
|
|
287
|
+
spinner.setText('Exporting index definitions...');
|
|
288
|
+
spinner.start();
|
|
289
|
+
return [4 /*yield*/, client.query("\n SELECT pg_get_indexdef(i.oid) as indexdef\n FROM pg_index idx\n JOIN pg_class i ON i.oid = idx.indexrelid\n JOIN pg_class t ON t.oid = idx.indrelid\n JOIN pg_namespace n ON n.oid = t.relnamespace\n WHERE n.nspname = $1\n AND NOT idx.indisprimary\n ", [config.schema])];
|
|
290
|
+
case 20:
|
|
291
|
+
indexResult = _m.sent();
|
|
292
|
+
backupData.indexes = indexResult.rows.map(function (r) { return r.indexdef; });
|
|
293
|
+
spinner.succeed("Exported " + backupData.indexes.length + " index definitions");
|
|
294
|
+
_m.label = 21;
|
|
295
|
+
case 21: return [4 /*yield*/, client.end()];
|
|
296
|
+
case 22:
|
|
297
|
+
_m.sent();
|
|
298
|
+
// Write backup file
|
|
299
|
+
spinner.setText("Writing backup to " + outputPath + "...");
|
|
300
|
+
spinner.start();
|
|
301
|
+
content = void 0;
|
|
302
|
+
if (format === 'sql') {
|
|
303
|
+
lines = [];
|
|
304
|
+
lines.push("-- RuVector Backup");
|
|
305
|
+
lines.push("-- Generated: " + backupData.metadata.backupDate);
|
|
306
|
+
lines.push("-- Database: " + config.database);
|
|
307
|
+
lines.push("-- Schema: " + config.schema);
|
|
280
308
|
lines.push('');
|
|
309
|
+
lines.push("CREATE SCHEMA IF NOT EXISTS " + config.schema + ";");
|
|
310
|
+
lines.push('');
|
|
311
|
+
for (_b = 0, _c = backupData.tables; _b < _c.length; _b++) {
|
|
312
|
+
table = _c[_b];
|
|
313
|
+
lines.push("-- Table: " + table.name);
|
|
314
|
+
lines.push("-- Rows: " + table.rows.length);
|
|
315
|
+
lines.push('');
|
|
316
|
+
if (table.rows.length > 0) {
|
|
317
|
+
_loop_1 = function (row) {
|
|
318
|
+
var values = table.columns.map(function (col) {
|
|
319
|
+
var val = row[col];
|
|
320
|
+
if (val === null || val === undefined)
|
|
321
|
+
return 'NULL';
|
|
322
|
+
if (typeof val === 'string')
|
|
323
|
+
return "'" + val.replace(/'/g, "''") + "'";
|
|
324
|
+
if (typeof val === 'object')
|
|
325
|
+
return "'" + JSON.stringify(val).replace(/'/g, "''") + "'";
|
|
326
|
+
return String(val);
|
|
327
|
+
});
|
|
328
|
+
lines.push("INSERT INTO " + config.schema + "." + table.name + " (" + table.columns.join(', ') + ") VALUES (" + values.join(', ') + ");");
|
|
329
|
+
};
|
|
330
|
+
for (_d = 0, _e = table.rows; _d < _e.length; _d++) {
|
|
331
|
+
row = _e[_d];
|
|
332
|
+
_loop_1(row);
|
|
333
|
+
}
|
|
334
|
+
lines.push('');
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
// Add indexes
|
|
338
|
+
if (includeIndexes && backupData.indexes.length > 0) {
|
|
339
|
+
lines.push('-- Indexes');
|
|
340
|
+
for (_f = 0, _g = backupData.indexes; _f < _g.length; _f++) {
|
|
341
|
+
idx = _g[_f];
|
|
342
|
+
lines.push(idx + ";");
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
content = lines.join('\n');
|
|
281
346
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
if (includeIndexes && backupData.indexes.length > 0) {
|
|
285
|
-
lines.push('-- Indexes');
|
|
286
|
-
for (const idx of backupData.indexes) {
|
|
287
|
-
lines.push(`${idx};`);
|
|
347
|
+
else if (format === 'json') {
|
|
348
|
+
content = JSON.stringify(backupData, null, 2);
|
|
288
349
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
350
|
+
else {
|
|
351
|
+
lines = [];
|
|
352
|
+
for (_h = 0, _j = backupData.tables; _h < _j.length; _h++) {
|
|
353
|
+
table = _j[_h];
|
|
354
|
+
lines.push("# Table: " + table.name);
|
|
355
|
+
lines.push(table.columns.join(','));
|
|
356
|
+
_loop_2 = function (row) {
|
|
357
|
+
var values = table.columns.map(function (col) {
|
|
358
|
+
var val = row[col];
|
|
359
|
+
if (val === null || val === undefined)
|
|
360
|
+
return '';
|
|
361
|
+
var str = typeof val === 'object' ? JSON.stringify(val) : String(val);
|
|
362
|
+
return str.includes(',') || str.includes('"') ? "\"" + str.replace(/"/g, '""') + "\"" : str;
|
|
363
|
+
});
|
|
364
|
+
lines.push(values.join(','));
|
|
365
|
+
};
|
|
366
|
+
for (_k = 0, _l = table.rows; _k < _l.length; _k++) {
|
|
367
|
+
row = _l[_k];
|
|
368
|
+
_loop_2(row);
|
|
369
|
+
}
|
|
370
|
+
lines.push('');
|
|
371
|
+
}
|
|
372
|
+
content = lines.join('\n');
|
|
310
373
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
374
|
+
if (!compress) return [3 /*break*/, 25];
|
|
375
|
+
return [4 /*yield*/, import('zlib')];
|
|
376
|
+
case 23:
|
|
377
|
+
zlib = _m.sent();
|
|
378
|
+
gzip = promisify(zlib.gzip);
|
|
379
|
+
return [4 /*yield*/, gzip(Buffer.from(content, 'utf-8'))];
|
|
380
|
+
case 24:
|
|
381
|
+
compressed = _m.sent();
|
|
382
|
+
outputPath = outputPath.endsWith('.gz') ? outputPath : outputPath + ".gz";
|
|
383
|
+
fs.writeFileSync(outputPath, compressed);
|
|
384
|
+
return [3 /*break*/, 26];
|
|
385
|
+
case 25:
|
|
386
|
+
fs.writeFileSync(outputPath, content, 'utf-8');
|
|
387
|
+
_m.label = 26;
|
|
388
|
+
case 26:
|
|
389
|
+
fileSize = fs.statSync(outputPath).size;
|
|
390
|
+
spinner.succeed("Backup written to " + outputPath + " (" + formatBytes(fileSize) + ")");
|
|
391
|
+
output.writeln();
|
|
392
|
+
output.printSuccess('Backup completed successfully!');
|
|
393
|
+
output.writeln();
|
|
394
|
+
output.printBox([
|
|
395
|
+
"Output: " + outputPath,
|
|
396
|
+
"Format: " + format.toUpperCase() + (compress ? ' (gzip compressed)' : ''),
|
|
397
|
+
"Size: " + formatBytes(fileSize),
|
|
398
|
+
"Tables: " + tables.length,
|
|
399
|
+
"Total Rows: " + totalRows.toLocaleString(),
|
|
400
|
+
"Indexes: " + backupData.indexes.length,
|
|
401
|
+
].join('\n'), 'Backup Summary');
|
|
402
|
+
return [2 /*return*/, {
|
|
403
|
+
success: true,
|
|
404
|
+
data: {
|
|
405
|
+
outputPath: outputPath,
|
|
406
|
+
format: format,
|
|
407
|
+
compressed: compress,
|
|
408
|
+
tables: tables.length,
|
|
409
|
+
totalRows: totalRows,
|
|
410
|
+
indexes: backupData.indexes.length,
|
|
411
|
+
fileSize: fileSize
|
|
412
|
+
}
|
|
413
|
+
}];
|
|
414
|
+
case 27:
|
|
415
|
+
error_1 = _m.sent();
|
|
416
|
+
spinner.fail('Backup failed');
|
|
417
|
+
output.printError(error_1 instanceof Error ? error_1.message : String(error_1));
|
|
418
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
419
|
+
case 28: return [2 /*return*/];
|
|
322
420
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
const fileSize = fs.statSync(outputPath).size;
|
|
327
|
-
spinner.succeed(`Backup written to ${outputPath} (${formatBytes(fileSize)})`);
|
|
328
|
-
output.writeln();
|
|
329
|
-
output.printSuccess('Backup completed successfully!');
|
|
330
|
-
output.writeln();
|
|
331
|
-
output.printBox([
|
|
332
|
-
`Output: ${outputPath}`,
|
|
333
|
-
`Format: ${format.toUpperCase()}${compress ? ' (gzip compressed)' : ''}`,
|
|
334
|
-
`Size: ${formatBytes(fileSize)}`,
|
|
335
|
-
`Tables: ${tables.length}`,
|
|
336
|
-
`Total Rows: ${totalRows.toLocaleString()}`,
|
|
337
|
-
`Indexes: ${backupData.indexes.length}`,
|
|
338
|
-
].join('\n'), 'Backup Summary');
|
|
339
|
-
return {
|
|
340
|
-
success: true,
|
|
341
|
-
data: {
|
|
342
|
-
outputPath,
|
|
343
|
-
format,
|
|
344
|
-
compressed: compress,
|
|
345
|
-
tables: tables.length,
|
|
346
|
-
totalRows,
|
|
347
|
-
indexes: backupData.indexes.length,
|
|
348
|
-
fileSize,
|
|
349
|
-
},
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
catch (error) {
|
|
353
|
-
spinner.fail('Backup failed');
|
|
354
|
-
output.printError(error instanceof Error ? error.message : String(error));
|
|
355
|
-
return { success: false, exitCode: 1 };
|
|
356
|
-
}
|
|
357
|
-
},
|
|
421
|
+
});
|
|
422
|
+
}); }
|
|
358
423
|
};
|
|
359
424
|
/**
|
|
360
425
|
* RuVector restore subcommand
|
|
361
426
|
*/
|
|
362
|
-
|
|
427
|
+
var restoreSubcommand = {
|
|
363
428
|
name: 'restore',
|
|
364
429
|
description: 'Restore RuVector data from backup',
|
|
365
430
|
options: [
|
|
@@ -368,63 +433,63 @@ const restoreSubcommand = {
|
|
|
368
433
|
short: 'i',
|
|
369
434
|
description: 'Input file path',
|
|
370
435
|
type: 'string',
|
|
371
|
-
required: true
|
|
436
|
+
required: true
|
|
372
437
|
},
|
|
373
438
|
{
|
|
374
439
|
name: 'clean',
|
|
375
440
|
description: 'Drop existing tables first',
|
|
376
441
|
type: 'boolean',
|
|
377
|
-
default: false
|
|
442
|
+
"default": false
|
|
378
443
|
},
|
|
379
444
|
{
|
|
380
445
|
name: 'dry-run',
|
|
381
446
|
description: 'Show what would be restored without executing',
|
|
382
447
|
type: 'boolean',
|
|
383
|
-
default: false
|
|
448
|
+
"default": false
|
|
384
449
|
},
|
|
385
450
|
{
|
|
386
451
|
name: 'host',
|
|
387
452
|
short: 'h',
|
|
388
453
|
description: 'PostgreSQL host',
|
|
389
454
|
type: 'string',
|
|
390
|
-
default: 'localhost'
|
|
455
|
+
"default": 'localhost'
|
|
391
456
|
},
|
|
392
457
|
{
|
|
393
458
|
name: 'port',
|
|
394
459
|
short: 'p',
|
|
395
460
|
description: 'PostgreSQL port',
|
|
396
461
|
type: 'number',
|
|
397
|
-
default: 5432
|
|
462
|
+
"default": 5432
|
|
398
463
|
},
|
|
399
464
|
{
|
|
400
465
|
name: 'database',
|
|
401
466
|
short: 'd',
|
|
402
467
|
description: 'Database name',
|
|
403
|
-
type: 'string'
|
|
468
|
+
type: 'string'
|
|
404
469
|
},
|
|
405
470
|
{
|
|
406
471
|
name: 'user',
|
|
407
472
|
short: 'u',
|
|
408
473
|
description: 'Database user',
|
|
409
|
-
type: 'string'
|
|
474
|
+
type: 'string'
|
|
410
475
|
},
|
|
411
476
|
{
|
|
412
477
|
name: 'password',
|
|
413
478
|
description: 'Database password',
|
|
414
|
-
type: 'string'
|
|
479
|
+
type: 'string'
|
|
415
480
|
},
|
|
416
481
|
{
|
|
417
482
|
name: 'ssl',
|
|
418
483
|
description: 'Enable SSL',
|
|
419
484
|
type: 'boolean',
|
|
420
|
-
default: false
|
|
485
|
+
"default": false
|
|
421
486
|
},
|
|
422
487
|
{
|
|
423
488
|
name: 'schema',
|
|
424
489
|
short: 's',
|
|
425
490
|
description: 'Schema name',
|
|
426
491
|
type: 'string',
|
|
427
|
-
default: 'claude_flow'
|
|
492
|
+
"default": 'claude_flow'
|
|
428
493
|
},
|
|
429
494
|
],
|
|
430
495
|
examples: [
|
|
@@ -432,236 +497,315 @@ const restoreSubcommand = {
|
|
|
432
497
|
{ command: 'claude-flow ruvector backup restore -i backup.json --clean', description: 'Clean restore' },
|
|
433
498
|
{ command: 'claude-flow ruvector backup restore -i backup.sql --dry-run', description: 'Preview restore' },
|
|
434
499
|
],
|
|
435
|
-
action:
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
// Check file exists
|
|
459
|
-
if (!fs.existsSync(inputPath)) {
|
|
460
|
-
spinner.fail('Backup file not found');
|
|
461
|
-
output.printError(`File not found: ${inputPath}`);
|
|
462
|
-
return { success: false, exitCode: 1 };
|
|
463
|
-
}
|
|
464
|
-
// Read file
|
|
465
|
-
let content;
|
|
466
|
-
if (inputPath.endsWith('.gz')) {
|
|
467
|
-
const zlib = await import('zlib');
|
|
468
|
-
const gunzip = promisify(zlib.gunzip);
|
|
469
|
-
const compressed = fs.readFileSync(inputPath);
|
|
470
|
-
const decompressed = await gunzip(compressed);
|
|
471
|
-
content = decompressed.toString('utf-8');
|
|
472
|
-
}
|
|
473
|
-
else {
|
|
474
|
-
content = fs.readFileSync(inputPath, 'utf-8');
|
|
475
|
-
}
|
|
476
|
-
const fileSize = fs.statSync(inputPath).size;
|
|
477
|
-
spinner.succeed(`Read backup file (${formatBytes(fileSize)})`);
|
|
478
|
-
// Determine format
|
|
479
|
-
const isJson = content.trim().startsWith('{');
|
|
480
|
-
const format = isJson ? 'json' : 'sql';
|
|
481
|
-
if (dryRun) {
|
|
482
|
-
output.printInfo('Dry run mode: showing what would be restored');
|
|
483
|
-
output.writeln();
|
|
484
|
-
if (isJson) {
|
|
485
|
-
const data = JSON.parse(content);
|
|
486
|
-
output.writeln(output.highlight('Backup metadata:'));
|
|
487
|
-
output.printTable({
|
|
488
|
-
columns: [
|
|
489
|
-
{ key: 'property', header: 'Property', width: 20 },
|
|
490
|
-
{ key: 'value', header: 'Value', width: 40 },
|
|
491
|
-
],
|
|
492
|
-
data: [
|
|
493
|
-
{ property: 'Backup Date', value: data.metadata?.backupDate || 'Unknown' },
|
|
494
|
-
{ property: 'Database', value: data.metadata?.database || 'Unknown' },
|
|
495
|
-
{ property: 'Schema', value: data.schema || 'Unknown' },
|
|
496
|
-
{ property: 'Tables', value: String(data.tables?.length || 0) },
|
|
497
|
-
{ property: 'Total Rows', value: String(data.tables?.reduce((sum, t) => sum + t.rows.length, 0) || 0) },
|
|
498
|
-
{ property: 'Indexes', value: String(data.indexes?.length || 0) },
|
|
499
|
-
],
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
else {
|
|
503
|
-
// Count SQL statements
|
|
504
|
-
const insertCount = (content.match(/INSERT INTO/gi) || []).length;
|
|
505
|
-
const createCount = (content.match(/CREATE (TABLE|INDEX)/gi) || []).length;
|
|
506
|
-
output.writeln(`SQL statements: ${insertCount} inserts, ${createCount} creates`);
|
|
507
|
-
}
|
|
508
|
-
return { success: true, data: { dryRun: true } };
|
|
509
|
-
}
|
|
510
|
-
// Confirm clean operation
|
|
511
|
-
if (clean && ctx.interactive) {
|
|
512
|
-
const confirmClean = await confirm({
|
|
513
|
-
message: 'This will drop existing tables. Continue?',
|
|
514
|
-
default: false,
|
|
515
|
-
});
|
|
516
|
-
if (!confirmClean) {
|
|
517
|
-
output.printInfo('Restore cancelled');
|
|
518
|
-
return { success: false, exitCode: 0 };
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
// Connect and restore
|
|
522
|
-
let pg = null;
|
|
523
|
-
try {
|
|
524
|
-
pg = await import('pg');
|
|
525
|
-
}
|
|
526
|
-
catch {
|
|
527
|
-
spinner.fail('PostgreSQL driver not found');
|
|
528
|
-
output.printError('Install pg package: npm install pg');
|
|
529
|
-
return { success: false, exitCode: 1 };
|
|
530
|
-
}
|
|
531
|
-
const client = new pg.Client({
|
|
532
|
-
host: config.host,
|
|
533
|
-
port: config.port,
|
|
534
|
-
database: config.database,
|
|
535
|
-
user: config.user,
|
|
536
|
-
password: config.password,
|
|
537
|
-
ssl: config.ssl ? { rejectUnauthorized: false } : false,
|
|
538
|
-
});
|
|
539
|
-
await client.connect();
|
|
540
|
-
spinner.succeed('Connected to PostgreSQL');
|
|
541
|
-
// Clean if requested
|
|
542
|
-
if (clean) {
|
|
543
|
-
spinner.setText(`Dropping schema "${config.schema}"...`);
|
|
544
|
-
spinner.start();
|
|
545
|
-
await client.query(`DROP SCHEMA IF EXISTS ${config.schema} CASCADE`);
|
|
546
|
-
await client.query(`CREATE SCHEMA ${config.schema}`);
|
|
547
|
-
spinner.succeed('Schema cleaned');
|
|
548
|
-
}
|
|
549
|
-
// Restore
|
|
550
|
-
let restoredRows = 0;
|
|
551
|
-
let restoredTables = 0;
|
|
552
|
-
let restoredIndexes = 0;
|
|
553
|
-
if (isJson) {
|
|
554
|
-
// Restore from JSON
|
|
555
|
-
const data = JSON.parse(content);
|
|
556
|
-
for (const table of data.tables || []) {
|
|
557
|
-
spinner.setText(`Restoring ${table.name}...`);
|
|
500
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
501
|
+
var config, inputPath, clean, dryRun, spinner, fs, path, promisify, content, zlib, gunzip, compressed, decompressed, fileSize, isJson, format, data, insertCount, createCount, confirmClean, pg, _a, client, restoredRows, restoredTables, restoredIndexes, data, _i, _b, table, _loop_3, _c, _d, row, _e, _f, indexDef, _g, statements, executed, _h, statements_1, stmt, error_2, error_3;
|
|
502
|
+
var _j, _k, _l, _m, _o;
|
|
503
|
+
return __generator(this, function (_p) {
|
|
504
|
+
switch (_p.label) {
|
|
505
|
+
case 0:
|
|
506
|
+
config = getConnectionConfig(ctx);
|
|
507
|
+
inputPath = ctx.flags.input;
|
|
508
|
+
clean = ctx.flags.clean;
|
|
509
|
+
dryRun = ctx.flags['dry-run'];
|
|
510
|
+
output.writeln();
|
|
511
|
+
output.writeln(output.bold('RuVector Restore'));
|
|
512
|
+
output.writeln(output.dim('='.repeat(60)));
|
|
513
|
+
output.writeln();
|
|
514
|
+
if (!config.database) {
|
|
515
|
+
output.printError('Database name is required. Use --database or -d flag, or set PGDATABASE env.');
|
|
516
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
517
|
+
}
|
|
518
|
+
if (!inputPath) {
|
|
519
|
+
output.printError('Input path is required. Use --input or -i flag.');
|
|
520
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
521
|
+
}
|
|
522
|
+
spinner = output.createSpinner({ text: 'Reading backup file...', spinner: 'dots' });
|
|
558
523
|
spinner.start();
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
524
|
+
_p.label = 1;
|
|
525
|
+
case 1:
|
|
526
|
+
_p.trys.push([1, 43, , 44]);
|
|
527
|
+
return [4 /*yield*/, import('fs')];
|
|
528
|
+
case 2:
|
|
529
|
+
fs = _p.sent();
|
|
530
|
+
return [4 /*yield*/, import('path')];
|
|
531
|
+
case 3:
|
|
532
|
+
path = _p.sent();
|
|
533
|
+
return [4 /*yield*/, import('util')];
|
|
534
|
+
case 4:
|
|
535
|
+
promisify = (_p.sent()).promisify;
|
|
536
|
+
// Check file exists
|
|
537
|
+
if (!fs.existsSync(inputPath)) {
|
|
538
|
+
spinner.fail('Backup file not found');
|
|
539
|
+
output.printError("File not found: " + inputPath);
|
|
540
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
541
|
+
}
|
|
542
|
+
content = void 0;
|
|
543
|
+
if (!inputPath.endsWith('.gz')) return [3 /*break*/, 7];
|
|
544
|
+
return [4 /*yield*/, import('zlib')];
|
|
545
|
+
case 5:
|
|
546
|
+
zlib = _p.sent();
|
|
547
|
+
gunzip = promisify(zlib.gunzip);
|
|
548
|
+
compressed = fs.readFileSync(inputPath);
|
|
549
|
+
return [4 /*yield*/, gunzip(compressed)];
|
|
550
|
+
case 6:
|
|
551
|
+
decompressed = _p.sent();
|
|
552
|
+
content = decompressed.toString('utf-8');
|
|
553
|
+
return [3 /*break*/, 8];
|
|
554
|
+
case 7:
|
|
555
|
+
content = fs.readFileSync(inputPath, 'utf-8');
|
|
556
|
+
_p.label = 8;
|
|
557
|
+
case 8:
|
|
558
|
+
fileSize = fs.statSync(inputPath).size;
|
|
559
|
+
spinner.succeed("Read backup file (" + formatBytes(fileSize) + ")");
|
|
560
|
+
isJson = content.trim().startsWith('{');
|
|
561
|
+
format = isJson ? 'json' : 'sql';
|
|
562
|
+
if (dryRun) {
|
|
563
|
+
output.printInfo('Dry run mode: showing what would be restored');
|
|
564
|
+
output.writeln();
|
|
565
|
+
if (isJson) {
|
|
566
|
+
data = JSON.parse(content);
|
|
567
|
+
output.writeln(output.highlight('Backup metadata:'));
|
|
568
|
+
output.printTable({
|
|
569
|
+
columns: [
|
|
570
|
+
{ key: 'property', header: 'Property', width: 20 },
|
|
571
|
+
{ key: 'value', header: 'Value', width: 40 },
|
|
572
|
+
],
|
|
573
|
+
data: [
|
|
574
|
+
{ property: 'Backup Date', value: ((_j = data.metadata) === null || _j === void 0 ? void 0 : _j.backupDate) || 'Unknown' },
|
|
575
|
+
{ property: 'Database', value: ((_k = data.metadata) === null || _k === void 0 ? void 0 : _k.database) || 'Unknown' },
|
|
576
|
+
{ property: 'Schema', value: data.schema || 'Unknown' },
|
|
577
|
+
{ property: 'Tables', value: String(((_l = data.tables) === null || _l === void 0 ? void 0 : _l.length) || 0) },
|
|
578
|
+
{ property: 'Total Rows', value: String(((_m = data.tables) === null || _m === void 0 ? void 0 : _m.reduce(function (sum, t) { return sum + t.rows.length; }, 0)) || 0) },
|
|
579
|
+
{ property: 'Indexes', value: String(((_o = data.indexes) === null || _o === void 0 ? void 0 : _o.length) || 0) },
|
|
580
|
+
]
|
|
581
|
+
});
|
|
574
582
|
}
|
|
575
|
-
|
|
576
|
-
|
|
583
|
+
else {
|
|
584
|
+
insertCount = (content.match(/INSERT INTO/gi) || []).length;
|
|
585
|
+
createCount = (content.match(/CREATE (TABLE|INDEX)/gi) || []).length;
|
|
586
|
+
output.writeln("SQL statements: " + insertCount + " inserts, " + createCount + " creates");
|
|
577
587
|
}
|
|
588
|
+
return [2 /*return*/, { success: true, data: { dryRun: true } }];
|
|
578
589
|
}
|
|
590
|
+
if (!(clean && ctx.interactive)) return [3 /*break*/, 10];
|
|
591
|
+
return [4 /*yield*/, confirm({
|
|
592
|
+
message: 'This will drop existing tables. Continue?',
|
|
593
|
+
"default": false
|
|
594
|
+
})];
|
|
595
|
+
case 9:
|
|
596
|
+
confirmClean = _p.sent();
|
|
597
|
+
if (!confirmClean) {
|
|
598
|
+
output.printInfo('Restore cancelled');
|
|
599
|
+
return [2 /*return*/, { success: false, exitCode: 0 }];
|
|
600
|
+
}
|
|
601
|
+
_p.label = 10;
|
|
602
|
+
case 10:
|
|
603
|
+
pg = null;
|
|
604
|
+
_p.label = 11;
|
|
605
|
+
case 11:
|
|
606
|
+
_p.trys.push([11, 13, , 14]);
|
|
607
|
+
return [4 /*yield*/, import('pg')];
|
|
608
|
+
case 12:
|
|
609
|
+
pg = _p.sent();
|
|
610
|
+
return [3 /*break*/, 14];
|
|
611
|
+
case 13:
|
|
612
|
+
_a = _p.sent();
|
|
613
|
+
spinner.fail('PostgreSQL driver not found');
|
|
614
|
+
output.printError('Install pg package: npm install pg');
|
|
615
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
616
|
+
case 14:
|
|
617
|
+
client = new pg.Client({
|
|
618
|
+
host: config.host,
|
|
619
|
+
port: config.port,
|
|
620
|
+
database: config.database,
|
|
621
|
+
user: config.user,
|
|
622
|
+
password: config.password,
|
|
623
|
+
ssl: config.ssl ? { rejectUnauthorized: false } : false
|
|
624
|
+
});
|
|
625
|
+
return [4 /*yield*/, client.connect()];
|
|
626
|
+
case 15:
|
|
627
|
+
_p.sent();
|
|
628
|
+
spinner.succeed('Connected to PostgreSQL');
|
|
629
|
+
if (!clean) return [3 /*break*/, 18];
|
|
630
|
+
spinner.setText("Dropping schema \"" + config.schema + "\"...");
|
|
631
|
+
spinner.start();
|
|
632
|
+
return [4 /*yield*/, client.query("DROP SCHEMA IF EXISTS " + config.schema + " CASCADE")];
|
|
633
|
+
case 16:
|
|
634
|
+
_p.sent();
|
|
635
|
+
return [4 /*yield*/, client.query("CREATE SCHEMA " + config.schema)];
|
|
636
|
+
case 17:
|
|
637
|
+
_p.sent();
|
|
638
|
+
spinner.succeed('Schema cleaned');
|
|
639
|
+
_p.label = 18;
|
|
640
|
+
case 18:
|
|
641
|
+
restoredRows = 0;
|
|
642
|
+
restoredTables = 0;
|
|
643
|
+
restoredIndexes = 0;
|
|
644
|
+
if (!isJson) return [3 /*break*/, 33];
|
|
645
|
+
data = JSON.parse(content);
|
|
646
|
+
_i = 0, _b = data.tables || [];
|
|
647
|
+
_p.label = 19;
|
|
648
|
+
case 19:
|
|
649
|
+
if (!(_i < _b.length)) return [3 /*break*/, 25];
|
|
650
|
+
table = _b[_i];
|
|
651
|
+
spinner.setText("Restoring " + table.name + "...");
|
|
652
|
+
spinner.start();
|
|
653
|
+
_loop_3 = function (row) {
|
|
654
|
+
var columns, values, params, _q;
|
|
655
|
+
return __generator(this, function (_r) {
|
|
656
|
+
switch (_r.label) {
|
|
657
|
+
case 0:
|
|
658
|
+
columns = Object.keys(row);
|
|
659
|
+
values = columns.map(function (col, idx) { return "$" + (idx + 1); });
|
|
660
|
+
params = columns.map(function (col) {
|
|
661
|
+
var val = row[col];
|
|
662
|
+
return typeof val === 'object' ? JSON.stringify(val) : val;
|
|
663
|
+
});
|
|
664
|
+
_r.label = 1;
|
|
665
|
+
case 1:
|
|
666
|
+
_r.trys.push([1, 3, , 4]);
|
|
667
|
+
return [4 /*yield*/, client.query("\n INSERT INTO " + config.schema + "." + table.name + " (" + columns.join(', ') + ")\n VALUES (" + values.join(', ') + ")\n ON CONFLICT DO NOTHING\n ", params)];
|
|
668
|
+
case 2:
|
|
669
|
+
_r.sent();
|
|
670
|
+
restoredRows++;
|
|
671
|
+
return [3 /*break*/, 4];
|
|
672
|
+
case 3:
|
|
673
|
+
_q = _r.sent();
|
|
674
|
+
return [3 /*break*/, 4];
|
|
675
|
+
case 4: return [2 /*return*/];
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
};
|
|
679
|
+
_c = 0, _d = table.rows;
|
|
680
|
+
_p.label = 20;
|
|
681
|
+
case 20:
|
|
682
|
+
if (!(_c < _d.length)) return [3 /*break*/, 23];
|
|
683
|
+
row = _d[_c];
|
|
684
|
+
return [5 /*yield**/, _loop_3(row)];
|
|
685
|
+
case 21:
|
|
686
|
+
_p.sent();
|
|
687
|
+
_p.label = 22;
|
|
688
|
+
case 22:
|
|
689
|
+
_c++;
|
|
690
|
+
return [3 /*break*/, 20];
|
|
691
|
+
case 23:
|
|
579
692
|
restoredTables++;
|
|
580
|
-
spinner.setText(
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
693
|
+
spinner.setText("Restoring " + table.name + "... (" + table.rows.length + " rows)");
|
|
694
|
+
_p.label = 24;
|
|
695
|
+
case 24:
|
|
696
|
+
_i++;
|
|
697
|
+
return [3 /*break*/, 19];
|
|
698
|
+
case 25:
|
|
699
|
+
spinner.succeed("Restored " + restoredTables + " tables, " + restoredRows + " rows");
|
|
700
|
+
if (!(data.indexes && data.indexes.length > 0)) return [3 /*break*/, 32];
|
|
585
701
|
spinner.setText('Restoring indexes...');
|
|
586
702
|
spinner.start();
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
703
|
+
_e = 0, _f = data.indexes;
|
|
704
|
+
_p.label = 26;
|
|
705
|
+
case 26:
|
|
706
|
+
if (!(_e < _f.length)) return [3 /*break*/, 31];
|
|
707
|
+
indexDef = _f[_e];
|
|
708
|
+
_p.label = 27;
|
|
709
|
+
case 27:
|
|
710
|
+
_p.trys.push([27, 29, , 30]);
|
|
711
|
+
return [4 /*yield*/, client.query(indexDef)];
|
|
712
|
+
case 28:
|
|
713
|
+
_p.sent();
|
|
714
|
+
restoredIndexes++;
|
|
715
|
+
return [3 /*break*/, 30];
|
|
716
|
+
case 29:
|
|
717
|
+
_g = _p.sent();
|
|
718
|
+
return [3 /*break*/, 30];
|
|
719
|
+
case 30:
|
|
720
|
+
_e++;
|
|
721
|
+
return [3 /*break*/, 26];
|
|
722
|
+
case 31:
|
|
723
|
+
spinner.succeed("Restored " + restoredIndexes + " indexes");
|
|
724
|
+
_p.label = 32;
|
|
725
|
+
case 32: return [3 /*break*/, 41];
|
|
726
|
+
case 33:
|
|
727
|
+
// Restore from SQL
|
|
728
|
+
spinner.setText('Executing SQL restore...');
|
|
729
|
+
spinner.start();
|
|
730
|
+
statements = content
|
|
731
|
+
.split(';')
|
|
732
|
+
.map(function (s) { return s.trim(); })
|
|
733
|
+
.filter(function (s) { return s.length > 0 && !s.startsWith('--'); });
|
|
734
|
+
executed = 0;
|
|
735
|
+
_h = 0, statements_1 = statements;
|
|
736
|
+
_p.label = 34;
|
|
737
|
+
case 34:
|
|
738
|
+
if (!(_h < statements_1.length)) return [3 /*break*/, 40];
|
|
739
|
+
stmt = statements_1[_h];
|
|
740
|
+
_p.label = 35;
|
|
741
|
+
case 35:
|
|
742
|
+
_p.trys.push([35, 37, , 38]);
|
|
743
|
+
return [4 /*yield*/, client.query(stmt)];
|
|
744
|
+
case 36:
|
|
745
|
+
_p.sent();
|
|
746
|
+
executed++;
|
|
747
|
+
if (stmt.toUpperCase().includes('INSERT INTO')) {
|
|
748
|
+
restoredRows++;
|
|
595
749
|
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
}
|
|
599
|
-
else {
|
|
600
|
-
// Restore from SQL
|
|
601
|
-
spinner.setText('Executing SQL restore...');
|
|
602
|
-
spinner.start();
|
|
603
|
-
// Split by semicolons and execute
|
|
604
|
-
const statements = content
|
|
605
|
-
.split(';')
|
|
606
|
-
.map(s => s.trim())
|
|
607
|
-
.filter(s => s.length > 0 && !s.startsWith('--'));
|
|
608
|
-
let executed = 0;
|
|
609
|
-
for (const stmt of statements) {
|
|
610
|
-
try {
|
|
611
|
-
await client.query(stmt);
|
|
612
|
-
executed++;
|
|
613
|
-
if (stmt.toUpperCase().includes('INSERT INTO')) {
|
|
614
|
-
restoredRows++;
|
|
615
|
-
}
|
|
616
|
-
else if (stmt.toUpperCase().includes('CREATE INDEX')) {
|
|
617
|
-
restoredIndexes++;
|
|
618
|
-
}
|
|
750
|
+
else if (stmt.toUpperCase().includes('CREATE INDEX')) {
|
|
751
|
+
restoredIndexes++;
|
|
619
752
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
753
|
+
return [3 /*break*/, 38];
|
|
754
|
+
case 37:
|
|
755
|
+
error_2 = _p.sent();
|
|
756
|
+
// Log but continue
|
|
757
|
+
if (process.env.DEBUG) {
|
|
758
|
+
console.error('Statement failed:', stmt.substring(0, 100));
|
|
625
759
|
}
|
|
760
|
+
return [3 /*break*/, 38];
|
|
761
|
+
case 38:
|
|
626
762
|
if (executed % 100 === 0) {
|
|
627
|
-
spinner.setText(
|
|
763
|
+
spinner.setText("Executing SQL restore... " + executed + "/" + statements.length);
|
|
628
764
|
}
|
|
629
|
-
|
|
630
|
-
|
|
765
|
+
_p.label = 39;
|
|
766
|
+
case 39:
|
|
767
|
+
_h++;
|
|
768
|
+
return [3 /*break*/, 34];
|
|
769
|
+
case 40:
|
|
770
|
+
spinner.succeed("Executed " + executed + " SQL statements");
|
|
771
|
+
_p.label = 41;
|
|
772
|
+
case 41: return [4 /*yield*/, client.end()];
|
|
773
|
+
case 42:
|
|
774
|
+
_p.sent();
|
|
775
|
+
output.writeln();
|
|
776
|
+
output.printSuccess('Restore completed successfully!');
|
|
777
|
+
output.writeln();
|
|
778
|
+
output.printBox([
|
|
779
|
+
"Source: " + inputPath,
|
|
780
|
+
"Format: " + format.toUpperCase(),
|
|
781
|
+
"Tables Restored: " + restoredTables,
|
|
782
|
+
"Rows Restored: " + restoredRows.toLocaleString(),
|
|
783
|
+
"Indexes Restored: " + restoredIndexes,
|
|
784
|
+
].join('\n'), 'Restore Summary');
|
|
785
|
+
return [2 /*return*/, {
|
|
786
|
+
success: true,
|
|
787
|
+
data: {
|
|
788
|
+
inputPath: inputPath,
|
|
789
|
+
format: format,
|
|
790
|
+
restoredTables: restoredTables,
|
|
791
|
+
restoredRows: restoredRows,
|
|
792
|
+
restoredIndexes: restoredIndexes
|
|
793
|
+
}
|
|
794
|
+
}];
|
|
795
|
+
case 43:
|
|
796
|
+
error_3 = _p.sent();
|
|
797
|
+
spinner.fail('Restore failed');
|
|
798
|
+
output.printError(error_3 instanceof Error ? error_3.message : String(error_3));
|
|
799
|
+
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
800
|
+
case 44: return [2 /*return*/];
|
|
631
801
|
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
output.printSuccess('Restore completed successfully!');
|
|
635
|
-
output.writeln();
|
|
636
|
-
output.printBox([
|
|
637
|
-
`Source: ${inputPath}`,
|
|
638
|
-
`Format: ${format.toUpperCase()}`,
|
|
639
|
-
`Tables Restored: ${restoredTables}`,
|
|
640
|
-
`Rows Restored: ${restoredRows.toLocaleString()}`,
|
|
641
|
-
`Indexes Restored: ${restoredIndexes}`,
|
|
642
|
-
].join('\n'), 'Restore Summary');
|
|
643
|
-
return {
|
|
644
|
-
success: true,
|
|
645
|
-
data: {
|
|
646
|
-
inputPath,
|
|
647
|
-
format,
|
|
648
|
-
restoredTables,
|
|
649
|
-
restoredRows,
|
|
650
|
-
restoredIndexes,
|
|
651
|
-
},
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
catch (error) {
|
|
655
|
-
spinner.fail('Restore failed');
|
|
656
|
-
output.printError(error instanceof Error ? error.message : String(error));
|
|
657
|
-
return { success: false, exitCode: 1 };
|
|
658
|
-
}
|
|
659
|
-
},
|
|
802
|
+
});
|
|
803
|
+
}); }
|
|
660
804
|
};
|
|
661
805
|
/**
|
|
662
806
|
* RuVector backup main command
|
|
663
807
|
*/
|
|
664
|
-
export
|
|
808
|
+
export var backupCommand = {
|
|
665
809
|
name: 'backup',
|
|
666
810
|
description: 'Backup and restore RuVector data',
|
|
667
811
|
subcommands: [backupSubcommand, restoreSubcommand],
|
|
@@ -671,76 +815,78 @@ export const backupCommand = {
|
|
|
671
815
|
short: 'h',
|
|
672
816
|
description: 'PostgreSQL host',
|
|
673
817
|
type: 'string',
|
|
674
|
-
default: 'localhost'
|
|
818
|
+
"default": 'localhost'
|
|
675
819
|
},
|
|
676
820
|
{
|
|
677
821
|
name: 'port',
|
|
678
822
|
short: 'p',
|
|
679
823
|
description: 'PostgreSQL port',
|
|
680
824
|
type: 'number',
|
|
681
|
-
default: 5432
|
|
825
|
+
"default": 5432
|
|
682
826
|
},
|
|
683
827
|
{
|
|
684
828
|
name: 'database',
|
|
685
829
|
short: 'd',
|
|
686
830
|
description: 'Database name',
|
|
687
|
-
type: 'string'
|
|
831
|
+
type: 'string'
|
|
688
832
|
},
|
|
689
833
|
{
|
|
690
834
|
name: 'user',
|
|
691
835
|
short: 'u',
|
|
692
836
|
description: 'Database user',
|
|
693
|
-
type: 'string'
|
|
837
|
+
type: 'string'
|
|
694
838
|
},
|
|
695
839
|
{
|
|
696
840
|
name: 'password',
|
|
697
841
|
description: 'Database password',
|
|
698
|
-
type: 'string'
|
|
842
|
+
type: 'string'
|
|
699
843
|
},
|
|
700
844
|
{
|
|
701
845
|
name: 'ssl',
|
|
702
846
|
description: 'Enable SSL',
|
|
703
847
|
type: 'boolean',
|
|
704
|
-
default: false
|
|
848
|
+
"default": false
|
|
705
849
|
},
|
|
706
850
|
{
|
|
707
851
|
name: 'schema',
|
|
708
852
|
short: 's',
|
|
709
853
|
description: 'Schema name',
|
|
710
854
|
type: 'string',
|
|
711
|
-
default: 'claude_flow'
|
|
855
|
+
"default": 'claude_flow'
|
|
712
856
|
},
|
|
713
857
|
],
|
|
714
858
|
examples: [
|
|
715
859
|
{ command: 'claude-flow ruvector backup create -o backup.sql', description: 'Create backup' },
|
|
716
860
|
{ command: 'claude-flow ruvector backup restore -i backup.sql', description: 'Restore backup' },
|
|
717
861
|
],
|
|
718
|
-
action:
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
862
|
+
action: function (ctx) { return __awaiter(void 0, void 0, Promise, function () {
|
|
863
|
+
return __generator(this, function (_a) {
|
|
864
|
+
output.writeln();
|
|
865
|
+
output.writeln(output.bold('RuVector Backup'));
|
|
866
|
+
output.writeln(output.dim('='.repeat(60)));
|
|
867
|
+
output.writeln();
|
|
868
|
+
output.printBox([
|
|
869
|
+
'RuVector Backup provides data backup and restore capabilities:',
|
|
870
|
+
'',
|
|
871
|
+
' create Create a backup of RuVector data',
|
|
872
|
+
' restore Restore RuVector data from backup',
|
|
873
|
+
'',
|
|
874
|
+
'Supported formats:',
|
|
875
|
+
' SQL - PostgreSQL-compatible SQL statements',
|
|
876
|
+
' JSON - Portable JSON format with metadata',
|
|
877
|
+
' CSV - Comma-separated values',
|
|
878
|
+
'',
|
|
879
|
+
'Features:',
|
|
880
|
+
' - Selective table backup',
|
|
881
|
+
' - Gzip compression',
|
|
882
|
+
' - Index preservation',
|
|
883
|
+
' - Incremental restore',
|
|
884
|
+
].join('\n'), 'Backup Commands');
|
|
885
|
+
output.writeln();
|
|
886
|
+
output.printInfo('Run `claude-flow ruvector backup <command> --help` for details');
|
|
887
|
+
return [2 /*return*/, { success: true }];
|
|
888
|
+
});
|
|
889
|
+
}); }
|
|
744
890
|
};
|
|
745
891
|
export default backupCommand;
|
|
746
892
|
//# sourceMappingURL=backup.js.map
|