ktworkflow-mcp/src/types.ts

462 lines
9.5 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'
| 'refactor'
| 'style';
export type WorkstreamReusablePattern =
| 'blocker'
| 'cleanup'
| 'command-template'
| 'deploy-observation'
| 'none'
| 'review-false-positive'
| 'test-flow';
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 NapcatDeviceProfileCheckInput {
project?: string;
}
export interface BlockerResolutionInput {
attempts?: number;
command?: string;
dryRun?: boolean;
evidence?: string;
nextEntry?: string;
problem?: string;
project?: string;
solution?: string;
title?: string;
}
export interface RemoteHealthCheckInput {
execute?: boolean;
host?: string;
port?: number;
services?: string[];
sshTarget?: string;
}
export type DeployObservationStatus =
| 'passed'
| 'failed'
| 'blocked'
| 'skipped';
export interface DeployObservationInput {
artifactRoot?: string;
buildNumber?: string;
container?: string;
deployment?: string;
execute?: boolean;
expectedCommit?: string;
healthUrl?: string;
imageTag?: string;
jobName?: string;
jenkinsHome?: string;
kubeconfigPath?: string;
namespace?: string;
project?: string;
selector?: string;
smoke?: string;
sshPort?: number;
sshTarget?: string;
}
export interface DeployObservationAssertion {
critical: boolean;
message: string;
name: string;
passed: boolean;
}
export interface DeployObservationCommand {
command: string;
name: string;
}
export interface DeployObservationJenkinsEvidence {
buildNumber: string | null;
commitMatched: boolean | null;
expectedCommit: string | null;
finishedStatus: string | null;
jobName: string;
}
export interface DeployObservationDeploymentEvidence {
container: string;
containerFound: boolean;
desiredReplicas: number | null;
generation: number | null;
image: string | null;
namespace: string;
observedGeneration: number | null;
readyReplicas: number | null;
updatedReplicas: number | null;
}
export interface DeployObservationPodEvidence {
containerFound: boolean;
image: string | null;
name: string | null;
phase: string | null;
ready: boolean | null;
restartCount: number | null;
}
export interface DeployObservationRuntimeHealthEvidence {
checkCount: number | null;
service: string | null;
status: string | null;
}
export interface DeployObservationEvidence {
assertions: DeployObservationAssertion[];
details: {
deployment: DeployObservationDeploymentEvidence;
eventsTail: string;
jenkins: DeployObservationJenkinsEvidence;
pod: DeployObservationPodEvidence;
runtimeHealth: DeployObservationRuntimeHealthEvidence;
smoke: {
command: string | null;
exitCode: number | null;
output: string;
success: boolean;
};
};
endedAt: string;
environment: 'production';
operation: 'kt_deploy_observation';
project: string;
schemaVersion: 1;
startedAt: string;
status: DeployObservationStatus;
target: string;
taskType: 'deploy';
title: string;
}
export interface DeployObservationResult {
artifactPath?: string;
commands: DeployObservationCommand[];
evidence?: DeployObservationEvidence;
execute: boolean;
notes: string[];
requiredEvidence: string[];
result?: ExecResult;
}
export interface DbSyncPlanInput {
backupName?: string;
source?: 'local' | 'remote';
target?: 'local' | 'remote';
}
export interface ComponentWorkflowInput {
target?:
| 'AdminAuth'
| 'BlogArgon'
| 'FF14Plugin'
| 'FnosK8s'
| '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 WorkstreamCloseoutInput {
changedProjects?: string[];
cleanupEvidence?: string[];
cleanupFinalDeleted?: number;
docSyncEvidence?: string[];
ktWorkflowUpdated?: boolean;
problemRecords?: string[];
reviewEvidence?: string[];
reusablePatterns?: WorkstreamReusablePattern[];
stableSolutions?: string[];
superpowersReviewEvidence?: string[];
title?: string;
upgradeNotes?: string;
verificationEvidence?: string[];
}
export interface ObsidianValidateInput {
checkLayout?: boolean;
failOnWarnings?: boolean;
includeMarkdownLinks?: boolean;
includeStaleReferences?: boolean;
}
export interface ObsidianSyncInput extends ObsidianValidateInput {
includeValidation?: boolean;
}
export interface ObsidianContextInput {
includeCanvas?: boolean;
includeContent?: boolean;
maxDocuments?: number;
module?: string;
query?: string;
}
export interface WorkflowLoopAuditInput {
changedProjects?: string[];
cleanupExecuted?: boolean;
cleanupEvidence?: string[];
cleanupFinalDeleted?: number;
cleanupPreviewDeleted?: number;
docSyncEvidence?: string[];
failureRecords?: string[];
ktWorkflowUpdated?: boolean;
problemRecords?: string[];
requireCompletion?: boolean;
reusablePattern?: boolean;
reviewEvidence?: string[];
stableSolutions?: string[];
stage?: 'failure' | 'finish' | 'start' | 'test';
superpowersReviewEvidence?: string[];
taskTitle?: string;
testCases?: string[];
verificationEvidence?: string[];
}
export interface ChangeDocSyncInput {
changedFiles?: string[];
project?: string;
taskType?: TaskType;
}
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';
}>;
}