mirror of
https://github.com/aljazceru/claude-code-viewer.git
synced 2025-12-30 11:44:22 +01:00
feat: system information view
This commit is contained in:
@@ -4,6 +4,7 @@ import type { ControllerResponse } from "../../../lib/effect/toEffectResponse";
|
||||
import type { InferEffect } from "../../../lib/effect/types";
|
||||
import { ApplicationContext } from "../../platform/services/ApplicationContext";
|
||||
import { ProjectRepository } from "../../project/infrastructure/ProjectRepository";
|
||||
import * as ClaudeCodeVersion from "../models/ClaudeCodeVersion";
|
||||
import { ClaudeCodeService } from "../services/ClaudeCodeService";
|
||||
|
||||
const LayerImpl = Effect.gen(function* () {
|
||||
@@ -80,9 +81,43 @@ const LayerImpl = Effect.gen(function* () {
|
||||
} as const satisfies ControllerResponse;
|
||||
});
|
||||
|
||||
const getClaudeCodeMeta = () =>
|
||||
Effect.gen(function* () {
|
||||
const config = yield* claudeCodeService.getClaudeCodeMeta();
|
||||
return {
|
||||
response: {
|
||||
executablePath: config.claudeCodeExecutablePath,
|
||||
version: config.claudeCodeVersion
|
||||
? ClaudeCodeVersion.versionText(config.claudeCodeVersion)
|
||||
: null,
|
||||
},
|
||||
status: 200,
|
||||
} as const satisfies ControllerResponse;
|
||||
});
|
||||
|
||||
const getAvailableFeatures = () =>
|
||||
Effect.gen(function* () {
|
||||
const features = yield* claudeCodeService.getAvailableFeatures();
|
||||
const featuresList = Object.entries(features).flatMap(([key, value]) => {
|
||||
return [
|
||||
{
|
||||
name: key as keyof typeof features,
|
||||
enabled: value,
|
||||
},
|
||||
];
|
||||
});
|
||||
|
||||
return {
|
||||
response: { features: featuresList },
|
||||
status: 200,
|
||||
} as const satisfies ControllerResponse;
|
||||
});
|
||||
|
||||
return {
|
||||
getClaudeCommands,
|
||||
getMcpListRoute,
|
||||
getClaudeCodeMeta,
|
||||
getAvailableFeatures,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -13,6 +13,21 @@ class ProjectPathNotFoundError extends Data.TaggedError(
|
||||
const LayerImpl = Effect.gen(function* () {
|
||||
const projectRepository = yield* ProjectRepository;
|
||||
|
||||
const getClaudeCodeMeta = () =>
|
||||
Effect.gen(function* () {
|
||||
const config = yield* ClaudeCode.Config;
|
||||
return config;
|
||||
});
|
||||
|
||||
const getAvailableFeatures = () =>
|
||||
Effect.gen(function* () {
|
||||
const config = yield* ClaudeCode.Config;
|
||||
const features = ClaudeCode.getAvailableFeatures(
|
||||
config.claudeCodeVersion,
|
||||
);
|
||||
return features;
|
||||
});
|
||||
|
||||
const getMcpList = (projectId: string) =>
|
||||
Effect.gen(function* () {
|
||||
const { project } = yield* projectRepository.getProject(projectId);
|
||||
@@ -27,7 +42,9 @@ const LayerImpl = Effect.gen(function* () {
|
||||
});
|
||||
|
||||
return {
|
||||
getClaudeCodeMeta,
|
||||
getMcpList,
|
||||
getAvailableFeatures,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { setCookie } from "hono/cookie";
|
||||
import { streamSSE } from "hono/streaming";
|
||||
import prexit from "prexit";
|
||||
import { z } from "zod";
|
||||
import packageJson from "../../../package.json" with { type: "json" };
|
||||
import { ClaudeCodeController } from "../core/claude-code/presentation/ClaudeCodeController";
|
||||
import { ClaudeCodePermissionController } from "../core/claude-code/presentation/ClaudeCodePermissionController";
|
||||
import { ClaudeCodeSessionProcessController } from "../core/claude-code/presentation/ClaudeCodeSessionProcessController";
|
||||
@@ -94,6 +95,12 @@ export const routes = (app: HonoAppType) =>
|
||||
});
|
||||
})
|
||||
|
||||
.get("/version", async (c) => {
|
||||
return c.json({
|
||||
version: packageJson.version,
|
||||
});
|
||||
})
|
||||
|
||||
/**
|
||||
* ProjectController Routes
|
||||
*/
|
||||
@@ -298,6 +305,26 @@ export const routes = (app: HonoAppType) =>
|
||||
return response;
|
||||
})
|
||||
|
||||
.get("/cc/meta", async (c) => {
|
||||
const response = await effectToResponse(
|
||||
c,
|
||||
claudeCodeController
|
||||
.getClaudeCodeMeta()
|
||||
.pipe(Effect.provide(runtime)),
|
||||
);
|
||||
return response;
|
||||
})
|
||||
|
||||
.get("/cc/features", async (c) => {
|
||||
const response = await effectToResponse(
|
||||
c,
|
||||
claudeCodeController
|
||||
.getAvailableFeatures()
|
||||
.pipe(Effect.provide(runtime)),
|
||||
);
|
||||
return response;
|
||||
})
|
||||
|
||||
/**
|
||||
* ClaudeCodeSessionProcessController Routes
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user