feat: batches with dry run, undo, and CSV import and export
- POST /_seo/api/v1/batch runs changes in one transaction: dry_run answers the diff and the conflicts (loops, chains, noindex on a published record, canonicals to redirected or noindex addresses) and rolls back; a refused change refuses the batch (D-12) - undo of a change or a whole batch from History and through MCP, with the undo_stale, undo_loop and undo_gone refusals (D-13) - CSV export and import of redirects, rules and records by URL: BOM, comma or semicolon, formula cells escaped, a dry-run preview, all or nothing with via import; the screen's apply token is HMAC-SHA256 over the file and a fingerprint of the data (transfer.stale) - Import and export singleton with the seo_transfer widget action, History record actions undo and undo_batch, navigation entry - MCP tools undo_change, undo_batch, apply_batch, export_csv, import_csv - TestBatch, TestUndo, TestCSVTransfer, TestLoopRefused mcp and import
This commit is contained in:
54
mcp.go
54
mcp.go
@@ -274,6 +274,60 @@ func (p *Plugin) MCP() pact.MCP {
|
||||
Permissions: []string{mcpPermission},
|
||||
},
|
||||
|
||||
// Undo (D-13).
|
||||
{
|
||||
Name: "undo_change",
|
||||
Title: "Undo an SEO change",
|
||||
Description: "Restores the values before one SEO change from history; the undo is itself recorded. Refused with undo_stale when a later change touched the same values (naming who and when), undo_loop when the restore would create a redirect loop, undo_gone when the record is gone.",
|
||||
Guard: mcpGuard,
|
||||
Method: http.MethodPost,
|
||||
Path: "/_seo/api/v1/history/{id}/undo",
|
||||
Input: apicontrollers.HistoryIDInput{},
|
||||
Permissions: []string{mcpPermission},
|
||||
},
|
||||
{
|
||||
Name: "undo_batch",
|
||||
Title: "Undo a batch",
|
||||
Description: "Undoes every change of a batch or an import (by batch id) as a whole, or none of them, with the refusals of undo_change.",
|
||||
Guard: mcpGuard,
|
||||
Method: http.MethodPost,
|
||||
Path: "/_seo/api/v1/history/batches/{batch}/undo",
|
||||
Input: apicontrollers.HistoryBatchInput{},
|
||||
Permissions: []string{mcpPermission},
|
||||
},
|
||||
|
||||
// Bulk changes and CSV (D-12, D-13).
|
||||
{
|
||||
Name: "apply_batch",
|
||||
Title: "Apply a batch of SEO changes",
|
||||
Description: "Applies a list of changes (set_seo by URL, redirect and rule creates, updates and deletes) all or nothing. With dry_run it answers the diff and the conflicts (redirect loops and chains, noindex on a published page, a canonical pointing to a redirected page) and writes nothing; a loop refuses the whole batch.",
|
||||
Guard: mcpGuard,
|
||||
Method: http.MethodPost,
|
||||
Path: "/_seo/api/v1/batch",
|
||||
Input: apicontrollers.ApplyBatchInput{},
|
||||
Permissions: []string{mcpPermission},
|
||||
},
|
||||
{
|
||||
Name: "export_csv",
|
||||
Title: "Export SEO data as CSV",
|
||||
Description: "Exports redirects, URL rules or the SEO of records (by URL) as CSV, UTF-8 with a BOM, 1000 rows per page; cells that start a formula are prefixed with an apostrophe.",
|
||||
Guard: mcpGuard,
|
||||
Method: http.MethodGet,
|
||||
Path: "/_seo/api/v1/export",
|
||||
Input: apicontrollers.ExportInput{},
|
||||
Permissions: []string{mcpPermission},
|
||||
},
|
||||
{
|
||||
Name: "import_csv",
|
||||
Title: "Import SEO data from CSV",
|
||||
Description: "Imports redirects, URL rules or the SEO of records (rows address pages by URL; no record means a URL rule) from CSV of at most 900 KB. With dry_run it previews every row as new, changed, unchanged or refused with notes; otherwise every row is applied as one batch, or nothing while a row is refused (a loop, an invalid value).",
|
||||
Guard: mcpGuard,
|
||||
Method: http.MethodPost,
|
||||
Path: "/_seo/api/v1/import",
|
||||
Input: apicontrollers.ImportInput{},
|
||||
Permissions: []string{mcpPermission},
|
||||
},
|
||||
|
||||
// Audit (D-13, D-14 CMS part).
|
||||
{
|
||||
Name: "list_issues",
|
||||
|
||||
Reference in New Issue
Block a user