@exaudeus/workrail 0.8.6 → 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 +45 -39
- 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/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/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
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createGetNextStep = createGetNextStep;
|
|
4
|
-
exports.getNextStep = getNextStep;
|
|
5
4
|
function createGetNextStep(service) {
|
|
6
|
-
return async (workflowId,
|
|
7
|
-
return service.getNextStep(workflowId,
|
|
5
|
+
return async (workflowId, state, event, context) => {
|
|
6
|
+
return service.getNextStep(workflowId, state, event, context);
|
|
8
7
|
};
|
|
9
8
|
}
|
|
10
|
-
async function getNextStep(service, workflowId, completedSteps, context) {
|
|
11
|
-
return createGetNextStep(service)(workflowId, completedSteps, context);
|
|
12
|
-
}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { WorkflowService } from '../services/workflow-service';
|
|
2
|
-
import { Workflow,
|
|
2
|
+
import { Workflow, WorkflowStepDefinition } from '../../types/workflow';
|
|
3
|
+
import { type Result } from '../../domain/execution/result';
|
|
4
|
+
import { type DomainError } from '../../domain/execution/error';
|
|
3
5
|
export type WorkflowGetMode = 'metadata' | 'preview' | undefined;
|
|
4
6
|
export interface WorkflowMetadata {
|
|
5
7
|
id: string;
|
|
6
8
|
name: string;
|
|
7
9
|
description: string;
|
|
8
10
|
version: string;
|
|
9
|
-
preconditions?: string[]
|
|
10
|
-
clarificationPrompts?: string[]
|
|
11
|
-
metaGuidance?: string[]
|
|
11
|
+
preconditions?: readonly string[];
|
|
12
|
+
clarificationPrompts?: readonly string[];
|
|
13
|
+
metaGuidance?: readonly string[];
|
|
12
14
|
totalSteps: number;
|
|
13
15
|
}
|
|
14
16
|
export interface WorkflowPreview extends WorkflowMetadata {
|
|
15
|
-
firstStep:
|
|
17
|
+
firstStep: WorkflowStepDefinition | null;
|
|
16
18
|
}
|
|
17
19
|
export type WorkflowGetResult = Workflow | WorkflowMetadata | WorkflowPreview;
|
|
18
|
-
export declare function createGetWorkflow(service: WorkflowService): (workflowId: string, mode?: WorkflowGetMode) => Promise<WorkflowGetResult
|
|
20
|
+
export declare function createGetWorkflow(service: WorkflowService): (workflowId: string, mode?: WorkflowGetMode) => Promise<Result<WorkflowGetResult, DomainError>>;
|
|
19
21
|
export declare function getWorkflow(service: WorkflowService, workflowId: string): Promise<Workflow>;
|
|
@@ -3,50 +3,59 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createGetWorkflow = createGetWorkflow;
|
|
4
4
|
exports.getWorkflow = getWorkflow;
|
|
5
5
|
const error_handler_1 = require("../../core/error-handler");
|
|
6
|
-
const
|
|
6
|
+
const state_1 = require("../../domain/execution/state");
|
|
7
|
+
const result_1 = require("../../domain/execution/result");
|
|
8
|
+
const error_1 = require("../../domain/execution/error");
|
|
7
9
|
function createGetWorkflow(service) {
|
|
8
10
|
return async (workflowId, mode = 'preview') => {
|
|
9
11
|
const workflow = await service.getWorkflowById(workflowId);
|
|
10
12
|
if (!workflow) {
|
|
11
|
-
|
|
13
|
+
return (0, result_1.err)(error_1.Err.workflowNotFound(workflowId));
|
|
12
14
|
}
|
|
15
|
+
const optional = {
|
|
16
|
+
...(workflow.definition.preconditions !== undefined
|
|
17
|
+
? { preconditions: workflow.definition.preconditions }
|
|
18
|
+
: {}),
|
|
19
|
+
...(workflow.definition.clarificationPrompts !== undefined
|
|
20
|
+
? { clarificationPrompts: workflow.definition.clarificationPrompts }
|
|
21
|
+
: {}),
|
|
22
|
+
...(workflow.definition.metaGuidance !== undefined
|
|
23
|
+
? { metaGuidance: workflow.definition.metaGuidance }
|
|
24
|
+
: {}),
|
|
25
|
+
};
|
|
13
26
|
switch (mode) {
|
|
14
27
|
case 'metadata':
|
|
15
|
-
return {
|
|
16
|
-
id: workflow.id,
|
|
17
|
-
name: workflow.name,
|
|
18
|
-
description: workflow.description,
|
|
19
|
-
version: workflow.version,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
totalSteps: workflow.steps.length
|
|
24
|
-
};
|
|
28
|
+
return (0, result_1.ok)({
|
|
29
|
+
id: workflow.definition.id,
|
|
30
|
+
name: workflow.definition.name,
|
|
31
|
+
description: workflow.definition.description,
|
|
32
|
+
version: workflow.definition.version,
|
|
33
|
+
...optional,
|
|
34
|
+
totalSteps: workflow.definition.steps.length,
|
|
35
|
+
});
|
|
25
36
|
case 'preview':
|
|
26
37
|
default:
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
38
|
+
const next = await service.getNextStep(workflowId, (0, state_1.initialExecutionState)(), undefined, {});
|
|
39
|
+
const firstStep = next.isOk() ? (next.value.next ? next.value.next.step : null) : null;
|
|
40
|
+
return (0, result_1.ok)({
|
|
41
|
+
id: workflow.definition.id,
|
|
42
|
+
name: workflow.definition.name,
|
|
43
|
+
description: workflow.definition.description,
|
|
44
|
+
version: workflow.definition.version,
|
|
45
|
+
...optional,
|
|
46
|
+
totalSteps: workflow.definition.steps.length,
|
|
47
|
+
firstStep,
|
|
48
|
+
});
|
|
39
49
|
}
|
|
40
50
|
};
|
|
41
51
|
}
|
|
42
|
-
function findFirstEligibleStep(steps, context = {}) {
|
|
43
|
-
return steps.find((step) => {
|
|
44
|
-
if (step.runCondition) {
|
|
45
|
-
return (0, condition_evaluator_1.evaluateCondition)(step.runCondition, context);
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
}) || null;
|
|
49
|
-
}
|
|
50
52
|
async function getWorkflow(service, workflowId) {
|
|
51
|
-
|
|
53
|
+
const result = await createGetWorkflow(service)(workflowId, 'preview');
|
|
54
|
+
if (result.isErr()) {
|
|
55
|
+
if (result.error._tag === 'WorkflowNotFound') {
|
|
56
|
+
throw new error_handler_1.WorkflowNotFoundError(workflowId);
|
|
57
|
+
}
|
|
58
|
+
throw new Error(result.error.message);
|
|
59
|
+
}
|
|
60
|
+
return result.value;
|
|
52
61
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { WorkflowService } from '../services/workflow-service';
|
|
2
|
-
import { WorkflowSummary } from '../../types/
|
|
3
|
-
export declare function createListWorkflows(service: WorkflowService): () => Promise<WorkflowSummary[]>;
|
|
4
|
-
export declare function listWorkflows(service: WorkflowService): Promise<WorkflowSummary[]>;
|
|
2
|
+
import { WorkflowSummary } from '../../types/workflow';
|
|
3
|
+
export declare function createListWorkflows(service: WorkflowService): () => Promise<readonly WorkflowSummary[]>;
|
|
4
|
+
export declare function listWorkflows(service: WorkflowService): Promise<readonly WorkflowSummary[]>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { WorkflowService } from '../services/workflow-service';
|
|
2
2
|
export declare function createValidateStepOutput(service: WorkflowService): (workflowId: string, stepId: string, output: string) => Promise<{
|
|
3
3
|
valid: boolean;
|
|
4
|
-
issues: string[];
|
|
5
|
-
suggestions: string[];
|
|
4
|
+
issues: readonly string[];
|
|
5
|
+
suggestions: readonly string[];
|
|
6
6
|
}>;
|
|
7
7
|
export declare function validateStepOutput(service: WorkflowService, workflowId: string, stepId: string, output: string): Promise<{
|
|
8
8
|
valid: boolean;
|
|
9
|
-
issues: string[];
|
|
10
|
-
suggestions: string[];
|
|
9
|
+
issues: readonly string[];
|
|
10
|
+
suggestions: readonly string[];
|
|
11
11
|
}>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Workflow, WorkflowDefinition } from '../../types/workflow.js';
|
|
2
|
+
import type { ValidationResult } from '../../types/validation.js';
|
|
3
|
+
export interface SchemaValidationResult {
|
|
4
|
+
readonly valid: boolean;
|
|
5
|
+
readonly errors: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
export type ValidateWorkflowFileResult = {
|
|
8
|
+
kind: 'file_not_found';
|
|
9
|
+
filePath: string;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'read_error';
|
|
12
|
+
filePath: string;
|
|
13
|
+
message: string;
|
|
14
|
+
code?: string;
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'json_parse_error';
|
|
17
|
+
filePath: string;
|
|
18
|
+
message: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'schema_invalid';
|
|
21
|
+
filePath: string;
|
|
22
|
+
errors: readonly string[];
|
|
23
|
+
} | {
|
|
24
|
+
kind: 'valid';
|
|
25
|
+
filePath: string;
|
|
26
|
+
warnings?: readonly string[];
|
|
27
|
+
info?: readonly string[];
|
|
28
|
+
suggestions?: readonly string[];
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'structural_invalid';
|
|
31
|
+
filePath: string;
|
|
32
|
+
issues: readonly string[];
|
|
33
|
+
warnings?: readonly string[];
|
|
34
|
+
info?: readonly string[];
|
|
35
|
+
suggestions?: readonly string[];
|
|
36
|
+
};
|
|
37
|
+
export interface ValidateWorkflowFileDeps {
|
|
38
|
+
readonly resolvePath: (filePath: string) => string;
|
|
39
|
+
readonly existsSync: (resolvedPath: string) => boolean;
|
|
40
|
+
readonly readFileSyncUtf8: (resolvedPath: string) => string;
|
|
41
|
+
readonly parseJson: (content: string) => unknown;
|
|
42
|
+
readonly schemaValidate: (definition: WorkflowDefinition) => SchemaValidationResult;
|
|
43
|
+
readonly makeRuntimeWorkflow: (definition: WorkflowDefinition, resolvedPath: string) => Workflow;
|
|
44
|
+
readonly validateRuntimeWorkflow: (workflow: Workflow) => ValidationResult;
|
|
45
|
+
}
|
|
46
|
+
export declare function createValidateWorkflowFileUseCase(deps: ValidateWorkflowFileDeps): (filePath: string) => ValidateWorkflowFileResult;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createValidateWorkflowFileUseCase = createValidateWorkflowFileUseCase;
|
|
4
|
+
function createValidateWorkflowFileUseCase(deps) {
|
|
5
|
+
return function validateWorkflowFile(filePath) {
|
|
6
|
+
const resolvedPath = deps.resolvePath(filePath);
|
|
7
|
+
if (!deps.existsSync(resolvedPath)) {
|
|
8
|
+
return { kind: 'file_not_found', filePath };
|
|
9
|
+
}
|
|
10
|
+
let content;
|
|
11
|
+
try {
|
|
12
|
+
content = deps.readFileSyncUtf8(resolvedPath);
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
return {
|
|
16
|
+
kind: 'read_error',
|
|
17
|
+
filePath,
|
|
18
|
+
message: err?.message ?? String(err),
|
|
19
|
+
code: err?.code,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
let parsed;
|
|
23
|
+
try {
|
|
24
|
+
parsed = deps.parseJson(content);
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
return { kind: 'json_parse_error', filePath, message: err?.message ?? String(err) };
|
|
28
|
+
}
|
|
29
|
+
const definition = parsed;
|
|
30
|
+
const schemaResult = deps.schemaValidate(definition);
|
|
31
|
+
if (!schemaResult.valid) {
|
|
32
|
+
return { kind: 'schema_invalid', filePath, errors: schemaResult.errors };
|
|
33
|
+
}
|
|
34
|
+
const runtimeWorkflow = deps.makeRuntimeWorkflow(definition, resolvedPath);
|
|
35
|
+
const structural = deps.validateRuntimeWorkflow(runtimeWorkflow);
|
|
36
|
+
if (structural.valid) {
|
|
37
|
+
const warnings = structural.warnings?.length ? structural.warnings : undefined;
|
|
38
|
+
const info = structural.info?.length ? structural.info : undefined;
|
|
39
|
+
const suggestions = structural.suggestions.length ? structural.suggestions : undefined;
|
|
40
|
+
return {
|
|
41
|
+
kind: 'valid',
|
|
42
|
+
filePath,
|
|
43
|
+
warnings,
|
|
44
|
+
info,
|
|
45
|
+
suggestions,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
kind: 'structural_invalid',
|
|
50
|
+
filePath,
|
|
51
|
+
issues: structural.issues,
|
|
52
|
+
warnings: structural.warnings,
|
|
53
|
+
info: structural.info,
|
|
54
|
+
suggestions: structural.suggestions.length ? structural.suggestions : undefined,
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CliResult } from '../types/cli-result.js';
|
|
2
|
+
export interface CleanupCommandDeps {
|
|
3
|
+
readonly fullCleanup: () => Promise<number>;
|
|
4
|
+
}
|
|
5
|
+
export interface CleanupCommandOptions {
|
|
6
|
+
readonly force?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function executeCleanupCommand(deps: CleanupCommandDeps, _options?: CleanupCommandOptions): Promise<CliResult>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeCleanupCommand = executeCleanupCommand;
|
|
4
|
+
const cli_result_js_1 = require("../types/cli-result.js");
|
|
5
|
+
async function executeCleanupCommand(deps, _options = {}) {
|
|
6
|
+
try {
|
|
7
|
+
const count = await deps.fullCleanup();
|
|
8
|
+
if (count > 0) {
|
|
9
|
+
return (0, cli_result_js_1.success)({
|
|
10
|
+
message: `Cleaned up ${count} orphaned process(es)`,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return (0, cli_result_js_1.success)({
|
|
14
|
+
message: 'No orphaned processes found',
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
return (0, cli_result_js_1.failure)(`Cleanup failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { executeInitCommand, type InitCommandDeps } from './init.js';
|
|
2
|
+
export { executeSourcesCommand, getWorkflowSources, type SourcesCommandDeps, type WorkflowSource } from './sources.js';
|
|
3
|
+
export { executeListCommand, type ListCommandDeps, type ListCommandOptions } from './list.js';
|
|
4
|
+
export { executeValidateCommand, type ValidateCommandDeps } from './validate.js';
|
|
5
|
+
export { executeStartCommand, type StartCommandDeps, type RpcServer } from './start.js';
|
|
6
|
+
export { executeCleanupCommand, type CleanupCommandDeps, type CleanupCommandOptions } from './cleanup.js';
|
|
7
|
+
export { executeMigrateCommand, migrateWorkflow, migrateWorkflowFile, detectWorkflowVersion, type MigrationResult, type FileMigrationResult, type MigrateCommandOptions, type MigrateFileDeps, type MigrateFileOptions, } from './migrate.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectWorkflowVersion = exports.migrateWorkflowFile = exports.migrateWorkflow = exports.executeMigrateCommand = exports.executeCleanupCommand = exports.executeStartCommand = exports.executeValidateCommand = exports.executeListCommand = exports.getWorkflowSources = exports.executeSourcesCommand = exports.executeInitCommand = void 0;
|
|
4
|
+
var init_js_1 = require("./init.js");
|
|
5
|
+
Object.defineProperty(exports, "executeInitCommand", { enumerable: true, get: function () { return init_js_1.executeInitCommand; } });
|
|
6
|
+
var sources_js_1 = require("./sources.js");
|
|
7
|
+
Object.defineProperty(exports, "executeSourcesCommand", { enumerable: true, get: function () { return sources_js_1.executeSourcesCommand; } });
|
|
8
|
+
Object.defineProperty(exports, "getWorkflowSources", { enumerable: true, get: function () { return sources_js_1.getWorkflowSources; } });
|
|
9
|
+
var list_js_1 = require("./list.js");
|
|
10
|
+
Object.defineProperty(exports, "executeListCommand", { enumerable: true, get: function () { return list_js_1.executeListCommand; } });
|
|
11
|
+
var validate_js_1 = require("./validate.js");
|
|
12
|
+
Object.defineProperty(exports, "executeValidateCommand", { enumerable: true, get: function () { return validate_js_1.executeValidateCommand; } });
|
|
13
|
+
var start_js_1 = require("./start.js");
|
|
14
|
+
Object.defineProperty(exports, "executeStartCommand", { enumerable: true, get: function () { return start_js_1.executeStartCommand; } });
|
|
15
|
+
var cleanup_js_1 = require("./cleanup.js");
|
|
16
|
+
Object.defineProperty(exports, "executeCleanupCommand", { enumerable: true, get: function () { return cleanup_js_1.executeCleanupCommand; } });
|
|
17
|
+
var migrate_js_1 = require("./migrate.js");
|
|
18
|
+
Object.defineProperty(exports, "executeMigrateCommand", { enumerable: true, get: function () { return migrate_js_1.executeMigrateCommand; } });
|
|
19
|
+
Object.defineProperty(exports, "migrateWorkflow", { enumerable: true, get: function () { return migrate_js_1.migrateWorkflow; } });
|
|
20
|
+
Object.defineProperty(exports, "migrateWorkflowFile", { enumerable: true, get: function () { return migrate_js_1.migrateWorkflowFile; } });
|
|
21
|
+
Object.defineProperty(exports, "detectWorkflowVersion", { enumerable: true, get: function () { return migrate_js_1.detectWorkflowVersion; } });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CliResult } from '../types/cli-result.js';
|
|
2
|
+
export interface InitCommandDeps {
|
|
3
|
+
readonly mkdir: (path: string, options: {
|
|
4
|
+
recursive: boolean;
|
|
5
|
+
}) => Promise<string | undefined>;
|
|
6
|
+
readonly readdir: (path: string) => Promise<string[]>;
|
|
7
|
+
readonly writeFile: (path: string, content: string) => Promise<void>;
|
|
8
|
+
readonly homedir: () => string;
|
|
9
|
+
readonly joinPath: (...paths: string[]) => string;
|
|
10
|
+
}
|
|
11
|
+
export declare function executeInitCommand(deps: InitCommandDeps): Promise<CliResult>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeInitCommand = executeInitCommand;
|
|
4
|
+
const cli_result_js_1 = require("../types/cli-result.js");
|
|
5
|
+
const SAMPLE_WORKFLOW = {
|
|
6
|
+
id: 'my-custom-workflow',
|
|
7
|
+
name: 'My Custom Workflow',
|
|
8
|
+
description: 'A template for creating custom workflows',
|
|
9
|
+
version: '1.0.0',
|
|
10
|
+
steps: [
|
|
11
|
+
{
|
|
12
|
+
id: 'step-1',
|
|
13
|
+
title: 'First Step',
|
|
14
|
+
prompt: 'Replace this with your custom step',
|
|
15
|
+
agentRole: 'You are helping the user with their custom workflow',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
async function executeInitCommand(deps) {
|
|
20
|
+
const userDir = deps.joinPath(deps.homedir(), '.workrail', 'workflows');
|
|
21
|
+
try {
|
|
22
|
+
await deps.mkdir(userDir, { recursive: true });
|
|
23
|
+
const entries = await deps.readdir(userDir);
|
|
24
|
+
if (entries.length === 0) {
|
|
25
|
+
const samplePath = deps.joinPath(userDir, 'my-custom-workflow.json');
|
|
26
|
+
await deps.writeFile(samplePath, JSON.stringify(SAMPLE_WORKFLOW, null, 2));
|
|
27
|
+
}
|
|
28
|
+
return (0, cli_result_js_1.success)({
|
|
29
|
+
message: 'User workflow directory initialized',
|
|
30
|
+
details: [
|
|
31
|
+
`Directory: ${userDir}`,
|
|
32
|
+
entries.length === 0
|
|
33
|
+
? 'Created sample workflow: my-custom-workflow.json'
|
|
34
|
+
: `Found ${entries.length} existing file(s)`,
|
|
35
|
+
],
|
|
36
|
+
suggestions: [
|
|
37
|
+
'Edit the sample workflow in the directory above',
|
|
38
|
+
'Create new workflow JSON files following the schema',
|
|
39
|
+
'Run "workrail list" to see your workflows',
|
|
40
|
+
'Use "workrail validate <file>" to check your workflow syntax',
|
|
41
|
+
],
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
return (0, cli_result_js_1.failure)(`Failed to initialize user workflow directory: ${error instanceof Error ? error.message : String(error)}`, {
|
|
46
|
+
suggestions: ['Check that you have write permissions to your home directory'],
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CliResult } from '../types/cli-result.js';
|
|
2
|
+
import type { WorkflowSummary } from '../../types/workflow.js';
|
|
3
|
+
export interface ListCommandDeps {
|
|
4
|
+
readonly listWorkflowSummaries: () => Promise<readonly WorkflowSummary[]>;
|
|
5
|
+
}
|
|
6
|
+
export interface ListCommandOptions {
|
|
7
|
+
readonly verbose?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function executeListCommand(deps: ListCommandDeps, options?: ListCommandOptions): Promise<CliResult>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeListCommand = executeListCommand;
|
|
4
|
+
const cli_result_js_1 = require("../types/cli-result.js");
|
|
5
|
+
async function executeListCommand(deps, options = {}) {
|
|
6
|
+
try {
|
|
7
|
+
const workflows = await deps.listWorkflowSummaries();
|
|
8
|
+
if (workflows.length === 0) {
|
|
9
|
+
return (0, cli_result_js_1.success)({
|
|
10
|
+
message: 'No workflows found',
|
|
11
|
+
suggestions: ['Run "workrail init" to create your first workflow'],
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
const details = workflows.flatMap((workflow, index) => {
|
|
15
|
+
const lines = [
|
|
16
|
+
`${index + 1}. ${workflow.name}`,
|
|
17
|
+
` ID: ${workflow.id}`,
|
|
18
|
+
` ${workflow.description}`,
|
|
19
|
+
];
|
|
20
|
+
if (options.verbose) {
|
|
21
|
+
lines.push(` Version: ${workflow.version}`);
|
|
22
|
+
}
|
|
23
|
+
return lines;
|
|
24
|
+
});
|
|
25
|
+
details.push(``, `Total: ${workflows.length} workflows`);
|
|
26
|
+
return (0, cli_result_js_1.success)({
|
|
27
|
+
message: 'Available workflows',
|
|
28
|
+
details,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
return (0, cli_result_js_1.failure)(`Failed to list workflows: ${error instanceof Error ? error.message : String(error)}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { WorkflowDefinition } from '../../types/workflow-definition.js';
|
|
2
|
+
import type { CliResult } from '../types/cli-result.js';
|
|
3
|
+
export type MigrationResult = {
|
|
4
|
+
kind: 'migrated';
|
|
5
|
+
originalVersion: string;
|
|
6
|
+
targetVersion: string;
|
|
7
|
+
changes: readonly string[];
|
|
8
|
+
warnings: readonly string[];
|
|
9
|
+
workflow: WorkflowDefinition;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'already_current';
|
|
12
|
+
version: string;
|
|
13
|
+
workflow: WorkflowDefinition;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'cannot_downgrade';
|
|
16
|
+
originalVersion: string;
|
|
17
|
+
targetVersion: string;
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'invalid_workflow';
|
|
20
|
+
errors: readonly string[];
|
|
21
|
+
} | {
|
|
22
|
+
kind: 'migration_error';
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
25
|
+
export type FileMigrationResult = {
|
|
26
|
+
kind: 'file_migrated';
|
|
27
|
+
migration: Extract<MigrationResult, {
|
|
28
|
+
kind: 'migrated';
|
|
29
|
+
}>;
|
|
30
|
+
outputPath: string;
|
|
31
|
+
backupPath?: string;
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'file_already_current';
|
|
34
|
+
migration: Extract<MigrationResult, {
|
|
35
|
+
kind: 'already_current';
|
|
36
|
+
}>;
|
|
37
|
+
} | {
|
|
38
|
+
kind: 'dry_run';
|
|
39
|
+
migration: Extract<MigrationResult, {
|
|
40
|
+
kind: 'migrated' | 'already_current';
|
|
41
|
+
}>;
|
|
42
|
+
} | {
|
|
43
|
+
kind: 'file_read_error';
|
|
44
|
+
message: string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: 'file_parse_error';
|
|
47
|
+
message: string;
|
|
48
|
+
} | {
|
|
49
|
+
kind: 'file_write_error';
|
|
50
|
+
message: string;
|
|
51
|
+
} | {
|
|
52
|
+
kind: 'backup_error';
|
|
53
|
+
message: string;
|
|
54
|
+
} | {
|
|
55
|
+
kind: 'migration_failed';
|
|
56
|
+
migration: Exclude<MigrationResult, {
|
|
57
|
+
kind: 'migrated' | 'already_current';
|
|
58
|
+
}>;
|
|
59
|
+
};
|
|
60
|
+
export declare function detectWorkflowVersion(workflow: unknown): string;
|
|
61
|
+
export declare function migrateWorkflow(workflow: unknown): MigrationResult;
|
|
62
|
+
export interface MigrateFileDeps {
|
|
63
|
+
readonly readFile: (path: string) => Promise<string>;
|
|
64
|
+
readonly writeFile: (path: string, content: string) => Promise<void>;
|
|
65
|
+
readonly copyFile: (src: string, dest: string) => Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
export interface MigrateFileOptions {
|
|
68
|
+
readonly outputPath?: string;
|
|
69
|
+
readonly dryRun?: boolean;
|
|
70
|
+
readonly backup?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export declare function migrateWorkflowFile(inputPath: string, options: MigrateFileOptions, deps: MigrateFileDeps): Promise<FileMigrationResult>;
|
|
73
|
+
export interface MigrateCommandOptions {
|
|
74
|
+
readonly output?: string;
|
|
75
|
+
readonly dryRun?: boolean;
|
|
76
|
+
readonly backup?: boolean;
|
|
77
|
+
}
|
|
78
|
+
export declare function executeMigrateCommand(filePath: string, options: MigrateCommandOptions, deps: MigrateFileDeps): Promise<CliResult>;
|