WIP: Save agent roles integration work before CHORUS rebrand
- Agent roles and coordination features - Chat API integration testing - New configuration and workspace management 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,22 @@ type Repository struct {
|
||||
GitHubTokenRequired bool `json:"github_token_required"`
|
||||
}
|
||||
|
||||
// MonitoredRepository represents a repository being monitored for tasks
|
||||
type MonitoredRepository struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Provider string `json:"provider"` // github, gitea
|
||||
ProviderBaseURL string `json:"provider_base_url"`
|
||||
GitOwner string `json:"git_owner"`
|
||||
GitRepository string `json:"git_repository"`
|
||||
GitBranch string `json:"git_branch"`
|
||||
BzzzEnabled bool `json:"bzzz_enabled"`
|
||||
AutoAssignment bool `json:"auto_assignment"`
|
||||
AccessToken string `json:"access_token,omitempty"`
|
||||
SSHPort int `json:"ssh_port,omitempty"`
|
||||
}
|
||||
|
||||
// ActiveRepositoriesResponse represents the response from /api/bzzz/active-repos
|
||||
type ActiveRepositoriesResponse struct {
|
||||
Repositories []Repository `json:"repositories"`
|
||||
@@ -206,6 +222,78 @@ func (c *HiveClient) UpdateTaskStatus(ctx context.Context, projectID, taskID int
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetMonitoredRepositories fetches repositories configured for bzzz monitoring
|
||||
func (c *HiveClient) GetMonitoredRepositories(ctx context.Context) ([]*MonitoredRepository, error) {
|
||||
url := fmt.Sprintf("%s/api/repositories", c.BaseURL)
|
||||
|
||||
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create request: %w", err)
|
||||
}
|
||||
|
||||
// Add authentication if API key is provided
|
||||
if c.APIKey != "" {
|
||||
req.Header.Set("Authorization", "Bearer "+c.APIKey)
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
|
||||
resp, err := c.HTTPClient.Do(req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to execute request: %w", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
body, _ := io.ReadAll(resp.Body)
|
||||
return nil, fmt.Errorf("API request failed with status %d: %s", resp.StatusCode, string(body))
|
||||
}
|
||||
|
||||
var repositories []struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Provider string `json:"provider"`
|
||||
ProviderBaseURL string `json:"provider_base_url"`
|
||||
Owner string `json:"owner"`
|
||||
Repository string `json:"repository"`
|
||||
Branch string `json:"branch"`
|
||||
BzzzEnabled bool `json:"bzzz_enabled"`
|
||||
AutoAssignment bool `json:"auto_assignment"`
|
||||
}
|
||||
|
||||
if err := json.NewDecoder(resp.Body).Decode(&repositories); err != nil {
|
||||
return nil, fmt.Errorf("failed to decode response: %w", err)
|
||||
}
|
||||
|
||||
// Convert to MonitoredRepository format
|
||||
var monitoredRepos []*MonitoredRepository
|
||||
for _, repo := range repositories {
|
||||
if repo.BzzzEnabled {
|
||||
monitoredRepo := &MonitoredRepository{
|
||||
ID: repo.ID,
|
||||
Name: repo.Name,
|
||||
Description: repo.Description,
|
||||
Provider: repo.Provider,
|
||||
ProviderBaseURL: repo.ProviderBaseURL,
|
||||
GitOwner: repo.Owner,
|
||||
GitRepository: repo.Repository,
|
||||
GitBranch: repo.Branch,
|
||||
BzzzEnabled: repo.BzzzEnabled,
|
||||
AutoAssignment: repo.AutoAssignment,
|
||||
}
|
||||
|
||||
// Set SSH port for Gitea
|
||||
if repo.Provider == "gitea" {
|
||||
monitoredRepo.SSHPort = 2222
|
||||
}
|
||||
|
||||
monitoredRepos = append(monitoredRepos, monitoredRepo)
|
||||
}
|
||||
}
|
||||
|
||||
return monitoredRepos, nil
|
||||
}
|
||||
|
||||
// HealthCheck verifies connectivity to the Hive API
|
||||
func (c *HiveClient) HealthCheck(ctx context.Context) error {
|
||||
url := fmt.Sprintf("%s/health", c.BaseURL)
|
||||
|
||||
Reference in New Issue
Block a user