Skip to content

Decompose uf-workflow plugin index (3,700+ lines, 25 tools) #741

Open

Description

@jflowers

Follow-up from the unleash-deterministic-tools code review council (architect run 76c2845a, dispatch artifact correlation 0c37ee87-7a99-4a31-b4ea-2532589e8b46).

Finding (LOW, structure)

.opencode/plugins/uf-workflow/index.ts is a single 3,700+ line module registering 25 tools. Parser and mechanics logic is inline:

  • parseTasksText / matchTaskLine / TASK_LINE_PATTERN (task-line grammar, ~L2330)
  • git porcelain parsing helpers (~L2044)
  • review-dispatch artifact reading (mostRecentArtifact / readDispatchArtifacts)

Recommended decomposition

Extract cohesive modules into .opencode/lib/ (the branch-classification.ts / review-dispatch-artifact.ts pattern), e.g.:

  • task-line grammar + tasks parser
  • git porcelain helpers
  • checkpoint state store

Each extraction requires the byte-identical scaffold mirror to internal/scaffold/assets/opencode/ and registration in scaffold_test.go / plugin_activation.go where applicable.

Not a blocker for #716; deferred by maintainer decision during the fix loop.

Activity

  1. added
    refactor
    on Oct 16, 2026
  2. added
    enhancement
    on Nov 2, 2026
  3. jflowers commented on Nov 2, 2026

    @jflowers
    ContributorAuthor

    Triage Summary

    Verdict: VALID — classified as an enhancement (objective; unanimous 5/5 panel agreement across adversary, architect, guard, SRE, and testing personas).

    What the panel verified

    • Provenance is traceable. The issue records its origin as a deferred LOW-severity structure finding from the unleash-deterministic-tools review council (architect run 76c2845a, dispatch correlation 0c37ee87-7a99-4a31-b4ea-2532589e8b46, parent change uf.unleash: move deterministic instruction from command markdown into plugin tools #716), deferred by explicit maintainer decision during the fix loop.
    • Every named symbol is present in the file. TASK_LINE_PATTERN, matchTaskLine, and parseTasksText (task-line grammar), the git porcelain helpers (porcelainEntryPath, C-style path decoding), and mostRecentArtifact / readDispatchArtifacts (review-dispatch artifact reading) all grep-confirm in .opencode/plugins/uf-workflow/index.ts.
    • The size claim holds and is compounding. The file was 3,700+ lines at filing (2026-10-16); at triage it measures ~5,400 lines with 27 tool({...}) registration sites (25 at filing). The structural concern is worsening, not stale.
    • The recommended pattern is established. .opencode/lib/ ships 12 extracted modules including both cited precedents (branch-classification.ts, review-dispatch-artifact.ts), and every one carries the byte-identical scaffold mirror under internal/scaffold/assets/opencode/ enforced by scaffold_test.go drift detection. The issue correctly acknowledges the mirror and registration obligations each extraction entails.
    • The extraction serves Constitution Principle VI (Deterministic Execution). Task-line parsing, porcelain parsing, and artifact reading are mechanical procedures that belong in tested modules; the originating change's design already placed task parsing in lib/, so this closes a design-intent gap rather than a style preference.

    Recommended next steps

    1. Route through an OpenSpec tactical change (opsx/<name>): moving code between modules requires a spec workflow per AGENTS.md, and the scope is single-repo and sub-3-story.
    2. Sequence the three extractions independently — task-line grammar + tasks parser, git porcelain helpers, checkpoint state store — each carrying its byte-identical scaffold mirror and registration updates in scaffold_test.go / plugin_activation.go.
    3. Maintain the 94% statements coverage floor on the .opencode/ vitest suite with the extracted modules.
    4. Schedule the work rather than leaving it deferred: the file grows monotonically as tools register (~1,700 lines added between filing and triage).

    Related issues (not duplicates)

    This triage was performed by the Divisor review panel.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementrefactor

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions