ktworkflow-mcp/src/types.ts

263 lines
4.9 KiB
TypeScript

export type ProjectAlias =
| 'admin'
| 'api'
| 'blog'
| 'fnosK8s'
| 'knife4j'
| 'mcp'
| 'playground'
| 'root'
| 'web';
export type RepoType = 'git' | 'missing' | 'none' | 'svn';
export type TaskType =
| 'api'
| 'backend'
| 'commit'
| 'database'
| 'deploy'
| 'docs'
| 'frontend'
| 'general'
| 'mcp'
| 'page'
| 'style';
export interface ResolvedProject {
alias: ProjectAlias | null;
label: string;
path: string;
relativePath: string;
}
export interface ExecResult {
ok: boolean;
stderr: string;
stdout: string;
}
export interface PackageJsonLike {
engines?: Record<string, string>;
packageManager?: string;
scripts?: Record<string, string>;
}
export interface PackageInfo {
engines: Record<string, string>;
lockfiles: Record<'npm' | 'pnpm' | 'yarn', boolean>;
packageManager: string | null;
packageManagerSpec: string | null;
scripts: Record<string, string>;
}
export interface InspectProjectInput {
includeGit?: boolean;
project?: string;
}
export interface InspectAllProjectsInput {
includeGit?: boolean;
includeRoot?: boolean;
}
export interface VerificationPlanInput {
changeType?: TaskType;
includePageTest?: boolean;
project?: string;
}
export interface PageTestCaseInput {
account?: string;
assertions?: string[];
entryUrl?: string;
project?: string;
steps?: string[];
title?: string;
}
export interface PageTestCaseResult {
account: string;
assertions: string[];
cleanup: string[];
entryUrl: string;
maxRounds: number;
project: ResolvedProject;
protocol: string[];
steps: string[];
title: string;
}
export interface GuardrailsInput {
changeType?: TaskType;
includePageTest?: boolean;
paths?: string[];
project?: string;
taskType?: TaskType;
userRequest?: string;
}
export interface ApiTestPlanInput {
auth?: 'bearer' | 'none';
baseUrl?: string;
body?: Record<string, unknown>;
contentType?: boolean;
endpoint?: string;
expectedFields?: string[];
method?: 'DELETE' | 'GET' | 'PATCH' | 'POST' | 'PUT';
project?: string;
}
export interface CleanupProcessPlanInput {
ports?: number[];
project?: string;
}
export interface CleanupHistoryInput {
dryRun?: boolean;
keep?: number;
roots?: string[];
}
export interface EnvPolicyInput {
project?: string;
}
export interface RiskScanInput {
changedFiles?: string[];
project?: string;
}
export interface GlobalCodeReviewInput {
contentScanMode?: 'all' | 'changed';
includeContentScan?: boolean;
includeRootScan?: boolean;
maxFindingsPerProject?: number;
projects?: string[];
}
export interface FinishTaskInput {
changeType?: TaskType;
cleanupHistory?: boolean;
contentScanMode?: 'all' | 'changed';
includeRootScan?: boolean;
keepHistory?: number;
maxFindingsPerProject?: number;
projects?: string[];
runValidation?: boolean;
}
export interface CommitPlanInput {
includePush?: boolean;
message?: string;
projects?: string[];
}
export interface PushPlanInput {
branch?: string;
projects?: string[];
remote?: string;
}
export type BusinessFlow =
| 'admin-login'
| 'blog-crud'
| 'fflogs-command'
| 'qqbot-account-scan'
| 'qqbot-auto-reply'
| 'qqbot-login-sse'
| 'system-log-visualization'
| 'web-playground-auth';
export interface BusinessTestPlanInput {
baseUrl?: string;
environment?: 'local' | 'remote';
flow?: BusinessFlow | 'all';
}
export interface RemoteHealthCheckInput {
execute?: boolean;
host?: string;
port?: number;
services?: string[];
sshTarget?: string;
}
export interface DbSyncPlanInput {
backupName?: string;
source?: 'local' | 'remote';
target?: 'local' | 'remote';
}
export interface ComponentWorkflowInput {
target?:
| 'AdminAuth'
| 'BlogArgon'
| 'FF14Plugin'
| 'Knife4jSwagger'
| 'KtTable'
| 'NapCatLogin'
| 'QQBot'
| 'SystemLog';
}
export interface PrepareTaskInput extends GuardrailsInput {
changedFiles?: string[];
entryUrl?: string;
includeGit?: boolean;
recordTitle?: string;
}
export interface TaskRecordInput {
content?: string;
date?: string;
dryRun?: boolean;
scope?: string[];
testCase?: string;
title: string;
verification?: string;
}
export interface CommitChecklistInput {
message?: string;
project?: string;
}
export interface WorkflowContextInput {
includeFullDocs?: boolean;
taskRecordCount?: number;
}
export interface VerificationPlanResult {
changeType: TaskType;
commands: string[];
notes: string[];
project: ResolvedProject;
repoType: RepoType;
}
export interface GuardrailSet {
beforeEdit: string[];
doNot: string[];
duringEdit: string[];
verification: VerificationPlanResult & {
pageTestCase?: PageTestCaseResult;
};
}
export interface GuardrailsResult {
guardrails: GuardrailSet;
paths: string[];
project: ResolvedProject;
taskType: TaskType;
userRequest: string;
}
export interface McpTextResponse {
[key: string]: unknown;
content: Array<{
text: string;
type: 'text';
}>;
}