|
| 1 | +# AI Coding Agent Instructions for SeedFolder |
| 2 | + |
| 3 | +## Project Overview |
| 4 | +This is a .NET Global Tool that creates project directories and seeds them with standard dotfiles. The entire application is contained in a single file (`src/Program.cs`) for simplicity. |
| 5 | + |
| 6 | +## Architecture Patterns |
| 7 | + |
| 8 | +### Single-File Console Application |
| 9 | +- All logic exists in `src/Program.cs` - no complex project structure |
| 10 | +- Uses `McMaster.Extensions.CommandLineUtils` for CLI interactions, `Figgle` for ASCII headers, `Colorful.Console` for output formatting |
| 11 | +- Command-line parsing is handled manually in `Main()` - check for help flags before processing folder names |
| 12 | + |
| 13 | +### Embedded Resources Pattern |
| 14 | +Template files in `src/Data/` are embedded as resources, not file system copies: |
| 15 | +```xml |
| 16 | +<EmbeddedResource Include="Data/dockerignore" /> |
| 17 | +<EmbeddedResource Include="Data/editorconfig" /> |
| 18 | +``` |
| 19 | +Access via `Assembly.GetManifestResourceStream("solrevdev.seedfolder.Data.{filename}")` in `WriteFileAsync()` |
| 20 | + |
| 21 | +### Multi-Framework Targeting |
| 22 | +Targets `net8.0;net9.0` for modern .NET compatibility. .NET 8 is LTS (supported until November 2026) and .NET 9 is STS (18-month support). Version bumps in `.csproj` trigger NuGet deployment. |
| 23 | + |
| 24 | +## Key Development Workflows |
| 25 | + |
| 26 | +### Local Testing Cycle |
| 27 | +```bash |
| 28 | +# Build and test locally (use build/test-local.sh script) |
| 29 | +dotnet pack -c release -o artifacts/nupkg |
| 30 | +dotnet tool uninstall -g solrevdev.seedfolder |
| 31 | +dotnet tool install -g --add-source artifacts/nupkg solrevdev.seedfolder |
| 32 | +``` |
| 33 | + |
| 34 | +### Version Management |
| 35 | +- Bump `<Version>` in `src/solrevdev.seedfolder.csproj` to trigger CI/CD |
| 36 | +- CI only runs on pushes to `master` branch (exclude commits with `***NO_CI***`, `[ci skip]`, `[skip ci]`) |
| 37 | +- GitHub Actions automatically publishes to NuGet on master pushes |
| 38 | + |
| 39 | +### Running During Development |
| 40 | +```bash |
| 41 | +# Interactive mode |
| 42 | +dotnet run --project src/solrevdev.seedfolder.csproj |
| 43 | + |
| 44 | +# With folder name argument |
| 45 | +dotnet run --project src/solrevdev.seedfolder.csproj myfolder |
| 46 | +``` |
| 47 | + |
| 48 | +## Project-Specific Conventions |
| 49 | + |
| 50 | +### Input Sanitization |
| 51 | +Always use `RemoveSpaces()` and `SafeNameForFileSystem()` for folder names: |
| 52 | +```csharp |
| 53 | +folderName = RemoveSpaces(folderName); // Spaces → dashes |
| 54 | +folderName = SafeNameForFileSystem(folderName); // Invalid chars → dashes |
| 55 | +``` |
| 56 | + |
| 57 | +### Date Prefixing Logic |
| 58 | +Interactive mode offers date prefixing: `YYYY-MM-DD_foldername` format using `StringBuilder` for performance. |
| 59 | + |
| 60 | +### Error Handling Pattern |
| 61 | +- Check if folder exists before creation - exit with colored error message |
| 62 | +- Use `Directory.Exists()` check, then `ConsoleColor.DarkRed` for error output |
| 63 | +- No exceptions for user errors - graceful CLI messaging |
| 64 | + |
| 65 | +## File Structure Details |
| 66 | +- `src/Data/` contains template files without leading dots (e.g., `gitignore` not `.gitignore`) |
| 67 | +- Files are copied with proper dotfile names during `WriteFileAsync()` |
| 68 | +- `omnisharp.json` is copied without dot prefix (special case) |
| 69 | + |
| 70 | +## CI/CD Integration Points |
| 71 | +- GitHub Actions workflow in `.github/workflows/ci.yml` handles build → pack → publish |
| 72 | +- Requires `NUGET_API_KEY` secret for automated publishing |
| 73 | +- Uses `rohith/[email protected]` action for NuGet deployment |
| 74 | +- Build scripts in `build/` folder provide cross-platform local testing |
0 commit comments