Objective
Add comprehensive GoDoc comments to the 5 undocumented exported functions in pkg/workflow/github_cli.go to clarify usage, token configuration, authentication requirements, and behavioral differences between variants.
Context
Issue #14844 identified a documentation gap: key exported functions lack GoDoc comments, forcing developers to reverse-engineer behavior from implementation. The file has inline comments (lines 17-19) with good content that should be expanded into proper GoDoc format.
Functions to Document
ExecGH (line 25) - Basic gh CLI execution with token handling
ExecGHContext (line 59) - Context-aware variant
ExecGHWithOutput (line 91) - Captures and returns output
RunGH (line 103) - Different execution semantics
RunGHCombined (line 125) - Combined stdout/stderr handling
Approach
Follow documentation patterns from pkg/stringutil/stringutil.go and pkg/sliceutil/sliceutil.go:
- Function Purpose: What does this function do?
- When to Use: Guidance on choosing between variants
- Token Handling: How GH_TOKEN/GITHUB_TOKEN affects behavior
- Parameters: Clear explanation of each parameter
- Return Values: What's returned and error conditions
- Example Usage: Simple code example showing common use case
- Security Notes: Authentication requirements and token precedence
Files to Modify
- Update:
pkg/workflow/github_cli.go - Add GoDoc comments above each exported function
Example Structure
// ExecGH wraps gh CLI calls with automatic token configuration.
//
// It attempts to use go-gh/v2 when GH_TOKEN or GITHUB_TOKEN environment
// variables are available, falling back to direct exec.Command for
// backward compatibility when tokens are absent.
//
// Token precedence: GH_TOKEN > GITHUB_TOKEN > unauthenticated mode
//
// Use ExecGH for commands that:
// - Don't need context cancellation
// - Don't need to capture output
// - Should use default stderr/stdout streams
//
// For context-aware execution, use ExecGHContext instead.
// For capturing output, use ExecGHWithOutput instead.
//
// Example:
// cmd := ExecGH("issue", "list", "--repo", "github/gh-aw")
// if err := cmd.Run(); err != nil {
// return fmt.Errorf("failed to list issues: %w", err)
// }
//
// Authentication: Requires GH_TOKEN or GITHUB_TOKEN for authenticated
// API access. Commands work without tokens but have rate limits.
func ExecGH(args ...string) *exec.Cmd {
// ...
}
Acceptance Criteria
AI generated by Plan Command for #14844
Objective
Add comprehensive GoDoc comments to the 5 undocumented exported functions in
pkg/workflow/github_cli.goto clarify usage, token configuration, authentication requirements, and behavioral differences between variants.Context
Issue #14844 identified a documentation gap: key exported functions lack GoDoc comments, forcing developers to reverse-engineer behavior from implementation. The file has inline comments (lines 17-19) with good content that should be expanded into proper GoDoc format.
Functions to Document
ExecGH(line 25) - Basic gh CLI execution with token handlingExecGHContext(line 59) - Context-aware variantExecGHWithOutput(line 91) - Captures and returns outputRunGH(line 103) - Different execution semanticsRunGHCombined(line 125) - Combined stdout/stderr handlingApproach
Follow documentation patterns from
pkg/stringutil/stringutil.goandpkg/sliceutil/sliceutil.go:Files to Modify
pkg/workflow/github_cli.go- Add GoDoc comments above each exported functionExample Structure
Acceptance Criteria
Related to [sergo] Sergo Report: Documentation-Security-Naming - 2026-02-10 #14844