Skip to content

[copilot] compile should support workflow-id #93

@pelikhan

Description

@pelikhan

You are tasked with implementing a CLI enhancement for the gh-aw tool to support workflow ID shortcuts in the compile command. Currently, users must provide full file paths to compile workflows, but the request is to allow using just the workflow ID (filename without extension) as a convenient shortcut.

CONTEXT: The gh-aw tool is a Go-based GitHub CLI extension that converts markdown workflow files to GitHub Actions YAML. Copilot agents frequently attempt to use workflow IDs instead of full paths when calling gh aw compile, but this currently fails and requires fallback to full paths.

OBJECTIVE: Modify the compile command to accept workflow IDs as arguments and automatically resolve them to full file paths.

KEY REQUIREMENTS:

Enhance argument parsing in pkg/cli/compile.go to detect when an argument is a workflow ID versus a full path
Implement workflow resolution logic that searches .github/workflows/ directory for matching .md files
Maintain backward compatibility - full file paths should continue to work exactly as before
Provide clear error messages when workflow IDs cannot be resolved or are ambiguous
Handle edge cases like multiple matches or no matches found
IMPLEMENTATION APPROACH:

Modify the compile command handler to detect non-path arguments (those without file extensions or absolute paths)
Create a resolveWorkflowID function that searches for matching .md files in .github/workflows/
Update argument processing to resolve workflow IDs to full paths before proceeding with existing compilation logic
Add appropriate error handling and user-friendly messages
FILES TO EXAMINE AND MODIFY:

cmd/gh-aw/main.go - CLI command structure
pkg/cli/compile.go - Compile command implementation
pkg/workflow/compiler.go - Workflow processing logic
pkg/workflow/resolve.go - Resolution helpers

TESTING REQUIREMENTS:

Verify gh aw compile workflow-name resolves to .github/workflows/workflow-name.md
Ensure gh aw compile path/to/file.md continues working (no regression)
Test error handling for nonexistent workflow IDs
Test error handling for ambiguous matches
Follow existing test patterns in the codebase
CONSTRAINTS:

Must follow Go coding standards and existing codebase patterns
Use the console package for user-facing output formatting
Run make agent-finish before completing to ensure code quality
Do not break existing functionality or change command interface beyond adding the ID support
SUCCESS CRITERIA:

gh aw compile weekly-research successfully compiles .github/workflows/weekly-research.md
All existing compile functionality remains unchanged
Clear error messages for invalid or ambiguous workflow IDs
Code passes all existing tests and linting requirements

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions