From 6b9455c90ee10d6371346bb54091a834894c8fae Mon Sep 17 00:00:00 2001 From: Mateusz Stomski Date: Sat, 3 Oct 2026 06:39:37 +0200 Subject: [PATCH] docs(plans): incorporate shell tab completion specifications into linux-connector --- docs/plans/linux-connector/00-status.md | 8 +++++++- docs/plans/linux-connector/01-spec.md | 18 ++++++++++++++++++ .../plans/linux-connector/03-program-design.md | 6 ++++++ docs/plans/linux-connector/04-slices.md | 9 ++++++--- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/docs/plans/linux-connector/00-status.md b/docs/plans/linux-connector/00-status.md index 6cafdaf..e5fcaa9 100644 --- a/docs/plans/linux-connector/00-status.md +++ b/docs/plans/linux-connector/00-status.md @@ -13,7 +13,7 @@ - [ ] 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 — full documentation (user, admin & developer guides), man page (Section 1), CLI -h/--help & Gitea Actions CI/CD release workflow +- [ ] Slice 8 — full documentation (user, admin & developer guides), man page (Section 1), CLI -h/--help, shell tab completion (Bash/Zsh) & 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. @@ -22,6 +22,12 @@ - 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. +- Shell Tab Completion Standard (Bash & Zsh): + - Subcommands and flags auto-completion (`connect`, `exec`, `status`, `tunnel`, `completion`). + - Dynamic host completion: `linux-connector [connect] ` automatically completes host aliases parsed from `~/.ssh/config` and inventory. + - Dynamic group completion: `linux-connector exec -g ` and `linux-connector status -g ` complete group names (`pve`, `k8s`, `nas`). + - Built-in generator: `linux-connector completion [bash|zsh]` outputting ready-to-source completion scripts. + - Packaging integration: Automated deployment to `/usr/share/bash-completion/completions/` and `/usr/share/zsh/site-functions/`. - Documentation Standard (Mandatory parity with linux-updater): - User Guide: `docs/user-guide.md` (interactive fuzzy launcher, inventory configuration, SSH shortcuts, command execution). - Administrator Guide: `docs/admin-guide.md` (fleet inventory structuring, automated scripting, CI/CD pipeline integration, JSON output). diff --git a/docs/plans/linux-connector/01-spec.md b/docs/plans/linux-connector/01-spec.md index 3709c75..9fdadbd 100644 --- a/docs/plans/linux-connector/01-spec.md +++ b/docs/plans/linux-connector/01-spec.md @@ -103,3 +103,21 @@ To ensure complete architectural parity and usability across homelab workstation - Root `linux-connector -h` outputs an intuitive summary of primary operational modes (`connect`, `exec`, `status`, `tunnel`). - Every sub-command provides detailed help (`linux-connector connect -h`, `linux-connector exec -h`, `linux-connector status -h`, `linux-connector tunnel -h`) with argument descriptions, default flags, and realistic command examples. +--- + +## 7. Shell Tab Completion (Bash & Zsh) +Fast keyboard-driven workflows are essential for a connection manager and fleet runner. `linux-connector` provides deep, context-aware shell auto-completion: +1. **Dynamic Host Completion:** + - Typing `linux-connector ` or `linux-connector connect ` immediately auto-completes host aliases directly from the user's `~/.ssh/config` and inventory files. + - Typing `linux-connector tunnel ` auto-completes target host names. +2. **Dynamic Group & Tag Completion:** + - Typing `linux-connector exec -g ` auto-completes all defined inventory group names (e.g. `pve`, `k8s`, `storage`). + - Typing `linux-connector status -g ` auto-completes target cluster group names. +3. **Sub-Commands & Flags Completion:** + - Tab completion for primary commands (`connect`, `exec`, `status`, `tunnel`, `completion`). + - Tab completion for command flags (`--concurrency`, `--timeout`, `--sudo`, `--json`, `--verbose`). +4. **Generator & Package Deployment:** + - Generator sub-command: `linux-connector completion [bash|zsh]` produces complete, standalone completion scripts. + - System packages (`.deb` and `.rpm`) install completion files into `/usr/share/bash-completion/completions/linux-connector` and `/usr/share/zsh/site-functions/_linux-connector`. + + diff --git a/docs/plans/linux-connector/03-program-design.md b/docs/plans/linux-connector/03-program-design.md index c4e7a53..32eb413 100644 --- a/docs/plans/linux-connector/03-program-design.md +++ b/docs/plans/linux-connector/03-program-design.md @@ -31,6 +31,12 @@ linux-connector/ │ ├── __init__.py │ ├── prober.py # Non-blocking TCP port 22 socket latency probe │ └── tunnel.py # SSH port-forwarding orchestrator +│ └── completion.py # Dynamic host/group completion resolver & generator +├── completions/ +│ ├── bash/ +│ │ └── linux-connector # Native Bash tab completion script +│ └── zsh/ +│ └── _linux-connector # Native Zsh tab completion function ├── packaging/ │ ├── build_packages.py # Standalone .deb, .rpm and .tar.gz generator │ ├── install.sh # Tarball installer script diff --git a/docs/plans/linux-connector/04-slices.md b/docs/plans/linux-connector/04-slices.md index eb2acb6..b15f34c 100644 --- a/docs/plans/linux-connector/04-slices.md +++ b/docs/plans/linux-connector/04-slices.md @@ -76,14 +76,17 @@ This roadmap defines the implementation order for `linux-connector` in thin, ind --- -### Slice 8 — Full Documentation, Man Page, CLI Help & Gitea Actions CI/CD Workflow -- **Goal:** Production-ready release automation and complete operator, admin, and developer documentation. +### Slice 8 — Full Documentation, Man Page, CLI Help, Shell Tab Completion & Gitea Actions CI/CD Workflow +- **Goal:** Production-ready release automation, complete documentation triad, man page, and native Bash/Zsh tab completion. - **Components:** - `docs/user-guide.md`: Comprehensive user manual for interactive fuzzy launcher, keystrokes, and multi-node execution. - `docs/admin-guide.md`: Fleet inventory management (`hosts.yaml`), CI/CD automation, scripting, and security rules. - `docs/developer-guide.md`: Internal architecture, OpenSSH parser design, TUI raw mode mechanics, and test suites. - `man/linux-connector.1`: Full UNIX Section 1 man page (`man 1 linux-connector`). + - Shell Tab Completion: Native Bash (`completions/bash/linux-connector`) and Zsh (`completions/zsh/_linux-connector`) scripts supporting commands, flags, and dynamic auto-completion of host aliases and cluster group names. + - `linux-connector completion [bash|zsh]` generator sub-command. - Interactive CLI Help: Complete `-h` and `--help` for root and all sub-commands (`connect`, `exec`, `status`, `tunnel`) with examples. + - Packaging integration: Install completion scripts to `/usr/share/bash-completion/completions/` and `/usr/share/zsh/site-functions/`. - `.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:** Unit tests verifying `linux-connector -h` and each sub-command `--help` return exit code 0; man page syntax verified with `man -l man/linux-connector.1`. +- **Verification:** Unit tests verifying `linux-connector -h`, sub-command `--help`, shell completion generation (`linux-connector completion bash` / `zsh`), and man page syntax verification with `man -l man/linux-connector.1`.