Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds a --output flag to the CLI commands (visualize, erd, classdiagram), enabling users to save generated diagrams directly to disk with proper encoding (UTF-8 without BOM) and automatic markdown fencing based on file extension. The feature addresses issues with shell redirection on Windows PowerShell and improves CI/CD integration by providing reliable file output.
Changes:
- Added
WriteAllTextAsyncandCreateDirectorymethods toIFileSysteminterface andPhysicalFileSystemimplementation - Implemented
--outputflag in all three CLI commands with consistent file handling logic and markdown fencing based on extension (.mmd = no fence, others = fence) - Added comprehensive unit and integration tests covering UTF-8 encoding, directory creation, and markdown fencing scenarios
- Updated documentation (README, CLI README, specifications) to showcase the new feature with clear examples
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ProjGraph.Lib.Core/Abstractions/IFileSystem.cs | Added WriteAllTextAsync and CreateDirectory methods to enable file writing operations |
| src/ProjGraph.Lib.Core/Infrastructure/PhysicalFileSystem.cs | Implemented new IFileSystem methods with UTF-8 encoding (no BOM) and directory creation |
| src/ProjGraph.Cli/Commands/VisualizeCommand.cs | Added --output flag, file writing logic, and markdown fencing based on extension |
| src/ProjGraph.Cli/Commands/ErdCommand.cs | Added --output flag, file writing logic, and markdown fencing based on extension |
| src/ProjGraph.Cli/Commands/ClassDiagramCommand.cs | Added --output flag, file writing logic, and markdown fencing based on extension |
| src/ProjGraph.Cli/Program.cs | Added examples demonstrating the new --output flag for all three commands |
| tests/ProjGraph.Tests.Unit.Core/PhysicalFileSystemTests.cs | Unit tests verifying UTF-8 encoding (no BOM), directory creation, and file operations |
| tests/ProjGraph.Tests.Integration.Cli/VisualizeCommandTests.cs | Integration tests for both .md (with fence) and .mmd (without fence) output scenarios |
| tests/ProjGraph.Tests.Integration.Cli/ErdCommandTests.cs | Integration test for .md file output with markdown fencing |
| tests/ProjGraph.Tests.Integration.Cli/ClassDiagramCommandTests.cs | Integration test for .md file output with markdown fencing |
| README.md | Updated examples to show new --output flag usage instead of shell redirection |
| src/ProjGraph.Cli/README.md | Comprehensive documentation of --output flag for all commands with examples |
| ProjGraph.slnx | Renamed Nuget.config to NuGet.config (proper casing) and added docs-publish.yml workflow reference |
| specs/007-cli-file-output/*.md | Complete feature specification including requirements, implementation plan, tasks, and quickstart guide |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This pull request introduces a new
--outputflag for CLI commands, enabling users to save generated diagrams directly to disk rather than relying on shell redirection. The feature is implemented acrossvisualize,class-diagram, anderdcommands, with robust error handling, markdown fencing logic, and confirmation messaging. The change is thoroughly documented and tested, with updates to abstractions, command settings, and integration tests.CLI Command Enhancements:
--outputflag (-o|--output <path>) toClassDiagramCommand,ErdCommand, and (implied)VisualizeCommand, allowing diagrams to be written directly to a file instead of stdout. [1] [2]IFileSystemfor file writing, including automatic directory creation and consistent UTF-8 encoding..mdor anything other than.mmd.Documentation & Specification:
specs/007-cli-file-output/. [1] [2] [3] [4] [5] [6] [7]User Experience Improvements:
Repository and Workflow Updates:
Nuget.configtoNuGet.configfor consistency and added a new documentation publishing workflow to.github/workflows/. [1] [2]README Updates:
--outputflag, replacing shell redirection with direct file output. [1] [2]References:
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]