Skip to content

[Refactor] Extract task history persistence from ClineProvider.ts #23

Open

Description

@doctarock

Parent Issue

Part of #8 — Code Refactor on Monolith Files

Summary

Extract the task history persistence, caching, and sync cluster from src/core/webview/ClineProvider.ts into a dedicated module.

Scope

Methods to extract:

  • initializeTaskHistoryStore()
  • updateTaskHistory()
  • scheduleGlobalStateWriteThrough()
  • flushGlobalStateWriteThrough()
  • broadcastTaskHistoryUpdate()
  • getRecentTasks()
  • getTaskWithId()
  • showTaskWithId()

State owned:

  • taskHistoryStore: TaskHistoryStore
  • taskHistoryStoreInitialized: boolean
  • recentTasksCache?: string[]
  • globalStateWriteThroughTimer?: NodeJS.Timeout
  • GLOBAL_STATE_WRITE_THROUGH_DEBOUNCE_MS = 5000

Estimated size: ~300–350 lines

Notes

Currently mixes caching strategy, debounced write-through, and broadcast concerns in one place. Extracting gives each a clear owner and makes the debounce/sync logic independently testable.

Constraints (from #8)

  • Preserve debounce timing and write-through order
  • Run type checks after extraction
  • One extraction per commit

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions