Add JSON output option to list-workflows command#42
Merged
charleslbryant merged 3 commits intomainfrom Jul 14, 2025
Merged
Conversation
- Created ListWorkflowsSettings with --json command option - Updated ListWorkflowsCommand to support JSON and table output formats - Added comprehensive test coverage for JSON output functionality - Fixed null reference warning in error message handling - JSON output includes success status, total count, and workflow details - Maintains backward compatibility with existing table output 🤖 Generated with AI Assistant (George) Co-Authored-By: George <george@decoupledlogic.com>
- Created comprehensive user guide for list-workflows command - Documents both table and JSON output formats with examples - Updated CURRENT_STATE.md to reflect JSON output completion - Updated NEXT_TASKS.md with new task priorities - Ready for next development session 🤖 Generated with AI Assistant (George) Co-Authored-By: George <george@decoupledlogic.com>
- Document decision to implement --json flag for machine-readable output - Establish consistent envelope pattern for JSON responses - Define extensible structure for future CLI commands - Record rationale for flag-based approach over alternatives 🤖 Generated with AI Assistant (George) Co-Authored-By: George <george@decoupledlogic.com>
There was a problem hiding this comment.
Pull Request Overview
Adds machine-readable JSON output to the list-workflows command while preserving the existing table format, and updates tests and documentation accordingly.
- Introduces a
--jsonflag via newListWorkflowsSettings.Jsonproperty. - Extends
ListWorkflowsCommandto emit structured JSON (success or error envelopes) when the flag is used. - Updates existing tests, adds a new JSON-success test, and refreshes user guides and ADR.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/tests/FlowForge.Console.Tests/Commands/ListWorkflowsCommandTests.cs | Updated command invocation to include settings and added a JSON-success test |
| dotnet/src/FlowForge.Console/Commands/ListWorkflowsSettings.cs | Introduced --json option |
| dotnet/src/FlowForge.Console/Commands/ListWorkflowsCommand.cs | Implemented JSON output branches and error-envelope handling |
| docs/user-guides/list-workflows-command.md | Documented JSON usage, examples, and error formats |
| docs/session-context/NEXT_TASKS.md | Removed completed JSON task from backlog |
| docs/session-context/CURRENT_STATE.md | Marked JSON output work as completed |
| docs/adr/adr-0008-json-output-option.md | Added ADR detailing the JSON envelope pattern |
Comments suppressed due to low confidence (3)
dotnet/tests/FlowForge.Console.Tests/Commands/ListWorkflowsCommandTests.cs:135
- The new JSON-success test only checks the exit code and service call but doesn’t validate the actual JSON output. Consider capturing the console output and asserting that the serialized JSON matches the expected structure and field values.
Assert.Equal(0, exitCode);
dotnet/tests/FlowForge.Console.Tests/Commands/ListWorkflowsCommandTests.cs:107
- There’s no test verifying the JSON error response when the service fails. Add a test that sets
settings.Json = trueon a failureWorkflowListResultto ensure the error envelope is serialized correctly.
[Fact]
dotnet/src/FlowForge.Console/Commands/ListWorkflowsCommand.cs:33
- For consistency with the envelope pattern, swap the order to serialize
successfirst and thenerror(e.g.,new { success = false, error = errorMessage }) so all JSON responses start with thesuccessfield.
var errorJson = JsonSerializer.Serialize(new { error = errorMessage, success = false });
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--jsonflag tolist-workflowscommand for machine-readable outputTechnical Changes
ListWorkflowsCommandto support--jsonflagWorkflowServiceto provide structured dataTest Plan
--jsonflagDocumentation
--jsonflag documentation🤖 Generated with Claude Code