관련 소스 업데이트
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 18s

This commit is contained in:
jade
2026-08-20 09:43:22 +09:00
parent 64c422378f
commit 8744387b29
4 changed files with 43 additions and 75 deletions

View File

@@ -167,9 +167,9 @@ public class ToolScaffolder {
String moduleName, StringBuilder log) throws IOException {
String baseName = toPascalCase(tool.baseName());
boolean mci = "MCI".equalsIgnoreCase(tool.routingType());
String code = mci ? tool.clientSystemCode().toLowerCase(Locale.ROOT) : toPackageSegment(tool.httpApiName());
String ioPackage = BASE_PACKAGE + (mci ? ".infra.itrf.mci." : ".infra.itrf.http.") + code;
Path clientDir = sourceRoot.resolve(Paths.get("infra", "itrf", mci ? "mci" : "http", code));
String codePath = mci ? (tool.clientSystemCode().length() == 4 ? tool.clientSystemCode().substring(0, 3).toLowerCase(Locale.ROOT) + "/" + tool.clientSystemCode().substring(3).toLowerCase(Locale.ROOT) : tool.clientSystemCode().toLowerCase(Locale.ROOT)) : toPackageSegment(tool.httpApiName());
String ioPackage = BASE_PACKAGE + (mci ? ".infra.itrf.mci." : ".infra.itrf.http.") + codePath.replace("/", ".");
Path clientDir = sourceRoot.resolve(Paths.get("infra", "itrf", mci ? "mci" : "http", codePath.replace("/", "\\\\")));
Path ioDir = clientDir.resolve("io");
Files.createDirectories(ioDir);
writeUtf8(dtoDir.resolve(baseName + "Request.java"),
@@ -180,13 +180,26 @@ public class ToolScaffolder {
writeStructuredFieldTypes(dtoDir, bizPackage + ".dto", baseName + "Response", tool.outputFields());
if (mci) {
writeUtf8(ioDir.resolve(baseName + "_I.java"),
mciIoContent("infra.itrf.mci." + code, baseName + "_I", tool.inputFields(), "", ""));
mciIoContent("infra.itrf.mci." + codePath.replace("/", "."), baseName + "_I", tool.inputFields(), "", ""));
writeUtf8(ioDir.resolve(baseName + "_O.java"),
mciIoContent("infra.itrf.mci." + code, baseName + "_O", tool.outputFields(), "", ""));
mciIoContent("infra.itrf.mci." + codePath.replace("/", "."), baseName + "_O", tool.outputFields(), "", ""));
writeStructuredFieldTypes(ioDir, ioPackage + ".io", baseName + "_I", tool.inputFields());
writeStructuredFieldTypes(ioDir, ioPackage + ".io", baseName + "_O", tool.outputFields());
writeUtf8(clientDir.resolve(baseName + "Client.java"),
groupedMciClientContent(ioPackage, baseName, tool.interfaceId()));
String clientPrefixCap = toPascalCase(tool.clientSystemCode());
Path mciClientFile = clientDir.resolve("Mci" + clientPrefixCap + "Client.java");
if (!java.nio.file.Files.exists(mciClientFile)) {
String mciClientContent = "package " + ioPackage + ";\n\n"
+ "import org.springframework.stereotype.Component;\n"
+ "import lombok.RequiredArgsConstructor;\n"
+ "import io.shinhanlife.dap.lib.integration.mci.component.AxhubMciComponent;\n"
+ "import io.shinhanlife.glow.communication.dto.Transfer;\n\n"
+ "@Component\n@RequiredArgsConstructor\npublic class Mci" + clientPrefixCap + "Client {\n"
+ " private final AxhubMciComponent mci;\n"
+ " public <O> Transfer<O> callTo(String interfaceId, String dummy, Object mciReq, Class<O> resType) throws Exception {\n"
+ " return mci.callTo(interfaceId, dummy, mciReq, resType);\n"
+ " }\n}\n";
writeUtf8(mciClientFile, mciClientContent);
}
writeUtf8(sourceRoot.resolve(Paths.get("biz", tool.group().toLowerCase(Locale.ROOT), "converter", baseName + "Converter.java")),
groupedMciConverterContent(bizPackage, baseName, ioPackage));
} else {
@@ -217,7 +230,7 @@ public class ToolScaffolder {
.append("import ").append(bizPackage).append(".dto.").append(baseName).append("Response;\n");
boolean isMutation = isMutationTool(baseName);
ToolDefinitionOptions opts = tool.definitionOptions() == null ? new ToolDefinitionOptions(null, null, null, null, null, null, null, null) : tool.definitionOptions();
methods.append(" @McpTool(name = \"").append(toToolName(moduleName, tool.group(), baseName))
.append("\", title = \"").append(javaText(option(tool.title(), baseName)))
.append("\", description = \"").append(javaText(option(tool.description(), ""))).append("\")\n")
@@ -232,7 +245,7 @@ public class ToolScaffolder {
.append(" whenNotToUse = \"").append(javaText(opts.whenNotToUse() != null && !opts.whenNotToUse().isBlank() ? opts.whenNotToUse() : "정보 변경이나 실행 작업에는 사용하지 않습니다.")).append("\",\n")
.append(" ioLimits = \"").append(javaText(opts.ioLimits() != null && !opts.ioLimits().isBlank() ? opts.ioLimits() : "정의된 입력 항목만 허용하며 업무 결과만 반환합니다.")).append("\",\n")
.append(" displayDescription = \"").append(javaText(opts.displayDescription() != null && !opts.displayDescription().isBlank() ? opts.displayDescription() : option(tool.title(), baseName) + " 정보를 처리합니다.")).append("\",\n");
List<String> examples = opts.exampleQueries();
if (examples == null || examples.isEmpty()) {
examples = List.of(option(tool.title(), baseName) + " 정보를 보여줘", option(tool.title(), baseName) + " 확인해줘", "현재 " + option(tool.title(), baseName) + " 알려줘");
@@ -242,7 +255,7 @@ public class ToolScaffolder {
.append("},\n")
.append(" destructive = ").append(isMutation).append(",\n")
.append(" idempotent = ").append(!isMutation).append(",\n");
List<String> tags = opts.tags();
if (tags == null || tags.isEmpty()) {
tags = List.of(tool.group().toLowerCase(Locale.ROOT), isMutation ? "처리" : "조회");
@@ -280,7 +293,9 @@ public class ToolScaffolder {
clientVariable = Character.toLowerCase(baseName.charAt(0)) + baseName.substring(1) + "Client";
}
String converterVariable = Character.toLowerCase(baseName.charAt(0)) + baseName.substring(1) + "Converter";
String integrationPackage = BASE_PACKAGE + (mci ? ".infra.itrf.mci." + tool.clientSystemCode().toLowerCase(Locale.ROOT)
String integrationSysCode = tool.clientSystemCode().toLowerCase(Locale.ROOT);
String sysCodePath = integrationSysCode.length() == 4 ? integrationSysCode.substring(0, 3) + "." + integrationSysCode.substring(3) : integrationSysCode;
String integrationPackage = BASE_PACKAGE + (mci ? ".infra.itrf.mci." + sysCodePath
: ".infra.itrf.http." + toPackageSegment(tool.httpApiName()));
imports.append("import ").append(bizPackage).append(".dto.").append(baseName).append("Request;\n")
.append("import ").append(bizPackage).append(".dto.").append(baseName).append("Response;\n")
@@ -298,7 +313,7 @@ public class ToolScaffolder {
.append("(").append(baseName).append("Request req) {\n")
.append(" ").append(baseName).append(mci ? "_I" : "HttpRequest").append(" request = ").append(converterVariable).append(".toRequest(req);\n")
.append(" ").append(baseName).append(mci ? "_O" : "HttpResponse").append(" response = ").append(clientVariable)
.append(mci ? ".call(\"" + tool.interfaceId() + "\", request, " + baseName + "_O.class);\n" : ".call(request, " + baseName + "HttpResponse.class);\n")
.append(mci ? ".callTo(\"" + tool.interfaceId() + "\", null, request, " + baseName + "_O.class).getBody();\n" : ".call(request, " + baseName + "HttpResponse.class);\n")
.append(" ").append(baseName).append("Response toolResponse = ").append(converterVariable).append(".toResponse(response);\n")
.append(" if (toolResponse == null) toolResponse = new ").append(baseName).append("Response();\n")
.append(" toolResponse.setResultCode(\"SUCCESS\");\n")
@@ -360,7 +375,9 @@ public class ToolScaffolder {
throw new IllegalArgumentException("Tool method or MCP Tool name already exists: " + methodName);
}
boolean mci = "MCI".equalsIgnoreCase(tool.routingType());
String integrationPackage = BASE_PACKAGE + (mci ? ".infra.itrf.mci." + tool.clientSystemCode().toLowerCase(Locale.ROOT)
String integrationSysCode = tool.clientSystemCode().toLowerCase(Locale.ROOT);
String sysCodePath = integrationSysCode.length() == 4 ? integrationSysCode.substring(0, 3) + "." + integrationSysCode.substring(3) : integrationSysCode;
String integrationPackage = BASE_PACKAGE + (mci ? ".infra.itrf.mci." + sysCodePath
: ".infra.itrf.http." + toPackageSegment(tool.httpApiName()));
String requestType = baseName + "Request";
String responseType = baseName + "Response";
@@ -371,7 +388,7 @@ public class ToolScaffolder {
useCase = addImport(useCase, "import " + bizPackage + ".dto." + responseType + ";") ;
boolean isMutation = isMutationTool(baseName);
ToolDefinitionOptions opts = tool.definitionOptions() == null ? new ToolDefinitionOptions(null, null, null, null, null, null, null, null) : tool.definitionOptions();
StringBuilder declBuilder = new StringBuilder("\n @McpTool(name = \"").append(toolName)
.append("\", title = \"").append(javaText(option(tool.title(), baseName)))
.append("\", description = \"").append(javaText(option(tool.description(), ""))).append("\")\n")
@@ -387,7 +404,7 @@ public class ToolScaffolder {
.append(" whenNotToUse = \"").append(javaText(opts.whenNotToUse() != null && !opts.whenNotToUse().isBlank() ? opts.whenNotToUse() : "정보 변경이나 실행 작업에는 사용하지 않습니다.")).append("\",\n")
.append(" ioLimits = \"").append(javaText(opts.ioLimits() != null && !opts.ioLimits().isBlank() ? opts.ioLimits() : "정의된 입력 항목만 허용하며 업무 결과만 반환합니다.")).append("\",\n")
.append(" displayDescription = \"").append(javaText(opts.displayDescription() != null && !opts.displayDescription().isBlank() ? opts.displayDescription() : option(tool.title(), baseName) + " 정보를 처리합니다.")).append("\",\n");
List<String> examples = opts.exampleQueries();
if (examples == null || examples.isEmpty()) {
examples = List.of(option(tool.title(), baseName) + " 정보를 보여줘", option(tool.title(), baseName) + " 확인해줘", "현재 " + option(tool.title(), baseName) + " 알려줘");
@@ -397,7 +414,7 @@ public class ToolScaffolder {
.append("},\n")
.append(" destructive = ").append(isMutation).append(",\n")
.append(" idempotent = ").append(!isMutation).append(",\n");
List<String> tags = opts.tags();
if (tags == null || tags.isEmpty()) {
tags = List.of(tool.group().toLowerCase(Locale.ROOT), isMutation ? "처리" : "조회");
@@ -408,7 +425,7 @@ public class ToolScaffolder {
.append(" ownerOrg = \"").append(javaText(opts.ownerOrg() != null && !opts.ownerOrg().isBlank() ? opts.ownerOrg() : "MCP_TOOL")).append("\"\n")
.append(" )\n")
.append(" ").append(responseType).append(" ").append(methodName).append("(").append(requestType).append(" req);\n");
String declaration = declBuilder.toString();
useCase = insertBeforeLastBrace(useCase, declaration);
@@ -645,7 +662,7 @@ public class ToolScaffolder {
Path mciClientDir = null;
if (isMci && clientSystemCode != null && clientSystemCode.length() == 4) {
String clientPrefix = clientSystemCode.toLowerCase();
String clientPrefix = clientSystemCode.length() == 4 ? clientSystemCode.substring(0,3).toLowerCase() + "/" + clientSystemCode.substring(3).toLowerCase() : clientSystemCode.toLowerCase();
clientPrefixCap = toPascalCase(clientSystemCode);
mciGroupPath = "infra/itrf/mci/" + clientPrefix;
mciClientDir = rootDir.resolve(Paths.get(moduleName, BASE_PACKAGE_PATH, mciGroupPath));
@@ -771,26 +788,26 @@ public class ToolScaffolder {
sb.append(" whenNotToUse = \"").append(javaText(definitionOptions.whenNotToUse() != null && !definitionOptions.whenNotToUse().isBlank() ? definitionOptions.whenNotToUse() : "정보 변경이나 실행 작업에는 사용하지 않습니다.")).append("\",\n");
sb.append(" ioLimits = \"").append(javaText(definitionOptions.ioLimits() != null && !definitionOptions.ioLimits().isBlank() ? definitionOptions.ioLimits() : "정의된 입력 항목만 허용하며 업무 결과만 반환합니다.")).append("\",\n");
sb.append(" displayDescription = \"").append(javaText(definitionOptions.displayDescription() != null && !definitionOptions.displayDescription().isBlank() ? definitionOptions.displayDescription() : title + " 정보를 처리합니다.")).append("\",\n");
List<String> examples = definitionOptions.exampleQueries();
if (examples == null || examples.isEmpty()) {
examples = List.of(title + " 정보를 보여줘", title + " 확인해줘", "현재 " + title + " 알려줘");
}
sb.append(" exampleQueries = {")
.append(examples.stream().map(q -> "\"" + javaText(q) + "\"").collect(Collectors.joining(", ")))
.append("},\n");
.append(examples.stream().map(q -> "\"" + javaText(q) + "\"").collect(Collectors.joining(", ")))
.append("},\n");
sb.append(" destructive = ").append(isMutation).append(",\n");
sb.append(" idempotent = ").append(!isMutation).append(",\n");
List<String> tags = definitionOptions.tags();
if (tags == null || tags.isEmpty()) {
tags = List.of(group.toLowerCase(Locale.ROOT), isMutation ? "처리" : "조회");
}
sb.append(" tags = {")
.append(tags.stream().map(t -> "\"" + javaText(t) + "\"").collect(Collectors.joining(", ")))
.append("},\n");
.append(tags.stream().map(t -> "\"" + javaText(t) + "\"").collect(Collectors.joining(", ")))
.append("},\n");
sb.append(" ownerOrg = \"").append(javaText(definitionOptions.ownerOrg() != null && !definitionOptions.ownerOrg().isBlank() ? definitionOptions.ownerOrg() : "MCP_TOOL")).append("\"\n");
sb.append(" )");
String toolHintLine = sb.toString();