@synergenius/flow-weaver 0.32.0 → 0.32.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.
@@ -251,6 +251,159 @@ const handlers = {
251
251
  },
252
252
  };
253
253
  },
254
+ // ─── market-install ─────────────────────────────────────────────
255
+ 'market-install': async (args) => {
256
+ const pkg = args.package;
257
+ if (!pkg) {
258
+ return { data: { success: false, error: 'Package name is required' } };
259
+ }
260
+ const cwd = args.cwd || process.cwd();
261
+ try {
262
+ const { execSync } = await import('child_process');
263
+ execSync(`npm install ${pkg}`, { cwd, stdio: 'pipe' });
264
+ // Try to read manifest from installed package
265
+ const packageName = pkg.replace(/@[^/]*$/, ''); // strip version suffix
266
+ const manifestPath = path.join(cwd, 'node_modules', packageName, 'flowweaver.manifest.json');
267
+ let manifest = null;
268
+ if (fs.existsSync(manifestPath)) {
269
+ manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
270
+ }
271
+ return { data: { success: true, package: pkg, manifest: manifest ? { name: manifest.name, version: manifest.version, nodeTypes: manifest.nodeTypes?.length ?? 0 } : null } };
272
+ }
273
+ catch (err) {
274
+ return { data: { success: false, error: err instanceof Error ? err.message : String(err) } };
275
+ }
276
+ },
277
+ // ─── market-uninstall ──────────────────────────────────────────
278
+ 'market-uninstall': async (args) => {
279
+ const pkg = args.package;
280
+ if (!pkg) {
281
+ return { data: { success: false, error: 'Package name is required' } };
282
+ }
283
+ const cwd = args.cwd || process.cwd();
284
+ try {
285
+ const { execSync } = await import('child_process');
286
+ execSync(`npm uninstall ${pkg}`, { cwd, stdio: 'pipe' });
287
+ return { data: { success: true, package: pkg, removed: true } };
288
+ }
289
+ catch (err) {
290
+ return { data: { success: false, error: err instanceof Error ? err.message : String(err) } };
291
+ }
292
+ },
293
+ // ─── market-init ───────────────────────────────────────────────
294
+ 'market-init': async (args) => {
295
+ const name = args.name;
296
+ if (!name) {
297
+ return { data: { success: false, error: 'Pack name is required' } };
298
+ }
299
+ const directory = path.resolve(String(args.directory || name));
300
+ fs.mkdirSync(directory, { recursive: true });
301
+ fs.mkdirSync(path.join(directory, 'src'), { recursive: true });
302
+ // Create package.json
303
+ const pkg = {
304
+ name: name.startsWith('flow-weaver-pack-') ? name : `flow-weaver-pack-${name}`,
305
+ version: '0.1.0',
306
+ type: 'module',
307
+ main: 'dist/index.js',
308
+ flowWeaver: {
309
+ type: 'marketplace-pack',
310
+ engineVersion: '>=0.30.0',
311
+ categories: [],
312
+ },
313
+ scripts: {
314
+ build: 'tsc',
315
+ pack: 'fw market pack',
316
+ },
317
+ peerDependencies: {
318
+ '@synergenius/flow-weaver': '>=0.30.0',
319
+ },
320
+ };
321
+ fs.writeFileSync(path.join(directory, 'package.json'), JSON.stringify(pkg, null, 2));
322
+ // Create tsconfig
323
+ const tsconfig = {
324
+ compilerOptions: {
325
+ target: 'ES2022', module: 'NodeNext', moduleResolution: 'NodeNext',
326
+ outDir: 'dist', declaration: true, strict: true, esModuleInterop: true,
327
+ },
328
+ include: ['src'],
329
+ };
330
+ fs.writeFileSync(path.join(directory, 'tsconfig.json'), JSON.stringify(tsconfig, null, 2));
331
+ // Create starter node type
332
+ const starterNode = `/** @flowWeaver nodeType @expression */\nexport function hello(name: string): { greeting: string } {\n return { greeting: \`Hello, \${name}!\` };\n}\n`;
333
+ fs.writeFileSync(path.join(directory, 'src', 'index.ts'), starterNode);
334
+ return { data: { success: true, directory, name: pkg.name, files: ['package.json', 'tsconfig.json', 'src/index.ts'] } };
335
+ },
336
+ // ─── market-pack ───────────────────────────────────────────────
337
+ 'market-pack': async (args) => {
338
+ const directory = path.resolve(String(args.directory || process.cwd()));
339
+ const pkgJsonPath = path.join(directory, 'package.json');
340
+ if (!fs.existsSync(pkgJsonPath)) {
341
+ return { data: { success: false, error: `No package.json found in ${directory}` } };
342
+ }
343
+ try {
344
+ const { generateManifest, writeManifest } = await import('../marketplace/manifest.js');
345
+ const { validatePackage } = await import('../marketplace/validator.js');
346
+ const genResult = await generateManifest({ directory });
347
+ const manifest = genResult.manifest;
348
+ const dryRun = Boolean(args.dryRun);
349
+ if (!dryRun) {
350
+ writeManifest(directory, manifest);
351
+ }
352
+ // Run validation
353
+ const validation = await validatePackage(directory, manifest);
354
+ const errors = validation.issues.filter((i) => i.severity === 'error');
355
+ const warnings = validation.issues.filter((i) => i.severity === 'warning');
356
+ return {
357
+ data: {
358
+ success: errors.length === 0,
359
+ manifest: {
360
+ name: manifest.name,
361
+ version: manifest.version,
362
+ nodeTypes: manifest.nodeTypes?.length ?? 0,
363
+ workflows: manifest.workflows?.length ?? 0,
364
+ cliCommands: manifest.cliCommands?.length ?? 0,
365
+ },
366
+ errors: errors.map((e) => e.message),
367
+ warnings: warnings.map((w) => w.message),
368
+ dryRun,
369
+ },
370
+ };
371
+ }
372
+ catch (err) {
373
+ return { data: { success: false, error: err instanceof Error ? err.message : String(err) } };
374
+ }
375
+ },
376
+ // ─── market-publish ────────────────────────────────────────────
377
+ 'market-publish': async (args) => {
378
+ const directory = path.resolve(String(args.directory || process.cwd()));
379
+ const dryRun = Boolean(args.dryRun);
380
+ const tag = args.tag;
381
+ const pkgJsonPath = path.join(directory, 'package.json');
382
+ if (!fs.existsSync(pkgJsonPath)) {
383
+ return { data: { success: false, error: `No package.json found in ${directory}` } };
384
+ }
385
+ const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));
386
+ if (dryRun) {
387
+ return {
388
+ data: {
389
+ success: true,
390
+ dryRun: true,
391
+ package: pkg.name,
392
+ version: pkg.version,
393
+ message: `Would publish ${pkg.name}@${pkg.version}${tag ? ` with tag ${tag}` : ''}`,
394
+ },
395
+ };
396
+ }
397
+ try {
398
+ const { execSync } = await import('child_process');
399
+ const tagFlag = tag ? ` --tag ${tag}` : '';
400
+ execSync(`npm publish${tagFlag}`, { cwd: directory, stdio: 'pipe' });
401
+ return { data: { success: true, package: pkg.name, version: pkg.version, published: true } };
402
+ }
403
+ catch (err) {
404
+ return { data: { success: false, error: err instanceof Error ? err.message : String(err) } };
405
+ }
406
+ },
254
407
  // ─── migrate ────────────────────────────────────────────────────
