Repository navigation
Done
Labels
Description
Overview
pkg/parser/import_field_extractor.go has grown to 1190 lines (threshold 800), mixing import orchestration, engine/config extraction, activation merging, model policy normalization, and result building. Split it into focused files.
Current State
- File:
pkg/parser/import_field_extractor.go - Size: 1190 lines (~60 funcs, one large
importAccumulatorstruct at L20-120) - Test file:
pkg/parser/import_field_extractor_test.go(1178 lines, ratio ≈ 0.99) - Complexity: Single god-struct (
importAccumulator) with manyextract*/merge*/append*methods; several independent domains.
Full File Analysis
- L20-135:
importAccumulatortype + constructor - L137-368: orchestration (
extractImportFields,prepareFrontmatter, inline sub-agent warnings, tools content, markdown helpers) - L369-560: engine, config and concurrency extraction
- L558-760: sandbox mounts, generic JSON/YAML field helpers, activation fields (bots, skip-roles, github-token/app)
- L751-850: checkout, steps/jobs, ordered steps, feature/observability
- L852-1020: model policy/alias/provider normalization (self-contained pure functions)
- L1004-1070: plugins, run-install-scripts, observability
- L1071-1190: result building,
computeImportRelPath,validateGitHubAppJSON
Refactoring Strategy
import_accumulator.go(~170 lines):importAccumulator,newImportAccumulator,toImportsResult,buildImportsResult,populateImportsResultScalars.import_extract_frontmatter.go(~230 lines):extractImportFields,prepareFrontmatter,parseOriginalFrontmatter,frontmatterMapOrEmpty, sub-agent warnings,extractToolsContent,trackRuntimeOrInlineImport,appendMarkdownWithSeparator,parseFrontmatterForExtraction.import_extract_engine.go(~230 lines): engine config, MCP settings, config fields, concurrency,mergeSandboxAgentMounts,mustMarshalJSON.import_extract_activation.go(~190 lines): activation fields, merge* list helpers,mergeJSONStringListField, skip match/token/app fields,validateGitHubAppJSON.import_extract_models.go(~180 lines):appendModelsField,normalizeModel*,parseModelPolicyField,sanitizeModelProvidersForCosts,parseStringSliceField,isModelPolicyKey.import_extract_steps.go(~150 lines): checkout, step/job/ordered-step fields, feature/observability, plugins, run-install-scripts, cache/labels/excluded-env,computeImportRelPath.- Generic
extractFirstWins*/append*Fieldhelpers could go toimport_extract_helpers.go.
Test Coverage Plan
Split the existing test file along the same lines (one _test.go per new file), targeting >80% coverage each; add tests for model normalization edge cases and validateGitHubAppJSON.
Implementation Guidelines
Preserve behavior and exports; move code in small steps, running make test-unit after each; run make fmt and make lint.
Acceptance Criteria
- Split into ~6 files, each under 500 lines
-
make test-unit,make lint,make buildpass - No public API changes
Priority: Medium · Effort: Medium · Impact: Better maintainability and testability
Generated by 🧹 Daily File Diet · copilot · auto (Claude Sonnet 5.5) · ~18 AIC · ⌖ ~2 AIC · ⊞ 13.3K · ◷
- expires on Nov 13, 2026, 4:45 AM UTC-08:00
Reacted by Copilot
Activity
github-actions commentedon Nov 11, 2026
🍪 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, Copilot will analyze the issue and create a pull request with the fix.
Om nom nom! 🍪