Commit Graph
42 Commits
Author SHA1 Message Date
Sebi a26e96cd32 fix(deps): update module charm.land/bubbletea/v2 to v2.1.1 2026-10-28 10:54:26 +00:00
Sebi ac713ac97b Merge pull request 'Fix/instance prefix completion' (#20) from fix/instance-prefix-completion into main
Release / release (push) Successful in 5m43s
Reviewed-on: #20
v0.0.22
2026-10-28 10:46:29 +00:00
Sebastian UnterschützandClaude Opus 5.5 091f5cc518 fix(completion): offer unique hostnames without instance prefix
bash (and zsh without a matcher) only accept candidates that start with
the typed text, so "fsn1-bx1<Tab>" found nothing when every candidate
was qualified as "prod/…". Hostnames that exist in only one instance
are now offered bare; names present in several instances stay
qualified. Connecting to a bare name still checks every instance for
ambiguity, so the connection behavior is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 11:44:54 +01:00
Sebastian UnterschützandClaude Opus 5.5 6243514def fix(completion): accept instance-qualified hosts for a bare name in zsh
With several NetBox instances, netssh offers "prod/fsn1-bx1…" for the
typed text "fsn1". compadd discarded these matches because they do not
start with the typed word, so <Tab> found nothing. The matcher
'l:|=*' lets zsh accept text before the typed word; netssh has already
filtered the candidates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 11:44:54 +01:00
Sebi 6f00d69b6f Merge pull request 'v0.0.21' (#19) from feat/ssh-options-completion-uninstall into main
Release / release (push) Successful in 5m45s
Reviewed-on: #19
v0.0.21
2026-10-28 10:25:20 +00:00
Sebastian UnterschützandClaude Opus 5.5 6711b610f1 docs: document SSH options, uninstall, and zsh completion for v0.0.21
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 11:23:31 +01:00
Sebastian UnterschützandClaude Opus 5.5 c2e590bf52 feat: add netssh uninstall
Remove everything netssh and install.sh set up, also leftovers of
older versions:

- netssh blocks and unmarked legacy lines in bash, zsh, and fish
  profiles
- completion files for bash, zsh (incl. the oh-my-zsh cache), fish,
  and the command alias; files not generated by netssh are kept
- the cache directory with hosts, aliases, and per-instance caches
- the config file and local notes; the config is first copied to a
  private netssh.yaml.backup-<timestamp> because it holds API tokens
- the netssh binary; for protected paths the sudo command is printed

--keep-config keeps config and notes, --dry-run only lists the plan,
and --yes skips the confirmation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 11:23:28 +01:00
Sebastian UnterschützandClaude Opus 5.5 786768ec53 feat: add netssh version and --version
`netssh --version` used to be passed to ssh and failed with
"unknown option -- -". Release builds now embed the tag via
-X main.version; other builds fall back to the module build info.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 11:23:19 +01:00
Sebastian UnterschützandClaude Opus 5.5 2b46c4f74d feat(ssh): jump hosts, host key checking, and configurable ssh options
Add SSH settings that apply only to netssh connections, so
~/.ssh/config does not need global changes:

- proxy_jump (passed as -J; "none" disables an inherited jump host)
- host_key_checking: strict | accept-new | off (off prints a notice)
- target: ip (default) | name | hostname; "name" connects to the
  NetBox name with -o HostName=<ip> and -o HostKeyAlias=<name>, so
  `Host *.example.com` rules apply and known_hosts entries follow the
  device instead of a reused IP
- address_family: any | inet | inet6
- options (-o Key=Value) and extra_args

Settings layer global -> netboxes[].ssh -> ssh.rules (match by tag,
instance, kind, or name glob). Options given on the command line
always win: -o values are inserted after the user's own, and
extra_args before them.

New wrapper flags: --jump HOST, --no-jump, and --dry-run, which prints
the final ssh command instead of connecting. The TUI uses the same
options. The setup wizard keeps all new settings when it saves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 11:23:09 +01:00
Sebastian UnterschützandClaude Opus 5.5 129a7201bc feat(hook): write marked profile blocks and register zsh completion
`netssh hook install` and the setup wizard now write the same marked
`# >>> netssh >>>` block as install.sh and replace unmarked entries of
older versions instead of appending duplicates. Uninstall shares the
legacy patterns with the installer (eval/alias/source variants).

For zsh the block adds ~/.zfunc to fpath and calls compdef, so
completion also works when compinit already ran earlier in .zshrc,
e.g. with oh-my-zsh. The installer reports which completion it set up
per shell and how to reset ~/.zcompdump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 11:22:53 +01:00
Sebastian UnterschützandClaude Opus 5.5 8fb7633783 feat(completion): fast zsh completion for large host caches
Cobra's generated zsh script spawns a subshell per candidate and sends
every host through _describe, so <Tab> hangs for seconds with thousands
of cached hosts. netssh now ships its own script: subcommands and flags
go through _describe, plain hostnames through compadd. 5000 hosts
complete in ~0.08 s instead of ~4 s.

Add completion.max_results to cap the number of offered hostnames and
sort host candidates for a stable order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 11:22:18 +01:00
Sebastian Unterschütz 7f53b90266 feat: search multiple NetBox instances with isolated host identities
Release / release (push) Successful in 5m16s
v0.0.20
2026-10-27 23:14:42 +01:00
Sebastian Unterschütz a2a6dd7591 chore(deps): update github.com/charmbracelet/ultraviolet digest to a45b7c8
Release / release (push) Successful in 5m7s
v0.0.19
2026-10-27 22:44:00 +01:00
Sebastian Unterschütz 79c0027833 fix(deps): migrate Charm to v2 and require Go 1.27.3
Release / release (push) Successful in 6m16s
v0.0.18
2026-10-27 22:29:54 +01:00
Sebastian Unterschütz fa7446e5f7 Fix host resolution and concurrent cache updates 2026-10-27 22:23:59 +01:00
Sebastian Unterschütz 92b1c40cb8 Update Go module dependencies
Release / release (push) Successful in 4m46s
v0.0.17
2026-10-27 19:25:37 +01:00
Sebastian Unterschütz 34503de68e Enable shell completion for configured command aliases
Release / release (push) Successful in 5m8s
v0.0.16
2026-10-27 19:19:42 +01:00
Sebastian Unterschütz 14d519d010 Use public Gitea URL for releases and download links
Release / release (push) Successful in 5m37s
v0.0.15
2026-10-27 18:46:38 +01:00
Sebastian Unterschütz fa4509038b Package installer in releases and expand Renovate dependency updates
Release / release (push) Successful in 4m41s
v0.0.14
2026-10-27 18:38:54 +01:00
Sebastian Unterschütz 66a49786c9 Translate remaining German text to English
Release / release (push) Successful in 5m32s
v0.0.13
2026-10-27 18:27:21 +01:00
Sebastian Unterschütz 4b28d441b0 Improve installer updates and dependency checks and add command aliases
Release / release (push) Successful in 7m57s
v0.0.12
2026-10-27 18:10:44 +01:00
Sebastian Unterschütz 12cc64fdd9 Add local and NetBox server notes and improve reliability
Release / release (push) Successful in 6m52s
v0.0.11
2026-10-27 17:51:59 +01:00
Sebi 2852dff2c4 Merge pull request 'chore(deps): update actions/setup-go action to v7' (#3) from renovate/actions-setup-go-7.x into main 2026-10-11 17:15:15 +00:00
Sebi 2d11303014 Merge pull request 'chore(deps): update actions/checkout action to v7' (#2) from renovate/actions-checkout-7.x into main 2026-10-11 17:13:57 +00:00
Sebi 5c6cc7dbbf chore(deps): update actions/setup-go action to v7 2026-10-11 16:30:19 +00:00
Sebi b17ace7fc5 chore(deps): update actions/checkout action to v7 2026-10-11 16:29:56 +00:00
Sebi 8241a064f4 Merge pull request 'chore: Configure Renovate' (#1) from renovate/configure into main 2026-10-11 16:12:43 +00:00
Sebi 86fc2f19eb Add renovate.json 2026-10-11 15:45:13 +00:00
Sebastian Unterschütz fa646f25a6 feat: add alias file generation and management for shell hooks
Release / release (push) Successful in 49s
- **Aliases**: Generate shell alias files (`aliases.sh` for bash/zsh, `netssh.fish` for fish) from cached hosts. Regenerate on each shell startup and cache refresh to keep aliases updated.
- **Hooks**: Extend shell hook functionality to include alias file support. Install and uninstall commands updated for bash, zsh, and fish.
- **Tests**: Add unit tests to verify alias file generation, path resolution, and idempotent hook installation.
- **Docs**: Update README with instructions for alias file usage, installation, and relation to hooks.
v0.0.10
2026-05-27 23:08:30 +02:00
Sebastian Unterschütz 7c902cab3a feat: introduce shortcuts and shell hook support
Release / release (push) Successful in 50s
- **Shortcuts**: Add hostname normalization with domain stripping and hyphen folding. Include alias generation for cached hosts.
- **Shell Hook**: Automate 24h cache refresh trigger with shell startup hook. Add install/uninstall commands for bash, zsh, and fish.
- **Wizard**: Extend setup wizard to configure shortcuts (domains, hyphen stripping) and default SSH port.
- **Cache**: Add `GetByShortcut` for resolving hosts via normalized shortcuts. Implement `NeedsRefresh` / `SetRefreshed` logic for refresh timestamps.
- **Tests**: Comprehensive unit tests for shortcuts, hook installation, cache refresh, and alias generation.
- **Docs**: Update README with shortcuts, shell hook, and default SSH port configuration.
v0.0.9
2026-05-27 22:53:24 +02:00
Sebastian Unterschütz d127a3b957 feat: enhance host resolution, filtering, and cache management
Release / release (push) Successful in 49s
- **Strategies**: Add resolver strategy input validation and parsing in setup wizard. Support comma-separated input with known strategy mapping.
- **Client**: Extend Search and SearchAll to include kind and tag filters. Add pagination for full cache refresh handling large datasets.
- **Cache**: Introduce `RecentlyUsed` and `MarkUsed`. Persist `LastUsed` timestamps for entries.
- **TUI**: Add recent hosts view, tag/kind filters, and inline editor for user/port override.
- **Tests**: Comprehensive unit tests for new features, including strategy validation, cache behavior, and client filtering.
- **Docs**: Update README with new TUI features and cache subcommands.
v0.0.8
2026-05-23 17:06:24 +02:00
Sebastian UnterschützandClaude Sonnet 4.6 cdf750081e feat: show subcommands after hostnames in shell completion
Release / release (push) Successful in 48s
Use ShellCompDirectiveKeepOrder so fish/zsh/bash preserve the returned
order instead of sorting alphabetically. ValidArgsFunction now appends
subcommand names (with their short descriptions) after all hostname
entries, so hosts always appear first in the completion list.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v0.0.7
2026-05-23 14:42:41 +02:00
Sebastian UnterschützandClaude Sonnet 4.6 574c4dbf58 fix: completion install writes non-empty scripts
Release / release (push) Successful in 47s
GenBashCompletionV2/GenZshCompletion/GenFishCompletion write into the
buffer as a side effect; capturing buf.String() in the return statement
before the Gen* call runs means the buffer is always empty. Separate
the call from the return to fix evaluation order.

Also call InitDefaultCompletionCmd() before iterating root.Commands()
so the lazily-initialized completion subtree is visible before Execute().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v0.0.5 v0.0.6
2026-05-23 13:50:53 +02:00
Sebastian Unterschütz 8fc7896b35 docs: update README for wizard, token versions, completion install
Release / release (push) Successful in 46s
v0.0.4
2026-05-23 13:31:08 +02:00
Sebastian UnterschützandClaude Sonnet 4.6 da3a280a43 feat: netssh completion install — user-space shell completion setup
Adds `netssh completion install` subcommand:
- Auto-detects shell from $SHELL, override with --shell bash|zsh|fish
- bash  → ~/.local/share/bash-completion/completions/netssh
- zsh   → ~/.zfunc/_netssh  (prints fpath hint)
- fish  → ~/.config/fish/completions/netssh.fish
- No sudo required

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 13:28:43 +02:00
Sebastian UnterschützandClaude Sonnet 4.6 a4fa33d224 feat: v2 token support in client + comprehensive tests
Release / release (push) Successful in 51s
API client:
- NewClient now accepts tokenVersion (0 = auto-detect from token prefix)
- tokenVersion stored on Client, used for 403 error hints
- All callers pass cfg.NetBox.TokenVersion

Tests added:
- netbox: TokenVersion, NewClient auto-detect, explicit version,
  403 v1 hint, 403 v2 no-hint, Authorization header verification
- config: token_version preserved/auto-detected, defaults, missing
  file, invalid YAML, Path()
- setup: save roundtrip, file permissions (0600), empty fields
  omitted, dir creation, full save→load roundtrip

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v0.0.3
2026-05-23 13:17:34 +02:00
Sebastian UnterschützandClaude Sonnet 4.6 8ae28b3474 feat: persist token_version in config, auto-detect on load
- NetBoxConfig.TokenVersion saved to netssh.yaml by the wizard
- config.Load() auto-detects the version from the token prefix if the
  field is missing (backwards-compatible with existing configs)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 13:12:35 +02:00
Sebastian UnterschützandClaude Sonnet 4.6 9334003c9e feat: detect NetBox token version, hint on v1, better 403 message
- TokenVersion() distinguishes nbt_-prefixed v2 tokens from legacy v1
- 403 errors now say "check token permissions" + v1 hint if applicable
- Setup wizard prints a note after saving if a v1 token was entered

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 13:11:01 +02:00
Sebastian UnterschützandClaude Sonnet 4.6 ff9c61c087 feat: interactive setup wizard for first-run and netssh configure
Release / release (push) Successful in 1m36s
- Auto-detects missing config (netbox.url empty) and launches wizard
- `netssh configure` re-runs the wizard anytime to change settings
- 3-page huh form: NetBox connection, SSH defaults, resolver & cache
- Saves to ~/.config/netssh.yaml (permissions 0600)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v0.0.2
2026-05-23 13:04:55 +02:00
Sebastian UnterschützandClaude Sonnet 4.6 11f5319eae ci: delete existing release before recreating on retrigger
Release / release (push) Successful in 1m32s
Prevents curl exit 22 (HTTP 409) when a tag's release already exists.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v0.0.1
2026-05-23 12:56:50 +02:00
Sebastian UnterschützandClaude Sonnet 4.6 d178f8b053 fix: add cmd/netssh to git and fix overly broad gitignore rule
Release / release (push) Failing after 1m0s
/netssh ignores only the root binary, not the cmd/netssh/ source directory.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-23 12:52:09 +02:00
Sebastian Unterschütz 8ef4bbec16 Add core modules (SSH args parser, cache, resolver, NetBox client) with tests
Release / release (push) Failing after 51s
2026-05-23 12:38:41 +02:00