Skip to content

Discovery: UI framework-aware grouping (React and Angular) #149

@Dimwiddle

Description

@Dimwiddle

Summary

Add React/Angular awareness to discovery grouping so features are clustered within UI framework boundaries before existing path/API/name/git heuristics run.

This is a follow-up to #133.

Problem

Current grouping in group_items() is framework-agnostic. In monorepos with both React and Angular code, similarly named modules can be merged into one feature cluster, reducing draft spec accuracy.

Proposed approach

  1. Detect UI frameworks (react, angular) independently from test frameworks (jest, vitest).
  2. Carry UI framework signal into grouping inputs.
  3. Partition by UI framework first, then apply existing deterministic grouping heuristics inside each partition.
  4. Keep behavior backward-compatible when no UI framework signal exists.

Scope

Framework detection

  • Extend TypeScript detection rules to infer UI frameworks from manifests + file patterns:
    • React signals: react dependency and/or .tsx component patterns.
    • Angular signals: angular.json, @angular/core dependency, and/or *.component.ts style patterns.
  • Keep existing FrameworkDetector outputs for test frameworks stable.
  • Add a separate UI-framework signal channel (do not overload existing ctx.frameworks test-framework semantics).

Grouping

  • Update group_items() to:
    • split items by ui_framework partition (react, angular, none)
    • run current grouping heuristics per partition
    • avoid cross-framework merges by default
  • Optional naming rule (if needed): include framework prefix in feature_id only when collisions occur (react-authentication, angular-authentication).

Data contracts

  • Add a backward-compatible model field for optional framework signal where appropriate (item metadata or context-level structure), with defaults for existing miners.
  • Ensure existing miners/tests continue passing without requiring immediate framework annotation updates.

Non-goals

  • No changes to route/test/docstring extraction logic beyond carrying framework context.
  • No framework-specific scenario generation templates yet.

Acceptance criteria

  • React and Angular are detectable as UI frameworks from manifest/pattern signals in mixed TS repos.
  • Existing test framework detection (jest, vitest) remains unchanged.
  • Grouping partitions items by UI framework before path/API/name/git heuristics.
  • Items from React and Angular areas with identical names do not merge into the same DraftFeature.
  • Repositories with no UI framework signal keep current grouping behavior.
  • group_items() remains deterministic for the same input set.
  • Unit tests added for detection + grouping partition behavior.
  • features/feature-spec-discovery.md updated with scenarios and acceptance criteria for UI framework-aware grouping.

Suggested tests

  • tests/discovery/test_framework_detector.py
    • React-only detection
    • Angular-only detection
    • Mixed React+Angular detection
    • No regression in Jest/Vitest detection
  • tests/discovery/test_grouping.py
    • same logical domain under React and Angular stays in separate feature groups
    • fallback behavior when framework signal is absent

Metadata

Metadata

Assignees

No one assigned

    Labels

    algorithmAlgorithmic and grouping logicnew featureIssues or PRs for a new feature that doesn't currently existphase-2Phase 2 spec generation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions