@mcpeak/cli 0.11.0 → 0.14.0

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.
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "@mcpeak/cli",
3
- "version": "0.11.0",
3
+ "version": "0.14.0",
4
4
  "private": false,
5
5
  "type": "module",
6
- "description": "MCPeak 프레임워크의 CLI 진입점 (얇게 유지)",
6
+ "description": "CLI for testing MCP servers: run test suites, generate tests, record/replay, mock, and audit",
7
+ "keywords": [
8
+ "mcp",
9
+ "model-context-protocol",
10
+ "mcp-server",
11
+ "testing",
12
+ "test-framework",
13
+ "cli"
14
+ ],
7
15
  "license": "MIT",
8
16
  "engines": {
9
17
  "node": ">=22.18.0"
@@ -50,11 +58,13 @@
50
58
  "dist"
51
59
  ],
52
60
  "dependencies": {
53
- "@mcpeak/core": "0.4.0",
54
- "@mcpeak/runner": "0.10.0",
55
- "@mcpeak/generate": "0.7.0",
56
- "@mcpeak/record": "0.4.0",
57
- "@mcpeak/mock": "0.4.1"
61
+ "@mcpeak/core": "0.6.1",
62
+ "@mcpeak/runner": "0.11.2",
63
+ "@mcpeak/generate": "0.8.2",
64
+ "@mcpeak/record": "0.5.1",
65
+ "@mcpeak/mock": "0.4.4",
66
+ "@mcpeak/optimize": "0.2.1",
67
+ "@mcpeak/audit": "0.3.0"
58
68
  },
