parallel-code
parallel-code copied to clipboard
[Quality audit] Reduce frontend, store, and shared-lib duplication
Derived from the local audit report CODE_QUALITY_FINDINGS.md created on 2026-05-30.
Scope
This issue groups renderer, store, and shared-library simplification opportunities.
Findings
- [ ] Finding 6: shortcut matching is duplicated and semantically inconsistent.
- Evidence:
src/lib/shortcuts.ts,src/lib/keybindings/match.ts,src/lib/keybindings/resolve.ts. - Fix direction: store app shortcuts as
KeyBinding-shaped records and share modifier normalization/matching.
- Evidence:
- [ ] Finding 20: prompt detection is duplicated between main and renderer.
- Evidence:
electron/mcp/prompt-detect.ts,src/store/taskStatus.ts. - Fix direction: move shared prompt detection to an importable pure helper.
- Evidence:
- [ ] Finding 21: diff review duplicates
ReviewProviderstate and flow.- Evidence:
src/components/ReviewProvider.tsx,src/components/ScrollingDiffView.tsx. - Fix direction: route diff selection through a shared provider/hook path.
- Evidence:
- [ ] Finding 22:
ScrollingDiffViewhas two hidden-context implementations.- Evidence:
GapViewandTrailingGapduplicate content fetching, context construction, highlighting, rendering, and expansion. - Fix direction: extract a shared context-line loader/expander.
- Evidence:
- [ ] Finding 23:
SettingsDialogtheme grids are duplicated.- Fix direction: extract
ThemeGrid(slot),PresetThemeCard, andCustomThemeCard.
- Fix direction: extract
- [ ] Finding 24:
SettingsDialogrepeats checkbox/card setting rows.- Fix direction: extract
SettingsCheckboxRowand a smallSettingsSectionwrapper.
- Fix direction: extract
- [ ] Finding 25:
Sidebarrepeats task row chrome.- Fix direction: extract
TaskRowShell,DirectBranchBadge, and shared attention/focus style helpers.
- Fix direction: extract
- [ ] Finding 26:
NewTaskDialogcarries reusable option UI inline.- Fix direction: extract
CheckboxOption,InlineBanner,DockerTaskOptions, andCoordinatorTaskOptions.
- Fix direction: extract
- [ ] Finding 27: task/agent record construction is duplicated in store.
- Fix direction: extract
createAgentRecord(...)and base task builders.
- Fix direction: extract
- [ ] Finding 28: task deletion and active-neighbor selection are duplicated.
- Fix direction: extract pure draft cleanup primitives and neighbor-selection helpers while preserving lifecycle differences.
- [ ] Finding 29: base64 terminal decoding is duplicated.
- Fix direction: move decoder to a shared utility used by desktop and remote terminal views.
- [ ] Finding 31: keybinding override resolution is duplicated.
- Fix direction: extract
resolveOneBinding; keep exports focused on inclusion of unbound rows.
- Fix direction: extract
- [ ] Finding 32: light terminal theme palette is copied twice.
- Fix direction: extract
LIGHT_TERMINAL_THEME.
- Fix direction: extract
- [ ] Finding 33: custom theme parsing/validation repeats primitives.
- Fix direction: extract
isHexTerminalBackground,collectAllowedVars, andformatVarLineswhile preserving current validation behavior unless intentionally changed.
- Fix direction: extract
- [ ] Finding 34: Electron window wrapper retains no-op compatibility methods.
- Fix direction: remove no-op methods and call-site awaits/catches if no supported platform behavior remains.
Acceptance checks
- affected component tests
- store tests
- keybinding and custom-theme tests
npm run typecheck- focused browser/UI smoke checks for touched flows