@synergenius/flow-weaver 0.13.2 → 0.14.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.
Files changed (57) hide show
  1. package/README.md +41 -2
  2. package/dist/api/validate.js +8 -2
  3. package/dist/ast/types.d.ts +120 -0
  4. package/dist/chevrotain-parser/node-parser.d.ts +4 -0
  5. package/dist/chevrotain-parser/node-parser.js +41 -1
  6. package/dist/chevrotain-parser/port-parser.d.ts +1 -0
  7. package/dist/chevrotain-parser/port-parser.js +22 -2
  8. package/dist/chevrotain-parser/tokens.d.ts +3 -0
  9. package/dist/chevrotain-parser/tokens.js +15 -0
  10. package/dist/cli/commands/export.js +25 -38
  11. package/dist/cli/flow-weaver.mjs +63703 -54297
  12. package/dist/cli/templates/index.js +9 -0
  13. package/dist/cli/templates/workflows/cicd-docker.d.ts +9 -0
  14. package/dist/cli/templates/workflows/cicd-docker.js +110 -0
  15. package/dist/cli/templates/workflows/cicd-matrix.d.ts +9 -0
  16. package/dist/cli/templates/workflows/cicd-matrix.js +112 -0
  17. package/dist/cli/templates/workflows/cicd-multi-env.d.ts +9 -0
  18. package/dist/cli/templates/workflows/cicd-multi-env.js +118 -0
  19. package/dist/cli/templates/workflows/cicd-test-deploy.d.ts +11 -0
  20. package/dist/cli/templates/workflows/cicd-test-deploy.js +149 -0
  21. package/dist/constants.js +7 -0
  22. package/dist/deployment/index.d.ts +14 -7
  23. package/dist/deployment/index.js +29 -17
  24. package/dist/deployment/targets/base.d.ts +27 -2
  25. package/dist/deployment/targets/base.js +38 -6
  26. package/dist/deployment/targets/cicd-base.d.ts +111 -0
  27. package/dist/deployment/targets/cicd-base.js +357 -0
  28. package/dist/deployment/targets/cloudflare.d.ts +6 -0
  29. package/dist/deployment/targets/cloudflare.js +3 -0
  30. package/dist/deployment/targets/github-actions.d.ts +54 -0
  31. package/dist/deployment/targets/github-actions.js +366 -0
  32. package/dist/deployment/targets/gitlab-ci.d.ts +65 -0
  33. package/dist/deployment/targets/gitlab-ci.js +374 -0
  34. package/dist/deployment/targets/inngest.d.ts +25 -0
  35. package/dist/deployment/targets/inngest.js +10 -1
  36. package/dist/deployment/targets/lambda.d.ts +17 -0
  37. package/dist/deployment/targets/lambda.js +5 -0
  38. package/dist/deployment/targets/vercel.d.ts +16 -0
  39. package/dist/deployment/targets/vercel.js +5 -0
  40. package/dist/diagram/geometry.js +13 -5
  41. package/dist/export/index.d.ts +13 -9
  42. package/dist/export/index.js +129 -997
  43. package/dist/generated-version.d.ts +1 -1
  44. package/dist/generated-version.js +1 -1
  45. package/dist/jsdoc-parser.d.ts +130 -0
  46. package/dist/jsdoc-parser.js +408 -4
  47. package/dist/marketplace/index.d.ts +1 -1
  48. package/dist/marketplace/types.d.ts +13 -0
  49. package/dist/marketplace/validator.js +21 -2
  50. package/dist/mcp/tools-export.js +56 -14
  51. package/dist/parser.js +28 -1
  52. package/dist/validation/cicd-detection.d.ts +33 -0
  53. package/dist/validation/cicd-detection.js +76 -0
  54. package/dist/validation/cicd-rules.d.ts +62 -0
  55. package/dist/validation/cicd-rules.js +284 -0
  56. package/docs/reference/scaffold.md +4 -0
  57. package/package.json +4 -3
@@ -15,6 +15,11 @@ import { webhookTemplate } from './workflows/webhook.js';
15
15
  import { errorHandlerTemplate } from './workflows/error-handler.js';
16
16
  import { aiAgentDurableTemplate } from './workflows/ai-agent-durable.js';
17
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';
18
23
  // Import node templates
19
24
  import { validatorNodeTemplate } from './nodes/validator.js';
20
25
  import { transformerNodeTemplate } from './nodes/transformer.js';
