Skip to content

refactor(repaint): AI Repaint is the second feature module, with a Settings tab and an MCP tool - #258

Merged
YIWANG3 merged 1 commit into
mainfrom
feat/feature-module-repaint
Nov 2, 2026
Merged

YIWANG3 merged 1 commit into
mainfrom
feat/feature-module-repaint

Conversation

@YIWANG3

@YIWANG3 YIWANG3 commented Nov 2, 2026

Copy link
Copy Markdown
Owner

PR 2 of docs/feature-modules-plan.md §7, after PR 1 (#257). Zero behaviour change: AI Repaint moves into features/repaint/, and the manifest grows two fields the LUT did not need — a Settings tab and an MCP tool.

Moved (git mv)

from to
src/components/editor/AiRepaintPanel.jsx, settings/RepaintSettings.jsx, ai/providers.jsx features/repaint/renderer/
the repaint handlers of electron/ipc/ai.js (status, start, history, styles) and pick-repaint-refs from ipc/dialogs.js features/repaint/electron/repaint.js
repaint_asset from mcp/tools/assets.js features/repaint/electron/mcpTools.js
6 rows of shared/ipcChannels.mjs features/repaint/manifest.mjs contributes.ipc

What stays in the host, and why

  • Provider credentials, preferences, model listing stay in electron/ipc/ai.js with the text-image channels: the text tool's HandwritingModal reads getAiPreferences / getAiProviderToken directly, so they are a host service two features share. The file keeps its name; its header now says "AI providers + text image".
  • dedupeModels (used by HandwritingModal and RepaintSettings) becomes src/utils/aiModels.js. The rest of providers.jsx (PROVIDER_TYPES, ProviderModal, getProviderType) goes with repaint.
  • Picker memory: pickerStart / rememberPicker move from dialogs.js's register into createDialogs(...) (which now takes readAppSettings / updateAppSettings), so host.dialogs serves the feature's picker too.
  • tasks.js's startAiRepaintTask / activeRepaintProvider, api/browser/ai.js, the sidecar's provider if-chain: untouched (registry merge is a later PR, as planned).

New manifest fields

  • settingsTab: { id: "repaint", key: "repaint" } → features/index.js settingsTabs; SettingsOverlay.jsx is CORE_TABS + feature tabs placed by TAB_ORDER, pane rendered from the table.
  • mcpTools: "./electron/mcpTools.js" → electron/features.js loadMcpToolGroups(), spread at the end of mcp/tools/index.js GROUPS; toolSchemas.test.js scans the feature files from the manifests. Still 37 tools; 08-mcp-http unchanged.
  • editorTool.mount: "always": the panel is a plain import (no lazy chunk) because the editor keeps it mounted; EditorOverlay still does that by hand.

Tests

features/repaint/electron/repaint.test.js (5: channels match the manifest, start/history forwarding, styles file, picker, picker memory); features.test.js covers loadMcpToolGroups; dialogs.test.js keeps the handwriting picker memory. IPC_METHODS is still 183 rows.

Verified

npm run lint, electron 290/290, renderer 432/432, npm run build, full npm run e2e: 434 passed, 14 skipped, 0 failed (13.8 min). Not done: e2e:coverage.

Docs: plan status line + §7 as-built record, docs/README.md, features/README.md.

🤖 Generated with Claude Code

…ttings tab and an MCP tool

The repaint panel, its Settings tab and the provider registry move from
src/ into features/repaint/renderer/, and the repaint job, its history, the
style library, the reference picker and the repaint_asset MCP tool move
from electron/ into features/repaint/electron/. The host reads what the
feature contributes from features/repaint/manifest.mjs. No behaviour
changes.

What stays in the host, and why: the AI providers' credentials,
preferences and model listing (electron/ipc/ai.js) also serve the editor's
text tool (HandwritingModal reads getAiPreferences / getAiProviderToken),
so ipc/ai.js keeps them and the text-image channels; dedupeModels, used by
both, becomes src/utils/aiModels.js. The picker memory
(pickerStart / rememberPicker) moves into createDialogs so host.dialogs
serves every module; the repaint picker registers from the feature.

New manifest fields: settingsTab (SettingsOverlay places it by TAB_ORDER,
features/index.js exports settingsTabs), mcpTools (electron/features.js
loadMcpToolGroups, appended to mcp/tools/index.js GROUPS; toolSchemas.test
scans them), editorTool.mount: "always" (honoured by EditorOverlay by hand).
IPC_METHODS keeps 183 methods, tools/list keeps 37 tools.

Tests: features/repaint/electron/repaint.test.js (5, incl. channels ==
manifest), features.test.js covers loadMcpToolGroups, dialogs.test.js keeps
the handwriting picker memory.

Verified: lint, electron 290/290, renderer 432/432, build, full e2e 434
passed / 14 skipped.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant