@mcpeak/cli 0.12.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,14 @@
1
- import { AuthoringExecutionSnapshot, AuthoringSessionView, BaselineGenerationResult, FixtureFile, PreFillProvider } from "@mcpeak/generate";
2
1
  import { SuiteValidationResult, TestSuiteSpec } from "@mcpeak/runner";
3
- import { McpHttpConnection, McpStdioConnection, ToolDef } from "@mcpeak/core";
2
+ import { AdvertiseOptions, HttpConnectOptions, McpHttpConnection, McpServerInfo, McpServerSurface, McpStdioConnection, ToolDef } from "@mcpeak/core";
3
+ import { AuthoringExecutionSnapshot, AuthoringSessionView, BaselineGenerationResult, FixtureFile, PreFillProvider } from "@mcpeak/generate";
4
+ import { ProbePolicy, SandboxBackend } from "@mcpeak/audit";
5
+ //#region src/audit-sandbox-target.d.ts
6
+ interface SandboxTargetFs {
7
+ /** 경로가 가리키는 것. 없거나 볼 수 없으면 undefined 다. 던지지 않는다. */
8
+ stat(path: string): Promise<"file" | "directory" | undefined>;
9
+ readFile(path: string): Promise<string>;
10
+ }
11
+ //#endregion
4
12
  //#region src/connect-target.d.ts
5
13
  /** 파서가 확정한 연결 대상. */
6
14
  type ConnectTarget = {
@@ -24,6 +32,78 @@ type ConnectTarget = {
24
32
  readonly headerEnv: Readonly<Record<string, string>>;
25
33
  };
26
34
  //#endregion
35
+ //#region src/audit-command.d.ts
36
+ /** `--sandbox` 와 그 하위 옵션. 경로는 사용자가 쓴 글자 그대로다. 실행할 때 푼다. */
37
+ interface AuditSandboxInput {
38
+ readonly session?: {
39
+ readonly mode: "record" | "replay";
40
+ readonly path: string;
41
+ };
42
+ /** `--allow-host` 값. 준 순서 그대로다. */
43
+ readonly allowHosts: readonly string[];
44
+ readonly compareHost: boolean;
45
+ /** `--sandbox-mount` 값. */
46
+ readonly mountPath?: string;
47
+ }
48
+ interface AuditCommandInput {
49
+ readonly target: ConnectTarget;
50
+ /** 격리가 켜지지 않은 실행의 호출 정책. 사용자가 주지 않았으면 `readonly` 다. */
51
+ readonly probe: ProbePolicy;
52
+ /**
53
+ * 사용자가 `--probe` 를 직접 주었는가. 격리가 실제로 켜진 실행은 주지 않았을 때만 `all` 로 돈다
54
+ * (ADR-0107). 준 값은 어느 쪽에서도 그대로다.
55
+ */
56
+ readonly probeExplicit: boolean;
57
+ readonly baselinePath?: string;
58
+ readonly updateBaseline: boolean;
59
+ readonly json: boolean;
60
+ /** `--sandbox` 를 준 실행에만 있다. */
61
+ readonly sandbox?: AuditSandboxInput;
62
+ }
63
+ /** `--sandbox` 실행에만 쓰는 의존성. 호스트의 파일 시스템과 Docker 를 만지는 유일한 통로다. */
64
+ interface AuditSandboxDependencies {
65
+ /**
66
+ * 격리 백엔드를 만든다. `--sandbox` 를 준 실행에서만 불린다. `progress` 는 백엔드의 진행 문장
67
+ * (이미지를 처음 만들 때의 한 줄)을 받는다.
68
+ */
69
+ createBackend(progress: (line: string) => void): SandboxBackend;
70
+ stat: SandboxTargetFs["stat"];
71
+ /** 서버 인자의 상대 경로를 푸는 기준이자 서버의 작업 디렉터리. */
72
+ readonly cwd: string;
73
+ /** 사용자 홈 디렉터리. 마운트 범위가 이것이면 거절한다. */
74
+ readonly home: string;
75
+ }
76
+ /** 감사가 쓰는 연결. core 의 connectStdio·connectHttp 반환이 이 꼴이다. */
77
+ type StdioAuditConnection = McpStdioConnection & McpServerInfo & McpServerSurface;
78
+ type HttpAuditConnection = McpHttpConnection & McpServerInfo & McpServerSurface;
79
+ interface AuditCommandDependencies {
80
+ connectStdio(options: {
81
+ command: string;
82
+ args: readonly string[];
83
+ env?: Readonly<Record<string, string>>;
84
+ advertise?: AdvertiseOptions;
85
+ connectTimeoutMs?: number;
86
+ }): Promise<StdioAuditConnection>;
87
+ connectHttp(options: HttpConnectOptions): Promise<HttpAuditConnection>;
88
+ /** `--env`·`--header-env` 가 가리키는 환경변수를 읽는 유일한 지점이다. */
89
+ readEnv(name: string): string | undefined;
90
+ /** 기준 파일을 읽는다. 없으면 `code: "ENOENT"` 인 오류를 던진다(node:fs 그대로). */
91
+ readFile(path: string): Promise<string>;
92
+ writeFile(path: string, text: string): Promise<void>;
93
+ readonly audit: typeof import("@mcpeak/audit").audit;
94
+ readonly renderReport: typeof import("@mcpeak/audit").renderReport;
95
+ /** 리포트의 `generator.version`. `@mcpeak/audit` 의 패키지 버전이다. */
96
+ readonly generatorVersion: string;
97
+ writeStdout(text: string): void;
98
+ writeStderr(text: string): void;
99
+ readonly fetch: typeof globalThis.fetch;
100
+ /** 카나리 값 하나. 16자 소문자 hex 이고 호출마다 다르다. */
101
+ random(): string;
102
+ readonly sandbox: AuditSandboxDependencies;
103
+ }
104
+ declare function parseAuditCommand(argv: readonly string[]): AuditCommandInput;
105
+ declare function runAuditCommand(argv: readonly string[], deps: AuditCommandDependencies): Promise<number>;
106
+ //#endregion
27
107
  //#region src/reset-hook.d.ts
28
108
  /**
29
109
  * 초기화가 실제로 무엇을 했는가. `--reset-cmd` 가 0 으로 끝난 것을 "초기 상태" 라고
@@ -194,6 +274,35 @@ declare function runGenerateCommand(argv: readonly string[], deps: GenerateComma
194
274
  declare const nodeGenerateDependencies: () => Omit<GenerateCommandDependencies, "connect" | "createBaselineSuite" | "createAuthoringSession" | "finalizeAuthoringDraft" | "getAuthoringExecutionSuite" | "validateSuite">;
195
275
  declare function nodeReviewIO(input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream): ReviewIO;
196
276
  //#endregion
277
+ //#region src/optimize-command.d.ts
278
+ interface OptimizeCommandInput {
279
+ readonly outPath: string;
280
+ readonly target: ConnectTarget;
281
+ readonly json: boolean;
282
+ }
283
+ interface OptimizeCommandDependencies {
284
+ /**
285
+ * 반환에 `McpServerInfo` 가 실려 있어야 한다. `instructions` 와 광고한 능력 키가 오버레이의
286
+ * 입력이기 때문이다. `core.connectStdio` 가 그 모양이다.
287
+ */
288
+ connectStdio(options: {
289
+ command: string;
290
+ args: readonly string[];
291
+ env?: Readonly<Record<string, string>>;
292
+ }): Promise<McpStdioConnection & McpServerInfo>;
293
+ connectHttp?(options: HttpConnectOptions): Promise<McpHttpConnection & McpServerInfo>;
294
+ readEnv?(name: string): string | undefined;
295
+ readonly optimize: typeof import("@mcpeak/optimize").optimize;
296
+ readonly renderReport: typeof import("@mcpeak/optimize").renderReport;
297
+ /** 오버레이의 `generator.version`. `@mcpeak/optimize` 의 패키지 버전이다. */
298
+ readonly generatorVersion: string;
299
+ writeFile(path: string, text: string): Promise<void>;
300
+ writeStdout(text: string): void;
301
+ writeStderr(text: string): void;
302
+ }
303
+ declare function parseOptimizeCommand(argv: readonly string[]): OptimizeCommandInput;
304
+ declare function runOptimizeCommand(argv: readonly string[], deps: OptimizeCommandDependencies): Promise<number>;
305
+ //#endregion
197
306
  //#region src/repair-command.d.ts
198
307
  interface RepairCommandInput {
199
308
  readonly bundlePath: string;
@@ -225,4 +334,39 @@ interface RepairCommandDependencies {
225
334
  declare function parseRepairCommand(argv: readonly string[]): RepairCommandInput;
226
335
  declare function runRepairCommand(argv: readonly string[], deps: RepairCommandDependencies): Promise<number>;
227
336
  //#endregion
228
- export { GenerateCommandDependencies as a, ReviewIO as c, runGenerateCommand as d, ConnectTarget as f, runRepairCommand as i, nodeGenerateDependencies as l, RepairCommandInput as n, GenerateCommandInput as o, parseRepairCommand as r, REVIEW_BACK_VALUE as s, RepairCommandDependencies as t, nodeReviewIO as u };
337
+ //#region src/index.d.ts
338
+ type Command = (argv: string[]) => Promise<number>;
339
+ declare const COMMANDS: readonly ["test", "generate", "repair", "record", "mock", "optimize", "audit"];
340
+ /**
341
+ * `repair` 실행 의존성. 함수로 빼 둔 이유는 **주입 자체를 테스트가 단언할 수 있게** 하기
342
+ * 위해서다. 분기 안에 리터럴로 두면 `reviewIO` 를 빠뜨려도 아무 테스트도 안 깨진다.
343
+ * 실제로 그렇게 한 번 빠뜨렸다(T10 보고서).
344
+ *
345
+ * 대화형 판정은 `generate` 와 같은 기준이다. 같은 `nodeReviewIO()` 를 쓰고, 그 구현이
346
+ * stdin·stdout 이 둘 다 TTY 일 때만 `interactive` 를 참으로 만든다.
347
+ */
348
+ declare function nodeRepairDependencies(generate: typeof import("@mcpeak/generate")): RepairCommandDependencies;
349
+ /**
350
+ * `optimize` 실행 의존성. `nodeRepairDependencies` 와 같은 이유로 함수로 뺀다. 주입 자체를
351
+ * 테스트가 단언할 수 있어야 `connectHttp` 나 `readEnv` 를 빠뜨린 배선이 초록으로 남지 않는다.
352
+ *
353
+ * `generatorVersion` 은 오버레이의 `generator` 가 `@mcpeak/optimize` 이므로 그 패키지의 버전이다.
354
+ * 그 패키지의 `exports` 가 `package.json` 을 열지 않아 상대 경로로 읽는다. 빌드가 값으로 싣고,
355
+ * 릴리스는 `changeset version` 뒤에 빌드하므로 발행되는 두 패키지의 버전이 맞는다.
356
+ */
357
+ declare function nodeOptimizeDependencies(core: typeof import("@mcpeak/core"), optimize: typeof import("@mcpeak/optimize")): OptimizeCommandDependencies;
358
+ /**
359
+ * `audit` 실행 의존성. `nodeOptimizeDependencies` 와 같은 이유로 함수로 뺀다. 주입 자체를 테스트가
360
+ * 단언할 수 있어야 `connectHttp`·`readEnv`·`fetch` 를 빠뜨린 배선이 초록으로 남지 않는다.
361
+ *
362
+ * `random` 은 카나리 값이다. 출력에 쓰지 않으므로 무작위여도 `--json` 의 바이트 결정론을 깨지
363
+ * 않는다. 서버가 값을 예측해 숨길 수 없게 암호학적 난수를 쓴다. `generatorVersion` 은 리포트의
364
+ * `generator` 가 `@mcpeak/audit` 이므로 그 패키지의 버전이고, 읽는 방식은 optimize 와 같다.
365
+ *
366
+ * `sandbox.createBackend` 는 `--sandbox` 를 준 실행에서만 불린다. 그 밖의 실행은 Docker 를 찾지도
367
+ * 부르지도 않는다.
368
+ */
369
+ declare function nodeAuditDependencies(core: typeof import("@mcpeak/core"), audit: typeof import("@mcpeak/audit")): AuditCommandDependencies;
370
+ declare function run(argv: string[]): Promise<number>;
371
+ //#endregion
372
+ export { AuditCommandInput as C, ConnectTarget as E, AuditCommandDependencies as S, runAuditCommand as T, REVIEW_BACK_VALUE as _, nodeRepairDependencies as a, nodeReviewIO as b, RepairCommandInput as c, OptimizeCommandDependencies as d, OptimizeCommandInput as f, GenerateCommandInput as g, GenerateCommandDependencies as h, nodeOptimizeDependencies as i, parseRepairCommand as l, runOptimizeCommand as m, Command as n, run as o, parseOptimizeCommand as p, nodeAuditDependencies as r, RepairCommandDependencies as s, COMMANDS as t, runRepairCommand as u, ReviewIO as v, parseAuditCommand as w, runGenerateCommand as x, nodeGenerateDependencies as y };
@@ -1,6 +1,14 @@
1
- import { McpHttpConnection, McpStdioConnection, ToolDef } from "@mcpeak/core";
1
+ import { ProbePolicy, SandboxBackend } from "@mcpeak/audit";
2
+ import { AdvertiseOptions, HttpConnectOptions, McpHttpConnection, McpServerInfo, McpServerSurface, McpStdioConnection, ToolDef } from "@mcpeak/core";
2
3
  import { AuthoringExecutionSnapshot, AuthoringSessionView, BaselineGenerationResult, FixtureFile, PreFillProvider } from "@mcpeak/generate";
3
4
  import { SuiteValidationResult, TestSuiteSpec } from "@mcpeak/runner";
5
+ //#region src/audit-sandbox-target.d.ts
6
+ interface SandboxTargetFs {
7
+ /** 경로가 가리키는 것. 없거나 볼 수 없으면 undefined 다. 던지지 않는다. */
8
+ stat(path: string): Promise<"file" | "directory" | undefined>;
9
+ readFile(path: string): Promise<string>;
10
+ }
11
+ //#endregion
4
12
  //#region src/connect-target.d.ts
5
13
  /** 파서가 확정한 연결 대상. */
6
14
  type ConnectTarget = {
@@ -24,6 +32,78 @@ type ConnectTarget = {
24
32
  readonly headerEnv: Readonly<Record<string, string>>;
25
33
  };
26
34
  //#endregion
35
+ //#region src/audit-command.d.ts
36
+ /** `--sandbox` 와 그 하위 옵션. 경로는 사용자가 쓴 글자 그대로다. 실행할 때 푼다. */
37
+ interface AuditSandboxInput {
38
+ readonly session?: {
39
+ readonly mode: "record" | "replay";
40
+ readonly path: string;
41
+ };
42
+ /** `--allow-host` 값. 준 순서 그대로다. */
43
+ readonly allowHosts: readonly string[];
44
+ readonly compareHost: boolean;
45
+ /** `--sandbox-mount` 값. */
46
+ readonly mountPath?: string;
47
+ }
48
+ interface AuditCommandInput {
49
+ readonly target: ConnectTarget;
50
+ /** 격리가 켜지지 않은 실행의 호출 정책. 사용자가 주지 않았으면 `readonly` 다. */
51
+ readonly probe: ProbePolicy;
52
+ /**
53
+ * 사용자가 `--probe` 를 직접 주었는가. 격리가 실제로 켜진 실행은 주지 않았을 때만 `all` 로 돈다
54
+ * (ADR-0107). 준 값은 어느 쪽에서도 그대로다.
55
+ */
56
+ readonly probeExplicit: boolean;
57
+ readonly baselinePath?: string;
58
+ readonly updateBaseline: boolean;
59
+ readonly json: boolean;
60
+ /** `--sandbox` 를 준 실행에만 있다. */
61
+ readonly sandbox?: AuditSandboxInput;
62
+ }
63
+ /** `--sandbox` 실행에만 쓰는 의존성. 호스트의 파일 시스템과 Docker 를 만지는 유일한 통로다. */
64
+ interface AuditSandboxDependencies {
65
+ /**
66
+ * 격리 백엔드를 만든다. `--sandbox` 를 준 실행에서만 불린다. `progress` 는 백엔드의 진행 문장
67
+ * (이미지를 처음 만들 때의 한 줄)을 받는다.
68
+ */
69
+ createBackend(progress: (line: string) => void): SandboxBackend;
70
+ stat: SandboxTargetFs["stat"];
71
+ /** 서버 인자의 상대 경로를 푸는 기준이자 서버의 작업 디렉터리. */
72
+ readonly cwd: string;
73
+ /** 사용자 홈 디렉터리. 마운트 범위가 이것이면 거절한다. */
74
+ readonly home: string;
75
+ }
76
+ /** 감사가 쓰는 연결. core 의 connectStdio·connectHttp 반환이 이 꼴이다. */
77
+ type StdioAuditConnection = McpStdioConnection & McpServerInfo & McpServerSurface;
78
+ type HttpAuditConnection = McpHttpConnection & McpServerInfo & McpServerSurface;
79
+ interface AuditCommandDependencies {
80
+ connectStdio(options: {
81
+ command: string;
82
+ args: readonly string[];
83
+ env?: Readonly<Record<string, string>>;
84
+ advertise?: AdvertiseOptions;
85
+ connectTimeoutMs?: number;
86
+ }): Promise<StdioAuditConnection>;
87
+ connectHttp(options: HttpConnectOptions): Promise<HttpAuditConnection>;
88
+ /** `--env`·`--header-env` 가 가리키는 환경변수를 읽는 유일한 지점이다. */
89
+ readEnv(name: string): string | undefined;
90
+ /** 기준 파일을 읽는다. 없으면 `code: "ENOENT"` 인 오류를 던진다(node:fs 그대로). */
91
+ readFile(path: string): Promise<string>;
92
+ writeFile(path: string, text: string): Promise<void>;
93
+ readonly audit: typeof import("@mcpeak/audit").audit;
94
+ readonly renderReport: typeof import("@mcpeak/audit").renderReport;
95
+ /** 리포트의 `generator.version`. `@mcpeak/audit` 의 패키지 버전이다. */
96
+ readonly generatorVersion: string;
97
+ writeStdout(text: string): void;
98
+ writeStderr(text: string): void;
99
+ readonly fetch: typeof globalThis.fetch;
100
+ /** 카나리 값 하나. 16자 소문자 hex 이고 호출마다 다르다. */
101
+ random(): string;
102
+ readonly sandbox: AuditSandboxDependencies;
103
+ }
104
+ declare function parseAuditCommand(argv: readonly string[]): AuditCommandInput;
105
+ declare function runAuditCommand(argv: readonly string[], deps: AuditCommandDependencies): Promise<number>;
106
+ //#endregion
27
107
  //#region src/reset-hook.d.ts
28
108
  /**
29
109
  * 초기화가 실제로 무엇을 했는가. `--reset-cmd` 가 0 으로 끝난 것을 "초기 상태" 라고
@@ -194,6 +274,35 @@ declare function runGenerateCommand(argv: readonly string[], deps: GenerateComma
194
274
  declare const nodeGenerateDependencies: () => Omit<GenerateCommandDependencies, "connect" | "createBaselineSuite" | "createAuthoringSession" | "finalizeAuthoringDraft" | "getAuthoringExecutionSuite" | "validateSuite">;
195
275
  declare function nodeReviewIO(input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream): ReviewIO;
196
276
  //#endregion
277
+ //#region src/optimize-command.d.ts
278
+ interface OptimizeCommandInput {
279
+ readonly outPath: string;
280
+ readonly target: ConnectTarget;
281
+ readonly json: boolean;
282
+ }
283
+ interface OptimizeCommandDependencies {
284
+ /**
285
+ * 반환에 `McpServerInfo` 가 실려 있어야 한다. `instructions` 와 광고한 능력 키가 오버레이의
286
+ * 입력이기 때문이다. `core.connectStdio` 가 그 모양이다.
287
+ */
288
+ connectStdio(options: {
289
+ command: string;
290
+ args: readonly string[];
291
+ env?: Readonly<Record<string, string>>;
292
+ }): Promise<McpStdioConnection & McpServerInfo>;
293
+ connectHttp?(options: HttpConnectOptions): Promise<McpHttpConnection & McpServerInfo>;
294
+ readEnv?(name: string): string | undefined;
295
+ readonly optimize: typeof import("@mcpeak/optimize").optimize;
296
+ readonly renderReport: typeof import("@mcpeak/optimize").renderReport;
297
+ /** 오버레이의 `generator.version`. `@mcpeak/optimize` 의 패키지 버전이다. */
298
+ readonly generatorVersion: string;
299
+ writeFile(path: string, text: string): Promise<void>;
300
+ writeStdout(text: string): void;
301
+ writeStderr(text: string): void;
302
+ }
303
+ declare function parseOptimizeCommand(argv: readonly string[]): OptimizeCommandInput;
304
+ declare function runOptimizeCommand(argv: readonly string[], deps: OptimizeCommandDependencies): Promise<number>;
305
+ //#endregion
197
306
  //#region src/repair-command.d.ts
198
307
  interface RepairCommandInput {
199
308
  readonly bundlePath: string;
@@ -225,4 +334,39 @@ interface RepairCommandDependencies {
225
334
  declare function parseRepairCommand(argv: readonly string[]): RepairCommandInput;
226
335
  declare function runRepairCommand(argv: readonly string[], deps: RepairCommandDependencies): Promise<number>;
227
336
  //#endregion
228
- export { GenerateCommandDependencies as a, ReviewIO as c, runGenerateCommand as d, ConnectTarget as f, runRepairCommand as i, nodeGenerateDependencies as l, RepairCommandInput as n, GenerateCommandInput as o, parseRepairCommand as r, REVIEW_BACK_VALUE as s, RepairCommandDependencies as t, nodeReviewIO as u };
337
+ //#region src/index.d.ts
338
+ type Command = (argv: string[]) => Promise<number>;
339
+ declare const COMMANDS: readonly ["test", "generate", "repair", "record", "mock", "optimize", "audit"];
340
+ /**
341
+ * `repair` 실행 의존성. 함수로 빼 둔 이유는 **주입 자체를 테스트가 단언할 수 있게** 하기
342
+ * 위해서다. 분기 안에 리터럴로 두면 `reviewIO` 를 빠뜨려도 아무 테스트도 안 깨진다.
343
+ * 실제로 그렇게 한 번 빠뜨렸다(T10 보고서).
344
+ *
345
+ * 대화형 판정은 `generate` 와 같은 기준이다. 같은 `nodeReviewIO()` 를 쓰고, 그 구현이
346
+ * stdin·stdout 이 둘 다 TTY 일 때만 `interactive` 를 참으로 만든다.
347
+ */
348
+ declare function nodeRepairDependencies(generate: typeof import("@mcpeak/generate")): RepairCommandDependencies;
349
+ /**
350
+ * `optimize` 실행 의존성. `nodeRepairDependencies` 와 같은 이유로 함수로 뺀다. 주입 자체를
351
+ * 테스트가 단언할 수 있어야 `connectHttp` 나 `readEnv` 를 빠뜨린 배선이 초록으로 남지 않는다.
352
+ *
353
+ * `generatorVersion` 은 오버레이의 `generator` 가 `@mcpeak/optimize` 이므로 그 패키지의 버전이다.
354
+ * 그 패키지의 `exports` 가 `package.json` 을 열지 않아 상대 경로로 읽는다. 빌드가 값으로 싣고,
355
+ * 릴리스는 `changeset version` 뒤에 빌드하므로 발행되는 두 패키지의 버전이 맞는다.
356
+ */
357
+ declare function nodeOptimizeDependencies(core: typeof import("@mcpeak/core"), optimize: typeof import("@mcpeak/optimize")): OptimizeCommandDependencies;
358
+ /**
359
+ * `audit` 실행 의존성. `nodeOptimizeDependencies` 와 같은 이유로 함수로 뺀다. 주입 자체를 테스트가
360
+ * 단언할 수 있어야 `connectHttp`·`readEnv`·`fetch` 를 빠뜨린 배선이 초록으로 남지 않는다.
361
+ *
362
+ * `random` 은 카나리 값이다. 출력에 쓰지 않으므로 무작위여도 `--json` 의 바이트 결정론을 깨지
363
+ * 않는다. 서버가 값을 예측해 숨길 수 없게 암호학적 난수를 쓴다. `generatorVersion` 은 리포트의
364
+ * `generator` 가 `@mcpeak/audit` 이므로 그 패키지의 버전이고, 읽는 방식은 optimize 와 같다.
365
+ *
366
+ * `sandbox.createBackend` 는 `--sandbox` 를 준 실행에서만 불린다. 그 밖의 실행은 Docker 를 찾지도
367
+ * 부르지도 않는다.
368
+ */
369
+ declare function nodeAuditDependencies(core: typeof import("@mcpeak/core"), audit: typeof import("@mcpeak/audit")): AuditCommandDependencies;
370
+ declare function run(argv: string[]): Promise<number>;
371
+ //#endregion
372
+ export { AuditCommandInput as C, ConnectTarget as E, AuditCommandDependencies as S, runAuditCommand as T, REVIEW_BACK_VALUE as _, nodeRepairDependencies as a, nodeReviewIO as b, RepairCommandInput as c, OptimizeCommandDependencies as d, OptimizeCommandInput as f, GenerateCommandInput as g, GenerateCommandDependencies as h, nodeOptimizeDependencies as i, parseRepairCommand as l, runOptimizeCommand as m, Command as n, run as o, parseOptimizeCommand as p, nodeAuditDependencies as r, RepairCommandDependencies as s, COMMANDS as t, runRepairCommand as u, ReviewIO as v, parseAuditCommand as w, runGenerateCommand as x, nodeGenerateDependencies as y };
package/dist/index.cjs CHANGED
@@ -1,220 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_test_command = require("./test-command-1m3myzTS.cjs");
3
- let node_fs_promises = require("node:fs/promises");
4
- //#region src/index.ts
5
- const COMMANDS = [
6
- "test",
7
- "generate",
8
- "repair",
9
- "record",
10
- "mock"
11
- ];
12
- const unavailableDependencies = {
13
- readFile: async () => {
14
- throw new Error("runtime dependencies unavailable");
15
- },
16
- validateSuite: () => {
17
- throw new Error("runtime dependencies unavailable");
18
- },
19
- connect: async () => {
20
- throw new Error("runtime dependencies unavailable");
21
- },
22
- startRunner: () => {
23
- throw new Error("runtime dependencies unavailable");
24
- },
25
- finalize: async () => {
26
- throw new Error("runtime dependencies unavailable");
27
- },
28
- renderReport: () => {
29
- throw new Error("runtime dependencies unavailable");
30
- },
31
- renderJUnit: () => {
32
- throw new Error("runtime dependencies unavailable");
33
- },
34
- writeFile: async () => {
35
- throw new Error("runtime dependencies unavailable");
36
- },
37
- colorEnabled: false,
38
- writeStdout: (text) => process.stdout.write(text),
39
- writeStderr: (text) => process.stderr.write(text)
40
- };
41
- const unavailableRuntimeDependencies = {
42
- ...unavailableDependencies,
43
- readFile: node_fs_promises.readFile
44
- };
45
- /**
46
- * `repair` 실행 의존성. 함수로 빼 둔 이유는 **주입 자체를 테스트가 단언할 수 있게** 하기
47
- * 위해서다. 분기 안에 리터럴로 두면 `reviewIO` 를 빠뜨려도 아무 테스트도 안 깨진다.
48
- * 실제로 그렇게 한 번 빠뜨렸다(T10 보고서).
49
- *
50
- * 대화형 판정은 `generate` 와 같은 기준이다. 같은 `nodeReviewIO()` 를 쓰고, 그 구현이
51
- * stdin·stdout 이 둘 다 TTY 일 때만 `interactive` 를 참으로 만든다.
52
- */
53
- function nodeRepairDependencies(generate) {
54
- return {
55
- readFile: (path) => (0, node_fs_promises.readFile)(path, "utf8"),
56
- writeStdout: (text) => void process.stdout.write(text),
57
- writeStderr: (text) => void process.stderr.write(text),
58
- reviewIO: require_test_command.nodeReviewIO(),
59
- diagnosis: {
60
- prepare: generate.prepareDiagnosisRequest,
61
- dispatch: generate.dispatchDiagnosisRequest,
62
- providers: {
63
- codex: (model) => generate.createCodexProvider({ model }),
64
- claude: (model) => generate.createClaudeProvider({ model })
65
- }
66
- }
67
- };
68
- }
69
- /** `mcpeak help <이름>` 으로 볼 수 있는 명령. 위 두 갈래가 같은 목록을 봐야 한다. */
70
- const HELP_TOPICS = [
71
- "test",
72
- "generate",
73
- "repair"
74
- ];
75
- const isHelpTopic = (value) => HELP_TOPICS.includes(value);
76
- async function run(argv) {
77
- if (argv.length === 0 || argv.length === 1 && [
78
- "--help",
79
- "-h",
80
- "help"
81
- ].includes(argv[0] ?? "")) {
82
- process.stdout.write(require_test_command.GLOBAL_HELP);
83
- return 0;
84
- }
85
- if (argv.length === 2) {
86
- const command = argv[0] === "help" ? argv[1] : argv[1] === "--help" ? argv[0] : void 0;
87
- if (command === "replay" || command === "verify") return require_test_command.runCli([command], unavailableDependencies);
88
- if (isHelpTopic(command)) {
89
- process.stdout.write(require_test_command.commandHelp(command));
90
- return 0;
91
- }
92
- }
93
- /**
94
- * `help` 로 시작했는데 위에서 안 걸렸다면 **뒤에 붙은 인자가 틀린 것**이다.
95
- *
96
- * 여기서 안 막고 아래로 흘려보내면 `runCli` 가 `argv[0]` 인 `help` 를 명령으로 읽어
97
- * "알 수 없는 CLI 명령 'help'입니다" 라고 한다. 사용자가 정확히 친 토큰을 틀렸다고
98
- * 지목하는 셈이라, 무엇을 고쳐야 하는지가 화면에서 사라진다.
99
- */
100
- if (argv[0] === "help") {
101
- const target = argv[1] ?? "";
102
- const extra = argv[2];
103
- const message = isHelpTopic(target) && extra !== void 0 ? `\`help ${require_test_command.escapeTerminalText(target)}\` 뒤의 '${require_test_command.escapeTerminalText(extra)}' 는 받지 않습니다.` : `도움말이 없는 명령 '${require_test_command.escapeTerminalText(target)}'입니다.`;
104
- process.stderr.write(`오류 [CLI_USAGE]: ${message}\n해결: ${require_test_command.commandDiscovery}\n`);
105
- return 1;
106
- }
107
- if (argv.length === 1 && argv[0] === "--version") {
108
- process.stdout.write(`mcpeak ${require_test_command.version}\n`);
109
- return 0;
110
- }
111
- if (argv[0] === "generate") {
112
- let core;
113
- let runner;
114
- let generate;
115
- try {
116
- [core, runner, generate] = await Promise.all([
117
- import("@mcpeak/core"),
118
- import("@mcpeak/runner"),
119
- import("@mcpeak/generate")
120
- ]);
121
- } catch {
122
- return require_test_command.runGenerateCommand(argv, {
123
- ...require_test_command.nodeGenerateDependencies(),
124
- connect: unavailableDependencies.connect,
125
- createBaselineSuite: unavailableDependencies.validateSuite,
126
- createAuthoringSession: unavailableDependencies.validateSuite,
127
- finalizeAuthoringDraft: unavailableDependencies.validateSuite,
128
- getAuthoringExecutionSuite: unavailableDependencies.validateSuite,
129
- validateSuite: unavailableDependencies.validateSuite
130
- });
131
- }
132
- return require_test_command.runGenerateCommand(argv, {
133
- ...require_test_command.nodeGenerateDependencies(),
134
- connect: core.connectStdio,
135
- connectHttp: core.connectHttp,
136
- readEnv: (name) => process.env[name],
137
- createBaselineSuite: generate.createBaselineSuite,
138
- createAuthoringSession: generate.createAuthoringSession,
139
- finalizeAuthoringDraft: generate.finalizeAuthoringDraft,
140
- getAuthoringExecutionSuite: generate.getAuthoringExecutionSuite,
141
- validateSuite: runner.validateMcpSuite,
142
- reviewIO: require_test_command.nodeReviewIO(),
143
- providers: {
144
- codex: (model) => generate.createCodexAuthoringProvider({ model }),
145
- claude: (model) => generate.createClaudeAuthoringProvider({ model })
146
- },
147
- prepareAuthoringRequest: generate.prepareAuthoringRequest,
148
- dispatchAuthoringRequest: generate.dispatchAuthoringRequest,
149
- createAuthoringDiff: generate.createAuthoringDiff,
150
- applyAuthoringChanges: generate.applyAuthoringChanges,
151
- reviewLocalAuthoringCandidate: generate.reviewLocalAuthoringCandidate,
152
- computeCoverage: generate.computeCoverage,
153
- preparePreFillRequest: generate.preparePreFillRequest,
154
- previewPreFillRequest: generate.previewPreFillRequest,
155
- dispatchPreFillRequest: generate.dispatchPreFillRequest,
156
- preFillProviders: {
157
- codex: (model) => generate.createCodexProvider({ model }),
158
- claude: (model) => generate.createClaudeProvider({ model })
159
- },
160
- prepareRejectionDiagnosisRequests: generate.prepareRejectionDiagnosisRequests,
161
- dispatchRejectionDiagnosis: generate.dispatchRejectionDiagnosis,
162
- rejectionProviders: {
163
- codex: (model) => generate.createCodexProvider({ model }),
164
- claude: (model) => generate.createClaudeProvider({ model })
165
- },
166
- GenerateTestsError: generate.GenerateTestsError
167
- });
168
- }
169
- if (argv[0] === "repair") {
170
- /**
171
- * `generate` 분기와 같은 모양으로 동적 import 한다. `test` 경로는 이 분기를 지나지 않으므로
172
- * 여전히 `core` 와 `runner` 만 로드한다. 계획서 §8 위험표 첫 줄.
173
- */
174
- let generate;
175
- try {
176
- generate = await import("@mcpeak/generate");
177
- } catch {
178
- process.stderr.write("오류 [REPAIR_RUNTIME_UNAVAILABLE]: 진단에 필요한 @mcpeak/generate 를 로드하지 못했습니다.\n해결: 의존성을 설치한 뒤 다시 실행하세요.\n");
179
- return 1;
180
- }
181
- const dependencies = nodeRepairDependencies(generate);
182
- try {
183
- return await require_test_command.runRepairCommand(argv, dependencies);
184
- } finally {
185
- dependencies.reviewIO?.close?.();
186
- }
187
- }
188
- if (argv[0] !== "test") return require_test_command.runCli(argv, unavailableDependencies);
189
- try {
190
- if (!require_test_command.parseTestCommand(argv.slice(1)).suitePath.toLowerCase().endsWith(".json")) return require_test_command.runCli(argv, unavailableDependencies);
191
- } catch {
192
- return require_test_command.runCli(argv, unavailableDependencies);
193
- }
194
- let core;
195
- let runner;
196
- try {
197
- [core, runner] = await Promise.all([import("@mcpeak/core"), import("@mcpeak/runner")]);
198
- } catch {
199
- return require_test_command.runCli(argv, unavailableRuntimeDependencies);
200
- }
201
- return require_test_command.runCli(argv, {
202
- readFile: node_fs_promises.readFile,
203
- validateSuite: runner.validateMcpSuite,
204
- connect: core.connectStdio,
205
- connectHttp: core.connectHttp,
206
- readEnv: (name) => process.env[name],
207
- startRunner: runner.runSuite,
208
- finalize: runner.finalizeRunnerExecution,
209
- renderReport: runner.renderReport,
210
- renderJUnit: runner.renderJUnit,
211
- writeFile: (path, text) => (0, node_fs_promises.writeFile)(path, text, "utf8"),
212
- colorEnabled: process.stdout.isTTY === true && process.env.NO_COLOR === void 0,
213
- writeStdout: (text) => process.stdout.write(text),
214
- writeStderr: (text) => process.stderr.write(text)
215
- });
216
- }
217
- //#endregion
218
- exports.COMMANDS = COMMANDS;
219
- exports.nodeRepairDependencies = nodeRepairDependencies;
220
- exports.run = run;
2
+ const require_src = require("./src-CsQbffCA.cjs");
3
+ exports.COMMANDS = require_src.COMMANDS;
4
+ exports.nodeAuditDependencies = require_src.nodeAuditDependencies;
5
+ exports.nodeOptimizeDependencies = require_src.nodeOptimizeDependencies;
6
+ exports.nodeRepairDependencies = require_src.nodeRepairDependencies;
7
+ exports.run = require_src.run;
package/dist/index.d.cts CHANGED
@@ -1,16 +1,2 @@
1
- import { t as RepairCommandDependencies } from "./repair-command-CVFqxU6V.cjs";
2
- //#region src/index.d.ts
3
- type Command = (argv: string[]) => Promise<number>;
4
- declare const COMMANDS: readonly ["test", "generate", "repair", "record", "mock"];
5
- /**
6
- * `repair` 실행 의존성. 함수로 빼 둔 이유는 **주입 자체를 테스트가 단언할 수 있게** 하기
7
- * 위해서다. 분기 안에 리터럴로 두면 `reviewIO` 를 빠뜨려도 아무 테스트도 안 깨진다.
8
- * 실제로 그렇게 한 번 빠뜨렸다(T10 보고서).
9
- *
10
- * 대화형 판정은 `generate` 와 같은 기준이다. 같은 `nodeReviewIO()` 를 쓰고, 그 구현이
11
- * stdin·stdout 이 둘 다 TTY 일 때만 `interactive` 를 참으로 만든다.
12
- */
13
- declare function nodeRepairDependencies(generate: typeof import("@mcpeak/generate")): RepairCommandDependencies;
14
- declare function run(argv: string[]): Promise<number>;
15
- //#endregion
16
- export { COMMANDS, Command, nodeRepairDependencies, run };
1
+ import { a as nodeRepairDependencies, i as nodeOptimizeDependencies, n as Command, o as run, r as nodeAuditDependencies, t as COMMANDS } from "./index-_hQ_Ohu-.cjs";
2
+ export { COMMANDS, Command, nodeAuditDependencies, nodeOptimizeDependencies, nodeRepairDependencies, run };
package/dist/index.d.mts CHANGED
@@ -1,16 +1,2 @@
1
- import { t as RepairCommandDependencies } from "./repair-command-8GUlJJ47.mjs";
2
- //#region src/index.d.ts
3
- type Command = (argv: string[]) => Promise<number>;
4
- declare const COMMANDS: readonly ["test", "generate", "repair", "record", "mock"];
5
- /**
6
- * `repair` 실행 의존성. 함수로 빼 둔 이유는 **주입 자체를 테스트가 단언할 수 있게** 하기
7
- * 위해서다. 분기 안에 리터럴로 두면 `reviewIO` 를 빠뜨려도 아무 테스트도 안 깨진다.
8
- * 실제로 그렇게 한 번 빠뜨렸다(T10 보고서).
9
- *
10
- * 대화형 판정은 `generate` 와 같은 기준이다. 같은 `nodeReviewIO()` 를 쓰고, 그 구현이
11
- * stdin·stdout 이 둘 다 TTY 일 때만 `interactive` 를 참으로 만든다.
12
- */
13
- declare function nodeRepairDependencies(generate: typeof import("@mcpeak/generate")): RepairCommandDependencies;
14
- declare function run(argv: string[]): Promise<number>;
15
- //#endregion
16
- export { COMMANDS, Command, nodeRepairDependencies, run };
1
+ import { a as nodeRepairDependencies, i as nodeOptimizeDependencies, n as Command, o as run, r as nodeAuditDependencies, t as COMMANDS } from "./index-CBFNkZgR.mjs";
2
+ export { COMMANDS, Command, nodeAuditDependencies, nodeOptimizeDependencies, nodeRepairDependencies, run };