Skip to content

[file-diet] Refactor pkg/cli/add_workflow_resolution.go (1214 lines) #64770

Closed as not planned

Description

@github-actions

Overview

pkg/cli/add_workflow_resolution.go has grown to 1214 lines (largest non-test Go file in pkg/; threshold 800). Refactor into focused files with better tests.

Current State

  • File: pkg/cli/add_workflow_resolution.go
  • Size: 1214 lines, ~42 top-level funcs/types
  • Test Coverage: no add_workflow_resolution_test.go; only _redirect_test.go (143) and _manifest_ref_test.go (50), ratio ≈ 0.16
  • Complexity: mixes remote spec resolution, local package manifest/asset resolution, and wildcard expansion
Full File Analysis
  • Public API and spec parsing (29–260): ResolvedWorkflow(s), ResolveWorkflows, parseWorkflowSpecsForResolution, resolveLocal/RepositoryPackage*Spec
  • Workflow resolution (259–456): resolveWorkflowSpecs, resolveSingleWorkflowSpec, resolvePackageOrActionWorkflow, resolveStandardWorkflow, selectBootstrapProfile
  • Local package resolution (457–970): manifest nodes, wildcard includes, installables, skill/agent files
  • Package-to-spec appenders (783–1062): append*WorkflowSpecs, appendRepositoryPackageExtensionSpecs
  • Wildcard/dispatch expansion (1063–1214): resolveAddWorkflowSpecAndContent, expandLocalWildcardWorkflows, checkWorkflowHasDispatchFromContent, expandLocalWildcard

Refactoring Strategy

Proposed File Splits

  1. add_workflow_resolution.go (~350 LOC): public types, ResolveWorkflows, spec parsing, workflow resolution, bootstrap profile selection.
  2. add_workflow_local_package.go (~400 LOC): resolveLocalRepositoryPackage*, manifest nodes, wildcard includes, installable normalization/validation.
  3. add_workflow_package_assets.go (~200 LOC): skill/agent file resolution and scanning.
  4. add_workflow_package_specs.go (~300 LOC): append*PackageWorkflowSpecs and extension specs.
  5. add_workflow_wildcard.go (~150 LOC): expandLocalWildcard*, dispatch check, resolveAddWorkflowSpecAndContent.
Test Coverage Plan
  1. add_workflow_resolution_test.go: input validation, spec routing, bootstrap profile selection, private-setting validation.
  2. add_workflow_local_package_test.go: manifest parsing, wildcard includes, path-escape validation, installable names.
  3. add_workflow_package_assets_test.go: skill dir scanning, explicit vs. discovered agents/skills.
  4. add_workflow_package_specs_test.go: spec generation for local and repo packages.
  5. add_workflow_wildcard_test.go: wildcard expansion, dispatch detection.

Target >80% coverage each.

Implementation Guidelines

  1. Preserve behavior and public API
  2. Add tests first; split one module at a time
  3. Run make test-unit after each split; make fmt

Acceptance Criteria

  • Split into 5 focused files, each under 500 lines
  • make test-unit, make lint, make build pass
  • ≥80% coverage on new files
  • No public API changes

Priority: Medium
Effort: Medium
Expected Impact: Improved maintainability and testability

Generated by 🧹 Daily File Diet · copilot · auto · 32.4 AIC · ⌖ 7.49 AIC · ⊞ 10.4K · ◷

  • expires on Oct 3, 2026, 4:59 AM UTC-08:00

Activity

  1. github-actions commented on Oct 1, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I’ve identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt54 · 8.64 AIC · ⌖ 10.4 AIC · ⊞ 14.1K · ◷

  2. github-actions commented on Oct 1, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt54 · 6.94 AIC · ⌖ 13.7 AIC · ⊞ 14.1K · ◷

  3. github-actions commented on Oct 1, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt54 · 10.8 AIC · ⌖ 10.6 AIC · ⊞ 14.1K · ◷

  4. github-actions commented on Oct 1, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I have identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt54 · 8.08 AIC · ⌖ 12.4 AIC · ⊞ 14.1K · ◷

  5. github-actions commented on Oct 1, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I’ve identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt54 · 6.27 AIC · ⌖ 16.4 AIC · ⊞ 14.1K · ◷

  6. github-actions commented on Oct 1, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    Ive identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt54 · 6.11 AIC · ⌖ 11.2 AIC · ⊞ 14.1K · ◷

  7. github-actions commented on Oct 1, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt54 · 6.87 AIC · ⌖ 10.5 AIC · ⊞ 14.1K · ◷

  8. github-actions commented on Oct 1, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt54 · 6.33 AIC · ⌖ 12 AIC · ⊞ 14K · ◷

  9. github-actions commented on Oct 1, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    I've identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt54 · 7.81 AIC · ⌖ 9.33 AIC · ⊞ 14K · ◷

  10. github-actions commented on Oct 1, 2026

    @github-actions
    ContributorAuthor

    🍪 Issue Monster selected this for Copilot

    Ive identified this issue as a good candidate for automated resolution and requested assignment to the Copilot coding agent.

    If assignment succeeds, the Copilot coding agent will analyze the issue and create a pull request with the fix.

    Om nom nom! 🍪

    🍪 Om nom nom by Issue Monster · pi · gpt54 · 8.88 AIC · ⌖ 10.6 AIC · ⊞ 14K · ◷

  11. github-actions commented on Oct 3, 2026

    @github-actions
    ContributorAuthor

    This issue was automatically closed because it expired on 2026-10-03T12:59:16.943Z.

    Closed by Workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions