@kirrosh/zond 0.12.1 → 0.12.3
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
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "../../core/generator/index.ts";
|
|
14
14
|
import { loadEnvironment } from "../../core/parser/variables.ts";
|
|
15
15
|
import { compressEndpointsWithSchemas, buildGenerationGuide } from "../../core/generator/guide-builder.ts";
|
|
16
|
+
import { findCollectionBySpec } from "../../db/queries.ts";
|
|
16
17
|
import { planChunks, filterByTag } from "../../core/generator/chunker.ts";
|
|
17
18
|
import { TOOL_DESCRIPTIONS } from "../descriptions.js";
|
|
18
19
|
import { validateAndSave } from "./save-test-suite.ts";
|
|
@@ -39,7 +40,11 @@ export function registerGenerateAndSaveTool(server: McpServer) {
|
|
|
39
40
|
const securitySchemes = extractSecuritySchemes(doc);
|
|
40
41
|
const baseUrl = ((doc as any).servers?.[0]?.url) as string | undefined;
|
|
41
42
|
const title = (doc as any).info?.title as string | undefined;
|
|
42
|
-
|
|
43
|
+
let effectiveOutputDir = outputDir;
|
|
44
|
+
if (!effectiveOutputDir) {
|
|
45
|
+
const collection = findCollectionBySpec(specPath);
|
|
46
|
+
effectiveOutputDir = collection?.test_path ?? "./tests/";
|
|
47
|
+
}
|
|
43
48
|
const effectiveMode = mode ?? "generate";
|
|
44
49
|
|
|
45
50
|
// Apply method filter
|
|
@@ -123,12 +128,12 @@ export function registerGenerateAndSaveTool(server: McpServer) {
|
|
|
123
128
|
const fileName = (suite.fileStem ?? suite.name) + ".yaml";
|
|
124
129
|
const filePath = join(effectiveOutputDir, fileName);
|
|
125
130
|
|
|
126
|
-
const result = await validateAndSave(filePath, yaml, overwrite ?? false);
|
|
131
|
+
const { result: saveResult } = await validateAndSave(filePath, yaml, overwrite ?? false);
|
|
127
132
|
files.push({
|
|
128
|
-
saved:
|
|
129
|
-
filePath:
|
|
133
|
+
saved: saveResult.saved,
|
|
134
|
+
filePath: saveResult.filePath ?? filePath,
|
|
130
135
|
tests: suite.tests.length,
|
|
131
|
-
...(
|
|
136
|
+
...(saveResult.error ? { error: saveResult.error } : {}),
|
|
132
137
|
});
|
|
133
138
|
}
|
|
134
139
|
|