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
20 changes: 0 additions & 20 deletions pkg/cli/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,6 @@ func initializeBasicRepository(verbose bool) error {
fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Configured .gitattributes"))
}

// Ensure .github/aw/logs/.gitignore exists
initLog.Print("Ensuring .github/aw/logs/.gitignore exists")
if err := ensureLogsGitignore(); err != nil {
initLog.Printf("Failed to ensure logs .gitignore: %v", err)
return fmt.Errorf("failed to ensure logs .gitignore: %w", err)
}
if verbose {
fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Configured .github/aw/logs/.gitignore"))
}

// Write copilot instructions
initLog.Print("Writing GitHub Copilot instructions")
if err := ensureCopilotInstructions(verbose, false); err != nil {
Expand Down Expand Up @@ -487,16 +477,6 @@ func InitRepository(verbose bool, mcp bool, tokens bool, engine string, codespac
fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Configured .gitattributes"))
}

// Ensure .github/aw/logs/.gitignore exists
initLog.Print("Ensuring .github/aw/logs/.gitignore exists")
if err := ensureLogsGitignore(); err != nil {
initLog.Printf("Failed to ensure logs .gitignore: %v", err)
return fmt.Errorf("failed to ensure logs .gitignore: %w", err)
}
if verbose {
fmt.Fprintln(os.Stderr, console.FormatSuccessMessage("Configured .github/aw/logs/.gitignore"))
}

// Write copilot instructions
initLog.Print("Writing GitHub Copilot instructions")
if err := ensureCopilotInstructions(verbose, false); err != nil {
Expand Down
1 change: 0 additions & 1 deletion pkg/cli/init_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Interactive Mode (default):

This command:
- Configures .gitattributes to mark .lock.yml files as generated
- Creates .github/aw/logs/.gitignore to ignore downloaded workflow logs
- Creates GitHub Copilot custom instructions at .github/aw/github-agentic-workflows.md
- Creates the dispatcher agent at .github/agents/agentic-workflows.agent.md
- Creates workflow creation prompt at .github/aw/create-agentic-workflow.md (for new workflows)
Expand Down
6 changes: 0 additions & 6 deletions pkg/cli/init_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,6 @@ func TestInitRepositoryBasic(t *testing.T) {
t.Errorf("Expected .gitattributes to contain %q", expectedEntry)
}

// Verify logs .gitignore was created
logsGitignorePath := filepath.Join(".github", "aw", "logs", ".gitignore")
if _, err := os.Stat(logsGitignorePath); os.IsNotExist(err) {
t.Error("Expected .github/aw/logs/.gitignore to be created")
}

// Verify MCP files were created by default
mcpConfigPath := filepath.Join(".vscode", "mcp.json")
if _, err := os.Stat(mcpConfigPath); os.IsNotExist(err) {
Expand Down
37 changes: 4 additions & 33 deletions pkg/cli/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,30 +76,8 @@ func TestInitRepository(t *testing.T) {
t.Errorf("Expected .gitattributes file to exist")
}

// Note: The following files are NOT created by init - they are source of truth in .github/aw/
// and should already exist in the gh-aw repository itself

// Verify logs .gitignore was created
logsGitignorePath := filepath.Join(tempDir, ".github", "aw", "logs", ".gitignore")
if _, err := os.Stat(logsGitignorePath); os.IsNotExist(err) {
t.Errorf("Expected .github/aw/logs/.gitignore file to exist")
}

// Verify logs .gitignore content
if content, err := os.ReadFile(logsGitignorePath); err == nil {
contentStr := string(content)
if !strings.Contains(contentStr, "# Ignore all downloaded workflow logs") {
t.Errorf("Expected .gitignore to contain comment about ignoring logs")
}
if !strings.Contains(contentStr, "*") {
t.Errorf("Expected .gitignore to contain wildcard pattern")
}
if !strings.Contains(contentStr, "!.gitignore") {
t.Errorf("Expected .gitignore to keep itself")
}
} else {
t.Errorf("Failed to read .github/aw/logs/.gitignore: %v", err)
}
// Note: The .github/aw/logs/.gitignore file is no longer created by init.
// It is now created by the logs download command on every invocation.

// Verify .gitattributes contains the correct entry
content, err := os.ReadFile(gitAttributesPath)
Expand Down Expand Up @@ -153,15 +131,8 @@ func TestInitRepository_Idempotent(t *testing.T) {
t.Errorf("Expected .gitattributes file to exist after second call")
}

// Note: The following files are NOT created by init - they are source of truth in .github/aw/
// and should already exist in the gh-aw repository itself. These tests are not relevant
// for external repositories.

// Verify logs .gitignore still exists after second call
logsGitignorePath := filepath.Join(tempDir, ".github", "aw", "logs", ".gitignore")
if _, err := os.Stat(logsGitignorePath); os.IsNotExist(err) {
t.Errorf("Expected .github/aw/logs/.gitignore file to exist after second call")
}
// Note: The .github/aw/logs/.gitignore file is no longer created by init.
// It is now created by the logs download command on every invocation.
}

func TestInitRepository_Verbose(t *testing.T) {
Expand Down
9 changes: 9 additions & 0 deletions pkg/cli/logs_orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ func getMaxConcurrentDownloads() int {
func DownloadWorkflowLogs(ctx context.Context, workflowName string, count int, startDate, endDate, outputDir, engine, ref string, beforeRunID, afterRunID int64, repoOverride string, verbose bool, toolGraph bool, noStaged bool, firewallOnly bool, noFirewall bool, parse bool, jsonOutput bool, timeout int, summaryFile string, safeOutputType string) error {
logsOrchestratorLog.Printf("Starting workflow log download: workflow=%s, count=%d, startDate=%s, endDate=%s, outputDir=%s, summaryFile=%s, safeOutputType=%s", workflowName, count, startDate, endDate, outputDir, summaryFile, safeOutputType)

// Ensure .github/aw/logs/.gitignore exists on every invocation
if err := ensureLogsGitignore(); err != nil {
// Log but don't fail - this is not critical for downloading logs
logsOrchestratorLog.Printf("Failed to ensure logs .gitignore: %v", err)
if verbose {
fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("Failed to ensure .github/aw/logs/.gitignore: %v", err)))
}
}

// Check context cancellation at the start
select {
case <-ctx.Done():
Expand Down
Loading