diff --git a/axhub-common/src/main/java/io/shinhanlife/axhub/common/util/ToolScaffolder.java b/axhub-common/src/main/java/io/shinhanlife/axhub/common/util/ToolScaffolder.java index 6af8d89..e360cae 100644 --- a/axhub-common/src/main/java/io/shinhanlife/axhub/common/util/ToolScaffolder.java +++ b/axhub-common/src/main/java/io/shinhanlife/axhub/common/util/ToolScaffolder.java @@ -169,6 +169,8 @@ public class ToolScaffolder { import %s.annotation.McpTool; import %s.dto.%sReq; import %s.dto.%sRes; + import %s.%s.converter.%sLegacyConverter; + import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; /** @@ -186,12 +188,15 @@ public class ToolScaffolder { * */ @Service + @RequiredArgsConstructor @McpTool( routingType = "%s", categoryKey = "%s" ) public class %sService extends AbstractMcpToolService { + private final %sLegacyConverter converter; + @McpFunction( displayName = "%s 툴", name = "%s", @@ -202,19 +207,20 @@ public class ToolScaffolder { requiresApproval = false ) public Object execute(%sReq req) { - return executeLegacy("%s", "%s", req); + // %sLegacyReq legacyReq = converter.toLegacyReq(req); + return executeLegacy("%s", "%s", req); // Or pass legacyReq } } """.formatted( - BASE_PACKAGE, - BASE_PACKAGE, BASE_PACKAGE, BASE_PACKAGE, baseName, BASE_PACKAGE, baseName, + BASE_PACKAGE, shortName, baseName, + BASE_PACKAGE, baseName, BASE_PACKAGE, baseName, author, createDate, createDate, author, - routingType, group.toLowerCase(), baseName, + routingType, group.toLowerCase(), baseName, baseName, baseName, toolName, description, description + " 해줘.", interfaceId, register, - baseName, routingType, interfaceId + baseName, baseName, routingType, interfaceId ); Files.writeString(serviceDir.resolve(baseName + "Service.java"), serviceContent); @@ -304,8 +310,6 @@ public class ToolScaffolder { @Mapper(componentModel = "spring") public interface %sLegacyConverter { - %sLegacyConverter INSTANCE = Mappers.getMapper(%sLegacyConverter.class); - // @Mapping(source = "sourceField", target = "targetField") %sLegacyReq toLegacyReq(%sReq req); @@ -318,7 +322,7 @@ public class ToolScaffolder { BASE_PACKAGE, shortName, baseName, BASE_PACKAGE, shortName, baseName, BASE_PACKAGE, shortName, baseName, author, createDate, createDate, author, - baseName, baseName, baseName, baseName, baseName, baseName, baseName + baseName, baseName, baseName, baseName, baseName, baseName ); Files.writeString(converterDir.resolve(baseName + "LegacyConverter.java"), converterContent); diff --git a/axhub-tool-sms/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/sms/converter/SmsLegacyConverter.java b/axhub-tool-sms/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/sms/converter/SmsLegacyConverter.java index 88bea1e..bb7fac5 100644 --- a/axhub-tool-sms/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/sms/converter/SmsLegacyConverter.java +++ b/axhub-tool-sms/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/sms/converter/SmsLegacyConverter.java @@ -9,8 +9,6 @@ import org.mapstruct.factory.Mappers; @Mapper(componentModel = "spring") public interface SmsLegacyConverter { - SmsLegacyConverter INSTANCE = Mappers.getMapper(SmsLegacyConverter.class); - @Mapping(source = "phoneNumber", target = "phone") @Mapping(source = "message", target = "content") SmsLegacyReqDto toLegacyReq(SmsSendReq req); diff --git a/axhub-tool-sms/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/sms/service/SmsToolService.java b/axhub-tool-sms/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/sms/service/SmsToolService.java index 4608676..df807ff 100644 --- a/axhub-tool-sms/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/sms/service/SmsToolService.java +++ b/axhub-tool-sms/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/sms/service/SmsToolService.java @@ -6,6 +6,7 @@ import io.shinhanlife.axhub.biz.mcp.tool.dto.SmsSendReq; import io.shinhanlife.axhub.biz.mcp.tool.service.AbstractMcpToolService; import io.shinhanlife.axhub.biz.mcp.tool.sms.converter.SmsLegacyConverter; import io.shinhanlife.axhub.biz.mcp.tool.sms.dto.SmsLegacyReqDto; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import java.util.Map; @@ -25,15 +26,18 @@ import java.util.Map; * */ @Slf4j +@RequiredArgsConstructor @McpTool(routingType = "EAI", categoryKey = "notification") public class SmsToolService extends AbstractMcpToolService { + private final SmsLegacyConverter converter; + @McpFunction(displayName = "send_sms 툴", name = "send_sms", description = "SMS 발송", prompt = "고객에게 SMS 메시지를 발송해줘.", mappingId = "SMS_SEND_001") public Object sendSms(SmsSendReq req) { log.info("[SMS] SMS 발송 요청 수신. 수신자: {}", req.getPhoneNumber()); // MapStruct를 이용한 자동 매핑 (AI DTO -> MCI DTO) - SmsLegacyReqDto legacyReq = SmsLegacyConverter.INSTANCE.toLegacyReq(req); + SmsLegacyReqDto legacyReq = converter.toLegacyReq(req); // 레거시 시스템 연동 (EAI) - DTO 객체를 그대로 넘김 Map result = executeLegacy("EAI", "SMS_SEND_001", legacyReq); diff --git a/fix_bugs.py b/fix_bugs.py new file mode 100644 index 0000000..6c7a42d --- /dev/null +++ b/fix_bugs.py @@ -0,0 +1,39 @@ +import os +import re + +# 1. Fix catalog.html JS bug and error box colors +catalog_path = r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\catalog.html" +with open(catalog_path, "r", encoding="utf-8") as f: + catalog_html = f.read() + +# Remove totalCount reference since we removed the element +catalog_html = catalog_html.replace("document.getElementById('totalCount').textContent = Total: ;", "") + +# Fix the error box colors to be dark-theme compatible +catalog_html = catalog_html.replace("border-red-200 bg-red-50 text-red-600", "border-red-900 bg-red-950/30 text-red-400") +with open(catalog_path, "w", encoding="utf-8") as f: + f.write(catalog_html) + +# 2. Fix input field visibility in scaffold.html and playground.html +files = [ + r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\admin\scaffold.html", + r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\playground.html" +] + +for fp in files: + if not os.path.exists(fp): + continue + with open(fp, "r", encoding="utf-8") as f: + content = f.read() + + # Enhance input-base visibility + content = content.replace("border: 1px solid rgba(255,255,255,0.1);", "border: 1px solid rgba(255,255,255,0.25);\n background-color: rgba(255,255,255,0.05);") + content = content.replace("background-color: #18181b;", "") # remove old background + + # In playground.html, also enhance select Tool and textarea + # We already updated .input-base, which applies to textarea and select. + + with open(fp, "w", encoding="utf-8") as f: + f.write(content) + +print("Bugs and visibility fixed.") diff --git a/fix_links.py b/fix_links.py new file mode 100644 index 0000000..3059f23 --- /dev/null +++ b/fix_links.py @@ -0,0 +1,23 @@ +import os + +files_to_patch = [ + r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\admin\scaffold.html", + r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\catalog.html", + r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\playground.html" +] + +for file_path in files_to_patch: + if not os.path.exists(file_path): + continue + with open(file_path, "r", encoding="utf-8") as f: + content = f.read() + + # Fix the links + content = content.replace('href="/admin/catalog.html"', 'href="/catalog.html"') + content = content.replace('href="/admin/playground.html"', 'href="/playground.html"') + content = content.replace('href="/admin/scaffold.html"', 'href="/admin/scaffold.html"') # Keep scaffold as /admin/scaffold.html + + with open(file_path, "w", encoding="utf-8") as f: + f.write(content) + +print("Links fixed.") diff --git a/patch_colors.py b/patch_colors.py new file mode 100644 index 0000000..9e4de04 --- /dev/null +++ b/patch_colors.py @@ -0,0 +1,37 @@ +import os +import re + +files_to_patch = [ + r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\admin\scaffold.html", + r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\catalog.html", + r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\playground.html" +] + +for file_path in files_to_patch: + if not os.path.exists(file_path): + continue + with open(file_path, "r", encoding="utf-8") as f: + content = f.read() + + # Change background and foreground colors in tailwind config + content = content.replace("background: '#ffffff',", "background: '#f8fafc',") + content = content.replace("foreground: '#000000',", "foreground: '#0f172a',") + + # Add primary colors to tailwind config + if "primaryHover: '#4338ca'," not in content: + content = content.replace("border: '#e2e8f0',", "border: '#e2e8f0',\n primary: '#4f46e5',\n primaryHover: '#4338ca',") + + # Change btn-black to use primary color (indigo) instead of pure black for primary actions + # In scaffold.html, btn-black is used for the generate button. Let's make it btn-primary. + content = content.replace(".btn-black {", ".btn-black {\n background-color: theme('colors.primary');") + content = content.replace("background-color: #000000;", "") + content = content.replace(".btn-black:hover {\n background-color: #333333;\n }", ".btn-black:hover {\n background-color: theme('colors.primaryHover');\n }") + + # Change btn-black references to btn-primary + content = content.replace("btn-black", "btn-primary") + content = content.replace(".btn-primary {", ".btn-primary {\n color: #ffffff;\n font-weight: 500;\n padding: 0.5rem 1rem;\n border-radius: 4px;\n font-size: 0.875rem;\n transition: background-color 0.15s;\n }") + + with open(file_path, "w", encoding="utf-8") as f: + f.write(content) + +print("Patch applied.") diff --git a/patch_dark_theme.py b/patch_dark_theme.py new file mode 100644 index 0000000..c991df0 --- /dev/null +++ b/patch_dark_theme.py @@ -0,0 +1,178 @@ +import os +import re + +files = [ + r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\admin\scaffold.html", + r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\catalog.html", + r"C:\Users\Admin\.gemini\antigravity\scratch\axhub-backend-main\axhub-gateway\src\main\resources\static\playground.html" +] + +tailwind_and_style = """ + """ + +for fp in files: + if not os.path.exists(fp): + continue + with open(fp, "r", encoding="utf-8") as f: + content = f.read() + + # 1. Replace tailwind config and style + content = re.sub(r'