diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000..8aea65c8 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,248 @@ +# GitHub Copilot Instructions for LogExpert + +## Repository Overview + +**LogExpert** is a Windows-based log file tail and analysis application written in C#. It's a GUI replacement for the Unix tail command, originally from CodePlex, with extensive features for viewing, analyzing, and filtering log files. + +### Key Features +- Tail mode for real-time log monitoring +- MDI-Interface with tabs for multiple files +- Search functionality including RegEx support +- Bookmarks and highlighting capabilities +- Flexible filter views with filter-to-tab functionality +- Columnizer plugins for parsing structured logs +- Unicode support and log4j XML file support +- 3rd party plugin architecture +- Automatic columnizer detection (experimental) +- Serilog.Formatting.Compact format support + +### Technology Stack +- **Primary Language**: C# (.NET 8.0-windows target framework) +- **UI Framework**: Windows Forms +- **Build System**: Nuke Build System with MSBuild +- **Target Platform**: Windows (requires Windows-specific dependencies) +- **Package Management**: NuGet with central package management +- **Testing**: NUnit framework +- **CI/CD**: GitHub Actions + AppVeyor + +## High-Level Repository Information + +- **Repository Size**: Medium (~26 source projects) +- **Project Type**: Desktop Application (Windows Forms) +- **Architecture**: Plugin-based architecture with columnizers +- **Main Entry Point**: `src/LogExpert/Program.cs` +- **Main Solution**: `src/LogExpert.sln` + +## Build Instructions + +### Prerequisites +**CRITICAL**: This project requires Windows development environment and .NET 9.0.301 SDK or compatible. + +### Environment Setup +1. **Install .NET SDK**: Project requires .NET 9.0.301 SDK (specified in `global.json`) +2. **Windows Environment**: Build targets `net8.0-windows` and uses Windows Forms +3. **Visual Studio**: Recommended Visual Studio 2017+ or Visual Studio Code with C# extension +4. **Optional Dependencies**: + - Chocolatey (for packaging) + - Inno Setup 5 or 6 (for setup creation) + +### Build Commands + +#### Using Nuke Build System (Recommended) +```bash +# Windows Command Prompt/PowerShell +./build.ps1 + +# Cross-platform (Linux/macOS) - Note: Limited functionality +./build.sh +``` + +#### Common Nuke Build Targets +```bash +# Clean and build +./build.ps1 --target Clean Compile + +# Run tests +./build.ps1 --target Test + +# Create packages +./build.ps1 --target Pack + +# Full release build with setup +./build.ps1 --target Clean Pack CreateSetup --configuration Release +``` + +#### Direct .NET Commands +```bash +# From src/ directory +dotnet restore +dotnet build --no-restore +dotnet test --no-build --verbosity normal +``` + +### Known Build Issues and Workarounds + +1. **Cross-Platform Limitations**: + - Linux/macOS builds will fail due to missing Windows Desktop SDK components + - Error: "Microsoft.NET.Sdk.WindowsDesktop/targets" not found + - **Workaround**: Use Windows environment or Windows Subsystem for Linux with proper .NET Windows SDK + +2. **.NET Version Mismatch**: + - Project requires .NET 9.0.301 but may encounter .NET 8.0 environments + - **Workaround**: Nuke build system automatically downloads correct SDK version + +3. **Build Timing**: + - Full build: ~2-5 minutes on modern hardware + - Test execution: ~30 seconds to 2 minutes + - Package creation: Additional 1-3 minutes + +### Validation Steps +Always run these validation steps after making changes: +1. `./build.ps1 --target Clean Compile` (ensures clean build) +2. `./build.ps1 --target Test` (runs all unit tests) +3. Review build output in `bin/` directory +4. Check for warnings in build output + +## Project Layout and Architecture + +### Repository Structure +``` +LogExpert/ +├── .github/ # GitHub Actions workflows +│ └── workflows/ # build_dotnet.yml, test_dotnet.yml +├── src/ # Main source directory +│ ├── LogExpert.sln # Main solution file +│ ├── LogExpert/ # Main application project +│ ├── LogExpert.Core/ # Core functionality library +│ ├── LogExpert.UI/ # UI components library +│ ├── LogExpert.Resources/ # Resource files +│ ├── ColumnizerLib/ # Plugin interface library +│ ├── Columnizers/ # Built-in columnizer plugins +│ │ ├── CsvColumnizer/ +│ │ ├── JsonColumnizer/ +│ │ ├── RegexColumnizer/ +│ │ └── ... # Other columnizers +│ ├── Tests/ # Test projects +│ │ ├── LogExpert.Tests/ +│ │ ├── ColumnizerLib.UnitTests/ +│ │ └── RegexColumnizer.UnitTests/ +│ └── Solution Items/ # Shared configuration files +├── build/ # Nuke build system +│ ├── Build.cs # Main build script +│ └── _build.csproj # Build project file +├── chocolatey/ # Chocolatey package configuration +├── lib/ # External libraries +├── global.json # .NET SDK version pinning +├── GitVersion.yml # Version configuration +├── Directory.Build.props # MSBuild properties +└── Directory.Packages.props # NuGet package versions +``` + +### Key Configuration Files +- **`global.json`**: Specifies required .NET SDK version (9.0.301) +- **`src/Directory.Build.props`**: Common MSBuild properties for all projects +- **`src/Directory.Packages.props`**: Centralized NuGet package version management +- **`.editorconfig`**: Code style and formatting rules (comprehensive 4000+ line config) +- **`GitVersion.yml`**: Semantic versioning configuration +- **`appveyor.yml`**: AppVeyor CI configuration + +### Architectural Components + +#### Main Application (`src/LogExpert/`) +- **`Program.cs`**: Application entry point with IPC for single-instance mode +- **Target Framework**: `net8.0-windows` +- **Dependencies**: LogExpert.UI, LogExpert.Core, ColumnizerLib, PluginRegistry + +#### Core Libraries +- **`LogExpert.Core`**: Core business logic and interfaces +- **`LogExpert.UI`**: Windows Forms UI components +- **`LogExpert.Resources`**: Localization and resource files +- **`ColumnizerLib`**: Plugin interface definitions + +#### Plugin System +- **Columnizers**: Parse log lines into columns (CSV, JSON, RegEx, etc.) +- **File System Plugins**: Support for different file sources (local, SFTP) +- **Plugin Discovery**: Automatic plugin loading from application directory + +### CI/CD Pipeline + +#### GitHub Actions +1. **`.github/workflows/build_dotnet.yml`**: + - Triggers on PR to Development branch + - Builds Debug and Release configurations + - Uploads build artifacts + - Uses windows-latest runner + +2. **`.github/workflows/test_dotnet.yml`**: + - Runs on push to Development branch + - Executes unit tests + - Uses .NET 9.0.x SDK + +#### AppVeyor Integration +- **`appveyor.yml`**: Legacy CI configuration +- Builds packages and publishes artifacts +- Creates setup executables with Inno Setup + +### Testing Strategy +- **Unit Tests**: Located in `*Tests.csproj` projects +- **Test Frameworks**: NUnit with Moq for mocking +- **Test Data**: Located in `TestData/` directories within test projects +- **Coverage**: Focus on core functionality and columnizer plugins + +### Dependencies and Libraries +Key external dependencies (managed via Directory.Packages.props): +- **NLog**: Logging framework +- **Newtonsoft.Json**: JSON processing +- **CsvHelper**: CSV file processing +- **SSH.NET**: SFTP file system support +- **DockPanelSuite**: UI docking panels +- **NUnit/Moq**: Testing frameworks + +## Agent Guidance + +### Making Code Changes +1. **Always build before changing**: Run `./build.ps1 --target Clean Compile Test` to establish baseline +2. **Follow existing patterns**: Study similar implementations in the codebase +3. **Respect architecture**: Use plugin interfaces for extensibility +4. **Code style**: Follow `.editorconfig` rules (extensive configuration provided) +5. **Null safety**: Project uses nullable reference types (`enable`) + +### Common Development Tasks + +#### Adding New Columnizer +1. Create new project in `src/` directory following naming pattern `*Columnizer` +2. Implement `ILogLineColumnizer` interface from `ColumnizerLib` +3. Add project reference to main solution +4. Add unit tests in corresponding `*Tests` project + +#### Modifying UI Components +1. UI components are in `LogExpert.UI` project +2. Follow Windows Forms patterns +3. Be aware of High DPI considerations (documented in README) +4. Test on different Windows versions if possible + +#### Adding Dependencies +1. Update `src/Directory.Packages.props` for version management +2. Add `` in specific project files +3. Ensure compatibility with .NET 8.0 target framework + +### Build Troubleshooting +- **Missing Windows SDK**: Ensure Windows development environment +- **Version conflicts**: Check `global.json` and upgrade SDK if needed +- **Plugin loading issues**: Verify plugins are copied to output directory +- **Test failures**: Check test data file paths and Windows-specific assumptions + +### Important Notes +- **Windows-only**: This is a Windows-specific application using Windows Forms +- **Plugin architecture**: Extensibility through columnizer and file system plugins +- **Single instance**: Application uses named pipes for IPC between instances +- **Legacy codebase**: Contains patterns from .NET Framework era, being modernized +- **Comprehensive configuration**: Very detailed .editorconfig and analysis rules + +### Trust These Instructions +These instructions are comprehensive and tested. Only search for additional information if: +1. Instructions appear incomplete for your specific task +2. You encounter errors not covered in the troubleshooting section +3. You need to understand implementation details not covered here + +The build system, project structure, and development patterns described here are accurate as of the current codebase state. \ No newline at end of file diff --git a/.gitignore b/.gitignore index 308bc974..8fe30cb0 100644 --- a/.gitignore +++ b/.gitignore @@ -322,6 +322,9 @@ paket-files/ # FAKE - F# Make .fake/ +# Nuke Build System +.nuke/ + # CodeRush personal settings .cr/personal diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json deleted file mode 100644 index ed98cf7e..00000000 --- a/.nuke/build.schema.json +++ /dev/null @@ -1,295 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "$ref": "#/definitions/build", - "title": "Build Schema", - "definitions": { - "Host": { - "type": "string", - "enum": [ - "AppVeyor", - "AzurePipelines", - "Bamboo", - "Bitbucket", - "Bitrise", - "GitHubActions", - "GitLab", - "Jenkins", - "Rider", - "SpaceAutomation", - "TeamCity", - "Terminal", - "TravisCI", - "VisualStudio", - "VSCode" - ] - }, - "ExecutableTarget": { - "type": "string", - "enum": [ - "BuildChocolateyPackage", - "ChangeVersionNumber", - "Clean", - "CleanPackage", - "CleanupAppDataLogExpert", - "CleanupDocumentsLogExpert", - "ColumnizerLibCreate", - "ColumnizerLibCreateNuget", - "Compile", - "CopyFilesForSetup", - "CopyOutputForChocolatey", - "CreatePackage", - "CreateSetup", - "Pack", - "PackageSftpFileSystem", - "PrepareChocolateyTemplates", - "Publish", - "PublishChocolatey", - "PublishColumnizerNuget", - "PublishGithub", - "PublishToAppveyor", - "Restore", - "Test" - ] - }, - "Verbosity": { - "type": "string", - "description": "", - "enum": [ - "Verbose", - "Normal", - "Minimal", - "Quiet" - ] - }, - "NukeBuild": { - "properties": { - "ChocolateyApiKey": { - "type": "string", - "description": "Chocolatey api key" - }, - "Configuration": { - "type": "string", - "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", - "enum": [ - "Debug", - "Release" - ] - }, - "Continue": { - "type": "boolean", - "description": "Indicates to continue a previously failed build attempt" - }, - "ExcludeDirectoryGlob": { - "type": "array", - "description": "Exlcude directory glob", - "items": { - "type": "string" - } - }, - "ExcludeFileGlob": { - "type": "array", - "description": "Exclude file globs", - "items": { - "type": "string" - } - }, - "GitHubApiKey": { - "type": "string", - "description": "GitHub Api key" - }, - "Help": { - "type": "boolean", - "description": "Shows the help text for this build assembly" - }, - "Host": { - "type": "string", - "description": "Host for execution. Default is 'automatic'", - "enum": [ - "AppVeyor", - "AzurePipelines", - "Bamboo", - "Bitbucket", - "Bitrise", - "GitHubActions", - "GitLab", - "Jenkins", - "Rider", - "SpaceAutomation", - "TeamCity", - "Terminal", - "TravisCI", - "VisualStudio", - "VSCode" - ] - }, - "my_variable": { - "type": "string", - "description": "My variable" - }, - "NoLogo": { - "type": "boolean", - "description": "Disables displaying the NUKE logo" - }, - "NugetApiKey": { - "type": "string", - "description": "Nuget api key" - }, - "Partition": { - "type": "string", - "description": "Partition to use on CI" - }, - "Plan": { - "type": "boolean", - "description": "Shows the execution plan (HTML)" - }, - "Profile": { - "type": "array", - "description": "Defines the profiles to load", - "items": { - "type": "string" - } - }, - "Root": { - "type": "string", - "description": "Root directory during build execution" - }, - "Skip": { - "type": "array", - "description": "List of targets to be skipped. Empty list skips all dependencies", - "items": { - "type": "string", - "enum": [ - "BuildChocolateyPackage", - "ChangeVersionNumber", - "Clean", - "CleanPackage", - "CleanupAppDataLogExpert", - "CleanupDocumentsLogExpert", - "ColumnizerLibCreateNuget", - "Compile", - "CopyFilesForSetup", - "CopyOutputForChocolatey", - "CreatePackage", - "CreateSetup", - "Pack", - "PackageSftpFileSystem", - "PrepareChocolateyTemplates", - "Publish", - "PublishChocolatey", - "PublishColumnizerNuget", - "PublishGithub", - "PublishToAppveyor", - "Restore", - "Test" - ] - } - }, - "Solution": { - "type": "string", - "description": "Path to a solution file that is automatically loaded" - }, - "Target": { - "type": "array", - "description": "List of targets to be invoked. Default is '{default_target}'", - "items": { - "type": "string", - "enum": [ - "BuildChocolateyPackage", - "ChangeVersionNumber", - "Clean", - "CleanPackage", - "CleanupAppDataLogExpert", - "CleanupDocumentsLogExpert", - "ColumnizerLibCreateNuget", - "Compile", - "CopyFilesForSetup", - "CopyOutputForChocolatey", - "CreatePackage", - "CreateSetup", - "Pack", - "PackageSftpFileSystem", - "PrepareChocolateyTemplates", - "Publish", - "PublishChocolatey", - "PublishColumnizerNuget", - "PublishGithub", - "PublishToAppveyor", - "Restore", - "Test" - ] - } - }, - "Verbosity": { - "type": "string", - "description": "Logging verbosity during build execution. Default is 'Normal'", - "$ref": "#/definitions/Verbosity" - } - } - } - }, - "allOf": [ - { - "properties": { - "ChocolateyApiKey": { - "type": "string", - "description": "Chocolatey api key" - }, - "Configuration": { - "type": "string", - "description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)", - "enum": [ - "Minimal", - "Normal", - "Quiet", - "Verbose" - ] - }, - "ExcludeDirectoryGlob": { - "type": "array", - "description": "Exlcude directory glob", - "items": { - "type": "string" - } - }, - "ExcludeFileGlob": { - "type": "array", - "description": "Exclude file globs", - "items": { - "type": "string" - } - }, - "GitHubApiKey": { - "type": "string", - "description": "GitHub Api key" - }, - "my_variable": { - "type": "string", - "description": "My variable" - }, - "NugetApiKey": { - "type": "string", - "description": "Nuget api key" - }, - "Solution": { - "type": "string", - "description": "Path to a solution file that is automatically loaded" - }, - "VersionFileString": { - "type": "string", - "description": "Version file string" - }, - "VersionInformationString": { - "type": "string", - "description": "Version Information string" - }, - "VersionString": { - "type": "string", - "description": "Version string" - } - } - }, - { - "$ref": "#/definitions/NukeBuild" - } - } -} diff --git a/.nuke/parameters.json b/.nuke/parameters.json deleted file mode 100644 index 969e7748..00000000 --- a/.nuke/parameters.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "$schema": "./build.schema.json", - "Solution": "src/LogExpert.sln" -} diff --git a/build.sh b/build.sh old mode 100644 new mode 100755