feat(cli): add github sub-command for standalone org/repo setup - #1259
Conversation
Site previewPreview: https://0682b760-site.fullsend-ai.workers.dev Commit: |
ReviewFindingsLow
Info
Previous runReviewFindingsLow
Info
Previous run (2)ReviewFindingsCritical
High
Low
Previous run (3)ReviewFindingsMedium
Low
Previous run (4)ReviewFindingsMedium
Low
Previous run (5)ReviewFindingsMedium
Low
Previous run (6)ReviewFindingsLow
Previous run (7)ReviewFindingsMedium
Low
|
288c917 to
b62db5a
Compare
b62db5a to
4c8af2e
Compare
4c8af2e to
9cc3f5a
Compare
9cc3f5a to
28bd34f
Compare
| printer.Blank() | ||
|
|
||
| perRepoCfg := config.NewPerRepoConfig(roles) | ||
| if err := perRepoCfg.Validate(); err != nil { |
There was a problem hiding this comment.
[critical] correctness
printer.Banner() is called without the required version string argument. The ui.Printer.Banner method signature is Banner(version string). This call appears in 5 places: lines 178, 314, 671, 797, and 947. The code will not compile.
Suggested fix: Pass Version() to all Banner calls, e.g. printer.Banner(Version()), matching the pattern used in admin.go.
12d730f to
3598f94
Compare
| if err := validateEnabledRepos(enabledRepos, repoNames); err != nil { | ||
| return err | ||
| } | ||
|
|
There was a problem hiding this comment.
[low] correctness
When enrollAll is true but every eligible repo is skipped due to per-repo guard, enabledRepos remains nil and silently falls through to loadExistingEnabledRepos. The user gets no indication their --enroll-all request was a no-op.
Suggested fix: Add a printer.StepWarn message when enrollAll is true and len(enabledRepos) == 0 before the nil check at line 382.
|
|
||
| cmd := &cobra.Command{ | ||
| Use: "setup <org|owner/repo>", | ||
| Short: "Configure fullsend for a GitHub org or repo", |
There was a problem hiding this comment.
[info] style
Extra blank line between githubSetupConfig struct and newGitHubSetupCmd function. Other files in the package use single blank lines between declarations.
Extract all GitHub-side operations from the monolithic admin install command into a standalone sub-command that only requires GitHub access (no GCP credentials needed). New commands: - github setup <org|owner/repo>: configure GitHub org or repo - github enroll <org> [repo...]: enable repos in config.yaml - github unenroll <org> [repo...]: disable repos in config.yaml - github set <org|owner/repo> <key> <value>: update config values - github status <org>: analyze GitHub-side installation - github uninstall <org>: remove .fullsend repo + org variables - github sync-scaffold <org>: update workflow templates The setup command uses skipMintDispatcher for DispatchTokenLayer, accepting --mint-url as a flag instead of provisioning GCP resources. The set command maintains an internal mapping of key -> storage type (secret vs variable) so users don't need to know the storage backend. Enroll/unenroll delegate to the existing runEnableRepos/runDisableRepos functions for lightweight config.yaml toggles without setting secrets. Signed-off-by: Wayne Sun <gsun@redhat.com>
…dering Remove githubSetupPerOrgOnlyFlags in github.go — it duplicated the existing perOrgOnlyFlags from admin.go (same package, same values). In newGitHubUninstallCmd, move resolveToken() and printer creation before the confirmation prompt so users get a fast failure on missing tokens before typing confirmation. This matches the pattern in admin.go's newUninstallCmd and eliminates a duplicate printer declaration. Signed-off-by: Wayne Sun <gsun@redhat.com>
…n github sub-command When ListOrgInstallations fails in runGitHubUninstall, the app cleanup section was silently skipped with no warning. Add a fallback matching admin.go's runUninstall pattern: warn the user and show all agentSlugs as potential app URLs for manual cleanup. Also update all printer.Banner() calls to pass Version() — the Banner signature was updated upstream to accept a version string. Remove vendor-fullsend-binary from the per-org-only test since the upstream vendor binary feature now supports per-repo mode. Signed-off-by: Wayne Sun <gsun@redhat.com>
Add tests for set command org-target path, ListOrgInstallations error fallback, parseTarget multi-slash behavior, and secret location assertions. Log when installed apps are not found during uninstall app filtering. Signed-off-by: Wayne Sun <gsun@redhat.com>
17a9a72 to
12b54d0
Compare
| if err := validateEnabledRepos(enabledRepos, repoNames); err != nil { | ||
| return err | ||
| } | ||
|
|
There was a problem hiding this comment.
[low] correctness
When enrollAll is true but every eligible repo is skipped due to per-repo guard (not errors), enabledRepos remains nil and silently falls through to loadExistingEnabledRepos. The user gets no indication that their --enroll-all request was effectively a no-op.
Suggested fix: Add a printer.StepWarn message when enrollAll is true and len(enabledRepos) == 0 before the nil check at line 382.
|
|
||
| cmd := &cobra.Command{ | ||
| Use: "setup <org|owner/repo>", | ||
| Short: "Configure fullsend for a GitHub org or repo", |
There was a problem hiding this comment.
[info] style
Extra blank line between the githubSetupConfig struct and newGitHubSetupCmd. Other files in the package use single blank lines between declarations.
Summary
fullsend githubsub-command tree with 7 commands:setup,enroll,unenroll,set,status,uninstall,sync-scaffoldadmin installso GitHub org admins can manage repos using pre-provisioned mint URL and WIF values without GCP credentialssetuphandles both per-org and per-repo installation using the existing layer stack withskipMintDispatchersetunifies secret/variable updates behind an internal key mapping, enabling transparent migration from secrets to variablesenroll/unenrolldelegate to existing enable/disable logic for lightweight config.yaml togglesTest plan
go test ./internal/cli/...passes (39 new tests)go vet ./internal/cli/...cleanfullsend github --helpshows all 7 sub-commandsfullsend github setup --helpshows all flagsfullsend github set --helpshows usagefullsend github setup <org> --mint-url=<url> --skip-app-setupruns layer stack without GCP callsfullsend github set <org> FULLSEND_MINT_URL <url>sets org variablefullsend github sync-scaffold <org>updates workflows only