@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/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/commands.cjs +58 -8
- package/dist/commands.d.cts +42 -3
- package/dist/commands.d.mts +42 -3
- package/dist/commands.mjs +45 -2
- package/dist/index-CBFNkZgR.d.mts +372 -0
- package/dist/index-_hQ_Ohu-.d.cts +372 -0
- package/dist/index.cjs +6 -219
- package/dist/index.d.cts +2 -16
- package/dist/index.d.mts +2 -16
- package/dist/index.mjs +2 -217
- package/dist/{test-command-B_faNSfA.cjs → src-BBBK_BXs.cjs} +6579 -4138
- package/dist/{test-command-DEp9hrfH.mjs → src-CRsYPuu_.mjs} +6583 -4172
- package/package.json +17 -7
- package/dist/repair-command-D3zL3G5W.d.cts +0 -178
- package/dist/repair-command-DQh2h4tQ.d.mts +0 -178
package/dist/cli.cjs
CHANGED
package/dist/cli.mjs
CHANGED
package/dist/commands.cjs
CHANGED
|
@@ -1,9 +1,59 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
const require_src = require("./src-BBBK_BXs.cjs");
|
|
3
|
+
//#region src/auto-review-io.ts
|
|
4
|
+
function autoReviewIO(sink) {
|
|
5
|
+
let menuSeen = false;
|
|
6
|
+
let cancelled = false;
|
|
7
|
+
const note = (question, answer) => {
|
|
8
|
+
sink.write(`▸ 자동 승인: ${summarize(question)} → ${answer}\n`);
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
interactive: true,
|
|
12
|
+
get cancelled() {
|
|
13
|
+
return cancelled;
|
|
14
|
+
},
|
|
15
|
+
write: (text) => sink.write(text),
|
|
16
|
+
async choose(message, choices) {
|
|
17
|
+
if (message === "검토 메뉴") {
|
|
18
|
+
const answer = menuSeen ? "cancel" : "save";
|
|
19
|
+
if (menuSeen) cancelled = true;
|
|
20
|
+
menuSeen = true;
|
|
21
|
+
note(message, answer);
|
|
22
|
+
return answer;
|
|
23
|
+
}
|
|
24
|
+
const answer = choices[0] ?? "";
|
|
25
|
+
note(message, answer);
|
|
26
|
+
return answer;
|
|
27
|
+
},
|
|
28
|
+
async confirm(message) {
|
|
29
|
+
const answer = !/그래도 적용합니까/.test(message);
|
|
30
|
+
note(message, answer ? "예" : "아니오");
|
|
31
|
+
return answer;
|
|
32
|
+
},
|
|
33
|
+
async input(message) {
|
|
34
|
+
const answer = /^\s*선택:\s*$/.test(message) ? "s" : "";
|
|
35
|
+
note(message, answer === "" ? "(엔터)" : answer);
|
|
36
|
+
return answer;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** 로그 한 줄에 들어갈 만큼만 남긴다. 질문 본문은 이미 화면에 찍혀 있다. */
|
|
41
|
+
function summarize(question) {
|
|
42
|
+
const oneLine = question.replace(/\s+/g, " ").trim();
|
|
43
|
+
return oneLine.length > 60 ? `${oneLine.slice(0, 57)}...` : oneLine;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.REVIEW_BACK_VALUE = require_src.REVIEW_BACK_VALUE;
|
|
47
|
+
exports.autoReviewIO = autoReviewIO;
|
|
48
|
+
exports.nodeAuditDependencies = require_src.nodeAuditDependencies;
|
|
49
|
+
exports.nodeGenerateDependencies = require_src.nodeGenerateDependencies;
|
|
50
|
+
exports.nodeReviewIO = require_src.nodeReviewIO;
|
|
51
|
+
exports.parseAuditCommand = require_src.parseAuditCommand;
|
|
52
|
+
exports.parseOptimizeCommand = require_src.parseOptimizeCommand;
|
|
53
|
+
exports.parseRepairCommand = require_src.parseRepairCommand;
|
|
54
|
+
exports.parseTestCommand = require_src.parseTestCommand;
|
|
55
|
+
exports.runAuditCommand = require_src.runAuditCommand;
|
|
56
|
+
exports.runCli = require_src.runCli;
|
|
57
|
+
exports.runGenerateCommand = require_src.runGenerateCommand;
|
|
58
|
+
exports.runOptimizeCommand = require_src.runOptimizeCommand;
|
|
59
|
+
exports.runRepairCommand = require_src.runRepairCommand;
|
package/dist/commands.d.cts
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as AuditCommandInput, E as ConnectTarget, S as AuditCommandDependencies, T as runAuditCommand, _ as REVIEW_BACK_VALUE, b as nodeReviewIO, c as RepairCommandInput, d as OptimizeCommandDependencies, f as OptimizeCommandInput, g as GenerateCommandInput, h as GenerateCommandDependencies, l as parseRepairCommand, m as runOptimizeCommand, p as parseOptimizeCommand, r as nodeAuditDependencies, s as RepairCommandDependencies, u as runRepairCommand, v as ReviewIO, w as parseAuditCommand, x as runGenerateCommand, y as nodeGenerateDependencies } from "./index-_hQ_Ohu-.cjs";
|
|
2
2
|
import { McpHttpConnection, McpStdioConnection } from "@mcpeak/core";
|
|
3
|
-
import { CheckDeterminismOptions, DeterminismResult, FinalizeRunnerExecutionOptions, InputContractOptions, RunSuiteOptions, RunnerExecution, RunnerReport, SpecFindingsResult, SuiteValidationIssue, SuiteValidationResult, TestSuiteSpec } from "@mcpeak/runner";
|
|
3
|
+
import { CheckDeterminismOptions, DeterminismResult, FinalizeRunnerExecutionOptions, InputContractOptions, RunSuiteOptions, RunnerExecution, RunnerReport, SpecFinding, SpecFindingsResult, SuiteValidationIssue, SuiteValidationResult, TestSuiteSpec } from "@mcpeak/runner";
|
|
4
4
|
import "@mcpeak/record/external";
|
|
5
|
+
//#region src/auto-review-io.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* `generate` 의 승인 질문에 정해진 정책으로 답하는 ReviewIO.
|
|
8
|
+
*
|
|
9
|
+
* 사람용 승인 화면(전송·시험 실행·재검증·저장 확인, 실패 분류, 교정 값 입력)을 에이전트나
|
|
10
|
+
* 대시보드의 "한 번에 검증" 이 사람 개입 없이 지나가게 한다. 판정 로직은 없다. 질문마다 어떤
|
|
11
|
+
* 답을 고르는지만 여기 있고, 고른 답은 `sink` 에 한 줄씩 남겨 무엇이 자동으로 결정됐는지
|
|
12
|
+
* 화면에서 읽을 수 있게 한다.
|
|
13
|
+
*
|
|
14
|
+
* 정책:
|
|
15
|
+
* - 검토 메뉴: 처음은 `save`, 그 뒤는 `cancel`. 저장이 되돌아오면(재검증 실패 등) 같은 답을
|
|
16
|
+
* 되풀이하지 않고 끝낸다.
|
|
17
|
+
* - 확인: 전부 예. 단 "그래도 적용합니까" 처럼 선언 위반이 남은 후보의 적용은 아니오.
|
|
18
|
+
* - 실패 분류(`선택: `): `s`(서버 결함). 교정 뒤에도 남은 실패는 명세가 옳고 서버가 틀린 것으로
|
|
19
|
+
* 기록한다. 보류(`?`)는 저장을 막으므로 쓰지 않는다.
|
|
20
|
+
* - 교정 값 입력(`엔터 = …`): 빈 문자열. 제안이 있으면 제안 값, 없으면 현재 값을 그대로 둔다.
|
|
21
|
+
* - 그 밖의 입력: 빈 문자열. 저장 경로에서는 나오지 않는다.
|
|
22
|
+
*/
|
|
23
|
+
interface AutoReviewIO extends ReviewIO {
|
|
24
|
+
/**
|
|
25
|
+
* 검토 메뉴에 두 번째로 닿아 `cancel` 로 끝냈는가. 저장이 되돌아왔다는 뜻이고, 그때 generate
|
|
26
|
+
* 는 저장 없이 0 을 돌려준다. 호출자는 이 값으로 "저장 성공" 과 "취소" 를 가른다.
|
|
27
|
+
*/
|
|
28
|
+
readonly cancelled: boolean;
|
|
29
|
+
}
|
|
30
|
+
declare function autoReviewIO(sink: {
|
|
31
|
+
write(text: string): void;
|
|
32
|
+
}): AutoReviewIO;
|
|
33
|
+
//#endregion
|
|
5
34
|
//#region src/test-command.d.ts
|
|
6
35
|
interface TestCommandInput {
|
|
7
36
|
readonly suitePath: string;
|
|
@@ -63,8 +92,13 @@ interface TestCommandDependencies {
|
|
|
63
92
|
readEnv?(name: string): string | undefined;
|
|
64
93
|
startRunner(options: RunSuiteOptions): RunnerExecution;
|
|
65
94
|
finalize(options: FinalizeRunnerExecutionOptions): Promise<RunnerReport>;
|
|
95
|
+
/**
|
|
96
|
+
* `specApproved` 는 명세에 approval 블록이 있는지다. 거절 근거 미확인 고지가 generate 승인
|
|
97
|
+
* 화면을 가리킬지 `--json` 의 rejectionBody 를 가리킬지 가른다. 설계 문서(경쟁 도구 비교) §3.4.
|
|
98
|
+
*/
|
|
66
99
|
renderReport(report: RunnerReport, options?: {
|
|
67
100
|
color?: boolean;
|
|
101
|
+
specApproved?: boolean;
|
|
68
102
|
}): string;
|
|
69
103
|
/**
|
|
70
104
|
* runner 의 `renderJUnit`. 두 번째 인자를 선언하지 않는다 — CLI 는 `suiteName` 을 넘길 이유가
|
|
@@ -79,6 +113,11 @@ interface TestCommandDependencies {
|
|
|
79
113
|
*/
|
|
80
114
|
checkInputContract?(options: InputContractOptions): SpecFindingsResult;
|
|
81
115
|
checkAssertionSubstance?(suite: TestSuiteSpec): SpecFindingsResult;
|
|
116
|
+
/**
|
|
117
|
+
* 거절 기대 케이스에서 억제된 선언 위반. 위 두 필드와 같은 이유로 선택 사항이다. 생략하면
|
|
118
|
+
* `runner` 의 `acceptedViolations` 다. 설계 문서(경쟁 도구 비교) §3.2.
|
|
119
|
+
*/
|
|
120
|
+
acceptedViolations?(options: InputContractOptions): ReadonlyMap<string, readonly SpecFinding[]>;
|
|
82
121
|
/**
|
|
83
122
|
* 결정론성 비교와 초기화 명령의 주입 지점. 위 두 필드와 같은 이유로 선택 사항이다.
|
|
84
123
|
* 생략하면 각각 `runner` 의 `checkDeterminism` 과 `reset-hook.ts` 의 `runResetCommand` 다.
|
|
@@ -102,4 +141,4 @@ declare function parseTestCommand(argv: readonly string[]): TestCommandInput;
|
|
|
102
141
|
*/
|
|
103
142
|
declare function runCli(argv: readonly string[], dependencies: TestCommandDependencies): Promise<number>;
|
|
104
143
|
//#endregion
|
|
105
|
-
export { type CliErrorCode, type CliFailure, type GenerateCommandDependencies, type GenerateCommandInput, type RepairCommandDependencies, type RepairCommandInput, type ReviewIO, type TestCommandDependencies, type TestCommandInput, nodeGenerateDependencies, nodeReviewIO, parseRepairCommand, parseTestCommand, runCli, runGenerateCommand, runRepairCommand };
|
|
144
|
+
export { type AuditCommandDependencies, type AuditCommandInput, type AutoReviewIO, type CliErrorCode, type CliFailure, type GenerateCommandDependencies, type GenerateCommandInput, type OptimizeCommandDependencies, type OptimizeCommandInput, REVIEW_BACK_VALUE, type RepairCommandDependencies, type RepairCommandInput, type ReviewIO, type TestCommandDependencies, type TestCommandInput, autoReviewIO, nodeAuditDependencies, nodeGenerateDependencies, nodeReviewIO, parseAuditCommand, parseOptimizeCommand, parseRepairCommand, parseTestCommand, runAuditCommand, runCli, runGenerateCommand, runOptimizeCommand, runRepairCommand };
|
package/dist/commands.d.mts
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CheckDeterminismOptions, DeterminismResult, FinalizeRunnerExecutionOptions, InputContractOptions, RunSuiteOptions, RunnerExecution, RunnerReport, SpecFindingsResult, SuiteValidationIssue, SuiteValidationResult, TestSuiteSpec } from "@mcpeak/runner";
|
|
1
|
+
import { C as AuditCommandInput, E as ConnectTarget, S as AuditCommandDependencies, T as runAuditCommand, _ as REVIEW_BACK_VALUE, b as nodeReviewIO, c as RepairCommandInput, d as OptimizeCommandDependencies, f as OptimizeCommandInput, g as GenerateCommandInput, h as GenerateCommandDependencies, l as parseRepairCommand, m as runOptimizeCommand, p as parseOptimizeCommand, r as nodeAuditDependencies, s as RepairCommandDependencies, u as runRepairCommand, v as ReviewIO, w as parseAuditCommand, x as runGenerateCommand, y as nodeGenerateDependencies } from "./index-CBFNkZgR.mjs";
|
|
2
|
+
import { CheckDeterminismOptions, DeterminismResult, FinalizeRunnerExecutionOptions, InputContractOptions, RunSuiteOptions, RunnerExecution, RunnerReport, SpecFinding, SpecFindingsResult, SuiteValidationIssue, SuiteValidationResult, TestSuiteSpec } from "@mcpeak/runner";
|
|
3
3
|
import { McpHttpConnection, McpStdioConnection } from "@mcpeak/core";
|
|
4
4
|
import "@mcpeak/record/external";
|
|
5
|
+
//#region src/auto-review-io.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* `generate` 의 승인 질문에 정해진 정책으로 답하는 ReviewIO.
|
|
8
|
+
*
|
|
9
|
+
* 사람용 승인 화면(전송·시험 실행·재검증·저장 확인, 실패 분류, 교정 값 입력)을 에이전트나
|
|
10
|
+
* 대시보드의 "한 번에 검증" 이 사람 개입 없이 지나가게 한다. 판정 로직은 없다. 질문마다 어떤
|
|
11
|
+
* 답을 고르는지만 여기 있고, 고른 답은 `sink` 에 한 줄씩 남겨 무엇이 자동으로 결정됐는지
|
|
12
|
+
* 화면에서 읽을 수 있게 한다.
|
|
13
|
+
*
|
|
14
|
+
* 정책:
|
|
15
|
+
* - 검토 메뉴: 처음은 `save`, 그 뒤는 `cancel`. 저장이 되돌아오면(재검증 실패 등) 같은 답을
|
|
16
|
+
* 되풀이하지 않고 끝낸다.
|
|
17
|
+
* - 확인: 전부 예. 단 "그래도 적용합니까" 처럼 선언 위반이 남은 후보의 적용은 아니오.
|
|
18
|
+
* - 실패 분류(`선택: `): `s`(서버 결함). 교정 뒤에도 남은 실패는 명세가 옳고 서버가 틀린 것으로
|
|
19
|
+
* 기록한다. 보류(`?`)는 저장을 막으므로 쓰지 않는다.
|
|
20
|
+
* - 교정 값 입력(`엔터 = …`): 빈 문자열. 제안이 있으면 제안 값, 없으면 현재 값을 그대로 둔다.
|
|
21
|
+
* - 그 밖의 입력: 빈 문자열. 저장 경로에서는 나오지 않는다.
|
|
22
|
+
*/
|
|
23
|
+
interface AutoReviewIO extends ReviewIO {
|
|
24
|
+
/**
|
|
25
|
+
* 검토 메뉴에 두 번째로 닿아 `cancel` 로 끝냈는가. 저장이 되돌아왔다는 뜻이고, 그때 generate
|
|
26
|
+
* 는 저장 없이 0 을 돌려준다. 호출자는 이 값으로 "저장 성공" 과 "취소" 를 가른다.
|
|
27
|
+
*/
|
|
28
|
+
readonly cancelled: boolean;
|
|
29
|
+
}
|
|
30
|
+
declare function autoReviewIO(sink: {
|
|
31
|
+
write(text: string): void;
|
|
32
|
+
}): AutoReviewIO;
|
|
33
|
+
//#endregion
|
|
5
34
|
//#region src/test-command.d.ts
|
|
6
35
|
interface TestCommandInput {
|
|
7
36
|
readonly suitePath: string;
|
|
@@ -63,8 +92,13 @@ interface TestCommandDependencies {
|
|
|
63
92
|
readEnv?(name: string): string | undefined;
|
|
64
93
|
startRunner(options: RunSuiteOptions): RunnerExecution;
|
|
65
94
|
finalize(options: FinalizeRunnerExecutionOptions): Promise<RunnerReport>;
|
|
95
|
+
/**
|
|
96
|
+
* `specApproved` 는 명세에 approval 블록이 있는지다. 거절 근거 미확인 고지가 generate 승인
|
|
97
|
+
* 화면을 가리킬지 `--json` 의 rejectionBody 를 가리킬지 가른다. 설계 문서(경쟁 도구 비교) §3.4.
|
|
98
|
+
*/
|
|
66
99
|
renderReport(report: RunnerReport, options?: {
|
|
67
100
|
color?: boolean;
|
|
101
|
+
specApproved?: boolean;
|
|
68
102
|
}): string;
|
|
69
103
|
/**
|
|
70
104
|
* runner 의 `renderJUnit`. 두 번째 인자를 선언하지 않는다 — CLI 는 `suiteName` 을 넘길 이유가
|
|
@@ -79,6 +113,11 @@ interface TestCommandDependencies {
|
|
|
79
113
|
*/
|
|
80
114
|
checkInputContract?(options: InputContractOptions): SpecFindingsResult;
|
|
81
115
|
checkAssertionSubstance?(suite: TestSuiteSpec): SpecFindingsResult;
|
|
116
|
+
/**
|
|
117
|
+
* 거절 기대 케이스에서 억제된 선언 위반. 위 두 필드와 같은 이유로 선택 사항이다. 생략하면
|
|
118
|
+
* `runner` 의 `acceptedViolations` 다. 설계 문서(경쟁 도구 비교) §3.2.
|
|
119
|
+
*/
|
|
120
|
+
acceptedViolations?(options: InputContractOptions): ReadonlyMap<string, readonly SpecFinding[]>;
|
|
82
121
|
/**
|
|
83
122
|
* 결정론성 비교와 초기화 명령의 주입 지점. 위 두 필드와 같은 이유로 선택 사항이다.
|
|
84
123
|
* 생략하면 각각 `runner` 의 `checkDeterminism` 과 `reset-hook.ts` 의 `runResetCommand` 다.
|
|
@@ -102,4 +141,4 @@ declare function parseTestCommand(argv: readonly string[]): TestCommandInput;
|
|
|
102
141
|
*/
|
|
103
142
|
declare function runCli(argv: readonly string[], dependencies: TestCommandDependencies): Promise<number>;
|
|
104
143
|
//#endregion
|
|
105
|
-
export { type CliErrorCode, type CliFailure, type GenerateCommandDependencies, type GenerateCommandInput, type RepairCommandDependencies, type RepairCommandInput, type ReviewIO, type TestCommandDependencies, type TestCommandInput, nodeGenerateDependencies, nodeReviewIO, parseRepairCommand, parseTestCommand, runCli, runGenerateCommand, runRepairCommand };
|
|
144
|
+
export { type AuditCommandDependencies, type AuditCommandInput, type AutoReviewIO, type CliErrorCode, type CliFailure, type GenerateCommandDependencies, type GenerateCommandInput, type OptimizeCommandDependencies, type OptimizeCommandInput, REVIEW_BACK_VALUE, type RepairCommandDependencies, type RepairCommandInput, type ReviewIO, type TestCommandDependencies, type TestCommandInput, autoReviewIO, nodeAuditDependencies, nodeGenerateDependencies, nodeReviewIO, parseAuditCommand, parseOptimizeCommand, parseRepairCommand, parseTestCommand, runAuditCommand, runCli, runGenerateCommand, runOptimizeCommand, runRepairCommand };
|
package/dist/commands.mjs
CHANGED
|
@@ -1,2 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { _ as runCli, c as parseOptimizeCommand, d as nodeGenerateDependencies, f as nodeReviewIO, g as parseTestCommand, h as runAuditCommand, l as runOptimizeCommand, m as parseAuditCommand, n as nodeAuditDependencies, o as parseRepairCommand, p as runGenerateCommand, s as runRepairCommand, u as REVIEW_BACK_VALUE } from "./src-CRsYPuu_.mjs";
|
|
2
|
+
//#region src/auto-review-io.ts
|
|
3
|
+
function autoReviewIO(sink) {
|
|
4
|
+
let menuSeen = false;
|
|
5
|
+
let cancelled = false;
|
|
6
|
+
const note = (question, answer) => {
|
|
7
|
+
sink.write(`▸ 자동 승인: ${summarize(question)} → ${answer}\n`);
|
|
8
|
+
};
|
|
9
|
+
return {
|
|
10
|
+
interactive: true,
|
|
11
|
+
get cancelled() {
|
|
12
|
+
return cancelled;
|
|
13
|
+
},
|
|
14
|
+
write: (text) => sink.write(text),
|
|
15
|
+
async choose(message, choices) {
|
|
16
|
+
if (message === "검토 메뉴") {
|
|
17
|
+
const answer = menuSeen ? "cancel" : "save";
|
|
18
|
+
if (menuSeen) cancelled = true;
|
|
19
|
+
menuSeen = true;
|
|
20
|
+
note(message, answer);
|
|
21
|
+
return answer;
|
|
22
|
+
}
|
|
23
|
+
const answer = choices[0] ?? "";
|
|
24
|
+
note(message, answer);
|
|
25
|
+
return answer;
|
|
26
|
+
},
|
|
27
|
+
async confirm(message) {
|
|
28
|
+
const answer = !/그래도 적용합니까/.test(message);
|
|
29
|
+
note(message, answer ? "예" : "아니오");
|
|
30
|
+
return answer;
|
|
31
|
+
},
|
|
32
|
+
async input(message) {
|
|
33
|
+
const answer = /^\s*선택:\s*$/.test(message) ? "s" : "";
|
|
34
|
+
note(message, answer === "" ? "(엔터)" : answer);
|
|
35
|
+
return answer;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** 로그 한 줄에 들어갈 만큼만 남긴다. 질문 본문은 이미 화면에 찍혀 있다. */
|
|
40
|
+
function summarize(question) {
|
|
41
|
+
const oneLine = question.replace(/\s+/g, " ").trim();
|
|
42
|
+
return oneLine.length > 60 ? `${oneLine.slice(0, 57)}...` : oneLine;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { REVIEW_BACK_VALUE, autoReviewIO, nodeAuditDependencies, nodeGenerateDependencies, nodeReviewIO, parseAuditCommand, parseOptimizeCommand, parseRepairCommand, parseTestCommand, runAuditCommand, runCli, runGenerateCommand, runOptimizeCommand, runRepairCommand };
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import { SuiteValidationResult, TestSuiteSpec } from "@mcpeak/runner";
|
|
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
|
|
12
|
+
//#region src/connect-target.d.ts
|
|
13
|
+
/** 파서가 확정한 연결 대상. */
|
|
14
|
+
type ConnectTarget = {
|
|
15
|
+
readonly transport: "stdio";
|
|
16
|
+
readonly command: string;
|
|
17
|
+
readonly args: readonly string[];
|
|
18
|
+
/**
|
|
19
|
+
* 자식에게 넘길 부모 환경변수의 **이름**. 값은 여기에도 argv 에도 없다(`--header-env` 와
|
|
20
|
+
* 같은 이유). `openConnection` 이 `readEnv` 로 읽어 `env` 에 얹는다.
|
|
21
|
+
*/
|
|
22
|
+
readonly envNames: readonly string[];
|
|
23
|
+
} | {
|
|
24
|
+
readonly transport: "http";
|
|
25
|
+
readonly url: string;
|
|
26
|
+
/**
|
|
27
|
+
* 헤더 이름 → 그 값을 담은 **환경변수 이름**. 값 자체는 여기에도 argv 에도 없다.
|
|
28
|
+
*
|
|
29
|
+
* 평문 `--header 'Authorization: Bearer …'` 를 두지 않은 이유가 이 타입이다. 토큰을
|
|
30
|
+
* argv 에 실으면 `ps` 목록과 셸 히스토리에 그대로 남고, 그건 우리가 만든 노출이다.
|
|
31
|
+
*/
|
|
32
|
+
readonly headerEnv: Readonly<Record<string, string>>;
|
|
33
|
+
};
|
|
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
|
|
107
|
+
//#region src/reset-hook.d.ts
|
|
108
|
+
/**
|
|
109
|
+
* 초기화가 실제로 무엇을 했는가. `--reset-cmd` 가 0 으로 끝난 것을 "초기 상태" 라고
|
|
110
|
+
* 부르지 않기 위해 있다. 명령이 무엇을 복원했는지 우리는 모른다(이슈 #399).
|
|
111
|
+
*/
|
|
112
|
+
type ResetGrade =
|
|
113
|
+
/**
|
|
114
|
+
* 새 프로세스·새 연결 + 초기화 명령 성공. 우리가 제공할 수 있는 가장 강한 것.
|
|
115
|
+
*
|
|
116
|
+
* **이번 회차는 이 값을 내지 않는다.** 프로세스를 다시 띄우는 것은 core 의 수명주기를
|
|
117
|
+
* 건드리고, generate 흐름 한가운데서 연결을 바꾸면 그 뒤 단계가 전부 새 client 를 봐야
|
|
118
|
+
* 한다. 값을 미리 정의하는 이유는, commandOnly 를 "초기 상태" 라고 부르지 않으려면
|
|
119
|
+
* 그보다 강한 것이 있다는 사실이 타입에 있어야 하기 때문이다. 죽은 값이 아니라
|
|
120
|
+
* 의도된 자리다. 지우지 마라(설계 §3).
|
|
121
|
+
*/
|
|
122
|
+
"freshProcess" |
|
|
123
|
+
/** 같은 연결에 초기화 명령만 성공. 서버 프로세스의 메모리 상태는 그대로다. */
|
|
124
|
+
"commandOnly" |
|
|
125
|
+
/** 초기화 수단이 없다. 앞 실행이 바꾼 상태가 남아 있다. */
|
|
126
|
+
"none" |
|
|
127
|
+
/** 초기화를 시도했으나 실패했다. 상태를 모른다. */
|
|
128
|
+
"failed";
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/generate-command.d.ts
|
|
131
|
+
interface GenerateCommandInput {
|
|
132
|
+
readonly suiteId: string;
|
|
133
|
+
readonly name: string;
|
|
134
|
+
readonly outPath: string;
|
|
135
|
+
/**
|
|
136
|
+
* 명세를 뽑을 대상. `--command`/`--arg` 면 stdio, `--url` 이면 Streamable HTTP 다(#137).
|
|
137
|
+
* `command` · `args` 두 필드를 이 하나로 바꾼 근거는 `TestCommandInput.target` 과 같다.
|
|
138
|
+
*/
|
|
139
|
+
readonly target: ConnectTarget;
|
|
140
|
+
readonly baselineOnly: boolean;
|
|
141
|
+
readonly provider?: "codex" | "claude";
|
|
142
|
+
readonly model?: string;
|
|
143
|
+
/** 승인 전 시험 실행 여부. 기본은 실행이고 `--no-dry-run` 이 끈다. 설계 문서 §4.3. */
|
|
144
|
+
readonly dryRun: boolean;
|
|
145
|
+
/** `--force`. `--out` 에 파일이 있으면 지우고 새로 쓴다. 설계 문서 §5. */
|
|
146
|
+
readonly force: boolean;
|
|
147
|
+
/** `--reset-cmd`. 시험 실행 직전 1회 실행한다. */
|
|
148
|
+
readonly resetCmd?: string;
|
|
149
|
+
/** 입력값 교정 단계를 돌릴지 여부. 기본은 실행이고 `--no-repair` 가 끈다. 설계 문서 §7. */
|
|
150
|
+
readonly repair: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* 통과한 거절 케이스의 근거를 확인할지 여부. 기본은 꺼짐이고 `--diagnose-rejections` 가 켠다.
|
|
153
|
+
* 끄면 미확인 목록도 AI 진단도 나가지 않고 한 줄 고지만 남는다(ADR-0098 · 설계 §4.2).
|
|
154
|
+
*/
|
|
155
|
+
readonly diagnoseRejections: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* `--fixtures` 로 명시한 픽스처 파일 경로. 없으면 기본 경로(`mcpeak.fixtures.json`)를 본다.
|
|
158
|
+
*
|
|
159
|
+
* "명시했는가" 를 여기서 구분해 두는 이유는 없는 파일의 처리가 다르기 때문이다. 기본
|
|
160
|
+
* 경로는 없는 것이 정상이라 조용히 지나가고, 사용자가 적은 경로가 없는 것은 오타다(#390).
|
|
161
|
+
*/
|
|
162
|
+
readonly fixturesPath?: string;
|
|
163
|
+
}
|
|
164
|
+
interface GenerateCommandDependencies {
|
|
165
|
+
connect(options: {
|
|
166
|
+
command: string;
|
|
167
|
+
args: readonly string[];
|
|
168
|
+
}): Promise<McpStdioConnection>;
|
|
169
|
+
/**
|
|
170
|
+
* 원격(Streamable HTTP) 대상용 연결. `core.connectHttp` 다. 선택 사항으로 두는 근거는
|
|
171
|
+
* `TestCommandDependencies.connectHttp` 와 같다(#137).
|
|
172
|
+
*/
|
|
173
|
+
connectHttp?(options: {
|
|
174
|
+
url: string;
|
|
175
|
+
headers?: Readonly<Record<string, string>>;
|
|
176
|
+
}): Promise<McpHttpConnection>;
|
|
177
|
+
/** `--header-env` 가 가리키는 환경변수를 읽는다. CLI 가 `process` 를 직접 읽지 않기 위한 주입점. */
|
|
178
|
+
readEnv?(name: string): string | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* 초기화 주입점. 기본은 `attemptReset` 이다.
|
|
181
|
+
*
|
|
182
|
+
* 사전보완 후보 비교가 같은 초기 상태에서 도는지를 유닛테스트가 보려면 초기화를 세워야 하는데,
|
|
183
|
+
* 실제 `attemptReset` 은 프로세스를 띄운다. 이 저장소는 유닛테스트를 인메모리로만 돌린다
|
|
184
|
+
* (터미널 병렬 안전). `dryRun` · `preparePreFillRequest` 를 주입으로 받는 것과 같은 이유다.
|
|
185
|
+
* 실제 명령을 돌리는 테스트는 `reset-hook-e2e.test.ts` 하나에만 둔다(#399).
|
|
186
|
+
*/
|
|
187
|
+
attemptReset?(resetCmd: string | undefined): Promise<{
|
|
188
|
+
readonly grade: ResetGrade;
|
|
189
|
+
}>;
|
|
190
|
+
createBaselineSuite(tools: readonly ToolDef[], options: {
|
|
191
|
+
suiteId: string;
|
|
192
|
+
suiteName: string;
|
|
193
|
+
fixtures?: FixtureFile;
|
|
194
|
+
}): BaselineGenerationResult;
|
|
195
|
+
createAuthoringSession(baseline: BaselineGenerationResult, options?: {
|
|
196
|
+
readonly preFilledCaseIds?: readonly string[];
|
|
197
|
+
}): AuthoringSessionView;
|
|
198
|
+
finalizeAuthoringDraft(options: {
|
|
199
|
+
session: AuthoringSessionView;
|
|
200
|
+
approval: {
|
|
201
|
+
approved: boolean;
|
|
202
|
+
fingerprint: string;
|
|
203
|
+
};
|
|
204
|
+
}): {
|
|
205
|
+
finalized: true;
|
|
206
|
+
snapshot: AuthoringExecutionSnapshot;
|
|
207
|
+
} | {
|
|
208
|
+
finalized: false;
|
|
209
|
+
};
|
|
210
|
+
getAuthoringExecutionSuite(snapshot: AuthoringExecutionSnapshot): TestSuiteSpec;
|
|
211
|
+
validateSuite(value: unknown): SuiteValidationResult;
|
|
212
|
+
exists(path: string): Promise<boolean>;
|
|
213
|
+
openTemp(path: string): Promise<{
|
|
214
|
+
writeFile(data: string, encoding: "utf8"): Promise<void>;
|
|
215
|
+
sync(): Promise<void>;
|
|
216
|
+
close(): Promise<void>;
|
|
217
|
+
}>;
|
|
218
|
+
readFile(path: string): Promise<Uint8Array>;
|
|
219
|
+
/**
|
|
220
|
+
* 임시 파일을 최종 경로에 커밋한다. `rename`이 아니라 `link`인 것이 요점이다.
|
|
221
|
+
* `rename`은 대상이 있으면 말없이 덮어쓴다. `link`는 EEXIST로 실패하므로
|
|
222
|
+
* 원자성과 no-clobber를 동시에 얻는다. 덮어쓸 수 있는 primitive를 아예 두지 않는다.
|
|
223
|
+
*/
|
|
224
|
+
link(from: string, to: string): Promise<void>;
|
|
225
|
+
unlink(path: string): Promise<void>;
|
|
226
|
+
writeStdout(text: string): void;
|
|
227
|
+
writeStderr(text: string): void;
|
|
228
|
+
reviewIO?: ReviewIO;
|
|
229
|
+
providers?: Partial<Record<"codex" | "claude", (model: string) => TestAuthoringProvider | undefined>>;
|
|
230
|
+
/**
|
|
231
|
+
* 거절 근거 진단 통로 (#89 · 설계 문서 §6). `providers` 와 **따로 둔다.** 그쪽은
|
|
232
|
+
* `TestAuthoringProvider`(`author`)이고 이쪽은 `diagnoseRejection` 이라 다른 계약이다.
|
|
233
|
+
* `preFillProviders` 와 같은 선례다. 없으면 진단을 아예 묻지 않는다.
|
|
234
|
+
*/
|
|
235
|
+
rejectionProviders?: Partial<Record<"codex" | "claude", (model: string) => import("@mcpeak/generate").RejectionDiagnosisProvider | undefined>>;
|
|
236
|
+
prepareRejectionDiagnosisRequests?: typeof import("@mcpeak/generate").prepareRejectionDiagnosisRequests;
|
|
237
|
+
dispatchRejectionDiagnosis?: typeof import("@mcpeak/generate").dispatchRejectionDiagnosis;
|
|
238
|
+
prepareAuthoringRequest?: typeof import("@mcpeak/generate").prepareAuthoringRequest;
|
|
239
|
+
dispatchAuthoringRequest?: typeof import("@mcpeak/generate").dispatchAuthoringRequest;
|
|
240
|
+
createAuthoringDiff?: typeof import("@mcpeak/generate").createAuthoringDiff;
|
|
241
|
+
applyAuthoringChanges?: typeof import("@mcpeak/generate").applyAuthoringChanges;
|
|
242
|
+
reviewLocalAuthoringCandidate?: typeof import("@mcpeak/generate").reviewLocalAuthoringCandidate;
|
|
243
|
+
computeCoverage?: typeof import("@mcpeak/generate").computeCoverage;
|
|
244
|
+
/**
|
|
245
|
+
* AI 사전보완 통로. 넷 다 주입돼야 사전보완이 돈다. 하나라도 없으면 건너뛴다.
|
|
246
|
+
* 위 authoring 통로와 같은 이유로 값 import 가 아니라 주입이다.
|
|
247
|
+
*/
|
|
248
|
+
preparePreFillRequest?: typeof import("@mcpeak/generate").preparePreFillRequest;
|
|
249
|
+
previewPreFillRequest?: typeof import("@mcpeak/generate").previewPreFillRequest;
|
|
250
|
+
dispatchPreFillRequest?: typeof import("@mcpeak/generate").dispatchPreFillRequest;
|
|
251
|
+
preFillProviders?: Partial<Record<"codex" | "claude", (model: string) => PreFillProvider | undefined>>;
|
|
252
|
+
/**
|
|
253
|
+
* `instanceof` 용 클래스. 값 import 가 아니라 주입인 것이 요점이다.
|
|
254
|
+
*
|
|
255
|
+
* 이 파일은 `@mcpeak/generate` 에서 타입만 가져온다(위 `import type`). 클래스를 값으로
|
|
256
|
+
* 가져오면 `index.ts` 가 정적으로 끌어와 `test` 경로까지 `generate` 를 로드한다.
|
|
257
|
+
* `typeof import(...)` 는 타입 위치라 런타임 import 가 생기지 않고, 주입하면 클래스
|
|
258
|
+
* 동일성도 보장된다. 위 6개 필드가 같은 방식이다.
|
|
259
|
+
*/
|
|
260
|
+
GenerateTestsError?: typeof import("@mcpeak/generate").GenerateTestsError;
|
|
261
|
+
}
|
|
262
|
+
interface ReviewIO {
|
|
263
|
+
input(message: string): Promise<string>;
|
|
264
|
+
choose(message: string, choices: readonly string[]): Promise<string>;
|
|
265
|
+
confirm(message: string): Promise<boolean>;
|
|
266
|
+
write(text: string): void;
|
|
267
|
+
readonly interactive: boolean;
|
|
268
|
+
close?(): void;
|
|
269
|
+
}
|
|
270
|
+
type TestAuthoringProvider = import("@mcpeak/generate").TestAuthoringProvider;
|
|
271
|
+
/** 대시보드의 검토 하위 입력에서 상위 메뉴로 돌아갈 때 쓰는 내부 제어값. */
|
|
272
|
+
declare const REVIEW_BACK_VALUE = "__mcpeak_review_back__";
|
|
273
|
+
declare function runGenerateCommand(argv: readonly string[], deps: GenerateCommandDependencies): Promise<number>;
|
|
274
|
+
declare const nodeGenerateDependencies: () => Omit<GenerateCommandDependencies, "connect" | "createBaselineSuite" | "createAuthoringSession" | "finalizeAuthoringDraft" | "getAuthoringExecutionSuite" | "validateSuite">;
|
|
275
|
+
declare function nodeReviewIO(input?: NodeJS.ReadableStream, output?: NodeJS.WritableStream): ReviewIO;
|
|
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
|
|
306
|
+
//#region src/repair-command.d.ts
|
|
307
|
+
interface RepairCommandInput {
|
|
308
|
+
readonly bundlePath: string;
|
|
309
|
+
readonly providerId: "codex" | "claude";
|
|
310
|
+
readonly model: string;
|
|
311
|
+
readonly yes: boolean;
|
|
312
|
+
readonly includeStderr: boolean;
|
|
313
|
+
readonly maxCases: number;
|
|
314
|
+
}
|
|
315
|
+
interface RepairCommandDependencies {
|
|
316
|
+
readFile(path: string): Promise<string>;
|
|
317
|
+
writeStdout(text: string): void;
|
|
318
|
+
writeStderr(text: string): void;
|
|
319
|
+
/** 전송 확인 화면. 없으면 비대화형으로 본다. `generate` 가 쓰는 그 인터페이스다. */
|
|
320
|
+
readonly reviewIO?: ReviewIO;
|
|
321
|
+
/**
|
|
322
|
+
* 진단 통로. `@mcpeak/generate` 를 값으로 import 하지 않고 주입받는다. 정적으로 import 하면
|
|
323
|
+
* `test` 경로가 `generate` 를 함께 로드한다. 계획서 §8 위험표 첫 줄이다.
|
|
324
|
+
*/
|
|
325
|
+
readonly diagnosis?: {
|
|
326
|
+
readonly prepare: typeof import("@mcpeak/generate").prepareDiagnosisRequest;
|
|
327
|
+
readonly dispatch: typeof import("@mcpeak/generate").dispatchDiagnosisRequest;
|
|
328
|
+
readonly providers: {
|
|
329
|
+
readonly codex: (model: string) => import("@mcpeak/generate").ServerDiagnosisProvider;
|
|
330
|
+
readonly claude: (model: string) => import("@mcpeak/generate").ServerDiagnosisProvider;
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
declare function parseRepairCommand(argv: readonly string[]): RepairCommandInput;
|
|
335
|
+
declare function runRepairCommand(argv: readonly string[], deps: RepairCommandDependencies): Promise<number>;
|
|
336
|
+
//#endregion
|
|
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 };
|