From e66e97ecc36b14c7c1ede8d75737681143c700e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A4=ED=9D=AC=EC=A4=80?= Date: Fri, 14 Aug 2026 16:49:43 +0900 Subject: [PATCH] fix: restore repository runner token and implement missing syncToolSource method --- .../dap/lib/util/ToolSourceUpdater.java | 40 +++++++++++++++++++ docker-compose.yml | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/dap-was-lib/src/main/java/io/shinhanlife/dap/lib/util/ToolSourceUpdater.java b/dap-was-lib/src/main/java/io/shinhanlife/dap/lib/util/ToolSourceUpdater.java index 5d2ca121..a5c1bc21 100644 --- a/dap-was-lib/src/main/java/io/shinhanlife/dap/lib/util/ToolSourceUpdater.java +++ b/dap-was-lib/src/main/java/io/shinhanlife/dap/lib/util/ToolSourceUpdater.java @@ -34,6 +34,46 @@ public final class ToolSourceUpdater { Files.writeString(targetFile, content, StandardCharsets.UTF_8); } + public static boolean syncToolSource(Path rootDirectory, String toolName, String title, String description, + boolean readOnlyHint, boolean destructiveHint, boolean idempotentHint, + String categoryKey) throws IOException { + Path targetFile = findToolSource(rootDirectory, toolName); + if (targetFile == null) { + throw new IllegalArgumentException("Tool source not found: " + toolName); + } + + String content = Files.readString(targetFile, StandardCharsets.UTF_8); + String originalContent = content; + + AnnotationRange mcpRange = annotationArguments(content, "McpTool", toolName); + if (mcpRange != null) { + if (title != null) { + content = replaceAttribute(content, mcpRange, "title", quote(title)); + mcpRange = annotationArguments(content, "McpTool", toolName); + } + if (description != null) { + content = replaceAttribute(content, mcpRange, "description", quote(description)); + } + } + + AnnotationRange hintRange = annotationArguments(content, "GrowToolHint", null); + if (hintRange != null) { + if (categoryKey != null && !categoryKey.isBlank()) { + content = replaceAttribute(content, hintRange, "categoryKey", quote(categoryKey)); + hintRange = annotationArguments(content, "GrowToolHint", null); + } + content = replaceAttribute(content, hintRange, "destructive", Boolean.toString(destructiveHint)); + hintRange = annotationArguments(content, "GrowToolHint", null); + content = replaceAttribute(content, hintRange, "idempotent", Boolean.toString(idempotentHint)); + } + + if (!content.equals(originalContent)) { + Files.writeString(targetFile, content, StandardCharsets.UTF_8); + return true; + } + return false; + } + private static Path findToolSource(Path rootDirectory, String toolName) throws IOException { try (var paths = Files.walk(rootDirectory)) { return paths.filter(Files::isRegularFile) diff --git a/docker-compose.yml b/docker-compose.yml index 32aa4dd0..8a3426f5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -100,7 +100,7 @@ services: image: gitea/act_runner:latest environment: - GITEA_INSTANCE_URL=https://git.devjun.net - - GITEA_RUNNER_REGISTRATION_TOKEN=BruvOCsirwaflqpu3kUMl95OfX8bMH39LN077jg8 + - GITEA_RUNNER_REGISTRATION_TOKEN=2N7ciuFIp2Jm29EWtzfl7ruQtpwGgB4ngFcXC2lF - GITEA_RUNNER_NAME=ociwp-runner - GLOW_COMMUNICATION_EXTMCI_PORT=8080 - GITEA_RUNNER_LABELS=ubuntu-latest,ubuntu-22.04,linux-arm64