feat: register generated apps with agent harness
This commit is contained in:
14
src/args.ts
14
src/args.ts
@@ -1,5 +1,5 @@
|
||||
import path from "node:path";
|
||||
import type { ParsedArguments, ProjectType } from "./types.js";
|
||||
import type { AgentRegistration, ParsedArguments, ProjectType } from "./types.js";
|
||||
|
||||
const requireValue = (args: string[], index: number, option: string): string => {
|
||||
const value = args[index + 1];
|
||||
@@ -18,6 +18,11 @@ export const parseProjectType = (value: string): ProjectType => {
|
||||
);
|
||||
};
|
||||
|
||||
export const parseAgentRegistration = (value: string): AgentRegistration => {
|
||||
if (value === "shared" || value === "local") return value;
|
||||
throw new Error("--agent-registration은 shared 또는 local이어야 합니다.");
|
||||
};
|
||||
|
||||
export function parseArguments(argv: string[]): ParsedArguments {
|
||||
const parsed: ParsedArguments = {
|
||||
yes: false,
|
||||
@@ -25,6 +30,7 @@ export function parseArguments(argv: string[]): ParsedArguments {
|
||||
installUi: true,
|
||||
build: true,
|
||||
jenkins: true,
|
||||
agentRegistration: "shared",
|
||||
skipAgentCompose: false,
|
||||
force: false,
|
||||
help: false,
|
||||
@@ -80,6 +86,10 @@ export function parseArguments(argv: string[]): ParsedArguments {
|
||||
parsed.harnessRoot = path.resolve(requireValue(argv, index, arg));
|
||||
index += 1;
|
||||
break;
|
||||
case "--agent-registration":
|
||||
parsed.agentRegistration = parseAgentRegistration(requireValue(argv, index, arg));
|
||||
index += 1;
|
||||
break;
|
||||
case "--target-dir":
|
||||
parsed.targetDir = path.resolve(requireValue(argv, index, arg));
|
||||
index += 1;
|
||||
@@ -140,6 +150,8 @@ export function printHelp(): void {
|
||||
--project-type <type> requested-project|internal-service|shared-service
|
||||
--agent-project-id <id> 하네스 프로젝트 ID (기본: 프로젝트명 slug)
|
||||
--harness-root <path> 중앙 Agent Harness 저장소 경로
|
||||
--agent-registration <shared|local>
|
||||
중앙 등록 범위 (기본 shared)
|
||||
--port <number> 개발/실행 포트 (기본 4000)
|
||||
--repo-url <url> Gitea 저장소 URL
|
||||
--app-root <path> Ubuntu 배포 경로
|
||||
|
||||
@@ -101,6 +101,7 @@ async function resolveOptions(): Promise<CliOptions> {
|
||||
build: parsed.build,
|
||||
jenkins,
|
||||
harnessRoot: parsed.harnessRoot,
|
||||
agentRegistration: parsed.agentRegistration,
|
||||
skipAgentCompose: parsed.skipAgentCompose,
|
||||
force: parsed.force,
|
||||
};
|
||||
|
||||
@@ -10,6 +10,7 @@ interface HarnessOptions {
|
||||
targetDir: string;
|
||||
agentProjectId: string;
|
||||
harnessRoot?: string;
|
||||
agentRegistration: "shared" | "local";
|
||||
skipAgentCompose: boolean;
|
||||
}
|
||||
|
||||
@@ -102,14 +103,16 @@ export async function composeAgentHarness(options: HarnessOptions): Promise<void
|
||||
}
|
||||
|
||||
const projectPath = workspaceRelativePath(harnessRoot, options.targetDir);
|
||||
console.log("\n[Agent Harness] 로컬 등록·합성·검증");
|
||||
await runHarness(harnessRoot, [
|
||||
console.log(`\n[Agent Harness] ${options.agentRegistration} 등록·합성·검증`);
|
||||
const registerArgs = [
|
||||
"register",
|
||||
"--project",
|
||||
options.agentProjectId,
|
||||
"--path",
|
||||
projectPath,
|
||||
]);
|
||||
];
|
||||
if (options.agentRegistration === "shared") registerArgs.push("--shared");
|
||||
await runHarness(harnessRoot, registerArgs);
|
||||
await runHarness(harnessRoot, ["compose", "--project", options.agentProjectId]);
|
||||
await runHarness(harnessRoot, ["verify", "--project", options.agentProjectId]);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export type ProjectType = "requested-project" | "internal-service" | "shared-service";
|
||||
export type AgentRegistration = "shared" | "local";
|
||||
|
||||
export interface CliOptions {
|
||||
projectName: string;
|
||||
@@ -19,6 +20,7 @@ export interface CliOptions {
|
||||
build: boolean;
|
||||
jenkins: boolean;
|
||||
harnessRoot?: string;
|
||||
agentRegistration: AgentRegistration;
|
||||
skipAgentCompose: boolean;
|
||||
force: boolean;
|
||||
}
|
||||
@@ -42,6 +44,7 @@ export interface ParsedArguments {
|
||||
build: boolean;
|
||||
jenkins: boolean;
|
||||
harnessRoot?: string;
|
||||
agentRegistration: AgentRegistration;
|
||||
skipAgentCompose: boolean;
|
||||
force: boolean;
|
||||
help: boolean;
|
||||
|
||||
Reference in New Issue
Block a user