Skip to content

Refactor: decompose CodebaseAnalytics.vue script section (3200+ lines, 503 functions) #2230

@mrveiss

Description

@mrveiss

Problem

After the initial decomposition in PR #2225 (#1469), CodebaseAnalytics.vue was reduced from 5500 to 4519 lines. However, the script section remains at 3200+ lines with 503 functions/consts — the template extractions were effective but the orchestration logic was left untouched.

The parent component still owns:

  • All reactive state declarations (~200 refs/reactives)
  • All data-loading/fetching functions (~40 async functions)
  • All event handlers for child components
  • All WebSocket/polling setup
  • Type interfaces used only by specific sub-components

Discovered During

Implementation of #1469 (PR #2225)

Suggested Approach

Extract into focused composables under composables/analytics/:

  • useCodebaseState.ts — shared reactive state (rootPath, analyzing, sources, selectedSource, etc.)
  • useCodebaseIndexing.ts — indexing job management, progress polling, phase/batch tracking
  • useCodebaseSourceRegistry.ts — source CRUD, selection, sharing
  • Wire the already-created useCodebaseDataLoaders.ts (see related issue)

Target: reduce parent script to <500 lines of pure orchestration (composable wiring + child event routing).

Impact

Medium — the file is still a maintenance burden. Changes to one data-loading function risk side effects across 500 other declarations.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions