mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-12 20:15:40 +00:00
refactor(types): add generic types and consolidate ExecutionResult
- add OperationResult<T> for success/failure patterns - add ComponentStatus for CLI tool statuses - add ValidationResult for validation patterns - remove duplicate ExecutionResult, re-export from executor/types
This commit is contained in:
1 parent
50c427d339
commit
6c78b63908
2 files changed
+32
-13
No files matched your search
+2
-13
@@ -34,19 +34,8 @@ export interface DelegationSessionsRegistry {
|
|||||||
lastSessionId?: string; // Most recent session ID
|
lastSessionId?: string; // Most recent session ID
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// Re-export ExecutionResult from canonical location for backward compatibility
|
||||||
* Execution result
|
export type { ExecutionResult } from '../delegation/executor/types';
|
||||||
*/
|
|
||||||
export interface ExecutionResult {
|
|
||||||
exitCode: number;
|
|
||||||
duration: number; // Seconds
|
|
||||||
workingDir: string;
|
|
||||||
sessionId: string;
|
|
||||||
profile: string;
|
|
||||||
model?: string; // Model name from settings
|
|
||||||
cost?: number; // Estimated cost (if available)
|
|
||||||
turns: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Real-time output event
|
* Real-time output event
|
||||||
|
|||||||
@@ -42,6 +42,36 @@ export interface TerminalInfo {
|
|||||||
*/
|
*/
|
||||||
export type Result<T, E = Error> = { ok: true; value: T } | { ok: false; error: E };
|
export type Result<T, E = Error> = { ok: true; value: T } | { ok: false; error: E };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic operation result for success/failure patterns
|
||||||
|
* Use this instead of defining new *Result interfaces
|
||||||
|
*/
|
||||||
|
export interface OperationResult<T = void> {
|
||||||
|
success: boolean;
|
||||||
|
message?: string;
|
||||||
|
error?: string;
|
||||||
|
data?: T;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic component/tool status
|
||||||
|
* Used for CLI tools, services, etc.
|
||||||
|
*/
|
||||||
|
export interface ComponentStatus {
|
||||||
|
installed: boolean;
|
||||||
|
path?: string;
|
||||||
|
version?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic validation result
|
||||||
|
* Standardized on 'valid' property name
|
||||||
|
*/
|
||||||
|
export interface ValidationResult {
|
||||||
|
valid: boolean;
|
||||||
|
errors?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
// UI TYPES (Phase 1: CLI UI/UX Enhancement)
|
// UI TYPES (Phase 1: CLI UI/UX Enhancement)
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|||||||
Reference in new issue
Block a user