@synergenius/flow-weaver 0.2.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/LICENSE +122 -0
- package/README.md +315 -0
- package/dist/annotation-generator.d.ts +45 -0
- package/dist/annotation-generator.js +557 -0
- package/dist/api/builder.d.ts +223 -0
- package/dist/api/builder.js +345 -0
- package/dist/api/compile.d.ts +92 -0
- package/dist/api/compile.js +149 -0
- package/dist/api/extract-types.d.ts +29 -0
- package/dist/api/extract-types.js +57 -0
- package/dist/api/generate-in-place.d.ts +73 -0
- package/dist/api/generate-in-place.js +1353 -0
- package/dist/api/generate.d.ts +83 -0
- package/dist/api/generate.js +510 -0
- package/dist/api/helpers.d.ts +248 -0
- package/dist/api/helpers.js +285 -0
- package/dist/api/index.d.ts +46 -0
- package/dist/api/index.js +45 -0
- package/dist/api/inline-runtime.d.ts +27 -0
- package/dist/api/inline-runtime.js +551 -0
- package/dist/api/manipulation/connections.d.ts +79 -0
- package/dist/api/manipulation/connections.js +151 -0
- package/dist/api/manipulation/index.d.ts +34 -0
- package/dist/api/manipulation/index.js +41 -0
- package/dist/api/manipulation/node-types.d.ts +123 -0
- package/dist/api/manipulation/node-types.js +200 -0
- package/dist/api/manipulation/nodes.d.ts +144 -0
- package/dist/api/manipulation/nodes.js +333 -0
- package/dist/api/manipulation/ports.d.ts +59 -0
- package/dist/api/manipulation/ports.js +228 -0
- package/dist/api/manipulation/scopes.d.ts +52 -0
- package/dist/api/manipulation/scopes.js +156 -0
- package/dist/api/manipulation/validation.d.ts +6 -0
- package/dist/api/manipulation/validation.js +6 -0
- package/dist/api/manipulation/workflow.d.ts +81 -0
- package/dist/api/manipulation/workflow.js +116 -0
- package/dist/api/manipulation.d.ts +8 -0
- package/dist/api/manipulation.js +8 -0
- package/dist/api/parse.d.ts +48 -0
- package/dist/api/parse.js +110 -0
- package/dist/api/patterns.d.ts +112 -0
- package/dist/api/patterns.js +306 -0
- package/dist/api/query.d.ts +429 -0
- package/dist/api/query.js +816 -0
- package/dist/api/templates.d.ts +98 -0
- package/dist/api/templates.js +117 -0
- package/dist/api/transform.d.ts +31 -0
- package/dist/api/transform.js +40 -0
- package/dist/api/validate.d.ts +25 -0
- package/dist/api/validate.js +39 -0
- package/dist/api/workflow-file-operations.d.ts +29 -0
- package/dist/api/workflow-file-operations.js +180 -0
- package/dist/ast/builder.d.ts +210 -0
- package/dist/ast/builder.js +395 -0
- package/dist/ast/index.d.ts +5 -0
- package/dist/ast/index.js +5 -0
- package/dist/ast/serialization-node.d.ts +6 -0
- package/dist/ast/serialization-node.js +30 -0
- package/dist/ast/serialization.d.ts +43 -0
- package/dist/ast/serialization.js +134 -0
- package/dist/ast/types.d.ts +852 -0
- package/dist/ast/types.js +2 -0
- package/dist/ast/workflow-utils.d.ts +54 -0
- package/dist/ast/workflow-utils.js +114 -0
- package/dist/body-generator.d.ts +31 -0
- package/dist/body-generator.js +35 -0
- package/dist/built-in-nodes/delay.d.ts +11 -0
- package/dist/built-in-nodes/delay.js +29 -0
- package/dist/built-in-nodes/index.d.ts +5 -0
- package/dist/built-in-nodes/index.js +4 -0
- package/dist/built-in-nodes/invoke-workflow.d.ts +13 -0
- package/dist/built-in-nodes/invoke-workflow.js +25 -0
- package/dist/built-in-nodes/mock-types.d.ts +18 -0
- package/dist/built-in-nodes/mock-types.js +12 -0
- package/dist/built-in-nodes/wait-for-event.d.ts +13 -0
- package/dist/built-in-nodes/wait-for-event.js +25 -0
- package/dist/chevrotain-parser/connect-parser.d.ts +24 -0
- package/dist/chevrotain-parser/connect-parser.js +98 -0
- package/dist/chevrotain-parser/grammar-diagrams.d.ts +29 -0
- package/dist/chevrotain-parser/grammar-diagrams.js +264 -0
- package/dist/chevrotain-parser/index.d.ts +25 -0
- package/dist/chevrotain-parser/index.js +27 -0
- package/dist/chevrotain-parser/map-parser.d.ts +33 -0
- package/dist/chevrotain-parser/map-parser.js +130 -0
- package/dist/chevrotain-parser/node-parser.d.ts +36 -0
- package/dist/chevrotain-parser/node-parser.js +466 -0
- package/dist/chevrotain-parser/path-parser.d.ts +28 -0
- package/dist/chevrotain-parser/path-parser.js +118 -0
- package/dist/chevrotain-parser/port-parser.d.ts +36 -0
- package/dist/chevrotain-parser/port-parser.js +442 -0
- package/dist/chevrotain-parser/position-parser.d.ts +20 -0
- package/dist/chevrotain-parser/position-parser.js +83 -0
- package/dist/chevrotain-parser/scope-parser.d.ts +19 -0
- package/dist/chevrotain-parser/scope-parser.js +104 -0
- package/dist/chevrotain-parser/tokens.d.ts +78 -0
- package/dist/chevrotain-parser/tokens.js +384 -0
- package/dist/chevrotain-parser/trigger-cancel-parser.d.ts +50 -0
- package/dist/chevrotain-parser/trigger-cancel-parser.js +282 -0
- package/dist/cli/commands/changelog.d.ts +13 -0
- package/dist/cli/commands/changelog.js +135 -0
- package/dist/cli/commands/compile.d.ts +64 -0
- package/dist/cli/commands/compile.js +278 -0
- package/dist/cli/commands/create.d.ts +33 -0
- package/dist/cli/commands/create.js +147 -0
- package/dist/cli/commands/describe.d.ts +68 -0
- package/dist/cli/commands/describe.js +377 -0
- package/dist/cli/commands/dev.d.ts +32 -0
- package/dist/cli/commands/dev.js +384 -0
- package/dist/cli/commands/diagram.d.ts +13 -0
- package/dist/cli/commands/diagram.js +33 -0
- package/dist/cli/commands/diff.d.ts +11 -0
- package/dist/cli/commands/diff.js +59 -0
- package/dist/cli/commands/doctor.d.ts +57 -0
- package/dist/cli/commands/doctor.js +719 -0
- package/dist/cli/commands/export.d.ts +57 -0
- package/dist/cli/commands/export.js +163 -0
- package/dist/cli/commands/grammar.d.ts +9 -0
- package/dist/cli/commands/grammar.js +39 -0
- package/dist/cli/commands/init.d.ts +59 -0
- package/dist/cli/commands/init.js +435 -0
- package/dist/cli/commands/listen.d.ts +16 -0
- package/dist/cli/commands/listen.js +39 -0
- package/dist/cli/commands/market.d.ts +52 -0
- package/dist/cli/commands/market.js +436 -0
- package/dist/cli/commands/migrate.d.ts +13 -0
- package/dist/cli/commands/migrate.js +89 -0
- package/dist/cli/commands/openapi.d.ts +37 -0
- package/dist/cli/commands/openapi.js +67 -0
- package/dist/cli/commands/pattern.d.ts +34 -0
- package/dist/cli/commands/pattern.js +185 -0
- package/dist/cli/commands/plugin.d.ts +16 -0
- package/dist/cli/commands/plugin.js +176 -0
- package/dist/cli/commands/run.d.ts +49 -0
- package/dist/cli/commands/run.js +191 -0
- package/dist/cli/commands/serve.d.ts +45 -0
- package/dist/cli/commands/serve.js +81 -0
- package/dist/cli/commands/templates.d.ts +8 -0
- package/dist/cli/commands/templates.js +54 -0
- package/dist/cli/commands/ui.d.ts +16 -0
- package/dist/cli/commands/ui.js +130 -0
- package/dist/cli/commands/validate.d.ts +12 -0
- package/dist/cli/commands/validate.js +247 -0
- package/dist/cli/commands/watch.d.ts +9 -0
- package/dist/cli/commands/watch.js +70 -0
- package/dist/cli/flow-weaver.mjs +92924 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.js +742 -0
- package/dist/cli/templates/ai/mock-provider.d.ts +7 -0
- package/dist/cli/templates/ai/mock-provider.js +64 -0
- package/dist/cli/templates/ai/types.d.ts +47 -0
- package/dist/cli/templates/ai/types.js +5 -0
- package/dist/cli/templates/approvals/index.d.ts +15 -0
- package/dist/cli/templates/approvals/index.js +241 -0
- package/dist/cli/templates/index.d.ts +102 -0
- package/dist/cli/templates/index.js +101 -0
- package/dist/cli/templates/nodes/agent-router.d.ts +3 -0
- package/dist/cli/templates/nodes/agent-router.js +114 -0
- package/dist/cli/templates/nodes/aggregator.d.ts +7 -0
- package/dist/cli/templates/nodes/aggregator.js +63 -0
- package/dist/cli/templates/nodes/conversation-memory.d.ts +3 -0
- package/dist/cli/templates/nodes/conversation-memory.js +85 -0
- package/dist/cli/templates/nodes/http.d.ts +7 -0
- package/dist/cli/templates/nodes/http.js +80 -0
- package/dist/cli/templates/nodes/human-approval.d.ts +3 -0
- package/dist/cli/templates/nodes/human-approval.js +110 -0
- package/dist/cli/templates/nodes/json-extractor.d.ts +3 -0
- package/dist/cli/templates/nodes/json-extractor.js +119 -0
- package/dist/cli/templates/nodes/llm-call.d.ts +3 -0
- package/dist/cli/templates/nodes/llm-call.js +106 -0
- package/dist/cli/templates/nodes/prompt-template.d.ts +3 -0
- package/dist/cli/templates/nodes/prompt-template.js +52 -0
- package/dist/cli/templates/nodes/rag-retriever.d.ts +3 -0
- package/dist/cli/templates/nodes/rag-retriever.js +128 -0
- package/dist/cli/templates/nodes/tool-executor.d.ts +3 -0
- package/dist/cli/templates/nodes/tool-executor.js +108 -0
- package/dist/cli/templates/nodes/transformer.d.ts +7 -0
- package/dist/cli/templates/nodes/transformer.js +68 -0
- package/dist/cli/templates/nodes/validator.d.ts +7 -0
- package/dist/cli/templates/nodes/validator.js +62 -0
- package/dist/cli/templates/providers/index.d.ts +14 -0
- package/dist/cli/templates/providers/index.js +239 -0
- package/dist/cli/templates/shared/approval-types.d.ts +9 -0
- package/dist/cli/templates/shared/approval-types.js +31 -0
- package/dist/cli/templates/shared/llm-types.d.ts +15 -0
- package/dist/cli/templates/shared/llm-types.js +104 -0
- package/dist/cli/templates/workflows/aggregator.d.ts +7 -0
- package/dist/cli/templates/workflows/aggregator.js +104 -0
- package/dist/cli/templates/workflows/ai-agent-durable.d.ts +8 -0
- package/dist/cli/templates/workflows/ai-agent-durable.js +338 -0
- package/dist/cli/templates/workflows/ai-agent.d.ts +31 -0
- package/dist/cli/templates/workflows/ai-agent.js +326 -0
- package/dist/cli/templates/workflows/ai-chat.d.ts +7 -0
- package/dist/cli/templates/workflows/ai-chat.js +169 -0
- package/dist/cli/templates/workflows/ai-pipeline-durable.d.ts +8 -0
- package/dist/cli/templates/workflows/ai-pipeline-durable.js +330 -0
- package/dist/cli/templates/workflows/ai-rag.d.ts +7 -0
- package/dist/cli/templates/workflows/ai-rag.js +186 -0
- package/dist/cli/templates/workflows/ai-react.d.ts +7 -0
- package/dist/cli/templates/workflows/ai-react.js +294 -0
- package/dist/cli/templates/workflows/conditional.d.ts +12 -0
- package/dist/cli/templates/workflows/conditional.js +142 -0
- package/dist/cli/templates/workflows/error-handler.d.ts +7 -0
- package/dist/cli/templates/workflows/error-handler.js +147 -0
- package/dist/cli/templates/workflows/foreach.d.ts +7 -0
- package/dist/cli/templates/workflows/foreach.js +143 -0
- package/dist/cli/templates/workflows/sequential.d.ts +7 -0
- package/dist/cli/templates/workflows/sequential.js +198 -0
- package/dist/cli/templates/workflows/webhook.d.ts +7 -0
- package/dist/cli/templates/workflows/webhook.js +161 -0
- package/dist/cli/utils/logger.d.ts +15 -0
- package/dist/cli/utils/logger.js +46 -0
- package/dist/constants.d.ts +100 -0
- package/dist/constants.js +125 -0
- package/dist/defaults.d.ts +3 -0
- package/dist/defaults.js +3 -0
- package/dist/deployment/config/defaults.d.ts +29 -0
- package/dist/deployment/config/defaults.js +98 -0
- package/dist/deployment/config/loader.d.ts +24 -0
- package/dist/deployment/config/loader.js +236 -0
- package/dist/deployment/config/types.d.ts +117 -0
- package/dist/deployment/config/types.js +5 -0
- package/dist/deployment/core/adapters.d.ts +90 -0
- package/dist/deployment/core/adapters.js +251 -0
- package/dist/deployment/core/executor.d.ts +62 -0
- package/dist/deployment/core/executor.js +197 -0
- package/dist/deployment/core/formatters.d.ts +57 -0
- package/dist/deployment/core/formatters.js +170 -0
- package/dist/deployment/index.d.ts +31 -0
- package/dist/deployment/index.js +48 -0
- package/dist/deployment/openapi/generator.d.ts +146 -0
- package/dist/deployment/openapi/generator.js +347 -0
- package/dist/deployment/openapi/schema-converter.d.ts +49 -0
- package/dist/deployment/openapi/schema-converter.js +192 -0
- package/dist/deployment/targets/base.d.ts +316 -0
- package/dist/deployment/targets/base.js +823 -0
- package/dist/deployment/targets/cloudflare.d.ts +23 -0
- package/dist/deployment/targets/cloudflare.js +1125 -0
- package/dist/deployment/targets/inngest.d.ts +38 -0
- package/dist/deployment/targets/inngest.js +926 -0
- package/dist/deployment/targets/lambda.d.ts +23 -0
- package/dist/deployment/targets/lambda.js +1289 -0
- package/dist/deployment/targets/vercel.d.ts +23 -0
- package/dist/deployment/targets/vercel.js +886 -0
- package/dist/deployment/types.d.ts +183 -0
- package/dist/deployment/types.js +8 -0
- package/dist/diagram/geometry.d.ts +26 -0
- package/dist/diagram/geometry.js +850 -0
- package/dist/diagram/index.d.ts +16 -0
- package/dist/diagram/index.js +42 -0
- package/dist/diagram/layout.d.ts +11 -0
- package/dist/diagram/layout.js +143 -0
- package/dist/diagram/orthogonal-router.d.ts +79 -0
- package/dist/diagram/orthogonal-router.js +568 -0
- package/dist/diagram/renderer.d.ts +3 -0
- package/dist/diagram/renderer.js +207 -0
- package/dist/diagram/theme.d.ts +20 -0
- package/dist/diagram/theme.js +189 -0
- package/dist/diagram/types.d.ts +70 -0
- package/dist/diagram/types.js +2 -0
- package/dist/diff/WorkflowDiffer.d.ts +13 -0
- package/dist/diff/WorkflowDiffer.js +429 -0
- package/dist/diff/formatDiff.d.ts +10 -0
- package/dist/diff/formatDiff.js +220 -0
- package/dist/diff/impact.d.ts +29 -0
- package/dist/diff/impact.js +119 -0
- package/dist/diff/index.d.ts +10 -0
- package/dist/diff/index.js +9 -0
- package/dist/diff/types.d.ts +138 -0
- package/dist/diff/types.js +35 -0
- package/dist/doc-metadata/extractors/annotations.d.ts +56 -0
- package/dist/doc-metadata/extractors/annotations.js +337 -0
- package/dist/doc-metadata/extractors/cli-commands.d.ts +17 -0
- package/dist/doc-metadata/extractors/cli-commands.js +355 -0
- package/dist/doc-metadata/extractors/mcp-tools.d.ts +16 -0
- package/dist/doc-metadata/extractors/mcp-tools.js +689 -0
- package/dist/doc-metadata/extractors/plugin-api.d.ts +19 -0
- package/dist/doc-metadata/extractors/plugin-api.js +279 -0
- package/dist/doc-metadata/index.d.ts +5 -0
- package/dist/doc-metadata/index.js +4 -0
- package/dist/doc-metadata/types.d.ts +120 -0
- package/dist/doc-metadata/types.js +5 -0
- package/dist/editor-completions/annotationValues.d.ts +12 -0
- package/dist/editor-completions/annotationValues.js +138 -0
- package/dist/editor-completions/contextParser.d.ts +40 -0
- package/dist/editor-completions/contextParser.js +410 -0
- package/dist/editor-completions/dataTypes.d.ts +16 -0
- package/dist/editor-completions/dataTypes.js +95 -0
- package/dist/editor-completions/goToDefinition.d.ts +27 -0
- package/dist/editor-completions/goToDefinition.js +112 -0
- package/dist/editor-completions/index.d.ts +39 -0
- package/dist/editor-completions/index.js +181 -0
- package/dist/editor-completions/jsDocAnnotations.d.ts +29 -0
- package/dist/editor-completions/jsDocAnnotations.js +357 -0
- package/dist/editor-completions/modifierCompletions.d.ts +17 -0
- package/dist/editor-completions/modifierCompletions.js +197 -0
- package/dist/editor-completions/types.d.ts +119 -0
- package/dist/editor-completions/types.js +8 -0
- package/dist/export/index.d.ts +68 -0
- package/dist/export/index.js +1074 -0
- package/dist/export/templates.d.ts +24 -0
- package/dist/export/templates.js +186 -0
- package/dist/friendly-errors.d.ts +35 -0
- package/dist/friendly-errors.js +375 -0
- package/dist/function-like.d.ts +38 -0
- package/dist/function-like.js +83 -0
- package/dist/generated-branding.d.ts +16 -0
- package/dist/generated-branding.js +22 -0
- package/dist/generator/async-detection.d.ts +27 -0
- package/dist/generator/async-detection.js +56 -0
- package/dist/generator/code-utils.d.ts +76 -0
- package/dist/generator/code-utils.js +410 -0
- package/dist/generator/control-flow.d.ts +54 -0
- package/dist/generator/control-flow.js +284 -0
- package/dist/generator/inngest.d.ts +53 -0
- package/dist/generator/inngest.js +1126 -0
- package/dist/generator/scope-function-generator.d.ts +78 -0
- package/dist/generator/scope-function-generator.js +360 -0
- package/dist/generator/unified.d.ts +42 -0
- package/dist/generator/unified.js +1504 -0
- package/dist/generator.d.ts +54 -0
- package/dist/generator.js +100 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +89 -0
- package/dist/jsdoc-parser.d.ts +308 -0
- package/dist/jsdoc-parser.js +923 -0
- package/dist/jsdoc-port-sync/constants.d.ts +41 -0
- package/dist/jsdoc-port-sync/constants.js +103 -0
- package/dist/jsdoc-port-sync/diff.d.ts +76 -0
- package/dist/jsdoc-port-sync/diff.js +319 -0
- package/dist/jsdoc-port-sync/index.d.ts +42 -0
- package/dist/jsdoc-port-sync/index.js +45 -0
- package/dist/jsdoc-port-sync/port-parser.d.ts +68 -0
- package/dist/jsdoc-port-sync/port-parser.js +579 -0
- package/dist/jsdoc-port-sync/rename.d.ts +21 -0
- package/dist/jsdoc-port-sync/rename.js +256 -0
- package/dist/jsdoc-port-sync/signature-parser.d.ts +104 -0
- package/dist/jsdoc-port-sync/signature-parser.js +559 -0
- package/dist/jsdoc-port-sync/sync.d.ts +36 -0
- package/dist/jsdoc-port-sync/sync.js +644 -0
- package/dist/jsdoc-port-sync.d.ts +10 -0
- package/dist/jsdoc-port-sync.js +10 -0
- package/dist/marketplace/index.d.ts +11 -0
- package/dist/marketplace/index.js +10 -0
- package/dist/marketplace/manifest.d.ts +32 -0
- package/dist/marketplace/manifest.js +176 -0
- package/dist/marketplace/registry.d.ts +30 -0
- package/dist/marketplace/registry.js +100 -0
- package/dist/marketplace/types.d.ts +154 -0
- package/dist/marketplace/types.js +9 -0
- package/dist/marketplace/validator.d.ts +13 -0
- package/dist/marketplace/validator.js +131 -0
- package/dist/mcp/auto-registration.d.ts +3 -0
- package/dist/mcp/auto-registration.js +62 -0
- package/dist/mcp/editor-connection.d.ts +50 -0
- package/dist/mcp/editor-connection.js +125 -0
- package/dist/mcp/event-buffer.d.ts +62 -0
- package/dist/mcp/event-buffer.js +150 -0
- package/dist/mcp/index.d.ts +12 -0
- package/dist/mcp/index.js +11 -0
- package/dist/mcp/resources.d.ts +14 -0
- package/dist/mcp/resources.js +55 -0
- package/dist/mcp/response-utils.d.ts +63 -0
- package/dist/mcp/response-utils.js +89 -0
- package/dist/mcp/server.d.ts +4 -0
- package/dist/mcp/server.js +99 -0
- package/dist/mcp/tools-diagram.d.ts +8 -0
- package/dist/mcp/tools-diagram.js +53 -0
- package/dist/mcp/tools-editor.d.ts +5 -0
- package/dist/mcp/tools-editor.js +190 -0
- package/dist/mcp/tools-export.d.ts +9 -0
- package/dist/mcp/tools-export.js +180 -0
- package/dist/mcp/tools-marketplace.d.ts +9 -0
- package/dist/mcp/tools-marketplace.js +132 -0
- package/dist/mcp/tools-pattern.d.ts +3 -0
- package/dist/mcp/tools-pattern.js +783 -0
- package/dist/mcp/tools-query.d.ts +3 -0
- package/dist/mcp/tools-query.js +364 -0
- package/dist/mcp/tools-template.d.ts +10 -0
- package/dist/mcp/tools-template.js +119 -0
- package/dist/mcp/types.d.ts +70 -0
- package/dist/mcp/types.js +8 -0
- package/dist/mcp/workflow-executor.d.ts +47 -0
- package/dist/mcp/workflow-executor.js +133 -0
- package/dist/migration/registry.d.ts +30 -0
- package/dist/migration/registry.js +29 -0
- package/dist/node-types-generator.d.ts +49 -0
- package/dist/node-types-generator.js +139 -0
- package/dist/npm-packages.d.ts +56 -0
- package/dist/npm-packages.js +255 -0
- package/dist/parser.d.ts +204 -0
- package/dist/parser.js +2100 -0
- package/dist/plugin/PluginPanel.d.ts +12 -0
- package/dist/plugin/PluginPanel.js +5 -0
- package/dist/plugin/index.d.ts +13 -0
- package/dist/plugin/index.js +14 -0
- package/dist/plugin/types.d.ts +75 -0
- package/dist/plugin/types.js +8 -0
- package/dist/resolve-package-types.d.ts +17 -0
- package/dist/resolve-package-types.js +123 -0
- package/dist/runtime/CancellationError.d.ts +11 -0
- package/dist/runtime/CancellationError.js +20 -0
- package/dist/runtime/ExecutionContext.d.ts +146 -0
- package/dist/runtime/ExecutionContext.js +235 -0
- package/dist/runtime/builtin-functions.d.ts +8 -0
- package/dist/runtime/builtin-functions.js +549 -0
- package/dist/runtime/events.d.ts +50 -0
- package/dist/runtime/events.js +2 -0
- package/dist/runtime/function-registry.d.ts +59 -0
- package/dist/runtime/function-registry.js +66 -0
- package/dist/runtime/index.d.ts +7 -0
- package/dist/runtime/index.js +7 -0
- package/dist/runtime/parameter-resolver.d.ts +62 -0
- package/dist/runtime/parameter-resolver.js +113 -0
- package/dist/server/index.d.ts +7 -0
- package/dist/server/index.js +6 -0
- package/dist/server/types.d.ts +93 -0
- package/dist/server/types.js +5 -0
- package/dist/server/webhook-server.d.ts +50 -0
- package/dist/server/webhook-server.js +269 -0
- package/dist/server/workflow-registry.d.ts +61 -0
- package/dist/server/workflow-registry.js +202 -0
- package/dist/shared-project.d.ts +9 -0
- package/dist/shared-project.js +28 -0
- package/dist/sugar-optimizer.d.ts +40 -0
- package/dist/sugar-optimizer.js +387 -0
- package/dist/testing/assertions.d.ts +51 -0
- package/dist/testing/assertions.js +127 -0
- package/dist/testing/index.d.ts +30 -0
- package/dist/testing/index.js +24 -0
- package/dist/testing/mock-approval.d.ts +81 -0
- package/dist/testing/mock-approval.js +98 -0
- package/dist/testing/mock-llm.d.ts +124 -0
- package/dist/testing/mock-llm.js +119 -0
- package/dist/testing/recorder.d.ts +72 -0
- package/dist/testing/recorder.js +70 -0
- package/dist/testing/replayer.d.ts +56 -0
- package/dist/testing/replayer.js +143 -0
- package/dist/testing/token-tracker.d.ts +71 -0
- package/dist/testing/token-tracker.js +94 -0
- package/dist/type-checker.d.ts +42 -0
- package/dist/type-checker.js +190 -0
- package/dist/type-mappings.d.ts +29 -0
- package/dist/type-mappings.js +125 -0
- package/dist/types/branded-ports.d.ts +151 -0
- package/dist/types/branded-ports.js +121 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +5 -0
- package/dist/types.d.ts +139 -0
- package/dist/types.js +15 -0
- package/dist/utils/error-utils.d.ts +15 -0
- package/dist/utils/error-utils.js +27 -0
- package/dist/utils/lru-cache.d.ts +15 -0
- package/dist/utils/lru-cache.js +40 -0
- package/dist/utils/port-ordering.d.ts +26 -0
- package/dist/utils/port-ordering.js +88 -0
- package/dist/utils/port-tag-utils.d.ts +23 -0
- package/dist/utils/port-tag-utils.js +41 -0
- package/dist/utils/string-distance.d.ts +14 -0
- package/dist/utils/string-distance.js +56 -0
- package/dist/validation/agent-detection.d.ts +33 -0
- package/dist/validation/agent-detection.js +115 -0
- package/dist/validation/agent-rules.d.ts +48 -0
- package/dist/validation/agent-rules.js +262 -0
- package/dist/validator.d.ts +92 -0
- package/dist/validator.js +970 -0
- package/package.json +109 -0
|
@@ -0,0 +1,742 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow Weaver Annotations CLI
|
|
3
|
+
* Command-line interface for compiling and validating workflow files
|
|
4
|
+
*
|
|
5
|
+
* Note: Shebang is added by build script (scripts/build-cli.ts) to the CJS bundle.
|
|
6
|
+
* Do not add #!/usr/bin/env node here - it will cause duplicate shebangs.
|
|
7
|
+
*/
|
|
8
|
+
import { Command } from 'commander';
|
|
9
|
+
import { compileCommand } from './commands/compile.js';
|
|
10
|
+
import { createWorkflowCommand, createNodeCommand } from './commands/create.js';
|
|
11
|
+
import { describeCommand } from './commands/describe.js';
|
|
12
|
+
import { diagramCommand } from './commands/diagram.js';
|
|
13
|
+
import { diffCommand } from './commands/diff.js';
|
|
14
|
+
import { patternListCommand, patternApplyCommand, patternExtractCommand, } from './commands/pattern.js';
|
|
15
|
+
import { templatesCommand } from './commands/templates.js';
|
|
16
|
+
import { validateCommand } from './commands/validate.js';
|
|
17
|
+
import { doctorCommand } from './commands/doctor.js';
|
|
18
|
+
import { initCommand } from './commands/init.js';
|
|
19
|
+
import { watchCommand } from './commands/watch.js';
|
|
20
|
+
import { devCommand } from './commands/dev.js';
|
|
21
|
+
import { listenCommand } from './commands/listen.js';
|
|
22
|
+
import { mcpServerCommand } from '../mcp/server.js';
|
|
23
|
+
import { uiFocusNode, uiAddNode, uiOpenWorkflow, uiGetState, uiBatch } from './commands/ui.js';
|
|
24
|
+
import { grammarCommand } from './commands/grammar.js';
|
|
25
|
+
import { runCommand } from './commands/run.js';
|
|
26
|
+
import { serveCommand } from './commands/serve.js';
|
|
27
|
+
import { exportCommand } from './commands/export.js';
|
|
28
|
+
import { openapiCommand } from './commands/openapi.js';
|
|
29
|
+
import { pluginInitCommand } from './commands/plugin.js';
|
|
30
|
+
import { migrateCommand } from './commands/migrate.js';
|
|
31
|
+
import { changelogCommand } from './commands/changelog.js';
|
|
32
|
+
import { marketInitCommand, marketPackCommand, marketPublishCommand, marketInstallCommand, marketSearchCommand, marketListCommand, } from './commands/market.js';
|
|
33
|
+
import { logger } from './utils/logger.js';
|
|
34
|
+
import { getErrorMessage } from '../utils/error-utils.js';
|
|
35
|
+
import { DEFAULT_SERVER_URL } from '../defaults.js';
|
|
36
|
+
const version = typeof __CLI_VERSION__ !== 'undefined' ? __CLI_VERSION__ : '0.0.0-dev';
|
|
37
|
+
const program = new Command();
|
|
38
|
+
program
|
|
39
|
+
.name('flow-weaver')
|
|
40
|
+
.description('Flow Weaver Annotations - Compile and validate workflow files')
|
|
41
|
+
.version(version, '-v, --version', 'Output the current version');
|
|
42
|
+
program.configureOutput({
|
|
43
|
+
writeErr: (str) => {
|
|
44
|
+
const trimmed = str.replace(/^error:\s*/i, '').trimEnd();
|
|
45
|
+
if (trimmed) {
|
|
46
|
+
logger.error(trimmed);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
writeOut: (str) => process.stdout.write(str),
|
|
50
|
+
});
|
|
51
|
+
// Compile command
|
|
52
|
+
program
|
|
53
|
+
.command('compile <input>')
|
|
54
|
+
.description('Compile workflow files to TypeScript')
|
|
55
|
+
.option('-o, --output <path>', 'Output file or directory')
|
|
56
|
+
.option('-p, --production', 'Generate production code (no debug events)', false)
|
|
57
|
+
.option('-s, --source-map', 'Generate source maps', false)
|
|
58
|
+
.option('--verbose', 'Verbose output', false)
|
|
59
|
+
.option('--dry-run', 'Preview compilation without writing files', false)
|
|
60
|
+
.option('-w, --workflow-name <name>', 'Specific workflow name to compile')
|
|
61
|
+
.option('-f, --format <format>', 'Module format: esm, cjs, or auto (default: auto)', 'auto')
|
|
62
|
+
.option('--strict', 'Treat type coercion warnings as errors', false)
|
|
63
|
+
.option('--inline-runtime', 'Force inline runtime even when @synergenius/flow-weaver package is installed', false)
|
|
64
|
+
.option('--clean', 'Omit redundant @param/@returns annotations from compiled output', false)
|
|
65
|
+
.option('--target <target>', 'Compilation target: typescript (default) or inngest (per-node step.run)')
|
|
66
|
+
.option('--cron <schedule>', 'Set cron trigger schedule (Inngest target only)')
|
|
67
|
+
.option('--serve', 'Generate serve() handler for HTTP event reception')
|
|
68
|
+
.option('--framework <name>', 'Framework adapter for serve handler (next, express, hono, fastify, remix)')
|
|
69
|
+
.option('--typed-events', 'Generate Zod event schemas from workflow @param annotations')
|
|
70
|
+
.option('--retries <n>', 'Number of retries per function (Inngest target only)', parseInt)
|
|
71
|
+
.option('--timeout <duration>', 'Function timeout (e.g. "30m", "1h")')
|
|
72
|
+
.action(async (input, options) => {
|
|
73
|
+
try {
|
|
74
|
+
await compileCommand(input, options);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
// Describe command
|
|
82
|
+
program
|
|
83
|
+
.command('describe <input>')
|
|
84
|
+
.description('Output workflow structure in LLM-friendly formats (JSON, text, mermaid)')
|
|
85
|
+
.option('-f, --format <format>', 'Output format: json (default), text, mermaid', 'json')
|
|
86
|
+
.option('-n, --node <id>', 'Focus on a specific node')
|
|
87
|
+
.option('--compile', 'Also update runtime markers in the source file')
|
|
88
|
+
.option('-w, --workflow-name <name>', 'Specific workflow name to describe')
|
|
89
|
+
.action(async (input, options) => {
|
|
90
|
+
try {
|
|
91
|
+
await describeCommand(input, options);
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
// Diagram command
|
|
99
|
+
program
|
|
100
|
+
.command('diagram <input>')
|
|
101
|
+
.description('Generate SVG diagram of a workflow')
|
|
102
|
+
.option('-t, --theme <theme>', 'Color theme: dark (default), light', 'dark')
|
|
103
|
+
.option('-w, --width <pixels>', 'SVG width in pixels')
|
|
104
|
+
.option('-p, --padding <pixels>', 'Canvas padding in pixels')
|
|
105
|
+
.option('--no-port-labels', 'Hide data type labels on ports')
|
|
106
|
+
.option('--workflow-name <name>', 'Specific workflow to render')
|
|
107
|
+
.option('-o, --output <file>', 'Write SVG to file instead of stdout')
|
|
108
|
+
.action(async (input, options) => {
|
|
109
|
+
try {
|
|
110
|
+
if (options.width)
|
|
111
|
+
options.width = Number(options.width);
|
|
112
|
+
if (options.padding)
|
|
113
|
+
options.padding = Number(options.padding);
|
|
114
|
+
options.showPortLabels = options.portLabels;
|
|
115
|
+
await diagramCommand(input, options);
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
// Diff command
|
|
123
|
+
program
|
|
124
|
+
.command('diff <file1> <file2>')
|
|
125
|
+
.description('Compare two workflow files semantically')
|
|
126
|
+
.option('-f, --format <format>', 'Output format: text (default), json, compact', 'text')
|
|
127
|
+
.option('-w, --workflow-name <name>', 'Specific workflow name to compare')
|
|
128
|
+
.option('--exit-zero', 'Exit 0 even when differences are found', false)
|
|
129
|
+
.action(async (file1, file2, options) => {
|
|
130
|
+
try {
|
|
131
|
+
await diffCommand(file1, file2, options);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
// Validate command
|
|
139
|
+
program
|
|
140
|
+
.command('validate <input>')
|
|
141
|
+
.description('Validate workflow files without compiling')
|
|
142
|
+
.option('--verbose', 'Verbose output', false)
|
|
143
|
+
.option('-q, --quiet', 'Suppress warnings', false)
|
|
144
|
+
.option('--json', 'Output results as JSON', false)
|
|
145
|
+
.option('-w, --workflow-name <name>', 'Specific workflow name to validate')
|
|
146
|
+
.option('--strict', 'Treat type coercion warnings as errors', false)
|
|
147
|
+
.action(async (input, options) => {
|
|
148
|
+
try {
|
|
149
|
+
await validateCommand(input, options);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
153
|
+
process.exit(1);
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
// Doctor command
|
|
157
|
+
program
|
|
158
|
+
.command('doctor')
|
|
159
|
+
.description('Check project environment and configuration for flow-weaver compatibility')
|
|
160
|
+
.option('--json', 'Output results as JSON', false)
|
|
161
|
+
.action(async (options) => {
|
|
162
|
+
try {
|
|
163
|
+
await doctorCommand(options);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
167
|
+
process.exit(1);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
// Init command
|
|
171
|
+
program
|
|
172
|
+
.command('init [directory]')
|
|
173
|
+
.description('Create a new flow-weaver project')
|
|
174
|
+
.option('-n, --name <name>', 'Project name (defaults to directory name)')
|
|
175
|
+
.option('-t, --template <template>', 'Workflow template (default: simple)')
|
|
176
|
+
.option('-f, --format <format>', 'Module format: esm or cjs (default: esm)')
|
|
177
|
+
.option('-y, --yes', 'Skip prompts and use defaults', false)
|
|
178
|
+
.option('--install', 'Run npm install after scaffolding')
|
|
179
|
+
.option('--no-install', 'Skip npm install')
|
|
180
|
+
.option('--git', 'Initialize a git repository')
|
|
181
|
+
.option('--no-git', 'Skip git init')
|
|
182
|
+
.option('--force', 'Overwrite existing files', false)
|
|
183
|
+
.option('--json', 'Output results as JSON', false)
|
|
184
|
+
.action(async (directory, options) => {
|
|
185
|
+
try {
|
|
186
|
+
await initCommand(directory, options);
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
190
|
+
process.exit(1);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
// Watch command
|
|
194
|
+
program
|
|
195
|
+
.command('watch <input>')
|
|
196
|
+
.description('Watch workflow files and recompile on changes')
|
|
197
|
+
.option('-o, --output <path>', 'Output file or directory')
|
|
198
|
+
.option('-p, --production', 'Generate production code (no debug events)', false)
|
|
199
|
+
.option('-s, --source-map', 'Generate source maps', false)
|
|
200
|
+
.option('--verbose', 'Verbose output', false)
|
|
201
|
+
.option('-w, --workflow-name <name>', 'Specific workflow name to compile')
|
|
202
|
+
.option('-f, --format <format>', 'Module format: esm, cjs, or auto (default: auto)', 'auto')
|
|
203
|
+
.action(async (input, options) => {
|
|
204
|
+
try {
|
|
205
|
+
await watchCommand(input, options);
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
209
|
+
process.exit(1);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
// Dev command (watch + compile + run)
|
|
213
|
+
program
|
|
214
|
+
.command('dev <input>')
|
|
215
|
+
.description('Watch, compile, and run workflow on changes')
|
|
216
|
+
.option('--params <json>', 'Input parameters as JSON string')
|
|
217
|
+
.option('--params-file <path>', 'Path to JSON file with input parameters')
|
|
218
|
+
.option('-w, --workflow <name>', 'Specific workflow name to run')
|
|
219
|
+
.option('-p, --production', 'Run in production mode (no trace events)', false)
|
|
220
|
+
.option('-f, --format <format>', 'Module format: esm, cjs, or auto (default: auto)', 'auto')
|
|
221
|
+
.option('--clean', 'Omit redundant @param/@returns annotations', false)
|
|
222
|
+
.option('--once', 'Run once then exit', false)
|
|
223
|
+
.option('--json', 'Output result as JSON', false)
|
|
224
|
+
.option('--target <target>', 'Compilation target: typescript or inngest (default: typescript)')
|
|
225
|
+
.option('--framework <framework>', 'Framework for serve handler (inngest target only)', 'express')
|
|
226
|
+
.option('--port <port>', 'Port for dev server (inngest target only)', (v) => parseInt(v, 10), 3000)
|
|
227
|
+
.action(async (input, options) => {
|
|
228
|
+
try {
|
|
229
|
+
await devCommand(input, options);
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
233
|
+
process.exit(1);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
// Listen command
|
|
237
|
+
program
|
|
238
|
+
.command('listen')
|
|
239
|
+
.description('Connect to the editor and stream integration events as JSON lines')
|
|
240
|
+
.option('-s, --server <url>', 'Editor URL', DEFAULT_SERVER_URL)
|
|
241
|
+
.action(async (options) => {
|
|
242
|
+
try {
|
|
243
|
+
await listenCommand(options);
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
247
|
+
process.exit(1);
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
// MCP server command
|
|
251
|
+
program
|
|
252
|
+
.command('mcp-server')
|
|
253
|
+
.description('Start MCP server for Claude Code integration')
|
|
254
|
+
.option('-s, --server <url>', 'Editor URL', DEFAULT_SERVER_URL)
|
|
255
|
+
.option('--stdio', 'Run in MCP stdio mode (skip interactive registration)')
|
|
256
|
+
.action(async (options) => {
|
|
257
|
+
try {
|
|
258
|
+
await mcpServerCommand(options);
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
262
|
+
process.exit(1);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
// UI command group (send commands to editor)
|
|
266
|
+
const uiCmd = program.command('ui').description('Send commands to the editor');
|
|
267
|
+
uiCmd
|
|
268
|
+
.command('focus-node <nodeId>')
|
|
269
|
+
.description('Select and center a node in the editor')
|
|
270
|
+
.option('-s, --server <url>', 'Editor URL', DEFAULT_SERVER_URL)
|
|
271
|
+
.action(async (nodeId, options) => {
|
|
272
|
+
try {
|
|
273
|
+
await uiFocusNode(nodeId, options);
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
277
|
+
process.exit(1);
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
uiCmd
|
|
281
|
+
.command('add-node <nodeTypeName>')
|
|
282
|
+
.description('Add a node at viewport center')
|
|
283
|
+
.option('-s, --server <url>', 'Editor URL', DEFAULT_SERVER_URL)
|
|
284
|
+
.action(async (nodeTypeName, options) => {
|
|
285
|
+
try {
|
|
286
|
+
await uiAddNode(nodeTypeName, options);
|
|
287
|
+
}
|
|
288
|
+
catch (error) {
|
|
289
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
290
|
+
process.exit(1);
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
uiCmd
|
|
294
|
+
.command('open-workflow <filePath>')
|
|
295
|
+
.description('Open a workflow file in the editor')
|
|
296
|
+
.option('-s, --server <url>', 'Editor URL', DEFAULT_SERVER_URL)
|
|
297
|
+
.action(async (filePath, options) => {
|
|
298
|
+
try {
|
|
299
|
+
await uiOpenWorkflow(filePath, options);
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
303
|
+
process.exit(1);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
uiCmd
|
|
307
|
+
.command('get-state')
|
|
308
|
+
.description('Return current workflow state from the editor')
|
|
309
|
+
.option('-s, --server <url>', 'Editor URL', DEFAULT_SERVER_URL)
|
|
310
|
+
.action(async (options) => {
|
|
311
|
+
try {
|
|
312
|
+
await uiGetState(options);
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
316
|
+
process.exit(1);
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
uiCmd
|
|
320
|
+
.command('batch <json>')
|
|
321
|
+
.description('Execute a batch of commands with auto-snapshot rollback')
|
|
322
|
+
.option('-s, --server <url>', 'Editor URL', DEFAULT_SERVER_URL)
|
|
323
|
+
.action(async (json, options) => {
|
|
324
|
+
try {
|
|
325
|
+
await uiBatch(json, options);
|
|
326
|
+
}
|
|
327
|
+
catch (error) {
|
|
328
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
329
|
+
process.exit(1);
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
// Create command (with subcommands)
|
|
333
|
+
const createCmd = program.command('create').description('Create workflows or nodes from templates');
|
|
334
|
+
createCmd
|
|
335
|
+
.command('workflow <template> <file>')
|
|
336
|
+
.description('Create a workflow from a template')
|
|
337
|
+
.option('-l, --line <number>', 'Insert at specific line number', parseInt)
|
|
338
|
+
.option('-a, --async', 'Generate an async workflow', false)
|
|
339
|
+
.option('-p, --preview', 'Preview generated code without writing', false)
|
|
340
|
+
.option('--provider <provider>', 'LLM provider (openai, anthropic, ollama, mock)')
|
|
341
|
+
.option('--model <model>', 'Model identifier (e.g., gpt-4o, claude-3-5-sonnet-20241022)')
|
|
342
|
+
.option('--config <json>', 'Configuration as JSON string')
|
|
343
|
+
.option('--name <name>', 'Override the derived workflow function name')
|
|
344
|
+
.option('--nodes <names>', 'Comma-separated node function names (e.g., "fetch,parse,store")')
|
|
345
|
+
.option('--input <name>', 'Custom input port name (default: "data")')
|
|
346
|
+
.option('--output <name>', 'Custom output port name (default: "result")')
|
|
347
|
+
.action(async (template, file, options) => {
|
|
348
|
+
try {
|
|
349
|
+
await createWorkflowCommand(template, file, options);
|
|
350
|
+
}
|
|
351
|
+
catch (error) {
|
|
352
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
353
|
+
process.exit(1);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
createCmd
|
|
357
|
+
.command('node <name> <file>')
|
|
358
|
+
.description('Create a node type (uses processor template by default)')
|
|
359
|
+
.option('-l, --line <number>', 'Insert at specific line number', parseInt)
|
|
360
|
+
.option('-t, --template <template>', 'Node template to use', 'processor')
|
|
361
|
+
.option('-p, --preview', 'Preview generated code without writing', false)
|
|
362
|
+
.option('--strategy <strategy>', 'Template strategy (e.g. mock, callback, webhook)')
|
|
363
|
+
.option('--config <json>', 'Additional configuration (JSON)')
|
|
364
|
+
.action(async (name, file, options) => {
|
|
365
|
+
try {
|
|
366
|
+
await createNodeCommand(name, file, options);
|
|
367
|
+
}
|
|
368
|
+
catch (error) {
|
|
369
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
370
|
+
process.exit(1);
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
// Templates command
|
|
374
|
+
program
|
|
375
|
+
.command('templates')
|
|
376
|
+
.description('List available templates')
|
|
377
|
+
.option('--json', 'Output as JSON', false)
|
|
378
|
+
.action(async (options) => {
|
|
379
|
+
try {
|
|
380
|
+
await templatesCommand(options);
|
|
381
|
+
}
|
|
382
|
+
catch (error) {
|
|
383
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
384
|
+
process.exit(1);
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
// Grammar command
|
|
388
|
+
program
|
|
389
|
+
.command('grammar')
|
|
390
|
+
.description('Output JSDoc annotation grammar (@input, @output, @connect, @node, @scope) as HTML railroad diagrams or EBNF text')
|
|
391
|
+
.option('-f, --format <format>', 'Output format: html (default), ebnf', 'html')
|
|
392
|
+
.option('-o, --output <path>', 'Write output to file instead of stdout')
|
|
393
|
+
.action(async (options) => {
|
|
394
|
+
try {
|
|
395
|
+
await grammarCommand(options);
|
|
396
|
+
}
|
|
397
|
+
catch (error) {
|
|
398
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
399
|
+
process.exit(1);
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
// Pattern command (with subcommands)
|
|
403
|
+
const patternCmd = program.command('pattern').description('Work with reusable workflow patterns');
|
|
404
|
+
patternCmd
|
|
405
|
+
.command('list <path>')
|
|
406
|
+
.description('List patterns in a file or directory')
|
|
407
|
+
.option('--json', 'Output as JSON', false)
|
|
408
|
+
.action(async (inputPath, options) => {
|
|
409
|
+
try {
|
|
410
|
+
await patternListCommand(inputPath, options);
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
414
|
+
process.exit(1);
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
patternCmd
|
|
418
|
+
.command('apply <pattern-file> <target-file>')
|
|
419
|
+
.description('Apply a pattern to a workflow file')
|
|
420
|
+
.option('-p, --preview', 'Preview changes without writing', false)
|
|
421
|
+
.option('--prefix <prefix>', 'Prefix for node instance IDs')
|
|
422
|
+
.option('-n, --name <name>', 'Specific pattern name to apply')
|
|
423
|
+
.action(async (patternFile, targetFile, options) => {
|
|
424
|
+
try {
|
|
425
|
+
await patternApplyCommand(patternFile, targetFile, options);
|
|
426
|
+
}
|
|
427
|
+
catch (error) {
|
|
428
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
429
|
+
process.exit(1);
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
patternCmd
|
|
433
|
+
.command('extract <source-file>')
|
|
434
|
+
.description('Extract a pattern from workflow nodes')
|
|
435
|
+
.requiredOption('--nodes <nodes>', 'Comma-separated list of node IDs to extract')
|
|
436
|
+
.requiredOption('-o, --output <file>', 'Output pattern file')
|
|
437
|
+
.option('-n, --name <name>', 'Pattern name')
|
|
438
|
+
.option('-p, --preview', 'Preview pattern without writing', false)
|
|
439
|
+
.action(async (sourceFile, options) => {
|
|
440
|
+
try {
|
|
441
|
+
await patternExtractCommand(sourceFile, options);
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
445
|
+
process.exit(1);
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
// Run command
|
|
449
|
+
program
|
|
450
|
+
.command('run <input>')
|
|
451
|
+
.description('Execute a workflow file directly')
|
|
452
|
+
.option('-w, --workflow <name>', 'Specific workflow name to run')
|
|
453
|
+
.option('--params <json>', 'Input parameters as JSON string')
|
|
454
|
+
.option('--params-file <path>', 'Path to JSON file with input parameters')
|
|
455
|
+
.option('-p, --production', 'Production mode (no trace events)', false)
|
|
456
|
+
.option('-t, --trace', 'Include execution trace events')
|
|
457
|
+
.option('--json', 'Output result as JSON', false)
|
|
458
|
+
.option('--timeout <ms>', 'Execution timeout in milliseconds', parseInt)
|
|
459
|
+
.option('--mocks <json>', 'Mock config for built-in nodes (events, invocations, fast) as JSON')
|
|
460
|
+
.option('--mocks-file <path>', 'Path to JSON file with mock config for built-in nodes')
|
|
461
|
+
.action(async (input, options) => {
|
|
462
|
+
try {
|
|
463
|
+
await runCommand(input, options);
|
|
464
|
+
}
|
|
465
|
+
catch (error) {
|
|
466
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
467
|
+
process.exit(1);
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
// Serve command
|
|
471
|
+
program
|
|
472
|
+
.command('serve [directory]')
|
|
473
|
+
.description('Start HTTP server exposing workflows as endpoints')
|
|
474
|
+
.option('-p, --port <port>', 'Server port', '3000')
|
|
475
|
+
.option('-H, --host <host>', 'Server host', '0.0.0.0')
|
|
476
|
+
.option('--no-watch', 'Disable file watching for hot reload')
|
|
477
|
+
.option('--production', 'Production mode (no trace events)', false)
|
|
478
|
+
.option('--precompile', 'Precompile all workflows on startup', false)
|
|
479
|
+
.option('--cors <origin>', 'CORS origin', '*')
|
|
480
|
+
.option('--swagger', 'Enable Swagger UI at /docs', false)
|
|
481
|
+
.action(async (directory, options) => {
|
|
482
|
+
try {
|
|
483
|
+
await serveCommand(directory, {
|
|
484
|
+
port: parseInt(options.port, 10),
|
|
485
|
+
host: options.host,
|
|
486
|
+
watch: options.watch,
|
|
487
|
+
production: options.production,
|
|
488
|
+
precompile: options.precompile,
|
|
489
|
+
cors: options.cors,
|
|
490
|
+
swagger: options.swagger,
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
catch (error) {
|
|
494
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
495
|
+
process.exit(1);
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
// Export command
|
|
499
|
+
program
|
|
500
|
+
.command('export <input>')
|
|
501
|
+
.description('Export workflow as serverless function')
|
|
502
|
+
.requiredOption('-t, --target <target>', 'Target platform (lambda, vercel, cloudflare)')
|
|
503
|
+
.requiredOption('-o, --output <path>', 'Output directory')
|
|
504
|
+
.option('-w, --workflow <name>', 'Specific workflow name to export')
|
|
505
|
+
.option('-p, --production', 'Production mode', true)
|
|
506
|
+
.option('--dry-run', 'Preview without writing files', false)
|
|
507
|
+
.option('--multi', 'Export all workflows in file as a single multi-workflow service', false)
|
|
508
|
+
.option('--workflows <names>', 'Comma-separated list of workflows to export (used with --multi)')
|
|
509
|
+
.option('--docs', 'Include API documentation routes (/docs and /openapi.json)', false)
|
|
510
|
+
.option('--durable-steps', 'Use deep generator with per-node Inngest steps for durability (inngest target only)', false)
|
|
511
|
+
.action(async (input, options) => {
|
|
512
|
+
try {
|
|
513
|
+
await exportCommand(input, options);
|
|
514
|
+
}
|
|
515
|
+
catch (error) {
|
|
516
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
517
|
+
process.exit(1);
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
// OpenAPI command
|
|
521
|
+
program
|
|
522
|
+
.command('openapi <directory>')
|
|
523
|
+
.description('Generate OpenAPI specification from workflows')
|
|
524
|
+
.option('-o, --output <path>', 'Output file path')
|
|
525
|
+
.option('--title <title>', 'API title', 'Flow Weaver API')
|
|
526
|
+
.option('--version <version>', 'API version', '1.0.0')
|
|
527
|
+
.option('--description <desc>', 'API description')
|
|
528
|
+
.option('-f, --format <format>', 'Output format: json (default), yaml', 'json')
|
|
529
|
+
.option('--server <url>', 'Server URL')
|
|
530
|
+
.action(async (directory, options) => {
|
|
531
|
+
try {
|
|
532
|
+
await openapiCommand(directory, options);
|
|
533
|
+
}
|
|
534
|
+
catch (error) {
|
|
535
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
536
|
+
process.exit(1);
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
// Plugin command group
|
|
540
|
+
const pluginCmd = program.command('plugin').description('Scaffold and manage external plugins');
|
|
541
|
+
pluginCmd
|
|
542
|
+
.command('init <name>')
|
|
543
|
+
.description('Scaffold a new external plugin')
|
|
544
|
+
.option('-a, --area <area>', 'Component area: sidebar, main, toolbar, modal, panel', 'panel')
|
|
545
|
+
.option('--no-system', 'Skip generating a system module')
|
|
546
|
+
.option('-p, --preview', 'Preview generated files without writing', false)
|
|
547
|
+
.option('--force', 'Overwrite existing files', false)
|
|
548
|
+
.action(async (name, options) => {
|
|
549
|
+
try {
|
|
550
|
+
await pluginInitCommand(name, options);
|
|
551
|
+
}
|
|
552
|
+
catch (error) {
|
|
553
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
554
|
+
process.exit(1);
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
// Migrate command
|
|
558
|
+
program
|
|
559
|
+
.command('migrate <glob>')
|
|
560
|
+
.description('Migrate workflow files to current syntax via parse → regenerate round-trip')
|
|
561
|
+
.option('--dry-run', 'Preview changes without writing files', false)
|
|
562
|
+
.option('--diff', 'Show semantic diff before/after', false)
|
|
563
|
+
.action(async (glob, options) => {
|
|
564
|
+
try {
|
|
565
|
+
await migrateCommand(glob, options);
|
|
566
|
+
}
|
|
567
|
+
catch (error) {
|
|
568
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
569
|
+
process.exit(1);
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
// Changelog command
|
|
573
|
+
program
|
|
574
|
+
.command('changelog')
|
|
575
|
+
.description('Generate changelog from git history, categorized by file path')
|
|
576
|
+
.option('--last-tag', 'From last git tag to HEAD', false)
|
|
577
|
+
.option('--since <date>', 'Date-based range (e.g., "2024-01-01")')
|
|
578
|
+
.option('-r, --range <range>', 'Custom git range (e.g., "v0.1.0..HEAD")')
|
|
579
|
+
.action(async (options) => {
|
|
580
|
+
try {
|
|
581
|
+
await changelogCommand(options);
|
|
582
|
+
}
|
|
583
|
+
catch (error) {
|
|
584
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
585
|
+
process.exit(1);
|
|
586
|
+
}
|
|
587
|
+
});
|
|
588
|
+
// Marketplace command group
|
|
589
|
+
const marketCmd = program.command('market').description('Discover, install, and publish marketplace packages');
|
|
590
|
+
marketCmd
|
|
591
|
+
.command('init <name>')
|
|
592
|
+
.description('Scaffold a new marketplace package')
|
|
593
|
+
.option('-d, --description <desc>', 'Package description')
|
|
594
|
+
.option('-a, --author <author>', 'Author name')
|
|
595
|
+
.option('-y, --yes', 'Skip prompts and use defaults', false)
|
|
596
|
+
.action(async (name, options) => {
|
|
597
|
+
try {
|
|
598
|
+
await marketInitCommand(name, options);
|
|
599
|
+
}
|
|
600
|
+
catch (error) {
|
|
601
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
602
|
+
process.exit(1);
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
marketCmd
|
|
606
|
+
.command('pack [directory]')
|
|
607
|
+
.description('Validate and generate flowweaver.manifest.json')
|
|
608
|
+
.option('--json', 'Output results as JSON', false)
|
|
609
|
+
.option('--verbose', 'Show parse warnings', false)
|
|
610
|
+
.action(async (directory, options) => {
|
|
611
|
+
try {
|
|
612
|
+
await marketPackCommand(directory, options);
|
|
613
|
+
}
|
|
614
|
+
catch (error) {
|
|
615
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
616
|
+
process.exit(1);
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
marketCmd
|
|
620
|
+
.command('publish [directory]')
|
|
621
|
+
.description('Pack and publish to npm')
|
|
622
|
+
.option('--dry-run', 'Preview without publishing', false)
|
|
623
|
+
.option('--tag <tag>', 'npm dist-tag')
|
|
624
|
+
.action(async (directory, options) => {
|
|
625
|
+
try {
|
|
626
|
+
await marketPublishCommand(directory, options);
|
|
627
|
+
}
|
|
628
|
+
catch (error) {
|
|
629
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
630
|
+
process.exit(1);
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
marketCmd
|
|
634
|
+
.command('install <package>')
|
|
635
|
+
.description('Install a marketplace package')
|
|
636
|
+
.option('--json', 'Output results as JSON', false)
|
|
637
|
+
.action(async (packageSpec, options) => {
|
|
638
|
+
try {
|
|
639
|
+
await marketInstallCommand(packageSpec, options);
|
|
640
|
+
}
|
|
641
|
+
catch (error) {
|
|
642
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
643
|
+
process.exit(1);
|
|
644
|
+
}
|
|
645
|
+
});
|
|
646
|
+
marketCmd
|
|
647
|
+
.command('search [query]')
|
|
648
|
+
.description('Search npm for marketplace packages')
|
|
649
|
+
.option('-l, --limit <number>', 'Max results', '20')
|
|
650
|
+
.option('-r, --registry <url>', 'Custom registry search URL (e.g., private npm registry)')
|
|
651
|
+
.option('--json', 'Output as JSON', false)
|
|
652
|
+
.action(async (query, options) => {
|
|
653
|
+
try {
|
|
654
|
+
await marketSearchCommand(query, { ...options, limit: parseInt(options.limit, 10) });
|
|
655
|
+
}
|
|
656
|
+
catch (error) {
|
|
657
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
658
|
+
process.exit(1);
|
|
659
|
+
}
|
|
660
|
+
});
|
|
661
|
+
marketCmd
|
|
662
|
+
.command('list')
|
|
663
|
+
.description('List installed marketplace packages')
|
|
664
|
+
.option('--json', 'Output as JSON', false)
|
|
665
|
+
.action(async (options) => {
|
|
666
|
+
try {
|
|
667
|
+
await marketListCommand(options);
|
|
668
|
+
}
|
|
669
|
+
catch (error) {
|
|
670
|
+
logger.error(`Command failed: ${getErrorMessage(error)}`);
|
|
671
|
+
process.exit(1);
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
// Help command (default commander behavior)
|
|
675
|
+
program.on('--help', () => {
|
|
676
|
+
logger.newline();
|
|
677
|
+
logger.section('Examples');
|
|
678
|
+
logger.log(' $ flow-weaver compile my-workflow.ts');
|
|
679
|
+
logger.log(" $ flow-weaver compile '**/*.ts' -o .output");
|
|
680
|
+
logger.log(' $ flow-weaver compile my-workflow.ts --format cjs');
|
|
681
|
+
logger.log(' $ flow-weaver describe workflow.ts');
|
|
682
|
+
logger.log(' $ flow-weaver describe workflow.ts --format mermaid');
|
|
683
|
+
logger.log(' $ flow-weaver describe workflow.ts --node validator');
|
|
684
|
+
logger.log(' $ flow-weaver diagram workflow.ts');
|
|
685
|
+
logger.log(' $ flow-weaver diagram workflow.ts --theme light -o diagram.svg');
|
|
686
|
+
logger.log(' $ flow-weaver diff workflow-v1.ts workflow-v2.ts');
|
|
687
|
+
logger.log(' $ flow-weaver diff workflow-v1.ts workflow-v2.ts --format json');
|
|
688
|
+
logger.log(" $ flow-weaver validate '**/*.ts'");
|
|
689
|
+
logger.log(" $ flow-weaver watch 'src/**/*.ts' -o dist");
|
|
690
|
+
logger.log(' $ flow-weaver create workflow simple my-workflow.ts');
|
|
691
|
+
logger.log(' $ flow-weaver create workflow ai-agent agent.ts --provider openai --model gpt-4o');
|
|
692
|
+
logger.log(' $ flow-weaver create node myProcessor my-workflow.ts');
|
|
693
|
+
logger.log(' $ flow-weaver templates');
|
|
694
|
+
logger.log(' $ flow-weaver pattern list ./patterns');
|
|
695
|
+
logger.log(' $ flow-weaver pattern apply pattern.ts workflow.ts');
|
|
696
|
+
logger.log(' $ flow-weaver pattern extract workflow.ts --nodes a,b -o extracted.ts');
|
|
697
|
+
logger.log(' $ flow-weaver init my-project');
|
|
698
|
+
logger.log(' $ flow-weaver init --template ai-agent -y');
|
|
699
|
+
logger.log(' $ flow-weaver init my-project --format cjs');
|
|
700
|
+
logger.log(' $ flow-weaver doctor');
|
|
701
|
+
logger.log(' $ flow-weaver doctor --json');
|
|
702
|
+
logger.newline();
|
|
703
|
+
logger.section('Plugin Commands');
|
|
704
|
+
logger.log(' $ flow-weaver plugin init my-plugin');
|
|
705
|
+
logger.log(' $ flow-weaver plugin init my-plugin --area sidebar --no-system');
|
|
706
|
+
logger.log(' $ flow-weaver plugin init my-plugin --preview');
|
|
707
|
+
logger.newline();
|
|
708
|
+
logger.section('Deployment Commands');
|
|
709
|
+
logger.log(' $ flow-weaver run workflow.ts --params \'{"a": 5}\'');
|
|
710
|
+
logger.log(' $ flow-weaver serve ./workflows --port 8080');
|
|
711
|
+
logger.log(' $ flow-weaver export workflow.ts --target vercel --output api/');
|
|
712
|
+
logger.log(' $ flow-weaver export workflows.ts --target lambda --output dist/ --multi');
|
|
713
|
+
logger.log(' $ flow-weaver export workflows.ts --target lambda --output dist/ --multi --docs');
|
|
714
|
+
logger.log(' $ flow-weaver export workflow.ts --target inngest --output dist/ --durable-steps');
|
|
715
|
+
logger.log(' $ flow-weaver compile workflow.ts --target inngest');
|
|
716
|
+
logger.log(' $ flow-weaver openapi ./workflows --output api-spec.json');
|
|
717
|
+
logger.newline();
|
|
718
|
+
logger.section('Marketplace Commands');
|
|
719
|
+
logger.log(' $ flow-weaver market init openai');
|
|
720
|
+
logger.log(' $ flow-weaver market pack');
|
|
721
|
+
logger.log(' $ flow-weaver market publish');
|
|
722
|
+
logger.log(' $ flow-weaver market publish --dry-run');
|
|
723
|
+
logger.log(' $ flow-weaver market install flowweaver-pack-openai');
|
|
724
|
+
logger.log(' $ flow-weaver market search openai');
|
|
725
|
+
logger.log(' $ flow-weaver market list');
|
|
726
|
+
logger.newline();
|
|
727
|
+
logger.section('Migration & Changelog');
|
|
728
|
+
logger.log(" $ flow-weaver migrate '**/*.ts'");
|
|
729
|
+
logger.log(" $ flow-weaver migrate '**/*.ts' --dry-run");
|
|
730
|
+
logger.log(" $ flow-weaver migrate 'src/**/*.ts' --diff");
|
|
731
|
+
logger.log(' $ flow-weaver changelog --last-tag');
|
|
732
|
+
logger.log(' $ flow-weaver changelog --range v0.1.0..HEAD');
|
|
733
|
+
logger.log(' $ flow-weaver changelog --since 2024-01-01');
|
|
734
|
+
logger.newline();
|
|
735
|
+
});
|
|
736
|
+
// Parse arguments
|
|
737
|
+
program.parse(process.argv);
|
|
738
|
+
// Show help if no command specified
|
|
739
|
+
if (!process.argv.slice(2).length) {
|
|
740
|
+
program.outputHelp();
|
|
741
|
+
}
|
|
742
|
+
//# sourceMappingURL=index.js.map
|