|
| 1 | +# Agent Quick Reference |
| 2 | + |
| 3 | +Project-specific guidance for agents working on Template DotNet Tool - a reference implementation demonstrating best practices for DEMA Consulting .NET CLI tools. |
| 4 | + |
| 5 | +## Tech Stack |
| 6 | + |
| 7 | +- C# 12, .NET 8.0/9.0/10.0, dotnet CLI, NuGet |
| 8 | + |
| 9 | +## Key Files |
| 10 | + |
| 11 | +- **`requirements.yaml`** - All requirements with test linkage (enforced via `dotnet reqstream --enforce`) |
| 12 | +- **`.editorconfig`** - Code style (file-scoped namespaces, 4-space indent, UTF-8+BOM, LF endings) |
| 13 | +- **`.cspell.json`, `.markdownlint.json`, `.yamllint.yaml`** - Linting configs |
| 14 | + |
| 15 | +## Requirements |
| 16 | + |
| 17 | +- Link ALL requirements to tests (prefer `TemplateTool_*` self-validation tests) |
| 18 | +- Enforced in CI: `dotnet reqstream --requirements requirements.yaml --tests "test-results/**/*.trx" --enforce` |
| 19 | +- When adding features: add requirement + link to test |
| 20 | + |
| 21 | +## Testing |
| 22 | + |
| 23 | +- **Test Naming**: `TemplateTool_MethodUnderTest_Scenario` for self-validation tests |
| 24 | +- **Self-Validation**: All tests run via `--validate` flag and can output TRX/JUnit format |
| 25 | +- **Test Framework**: Uses DemaConsulting.TestResults library for test result generation |
| 26 | + |
| 27 | +## Code Style |
| 28 | + |
| 29 | +- **XML Docs**: On ALL members (public/internal/private) with spaces after `///` in summaries |
| 30 | +- **Errors**: `ArgumentException` for parsing, `InvalidOperationException` for runtime issues |
| 31 | +- **Namespace**: File-scoped namespaces only |
| 32 | +- **Using Statements**: Top of file only (no nested using declarations except for IDisposable) |
| 33 | +- **String Formatting**: Use interpolated strings ($"") for clarity |
| 34 | + |
| 35 | +## Project Structure |
| 36 | + |
| 37 | +- **Context.cs**: Handles command-line argument parsing, logging, and output |
| 38 | +- **Program.cs**: Main entry point with version/help/validation routing |
| 39 | +- **Validation.cs**: Self-validation tests with TRX/JUnit output support |
| 40 | + |
| 41 | +## Standard Command-Line Arguments |
| 42 | + |
| 43 | +All DEMA Consulting tools should support: |
| 44 | +- `-v`, `--version` - Display version information |
| 45 | +- `-?`, `-h`, `--help` - Display help message |
| 46 | +- `--silent` - Suppress console output |
| 47 | +- `--validate` - Run self-validation |
| 48 | +- `--results <file>` - Write validation results to file (TRX or JUnit format) |
| 49 | +- `--log <file>` - Write output to log file |
| 50 | + |
| 51 | +## Build and Test |
| 52 | + |
| 53 | +```bash |
| 54 | +# Build the project |
| 55 | +dotnet build --configuration Release |
| 56 | + |
| 57 | +# Run self-validation |
| 58 | +dotnet run --project src/DemaConsulting.TemplateDotNetTool \ |
| 59 | + --configuration Release --framework net10.0 --no-build -- --validate |
| 60 | + |
| 61 | +# Use convenience scripts |
| 62 | +./build.sh # Linux/macOS |
| 63 | +build.bat # Windows |
| 64 | +``` |
| 65 | + |
| 66 | +## Documentation |
| 67 | + |
| 68 | +- **User Guide**: `docs/guide/guide.md` |
| 69 | +- **Requirements**: `requirements.yaml` -> auto-generated docs |
| 70 | +- **Build Notes**: Auto-generated via BuildMark |
| 71 | +- **Code Quality**: Auto-generated via CodeQL and SonarMark |
| 72 | +- **Trace Matrix**: Auto-generated via ReqStream |
| 73 | + |
| 74 | +## CI/CD |
| 75 | + |
| 76 | +- **Quality Checks**: Markdown lint, spell check, YAML lint |
| 77 | +- **Build**: Multi-platform (Windows/Linux) |
| 78 | +- **CodeQL**: Security scanning |
| 79 | +- **Integration Tests**: .NET 8/9/10 on Windows/Linux |
| 80 | +- **Documentation**: Auto-generated via Pandoc + Weasyprint |
| 81 | + |
| 82 | +## Common Tasks |
| 83 | + |
| 84 | +```bash |
| 85 | +# Format code |
| 86 | +dotnet format |
| 87 | + |
| 88 | +# Run all linters |
| 89 | +./lint.sh # Linux/macOS |
| 90 | +lint.bat # Windows |
| 91 | + |
| 92 | +# Pack as NuGet tool |
| 93 | +dotnet pack --configuration Release |
| 94 | +``` |
0 commit comments