@@ -46,6 +51,10 @@ export const workflowTemplates = [
46
51
  errorHandlerTemplate,
47
52
  aiAgentDurableTemplate,
48
53
  aiPipelineDurableTemplate,
54
+ cicdTestDeployTemplate,
55
+ cicdDockerTemplate,
56
+ cicdMultiEnvTemplate,
57
+ cicdMatrixTemplate,
49
58
  ];
50
59
  /**
51
60
  * All available node templates
@@ -0,0 +1,9 @@
1
+ /**
2
+ * CI/CD: Docker Pipeline template
3
+ *
4
+ * Generates a Flow Weaver workflow for building and pushing Docker images:
5
+ * checkout → docker-login → docker-build → docker-push
6
+ */
7
+ import type { WorkflowTemplate } from '../index.js';
8
+ export declare const cicdDockerTemplate: WorkflowTemplate;
9
+ //# sourceMappingURL=cicd-docker.d.ts.map
@@ -0,0 +1,110 @@
1
+ /**
2
+ * CI/CD: Docker Pipeline template
3
+ *
4
+ * Generates a Flow Weaver workflow for building and pushing Docker images:
5
+ * checkout → docker-login → docker-build → docker-push
6
+ */
7
+ const configSchema = {
8
+ platform: {
9
+ type: 'select',
10
+ label: 'CI/CD Platform',
11
+ default: 'github-actions',
12
+ options: [
13
+ { value: 'github-actions', label: 'GitHub Actions' },
14
+ { value: 'gitlab-ci', label: 'GitLab CI' },
15
+ ],
16
+ },
17
+ registry: {
18
+ type: 'select',
19
+ label: 'Container Registry',
20
+ default: 'ghcr',
21
+ options: [
22
+ { value: 'ghcr', label: 'GitHub Container Registry (ghcr.io)' },
23
+ { value: 'dockerhub', label: 'Docker Hub' },
24
+ { value: 'ecr', label: 'AWS ECR' },
25
+ { value: 'gcr', label: 'Google Container Registry' },
26
+ ],
27
+ },
28
+ };
29
+ export const cicdDockerTemplate = {
30
+ id: 'cicd-docker',
31
+ name: 'CI/CD: Docker Pipeline',
32
+ description: 'Build and push Docker images to a container registry',
33
+ category: 'automation',
34
+ configSchema,
35
+ generate: (opts) => {
36
+ const name = opts.workflowName || 'dockerPipeline';
37
+ const registry = opts.config?.registry || 'ghcr';
38
+ const registrySecrets = {
39
+ ghcr: ' * @secret GITHUB_TOKEN - GitHub token for ghcr.io',
40
+ dockerhub: ' * @secret DOCKER_USERNAME - Docker Hub username\n * @secret DOCKER_PASSWORD - Docker Hub password',
41
+ ecr: ' * @secret AWS_ACCESS_KEY_ID - AWS access key\n * @secret AWS_SECRET_ACCESS_KEY - AWS secret key',
42
+ gcr: ' * @secret GCR_KEY - Google Cloud service account key',
43
+ };
44
+ const registryConnect = {
45
+ ghcr: ' * @connect secret:GITHUB_TOKEN -> login.token',
46
+ dockerhub: ' * @connect secret:DOCKER_USERNAME -> login.username\n * @connect secret:DOCKER_PASSWORD -> login.password',
47
+ ecr: ' * @connect secret:AWS_ACCESS_KEY_ID -> login.accessKey\n * @connect secret:AWS_SECRET_ACCESS_KEY -> login.secretKey',
48
+ gcr: ' * @connect secret:GCR_KEY -> login.serviceAccountKey',
49
+ };
50
+ return `/** @flowWeaver nodeType
51
+ * @expression
52
+ * @label Checkout code
53
+ */
54
+ function checkout(): { repo: string } { return { repo: '.' }; }
55
+
56
+ /** @flowWeaver nodeType
57
+ * @expression
58
+ * @label Docker login
59
+ */
60
+ function dockerLogin(${registry === 'dockerhub' ? 'username: string = \'\', password: string = \'\'' : registry === 'ecr' ? 'accessKey: string = \'\', secretKey: string = \'\'' : registry === 'gcr' ? 'serviceAccountKey: string = \'\'' : 'token: string = \'\''}): { loggedIn: boolean } { return { loggedIn: true }; }
61
+
62
+ /** @flowWeaver nodeType
63
+ * @expression
64
+ * @label Docker build
65
+ */
66
+ function dockerBuild(): { imageTag: string } { return { imageTag: 'latest' }; }
67
+
68
+ /** @flowWeaver nodeType
69
+ * @expression
70
+ * @label Docker push
71
+ */
72
+ function dockerPush(): { digest: string } { return { digest: 'sha256:abc123' }; }
73
+
74
+ /**
75
+ * @flowWeaver workflow
76
+ * @trigger push branches="main" paths="Dockerfile,src/**"
77
+ * @trigger tag pattern="v*"
78
+ * @runner ubuntu-latest
79
+ ${registrySecrets[registry]}
80
+ *
81
+ * @node co checkout [job: "build"] [position: 270 0]
82
+ * @node login dockerLogin [job: "build"] [position: 540 0]
83
+ * @node build dockerBuild [job: "build"] [position: 810 0]
84
+ * @node push dockerPush [job: "build"] [position: 1080 0]
85
+ *
86
+ * @path Start -> co -> login -> build -> push -> Exit
87
+ * @position Start 0 0
88
+ * @position Exit 1350 0
89
+ ${registryConnect[registry]}
90
+ * @connect push.digest -> Exit.imageDigest
91
+ *
92
+ * @param execute [order:-1] - Execute
93
+ * @param params [order:0] - Params
94
+ * @returns onSuccess [order:-2] - On Success
95
+ * @returns onFailure [order:-1] - On Failure
96
+ * @returns imageDigest [order:0] - Docker image digest
97
+ */
98
+ export async function ${name}(
99
+ execute: boolean,
100
+ params: Record<string, never> = {},
101
+ ): Promise<{ onSuccess: boolean; onFailure: boolean; imageDigest: string | null }> {
102
+ // @flow-weaver-body-start
103
+ throw new Error('Compile with: npx flow-weaver compile <this-file>');
104
+ // @flow-weaver-body-end
105
+ return { onSuccess: false, onFailure: true, imageDigest: null };
106
+ }
107
+ `;
108
+ },
109
+ };
110
+ //# sourceMappingURL=cicd-docker.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * CI/CD: Matrix Testing template
3
+ *
4
+ * Generates a pipeline with matrix strategy for testing across
5
+ * multiple Node.js versions and/or operating systems.
6
+ */
7
+ import type { WorkflowTemplate } from '../index.js';
8
+ export declare const cicdMatrixTemplate: WorkflowTemplate;
9
+ //# sourceMappingURL=cicd-matrix.d.ts.map
@@ -0,0 +1,112 @@
1
+ /**
2
+ * CI/CD: Matrix Testing template
3
+ *
4
+ * Generates a pipeline with matrix strategy for testing across
5
+ * multiple Node.js versions and/or operating systems.
6
+ */
7
+ const configSchema = {
8
+ platform: {
9
+ type: 'select',
10
+ label: 'CI/CD Platform',
11
+ default: 'github-actions',
12
+ options: [
13
+ { value: 'github-actions', label: 'GitHub Actions' },
14
+ { value: 'gitlab-ci', label: 'GitLab CI' },
15
+ ],
16
+ },
17
+ versions: {
18
+ type: 'string',
19
+ label: 'Node.js Versions',
20
+ description: 'Comma-separated versions to test',
21
+ default: '18,20,22',
22
+ },
23
+ operatingSystems: {
24
+ type: 'string',
25
+ label: 'Operating Systems',
26
+ description: 'Comma-separated OS labels',
27
+ default: 'ubuntu-latest',
28
+ },
29
+ };
30
+ export const cicdMatrixTemplate = {
31
+ id: 'cicd-matrix',
32
+ name: 'CI/CD: Matrix Testing',
33
+ description: 'Test across multiple Node.js versions and operating systems',
34
+ category: 'automation',
35
+ configSchema,
36
+ generate: (opts) => {
37
+ const name = opts.workflowName || 'matrixTest';
38
+ const versions = (opts.config?.versions || '18,20,22')
39
+ .split(',')
40
+ .map((v) => v.trim());
41
+ const oses = (opts.config?.operatingSystems || 'ubuntu-latest')
42
+ .split(',')
43
+ .map((o) => o.trim());
44
+ const matrixNode = ` * @matrix node="${versions.join(',')}" os="${oses.join(',')}"`;
45
+ return `/** @flowWeaver nodeType
46
+ * @expression
47
+ * @label Checkout code
48
+ */
49
+ function checkout(): { repo: string } { return { repo: '.' }; }
50
+
51
+ /** @flowWeaver nodeType
52
+ * @expression
53
+ * @label Setup Node.js
54
+ */
55
+ function setupNode(): { nodeVersion: string } { return { nodeVersion: '20' }; }
56
+
57
+ /** @flowWeaver nodeType
58
+ * @expression
59
+ * @label Install dependencies
60
+ */
61
+ function npmInstall(): { installed: boolean } { return { installed: true }; }
62
+
63
+ /** @flowWeaver nodeType
64
+ * @expression
65
+ * @label Run shell command
66
+ */
67
+ function shellCommand(): { exitCode: number } { return { exitCode: 0 }; }
68
+
69
+ /** @flowWeaver nodeType
70
+ * @expression
71
+ * @label Run tests
72
+ */
73
+ function npmTest(): { exitCode: number } { return { exitCode: 0 }; }
74
+
75
+ /**
76
+ * @flowWeaver workflow
77
+ * @trigger push branches="main"
78
+ * @trigger pull_request branches="main"
79
+ * @runner ubuntu-latest
80
+ ${matrixNode}
81
+ * @cache npm key="package-lock.json"
82
+ *
83
+ * @node co checkout [job: "test"] [position: 270 0]
84
+ * @node setup setupNode [job: "test"] [position: 540 0]
85
+ * @node install npmInstall [job: "test"] [position: 810 0]
86
+ * @node lint shellCommand [job: "test"] [position: 1080 0]
87
+ * @node test npmTest [job: "test"] [position: 1350 0]
88
+ *
89
+ * @path Start -> co -> setup -> install -> lint -> test -> Exit
90
+ * @position Start 0 0
91
+ * @position Exit 1620 0
92
+ * @connect test.exitCode -> Exit.testResult
93
+ *
94
+ * @param execute [order:-1] - Execute
95
+ * @param params [order:0] - Params
96
+ * @returns onSuccess [order:-2] - On Success
97
+ * @returns onFailure [order:-1] - On Failure
98
+ * @returns testResult [order:0] - Test result
99
+ */
100
+ export async function ${name}(
101
+ execute: boolean,
102
+ params: Record<string, never> = {},
103
+ ): Promise<{ onSuccess: boolean; onFailure: boolean; testResult: string | null }> {
104
+ // @flow-weaver-body-start
105
+ throw new Error('Compile with: npx flow-weaver compile <this-file>');
106
+ // @flow-weaver-body-end
107
+ return { onSuccess: false, onFailure: true, testResult: null };
108
+ }
109
+ `;
110
+ },
111
+ };
112
+ //# sourceMappingURL=cicd-matrix.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * CI/CD: Multi-Environment Deploy template
3
+ *
4
+ * Generates a pipeline with staging → production promotion:
5
+ * test → deploy-staging → deploy-production (with environment protection)
6
+ */
7
+ import type { WorkflowTemplate } from '../index.js';
8
+ export declare const cicdMultiEnvTemplate: WorkflowTemplate;
9
+ //# sourceMappingURL=cicd-multi-env.d.ts.map
@@ -0,0 +1,118 @@
1
+ /**
2
+ * CI/CD: Multi-Environment Deploy template
3
+ *
4
+ * Generates a pipeline with staging → production promotion:
5
+ * test → deploy-staging → deploy-production (with environment protection)
6
+ */
7
+ const configSchema = {
8
+ platform: {
9
+ type: 'select',
10
+ label: 'CI/CD Platform',
11
+ default: 'github-actions',
12
+ options: [
13
+ { value: 'github-actions', label: 'GitHub Actions' },
14
+ { value: 'gitlab-ci', label: 'GitLab CI' },
15
+ ],
16
+ },
17
+ environments: {
18
+ type: 'string',
19
+ label: 'Environments',
20
+ description: 'Comma-separated environment names',
21
+ default: 'staging,production',
22
+ },
23
+ };
24
+ export const cicdMultiEnvTemplate = {
25
+ id: 'cicd-multi-env',
26
+ name: 'CI/CD: Multi-Environment',
27
+ description: 'Multi-environment deployment pipeline with staging and production stages',
28
+ category: 'automation',
29
+ configSchema,
30
+ generate: (opts) => {
31
+ const name = opts.workflowName || 'multiEnvPipeline';
32
+ const envs = (opts.config?.environments || 'staging,production')
33
+ .split(',')
34
+ .map((e) => e.trim());
35
+ const envAnnotations = envs
36
+ .map((env) => ` * @environment ${env} url="https://${env}.example.com"`)
37
+ .join('\n');
38
+ let x = 270;
39
+ const nodeAnnotations = [];
40
+ const pathParts = ['Start'];
41
+ // Test job
42
+ nodeAnnotations.push(` * @node co checkout [job: "test"] [position: ${x} 0]`);
43
+ pathParts.push('co');
44
+ x += 270;
45
+ nodeAnnotations.push(` * @node test npmTest [job: "test"] [position: ${x} 0]`);
46
+ pathParts.push('test');
47
+ x += 270;
48
+ nodeAnnotations.push(` * @node build npmBuild [job: "build"] [position: ${x} 0]`);
49
+ pathParts.push('build');
50
+ x += 270;
51
+ // Deploy jobs for each environment
52
+ for (const env of envs) {
53
+ const id = `deploy_${env.replace(/[^a-zA-Z0-9]/g, '_')}`;
54
+ nodeAnnotations.push(` * @node ${id} deploySsh [job: "deploy-${env}"] [environment: "${env}"] [position: ${x} 0]`);
55
+ pathParts.push(id);
56
+ x += 270;
57
+ }
58
+ pathParts.push('Exit');
59
+ return `/** @flowWeaver nodeType
60
+ * @expression
61
+ * @label Checkout code
62
+ */
63
+ function checkout(): { repo: string } { return { repo: '.' }; }
64
+
65
+ /** @flowWeaver nodeType
66
+ * @expression
67
+ * @label Run tests
68
+ */
69
+ function npmTest(): { exitCode: number } { return { exitCode: 0 }; }
70
+
71
+ /** @flowWeaver nodeType
72
+ * @expression
73
+ * @label Build project
74
+ */
75
+ function npmBuild(): { output: string } { return { output: 'dist/' }; }
76
+
77
+ /** @flowWeaver nodeType
78
+ * @expression
79
+ * @label Deploy via SSH
80
+ */
81
+ function deploySsh(sshKey: string = ''): { result: string } { return { result: 'deployed' }; }
82
+
83
+ /**
84
+ * @flowWeaver workflow
85
+ * @trigger push branches="main"
86
+ * @runner ubuntu-latest
87
+ * @secret DEPLOY_KEY - SSH deployment key
88
+ ${envAnnotations}
89
+ * @cache npm key="package-lock.json"
90
+ * @artifact dist path="dist/" retention=3
91
+ *
92
+ ${nodeAnnotations.join('\n')}
93
+ *
94
+ * @path ${pathParts.join(' -> ')}
95
+ * @position Start 0 0
96
+ * @position Exit ${x} 0
97
+ * @connect secret:DEPLOY_KEY -> ${`deploy_${envs[0].replace(/[^a-zA-Z0-9]/g, '_')}`}.sshKey
98
+ ${envs.slice(1).map((env) => ` * @connect secret:DEPLOY_KEY -> deploy_${env.replace(/[^a-zA-Z0-9]/g, '_')}.sshKey`).join('\n')}
99
+ *
100
+ * @param execute [order:-1] - Execute
101
+ * @param params [order:0] - Params
102
+ * @returns onSuccess [order:-2] - On Success
103
+ * @returns onFailure [order:-1] - On Failure
104
+ * @returns summary [order:0] - Deployment summary
105
+ */
106
+ export async function ${name}(
107
+ execute: boolean,
108
+ params: Record<string, never> = {},
109
+ ): Promise<{ onSuccess: boolean; onFailure: boolean; summary: string | null }> {
110
+ // @flow-weaver-body-start
111
+ throw new Error('Compile with: npx flow-weaver compile <this-file>');
112
+ // @flow-weaver-body-end
113
+ return { onSuccess: false, onFailure: true, summary: null };
114
+ }
115
+ `;
116
+ },
117
+ };
118
+ //# sourceMappingURL=cicd-multi-env.js.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * CI/CD: Test and Deploy template
3
+ *
4
+ * Generates a Flow Weaver workflow for a standard CI/CD pipeline:
5
+ * checkout → setup → install → test → build → deploy
6
+ *
7
+ * Exports to GitHub Actions or GitLab CI via `fw_export`.
8
+ */
9
+ import type { WorkflowTemplate } from '../index.js';
10
+ export declare const cicdTestDeployTemplate: WorkflowTemplate;
11
+ //# sourceMappingURL=cicd-test-deploy.d.ts.map
@@ -0,0 +1,149 @@
1
+ /**
2
+ * CI/CD: Test and Deploy template
3
+ *
4
+ * Generates a Flow Weaver workflow for a standard CI/CD pipeline:
5
+ * checkout → setup → install → test → build → deploy
6
+ *
7
+ * Exports to GitHub Actions or GitLab CI via `fw_export`.
8
+ */
9
+ const configSchema = {
10
+ platform: {
11
+ type: 'select',
12
+ label: 'CI/CD Platform',
13
+ description: 'Target CI/CD platform for export',
14
+ default: 'github-actions',
15
+ options: [
16
+ { value: 'github-actions', label: 'GitHub Actions' },
17
+ { value: 'gitlab-ci', label: 'GitLab CI' },
18
+ ],
19
+ },
20
+ nodeVersion: {
21
+ type: 'string',
22
+ label: 'Node.js Version',
23
+ default: '20',
24
+ description: 'Node.js version for setup-node step',
25
+ },
26
+ deployTarget: {
27
+ type: 'select',
28
+ label: 'Deploy Method',
29
+ default: 'ssh',
30
+ options: [
31
+ { value: 'ssh', label: 'SSH Deploy' },
32
+ { value: 's3', label: 'AWS S3' },
33
+ { value: 'none', label: 'No deploy (test only)' },
34
+ ],
35
+ },
36
+ };
37
+ export const cicdTestDeployTemplate = {
38
+ id: 'cicd-test-deploy',
39
+ name: 'CI/CD: Test and Deploy',
40
+ description: 'Standard test-and-deploy pipeline with checkout, setup, test, build, and deploy stages',
41
+ category: 'automation',
42
+ configSchema,
43
+ generate: (opts) => {
44
+ const name = opts.workflowName || 'ciPipeline';
45
+ const deployTarget = opts.config?.deployTarget || 'ssh';
46
+ const hasDeploy = deployTarget !== 'none';
47
+ const deployNodeType = deployTarget === 'ssh' ? 'deploySsh' : 'deployS3';
48
+ const deployNode = hasDeploy
49
+ ? `\n * @node deploy ${deployNodeType} [job: "deploy"] [environment: "production"] [position: 1620 0]`
50
+ : '';
51
+ const deployPath = hasDeploy ? ' -> deploy' : '';
52
+ const deploySecret = deployTarget === 'ssh'
53
+ ? '\n * @secret DEPLOY_KEY - SSH key for deployment'
54
+ : deployTarget === 's3'
55
+ ? '\n * @secret AWS_ACCESS_KEY_ID - AWS access key\n * @secret AWS_SECRET_ACCESS_KEY - AWS secret key'
56
+ : '';
57
+ const deployConnect = deployTarget === 'ssh'
58
+ ? '\n * @connect secret:DEPLOY_KEY -> deploy.sshKey'
59
+ : deployTarget === 's3'
60
+ ? '\n * @connect secret:AWS_ACCESS_KEY_ID -> deploy.accessKey\n * @connect secret:AWS_SECRET_ACCESS_KEY -> deploy.secretKey'
61
+ : '';
62
+ const deployReturns = hasDeploy ? '\n * @returns deployResult [order:3] - Deploy result' : '';
63
+ const deployConnect2 = hasDeploy ? '\n * @connect deploy.result -> Exit.deployResult' : '';
64
+ const deployStub = hasDeploy
65
+ ? deployTarget === 'ssh'
66
+ ? `
67
+ /** @flowWeaver nodeType
68
+ * @expression
69
+ * @label Deploy via SSH
70
+ */
71
+ function deploySsh(sshKey: string = ''): { result: string } { return { result: 'deployed' }; }
72
+ `
73
+ : `
74
+ /** @flowWeaver nodeType
75
+ * @expression
76
+ * @label Deploy to S3
77
+ */
78
+ function deployS3(accessKey: string = '', secretKey: string = ''): { result: string } { return { result: 'deployed' }; }
79
+ `
80
+ : '';
81
+ return `/** @flowWeaver nodeType
82
+ * @expression
83
+ * @label Checkout code
84
+ */
85
+ function checkout(): { repo: string } { return { repo: '.' }; }
86
+
87
+ /** @flowWeaver nodeType
88
+ * @expression
89
+ * @label Setup Node.js
90
+ */
91
+ function setupNode(): { nodeVersion: string } { return { nodeVersion: '20' }; }
92
+
93
+ /** @flowWeaver nodeType
94
+ * @expression
95
+ * @label Install dependencies
96
+ */
97
+ function npmInstall(npmToken: string = ''): { installed: boolean } { return { installed: true }; }
98
+
99
+ /** @flowWeaver nodeType
100
+ * @expression
101
+ * @label Run tests
102
+ */
103
+ function npmTest(): { exitCode: number } { return { exitCode: 0 }; }
104
+
105
+ /** @flowWeaver nodeType
106
+ * @expression
107
+ * @label Build project
108
+ */
109
+ function npmBuild(): { output: string } { return { output: 'dist/' }; }
110
+ ${deployStub}
111
+ /**
112
+ * @flowWeaver workflow
113
+ * @trigger push branches="main"
114
+ * @trigger pull_request branches="main"
115
+ * @runner ubuntu-latest
116
+ * @secret NPM_TOKEN - npm auth token${deploySecret}
117
+ * @cache npm key="package-lock.json"
118
+ *
119
+ * @node co checkout [job: "test"] [position: 270 0]
120
+ * @node setup setupNode [job: "test"] [position: 540 0]
121
+ * @node install npmInstall [job: "test"] [position: 810 0]
122
+ * @node test npmTest [job: "test"] [position: 1080 0]
123
+ * @node build npmBuild [job: "build"] [position: 1350 0]${deployNode}
124
+ *
125
+ * @path Start -> co -> setup -> install -> test -> build${deployPath} -> Exit
126
+ * @position Start 0 0
127
+ * @position Exit ${hasDeploy ? '1890' : '1620'} 0
128
+ * @connect secret:NPM_TOKEN -> install.npmToken${deployConnect}
129
+ * @connect build.output -> Exit.buildOutput${deployConnect2}
130
+ *
131
+ * @param execute [order:-1] - Execute
132
+ * @param params [order:0] - Params
133
+ * @returns onSuccess [order:-2] - On Success
134
+ * @returns onFailure [order:-1] - On Failure
135
+ * @returns buildOutput [order:0] - Build output path${deployReturns}
136
+ */
137
+ export async function ${name}(
138
+ execute: boolean,
139
+ params: Record<string, never> = {},
140
+ ): Promise<{ onSuccess: boolean; onFailure: boolean; buildOutput: string | null${hasDeploy ? '; deployResult: string | null' : ''} }> {
141
+ // @flow-weaver-body-start
142
+ throw new Error('Compile with: npx flow-weaver compile <this-file>');
143
+ // @flow-weaver-body-end
144
+ return { onSuccess: false, onFailure: true, buildOutput: null${hasDeploy ? ', deployResult: null' : ''} };
145
+ }
146
+ `;
147
+ },
148
+ };
149
+ //# sourceMappingURL=cicd-test-deploy.js.map
package/dist/constants.js CHANGED
@@ -130,12 +130,19 @@ export const VALID_NODE_COLORS = [
130
130
  export const KNOWN_NODETYPE_TAGS = new Set([
131
131
  'flowWeaver', 'name', 'label', 'description', 'color', 'icon', 'tag',
132
132
  'executeWhen', 'scope', 'expression', 'pullExecution', 'input', 'output', 'step',
133
+ // Deployment annotations
134
+ 'deploy',
133
135
  ]);
134
136
  export const KNOWN_WORKFLOW_TAGS = new Set([
135
137
  'flowWeaver', 'name', 'fwImport', 'description', 'strictTypes', 'autoConnect',
136
138
  'node', 'position', 'connect', 'scope', 'map', 'path', 'fanOut', 'fanIn',
137
139
  'coerce', 'trigger', 'cancelOn', 'retries', 'timeout', 'throttle', 'param',
138
140
  'return', 'returns',
141
+ // CI/CD annotations
142
+ 'secret', 'runner', 'cache', 'artifact', 'environment', 'matrix',
143
+ 'service', 'concurrency',
144
+ // Deployment annotations
145
+ 'deploy',
139
146
  ]);
140
147
  export const KNOWN_PATTERN_TAGS = new Set([
141
148
  'flowWeaver', 'name', 'description', 'node', 'position', 'connect', 'port',
@@ -14,18 +14,25 @@ export { DEFAULT_CONFIG, DEFAULT_SERVER_CONFIG, DEFAULT_EXECUTION_CONFIG, getDef
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
- export { type ExportTarget, type ExportOptions, type ExportArtifacts, type GeneratedFile, type DeployInstructions, BaseExportTarget, ExportTargetRegistry, } from './targets/base.js';
17
+ export { type ExportTarget, type ExportOptions, type ExportArtifacts, type GeneratedFile, type DeployInstructions, type DeploySchema, type DeploySchemaField, BaseExportTarget, ExportTargetRegistry, } from './targets/base.js';
18
18
  export { LambdaTarget } from './targets/lambda.js';
19
19
  export { VercelTarget } from './targets/vercel.js';
20
20
  export { CloudflareTarget } from './targets/cloudflare.js';
21
21
  export { InngestTarget } from './targets/inngest.js';
22
+ export { GitHubActionsTarget } from './targets/github-actions.js';
23
+ export { GitLabCITarget } from './targets/gitlab-ci.js';
24
+ export { BaseCICDTarget, NODE_ACTION_MAP } from './targets/cicd-base.js';
22
25
  import { ExportTargetRegistry } from './targets/base.js';
23
26
  /**
24
- * Default export target registry with all built-in targets
25
- */
26
- export declare function createTargetRegistry(): ExportTargetRegistry;
27
- /**
28
- * Get names of all supported export targets
27
+ * Create an export target registry via marketplace discovery.
28
+ *
29
+ * Scans `node_modules/` for installed `flowweaver-pack-*` packages that
30
+ * declare `exportTargets` in their `flowweaver.manifest.json`.
31
+ * Each target class is eagerly imported (to resolve the async import) but
32
+ * lazily instantiated — the constructor only runs when `registry.get()` is called.
33
+ *
34
+ * @param projectDir — project root to scan for installed packs.
35
+ * When omitted, returns an empty registry (useful for tests).
29
36
  */
30
- export declare function getSupportedTargetNames(): string[];
37
+ export declare function createTargetRegistry(projectDir?: string): Promise<ExportTargetRegistry>;
31
38
  //# sourceMappingURL=index.d.ts.map
@@ -18,31 +18,43 @@ export { OpenAPIGenerator, generateOpenAPIJson, generateOpenAPIYaml, } from './o
18
18
  export { SchemaConverter, schemaConverter, } from './openapi/schema-converter.js';
19
19
  // Export Targets
20
20
  export { BaseExportTarget, ExportTargetRegistry, } from './targets/base.js';
21
+ // Target implementations — still exported for direct use by pack authors and tests
21
22
  export { LambdaTarget } from './targets/lambda.js';
22
23
  export { VercelTarget } from './targets/vercel.js';
23
24
  export { CloudflareTarget } from './targets/cloudflare.js';
24
25
  export { InngestTarget } from './targets/inngest.js';
25
- // Convenience: Create a pre-configured target registry
26
+ export { GitHubActionsTarget } from './targets/github-actions.js';
27
+ export { GitLabCITarget } from './targets/gitlab-ci.js';
28
+ export { BaseCICDTarget, NODE_ACTION_MAP } from './targets/cicd-base.js';
29
+ import * as path from 'path';
26
30
  import { ExportTargetRegistry } from './targets/base.js';
27
- import { LambdaTarget } from './targets/lambda.js';
28
- import { VercelTarget } from './targets/vercel.js';
29
- import { CloudflareTarget } from './targets/cloudflare.js';
30
- import { InngestTarget } from './targets/inngest.js';
31
31
  /**
32
- * Default export target registry with all built-in targets
32
+ * Create an export target registry via marketplace discovery.
33
+ *
34
+ * Scans `node_modules/` for installed `flowweaver-pack-*` packages that
35
+ * declare `exportTargets` in their `flowweaver.manifest.json`.
36
+ * Each target class is eagerly imported (to resolve the async import) but
37
+ * lazily instantiated — the constructor only runs when `registry.get()` is called.
38
+ *
39
+ * @param projectDir — project root to scan for installed packs.
40
+ * When omitted, returns an empty registry (useful for tests).
33
41
  */
34
- export function createTargetRegistry() {
42
+ export async function createTargetRegistry(projectDir) {
35
43
  const registry = new ExportTargetRegistry();
36
- registry.register(new LambdaTarget());
37
- registry.register(new VercelTarget());
38
- registry.register(new CloudflareTarget());
39
- registry.register(new InngestTarget());
44
+ if (projectDir) {
45
+ const { listInstalledPackages } = await import('../marketplace/registry.js');
46
+ const packages = await listInstalledPackages(projectDir);
47
+ for (const pkg of packages) {
48
+ for (const def of pkg.manifest.exportTargets ?? []) {
49
+ const filePath = path.join(pkg.path, def.file);
50
+ // Dynamic import is async, so we resolve the module here
51
+ // but defer instantiation to the lazy factory
52
+ const mod = await import(filePath);
53
+ const TargetClass = def.exportName ? mod[def.exportName] : mod.default;
54
+ registry.register(def.name, () => new TargetClass());
55
+ }
56
+ }
57
+ }
40
58
  return registry;
41
59
  }
42
- /**
43
- * Get names of all supported export targets
44
- */
45
- export function getSupportedTargetNames() {
46
- return ['lambda', 'vercel', 'cloudflare', 'inngest'];
47
- }
48
60
  //# sourceMappingURL=index.js.map