@synergenius/flow-weaver 0.17.0 → 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.
Files changed (123) hide show
  1. package/dist/api/index.d.ts +4 -1
  2. package/dist/api/index.js +4 -1
  3. package/dist/api/templates.js +2 -2
  4. package/dist/api/validate.d.ts +2 -2
  5. package/dist/api/validate.js +6 -6
  6. package/dist/api/validation-registry.d.ts +10 -0
  7. package/dist/api/validation-registry.js +10 -0
  8. package/dist/ast/types.d.ts +91 -4
  9. package/dist/built-in-nodes/invoke-workflow.d.ts +1 -1
  10. package/dist/built-in-nodes/invoke-workflow.js +1 -1
  11. package/dist/chevrotain-parser/connect-parser.js +25 -7
  12. package/dist/cli/commands/compile.d.ts +5 -9
  13. package/dist/cli/commands/compile.js +21 -14
  14. package/dist/cli/commands/dev.d.ts +2 -13
  15. package/dist/cli/commands/dev.js +10 -204
  16. package/dist/cli/commands/doctor.js +6 -3
  17. package/dist/cli/commands/export.d.ts +8 -17
  18. package/dist/cli/commands/export.js +8 -17
  19. package/dist/cli/commands/init-personas.d.ts +17 -6
  20. package/dist/cli/commands/init-personas.js +73 -24
  21. package/dist/cli/commands/init.d.ts +5 -2
  22. package/dist/cli/commands/init.js +73 -42
  23. package/dist/cli/commands/mcp-setup.d.ts +7 -0
  24. package/dist/cli/commands/mcp-setup.js +16 -1
  25. package/dist/cli/flow-weaver.mjs +71002 -70385
  26. package/dist/cli/index.d.ts +1 -0
  27. package/dist/cli/index.js +9 -7
  28. package/dist/cli/templates/index.d.ts +20 -1
  29. package/dist/cli/templates/index.js +66 -15
  30. package/dist/cli/templates/nodes/human-approval.js +2 -3
  31. package/dist/cli/templates/nodes/rag-retriever.js +1 -1
  32. package/dist/constants.d.ts +7 -0
  33. package/dist/constants.js +13 -3
  34. package/dist/context/index.js +13 -3
  35. package/dist/deployment/config/loader.js +2 -1
  36. package/dist/deployment/core/adapters.d.ts +1 -25
  37. package/dist/deployment/core/adapters.js +0 -95
  38. package/dist/deployment/core/formatters.d.ts +0 -15
  39. package/dist/deployment/core/formatters.js +0 -24
  40. package/dist/deployment/index.d.ts +7 -5
  41. package/dist/deployment/index.js +8 -5
  42. package/dist/deployment/types.d.ts +2 -45
  43. package/dist/diagram/html-viewer.js +65 -32
  44. package/dist/diagram/renderer.js +9 -6
  45. package/dist/diagram/theme.js +4 -0
  46. package/dist/diagram/types.d.ts +2 -0
  47. package/dist/doc-metadata/extractors/annotations.js +5 -5
  48. package/dist/doc-metadata/extractors/cli-commands.js +1 -1
  49. package/dist/doc-metadata/extractors/mcp-tools.js +1 -2
  50. package/dist/docs/index.d.ts +28 -1
  51. package/dist/docs/index.js +95 -28
  52. package/dist/export/index.d.ts +2 -3
  53. package/dist/{deployment/targets/cicd-base.d.ts → extensions/cicd/base-target.d.ts} +35 -36
  54. package/dist/{deployment/targets/cicd-base.js → extensions/cicd/base-target.js} +97 -57
  55. package/dist/{validation/cicd-detection.d.ts → extensions/cicd/detection.d.ts} +2 -2
  56. package/dist/{validation/cicd-detection.js → extensions/cicd/detection.js} +13 -1
  57. package/dist/extensions/cicd/docs/cicd.md +395 -0
  58. package/dist/extensions/cicd/index.d.ts +10 -0
  59. package/dist/extensions/cicd/index.js +10 -0
  60. package/dist/extensions/cicd/register.d.ts +11 -0
  61. package/dist/extensions/cicd/register.js +62 -0
  62. package/dist/extensions/cicd/rules.d.ts +30 -0
  63. package/dist/{validation/cicd-rules.js → extensions/cicd/rules.js} +60 -56
  64. package/dist/extensions/cicd/tag-handler.d.ts +14 -0
  65. package/dist/extensions/cicd/tag-handler.js +488 -0
  66. package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-docker.d.ts +1 -1
  67. package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-matrix.d.ts +1 -1
  68. package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-multi-env.d.ts +1 -1
  69. package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-test-deploy.d.ts +1 -1
  70. package/dist/extensions/index.d.ts +12 -0
  71. package/dist/extensions/index.js +12 -0
  72. package/dist/extensions/inngest/dev-mode.d.ts +9 -0
  73. package/dist/extensions/inngest/dev-mode.js +213 -0
  74. package/dist/{generator/inngest.d.ts → extensions/inngest/generator.d.ts} +2 -2
  75. package/dist/{generator/inngest.js → extensions/inngest/generator.js} +4 -4
  76. package/dist/extensions/inngest/index.d.ts +2 -0
  77. package/dist/extensions/inngest/index.js +2 -0
  78. package/dist/extensions/inngest/register.d.ts +6 -0
  79. package/dist/extensions/inngest/register.js +23 -0
  80. package/dist/extensions/inngest/templates/ai-agent-durable.d.ts +8 -0
  81. package/dist/{cli/templates/workflows → extensions/inngest/templates}/ai-agent-durable.js +8 -8
  82. package/dist/{cli/templates/workflows → extensions/inngest/templates}/ai-pipeline-durable.d.ts +2 -2
  83. package/dist/{cli/templates/workflows → extensions/inngest/templates}/ai-pipeline-durable.js +7 -7
  84. package/dist/generated-version.d.ts +1 -1
  85. package/dist/generated-version.js +1 -1
  86. package/dist/generator/compile-target-registry.d.ts +20 -0
  87. package/dist/generator/compile-target-registry.js +20 -0
  88. package/dist/generator/dev-mode-registry.d.ts +27 -0
  89. package/dist/generator/dev-mode-registry.js +20 -0
  90. package/dist/index.d.ts +4 -0
  91. package/dist/index.js +3 -0
  92. package/dist/jsdoc-parser.d.ts +12 -114
  93. package/dist/jsdoc-parser.js +57 -362
  94. package/dist/marketplace/index.d.ts +2 -2
  95. package/dist/marketplace/index.js +1 -1
  96. package/dist/marketplace/registry.d.ts +39 -1
  97. package/dist/marketplace/registry.js +77 -0
  98. package/dist/marketplace/types.d.ts +76 -3
  99. package/dist/mcp/server.d.ts +1 -0
  100. package/dist/mcp/server.js +2 -0
  101. package/dist/mcp/tools-export.js +3 -3
  102. package/dist/mcp/tools-query.js +17 -11
  103. package/dist/mcp/tools-template.js +1 -1
  104. package/dist/parser/tag-registry.d.ts +47 -0
  105. package/dist/parser/tag-registry.js +57 -0
  106. package/dist/parser.d.ts +3 -0
  107. package/dist/parser.js +10 -23
  108. package/dist/validation/rule-registry.d.ts +36 -0
  109. package/dist/validation/rule-registry.js +37 -0
  110. package/dist/validator.js +3 -3
  111. package/docs/reference/concepts.md +2 -1
  112. package/docs/reference/deployment.md +21 -0
  113. package/docs/reference/jsdoc-grammar.md +242 -1
  114. package/docs/reference/scaffold.md +0 -6
  115. package/package.json +9 -1
  116. package/dist/cli/templates/workflows/ai-agent-durable.d.ts +0 -8
  117. package/dist/export/templates.d.ts +0 -24
  118. package/dist/export/templates.js +0 -186
  119. package/dist/validation/cicd-rules.d.ts +0 -62
  120. /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-docker.js +0 -0
  121. /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-matrix.js +0 -0
  122. /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-multi-env.js +0 -0
  123. /package/dist/{cli/templates/workflows → extensions/cicd/templates}/cicd-test-deploy.js +0 -0
