@synergenius/flow-weaver 0.17.7 → 0.17.8

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 (52) hide show
  1. package/dist/api/parse.d.ts +5 -0
  2. package/dist/api/parse.js +4 -0
  3. package/dist/ast/types.d.ts +2 -0
  4. package/dist/cli/commands/compile.js +2 -1
  5. package/dist/cli/commands/init.js +15 -9
  6. package/dist/cli/commands/validate.js +1 -1
  7. package/dist/cli/exports.d.ts +17 -0
  8. package/dist/cli/exports.js +23 -0
  9. package/dist/cli/flow-weaver.mjs +59021 -62127
  10. package/dist/cli/templates/index.js +8 -1
  11. package/dist/extensions/index.d.ts +10 -6
  12. package/dist/extensions/index.js +11 -6
  13. package/dist/generated-version.d.ts +1 -1
  14. package/dist/generated-version.js +1 -1
  15. package/dist/generator/index.d.ts +11 -0
  16. package/dist/generator/index.js +11 -0
  17. package/dist/parser.d.ts +7 -0
  18. package/dist/parser.js +29 -0
  19. package/package.json +11 -7
  20. package/dist/extensions/cicd/base-target.d.ts +0 -110
  21. package/dist/extensions/cicd/base-target.js +0 -397
  22. package/dist/extensions/cicd/detection.d.ts +0 -33
  23. package/dist/extensions/cicd/detection.js +0 -88
  24. package/dist/extensions/cicd/docs/cicd.md +0 -395
  25. package/dist/extensions/cicd/index.d.ts +0 -15
  26. package/dist/extensions/cicd/index.js +0 -15
  27. package/dist/extensions/cicd/register.d.ts +0 -11
  28. package/dist/extensions/cicd/register.js +0 -62
  29. package/dist/extensions/cicd/rules.d.ts +0 -30
  30. package/dist/extensions/cicd/rules.js +0 -288
  31. package/dist/extensions/cicd/tag-handler.d.ts +0 -14
  32. package/dist/extensions/cicd/tag-handler.js +0 -504
  33. package/dist/extensions/cicd/templates/cicd-docker.d.ts +0 -9
  34. package/dist/extensions/cicd/templates/cicd-docker.js +0 -110
  35. package/dist/extensions/cicd/templates/cicd-matrix.d.ts +0 -9
  36. package/dist/extensions/cicd/templates/cicd-matrix.js +0 -112
  37. package/dist/extensions/cicd/templates/cicd-multi-env.d.ts +0 -9
  38. package/dist/extensions/cicd/templates/cicd-multi-env.js +0 -126
  39. package/dist/extensions/cicd/templates/cicd-test-deploy.d.ts +0 -11
  40. package/dist/extensions/cicd/templates/cicd-test-deploy.js +0 -156
  41. package/dist/extensions/inngest/dev-mode.d.ts +0 -9
  42. package/dist/extensions/inngest/dev-mode.js +0 -213
  43. package/dist/extensions/inngest/generator.d.ts +0 -53
  44. package/dist/extensions/inngest/generator.js +0 -1176
  45. package/dist/extensions/inngest/index.d.ts +0 -2
  46. package/dist/extensions/inngest/index.js +0 -2
  47. package/dist/extensions/inngest/register.d.ts +0 -6
  48. package/dist/extensions/inngest/register.js +0 -23
  49. package/dist/extensions/inngest/templates/ai-agent-durable.d.ts +0 -8
  50. package/dist/extensions/inngest/templates/ai-agent-durable.js +0 -334
  51. package/dist/extensions/inngest/templates/ai-pipeline-durable.d.ts +0 -8
  52. package/dist/extensions/inngest/templates/ai-pipeline-durable.js +0 -326
