@synergenius/flow-weaver 0.8.1 → 0.8.3
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.
- package/dist/api/generate.js +1 -1
- package/dist/ast/types.d.ts +1 -1
- package/dist/cli/commands/changelog.js +2 -2
- package/dist/cli/commands/create.js +1 -1
- package/dist/cli/commands/dev.js +5 -3
- package/dist/cli/commands/serve.js +2 -1
- package/dist/cli/commands/strip.d.ts +7 -0
- package/dist/cli/commands/strip.js +62 -0
- package/dist/cli/commands/watch.js +2 -1
- package/dist/cli/flow-weaver.mjs +434 -357
- package/dist/cli/index.js +17 -0
- package/dist/cli/templates/workflows/aggregator.js +1 -1
- package/dist/cli/templates/workflows/sequential.js +1 -1
- package/dist/function-like.d.ts +2 -0
- package/dist/function-like.js +1 -0
- package/dist/jsdoc-parser.js +13 -2
- package/dist/parser.js +11 -6
- package/docs/reference/cli-reference.md +25 -1
- package/docs/reference/concepts.md +3 -3
- package/docs/reference/iterative-development.md +8 -9
- package/docs/reference/node-conversion.md +2 -5
- package/package.json +1 -1
package/dist/api/generate.js
CHANGED
|
@@ -356,7 +356,7 @@ export function generateCode(ast, options) {
|
|
|
356
356
|
if (sourceMapGenerator && ast.sourceFile) {
|
|
357
357
|
try {
|
|
358
358
|
const sourceContent = fs.readFileSync(ast.sourceFile, 'utf-8');
|
|
359
|
-
const sourceLines = sourceContent.split(
|
|
359
|
+
const sourceLines = sourceContent.split(/\r?\n/);
|
|
360
360
|
const exportLineIndex = sourceLines.findIndex((line) => line.includes(`export`) && line.includes(`function ${ast.functionName}`));
|
|
361
361
|
if (exportLineIndex >= 0) {
|
|
362
362
|
addMapping(exportLineIndex + 1, 0); // Line numbers are 1-indexed
|
package/dist/ast/types.d.ts
CHANGED
|
@@ -240,7 +240,7 @@ export type TNodeTypeAST = {
|
|
|
240
240
|
/** Multiple scopes this node creates */
|
|
241
241
|
scopes?: string[];
|
|
242
242
|
/** Variant identifier (set by app layer) */
|
|
243
|
-
variant?: 'FUNCTION' | 'WORKFLOW' | 'IMPORTED_WORKFLOW' | 'MAP_ITERATOR' | 'COERCION';
|
|
243
|
+
variant?: 'FUNCTION' | 'WORKFLOW' | 'IMPORTED_WORKFLOW' | 'MAP_ITERATOR' | 'COERCION' | 'STUB';
|
|
244
244
|
/** File path for external node types */
|
|
245
245
|
path?: string;
|
|
246
246
|
/** Function reference for function-based node types */
|
|
@@ -66,7 +66,7 @@ function getCommits(rangeArg) {
|
|
|
66
66
|
return [];
|
|
67
67
|
}
|
|
68
68
|
const entries = [];
|
|
69
|
-
for (const line of logOutput.split(
|
|
69
|
+
for (const line of logOutput.split(/\r?\n/)) {
|
|
70
70
|
if (!line.trim())
|
|
71
71
|
continue;
|
|
72
72
|
const spaceIdx = line.indexOf(' ');
|
|
@@ -78,7 +78,7 @@ function getCommits(rangeArg) {
|
|
|
78
78
|
const filesOutput = execSync(`git diff-tree --no-commit-id --name-only -r ${hash}`, {
|
|
79
79
|
encoding: 'utf8',
|
|
80
80
|
}).trim();
|
|
81
|
-
files = filesOutput ? filesOutput.split(
|
|
81
|
+
files = filesOutput ? filesOutput.split(/\r?\n/) : [];
|
|
82
82
|
}
|
|
83
83
|
catch {
|
|
84
84
|
files = [];
|
|
@@ -21,7 +21,7 @@ function insertIntoFile(filePath, content, line) {
|
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
const existingContent = fs.readFileSync(filePath, 'utf8');
|
|
24
|
-
const lines = existingContent.split(
|
|
24
|
+
const lines = existingContent.split(/\r?\n/);
|
|
25
25
|
if (line !== undefined && line > 0) {
|
|
26
26
|
// Insert AFTER specific line (1-indexed)
|
|
27
27
|
// Line 3 means insert after line 3, so at index 3
|
package/dist/cli/commands/dev.js
CHANGED
|
@@ -247,7 +247,7 @@ async function runInngestDevMode(filePath, options) {
|
|
|
247
247
|
};
|
|
248
248
|
const stopServer = () => {
|
|
249
249
|
if (serverProcess && !serverProcess.killed) {
|
|
250
|
-
serverProcess.kill(
|
|
250
|
+
serverProcess.kill();
|
|
251
251
|
serverProcess = null;
|
|
252
252
|
}
|
|
253
253
|
};
|
|
@@ -311,7 +311,8 @@ async function runInngestDevMode(filePath, options) {
|
|
|
311
311
|
process.exit(0);
|
|
312
312
|
};
|
|
313
313
|
process.on('SIGINT', cleanup);
|
|
314
|
-
process.
|
|
314
|
+
if (process.platform !== 'win32')
|
|
315
|
+
process.on('SIGTERM', cleanup);
|
|
315
316
|
// Keep process alive
|
|
316
317
|
await new Promise(() => { });
|
|
317
318
|
}
|
|
@@ -375,7 +376,8 @@ export async function devCommand(input, options = {}) {
|
|
|
375
376
|
process.exit(0);
|
|
376
377
|
};
|
|
377
378
|
process.on('SIGINT', cleanup);
|
|
378
|
-
process.
|
|
379
|
+
if (process.platform !== 'win32')
|
|
380
|
+
process.on('SIGTERM', cleanup);
|
|
379
381
|
// Keep process alive
|
|
380
382
|
await new Promise(() => {
|
|
381
383
|
// Never resolves - keeps process running
|
|
@@ -67,7 +67,8 @@ export async function serveCommand(dir, options) {
|
|
|
67
67
|
process.exit(0);
|
|
68
68
|
};
|
|
69
69
|
process.on('SIGINT', () => shutdown('SIGINT'));
|
|
70
|
-
process.
|
|
70
|
+
if (process.platform !== 'win32')
|
|
71
|
+
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
|
71
72
|
try {
|
|
72
73
|
await server.start();
|
|
73
74
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { glob } from 'glob';
|
|
4
|
+
import { hasInPlaceMarkers, stripGeneratedSections } from '../../api/generate-in-place.js';
|
|
5
|
+
import { logger } from '../utils/logger.js';
|
|
6
|
+
export async function stripCommand(input, options = {}) {
|
|
7
|
+
const { output, dryRun = false, verbose = false } = options;
|
|
8
|
+
// If input is a directory, expand to all .ts files recursively
|
|
9
|
+
let pattern = input;
|
|
10
|
+
try {
|
|
11
|
+
if (fs.existsSync(input) && fs.statSync(input).isDirectory()) {
|
|
12
|
+
pattern = path.join(input, '**/*.ts');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
// Not a valid path, use as glob pattern
|
|
17
|
+
}
|
|
18
|
+
const allFiles = await glob(pattern, { absolute: true });
|
|
19
|
+
const files = allFiles.filter((f) => {
|
|
20
|
+
try {
|
|
21
|
+
return fs.statSync(f).isFile();
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
if (files.length === 0) {
|
|
28
|
+
logger.error(`No files found matching pattern: ${input}`);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
let stripped = 0;
|
|
32
|
+
let skipped = 0;
|
|
33
|
+
for (const filePath of files) {
|
|
34
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
35
|
+
if (!hasInPlaceMarkers(content)) {
|
|
36
|
+
skipped++;
|
|
37
|
+
if (verbose) {
|
|
38
|
+
logger.info(`Skipped (no markers): ${path.relative(process.cwd(), filePath)}`);
|
|
39
|
+
}
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
const result = stripGeneratedSections(content);
|
|
43
|
+
if (dryRun) {
|
|
44
|
+
logger.info(`Would strip: ${path.relative(process.cwd(), filePath)}`);
|
|
45
|
+
stripped++;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const outPath = output
|
|
49
|
+
? path.join(path.resolve(output), path.basename(filePath))
|
|
50
|
+
: filePath;
|
|
51
|
+
if (output) {
|
|
52
|
+
fs.mkdirSync(path.dirname(outPath), { recursive: true });
|
|
53
|
+
}
|
|
54
|
+
fs.writeFileSync(outPath, result);
|
|
55
|
+
stripped++;
|
|
56
|
+
if (verbose) {
|
|
57
|
+
logger.success(`Stripped: ${path.relative(process.cwd(), outPath)}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
logger.success(`${stripped} file${stripped !== 1 ? 's' : ''} stripped, ${skipped} skipped`);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=strip.js.map
|
|
@@ -61,7 +61,8 @@ export async function watchCommand(input, options = {}) {
|
|
|
61
61
|
process.exit(0);
|
|
62
62
|
};
|
|
63
63
|
process.on('SIGINT', cleanup);
|
|
64
|
-
process.
|
|
64
|
+
if (process.platform !== 'win32')
|
|
65
|
+
process.on('SIGTERM', cleanup);
|
|
65
66
|
// Keep process alive
|
|
66
67
|
await new Promise(() => {
|
|
67
68
|
// Never resolves - keeps process running
|