@synergenius/flowweaver-pack-github-actions 0.1.1

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 ADDED
@@ -0,0 +1,204 @@
1
+ Flow Weaver Library License
2
+
3
+ Version 2.0, February 2026
4
+
5
+ ## Quick Reference (non-binding summary)
6
+
7
+ This table is provided for convenience only. In case of any conflict between
8
+ this summary and the license terms below, the license terms control.
9
+
10
+ Permitted:
11
+
12
+ Use Who Notes
13
+ ---------------------------------------- ---------------- ----------------------------------
14
+ Install and run locally Anyone No restrictions on local use
15
+ Compile workflows Anyone CLI, programmatic, scripts
16
+ Use generated output (code, artifacts) Anyone Output is unrestricted
17
+ Run in CI/CD pipelines and build systems Anyone, any size Not considered "hosting"
18
+ Distribute copies with license notices Anyone Must include license, mark changes
19
+ Create derivative works Anyone Must retain license key checks
20
+ Host internally Orgs <= 15 All members count toward limit
21
+ Embed in internal toolchains Anyone No visual workflow authoring UI
22
+ Use inside a larger product Anyone If flow-weaver is not the primary value
23
+
24
+ Requires commercial license:
25
+
26
+ Use Notes
27
+ ---------------------------------------- ----------------------------------
28
+ Host internally Orgs > 15 people
29
+ Build visual workflow authoring tools Standalone products for workflow authoring
30
+ Offer as a hosted or managed service To third parties, at any scale
31
+ Sell products built on the software Where flow-weaver is the primary value
32
+
33
+ Never permitted:
34
+
35
+ Use Notes
36
+ ---------------------------------------- ----------------------------------
37
+ Remove or circumvent license keys Applies to software and derivatives
38
+ Remove licensing or copyright notices Must always be retained
39
+ Strip license key checks from forks Derivatives must retain protections
40
+
41
+ ---
42
+
43
+ ## Acceptance
44
+
45
+ By using the software, you agree to all of the terms and conditions below.
46
+
47
+ ## Copyright License
48
+
49
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
50
+ non-sublicensable, non-transferable license to use, copy, distribute, make
51
+ available, and prepare derivative works of the software, in each case subject to
52
+ the limitations and conditions below.
53
+
54
+ ## Limitations
55
+
56
+ You may not provide the software to third parties as a hosted or managed
57
+ service, where the service provides users with access to any of the features or
58
+ functionality of the software.
59
+
60
+ You may not use the software to build, distribute, or offer any standalone
61
+ product or service whose primary purpose is providing a graphical or visual
62
+ interface for creating, editing, designing, or composing workflows. This
63
+ restriction applies whether the product is hosted, distributed, sold, or offered
64
+ free of charge. It does not apply to products that use the software internally
65
+ without exposing its workflow authoring capabilities to end users through a
66
+ graphical interface.
67
+
68
+ You may not sell the software or any product that provides, as its primary
69
+ function, capabilities supplied by the software (including workflow compilation,
70
+ parsing, validation, code generation, or diagram generation), without a separate
71
+ commercial license from the licensor. This does not restrict the sale of products
72
+ that merely incorporate the software as one component among many, where the
73
+ product's primary value comes from functionality independent of the software.
74
+
75
+ You may not move, change, disable, or circumvent the license key functionality
76
+ in the software, and you may not remove or obscure any functionality in the
77
+ software that is protected by the license key.
78
+
79
+ Derivative works must retain all license key functionality, license verification
80
+ mechanisms, and licensing notices present in the original software. Distributing
81
+ derivative works with license key protections removed, disabled, or bypassed
82
+ constitutes a violation of this license.
83
+
84
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
85
+ of the licensor in the software. Any use of the licensor's trademarks is subject
86
+ to applicable law.
87
+
88
+ ## Patents
89
+
90
+ The licensor grants you a license, under any patent claims the licensor can
91
+ license, or becomes able to license, to make, have made, use, sell, offer for
92
+ sale, import and have imported the software, in each case subject to the
93
+ limitations and conditions in this license. This license does not cover any
94
+ patent claims that you cause to be infringed by modifications or additions to the
95
+ software. If you or your company make any written claim that the software
96
+ infringes or contributes to infringement of any patent, your patent license for
97
+ the software granted under these terms ends immediately. If your company makes
98
+ such a claim, your patent license ends immediately for work on behalf of your
99
+ company.
100
+
101
+ ## Notices
102
+
103
+ You must ensure that anyone who gets a copy of any part of the software from you
104
+ also gets a copy of these terms.
105
+
106
+ If you modify the software, you must include in any modified copies of the
107
+ software prominent notices stating that you have modified the software.
108
+
109
+ ## No Other Rights
110
+
111
+ These terms do not imply any licenses other than those expressly granted in
112
+ these terms.
113
+
114
+ ## Termination
115
+
116
+ If you use the software in violation of these terms, such use is not licensed,
117
+ and your licenses will automatically terminate. If the licensor provides you
118
+ with a notice of your violation, and you cease all violation of this license no
119
+ later than 30 days after you receive that notice, your licenses will be
120
+ reinstated retroactively. However, if you violate these terms after such
121
+ reinstatement, any additional violation of these terms will cause your licenses
122
+ to terminate immediately.
123
+
124
+ You may request a review of any termination by contacting the licensor in
125
+ writing within 15 days of termination. The licensor will respond within 30 days.
126
+
127
+ ## No Liability
128
+
129
+ As far as the law allows, the software comes as is, without any warranty or
130
+ condition, and the licensor will not be liable to you for any damages arising
131
+ out of these terms or the use or nature of the software, under any kind of
132
+ legal claim.
133
+
134
+ ## Governing Law
135
+
136
+ This license is governed by the laws of Portugal. Any disputes arising from or
137
+ related to this license will be submitted to the exclusive jurisdiction of the
138
+ courts of Lisbon, Portugal.
139
+
140
+ ## Definitions
141
+
142
+ The "licensor" is Ricardo Jose Horta Morais (Synergenius), and the "software"
143
+ is the software the licensor makes available under these terms.
144
+
145
+ "You" refers to the individual or entity agreeing to these terms. "Your company"
146
+ is any legal entity, sole proprietorship, or other kind of organization that you
147
+ work for, plus all organizations that have control over, are under the control
148
+ of, or are under common control with that organization. "Control" means
149
+ ownership of substantially all the assets of an entity, or the power to direct
150
+ its management and policies by vote, contract, or otherwise. Control can be
151
+ direct or indirect.
152
+
153
+ "Third parties" means any individual or entity that is not you or your company
154
+ as defined in these terms.
155
+
156
+ "Your licenses" are all the licenses granted to you for the software under these
157
+ terms. "Use" means anything you do with the software requiring one of your
158
+ licenses.
159
+
160
+ "Hosting the software" means making the software's functionality available to
161
+ users over a network as a service. Running the software in automated build
162
+ pipelines, continuous integration systems, command-line interfaces, or
163
+ development toolchains does not constitute hosting, regardless of organization
164
+ size.
165
+
166
+ ---
167
+
168
+ ADDITIONAL NOTICES
169
+
170
+ 1. Output of the Software
171
+
172
+ The output of the software, including but not limited to compiled workflows,
173
+ generated code, deployment artifacts, and any other files produced by the
174
+ software's compilation, code generation, or export features, is not considered
175
+ part of the software and may be used, copied, modified, distributed, and
176
+ sublicensed for any purpose without restriction under this license.
177
+
178
+ 2. Internal Hosting Threshold
179
+
180
+ Organizations with 15 or fewer individuals, including employees, contractors,
181
+ and affiliates, may host the software on internal infrastructure for use by
182
+ their members without restriction under this license. The count includes all
183
+ individuals in the organization, not only those who directly use the software.
184
+
185
+ Organizations with more than 15 individuals that wish to host the software,
186
+ whether on internal infrastructure or as a service, require a commercial
187
+ license.
188
+
189
+ 3. Unrestricted Use
190
+
191
+ Using the software locally, including installing, running, compiling workflows,
192
+ generating code, and producing deployment artifacts, is permitted for any
193
+ individual or organization regardless of size, subject to the Limitations above.
194
+
195
+ 4. Export Compliance
196
+
197
+ You are responsible for compliance with all applicable export and import laws
198
+ and regulations in your jurisdiction when using, distributing, or making the
199
+ software available.
200
+
201
+ 5. Commercial Licensing
202
+
203
+ For commercial licensing inquiries, partnership arrangements, or questions
204
+ about permitted use, contact support@synergenius.pt.
@@ -0,0 +1,54 @@
1
+ /**
2
+ * GitHub Actions Export Target
3
+ *
4
+ * Generates .github/workflows/<name>.yml from a Flow Weaver CI/CD workflow.
5
+ * No FW runtime dependency — outputs native GitHub Actions YAML.
6
+ *
7
+ * Mapping:
8
+ * - FW Node → GitHub Actions step (uses: or run:)
9
+ * - FW [job: "name"] → GitHub Actions job
10
+ * - FW @path → job `needs:` dependencies
11
+ * - FW @secret → ${{ secrets.NAME }}
12
+ * - FW @cache → actions/cache@v4
13
+ * - FW @artifact → actions/upload-artifact@v4 / actions/download-artifact@v4
14
+ * - FW @trigger → `on:` event configuration
15
+ */
16
+ import { BaseCICDTarget } from '@synergenius/flow-weaver/deployment';
17
+ import type { ExportOptions, ExportArtifacts, DeployInstructions } from '@synergenius/flow-weaver/deployment';
18
+ export declare class GitHubActionsTarget extends BaseCICDTarget {
19
+ readonly name = "github-actions";
20
+ readonly description = "GitHub Actions workflow YAML (.github/workflows/)";
21
+ readonly deploySchema: {
22
+ runner: {
23
+ type: "string";
24
+ description: string;
25
+ default: string;
26
+ };
27
+ };
28
+ readonly nodeTypeDeploySchema: {
29
+ action: {
30
+ type: "string";
31
+ description: string;
32
+ };
33
+ with: {
34
+ type: "string";
35
+ description: string;
36
+ };
37
+ label: {
38
+ type: "string";
39
+ description: string;
40
+ };
41
+ };
42
+ generate(options: ExportOptions): Promise<ExportArtifacts>;
43
+ getDeployInstructions(_artifacts: ExportArtifacts): DeployInstructions;
44
+ private renderWorkflowYAML;
45
+ private renderTriggers;
46
+ private renderJob;
47
+ private renderStep;
48
+ private renderCacheStep;
49
+ /**
50
+ * Apply workflow-level options (cache, services, matrix) to jobs.
51
+ */
52
+ private applyWorkflowOptions;
53
+ }
54
+ export default GitHubActionsTarget;
package/dist/target.js ADDED
@@ -0,0 +1,366 @@
1
+ /**
2
+ * GitHub Actions Export Target
3
+ *
4
+ * Generates .github/workflows/<name>.yml from a Flow Weaver CI/CD workflow.
5
+ * No FW runtime dependency — outputs native GitHub Actions YAML.
6
+ *
7
+ * Mapping:
8
+ * - FW Node → GitHub Actions step (uses: or run:)
9
+ * - FW [job: "name"] → GitHub Actions job
10
+ * - FW @path → job `needs:` dependencies
11
+ * - FW @secret → ${{ secrets.NAME }}
12
+ * - FW @cache → actions/cache@v4
13
+ * - FW @artifact → actions/upload-artifact@v4 / actions/download-artifact@v4
14
+ * - FW @trigger → `on:` event configuration
15
+ */
16
+ import { stringify as yamlStringify } from 'yaml';
17
+ import { isCICDWorkflow } from '@synergenius/flow-weaver/deployment';
18
+ import { BaseCICDTarget, } from '@synergenius/flow-weaver/deployment';
19
+ import { parseWorkflow } from '@synergenius/flow-weaver/api';
20
+ import * as path from 'path';
21
+ export class GitHubActionsTarget extends BaseCICDTarget {
22
+ name = 'github-actions';
23
+ description = 'GitHub Actions workflow YAML (.github/workflows/)';
24
+ deploySchema = {
25
+ runner: { type: 'string', description: 'GitHub runner label', default: 'ubuntu-latest' },
26
+ };
27
+ nodeTypeDeploySchema = {
28
+ action: { type: 'string', description: 'GitHub Action uses: value (e.g. actions/checkout@v4)' },
29
+ with: { type: 'string', description: 'JSON object for with: parameters' },
30
+ label: { type: 'string', description: 'Step display name' },
31
+ };
32
+ async generate(options) {
33
+ const filePath = path.resolve(options.sourceFile);
34
+ const outputDir = path.resolve(options.outputDir);
35
+ // Parse the workflow file to get AST
36
+ const parseResult = await parseWorkflow(filePath, { nodeTypesOnly: false });
37
+ if (parseResult.errors.length > 0) {
38
+ throw new Error(`Parse errors: ${parseResult.errors.join('; ')}`);
39
+ }
40
+ const allWorkflows = parseResult.allWorkflows || [];
41
+ const targetWorkflows = options.workflowName
42
+ ? allWorkflows.filter((w) => w.name === options.workflowName || w.functionName === options.workflowName)
43
+ : allWorkflows.filter((w) => isCICDWorkflow(w));
44
+ if (targetWorkflows.length === 0) {
45
+ throw new Error('No CI/CD workflows found. Ensure workflow has CI/CD annotations (@secret, @runner, @trigger, [job:], etc.)');
46
+ }
47
+ const files = [];
48
+ for (const ast of targetWorkflows) {
49
+ // Build job graph
50
+ const jobs = this.buildJobGraph(ast);
51
+ // Resolve secrets
52
+ this.resolveJobSecrets(jobs, ast, (name) => `\${{ secrets.${name} }}`);
53
+ // Inject artifacts
54
+ const artifacts = ast.options?.cicd?.artifacts || [];
55
+ this.injectArtifactSteps(jobs, artifacts);
56
+ // Apply cache, services, matrix from workflow options
57
+ this.applyWorkflowOptions(jobs, ast);
58
+ // Generate YAML
59
+ const yamlContent = this.renderWorkflowYAML(ast, jobs);
60
+ // Output path: .github/workflows/<name>.yml
61
+ const yamlFileName = `.github/workflows/${ast.functionName}.yml`;
62
+ files.push(this.createFile(outputDir, yamlFileName, yamlContent, 'config'));
63
+ // Generate secrets doc if secrets exist
64
+ const secrets = ast.options?.cicd?.secrets || [];
65
+ if (secrets.length > 0) {
66
+ const secretsDoc = this.generateSecretsDoc(secrets, 'github-actions');
67
+ files.push(this.createFile(outputDir, 'SECRETS_SETUP.md', secretsDoc, 'other'));
68
+ }
69
+ }
70
+ return {
71
+ files,
72
+ target: this.name,
73
+ workflowName: options.displayName || targetWorkflows[0].name,
74
+ entryPoint: files[0].relativePath,
75
+ };
76
+ }
77
+ getDeployInstructions(_artifacts) {
78
+ return {
79
+ title: 'Deploy GitHub Actions Workflow',
80
+ prerequisites: [
81
+ 'GitHub repository',
82
+ 'Repository secrets configured (see SECRETS_SETUP.md)',
83
+ ],
84
+ steps: [
85
+ 'Copy the .github/workflows/ directory to your repository root',
86
+ 'Configure required secrets in GitHub (Settings > Secrets > Actions)',
87
+ 'Push to trigger the workflow',
88
+ ],
89
+ localTestSteps: [
90
+ 'Install act: brew install act (or see https://github.com/nektos/act)',
91
+ 'Run locally: act push',
92
+ ],
93
+ links: [
94
+ { label: 'GitHub Actions Docs', url: 'https://docs.github.com/en/actions' },
95
+ { label: 'act - Local Testing', url: 'https://github.com/nektos/act' },
96
+ ],
97
+ };
98
+ }
99
+ // ---------------------------------------------------------------------------
100
+ // Private: YAML Rendering
101
+ // ---------------------------------------------------------------------------
102
+ renderWorkflowYAML(ast, jobs) {
103
+ const doc = {};
104
+ // name
105
+ doc.name = ast.name;
106
+ // on: triggers
107
+ doc.on = this.renderTriggers(ast.options?.cicd?.triggers || []);
108
+ // concurrency
109
+ if (ast.options?.cicd?.concurrency) {
110
+ doc.concurrency = {
111
+ group: ast.options.cicd.concurrency.group,
112
+ 'cancel-in-progress': ast.options.cicd.concurrency.cancelInProgress ?? false,
113
+ };
114
+ }
115
+ // jobs
116
+ const jobsObj = {};
117
+ for (const job of jobs) {
118
+ jobsObj[job.id] = this.renderJob(job, ast);
119
+ }
120
+ doc.jobs = jobsObj;
121
+ return yamlStringify(doc, {
122
+ lineWidth: 120,
123
+ defaultStringType: 'PLAIN',
124
+ defaultKeyType: 'PLAIN',
125
+ });
126
+ }
127
+ renderTriggers(triggers) {
128
+ if (triggers.length === 0) {
129
+ // Default: manual dispatch
130
+ return { workflow_dispatch: {} };
131
+ }
132
+ const on = {};
133
+ for (const trigger of triggers) {
134
+ switch (trigger.type) {
135
+ case 'push': {
136
+ const pushConfig = {};
137
+ if (trigger.branches)
138
+ pushConfig.branches = trigger.branches;
139
+ if (trigger.paths)
140
+ pushConfig.paths = trigger.paths;
141
+ if (trigger.pathsIgnore)
142
+ pushConfig['paths-ignore'] = trigger.pathsIgnore;
143
+ on.push = Object.keys(pushConfig).length > 0 ? pushConfig : null;
144
+ break;
145
+ }
146
+ case 'pull_request': {
147
+ const prConfig = {};
148
+ if (trigger.branches)
149
+ prConfig.branches = trigger.branches;
150
+ if (trigger.types)
151
+ prConfig.types = trigger.types;
152
+ if (trigger.paths)
153
+ prConfig.paths = trigger.paths;
154
+ if (trigger.pathsIgnore)
155
+ prConfig['paths-ignore'] = trigger.pathsIgnore;
156
+ on.pull_request = Object.keys(prConfig).length > 0 ? prConfig : null;
157
+ break;
158
+ }
159
+ case 'schedule':
160
+ on.schedule = on.schedule || [];
161
+ if (trigger.cron) {
162
+ on.schedule.push({ cron: trigger.cron });
163
+ }
164
+ break;
165
+ case 'dispatch':
166
+ on.workflow_dispatch = trigger.inputs
167
+ ? { inputs: trigger.inputs }
168
+ : {};
169
+ break;
170
+ case 'tag': {
171
+ // Tags are a filter on push
172
+ if (!on.push)
173
+ on.push = {};
174
+ on.push.tags = trigger.pattern
175
+ ? [trigger.pattern]
176
+ : ['*'];
177
+ break;
178
+ }
179
+ }
180
+ }
181
+ return on;
182
+ }
183
+ renderJob(job, ast) {
184
+ const jobObj = {};
185
+ // runs-on
186
+ jobObj['runs-on'] = job.runner || 'ubuntu-latest';
187
+ // needs
188
+ if (job.needs.length > 0) {
189
+ jobObj.needs = job.needs;
190
+ }
191
+ // environment
192
+ if (job.environment) {
193
+ const envConfig = ast.options?.cicd?.environments?.find((e) => e.name === job.environment);
194
+ if (envConfig?.url) {
195
+ jobObj.environment = { name: job.environment, url: envConfig.url };
196
+ }
197
+ else {
198
+ jobObj.environment = job.environment;
199
+ }
200
+ }
201
+ // matrix strategy
202
+ if (job.matrix) {
203
+ const strategy = {};
204
+ if (job.matrix.dimensions) {
205
+ strategy.matrix = { ...job.matrix.dimensions };
206
+ }
207
+ if (job.matrix.include) {
208
+ strategy.matrix = strategy.matrix || {};
209
+ strategy.matrix.include = job.matrix.include;
210
+ }
211
+ if (job.matrix.exclude) {
212
+ strategy.matrix = strategy.matrix || {};
213
+ strategy.matrix.exclude = job.matrix.exclude;
214
+ }
215
+ jobObj.strategy = strategy;
216
+ }
217
+ // services
218
+ if (job.services && job.services.length > 0) {
219
+ const services = {};
220
+ for (const svc of job.services) {
221
+ const svcObj = { image: svc.image };
222
+ if (svc.ports)
223
+ svcObj.ports = svc.ports;
224
+ if (svc.env)
225
+ svcObj.env = svc.env;
226
+ services[svc.name] = svcObj;
227
+ }
228
+ jobObj.services = services;
229
+ }
230
+ // steps
231
+ const steps = [];
232
+ // Download artifacts first
233
+ if (job.downloadArtifacts && job.downloadArtifacts.length > 0) {
234
+ for (const artifactName of job.downloadArtifacts) {
235
+ const artifact = ast.options?.cicd?.artifacts?.find((a) => a.name === artifactName);
236
+ steps.push({
237
+ uses: 'actions/download-artifact@v4',
238
+ with: {
239
+ name: artifactName,
240
+ ...(artifact?.path && { path: artifact.path }),
241
+ },
242
+ });
243
+ }
244
+ }
245
+ // Cache step
246
+ if (job.cache) {
247
+ steps.push(this.renderCacheStep(job.cache));
248
+ }
249
+ // Node steps
250
+ for (const step of job.steps) {
251
+ steps.push(this.renderStep(step));
252
+ }
253
+ // Upload artifacts last
254
+ if (job.uploadArtifacts && job.uploadArtifacts.length > 0) {
255
+ for (const artifact of job.uploadArtifacts) {
256
+ const uploadStep = {
257
+ uses: 'actions/upload-artifact@v4',
258
+ with: {
259
+ name: artifact.name,
260
+ path: artifact.path,
261
+ },
262
+ };
263
+ if (artifact.retention) {
264
+ uploadStep.with['retention-days'] = artifact.retention;
265
+ }
266
+ steps.push(uploadStep);
267
+ }
268
+ }
269
+ jobObj.steps = steps;
270
+ return jobObj;
271
+ }
272
+ renderStep(step) {
273
+ const mapping = this.resolveActionMapping(step, 'github-actions');
274
+ if (mapping?.githubAction) {
275
+ // Use a pre-built action
276
+ const stepObj = {
277
+ name: mapping.label || step.name,
278
+ uses: mapping.githubAction,
279
+ };
280
+ if (mapping.githubWith) {
281
+ stepObj.with = { ...mapping.githubWith };
282
+ }
283
+ if (step.env && Object.keys(step.env).length > 0) {
284
+ stepObj.env = step.env;
285
+ }
286
+ return stepObj;
287
+ }
288
+ if (mapping?.gitlabScript) {
289
+ // Known node type but no GitHub action — use run:
290
+ const stepObj = {
291
+ name: mapping.label || step.name,
292
+ run: mapping.gitlabScript.join('\n'),
293
+ };
294
+ if (step.env && Object.keys(step.env).length > 0) {
295
+ stepObj.env = step.env;
296
+ }
297
+ return stepObj;
298
+ }
299
+ // Unknown node type — generate TODO placeholder
300
+ const stepObj = {
301
+ name: step.name,
302
+ run: `echo "TODO: Implement step '${step.id}' (node type: ${step.nodeType})"`,
303
+ };
304
+ if (step.env && Object.keys(step.env).length > 0) {
305
+ stepObj.env = step.env;
306
+ }
307
+ return stepObj;
308
+ }
309
+ renderCacheStep(cache) {
310
+ const cacheConfig = {};
311
+ switch (cache.strategy) {
312
+ case 'npm':
313
+ cacheConfig.path = cache.path || '~/.npm';
314
+ cacheConfig.key = cache.key
315
+ ? `npm-\${{ hashFiles('${cache.key}') }}`
316
+ : "npm-${{ hashFiles('**/package-lock.json') }}";
317
+ break;
318
+ case 'pip':
319
+ cacheConfig.path = cache.path || '~/.cache/pip';
320
+ cacheConfig.key = cache.key
321
+ ? `pip-\${{ hashFiles('${cache.key}') }}`
322
+ : "pip-${{ hashFiles('**/requirements.txt') }}";
323
+ break;
324
+ default:
325
+ cacheConfig.path = cache.path || '.cache';
326
+ cacheConfig.key = cache.key
327
+ ? `${cache.strategy}-\${{ hashFiles('${cache.key}') }}`
328
+ : `${cache.strategy}-\${{ github.sha }}`;
329
+ }
330
+ return {
331
+ name: `Cache ${cache.strategy}`,
332
+ uses: 'actions/cache@v4',
333
+ with: cacheConfig,
334
+ };
335
+ }
336
+ /**
337
+ * Apply workflow-level options (cache, services, matrix) to jobs.
338
+ */
339
+ applyWorkflowOptions(jobs, ast) {
340
+ const cicd = ast.options?.cicd;
341
+ if (!cicd)
342
+ return;
343
+ // Apply cache to all jobs (or first job if only one)
344
+ if (cicd.caches && cicd.caches.length > 0) {
345
+ const targetJobs = jobs.length === 1 ? jobs : jobs.filter((j) => j.needs.length === 0);
346
+ for (const job of targetJobs) {
347
+ job.cache = cicd.caches[0]; // Primary cache
348
+ }
349
+ }
350
+ // Apply services to all jobs
351
+ if (cicd.services && cicd.services.length > 0) {
352
+ for (const job of jobs) {
353
+ job.services = cicd.services;
354
+ }
355
+ }
356
+ // Apply matrix to first job (or specific jobs based on convention)
357
+ if (cicd.matrix) {
358
+ // Apply to all jobs that don't have dependencies (root jobs)
359
+ const rootJobs = jobs.filter((j) => j.needs.length === 0);
360
+ for (const job of rootJobs) {
361
+ job.matrix = cicd.matrix;
362
+ }
363
+ }
364
+ }
365
+ }
366
+ export default GitHubActionsTarget;
@@ -0,0 +1,15 @@
1
+ {
2
+ "manifestVersion": 1,
3
+ "name": "@synergenius/flowweaver-pack-github-actions",
4
+ "version": "0.1.1",
5
+ "nodeTypes": [],
6
+ "workflows": [],
7
+ "patterns": [],
8
+ "exportTargets": [
9
+ {
10
+ "name": "github-actions",
11
+ "description": "GitHub Actions CI/CD pipeline generation",
12
+ "file": "dist/target.js"
13
+ }
14
+ ]
15
+ }
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@synergenius/flowweaver-pack-github-actions",
3
+ "version": "0.1.1",
4
+ "description": "GitHub Actions CI/CD export target for Flow Weaver",
5
+ "keywords": [
6
+ "flowweaver-marketplace-pack",
7
+ "flow-weaver",
8
+ "github-actions",
9
+ "cicd"
10
+ ],
11
+ "flowWeaver": {
12
+ "type": "marketplace-pack",
13
+ "engineVersion": ">=0.14.0",
14
+ "categories": [
15
+ "deployment",
16
+ "cicd"
17
+ ]
18
+ },
19
+ "peerDependencies": {
20
+ "@synergenius/flow-weaver": ">=0.14.0"
21
+ },
22
+ "dependencies": {
23
+ "yaml": "^2.8.0"
24
+ },
25
+ "main": "./dist/target.js",
26
+ "types": "./dist/target.d.ts",
27
+ "type": "module",
28
+ "files": [
29
+ "dist",
30
+ "flowweaver.manifest.json",
31
+ "README.md"
32
+ ],
33
+ "scripts": {
34
+ "build": "tsc",
35
+ "prepublishOnly": "npm run build"
36
+ },
37
+ "devDependencies": {
38
+ "typescript": "^5.0.0",
39
+ "@synergenius/flow-weaver": "^0.14.2",
40
+ "@types/node": "^20.0.0"
41
+ },
42
+ "license": "SEE LICENSE IN LICENSE",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "https://github.com/synergenius-fw/flowweaver-pack-github-actions.git"
46
+ }
47
+ }