@synergenius/flowweaver-pack-weaver 0.3.1 → 0.5.0
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/bot/dashboard.d.ts +3 -0
- package/dist/bot/dashboard.d.ts.map +1 -1
- package/dist/bot/dashboard.js +141 -0
- package/dist/bot/dashboard.js.map +1 -1
- package/dist/bot/index.d.ts +8 -1
- package/dist/bot/index.d.ts.map +1 -1
- package/dist/bot/index.js +5 -0
- package/dist/bot/index.js.map +1 -1
- package/dist/bot/notifications.d.ts.map +1 -1
- package/dist/bot/notifications.js +18 -0
- package/dist/bot/notifications.js.map +1 -1
- package/dist/bot/session-state.d.ts +19 -0
- package/dist/bot/session-state.d.ts.map +1 -0
- package/dist/bot/session-state.js +56 -0
- package/dist/bot/session-state.js.map +1 -0
- package/dist/bot/steering.d.ts +13 -0
- package/dist/bot/steering.d.ts.map +1 -0
- package/dist/bot/steering.js +35 -0
- package/dist/bot/steering.js.map +1 -0
- package/dist/bot/system-prompt.d.ts +1 -0
- package/dist/bot/system-prompt.d.ts.map +1 -1
- package/dist/bot/system-prompt.js +55 -0
- package/dist/bot/system-prompt.js.map +1 -1
- package/dist/bot/task-queue.d.ts +26 -0
- package/dist/bot/task-queue.d.ts.map +1 -0
- package/dist/bot/task-queue.js +87 -0
- package/dist/bot/task-queue.js.map +1 -0
- package/dist/bot/types.d.ts +37 -1
- package/dist/bot/types.d.ts.map +1 -1
- package/dist/cli-bridge.d.ts +2 -0
- package/dist/cli-bridge.d.ts.map +1 -0
- package/dist/cli-bridge.js +31 -0
- package/dist/cli-bridge.js.map +1 -0
- package/dist/cli-handlers.d.ts +50 -0
- package/dist/cli-handlers.d.ts.map +1 -0
- package/dist/{cli.js → cli-handlers.js} +413 -181
- package/dist/cli-handlers.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp-tools.d.ts +13 -0
- package/dist/mcp-tools.d.ts.map +1 -0
- package/dist/mcp-tools.js +175 -0
- package/dist/mcp-tools.js.map +1 -0
- package/dist/node-types/abort-task.d.ts +22 -0
- package/dist/node-types/abort-task.d.ts.map +1 -0
- package/dist/node-types/abort-task.js +33 -0
- package/dist/node-types/abort-task.js.map +1 -0
- package/dist/node-types/approval-gate.d.ts +35 -0
- package/dist/node-types/approval-gate.d.ts.map +1 -0
- package/dist/node-types/approval-gate.js +62 -0
- package/dist/node-types/approval-gate.js.map +1 -0
- package/dist/node-types/bot-report.d.ts +22 -0
- package/dist/node-types/bot-report.d.ts.map +1 -0
- package/dist/node-types/bot-report.js +63 -0
- package/dist/node-types/bot-report.js.map +1 -0
- package/dist/node-types/build-context.d.ts +29 -0
- package/dist/node-types/build-context.d.ts.map +1 -0
- package/dist/node-types/build-context.js +73 -0
- package/dist/node-types/build-context.js.map +1 -0
- package/dist/node-types/detect-provider.d.ts +20 -0
- package/dist/node-types/detect-provider.d.ts.map +1 -0
- package/dist/node-types/detect-provider.js +72 -0
- package/dist/node-types/detect-provider.js.map +1 -0
- package/dist/node-types/exec-validate-retry.d.ts +38 -0
- package/dist/node-types/exec-validate-retry.d.ts.map +1 -0
- package/dist/node-types/exec-validate-retry.js +250 -0
- package/dist/node-types/exec-validate-retry.js.map +1 -0
- package/dist/node-types/execute-plan.d.ts +34 -0
- package/dist/node-types/execute-plan.d.ts.map +1 -0
- package/dist/node-types/execute-plan.js +175 -0
- package/dist/node-types/execute-plan.js.map +1 -0
- package/dist/node-types/execute-target.d.ts +26 -0
- package/dist/node-types/execute-target.d.ts.map +1 -0
- package/dist/node-types/execute-target.js +312 -0
- package/dist/node-types/execute-target.js.map +1 -0
- package/dist/node-types/fix-errors.d.ts +32 -0
- package/dist/node-types/fix-errors.d.ts.map +1 -0
- package/dist/node-types/fix-errors.js +106 -0
- package/dist/node-types/fix-errors.js.map +1 -0
- package/dist/node-types/git-ops.d.ts +18 -0
- package/dist/node-types/git-ops.d.ts.map +1 -0
- package/dist/node-types/git-ops.js +65 -0
- package/dist/node-types/git-ops.js.map +1 -0
- package/dist/node-types/index.d.ts +20 -0
- package/dist/node-types/index.d.ts.map +1 -0
- package/dist/node-types/index.js +20 -0
- package/dist/node-types/index.js.map +1 -0
- package/dist/node-types/load-config.d.ts +15 -0
- package/dist/node-types/load-config.d.ts.map +1 -0
- package/dist/node-types/load-config.js +26 -0
- package/dist/node-types/load-config.js.map +1 -0
- package/dist/node-types/plan-task.d.ts +32 -0
- package/dist/node-types/plan-task.d.ts.map +1 -0
- package/dist/node-types/plan-task.js +122 -0
- package/dist/node-types/plan-task.js.map +1 -0
- package/dist/node-types/read-workflow.d.ts +30 -0
- package/dist/node-types/read-workflow.d.ts.map +1 -0
- package/dist/node-types/read-workflow.js +72 -0
- package/dist/node-types/read-workflow.js.map +1 -0
- package/dist/node-types/receive-task.d.ts +31 -0
- package/dist/node-types/receive-task.d.ts.map +1 -0
- package/dist/node-types/receive-task.js +72 -0
- package/dist/node-types/receive-task.js.map +1 -0
- package/dist/node-types/report.d.ts +15 -0
- package/dist/node-types/report.d.ts.map +1 -0
- package/dist/node-types/report.js +25 -0
- package/dist/node-types/report.js.map +1 -0
- package/dist/node-types/resolve-target.d.ts +24 -0
- package/dist/node-types/resolve-target.d.ts.map +1 -0
- package/dist/node-types/resolve-target.js +67 -0
- package/dist/node-types/resolve-target.js.map +1 -0
- package/dist/node-types/route-task.d.ts +26 -0
- package/dist/node-types/route-task.d.ts.map +1 -0
- package/dist/node-types/route-task.js +29 -0
- package/dist/node-types/route-task.js.map +1 -0
- package/dist/node-types/send-notify.d.ts +20 -0
- package/dist/node-types/send-notify.d.ts.map +1 -0
- package/dist/node-types/send-notify.js +75 -0
- package/dist/node-types/send-notify.js.map +1 -0
- package/dist/node-types/validate-result.d.ts +32 -0
- package/dist/node-types/validate-result.d.ts.map +1 -0
- package/dist/node-types/validate-result.js +53 -0
- package/dist/node-types/validate-result.js.map +1 -0
- package/dist/templates/index.d.ts +2 -0
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +3 -1
- package/dist/templates/index.js.map +1 -1
- package/dist/templates/weaver-bot-template.d.ts +3 -0
- package/dist/templates/weaver-bot-template.d.ts.map +1 -0
- package/dist/templates/weaver-bot-template.js +99 -0
- package/dist/templates/weaver-bot-template.js.map +1 -0
- package/dist/templates/weaver-template.d.ts.map +1 -1
- package/dist/templates/weaver-template.js +15 -653
- package/dist/templates/weaver-template.js.map +1 -1
- package/dist/workflows/index.d.ts +5 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/index.js +5 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/weaver-bot-batch.d.ts +57 -0
- package/dist/workflows/weaver-bot-batch.d.ts.map +1 -0
- package/dist/workflows/weaver-bot-batch.js +60 -0
- package/dist/workflows/weaver-bot-batch.js.map +1 -0
- package/dist/workflows/weaver-bot-session.d.ts +65 -0
- package/dist/workflows/weaver-bot-session.d.ts.map +1 -0
- package/dist/workflows/weaver-bot-session.js +68 -0
- package/dist/workflows/weaver-bot-session.js.map +1 -0
- package/dist/workflows/weaver-bot.d.ts +72 -0
- package/dist/workflows/weaver-bot.d.ts.map +1 -0
- package/dist/workflows/weaver-bot.js +75 -0
- package/dist/workflows/weaver-bot.js.map +1 -0
- package/dist/workflows/weaver.d.ts +24 -0
- package/dist/workflows/weaver.d.ts.map +1 -0
- package/dist/workflows/weaver.js +28 -0
- package/dist/workflows/weaver.js.map +1 -0
- package/flowweaver.manifest.json +1004 -3
- package/package.json +23 -5
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import * as os from 'node:os';
|
|
4
|
+
/**
|
|
5
|
+
* Receives a task from CLI args, MCP tool call, or the task queue.
|
|
6
|
+
* Parses the instruction into a structured BotTask.
|
|
7
|
+
*
|
|
8
|
+
* @flowWeaver nodeType
|
|
9
|
+
* @label Receive Task
|
|
10
|
+
* @input projectDir [order:0] - Project root directory
|
|
11
|
+
* @input config [order:1] - Weaver configuration (JSON)
|
|
12
|
+
* @input providerType [order:2] - Provider type (pass-through)
|
|
13
|
+
* @input providerInfo [order:3] - Provider info (JSON, pass-through)
|
|
14
|
+
* @input [taskJson] [order:4] - Pre-supplied task (JSON, optional)
|
|
15
|
+
* @output projectDir [order:0] - Project root directory (pass-through)
|
|
16
|
+
* @output config [order:1] - Config (pass-through)
|
|
17
|
+
* @output providerType [order:2] - Provider type (pass-through)
|
|
18
|
+
* @output providerInfo [order:3] - Provider info (pass-through)
|
|
19
|
+
* @output taskJson [order:4] - Parsed task (JSON)
|
|
20
|
+
* @output hasTask [order:5] - Whether a task was found
|
|
21
|
+
* @output onSuccess [order:-2] - On Success
|
|
22
|
+
* @output onFailure [order:-1] - On Failure
|
|
23
|
+
*/
|
|
24
|
+
export async function weaverReceiveTask(execute, projectDir, config, providerType, providerInfo, taskJson) {
|
|
25
|
+
const passthrough = { projectDir, config, providerType, providerInfo };
|
|
26
|
+
if (!execute) {
|
|
27
|
+
return { onSuccess: true, onFailure: false, ...passthrough, taskJson: '{}', hasTask: false };
|
|
28
|
+
}
|
|
29
|
+
// If taskJson is pre-supplied, use it directly
|
|
30
|
+
if (taskJson) {
|
|
31
|
+
try {
|
|
32
|
+
const parsed = JSON.parse(taskJson);
|
|
33
|
+
if (parsed.instruction) {
|
|
34
|
+
console.log(`\x1b[36m→ Task received: ${parsed.instruction.slice(0, 80)}\x1b[0m`);
|
|
35
|
+
return { onSuccess: true, onFailure: false, ...passthrough, taskJson, hasTask: true };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch { /* fall through to queue check */ }
|
|
39
|
+
}
|
|
40
|
+
// Check task queue
|
|
41
|
+
const queuePath = path.join(os.homedir(), '.weaver', 'task-queue.ndjson');
|
|
42
|
+
try {
|
|
43
|
+
if (fs.existsSync(queuePath)) {
|
|
44
|
+
const content = fs.readFileSync(queuePath, 'utf-8').trim();
|
|
45
|
+
if (content) {
|
|
46
|
+
const tasks = content.split('\n').map(l => JSON.parse(l));
|
|
47
|
+
const pending = tasks
|
|
48
|
+
.filter(t => t.status === 'pending')
|
|
49
|
+
.sort((a, b) => b.priority - a.priority || a.addedAt - b.addedAt);
|
|
50
|
+
if (pending.length > 0) {
|
|
51
|
+
const task = pending[0];
|
|
52
|
+
// Mark as running
|
|
53
|
+
const updated = tasks.map(t => t.id === task.id ? { ...t, status: 'running' } : t);
|
|
54
|
+
fs.writeFileSync(queuePath, updated.map(t => JSON.stringify(t)).join('\n') + '\n', 'utf-8');
|
|
55
|
+
const botTask = {
|
|
56
|
+
instruction: task.instruction,
|
|
57
|
+
mode: task.mode ?? 'create',
|
|
58
|
+
targets: task.targets,
|
|
59
|
+
options: task.options,
|
|
60
|
+
queueId: task.id,
|
|
61
|
+
};
|
|
62
|
+
console.log(`\x1b[36m→ Task from queue [${task.id}]: ${task.instruction.slice(0, 80)}\x1b[0m`);
|
|
63
|
+
return { onSuccess: true, onFailure: false, ...passthrough, taskJson: JSON.stringify(botTask), hasTask: true };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch { /* ignore queue errors */ }
|
|
69
|
+
console.log('\x1b[33m→ No task found\x1b[0m');
|
|
70
|
+
return { onSuccess: false, onFailure: true, ...passthrough, taskJson: '{}', hasTask: false };
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=receive-task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"receive-task.js","sourceRoot":"","sources":["../../src/node-types/receive-task.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC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CAAC;oBACF,OAAO,CAAC,GAAG,CAAC,8BAA8B,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC;oBAC/F,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gBACjH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC,CAAC,yBAAyB,CAAC,CAAC;IAErC,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;IAC9C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC/F,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format the result summary, suitable for display or further processing.
|
|
3
|
+
*
|
|
4
|
+
* @flowWeaver nodeType
|
|
5
|
+
* @expression
|
|
6
|
+
* @label Report
|
|
7
|
+
* @input projectDir [order:0] - Project root directory
|
|
8
|
+
* @input targetPath [order:1] - Target workflow path
|
|
9
|
+
* @input resultJson [order:2] - Result (JSON)
|
|
10
|
+
* @output summary [order:0] - Summary string
|
|
11
|
+
*/
|
|
12
|
+
export declare function weaverReport(projectDir: string, targetPath: string, resultJson: string): {
|
|
13
|
+
summary: string;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=report.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/node-types/report.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAU5G"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
/**
|
|
3
|
+
* Format the result summary, suitable for display or further processing.
|
|
4
|
+
*
|
|
5
|
+
* @flowWeaver nodeType
|
|
6
|
+
* @expression
|
|
7
|
+
* @label Report
|
|
8
|
+
* @input projectDir [order:0] - Project root directory
|
|
9
|
+
* @input targetPath [order:1] - Target workflow path
|
|
10
|
+
* @input resultJson [order:2] - Result (JSON)
|
|
11
|
+
* @output summary [order:0] - Summary string
|
|
12
|
+
*/
|
|
13
|
+
export function weaverReport(projectDir, targetPath, resultJson) {
|
|
14
|
+
const result = JSON.parse(resultJson);
|
|
15
|
+
const relPath = path.relative(projectDir, targetPath);
|
|
16
|
+
const lines = [
|
|
17
|
+
`Weaver: ${result.outcome} (${relPath})`,
|
|
18
|
+
result.summary,
|
|
19
|
+
];
|
|
20
|
+
if (result.executionTime)
|
|
21
|
+
lines.push(`Time: ${result.executionTime}s`);
|
|
22
|
+
console.log(`\x1b[32m✓ ${lines[0]}\x1b[0m`);
|
|
23
|
+
return { summary: lines.join('\n') };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/node-types/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,UAAkB,EAAE,UAAkB,EAAE,UAAkB;IACrF,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG;QACZ,WAAW,MAAM,CAAC,OAAO,KAAK,OAAO,GAAG;QACxC,MAAM,CAAC,OAAO;KACf,CAAC;IACF,IAAI,MAAM,CAAC,aAAa;QAAE,KAAK,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC;IACvE,OAAO,CAAC,GAAG,CAAC,aAAa,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC5C,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find the target workflow file from config or by scanning the project directory.
|
|
3
|
+
*
|
|
4
|
+
* @flowWeaver nodeType
|
|
5
|
+
* @expression
|
|
6
|
+
* @label Resolve Target
|
|
7
|
+
* @input projectDir [order:0] - Project root directory
|
|
8
|
+
* @input config [order:1] - Config (JSON)
|
|
9
|
+
* @input providerType [order:2] - Provider type (pass-through)
|
|
10
|
+
* @input providerInfo [order:3] - Provider info (pass-through)
|
|
11
|
+
* @output projectDir [order:0] - Project root directory (pass-through)
|
|
12
|
+
* @output config [order:1] - Config (pass-through)
|
|
13
|
+
* @output providerType [order:2] - Provider type (pass-through)
|
|
14
|
+
* @output providerInfo [order:3] - Provider info (pass-through)
|
|
15
|
+
* @output targetPath [order:4] - Absolute path to target workflow
|
|
16
|
+
*/
|
|
17
|
+
export declare function weaverResolveTarget(projectDir: string, config: string, providerType: string, providerInfo: string): {
|
|
18
|
+
projectDir: string;
|
|
19
|
+
config: string;
|
|
20
|
+
providerType: string;
|
|
21
|
+
providerInfo: string;
|
|
22
|
+
targetPath: string;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=resolve-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-target.d.ts","sourceRoot":"","sources":["../../src/node-types/resolve-target.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAC7E;IACD,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAC/E,UAAU,EAAE,MAAM,CAAC;CACpB,CAyCA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* Find the target workflow file from config or by scanning the project directory.
|
|
5
|
+
*
|
|
6
|
+
* @flowWeaver nodeType
|
|
7
|
+
* @expression
|
|
8
|
+
* @label Resolve Target
|
|
9
|
+
* @input projectDir [order:0] - Project root directory
|
|
10
|
+
* @input config [order:1] - Config (JSON)
|
|
11
|
+
* @input providerType [order:2] - Provider type (pass-through)
|
|
12
|
+
* @input providerInfo [order:3] - Provider info (pass-through)
|
|
13
|
+
* @output projectDir [order:0] - Project root directory (pass-through)
|
|
14
|
+
* @output config [order:1] - Config (pass-through)
|
|
15
|
+
* @output providerType [order:2] - Provider type (pass-through)
|
|
16
|
+
* @output providerInfo [order:3] - Provider info (pass-through)
|
|
17
|
+
* @output targetPath [order:4] - Absolute path to target workflow
|
|
18
|
+
*/
|
|
19
|
+
export function weaverResolveTarget(projectDir, config, providerType, providerInfo) {
|
|
20
|
+
const cfg = JSON.parse(config);
|
|
21
|
+
if (cfg.target) {
|
|
22
|
+
const abs = path.resolve(projectDir, cfg.target);
|
|
23
|
+
if (!fs.existsSync(abs))
|
|
24
|
+
throw new Error(`Target workflow not found: ${abs}`);
|
|
25
|
+
console.log(`\x1b[36m→ Target: ${abs}\x1b[0m`);
|
|
26
|
+
return { projectDir, config, providerType, providerInfo, targetPath: abs };
|
|
27
|
+
}
|
|
28
|
+
const found = [];
|
|
29
|
+
const scan = (dir, depth) => {
|
|
30
|
+
if (depth > 2)
|
|
31
|
+
return;
|
|
32
|
+
let entries;
|
|
33
|
+
try {
|
|
34
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
for (const entry of entries) {
|
|
40
|
+
if (entry.name.startsWith('.') || entry.name === 'node_modules')
|
|
41
|
+
continue;
|
|
42
|
+
const full = path.join(dir, entry.name);
|
|
43
|
+
if (entry.isDirectory()) {
|
|
44
|
+
scan(full, depth + 1);
|
|
45
|
+
}
|
|
46
|
+
else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.d.ts')) {
|
|
47
|
+
try {
|
|
48
|
+
const content = fs.readFileSync(full, 'utf-8').slice(0, 2000);
|
|
49
|
+
if (content.includes('@flowWeaver workflow'))
|
|
50
|
+
found.push(full);
|
|
51
|
+
}
|
|
52
|
+
catch { /* skip */ }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
scan(projectDir, 0);
|
|
57
|
+
if (found.length === 0) {
|
|
58
|
+
throw new Error(`No workflow files found in ${projectDir}. Set "target" in .weaver.json or pass a file path.`);
|
|
59
|
+
}
|
|
60
|
+
if (found.length > 1) {
|
|
61
|
+
throw new Error(`Multiple workflows found. Set "target" in .weaver.json to pick one:\n` +
|
|
62
|
+
found.map(f => ` - ${path.relative(projectDir, f)}`).join('\n'));
|
|
63
|
+
}
|
|
64
|
+
console.log(`\x1b[36m→ Target: ${found[0]}\x1b[0m`);
|
|
65
|
+
return { projectDir, config, providerType, providerInfo, targetPath: found[0] };
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=resolve-target.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-target.js","sourceRoot":"","sources":["../../src/node-types/resolve-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B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AAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routes based on task mode. onSuccess fires for actionable tasks
|
|
3
|
+
* (create/modify/batch). onFailure fires for read-only tasks.
|
|
4
|
+
*
|
|
5
|
+
* @flowWeaver nodeType
|
|
6
|
+
* @expression
|
|
7
|
+
* @label Route Task
|
|
8
|
+
* @input projectDir [order:0] - Project root directory
|
|
9
|
+
* @input config [order:1] - Config (JSON)
|
|
10
|
+
* @input providerType [order:2] - Provider type
|
|
11
|
+
* @input providerInfo [order:3] - Provider info (JSON)
|
|
12
|
+
* @input taskJson [order:4] - Task (JSON)
|
|
13
|
+
* @output projectDir [order:0] - Project root directory (pass-through)
|
|
14
|
+
* @output config [order:1] - Config (pass-through)
|
|
15
|
+
* @output providerType [order:2] - Provider type (pass-through)
|
|
16
|
+
* @output providerInfo [order:3] - Provider info (pass-through)
|
|
17
|
+
* @output taskJson [order:4] - Task (pass-through)
|
|
18
|
+
*/
|
|
19
|
+
export declare function weaverRouteTask(projectDir: string, config: string, providerType: string, providerInfo: string, taskJson: string): {
|
|
20
|
+
projectDir: string;
|
|
21
|
+
config: string;
|
|
22
|
+
providerType: string;
|
|
23
|
+
providerInfo: string;
|
|
24
|
+
taskJson: string;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=route-task.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-task.d.ts","sourceRoot":"","sources":["../../src/node-types/route-task.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,GACf;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAWtG"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Routes based on task mode. onSuccess fires for actionable tasks
|
|
3
|
+
* (create/modify/batch). onFailure fires for read-only tasks.
|
|
4
|
+
*
|
|
5
|
+
* @flowWeaver nodeType
|
|
6
|
+
* @expression
|
|
7
|
+
* @label Route Task
|
|
8
|
+
* @input projectDir [order:0] - Project root directory
|
|
9
|
+
* @input config [order:1] - Config (JSON)
|
|
10
|
+
* @input providerType [order:2] - Provider type
|
|
11
|
+
* @input providerInfo [order:3] - Provider info (JSON)
|
|
12
|
+
* @input taskJson [order:4] - Task (JSON)
|
|
13
|
+
* @output projectDir [order:0] - Project root directory (pass-through)
|
|
14
|
+
* @output config [order:1] - Config (pass-through)
|
|
15
|
+
* @output providerType [order:2] - Provider type (pass-through)
|
|
16
|
+
* @output providerInfo [order:3] - Provider info (pass-through)
|
|
17
|
+
* @output taskJson [order:4] - Task (pass-through)
|
|
18
|
+
*/
|
|
19
|
+
export function weaverRouteTask(projectDir, config, providerType, providerInfo, taskJson) {
|
|
20
|
+
const task = JSON.parse(taskJson);
|
|
21
|
+
const mode = task.mode ?? 'create';
|
|
22
|
+
if (mode === 'read') {
|
|
23
|
+
console.log('\x1b[36m→ Routing to read-only path\x1b[0m');
|
|
24
|
+
throw new Error('read-only-route');
|
|
25
|
+
}
|
|
26
|
+
console.log(`\x1b[36m→ Routing to ${mode} path\x1b[0m`);
|
|
27
|
+
return { projectDir, config, providerType, providerInfo, taskJson };
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=route-task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-task.js","sourceRoot":"","sources":["../../src/node-types/route-task.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,eAAe,CAC7B,UAAkB,EAClB,MAAc,EACd,YAAoB,EACpB,YAAoB,EACpB,QAAgB;IAEhB,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAsB,CAAC;IACvD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,QAAQ,CAAC;IAEnC,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,cAAc,CAAC,CAAC;IACxD,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Send webhook/Discord/Slack notifications based on config.
|
|
3
|
+
*
|
|
4
|
+
* @flowWeaver nodeType
|
|
5
|
+
* @expression
|
|
6
|
+
* @label Notify Result
|
|
7
|
+
* @input projectDir [order:0] - Project root directory
|
|
8
|
+
* @input config [order:1] - Config (JSON)
|
|
9
|
+
* @input targetPath [order:2] - Target path
|
|
10
|
+
* @input resultJson [order:3] - Result (JSON)
|
|
11
|
+
* @output projectDir [order:0] - Project root directory (pass-through)
|
|
12
|
+
* @output targetPath [order:1] - Target path (pass-through)
|
|
13
|
+
* @output resultJson [order:2] - Result (pass-through)
|
|
14
|
+
*/
|
|
15
|
+
export declare function weaverSendNotify(projectDir: string, config: string, targetPath: string, resultJson: string): {
|
|
16
|
+
projectDir: string;
|
|
17
|
+
targetPath: string;
|
|
18
|
+
resultJson: string;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=send-notify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-notify.d.ts","sourceRoot":"","sources":["../../src/node-types/send-notify.ts"],"names":[],"mappings":"AAgDA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GACzE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAchE"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
function sendWebhook(config, event) {
|
|
3
|
+
const headers = {
|
|
4
|
+
'content-type': 'application/json',
|
|
5
|
+
...config.headers,
|
|
6
|
+
};
|
|
7
|
+
let body;
|
|
8
|
+
if (config.channel === 'discord') {
|
|
9
|
+
const color = event.success ? 0x22c55e : 0xef4444;
|
|
10
|
+
body = JSON.stringify({
|
|
11
|
+
embeds: [{
|
|
12
|
+
title: `Weaver: ${event.outcome ?? 'update'}`,
|
|
13
|
+
description: String(event.summary ?? '').slice(0, 2000),
|
|
14
|
+
color,
|
|
15
|
+
fields: [
|
|
16
|
+
{ name: 'Workflow', value: String(event.targetPath ?? 'unknown'), inline: true },
|
|
17
|
+
{ name: 'Provider', value: String(event.providerType ?? 'unknown'), inline: true },
|
|
18
|
+
],
|
|
19
|
+
timestamp: new Date().toISOString(),
|
|
20
|
+
}],
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
else if (config.channel === 'slack') {
|
|
24
|
+
const emoji = event.success ? ':white_check_mark:' : ':x:';
|
|
25
|
+
body = JSON.stringify({
|
|
26
|
+
blocks: [
|
|
27
|
+
{ type: 'header', text: { type: 'plain_text', text: `${emoji} Weaver: ${event.outcome ?? 'update'}` } },
|
|
28
|
+
{ type: 'section', text: { type: 'mrkdwn', text: String(event.summary ?? '').slice(0, 2000) } },
|
|
29
|
+
],
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
body = JSON.stringify(event);
|
|
34
|
+
}
|
|
35
|
+
const headerFlags = Object.entries(headers).map(([k, v]) => `-H "${k}: ${v}"`).join(' ');
|
|
36
|
+
try {
|
|
37
|
+
execSync(`curl -sS -X POST ${headerFlags} -d @- "${config.url}"`, {
|
|
38
|
+
input: body,
|
|
39
|
+
encoding: 'utf-8',
|
|
40
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
41
|
+
timeout: 10_000,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
catch { /* notification failure is non-fatal */ }
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Send webhook/Discord/Slack notifications based on config.
|
|
48
|
+
*
|
|
49
|
+
* @flowWeaver nodeType
|
|
50
|
+
* @expression
|
|
51
|
+
* @label Notify Result
|
|
52
|
+
* @input projectDir [order:0] - Project root directory
|
|
53
|
+
* @input config [order:1] - Config (JSON)
|
|
54
|
+
* @input targetPath [order:2] - Target path
|
|
55
|
+
* @input resultJson [order:3] - Result (JSON)
|
|
56
|
+
* @output projectDir [order:0] - Project root directory (pass-through)
|
|
57
|
+
* @output targetPath [order:1] - Target path (pass-through)
|
|
58
|
+
* @output resultJson [order:2] - Result (pass-through)
|
|
59
|
+
*/
|
|
60
|
+
export function weaverSendNotify(projectDir, config, targetPath, resultJson) {
|
|
61
|
+
const cfg = JSON.parse(config);
|
|
62
|
+
const result = JSON.parse(resultJson);
|
|
63
|
+
const channels = (Array.isArray(cfg.notify) ? cfg.notify : cfg.notify ? [cfg.notify] : []);
|
|
64
|
+
for (const ch of channels) {
|
|
65
|
+
const events = ch.events ?? ['workflow-complete', 'error'];
|
|
66
|
+
const eventType = result.success ? 'workflow-complete' : 'error';
|
|
67
|
+
if (!events.includes(eventType))
|
|
68
|
+
continue;
|
|
69
|
+
sendWebhook(ch, { ...result, targetPath, providerType: cfg.provider, projectDir });
|
|
70
|
+
}
|
|
71
|
+
if (channels.length > 0)
|
|
72
|
+
console.log(`\x1b[36m→ Sent ${channels.length} notification(s)\x1b[0m`);
|
|
73
|
+
return { projectDir, targetPath, resultJson };
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=send-notify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-notify.js","sourceRoot":"","sources":["../../src/node-types/send-notify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,SAAS,WAAW,CAClB,MAA0E,EAC1E,KAA8B;IAE9B,MAAM,OAAO,GAA2B;QACtC,cAAc,EAAE,kBAAkB;QAClC,GAAG,MAAM,CAAC,OAAO;KAClB,CAAC;IACF,IAAI,IAAY,CAAC;IACjB,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC;QAClD,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;YACpB,MAAM,EAAE,CAAC;oBACP,KAAK,EAAE,WAAW,KAAK,CAAC,OAAO,IAAI,QAAQ,EAAE;oBAC7C,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC;oBACvD,KAAK;oBACL,MAAM,EAAE;wBACN,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,IAAI,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE;wBAChF,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,YAAY,IAAI,SAAS,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE;qBACnF;oBACD,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;iBACpC,CAAC;SACH,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,MAAM,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,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,GAAG,GAAiB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAE3F,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;QAC1B,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;QAC3D,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC;QACjE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YAAE,SAAS;QAC1C,WAAW,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC;IACrF,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,QAAQ,CAAC,MAAM,yBAAyB,CAAC,CAAC;IACjG,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates all modified/created files using flow-weaver validate
|
|
3
|
+
* and compile. Branches on validation success/failure.
|
|
4
|
+
*
|
|
5
|
+
* @flowWeaver nodeType
|
|
6
|
+
* @expression
|
|
7
|
+
* @label Validate Result
|
|
8
|
+
* @input projectDir [order:0] - Project root directory
|
|
9
|
+
* @input config [order:1] - Config (JSON, pass-through)
|
|
10
|
+
* @input providerType [order:2] - Provider type (pass-through)
|
|
11
|
+
* @input providerInfo [order:3] - Provider info (pass-through)
|
|
12
|
+
* @input executionResultJson [order:4] - Execution result (JSON)
|
|
13
|
+
* @input taskJson [order:5] - Task (JSON, pass-through)
|
|
14
|
+
* @input filesModified [order:6] - Files modified (JSON array)
|
|
15
|
+
* @output projectDir [order:0] - Project root directory (pass-through)
|
|
16
|
+
* @output config [order:1] - Config (pass-through)
|
|
17
|
+
* @output providerType [order:2] - Provider type (pass-through)
|
|
18
|
+
* @output providerInfo [order:3] - Provider info (pass-through)
|
|
19
|
+
* @output validationResultJson [order:4] - Validation results (JSON)
|
|
20
|
+
* @output taskJson [order:5] - Task (pass-through)
|
|
21
|
+
* @output allValid [order:6] - Whether all files passed validation
|
|
22
|
+
*/
|
|
23
|
+
export declare function weaverValidateResult(projectDir: string, config: string, providerType: string, providerInfo: string, executionResultJson: string, taskJson: string, filesModified: string): {
|
|
24
|
+
projectDir: string;
|
|
25
|
+
config: string;
|
|
26
|
+
providerType: string;
|
|
27
|
+
providerInfo: string;
|
|
28
|
+
validationResultJson: string;
|
|
29
|
+
taskJson: string;
|
|
30
|
+
allValid: boolean;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=validate-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-result.d.ts","sourceRoot":"","sources":["../../src/node-types/validate-result.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,mBAAmB,EAAE,MAAM,EAC3B,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,GACpB;IACD,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAC/E,oBAAoB,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;CACnE,CA+BA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Validates all modified/created files using flow-weaver validate
|
|
4
|
+
* and compile. Branches on validation success/failure.
|
|
5
|
+
*
|
|
6
|
+
* @flowWeaver nodeType
|
|
7
|
+
* @expression
|
|
8
|
+
* @label Validate Result
|
|
9
|
+
* @input projectDir [order:0] - Project root directory
|
|
10
|
+
* @input config [order:1] - Config (JSON, pass-through)
|
|
11
|
+
* @input providerType [order:2] - Provider type (pass-through)
|
|
12
|
+
* @input providerInfo [order:3] - Provider info (pass-through)
|
|
13
|
+
* @input executionResultJson [order:4] - Execution result (JSON)
|
|
14
|
+
* @input taskJson [order:5] - Task (JSON, pass-through)
|
|
15
|
+
* @input filesModified [order:6] - Files modified (JSON array)
|
|
16
|
+
* @output projectDir [order:0] - Project root directory (pass-through)
|
|
17
|
+
* @output config [order:1] - Config (pass-through)
|
|
18
|
+
* @output providerType [order:2] - Provider type (pass-through)
|
|
19
|
+
* @output providerInfo [order:3] - Provider info (pass-through)
|
|
20
|
+
* @output validationResultJson [order:4] - Validation results (JSON)
|
|
21
|
+
* @output taskJson [order:5] - Task (pass-through)
|
|
22
|
+
* @output allValid [order:6] - Whether all files passed validation
|
|
23
|
+
*/
|
|
24
|
+
export function weaverValidateResult(projectDir, config, providerType, providerInfo, executionResultJson, taskJson, filesModified) {
|
|
25
|
+
const files = JSON.parse(filesModified);
|
|
26
|
+
const results = [];
|
|
27
|
+
for (const file of files) {
|
|
28
|
+
if (!file.endsWith('.ts'))
|
|
29
|
+
continue;
|
|
30
|
+
try {
|
|
31
|
+
execSync(`flow-weaver validate "${file}"`, {
|
|
32
|
+
cwd: projectDir, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], timeout: 30_000,
|
|
33
|
+
});
|
|
34
|
+
results.push({ file, valid: true, errors: [], warnings: [] });
|
|
35
|
+
console.log(`\x1b[32m ✓ ${file}\x1b[0m`);
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
const stderr = err.stderr ?? (err instanceof Error ? err.message : String(err));
|
|
39
|
+
results.push({ file, valid: false, errors: [stderr], warnings: [] });
|
|
40
|
+
console.log(`\x1b[31m x ${file}: ${stderr.slice(0, 100)}\x1b[0m`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const allValid = results.length === 0 || results.every(r => r.valid);
|
|
44
|
+
if (!allValid) {
|
|
45
|
+
throw new Error('Validation failed: ' + results.filter(r => !r.valid).map(r => r.file).join(', '));
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
projectDir, config, providerType, providerInfo,
|
|
49
|
+
validationResultJson: JSON.stringify(results),
|
|
50
|
+
taskJson, allValid,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=validate-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-result.js","sourceRoot":"","sources":["../../src/node-types/validate-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAkB,EAClB,MAAc,EACd,YAAoB,EACpB,YAAoB,EACpB,mBAA2B,EAC3B,QAAgB,EAChB,aAAqB;IAKrB,MAAM,KAAK,GAAa,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAClD,MAAM,OAAO,GAAkF,EAAE,CAAC;IAElG,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;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,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACrG,CAAC;IAED,OAAO;QACL,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY;QAC9C,oBAAoB,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAC7C,QAAQ,EAAE,QAAQ;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { weaverTemplate } from './weaver-template.js';
|
|
2
|
+
import { weaverBotTemplate } from './weaver-bot-template.js';
|
|
2
3
|
export type { WorkflowTemplate } from './weaver-template.js';
|
|
3
4
|
export { weaverTemplate };
|
|
5
|
+
export { weaverBotTemplate };
|
|
4
6
|
export declare const workflowTemplates: import("./weaver-template.js").WorkflowTemplate[];
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,eAAO,MAAM,iBAAiB,mDAAsC,CAAC"}
|
package/dist/templates/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { weaverTemplate } from './weaver-template.js';
|
|
2
|
+
import { weaverBotTemplate } from './weaver-bot-template.js';
|
|
2
3
|
export { weaverTemplate };
|
|
3
|
-
export
|
|
4
|
+
export { weaverBotTemplate };
|
|
5
|
+
export const workflowTemplates = [weaverTemplate, weaverBotTemplate];
|
|
4
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC7B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"weaver-bot-template.d.ts","sourceRoot":"","sources":["../../src/templates/weaver-bot-template.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,eAAO,MAAM,iBAAiB,EAAE,gBAiG/B,CAAC"}
|