khodkar-cli
Version:
A TypeScript CLI application that extracts business rules and logic from codebases for customer support knowledge bases
500 lines • 15.3 kB
TypeScript
import { z } from 'zod';
export declare const CLIOptionsSchema: z.ZodObject<{
directory: z.ZodString;
output: z.ZodString;
format: z.ZodDefault<z.ZodEnum<["json", "markdown"]>>;
verbose: z.ZodDefault<z.ZodBoolean>;
llmBaseUrl: z.ZodString;
llmApiKey: z.ZodString;
llmModel: z.ZodString;
llmMaxSteps: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
directory: string;
output: string;
format: "json" | "markdown";
verbose: boolean;
llmBaseUrl: string;
llmApiKey: string;
llmModel: string;
llmMaxSteps?: number | undefined;
}, {
directory: string;
output: string;
llmBaseUrl: string;
llmApiKey: string;
llmModel: string;
format?: "json" | "markdown" | undefined;
verbose?: boolean | undefined;
llmMaxSteps?: number | undefined;
}>;
export type CLIOptions = z.infer<typeof CLIOptionsSchema>;
export declare const LLMConfigSchema: z.ZodObject<{
baseUrl: z.ZodString;
apiKey: z.ZodString;
model: z.ZodString;
maxSteps: z.ZodDefault<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
baseUrl: string;
apiKey: string;
model: string;
maxSteps: number;
}, {
baseUrl: string;
apiKey: string;
model: string;
maxSteps?: number | undefined;
}>;
export type LLMConfig = z.infer<typeof LLMConfigSchema>;
export declare const BusinessRuleSchema: z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
description: z.ZodString;
priority: z.ZodDefault<z.ZodEnum<["high", "medium", "low"]>>;
source: z.ZodObject<{
file: z.ZodString;
startLine: z.ZodOptional<z.ZodNumber>;
endLine: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
}, {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
}>;
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
userFacing: z.ZodDefault<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
description: string;
priority: "high" | "medium" | "low";
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
tags: string[];
userFacing: boolean;
}, {
id: string;
title: string;
description: string;
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
priority?: "high" | "medium" | "low" | undefined;
tags?: string[] | undefined;
userFacing?: boolean | undefined;
}>;
export type BusinessRule = z.infer<typeof BusinessRuleSchema>;
export declare const llmObjectGeneratedSchema: z.ZodObject<{
rules: z.ZodArray<z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
description: z.ZodString;
priority: z.ZodDefault<z.ZodEnum<["high", "medium", "low"]>>;
source: z.ZodObject<{
file: z.ZodString;
startLine: z.ZodOptional<z.ZodNumber>;
endLine: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
}, {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
}>;
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
userFacing: z.ZodDefault<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
description: string;
priority: "high" | "medium" | "low";
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
tags: string[];
userFacing: boolean;
}, {
id: string;
title: string;
description: string;
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
priority?: "high" | "medium" | "low" | undefined;
tags?: string[] | undefined;
userFacing?: boolean | undefined;
}>, "many">;
}, "strip", z.ZodTypeAny, {
rules: {
id: string;
title: string;
description: string;
priority: "high" | "medium" | "low";
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
tags: string[];
userFacing: boolean;
}[];
}, {
rules: {
id: string;
title: string;
description: string;
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
priority?: "high" | "medium" | "low" | undefined;
tags?: string[] | undefined;
userFacing?: boolean | undefined;
}[];
}>;
export type LlmObjectGenerated = z.infer<typeof llmObjectGeneratedSchema>;
export declare const AnalysisResultSchema: z.ZodObject<{
analysisDate: z.ZodString;
businessRules: z.ZodArray<z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
description: z.ZodString;
priority: z.ZodDefault<z.ZodEnum<["high", "medium", "low"]>>;
source: z.ZodObject<{
file: z.ZodString;
startLine: z.ZodOptional<z.ZodNumber>;
endLine: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
}, {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
}>;
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
userFacing: z.ZodDefault<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
description: string;
priority: "high" | "medium" | "low";
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
tags: string[];
userFacing: boolean;
}, {
id: string;
title: string;
description: string;
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
priority?: "high" | "medium" | "low" | undefined;
tags?: string[] | undefined;
userFacing?: boolean | undefined;
}>, "many">;
summary: z.ZodObject<{
totalRules: z.ZodNumber;
highPriorityRules: z.ZodNumber;
userFacingRules: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
totalRules: number;
highPriorityRules: number;
userFacingRules: number;
}, {
totalRules: number;
highPriorityRules: number;
userFacingRules: number;
}>;
}, "strip", z.ZodTypeAny, {
analysisDate: string;
businessRules: {
id: string;
title: string;
description: string;
priority: "high" | "medium" | "low";
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
tags: string[];
userFacing: boolean;
}[];
summary: {
totalRules: number;
highPriorityRules: number;
userFacingRules: number;
};
}, {
analysisDate: string;
businessRules: {
id: string;
title: string;
description: string;
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
priority?: "high" | "medium" | "low" | undefined;
tags?: string[] | undefined;
userFacing?: boolean | undefined;
}[];
summary: {
totalRules: number;
highPriorityRules: number;
userFacingRules: number;
};
}>;
export type AnalysisResult = z.infer<typeof AnalysisResultSchema>;
export declare const FileAnalysisSchema: z.ZodObject<{
filePath: z.ZodString;
fileType: z.ZodString;
language: z.ZodString;
size: z.ZodNumber;
lastModified: z.ZodString;
businessRules: z.ZodArray<z.ZodObject<{
id: z.ZodString;
title: z.ZodString;
description: z.ZodString;
priority: z.ZodDefault<z.ZodEnum<["high", "medium", "low"]>>;
source: z.ZodObject<{
file: z.ZodString;
startLine: z.ZodOptional<z.ZodNumber>;
endLine: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
}, {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
}>;
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
userFacing: z.ZodDefault<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
id: string;
title: string;
description: string;
priority: "high" | "medium" | "low";
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
tags: string[];
userFacing: boolean;
}, {
id: string;
title: string;
description: string;
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
priority?: "high" | "medium" | "low" | undefined;
tags?: string[] | undefined;
userFacing?: boolean | undefined;
}>, "many">;
analysisStatus: z.ZodEnum<["pending", "analyzing", "completed", "failed"]>;
error: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
businessRules: {
id: string;
title: string;
description: string;
priority: "high" | "medium" | "low";
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
tags: string[];
userFacing: boolean;
}[];
filePath: string;
fileType: string;
language: string;
size: number;
lastModified: string;
analysisStatus: "pending" | "analyzing" | "completed" | "failed";
error?: string | undefined;
}, {
businessRules: {
id: string;
title: string;
description: string;
source: {
file: string;
startLine?: number | undefined;
endLine?: number | undefined;
};
priority?: "high" | "medium" | "low" | undefined;
tags?: string[] | undefined;
userFacing?: boolean | undefined;
}[];
filePath: string;
fileType: string;
language: string;
size: number;
lastModified: string;
analysisStatus: "pending" | "analyzing" | "completed" | "failed";
error?: string | undefined;
}>;
export type FileAnalysis = z.infer<typeof FileAnalysisSchema>;
export declare const ProgressInfoSchema: z.ZodObject<{
currentFile: z.ZodString;
filesProcessed: z.ZodNumber;
totalFiles: z.ZodNumber;
currentPhase: z.ZodEnum<["scanning", "analyzing", "formatting", "complete"]>;
estimatedTimeRemaining: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
currentFile: string;
filesProcessed: number;
totalFiles: number;
currentPhase: "analyzing" | "scanning" | "formatting" | "complete";
estimatedTimeRemaining?: number | undefined;
}, {
currentFile: string;
filesProcessed: number;
totalFiles: number;
currentPhase: "analyzing" | "scanning" | "formatting" | "complete";
estimatedTimeRemaining?: number | undefined;
}>;
export type ProgressInfo = z.infer<typeof ProgressInfoSchema>;
export declare const MCPServerConfigSchema: z.ZodObject<{
name: z.ZodString;
command: z.ZodString;
args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
enabled: z.ZodDefault<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
name: string;
command: string;
args: string[];
enabled: boolean;
env?: Record<string, string> | undefined;
}, {
name: string;
command: string;
args?: string[] | undefined;
env?: Record<string, string> | undefined;
enabled?: boolean | undefined;
}>;
export type MCPServerConfig = z.infer<typeof MCPServerConfigSchema>;
export declare const LLMAnalysisRequestSchema: z.ZodObject<{
filePath: z.ZodString;
fileContent: z.ZodString;
language: z.ZodString;
context: z.ZodObject<{
projectName: z.ZodOptional<z.ZodString>;
fileType: z.ZodString;
relatedFiles: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
}, "strip", z.ZodTypeAny, {
fileType: string;
relatedFiles: string[];
projectName?: string | undefined;
}, {
fileType: string;
projectName?: string | undefined;
relatedFiles?: string[] | undefined;
}>;
}, "strip", z.ZodTypeAny, {
filePath: string;
language: string;
fileContent: string;
context: {
fileType: string;
relatedFiles: string[];
projectName?: string | undefined;
};
}, {
filePath: string;
language: string;
fileContent: string;
context: {
fileType: string;
projectName?: string | undefined;
relatedFiles?: string[] | undefined;
};
}>;
export type LLMAnalysisRequest = z.infer<typeof LLMAnalysisRequestSchema>;
export declare const MarkdownOutputSchema: z.ZodObject<{
format: z.ZodLiteral<"markdown">;
content: z.ZodString;
}, "strip", z.ZodTypeAny, {
format: "markdown";
content: string;
}, {
format: "markdown";
content: string;
}>;
export declare const JSONOutputSchema: z.ZodObject<{
format: z.ZodLiteral<"json">;
content: z.ZodString;
}, "strip", z.ZodTypeAny, {
format: "json";
content: string;
}, {
format: "json";
content: string;
}>;
export declare const OutputSchema: z.ZodUnion<[z.ZodObject<{
format: z.ZodLiteral<"markdown">;
content: z.ZodString;
}, "strip", z.ZodTypeAny, {
format: "markdown";
content: string;
}, {
format: "markdown";
content: string;
}>, z.ZodObject<{
format: z.ZodLiteral<"json">;
content: z.ZodString;
}, "strip", z.ZodTypeAny, {
format: "json";
content: string;
}, {
format: "json";
content: string;
}>]>;
export type Output = z.infer<typeof OutputSchema>;
export declare class KhodkarError extends Error {
code: string;
details?: Record<string, unknown> | undefined;
constructor(message: string, code: string, details?: Record<string, unknown> | undefined);
}
export declare class FileSystemError extends KhodkarError {
constructor(message: string, details?: Record<string, unknown>);
}
export declare class LLMAnalysisError extends KhodkarError {
constructor(message: string, details?: Record<string, unknown>);
}
export declare class MCPServerError extends KhodkarError {
constructor(message: string, details?: Record<string, unknown>);
}
//# sourceMappingURL=index.d.ts.map