@exaudeus/workrail 0.8.5 → 0.9.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/README.md +157 -403
- package/dist/application/services/enhanced-loop-validator.d.ts +2 -2
- package/dist/application/services/enhanced-loop-validator.js +12 -2
- package/dist/application/services/validation-engine.d.ts +8 -29
- package/dist/application/services/validation-engine.js +38 -21
- package/dist/application/services/workflow-compiler.d.ts +18 -0
- package/dist/application/services/workflow-compiler.js +79 -0
- package/dist/application/services/workflow-interpreter.d.ts +31 -0
- package/dist/application/services/workflow-interpreter.js +280 -0
- package/dist/application/services/workflow-service.d.ts +34 -32
- package/dist/application/services/workflow-service.js +93 -425
- package/dist/application/use-cases/get-next-step.d.ts +6 -10
- package/dist/application/use-cases/get-next-step.js +2 -6
- package/dist/application/use-cases/get-workflow.d.ts +8 -6
- package/dist/application/use-cases/get-workflow.js +42 -33
- package/dist/application/use-cases/list-workflows.d.ts +3 -3
- package/dist/application/use-cases/validate-step-output.d.ts +4 -4
- package/dist/application/use-cases/validate-workflow-file.d.ts +46 -0
- package/dist/application/use-cases/validate-workflow-file.js +57 -0
- package/dist/cli/commands/cleanup.d.ts +8 -0
- package/dist/cli/commands/cleanup.js +20 -0
- package/dist/cli/commands/index.d.ts +7 -0
- package/dist/cli/commands/index.js +21 -0
- package/dist/cli/commands/init.d.ts +11 -0
- package/dist/cli/commands/init.js +49 -0
- package/dist/cli/commands/list.d.ts +9 -0
- package/dist/cli/commands/list.js +34 -0
- package/dist/cli/commands/migrate.d.ts +78 -0
- package/dist/cli/commands/migrate.js +248 -0
- package/dist/cli/commands/sources.d.ts +21 -0
- package/dist/cli/commands/sources.js +87 -0
- package/dist/cli/commands/start.d.ts +8 -0
- package/dist/cli/commands/start.js +16 -0
- package/dist/cli/commands/validate.d.ts +6 -0
- package/dist/cli/commands/validate.js +55 -0
- package/dist/cli/interpret-result.d.ts +4 -0
- package/dist/cli/interpret-result.js +24 -0
- package/dist/cli/output-formatter.d.ts +10 -0
- package/dist/cli/output-formatter.js +97 -0
- package/dist/cli/types/cli-result.d.ts +23 -0
- package/dist/cli/types/cli-result.js +30 -0
- package/dist/cli/types/exit-code.d.ts +13 -0
- package/dist/cli/types/exit-code.js +23 -0
- package/dist/cli/types/index.d.ts +4 -0
- package/dist/cli/types/index.js +11 -0
- package/dist/cli.js +84 -278
- package/dist/config/app-config.d.ts +40 -0
- package/dist/config/app-config.js +58 -0
- package/dist/config/feature-flags.d.ts +10 -2
- package/dist/config/feature-flags.js +74 -12
- package/dist/core/error-handler.d.ts +18 -27
- package/dist/core/error-handler.js +24 -218
- package/dist/di/container.d.ts +12 -0
- package/dist/di/container.js +244 -0
- package/dist/di/tokens.d.ts +40 -0
- package/dist/di/tokens.js +42 -0
- package/dist/domain/execution/error.d.ts +32 -0
- package/dist/domain/execution/error.js +24 -0
- package/dist/domain/execution/event.d.ts +7 -0
- package/dist/domain/execution/event.js +11 -0
- package/dist/domain/execution/ids.d.ts +9 -0
- package/dist/domain/execution/ids.js +9 -0
- package/dist/domain/execution/result.d.ts +3 -0
- package/dist/domain/execution/result.js +10 -0
- package/dist/domain/execution/state.d.ts +57 -0
- package/dist/domain/execution/state.js +28 -0
- package/dist/errors/app-error.d.ts +23 -0
- package/dist/errors/factories.d.ts +6 -0
- package/dist/errors/factories.js +21 -0
- package/dist/errors/formatter.d.ts +2 -0
- package/dist/errors/formatter.js +32 -0
- package/dist/errors/index.d.ts +3 -0
- package/dist/errors/index.js +7 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +10 -25
- package/dist/infrastructure/index.d.ts +0 -1
- package/dist/infrastructure/index.js +0 -1
- package/dist/infrastructure/session/DashboardHeartbeat.d.ts +8 -0
- package/dist/infrastructure/session/DashboardHeartbeat.js +39 -0
- package/dist/infrastructure/session/DashboardLockRelease.d.ts +2 -0
- package/dist/infrastructure/session/DashboardLockRelease.js +29 -0
- package/dist/infrastructure/session/HttpServer.d.ts +25 -6
- package/dist/infrastructure/session/HttpServer.js +245 -90
- package/dist/infrastructure/session/SessionDataNormalizer.js +12 -2
- package/dist/infrastructure/session/SessionDataValidator.js +12 -2
- package/dist/infrastructure/session/SessionManager.d.ts +5 -3
- package/dist/infrastructure/session/SessionManager.js +52 -6
- package/dist/infrastructure/storage/caching-workflow-storage.d.ts +30 -6
- package/dist/infrastructure/storage/caching-workflow-storage.js +105 -23
- package/dist/infrastructure/storage/enhanced-multi-source-workflow-storage.d.ts +13 -9
- package/dist/infrastructure/storage/enhanced-multi-source-workflow-storage.js +80 -54
- package/dist/infrastructure/storage/file-workflow-storage.d.ts +10 -8
- package/dist/infrastructure/storage/file-workflow-storage.js +48 -56
- package/dist/infrastructure/storage/git-workflow-storage.d.ts +7 -22
- package/dist/infrastructure/storage/git-workflow-storage.js +48 -103
- package/dist/infrastructure/storage/in-memory-storage.d.ts +10 -6
- package/dist/infrastructure/storage/in-memory-storage.js +18 -13
- package/dist/infrastructure/storage/plugin-workflow-storage.d.ts +6 -18
- package/dist/infrastructure/storage/plugin-workflow-storage.js +29 -51
- package/dist/infrastructure/storage/remote-workflow-storage.d.ts +8 -17
- package/dist/infrastructure/storage/remote-workflow-storage.js +33 -156
- package/dist/infrastructure/storage/schema-validating-workflow-storage.d.ts +21 -13
- package/dist/infrastructure/storage/schema-validating-workflow-storage.js +86 -24
- package/dist/infrastructure/storage/storage.d.ts +7 -5
- package/dist/infrastructure/storage/storage.js +7 -6
- package/dist/manifest.json +1093 -0
- package/dist/mcp/error-mapper.d.ts +9 -0
- package/dist/mcp/error-mapper.js +66 -0
- package/dist/mcp/handlers/session.d.ts +34 -0
- package/dist/mcp/handlers/session.js +135 -0
- package/dist/mcp/handlers/v2-workflow.d.ts +4 -0
- package/dist/mcp/handlers/v2-workflow.js +112 -0
- package/dist/mcp/handlers/workflow.d.ts +45 -0
- package/dist/mcp/handlers/workflow.js +167 -0
- package/dist/mcp/index.d.ts +16 -0
- package/dist/mcp/index.js +51 -0
- package/dist/mcp/output-schemas.d.ts +317 -0
- package/dist/mcp/output-schemas.js +91 -0
- package/dist/mcp/server.d.ts +3 -0
- package/dist/mcp/server.js +258 -0
- package/dist/mcp/tool-description-provider.d.ts +16 -0
- package/dist/mcp/tool-description-provider.js +43 -0
- package/dist/mcp/tool-descriptions.d.ts +2 -0
- package/dist/mcp/tool-descriptions.js +109 -0
- package/dist/mcp/tool-factory.d.ts +23 -0
- package/dist/mcp/tool-factory.js +14 -0
- package/dist/mcp/tools.d.ts +156 -0
- package/dist/mcp/tools.js +196 -0
- package/dist/mcp/types/tool-description-types.d.ts +8 -0
- package/dist/mcp/types/tool-description-types.js +24 -0
- package/dist/mcp/types.d.ts +25 -0
- package/dist/mcp/types.js +15 -0
- package/dist/mcp/v2/tool-registry.d.ts +11 -0
- package/dist/mcp/v2/tool-registry.js +26 -0
- package/dist/mcp/v2/tools.d.ts +20 -0
- package/dist/mcp/v2/tools.js +17 -0
- package/dist/mcp/validation/bounded-json.d.ts +3 -0
- package/dist/mcp/validation/bounded-json.js +22 -0
- package/dist/mcp/validation/workflow-next-prevalidate.d.ts +9 -0
- package/dist/mcp/validation/workflow-next-prevalidate.js +83 -0
- package/dist/mcp/zod-to-json-schema.d.ts +17 -0
- package/dist/mcp/zod-to-json-schema.js +134 -0
- package/dist/mcp-server.d.ts +1 -1
- package/dist/mcp-server.js +6 -424
- package/dist/runtime/adapters/in-memory-shutdown-events.d.ts +6 -0
- package/dist/runtime/adapters/in-memory-shutdown-events.js +20 -0
- package/dist/runtime/adapters/node-process-signals.d.ts +4 -0
- package/dist/runtime/adapters/node-process-signals.js +11 -0
- package/dist/runtime/adapters/node-process-terminator.d.ts +4 -0
- package/dist/runtime/adapters/node-process-terminator.js +17 -0
- package/dist/runtime/adapters/noop-process-signals.d.ts +4 -0
- package/dist/runtime/adapters/noop-process-signals.js +8 -0
- package/dist/runtime/adapters/throwing-process-terminator.d.ts +4 -0
- package/dist/runtime/adapters/throwing-process-terminator.js +9 -0
- package/dist/runtime/assert-never.d.ts +1 -0
- package/dist/runtime/assert-never.js +6 -0
- package/dist/runtime/brand.d.ts +5 -0
- package/dist/runtime/ports/process-signals.d.ts +4 -0
- package/dist/runtime/ports/process-signals.js +2 -0
- package/dist/runtime/ports/process-terminator.d.ts +8 -0
- package/dist/runtime/ports/process-terminator.js +2 -0
- package/dist/runtime/ports/shutdown-events.d.ts +11 -0
- package/dist/runtime/ports/shutdown-events.js +2 -0
- package/dist/runtime/process-lifecycle-policy.d.ts +5 -0
- package/dist/runtime/process-lifecycle-policy.js +2 -0
- package/dist/runtime/result.d.ts +17 -0
- package/dist/runtime/result.js +31 -0
- package/dist/runtime/runtime-mode.d.ts +9 -0
- package/dist/runtime/runtime-mode.js +2 -0
- package/dist/types/storage.d.ts +16 -5
- package/dist/types/storage.js +8 -0
- package/dist/types/validation.d.ts +27 -0
- package/dist/types/validation.js +10 -0
- package/dist/types/workflow-definition.d.ts +63 -0
- package/dist/types/workflow-definition.js +33 -0
- package/dist/types/workflow-source.d.ts +51 -0
- package/dist/types/workflow-source.js +128 -0
- package/dist/types/workflow.d.ts +28 -0
- package/dist/types/workflow.js +96 -0
- package/dist/utils/workflow-init.d.ts +1 -0
- package/dist/utils/workflow-init.js +38 -0
- package/dist/v2/durable-core/canonical/hashing.d.ts +11 -0
- package/dist/v2/durable-core/canonical/hashing.js +13 -0
- package/dist/v2/durable-core/canonical/jcs.d.ts +11 -0
- package/dist/v2/durable-core/canonical/jcs.js +65 -0
- package/dist/v2/durable-core/canonical/json-types.d.ts +6 -0
- package/dist/v2/durable-core/canonical/json-types.js +2 -0
- package/dist/v2/durable-core/canonical/json-zod.d.ts +2 -0
- package/dist/v2/durable-core/canonical/json-zod.js +7 -0
- package/dist/v2/durable-core/canonical/jsonl.d.ts +4 -0
- package/dist/v2/durable-core/canonical/jsonl.js +13 -0
- package/dist/v2/durable-core/ids/index.d.ts +23 -0
- package/dist/v2/durable-core/ids/index.js +46 -0
- package/dist/v2/durable-core/schemas/compiled-workflow/index.d.ts +47 -0
- package/dist/v2/durable-core/schemas/compiled-workflow/index.js +17 -0
- package/dist/v2/durable-core/schemas/session/events.d.ts +1812 -0
- package/dist/v2/durable-core/schemas/session/events.js +328 -0
- package/dist/v2/durable-core/schemas/session/index.d.ts +2 -0
- package/dist/v2/durable-core/schemas/session/index.js +8 -0
- package/dist/v2/durable-core/schemas/session/manifest.d.ts +57 -0
- package/dist/v2/durable-core/schemas/session/manifest.js +30 -0
- package/dist/v2/infra/local/crypto/index.d.ts +5 -0
- package/dist/v2/infra/local/crypto/index.js +12 -0
- package/dist/v2/infra/local/data-dir/index.d.ts +13 -0
- package/dist/v2/infra/local/data-dir/index.js +69 -0
- package/dist/v2/infra/local/fs/index.d.ts +26 -0
- package/dist/v2/infra/local/fs/index.js +156 -0
- package/dist/v2/infra/local/pinned-workflow-store/index.d.ts +11 -0
- package/dist/v2/infra/local/pinned-workflow-store/index.js +85 -0
- package/dist/v2/infra/local/session-lock/index.d.ts +12 -0
- package/dist/v2/infra/local/session-lock/index.js +44 -0
- package/dist/v2/infra/local/session-store/index.d.ts +22 -0
- package/dist/v2/infra/local/session-store/index.js +358 -0
- package/dist/v2/infra/local/sha256/index.d.ts +5 -0
- package/dist/v2/infra/local/sha256/index.js +12 -0
- package/dist/v2/ports/data-dir.port.d.ts +9 -0
- package/dist/v2/ports/data-dir.port.js +2 -0
- package/dist/v2/ports/fs.port.d.ts +41 -0
- package/dist/v2/ports/fs.port.js +2 -0
- package/dist/v2/ports/pinned-workflow-store.port.d.ts +11 -0
- package/dist/v2/ports/pinned-workflow-store.port.js +2 -0
- package/dist/v2/ports/session-event-log-store.port.d.ts +37 -0
- package/dist/v2/ports/session-event-log-store.port.js +2 -0
- package/dist/v2/ports/session-lock.port.d.ts +23 -0
- package/dist/v2/ports/session-lock.port.js +2 -0
- package/dist/v2/ports/sha256.port.d.ts +4 -0
- package/dist/v2/ports/sha256.port.js +2 -0
- package/dist/v2/projections/advance-outcomes.d.ts +23 -0
- package/dist/v2/projections/advance-outcomes.js +23 -0
- package/dist/v2/projections/capabilities.d.ts +27 -0
- package/dist/v2/projections/capabilities.js +33 -0
- package/dist/v2/projections/gaps.d.ts +29 -0
- package/dist/v2/projections/gaps.js +49 -0
- package/dist/v2/projections/node-outputs.d.ts +34 -0
- package/dist/v2/projections/node-outputs.js +73 -0
- package/dist/v2/projections/preferences.d.ts +28 -0
- package/dist/v2/projections/preferences.js +50 -0
- package/dist/v2/projections/run-dag.d.ts +42 -0
- package/dist/v2/projections/run-dag.js +186 -0
- package/dist/v2/projections/run-status-signals.d.ts +26 -0
- package/dist/v2/projections/run-status-signals.js +49 -0
- package/dist/v2/projections/session-health.d.ts +18 -0
- package/dist/v2/projections/session-health.js +15 -0
- package/dist/v2/read-only/v1-to-v2-shim.d.ts +3 -0
- package/dist/v2/read-only/v1-to-v2-shim.js +38 -0
- package/package.json +35 -10
- package/spec/mcp-api-v1.0.md +5 -5
- package/web/assets/services/data-normalizer.js +17 -2
- package/web/assets/services/pattern-recognizer.js +3 -1
- package/web/assets/services/session-data.js +13 -8
- package/web/assets/utils/formatters.js +34 -23
- package/workflows/CHANGELOG-bug-investigation.md +4 -4
- package/workflows/bug-investigation.agentic.json +156 -56
- package/workflows/coding-task-workflow-agentic.json +262 -0
- package/workflows/design-thinking-workflow-autonomous.agentic.json +215 -0
- package/workflows/design-thinking-workflow.json +198 -0
- package/workflows/mr-review-workflow.agentic.json +538 -0
- package/workflows/routines/context-gathering.json +0 -4
- package/workflows/routines/ideation.json +73 -0
- package/dist/application/app.d.ts +0 -29
- package/dist/application/app.d.ts.map +0 -1
- package/dist/application/app.js +0 -114
- package/dist/application/app.js.map +0 -1
- package/dist/application/decorators/simple-output-decorator.d.ts +0 -8
- package/dist/application/decorators/simple-output-decorator.js +0 -89
- package/dist/application/services/classification-engine.d.ts +0 -33
- package/dist/application/services/classification-engine.js +0 -258
- package/dist/application/services/compression-service.d.ts +0 -20
- package/dist/application/services/compression-service.js +0 -312
- package/dist/application/services/context-management-service.d.ts +0 -38
- package/dist/application/services/context-management-service.js +0 -301
- package/dist/application/services/context-optimizer.d.ts +0 -11
- package/dist/application/services/context-optimizer.js +0 -62
- package/dist/application/services/context-persistence-service.d.ts +0 -45
- package/dist/application/services/context-persistence-service.js +0 -273
- package/dist/application/services/documentation-service.d.ts +0 -20
- package/dist/application/services/documentation-service.js +0 -155
- package/dist/application/services/enhanced-error-service.d.ts.map +0 -1
- package/dist/application/services/enhanced-error-service.js.map +0 -1
- package/dist/application/services/loop-context-optimizer.d.ts +0 -8
- package/dist/application/services/loop-context-optimizer.js +0 -114
- package/dist/application/services/loop-execution-context.d.ts +0 -23
- package/dist/application/services/loop-execution-context.js +0 -188
- package/dist/application/services/loop-step-resolver.d.ts +0 -11
- package/dist/application/services/loop-step-resolver.js +0 -70
- package/dist/application/services/validation-engine.d.ts.map +0 -1
- package/dist/application/services/validation-engine.js.map +0 -1
- package/dist/application/services/workflow-service.d.ts.map +0 -1
- package/dist/application/services/workflow-service.js.map +0 -1
- package/dist/application/use-cases/get-next-step.d.ts.map +0 -1
- package/dist/application/use-cases/get-next-step.js.map +0 -1
- package/dist/application/use-cases/get-workflow-docs.d.ts +0 -4
- package/dist/application/use-cases/get-workflow-docs.js +0 -12
- package/dist/application/use-cases/get-workflow.d.ts.map +0 -1
- package/dist/application/use-cases/get-workflow.js.map +0 -1
- package/dist/application/use-cases/get-workrail-help.d.ts +0 -4
- package/dist/application/use-cases/get-workrail-help.js +0 -12
- package/dist/application/use-cases/list-workflows.d.ts.map +0 -1
- package/dist/application/use-cases/list-workflows.js.map +0 -1
- package/dist/application/use-cases/validate-step-output.d.ts.map +0 -1
- package/dist/application/use-cases/validate-step-output.js.map +0 -1
- package/dist/application/use-cases/validate-workflow-json.d.ts.map +0 -1
- package/dist/application/use-cases/validate-workflow-json.js.map +0 -1
- package/dist/application/validation.d.ts.map +0 -1
- package/dist/application/validation.js.map +0 -1
- package/dist/cli/migrate-workflow.d.ts +0 -22
- package/dist/cli/migrate-workflow.js +0 -196
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/container.d.ts +0 -15
- package/dist/container.d.ts.map +0 -1
- package/dist/container.js +0 -25
- package/dist/container.js.map +0 -1
- package/dist/core/error-handler.d.ts.map +0 -1
- package/dist/core/error-handler.js.map +0 -1
- package/dist/domain/index.d.ts +0 -2
- package/dist/domain/index.d.ts.map +0 -1
- package/dist/domain/index.js +0 -18
- package/dist/domain/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/infrastructure/index.d.ts.map +0 -1
- package/dist/infrastructure/index.js.map +0 -1
- package/dist/infrastructure/rpc/handler.d.ts +0 -17
- package/dist/infrastructure/rpc/handler.d.ts.map +0 -1
- package/dist/infrastructure/rpc/handler.js +0 -78
- package/dist/infrastructure/rpc/handler.js.map +0 -1
- package/dist/infrastructure/rpc/index.d.ts +0 -1
- package/dist/infrastructure/rpc/index.d.ts.map +0 -1
- package/dist/infrastructure/rpc/index.js +0 -17
- package/dist/infrastructure/rpc/index.js.map +0 -1
- package/dist/infrastructure/rpc/server.d.ts +0 -3
- package/dist/infrastructure/rpc/server.d.ts.map +0 -1
- package/dist/infrastructure/rpc/server.js +0 -37
- package/dist/infrastructure/rpc/server.js.map +0 -1
- package/dist/infrastructure/storage/caching-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/caching-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/context-storage.d.ts +0 -150
- package/dist/infrastructure/storage/context-storage.js +0 -40
- package/dist/infrastructure/storage/file-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/file-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/filesystem-blob-storage.d.ts +0 -27
- package/dist/infrastructure/storage/filesystem-blob-storage.js +0 -363
- package/dist/infrastructure/storage/git-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/git-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/hybrid-context-storage.d.ts +0 -29
- package/dist/infrastructure/storage/hybrid-context-storage.js +0 -400
- package/dist/infrastructure/storage/in-memory-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/in-memory-storage.js.map +0 -1
- package/dist/infrastructure/storage/index.d.ts.map +0 -1
- package/dist/infrastructure/storage/index.js.map +0 -1
- package/dist/infrastructure/storage/migrations/001_initial_schema.sql +0 -38
- package/dist/infrastructure/storage/migrations/002_context_concurrency_enhancements.sql +0 -234
- package/dist/infrastructure/storage/migrations/003_classification_overrides.sql +0 -20
- package/dist/infrastructure/storage/multi-directory-workflow-storage.d.ts +0 -32
- package/dist/infrastructure/storage/multi-directory-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/multi-directory-workflow-storage.js +0 -184
- package/dist/infrastructure/storage/multi-directory-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/plugin-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/plugin-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/remote-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/remote-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/schema-validating-workflow-storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/schema-validating-workflow-storage.js.map +0 -1
- package/dist/infrastructure/storage/sqlite-metadata-storage.d.ts +0 -35
- package/dist/infrastructure/storage/sqlite-metadata-storage.js +0 -410
- package/dist/infrastructure/storage/sqlite-migrator.d.ts +0 -46
- package/dist/infrastructure/storage/sqlite-migrator.js +0 -293
- package/dist/infrastructure/storage/storage.d.ts.map +0 -1
- package/dist/infrastructure/storage/storage.js.map +0 -1
- package/dist/mcp-server.d.ts.map +0 -1
- package/dist/mcp-server.js.map +0 -1
- package/dist/tools/mcp_initialize.d.ts +0 -2
- package/dist/tools/mcp_initialize.d.ts.map +0 -1
- package/dist/tools/mcp_initialize.js +0 -45
- package/dist/tools/mcp_initialize.js.map +0 -1
- package/dist/tools/mcp_shutdown.d.ts +0 -2
- package/dist/tools/mcp_shutdown.d.ts.map +0 -1
- package/dist/tools/mcp_shutdown.js +0 -10
- package/dist/tools/mcp_shutdown.js.map +0 -1
- package/dist/tools/mcp_tools_list.d.ts +0 -2
- package/dist/tools/mcp_tools_list.d.ts.map +0 -1
- package/dist/tools/mcp_tools_list.js +0 -60
- package/dist/tools/mcp_tools_list.js.map +0 -1
- package/dist/tools/session-tools.d.ts +0 -5
- package/dist/tools/session-tools.js +0 -270
- package/dist/types/context-types.d.ts +0 -236
- package/dist/types/context-types.js +0 -10
- package/dist/types/documentation-types.d.ts +0 -37
- package/dist/types/loop-context-optimizer.d.ts +0 -7
- package/dist/types/mcp-types.d.ts +0 -273
- package/dist/types/mcp-types.d.ts.map +0 -1
- package/dist/types/mcp-types.js +0 -19
- package/dist/types/mcp-types.js.map +0 -1
- package/dist/types/server.d.ts.map +0 -1
- package/dist/types/server.js.map +0 -1
- package/dist/types/storage.d.ts.map +0 -1
- package/dist/types/storage.js.map +0 -1
- package/dist/types/workflow-types.d.ts +0 -336
- package/dist/types/workflow-types.d.ts.map +0 -1
- package/dist/types/workflow-types.js +0 -20
- package/dist/types/workflow-types.js.map +0 -1
- package/dist/utils/condition-evaluator.d.ts.map +0 -1
- package/dist/utils/condition-evaluator.js.map +0 -1
- package/dist/utils/config.d.ts +0 -149
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js +0 -251
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/storage-security.d.ts.map +0 -1
- package/dist/utils/storage-security.js.map +0 -1
- package/dist/validation/request-validator.d.ts +0 -8
- package/dist/validation/request-validator.d.ts.map +0 -1
- package/dist/validation/request-validator.js +0 -32
- package/dist/validation/request-validator.js.map +0 -1
- package/dist/validation/response-validator.d.ts +0 -8
- package/dist/validation/response-validator.d.ts.map +0 -1
- package/dist/validation/response-validator.js +0 -110
- package/dist/validation/response-validator.js.map +0 -1
- package/dist/validation/schemas.d.ts +0 -1
- package/dist/validation/schemas.d.ts.map +0 -1
- package/dist/validation/schemas.js +0 -53
- package/dist/validation/schemas.js.map +0 -1
- /package/dist/{types/documentation-types.js → errors/app-error.js} +0 -0
- /package/dist/{types/loop-context-optimizer.js → runtime/brand.js} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.misuse = exports.failure = exports.successMessage = exports.success = exports.toNumericExitCode = exports.toProcessExitCode = void 0;
|
|
4
|
+
var exit_code_js_1 = require("./exit-code.js");
|
|
5
|
+
Object.defineProperty(exports, "toProcessExitCode", { enumerable: true, get: function () { return exit_code_js_1.toProcessExitCode; } });
|
|
6
|
+
Object.defineProperty(exports, "toNumericExitCode", { enumerable: true, get: function () { return exit_code_js_1.toNumericExitCode; } });
|
|
7
|
+
var cli_result_js_1 = require("./cli-result.js");
|
|
8
|
+
Object.defineProperty(exports, "success", { enumerable: true, get: function () { return cli_result_js_1.success; } });
|
|
9
|
+
Object.defineProperty(exports, "successMessage", { enumerable: true, get: function () { return cli_result_js_1.successMessage; } });
|
|
10
|
+
Object.defineProperty(exports, "failure", { enumerable: true, get: function () { return cli_result_js_1.failure; } });
|
|
11
|
+
Object.defineProperty(exports, "misuse", { enumerable: true, get: function () { return cli_result_js_1.misuse; } });
|
package/dist/cli.js
CHANGED
|
@@ -1,38 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
-
var ownKeys = function(o) {
|
|
21
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
-
var ar = [];
|
|
23
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
-
return ar;
|
|
25
|
-
};
|
|
26
|
-
return ownKeys(o);
|
|
27
|
-
};
|
|
28
|
-
return function (mod) {
|
|
29
|
-
if (mod && mod.__esModule) return mod;
|
|
30
|
-
var result = {};
|
|
31
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
-
__setModuleDefault(result, mod);
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
5
|
};
|
|
@@ -40,14 +7,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
7
|
const commander_1 = require("commander");
|
|
41
8
|
const fs_1 = __importDefault(require("fs"));
|
|
42
9
|
const path_1 = __importDefault(require("path"));
|
|
43
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
44
10
|
const os_1 = __importDefault(require("os"));
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
11
|
+
const container_js_1 = require("./di/container.js");
|
|
12
|
+
const tokens_js_1 = require("./di/tokens.js");
|
|
13
|
+
const server_js_1 = require("./mcp/server.js");
|
|
14
|
+
const workflow_js_1 = require("./types/workflow.js");
|
|
15
|
+
const validation_js_1 = require("./application/validation.js");
|
|
16
|
+
const validate_workflow_file_js_1 = require("./application/use-cases/validate-workflow-file.js");
|
|
17
|
+
const interpret_result_js_1 = require("./cli/interpret-result.js");
|
|
18
|
+
const index_js_1 = require("./cli/commands/index.js");
|
|
51
19
|
const program = new commander_1.Command();
|
|
52
20
|
program
|
|
53
21
|
.name('workrail')
|
|
@@ -57,270 +25,108 @@ program
|
|
|
57
25
|
.command('init')
|
|
58
26
|
.description('Initialize user workflow directory with sample workflows')
|
|
59
27
|
.action(async () => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
28
|
+
const result = await (0, index_js_1.executeInitCommand)({
|
|
29
|
+
mkdir: (p, opts) => fs_1.default.promises.mkdir(p, opts),
|
|
30
|
+
readdir: (p) => fs_1.default.promises.readdir(p),
|
|
31
|
+
writeFile: (p, content) => fs_1.default.promises.writeFile(p, content, 'utf-8'),
|
|
32
|
+
homedir: os_1.default.homedir,
|
|
33
|
+
joinPath: path_1.default.join,
|
|
34
|
+
});
|
|
35
|
+
(0, interpret_result_js_1.interpretCliResultWithoutDI)(result);
|
|
36
|
+
});
|
|
37
|
+
program
|
|
38
|
+
.command('sources')
|
|
39
|
+
.description('Show workflow directory sources and their status')
|
|
40
|
+
.action(() => {
|
|
41
|
+
const result = (0, index_js_1.executeSourcesCommand)({
|
|
42
|
+
resolvePath: path_1.default.resolve,
|
|
43
|
+
existsSync: fs_1.default.existsSync,
|
|
44
|
+
readdirSync: fs_1.default.readdirSync,
|
|
45
|
+
homedir: os_1.default.homedir,
|
|
46
|
+
cwd: process.cwd,
|
|
47
|
+
dirname: __dirname,
|
|
48
|
+
pathDelimiter: path_1.default.delimiter,
|
|
49
|
+
env: process.env,
|
|
50
|
+
});
|
|
51
|
+
(0, interpret_result_js_1.interpretCliResultWithoutDI)(result);
|
|
79
52
|
});
|
|
80
53
|
program
|
|
81
54
|
.command('list')
|
|
82
55
|
.description('List all available workflows from all sources')
|
|
83
56
|
.option('-v, --verbose', 'Show detailed information including sources')
|
|
84
57
|
.action(async (options) => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (workflows.length === 0) {
|
|
91
|
-
console.log(chalk_1.default.yellow(' No workflows found.'));
|
|
92
|
-
console.log(chalk_1.default.gray(' Run "workrail init" to create your first workflow.'));
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
workflows.forEach((workflow, index) => {
|
|
96
|
-
console.log(chalk_1.default.green(`${index + 1}. ${workflow.name}`));
|
|
97
|
-
console.log(chalk_1.default.white(` ID: ${workflow.id}`));
|
|
98
|
-
console.log(chalk_1.default.gray(` ${workflow.description}`));
|
|
99
|
-
if (options.verbose) {
|
|
100
|
-
console.log(chalk_1.default.cyan(` Version: ${workflow.version}`));
|
|
101
|
-
}
|
|
102
|
-
console.log();
|
|
103
|
-
});
|
|
104
|
-
console.log(chalk_1.default.gray(`Total: ${workflows.length} workflows`));
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
console.error(chalk_1.default.red('❌ Failed to list workflows:'));
|
|
108
|
-
console.error(chalk_1.default.red(error.message));
|
|
109
|
-
process.exit(1);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
program
|
|
113
|
-
.command('sources')
|
|
114
|
-
.description('Show workflow directory sources and their status')
|
|
115
|
-
.action(async () => {
|
|
116
|
-
try {
|
|
117
|
-
console.log(chalk_1.default.blue('📂 Workflow directory sources:'));
|
|
118
|
-
console.log();
|
|
119
|
-
const sources = [
|
|
120
|
-
{
|
|
121
|
-
name: 'Bundled Workflows',
|
|
122
|
-
path: path_1.default.resolve(__dirname, '../workflows'),
|
|
123
|
-
type: 'bundled',
|
|
124
|
-
description: 'Pre-built workflows included with WorkRail'
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
name: 'User Workflows',
|
|
128
|
-
path: path_1.default.join(os_1.default.homedir(), '.workrail', 'workflows'),
|
|
129
|
-
type: 'user',
|
|
130
|
-
description: 'Your personal workflow collection'
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
name: 'Project Workflows',
|
|
134
|
-
path: path_1.default.resolve(process.cwd(), 'workflows'),
|
|
135
|
-
type: 'project',
|
|
136
|
-
description: 'Project-specific workflows'
|
|
137
|
-
}
|
|
138
|
-
];
|
|
139
|
-
const envPaths = process.env['WORKFLOW_STORAGE_PATH'];
|
|
140
|
-
if (envPaths) {
|
|
141
|
-
const customPaths = envPaths.split(path_1.default.delimiter);
|
|
142
|
-
customPaths.forEach((customPath, index) => {
|
|
143
|
-
sources.push({
|
|
144
|
-
name: `Custom Path ${index + 1}`,
|
|
145
|
-
path: path_1.default.resolve(customPath.trim()),
|
|
146
|
-
type: 'custom',
|
|
147
|
-
description: 'Custom workflow directory'
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
sources.forEach((source, index) => {
|
|
152
|
-
const exists = fs_1.default.existsSync(source.path);
|
|
153
|
-
const icon = exists ? '✅' : '❌';
|
|
154
|
-
const status = exists ? 'Found' : 'Not found';
|
|
155
|
-
console.log(chalk_1.default.white(`${index + 1}. ${source.name} ${icon}`));
|
|
156
|
-
console.log(chalk_1.default.gray(` Path: ${source.path}`));
|
|
157
|
-
console.log(chalk_1.default.gray(` Status: ${status}`));
|
|
158
|
-
console.log(chalk_1.default.gray(` ${source.description}`));
|
|
159
|
-
if (exists) {
|
|
160
|
-
try {
|
|
161
|
-
const files = fs_1.default.readdirSync(source.path).filter(f => f.endsWith('.json'));
|
|
162
|
-
console.log(chalk_1.default.cyan(` Workflows: ${files.length} files`));
|
|
163
|
-
}
|
|
164
|
-
catch (error) {
|
|
165
|
-
console.log(chalk_1.default.red(` Error reading directory`));
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
console.log();
|
|
169
|
-
});
|
|
170
|
-
console.log(chalk_1.default.yellow('💡 Tips:'));
|
|
171
|
-
console.log(chalk_1.default.white('• Run "workrail init" to create the user workflow directory'));
|
|
172
|
-
console.log(chalk_1.default.white('• Set WORKFLOW_STORAGE_PATH to add custom directories'));
|
|
173
|
-
console.log(chalk_1.default.white('• Use colon-separated paths for multiple custom directories'));
|
|
174
|
-
}
|
|
175
|
-
catch (error) {
|
|
176
|
-
console.error(chalk_1.default.red('❌ Failed to check workflow sources:'));
|
|
177
|
-
console.error(chalk_1.default.red(error.message));
|
|
178
|
-
process.exit(1);
|
|
179
|
-
}
|
|
58
|
+
await (0, container_js_1.initializeContainer)({ runtimeMode: { kind: 'cli' } });
|
|
59
|
+
const terminator = container_js_1.container.resolve(tokens_js_1.DI.Runtime.ProcessTerminator);
|
|
60
|
+
const workflowService = container_js_1.container.resolve(tokens_js_1.DI.Services.Workflow);
|
|
61
|
+
const result = await (0, index_js_1.executeListCommand)({ listWorkflowSummaries: () => workflowService.listWorkflowSummaries() }, { verbose: options.verbose });
|
|
62
|
+
(0, interpret_result_js_1.interpretCliResult)(result, terminator);
|
|
180
63
|
});
|
|
181
|
-
async function validateWorkflowFile(filePath) {
|
|
182
|
-
try {
|
|
183
|
-
const resolvedPath = path_1.default.resolve(filePath);
|
|
184
|
-
if (!fs_1.default.existsSync(resolvedPath)) {
|
|
185
|
-
console.error(chalk_1.default.red('❌ Error: File not found:'), filePath);
|
|
186
|
-
console.error(chalk_1.default.yellow('\nPlease check the file path and try again.'));
|
|
187
|
-
process.exit(1);
|
|
188
|
-
}
|
|
189
|
-
let content;
|
|
190
|
-
try {
|
|
191
|
-
content = fs_1.default.readFileSync(resolvedPath, 'utf-8');
|
|
192
|
-
}
|
|
193
|
-
catch (error) {
|
|
194
|
-
if (error.code === 'EACCES') {
|
|
195
|
-
console.error(chalk_1.default.red('❌ Error: Permission denied:'), filePath);
|
|
196
|
-
console.error(chalk_1.default.yellow('\nPlease check file permissions and try again.'));
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
console.error(chalk_1.default.red('❌ Error reading file:'), filePath);
|
|
200
|
-
console.error(chalk_1.default.yellow(`\n${error.message}`));
|
|
201
|
-
}
|
|
202
|
-
process.exit(1);
|
|
203
|
-
}
|
|
204
|
-
let workflow;
|
|
205
|
-
try {
|
|
206
|
-
workflow = JSON.parse(content);
|
|
207
|
-
}
|
|
208
|
-
catch (error) {
|
|
209
|
-
console.error(chalk_1.default.red('❌ Error: Invalid JSON syntax in'), filePath);
|
|
210
|
-
console.error(chalk_1.default.yellow(`\n${error.message}`));
|
|
211
|
-
console.error(chalk_1.default.yellow('\nPlease check the JSON syntax and try again.'));
|
|
212
|
-
process.exit(1);
|
|
213
|
-
}
|
|
214
|
-
const { validateWorkflow: schemaValidate } = await Promise.resolve().then(() => __importStar(require('./application/validation')));
|
|
215
|
-
const schemaResult = schemaValidate(workflow);
|
|
216
|
-
if (!schemaResult.valid) {
|
|
217
|
-
console.error(chalk_1.default.red('❌ Workflow validation failed:'), filePath);
|
|
218
|
-
console.error(chalk_1.default.yellow('\nValidation errors:'));
|
|
219
|
-
schemaResult.errors.forEach(error => {
|
|
220
|
-
console.error(chalk_1.default.red(' •'), error);
|
|
221
|
-
});
|
|
222
|
-
console.error(chalk_1.default.yellow('\nPlease fix the errors above and try again.'));
|
|
223
|
-
process.exit(1);
|
|
224
|
-
}
|
|
225
|
-
const validationEngine = new validation_engine_1.ValidationEngine();
|
|
226
|
-
const result = validationEngine.validateWorkflow(workflow);
|
|
227
|
-
if (result.valid && !result.warnings?.length && !result.info?.length) {
|
|
228
|
-
console.log(chalk_1.default.green('✅ Workflow is valid:'), filePath);
|
|
229
|
-
}
|
|
230
|
-
else if (result.valid) {
|
|
231
|
-
console.log(chalk_1.default.green('✅ Workflow is valid with warnings:'), filePath);
|
|
232
|
-
if (result.warnings && result.warnings.length > 0) {
|
|
233
|
-
console.log(chalk_1.default.yellow('\n⚠️ Warnings:'));
|
|
234
|
-
result.warnings.forEach(warning => {
|
|
235
|
-
console.log(chalk_1.default.yellow(' •'), warning);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
if (result.info && result.info.length > 0) {
|
|
239
|
-
console.log(chalk_1.default.blue('\nℹ️ Information:'));
|
|
240
|
-
result.info.forEach(info => {
|
|
241
|
-
console.log(chalk_1.default.blue(' •'), info);
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
if (result.suggestions && result.suggestions.length > 0) {
|
|
245
|
-
console.log(chalk_1.default.gray('\n💡 Suggestions:'));
|
|
246
|
-
result.suggestions.forEach(suggestion => {
|
|
247
|
-
console.log(chalk_1.default.gray(' •'), suggestion);
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
console.error(chalk_1.default.red('❌ Workflow validation failed:'), filePath);
|
|
253
|
-
console.error(chalk_1.default.yellow('\nValidation errors:'));
|
|
254
|
-
result.issues.forEach(error => {
|
|
255
|
-
console.error(chalk_1.default.red(' •'), error);
|
|
256
|
-
});
|
|
257
|
-
console.error(chalk_1.default.yellow(`\nFound ${result.issues.length} validation error${result.issues.length === 1 ? '' : 's'}.`));
|
|
258
|
-
if (result.suggestions && result.suggestions.length > 0) {
|
|
259
|
-
console.log(chalk_1.default.gray('\n💡 Suggestions:'));
|
|
260
|
-
result.suggestions.forEach(suggestion => {
|
|
261
|
-
console.log(chalk_1.default.gray(' •'), suggestion);
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
process.exit(1);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
catch (error) {
|
|
268
|
-
console.error(chalk_1.default.red('❌ Unexpected error:'), error.message);
|
|
269
|
-
process.exit(1);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
64
|
program
|
|
273
65
|
.command('validate <file>')
|
|
274
66
|
.description('Validate a workflow file against the schema')
|
|
275
|
-
.action(
|
|
67
|
+
.action(async (filePath) => {
|
|
68
|
+
await (0, container_js_1.initializeContainer)({ runtimeMode: { kind: 'cli' } });
|
|
69
|
+
const terminator = container_js_1.container.resolve(tokens_js_1.DI.Runtime.ProcessTerminator);
|
|
70
|
+
const validationEngine = container_js_1.container.resolve(tokens_js_1.DI.Infra.ValidationEngine);
|
|
71
|
+
const validateWorkflowFile = (0, validate_workflow_file_js_1.createValidateWorkflowFileUseCase)({
|
|
72
|
+
resolvePath: path_1.default.resolve,
|
|
73
|
+
existsSync: fs_1.default.existsSync,
|
|
74
|
+
readFileSyncUtf8: (resolvedPath) => fs_1.default.readFileSync(resolvedPath, 'utf-8'),
|
|
75
|
+
parseJson: (content) => JSON.parse(content),
|
|
76
|
+
schemaValidate: (definition) => (0, validation_js_1.validateWorkflow)(definition),
|
|
77
|
+
makeRuntimeWorkflow: (definition, resolvedPath) => (0, workflow_js_1.createWorkflow)(definition, (0, workflow_js_1.createCustomDirectorySource)(path_1.default.dirname(resolvedPath), 'CLI Validate')),
|
|
78
|
+
validateRuntimeWorkflow: (workflow) => validationEngine.validateWorkflow(workflow),
|
|
79
|
+
});
|
|
80
|
+
const result = (0, index_js_1.executeValidateCommand)(filePath, { validateWorkflowFile });
|
|
81
|
+
(0, interpret_result_js_1.interpretCliResult)(result, terminator);
|
|
82
|
+
});
|
|
276
83
|
program
|
|
277
84
|
.command('migrate <file>')
|
|
278
85
|
.description('Migrate a workflow from v0.0.1 to v0.1.0')
|
|
279
86
|
.option('-o, --output <path>', 'Output file path (defaults to input file)')
|
|
280
87
|
.option('-d, --dry-run', 'Show what would be changed without modifying files')
|
|
281
88
|
.option('-b, --backup', 'Create a backup when overwriting the input file')
|
|
282
|
-
.
|
|
283
|
-
|
|
89
|
+
.action(async (filePath, options) => {
|
|
90
|
+
await (0, container_js_1.initializeContainer)({ runtimeMode: { kind: 'cli' } });
|
|
91
|
+
const terminator = container_js_1.container.resolve(tokens_js_1.DI.Runtime.ProcessTerminator);
|
|
92
|
+
const result = await (0, index_js_1.executeMigrateCommand)(filePath, {
|
|
93
|
+
output: options.output,
|
|
94
|
+
dryRun: options.dryRun,
|
|
95
|
+
backup: options.backup,
|
|
96
|
+
}, {
|
|
97
|
+
readFile: (p) => fs_1.default.promises.readFile(p, 'utf-8'),
|
|
98
|
+
writeFile: (p, content) => fs_1.default.promises.writeFile(p, content, 'utf-8'),
|
|
99
|
+
copyFile: (src, dest) => fs_1.default.promises.copyFile(src, dest),
|
|
100
|
+
});
|
|
101
|
+
(0, interpret_result_js_1.interpretCliResult)(result, terminator);
|
|
102
|
+
});
|
|
284
103
|
program
|
|
285
104
|
.command('start')
|
|
286
105
|
.description('Start the MCP server')
|
|
287
106
|
.action(async () => {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
catch (error) {
|
|
295
|
-
console.error(chalk_1.default.red('❌ Failed to start server:'), error.message);
|
|
296
|
-
process.exit(1);
|
|
297
|
-
}
|
|
107
|
+
await (0, container_js_1.initializeContainer)({ runtimeMode: { kind: 'cli' } });
|
|
108
|
+
const terminator = container_js_1.container.resolve(tokens_js_1.DI.Runtime.ProcessTerminator);
|
|
109
|
+
const result = await (0, index_js_1.executeStartCommand)({
|
|
110
|
+
createServer: () => ({ start: () => (0, server_js_1.startServer)() }),
|
|
111
|
+
});
|
|
112
|
+
(0, interpret_result_js_1.interpretCliResult)(result, terminator);
|
|
298
113
|
});
|
|
299
114
|
program
|
|
300
115
|
.command('cleanup')
|
|
301
116
|
.description('Clean up orphaned workrail processes and free up ports')
|
|
302
117
|
.option('-f, --force', 'Force cleanup without confirmation')
|
|
303
118
|
.action(async (options) => {
|
|
304
|
-
|
|
305
|
-
console.
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
console.log(chalk_1.default.yellow(' Press Ctrl+C to cancel, or wait 3 seconds to continue...'));
|
|
309
|
-
await new Promise(resolve => setTimeout(resolve, 3000));
|
|
310
|
-
}
|
|
311
|
-
const sessionManager = new index_js_1.SessionManager();
|
|
312
|
-
const httpServer = new index_js_1.HttpServer(sessionManager);
|
|
313
|
-
const count = await httpServer.fullCleanup();
|
|
314
|
-
if (count > 0) {
|
|
315
|
-
console.log(chalk_1.default.green(`✅ Cleaned up ${count} orphaned process(es)`));
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
console.log(chalk_1.default.green('✅ No orphaned processes found'));
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
catch (error) {
|
|
322
|
-
console.error(chalk_1.default.red('❌ Cleanup failed:'), error.message);
|
|
323
|
-
process.exit(1);
|
|
119
|
+
if (!options.force) {
|
|
120
|
+
console.error('⚠️ This will terminate all workrail dashboard processes');
|
|
121
|
+
console.error(' Press Ctrl+C to cancel, or wait 3 seconds to continue...');
|
|
122
|
+
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
324
123
|
}
|
|
124
|
+
await (0, container_js_1.initializeContainer)({ runtimeMode: { kind: 'cli' } });
|
|
125
|
+
const terminator = container_js_1.container.resolve(tokens_js_1.DI.Runtime.ProcessTerminator);
|
|
126
|
+
const httpServer = container_js_1.container.resolve(tokens_js_1.DI.Infra.HttpServer);
|
|
127
|
+
const result = await (0, index_js_1.executeCleanupCommand)({
|
|
128
|
+
fullCleanup: () => httpServer.fullCleanup(),
|
|
129
|
+
});
|
|
130
|
+
(0, interpret_result_js_1.interpretCliResult)(result, terminator);
|
|
325
131
|
});
|
|
326
132
|
program.parse();
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Result } from '../runtime/result.js';
|
|
2
|
+
import type { Brand } from '../runtime/brand.js';
|
|
3
|
+
import { Err } from '../errors/factories.js';
|
|
4
|
+
import type { ValidatedAppConfig } from '../errors/app-error.js';
|
|
5
|
+
export type CacheTtlMs = Brand<number, 'CacheTtlMs'>;
|
|
6
|
+
export type ProjectPath = Brand<string, 'ProjectPath'>;
|
|
7
|
+
export type WorkflowDir = Brand<string, 'WorkflowDir'>;
|
|
8
|
+
export type DashboardPort = Brand<number, 'DashboardPort'>;
|
|
9
|
+
export type DashboardMode = {
|
|
10
|
+
readonly kind: 'unified';
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: 'legacy';
|
|
13
|
+
};
|
|
14
|
+
export type BrowserBehavior = {
|
|
15
|
+
readonly kind: 'auto_open';
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: 'manual';
|
|
18
|
+
};
|
|
19
|
+
export interface AppConfig {
|
|
20
|
+
readonly cache: {
|
|
21
|
+
readonly ttlMs: CacheTtlMs;
|
|
22
|
+
};
|
|
23
|
+
readonly paths: {
|
|
24
|
+
readonly projectPath: ProjectPath;
|
|
25
|
+
readonly workflowDir: WorkflowDir;
|
|
26
|
+
};
|
|
27
|
+
readonly dashboard: {
|
|
28
|
+
readonly mode: DashboardMode;
|
|
29
|
+
readonly browserBehavior: BrowserBehavior;
|
|
30
|
+
readonly port: DashboardPort;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export type ValidatedConfig = ValidatedAppConfig<AppConfig>;
|
|
34
|
+
export interface LoadConfigOptions {
|
|
35
|
+
readonly env: Record<string, string | undefined>;
|
|
36
|
+
readonly projectPath: string;
|
|
37
|
+
}
|
|
38
|
+
export type LoadConfigResult = Result<ValidatedConfig, ReturnType<typeof Err.configInvalid>>;
|
|
39
|
+
export declare function loadConfig(options: LoadConfigOptions): LoadConfigResult;
|
|
40
|
+
export declare function createValidatedConfig(value: AppConfig): ValidatedConfig;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadConfig = loadConfig;
|
|
4
|
+
exports.createValidatedConfig = createValidatedConfig;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const result_js_1 = require("../runtime/result.js");
|
|
7
|
+
const factories_js_1 = require("../errors/factories.js");
|
|
8
|
+
const EnvSchema = zod_1.z.object({
|
|
9
|
+
CACHE_TTL: zod_1.z
|
|
10
|
+
.string()
|
|
11
|
+
.optional()
|
|
12
|
+
.transform((v) => (v === undefined ? undefined : Number(v)))
|
|
13
|
+
.pipe(zod_1.z
|
|
14
|
+
.number()
|
|
15
|
+
.min(0, 'CACHE_TTL cannot be negative')
|
|
16
|
+
.max(86400000, 'CACHE_TTL cannot exceed 24 hours (86400000ms)')
|
|
17
|
+
.default(300000)),
|
|
18
|
+
WORKRAIL_WORKFLOWS_DIR: zod_1.z.string().optional(),
|
|
19
|
+
WORKRAIL_DISABLE_UNIFIED_DASHBOARD: zod_1.z.enum(['0', '1']).default('0'),
|
|
20
|
+
WORKRAIL_DISABLE_AUTO_OPEN: zod_1.z.enum(['0', '1']).default('0'),
|
|
21
|
+
WORKRAIL_DASHBOARD_PORT: zod_1.z
|
|
22
|
+
.string()
|
|
23
|
+
.optional()
|
|
24
|
+
.transform((v) => (v === undefined ? undefined : Number(v)))
|
|
25
|
+
.pipe(zod_1.z.number().int().min(1024, 'Port must be >= 1024').max(65535, 'Port must be <= 65535').default(3456)),
|
|
26
|
+
});
|
|
27
|
+
function loadConfig(options) {
|
|
28
|
+
const parsed = EnvSchema.safeParse(options.env);
|
|
29
|
+
if (!parsed.success) {
|
|
30
|
+
return (0, result_js_1.err)(factories_js_1.Err.configInvalid(toConfigIssues(parsed.error)));
|
|
31
|
+
}
|
|
32
|
+
return (0, result_js_1.ok)(buildConfig(parsed.data, options.projectPath));
|
|
33
|
+
}
|
|
34
|
+
function createValidatedConfig(value) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
function buildConfig(env, projectPath) {
|
|
38
|
+
const dashboardMode = env.WORKRAIL_DISABLE_UNIFIED_DASHBOARD === '1' ? { kind: 'legacy' } : { kind: 'unified' };
|
|
39
|
+
const browserBehavior = env.WORKRAIL_DISABLE_AUTO_OPEN === '1' ? { kind: 'manual' } : { kind: 'auto_open' };
|
|
40
|
+
return {
|
|
41
|
+
cache: { ttlMs: env.CACHE_TTL },
|
|
42
|
+
paths: {
|
|
43
|
+
projectPath: projectPath,
|
|
44
|
+
workflowDir: (env.WORKRAIL_WORKFLOWS_DIR ?? projectPath),
|
|
45
|
+
},
|
|
46
|
+
dashboard: {
|
|
47
|
+
mode: dashboardMode,
|
|
48
|
+
browserBehavior,
|
|
49
|
+
port: env.WORKRAIL_DASHBOARD_PORT,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function toConfigIssues(error) {
|
|
54
|
+
return error.errors.map((issue) => ({
|
|
55
|
+
path: issue.path.length ? issue.path.join('.') : '(root)',
|
|
56
|
+
message: issue.message,
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
@@ -18,7 +18,15 @@ export interface IFeatureFlagProvider {
|
|
|
18
18
|
}
|
|
19
19
|
export declare class EnvironmentFeatureFlagProvider implements IFeatureFlagProvider {
|
|
20
20
|
private readonly flags;
|
|
21
|
-
constructor(
|
|
21
|
+
constructor();
|
|
22
|
+
static withEnv(env: Record<string, string | undefined>): IFeatureFlagProvider;
|
|
23
|
+
isEnabled(key: FeatureFlagKey): boolean;
|
|
24
|
+
getAll(): FeatureFlags;
|
|
25
|
+
getSummary(): string;
|
|
26
|
+
}
|
|
27
|
+
export declare class CustomEnvFeatureFlagProvider implements IFeatureFlagProvider {
|
|
28
|
+
private readonly flags;
|
|
29
|
+
constructor(env: Record<string, string | undefined>);
|
|
22
30
|
isEnabled(key: FeatureFlagKey): boolean;
|
|
23
31
|
getAll(): FeatureFlags;
|
|
24
32
|
getSummary(): string;
|
|
@@ -30,4 +38,4 @@ export declare class StaticFeatureFlagProvider implements IFeatureFlagProvider {
|
|
|
30
38
|
getAll(): FeatureFlags;
|
|
31
39
|
getSummary(): string;
|
|
32
40
|
}
|
|
33
|
-
export declare function createFeatureFlagProvider(
|
|
41
|
+
export declare function createFeatureFlagProvider(): never;
|