fix: align tool module handling with dap-was naming
All checks were successful
Deploy to OCIWP / deploy (push) Successful in 1m55s

This commit is contained in:
jade
2026-08-05 13:44:35 +09:00
parent ae8cc38bcf
commit 3a86a8e0c7
9 changed files with 242 additions and 563 deletions

View File

@@ -18,10 +18,10 @@ public class PodScaffolder {
System.out.println(" MCP Tool Pod Scaffolder (Java CLI) ");
System.out.println("=========================================\n");
String rawModuleName = getOrAsk(args, 0, scanner, "1. 생성할 모듈(Pod) 이름 (예: payment 또는 dap-tool-payment): ");
String moduleName = rawModuleName.startsWith("dap-tool-") ? rawModuleName : "dap-tool-" + rawModuleName;
String rawModuleName = getOrAsk(args, 0, scanner, "1. 생성할 모듈(Pod) 이름 (예: payment 또는 dap-was-payment): ");
String moduleName = rawModuleName.startsWith("dap-was-") ? rawModuleName : "dap-was-" + rawModuleName;
String portStr = getOrAsk(args, 1, scanner, "2. 사용할 포트 번호 (예: 8085): ");
String shortName = moduleName.replace("dap-tool-", "").replace("-", "");
String shortName = moduleName.replace("dap-was-", "").replace("-", "");
String defaultAuthor = System.getProperty("user.name");
String defaultDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy.MM.dd"));

View File

@@ -673,8 +673,9 @@ public class ToolScaffolder {
}
private static String toToolName(String moduleName, String group, String baseName) {
String pod = moduleName.startsWith("dap-tool-")
? moduleName.substring("dap-tool-".length())
String moduleDirectory = Path.of(moduleName).getFileName().toString();
String pod = moduleDirectory.startsWith("dap-was-")
? moduleDirectory.substring("dap-was-".length())
: "oth";
String normalizedName = baseName.replaceAll("([a-z0-9])([A-Z])", "$1 $2")
.toLowerCase(Locale.ROOT)

View File

@@ -28,7 +28,7 @@ import java.util.stream.Stream;
public class ToolSourceUpdater {
public static void updateToolSource(String toolName, String domainGroup, String description, boolean register, Boolean requiresApproval) throws Exception {
// 1. Find all *UseCase.java files in dap-tool-* directories
// 1. Find all *UseCase.java files in dap-was-* directories
String envSourceDir = System.getenv("AXHUB_SOURCE_DIR");
Path rootDir = envSourceDir != null ? Paths.get(envSourceDir) : Paths.get(".");
@@ -37,7 +37,7 @@ public class ToolSourceUpdater {
javaFiles = paths
.filter(Files::isRegularFile)
.filter(p -> p.toString().endsWith("UseCase.java"))
.filter(p -> p.toString().contains("dap-tool-") || p.toString().contains("axhub-tool-"))
.filter(p -> p.toString().contains("dap-was-") || p.toString().contains("axhub-tool-"))
.collect(Collectors.toList());
}

View File

@@ -38,7 +38,7 @@ public final class McpToolNameValidator {
try (var modules = Files.list(projectRoot)) {
modules.filter(Files::isDirectory)
.filter(path -> path.getFileName().toString().startsWith("dap-tool-"))
.filter(path -> path.getFileName().toString().startsWith("dap-was-"))
.filter(path -> !path.getFileName().toString().equals("dap-was-lib"))
.sorted()
.forEach(module -> collectDeclarations(module, declarationsByName));

View File

@@ -25,4 +25,17 @@ class ToolScaffolderTest {
assertTrue(response.contains("@McpOutputSchema"));
assertTrue(response.contains("@McpValidation"));
}
@Test
void usesWasModuleNameAsToolPodPrefix() throws Exception {
String moduleName = "build/dap-was-sms";
ToolScaffolder.scaffold("notification send", "SMS0001", "SMS 발송", "cmm", "HTTP", moduleName,
"tester", "2026.08.05", true, null);
Path useCasePath = Path.of(moduleName,
"src/main/java/io/shinhanlife/dap/mcc/biz/cmm/usecase/NotificationSendUseCase.java");
String useCase = Files.readString(useCasePath);
assertTrue(useCase.contains("name = \"sms.cmm.notification.send\""));
}
}

View File

@@ -31,21 +31,21 @@ class McpToolNameValidatorTest {
@Test
void rejectsDuplicateMcpFunctionNamesAcrossToolModules() throws IOException {
writeToolSource("dap-tool-first", "FirstTool.java", "first", "oth.sms.notification.send");
writeToolSource("dap-tool-second", "SecondTool.java", "second", "oth.sms.notification.send");
writeToolSource("dap-was-first", "FirstTool.java", "first", "oth.sms.notification.send");
writeToolSource("dap-was-second", "SecondTool.java", "second", "oth.sms.notification.send");
IllegalStateException exception = assertThrows(IllegalStateException.class,
() -> McpToolNameValidator.assertUnique(temporaryRoot));
assertTrue(exception.getMessage().contains("oth.sms.notification.send"));
assertTrue(exception.getMessage().contains("dap-tool-first"));
assertTrue(exception.getMessage().contains("dap-tool-second"));
assertTrue(exception.getMessage().contains("dap-was-first"));
assertTrue(exception.getMessage().contains("dap-was-second"));
}
@Test
void validationRunnerRejectsDuplicateMcpFunctionNamesBeforePackaging() throws IOException {
writeToolSource("dap-tool-first", "FirstTool.java", "first", "oth.sms.notification.send");
writeToolSource("dap-tool-second", "SecondTool.java", "second", "oth.sms.notification.send");
writeToolSource("dap-was-first", "FirstTool.java", "first", "oth.sms.notification.send");
writeToolSource("dap-was-second", "SecondTool.java", "second", "oth.sms.notification.send");
assertThrows(IllegalStateException.class,
() -> McpToolNameValidationRunner.validate(temporaryRoot));
@@ -53,7 +53,7 @@ class McpToolNameValidatorTest {
@Test
void rejectsToolNameOutsidePodDomainServiceActionConvention() throws IOException {
writeToolSource("dap-tool-first", "FirstTool.java", "first", "bond_issue");
writeToolSource("dap-was-first", "FirstTool.java", "first", "bond_issue");
IllegalStateException exception = assertThrows(IllegalStateException.class,
() -> McpToolNameValidator.assertUnique(temporaryRoot));