Add 4 major features to codetyper-cli:
- Hooks System: Lifecycle hooks (PreToolUse, PostToolUse, SessionStart,
SessionEnd, UserPromptSubmit, Stop) with exit code control flow
- Plugin System: Custom tools, commands, and hooks via plugin manifest
- Session Forking: Snapshots, rewind, fork, and switch between branches
- Vim Motions: Normal/Insert/Command/Visual modes with keyboard navigation
New files:
- src/types/{hooks,plugin,session-fork,vim}.ts
- src/constants/{hooks,plugin,session-fork,vim}.ts
- src/services/{hooks-service,plugin-loader,plugin-service,session-fork-service}.ts
- src/stores/vim-store.ts (vanilla)
- src/tui/hooks/{useVimMode,useVimStore,useTodoStore,useThemeStore}.ts
- src/tui/components/VimStatusLine.tsx
Modified:
- src/services/agent.ts (hook integration)
- src/tools/index.ts (plugin tool registration)
- src/stores/{todo-store,theme-store}.ts (converted to vanilla)
- TUI components (updated hook imports)
137 lines
2.4 KiB
TypeScript
137 lines
2.4 KiB
TypeScript
/**
|
|
* TypeScript type definitions for CodeTyper CLI
|
|
*/
|
|
|
|
export type AgentType = "coder" | "tester" | "refactorer" | "documenter";
|
|
|
|
// Re-export image types
|
|
export type {
|
|
ImageMediaType,
|
|
ImageContent,
|
|
TextContent,
|
|
MessageContent,
|
|
MultimodalMessage,
|
|
PastedImage,
|
|
} from "@/types/image";
|
|
|
|
export {
|
|
isImageContent,
|
|
isTextContent,
|
|
createTextContent,
|
|
createImageContent,
|
|
} from "@/types/image";
|
|
|
|
export type IntentType =
|
|
| "ask"
|
|
| "code"
|
|
| "refactor"
|
|
| "fix"
|
|
| "document"
|
|
| "test"
|
|
| "explain";
|
|
|
|
export type Provider = "copilot" | "ollama";
|
|
|
|
export interface Config {
|
|
provider: Provider;
|
|
model?: string;
|
|
theme?: string;
|
|
maxIterations: number;
|
|
timeout: number;
|
|
protectedPaths: string[];
|
|
systemPrompt?: string;
|
|
cascadeEnabled?: boolean;
|
|
}
|
|
|
|
export interface IntentRequest {
|
|
prompt: string;
|
|
context?: string;
|
|
files?: string[];
|
|
}
|
|
|
|
export interface IntentResponse {
|
|
intent: IntentType;
|
|
confidence: number;
|
|
reasoning: string;
|
|
needsClarification: boolean;
|
|
clarificationQuestions?: string[];
|
|
}
|
|
|
|
export interface PlanStep {
|
|
id: string;
|
|
type: "read" | "edit" | "create" | "delete" | "execute";
|
|
description: string;
|
|
file?: string;
|
|
dependencies?: string[];
|
|
tool?: string;
|
|
args?: Record<string, unknown>;
|
|
}
|
|
|
|
export interface ExecutionPlan {
|
|
steps: PlanStep[];
|
|
intent: IntentType;
|
|
summary: string;
|
|
estimatedTime?: number;
|
|
}
|
|
|
|
export interface ValidationResult {
|
|
valid: boolean;
|
|
errors: string[];
|
|
warnings: string[];
|
|
protectedPaths: string[];
|
|
}
|
|
|
|
export interface ChatMessage {
|
|
role: "user" | "assistant" | "system";
|
|
content: string;
|
|
timestamp: number;
|
|
}
|
|
|
|
export interface ChatSession {
|
|
id: string;
|
|
agent: AgentType;
|
|
messages: ChatMessage[];
|
|
contextFiles: string[];
|
|
createdAt: number;
|
|
updatedAt: number;
|
|
}
|
|
|
|
export interface CommandOptions {
|
|
agent?: AgentType;
|
|
model?: string;
|
|
files?: string[];
|
|
dryRun?: boolean;
|
|
maxIterations?: number;
|
|
autoApprove?: boolean;
|
|
task?: string;
|
|
prompt?: string;
|
|
context?: string;
|
|
intent?: IntentType;
|
|
output?: string;
|
|
planFile?: string;
|
|
action?: string;
|
|
key?: string;
|
|
value?: string;
|
|
}
|
|
|
|
export interface ToolResult {
|
|
success: boolean;
|
|
output?: string;
|
|
error?: string;
|
|
files?: string[];
|
|
}
|
|
|
|
export interface FileEdit {
|
|
file: string;
|
|
search: string;
|
|
replace: string;
|
|
description?: string;
|
|
}
|
|
|
|
export interface TerminalSpinner {
|
|
start(text: string): void;
|
|
succeed(text: string): void;
|
|
fail(text: string): void;
|
|
stop(): void;
|
|
}
|