@synergenius/flow-weaver 0.17.9 → 0.17.10

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.
@@ -15,6 +15,7 @@ export interface PortParseResult {
15
15
  mergeStrategy?: string;
16
16
  hidden?: boolean;
17
17
  description?: string;
18
+ customMetadata?: Record<string, string | boolean | number>;
18
19
  }
19
20
  /**
20
21
  * Parse a port line (@input/@output/@step) and return structured result.
@@ -98,6 +98,7 @@ class PortParser extends CstParser {
98
98
  { ALT: () => this.SUBRULE(this.typeAttr) },
99
99
  { ALT: () => this.SUBRULE(this.mergeStrategyAttr) },
100
100
  { ALT: () => this.SUBRULE(this.hiddenAttr) },
101
+ { ALT: () => this.SUBRULE(this.customAttr) },
101
102
  ]);
102
103
  },
103
104
  });
@@ -131,6 +132,18 @@ class PortParser extends CstParser {
131
132
  hiddenAttr = this.RULE('hiddenAttr', () => {
132
133
  this.CONSUME(HiddenKeyword);
133
134
  });
135
+ // customAttr: key:value pairs for arbitrary metadata (e.g., artifactPath:"dist/")
136
+ customAttr = this.RULE('customAttr', () => {
137
+ this.CONSUME(Identifier, { LABEL: 'customKey' });
138
+ this.CONSUME(Colon);
139
+ this.OR([
140
+ { ALT: () => this.CONSUME(StringLiteral, { LABEL: 'customStrVal' }) },
141
+ { ALT: () => this.CONSUME(TrueKeyword, { LABEL: 'customTrue' }) },
142
+ { ALT: () => this.CONSUME(FalseKeyword, { LABEL: 'customFalse' }) },
143
+ { ALT: () => this.CONSUME2(Identifier, { LABEL: 'customIdVal' }) },
144
+ { ALT: () => this.CONSUME(Integer, { LABEL: 'customIntVal' }) },
145
+ ]);
146
+ });
134
147
  // - description text
135
148
  // Note: We just consume the dash here. The actual description text is extracted
136
149
  // from the raw input in parsePortLine() to handle special characters like &, :, etc.
@@ -232,6 +245,7 @@ class PortVisitor extends BaseVisitor {
232
245
  scope = this.visit(ctx.scopeClause);
233
246
  }
234
247
  let hidden;
248
+ let customMetadata;
235
249
  if (ctx.metadataBracket) {
236
250
  // Handle multiple metadata brackets (e.g., [order:1] [placement:TOP])
237
251
  for (const bracket of ctx.metadataBracket) {
@@ -246,6 +260,9 @@ class PortVisitor extends BaseVisitor {
246
260
  mergeStrategy = metadata.mergeStrategy;
247
261
  if (metadata.hidden)
248
262
  hidden = true;
263
+ if (metadata.customMetadata) {
264
+ customMetadata = { ...customMetadata, ...metadata.customMetadata };
265
+ }
249
266
  }
250
267
  }
251
268
  if (ctx.descriptionClause) {
@@ -263,6 +280,7 @@ class PortVisitor extends BaseVisitor {
263
280
  ...(mergeStrategy && { mergeStrategy }),
264
281
  ...(hidden && { hidden }),
265
282
  ...(description && { description }),
283
+ ...(customMetadata && { customMetadata }),
266
284
  };
267
285
  }
268
286
  outputPort(ctx) {
@@ -276,6 +294,7 @@ class PortVisitor extends BaseVisitor {
276
294
  scope = this.visit(ctx.scopeClause);
277
295
  }
278
296
  let hidden;
297
+ let customMetadata;
279
298
  if (ctx.metadataBracket) {
280
299
  // Handle multiple metadata brackets (e.g., [order:1] [placement:TOP])
281
300
  for (const bracket of ctx.metadataBracket) {
@@ -288,6 +307,9 @@ class PortVisitor extends BaseVisitor {
288
307
  dataType = metadata.dataType;
289
308
  if (metadata.hidden)
290
309
  hidden = true;
310
+ if (metadata.customMetadata) {
311
+ customMetadata = { ...customMetadata, ...metadata.customMetadata };
312
+ }
291
313
  }
292
314
  }
293
315
  if (ctx.descriptionClause) {
@@ -302,6 +324,7 @@ class PortVisitor extends BaseVisitor {
302
324
  ...(dataType && { dataType }),
303
325
  ...(hidden && { hidden }),
304
326
  ...(description && { description }),
327
+ ...(customMetadata && { customMetadata }),
305
328
  };
306
329
  }
307
330
  stepPort(ctx) {
@@ -325,6 +348,7 @@ class PortVisitor extends BaseVisitor {
325
348
  let dataType;
326
349
  let mergeStrategy;
327
350
  let hidden;
351
+ let customMetadata;
328
352
  if (ctx.orderAttr) {
329
353
  for (const attr of ctx.orderAttr) {
330
354
  order = this.visit(attr);
@@ -348,7 +372,14 @@ class PortVisitor extends BaseVisitor {
348
372
  if (ctx.hiddenAttr) {
349
373
  hidden = true;
350
374
  }
351
- return { order, placement, dataType, mergeStrategy, hidden };
375
+ if (ctx.customAttr) {
376
+ customMetadata = customMetadata || {};
377
+ for (const attr of ctx.customAttr) {
378
+ const { key, value } = this.visit(attr);
379
+ customMetadata[key] = value;
380
+ }
381
+ }
382
+ return { order, placement, dataType, mergeStrategy, hidden, customMetadata };
352
383
  }
353
384
  orderAttr(ctx) {
354
385
  return parseInt(ctx.orderValue[0].image, 10);
@@ -365,6 +396,31 @@ class PortVisitor extends BaseVisitor {
365
396
  mergeStrategyAttr(ctx) {
366
397
  return ctx.mergeStrategyValue[0].image;
367
398
  }
399
+ customAttr(ctx) {
400
+ const key = ctx.customKey[0].image;
401
+ let value;
402
+ if (ctx.customStrVal) {
403
+ // Remove quotes from string literal
404
+ const raw = ctx.customStrVal[0].image;
405
+ value = raw.slice(1, -1);
406
+ }
407
+ else if (ctx.customTrue) {
408
+ value = true;
409
+ }
410
+ else if (ctx.customFalse) {
411
+ value = false;
412
+ }
413
+ else if (ctx.customIntVal) {
414
+ value = parseInt(ctx.customIntVal[0].image, 10);
415
+ }
416
+ else if (ctx.customIdVal) {
417
+ value = ctx.customIdVal[0].image;
418
+ }
419
+ else {
420
+ value = '';
421
+ }
422
+ return { key, value };
423
+ }
368
424
  descriptionClause(ctx) {
369
425
  if (ctx.Identifier) {
370
426
  return ctx.Identifier.map((token) => token.image).join(' ');
@@ -9671,7 +9671,7 @@ var VERSION;
9671
9671
  var init_generated_version = __esm({
9672
9672
  "src/generated-version.ts"() {
9673
9673
  "use strict";
9674
- VERSION = "0.17.9";
9674
+ VERSION = "0.17.10";
9675
9675
  }
9676
9676
  });
9677
9677
 
@@ -31902,7 +31902,8 @@ var init_port_parser = __esm({
31902
31902
  { ALT: () => this.SUBRULE(this.placementAttr) },
31903
31903
  { ALT: () => this.SUBRULE(this.typeAttr) },
31904
31904
  { ALT: () => this.SUBRULE(this.mergeStrategyAttr) },
31905
- { ALT: () => this.SUBRULE(this.hiddenAttr) }
31905
+ { ALT: () => this.SUBRULE(this.hiddenAttr) },
31906
+ { ALT: () => this.SUBRULE(this.customAttr) }
31906
31907
  ]);
31907
31908
  }
31908
31909
  });
@@ -31936,6 +31937,18 @@ var init_port_parser = __esm({
31936
31937
  hiddenAttr = this.RULE("hiddenAttr", () => {
31937
31938
  this.CONSUME(HiddenKeyword);
31938
31939
  });
31940
+ // customAttr: key:value pairs for arbitrary metadata (e.g., artifactPath:"dist/")
31941
+ customAttr = this.RULE("customAttr", () => {
31942
+ this.CONSUME(Identifier, { LABEL: "customKey" });
31943
+ this.CONSUME(Colon);
31944
+ this.OR([
31945
+ { ALT: () => this.CONSUME(StringLiteral, { LABEL: "customStrVal" }) },
31946
+ { ALT: () => this.CONSUME(TrueKeyword, { LABEL: "customTrue" }) },
31947
+ { ALT: () => this.CONSUME(FalseKeyword, { LABEL: "customFalse" }) },
31948
+ { ALT: () => this.CONSUME2(Identifier, { LABEL: "customIdVal" }) },
31949
+ { ALT: () => this.CONSUME(Integer, { LABEL: "customIntVal" }) }
31950
+ ]);
31951
+ });
31939
31952
  // - description text
31940
31953
  // Note: We just consume the dash here. The actual description text is extracted
31941
31954
  // from the raw input in parsePortLine() to handle special characters like &, :, etc.
@@ -32022,6 +32035,7 @@ var init_port_parser = __esm({
32022
32035
  scope = this.visit(ctx.scopeClause);
32023
32036
  }
32024
32037
  let hidden;
32038
+ let customMetadata;
32025
32039
  if (ctx.metadataBracket) {
32026
32040
  for (const bracket of ctx.metadataBracket) {
32027
32041
  const metadata = this.visit(bracket);
@@ -32030,6 +32044,9 @@ var init_port_parser = __esm({
32030
32044
  if (metadata.dataType !== void 0) dataType = metadata.dataType;
32031
32045
  if (metadata.mergeStrategy !== void 0) mergeStrategy = metadata.mergeStrategy;
32032
32046
  if (metadata.hidden) hidden = true;
32047
+ if (metadata.customMetadata) {
32048
+ customMetadata = { ...customMetadata, ...metadata.customMetadata };
32049
+ }
32033
32050
  }
32034
32051
  }
32035
32052
  if (ctx.descriptionClause) {
@@ -32046,7 +32063,8 @@ var init_port_parser = __esm({
32046
32063
  ...dataType && { dataType },
32047
32064
  ...mergeStrategy && { mergeStrategy },
32048
32065
  ...hidden && { hidden },
32049
- ...description && { description }
32066
+ ...description && { description },
32067
+ ...customMetadata && { customMetadata }
32050
32068
  };
32051
32069
  }
32052
32070
  outputPort(ctx) {
@@ -32060,6 +32078,7 @@ var init_port_parser = __esm({
32060
32078
  scope = this.visit(ctx.scopeClause);
32061
32079
  }
32062
32080
  let hidden;
32081
+ let customMetadata;
32063
32082
  if (ctx.metadataBracket) {
32064
32083
  for (const bracket of ctx.metadataBracket) {
32065
32084
  const metadata = this.visit(bracket);
@@ -32067,6 +32086,9 @@ var init_port_parser = __esm({
32067
32086
  if (metadata.placement !== void 0) placement = metadata.placement;
32068
32087
  if (metadata.dataType !== void 0) dataType = metadata.dataType;
32069
32088
  if (metadata.hidden) hidden = true;
32089
+ if (metadata.customMetadata) {
32090
+ customMetadata = { ...customMetadata, ...metadata.customMetadata };
32091
+ }
32070
32092
  }
32071
32093
  }
32072
32094
  if (ctx.descriptionClause) {
@@ -32080,7 +32102,8 @@ var init_port_parser = __esm({
32080
32102
  ...placement && { placement },
32081
32103
  ...dataType && { dataType },
32082
32104
  ...hidden && { hidden },
32083
- ...description && { description }
32105
+ ...description && { description },
32106
+ ...customMetadata && { customMetadata }
32084
32107
  };
32085
32108
  }
32086
32109
  stepPort(ctx) {
@@ -32104,6 +32127,7 @@ var init_port_parser = __esm({
32104
32127
  let dataType;
32105
32128
  let mergeStrategy;
32106
32129
  let hidden;
32130
+ let customMetadata;
32107
32131
  if (ctx.orderAttr) {
32108
32132
  for (const attr of ctx.orderAttr) {
32109
32133
  order = this.visit(attr);
@@ -32127,7 +32151,14 @@ var init_port_parser = __esm({
32127
32151
  if (ctx.hiddenAttr) {
32128
32152
  hidden = true;
32129
32153
  }
32130
- return { order, placement, dataType, mergeStrategy, hidden };
32154
+ if (ctx.customAttr) {
32155
+ customMetadata = customMetadata || {};
32156
+ for (const attr of ctx.customAttr) {
32157
+ const { key, value: value2 } = this.visit(attr);
32158
+ customMetadata[key] = value2;
32159
+ }
32160
+ }
32161
+ return { order, placement, dataType, mergeStrategy, hidden, customMetadata };
32131
32162
  }
32132
32163
  orderAttr(ctx) {
32133
32164
  return parseInt(ctx.orderValue[0].image, 10);
@@ -32144,6 +32175,25 @@ var init_port_parser = __esm({
32144
32175
  mergeStrategyAttr(ctx) {
32145
32176
  return ctx.mergeStrategyValue[0].image;
32146
32177
  }
32178
+ customAttr(ctx) {
32179
+ const key = ctx.customKey[0].image;
32180
+ let value2;
32181
+ if (ctx.customStrVal) {
32182
+ const raw = ctx.customStrVal[0].image;
32183
+ value2 = raw.slice(1, -1);
32184
+ } else if (ctx.customTrue) {
32185
+ value2 = true;
32186
+ } else if (ctx.customFalse) {
32187
+ value2 = false;
32188
+ } else if (ctx.customIntVal) {
32189
+ value2 = parseInt(ctx.customIntVal[0].image, 10);
32190
+ } else if (ctx.customIdVal) {
32191
+ value2 = ctx.customIdVal[0].image;
32192
+ } else {
32193
+ value2 = "";
32194
+ }
32195
+ return { key, value: value2 };
32196
+ }
32147
32197
  descriptionClause(ctx) {
32148
32198
  if (ctx.Identifier) {
32149
32199
  return ctx.Identifier.map((token) => token.image).join(" ");
@@ -34219,7 +34269,7 @@ var init_jsdoc_parser = __esm({
34219
34269
  if (!result) {
34220
34270
  return;
34221
34271
  }
34222
- const { name, defaultValue, isOptional, scope, order, mergeStrategy, hidden, description } = result;
34272
+ const { name, defaultValue, isOptional, scope, order, mergeStrategy, hidden, description, customMetadata } = result;
34223
34273
  let type2;
34224
34274
  let tsType;
34225
34275
  const isScopedStepInput = scope && isScopedMandatoryPort(name);
@@ -34280,7 +34330,9 @@ var init_jsdoc_parser = __esm({
34280
34330
  ...scope && { scope },
34281
34331
  ...mergeStrategy && { mergeStrategy },
34282
34332
  ...hidden && { hidden },
34283
- ...order !== void 0 && { metadata: { order } },
34333
+ ...(order !== void 0 || customMetadata) && {
34334
+ metadata: { ...order !== void 0 && { order }, ...customMetadata }
34335
+ },
34284
34336
  ...tsType && { tsType }
34285
34337
  };
34286
34338
  }
@@ -34294,7 +34346,7 @@ var init_jsdoc_parser = __esm({
34294
34346
  if (!result) {
34295
34347
  return;
34296
34348
  }
34297
- const { name, scope, order, hidden, description } = result;
34349
+ const { name, scope, order, hidden, description, customMetadata } = result;
34298
34350
  let type2;
34299
34351
  let tsType;
34300
34352
  const isScopedStepOutput = scope && isScopedMandatoryPort(name);
@@ -34348,7 +34400,9 @@ var init_jsdoc_parser = __esm({
34348
34400
  label: description?.trim(),
34349
34401
  ...scope && { scope },
34350
34402
  ...hidden && { hidden },
34351
- ...order !== void 0 && { metadata: { order } },
34403
+ ...(order !== void 0 || customMetadata) && {
34404
+ metadata: { ...order !== void 0 && { order }, ...customMetadata }
34405
+ },
34352
34406
  ...tsType && { tsType }
34353
34407
  };
34354
34408
  }
@@ -34386,7 +34440,7 @@ var init_jsdoc_parser = __esm({
34386
34440
  if (!result) {
34387
34441
  return;
34388
34442
  }
34389
- const { name, order, description } = result;
34443
+ const { name, order, description, customMetadata } = result;
34390
34444
  let type2 = "ANY";
34391
34445
  if (isSuccessPort(name) || isFailurePort(name)) {
34392
34446
  type2 = "STEP";
@@ -34407,7 +34461,9 @@ var init_jsdoc_parser = __esm({
34407
34461
  config2.returnPorts[name] = {
34408
34462
  dataType: type2,
34409
34463
  label: description?.trim(),
34410
- ...order !== void 0 && { metadata: { order } }
34464
+ ...(order !== void 0 || customMetadata) && {
34465
+ metadata: { ...order !== void 0 && { order }, ...customMetadata }
34466
+ }
34411
34467
  };
34412
34468
  }
34413
34469
  /**
@@ -105820,7 +105876,7 @@ function displayInstalledPackage(pkg) {
105820
105876
  // src/cli/index.ts
105821
105877
  init_logger();
105822
105878
  init_error_utils();
105823
- var version2 = true ? "0.17.9" : "0.0.0-dev";
105879
+ var version2 = true ? "0.17.10" : "0.0.0-dev";
105824
105880
  var program2 = new Command();
105825
105881
  program2.name("flow-weaver").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", () => {
105826
105882
  logger.banner(version2);
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.17.9";
1
+ export declare const VERSION = "0.17.10";
2
2
  //# sourceMappingURL=generated-version.d.ts.map
@@ -1,3 +1,3 @@
1
1
  // Auto-generated by scripts/generate-version.ts — do not edit manually
2
- export const VERSION = '0.17.9';
2
+ export const VERSION = '0.17.10';
3
3
  //# sourceMappingURL=generated-version.js.map
@@ -522,7 +522,7 @@ export class JSDocParser {
522
522
  if (!result) {
523
523
  return;
524
524
  }
525
- const { name, defaultValue, isOptional, scope, order, mergeStrategy, hidden, description } = result;
525
+ const { name, defaultValue, isOptional, scope, order, mergeStrategy, hidden, description, customMetadata } = result;
526
526
  // Infer type from signature or scope callback return type
527
527
  let type;
528
528
  let tsType;
@@ -599,7 +599,9 @@ export class JSDocParser {
599
599
  ...(scope && { scope }),
600
600
  ...(mergeStrategy && { mergeStrategy: mergeStrategy }),
601
601
  ...(hidden && { hidden }),
602
- ...(order !== undefined && { metadata: { order } }),
602
+ ...((order !== undefined || customMetadata) && {
603
+ metadata: { ...(order !== undefined && { order }), ...customMetadata },
604
+ }),
603
605
  ...(tsType && { tsType }),
604
606
  };
605
607
  }
@@ -613,7 +615,7 @@ export class JSDocParser {
613
615
  if (!result) {
614
616
  return;
615
617
  }
616
- const { name, scope, order, hidden, description } = result;
618
+ const { name, scope, order, hidden, description, customMetadata } = result;
617
619
  // Infer type from return type or scope callback parameter
618
620
  let type;
619
621
  let tsType;
@@ -683,7 +685,9 @@ export class JSDocParser {
683
685
  label: description?.trim(),
684
686
  ...(scope && { scope }),
685
687
  ...(hidden && { hidden }),
686
- ...(order !== undefined && { metadata: { order } }),
688
+ ...((order !== undefined || customMetadata) && {
689
+ metadata: { ...(order !== undefined && { order }), ...customMetadata },
690
+ }),
687
691
  ...(tsType && { tsType }),
688
692
  };
689
693
  }
@@ -727,7 +731,7 @@ export class JSDocParser {
727
731
  if (!result) {
728
732
  return;
729
733
  }
730
- const { name, order, description } = result;
734
+ const { name, order, description, customMetadata } = result;
731
735
  // Infer type from return type signature
732
736
  let type = 'ANY';
733
737
  if (isSuccessPort(name) || isFailurePort(name)) {
@@ -753,7 +757,9 @@ export class JSDocParser {
753
757
  config.returnPorts[name] = {
754
758
  dataType: type,
755
759
  label: description?.trim(),
756
- ...(order !== undefined && { metadata: { order } }),
760
+ ...((order !== undefined || customMetadata) && {
761
+ metadata: { ...(order !== undefined && { order }), ...customMetadata },
762
+ }),
757
763
  };
758
764
  }
759
765
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synergenius/flow-weaver",
3
- "version": "0.17.9",
3
+ "version": "0.17.10",
4
4
  "description": "Deterministic workflow compiler for AI agents. Compiles to standalone TypeScript, no runtime dependencies.",
5
5
  "private": false,
6
6
  "type": "module",