@lhi/n8m 0.2.1 → 0.2.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/README.md +105 -6
- package/dist/agentic/graph.d.ts +50 -0
- package/dist/agentic/graph.js +3 -11
- package/dist/agentic/nodes/architect.d.ts +5 -0
- package/dist/agentic/nodes/architect.js +8 -22
- package/dist/agentic/nodes/engineer.d.ts +15 -0
- package/dist/agentic/nodes/engineer.js +25 -4
- package/dist/agentic/nodes/qa.d.ts +1 -0
- package/dist/agentic/nodes/qa.js +280 -45
- package/dist/agentic/nodes/reviewer.d.ts +4 -0
- package/dist/agentic/nodes/reviewer.js +71 -13
- package/dist/agentic/nodes/supervisor.js +2 -3
- package/dist/agentic/state.d.ts +1 -0
- package/dist/agentic/state.js +4 -0
- package/dist/commands/create.js +162 -95
- package/dist/commands/doc.js +1 -1
- package/dist/commands/fixture.d.ts +12 -0
- package/dist/commands/fixture.js +258 -0
- package/dist/commands/test.d.ts +63 -4
- package/dist/commands/test.js +1179 -90
- package/dist/fixture-schema.json +162 -0
- package/dist/resources/node-definitions-fallback.json +185 -8
- package/dist/resources/node-test-hints.json +188 -0
- package/dist/resources/workflow-test-fixtures.json +42 -0
- package/dist/services/ai.service.d.ts +42 -0
- package/dist/services/ai.service.js +271 -21
- package/dist/services/node-definitions.service.d.ts +1 -0
- package/dist/services/node-definitions.service.js +4 -11
- package/dist/utils/config.js +2 -0
- package/dist/utils/fixtureManager.d.ts +28 -0
- package/dist/utils/fixtureManager.js +41 -0
- package/dist/utils/n8nClient.d.ts +27 -0
- package/dist/utils/n8nClient.js +169 -5
- package/dist/utils/spinner.d.ts +17 -0
- package/dist/utils/spinner.js +52 -0
- package/oclif.manifest.json +49 -1
- package/package.json +2 -2
package/dist/commands/test.d.ts
CHANGED
|
@@ -10,19 +10,78 @@ export default class Test extends Command {
|
|
|
10
10
|
'no-brand': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
11
|
'validate-only': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
12
12
|
'ai-scenarios': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
fixture: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
14
|
};
|
|
14
15
|
run(): Promise<void>;
|
|
15
16
|
/**
|
|
16
17
|
* Extract clean error message from n8n API responses
|
|
17
18
|
*/
|
|
18
19
|
private cleanErrorMsg;
|
|
19
|
-
/**
|
|
20
|
-
* Normalize error messages to catch "similar" errors (masking IDs/numbers)
|
|
21
|
-
*/
|
|
22
|
-
private normalizeError;
|
|
23
20
|
private sanitizeWorkflow;
|
|
24
21
|
private stripShim;
|
|
25
22
|
private saveWorkflows;
|
|
26
23
|
private handlePostTestActions;
|
|
24
|
+
/**
|
|
25
|
+
* Test a workflow that already exists on the n8n instance, using its real credentials
|
|
26
|
+
* and configured triggers — no ephemeral copy, no credential stripping, no shim injection.
|
|
27
|
+
*/
|
|
28
|
+
private testRemoteWorkflowDirectly;
|
|
29
|
+
/**
|
|
30
|
+
* Scan a workflow's expressions to find all field names accessed via $json.body.FIELD.
|
|
31
|
+
* These become required keys in the test POST payload because n8n wraps the body
|
|
32
|
+
* automatically — a downstream expression $json.body.content needs {"content": ...} in the POST.
|
|
33
|
+
*/
|
|
34
|
+
private extractRequiredBodyFields;
|
|
35
|
+
/**
|
|
36
|
+
* Load a pre-defined test payload fixture for a specific workflow.
|
|
37
|
+
* Checks (in order): ./workflow-test-fixtures.json, ./workflows/test-fixtures.json,
|
|
38
|
+
* and the bundled src/resources/workflow-test-fixtures.json.
|
|
39
|
+
* Returns null if no matching fixture is found.
|
|
40
|
+
*/
|
|
41
|
+
private loadWorkflowFixture;
|
|
42
|
+
/**
|
|
43
|
+
* Load node-test-hints.json and build a context string describing what
|
|
44
|
+
* data format each node type in the workflow expects. Used to inform
|
|
45
|
+
* generateMockData so the AI sends correctly-shaped values (e.g. Block Kit
|
|
46
|
+
* JSON for a Slack blocksUi parameter instead of a plain string).
|
|
47
|
+
*/
|
|
48
|
+
private extractNodeTypeHints;
|
|
49
|
+
/**
|
|
50
|
+
* Find nodes that feed binary data into upload-type nodes.
|
|
51
|
+
* Returns node names whose outputs should be pinned with a test binary
|
|
52
|
+
* so downstream file-upload steps receive real content instead of empty buffers.
|
|
53
|
+
*/
|
|
54
|
+
private findBinarySourceNodes;
|
|
55
|
+
/**
|
|
56
|
+
* Detect webhook body fields that are used as image/file URLs by HTTP Request
|
|
57
|
+
* nodes that sit immediately upstream of binary-upload nodes.
|
|
58
|
+
*
|
|
59
|
+
* When n8n fetches a real image URL (supplied via the webhook payload) it gets
|
|
60
|
+
* actual binary bytes, which then flow into the upload step. Returning these
|
|
61
|
+
* field names lets the prompt instruct the AI to use a real hosted image URL
|
|
62
|
+
* (e.g. placehold.co) instead of a placeholder string — so the upload step
|
|
63
|
+
* receives real binary data without needing pinData API support.
|
|
64
|
+
*/
|
|
65
|
+
private findBinaryUrlFields;
|
|
66
|
+
/**
|
|
67
|
+
* Deep-scan all node parameter values and strip control characters
|
|
68
|
+
* (U+0000–U+001F, U+007F). Returns the sanitized nodes array and a flag
|
|
69
|
+
* indicating whether any changes were made.
|
|
70
|
+
*
|
|
71
|
+
* Control chars in node params (e.g. a literal newline inside a Slack
|
|
72
|
+
* blocksUi JSON string) are workflow configuration bugs — they cause n8n to
|
|
73
|
+
* throw "could not be parsed" at execution time regardless of the test payload.
|
|
74
|
+
*/
|
|
75
|
+
private sanitizeWorkflowNodeParams;
|
|
76
|
+
/**
|
|
77
|
+
* Strip control characters (U+0000–U+001F, except tab/LF/CR) from all
|
|
78
|
+
* string values in a generated mock payload. AI-generated Block Kit JSON
|
|
79
|
+
* and other rich-text fields sometimes contain raw control chars that cause
|
|
80
|
+
* n8n's parameter parser to throw "Bad control character in string literal".
|
|
81
|
+
*/
|
|
82
|
+
private sanitizeMockPayload;
|
|
27
83
|
private deployWorkflows;
|
|
84
|
+
private offerSaveFixture;
|
|
85
|
+
private testWithFixture;
|
|
86
|
+
private findPredecessorNode;
|
|
28
87
|
}
|