Skip to content

Conversation

@github-actions
Copy link
Contributor

Enhanced the following files with debug logging statements to help with troubleshooting and development:

Files Enhanced

1. pkg/cli/update_command.go - Workflow Update Lifecycle Logging

  • Update process initiation with parameters (workflows, allowMajor, force, createPR)
  • Workflow scanning and discovery in specified directory
  • Latest ref resolution with repository and version detection
  • Ref type detection (semantic version tag, branch, or default branch)
  • Individual workflow update tracking with source spec
  • 3-way merge operations and conflict detection
  • Workflow compilation status and failures

2. pkg/parser/mcp.go - MCP Configuration Parsing

  • MCP configuration extraction with filter parameter
  • Safe-outputs and safe-jobs detection
  • Built-in MCP tool processing (github, playwright)
  • Custom MCP servers processing with count
  • MCP type inference (http from url, stdio from command/container)
  • Tool configuration extraction by type
  • Container detection for containerized tools

3. pkg/workflow/threat_detection.go - Threat Detection Configuration

  • Configuration parsing (enabled/disabled states)
  • Threat detection AI engine configuration
  • Custom prompt and steps detection
  • Job building with step count tracking

4. pkg/workflow/tools_types.go - Tools Configuration

  • Tools configuration creation with entry count
  • Custom tools count extraction
  • GitHub tool configuration parsing (default, string, detailed)
  • Tools summary (github, bash, playwright, custom count)

5. pkg/parser/github_urls.go - GitHub URL Parsing

  • URL parsing and validation
  • Host and type detection
  • raw.githubusercontent.com URL handling
  • File, PR, issue, and Actions run URL parsing
  • URL type segment detection with owner and repo

Quality Checklist

  • ✅ Maximum 5 files modified
  • ✅ No test files modified
  • ✅ Each file has proper logger declaration with correct naming convention
  • ✅ Logger arguments don't compute anything or cause side effects
  • ✅ Logging messages are meaningful and helpful for debugging
  • ✅ No duplicate logging with existing logs
  • ✅ Import statements properly formatted
  • ✅ Changes validated with make build (no compilation errors)
  • ✅ Workflow compilation tested with DEBUG=* ./gh-aw compile dev

Logging Guidelines Followed

All enhancements follow the project's logging guidelines from AGENTS.md:

  • No side effects: Logger arguments don't compute values or cause side effects
  • Meaningful messages: Each log statement provides useful debugging context
  • Proper naming: Logger variables follow naming conventions to avoid conflicts
  • Function entry: Key functions log entry with parameters
  • Control flow: Important decisions and branches are logged
  • State changes: Important state transitions are tracked

Example Debug Output

When running with DEBUG=*, you can now see detailed logging like:

cli:update_command Starting update process: workflows=[ci-doctor], allowMajor=false, force=false, createPR=true
cli:update_command Scanning for workflows with source field: dir=.github/workflows, filter=[ci-doctor]
cli:update_command Found 1 workflows with source field
parser:mcp Extracting MCP configurations with filter: 
parser:mcp Found safe-outputs configuration
workflow:threat_detection Found threat-detection configuration
workflow:threat_detection Threat detection AI engine disabled
workflow:tools_types Creating tools configuration from map with 3 entries
workflow:tools_types Parsed tools: github=true, bash=false, playwright=true, custom=1
parser:github_urls Parsing GitHub URL: https://github.com/owner/repo/pull/123
parser:github_urls Detected host: github.com
parser:github_urls Detected URL type segment: pull for owner/repo
parser:github_urls Parsing pull request URL

🤖 Generated with Claude Code

Co-Authored-By: Claude (noreply@anthropic.com)

AI generated by Go Logger Enhancement

Enhanced the following files with debug logging statements:

1. **pkg/cli/update_command.go** - Added logging for workflow update lifecycle
   - Update process initiation with parameters
   - Workflow scanning and discovery
   - Ref resolution and version detection
   - Merge operations and conflict detection
   - Compilation status

2. **pkg/parser/mcp.go** - Added logging for MCP configuration parsing
   - MCP configuration extraction with filters
   - Safe-outputs and safe-jobs detection
   - Built-in and custom MCP tool processing
   - MCP type inference (http, stdio, container)

3. **pkg/workflow/threat_detection.go** - Added logging for threat detection
   - Configuration parsing (enabled/disabled states)
   - AI engine configuration
   - Job building with step counts

4. **pkg/workflow/tools_types.go** - Added logging for tools configuration
   - Tools configuration creation with entry counts
   - GitHub tool configuration parsing
   - Custom tools detection

5. **pkg/parser/github_urls.go** - Added logging for GitHub URL parsing
   - URL parsing and validation
   - Host and type detection
   - File, PR, issue, and run URL handling

All logging follows project guidelines:
- No side effects in logger arguments
- Meaningful messages for debugging
- Proper logger naming conventions
- Function entry logging with parameters

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added automation enhancement New feature or request labels Nov 15, 2025
@pelikhan pelikhan merged commit fccb7d7 into main Nov 15, 2025
4 checks passed
@pelikhan pelikhan deleted the log-add-logging-to-5-more-files-6429c06b43938d1f branch November 15, 2025 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants