Skip to content

Fix package documentation by removing duplicate package comments from 70 files#12301

Merged
pelikhan merged 4 commits intomainfrom
copilot/add-package-level-documentation
Jan 28, 2026
Merged

Fix package documentation by removing duplicate package comments from 70 files#12301
pelikhan merged 4 commits intomainfrom
copilot/add-package-level-documentation

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

Problem

Go's go doc was displaying incorrect package documentation for pkg/workflow and pkg/cli. All 5 major packages already had comprehensive doc.go files, but 70 files had duplicate package-level comments that shadowed them.

Root Cause

In Go, comments directly before package (no blank line) are treated as package documentation. When multiple files contain such comments, go doc arbitrarily selects one instead of using the authoritative doc.go.

Changes

Modified 70 files in pkg/workflow/ and pkg/cli/:

  • Changed // Package X provides...// This file provides...
  • Added blank line before package statement to mark comments as file-level

Example change:

-// Package workflow provides agent file and feature support validation.
+// This file provides agent file and feature support validation.
 //
 // # Agent Validation
 // ...
+
 package workflow

Result

go doc pkg/workflow and go doc pkg/cli now correctly display documentation from their respective doc.go files, fixing pkg.go.dev presentation.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Code Quality] Add package-level documentation for major packages</issue_title>
<issue_description>## Description

Major packages lack package-level documentation comments, which affects pkg.go.dev presentation and developer onboarding. Go convention requires // Package X comments for proper API documentation.

Missing Package Docs

The following packages have no package-level documentation:

  • pkg/workflow/ - 600+ files, core compilation functionality
  • pkg/types/ - Type definitions
  • pkg/cli/ - CLI interface
  • pkg/parser/ - Markdown/YAML parsing
  • pkg/logger/ - Logging utilities

Proposed Solution

Add comprehensive package documentation following this template:

// Package workflow provides compilation and generation of GitHub Actions workflows
// from markdown-based agentic workflow specifications.
//
// The workflow package is the core of gh-aw, handling the transformation of
// user-friendly markdown files into production-ready GitHub Actions YAML workflows.
// It supports advanced features including:
//   - Agentic AI workflow execution with Claude, Codex, and Copilot engines
//   - Safe output handling with configurable permissions
//   - MCP (Model Context Protocol) server integration
//   - Network sandboxing and firewall configuration
//   - Dynamic tool registration and custom action generation
//
// # Basic Usage
//
// To compile a workflow from markdown:
//
//     compiler := workflow.NewCompiler(workflow.CompilerOptions{
//         Verbose: true,
//         Version: "1.0.0",
//     })
//     err := compiler.CompileWorkflow("path/to/workflow.md")
//
// # Architecture
//
// The compilation process consists of several stages:
//  1. Frontmatter parsing (extracting YAML metadata)
//  2. Markdown processing (prompt extraction)
//  3. Tool configuration (MCP servers, safe outputs)
//  4. Job generation (main, activation, safe output jobs)
//  5. YAML generation (final GitHub Actions workflow)
//
// For more details, see the Compiler type documentation.
package workflow

Files to Create/Update

  • pkg/workflow/doc.go (new file)
  • pkg/types/doc.go (new file)
  • pkg/cli/doc.go (new file)
  • pkg/parser/doc.go (new file)
  • pkg/logger/doc.go (new file)

Success Criteria

  • Package documentation added for all 5 major packages
  • Documentation includes:
    • Package purpose and responsibility
    • Key features and capabilities
    • Basic usage examples
    • Architecture overview (where applicable)
  • Verify with go doc pkg/workflow
  • Check pkg.go.dev rendering
  • Ensure examples compile
  • Review for accuracy

Impact

  • Severity: Medium-High - Affects API discoverability and onboarding
  • Effort: Medium - Estimated 2-3 hours total
  • Risk: Low - Documentation-only change
  • Benefit: Improved developer experience, better pkg.go.dev presentation

Source

Extracted from Sergo Report: Memory Allocation & Documentation Quality - 2026-01-27

Priority

Medium-High - High visibility improvement for new developers

AI generated by Discussion Task Miner - Code Quality Improvement Agent

  • expires on Feb 11, 2026, 9:11 AM UTC

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 28, 2026 16:17
…s from non-doc.go files

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add package-level documentation for major packages Fix package documentation by removing duplicate package comments from 70 files Jan 28, 2026
Copilot AI requested a review from pelikhan January 28, 2026 16:33
@pelikhan pelikhan marked this pull request as ready for review January 28, 2026 17:14
@pelikhan pelikhan merged commit 2d420a2 into main Jan 28, 2026
53 checks passed
@pelikhan pelikhan deleted the copilot/add-package-level-documentation branch January 28, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Code Quality] Add package-level documentation for major packages

2 participants

Comments