Add embedded OpenAPI specification exporter subcommand
Binaries / Verify (push) Has been cancelled
Binaries / Build linux-x64 (push) Has been cancelled
Binaries / Build macos-arm64 (push) Has been cancelled
Binaries / Build macos-x64 (push) Has been cancelled
Binaries / Build windows-x64 (push) Has been cancelled
Binaries / Publish release assets (push) Has been cancelled

This commit is contained in:
gitea committed 2026-08-25 14:19:29 +08:00
1 parent f1380873e4
commit bf2bb3d87a
9 files changed
+3405 -2

No files matched your search

+3361
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -2,7 +2,7 @@
"openapi": "3.1.0",
"info": {
"title": "seal-home Wrapped API",
"version": "0.4.2",
"version": "0.7.0",
"description": "Planned HTTP contract for the seal-home wrapped backend API.\n\nThese endpoints describe the intended stable API for frontend developers and agents once\nthe HTTP adapter is implemented.\nThey are not the raw downstream Seal endpoints. seal-home is responsible for enterprise\nselection, source authentication, response compaction, and diagnostics-friendly fields.\n"
},
"servers": [
+1 -1
View File
@@ -1,7 +1,7 @@
openapi: 3.1.0
info:
title: seal-home Wrapped API
version: 0.4.2
version: 0.7.0
description: |
Planned HTTP contract for the seal-home wrapped backend API.
+9
View File
@@ -156,6 +156,15 @@ describe("CLI version & help handling", () => {
expect(parsed.targetDir).toBe(tmp);
expect(parsed.fileCount).toBeGreaterThan(5);
});
test("openapi command outputs embedded OpenAPI specification", () => {
const result = runCli(["openapi"]);
expect(result.status).toBe(0);
const parsed = JSON.parse(result.stdout.trim());
expect(parsed.openapi).toBe("3.1.0");
expect(parsed.info.title).toContain("seal-home");
expect(parsed.paths).toHaveProperty("/v1/corps");
});
});
function makeConfigEnv(): Record<string, string> {
+8
View File
@@ -0,0 +1,8 @@
import { getOpenApiSchema } from "../../core/embedded-openapi.js";
import { outputOptions, printJson } from "../printer.js";
import type { ParsedArgs } from "../types.js";
export function handleOpenApiCommand(args: ParsedArgs) {
const schema = getOpenApiSchema();
printJson(schema, { ...outputOptions(args.options), allowFull: true });
}
+1
View File
@@ -80,6 +80,7 @@ Usage:
seal-home skill dump
seal-home skill install [--dir <path>|--local]
seal-home skill status
seal-home openapi
seal-home probe [<corpId>]
seal-home config paths
seal-home config get
+7
View File
@@ -13,6 +13,7 @@ import { handleCorpsCommand } from "./commands/corps.js";
import { handleDelegationCommand } from "./commands/delegation.js";
import { handleLlmCommand } from "./commands/llm.js";
import { handleMcpCommand, printMcpConfig } from "./commands/mcp.js";
import { handleOpenApiCommand } from "./commands/openapi.js";
import { handlePermissionsCommand } from "./commands/permissions.js";
import { handleProbeCommand } from "./commands/probe.js";
import { handleRulesCommand } from "./commands/rules.js";
@@ -61,6 +62,7 @@ const KNOWN_AREAS = new Set([
"server",
"mcp-config",
"skill",
"openapi",
"probe"
]);
@@ -144,6 +146,11 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
throw new Error(`Unknown command: ${args.command.join(" ")}. Run 'seal-home help' for available commands.`);
}
if (area === "openapi") {
handleOpenApiCommand(args);
return;
}
if (area === "mcp-config") {
printMcpConfig();
return;
+12
View File
@@ -0,0 +1,12 @@
import { describe, expect, test } from "bun:test";
import { getOpenApiSchema } from "./embedded-openapi.js";
describe("embedded-openapi", () => {
test("returns valid OpenAPI 3.x schema object", () => {
const schema = getOpenApiSchema();
expect(schema).toBeDefined();
expect(schema.openapi).toBe("3.1.0");
expect(schema.info).toHaveProperty("title");
expect(schema.paths).toBeDefined();
});
});
+5
View File
@@ -0,0 +1,5 @@
import openapiSchema from "../../dist/openapi.json" with { type: "json" };
export function getOpenApiSchema(): Record<string, unknown> {
return openapiSchema as Record<string, unknown>;
}