fix(blocks): one block definition service for delete, rename and purge on every path

new src/scene/block_service.rs (references, delete, rename, purge candidates, name validation, one error type and message). The command-line RENAME, palette Remove, plugin API, control/MCP block_delete and PURGE all use it. Layout, xref, dynamic-block, anonymous and open-in-editor records are protected; PURGE removes an anonymous block only when nothing references it. PROTOCOL CHANGE: control/MCP block_delete refuses a referenced block unless force=true (erases referencing INSERTs in one undo step). New REST route DELETE /api/v1/blocks/{name}?force=true. MCP tool digest re-pinned. Undo labels are Delete block X, Rename block X to Y and Purge.
This commit is contained in:
Karim Jerbi committed 2026-10-12 07:25:11 +01:00
1 parent 5dfa41c032
commit 2b50b6c858
16 files changed
+2701 -262

No files matched your search

+10 -3
View File
@@ -534,11 +534,18 @@ pub static BLOCK_DEFINE: OpDef = OpDef {
pub static BLOCK_DELETE: OpDef = OpDef {
name: "block_delete",
doc: "Delete a block definition and all its child entities and inserts.",
doc: "Delete a block definition and all its child entities. A referenced block is refused; force erases the referencing inserts.",
batchable: true,
params: &[req("name", Ty::Str, "Block name to delete.")],
params: &[
req("name", Ty::Str, "Block name to delete."),
opt(
"force",
Ty::Bool,
"Erase the referencing inserts instead of refusing a referenced block. Result reports how many references were overridden.",
),
],
rules: &[],
example: r#"{"op":"block_delete","name":"DOOR"}"#,
example: r#"{"op":"block_delete","name":"DOOR","force":true}"#,
};
pub static XDATA_SET: OpDef = OpDef {