@@ -36,6 +36,7 @@ export { type InPlaceGenerateOptions, type InPlaceGenerateResult, generateInPlac
36
36
  export { type ParseResult, parseWorkflow } from './parse.js';
37
37
  export { transformWorkflow } from './transform.js';
38
38
  export { type ValidationResult, validateWorkflow } from './validate.js';
39
+ export { validationRuleRegistry } from './validation-registry.js';
39
40
  export * from './manipulation.js';
40
41
  export { withValidation, withMinimalValidation, withoutValidation, type RemoveOptions, type NodeFilter, type OperationResult, validatePortReference, portReferencesEqual, formatPortReference, generateUniqueNodeId, assertNodeTypeExists, assertNodeExists, assertNodeNotExists, } from './helpers.js';
41
42
  export * from './query.js';
@@ -43,6 +44,8 @@ export * from './builder.js';
43
44
  export * from './workflow-file-operations.js';
44
45
  export * from './templates.js';
45
46
  export * from './patterns.js';
46
- export { generateInngestFunction } from '../generator/inngest.js';
47
47
  export { AnnotationParser } from '../parser.js';
48
+ export { compileTargetRegistry, type CompileTarget } from '../generator/compile-target-registry.js';
49
+ export { devModeRegistry, type DevModeProvider, type DevModeOptions } from '../generator/dev-mode-registry.js';
50
+ export { tagHandlerRegistry, type TagHandlerRegistry, type TTagHandlerFn, type TTagHandlerContext } from '../parser/tag-registry.js';
48
51
  //# sourceMappingURL=index.d.ts.map
package/dist/api/index.js CHANGED
@@ -35,6 +35,7 @@ export { generateInPlace, hasInPlaceMarkers, stripGeneratedSections, MARKERS, }
35
35
  export { parseWorkflow } from './parse.js';
36
36
  export { transformWorkflow } from './transform.js';
37
37
  export { validateWorkflow } from './validate.js';
38
+ export { validationRuleRegistry } from './validation-registry.js';
38
39
  export * from './manipulation.js';
39
40
  export { withValidation, withMinimalValidation, withoutValidation, validatePortReference, portReferencesEqual, formatPortReference, generateUniqueNodeId, assertNodeTypeExists, assertNodeExists, assertNodeNotExists, } from './helpers.js';
40
41
  export * from './query.js';
@@ -43,6 +44,8 @@ export * from './workflow-file-operations.js';
43
44
  export * from './templates.js';
44
45
  export * from './patterns.js';
45
46
  // Re-exports needed by export target packs
46
- export { generateInngestFunction } from '../generator/inngest.js';
47
47
  export { AnnotationParser } from '../parser.js';
48
+ export { compileTargetRegistry } from '../generator/compile-target-registry.js';
49
+ export { devModeRegistry } from '../generator/dev-mode-registry.js';
50
+ export { tagHandlerRegistry } from '../parser/tag-registry.js';
48
51
  //# sourceMappingURL=index.js.map
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @module
8
8
  */
9
- import { workflowTemplates, nodeTemplates, getWorkflowTemplate as getWorkflowTemplateById, getNodeTemplate as getNodeTemplateById, } from "../cli/templates/index.js";
9
+ import { nodeTemplates, getAllWorkflowTemplates, getWorkflowTemplate as getWorkflowTemplateById, getNodeTemplate as getNodeTemplateById, } from "../cli/templates/index.js";
10
10
  /**
11
11
  * List all available workflow templates
12
12
  *
@@ -19,7 +19,7 @@ import { workflowTemplates, nodeTemplates, getWorkflowTemplate as getWorkflowTem
19
19
  * ```
20
20
  */
21
21
  export function listWorkflowTemplates() {
22
- return workflowTemplates;
22
+ return getAllWorkflowTemplates();
23
23
  }
24
24
  /**
25
25
  * List all available node templates
@@ -14,8 +14,8 @@ export interface ValidationResult {
14
14
  /**
15
15
  * Validates a workflow AST
16
16
  *
17
- * Runs the built-in validator, then agent-specific rules, then any custom rules.
18
- * Agent rules are always applied automatically.
17
+ * Runs the built-in validator, then agent-specific rules, then registry rules
18
+ * (pack-contributed), then any custom rules.
19
19
  *
20
20
  * @param ast - The workflow AST to validate
21
21
  * @param options - Validation options: custom rules and/or draft mode
@@ -6,13 +6,12 @@
6
6
  */
7
7
  import { validator } from "../validator.js";
8
8
  import { getAgentValidationRules } from "../validation/agent-rules.js";
9
- import { getCICDValidationRules } from "../validation/cicd-rules.js";
10
- import { isCICDWorkflow } from "../validation/cicd-detection.js";
9
+ import { validationRuleRegistry } from "./validation-registry.js";
11
10
  /**
12
11
  * Validates a workflow AST
13
12
  *
14
- * Runs the built-in validator, then agent-specific rules, then any custom rules.
15
- * Agent rules are always applied automatically.
13
+ * Runs the built-in validator, then agent-specific rules, then registry rules
14
+ * (pack-contributed), then any custom rules.
16
15
  *
17
16
  * @param ast - The workflow AST to validate
18
17
  * @param options - Validation options: custom rules and/or draft mode
@@ -21,10 +20,11 @@ import { isCICDWorkflow } from "../validation/cicd-detection.js";
21
20
  export function validateWorkflow(ast, options) {
22
21
  // Use the consolidated validator
23
22
  const result = validator.validate(ast, { mode: options?.mode });
24
- // Apply agent-specific rules, CI/CD rules (only if workflow is CI/CD), and custom rules
23
+ // Apply agent-specific rules, registry rules (pack-contributed,
24
+ // including CI/CD when applicable), and custom rules
25
25
  const allRules = [
26
26
  ...getAgentValidationRules(),
27
- ...(isCICDWorkflow(ast) ? getCICDValidationRules() : []),
27
+ ...validationRuleRegistry.getApplicableRules(ast),
28
28
  ...(options?.customRules || []),
29
29
  ];
30
30
  for (const rule of allRules) {
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Singleton validation rule registry for the public API.
3
+ *
4
+ * Core rule sets (agent, CI/CD) are registered statically.
5
+ * Pack-contributed rule sets are registered via marketplace discovery.
6
+ */
7
+ import { ValidationRuleRegistry } from '../validation/rule-registry.js';
8
+ /** Global validation rule registry. Packs register rule sets here at startup. */
9
+ export declare const validationRuleRegistry: ValidationRuleRegistry;
10
+ //# sourceMappingURL=validation-registry.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Singleton validation rule registry for the public API.
3
+ *
4
+ * Core rule sets (agent, CI/CD) are registered statically.
5
+ * Pack-contributed rule sets are registered via marketplace discovery.
6
+ */
7
+ import { ValidationRuleRegistry } from '../validation/rule-registry.js';
8
+ /** Global validation rule registry. Packs register rule sets here at startup. */
9
+ export const validationRuleRegistry = new ValidationRuleRegistry();
10
+ //# sourceMappingURL=validation-registry.js.map
@@ -397,10 +397,18 @@ export type TNodeInstanceAST = {
397
397
  sourceLocation?: TSourceLocation;
398
398
  /** Reserved for plugin extensibility */
399
399
  metadata?: TNodeMetadata;
400
- /** CI/CD job group this node belongs to (from [job: "name"] attribute) */
400
+ /**
401
+ * CI/CD job group this node belongs to (from [job: "name"] attribute).
402
+ * @deprecated Use `deploy?.['cicd']?.job` instead. Kept for backwards compatibility.
403
+ */
401
404
  job?: string;
402
- /** CI/CD environment for this node's job (from [environment: "name"] attribute) */
405
+ /**
406
+ * CI/CD environment for this node's job (from [environment: "name"] attribute).
407
+ * @deprecated Use `deploy?.['cicd']?.environment` instead. Kept for backwards compatibility.
408
+ */
403
409
  environment?: string;
410
+ /** Per-target deploy config contributed by packs (e.g., deploy['cicd'].job) */
411
+ deploy?: Record<string, Record<string, unknown>>;
404
412
  };
405
413
  /**
406
414
  * Type compatibility result for a connection.
@@ -446,7 +454,10 @@ export type TWorkflowOptions = {
446
454
  limit: number;
447
455
  period?: string;
448
456
  };
449
- /** CI/CD pipeline configuration from @secret, @cache, @artifact, etc. */
457
+ /**
458
+ * CI/CD pipeline configuration from @secret, @cache, @artifact, etc.
459
+ * @deprecated Use `deploy?.['cicd']` instead. Kept for backwards compatibility.
460
+ */
450
461
  cicd?: TCICDOptions;
451
462
  /** Target-specific config (e.g., deploy['github-actions'].runner) */
452
463
  deploy?: Record<string, Record<string, unknown>>;
@@ -454,7 +465,8 @@ export type TWorkflowOptions = {
454
465
  /**
455
466
  * CI/CD domain options — shared across all CI/CD export targets.
456
467
  * Populated from @secret, @runner, @cache, @artifact, @environment,
457
- * @matrix, @service, @concurrency annotations.
468
+ * @matrix, @service, @concurrency, @job, @stage, @variables,
469
+ * @before_script, @tags, @includes annotations.
458
470
  */
459
471
  export type TCICDOptions = {
460
472
  /** Secret declarations for CI/CD pipelines */
@@ -478,6 +490,18 @@ export type TCICDOptions = {
478
490
  };
479
491
  /** Extended CI/CD triggers (push, PR, dispatch, tag) */
480
492
  triggers?: TCICDTrigger[];
493
+ /** Per-job configuration from @job annotations */
494
+ jobs?: TCICDJobConfig[];
495
+ /** Workflow-level default variables from @variables */
496
+ variables?: Record<string, string>;
497
+ /** Workflow-level before_script commands from @before_script */
498
+ beforeScript?: string[];
499
+ /** Workflow-level runner tags from @tags */
500
+ tags?: string[];
501
+ /** GitLab template includes from @includes */
502
+ includes?: TCICDInclude[];
503
+ /** Pipeline stage declarations from @stage */
504
+ stages?: TCICDStage[];
481
505
  };
482
506
  /** Secret declaration from @secret annotation */
483
507
  export type TCICDSecret = {
@@ -561,6 +585,69 @@ export type TCICDTrigger = {
561
585
  type?: string;
562
586
  }>;
563
587
  };
588
+ /** Per-job configuration from @job annotation */
589
+ export type TCICDJobConfig = {
590
+ /** Job identifier (must match a [job: "name"] on @node declarations) */
591
+ id: string;
592
+ /** Maximum retry count on failure */
593
+ retry?: number;
594
+ /** Whether this job can fail without failing the pipeline */
595
+ allowFailure?: boolean;
596
+ /** Job-level timeout duration (e.g., "30m", "1h") */
597
+ timeout?: string;
598
+ /** Key-value environment variables */
599
+ variables?: Record<string, string>;
600
+ /** Runner selection tags */
601
+ tags?: string[];
602
+ /** Setup commands run before the main script */
603
+ beforeScript?: string[];
604
+ /** Conditional execution rules */
605
+ rules?: TCICDJobRule[];
606
+ /** Coverage regex pattern */
607
+ coverage?: string;
608
+ /** Test/coverage report declarations */
609
+ reports?: TCICDReport[];
610
+ /** Per-job runner override */
611
+ runner?: string;
612
+ /** GitLab template to extend */
613
+ extends?: string;
614
+ };
615
+ /** Conditional execution rule for a CI/CD job */
616
+ export type TCICDJobRule = {
617
+ /** Condition expression (e.g., '$CI_COMMIT_BRANCH == "main"') */
618
+ if?: string;
619
+ /** When to run: always, never, manual, delayed */
620
+ when?: 'always' | 'never' | 'manual' | 'delayed';
621
+ /** Whether failure is allowed when this rule matches */
622
+ allowFailure?: boolean;
623
+ /** Variables to set when this rule matches */
624
+ variables?: Record<string, string>;
625
+ /** Changed file patterns that trigger this rule */
626
+ changes?: string[];
627
+ };
628
+ /** Report declaration for a CI/CD job */
629
+ export type TCICDReport = {
630
+ /** Report type (junit, cobertura, codequality, sast, etc.) */
631
+ type: string;
632
+ /** Report file path */
633
+ path: string;
634
+ };
635
+ /** GitLab include directive from @includes annotation */
636
+ export type TCICDInclude = {
637
+ /** Include type */
638
+ type: 'local' | 'project' | 'remote' | 'template';
639
+ /** File path or URL */
640
+ file: string;
641
+ /** Project path (for type=project) */
642
+ project?: string;
643
+ /** Git ref (for type=project) */
644
+ ref?: string;
645
+ };
646
+ /** Pipeline stage declaration from @stage annotation */
647
+ export type TCICDStage = {
648
+ /** Stage name */
649
+ name: string;
650
+ };
564
651
  /**
565
652
  * Connection AST - A link between two ports.
566
653
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @flowWeaver nodeType
3
- * @input functionId - Inngest function ID (e.g. "my-service/sub-workflow")
3
+ * @input functionId - Function ID of the workflow to invoke (e.g. "my-service/sub-workflow")
4
4
  * @input payload - Data to pass as event.data to the invoked function
5
5
  * @input [timeout] - Max wait time (e.g. "1h")
6
6
  * @output result - Return value from the invoked function
@@ -1,7 +1,7 @@
1
1
  import { getMockConfig, lookupMock } from './mock-types.js';
2
2
  /**
3
3
  * @flowWeaver nodeType
4
- * @input functionId - Inngest function ID (e.g. "my-service/sub-workflow")
4
+ * @input functionId - Function ID of the workflow to invoke (e.g. "my-service/sub-workflow")
5
5
  * @input payload - Data to pass as event.data to the invoked function
6
6
  * @input [timeout] - Max wait time (e.g. "1h")
7
7
  * @output result - Return value from the invoked function
@@ -24,15 +24,28 @@ class ConnectParser extends CstParser {
24
24
  this.CONSUME(Identifier, { LABEL: 'coerceType' });
25
25
  });
26
26
  });
27
- // node.port or node.port:scope
27
+ // node.port, node.port:scope, or pseudo-node (secret:NAME)
28
28
  portRef = this.RULE('portRef', () => {
29
29
  this.CONSUME(Identifier, { LABEL: 'nodeId' });
30
- this.CONSUME(Dot);
31
- this.CONSUME2(Identifier, { LABEL: 'portName' });
32
- this.OPTION(() => {
33
- this.CONSUME(Colon);
34
- this.CONSUME3(Identifier, { LABEL: 'scopeName' });
35
- });
30
+ this.OR([
31
+ {
32
+ ALT: () => {
33
+ this.CONSUME(Dot);
34
+ this.CONSUME2(Identifier, { LABEL: 'portName' });
35
+ this.OPTION(() => {
36
+ this.CONSUME(Colon);
37
+ this.CONSUME3(Identifier, { LABEL: 'scopeName' });
38
+ });
39
+ },
40
+ },
41
+ {
42
+ // pseudo-node: secret:NAME (nodeId="secret", colon, pseudoName="NAME")
43
+ ALT: () => {
44
+ this.CONSUME2(Colon, { LABEL: 'pseudoColon' });
45
+ this.CONSUME4(Identifier, { LABEL: 'pseudoName' });
46
+ },
47
+ },
48
+ ]);
36
49
  });
37
50
  }
38
51
  // =============================================================================
@@ -66,6 +79,11 @@ class ConnectVisitor extends BaseVisitor {
66
79
  }
67
80
  portRef(ctx) {
68
81
  const nodeId = ctx.nodeId[0].image;
82
+ // Pseudo-node branch: secret:NAME -> { nodeId: "secret:NAME", portName: "value" }
83
+ if (ctx.pseudoColon) {
84
+ const pseudoName = ctx.pseudoName[0].image;
85
+ return { nodeId: `${nodeId}:${pseudoName}`, portName: 'value' };
86
+ }
69
87
  const portName = ctx.portName[0].image;
70
88
  const scope = ctx.scopeName?.[0]?.image;
71
89
  return { nodeId, portName, scope };
@@ -26,13 +26,9 @@ export interface CompileOptions {
26
26
  * Useful for vibe coders who don't use the visual editor.
27
27
  */
28
28
  clean?: boolean;
29
- /**
30
- * Compilation target.
31
- * - 'typescript' (default): Standard in-place compilation
32
- * - 'inngest': Generate Inngest function with per-node step.run() for durability
33
- */
34
- target?: 'typescript' | 'inngest';
35
- /** Override @trigger cron from CLI (Inngest target only) */
29
+ /** Compilation target. 'typescript' (default) or a registered extension target. */
30
+ target?: string;
31
+ /** Override @trigger cron from CLI */
36
32
  cron?: string;
37
33
  /** Generate serve() handler */
38
34
  serve?: boolean;
@@ -47,9 +43,9 @@ export interface CompileOptions {
47
43
  }
48
44
  export declare function compileCommand(input: string, options?: CompileOptions): Promise<void>;
49
45
  /**
50
- * Compile a workflow file to Inngest function code with per-node step.run().
46
+ * Compile a workflow file using a registered custom compile target.
51
47
  */
52
- export declare function compileInngestTarget(input: string, options: {
48
+ export declare function compileCustomTarget(target: string, input: string, options: {
53
49
  production: boolean;
54
50
  verbose?: boolean;
55
51
  workflowName?: string;
@@ -12,7 +12,7 @@ import { logger } from '../utils/logger.js';
12
12
  import { getErrorMessage } from '../../utils/error-utils.js';
13
13
  import { getFriendlyError } from '../../friendly-errors.js';
14
14
  import { detectProjectModuleFormat } from './doctor.js';
15
- import { generateInngestFunction } from '../../generator/inngest.js';
15
+ import { compileTargetRegistry } from '../../generator/compile-target-registry.js';
16
16
  import { AnnotationParser } from '../../parser.js';
17
17
  /** Show path relative to cwd for cleaner output */
18
18
  function displayPath(filePath) {
@@ -37,9 +37,9 @@ function resolveModuleFormat(format, cwd) {
37
37
  }
38
38
  export async function compileCommand(input, options = {}) {
39
39
  const { production = false, sourceMap = false, strict = false, verbose = false, workflowName, dryRun = false, format, inlineRuntime = false, clean = false, target } = options;
40
- // Handle Inngest target compilation
41
- if (target === 'inngest') {
42
- return compileInngestTarget(input, { production, verbose, workflowName, dryRun });
40
+ // Handle custom compile target
41
+ if (target && target !== 'typescript') {
42
+ return compileCustomTarget(target, input, { production, verbose, workflowName, dryRun, cron: options.cron, serve: options.serve, framework: options.framework, typedEvents: options.typedEvents, retries: options.retries, timeout: options.timeout });
43
43
  }
44
44
  // Resolve module format (auto-detect if not specified)
45
45
  const cwd = process.cwd();
@@ -222,19 +222,27 @@ export async function compileCommand(input, options = {}) {
222
222
  }
223
223
  }
224
224
  /**
225
- * Compile a workflow file to Inngest function code with per-node step.run().
225
+ * Compile a workflow file using a registered custom compile target.
226
226
  */
227
- export async function compileInngestTarget(input, options) {
227
+ export async function compileCustomTarget(target, input, options) {
228
+ const customTarget = compileTargetRegistry.get(target);
229
+ if (!customTarget) {
230
+ const available = compileTargetRegistry.getNames();
231
+ const hint = available.length > 0
232
+ ? ` Available targets: typescript, ${available.join(', ')}`
233
+ : ' No custom targets registered.';
234
+ throw new Error(`Unknown compile target: ${target}.${hint}`);
235
+ }
228
236
  const filePath = path.resolve(input);
229
237
  if (!fs.existsSync(filePath)) {
230
238
  throw new Error(`File not found: ${displayPath(filePath)}`);
231
239
  }
232
- logger.section('Compiling to Inngest');
240
+ logger.section(`Compiling to ${target}`);
233
241
  logger.info(`Input: ${displayPath(filePath)}`);
234
- logger.info(`Target: Inngest (per-node step.run)`);
242
+ logger.info(`Target: ${target}`);
235
243
  logger.newline();
236
- const parser = new AnnotationParser();
237
- const parseResult = parser.parse(filePath);
244
+ const annotationParser = new AnnotationParser();
245
+ const parseResult = annotationParser.parse(filePath);
238
246
  if (parseResult.errors.length > 0) {
239
247
  const msgs = parseResult.errors.map((e) => ` ${e}`).join('\n');
240
248
  throw new Error(`Parse errors:\n${msgs}`);
@@ -263,13 +271,13 @@ export async function compileInngestTarget(input, options) {
263
271
  workflow.options = workflow.options || {};
264
272
  workflow.options.timeout = options.timeout;
265
273
  }
266
- const code = generateInngestFunction(workflow, allNodeTypes, {
274
+ const code = customTarget.compile(workflow, allNodeTypes, {
267
275
  production: options.production,
268
276
  typedEvents: options.typedEvents,
269
277
  serveHandler: options.serve,
270
278
  framework: options.framework,
271
279
  });
272
- const outputPath = filePath.replace(/\.ts$/, '.inngest.ts');
280
+ const outputPath = filePath.replace(/\.ts$/, `.${target}.ts`);
273
281
  if (options.dryRun) {
274
282
  logger.success(`Would generate: ${displayPath(outputPath)}`);
275
283
  logger.newline();
@@ -287,7 +295,6 @@ export async function compileInngestTarget(input, options) {
287
295
  }
288
296
  logger.newline();
289
297
  logger.section('Summary');
290
- logger.success(`Workflow "${workflow.name}" compiled to Inngest function`);
291
- logger.info('Each node is wrapped in step.run() for per-node durability');
298
+ logger.success(`Workflow "${workflow.name}" compiled to ${target} target`);
292
299
  }
293
300
  //# sourceMappingURL=compile.js.map
@@ -1,29 +1,18 @@
1
1
  /**
2
2
  * Dev command - watch, compile, and run workflow on changes
3
3
  */
4
- export interface DevOptions {
4
+ import { type DevModeOptions } from '../../generator/dev-mode-registry.js';
5
+ export interface DevOptions extends DevModeOptions {
5
6
  /** Input parameters as JSON string */
6
7
  params?: string;
7
8
  /** Path to JSON file containing input parameters */
8
9
  paramsFile?: string;
9
- /** Specific workflow name to run (if file contains multiple workflows) */
10
- workflow?: string;
11
- /** Run in production mode (no trace events) */
12
- production?: boolean;
13
10
  /** Module format for generated code */
14
11
  format?: 'esm' | 'cjs' | 'auto';
15
12
  /** Omit redundant @param/@returns annotations */
16
13
  clean?: boolean;
17
- /** Run once then exit (for testing) */
18
- once?: boolean;
19
- /** Output result as JSON (for scripting) */
20
- json?: boolean;
21
14
  /** Compilation target (default: typescript in-place) */
22
15
  target?: string;
23
- /** Framework for serve handler (inngest target only) */
24
- framework?: 'next' | 'express' | 'hono' | 'fastify' | 'remix';
25
- /** Port for the dev server (inngest target only) */
26
- port?: number;
27
16
  }
28
17
  /**
29
18
  * Dev command: watch + compile + run in a single loop.