@synergenius/flow-weaver 0.30.2 → 0.30.4
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.
|
@@ -202,6 +202,49 @@ export class AnnotationGenerator {
|
|
|
202
202
|
line += ` period="${t.period}"`;
|
|
203
203
|
lines.push(line);
|
|
204
204
|
}
|
|
205
|
+
// CI/CD annotations round-trip (from pack-contributed tag handlers)
|
|
206
|
+
if (workflow.options?.cicd) {
|
|
207
|
+
const cicd = workflow.options.cicd;
|
|
208
|
+
// @trigger (CI/CD style: push, pull_request, etc.)
|
|
209
|
+
if (cicd.triggers && Array.isArray(cicd.triggers)) {
|
|
210
|
+
for (const trigger of cicd.triggers) {
|
|
211
|
+
const parts = [String(trigger.type || '')];
|
|
212
|
+
if (trigger.branches)
|
|
213
|
+
parts.push(`branches="${trigger.branches}"`);
|
|
214
|
+
if (trigger.types)
|
|
215
|
+
parts.push(`types="${trigger.types}"`);
|
|
216
|
+
if (trigger.pattern)
|
|
217
|
+
parts.push(`pattern="${trigger.pattern}"`);
|
|
218
|
+
if (trigger.cron)
|
|
219
|
+
parts.push(`cron="${trigger.cron}"`);
|
|
220
|
+
lines.push(` * @trigger ${parts.join(' ')}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
// @secret
|
|
224
|
+
if (cicd.secrets && Array.isArray(cicd.secrets)) {
|
|
225
|
+
for (const secret of cicd.secrets) {
|
|
226
|
+
let line = ` * @secret ${secret.name}`;
|
|
227
|
+
if (secret.description)
|
|
228
|
+
line += ` - ${secret.description}`;
|
|
229
|
+
lines.push(line);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// @runner
|
|
233
|
+
if (cicd.runner) {
|
|
234
|
+
lines.push(` * @runner ${cicd.runner}`);
|
|
235
|
+
}
|
|
236
|
+
// @cache
|
|
237
|
+
if (cicd.caches && Array.isArray(cicd.caches)) {
|
|
238
|
+
for (const cache of cicd.caches) {
|
|
239
|
+
let line = ` * @cache ${cache.strategy || 'npm'}`;
|
|
240
|
+
if (cache.key)
|
|
241
|
+
line += ` key="${cache.key}"`;
|
|
242
|
+
if (cache.path)
|
|
243
|
+
line += ` path="${cache.path}"`;
|
|
244
|
+
lines.push(line);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
205
248
|
// Add name if different from export name
|
|
206
249
|
if (workflow.name && workflow.name !== workflow.functionName) {
|
|
207
250
|
lines.push(` * @name ${workflow.name}`);
|
|
@@ -42,9 +42,19 @@ export function generateInPlace(sourceCode, ast, options = {}) {
|
|
|
42
42
|
}
|
|
43
43
|
// Skip node types imported from other files — the import statement handles them.
|
|
44
44
|
// Inlining would create duplicate declarations (TS2440) and duplicate node type names.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
// Compare basenames as a fallback: after a client roundtrip (JSON serialization),
|
|
46
|
+
// sourceLocation.file may contain a virtual path ("/testing.ts") instead of the
|
|
47
|
+
// real workspace path. Full-path comparison would incorrectly skip the node type.
|
|
48
|
+
// Normalize separators for cross-platform (Windows backslash → forward slash).
|
|
49
|
+
if (nodeType.sourceLocation?.file) {
|
|
50
|
+
const ntFile = nodeType.sourceLocation.file.replace(/\\/g, '/');
|
|
51
|
+
const astFile = ast.sourceFile.replace(/\\/g, '/');
|
|
52
|
+
const ntBase = ntFile.split('/').filter(Boolean).pop() ?? '';
|
|
53
|
+
const astBase = astFile.split('/').filter(Boolean).pop() ?? '';
|
|
54
|
+
if (path.resolve(ntFile) !== path.resolve(astFile) &&
|
|
55
|
+
ntBase !== astBase) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
48
58
|
}
|
|
49
59
|
// Skip built-in auto-injected nodes — step 1.2 handles their insertion
|
|
50
60
|
if (!nodeType.sourceLocation && nodeType.helperText != null) {
|
|
@@ -1108,6 +1118,45 @@ function generateWorkflowJSDoc(ast, options = {}) {
|
|
|
1108
1118
|
line += ` period="${t.period}"`;
|
|
1109
1119
|
lines.push(line);
|
|
1110
1120
|
}
|
|
1121
|
+
// CI/CD annotations round-trip (from pack-contributed tag handlers)
|
|
1122
|
+
if (ast.options?.cicd) {
|
|
1123
|
+
const cicd = ast.options.cicd;
|
|
1124
|
+
if (cicd.triggers && Array.isArray(cicd.triggers)) {
|
|
1125
|
+
for (const trigger of cicd.triggers) {
|
|
1126
|
+
const parts = [String(trigger.type || '')];
|
|
1127
|
+
if (trigger.branches)
|
|
1128
|
+
parts.push(`branches="${trigger.branches}"`);
|
|
1129
|
+
if (trigger.types)
|
|
1130
|
+
parts.push(`types="${trigger.types}"`);
|
|
1131
|
+
if (trigger.pattern)
|
|
1132
|
+
parts.push(`pattern="${trigger.pattern}"`);
|
|
1133
|
+
if (trigger.cron)
|
|
1134
|
+
parts.push(`cron="${trigger.cron}"`);
|
|
1135
|
+
lines.push(` * @trigger ${parts.join(' ')}`);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
if (cicd.secrets && Array.isArray(cicd.secrets)) {
|
|
1139
|
+
for (const secret of cicd.secrets) {
|
|
1140
|
+
let line = ` * @secret ${secret.name}`;
|
|
1141
|
+
if (secret.description)
|
|
1142
|
+
line += ` - ${secret.description}`;
|
|
1143
|
+
lines.push(line);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
if (cicd.runner) {
|
|
1147
|
+
lines.push(` * @runner ${cicd.runner}`);
|
|
1148
|
+
}
|
|
1149
|
+
if (cicd.caches && Array.isArray(cicd.caches)) {
|
|
1150
|
+
for (const cache of cicd.caches) {
|
|
1151
|
+
let line = ` * @cache ${cache.strategy || 'npm'}`;
|
|
1152
|
+
if (cache.key)
|
|
1153
|
+
line += ` key="${cache.key}"`;
|
|
1154
|
+
if (cache.path)
|
|
1155
|
+
line += ` path="${cache.path}"`;
|
|
1156
|
+
lines.push(line);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1111
1160
|
// Add name if different from function name
|
|
1112
1161
|
if (ast.name && ast.name !== ast.functionName) {
|
|
1113
1162
|
lines.push(` * @name ${ast.name}`);
|
package/dist/cli/flow-weaver.mjs
CHANGED
|
@@ -5987,7 +5987,7 @@ var VERSION;
|
|
|
5987
5987
|
var init_generated_version = __esm({
|
|
5988
5988
|
"src/generated-version.ts"() {
|
|
5989
5989
|
"use strict";
|
|
5990
|
-
VERSION = "0.30.
|
|
5990
|
+
VERSION = "0.30.4";
|
|
5991
5991
|
}
|
|
5992
5992
|
});
|
|
5993
5993
|
|
|
@@ -15132,6 +15132,37 @@ var init_annotation_generator = __esm({
|
|
|
15132
15132
|
if (t.period) line += ` period="${t.period}"`;
|
|
15133
15133
|
lines.push(line);
|
|
15134
15134
|
}
|
|
15135
|
+
if (workflow.options?.cicd) {
|
|
15136
|
+
const cicd = workflow.options.cicd;
|
|
15137
|
+
if (cicd.triggers && Array.isArray(cicd.triggers)) {
|
|
15138
|
+
for (const trigger of cicd.triggers) {
|
|
15139
|
+
const parts = [String(trigger.type || "")];
|
|
15140
|
+
if (trigger.branches) parts.push(`branches="${trigger.branches}"`);
|
|
15141
|
+
if (trigger.types) parts.push(`types="${trigger.types}"`);
|
|
15142
|
+
if (trigger.pattern) parts.push(`pattern="${trigger.pattern}"`);
|
|
15143
|
+
if (trigger.cron) parts.push(`cron="${trigger.cron}"`);
|
|
15144
|
+
lines.push(` * @trigger ${parts.join(" ")}`);
|
|
15145
|
+
}
|
|
15146
|
+
}
|
|
15147
|
+
if (cicd.secrets && Array.isArray(cicd.secrets)) {
|
|
15148
|
+
for (const secret of cicd.secrets) {
|
|
15149
|
+
let line = ` * @secret ${secret.name}`;
|
|
15150
|
+
if (secret.description) line += ` - ${secret.description}`;
|
|
15151
|
+
lines.push(line);
|
|
15152
|
+
}
|
|
15153
|
+
}
|
|
15154
|
+
if (cicd.runner) {
|
|
15155
|
+
lines.push(` * @runner ${cicd.runner}`);
|
|
15156
|
+
}
|
|
15157
|
+
if (cicd.caches && Array.isArray(cicd.caches)) {
|
|
15158
|
+
for (const cache of cicd.caches) {
|
|
15159
|
+
let line = ` * @cache ${cache.strategy || "npm"}`;
|
|
15160
|
+
if (cache.key) line += ` key="${cache.key}"`;
|
|
15161
|
+
if (cache.path) line += ` path="${cache.path}"`;
|
|
15162
|
+
lines.push(line);
|
|
15163
|
+
}
|
|
15164
|
+
}
|
|
15165
|
+
}
|
|
15135
15166
|
if (workflow.name && workflow.name !== workflow.functionName) {
|
|
15136
15167
|
lines.push(` * @name ${workflow.name}`);
|
|
15137
15168
|
}
|
|
@@ -15293,8 +15324,14 @@ function generateInPlace(sourceCode, ast, options = {}) {
|
|
|
15293
15324
|
if (nodeType.variant === "IMPORTED_WORKFLOW" || nodeType.variant === "WORKFLOW" || nodeType.variant === "MAP_ITERATOR") {
|
|
15294
15325
|
continue;
|
|
15295
15326
|
}
|
|
15296
|
-
if (nodeType.sourceLocation?.file
|
|
15297
|
-
|
|
15327
|
+
if (nodeType.sourceLocation?.file) {
|
|
15328
|
+
const ntFile = nodeType.sourceLocation.file.replace(/\\/g, "/");
|
|
15329
|
+
const astFile = ast.sourceFile.replace(/\\/g, "/");
|
|
15330
|
+
const ntBase = ntFile.split("/").filter(Boolean).pop() ?? "";
|
|
15331
|
+
const astBase = astFile.split("/").filter(Boolean).pop() ?? "";
|
|
15332
|
+
if (path2.resolve(ntFile) !== path2.resolve(astFile) && ntBase !== astBase) {
|
|
15333
|
+
continue;
|
|
15334
|
+
}
|
|
15298
15335
|
}
|
|
15299
15336
|
if (!nodeType.sourceLocation && nodeType.helperText != null) {
|
|
15300
15337
|
continue;
|
|
@@ -16129,6 +16166,37 @@ function generateWorkflowJSDoc(ast, options = {}) {
|
|
|
16129
16166
|
if (t.period) line += ` period="${t.period}"`;
|
|
16130
16167
|
lines.push(line);
|
|
16131
16168
|
}
|
|
16169
|
+
if (ast.options?.cicd) {
|
|
16170
|
+
const cicd = ast.options.cicd;
|
|
16171
|
+
if (cicd.triggers && Array.isArray(cicd.triggers)) {
|
|
16172
|
+
for (const trigger of cicd.triggers) {
|
|
16173
|
+
const parts = [String(trigger.type || "")];
|
|
16174
|
+
if (trigger.branches) parts.push(`branches="${trigger.branches}"`);
|
|
16175
|
+
if (trigger.types) parts.push(`types="${trigger.types}"`);
|
|
16176
|
+
if (trigger.pattern) parts.push(`pattern="${trigger.pattern}"`);
|
|
16177
|
+
if (trigger.cron) parts.push(`cron="${trigger.cron}"`);
|
|
16178
|
+
lines.push(` * @trigger ${parts.join(" ")}`);
|
|
16179
|
+
}
|
|
16180
|
+
}
|
|
16181
|
+
if (cicd.secrets && Array.isArray(cicd.secrets)) {
|
|
16182
|
+
for (const secret of cicd.secrets) {
|
|
16183
|
+
let line = ` * @secret ${secret.name}`;
|
|
16184
|
+
if (secret.description) line += ` - ${secret.description}`;
|
|
16185
|
+
lines.push(line);
|
|
16186
|
+
}
|
|
16187
|
+
}
|
|
16188
|
+
if (cicd.runner) {
|
|
16189
|
+
lines.push(` * @runner ${cicd.runner}`);
|
|
16190
|
+
}
|
|
16191
|
+
if (cicd.caches && Array.isArray(cicd.caches)) {
|
|
16192
|
+
for (const cache of cicd.caches) {
|
|
16193
|
+
let line = ` * @cache ${cache.strategy || "npm"}`;
|
|
16194
|
+
if (cache.key) line += ` key="${cache.key}"`;
|
|
16195
|
+
if (cache.path) line += ` path="${cache.path}"`;
|
|
16196
|
+
lines.push(line);
|
|
16197
|
+
}
|
|
16198
|
+
}
|
|
16199
|
+
}
|
|
16132
16200
|
if (ast.name && ast.name !== ast.functionName) {
|
|
16133
16201
|
lines.push(` * @name ${ast.name}`);
|
|
16134
16202
|
}
|
|
@@ -88856,7 +88924,7 @@ function parseIntStrict(value) {
|
|
|
88856
88924
|
// src/cli/index.ts
|
|
88857
88925
|
init_logger();
|
|
88858
88926
|
init_error_utils();
|
|
88859
|
-
var version2 = true ? "0.30.
|
|
88927
|
+
var version2 = true ? "0.30.4" : "0.0.0-dev";
|
|
88860
88928
|
var program2 = new Command();
|
|
88861
88929
|
program2.name("fw").description("Flow Weaver Annotations - Compile and validate workflow files").option("-v, --version", "Output the current version").option("--no-color", "Disable colors").option("--color", "Force colors").on("option:version", () => {
|
|
88862
88930
|
logger.banner(version2);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.30.
|
|
1
|
+
export declare const VERSION = "0.30.4";
|
|
2
2
|
//# sourceMappingURL=generated-version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synergenius/flow-weaver",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.4",
|
|
4
4
|
"description": "Flow Weaver: deterministic TypeScript workflow compiler. Define workflows with JSDoc annotations, compile to standalone functions with zero runtime dependencies.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|