feat: add AI manifest generation to pod scaffold
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 1m6s
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 1m6s
This commit is contained in:
@@ -50,11 +50,24 @@ public class PodScaffolder {
|
||||
envSourceDir = System.getenv("AXHUB_SOURCE_DIR");
|
||||
}
|
||||
Path rootDir = envSourceDir != null ? Paths.get(envSourceDir) : Paths.get(".");
|
||||
return scaffoldPod(rootDir, moduleName, portStr, shortName, author, createDate);
|
||||
return scaffoldPod(rootDir, moduleName, portStr, shortName, author, createDate, null);
|
||||
}
|
||||
|
||||
public static String scaffoldPod(String moduleName, String portStr, String shortName, String author,
|
||||
String createDate, String toolServiceManifest) throws IOException {
|
||||
String envSourceDir = System.getProperty("AXHUB_SOURCE_DIR");
|
||||
if (envSourceDir == null || envSourceDir.isBlank()) envSourceDir = System.getenv("AXHUB_SOURCE_DIR");
|
||||
Path rootDir = envSourceDir != null ? Paths.get(envSourceDir) : Paths.get(".");
|
||||
return scaffoldPod(rootDir, moduleName, portStr, shortName, author, createDate, toolServiceManifest);
|
||||
}
|
||||
|
||||
static String scaffoldPod(Path rootDir, String moduleName, String portStr, String shortName,
|
||||
String author, String createDate) throws IOException {
|
||||
return scaffoldPod(rootDir, moduleName, portStr, shortName, author, createDate, null);
|
||||
}
|
||||
|
||||
static String scaffoldPod(Path rootDir, String moduleName, String portStr, String shortName,
|
||||
String author, String createDate, String toolServiceManifest) throws IOException {
|
||||
Path modulePath = rootDir.resolve(Paths.get(moduleName));
|
||||
if (Files.exists(modulePath)) {
|
||||
return "[오류] 이미 존재하는 모듈입니다: " + moduleName;
|
||||
@@ -135,6 +148,8 @@ public class PodScaffolder {
|
||||
spring:
|
||||
application:
|
||||
name: %s
|
||||
config:
|
||||
import: optional:classpath:tool-service-manifest.yml
|
||||
profiles:
|
||||
active: local
|
||||
logging:
|
||||
@@ -151,6 +166,9 @@ public class PodScaffolder {
|
||||
TESTER-DEV: ALL
|
||||
""".formatted(portStr, moduleName, moduleName.replace("dap-", ""));
|
||||
writeUtf8(resPath.resolve("application.yml"), applicationYml);
|
||||
String manifest = toolServiceManifest == null || toolServiceManifest.isBlank()
|
||||
? defaultToolServiceManifest(moduleName) : toolServiceManifest.trim() + System.lineSeparator();
|
||||
writeUtf8(resPath.resolve("tool-service-manifest.yml"), manifest);
|
||||
|
||||
String applicationLocalYml = """
|
||||
# Local 환경 전용 설정 (H2 메모리 DB 등)
|
||||
@@ -368,6 +386,28 @@ public class PodScaffolder {
|
||||
Files.writeString(path, content, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
private static String defaultToolServiceManifest(String moduleName) {
|
||||
String key = moduleName.replace("dat-was-", "");
|
||||
return """
|
||||
mcp:
|
||||
manifest:
|
||||
routing-functions:
|
||||
- name: route_to_%s
|
||||
description: %s 업무 서버로 요청을 라우팅합니다.
|
||||
server-id: %s
|
||||
category-key: %s
|
||||
product-boundary: insurance
|
||||
business-domain: %s 업무
|
||||
business-outcome: %s 관련 업무를 처리합니다.
|
||||
primary-entities: []
|
||||
capabilities: []
|
||||
select-if: %s 관련 요청인 경우
|
||||
reject-if: 다른 업무 영역이 주된 요청인 경우
|
||||
confidence-server-ids: [%s]
|
||||
decision-policy: 요청의 주요 업무 영역을 기준으로 서버를 선택합니다.
|
||||
""".formatted(moduleName.replace("-", "_"), key, moduleName, key, key, key, key, moduleName);
|
||||
}
|
||||
|
||||
private static String capitalize(String str) {
|
||||
if (str == null || str.isEmpty()) return str;
|
||||
return str.substring(0, 1).toUpperCase() + str.substring(1);
|
||||
|
||||
Reference in New Issue
Block a user