Synfig MCP Repository Audit & Cleanup Plan¶
Phase A0 Baseline Audit (Target: v0.8.0-rc1) Systematically analyzes code bloat, files over 400 lines, stale documentation, naming inconsistencies, git topology, and dead code. Establishes the actionable refactoring roadmap for Phase A7 (Repo & UX Polish).
1. Files Over 400 Lines (Refactoring Targets)¶
Analysis performed across source, bridge, documentation, and test suites:
| File Path | Line Count | Current Responsibility | Proposed Phase A7 Split / Action |
|---|---|---|---|
bridge/src/mcp_bridge/handlers.cpp |
2,429 | Monolithic JSON-RPC dispatcher for doc, layer, param, anim, history, render, and selection | Split by domain into handlers_doc.cpp, handlers_layer.cpp, handlers_param.cpp, handlers_anim.cpp, handlers_render.cpp with a central router |
server/tests/e2e/test_live_mutate.py |
1,808 | All live E2E mutation tests against real Synfig Studio | Split into focused suites: test_live_layers.py, test_live_params.py, test_live_anim.py, test_live_security.py |
server/src/synfig_mcp/tools/register.py |
1,447 | Monolithic MCP tool registration functions (all 52 tools in one file) | Split into domain modules under synfig_mcp/tools/: doc.py, layer.py, param.py, anim.py, render.py, scene.py |
docs/tools.md |
1,439 | Auto-generated Markdown tool reference | Keep generated, but update scripts/generate_tool_docs.py to group by profile and link to topic guides |
server/src/synfig_mcp/sif/parser.py |
1,193 | XML DOM parser, SIF document abstraction, layer models, waypoints | Separate into ast.py, layers.py, values.py, and serializer.py |
server/src/synfig_mcp/backend/headless.py |
875 | Complete headless SIF engine + CLI fallback | Modularize backend delegate classes for canvas manipulation, parameters, and render jobs |
server/tests/contract/test_mcp_tools.py |
721 | Parametrized contract tests for all tools | Split into per-domain contract test modules |
server/src/synfig_mcp/protocol/fake_bridge.py |
655 | In-memory mock TCP bridge server | Split mock document storage from protocol handshake logic |
server/src/synfig_mcp/backend/live.py |
651 | Live bridge backend adapter | Keep coherent, delegate complex render polling to render pipeline |
server/src/synfig_mcp/backend/base.py |
409 | BaseBackend abstract class | Clean abstract interface; acceptable size |
2. Duplicate and Stale Documentation Audit¶
server/README.mdvs RootREADME.md:server/README.mdis an exact duplicate of the rootREADME.md.- Resolution: Replace
server/README.mdwith a clean symlink or a minimal pointer referencing rootREADME.md. docs/ROADMAP.md:- Stale milestones referencing completed alpha targets (v0.6.0, v0.7.0) and Phase P0–P7.
- Resolution: Reconcile
ROADMAP.mdto reflect the v0.8.0-rc1 Studio-grade upgrade phases (A0 through A8). scripts/generate_tool_docs.py:- Docstring states: "Generate comprehensive Markdown documentation for all 47 Synfig MCP tools", whereas 52 tools currently exist.
- Resolution: Update generator to introspect dynamically and group tools according to Phase A1 profiles.
3. Naming and API Inconsistencies¶
- Tool Naming (
verb_nounconsistency): - Current names:
layer_removevslayer_delete,layer_reordervslayer_move,scene_tree(noun phrase) vscanvas_list,import_assetvsasset_import. (Resolved in v1.0.6: the duplicate asset actions were consolidated into a singleasset_importtool.) - C++ Bridge methods: Accepts both
layer.removeandlayer.delete,layer.moveandlayer.reorder. - Resolution: Standardize Python MCP tool names strictly on
noun_verborverb_nounconvention in Phase A1 / A7. - Parameter Conventions:
- Some layer tools accept
canvas_path: str = ""while others require explicit canvas resolution. - Resolution: Unify canvas targeting across all tools.
- Version Number Single Source of Truth:
server/pyproject.tomldefines0.7.0rc3.bridge/src/mcp_bridge/handlers.cpphardcodes0.7.0-rc3.- Resolution: Centralize version in a single file (e.g.
VERSIONor root metadata) injected into C++ build via CMake and read dynamically by Python packaging.
4. Git References and Branch Topology Audit¶
- Branch
v1.0.0: - Currently checked out branch is named
v1.0.0, whileorigin/HEADpoints toorigin/main. - A branch named after a future major version creates confusion with release tags.
- Resolution: Never delete tags. Align work on
mainor a dedicated release branchrelease/v0.8.0-rc1. - Preservation of Existing Tags:
- Verified existing tags:
v0.6.0,v0.7.0-rc1,v0.7.0-rc2,v0.7.0-rc3. - Hard Rule: No existing tags will be deleted or moved. Code changes will ship strictly under the new tag
v0.8.0-rc1.
5. Dead Code and Workspace Cleanup¶
scratch/Directory:- Contains 15 ad-hoc debugging scripts from previous CI troubleshooting (
check_all_jobs.py,check_ci.py,fetch_pkg_info.py,pkgs_info.json,test_win32_fs.cpp). - Resolution: Move or archive these ad-hoc scripts to keep the root repository clean.
dist/Directory:- Contains historical release archives from previous builds.
- Resolution: Retain
.gitignoretracking so build artifacts are excluded from git.