|
| 1 | +---@brief [[ |
| 2 | +--- Centralized type definitions for ClaudeCode.nvim public API. |
| 3 | +--- This module contains all user-facing types and configuration structures. |
| 4 | +---@brief ]] |
| 5 | +---@module 'claudecode.types' |
| 6 | + |
| 7 | +-- Version information type |
| 8 | +---@class ClaudeCodeVersion |
| 9 | +---@field major integer |
| 10 | +---@field minor integer |
| 11 | +---@field patch integer |
| 12 | +---@field prerelease? string |
| 13 | +---@field string fun(self: ClaudeCodeVersion): string |
| 14 | + |
| 15 | +-- Diff behavior configuration |
| 16 | +---@class ClaudeCodeDiffOptions |
| 17 | +---@field auto_close_on_accept boolean |
| 18 | +---@field show_diff_stats boolean |
| 19 | +---@field vertical_split boolean |
| 20 | +---@field open_in_current_tab boolean |
| 21 | +---@field keep_terminal_focus boolean |
| 22 | + |
| 23 | +-- Model selection option |
| 24 | +---@class ClaudeCodeModelOption |
| 25 | +---@field name string |
| 26 | +---@field value string |
| 27 | + |
| 28 | +-- Log level type alias |
| 29 | +---@alias ClaudeCodeLogLevel "trace"|"debug"|"info"|"warn"|"error" |
| 30 | + |
| 31 | +-- @ mention queued for Claude Code |
| 32 | +---@class ClaudeCodeMention |
| 33 | +---@field file_path string The absolute file path to mention |
| 34 | +---@field start_line number? Optional start line (0-indexed for Claude compatibility) |
| 35 | +---@field end_line number? Optional end line (0-indexed for Claude compatibility) |
| 36 | +---@field timestamp number Creation timestamp from vim.loop.now() for expiry tracking |
| 37 | + |
| 38 | +-- Port range configuration |
| 39 | +---@class ClaudeCodePortRange |
| 40 | +---@field min integer |
| 41 | +---@field max integer |
| 42 | + |
| 43 | +-- Server status information |
| 44 | +---@class ClaudeCodeServerStatus |
| 45 | +---@field running boolean |
| 46 | +---@field port integer? |
| 47 | +---@field client_count integer |
| 48 | +---@field clients? table<string, any> |
| 49 | + |
| 50 | +-- Main configuration structure |
| 51 | +---@class ClaudeCodeConfig |
| 52 | +---@field port_range ClaudeCodePortRange |
| 53 | +---@field auto_start boolean |
| 54 | +---@field terminal_cmd string|nil |
| 55 | +---@field env table<string, string> |
| 56 | +---@field log_level ClaudeCodeLogLevel |
| 57 | +---@field track_selection boolean |
| 58 | +---@field visual_demotion_delay_ms number |
| 59 | +---@field connection_wait_delay number |
| 60 | +---@field connection_timeout number |
| 61 | +---@field queue_timeout number |
| 62 | +---@field diff_opts ClaudeCodeDiffOptions |
| 63 | +---@field models ClaudeCodeModelOption[] |
| 64 | +---@field disable_broadcast_debouncing? boolean |
| 65 | +---@field enable_broadcast_debouncing_in_tests? boolean |
| 66 | +---@field terminal TerminalConfig|nil |
| 67 | + |
| 68 | +-- Server interface for main module |
| 69 | +---@class ClaudeCodeServerFacade |
| 70 | +---@field start fun(config: ClaudeCodeConfig, auth_token: string|nil): (success: boolean, port_or_error: number|string) |
| 71 | +---@field stop fun(): (success: boolean, error_message: string?) |
| 72 | +---@field broadcast fun(method: string, params: table?): boolean |
| 73 | +---@field get_status fun(): ClaudeCodeServerStatus |
| 74 | + |
| 75 | +-- Main module state |
| 76 | +---@class ClaudeCodeState |
| 77 | +---@field config ClaudeCodeConfig |
| 78 | +---@field server ClaudeCodeServerFacade|nil |
| 79 | +---@field port integer|nil |
| 80 | +---@field auth_token string|nil |
| 81 | +---@field initialized boolean |
| 82 | +---@field mention_queue ClaudeCodeMention[] |
| 83 | +---@field mention_timer uv.uv_timer_t? -- (compatible with vim.loop timer) |
| 84 | +---@field connection_timer uv.uv_timer_t? -- (compatible with vim.loop timer) |
| 85 | + |
| 86 | +-- This module only defines types, no runtime functionality |
| 87 | +return {} |
0 commit comments