@synergenius/flow-weaver 0.19.3 → 0.19.5

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.
@@ -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.19.3";
9674
+ VERSION = "0.19.5";
9675
9675
  }
9676
9676
  });
9677
9677
 
@@ -35842,7 +35842,17 @@ var init_parser2 = __esm({
35842
35842
  const hasExtension = extensions.some((ext2) => moduleSpecifier.endsWith(ext2));
35843
35843
  if (hasExtension) {
35844
35844
  const fullPath = path6.resolve(currentDir, moduleSpecifier);
35845
- return fs7.existsSync(fullPath) ? fullPath : null;
35845
+ if (fs7.existsSync(fullPath)) return fullPath;
35846
+ if (moduleSpecifier.endsWith(".js")) {
35847
+ const tsPath = fullPath.replace(/\.js$/, ".ts");
35848
+ if (fs7.existsSync(tsPath)) return tsPath;
35849
+ const tsxPath = fullPath.replace(/\.js$/, ".tsx");
35850
+ if (fs7.existsSync(tsxPath)) return tsxPath;
35851
+ } else if (moduleSpecifier.endsWith(".jsx")) {
35852
+ const tsxPath = fullPath.replace(/\.jsx$/, ".tsx");
35853
+ if (fs7.existsSync(tsxPath)) return tsxPath;
35854
+ }
35855
+ return null;
35846
35856
  }
35847
35857
  for (const ext2 of extensions) {
35848
35858
  const fullPath = path6.resolve(currentDir, moduleSpecifier + ext2);
@@ -73218,6 +73228,40 @@ __export(pack_commands_exports, {
73218
73228
  registerPackCommands: () => registerPackCommands
73219
73229
  });
73220
73230
  import * as path55 from "path";
73231
+ import { createRequire as createRequire2 } from "node:module";
73232
+ function getEngineVersion2() {
73233
+ try {
73234
+ const req = createRequire2(import.meta.url);
73235
+ const pkg = req("../../package.json");
73236
+ return pkg.version;
73237
+ } catch {
73238
+ return "0.0.0";
73239
+ }
73240
+ }
73241
+ function compareVersions2(a, b) {
73242
+ const pa = a.split(".").map(Number);
73243
+ const pb = b.split(".").map(Number);
73244
+ for (let i = 0; i < 3; i++) {
73245
+ const diff = (pa[i] ?? 0) - (pb[i] ?? 0);
73246
+ if (diff !== 0) return diff;
73247
+ }
73248
+ return 0;
73249
+ }
73250
+ function checkPackEngineVersion2(pkg) {
73251
+ const required2 = pkg.manifest.engineVersion;
73252
+ if (!required2) return;
73253
+ const minVersion = required2.replace(/^>=?\s*/, "");
73254
+ const current2 = getEngineVersion2();
73255
+ if (current2 === "0.0.0") return;
73256
+ if (compareVersions2(current2, minVersion) < 0) {
73257
+ console.warn(
73258
+ `\x1B[33mWarning: ${pkg.name} requires flow-weaver >=${minVersion} but ${current2} is installed.\x1B[0m`
73259
+ );
73260
+ console.warn(
73261
+ `\x1B[33mRun: npm install @synergenius/flow-weaver@latest\x1B[0m`
73262
+ );
73263
+ }
73264
+ }
73221
73265
  function deriveNamespace(packageName) {
73222
73266
  const base = packageName.replace(/^@[^/]+\//, "");
73223
73267
  return base.replace(/^flowweaver-pack-/, "");
@@ -73233,6 +73277,7 @@ async function registerPackCommands(program3) {
73233
73277
  for (const pkg of packages) {
73234
73278
  const manifest = pkg.manifest;
73235
73279
  if (!manifest.cliEntrypoint || !manifest.cliCommands?.length) continue;
73280
+ checkPackEngineVersion2(pkg);
73236
73281
  const namespace = deriveNamespace(pkg.name);
73237
73282
  const entrypointPath = path55.join(pkg.path, manifest.cliEntrypoint);
73238
73283
  const group = program3.command(namespace).description(`Commands from ${pkg.name}`);
@@ -103581,6 +103626,42 @@ function registerPrompts(mcp) {
103581
103626
  // src/mcp/pack-tools.ts
103582
103627
  init_registry();
103583
103628
  import * as path44 from "path";
103629
+ import { createRequire } from "node:module";
103630
+ function getEngineVersion() {
103631
+ try {
103632
+ const req = createRequire(import.meta.url);
103633
+ const pkg = req("../../package.json");
103634
+ return pkg.version;
103635
+ } catch {
103636
+ return "0.0.0";
103637
+ }
103638
+ }
103639
+ function compareVersions(a, b) {
103640
+ const pa = a.split(".").map(Number);
103641
+ const pb = b.split(".").map(Number);
103642
+ for (let i = 0; i < 3; i++) {
103643
+ const diff = (pa[i] ?? 0) - (pb[i] ?? 0);
103644
+ if (diff !== 0) return diff;
103645
+ }
103646
+ return 0;
103647
+ }
103648
+ function checkPackEngineVersion(pkg) {
103649
+ const required2 = pkg.manifest.engineVersion;
103650
+ if (!required2) return;
103651
+ const minVersion = required2.replace(/^>=?\s*/, "");
103652
+ const current2 = getEngineVersion();
103653
+ if (current2 === "0.0.0") return;
103654
+ if (compareVersions(current2, minVersion) < 0) {
103655
+ process.stderr.write(
103656
+ `\x1B[33mWarning: ${pkg.name} requires flow-weaver >=${minVersion} but ${current2} is installed.\x1B[0m
103657
+ `
103658
+ );
103659
+ process.stderr.write(
103660
+ `\x1B[33mRun: npm install @synergenius/flow-weaver@latest\x1B[0m
103661
+ `
103662
+ );
103663
+ }
103664
+ }
103584
103665
  async function registerPackMcpTools(mcp) {
103585
103666
  const projectDir = process.cwd();
103586
103667
  let packages;
@@ -103592,6 +103673,7 @@ async function registerPackMcpTools(mcp) {
103592
103673
  for (const pkg of packages) {
103593
103674
  const manifest = pkg.manifest;
103594
103675
  if (!manifest.mcpEntrypoint || !manifest.mcpTools?.length) continue;
103676
+ checkPackEngineVersion(pkg);
103595
103677
  const entrypointPath = path44.join(pkg.path, manifest.mcpEntrypoint);
103596
103678
  try {
103597
103679
  const mod = await import(entrypointPath);
@@ -106429,7 +106511,7 @@ function displayInstalledPackage(pkg) {
106429
106511
  // src/cli/index.ts
106430
106512
  init_logger();
106431
106513
  init_error_utils();
106432
- var version2 = true ? "0.19.3" : "0.0.0-dev";
106514
+ var version2 = true ? "0.19.5" : "0.0.0-dev";
106433
106515
  var program2 = new Command();
106434
106516
  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", () => {
106435
106517
  logger.banner(version2);
@@ -9,7 +9,41 @@
9
9
  * when the user actually invokes a pack command.
10
10
  */
11
11
  import * as path from 'path';
12
+ import { createRequire } from 'node:module';
12
13
  import { listInstalledPackages } from '../marketplace/registry.js';
14
+ function getEngineVersion() {
15
+ try {
16
+ const req = createRequire(import.meta.url);
17
+ const pkg = req('../../package.json');
18
+ return pkg.version;
19
+ }
20
+ catch {
21
+ return '0.0.0';
22
+ }
23
+ }
24
+ function compareVersions(a, b) {
25
+ const pa = a.split('.').map(Number);
26
+ const pb = b.split('.').map(Number);
27
+ for (let i = 0; i < 3; i++) {
28
+ const diff = (pa[i] ?? 0) - (pb[i] ?? 0);
29
+ if (diff !== 0)
30
+ return diff;
31
+ }
32
+ return 0;
33
+ }
34
+ function checkPackEngineVersion(pkg) {
35
+ const required = pkg.manifest.engineVersion;
36
+ if (!required)
37
+ return;
38
+ const minVersion = required.replace(/^>=?\s*/, '');
39
+ const current = getEngineVersion();
40
+ if (current === '0.0.0')
41
+ return; // dev mode, skip check
42
+ if (compareVersions(current, minVersion) < 0) {
43
+ console.warn(`\x1b[33mWarning: ${pkg.name} requires flow-weaver >=${minVersion} but ${current} is installed.\x1b[0m`);
44
+ console.warn(`\x1b[33mRun: npm install @synergenius/flow-weaver@latest\x1b[0m`);
45
+ }
46
+ }
13
47
  /**
14
48
  * Derive a short namespace from a pack's npm name.
15
49
  * @synergenius/flowweaver-pack-weaver -> weaver
@@ -32,6 +66,7 @@ export async function registerPackCommands(program) {
32
66
  const manifest = pkg.manifest;
33
67
  if (!manifest.cliEntrypoint || !manifest.cliCommands?.length)
34
68
  continue;
69
+ checkPackEngineVersion(pkg);
35
70
  const namespace = deriveNamespace(pkg.name);
36
71
  const entrypointPath = path.join(pkg.path, manifest.cliEntrypoint);
37
72
  const group = program
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.19.3";
1
+ export declare const VERSION = "0.19.5";
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.19.3';
2
+ export const VERSION = '0.19.5';
3
3
  //# sourceMappingURL=generated-version.js.map
@@ -5,7 +5,41 @@
5
5
  * imports the entrypoint and calls its registerMcpTools(mcp) function.
6
6
  */
7
7
  import * as path from 'path';
8
+ import { createRequire } from 'node:module';
8
9
  import { listInstalledPackages } from '../marketplace/registry.js';
10
+ function getEngineVersion() {
11
+ try {
12
+ const req = createRequire(import.meta.url);
13
+ const pkg = req('../../package.json');
14
+ return pkg.version;
15
+ }
16
+ catch {
17
+ return '0.0.0';
18
+ }
19
+ }
20
+ function compareVersions(a, b) {
21
+ const pa = a.split('.').map(Number);
22
+ const pb = b.split('.').map(Number);
23
+ for (let i = 0; i < 3; i++) {
24
+ const diff = (pa[i] ?? 0) - (pb[i] ?? 0);
25
+ if (diff !== 0)
26
+ return diff;
27
+ }
28
+ return 0;
29
+ }
30
+ function checkPackEngineVersion(pkg) {
31
+ const required = pkg.manifest.engineVersion;
32
+ if (!required)
33
+ return;
34
+ const minVersion = required.replace(/^>=?\s*/, '');
35
+ const current = getEngineVersion();
36
+ if (current === '0.0.0')
37
+ return;
38
+ if (compareVersions(current, minVersion) < 0) {
39
+ process.stderr.write(`\x1b[33mWarning: ${pkg.name} requires flow-weaver >=${minVersion} but ${current} is installed.\x1b[0m\n`);
40
+ process.stderr.write(`\x1b[33mRun: npm install @synergenius/flow-weaver@latest\x1b[0m\n`);
41
+ }
42
+ }
9
43
  export async function registerPackMcpTools(mcp) {
10
44
  const projectDir = process.cwd();
11
45
  let packages;
@@ -19,6 +53,7 @@ export async function registerPackMcpTools(mcp) {
19
53
  const manifest = pkg.manifest;
20
54
  if (!manifest.mcpEntrypoint || !manifest.mcpTools?.length)
21
55
  continue;
56
+ checkPackEngineVersion(pkg);
22
57
  const entrypointPath = path.join(pkg.path, manifest.mcpEntrypoint);
23
58
  try {
24
59
  const mod = await import(entrypointPath);
package/dist/parser.js CHANGED
@@ -311,11 +311,28 @@ export class AnnotationParser {
311
311
  }
312
312
  resolveModulePath(moduleSpecifier, currentDir) {
313
313
  const extensions = ['.ts', '.tsx', '.js', '.jsx'];
314
- // If already has extension, check if exists
314
+ // If already has extension, check if exists (with ESM .js → .ts fallback)
315
315
  const hasExtension = extensions.some((ext) => moduleSpecifier.endsWith(ext));
316
316
  if (hasExtension) {
317
317
  const fullPath = path.resolve(currentDir, moduleSpecifier);
318
- return fs.existsSync(fullPath) ? fullPath : null;
318
+ if (fs.existsSync(fullPath))
319
+ return fullPath;
320
+ // ESM convention: TypeScript files use .js extensions in imports.
321
+ // If the .js file doesn't exist, try the .ts/.tsx equivalent.
322
+ if (moduleSpecifier.endsWith('.js')) {
323
+ const tsPath = fullPath.replace(/\.js$/, '.ts');
324
+ if (fs.existsSync(tsPath))
325
+ return tsPath;
326
+ const tsxPath = fullPath.replace(/\.js$/, '.tsx');
327
+ if (fs.existsSync(tsxPath))
328
+ return tsxPath;
329
+ }
330
+ else if (moduleSpecifier.endsWith('.jsx')) {
331
+ const tsxPath = fullPath.replace(/\.jsx$/, '.tsx');
332
+ if (fs.existsSync(tsxPath))
333
+ return tsxPath;
334
+ }
335
+ return null;
319
336
  }
320
337
  // Try each extension in order
321
338
  for (const ext of extensions) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synergenius/flow-weaver",
3
- "version": "0.19.3",
3
+ "version": "0.19.5",
4
4
  "description": "Deterministic workflow compiler for AI agents. Compiles to standalone TypeScript, no runtime dependencies.",
5
5
  "private": false,
6
6
  "type": "module",