diff --git a/mateclaw-server/src/main/java/vip/mate/wiki/WikiProperties.java b/mateclaw-server/src/main/java/vip/mate/wiki/WikiProperties.java
index 4df212e6..4ad3115f 100644
--- a/mateclaw-server/src/main/java/vip/mate/wiki/WikiProperties.java
+++ b/mateclaw-server/src/main/java/vip/mate/wiki/WikiProperties.java
@@ -270,4 +270,17 @@ public class WikiProperties {
* top-3 RRF hit but doesn't dominate it.
*/
private double relationBoostLambda = 0.05;
+
+ /**
+ * Feature flag for the cascade-delete / cascade-rename pipeline: when a
+ * page is deleted (or renamed), find every other page that linked to it
+ * via {@code [[slug]]} and rewrite those references so they don't dangle.
+ *
+ * Defaults to {@code true} — the legacy row-only delete left dangling
+ * {@code [[slug]]} markers behind, which is exactly the bug class this
+ * RFC closes. Set to {@code false} only as a temporary kill-switch if a
+ * cascade pass starts mangling referrer content (which would be a real
+ * bug to chase down, not a steady state).
+ */
+ private boolean cascadeDeleteEnabled = true;
}
diff --git a/mateclaw-server/src/main/java/vip/mate/wiki/controller/WikiController.java b/mateclaw-server/src/main/java/vip/mate/wiki/controller/WikiController.java
index bf62cd05..a3427cc4 100644
--- a/mateclaw-server/src/main/java/vip/mate/wiki/controller/WikiController.java
+++ b/mateclaw-server/src/main/java/vip/mate/wiki/controller/WikiController.java
@@ -517,6 +517,38 @@ public class WikiController {
return R.ok(pageService.getBacklinks(kbId, slug));
}
+ /**
+ * Rename a page within a KB. The old slug is no longer reachable after
+ * this call; every wikilink in the KB that pointed at it is rewritten
+ * to the new slug in the same transaction. Aliases ({@code [[oldSlug|x]]})
+ * are preserved by carrying the alias text over to the new target.
+ */
+ @RequireWorkspaceRole("admin")
+ @Operation(summary = "重命名 Wiki 页面,并级联更新所有引用方")
+ @PostMapping("/knowledge-bases/{kbId}/pages/{slug}/rename")
+ public R