Skip to content

Add workflow inventory package for unified name extraction and file discovery#11256

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/add-inventory-helper-functions
Closed

Add workflow inventory package for unified name extraction and file discovery#11256
Copilot wants to merge 3 commits intomainfrom
copilot/add-inventory-helper-functions

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Workflow name extraction and normalization logic was scattered across pkg/cli/workflows.go, pkg/cli/status_command.go, and inline throughout the codebase with variations in handling edge cases.

Changes

New package: pkg/cli/inventory

  • ExtractWorkflowName(path) - Normalizes workflow names from paths, handling .md, .lock.yml, .campaign.md, .campaign.lock.yml, .campaign.g.md
  • NormalizeWorkflowName(input) - Semantic alias for user input normalization
  • GetWorkflowPath(name, dir) - Converts workflow name to markdown file path
  • GetLockFilePath(path, dir) - Returns corresponding lock file path (campaign-aware)
  • ListWorkflowFiles(dir, campaigns, generated) - Discovers workflows with filtering, returns structured WorkflowFile metadata
  • WorkflowType enum and WorkflowFile struct for type-safe workflow representation

Usage

import "github.com/githubnext/gh-aw/pkg/cli/inventory"

// Extract from any path format
name := inventory.ExtractWorkflowName(".github/workflows/deploy.campaign.g.md")  // "deploy"

// Discover with filtering
workflows, _ := inventory.ListWorkflowFiles("", true, false)  // campaigns yes, generated no
for _, wf := range workflows {
    fmt.Printf("%s: %s -> %s\n", wf.Name, wf.Path, wf.LockPath)
}

README.md filters are case-insensitive and automatic. Campaign orchestrator .g.md files correctly map to their .campaign.lock.yml counterparts.

Test coverage: 97.1% (56+ test cases across 13 test functions)

Original prompt

Inventory helpers that extract / normalize workflow names from file names and organize, unify. Add tests.


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

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review January 22, 2026 12:23
@pelikhan
Copy link
Contributor

@copilot Merge main and recompile

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
Copy link
Contributor

@copilot add tests

Copilot AI changed the title [WIP] Add inventory helpers to normalize and organize workflow names Add workflow inventory package for unified name extraction and file discovery Jan 22, 2026
Copilot AI requested a review from pelikhan January 22, 2026 12:26
@@ -0,0 +1,293 @@
# Workflow Inventory Package
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot unbloat this will, keep it short

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.

2 participants