refactor: split internal/github into internal/forge and internal/forge/github - #133
Closed
ralphbean wants to merge 6 commits into
Closed
refactor: split internal/github into internal/forge and internal/forge/github#133ralphbean wants to merge 6 commits into
ralphbean wants to merge 6 commits into
Conversation
Implement a Go CLI tool using Cobra that demonstrates the installation and bootstrap workflow described in issue #124. The CLI uses charmbracelet/lipgloss for styled terminal output. What's included: - `fullsend install <org>` command with --repo, --agents, --dry-run flags - GitHub App configuration with minimum required permissions - .fullsend config repo creation with safe defaults (auto_merge: false) - Enrollment PR generation for enabled repositories - Reusable GitHub Actions workflow generation - CODEOWNERS file generation - Comprehensive unit tests (46 tests, 92-100% coverage) - golangci-lint configuration and CI integration - Go build/test/lint/vet/fmt targets in Makefile The install command uses a fake GitHub client for the PoC to demonstrate the full workflow without requiring real API credentials. The Client interface is designed for easy replacement with a real implementation. Note: The .github/workflows/lint.yml update (adding Go CI job) requires the workflow scope and should be applied separately by a maintainer. Resolves #124 Assisted-by: OpenCode claude-opus-4-6@default
The end-of-file-fixer pre-commit hook requires exactly one trailing newline. The previous version had two. Assisted-by: OpenCode claude-opus-4-6@default
No code uses Go 1.26-specific features. All dependencies require Go 1.18 or lower, so lowering the minimum version is safe. Assisted-by: OpenCode claude-opus-4-6@default
Replace the simulated install flow with a real GitHub API client that creates repos, files, branches, and PRs via the REST API. Address all findings from code review. Changes: - Add LiveClient implementing Client interface with real HTTP calls - Authenticate via GITHUB_TOKEN environment variable (removed --token flag) - Add security hardening: io.LimitReader (10MB cap), pagination limit (100 pages), URL path escaping on all user inputs, dedicated http.Client with 30s timeout, GitHub Actions env vars instead of inline interpolation to prevent script injection - Use discovered DefaultBranch for PR base (not hardcoded 'main') - Default .fullsend repo to private - Validate org name format and --repo values against discovered repos - Fix DefaultAgents slice aliasing (now returns fresh copy) - Sort validation error messages for determinism - Validate per-repo agent lists in config - Unexport ui style variables (internal use only) - Remove all PoC/demo language from code and help text - Be honest about GitHub App creation (manual step, not automated) - Add comprehensive tests: httptest-based client tests, org name validation, default branch handling, config validation, repo warnings Note: .github/workflows/lint.yml update (adding Go CI job) requires the workflow scope and should be applied separately by a maintainer. Assisted-by: OpenCode claude-opus-4-6@default
Add token resolution chain: GH_TOKEN > GITHUB_TOKEN > gh auth token. If the user has already authenticated with the gh CLI, fullsend picks up their stored credentials automatically — no env var needed. Assisted-by: OpenCode claude-opus-4-6@default
…e/github Extract forge-neutral interface (Client, Repository, ChangeProposal) into internal/forge/ and move the GitHub-specific implementation to internal/forge/github/. This is a pure structural refactor with no behavior changes, preparing the codebase for multi-forge support (GitLab, Forgejo). Key renames: - PullRequest -> ChangeProposal (with URL instead of HTMLURL) - CreatePullRequest -> CreateChangeProposal - Result.PRs -> Result.Proposals - FakeClient moved to forge package with neutral test URLs Assisted-by: OpenCode claude-opus-4-6@default
Member
Author
|
Closing this in favor of #142 |
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.
Summary
Client,Repository,ChangeProposal) intointernal/forge/packageLiveClient,AppConfig) tointernal/forge/github/internal/install/,internal/cli/) to use the new package structureinternal/forge/with forge-neutral namingThis is a pure structural refactor with no behavior changes. All existing tests pass unchanged (modulo import paths and type name updates).
Key renames
github.PullRequestforge.ChangeProposalgithub.Clientforge.Clientgithub.Repositoryforge.RepositoryCreatePullRequest()CreateChangeProposal()Result.PRsResult.Proposalspr.HTMLURLproposal.URLVerification
All four checks pass clean:
go build ./...go vet ./...go test ./... -count=1 -timeout 60sgolangci-lint run ./...