feat(ssh): rewrite SSH cache system in native Zig

- Eliminates standalone bash dependency
- Consolidates `+list-ssh-cache` and `+clear-ssh-cache` actions into
single `+ssh-cache` action with args
- Structured cache format with timestamps and expiration support
- Memory-safe entry handling with proper file locking
- Comprehensive hostname validation (IPv4/IPv6/domains)
- Atomic updates via temp file + rename
- Updated shell integrations for improved cross-platform support and
reliability
- Cache operations are now unit-testable
This commit is contained in:
Jason Rayne
2025-07-03 20:11:45 -07:00
parent e25aa9f424
commit 75c703071a
9 changed files with 1401 additions and 377 deletions

View File

@@ -9,8 +9,7 @@ const list_keybinds = @import("list_keybinds.zig");
const list_themes = @import("list_themes.zig");
const list_colors = @import("list_colors.zig");
const list_actions = @import("list_actions.zig");
const list_ssh_cache = @import("list_ssh_cache.zig");
const clear_ssh_cache = @import("clear_ssh_cache.zig");
const ssh_cache = @import("ssh_cache.zig");
const edit_config = @import("edit_config.zig");
const show_config = @import("show_config.zig");
const validate_config = @import("validate_config.zig");
@@ -43,11 +42,8 @@ pub const Action = enum {
/// List keybind actions
@"list-actions",
/// List hosts cached by SSH shell integration for terminfo installation
@"list-ssh-cache",
/// Clear hosts cached by SSH shell integration for terminfo installation
@"clear-ssh-cache",
/// Manage SSH terminfo cache for automatic remote host setup
@"ssh-cache",
/// Edit the config file in the configured terminal editor.
@"edit-config",
@@ -163,8 +159,7 @@ pub const Action = enum {
.@"list-themes" => try list_themes.run(alloc),
.@"list-colors" => try list_colors.run(alloc),
.@"list-actions" => try list_actions.run(alloc),
.@"list-ssh-cache" => try list_ssh_cache.run(alloc),
.@"clear-ssh-cache" => try clear_ssh_cache.run(alloc),
.@"ssh-cache" => try ssh_cache.run(alloc),
.@"edit-config" => try edit_config.run(alloc),
.@"show-config" => try show_config.run(alloc),
.@"validate-config" => try validate_config.run(alloc),
@@ -202,8 +197,7 @@ pub const Action = enum {
.@"list-themes" => list_themes.Options,
.@"list-colors" => list_colors.Options,
.@"list-actions" => list_actions.Options,
.@"list-ssh-cache" => list_ssh_cache.Options,
.@"clear-ssh-cache" => clear_ssh_cache.Options,
.@"ssh-cache" => ssh_cache.Options,
.@"edit-config" => edit_config.Options,
.@"show-config" => show_config.Options,
.@"validate-config" => validate_config.Options,