Skip to content

Add GetWorkflowCommand with JSON output support#44

Merged
charleslbryant merged 10 commits intomainfrom
feature/json-output-option
Jul 14, 2025
Merged

Add GetWorkflowCommand with JSON output support#44
charleslbryant merged 10 commits intomainfrom
feature/json-output-option

Conversation

@charleslbryant
Copy link
Owner

Summary

  • Implements GetWorkflowCommand for Issue CRD-2.2: Workflow Get Command #23 (CRD-2.2: Workflow Get Command)
  • Adds complete workflow details retrieval with JSON output support
  • Extends workflow management infrastructure with new APIs and models

Changes Made

  • New Model: WorkflowDetails with node definitions and comprehensive metadata
  • Extended Services: Added GetWorkflowAsync to IWorkflowService and WorkflowService
  • Extended Infrastructure: Added GetWorkflowAsync to N8nHttpClient for API integration
  • New Command: GetWorkflowCommand with rich table output and --json flag
  • Command Settings: GetWorkflowSettings for workflow ID parameter and JSON flag
  • Comprehensive Tests: 4 new unit tests covering all scenarios (success, not found, connection errors, JSON output)
  • User Documentation: Complete user guide with examples and troubleshooting

Technical Details

  • Uses GET /workflows/{id} endpoint for n8n API integration
  • Implements consistent JSON output format with list-workflows command
  • Follows established TDD patterns with red-green-refactor cycle
  • Maintains clean architecture with proper service separation
  • All 40 tests passing with comprehensive coverage

Test Plan

  • Unit tests for all command scenarios (success, errors, JSON output)
  • Integration test with mocked n8n API responses
  • Error handling for invalid workflow IDs and connection failures
  • JSON output format validation
  • Table output format validation
  • Build verification and lint checks

Related Issues

🤖 Generated with Claude Code

charleslbryant and others added 6 commits July 14, 2025 00:32
- Create WorkflowDetails model for detailed workflow information
- Extend IWorkflowService with GetWorkflowAsync method
- Extend N8nHttpClient with workflow detail endpoint
- Implement GetWorkflowCommand with rich table and JSON output
- Add comprehensive unit tests with 100% path coverage
- Support --json flag for programmatic consumption
- Add workflow definition display with proper formatting
- Resolves GitHub issue #23

🤖 Generated with AI Assistant (George)

Co-Authored-By: George <george@decoupledlogic.com>
- Create comprehensive user guide for get-workflow command
- Update CURRENT_STATE.md with GetWorkflow completion
- Update NEXT_TASKS.md with next priorities (Issue #24, #25, #26)
- Document 40 passing tests and enhanced architecture
- Mark Issue #23 as completed

🤖 Generated with AI Assistant (George)

Co-Authored-By: George <george@decoupledlogic.com>
🤖 Generated with Claude Code

Co-Authored-By: George <noreply@anthropic.com>
- Add .claude/ to .gitignore for AI assistant configuration
- Update ACTIVE_SESSION.md with completed task status

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@charleslbryant charleslbryant requested a review from Copilot July 14, 2025 18:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces the get-workflow command to fetch detailed workflow information from the n8n API, supporting both rich table and JSON outputs.

  • Adds a new WorkflowDetails model and result type
  • Extends service and HTTP client layers with GetWorkflowAsync
  • Implements GetWorkflowCommand with unit tests and user documentation

Reviewed Changes

Copilot reviewed 20 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
dotnet/tests/FlowForge.Console.Tests/Commands/GetWorkflowCommandTests.cs Adds unit tests for success, error, and JSON-output scenarios
dotnet/src/FlowForge.Console/Services/WorkflowManagement/WorkflowService.cs Implements GetWorkflowAsync and error handling in the service
dotnet/src/FlowForge.Console/Services/WorkflowManagement/IWorkflowService.cs Adds GetWorkflowAsync signature and WorkflowDetailsResult type
dotnet/src/FlowForge.Console/Models/Workflows/WorkflowDetails.cs Defines the new model for detailed workflow information
dotnet/src/FlowForge.Console/Infrastructure/Http/N8nHttpClient.cs Integrates HTTP call to /workflows/{id} and maps response
dotnet/src/FlowForge.Console/Infrastructure/Http/IN8nHttpClient.cs Extends interface with GetWorkflowAsync
dotnet/src/FlowForge.Console/Commands/GetWorkflowSettings.cs Defines command settings (Id argument and --json option)
dotnet/src/FlowForge.Console/Commands/GetWorkflowCommand.cs Implements the command’s table and JSON output logic
docs/user-guides/get-workflow-command.md Adds user guide with usage, examples, and troubleshooting
docs/session-context/NEXT_TASKS.md Updates task queue to include the new command
docs/session-context/CURRENT_STATE.md Marks GetWorkflowCommand as completed in project state
docs/session-context/ACTIVE_SESSION.md Logs session progress for GetWorkflowCommand
Comments suppressed due to low confidence (2)

dotnet/tests/FlowForge.Console.Tests/Commands/GetWorkflowCommandTests.cs:58

  • [nitpick] Consider adding assertions to verify the command’s output (table or JSON) to ensure full coverage of the formatting logic, not just exit codes.
        Assert.Equal(0, exitCode);

docs/user-guides/get-workflow-command.md:237

  • The documentation mentions ID format validation, but the command does not currently enforce any ID format checks; remove or align this reference with the implementation.
- Validates workflow ID format before making API requests

charleslbryant and others added 4 commits July 14, 2025 14:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Remove claim about ID format validation that isn't implemented
- Address PR review feedback from Copilot

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Add NodeDefinition model with proper type safety
- Replace object? Nodes with IEnumerable<NodeDefinition> Nodes
- Update N8nHttpClient mapping to convert N8nNode to NodeDefinition
- Update test data to use NodeDefinition instead of anonymous objects
- Addresses PR review feedback for better type safety

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@charleslbryant
Copy link
Owner Author

Fixed: Improved type safety for WorkflowDetails.Nodes property

  • Created model with proper type safety
  • Replaced with
  • Updated N8nHttpClient mapping to convert N8nNode to NodeDefinition
  • Updated test data to use NodeDefinition instead of anonymous objects
  • All 40 tests passing

This addresses the PR review feedback about using proper models instead of object for better type safety.

@charleslbryant
Copy link
Owner Author

✅ Fixed: Improved type safety for WorkflowDetails.Nodes property

  • Created NodeDefinition model with proper type safety
  • Replaced object? Nodes with IEnumerable Nodes
  • Updated N8nHttpClient mapping to convert N8nNode to NodeDefinition
  • Updated test data to use NodeDefinition instead of anonymous objects
  • All 40 tests passing

This addresses the PR review feedback about using proper models instead of object for better type safety.

@charleslbryant charleslbryant merged commit 2c588d3 into main Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CRD-2.2: Workflow Get Command

1 participant