@synergenius/flow-weaver 0.17.1 → 0.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.d.ts +4 -1
- package/dist/api/index.js +4 -1
- package/dist/api/templates.js +2 -2
- package/dist/api/validate.d.ts +2 -2
- package/dist/api/validate.js +6 -6
- package/dist/api/validation-registry.d.ts +10 -0
- package/dist/api/validation-registry.js +10 -0
- package/dist/ast/types.d.ts +91 -4
- package/dist/built-in-nodes/invoke-workflow.d.ts +1 -1
- package/dist/built-in-nodes/invoke-workflow.js +1 -1
- package/dist/chevrotain-parser/connect-parser.js +25 -7
- package/dist/cli/commands/compile.d.ts +5 -9
- package/dist/cli/commands/compile.js +21 -14
- package/dist/cli/commands/dev.d.ts +2 -13
- package/dist/cli/commands/dev.js +10 -204
- package/dist/cli/commands/doctor.js +6 -3
- package/dist/cli/commands/export.d.ts +8 -17
- package/dist/cli/commands/export.js +8 -17
- package/dist/cli/commands/init-personas.d.ts +12 -3
- package/dist/cli/commands/init-personas.js +27 -4
- package/dist/cli/commands/init.d.ts +2 -2
- package/dist/cli/commands/init.js +5 -11
- package/dist/cli/flow-weaver.mjs +61463 -60910
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +9 -7
- package/dist/cli/templates/index.d.ts +20 -1
- package/dist/cli/templates/index.js +66 -15
- package/dist/cli/templates/nodes/human-approval.js +2 -3
- package/dist/cli/templates/nodes/rag-retriever.js +1 -1
- package/dist/constants.d.ts +7 -0
- package/dist/constants.js +13 -3
- package/dist/context/index.js +13 -3
- package/dist/deployment/config/loader.js +2 -1
- package/dist/deployment/core/adapters.d.ts +1 -25
- package/dist/deployment/core/adapters.js +0 -95
- package/dist/deployment/core/formatters.d.ts +0 -15
- package/dist/deployment/core/formatters.js +0 -24
- package/dist/deployment/index.d.ts +7 -5
- package/dist/deployment/index.js +8 -5
- package/dist/deployment/types.d.ts +2 -45
- package/dist/diagram/html-viewer.js +65 -32
- package/dist/diagram/renderer.js +9 -6
- package/dist/diagram/theme.js +4 -0
- package/dist/diagram/types.d.ts +2 -0
- package/dist/doc-metadata/extractors/annotations.js +5 -5
- package/dist/doc-metadata/extractors/cli-commands.js +1 -1
- package/dist/doc-metadata/extractors/mcp-tools.js +1 -2
- package/dist/docs/index.d.ts +28 -1
- package/dist/docs/index.js +95 -28
- package/dist/export/index.d.ts +2 -3
- package/dist/{deployment/targets/cicd-base.d.ts → extensions/cicd/base-target.d.ts} +35 -36
- package/dist/{deployment/targets/cicd-base.js → extensions/cicd/base-target.js} +97 -57
- package/dist/{validation/cicd-detection.d.ts → extensions/cicd/detection.d.ts} +2 -2
- package/dist/{validation/cicd-detection.js → extensions/cicd/detection.js} +13 -1
- package/dist/extensions/cicd/docs/cicd.md +395 -0
- package/dist/extensions/cicd/index.d.ts +10 -0
- package/dist/extensions/cicd/index.js +10 -0
- package/dist/extensions/cicd/register.d.ts +11 -0
- package/dist/extensions/cicd/register.js +62 -0
- package/dist/extensions/cicd/rules.d.ts +30 -0
- package/dist/{validation/cicd-rules.js → extensions/cicd/rules.js} +60 -56
- package/dist/extensions/cicd/tag-handler.d.ts +14 -0
- package/dist/extensions/cicd/tag-handler.js +488 -0
- package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-docker.d.ts +1 -1
- package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-matrix.d.ts +1 -1
- package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-multi-env.d.ts +1 -1
- package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-test-deploy.d.ts +1 -1
- package/dist/extensions/index.d.ts +12 -0
- package/dist/extensions/index.js +12 -0
- package/dist/extensions/inngest/dev-mode.d.ts +9 -0
- package/dist/extensions/inngest/dev-mode.js +213 -0
- package/dist/{generator/inngest.d.ts → extensions/inngest/generator.d.ts} +2 -2
- package/dist/{generator/inngest.js → extensions/inngest/generator.js} +4 -4
- package/dist/extensions/inngest/index.d.ts +2 -0
- package/dist/extensions/inngest/index.js +2 -0
- package/dist/extensions/inngest/register.d.ts +6 -0
- package/dist/extensions/inngest/register.js +23 -0
- package/dist/extensions/inngest/templates/ai-agent-durable.d.ts +8 -0
- package/dist/{cli/templates/workflows → extensions/inngest/templates}/ai-agent-durable.js +8 -8
- package/dist/{cli/templates/workflows → extensions/inngest/templates}/ai-pipeline-durable.d.ts +2 -2
- package/dist/{cli/templates/workflows → extensions/inngest/templates}/ai-pipeline-durable.js +7 -7
- package/dist/generated-version.d.ts +1 -1
- package/dist/generated-version.js +1 -1
- package/dist/generator/compile-target-registry.d.ts +20 -0
- package/dist/generator/compile-target-registry.js +20 -0
- package/dist/generator/dev-mode-registry.d.ts +27 -0
- package/dist/generator/dev-mode-registry.js +20 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/jsdoc-parser.d.ts +12 -114
- package/dist/jsdoc-parser.js +57 -362
- package/dist/marketplace/index.d.ts +2 -2
- package/dist/marketplace/index.js +1 -1
- package/dist/marketplace/registry.d.ts +39 -1
- package/dist/marketplace/registry.js +77 -0
- package/dist/marketplace/types.d.ts +76 -3
- package/dist/mcp/server.d.ts +1 -0
- package/dist/mcp/server.js +2 -0
- package/dist/mcp/tools-export.js +3 -3
- package/dist/mcp/tools-query.js +17 -11
- package/dist/mcp/tools-template.js +1 -1
- package/dist/parser/tag-registry.d.ts +47 -0
- package/dist/parser/tag-registry.js +57 -0
- package/dist/parser.d.ts +3 -0
- package/dist/parser.js +10 -23
- package/dist/validation/rule-registry.d.ts +36 -0
- package/dist/validation/rule-registry.js +37 -0
- package/dist/validator.js +3 -3
- package/docs/reference/concepts.md +2 -1
- package/docs/reference/deployment.md +21 -0
- package/docs/reference/jsdoc-grammar.md +242 -1
- package/docs/reference/scaffold.md +0 -6
- package/package.json +9 -1
- package/dist/cli/templates/workflows/ai-agent-durable.d.ts +0 -8
- package/dist/export/templates.d.ts +0 -24
- package/dist/export/templates.js +0 -186
- package/dist/validation/cicd-rules.d.ts +0 -62
- /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-docker.js +0 -0
- /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-matrix.js +0 -0
- /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-multi-env.js +0 -0
- /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-test-deploy.js +0 -0
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
// Must be imported first: sets up env vars before picocolors reads them
|
|
9
9
|
import './env-setup.js';
|
|
10
|
+
// Load built-in extensions (CI/CD, etc.) before any commands run
|
|
11
|
+
import '../extensions/index.js';
|
|
10
12
|
import { Command, Option } from 'commander';
|
|
11
13
|
import { compileCommand } from './commands/compile.js';
|
|
12
14
|
import { createWorkflowCommand, createNodeCommand } from './commands/create.js';
|
|
@@ -102,12 +104,12 @@ program
|
|
|
102
104
|
.option('--strict', 'Treat type coercion warnings as errors', false)
|
|
103
105
|
.option('--inline-runtime', 'Force inline runtime even when @synergenius/flow-weaver package is installed', false)
|
|
104
106
|
.option('--clean', 'Omit redundant @param/@returns annotations from compiled output', false)
|
|
105
|
-
.option('--target <target>', 'Compilation target: typescript (default) or
|
|
106
|
-
.option('--cron <schedule>', 'Set cron trigger schedule
|
|
107
|
+
.option('--target <target>', 'Compilation target: typescript (default) or a registered extension target')
|
|
108
|
+
.option('--cron <schedule>', 'Set cron trigger schedule')
|
|
107
109
|
.option('--serve', 'Generate serve() handler for HTTP event reception')
|
|
108
110
|
.option('--framework <name>', 'Framework adapter for serve handler (next, express, hono, fastify, remix)')
|
|
109
111
|
.option('--typed-events', 'Generate Zod event schemas from workflow @param annotations')
|
|
110
|
-
.option('--retries <n>', 'Number of retries per function
|
|
112
|
+
.option('--retries <n>', 'Number of retries per function', parseInt)
|
|
111
113
|
.option('--timeout <duration>', 'Function timeout (e.g. "30m", "1h")')
|
|
112
114
|
.action(wrapAction(async (input, options) => {
|
|
113
115
|
if (options.workflow)
|
|
@@ -241,9 +243,9 @@ program
|
|
|
241
243
|
.option('--clean', 'Omit redundant @param/@returns annotations', false)
|
|
242
244
|
.option('--once', 'Run once then exit', false)
|
|
243
245
|
.option('--json', 'Output result as JSON', false)
|
|
244
|
-
.option('--target <target>', 'Compilation target
|
|
245
|
-
.option('--framework <framework>', 'Framework for serve handler
|
|
246
|
-
.option('--port <port>', 'Port for dev server
|
|
246
|
+
.option('--target <target>', 'Compilation target (default: typescript)')
|
|
247
|
+
.option('--framework <framework>', 'Framework for serve handler', 'express')
|
|
248
|
+
.option('--port <port>', 'Port for dev server', (v) => parseInt(v, 10), 3000)
|
|
247
249
|
.action(wrapAction(async (input, options) => {
|
|
248
250
|
await devCommand(input, options);
|
|
249
251
|
}));
|
|
@@ -450,7 +452,7 @@ program
|
|
|
450
452
|
.option('--multi', 'Export all workflows in file as a single multi-workflow service', false)
|
|
451
453
|
.option('--workflows <names>', 'Comma-separated list of workflows to export (used with --multi)')
|
|
452
454
|
.option('--docs', 'Include API documentation routes (/docs and /openapi.json)', false)
|
|
453
|
-
.option('--durable-steps', 'Use deep generator with per-node
|
|
455
|
+
.option('--durable-steps', 'Use deep generator with per-node durable steps', false)
|
|
454
456
|
.action(wrapAction(async (input, options) => {
|
|
455
457
|
await exportCommand(input, options);
|
|
456
458
|
}));
|
|
@@ -84,13 +84,32 @@ export declare const workflowTemplates: WorkflowTemplate[];
|
|
|
84
84
|
*/
|
|
85
85
|
export declare const nodeTemplates: NodeTemplate[];
|
|
86
86
|
/**
|
|
87
|
-
* Get a workflow template by ID
|
|
87
|
+
* Get a workflow template by ID.
|
|
88
|
+
* Checks both core templates and any dynamically loaded pack templates.
|
|
88
89
|
*/
|
|
89
90
|
export declare function getWorkflowTemplate(id: string): WorkflowTemplate | undefined;
|
|
90
91
|
/**
|
|
91
92
|
* Get a node template by ID
|
|
92
93
|
*/
|
|
93
94
|
export declare function getNodeTemplate(id: string): NodeTemplate | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Get all workflow templates including pack-contributed ones.
|
|
97
|
+
*/
|
|
98
|
+
export declare function getAllWorkflowTemplates(): WorkflowTemplate[];
|
|
99
|
+
/**
|
|
100
|
+
* Register workflow templates contributed by a built-in extension.
|
|
101
|
+
* Unlike loadPackTemplates (which scans npm packages), this is for
|
|
102
|
+
* in-tree extensions that register at bootstrap time.
|
|
103
|
+
*/
|
|
104
|
+
export declare function registerWorkflowTemplates(templates: WorkflowTemplate[]): void;
|
|
105
|
+
/**
|
|
106
|
+
* Load workflow templates from installed pack manifests.
|
|
107
|
+
* Templates declared in `initContributions.templates` are dynamically imported
|
|
108
|
+
* and appended to the available template list.
|
|
109
|
+
*
|
|
110
|
+
* @param projectDir - Project root to scan for installed packs
|
|
111
|
+
*/
|
|
112
|
+
export declare function loadPackTemplates(projectDir: string): Promise<void>;
|
|
94
113
|
/**
|
|
95
114
|
* Convert a string to camelCase
|
|
96
115
|
*/
|
|
@@ -13,13 +13,6 @@ import { aiChatTemplate } from './workflows/ai-chat.js';
|
|
|
13
13
|
import { aggregatorTemplate } from './workflows/aggregator.js';
|
|
14
14
|
import { webhookTemplate } from './workflows/webhook.js';
|
|
15
15
|
import { errorHandlerTemplate } from './workflows/error-handler.js';
|
|
16
|
-
import { aiAgentDurableTemplate } from './workflows/ai-agent-durable.js';
|
|
17
|
-
import { aiPipelineDurableTemplate } from './workflows/ai-pipeline-durable.js';
|
|
18
|
-
// Import CI/CD workflow templates
|
|
19
|
-
import { cicdTestDeployTemplate } from './workflows/cicd-test-deploy.js';
|
|
20
|
-
import { cicdDockerTemplate } from './workflows/cicd-docker.js';
|
|
21
|
-
import { cicdMultiEnvTemplate } from './workflows/cicd-multi-env.js';
|
|
22
|
-
import { cicdMatrixTemplate } from './workflows/cicd-matrix.js';
|
|
23
16
|
// Import node templates
|
|
24
17
|
import { validatorNodeTemplate } from './nodes/validator.js';
|
|
25
18
|
import { transformerNodeTemplate } from './nodes/transformer.js';
|
|
@@ -49,12 +42,6 @@ export const workflowTemplates = [
|
|
|
49
42
|
aggregatorTemplate,
|
|
50
43
|
webhookTemplate,
|
|
51
44
|
errorHandlerTemplate,
|
|
52
|
-
aiAgentDurableTemplate,
|
|
53
|
-
aiPipelineDurableTemplate,
|
|
54
|
-
cicdTestDeployTemplate,
|
|
55
|
-
cicdDockerTemplate,
|
|
56
|
-
cicdMultiEnvTemplate,
|
|
57
|
-
cicdMatrixTemplate,
|
|
58
45
|
];
|
|
59
46
|
/**
|
|
60
47
|
* All available node templates
|
|
@@ -74,10 +61,12 @@ export const nodeTemplates = [
|
|
|
74
61
|
ragRetrieverNodeTemplate,
|
|
75
62
|
];
|
|
76
63
|
/**
|
|
77
|
-
* Get a workflow template by ID
|
|
64
|
+
* Get a workflow template by ID.
|
|
65
|
+
* Checks both core templates and any dynamically loaded pack templates.
|
|
78
66
|
*/
|
|
79
67
|
export function getWorkflowTemplate(id) {
|
|
80
|
-
return workflowTemplates.find((t) => t.id === id)
|
|
68
|
+
return workflowTemplates.find((t) => t.id === id)
|
|
69
|
+
?? packWorkflowTemplates.find((t) => t.id === id);
|
|
81
70
|
}
|
|
82
71
|
/**
|
|
83
72
|
* Get a node template by ID
|
|
@@ -85,6 +74,68 @@ export function getWorkflowTemplate(id) {
|
|
|
85
74
|
export function getNodeTemplate(id) {
|
|
86
75
|
return nodeTemplates.find((t) => t.id === id);
|
|
87
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Dynamically loaded pack templates. Populated by loadPackTemplates().
|
|
79
|
+
*/
|
|
80
|
+
const packWorkflowTemplates = [];
|
|
81
|
+
/**
|
|
82
|
+
* Get all workflow templates including pack-contributed ones.
|
|
83
|
+
*/
|
|
84
|
+
export function getAllWorkflowTemplates() {
|
|
85
|
+
return [...workflowTemplates, ...packWorkflowTemplates];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Register workflow templates contributed by a built-in extension.
|
|
89
|
+
* Unlike loadPackTemplates (which scans npm packages), this is for
|
|
90
|
+
* in-tree extensions that register at bootstrap time.
|
|
91
|
+
*/
|
|
92
|
+
export function registerWorkflowTemplates(templates) {
|
|
93
|
+
for (const tmpl of templates) {
|
|
94
|
+
if (!packWorkflowTemplates.some((t) => t.id === tmpl.id)) {
|
|
95
|
+
packWorkflowTemplates.push(tmpl);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Load workflow templates from installed pack manifests.
|
|
101
|
+
* Templates declared in `initContributions.templates` are dynamically imported
|
|
102
|
+
* and appended to the available template list.
|
|
103
|
+
*
|
|
104
|
+
* @param projectDir - Project root to scan for installed packs
|
|
105
|
+
*/
|
|
106
|
+
export async function loadPackTemplates(projectDir) {
|
|
107
|
+
try {
|
|
108
|
+
const { listInstalledPackages } = await import('../../marketplace/registry.js');
|
|
109
|
+
const packages = await listInstalledPackages(projectDir);
|
|
110
|
+
for (const pkg of packages) {
|
|
111
|
+
const contributions = pkg.manifest.initContributions;
|
|
112
|
+
if (!contributions?.templates)
|
|
113
|
+
continue;
|
|
114
|
+
// Pack templates must be exported from the pack's main entry point
|
|
115
|
+
// or from a templates.js file alongside the manifest
|
|
116
|
+
try {
|
|
117
|
+
const templatesPath = await import('path').then((p) => p.join(pkg.path, 'templates.js'));
|
|
118
|
+
const { existsSync } = await import('fs');
|
|
119
|
+
if (!existsSync(templatesPath))
|
|
120
|
+
continue;
|
|
121
|
+
const mod = await import(templatesPath);
|
|
122
|
+
if (mod.workflowTemplates && Array.isArray(mod.workflowTemplates)) {
|
|
123
|
+
for (const tmpl of mod.workflowTemplates) {
|
|
124
|
+
if (contributions.templates.includes(tmpl.id)) {
|
|
125
|
+
packWorkflowTemplates.push(tmpl);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
// Skip packs that fail to load templates
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
// Marketplace scanning not available (e.g., no node_modules)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
88
139
|
/**
|
|
89
140
|
* Convert a string to camelCase
|
|
90
141
|
*/
|
|
@@ -30,9 +30,8 @@ export const humanApprovalNodeTemplate = {
|
|
|
30
30
|
// APPROVAL TYPES
|
|
31
31
|
// ============================================================
|
|
32
32
|
//
|
|
33
|
-
// On
|
|
34
|
-
//
|
|
35
|
-
// See: https://www.inngest.com/docs/reference/functions/step-wait-for-event
|
|
33
|
+
// On durable targets, consider using the built-in waitForEvent node instead.
|
|
34
|
+
// It maps to a platform-native durable pause for zero-cost waiting.
|
|
36
35
|
|
|
37
36
|
${APPROVAL_TYPES}
|
|
38
37
|
|
|
@@ -38,7 +38,7 @@ const MOCK_DOCUMENTS: Record<string, RetrievedDocument[]> = {
|
|
|
38
38
|
{ text: 'Flow Weaver compiles workflows to standalone TypeScript functions.', score: 0.95, metadata: { source: 'docs/overview.md' } },
|
|
39
39
|
{ text: 'The compiler validates connections at compile time, catching errors before runtime.', score: 0.88, metadata: { source: 'docs/compiler.md' } },
|
|
40
40
|
{ text: 'Workflows are standard TypeScript files with JSDoc annotations.', score: 0.82, metadata: { source: 'docs/authoring.md' } },
|
|
41
|
-
{ text: 'Deploy compiled workflows to
|
|
41
|
+
{ text: 'Deploy compiled workflows to any supported target via installed packs.', score: 0.75, metadata: { source: 'docs/deployment.md' } },
|
|
42
42
|
{ text: 'The visual editor provides bidirectional editing — code changes update the canvas and vice versa.', score: 0.71, metadata: { source: 'docs/editor.md' } },
|
|
43
43
|
],
|
|
44
44
|
};
|
package/dist/constants.d.ts
CHANGED
|
@@ -81,6 +81,8 @@ export declare function isReservedPortName(name: string): name is ReservedPortNa
|
|
|
81
81
|
export declare function isStartNode(nodeName: string): boolean;
|
|
82
82
|
export declare function isExitNode(nodeName: string): boolean;
|
|
83
83
|
export declare function isSpecialNode(nodeName: string): boolean;
|
|
84
|
+
/** Pseudo-nodes like `secret:NAME` are connection sources that don't correspond to real node instances. */
|
|
85
|
+
export declare function isPseudoNode(nodeName: string): boolean;
|
|
84
86
|
export declare function isExecutePort(portName: string): boolean;
|
|
85
87
|
export declare function isSuccessPort(portName: string): boolean;
|
|
86
88
|
export declare function isFailurePort(portName: string): boolean;
|
|
@@ -103,4 +105,9 @@ export declare const KNOWN_NODETYPE_TAGS: Set<string>;
|
|
|
103
105
|
export declare const KNOWN_WORKFLOW_TAGS: Set<string>;
|
|
104
106
|
export declare const KNOWN_PATTERN_TAGS: Set<string>;
|
|
105
107
|
export declare const STANDARD_JSDOC_TAGS: Set<string>;
|
|
108
|
+
/**
|
|
109
|
+
* Build a dynamic known-workflow-tags set that includes core tags
|
|
110
|
+
* plus any extra tags contributed by pack registries.
|
|
111
|
+
*/
|
|
112
|
+
export declare function getKnownWorkflowTags(extraTags?: string[]): Set<string>;
|
|
106
113
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.js
CHANGED
|
@@ -88,6 +88,10 @@ export function isExitNode(nodeName) {
|
|
|
88
88
|
export function isSpecialNode(nodeName) {
|
|
89
89
|
return isStartNode(nodeName) || isExitNode(nodeName);
|
|
90
90
|
}
|
|
91
|
+
/** Pseudo-nodes like `secret:NAME` are connection sources that don't correspond to real node instances. */
|
|
92
|
+
export function isPseudoNode(nodeName) {
|
|
93
|
+
return nodeName.startsWith('secret:');
|
|
94
|
+
}
|
|
91
95
|
export function isExecutePort(portName) {
|
|
92
96
|
return portName === RESERVED_PORT_NAMES.EXECUTE;
|
|
93
97
|
}
|
|
@@ -138,9 +142,6 @@ export const KNOWN_WORKFLOW_TAGS = new Set([
|
|
|
138
142
|
'node', 'position', 'connect', 'scope', 'map', 'path', 'fanOut', 'fanIn',
|
|
139
143
|
'coerce', 'trigger', 'cancelOn', 'retries', 'timeout', 'throttle', 'param',
|
|
140
144
|
'return', 'returns',
|
|
141
|
-
// CI/CD annotations
|
|
142
|
-
'secret', 'runner', 'cache', 'artifact', 'environment', 'matrix',
|
|
143
|
-
'service', 'concurrency',
|
|
144
145
|
// Deployment annotations
|
|
145
146
|
'deploy',
|
|
146
147
|
]);
|
|
@@ -151,4 +152,13 @@ export const STANDARD_JSDOC_TAGS = new Set([
|
|
|
151
152
|
'example', 'see', 'deprecated', 'type', 'typedef', 'template',
|
|
152
153
|
'link', 'since', 'version', 'author',
|
|
153
154
|
]);
|
|
155
|
+
/**
|
|
156
|
+
* Build a dynamic known-workflow-tags set that includes core tags
|
|
157
|
+
* plus any extra tags contributed by pack registries.
|
|
158
|
+
*/
|
|
159
|
+
export function getKnownWorkflowTags(extraTags) {
|
|
160
|
+
if (!extraTags || extraTags.length === 0)
|
|
161
|
+
return KNOWN_WORKFLOW_TAGS;
|
|
162
|
+
return new Set([...KNOWN_WORKFLOW_TAGS, ...extraTags]);
|
|
163
|
+
}
|
|
154
164
|
//# sourceMappingURL=constants.js.map
|
package/dist/context/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Composes Flow Weaver documentation, annotation grammar, and a profile-specific
|
|
5
5
|
* preamble into a single markdown document suitable for LLM consumption.
|
|
6
6
|
*/
|
|
7
|
-
import { readTopic, listTopics } from '../docs/index.js';
|
|
7
|
+
import { readTopic, listTopics, getPackDocTopics } from '../docs/index.js';
|
|
8
8
|
import { getAllGrammars, serializedToEBNF } from '../chevrotain-parser/grammar-diagrams.js';
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
10
10
|
// Presets
|
|
@@ -82,7 +82,13 @@ Tool quick reference:
|
|
|
82
82
|
- fw_diagram: Visualize. Prefer format "ascii-compact" in chat contexts
|
|
83
83
|
- fw_compile: Generate executable TypeScript from annotations
|
|
84
84
|
- fw_docs: Look up reference docs by topic slug
|
|
85
|
-
- fw_scaffold: Create from templates (sequential, foreach, ai-agent, etc.)
|
|
85
|
+
- fw_scaffold: Create from templates (sequential, foreach, ai-agent, cicd-test-deploy, cicd-docker, etc.)
|
|
86
|
+
- fw_export: Deploy to cloud or generate CI/CD pipelines (targets depend on installed packs)
|
|
87
|
+
|
|
88
|
+
Flow Weaver can also generate CI/CD pipelines. Use @secret, @runner, @trigger,
|
|
89
|
+
@cache, @matrix, and [job: "name"] annotations to define pipeline structure,
|
|
90
|
+
then export to GitHub Actions YAML or GitLab CI YAML with fw_export.
|
|
91
|
+
For details: fw_docs(action="read", topic="cicd")
|
|
86
92
|
|
|
87
93
|
File conventions: .ts extension, camelCase node names, PascalCase workflow names.`;
|
|
88
94
|
}
|
|
@@ -91,7 +97,11 @@ File conventions: .ts extension, camelCase node names, PascalCase workflow names
|
|
|
91
97
|
// ---------------------------------------------------------------------------
|
|
92
98
|
export function resolveTopics(preset, explicit, add) {
|
|
93
99
|
const base = explicit ?? PRESETS[preset];
|
|
94
|
-
|
|
100
|
+
// Append pack doc topics that declare this preset
|
|
101
|
+
const packSlugs = getPackDocTopics()
|
|
102
|
+
.filter((t) => t.presets?.includes(preset))
|
|
103
|
+
.map((t) => t.slug);
|
|
104
|
+
const combined = [...base, ...packSlugs, ...(add ?? [])];
|
|
95
105
|
// Deduplicate while preserving order
|
|
96
106
|
return [...new Set(combined)];
|
|
97
107
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as fs from 'fs';
|
|
8
8
|
import * as path from 'path';
|
|
9
|
+
import { pathToFileURL } from 'url';
|
|
9
10
|
import * as YAML from 'js-yaml';
|
|
10
11
|
import { DEFAULT_CONFIG, getDefaultConfig } from './defaults.js';
|
|
11
12
|
/**
|
|
@@ -102,7 +103,7 @@ async function loadConfigFromPath(filePath) {
|
|
|
102
103
|
// TypeScript files - dynamic import
|
|
103
104
|
if (ext === '.ts') {
|
|
104
105
|
try {
|
|
105
|
-
const module = await import(absolutePath);
|
|
106
|
+
const module = await import(pathToFileURL(absolutePath).href);
|
|
106
107
|
return (module.default || module);
|
|
107
108
|
}
|
|
108
109
|
catch {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Each adapter transforms source-specific input into a unified WorkflowRequest.
|
|
5
5
|
*/
|
|
6
|
-
import type { WorkflowRequest, ExecutionContext, ValidationResult, CliInput, HttpInput,
|
|
6
|
+
import type { WorkflowRequest, ExecutionContext, ValidationResult, CliInput, HttpInput, Environment } from '../types.js';
|
|
7
7
|
/**
|
|
8
8
|
* Request adapter interface
|
|
9
9
|
*/
|
|
@@ -57,34 +57,10 @@ export declare class CliRequestAdapter extends BaseRequestAdapter<CliInput> {
|
|
|
57
57
|
export declare class HttpRequestAdapter extends BaseRequestAdapter<HttpInput> {
|
|
58
58
|
parseRequest(input: HttpInput): WorkflowRequest;
|
|
59
59
|
}
|
|
60
|
-
/**
|
|
61
|
-
* AWS Lambda request adapter
|
|
62
|
-
*
|
|
63
|
-
* Parses API Gateway event into a WorkflowRequest
|
|
64
|
-
*/
|
|
65
|
-
export declare class LambdaRequestAdapter extends BaseRequestAdapter<LambdaInput> {
|
|
66
|
-
parseRequest(input: LambdaInput): WorkflowRequest;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Vercel serverless function request adapter
|
|
70
|
-
*/
|
|
71
|
-
export declare class VercelRequestAdapter extends BaseRequestAdapter<VercelInput> {
|
|
72
|
-
parseRequest(input: VercelInput): WorkflowRequest;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Cloudflare Workers request adapter
|
|
76
|
-
*/
|
|
77
|
-
export declare class CloudflareRequestAdapter extends BaseRequestAdapter<CloudflareInput> {
|
|
78
|
-
parseRequestAsync(input: CloudflareInput): Promise<WorkflowRequest>;
|
|
79
|
-
parseRequest(_input: CloudflareInput): WorkflowRequest;
|
|
80
|
-
}
|
|
81
60
|
/**
|
|
82
61
|
* Create the appropriate adapter for a given source
|
|
83
62
|
*/
|
|
84
63
|
export declare function createAdapter(source: 'cli'): CliRequestAdapter;
|
|
85
64
|
export declare function createAdapter(source: 'http'): HttpRequestAdapter;
|
|
86
|
-
export declare function createAdapter(source: 'lambda'): LambdaRequestAdapter;
|
|
87
|
-
export declare function createAdapter(source: 'vercel'): VercelRequestAdapter;
|
|
88
|
-
export declare function createAdapter(source: 'cloudflare'): CloudflareRequestAdapter;
|
|
89
65
|
export {};
|
|
90
66
|
//# sourceMappingURL=adapters.d.ts.map
|
|
@@ -145,107 +145,12 @@ export class HttpRequestAdapter extends BaseRequestAdapter {
|
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
/**
|
|
149
|
-
* AWS Lambda request adapter
|
|
150
|
-
*
|
|
151
|
-
* Parses API Gateway event into a WorkflowRequest
|
|
152
|
-
*/
|
|
153
|
-
export class LambdaRequestAdapter extends BaseRequestAdapter {
|
|
154
|
-
parseRequest(input) {
|
|
155
|
-
// Parse body
|
|
156
|
-
let params = {};
|
|
157
|
-
if (typeof input.body === 'string') {
|
|
158
|
-
try {
|
|
159
|
-
params = JSON.parse(input.body || '{}');
|
|
160
|
-
}
|
|
161
|
-
catch {
|
|
162
|
-
params = {};
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
else if (input.body && typeof input.body === 'object') {
|
|
166
|
-
params = input.body;
|
|
167
|
-
}
|
|
168
|
-
// Get workflow ID from path parameters
|
|
169
|
-
const workflowId = input.pathParameters?.name ||
|
|
170
|
-
input.pathParameters?.workflow ||
|
|
171
|
-
input.pathParameters?.id ||
|
|
172
|
-
'';
|
|
173
|
-
const includeTrace = input.queryStringParameters?.trace === 'true';
|
|
174
|
-
const isProduction = input.requestContext?.stage === 'prod' || input.requestContext?.stage === 'production';
|
|
175
|
-
return {
|
|
176
|
-
workflowId,
|
|
177
|
-
params,
|
|
178
|
-
context: this.createContext('lambda', {
|
|
179
|
-
requestId: input.requestContext?.requestId,
|
|
180
|
-
includeTrace,
|
|
181
|
-
environment: isProduction ? 'production' : 'development',
|
|
182
|
-
}),
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Vercel serverless function request adapter
|
|
188
|
-
*/
|
|
189
|
-
export class VercelRequestAdapter extends BaseRequestAdapter {
|
|
190
|
-
parseRequest(input) {
|
|
191
|
-
// Workflow ID comes from the file-based routing in Vercel
|
|
192
|
-
// The caller should provide it, or we extract from query
|
|
193
|
-
const workflowId = input.query.workflow || input.query.name || '';
|
|
194
|
-
const includeTrace = input.query.trace === 'true';
|
|
195
|
-
return {
|
|
196
|
-
workflowId,
|
|
197
|
-
params: input.body || {},
|
|
198
|
-
context: this.createContext('vercel', {
|
|
199
|
-
requestId: input.headers['x-vercel-id'],
|
|
200
|
-
includeTrace,
|
|
201
|
-
}),
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Cloudflare Workers request adapter
|
|
207
|
-
*/
|
|
208
|
-
export class CloudflareRequestAdapter extends BaseRequestAdapter {
|
|
209
|
-
async parseRequestAsync(input) {
|
|
210
|
-
// Parse body
|
|
211
|
-
let params = {};
|
|
212
|
-
try {
|
|
213
|
-
params = await input.request.json();
|
|
214
|
-
}
|
|
215
|
-
catch {
|
|
216
|
-
params = {};
|
|
217
|
-
}
|
|
218
|
-
// Extract workflow ID from URL path
|
|
219
|
-
const url = new URL(input.request.url);
|
|
220
|
-
const pathParts = url.pathname.split('/').filter(Boolean);
|
|
221
|
-
const workflowId = pathParts[pathParts.length - 1] || '';
|
|
222
|
-
const includeTrace = url.searchParams.get('trace') === 'true';
|
|
223
|
-
return {
|
|
224
|
-
workflowId,
|
|
225
|
-
params,
|
|
226
|
-
context: this.createContext('cloudflare', {
|
|
227
|
-
requestId: input.request.headers.get('cf-ray') || undefined,
|
|
228
|
-
includeTrace,
|
|
229
|
-
}),
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
// Sync version throws - use parseRequestAsync for Cloudflare
|
|
233
|
-
parseRequest(_input) {
|
|
234
|
-
throw new Error('Use parseRequestAsync for Cloudflare Workers');
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
148
|
export function createAdapter(source) {
|
|
238
149
|
switch (source) {
|
|
239
150
|
case 'cli':
|
|
240
151
|
return new CliRequestAdapter();
|
|
241
152
|
case 'http':
|
|
242
153
|
return new HttpRequestAdapter();
|
|
243
|
-
case 'lambda':
|
|
244
|
-
return new LambdaRequestAdapter();
|
|
245
|
-
case 'vercel':
|
|
246
|
-
return new VercelRequestAdapter();
|
|
247
|
-
case 'cloudflare':
|
|
248
|
-
return new CloudflareRequestAdapter();
|
|
249
154
|
}
|
|
250
155
|
}
|
|
251
156
|
//# sourceMappingURL=adapters.js.map
|
|
@@ -27,21 +27,6 @@ export declare function formatHttpResponse<T>(response: WorkflowResponse<T>): {
|
|
|
27
27
|
body: Record<string, unknown>;
|
|
28
28
|
headers: Record<string, string>;
|
|
29
29
|
};
|
|
30
|
-
/**
|
|
31
|
-
* Format response for AWS Lambda (API Gateway response format)
|
|
32
|
-
*/
|
|
33
|
-
export declare function formatLambdaResponse<T>(response: WorkflowResponse<T>): {
|
|
34
|
-
statusCode: number;
|
|
35
|
-
headers: Record<string, string>;
|
|
36
|
-
body: string;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Format response for Cloudflare Workers (returns Response object constructor args)
|
|
40
|
-
*/
|
|
41
|
-
export declare function formatCloudflareResponse<T>(response: WorkflowResponse<T>): {
|
|
42
|
-
body: string;
|
|
43
|
-
init: ResponseInit;
|
|
44
|
-
};
|
|
45
30
|
/**
|
|
46
31
|
* Format error for consistent error responses
|
|
47
32
|
*/
|
|
@@ -117,30 +117,6 @@ export function formatHttpResponse(response) {
|
|
|
117
117
|
headers,
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
|
-
/**
|
|
121
|
-
* Format response for AWS Lambda (API Gateway response format)
|
|
122
|
-
*/
|
|
123
|
-
export function formatLambdaResponse(response) {
|
|
124
|
-
const httpResponse = formatHttpResponse(response);
|
|
125
|
-
return {
|
|
126
|
-
statusCode: httpResponse.statusCode,
|
|
127
|
-
headers: httpResponse.headers,
|
|
128
|
-
body: JSON.stringify(httpResponse.body),
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Format response for Cloudflare Workers (returns Response object constructor args)
|
|
133
|
-
*/
|
|
134
|
-
export function formatCloudflareResponse(response) {
|
|
135
|
-
const httpResponse = formatHttpResponse(response);
|
|
136
|
-
return {
|
|
137
|
-
body: JSON.stringify(httpResponse.body),
|
|
138
|
-
init: {
|
|
139
|
-
status: httpResponse.statusCode,
|
|
140
|
-
headers: httpResponse.headers,
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
120
|
/**
|
|
145
121
|
* Format error for consistent error responses
|
|
146
122
|
*/
|
|
@@ -5,19 +5,21 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module deployment
|
|
7
7
|
*/
|
|
8
|
-
export type { ExecutionSource, Environment, ExecutionContext, WorkflowRequest, WorkflowResponse, WorkflowError, WorkflowErrorCode, ValidationResult, ValidationError, CliInput, HttpInput,
|
|
8
|
+
export type { ExecutionSource, Environment, ExecutionContext, WorkflowRequest, WorkflowResponse, WorkflowError, WorkflowErrorCode, ValidationResult, ValidationError, CliInput, HttpInput, AdapterInput, } from './types.js';
|
|
9
9
|
export { UnifiedWorkflowExecutor, createExecutor, type ExecutorOptions } from './core/executor.js';
|
|
10
|
-
export { type RequestAdapter, CliRequestAdapter, HttpRequestAdapter,
|
|
11
|
-
export { formatCliResponse, formatHttpResponse,
|
|
10
|
+
export { type RequestAdapter, CliRequestAdapter, HttpRequestAdapter, createAdapter, } from './core/adapters.js';
|
|
11
|
+
export { formatCliResponse, formatHttpResponse, formatError, type CliOutputOptions, } from './core/formatters.js';
|
|
12
12
|
export type { DeploymentConfig, ServerConfig, ExecutionConfig, SecretsConfig, CorsConfig, RetryConfig, PartialDeploymentConfig, CliConfigOverrides, } from './config/types.js';
|
|
13
13
|
export { DEFAULT_CONFIG, DEFAULT_SERVER_CONFIG, DEFAULT_EXECUTION_CONFIG, getDefaultConfig, } from './config/defaults.js';
|
|
14
14
|
export { loadConfig, loadConfigSync, getConfigValue } from './config/loader.js';
|
|
15
15
|
export { OpenAPIGenerator, generateOpenAPIJson, generateOpenAPIYaml, type OpenAPIDocument, type OpenAPIInfo, type OpenAPIServer, type GeneratorOptions, } from './openapi/generator.js';
|
|
16
16
|
export { SchemaConverter, schemaConverter, type OpenAPISchema, } from './openapi/schema-converter.js';
|
|
17
17
|
export { type ExportTarget, type ExportOptions, type ExportArtifacts, type GeneratedFile, type DeployInstructions, type DeploySchema, type DeploySchemaField, type CompiledWorkflow, type MultiWorkflowArtifacts, type NodeTypeInfo, type NodeTypeExportOptions, type NodeTypeArtifacts, type BundleWorkflow, type BundleNodeType, type BundleArtifacts, BaseExportTarget, ExportTargetRegistry, } from './targets/base.js';
|
|
18
|
-
|
|
18
|
+
/** @deprecated Import from '@synergenius/flow-weaver/extensions/cicd' instead */
|
|
19
|
+
export { isCICDWorkflow } from '../extensions/cicd/detection.js';
|
|
19
20
|
export { generateStandaloneRuntimeModule } from '../api/inline-runtime.js';
|
|
20
|
-
|
|
21
|
+
/** @deprecated Import from '@synergenius/flow-weaver/extensions/cicd' instead */
|
|
22
|
+
export { BaseCICDTarget, NODE_ACTION_MAP, type CICDStep, type CICDJob, type ActionMapping, } from '../extensions/cicd/base-target.js';
|
|
21
23
|
import { ExportTargetRegistry } from './targets/base.js';
|
|
22
24
|
/**
|
|
23
25
|
* Create an export target registry via marketplace discovery.
|
package/dist/deployment/index.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
// Core - Executor
|
|
9
9
|
export { UnifiedWorkflowExecutor, createExecutor } from './core/executor.js';
|
|
10
10
|
// Core - Adapters
|
|
11
|
-
export { CliRequestAdapter, HttpRequestAdapter,
|
|
11
|
+
export { CliRequestAdapter, HttpRequestAdapter, createAdapter, } from './core/adapters.js';
|
|
12
12
|
// Core - Formatters
|
|
13
|
-
export { formatCliResponse, formatHttpResponse,
|
|
13
|
+
export { formatCliResponse, formatHttpResponse, formatError, } from './core/formatters.js';
|
|
14
14
|
export { DEFAULT_CONFIG, DEFAULT_SERVER_CONFIG, DEFAULT_EXECUTION_CONFIG, getDefaultConfig, } from './config/defaults.js';
|
|
15
15
|
export { loadConfig, loadConfigSync, getConfigValue } from './config/loader.js';
|
|
16
16
|
// OpenAPI
|
|
@@ -19,10 +19,13 @@ export { SchemaConverter, schemaConverter, } from './openapi/schema-converter.js
|
|
|
19
19
|
// Export Targets
|
|
20
20
|
export { BaseExportTarget, ExportTargetRegistry, } from './targets/base.js';
|
|
21
21
|
// Utilities needed by export target packs
|
|
22
|
-
|
|
22
|
+
/** @deprecated Import from '@synergenius/flow-weaver/extensions/cicd' instead */
|
|
23
|
+
export { isCICDWorkflow } from '../extensions/cicd/detection.js';
|
|
23
24
|
export { generateStandaloneRuntimeModule } from '../api/inline-runtime.js';
|
|
24
|
-
|
|
25
|
+
/** @deprecated Import from '@synergenius/flow-weaver/extensions/cicd' instead */
|
|
26
|
+
export { BaseCICDTarget, NODE_ACTION_MAP, } from '../extensions/cicd/base-target.js';
|
|
25
27
|
import * as path from 'path';
|
|
28
|
+
import { pathToFileURL } from 'url';
|
|
26
29
|
import { ExportTargetRegistry } from './targets/base.js';
|
|
27
30
|
/**
|
|
28
31
|
* Create an export target registry via marketplace discovery.
|
|
@@ -45,7 +48,7 @@ export async function createTargetRegistry(projectDir) {
|
|
|
45
48
|
const filePath = path.join(pkg.path, def.file);
|
|
46
49
|
// Dynamic import is async, so we resolve the module here
|
|
47
50
|
// but defer instantiation to the lazy factory
|
|
48
|
-
const mod = await import(filePath);
|
|
51
|
+
const mod = await import(pathToFileURL(filePath).href);
|
|
49
52
|
const TargetClass = def.exportName ? mod[def.exportName] : mod.default;
|
|
50
53
|
registry.register(def.name, () => new TargetClass());
|
|
51
54
|
}
|