255
408
  migrate: async (args) => {
256
409
  const filePath = resolveFile(args, args.cwd);
@@ -412,6 +565,43 @@ const handlers = {
412
565
  return { data: { authenticated: false, message: err instanceof Error ? err.message : String(err) } };
413
566
  }
414
567
  },
568
+ // ─── export ──────────────────────────────────────────────────────
569
+ export: async (args) => {
570
+ const filePath = resolveFile(args, args.cwd);
571
+ const target = String(args.target);
572
+ const outputDir = args.output ? path.resolve(String(args.output)) : path.resolve('export');
573
+ const dryRun = Boolean(args.dryRun);
574
+ // Parse and validate
575
+ const parseResult = await parseWorkflow(filePath);
576
+ if (parseResult.errors.length > 0) {
577
+ return { data: { errors: parseResult.errors } };
578
+ }
579
+ const validation = validateWorkflow(parseResult.ast);
580
+ if (!validation.valid) {
581
+ return { data: { errors: validation.errors.map((e) => typeof e === 'string' ? e : e.message) } };
582
+ }
583
+ // Compile first
584
+ await compileWorkflow(filePath);
585
+ // Load export target registry
586
+ const { createTargetRegistry } = await import('../deployment/index.js');
587
+ const registry = await createTargetRegistry(path.dirname(filePath));
588
+ const targetInstance = registry.get(target);
589
+ if (!targetInstance) {
590
+ const available = registry.getNames();
591
+ return { data: { error: `Unknown export target: ${target}. Available: ${available.join(', ')}` } };
592
+ }
593
+ if (dryRun) {
594
+ return { data: { target, filePath, outputDir, dryRun: true, message: `Would export to ${target} at ${outputDir}` } };
595
+ }
596
+ const workflowName = args.workflow || parseResult.ast.name;
597
+ const artifacts = await targetInstance.generate({
598
+ sourceFile: filePath,
599
+ workflowName,
600
+ displayName: workflowName,
601
+ outputDir,
602
+ });
603
+ return { data: { target, outputDir, files: artifacts.files.map((f) => f.relativePath) } };
604
+ },
415
605
  // ─── doctor ─────────────────────────────────────────────────────
416
606
  doctor: async (args) => {
417
607
  const cwd = args.cwd || process.cwd();
@@ -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.32.0";
5990
+ VERSION = "0.32.2";
5991
5991
  }
5992
5992
  });
5993
5993
 
@@ -88937,7 +88937,7 @@ function parseIntStrict(value) {
88937
88937
  // src/cli/index.ts
88938
88938
  init_logger();
88939
88939
  init_error_utils();
88940
- var version2 = true ? "0.32.0" : "0.0.0-dev";
88940
+ var version2 = true ? "0.32.2" : "0.0.0-dev";
88941
88941
  var program2 = new Command();
88942
88942
  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", () => {
88943
88943
  logger.banner(version2);
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.32.0";
1
+ export declare const VERSION = "0.32.2";
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.32.0';
2
+ export const VERSION = '0.32.2';
3
3
  //# sourceMappingURL=generated-version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synergenius/flow-weaver",
3
- "version": "0.32.0",
3
+ "version": "0.32.2",
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",