Merged
Conversation
Co-authored-by: ewega <[email protected]>
Copilot
AI
changed the title
[WIP] Add configure connection list command
Add Feb 19, 2026
configure connection list subcommand
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new read-only CLI subcommand to enumerate existing DevLake plugin connections, primarily to help with inspection and automation.
Changes:
- Introduces
gh devlake configure connection listwith optional--pluginfiltering and tabular output. - Adds unit tests for plugin validation, available plugin slugs, and subcommand registration.
- Documents the new subcommand in the README with usage and sample output.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
cmd/configure_connection_list.go |
Implements the new configure connection list command, plugin filtering/validation, and table rendering. |
cmd/configure_connection_list_test.go |
Adds basic tests for validation helpers and command registration. |
README.md |
Documents the new subcommand, flags, and example output. |
Comments suppressed due to low confidence (5)
cmd/configure_connection_list.go:34
- This command is described as useful for scripting, but it prints a large banner to stdout before the table. That makes
configure connection list | ...harder to parse. Consider either removing the banner for this read-only command, or writing banners/progress messages to stderr so stdout remains just the tabular data (or "No connections found.").
This issue also appears in the following locations of the same file:
- line 46
- line 74
- line 91
fmt.Println()
fmt.Println("════════════════════════════════════════")
fmt.Println(" DevLake — List Connections")
fmt.Println("════════════════════════════════════════")
cmd/configure_connection_list.go:52
- The "Discovering DevLake" status lines are printed to stdout; for script-friendly output they should be suppressed or redirected to stderr (similar to how other commands write warnings to os.Stderr). Otherwise callers expecting only the table on stdout will get extra lines mixed in.
fmt.Println("\n🔍 Discovering DevLake instance...")
disc, err := devlake.Discover(cfgURL)
if err != nil {
return err
}
fmt.Printf(" Found DevLake at %s (via %s)\n", disc.URL, disc.Source)
cmd/configure_connection_list.go:77
- Per-plugin API failures are currently reported with fmt.Printf to stdout. Because the command’s primary output is a table on stdout, warnings like this should go to stderr to avoid corrupting piped/tabular output.
conns, err := client.ListConnections(def.Plugin)
if err != nil {
fmt.Printf("\n⚠️ Could not list %s connections: %v\n", def.DisplayName, err)
continue
cmd/configure_connection_list.go:100
- Output is split between fmt.Println (implicit stdout) and cmd.OutOrStdout() (tabwriter). This makes it impossible to reliably capture/redirect the command’s output via cobra (cmd.SetOut) and can interleave output on different writers. Prefer consistently writing user-facing output via cmd.OutOrStdout(), and send diagnostics to cmd.ErrOrStderr().
fmt.Println()
if len(rows) == 0 {
fmt.Println(" No connections found.")
fmt.Println()
return nil
}
w := tabwriter.NewWriter(cmd.OutOrStdout(), 0, 0, 2, ' ', 0)
fmt.Fprintln(w, "Plugin\tID\tName\tOrganization\tEnterprise")
fmt.Fprintln(w, strings.Repeat("─", 10)+"\t"+strings.Repeat("─", 4)+"\t"+strings.Repeat("─", 30)+"\t"+strings.Repeat("─", 14)+"\t"+strings.Repeat("─", 12))
cmd/configure_connection_list.go:117
- availablePluginSlugs() returns plugins in whatever order AvailableConnections() provides. That order is used in the "choose:" error message, so sorting the slugs would make the message deterministic and keep it consistent with other commands (typically "github, gh-copilot").
func availablePluginSlugs() []string {
defs := AvailableConnections()
slugs := make([]string, len(defs))
for i, d := range defs {
slugs[i] = d.Plugin
}
return slugs
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.
Adds a read-only
listsubcommand underconfigure connectionto enumerate all existing DevLake plugin connections — useful for scripting, debugging, and auditing what's configured.Changes
cmd/configure_connection_list.go— newlistsubcommand:--pluginarg) and callsGET /plugins/{plugin}/connectionstext/tabwriter: Plugin · ID · Name · Organization · Enterprise--pluginvalidates against available (non-coming-soon) plugins, matching the error pattern from other commands⚠️warning, continues to next plugin)"No connections found."when the result set is emptycmd/configure_connection_list_test.go— covers unknown plugin rejection,availablePluginSlugscorrectness, and subcommand registrationREADME.md— documents the new subcommand with flag table and example outputUsage
Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.