@@ -106,11 +106,16 @@ export function registerWorkflowTemplates(templates) {
106
106
  export async function loadPackTemplates(projectDir) {
107
107
  try {
108
108
  const { listInstalledPackages } = await import('../../marketplace/registry.js');
109
+ const { registerPackUseCase } = await import('../commands/init-personas.js');
109
110
  const packages = await listInstalledPackages(projectDir);
110
111
  for (const pkg of packages) {
111
112
  const contributions = pkg.manifest.initContributions;
112
113
  if (!contributions?.templates)
113
114
  continue;
115
+ // Register use case if declared
116
+ if (contributions.useCase) {
117
+ registerPackUseCase(contributions.useCase, contributions.templates);
118
+ }
114
119
  // Pack templates must be exported from the pack's main entry point
115
120
  // or from a templates.js file alongside the manifest
116
121
  try {
@@ -122,7 +127,9 @@ export async function loadPackTemplates(projectDir) {
122
127
  if (mod.workflowTemplates && Array.isArray(mod.workflowTemplates)) {
123
128
  for (const tmpl of mod.workflowTemplates) {
124
129
  if (contributions.templates.includes(tmpl.id)) {
125
- packWorkflowTemplates.push(tmpl);
130
+ if (!packWorkflowTemplates.some((t) => t.id === tmpl.id)) {
131
+ packWorkflowTemplates.push(tmpl);
132
+ }
126
133
  }
127
134
  }
128
135
  }
@@ -1,12 +1,16 @@
1
1
  /**
2
2
  * Extension bootstrap loader.
3
3
  *
4
- * Side-effect imports for built-in extensions. Each extension self-registers
5
- * through the existing registry infrastructure (tag handlers, validation rules,
6
- * doc topics, templates, init use cases).
4
+ * Previously loaded built-in CI/CD and Inngest extensions via side-effect
5
+ * imports. Both have been extracted to marketplace packs:
7
6
  *
8
- * CLI and MCP entry points import this file once at startup.
7
+ * - CI/CD: @synergenius/flowweaver-pack-cicd
8
+ * - Inngest: @synergenius/flowweaver-pack-inngest
9
+ *
10
+ * Extensions are now discovered via marketplace pack discovery in the parser
11
+ * (loadPackHandlers) or registered by packs during installation.
12
+ *
13
+ * This file is kept as a no-op to avoid breaking CLI/MCP entry points that
14
+ * import it. It can be removed once those imports are cleaned up.
9
15
  */
10
- import './cicd/register.js';
11
- import './inngest/register.js';
12
16
  //# sourceMappingURL=index.d.ts.map
@@ -1,12 +1,17 @@
1
+ "use strict";
1
2
  /**
2
3
  * Extension bootstrap loader.
3
4
  *
4
- * Side-effect imports for built-in extensions. Each extension self-registers
5
- * through the existing registry infrastructure (tag handlers, validation rules,
6
- * doc topics, templates, init use cases).
5
+ * Previously loaded built-in CI/CD and Inngest extensions via side-effect
6
+ * imports. Both have been extracted to marketplace packs:
7
7
  *
8
- * CLI and MCP entry points import this file once at startup.
8
+ * - CI/CD: @synergenius/flowweaver-pack-cicd
9
+ * - Inngest: @synergenius/flowweaver-pack-inngest
10
+ *
11
+ * Extensions are now discovered via marketplace pack discovery in the parser
12
+ * (loadPackHandlers) or registered by packs during installation.
13
+ *
14
+ * This file is kept as a no-op to avoid breaking CLI/MCP entry points that
15
+ * import it. It can be removed once those imports are cleaned up.
9
16
  */
10
- import './cicd/register.js';
11
- import './inngest/register.js';
12
17
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.17.7";
1
+ export declare const VERSION = "0.17.8";
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.7';
2
+ export const VERSION = '0.17.8';
3
3
  //# sourceMappingURL=generated-version.js.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Generator utilities — public barrel for export target packs.
3
+ *
4
+ * Exposes control-flow analysis and code generation helpers used by
5
+ * compile targets (Inngest deep generator, CI/CD compile target, etc.).
6
+ */
7
+ export { buildControlFlowGraph, detectBranchingChains, findAllBranchingNodes, findNodesInBranch, performKahnsTopologicalSort, isPerPortScopedChild, computeParallelLevels, determineExecutionOrder, type ControlFlowGraph, } from './control-flow.js';
8
+ export { toValidIdentifier, getCoercionWrapper, buildMergeExpression, buildNodeArgumentsWithContext, generateNodeWithExecutionContext, buildExecutionContextReturnForBranch, type TBuildNodeArgsOptions, } from './code-utils.js';
9
+ export { compileTargetRegistry, type CompileTarget, } from './compile-target-registry.js';
10
+ export { devModeRegistry, type DevModeProvider, type DevModeOptions, } from './dev-mode-registry.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Generator utilities — public barrel for export target packs.
3
+ *
4
+ * Exposes control-flow analysis and code generation helpers used by
5
+ * compile targets (Inngest deep generator, CI/CD compile target, etc.).
6
+ */
7
+ export { buildControlFlowGraph, detectBranchingChains, findAllBranchingNodes, findNodesInBranch, performKahnsTopologicalSort, isPerPortScopedChild, computeParallelLevels, determineExecutionOrder, } from './control-flow.js';
8
+ export { toValidIdentifier, getCoercionWrapper, buildMergeExpression, buildNodeArgumentsWithContext, generateNodeWithExecutionContext, buildExecutionContextReturnForBranch, } from './code-utils.js';
9
+ export { compileTargetRegistry, } from './compile-target-registry.js';
10
+ export { devModeRegistry, } from './dev-mode-registry.js';
11
+ //# sourceMappingURL=index.js.map
package/dist/parser.d.ts CHANGED
@@ -32,7 +32,14 @@ export declare class AnnotationParser {
32
32
  private parseCache;
33
33
  /** Tag handler registry. Defaults to the global singleton (pre-populated by extensions). */
34
34
  tagRegistry: TagHandlerRegistry;
35
+ /** Tracks which projectDirs have already had their pack handlers loaded. */
36
+ private loadedPackDirs;
35
37
  constructor();
38
+ /**
39
+ * Discover and register tag handlers from installed marketplace packs.
40
+ * Results are cached per projectDir so repeated parse calls skip the scan.
41
+ */
42
+ loadPackHandlers(projectDir: string): Promise<void>;
36
43
  private computeHash;
37
44
  private detectMinorEdit;
38
45
  private patchAST;
package/dist/parser.js CHANGED
@@ -76,9 +76,38 @@ export class AnnotationParser {
76
76
  parseCache = new LRUCache(100);
77
77
  /** Tag handler registry. Defaults to the global singleton (pre-populated by extensions). */
78
78
  tagRegistry = tagHandlerRegistry;
79
+ /** Tracks which projectDirs have already had their pack handlers loaded. */
80
+ loadedPackDirs = new Set();
79
81
  constructor() {
80
82
  this.project = getSharedProject();
81
83
  }
84
+ /**
85
+ * Discover and register tag handlers from installed marketplace packs.
86
+ * Results are cached per projectDir so repeated parse calls skip the scan.
87
+ */
88
+ async loadPackHandlers(projectDir) {
89
+ if (this.loadedPackDirs.has(projectDir))
90
+ return;
91
+ this.loadedPackDirs.add(projectDir);
92
+ const { discoverTagHandlers } = await import('./marketplace/registry.js');
93
+ const handlers = await discoverTagHandlers(projectDir);
94
+ for (const discovered of handlers) {
95
+ // Skip if these tags are already registered (e.g. by side-effect imports)
96
+ if (discovered.tags.every((t) => this.tagRegistry.has(t)))
97
+ continue;
98
+ try {
99
+ const { pathToFileURL } = await import('node:url');
100
+ const mod = await import(pathToFileURL(discovered.absoluteFile).href);
101
+ const handlerFn = discovered.exportName ? mod[discovered.exportName] : mod.default;
102
+ if (typeof handlerFn === 'function') {
103
+ this.tagRegistry.register(discovered.tags, discovered.namespace, discovered.scope, handlerFn);
104
+ }
105
+ }
106
+ catch {
107
+ // Skip handlers that fail to load (pack may not be built)
108
+ }
109
+ }
110
+ }
82
111
  computeHash(content) {
83
112
  return createHash('sha256').update(content).digest('hex').slice(0, 16);
84
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synergenius/flow-weaver",
3
- "version": "0.17.7",
3
+ "version": "0.17.8",
4
4
  "description": "Deterministic workflow compiler for AI agents. Compiles to standalone TypeScript, no runtime dependencies.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -71,13 +71,17 @@
71
71
  "types": "./dist/testing/index.d.ts",
72
72
  "default": "./dist/testing/index.js"
73
73
  },
74
- "./extensions/inngest": {
75
- "types": "./dist/extensions/inngest/index.d.ts",
76
- "default": "./dist/extensions/inngest/index.js"
74
+ "./generator": {
75
+ "types": "./dist/generator/index.d.ts",
76
+ "default": "./dist/generator/index.js"
77
77
  },
78
- "./extensions/cicd": {
79
- "types": "./dist/extensions/cicd/index.d.ts",
80
- "default": "./dist/extensions/cicd/index.js"
78
+ "./constants": {
79
+ "types": "./dist/constants.d.ts",
80
+ "default": "./dist/constants.js"
81
+ },
82
+ "./cli": {
83
+ "types": "./dist/cli/exports.d.ts",
84
+ "default": "./dist/cli/exports.js"
81
85
  }
82
86
  },
83
87
  "bin": {
@@ -1,110 +0,0 @@
1
- /**
2
- * Base CI/CD Export Target
3
- *
4
- * Shared logic for generating CI/CD pipeline files (GitHub Actions, GitLab CI).
5
- * Unlike serverless targets, CI/CD targets produce native YAML that runs without
6
- * any FW runtime dependency.
7
- *
8
- * Key responsibilities:
9
- * - Build job graph from AST (group nodes by @job, compute dependencies)
10
- * - Resolve secret wiring (secret: pseudo-node connections -> job env vars)
11
- * - Inject artifact upload/download steps between jobs
12
- * - Generate SECRETS_SETUP.md documentation
13
- */
14
- import type { TWorkflowAST, TCICDSecret, TCICDCache, TCICDArtifact, TCICDService, TCICDMatrix } from '../../ast/types.js';
15
- import { BaseExportTarget, type ExportOptions, type MultiWorkflowArtifacts, type CompiledWorkflow, type NodeTypeArtifacts, type NodeTypeInfo, type NodeTypeExportOptions, type BundleArtifacts, type BundleWorkflow, type BundleNodeType } from '../../deployment/targets/base.js';
16
- export interface CICDStep {
17
- /** Node instance ID */
18
- id: string;
19
- /** Human-readable step name */
20
- name: string;
21
- /** Node type (used for action mapping) */
22
- nodeType: string;
23
- /** Environment variables for this step */
24
- env?: Record<string, string>;
25
- /** Per-target deploy config from @deploy annotations on the node type */
26
- nodeTypeDeploy?: Record<string, Record<string, unknown>>;
27
- }
28
- export interface CICDJob {
29
- /** Job identifier (from [job: "name"]) */
30
- id: string;
31
- /** Human-readable job name */
32
- name: string;
33
- /** Runner label (from @runner or job-level override) */
34
- runner?: string;
35
- /** Jobs that must complete before this one */
36
- needs: string[];
37
- /** Steps in execution order */
38
- steps: CICDStep[];
39
- /** Deployment environment (from [environment: "name"]) */
40
- environment?: string;
41
- /** Secret names used by this job */
42
- secrets: string[];
43
- /** Matrix strategy */
44
- matrix?: TCICDMatrix;
45
- /** Sidecar services */
46
- services?: TCICDService[];
47
- /** Cache configuration */
48
- cache?: TCICDCache;
49
- /** Artifacts to upload after this job */
50
- uploadArtifacts?: TCICDArtifact[];
51
- /** Artifact names to download before this job */
52
- downloadArtifacts?: string[];
53
- /** Maximum retry count on failure (from @job) */
54
- retry?: number;
55
- /** Whether this job can fail without failing the pipeline (from @job) */
56
- allowFailure?: boolean;
57
- /** Job-level timeout duration (from @job) */
58
- timeout?: string;
59
- /** Environment variables (from @job or @variables) */
60
- variables?: Record<string, string>;
61
- /** Runner selection tags (from @job or @tags) */
62
- tags?: string[];
63
- /** Setup commands before main script (from @job or @before_script) */
64
- beforeScript?: string[];
65
- /** Conditional execution rules (from @job) */
66
- rules?: Array<{
67
- if?: string;
68
- when?: string;
69
- allowFailure?: boolean;
70
- variables?: Record<string, string>;
71
- changes?: string[];
72
- }>;
73
- /** Coverage regex pattern (from @job) */
74
- coverage?: string;
75
- /** Test/coverage report declarations (from @job) */
76
- reports?: Array<{
77
- type: string;
78
- path: string;
79
- }>;
80
- /** GitLab template to extend (from @job) */
81
- extends?: string;
82
- /** Explicit stage name (from @stage) */
83
- stage?: string;
84
- }
85
- export interface ActionMapping {
86
- /** GitHub Actions `uses:` value */
87
- githubAction?: string;
88
- /** GitHub Actions `with:` defaults */
89
- githubWith?: Record<string, string>;
90
- /** GitLab CI script commands */
91
- gitlabScript?: string[];
92
- /** GitLab CI image override */
93
- gitlabImage?: string;
94
- /** Human-readable step name */
95
- label?: string;
96
- }
97
- export declare const NODE_ACTION_MAP: Record<string, ActionMapping>;
98
- export declare abstract class BaseCICDTarget extends BaseExportTarget {
99
- generateMultiWorkflow(_workflows: CompiledWorkflow[], _options: ExportOptions): Promise<MultiWorkflowArtifacts>;
100
- generateNodeTypeService(_nodeTypes: NodeTypeInfo[], _options: NodeTypeExportOptions): Promise<NodeTypeArtifacts>;
101
- generateBundle(_workflows: BundleWorkflow[], _nodeTypes: BundleNodeType[], _options: ExportOptions): Promise<BundleArtifacts>;
102
- protected resolveActionMapping(step: CICDStep, targetName: string): ActionMapping | undefined;
103
- protected buildJobGraph(ast: TWorkflowAST): CICDJob[];
104
- private topoSortJobs;
105
- private computeJobDepths;
106
- protected resolveJobSecrets(jobs: CICDJob[], ast: TWorkflowAST, renderSecretRef: (name: string) => string): void;
107
- protected injectArtifactSteps(jobs: CICDJob[], artifacts: TCICDArtifact[]): void;
108
- protected generateSecretsDoc(secrets: TCICDSecret[], platform: string): string;
109
- }
110
- //# sourceMappingURL=base-target.d.ts.map