hintshell 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -5
- package/package.json +1 -1
- package/scripts/test-bashrc-load.sh +26 -0
- package/scripts/test-fzf-quiet.sh +24 -0
- package/scripts/test-fzf-resolve-bash.sh +27 -0
- package/scripts/test-overlay-layout.ps1 +41 -0
package/README.md
CHANGED
|
@@ -42,11 +42,12 @@ Most shells offer basic, single-line autocomplete. HintShell replaces that with
|
|
|
42
42
|
|
|
43
43
|
Follow these steps in order to get HintShell running on your machine.
|
|
44
44
|
|
|
45
|
-
### 1. Install Dependencies (macOS / Linux
|
|
46
|
-
HintShell uses `fzf` to render the suggestion picker on
|
|
45
|
+
### 1. Install Dependencies (macOS / Linux / Git Bash)
|
|
46
|
+
HintShell uses `fzf` to render the suggestion picker on Bash/Zsh (including **Git Bash** on Windows).
|
|
47
47
|
- **macOS**: `brew install fzf`
|
|
48
48
|
- **Linux (Ubuntu/Debian)**: `sudo apt install fzf`
|
|
49
|
-
- **Windows**:
|
|
49
|
+
- **Windows (Git Bash)**: `winget install junegunn.fzf` (or install fzf another way). PowerShell overlay does **not** require fzf.
|
|
50
|
+
- **Windows PowerShell**: No extra dependencies for the real-time overlay.
|
|
50
51
|
|
|
51
52
|
### 2. Install HintShell
|
|
52
53
|
Install via NPM to get the latest pre-built binaries for your platform:
|
|
@@ -83,13 +84,20 @@ source ~/.bashrc
|
|
|
83
84
|
- **Tab** : Accept
|
|
84
85
|
- **Esc** : Close
|
|
85
86
|
|
|
86
|
-
### Zsh / Bash (macOS/Linux)
|
|
87
|
+
### Zsh / Bash (macOS/Linux/Git Bash)
|
|
87
88
|
**Tab-to-Suggest**: To avoid conflicts with `zsh-autosuggestions`, HintShell activates when you press **Tab**.
|
|
88
|
-
- **Type `git ` + Tab** : Opens a fuzzy picker with frequencies
|
|
89
|
+
- **Type `git ` + Tab** : Opens a fuzzy picker with frequencies.
|
|
89
90
|
- **Enter** : Select and fill the command line.
|
|
90
91
|
|
|
92
|
+
> **Git Bash note:** HintShell resolves `fzf` to a real executable (e.g. under WinGet Packages). If you previously saw `Permission denied` on `WinGet/Links/fzf`, reinstall/update to **0.2.0+**, run `hs init` (or reload `~/.bashrc`), and open a new terminal.
|
|
93
|
+
|
|
91
94
|
---
|
|
92
95
|
|
|
96
|
+
## ✨ What's new in 0.2.0
|
|
97
|
+
|
|
98
|
+
- PowerShell: multi-line paste no longer covers the buffer with the suggestion panel; narrow terminals use a compact layout.
|
|
99
|
+
- Git Bash / Bash / Zsh: reliable fzf picker (WinGet Links shim fix) and init that prefers `~/.hintshell` over npm shims.
|
|
100
|
+
- See [CHANGELOG.md](./CHANGELOG.md) for the full list.
|
|
93
101
|
## 🗑️ Uninstallation
|
|
94
102
|
|
|
95
103
|
If you need to remove HintShell, it now comes with a clean uninstaller that handles everything for you:
|
package/package.json
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -e
|
|
3
|
+
# Simulate what user does after fix
|
|
4
|
+
source "$HOME/.bashrc"
|
|
5
|
+
echo "which hintshell: $(which hintshell 2>/dev/null || true)"
|
|
6
|
+
echo "type resolve: $(type -t _hintshell_resolve_fzf 2>/dev/null || echo NOT_FOUND)"
|
|
7
|
+
if type -t _hintshell_resolve_fzf >/dev/null 2>&1; then
|
|
8
|
+
r="$(_hintshell_resolve_fzf 2>&1)"
|
|
9
|
+
echo "resolve: $r"
|
|
10
|
+
if printf '%s' "$r" | grep -qi 'Permission denied'; then
|
|
11
|
+
echo FAIL_permission
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
case "$r" in
|
|
15
|
+
*/Packages/*) echo OK ;;
|
|
16
|
+
*) echo FAIL_path; exit 1 ;;
|
|
17
|
+
esac
|
|
18
|
+
else
|
|
19
|
+
echo FAIL_no_function
|
|
20
|
+
# debug
|
|
21
|
+
echo "HINTSHELL_BIN=${HINTSHELL_BIN:-unset}"
|
|
22
|
+
ls -la /c/Users/ADMIN/.hintshell/bin/ 2>&1 | head -10
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
echo "grep Links in hook: $(/c/Users/ADMIN/.hintshell/bin/hintshell.exe hook bash 2>/dev/null | grep -c 'WinGet/Links' || true)"
|
|
26
|
+
echo ALL_OK
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -e
|
|
3
|
+
export PATH="/c/Users/ADMIN/.hintshell/bin:$PATH"
|
|
4
|
+
eval "$(hintshell hook bash 2>/dev/null)"
|
|
5
|
+
echo "type resolve: $(type -t _hintshell_resolve_fzf)"
|
|
6
|
+
# Capture all stderr+stdout from resolve — must not contain Permission denied
|
|
7
|
+
out="$(_hintshell_resolve_fzf 2>&1)" || true
|
|
8
|
+
echo "OUT=$out"
|
|
9
|
+
if printf '%s' "$out" | grep -qi 'Permission denied'; then
|
|
10
|
+
echo FAIL_leaked_error
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
case "$out" in
|
|
14
|
+
*/Packages/*) echo OK_packages_path ;;
|
|
15
|
+
*) echo "OTHER: $out"; exit 1 ;;
|
|
16
|
+
esac
|
|
17
|
+
# Force try Links path (must not print Permission denied)
|
|
18
|
+
err="$(_hintshell_try_fzf '/c/Users/ADMIN/AppData/Local/Microsoft/WinGet/Links/fzf' 2>&1)" || true
|
|
19
|
+
echo "TRY_LINKS=$err"
|
|
20
|
+
if printf '%s' "$err" | grep -qi 'Permission denied'; then
|
|
21
|
+
echo FAIL_links_leaked
|
|
22
|
+
exit 1
|
|
23
|
+
fi
|
|
24
|
+
echo ALL_OK
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
BIN="/d/Admin/Documents/PROJECTS/HintShell/target/release/hintshell.exe"
|
|
4
|
+
[[ -x "$BIN" ]] || BIN="/d/Admin/Documents/PROJECTS/HintShell/target/release/hintshell"
|
|
5
|
+
[[ -x "$BIN" ]] || { echo "FAIL: binary missing"; exit 1; }
|
|
6
|
+
|
|
7
|
+
# Load only fzf resolve helpers from generated hook
|
|
8
|
+
eval "$(
|
|
9
|
+
"$BIN" hook bash 2>/dev/null | awk '
|
|
10
|
+
/^_hintshell_try_fzf\(\)/ {p=1}
|
|
11
|
+
p {print}
|
|
12
|
+
/^}$/ && p && seen++ { if (seen>=2) exit }
|
|
13
|
+
'
|
|
14
|
+
)"
|
|
15
|
+
|
|
16
|
+
resolved="$(_hintshell_resolve_fzf)"
|
|
17
|
+
echo "RESOLVED=$resolved"
|
|
18
|
+
# Must not be the WinGet Links shim
|
|
19
|
+
case "$resolved" in
|
|
20
|
+
*/WinGet/Links/*)
|
|
21
|
+
echo "FAIL: still resolved to Links shim"
|
|
22
|
+
exit 1
|
|
23
|
+
;;
|
|
24
|
+
esac
|
|
25
|
+
ver="$("$resolved" --version 2>&1)"
|
|
26
|
+
echo "VERSION=$ver"
|
|
27
|
+
echo "OK fzf resolve"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
$ErrorActionPreference = 'Stop'
|
|
2
|
+
$repo = Split-Path $PSScriptRoot -Parent
|
|
3
|
+
Set-Location $repo
|
|
4
|
+
|
|
5
|
+
$overlay = Join-Path $repo 'integrations/powershell/HintShellModule/HintShellOverlay.ps1'
|
|
6
|
+
$handlers = Join-Path $repo 'integrations/powershell/HintShellModule/HintShellHandlers.ps1'
|
|
7
|
+
|
|
8
|
+
foreach ($f in @($overlay, $handlers)) {
|
|
9
|
+
$tokens = $null; $errors = $null
|
|
10
|
+
$null = [System.Management.Automation.Language.Parser]::ParseFile($f, [ref]$tokens, [ref]$errors)
|
|
11
|
+
if ($errors -and $errors.Count -gt 0) {
|
|
12
|
+
Write-Host "FAIL $f"
|
|
13
|
+
$errors | ForEach-Object { Write-Host $_.ToString() }
|
|
14
|
+
exit 1
|
|
15
|
+
}
|
|
16
|
+
Write-Host "OK parse $f"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
. $overlay
|
|
20
|
+
function script:Invoke-HSDaemon { param($Query, $Limit) @() }
|
|
21
|
+
|
|
22
|
+
$w1 = Get-HSDisplayWidth -Text 'hello'
|
|
23
|
+
$w2 = Get-HSDisplayWidth -Text ([string][char]0x2500 * 5)
|
|
24
|
+
$t1 = Get-HSTruncateToWidth -Text ('x' * 20) -MaxCols 10
|
|
25
|
+
$ml1 = Test-HSMultilineBuffer -Typed ("git commit -m" + [char]10 + "foo")
|
|
26
|
+
$ml2 = Test-HSMultilineBuffer -Typed 'git status'
|
|
27
|
+
|
|
28
|
+
if ($w1 -ne 5) { throw "width hello=$w1" }
|
|
29
|
+
# U+2500 box-drawing is single-column in modern terminals
|
|
30
|
+
if ($w2 -ne 5) { throw "width box=$w2" }
|
|
31
|
+
if (-not $ml1) { throw 'multiline detect failed' }
|
|
32
|
+
if ($ml2) { throw 'single-line false positive' }
|
|
33
|
+
$tw = Get-HSDisplayWidth -Text $t1
|
|
34
|
+
if ($tw -gt 10) { throw "trunc too wide: $tw" }
|
|
35
|
+
|
|
36
|
+
# Layout budget uses safe console defaults when handle invalid (CI/headless)
|
|
37
|
+
$budget = Get-HSLayoutBudget -CursorTop 0
|
|
38
|
+
if ($budget.W -lt 20) { throw "W too small $($budget.W)" }
|
|
39
|
+
if ($budget.VpMax -lt 1) { throw "vpMax invalid $($budget.VpMax)" }
|
|
40
|
+
Write-Host "budget W=$($budget.W) compact=$($budget.Compact) vp=$($budget.VpMax) rows=$($budget.AvailableRows)"
|
|
41
|
+
Write-Host 'UNIT OK'
|