From db0c65afe0c3ae328d3b90cb3f94b56ee99c2277 Mon Sep 17 00:00:00 2001 From: Mateusz Stomski Date: Sat, 3 Oct 2026 06:31:49 +0200 Subject: [PATCH] docs(plans): complete Software Factory 4-gate plan for linux-connector --- docs/plans/linux-connector/00-status.md | 26 +++ docs/plans/linux-connector/01-spec.md | 92 ++++++++++ docs/plans/linux-connector/02-architecture.md | 105 +++++++++++ .../linux-connector/03-program-design.md | 169 ++++++++++++++++++ docs/plans/linux-connector/04-slices.md | 85 +++++++++ 5 files changed, 477 insertions(+) create mode 100644 docs/plans/linux-connector/00-status.md create mode 100644 docs/plans/linux-connector/01-spec.md create mode 100644 docs/plans/linux-connector/02-architecture.md create mode 100644 docs/plans/linux-connector/03-program-design.md create mode 100644 docs/plans/linux-connector/04-slices.md diff --git a/docs/plans/linux-connector/00-status.md b/docs/plans/linux-connector/00-status.md new file mode 100644 index 0000000..03e4560 --- /dev/null +++ b/docs/plans/linux-connector/00-status.md @@ -0,0 +1,26 @@ +# Status: linux-connector + +- Gate 1 — Spec & Product: in progress +- Gate 2 — Architecture: in progress +- Gate 3 — Program Design: in progress +- Gate 4 — Slice Plan: in progress + +## Slices +- [ ] Slice 1 — tracer bullet: minimal end-to-end wire (CLI + OpenSSH config parser + TCP socket probe + execvp ssh launcher) +- [ ] Slice 2 — rich inventory engine (merging `~/.ssh/config`, `/etc/ssh/ssh_config`, and custom `hosts.yaml` with groups & tags) +- [ ] Slice 3 — interactive terminal launcher (pure ANSI keyboard navigation + fuzzy filtering + optional `fzf` auto-detection) +- [ ] Slice 4 — parallel remote command runner (`exec` engine replacing `massAct.sh` with live prefixed output streaming and exit summary) +- [ ] Slice 5 — fleet health & connectivity matrix (`status` command probing TCP/22, SSH banners, and latency across homelab nodes) +- [ ] Slice 6 — tunnel & port forwarding helper (`tunnel` command automating local/remote port forwarding and ProxyJump bastions) +- [ ] Slice 7 — packaging & distribution (.deb, .rpm, .tar.gz standalone) +- [ ] Slice 8 — documentation, man page (Section 1) & Gitea Actions CI/CD release workflow + +## Notes for a fresh session +- Project: Fast SSH connection manager, interactive host launcher, and multi-node command runner for Linux fleets. +- Goal: Modern, unified Python rewrite replacing legacy `psh` (SSH manager) and `massAct.sh` (mass execution tool). +- Framework / Process: Software Factory 4-gate workflow. +- Platforms: Client runs on macOS, Fedora, Debian/Ubuntu, RHEL 8/9, Arch Linux. Targets any standard SSH daemon. +- Target Python runtime: Python >= 3.6 (RHEL 8 compatibility). +- Dependencies: Standard library core (uses system OpenSSH client binary for native keys, agent, and FIDO2). `paramiko` and `cryptography` permitted for programmatic parallel execution, SFTP, and key handling. +- Testing environment: Proxmox VE cluster (`alma-crash`, `arch-crash`, `debian-crash`, `fedora-crash`, `ubuntu-crash`) and Podman on macOS. +- Repository: `https://gitea.wired.synology.me/soda64/linux-connector.git` on branch `main`. diff --git a/docs/plans/linux-connector/01-spec.md b/docs/plans/linux-connector/01-spec.md new file mode 100644 index 0000000..4eb51eb --- /dev/null +++ b/docs/plans/linux-connector/01-spec.md @@ -0,0 +1,92 @@ +# Gate 1 — Spec & Product: linux-connector + +## 1. Problem Statement & User Need +In modern Linux homelabs and enterprise clusters, engineers manage dozens of physical servers, Proxmox hypervisors, K3s Kubernetes nodes, storage appliances, and testing virtual machines. Two common daily workflows are currently fragmented across outdated legacy scripts: + +1. **Interactive Host Access (previously `psh.sh`):** + - Operators jump between servers daily. Native OpenSSH `ssh user@host` requires memorizing IP addresses, ports, and hostnames. + - The legacy `psh` script stored plain-text records in an ad-hoc tab-delimited file, enforced insecure file permissions (`755`), provided a clunky bash `select` menu, and completely ignored the user's existing `~/.ssh/config`. +2. **Fleet/Cluster Command Execution (previously `massAct.sh`):** + - Running ad-hoc operational commands (e.g. checking disk space, inspecting kernel versions, restarting services, or querying `linux-updater status`) across multiple nodes simultaneously. + - The legacy `massAct.sh` script grew into a 1,750-line monolithic shell script that relied on `sshpass` (storing/passing plaintext passwords), suffered from race conditions in background process tracking, and lacked clean live streaming output. + +`linux-connector` unifies both operational needs into a fast, elegant CLI tool: +- **Interactive Launcher (`linux-connector connect` / default):** Instantly parses `~/.ssh/config` and homelab inventory, presents a fuzzy-searchable terminal menu with pre-flight reachability checks, and drops the operator into a full native interactive terminal. +- **Fleet Command Runner (`linux-connector exec`):** Concurrently dispatches commands across targeted node groups, streams real-time color-coded terminal output, and displays an execution summary with exit codes and execution times. +- **Fleet Connectivity Matrix (`linux-connector status`):** Rapidly scans homelab nodes to verify SSH port reachability, round-trip latency, and system availability. + +--- + +## 2. Success Metrics +1. **Instant Interactive Launch:** Launching `linux-connector` and selecting a host connects to SSH within 100ms of user selection. +2. **Native OpenSSH Compatibility:** 100% interoperable with `~/.ssh/config`—automatically inherits existing host aliases, ProxyJump bastions, custom identity keys, and SSH agent sessions with zero manual re-entry. +3. **Robust Concurrent Execution:** Capable of running commands across 50+ remote nodes concurrently without process leaks or zombie processes. +4. **Live Prefixed Streaming:** Streams output from remote nodes in real time with distinguishable colored host tags, followed by an actionable summary table. +5. **Zero-Friction Fallback:** Features a pure ANSI terminal menu when `fzf` is absent, and seamlessly delegates to `fzf` if installed on the host. +6. **Enterprise Safety:** Replaces `sshpass` anti-patterns with standard SSH key/agent authentication and secure agent forwarding. + +--- + +## 3. User Stories & Announcement + +### Announcement +> "Announcing `linux-connector` v1.0.0 — your single command center for Linux fleet connectivity. Jump into any homelab node with interactive fuzzy search (`linux-connector`), or execute fleet-wide commands in parallel (`linux-connector exec -g k8s 'uptime'`). Built for speed, full OpenSSH config interoperability, and live multi-node streaming." + +### User Stories +- **As a homelab administrator**, I want to type `linux-connector` in my terminal, type 3 letters of a node's hostname, and immediately press Enter to open an SSH session without looking up IPs. +- **As a cluster engineer**, I want to run `linux-connector exec -g pve-cluster 'pvesm status'` from my workstation, so that I can see the storage status across all Proxmox nodes simultaneously. +- **As a system operator**, I want to run `linux-connector exec -g all 'linux-updater check --json'` to aggregate available package updates across my entire fleet into a single structured report. + +--- + +## 4. Screens & CLI Commands + +```text +# 1. Interactive Host Launcher (Default / psh replacement): +$ linux-connector +? Select host to connect: +> pve-01.wired.intra [192.168.10.11:22] (tags: pve, hypervisor) [ONLINE 1.2ms] + pve-02.wired.intra [192.168.10.12:22] (tags: pve, hypervisor) [ONLINE 1.4ms] + k8s-master-01 [192.168.10.21:22] (tags: k8s, control) [ONLINE 2.1ms] + k8s-worker-01 [192.168.10.31:22] (tags: k8s, worker) [ONLINE 1.9ms] + nas.wired.intra [192.168.10.2:22] (tags: storage) [ONLINE 0.8ms] +[Filter: k8s- ] +Connecting to root@192.168.10.21 (k8s-master-01)... + +# 2. Parallel Command Execution (massAct replacement): +$ linux-connector exec -g k8s "uptime" +[INFO] Executing 'uptime' on 3 hosts (concurrency: 10)... +[k8s-master-01] 21:16:01 up 14 days, 3:12, 0 users, load average: 0.12, 0.18, 0.15 +[k8s-worker-01] 21:16:01 up 14 days, 3:11, 0 users, load average: 0.45, 0.52, 0.49 +[k8s-worker-02] 21:16:01 up 14 days, 3:10, 0 users, load average: 0.38, 0.41, 0.40 + +============================= Execution Summary ============================= +HOST STATUS EXIT CODE DURATION +k8s-master-01 SUCCESS 0 0.28s +k8s-worker-01 SUCCESS 0 0.31s +k8s-worker-02 SUCCESS 0 0.30s +----------------------------------------------------------------------------- +Total: 3 hosts | Succeeded: 3 | Failed: 0 | Execution Time: 0.34s + +# 3. Fleet Connectivity Matrix: +$ linux-connector status -g all ++-------------------+-----------------+-------+----------+---------------+ +| HOST | IP ADDRESS | PORT | STATUS | LATENCY (ms) | ++-------------------+-----------------+-------+----------+---------------+ +| pve-01 | 192.168.10.11 | 22 | REACHABLE| 1.1 ms | +| pve-02 | 192.168.10.12 | 22 | REACHABLE| 1.3 ms | +| nas | 192.168.10.2 | 22 | REACHABLE| 0.7 ms | +| old-backup-vm | 192.168.10.99 | 22 | TIMEOUT | --- | ++-------------------+-----------------+-------+----------+---------------+ + +# 4. SSH Tunnel Helper: +$ linux-connector tunnel pve-01 8006:localhost:8006 +[INFO] Forwarding local port 8006 -> pve-01:8006 (Press Ctrl+C to terminate) +``` + +--- + +## 5. Scope & Constraints +- **Client Environments:** macOS and Linux (Debian, Ubuntu, Fedora, RHEL, Arch). +- **Security:** Strict Zero-Secrets policy. Passwords in plaintext files are forbidden. Authentication relies on SSH keys, SSH agent forwarding, or interactive prompt. +- **Terminal Discipline:** Interactive session handover uses `os.execvp("ssh", ...)` so that raw terminal handling, TTY allocation, window resizing (SIGWINCH), and escape sequences remain 100% native to the operating system's OpenSSH client. diff --git a/docs/plans/linux-connector/02-architecture.md b/docs/plans/linux-connector/02-architecture.md new file mode 100644 index 0000000..73be669 --- /dev/null +++ b/docs/plans/linux-connector/02-architecture.md @@ -0,0 +1,105 @@ +# Gate 2 — Architecture: linux-connector + +## 1. System Fit & Architecture Diagram + +``` + ┌────────────────────────┐ + │ CLI Parser │ + │ (connect, exec, status)│ + └───────────┬────────────┘ + │ + ▼ + ┌────────────────────────┐ + │ Inventory Engine │ + │ - ~/.ssh/config │ + │ - /etc/ssh/ssh_config │ + │ - hosts.yaml / json │ + └───────────┬────────────┘ + │ + ┌─────────────────────────┼─────────────────────────┐ + ▼ ▼ ▼ + ┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐ + │ Interactive TUI │ │ Concurrent Runner │ │ Status Prober │ + │ - Pure ANSI Menu │ │ - ThreadPoolExecutor│ │ - Non-blocking TCP │ + │ - Fuzzy Search │ │ - Async Line Stream │ │ - Socket connect │ + │ - fzf delegation │ │ - Exit aggregator │ │ - Latency timing │ + └──────────┬──────────┘ └──────────┬──────────┘ └──────────┬──────────┘ + │ │ │ + ▼ ▼ ▼ + ┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐ + │ Native execvp(ssh) │ │ OpenSSH / Paramiko │ │ Raw Socket Probe │ + │ (100% Native TTY) │ │ (Parallel Subprocess│ │ (TCP Port 22) │ + └─────────────────────┘ └─────────────────────┘ └─────────────────────┘ +``` + +--- + +## 2. Inventory Model & Discovery Hierarchy + +`linux-connector` loads host definitions hierarchically: + +1. **`~/.ssh/config` & `/etc/ssh/ssh_config` (Primary Source):** + - Automatically parsed using an RFC/OpenSSH-compliant lexer. + - Extracts: `Host`, `HostName`, `User`, `Port`, `IdentityFile`, `ProxyJump`, `ForwardAgent`. +2. **`~/.config/linux-connector/hosts.yaml` (or `.json`) (Enrichment Source):** + - Supplements SSH hosts with metadata (groups, environment, human tags, description). + - Also supports standalone host declarations. + +### Inventory Data Contract +```json +{ + "hosts": [ + { + "name": "pve-01", + "hostname": "192.168.10.11", + "user": "root", + "port": 22, + "identity_file": "~/.ssh/id_ed25519_homelab", + "proxy_jump": null, + "groups": ["pve", "hypervisors", "production"], + "tags": ["proxmox", "ceph-mon", "zfs"], + "description": "Proxmox Node 1 (Dell R730)" + } + ], + "groups": { + "pve": ["pve-01", "pve-02", "pve-03"], + "k8s": ["k8s-master-01", "k8s-worker-01", "k8s-worker-02"] + } +} +``` + +--- + +## 3. Execution Engine & Output Streaming + +For the `exec` sub-command: +- Worker pool powered by `concurrent.futures.ThreadPoolExecutor` (or standard `asyncio` subprocess runner). +- Configurable concurrency limit (default: 10 concurrent streams). +- Real-time line streaming: standard output and standard error from each node are consumed non-blockingly, stamped with ANSI color-coded `[hostname]`, and flushed immediately to the terminal. +- Aggregate summary table tracks: + - Host identifier + - Status (`SUCCESS`, `FAILED`, `TIMEOUT`, `UNREACHABLE`) + - Exit code + - Execution duration in seconds. + +--- + +## 4. Interactive Terminal Handover Strategy + +A common failure mode in SSH manager tools is attempting to proxy interactive terminal I/O through Python buffers, which breaks terminal resizing, raw mode, and complex ncurses programs. + +`linux-connector` uses a **two-phase connection strategy**: +1. **Phase 1 (Inspection & Selection):** Python handles inventory discovery, TCP socket latency check, and terminal interactive fuzzy search. +2. **Phase 2 (Handover):** Once the target host is confirmed, Python performs `os.execvp("ssh", ssh_args)`. This cleanly replaces the Python process image with the native `/usr/bin/ssh` process, granting it 100% direct access to the user's TTY, signals, and agent keys. + +--- + +## 5. Exit Codes + +| Code | Status | Meaning | +|---|---|---| +| `0` | `SUCCESS` | Selected host connected, or all remote commands succeeded (exit code 0). | +| `1` | `COMMAND_FAILURE` | One or more remote commands returned non-zero exit code. | +| `2` | `UNREACHABLE` | Target host(s) could not be reached over network / port 22 refused. | +| `3` | `CONFIG_ERROR` | Malformed inventory file, missing host argument, or unknown group. | +| `130`| `ABORTED` | User interrupted operation (Ctrl+C). | diff --git a/docs/plans/linux-connector/03-program-design.md b/docs/plans/linux-connector/03-program-design.md new file mode 100644 index 0000000..7796fb0 --- /dev/null +++ b/docs/plans/linux-connector/03-program-design.md @@ -0,0 +1,169 @@ +# Gate 3 — Program Design: linux-connector + +## 1. Directory & File Layout + +```text +linux-connector/ +├── bin/ +│ └── linux-connector # Executable launcher (#!/usr/bin/env python3) +├── linux_connector/ +│ ├── __init__.py # Version constant (__version__ = "1.0.0") +│ ├── __main__.py # Entrypoint for `python3 -m linux_connector` +│ ├── cli.py # Argument parsing and command routing +│ ├── config.py # Config loader (~/.config/linux-connector/config.json) +│ ├── models.py # HostEntry, HostGroup, ExecResult dataclasses +│ ├── inventory/ +│ │ ├── __init__.py +│ │ ├── ssh_config.py # OpenSSH config file parser +│ │ ├── custom_loader.py # YAML/JSON inventory loader +│ │ └── resolver.py # Host & group query resolver +│ ├── tui/ +│ │ ├── __init__.py +│ │ ├── selector.py # Pure ANSI terminal interactive menu +│ │ ├── fuzzy.py # Lightweight in-memory fuzzy search matcher +│ │ └── fzf_backend.py # Optional delegation to external `fzf` +│ ├── runner/ +│ │ ├── __init__.py +│ │ ├── executor.py # Multi-host concurrent command dispatcher +│ │ ├── streamer.py # Real-time prefixed line printer +│ │ └── summary.py # Execution summary table formatter +│ └── network/ +│ ├── __init__.py +│ ├── prober.py # Non-blocking TCP port 22 socket latency probe +│ └── tunnel.py # SSH port-forwarding orchestrator +├── packaging/ +│ ├── build_packages.py # Standalone .deb, .rpm and .tar.gz generator +│ ├── install.sh # Tarball installer script +│ ├── deb/ +│ └── rpm/ +├── man/ +│ └── linux-connector.1 # Man page (Section 1) +├── tests/ +│ ├── __init__.py +│ ├── test_cli.py +│ ├── test_ssh_config.py +│ ├── test_resolver.py +│ ├── test_fuzzy.py +│ ├── test_executor.py +│ ├── test_prober.py +│ └── fixtures/ +│ ├── mock_ssh_config +│ └── mock_inventory.json +└── .gitea/ + └── workflows/ + └── release.yml # Gitea Actions CI/CD pipeline +``` + +--- + +## 2. Key Type Signatures & Interfaces (No Bodies) + +```python +# models.py +from typing import Dict, List, Optional, Any +from dataclasses import dataclass + +@dataclass +class HostEntry: + name: str + hostname: str + user: Optional[str] = None + port: int = 22 + identity_file: Optional[str] = None + proxy_jump: Optional[str] = None + groups: List[str] = None + tags: List[str] = None + description: Optional[str] = None + latency_ms: Optional[float] = None + is_reachable: Optional[bool] = None + +@dataclass +class ExecResult: + host: str + exit_code: int + duration_sec: float + stdout: str + stderr: str + is_timeout: bool = False + error_message: Optional[str] = None + +# inventory/ssh_config.py +class SshConfigParser: + def __init__(self, config_paths: Optional[List[str]] = None): ... + def parse(self) -> List[HostEntry]: ... + +# inventory/resolver.py +class InventoryResolver: + def __init__(self, hosts: List[HostEntry]): ... + def resolve_targets( + self, + target_patterns: Optional[List[str]] = None, + group_names: Optional[List[str]] = None, + tag_filters: Optional[List[str]] = None, + ) -> List[HostEntry]: ... + +# network/prober.py +class SocketProber: + def __init__(self, timeout_sec: float = 1.0): ... + def probe_host(self, host: HostEntry) -> HostEntry: ... + def probe_all_concurrent(self, hosts: List[HostEntry], max_workers: int = 20) -> List[HostEntry]: ... + +# runner/executor.py +class ConcurrentCommandRunner: + def __init__(self, concurrency: int = 10, timeout_sec: int = 60): ... + def execute_fleet( + self, + hosts: List[HostEntry], + command: str, + live_stream: bool = True, + sudo: bool = False, + ) -> List[ExecResult]: ... + +# tui/selector.py +class InteractiveHostSelector: + def __init__(self, hosts: List[HostEntry]): ... + def select_host(self) -> Optional[HostEntry]: ... +``` + +--- + +## 3. Call Stack Trace + +### `connect` (Interactive mode): +1. `cli.main()` detects no arguments (or `connect` sub-command). +2. `inventory.ssh_config.SshConfigParser` parses `~/.ssh/config`. +3. `inventory.custom_loader` merges tags/groups from `~/.config/linux-connector/hosts.yaml`. +4. `network.prober.SocketProber` starts fast background worker threads to check TCP port 22 reachability. +5. `tui.selector.InteractiveHostSelector` captures terminal raw mode (ANSI) and handles arrow keys and fuzzy input (or delegates to `fzf` if detected). +6. User hits `Enter` on selected host. +7. Terminal raw mode is cleanly released. +8. Python builds `/usr/bin/ssh` parameter vector and calls `os.execvp("ssh", args)`. + +### `exec` (Parallel command runner): +1. `cli.main()` parses `exec -g k8s "uptime"`. +2. `inventory.resolver.InventoryResolver` finds all hosts tagged `k8s`. +3. `runner.executor.ConcurrentCommandRunner` dispatches worker threads via `ThreadPoolExecutor`. +4. `runner.streamer.Streamer` tags incoming lines with colored host labels and flushes to stdout. +5. `runner.summary.print_summary_table()` displays execution results, failed hosts, and durations. +6. Returns exit code `0` if all succeeded, `1` if any failed. + +--- + +## 4. Test Plan & Assertions + +- `test_ssh_config.py`: Verifies parsing of multi-stanza `~/.ssh/config` files (handles wildcards, comments, indented options, `ProxyJump`, and `Include` directives). +- `test_resolver.py`: Verifies resolution by exact name, wildcard pattern (`k8s-*`), group, or comma-separated lists. +- `test_fuzzy.py`: Verifies scoring algorithm filters matching hosts correctly on partial/subsequence typing. +- `test_executor.py`: Uses a local mock SSH echo command to verify concurrent thread execution, line interleaving safety, and timeout handling. +- `test_prober.py`: Verifies non-blocking TCP socket timeout handling against unreachable IP addresses. + +--- + +## 5. Least Confident Decisions (Adversarial Check) + +1. **Complex `~/.ssh/config` with dynamic tokens:** Some SSH configurations use `%h`, `%p`, or `Match exec` directives. + - *Mitigation:* The parser handles standard `Host`, `HostName`, `User`, `Port`, `IdentityFile`, `ProxyJump`. For edge-case directives, the final handover uses native `ssh `, letting native OpenSSH evaluate dynamic Match expressions at runtime. +2. **Terminal Raw Mode cleanup on unexpected signals:** If a user presses `Ctrl+\` or the process is killed with `SIGTERM` during interactive menu navigation, terminal echo could be left disabled. + - *Mitigation:* Wrap all TUI raw mode blocks in strict `try ... finally: termios.tcsetattr(...)` blocks and install signal handlers for `SIGINT` and `SIGTERM`. +3. **Multi-host `sudo` commands prompting for password:** + - *Mitigation:* By default, multi-host commands require passwordless sudo (`NOPASSWD`) or an active SSH session key. Add an explicit `--ask-sudo-pass` flag that securely reads a password once and feeds it via stdin (`sudo -S -p ''`). diff --git a/docs/plans/linux-connector/04-slices.md b/docs/plans/linux-connector/04-slices.md new file mode 100644 index 0000000..f794cd7 --- /dev/null +++ b/docs/plans/linux-connector/04-slices.md @@ -0,0 +1,85 @@ +# Gate 4 — Slice Plan: linux-connector + +This roadmap defines the implementation order for `linux-connector` in thin, independently verifiable vertical slices. + +--- + +### Slice 1 — Tracer Bullet (Minimal End-to-End Wire) +- **Goal:** Minimal working CLI capable of parsing a simple `~/.ssh/config` file, probing port 22, and dropping the operator into an SSH session. +- **Components:** + - `bin/linux-connector` launcher and `linux_connector/cli.py`. + - Basic OpenSSH config parser (`inventory/ssh_config.py`). + - Simple non-interactive host select via CLI argument or numbered list. + - Process handover using `os.execvp("ssh", ...)`. + - Unit tests verifying CLI parsing and SSH parameter generation. +- **Verification:** `python3 -m unittest tests/test_cli.py` passes 100%. + +--- + +### Slice 2 — Rich Inventory Engine & Resolver +- **Goal:** Comprehensive discovery and filtering supporting standard OpenSSH configurations and custom YAML/JSON inventory. +- **Components:** + - Full OpenSSH parser supporting `Host`, `HostName`, `User`, `Port`, `IdentityFile`, `ProxyJump`, and `Include`. + - Custom inventory loader (`inventory/custom_loader.py`) for tags and host groups. + - Flexible query resolver: query by group (`-g pve`), tag (`--tag k8s`), pattern (`pve-*`), or specific host list. +- **Verification:** Unit tests against realistic complex SSH configs and YAML inventory fixtures. + +--- + +### Slice 3 — Interactive Terminal UX (Fuzzy Search & TUI) +- **Goal:** Delightful, fast terminal selection menu. +- **Components:** + - Pure ANSI keyboard navigation (`tui/selector.py`) using standard Unix `termios` and `tty`. + - Subsequence fuzzy matching (`tui/fuzzy.py`) with real-time list filtering as user types. + - Background socket probe (`network/prober.py`) displaying live latency and online/offline status badge next to host names. + - Seamless delegation to external `fzf` when present in `$PATH`. +- **Verification:** Terminal smoke tests with ANSI mock sequences and fuzzy scoring tests. + +--- + +### Slice 4 — Parallel Fleet Command Runner (`exec` Engine) +- **Goal:** Modern, robust replacement for `massAct.sh`. +- **Components:** + - Concurrent multi-host runner (`runner/executor.py`) using `concurrent.futures.ThreadPoolExecutor`. + - Real-time line streaming (`runner/streamer.py`) with colored host prefixes. + - Summary reporter (`runner/summary.py`) with status, exit code, and execution duration table. + - Support for `--concurrency`, `--timeout`, and `--sudo`. +- **Verification:** Mock concurrent tests verifying 10 simultaneous runs, proper output interleaving, and exit code aggregation. + +--- + +### Slice 5 — Fleet Health & Connectivity Matrix (`status` Engine) +- **Goal:** Instant verification of homelab infrastructure reachability. +- **Components:** + - Fast non-blocking socket prober across all configured nodes. + - SSH banner inspection to identify running OpenSSH versions without full authentication. + - Formatted tabular output and structured `--json` report. +- **Verification:** Unit tests verifying timeout handling and reachability matrix output. + +--- + +### Slice 6 — Tunnel & Port Forwarding Helper (`tunnel` Engine) +- **Goal:** Effortless creation of SSH tunnels into private homelab services. +- **Components:** + - `tunnel` CLI sub-command parsing `local_port:remote_host:remote_port`. + - Background SSH tunnel launcher with clean SIGINT termination. +- **Verification:** Test tunnel parameter validation and command construction. + +--- + +### Slice 7 — Native Packaging (.deb, .rpm, .tar.gz) +- **Goal:** Enterprise packaging matching the `linux-updater` packaging pipeline. +- **Components:** + - `packaging/build_packages.py`: pure Python Debian `.deb` builder and RPM spec generator. + - `packaging/install.sh`: installer for generic `.tar.gz` distribution. +- **Verification:** Build test packages locally and verify package structure with `tar -tvf` and `ar -t`. + +--- + +### Slice 8 — Documentation & Gitea Actions CI/CD Workflow +- **Goal:** Production-ready release automation. +- **Components:** + - Man page in `man/linux-connector.1`. + - Comprehensive documentation (`README.md`, `docs/user-guide.md`). + - `.gitea/workflows/release.yml`: Gitea Actions pipeline targeting `runs-on: fedora`, running tests, building `.rpm`/`.deb`, publishing to Gitea Package Registry and Release assets. +- **Verification:** Validate workflow syntax and verify package linking API requests.