fix: restore repository runner token and implement missing syncToolSource method
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 53s
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 53s
This commit is contained in:
@@ -34,6 +34,46 @@ public final class ToolSourceUpdater {
|
|||||||
Files.writeString(targetFile, content, StandardCharsets.UTF_8);
|
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 {
|
private static Path findToolSource(Path rootDirectory, String toolName) throws IOException {
|
||||||
try (var paths = Files.walk(rootDirectory)) {
|
try (var paths = Files.walk(rootDirectory)) {
|
||||||
return paths.filter(Files::isRegularFile)
|
return paths.filter(Files::isRegularFile)
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ services:
|
|||||||
image: gitea/act_runner:latest
|
image: gitea/act_runner:latest
|
||||||
environment:
|
environment:
|
||||||
- GITEA_INSTANCE_URL=https://git.devjun.net
|
- GITEA_INSTANCE_URL=https://git.devjun.net
|
||||||
- GITEA_RUNNER_REGISTRATION_TOKEN=BruvOCsirwaflqpu3kUMl95OfX8bMH39LN077jg8
|
- GITEA_RUNNER_REGISTRATION_TOKEN=2N7ciuFIp2Jm29EWtzfl7ruQtpwGgB4ngFcXC2lF
|
||||||
- GITEA_RUNNER_NAME=ociwp-runner
|
- GITEA_RUNNER_NAME=ociwp-runner
|
||||||
- GLOW_COMMUNICATION_EXTMCI_PORT=8080
|
- GLOW_COMMUNICATION_EXTMCI_PORT=8080
|
||||||
- GITEA_RUNNER_LABELS=ubuntu-latest,ubuntu-22.04,linux-arm64
|
- GITEA_RUNNER_LABELS=ubuntu-latest,ubuntu-22.04,linux-arm64
|
||||||
|
|||||||
Reference in New Issue
Block a user