feat(import): add central yaml import for all exportable kinds

- add POST /import, an import page and the import_yaml mcp tool; items
  are validated up front and imported in dependency order
- switch list page import buttons to the central import
- write scenario exports as separate --- yaml documents per entity
- give each test app its own files dir to avoid cross-suite races
- use node: prefix for node built-in imports
- bump version to 1.18.0
This commit is contained in:
ars9 committed 2026-09-30 19:25:03 +03:00
1 parent cf56840df9
commit 8935783371
39 files changed
+848 -130

No files matched your search

+2
View File
@@ -6,6 +6,7 @@ import { EnvironmentModule } from "../environment/environment.module";
import { ScenarioModule } from "../scenario/scenario.module";
import { SessionModule } from "../session/session.module";
import { SnippetModule } from "../snippet/snippet.module";
import { ImportModule } from "../import/import.module";
import { McpController } from "./mcp.controller";
import { McpService } from "./mcp.service";
@@ -18,6 +19,7 @@ import { McpService } from "./mcp.service";
CodeExecutorModule,
ScenarioModule,
SnippetModule,
ImportModule,
],
controllers: [McpController],
providers: [McpService],
+31
View File
@@ -14,6 +14,7 @@ import { CodeExecutorService } from "../code-executor/code-executor.service";
import { ScenarioService } from "../scenario/scenario.service";
import { E2eExportService } from "../scenario/e2e-export.service";
import { SnippetService } from "../snippet/snippet.service";
import { ImportService } from "../import/import.service";
import pkg from "../../package.json";
@@ -29,6 +30,7 @@ export class McpService {
private readonly scenarioService: ScenarioService,
private readonly e2eExportService: E2eExportService,
private readonly snippetService: SnippetService,
private readonly importService: ImportService,
) {}
private createServer(): McpServer {
@@ -1307,6 +1309,35 @@ export class McpService {
},
);
server.registerTool(
"import_yaml",
{
description:
"Import any mix of exported environments, credentials, snippets and scenarios from YAML: `---`-separated documents, each holding one item or a list of items, each with a `kind`. All items are validated before anything is imported; versioned items (snippets, scenarios) must include `version`",
inputSchema: {
yaml: z.string().describe("YAML text, e.g. the content of an export file"),
},
},
async ({ yaml }) => {
try {
const result = await this.importService.importYaml(yaml);
return {
content: [{ type: "text" as const, text: JSON.stringify(result) }],
};
} catch (err) {
const response = (err as { getResponse?: () => unknown }).getResponse?.();
const message =
response && typeof response === "object" && "message" in response
? JSON.stringify((response as { message: unknown }).message)
: (err as Error).message;
return {
isError: true,
content: [{ type: "text" as const, text: message }],
};
}
},
);
server.registerTool(
"export_e2e_test",
{