feat(copy-process): add copy-process MCP tool - #63
Conversation
Introduces copy-process(source_process_id, new_name?, folder_path?) — the equivalent of the Corezoid UI "Duplicate" action. The tool exports the source process server-side, creates an empty target in the destination folder, and deploys the source scheme to the new process ID without ever loading the full JSON into the AI context. tool: create-process | install: 104e5afc | version: 2.3.5 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AI ReviewAdds Checklist
Issues foundwarning — Orphaned empty process on deploy failure ( Steps 5 → 7 of Fix: add a if _, err := v.ProcessJSON(finalPath, string(srcJSON)); err != nil {
os.Remove(finalPath) //nolint:errcheck
// Also clean up the orphaned empty process:
v.DeleteProcess(newID)
return 0, "", fmt.Errorf("deploy copy: %w", err)
}warning — Source JSON The exported source JSON contains the original process's This review was generated automatically. A human maintainer should still make the merge decision. |
|
CI note: The Validate JSON manifests check failure is a pre-existing version mismatch in the |
|
Serious findings only — merge conflicts, style, and formatting intentionally skipped.
Unrelated to this PR: the failing |
|
Serious findings only — merge conflicts, style, and formatting intentionally skipped.
Side note (not a blocker): the tool is described as equivalent to the UI "Duplicate", but the source JSON is deployed largely as-is, including |
Summary
copy-processMCP tool — duplicates a process or state diagram without loading its JSON into the AI contextnew_name(defaults to<title> (Copy)) and optionalfolder_path(defaults to the source's parent folder).conv.jsonfile in the resolved local directory, ready for further editingContext
tool: create-process | version: 2.3.5 | install: 104e5afc
Implementation
copy-process(source_process_id, new_name?, folder_path?)in the MCP server:ExportProcessAPICreateEmptyConvProcessJSON<newID>_<title>.conv.jsonin the correct local directoryThe AI context never sees the process JSON — context-cost is O(1) regardless of process size.
Checklist
make buildpassesmake vetpassesmake testpasses (TestToolRegistryMatchesREADME, TestToolRegistryNoDuplicates, etc.)Test plan
copy-processwith a validsource_process_id— verify a new.conv.jsonappears in the correct folder with a new process IDnew_nameset — verify the copy uses that titlefolder_pathpointing to a different subfolder — verify placement<original> (Copy)and same-folder placement