synapse-mcp 1.0.0 → 1.0.2
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/README.md +1820 -147
- package/dist/constants.d.ts +10 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +18 -8
- package/dist/constants.js.map +1 -1
- package/dist/events/emitter.d.ts +63 -0
- package/dist/events/emitter.d.ts.map +1 -0
- package/dist/events/emitter.js +112 -0
- package/dist/events/emitter.js.map +1 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +3 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/types.d.ts +51 -0
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +3 -0
- package/dist/events/types.js.map +1 -0
- package/dist/formatters/compose.d.ts +185 -0
- package/dist/formatters/compose.d.ts.map +1 -0
- package/dist/formatters/compose.js +397 -0
- package/dist/formatters/compose.js.map +1 -0
- package/dist/formatters/container.d.ts +84 -0
- package/dist/formatters/container.d.ts.map +1 -0
- package/dist/formatters/container.js +323 -0
- package/dist/formatters/container.js.map +1 -0
- package/dist/formatters/diagnostics.d.ts +20 -0
- package/dist/formatters/diagnostics.d.ts.map +1 -0
- package/dist/formatters/diagnostics.js +73 -0
- package/dist/formatters/diagnostics.js.map +1 -0
- package/dist/formatters/docker.d.ts +139 -0
- package/dist/formatters/docker.d.ts.map +1 -0
- package/dist/formatters/docker.js +216 -0
- package/dist/formatters/docker.js.map +1 -0
- package/dist/formatters/host.d.ts +137 -0
- package/dist/formatters/host.d.ts.map +1 -0
- package/dist/formatters/host.js +198 -0
- package/dist/formatters/host.js.map +1 -0
- package/dist/formatters/index.d.ts +17 -270
- package/dist/formatters/index.d.ts.map +1 -1
- package/dist/formatters/index.js +21 -456
- package/dist/formatters/index.js.map +1 -1
- package/dist/formatters/scout.d.ts +424 -0
- package/dist/formatters/scout.d.ts.map +1 -0
- package/dist/formatters/scout.js +687 -0
- package/dist/formatters/scout.js.map +1 -0
- package/dist/formatters/strategy.d.ts +105 -0
- package/dist/formatters/strategy.d.ts.map +1 -0
- package/dist/formatters/strategy.js +120 -0
- package/dist/formatters/strategy.js.map +1 -0
- package/dist/formatters/utils.d.ts +84 -0
- package/dist/formatters/utils.d.ts.map +1 -0
- package/dist/formatters/utils.js +129 -0
- package/dist/formatters/utils.js.map +1 -0
- package/dist/health-rate-limiter.d.ts +59 -0
- package/dist/health-rate-limiter.d.ts.map +1 -0
- package/dist/health-rate-limiter.js +159 -0
- package/dist/health-rate-limiter.js.map +1 -0
- package/dist/index.js +61 -100
- package/dist/index.js.map +1 -1
- package/dist/middleware/async-handler.d.ts +62 -0
- package/dist/middleware/async-handler.d.ts.map +1 -0
- package/dist/middleware/async-handler.js +58 -0
- package/dist/middleware/async-handler.js.map +1 -0
- package/dist/middleware/auth.d.ts +32 -0
- package/dist/middleware/auth.d.ts.map +1 -0
- package/dist/middleware/auth.js +63 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/middleware/csrf-protection.d.ts +58 -0
- package/dist/middleware/csrf-protection.d.ts.map +1 -0
- package/dist/middleware/csrf-protection.js +123 -0
- package/dist/middleware/csrf-protection.js.map +1 -0
- package/dist/middleware/error-handler.d.ts +49 -0
- package/dist/middleware/error-handler.d.ts.map +1 -0
- package/dist/middleware/error-handler.js +90 -0
- package/dist/middleware/error-handler.js.map +1 -0
- package/dist/middleware/error-mapper.d.ts +44 -0
- package/dist/middleware/error-mapper.d.ts.map +1 -0
- package/dist/middleware/error-mapper.js +127 -0
- package/dist/middleware/error-mapper.js.map +1 -0
- package/dist/middleware/index.d.ts +13 -0
- package/dist/middleware/index.d.ts.map +1 -0
- package/dist/middleware/index.js +13 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/request-id.d.ts +22 -0
- package/dist/middleware/request-id.d.ts.map +1 -0
- package/dist/middleware/request-id.js +31 -0
- package/dist/middleware/request-id.js.map +1 -0
- package/dist/middleware/types.d.ts +33 -0
- package/dist/middleware/types.d.ts.map +1 -0
- package/dist/middleware/types.js +2 -0
- package/dist/middleware/types.js.map +1 -0
- package/dist/schemas/common.d.ts +205 -8
- package/dist/schemas/common.d.ts.map +1 -1
- package/dist/schemas/common.js +290 -17
- package/dist/schemas/common.js.map +1 -1
- package/dist/schemas/flux/compose.d.ts +307 -44
- package/dist/schemas/flux/compose.d.ts.map +1 -1
- package/dist/schemas/flux/compose.js +74 -48
- package/dist/schemas/flux/compose.js.map +1 -1
- package/dist/schemas/flux/container.d.ts +423 -56
- package/dist/schemas/flux/container.d.ts.map +1 -1
- package/dist/schemas/flux/container.js +83 -61
- package/dist/schemas/flux/container.js.map +1 -1
- package/dist/schemas/flux/docker.d.ts +254 -37
- package/dist/schemas/flux/docker.d.ts.map +1 -1
- package/dist/schemas/flux/docker.js +69 -39
- package/dist/schemas/flux/docker.js.map +1 -1
- package/dist/schemas/flux/host.d.ts +312 -29
- package/dist/schemas/flux/host.d.ts.map +1 -1
- package/dist/schemas/flux/host.js +74 -31
- package/dist/schemas/flux/host.js.map +1 -1
- package/dist/schemas/flux/index.d.ts +503 -11
- package/dist/schemas/flux/index.d.ts.map +1 -1
- package/dist/schemas/flux/index.js +34 -70
- package/dist/schemas/flux/index.js.map +1 -1
- package/dist/schemas/host-config.d.ts +76 -0
- package/dist/schemas/host-config.d.ts.map +1 -0
- package/dist/schemas/host-config.js +105 -0
- package/dist/schemas/host-config.js.map +1 -0
- package/dist/schemas/scout/index.d.ts +80 -23
- package/dist/schemas/scout/index.d.ts.map +1 -1
- package/dist/schemas/scout/index.js +26 -11
- package/dist/schemas/scout/index.js.map +1 -1
- package/dist/schemas/scout/logs.d.ts +17 -5
- package/dist/schemas/scout/logs.d.ts.map +1 -1
- package/dist/schemas/scout/logs.js +41 -31
- package/dist/schemas/scout/logs.js.map +1 -1
- package/dist/schemas/scout/simple.d.ts +126 -11
- package/dist/schemas/scout/simple.d.ts.map +1 -1
- package/dist/schemas/scout/simple.js +112 -57
- package/dist/schemas/scout/simple.js.map +1 -1
- package/dist/schemas/scout/zfs.d.ts +17 -5
- package/dist/schemas/scout/zfs.d.ts.map +1 -1
- package/dist/schemas/scout/zfs.js +34 -25
- package/dist/schemas/scout/zfs.js.map +1 -1
- package/dist/services/cache-layer.d.ts +160 -0
- package/dist/services/cache-layer.d.ts.map +1 -0
- package/dist/services/cache-layer.js +138 -0
- package/dist/services/cache-layer.js.map +1 -0
- package/dist/services/compose-cache.d.ts +75 -0
- package/dist/services/compose-cache.d.ts.map +1 -0
- package/dist/services/compose-cache.js +178 -0
- package/dist/services/compose-cache.js.map +1 -0
- package/dist/services/compose-discovery.d.ts +46 -0
- package/dist/services/compose-discovery.d.ts.map +1 -0
- package/dist/services/compose-discovery.js +219 -0
- package/dist/services/compose-discovery.js.map +1 -0
- package/dist/services/compose-project-lister.d.ts +27 -0
- package/dist/services/compose-project-lister.d.ts.map +1 -0
- package/dist/services/compose-project-lister.js +71 -0
- package/dist/services/compose-project-lister.js.map +1 -0
- package/dist/services/compose-scanner.d.ts +63 -0
- package/dist/services/compose-scanner.d.ts.map +1 -0
- package/dist/services/compose-scanner.js +253 -0
- package/dist/services/compose-scanner.js.map +1 -0
- package/dist/services/compose.d.ts +64 -28
- package/dist/services/compose.d.ts.map +1 -1
- package/dist/services/compose.js +220 -98
- package/dist/services/compose.js.map +1 -1
- package/dist/services/config-loader.d.ts +23 -0
- package/dist/services/config-loader.d.ts.map +1 -0
- package/dist/services/config-loader.js +124 -0
- package/dist/services/config-loader.js.map +1 -0
- package/dist/services/config-service.d.ts +38 -0
- package/dist/services/config-service.d.ts.map +1 -0
- package/dist/services/config-service.js +225 -0
- package/dist/services/config-service.js.map +1 -0
- package/dist/services/container-host-map-cache.d.ts +121 -0
- package/dist/services/container-host-map-cache.d.ts.map +1 -0
- package/dist/services/container-host-map-cache.js +188 -0
- package/dist/services/container-host-map-cache.js.map +1 -0
- package/dist/services/container.d.ts +194 -6
- package/dist/services/container.d.ts.map +1 -1
- package/dist/services/container.js +386 -11
- package/dist/services/container.js.map +1 -1
- package/dist/services/diagnostics.d.ts +57 -0
- package/dist/services/diagnostics.d.ts.map +1 -0
- package/dist/services/diagnostics.js +271 -0
- package/dist/services/diagnostics.js.map +1 -0
- package/dist/services/docker/container-service.d.ts +123 -0
- package/dist/services/docker/container-service.d.ts.map +1 -0
- package/dist/services/docker/container-service.js +347 -0
- package/dist/services/docker/container-service.js.map +1 -0
- package/dist/services/docker/image-service.d.ts +82 -0
- package/dist/services/docker/image-service.d.ts.map +1 -0
- package/dist/services/docker/image-service.js +193 -0
- package/dist/services/docker/image-service.js.map +1 -0
- package/dist/services/docker/index.d.ts +80 -0
- package/dist/services/docker/index.d.ts.map +1 -0
- package/dist/services/docker/index.js +103 -0
- package/dist/services/docker/index.js.map +1 -0
- package/dist/services/docker/network-service.d.ts +22 -0
- package/dist/services/docker/network-service.d.ts.map +1 -0
- package/dist/services/docker/network-service.js +43 -0
- package/dist/services/docker/network-service.js.map +1 -0
- package/dist/services/docker/system-service.d.ts +49 -0
- package/dist/services/docker/system-service.d.ts.map +1 -0
- package/dist/services/docker/system-service.js +215 -0
- package/dist/services/docker/system-service.js.map +1 -0
- package/dist/services/docker/utils/client-factory.d.ts +56 -0
- package/dist/services/docker/utils/client-factory.d.ts.map +1 -0
- package/dist/services/docker/utils/client-factory.js +139 -0
- package/dist/services/docker/utils/client-factory.js.map +1 -0
- package/dist/services/docker/utils/client-manager.d.ts +88 -0
- package/dist/services/docker/utils/client-manager.d.ts.map +1 -0
- package/dist/services/docker/utils/client-manager.js +124 -0
- package/dist/services/docker/utils/client-manager.js.map +1 -0
- package/dist/services/docker/utils/exec-handler.d.ts +94 -0
- package/dist/services/docker/utils/exec-handler.d.ts.map +1 -0
- package/dist/services/docker/utils/exec-handler.js +197 -0
- package/dist/services/docker/utils/exec-handler.js.map +1 -0
- package/dist/services/docker/utils/formatters.d.ts +13 -0
- package/dist/services/docker/utils/formatters.d.ts.map +1 -0
- package/dist/services/docker/utils/formatters.js +33 -0
- package/dist/services/docker/utils/formatters.js.map +1 -0
- package/dist/services/docker/utils/log-parser.d.ts +10 -0
- package/dist/services/docker/utils/log-parser.d.ts.map +1 -0
- package/dist/services/docker/utils/log-parser.js +48 -0
- package/dist/services/docker/utils/log-parser.js.map +1 -0
- package/dist/services/docker/utils/stats-calculator.d.ts +68 -0
- package/dist/services/docker/utils/stats-calculator.d.ts.map +1 -0
- package/dist/services/docker/utils/stats-calculator.js +61 -0
- package/dist/services/docker/utils/stats-calculator.js.map +1 -0
- package/dist/services/docker/volume-service.d.ts +22 -0
- package/dist/services/docker/volume-service.d.ts.map +1 -0
- package/dist/services/docker/volume-service.js +48 -0
- package/dist/services/docker/volume-service.js.map +1 -0
- package/dist/services/docker-interfaces.d.ts +283 -0
- package/dist/services/docker-interfaces.d.ts.map +1 -0
- package/dist/services/docker-interfaces.js +13 -0
- package/dist/services/docker-interfaces.js.map +1 -0
- package/dist/services/docker.d.ts +42 -5
- package/dist/services/docker.d.ts.map +1 -1
- package/dist/services/docker.js +335 -127
- package/dist/services/docker.js.map +1 -1
- package/dist/services/file-service.d.ts +6 -2
- package/dist/services/file-service.d.ts.map +1 -1
- package/dist/services/file-service.js +156 -52
- package/dist/services/file-service.js.map +1 -1
- package/dist/services/host-config-repository.d.ts +133 -0
- package/dist/services/host-config-repository.d.ts.map +1 -0
- package/dist/services/host-config-repository.js +323 -0
- package/dist/services/host-config-repository.js.map +1 -0
- package/dist/services/host-resolver.d.ts +49 -0
- package/dist/services/host-resolver.d.ts.map +1 -0
- package/dist/services/host-resolver.js +176 -0
- package/dist/services/host-resolver.js.map +1 -0
- package/dist/services/interfaces.d.ts +61 -194
- package/dist/services/interfaces.d.ts.map +1 -1
- package/dist/services/local-executor.d.ts +31 -0
- package/dist/services/local-executor.d.ts.map +1 -0
- package/dist/services/local-executor.js +71 -0
- package/dist/services/local-executor.js.map +1 -0
- package/dist/services/ssh-config-loader.d.ts +35 -0
- package/dist/services/ssh-config-loader.d.ts.map +1 -0
- package/dist/services/ssh-config-loader.js +218 -0
- package/dist/services/ssh-config-loader.js.map +1 -0
- package/dist/services/ssh-pool.d.ts +26 -1
- package/dist/services/ssh-pool.d.ts.map +1 -1
- package/dist/services/ssh-pool.js +166 -25
- package/dist/services/ssh-pool.js.map +1 -1
- package/dist/services/ssh-service.d.ts +3 -0
- package/dist/services/ssh-service.d.ts.map +1 -1
- package/dist/services/ssh-service.js +53 -31
- package/dist/services/ssh-service.js.map +1 -1
- package/dist/services/ssh.d.ts +2 -6
- package/dist/services/ssh.d.ts.map +1 -1
- package/dist/services/ssh.js +9 -40
- package/dist/services/ssh.js.map +1 -1
- package/dist/tools/definitions/flux.d.ts +13 -0
- package/dist/tools/definitions/flux.d.ts.map +1 -0
- package/dist/tools/definitions/flux.js +101 -0
- package/dist/tools/definitions/flux.js.map +1 -0
- package/dist/tools/definitions/index.d.ts +8 -0
- package/dist/tools/definitions/index.d.ts.map +1 -0
- package/dist/tools/definitions/index.js +8 -0
- package/dist/tools/definitions/index.js.map +1 -0
- package/dist/tools/definitions/scout.d.ts +13 -0
- package/dist/tools/definitions/scout.d.ts.map +1 -0
- package/dist/tools/definitions/scout.js +78 -0
- package/dist/tools/definitions/scout.js.map +1 -0
- package/dist/tools/flux.d.ts +16 -8
- package/dist/tools/flux.d.ts.map +1 -1
- package/dist/tools/flux.js +27 -66
- package/dist/tools/flux.js.map +1 -1
- package/dist/tools/handlers/base-handler.d.ts +172 -0
- package/dist/tools/handlers/base-handler.d.ts.map +1 -0
- package/dist/tools/handlers/base-handler.js +234 -0
- package/dist/tools/handlers/base-handler.js.map +1 -0
- package/dist/tools/handlers/compose-handlers.d.ts +108 -0
- package/dist/tools/handlers/compose-handlers.d.ts.map +1 -0
- package/dist/tools/handlers/compose-handlers.js +293 -0
- package/dist/tools/handlers/compose-handlers.js.map +1 -0
- package/dist/tools/handlers/compose-utils.d.ts +35 -0
- package/dist/tools/handlers/compose-utils.d.ts.map +1 -0
- package/dist/tools/handlers/compose-utils.js +76 -0
- package/dist/tools/handlers/compose-utils.js.map +1 -0
- package/dist/tools/handlers/compose.d.ts +23 -0
- package/dist/tools/handlers/compose.d.ts.map +1 -0
- package/dist/tools/handlers/compose.js +125 -0
- package/dist/tools/handlers/compose.js.map +1 -0
- package/dist/tools/handlers/container.d.ts +23 -0
- package/dist/tools/handlers/container.d.ts.map +1 -0
- package/dist/tools/handlers/container.js +333 -0
- package/dist/tools/handlers/container.js.map +1 -0
- package/dist/tools/handlers/docker.d.ts +24 -0
- package/dist/tools/handlers/docker.d.ts.map +1 -0
- package/dist/tools/handlers/docker.js +155 -0
- package/dist/tools/handlers/docker.js.map +1 -0
- package/dist/tools/handlers/host.d.ts +23 -0
- package/dist/tools/handlers/host.d.ts.map +1 -0
- package/dist/tools/handlers/host.js +196 -0
- package/dist/tools/handlers/host.js.map +1 -0
- package/dist/tools/handlers/scout-logs.d.ts +24 -0
- package/dist/tools/handlers/scout-logs.d.ts.map +1 -0
- package/dist/tools/handlers/scout-logs.js +119 -0
- package/dist/tools/handlers/scout-logs.js.map +1 -0
- package/dist/tools/handlers/scout-simple.d.ts +23 -0
- package/dist/tools/handlers/scout-simple.d.ts.map +1 -0
- package/dist/tools/handlers/scout-simple.js +286 -0
- package/dist/tools/handlers/scout-simple.js.map +1 -0
- package/dist/tools/handlers/scout-zfs.d.ts +23 -0
- package/dist/tools/handlers/scout-zfs.d.ts.map +1 -0
- package/dist/tools/handlers/scout-zfs.js +82 -0
- package/dist/tools/handlers/scout-zfs.js.map +1 -0
- package/dist/tools/index.d.ts +32 -2
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +41 -35
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/registry.d.ts +135 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +151 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/scout.d.ts +16 -8
- package/dist/tools/scout.d.ts.map +1 -1
- package/dist/tools/scout.js +36 -78
- package/dist/tools/scout.js.map +1 -1
- package/dist/types.d.ts +629 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/command-security.d.ts +82 -0
- package/dist/utils/command-security.d.ts.map +1 -0
- package/dist/utils/command-security.js +122 -0
- package/dist/utils/command-security.js.map +1 -0
- package/dist/utils/error-sanitization.d.ts +77 -0
- package/dist/utils/error-sanitization.d.ts.map +1 -0
- package/dist/utils/error-sanitization.js +107 -0
- package/dist/utils/error-sanitization.js.map +1 -0
- package/dist/utils/errors.d.ts +30 -6
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +91 -12
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/help-handler.d.ts +23 -0
- package/dist/utils/help-handler.d.ts.map +1 -0
- package/dist/utils/help-handler.js +21 -0
- package/dist/utils/help-handler.js.map +1 -0
- package/dist/utils/help.d.ts +1 -1
- package/dist/utils/help.d.ts.map +1 -1
- package/dist/utils/help.js +57 -16
- package/dist/utils/help.js.map +1 -1
- package/dist/utils/host-utils.d.ts +31 -0
- package/dist/utils/host-utils.d.ts.map +1 -0
- package/dist/utils/host-utils.js +80 -0
- package/dist/utils/host-utils.js.map +1 -0
- package/dist/utils/index.d.ts +8 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +8 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/init-detection.d.ts +36 -0
- package/dist/utils/init-detection.d.ts.map +1 -0
- package/dist/utils/init-detection.js +79 -0
- package/dist/utils/init-detection.js.map +1 -0
- package/dist/utils/logger.d.ts +11 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +32 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/pagination.d.ts +20 -0
- package/dist/utils/pagination.d.ts.map +1 -0
- package/dist/utils/pagination.js +29 -0
- package/dist/utils/pagination.js.map +1 -0
- package/dist/utils/path-security.d.ts +132 -18
- package/dist/utils/path-security.d.ts.map +1 -1
- package/dist/utils/path-security.js +164 -35
- package/dist/utils/path-security.js.map +1 -1
- package/dist/utils/sorting.d.ts +33 -0
- package/dist/utils/sorting.d.ts.map +1 -0
- package/dist/utils/sorting.js +57 -0
- package/dist/utils/sorting.js.map +1 -0
- package/dist/utils/text-filters.d.ts +13 -0
- package/dist/utils/text-filters.d.ts.map +1 -0
- package/dist/utils/text-filters.js +18 -0
- package/dist/utils/text-filters.js.map +1 -0
- package/dist/utils/time.d.ts +11 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/time.js +13 -0
- package/dist/utils/time.js.map +1 -0
- package/dist/utils/validation.d.ts +25 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +56 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +45 -19
- package/dist/schemas/discriminator.d.ts +0 -20
- package/dist/schemas/discriminator.d.ts.map +0 -1
- package/dist/schemas/discriminator.js +0 -25
- package/dist/schemas/discriminator.js.map +0 -1
- package/dist/schemas/unified.d.ts +0 -674
- package/dist/schemas/unified.d.ts.map +0 -1
- package/dist/schemas/unified.js +0 -453
- package/dist/schemas/unified.js.map +0 -1
- package/dist/tools/unified.d.ts +0 -7
- package/dist/tools/unified.d.ts.map +0 -1
- package/dist/tools/unified.js +0 -827
- package/dist/tools/unified.js.map +0 -1
package/dist/tools/flux.js
CHANGED
|
@@ -1,86 +1,47 @@
|
|
|
1
1
|
// src/tools/flux.ts
|
|
2
|
-
import { FluxSchema } from
|
|
3
|
-
import {
|
|
2
|
+
import { FluxSchema } from "../schemas/flux/index.js";
|
|
3
|
+
import { handleHelpAction } from "../utils/help-handler.js";
|
|
4
|
+
import { handleComposeAction } from "./handlers/compose.js";
|
|
5
|
+
import { handleContainerAction } from "./handlers/container.js";
|
|
6
|
+
import { handleDockerAction } from "./handlers/docker.js";
|
|
7
|
+
import { handleHostAction } from "./handlers/host.js";
|
|
4
8
|
/**
|
|
5
|
-
* Flux tool
|
|
9
|
+
* Handle all Flux tool requests - Docker infrastructure management.
|
|
6
10
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - compose: 9 subactions (list, status, up, down, restart, logs, build, pull, recreate)
|
|
10
|
-
* - docker: 9 subactions (info, df, prune, images, pull, build, rmi, networks, volumes)
|
|
11
|
-
* - host: 7 subactions (status, resources, info, uptime, services, network, mounts)
|
|
11
|
+
* Routes incoming requests to specialized handlers based on action type.
|
|
12
|
+
* Validates input against Flux schema before dispatching.
|
|
12
13
|
*
|
|
13
|
-
*
|
|
14
|
+
* @param input - Unvalidated user input to process
|
|
15
|
+
* @param container - Service container with dependencies
|
|
16
|
+
* @returns Formatted response string (markdown or JSON)
|
|
17
|
+
* @throws {Error} When validation fails or action is unknown
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const result = await handleFluxTool(
|
|
22
|
+
* { action: 'container', subaction: 'list', state: 'running' },
|
|
23
|
+
* container
|
|
24
|
+
* );
|
|
25
|
+
* ```
|
|
14
26
|
*/
|
|
15
27
|
export async function handleFluxTool(input, container) {
|
|
16
|
-
// Handle help action before schema validation
|
|
17
|
-
if (typeof input === 'object' && input !== null && 'action' in input && input.action === 'help') {
|
|
18
|
-
const helpInput = input;
|
|
19
|
-
const entries = generateHelp(FluxSchema, helpInput.topic);
|
|
20
|
-
if (helpInput.format === 'json') {
|
|
21
|
-
return formatHelpJson(entries);
|
|
22
|
-
}
|
|
23
|
-
return formatHelpMarkdown(entries);
|
|
24
|
-
}
|
|
25
28
|
// Validate input against Flux schema
|
|
26
29
|
const validated = FluxSchema.parse(input);
|
|
27
30
|
// Route to appropriate handler based on action
|
|
28
31
|
switch (validated.action) {
|
|
29
|
-
case
|
|
32
|
+
case "help":
|
|
33
|
+
return handleHelpAction(validated, FluxSchema);
|
|
34
|
+
case "container":
|
|
30
35
|
return handleContainerAction(validated, container);
|
|
31
|
-
case
|
|
36
|
+
case "compose":
|
|
32
37
|
return handleComposeAction(validated, container);
|
|
33
|
-
case
|
|
38
|
+
case "docker":
|
|
34
39
|
return handleDockerAction(validated, container);
|
|
35
|
-
case
|
|
40
|
+
case "host":
|
|
36
41
|
return handleHostAction(validated, container);
|
|
37
42
|
default:
|
|
38
43
|
// Zod validation should prevent reaching here
|
|
39
44
|
throw new Error(`Unknown action: ${validated.action}`);
|
|
40
45
|
}
|
|
41
46
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Placeholder handler for container actions
|
|
44
|
-
* Will be implemented in Task 16
|
|
45
|
-
*/
|
|
46
|
-
function handleContainerAction(input, _container) {
|
|
47
|
-
// Type guard to ensure we have container action
|
|
48
|
-
if (input.action !== 'container') {
|
|
49
|
-
throw new Error(`Invalid action for container handler: ${input.action}`);
|
|
50
|
-
}
|
|
51
|
-
throw new Error(`Handler not implemented: container:${input.subaction}`);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Placeholder handler for compose actions
|
|
55
|
-
* Will be implemented in Task 17
|
|
56
|
-
*/
|
|
57
|
-
function handleComposeAction(input, _container) {
|
|
58
|
-
// Type guard to ensure we have compose action
|
|
59
|
-
if (input.action !== 'compose') {
|
|
60
|
-
throw new Error(`Invalid action for compose handler: ${input.action}`);
|
|
61
|
-
}
|
|
62
|
-
throw new Error(`Handler not implemented: compose:${input.subaction}`);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Placeholder handler for docker actions
|
|
66
|
-
* Will be implemented in Task 18
|
|
67
|
-
*/
|
|
68
|
-
function handleDockerAction(input, _container) {
|
|
69
|
-
// Type guard to ensure we have docker action
|
|
70
|
-
if (input.action !== 'docker') {
|
|
71
|
-
throw new Error(`Invalid action for docker handler: ${input.action}`);
|
|
72
|
-
}
|
|
73
|
-
throw new Error(`Handler not implemented: docker:${input.subaction}`);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Placeholder handler for host actions
|
|
77
|
-
* Will be implemented in Task 19
|
|
78
|
-
*/
|
|
79
|
-
function handleHostAction(input, _container) {
|
|
80
|
-
// Type guard to ensure we have host action
|
|
81
|
-
if (input.action !== 'host') {
|
|
82
|
-
throw new Error(`Invalid action for host handler: ${input.action}`);
|
|
83
|
-
}
|
|
84
|
-
throw new Error(`Handler not implemented: host:${input.subaction}`);
|
|
85
|
-
}
|
|
86
47
|
//# sourceMappingURL=flux.js.map
|
package/dist/tools/flux.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flux.js","sourceRoot":"","sources":["../../src/tools/flux.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,
|
|
1
|
+
{"version":3,"file":"flux.js","sourceRoot":"","sources":["../../src/tools/flux.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,EAAkB,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtE,OAAO,EAAkB,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAAc,EAAE,SAA2B;IAC9E,qCAAqC;IACrC,MAAM,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAc,CAAC;IAEvD,+CAA+C;IAC/C,QAAQ,SAAS,CAAC,MAAM,EAAE,CAAC;QACzB,KAAK,MAAM;YACT,OAAO,gBAAgB,CAAC,SAAiC,EAAE,UAAU,CAAC,CAAC;QACzE,KAAK,WAAW;YACd,OAAO,qBAAqB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACrD,KAAK,SAAS;YACZ,OAAO,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACnD,KAAK,QAAQ;YACX,OAAO,kBAAkB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAClD,KAAK,MAAM;YACT,OAAO,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChD;YACE,8CAA8C;YAC9C,MAAM,IAAI,KAAK,CAAC,mBAAoB,SAAgC,CAAC,MAAM,EAAE,CAAC,CAAC;IACnF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base handler utilities for reducing boilerplate across handlers
|
|
3
|
+
*
|
|
4
|
+
* Consolidates common patterns found in all handler files:
|
|
5
|
+
* - Initialization (service extraction, format resolution)
|
|
6
|
+
* - Host lookup and resolution
|
|
7
|
+
* - Action validation
|
|
8
|
+
* - Response formatting
|
|
9
|
+
* - Pagination
|
|
10
|
+
* - String utilities
|
|
11
|
+
*/
|
|
12
|
+
import type { z } from "zod";
|
|
13
|
+
import type { ServiceContainer } from "../../services/container.js";
|
|
14
|
+
import type { HostConfig, ResponseFormat } from "../../types.js";
|
|
15
|
+
/**
|
|
16
|
+
* Common handler context with services and configuration
|
|
17
|
+
*/
|
|
18
|
+
export interface HandlerContext<TService> {
|
|
19
|
+
service: TService;
|
|
20
|
+
hosts: HostConfig[];
|
|
21
|
+
format: ResponseFormat;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Initialize handler context with common setup
|
|
25
|
+
* Consolidates repeated initialization from 6+ handlers
|
|
26
|
+
*
|
|
27
|
+
* @param input - Input object containing optional response_format
|
|
28
|
+
* @param container - Service container for dependency injection
|
|
29
|
+
* @param getService - Function to extract specific service from container
|
|
30
|
+
* @returns Promise resolving to handler context with service, hosts, and format
|
|
31
|
+
*/
|
|
32
|
+
export declare function initializeHandler<TService>(input: {
|
|
33
|
+
response_format?: ResponseFormat;
|
|
34
|
+
}, container: ServiceContainer, getService: (container: ServiceContainer) => TService): Promise<HandlerContext<TService>>;
|
|
35
|
+
/**
|
|
36
|
+
* Find host by name or throw if not found
|
|
37
|
+
* Consolidates host lookup pattern from container.ts, docker.ts, host.ts, scout-logs.ts
|
|
38
|
+
*
|
|
39
|
+
* @param hosts - Array of host configurations to search
|
|
40
|
+
* @param hostName - Name of the host to find
|
|
41
|
+
* @returns The found host configuration
|
|
42
|
+
* @throws Error if host is not found
|
|
43
|
+
*/
|
|
44
|
+
export declare function getHostConfigOrThrow(hosts: HostConfig[], hostName: string): HostConfig;
|
|
45
|
+
/**
|
|
46
|
+
* Find host by name, returns undefined if not provided or not found
|
|
47
|
+
*
|
|
48
|
+
* @param hosts - Array of host configurations to search
|
|
49
|
+
* @param hostName - Name of the host to find (optional)
|
|
50
|
+
* @returns The found host configuration or undefined
|
|
51
|
+
*/
|
|
52
|
+
export declare function getHostConfigOptional(hosts: HostConfig[], hostName: string | undefined): HostConfig | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Resolve target hosts - single host if specified, all hosts otherwise
|
|
55
|
+
* Consolidates pattern from compose.ts, host.ts, docker.ts
|
|
56
|
+
*
|
|
57
|
+
* @param hosts - Array of all available host configurations
|
|
58
|
+
* @param hostName - Optional specific host name to filter to
|
|
59
|
+
* @returns Array containing single host if specified, or all hosts
|
|
60
|
+
* @throws Error if specified host is not found
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveTargetHosts(hosts: HostConfig[], hostName: string | undefined): HostConfig[];
|
|
63
|
+
/**
|
|
64
|
+
* Validate action matches handler type
|
|
65
|
+
* Consolidates action validation from all handlers
|
|
66
|
+
*
|
|
67
|
+
* @param input - Input object with action property
|
|
68
|
+
* @param expectedAction - The expected action value
|
|
69
|
+
* @param handlerName - Name of the handler (for error messages)
|
|
70
|
+
* @throws Error if action doesn't match expected
|
|
71
|
+
*/
|
|
72
|
+
export declare function assertValidAction(input: {
|
|
73
|
+
action: string;
|
|
74
|
+
} | Record<string, unknown>, expectedAction: string, handlerName: string): void;
|
|
75
|
+
/**
|
|
76
|
+
* Format response based on format preference using strategy pattern
|
|
77
|
+
* Consolidates 40+ occurrences across all handlers
|
|
78
|
+
*
|
|
79
|
+
* @param data - The data to format
|
|
80
|
+
* @param format - The desired output format (JSON or MARKDOWN)
|
|
81
|
+
* @param markdownFormatter - Function to convert data to markdown (called for markdown format)
|
|
82
|
+
* @returns Formatted string (JSON or markdown)
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* // Handler provides raw data and markdown formatter
|
|
87
|
+
* return formatResponse(containers, format, () =>
|
|
88
|
+
* formatContainersMarkdown(containers, total, offset, hasMore)
|
|
89
|
+
* );
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare function formatResponse<T>(data: T, format: ResponseFormat, markdownFormatter: (data: T) => string): string;
|
|
93
|
+
/**
|
|
94
|
+
* Pagination options for list operations
|
|
95
|
+
*/
|
|
96
|
+
export interface PaginationOptions {
|
|
97
|
+
offset?: number;
|
|
98
|
+
limit?: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Result of pagination operation
|
|
102
|
+
*/
|
|
103
|
+
export interface PaginatedResult<T> {
|
|
104
|
+
items: T[];
|
|
105
|
+
total: number;
|
|
106
|
+
offset: number;
|
|
107
|
+
limit: number;
|
|
108
|
+
hasMore: boolean;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Apply pagination to array and return paginated result
|
|
112
|
+
* Consolidates pagination pattern from 8+ locations
|
|
113
|
+
*
|
|
114
|
+
* @param items - Full array of items to paginate
|
|
115
|
+
* @param options - Pagination options (offset, limit)
|
|
116
|
+
* @returns Paginated result with items and metadata
|
|
117
|
+
*/
|
|
118
|
+
export declare function paginateItems<T>(items: T[], options: PaginationOptions): PaginatedResult<T>;
|
|
119
|
+
/**
|
|
120
|
+
* Create exhaustive check error for switch statements
|
|
121
|
+
* Consolidates pattern from all handlers
|
|
122
|
+
*
|
|
123
|
+
* @param value - The unhandled value (should be never type)
|
|
124
|
+
* @param context - Context description for error message
|
|
125
|
+
* @returns Error with descriptive message
|
|
126
|
+
*/
|
|
127
|
+
export declare function createExhaustiveError(value: never, context: string): Error;
|
|
128
|
+
/**
|
|
129
|
+
* Resolve non-empty string or undefined
|
|
130
|
+
* Consolidates utility from container.ts
|
|
131
|
+
*
|
|
132
|
+
* @param value - Value to check
|
|
133
|
+
* @returns Trimmed string if valid and non-empty, undefined otherwise
|
|
134
|
+
*/
|
|
135
|
+
export declare function resolveNonEmptyString(value: unknown): string | undefined;
|
|
136
|
+
/**
|
|
137
|
+
* Get optional string field with type checking
|
|
138
|
+
* Consolidates utility from host.ts
|
|
139
|
+
*
|
|
140
|
+
* @param value - Value to check
|
|
141
|
+
* @param fieldName - Name of the field (for error messages)
|
|
142
|
+
* @returns The string value or undefined
|
|
143
|
+
* @throws Error if value is not undefined and not a string
|
|
144
|
+
*/
|
|
145
|
+
export declare function getOptionalString(value: unknown, fieldName: string): string | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* Get host name from input object with validation
|
|
148
|
+
* Consolidates getHostName from host.ts
|
|
149
|
+
*
|
|
150
|
+
* @param input - Input object that may contain a host field
|
|
151
|
+
* @returns The host name string or undefined
|
|
152
|
+
* @throws Error if host is present but not a string
|
|
153
|
+
*/
|
|
154
|
+
export declare function getHostNameFromInput(input: Record<string, unknown>): string | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* Validate input with Zod schema at handler boundary
|
|
157
|
+
*
|
|
158
|
+
* Provides runtime safety and consistent error messages across all handlers.
|
|
159
|
+
* Throws Error with handler name and field-specific validation issues.
|
|
160
|
+
*
|
|
161
|
+
* @param input - Unknown input to validate
|
|
162
|
+
* @param schema - Zod schema to validate against
|
|
163
|
+
* @param handlerName - Name of handler (for error messages)
|
|
164
|
+
* @returns Validated and typed input
|
|
165
|
+
* @throws Error if validation fails
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* const validated = validateInput(input, scoutZfsSchema, 'zfs');
|
|
169
|
+
* // validated is now typed as ScoutZfsInput
|
|
170
|
+
*/
|
|
171
|
+
export declare function validateInput<T>(input: unknown, schema: z.ZodSchema<T>, handlerName: string): T;
|
|
172
|
+
//# sourceMappingURL=base-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-handler.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/base-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGjE;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,QAAQ;IACtC,OAAO,EAAE,QAAQ,CAAC;IAClB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;CACxB;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAC9C,KAAK,EAAE;IAAE,eAAe,CAAC,EAAE,cAAc,CAAA;CAAE,EAC3C,SAAS,EAAE,gBAAgB,EAC3B,UAAU,EAAE,CAAC,SAAS,EAAE,gBAAgB,KAAK,QAAQ,GACpD,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAQnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAMtF;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,UAAU,EAAE,EACnB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,UAAU,GAAG,SAAS,CAGxB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,UAAU,EAAE,EACnB,QAAQ,EAAE,MAAM,GAAG,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gB,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,SAAS,CAMvF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC,CAS/F"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base handler utilities for reducing boilerplate across handlers
|
|
3
|
+
*
|
|
4
|
+
* Consolidates common patterns found in all handler files:
|
|
5
|
+
* - Initialization (service extraction, format resolution)
|
|
6
|
+
* - Host lookup and resolution
|
|
7
|
+
* - Action validation
|
|
8
|
+
* - Response formatting
|
|
9
|
+
* - Pagination
|
|
10
|
+
* - String utilities
|
|
11
|
+
*/
|
|
12
|
+
import { createFormatter } from "../../formatters/index.js";
|
|
13
|
+
import { ResponseFormat as ResponseFormatEnum } from "../../types.js";
|
|
14
|
+
/**
|
|
15
|
+
* Initialize handler context with common setup
|
|
16
|
+
* Consolidates repeated initialization from 6+ handlers
|
|
17
|
+
*
|
|
18
|
+
* @param input - Input object containing optional response_format
|
|
19
|
+
* @param container - Service container for dependency injection
|
|
20
|
+
* @param getService - Function to extract specific service from container
|
|
21
|
+
* @returns Promise resolving to handler context with service, hosts, and format
|
|
22
|
+
*/
|
|
23
|
+
export async function initializeHandler(input, container, getService) {
|
|
24
|
+
const service = getService(container);
|
|
25
|
+
const format = input.response_format ?? ResponseFormatEnum.MARKDOWN;
|
|
26
|
+
// Load hosts from repository via container
|
|
27
|
+
const hosts = await container.getHostConfigRepository().loadHosts();
|
|
28
|
+
return { service, hosts, format };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Find host by name or throw if not found
|
|
32
|
+
* Consolidates host lookup pattern from container.ts, docker.ts, host.ts, scout-logs.ts
|
|
33
|
+
*
|
|
34
|
+
* @param hosts - Array of host configurations to search
|
|
35
|
+
* @param hostName - Name of the host to find
|
|
36
|
+
* @returns The found host configuration
|
|
37
|
+
* @throws Error if host is not found
|
|
38
|
+
*/
|
|
39
|
+
export function getHostConfigOrThrow(hosts, hostName) {
|
|
40
|
+
const host = hosts.find((h) => h.name === hostName);
|
|
41
|
+
if (!host) {
|
|
42
|
+
throw new Error(`Host not found: ${hostName}`);
|
|
43
|
+
}
|
|
44
|
+
return host;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Find host by name, returns undefined if not provided or not found
|
|
48
|
+
*
|
|
49
|
+
* @param hosts - Array of host configurations to search
|
|
50
|
+
* @param hostName - Name of the host to find (optional)
|
|
51
|
+
* @returns The found host configuration or undefined
|
|
52
|
+
*/
|
|
53
|
+
export function getHostConfigOptional(hosts, hostName) {
|
|
54
|
+
if (!hostName)
|
|
55
|
+
return undefined;
|
|
56
|
+
return hosts.find((h) => h.name === hostName);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Resolve target hosts - single host if specified, all hosts otherwise
|
|
60
|
+
* Consolidates pattern from compose.ts, host.ts, docker.ts
|
|
61
|
+
*
|
|
62
|
+
* @param hosts - Array of all available host configurations
|
|
63
|
+
* @param hostName - Optional specific host name to filter to
|
|
64
|
+
* @returns Array containing single host if specified, or all hosts
|
|
65
|
+
* @throws Error if specified host is not found
|
|
66
|
+
*/
|
|
67
|
+
export function resolveTargetHosts(hosts, hostName) {
|
|
68
|
+
const rawDefaultHost = process.env.SYNAPSE_DEFAULT_HOST?.trim();
|
|
69
|
+
const defaultHost = rawDefaultHost && rawDefaultHost !== "undefined" && rawDefaultHost !== "null"
|
|
70
|
+
? rawDefaultHost
|
|
71
|
+
: undefined;
|
|
72
|
+
const localSocketHost = hosts.find((host) => {
|
|
73
|
+
return Boolean(host.dockerSocketPath) || host.host.startsWith("/");
|
|
74
|
+
});
|
|
75
|
+
const requestedHost = hostName ?? defaultHost ?? localSocketHost?.name;
|
|
76
|
+
if (!requestedHost)
|
|
77
|
+
return hosts;
|
|
78
|
+
const host = hosts.find((h) => h.name === requestedHost);
|
|
79
|
+
if (!host) {
|
|
80
|
+
if (!hostName && defaultHost) {
|
|
81
|
+
throw new Error(`Default host not found: ${defaultHost}`);
|
|
82
|
+
}
|
|
83
|
+
throw new Error(`Host not found: ${requestedHost}`);
|
|
84
|
+
}
|
|
85
|
+
return [host];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Validate action matches handler type
|
|
89
|
+
* Consolidates action validation from all handlers
|
|
90
|
+
*
|
|
91
|
+
* @param input - Input object with action property
|
|
92
|
+
* @param expectedAction - The expected action value
|
|
93
|
+
* @param handlerName - Name of the handler (for error messages)
|
|
94
|
+
* @throws Error if action doesn't match expected
|
|
95
|
+
*/
|
|
96
|
+
export function assertValidAction(input, expectedAction, handlerName) {
|
|
97
|
+
const action = "action" in input ? input.action : undefined;
|
|
98
|
+
if (action !== expectedAction) {
|
|
99
|
+
throw new Error(`Invalid action for ${handlerName} handler: ${action}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Format response based on format preference using strategy pattern
|
|
104
|
+
* Consolidates 40+ occurrences across all handlers
|
|
105
|
+
*
|
|
106
|
+
* @param data - The data to format
|
|
107
|
+
* @param format - The desired output format (JSON or MARKDOWN)
|
|
108
|
+
* @param markdownFormatter - Function to convert data to markdown (called for markdown format)
|
|
109
|
+
* @returns Formatted string (JSON or markdown)
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* // Handler provides raw data and markdown formatter
|
|
114
|
+
* return formatResponse(containers, format, () =>
|
|
115
|
+
* formatContainersMarkdown(containers, total, offset, hasMore)
|
|
116
|
+
* );
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export function formatResponse(data, format, markdownFormatter) {
|
|
120
|
+
// Use strategy pattern via createFormatter
|
|
121
|
+
const formatter = createFormatter(format);
|
|
122
|
+
// For markdown format, pass the pre-formatted markdown string
|
|
123
|
+
// For JSON format, pass the raw data for direct serialization
|
|
124
|
+
const input = format === ResponseFormatEnum.MARKDOWN ? markdownFormatter(data) : data;
|
|
125
|
+
return formatter.format(input);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Apply pagination to array and return paginated result
|
|
129
|
+
* Consolidates pagination pattern from 8+ locations
|
|
130
|
+
*
|
|
131
|
+
* @param items - Full array of items to paginate
|
|
132
|
+
* @param options - Pagination options (offset, limit)
|
|
133
|
+
* @returns Paginated result with items and metadata
|
|
134
|
+
*/
|
|
135
|
+
export function paginateItems(items, options) {
|
|
136
|
+
const offset = options.offset ?? 0;
|
|
137
|
+
const limit = options.limit ?? 50;
|
|
138
|
+
const total = items.length;
|
|
139
|
+
const paginatedItems = items.slice(offset, offset + limit);
|
|
140
|
+
const hasMore = offset + limit < total;
|
|
141
|
+
return {
|
|
142
|
+
items: paginatedItems,
|
|
143
|
+
total,
|
|
144
|
+
offset,
|
|
145
|
+
limit,
|
|
146
|
+
hasMore,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Create exhaustive check error for switch statements
|
|
151
|
+
* Consolidates pattern from all handlers
|
|
152
|
+
*
|
|
153
|
+
* @param value - The unhandled value (should be never type)
|
|
154
|
+
* @param context - Context description for error message
|
|
155
|
+
* @returns Error with descriptive message
|
|
156
|
+
*/
|
|
157
|
+
export function createExhaustiveError(value, context) {
|
|
158
|
+
const subaction = value.subaction;
|
|
159
|
+
return new Error(`Unknown ${context}: ${subaction ?? value}`);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Resolve non-empty string or undefined
|
|
163
|
+
* Consolidates utility from container.ts
|
|
164
|
+
*
|
|
165
|
+
* @param value - Value to check
|
|
166
|
+
* @returns Trimmed string if valid and non-empty, undefined otherwise
|
|
167
|
+
*/
|
|
168
|
+
export function resolveNonEmptyString(value) {
|
|
169
|
+
if (typeof value !== "string")
|
|
170
|
+
return undefined;
|
|
171
|
+
const trimmed = value.trim();
|
|
172
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Get optional string field with type checking
|
|
176
|
+
* Consolidates utility from host.ts
|
|
177
|
+
*
|
|
178
|
+
* @param value - Value to check
|
|
179
|
+
* @param fieldName - Name of the field (for error messages)
|
|
180
|
+
* @returns The string value or undefined
|
|
181
|
+
* @throws Error if value is not undefined and not a string
|
|
182
|
+
*/
|
|
183
|
+
export function getOptionalString(value, fieldName) {
|
|
184
|
+
if (value === undefined)
|
|
185
|
+
return undefined;
|
|
186
|
+
if (typeof value === "string")
|
|
187
|
+
return value;
|
|
188
|
+
throw new Error(`Invalid ${fieldName}: expected string`);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Get host name from input object with validation
|
|
192
|
+
* Consolidates getHostName from host.ts
|
|
193
|
+
*
|
|
194
|
+
* @param input - Input object that may contain a host field
|
|
195
|
+
* @returns The host name string or undefined
|
|
196
|
+
* @throws Error if host is present but not a string
|
|
197
|
+
*/
|
|
198
|
+
export function getHostNameFromInput(input) {
|
|
199
|
+
if (!("host" in input))
|
|
200
|
+
return undefined;
|
|
201
|
+
const hostValue = input.host;
|
|
202
|
+
if (hostValue === undefined)
|
|
203
|
+
return undefined;
|
|
204
|
+
if (typeof hostValue === "string")
|
|
205
|
+
return hostValue;
|
|
206
|
+
throw new Error("Invalid host: expected string");
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Validate input with Zod schema at handler boundary
|
|
210
|
+
*
|
|
211
|
+
* Provides runtime safety and consistent error messages across all handlers.
|
|
212
|
+
* Throws Error with handler name and field-specific validation issues.
|
|
213
|
+
*
|
|
214
|
+
* @param input - Unknown input to validate
|
|
215
|
+
* @param schema - Zod schema to validate against
|
|
216
|
+
* @param handlerName - Name of handler (for error messages)
|
|
217
|
+
* @returns Validated and typed input
|
|
218
|
+
* @throws Error if validation fails
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* const validated = validateInput(input, scoutZfsSchema, 'zfs');
|
|
222
|
+
* // validated is now typed as ScoutZfsInput
|
|
223
|
+
*/
|
|
224
|
+
export function validateInput(input, schema, handlerName) {
|
|
225
|
+
const parsed = schema.safeParse(input);
|
|
226
|
+
if (!parsed.success) {
|
|
227
|
+
const issues = parsed.error.issues
|
|
228
|
+
.map((issue) => `${issue.path.join(".")}: ${issue.message}`)
|
|
229
|
+
.join(", ");
|
|
230
|
+
throw new Error(`${handlerName} input validation failed: ${issues}`);
|
|
231
|
+
}
|
|
232
|
+
return parsed.data;
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=base-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-handler.js","sourceRoot":"","sources":["../../../src/tools/handlers/base-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAWtE;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAA2C,EAC3C,SAA2B,EAC3B,UAAqD;IAErD,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,eAAe,IAAI,kBAAkB,CAAC,QAAQ,CAAC;IAEpE,2CAA2C;IAC3C,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,uBAAuB,EAAE,CAAC,SAAS,EAAE,CAAC;IAEpE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;AACpC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAmB,EAAE,QAAgB;IACxE,MAAM,IAAI,GAAG,KAAK,CAAC,I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S,CAAC;IAC9C,IAAI,OAAO,SAAS,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACpD,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;AACnD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,aAAa,CAAI,KAAc,EAAE,MAAsB,EAAE,WAAmB;IAC1F,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM;aAC/B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;aAC3D,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,GAAG,WAAW,6BAA6B,MAAM,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { ComposeBuildInput, ComposeDownInput, ComposeLogsInput, ComposePullInput, ComposeRecreateInput, ComposeRefreshInput, ComposeRestartInput, ComposeUpInput } from "../../schemas/flux/compose.js";
|
|
2
|
+
import type { ServiceContainer } from "../../services/container.js";
|
|
3
|
+
import type { HostConfig } from "../../types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Handle compose up operation with cache invalidation.
|
|
6
|
+
*
|
|
7
|
+
* Starts services in a compose project with auto-discovery support.
|
|
8
|
+
* Invalidates compose cache after successful operation.
|
|
9
|
+
*
|
|
10
|
+
* @param input - Validated compose up input with project and detach options
|
|
11
|
+
* @param hosts - Array of available host configurations
|
|
12
|
+
* @param container - Service container with compose service
|
|
13
|
+
* @returns Success message
|
|
14
|
+
* @throws {Error} When project/host not found or operation fails
|
|
15
|
+
*/
|
|
16
|
+
export declare function handleComposeUp(input: ComposeUpInput, hosts: HostConfig[], container: ServiceContainer): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Handle compose down operation with cache invalidation.
|
|
19
|
+
*
|
|
20
|
+
* Stops services in a compose project with optional volume removal.
|
|
21
|
+
* Requires force flag when removing volumes to prevent accidental data loss.
|
|
22
|
+
*
|
|
23
|
+
* @param input - Validated compose down input with project and volume options
|
|
24
|
+
* @param hosts - Array of available host configurations
|
|
25
|
+
* @param container - Service container with compose service
|
|
26
|
+
* @returns Success message
|
|
27
|
+
* @throws {Error} When project/host not found, force required, or operation fails
|
|
28
|
+
*/
|
|
29
|
+
export declare function handleComposeDown(input: ComposeDownInput, hosts: HostConfig[], container: ServiceContainer): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Handle compose restart operation with cache invalidation.
|
|
32
|
+
*
|
|
33
|
+
* Restarts all services in a compose project.
|
|
34
|
+
* Invalidates compose cache after successful operation.
|
|
35
|
+
*
|
|
36
|
+
* @param input - Validated compose restart input with project
|
|
37
|
+
* @param hosts - Array of available host configurations
|
|
38
|
+
* @param container - Service container with compose service
|
|
39
|
+
* @returns Success message
|
|
40
|
+
* @throws {Error} When project/host not found or operation fails
|
|
41
|
+
*/
|
|
42
|
+
export declare function handleComposeRestart(input: ComposeRestartInput, hosts: HostConfig[], container: ServiceContainer): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* Handle compose logs operation with cache invalidation.
|
|
45
|
+
*
|
|
46
|
+
* Retrieves logs from compose project services with optional filtering.
|
|
47
|
+
* Supports time range, service filtering, and grep patterns.
|
|
48
|
+
*
|
|
49
|
+
* @param input - Validated compose logs input with project and filter options
|
|
50
|
+
* @param hosts - Array of available host configurations
|
|
51
|
+
* @param container - Service container with compose service
|
|
52
|
+
* @returns Formatted logs in markdown
|
|
53
|
+
* @throws {Error} When project/host not found or operation fails
|
|
54
|
+
*/
|
|
55
|
+
export declare function handleComposeLogs(input: ComposeLogsInput, hosts: HostConfig[], container: ServiceContainer): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Handle compose build operation with cache invalidation.
|
|
58
|
+
*
|
|
59
|
+
* Builds or rebuilds service images in a compose project.
|
|
60
|
+
* Supports no-cache builds and service-specific builds.
|
|
61
|
+
*
|
|
62
|
+
* @param input - Validated compose build input with project and build options
|
|
63
|
+
* @param hosts - Array of available host configurations
|
|
64
|
+
* @param container - Service container with compose service
|
|
65
|
+
* @returns Success message
|
|
66
|
+
* @throws {Error} When project/host not found or operation fails
|
|
67
|
+
*/
|
|
68
|
+
export declare function handleComposeBuild(input: ComposeBuildInput, hosts: HostConfig[], container: ServiceContainer): Promise<string>;
|
|
69
|
+
/**
|
|
70
|
+
* Handle compose pull operation with cache invalidation.
|
|
71
|
+
*
|
|
72
|
+
* Pulls service images defined in a compose project.
|
|
73
|
+
* Supports service-specific pulls.
|
|
74
|
+
*
|
|
75
|
+
* @param input - Validated compose pull input with project and service options
|
|
76
|
+
* @param hosts - Array of available host configurations
|
|
77
|
+
* @param container - Service container with compose service
|
|
78
|
+
* @returns Success message
|
|
79
|
+
* @throws {Error} When project/host not found or operation fails
|
|
80
|
+
*/
|
|
81
|
+
export declare function handleComposePull(input: ComposePullInput, hosts: HostConfig[], container: ServiceContainer): Promise<string>;
|
|
82
|
+
/**
|
|
83
|
+
* Handle compose recreate operation with cache invalidation.
|
|
84
|
+
*
|
|
85
|
+
* Recreates containers in a compose project without rebuilding images.
|
|
86
|
+
* Supports service-specific recreation and force-recreate option.
|
|
87
|
+
*
|
|
88
|
+
* @param input - Validated compose recreate input with project and recreate options
|
|
89
|
+
* @param hosts - Array of available host configurations
|
|
90
|
+
* @param container - Service container with compose service
|
|
91
|
+
* @returns Success message
|
|
92
|
+
* @throws {Error} When project/host not found or operation fails
|
|
93
|
+
*/
|
|
94
|
+
export declare function handleComposeRecreate(input: ComposeRecreateInput, hosts: HostConfig[], container: ServiceContainer): Promise<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Handle compose refresh operation - scans filesystem and updates cache.
|
|
97
|
+
*
|
|
98
|
+
* Scans host for compose files and updates discovery cache.
|
|
99
|
+
* Uses host's configured compose search paths.
|
|
100
|
+
*
|
|
101
|
+
* @param input - Validated compose refresh input with host
|
|
102
|
+
* @param hosts - Array of available host configurations
|
|
103
|
+
* @param container - Service container with compose scanner and discovery
|
|
104
|
+
* @returns Summary of discovered projects
|
|
105
|
+
* @throws {Error} When host not found or scan fails
|
|
106
|
+
*/
|
|
107
|
+
export declare function handleComposeRefresh(input: ComposeRefreshInput, hosts: HostConfig[], container: ServiceContainer): Promise<string>;
|
|
108
|
+
//# sourceMappingURL=compose-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose-handlers.d.ts","sourceRoot":"","sources":["../../../src/tools/handlers/compose-handlers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACf,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAqDjD;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,cAAc,EACrB,KAAK,EAAE,UAAU,EAAE,EACnB,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,MAAM,CAAC,CA4BjB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,UAAU,EAAE,EACnB,SAAS,EAAE,gBAAgB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAiDjB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,mBAAmB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