Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/content/docs/agent-factory-status.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ These are experimental agentic workflows used by the GitHub Next team to learn,
| [Daily Firewall Logs Collector and Reporter](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-firewall-report.md) | copilot | [![Daily Firewall Logs Collector and Reporter](https://github.com/github/gh-aw/actions/workflows/daily-firewall-report.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-firewall-report.lock.yml) | - | - |
| [Daily Issues Report Generator](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-issues-report.md) | codex | [![Daily Issues Report Generator](https://github.com/github/gh-aw/actions/workflows/daily-issues-report.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-issues-report.lock.yml) | - | - |
| [Daily Malicious Code Scan Agent](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-malicious-code-scan.md) | copilot | [![Daily Malicious Code Scan Agent](https://github.com/github/gh-aw/actions/workflows/daily-malicious-code-scan.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-malicious-code-scan.lock.yml) | - | - |
| [Daily MCP Tool Concurrency Analysis](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-mcp-concurrency-analysis.md) | copilot | [![Daily MCP Tool Concurrency Analysis](https://github.com/github/gh-aw/actions/workflows/daily-mcp-concurrency-analysis.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-mcp-concurrency-analysis.lock.yml) | `0 9 * * 1-5` | - |
| [Daily News](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-news.md) | copilot | [![Daily News](https://github.com/github/gh-aw/actions/workflows/daily-news.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-news.lock.yml) | `0 9 * * 1-5` | - |
| [Daily Observability Report for AWF Firewall and MCP Gateway](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-observability-report.md) | codex | [![Daily Observability Report for AWF Firewall and MCP Gateway](https://github.com/github/gh-aw/actions/workflows/daily-observability-report.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-observability-report.lock.yml) | - | - |
| [Daily Project Performance Summary Generator (Using Safe Inputs)](https://github.com/github/gh-aw/blob/main/.github/workflows/daily-performance-summary.md) | codex | [![Daily Project Performance Summary Generator (Using Safe Inputs)](https://github.com/github/gh-aw/actions/workflows/daily-performance-summary.lock.yml/badge.svg)](https://github.com/github/gh-aw/actions/workflows/daily-performance-summary.lock.yml) | - | - |
Expand Down
150 changes: 0 additions & 150 deletions pkg/cli/agentic_workflow_agent_test.go

This file was deleted.

143 changes: 10 additions & 133 deletions pkg/cli/copilot-agents.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,88 +12,6 @@ import (

var copilotAgentsLog = logger.New("cli:copilot_agents")

// cleanupOldPromptFile removes an old prompt file from .github/prompts/ if it exists
func cleanupOldPromptFile(promptFileName string, verbose bool) error {
gitRoot, err := findGitRoot()
if err != nil {
return nil // Not in a git repository, skip
}

oldPath := filepath.Join(gitRoot, ".github", "prompts", promptFileName)

// Check if the old file exists and remove it
if _, err := os.Stat(oldPath); err == nil {
if err := os.Remove(oldPath); err != nil {
return fmt.Errorf("failed to remove old prompt file: %w", err)
}
if verbose {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Removed old prompt file: %s", oldPath)))
}
}

return nil
}

// ensureCopilotInstructions ensures that .github/aw/github-agentic-workflows.md exists
func ensureCopilotInstructions(verbose bool, skipInstructions bool) error {
copilotAgentsLog.Print("Checking Copilot instructions file")

if skipInstructions {
copilotAgentsLog.Print("Skipping instructions check: instructions disabled")
return nil
}

// First, clean up the old file location if it exists
if err := cleanupOldCopilotInstructions(verbose); err != nil {
return err
}

gitRoot, err := findGitRoot()
if err != nil {
return err // Not in a git repository, skip
}

targetPath := filepath.Join(gitRoot, ".github", "aw", "github-agentic-workflows.md")

// Check if the file exists
if _, err := os.Stat(targetPath); err == nil {
copilotAgentsLog.Printf("Copilot instructions file exists: %s", targetPath)
if verbose {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Copilot instructions file exists: %s", targetPath)))
}
return nil
}

// File doesn't exist - this is expected in external repositories
copilotAgentsLog.Printf("Copilot instructions file not found: %s (expected in gh-aw repository)", targetPath)
if verbose {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Copilot instructions file not found: %s", targetPath)))
}
return nil
}

// cleanupOldCopilotInstructions removes the old instructions file from .github/instructions/
func cleanupOldCopilotInstructions(verbose bool) error {
gitRoot, err := findGitRoot()
if err != nil {
return nil // Not in a git repository, skip
}

oldPath := filepath.Join(gitRoot, ".github", "instructions", "github-agentic-workflows.instructions.md")

// Check if the old file exists and remove it
if _, err := os.Stat(oldPath); err == nil {
if err := os.Remove(oldPath); err != nil {
return fmt.Errorf("failed to remove old instructions file: %w", err)
}
if verbose {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Removed old instructions file: %s", oldPath)))
}
}

return nil
}

// ensureAgenticWorkflowsDispatcher ensures that .github/agents/agentic-workflows.agent.md contains the dispatcher agent
func ensureAgenticWorkflowsDispatcher(verbose bool, skipInstructions bool) error {
copilotAgentsLog.Print("Ensuring agentic workflows dispatcher agent")
Expand Down Expand Up @@ -161,66 +79,25 @@ func ensureAgenticWorkflowsDispatcher(verbose bool, skipInstructions bool) error
return nil
}

// ensureCreateWorkflowPrompt ensures that .github/aw/create-agentic-workflow.md exists
func ensureCreateWorkflowPrompt(verbose bool, skipInstructions bool) error {
return ensurePromptFileExists(".github/aw/create-agentic-workflow.md", "create workflow prompt", verbose, skipInstructions)
}

// ensureUpdateWorkflowPrompt ensures that .github/aw/update-agentic-workflow.md exists
func ensureUpdateWorkflowPrompt(verbose bool, skipInstructions bool) error {
return ensurePromptFileExists(".github/aw/update-agentic-workflow.md", "update workflow prompt", verbose, skipInstructions)
}

// ensureCreateSharedAgenticWorkflowPrompt ensures that .github/aw/create-shared-agentic-workflow.md exists
func ensureCreateSharedAgenticWorkflowPrompt(verbose bool, skipInstructions bool) error {
return ensurePromptFileExists(".github/aw/create-shared-agentic-workflow.md", "create shared workflow prompt", verbose, skipInstructions)
}

// ensureDebugWorkflowPrompt ensures that .github/aw/debug-agentic-workflow.md exists
func ensureDebugWorkflowPrompt(verbose bool, skipInstructions bool) error {
return ensurePromptFileExists(".github/aw/debug-agentic-workflow.md", "debug workflow prompt", verbose, skipInstructions)
}

// ensureUpgradeAgenticWorkflowsPrompt ensures that .github/aw/upgrade-agentic-workflows.md exists
func ensureUpgradeAgenticWorkflowsPrompt(verbose bool, skipInstructions bool) error {
return ensurePromptFileExists(".github/aw/upgrade-agentic-workflows.md", "upgrade workflows prompt", verbose, skipInstructions)
}

// ensureSerenaTool ensures that .github/aw/serena-tool.md exists
func ensureSerenaTool(verbose bool, skipInstructions bool) error {
return ensurePromptFileExists(".github/aw/serena-tool.md", "Serena tool documentation", verbose, skipInstructions)
}

// ensurePromptFileExists checks if a prompt file exists
func ensurePromptFileExists(relativePath, fileType string, verbose bool, skipInstructions bool) error {
copilotAgentsLog.Printf("Checking %s file: %s", fileType, relativePath)

if skipInstructions {
copilotAgentsLog.Print("Skipping file check: instructions disabled")
return nil
}

// cleanupOldPromptFile removes an old prompt file from .github/prompts/ if it exists
func cleanupOldPromptFile(promptFileName string, verbose bool) error {
gitRoot, err := findGitRoot()
if err != nil {
return err // Not in a git repository, skip
return nil // Not in a git repository, skip
}

targetPath := filepath.Join(gitRoot, relativePath)
oldPath := filepath.Join(gitRoot, ".github", "prompts", promptFileName)

// Check if the file exists
if _, err := os.Stat(targetPath); err == nil {
copilotAgentsLog.Printf("%s file exists: %s", fileType, targetPath)
// Check if the old file exists and remove it
if _, err := os.Stat(oldPath); err == nil {
if err := os.Remove(oldPath); err != nil {
return fmt.Errorf("failed to remove old prompt file: %w", err)
}
if verbose {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("%s file exists: %s", fileType, targetPath)))
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("Removed old prompt file: %s", oldPath)))
}
return nil
}

// File doesn't exist - this is expected in external repositories
copilotAgentsLog.Printf("%s file not found: %s (expected in gh-aw repository)", fileType, targetPath)
if verbose {
fmt.Fprintln(os.Stderr, console.FormatInfoMessage(fmt.Sprintf("%s file not found: %s", fileType, targetPath)))
}
return nil
}

Expand Down
Loading
Loading