feat(LocalRunnerClient): support deleting *.desc.json in DescMcpServer

This commit is contained in:
2026-01-02 17:20:12 +08:00
parent 19ec93f248
commit 0757856187

View File

@@ -926,7 +926,29 @@ public class LocalRunnerClient extends RunnerClient {
@Override @Override
@NotNull @NotNull
protected LocalWatchServiceBuild.EventHandler buildDelete() { protected LocalWatchServiceBuild.EventHandler buildDelete() {
return null; return (thisDir, context) -> {
// 排除被删除文件名称不符合要求的事件
String fileName = context.getFileName().toString();
if (!normal(fileName)) {
return;
}
// DELETE 事件发生后,需要移除对应的 descCache 条目;
// 如果存在对应的 info,也需要将其中的额外信息进行重置,只保留 Tools 自身的信息
descCache.remove(context.toUri().toString());
String actionKey = fileName.replace(".desc.json", "");
if (existedMetaActions.containsKey(actionKey)) {
resetMetaActionInfo(existedMetaActions.get(actionKey));
}
};
}
private void resetMetaActionInfo(MetaActionInfo info) {
info.setIo(false);
info.getTags().clear();
info.getPreActions().clear();
info.getPostActions().clear();
info.setStrictDependencies(false);
} }
@Override @Override