Add GitHub connection type — repo viewer with org grouping and auto-refresh
New protocol type 'github' for browsing repositories via the GitHub REST API. Creates a non-terminal panel showing repos grouped by owner/org, sorted by last commit date (newest first), with search filtering and auto-refresh. Backend: - ProtocolGitHub constant and GitHubConfig/GitHubRepo model structs - New internal/githubclient package (REST API, pagination, token validation) - Session manager connectGitHub() with periodic refresh goroutine - API surface: RefreshGitHubRepos() for on-demand refresh - Token stored via existing credential infrastructure (keychain/vault) Frontend: - GitHub tab in profile editor with API URL and token storage fields - New github.js viewer component (grouped repos, badges, language dots) - github.css with charcoal-themed repo cards and org headers - Protocol colour tokens, tab badge, sidebar indicator for GitHub - Event wiring for session:github:repos and session:github:error - Cleanup on tab close Supports GitHub Enterprise via configurable API base URL.
This commit is contained in:
@@ -11,6 +11,7 @@ const (
|
||||
DefaultSSHPort = 22
|
||||
DefaultTelnetPort = 23
|
||||
DefaultRAWPort = 23
|
||||
DefaultGitHubPort = 443
|
||||
)
|
||||
|
||||
// Default timeout values (in seconds).
|
||||
@@ -96,6 +97,14 @@ func NewProfile(protocol Protocol) Profile {
|
||||
Encoding: "utf-8",
|
||||
PayloadPresets: []PayloadPreset{},
|
||||
}
|
||||
case ProtocolGitHub:
|
||||
p.Port = DefaultGitHubPort
|
||||
p.Host = "github.com"
|
||||
p.GitHub = &GitHubConfig{
|
||||
BaseURL: "https://api.github.com",
|
||||
SecretMode: SecretModeSaved,
|
||||
RefreshIntervalSecs: 300,
|
||||
}
|
||||
}
|
||||
|
||||
return p
|
||||
|
||||
@@ -11,6 +11,7 @@ const (
|
||||
ProtocolSSH Protocol = "ssh"
|
||||
ProtocolTelnet Protocol = "telnet"
|
||||
ProtocolRAW Protocol = "raw"
|
||||
ProtocolGitHub Protocol = "github"
|
||||
)
|
||||
|
||||
// HostKeyPolicy determines how unknown or changed SSH host keys are handled.
|
||||
@@ -76,6 +77,9 @@ type Profile struct {
|
||||
|
||||
// RAW-specific configuration
|
||||
RAW *RAWConfig `json:"raw,omitempty"`
|
||||
|
||||
// GitHub-specific configuration
|
||||
GitHub *GitHubConfig `json:"github,omitempty"`
|
||||
}
|
||||
|
||||
// SSHConfig holds SSH-specific settings for a connection profile.
|
||||
@@ -132,6 +136,36 @@ type PayloadPreset struct {
|
||||
Format string `json:"format"` // text, hex, escaped
|
||||
}
|
||||
|
||||
// GitHubConfig holds GitHub API-specific settings for a connection profile.
|
||||
type GitHubConfig struct {
|
||||
// BaseURL is the GitHub API base (e.g. "https://api.github.com" for
|
||||
// github.com, or "https://github.example.com/api/v3" for GHE).
|
||||
BaseURL string `json:"baseURL"`
|
||||
|
||||
// SecretMode controls how the personal access token is stored.
|
||||
SecretMode SecretMode `json:"secretMode"`
|
||||
|
||||
// RefreshIntervalSecs controls the auto-refresh period in seconds.
|
||||
// Defaults to 300 (5 minutes).
|
||||
RefreshIntervalSecs int `json:"refreshIntervalSecs"`
|
||||
}
|
||||
|
||||
// GitHubRepo is a single repository returned to the frontend for display.
|
||||
type GitHubRepo struct {
|
||||
FullName string `json:"fullName"`
|
||||
Name string `json:"name"`
|
||||
Owner string `json:"owner"`
|
||||
Description string `json:"description"`
|
||||
HTMLURL string `json:"htmlURL"`
|
||||
Private bool `json:"private"`
|
||||
Fork bool `json:"fork"`
|
||||
Archived bool `json:"archived"`
|
||||
Language string `json:"language"`
|
||||
Stars int `json:"stars"`
|
||||
PushedAt string `json:"pushedAt"` // ISO 8601
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// SessionState represents the lifecycle state of a connection session.
|
||||
type SessionState string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user