feat: implement transferWorkflow operation in n8n_update_partial_workflow (#644) (#649)

Add transferWorkflow diff operation to move workflows between n8n projects:
- TransferWorkflowOperation type with destinationProjectId field
- WorkflowDiffEngine validates and tracks transfer intent
- Handler calls PUT /workflows/{id}/transfer after update
- N8nApiClient.transferWorkflow() method
- Zod schema validates destinationProjectId is non-empty
- Tool description and documentation updated
- inferIntentFromOperations case for transfer

Also fixes two pre-existing bugs found during review:
- continueOnError path now properly extracts/propagates activation flags
- Debug log in updateConnectionReferences shows correct old name

Based on work by @djakielski in PR #645.


Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en
This commit is contained in:
Romuald Członkowski
2026-03-20 17:50:00 +01:00
committed by GitHub
parent 14962a39b6
commit 47a1cb135d
30 changed files with 582 additions and 37 deletions

View File

@@ -124,6 +124,11 @@ export interface DeactivateWorkflowOperation extends DiffOperation {
// No additional properties needed - just deactivates the workflow
}
export interface TransferWorkflowOperation extends DiffOperation {
type: 'transferWorkflow';
destinationProjectId: string;
}
// Connection Cleanup Operations
export interface CleanStaleConnectionsOperation extends DiffOperation {
type: 'cleanStaleConnections';
@@ -161,7 +166,8 @@ export type WorkflowDiffOperation =
| ActivateWorkflowOperation
| DeactivateWorkflowOperation
| CleanStaleConnectionsOperation
| ReplaceConnectionsOperation;
| ReplaceConnectionsOperation
| TransferWorkflowOperation;
// Main diff request structure
export interface WorkflowDiffRequest {
@@ -192,6 +198,7 @@ export interface WorkflowDiffResult {
shouldDeactivate?: boolean; // Flag to deactivate workflow after update (for deactivateWorkflow operation)
tagsToAdd?: string[];
tagsToRemove?: string[];
transferToProjectId?: string; // For transferWorkflow operation - uses dedicated API call
}
// Helper type for node reference (supports both ID and name)