Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
This is a C# based repository that produces several CLIs that are used by customers to interact with the GitHub migration APIs. Please follow these guidelines when contributing:
This is a C# based repository that produces several CLIs that are used by customers to interact with the GitHub migration APIs. A Go port is in progress and coexists with the C# code. Please follow these guidelines when contributing:

## Code Standards

### Required Before Each Commit
- Run `dotnet format src/OctoshiftCLI.sln` before committing any changes to ensure proper code formatting. This will run dotnet format on all C# files to maintain consistent style
- Run `dotnet format src/OctoshiftCLI.sln` before committing any changes to ensure proper code formatting
- Run `go test ./...` if you modify any Go files
- Run `golangci-lint run` if you modify any Go files

### Development Flow
- Build: `dotnet build src/OctoshiftCLI.sln /p:TreatWarningsAsErrors=true`
- Test: `dotnet test src/OctoshiftCLI.Tests/OctoshiftCLI.Tests.csproj`
- C# Build: `dotnet build src/OctoshiftCLI.sln /p:TreatWarningsAsErrors=true`
- C# Test: `dotnet test src/OctoshiftCLI.Tests/OctoshiftCLI.Tests.csproj`
- Go Build: `just go-build`
- Go Test: `just go-test`

## Repository Structure
- `src/`: Contains the main C# source code for the Octoshift CLI
Expand All @@ -18,6 +22,12 @@ This is a C# based repository that produces several CLIs that are used by custom
- `src/OctoshiftCLI.IntegrationTests/`: Contains integration tests for the Octoshift CLI
- `src/OctoshiftCLI.Tests/`: Contains unit tests for the Octoshift CLI

### Go Port Directories
- `cmd/gei/`, `cmd/ado2gh/`, `cmd/bbs2gh/`: Go CLI entry points
- `pkg/scriptgen/`: PowerShell script generation (ported from C#)
- `pkg/logger/`, `pkg/env/`: Shared Go packages
- `internal/cmdutil/`: Command utility helpers

## Key Guidelines
1. Follow C# best practices and idiomatic patterns
2. Maintain existing code structure and organization
Expand All @@ -26,14 +36,16 @@ This is a C# based repository that produces several CLIs that are used by custom
6. Never silently swallow exceptions.
7. If an exception is expected/understood and we can give a helpful user-friendly message, then throw an OctoshiftCliException with a user-friendly message. Otherwise let the exception bubble up and the top-level exception handler will log and handle it appropriately.

## Go Port (In Progress)

A Go port of these CLIs is underway. The Go code lives alongside the C# code:
## Go Port Sync Requirements

- `cmd/gei/`, `cmd/ado2gh/`, `cmd/bbs2gh/`: Go CLI entry points (skeleton only at this stage)
- `pkg/`: Shared Go packages (logger, env)
- `internal/`: Internal Go packages (command utilities)
**Current state:** The Go port has the base framework and `generate-script` commands for all three CLIs. Script generation has full behavioral parity with C#.

**Current state:** The Go port contains only the base framework — CLI skeleton, logger, environment variable provider, and command structure. No commands have behavioral parity with C# yet.
**When making C# changes to script generation logic:**
- If you modify `GenerateScriptCommandHandler.cs` in any of the three CLIs, you MUST make the corresponding change in Go:
- `src/gei/Commands/GenerateScript/` → `cmd/gei/generate_script.go` + `pkg/scriptgen/generator.go`
- `src/ado2gh/Commands/GenerateScript/` → `cmd/ado2gh/generate_script.go`
- `src/bbs2gh/Commands/GenerateScript/` → `cmd/bbs2gh/generate_script.go`
- Run `go test ./...` to verify the Go changes compile and tests pass
- Generated PowerShell scripts must be identical between C# and Go

**When making C# changes:** No Go sync is required at this stage. Just be aware the Go directories exist and avoid naming conflicts.
**When making other C# changes:** No Go sync required yet. The remaining commands are not yet ported.
Loading
Loading