59
69
  "scripts": {
60
70
  "build": "tsdown --config-loader native",
@@ -1,178 +0,0 @@
1
- import { McpHttpConnection, McpStdioConnection, ToolDef } from "@mcpeak/core";
2
- import { AuthoringExecutionSnapshot, AuthoringSessionView, BaselineGenerationResult, PreFillProvider } from "@mcpeak/generate";
3
- import { SuiteValidationResult, TestSuiteSpec } from "@mcpeak/runner";
4
- //#region src/connect-target.d.ts
5
- /** 파서가 확정한 연결 대상. */
6
- type ConnectTarget = {
7
- readonly transport: "stdio";
8
- readonly command: string;
9
- readonly args: readonly string[];
10
- } | {
11
- readonly transport: "http";
12
- readonly url: string;
13
- /**
14
- * 헤더 이름 → 그 값을 담은 **환경변수 이름**. 값 자체는 여기에도 argv 에도 없다.
15
- *
16
- * 평문 `--header 'Authorization: Bearer …'` 를 두지 않은 이유가 이 타입이다. 토큰을
17
- * argv 에 실으면 `ps` 목록과 셸 히스토리에 그대로 남고, 그건 우리가 만든 노출이다.
18
- */
19
- readonly headerEnv: Readonly<Record<string, string>>;
20
- };
21
- //#endregion
22
- //#region src/generate-command.d.ts
23
- interface GenerateCommandInput {
24
- readonly suiteId: string;
25
- readonly name: string;
26
- readonly outPath: string;
27
- /**
28
- * 명세를 뽑을 대상. `--command`/`--arg` 면 stdio, `--url` 이면 Streamable HTTP 다(#137).
29
- * `command` · `args` 두 필드를 이 하나로 바꾼 근거는 `TestCommandInput.target` 과 같다.
30
- */
31
- readonly target: ConnectTarget;
32
- readonly baselineOnly: boolean;
33
- readonly provider?: "codex" | "claude";
34
- readonly model?: string;
35
- /** 승인 전 시험 실행 여부. 기본은 실행이고 `--no-dry-run` 이 끈다. 설계 문서 §4.3. */
36
- readonly dryRun: boolean;
37
- /** `--force`. `--out` 에 파일이 있으면 지우고 새로 쓴다. 설계 문서 §5. */
38
- readonly force: boolean;
39
- /** `--reset-cmd`. 시험 실행 직전 1회 실행한다. */
40
- readonly resetCmd?: string;
41
- /** 입력값 교정 단계를 돌릴지 여부. 기본은 실행이고 `--no-repair` 가 끈다. 설계 문서 §7. */
42
- readonly repair: boolean;
43
- }
44
- interface GenerateCommandDependencies {
45
- connect(options: {
46
- command: string;
47
- args: readonly string[];
48
- }): Promise<McpStdioConnection>;
49
- /**
50
- * 원격(Streamable HTTP) 대상용 연결. `core.connectHttp` 다. 선택 사항으로 두는 근거는
51
- * `TestCommandDependencies.connectHttp` 와 같다(#137).
52
- */
53
- connectHttp?(options: {
54
- url: string;
55
- headers?: Readonly<Record<string, string>>;
56
- }): Promise<McpHttpConnection>;
57
- /** `--header-env` 가 가리키는 환경변수를 읽는다. CLI 가 `process` 를 직접 읽지 않기 위한 주입점. */
58
- readEnv?(name: string): string | undefined;
59
- createBaselineSuite(tools: readonly ToolDef[], options: {
60
- suiteId: string;
61
- suiteName: string;
62
- }): BaselineGenerationResult;
63
- createAuthoringSession(baseline: BaselineGenerationResult, options?: {
64
- readonly preFilledCaseIds?: readonly string[];
65
- }): AuthoringSessionView;
66
- finalizeAuthoringDraft(options: {
67
- session: AuthoringSessionView;
68
- approval: {
69
- approved: boolean;
70
- fingerprint: string;
71
- };
72
- }): {
73
- finalized: true;
74
- snapshot: AuthoringExecutionSnapshot;
75
- } | {
76
- finalized: false;
77
- };
78
- getAuthoringExecutionSuite(snapshot: AuthoringExecutionSnapshot): TestSuiteSpec;
79
- validateSuite(value: unknown): SuiteValidationResult;
80
- exists(path: string): Promise<boolean>;
81
- openTemp(path: string): Promise<{
82
- writeFile(data: string, encoding: "utf8"): Promise<void>;
83
- sync(): Promise<void>;
84
- close(): Promise<void>;
85
- }>;
86
- readFile(path: string): Promise<Uint8Array>;
87
- /**
88
- * 임시 파일을 최종 경로에 커밋한다. `rename`이 아니라 `link`인 것이 요점이다.
89
- * `rename`은 대상이 있으면 말없이 덮어쓴다. `link`는 EEXIST로 실패하므로
90
- * 원자성과 no-clobber를 동시에 얻는다. 덮어쓸 수 있는 primitive를 아예 두지 않는다.
91
- */
92
- link(from: string, to: string): Promise<void>;
93
- unlink(path: string): Promise<void>;
94
- writeStdout(text: string): void;
95
- writeStderr(text: string): void;
96
- reviewIO?: ReviewIO;
97
- providers?: Partial<Record<"codex" | "claude", (model: string) => TestAuthoringProvider | undefined>>;
98
- /**
99
- * 거절 근거 진단 통로 (#89 · 설계 문서 §6). `providers` 와 **따로 둔다.** 그쪽은
100
- * `TestAuthoringProvider`(`author`)이고 이쪽은 `diagnoseRejection` 이라 다른 계약이다.
101
- * `preFillProviders` 와 같은 선례다. 없으면 진단을 아예 묻지 않는다.
102
- */
103
- rejectionProviders?: Partial<Record<"codex" | "claude", (model: string) => import("@mcpeak/generate").RejectionDiagnosisProvider | undefined>>;
104
- prepareRejectionDiagnosisRequests?: typeof import("@mcpeak/generate").prepareRejectionDiagnosisRequests;
105
- dispatchRejectionDiagnosis?: typeof import("@mcpeak/generate").dispatchRejectionDiagnosis;
106
- prepareAuthoringRequest?: typeof import("@mcpeak/generate").prepareAuthoringRequest;
107
- dispatchAuthoringRequest?: typeof import("@mcpeak/generate").dispatchAuthoringRequest;
108
- createAuthoringDiff?: typeof import("@mcpeak/generate").createAuthoringDiff;
109
- applyAuthoringChanges?: typeof import("@mcpeak/generate").applyAuthoringChanges;
110
- reviewLocalAuthoringCandidate?: typeof import("@mcpeak/generate").reviewLocalAuthoringCandidate;
111
- computeCoverage?: typeof import("@mcpeak/generate").computeCoverage;
112
- /**
113
- * AI 사전보완 통로. 넷 다 주입돼야 사전보완이 돈다. 하나라도 없으면 건너뛴다.
114
- * 위 authoring 통로와 같은 이유로 값 import 가 아니라 주입이다.
115
- */
116
- preparePreFillRequest?: typeof import("@mcpeak/generate").preparePreFillRequest;
117
- previewPreFillRequest?: typeof import("@mcpeak/generate").previewPreFillRequest;
118
- dispatchPreFillRequest?: typeof import("@mcpeak/generate").dispatchPreFillRequest;
119
- preFillProviders?: Partial<Record<"codex" | "claude", (model: string) => PreFillProvider | undefined>>;
120
- /**
121
- * `instanceof` 용 클래스. 값 import 가 아니라 주입인 것이 요점이다.
122
- *
123
- * 이 파일은 `@mcpeak/generate` 에서 타입만 가져온다(위 `import type`). 클래스를 값으로
124
- * 가져오면 `index.ts` 가 정적으로 끌어와 `test` 경로까지 `generate` 를 로드한다.
125
- * `typeof import(...)` 는 타입 위치라 런타임 import 가 생기지 않고, 주입하면 클래스
126
- * 동일성도 보장된다. 위 6개 필드가 같은 방식이다.
127
- */
128
- GenerateTestsError?: typeof import("@mcpeak/generate").GenerateTestsError;
129
- }
130
- interface ReviewIO {
131
- input(message: string): Promise<string>;
132
- choose(message: string, choices: readonly string[]): Promise<string>;
133
- confirm(message: string): Promise<boolean>;
134
- write(text: string): void;
135
- readonly interactive: boolean;
136
- close?(): void;
137
- }
138
- type TestAuthoringProvider = import("@mcpeak/generate").TestAuthoringProvider;
139
- declare function runGenerateCommand(argv: readonly string[], deps: GenerateCommandDependencies): Promise<number>;
140
- declare const nodeGenerateDependencies: () => Omit<GenerateCommandDependencies, "connect" | "createBaselineSuite" | "createAuthoringSession" | "finalizeAuthoringDraft" | "getAuthoringExecutionSuite" | "validateSuite">;
141
- declare function nodeReviewIO(input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream): ReviewIO;
142
- //#endregion
143
- //#region src/repair-command.d.ts
144
- interface RepairCommandInput {
145
- readonly bundlePath: string;
146
- readonly providerId: "codex" | "claude";
147
- readonly model: string;
148
- readonly yes: boolean;
149
- readonly includeStderr: boolean;
150
- readonly maxCases: number;
151
- }
152
- interface RepairCommandDependencies {
153
- readFile(path: string): Promise<string>;
154
- writeStdout(text: string): void;
155
- writeStderr(text: string): void;
156
- /** 전송 확인 화면. 없으면 비대화형으로 본다. `generate` 가 쓰는 그 인터페이스다. */
157
- readonly reviewIO?: ReviewIO;
158
- /**
159
- * 진단 통로. `@mcpeak/generate` 를 값으로 import 하지 않고 주입받는다. 정적으로 import 하면
160
- * `test` 경로가 `generate` 를 함께 로드한다. 계획서 §8 위험표 첫 줄이다.
161
- */
162
- readonly diagnosis?: {
163
- readonly prepare: typeof import("@mcpeak/generate").prepareDiagnosisRequest;
164
- readonly dispatch: typeof import("@mcpeak/generate").dispatchDiagnosisRequest;
165
- readonly providers: {
166
- readonly codex: (model: string) => import("@mcpeak/generate").ServerDiagnosisProvider;
167
- readonly claude: (model: string) => import("@mcpeak/generate").ServerDiagnosisProvider;
168
- };
169
- };
170
- }
171
- declare function parseRepairCommand(argv: readonly string[]): RepairCommandInput;
172
- /**
173
- * `repair` 명령. 번들을 읽고, 전송 내용을 확인받고, provider 에게 진단을 물어 화면에 찍는다.
174
- * 파일도 명세도 고치지 않는다. 종료 코드는 운영 실패에만 1 이다(설계서 §7.1).
175
- */
176
- declare function runRepairCommand(argv: readonly string[], deps: RepairCommandDependencies): Promise<number>;
177
- //#endregion
178
- export { GenerateCommandDependencies as a, nodeGenerateDependencies as c, ConnectTarget as d, runRepairCommand as i, nodeReviewIO as l, RepairCommandInput as n, GenerateCommandInput as o, parseRepairCommand as r, ReviewIO as s, RepairCommandDependencies as t, runGenerateCommand as u };
@@ -1,178 +0,0 @@
1
- import { SuiteValidationResult, TestSuiteSpec } from "@mcpeak/runner";
2
- import { McpHttpConnection, McpStdioConnection, ToolDef } from "@mcpeak/core";
3
- import { AuthoringExecutionSnapshot, AuthoringSessionView, BaselineGenerationResult, PreFillProvider } from "@mcpeak/generate";
4
- //#region src/connect-target.d.ts
5
- /** 파서가 확정한 연결 대상. */
6
- type ConnectTarget = {
7
- readonly transport: "stdio";
8
- readonly command: string;
9
- readonly args: readonly string[];
10
- } | {
11
- readonly transport: "http";
12
- readonly url: string;
13
- /**
14
- * 헤더 이름 → 그 값을 담은 **환경변수 이름**. 값 자체는 여기에도 argv 에도 없다.
15
- *
16
- * 평문 `--header 'Authorization: Bearer …'` 를 두지 않은 이유가 이 타입이다. 토큰을
17
- * argv 에 실으면 `ps` 목록과 셸 히스토리에 그대로 남고, 그건 우리가 만든 노출이다.
18
- */
19
- readonly headerEnv: Readonly<Record<string, string>>;
20
- };
21
- //#endregion
22
- //#region src/generate-command.d.ts
23
- interface GenerateCommandInput {
24
- readonly suiteId: string;
25
- readonly name: string;
26
- readonly outPath: string;
27
- /**
28
- * 명세를 뽑을 대상. `--command`/`--arg` 면 stdio, `--url` 이면 Streamable HTTP 다(#137).
29
- * `command` · `args` 두 필드를 이 하나로 바꾼 근거는 `TestCommandInput.target` 과 같다.
30
- */
31
- readonly target: ConnectTarget;
32
- readonly baselineOnly: boolean;
33
- readonly provider?: "codex" | "claude";
34
- readonly model?: string;
35
- /** 승인 전 시험 실행 여부. 기본은 실행이고 `--no-dry-run` 이 끈다. 설계 문서 §4.3. */
36
- readonly dryRun: boolean;
37
- /** `--force`. `--out` 에 파일이 있으면 지우고 새로 쓴다. 설계 문서 §5. */
38
- readonly force: boolean;
39
- /** `--reset-cmd`. 시험 실행 직전 1회 실행한다. */
40
- readonly resetCmd?: string;
41
- /** 입력값 교정 단계를 돌릴지 여부. 기본은 실행이고 `--no-repair` 가 끈다. 설계 문서 §7. */
42
- readonly repair: boolean;
43
- }
44
- interface GenerateCommandDependencies {
45
- connect(options: {
46
- command: string;
47
- args: readonly string[];
48
- }): Promise<McpStdioConnection>;
49
- /**
50
- * 원격(Streamable HTTP) 대상용 연결. `core.connectHttp` 다. 선택 사항으로 두는 근거는
51
- * `TestCommandDependencies.connectHttp` 와 같다(#137).
52
- */
53
- connectHttp?(options: {
54
- url: string;
55
- headers?: Readonly<Record<string, string>>;
56
- }): Promise<McpHttpConnection>;
57
- /** `--header-env` 가 가리키는 환경변수를 읽는다. CLI 가 `process` 를 직접 읽지 않기 위한 주입점. */
58
- readEnv?(name: string): string | undefined;
59
- createBaselineSuite(tools: readonly ToolDef[], options: {
60
- suiteId: string;
61
- suiteName: string;
62
- }): BaselineGenerationResult;
63
- createAuthoringSession(baseline: BaselineGenerationResult, options?: {
64
- readonly preFilledCaseIds?: readonly string[];
65
- }): AuthoringSessionView;
66
- finalizeAuthoringDraft(options: {
67
- session: AuthoringSessionView;
68
- approval: {
69
- approved: boolean;
70
- fingerprint: string;
71
- };
72
- }): {
73
- finalized: true;
74
- snapshot: AuthoringExecutionSnapshot;
75
- } | {
76
- finalized: false;
77
- };
78
- getAuthoringExecutionSuite(snapshot: AuthoringExecutionSnapshot): TestSuiteSpec;
79
- validateSuite(value: unknown): SuiteValidationResult;
80
- exists(path: string): Promise<boolean>;
81
- openTemp(path: string): Promise<{
82
- writeFile(data: string, encoding: "utf8"): Promise<void>;
83
- sync(): Promise<void>;
84
- close(): Promise<void>;
85
- }>;
86
- readFile(path: string): Promise<Uint8Array>;
87
- /**
88
- * 임시 파일을 최종 경로에 커밋한다. `rename`이 아니라 `link`인 것이 요점이다.
89
- * `rename`은 대상이 있으면 말없이 덮어쓴다. `link`는 EEXIST로 실패하므로
90
- * 원자성과 no-clobber를 동시에 얻는다. 덮어쓸 수 있는 primitive를 아예 두지 않는다.
91
- */
92
- link(from: string, to: string): Promise<void>;
93
- unlink(path: string): Promise<void>;
94
- writeStdout(text: string): void;
95
- writeStderr(text: string): void;
96
- reviewIO?: ReviewIO;
97
- providers?: Partial<Record<"codex" | "claude", (model: string) => TestAuthoringProvider | undefined>>;
98
- /**
99
- * 거절 근거 진단 통로 (#89 · 설계 문서 §6). `providers` 와 **따로 둔다.** 그쪽은
100
- * `TestAuthoringProvider`(`author`)이고 이쪽은 `diagnoseRejection` 이라 다른 계약이다.
101
- * `preFillProviders` 와 같은 선례다. 없으면 진단을 아예 묻지 않는다.
102
- */
103
- rejectionProviders?: Partial<Record<"codex" | "claude", (model: string) => import("@mcpeak/generate").RejectionDiagnosisProvider | undefined>>;
104
- prepareRejectionDiagnosisRequests?: typeof import("@mcpeak/generate").prepareRejectionDiagnosisRequests;
105
- dispatchRejectionDiagnosis?: typeof import("@mcpeak/generate").dispatchRejectionDiagnosis;
106
- prepareAuthoringRequest?: typeof import("@mcpeak/generate").prepareAuthoringRequest;
107
- dispatchAuthoringRequest?: typeof import("@mcpeak/generate").dispatchAuthoringRequest;
108
- createAuthoringDiff?: typeof import("@mcpeak/generate").createAuthoringDiff;
109
- applyAuthoringChanges?: typeof import("@mcpeak/generate").applyAuthoringChanges;
110
- reviewLocalAuthoringCandidate?: typeof import("@mcpeak/generate").reviewLocalAuthoringCandidate;
111
- computeCoverage?: typeof import("@mcpeak/generate").computeCoverage;
112
- /**
113
- * AI 사전보완 통로. 넷 다 주입돼야 사전보완이 돈다. 하나라도 없으면 건너뛴다.
114
- * 위 authoring 통로와 같은 이유로 값 import 가 아니라 주입이다.
115
- */
116
- preparePreFillRequest?: typeof import("@mcpeak/generate").preparePreFillRequest;
117
- previewPreFillRequest?: typeof import("@mcpeak/generate").previewPreFillRequest;
118
- dispatchPreFillRequest?: typeof import("@mcpeak/generate").dispatchPreFillRequest;
119
- preFillProviders?: Partial<Record<"codex" | "claude", (model: string) => PreFillProvider | undefined>>;
120
- /**
121
- * `instanceof` 용 클래스. 값 import 가 아니라 주입인 것이 요점이다.
122
- *
123
- * 이 파일은 `@mcpeak/generate` 에서 타입만 가져온다(위 `import type`). 클래스를 값으로
124
- * 가져오면 `index.ts` 가 정적으로 끌어와 `test` 경로까지 `generate` 를 로드한다.
125
- * `typeof import(...)` 는 타입 위치라 런타임 import 가 생기지 않고, 주입하면 클래스
126
- * 동일성도 보장된다. 위 6개 필드가 같은 방식이다.
127
- */
128
- GenerateTestsError?: typeof import("@mcpeak/generate").GenerateTestsError;
129
- }
130
- interface ReviewIO {
131
- input(message: string): Promise<string>;
132
- choose(message: string, choices: readonly string[]): Promise<string>;
133
- confirm(message: string): Promise<boolean>;
134
- write(text: string): void;
135
- readonly interactive: boolean;
136
- close?(): void;
137
- }
138
- type TestAuthoringProvider = import("@mcpeak/generate").TestAuthoringProvider;
139
- declare function runGenerateCommand(argv: readonly string[], deps: GenerateCommandDependencies): Promise<number>;
140
- declare const nodeGenerateDependencies: () => Omit<GenerateCommandDependencies, "connect" | "createBaselineSuite" | "createAuthoringSession" | "finalizeAuthoringDraft" | "getAuthoringExecutionSuite" | "validateSuite">;
141
- declare function nodeReviewIO(input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream): ReviewIO;
142
- //#endregion
143
- //#region src/repair-command.d.ts
144
- interface RepairCommandInput {
145
- readonly bundlePath: string;
146
- readonly providerId: "codex" | "claude";
147
- readonly model: string;
148
- readonly yes: boolean;
149
- readonly includeStderr: boolean;
150
- readonly maxCases: number;
151
- }
152
- interface RepairCommandDependencies {
153
- readFile(path: string): Promise<string>;
154
- writeStdout(text: string): void;
155
- writeStderr(text: string): void;
156
- /** 전송 확인 화면. 없으면 비대화형으로 본다. `generate` 가 쓰는 그 인터페이스다. */
157
- readonly reviewIO?: ReviewIO;
158
- /**
159
- * 진단 통로. `@mcpeak/generate` 를 값으로 import 하지 않고 주입받는다. 정적으로 import 하면
160
- * `test` 경로가 `generate` 를 함께 로드한다. 계획서 §8 위험표 첫 줄이다.
161
- */
162
- readonly diagnosis?: {
163
- readonly prepare: typeof import("@mcpeak/generate").prepareDiagnosisRequest;
164
- readonly dispatch: typeof import("@mcpeak/generate").dispatchDiagnosisRequest;
165
- readonly providers: {
166
- readonly codex: (model: string) => import("@mcpeak/generate").ServerDiagnosisProvider;
167
- readonly claude: (model: string) => import("@mcpeak/generate").ServerDiagnosisProvider;
168
- };
169
- };
170
- }
171
- declare function parseRepairCommand(argv: readonly string[]): RepairCommandInput;
172
- /**
173
- * `repair` 명령. 번들을 읽고, 전송 내용을 확인받고, provider 에게 진단을 물어 화면에 찍는다.
174
- * 파일도 명세도 고치지 않는다. 종료 코드는 운영 실패에만 1 이다(설계서 §7.1).
175
- */
176
- declare function runRepairCommand(argv: readonly string[], deps: RepairCommandDependencies): Promise<number>;
177
- //#endregion
178
- export { GenerateCommandDependencies as a, nodeGenerateDependencies as c, ConnectTarget as d, runRepairCommand as i, nodeReviewIO as l, RepairCommandInput as n, GenerateCommandInput as o, parseRepairCommand as r, ReviewIO as s, RepairCommandDependencies as t, runGenerateCommand as u };