feat: system optional capabilities

This commit is contained in:
Nicolas Meienberger
2025-11-08 10:14:42 +01:00
parent 4dc239139f
commit 9ec765bd90
13 changed files with 316 additions and 43 deletions

View File

@@ -0,0 +1,9 @@
import { Hono } from "hono";
import { systemInfoDto, type SystemInfoDto } from "./system.dto";
import { systemService } from "./system.service";
export const systemController = new Hono().get("/info", systemInfoDto, async (c) => {
const info = await systemService.getSystemInfo();
return c.json<SystemInfoDto>(info, 200);
});

View File

@@ -0,0 +1,28 @@
import { type } from "arktype";
import { describeRoute, resolver } from "hono-openapi";
export const capabilitiesSchema = type({
docker: "boolean",
});
export const systemInfoResponse = type({
capabilities: capabilitiesSchema,
});
export type SystemInfoDto = typeof systemInfoResponse.infer;
export const systemInfoDto = describeRoute({
description: "Get system information including available capabilities",
tags: ["System"],
operationId: "getSystemInfo",
responses: {
200: {
description: "System information with enabled capabilities",
content: {
"application/json": {
schema: resolver(systemInfoResponse),
},
},
},
},
});

View File

@@ -0,0 +1,11 @@
import { getCapabilities } from "../../core/capabilities";
const getSystemInfo = async () => {
return {
capabilities: await getCapabilities(),
};
};
export const systemService = {
getSystemInfo,
};