Commit graph

567 commits

Author SHA1 Message Date
Frad LEE
cd66c5695a refactor(ai): replace empty buffer with min input
- Replace ZSH_AUTOSUGGEST_ALLOW_EMPTY_BUFFER with AI_MIN_INPUT
- Add ZSH_AUTOSUGGEST_AI_DEBUG environment variable
- Add debug logging function to diagnose failures
- Update history lines default from 20 to 5
- Update pwd history preference default to no

Min input provides clearer semantics: set to 0 for empty-buffer
suggestions or higher to require minimum input. Debug logging helps
diagnose missing suggestions by showing API request flow.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-05 14:39:12 +08:00
Frad LEE
81672cc7fe test(ai): add comprehensive functionality tests
Add test coverage to ensure AI features are working
correctly and remain functional.

- Add RSpec tests for endpoint construction
- Add RSpec tests for environment context gathering
- Add RSpec tests for dual prompt modes
- Add RSpec tests for temperature configuration
- Add integration test script for manual validation
- Add simple functionality test for CI/verification

Tests verify base URL handling, context collection,
prompt modes, and all new AI strategy features.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 11:30:38 +08:00
Frad LEE
f43786cafd refactor(ai): use base url for endpoint config
Change endpoint configuration to use base URL pattern,
automatically appending /chat/completions path.

- Update default endpoint to base URL format
- Add automatic path construction in strategy
- Update README examples to use base URLs
- Update endpoint description to "base URL"

Follows OpenAI SDK standard pattern where users configure
base URL and library appends specific paths.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 11:25:31 +08:00
Frad LEE
d89bf4ec0d feat(ai): add empty buffer context suggestions
Enable AI suggestions on empty prompts with enhanced
environmental context.

- Update AI_MIN_INPUT default from 3 to 0
- Add ALLOW_EMPTY_BUFFER opt-in config variable
- Remove empty-buffer guards in modify, suggest, enable
- Add zle-line-init hook for prompt-time suggestions
- Enhance history gathering with PWD-aware priority
- Add env context for dir listing, git branch, status
- Implement dual prompts: predict vs complete modes
- Add prompt artifact stripping for $ and > prefixes
- Update README with empty buffer configuration
- Add tests for empty buffer and artifact stripping

Empty buffer suggestions require zsh 5.3+ and work best with
AI strategy, leveraging directory context, git state, and
command history to predict likely next actions.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 10:58:19 +08:00
Frad LEE
8a9c1a2a30 feat: add ai suggestion strategy
Add new AI strategy that queries OpenAI-compatible LLM APIs
to generate intelligent command completions based on partial
input, working directory, and recent shell history.

- Add AI strategy implementation with JSON escaping
- Add context gathering with PWD prioritization
- Add response normalization for clean suggestions
- Add configuration defaults for AI settings
- Add comprehensive test suite with mocked responses
- Update README with setup guide and examples

Enables LLM-powered completions via ZSH_AUTOSUGGEST_AI_API_KEY
with silent failure and fallback to next strategy. Supports
OpenAI, Ollama, and custom endpoints. Requires curl and jq.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 10:24:52 +08:00
Eric Freese
85919cd1ff
Merge pull request #829 from win8linux/patch-1
INSTALL.md: Add FreeBSD
2025-06-24 10:15:03 -06:00
Eric Freese
dc8dcf7425
Merge pull request #831 from ShoeBoom/patch-1
Update homebrew install link to point to homebrew website.
2025-06-24 10:13:31 -06:00
ShoeBoom
da75fc226d
Update homebrew install link to point to homebrew website.
the git file in the homebrew repo does not provide a clear path to install
2025-06-22 20:12:57 -07:00
Julius Enriquez
a00927c673
INSTALL.md: Add FreeBSD 2025-06-07 01:04:21 +08:00
Eric Freese
0e810e5afa
Merge pull request #813 from tesar-tech/patch-1
Some checks failed
/ determine-versions (push) Successful in 4s
/ test (push) Failing after 17s
Fixes link for nixos package
2024-11-25 20:07:39 -07:00
Jan Tesař
f9526195c5
Fixes link for nixos package 2024-11-25 18:04:58 +01:00
Eric Freese
e52ee8ca55
Merge pull request #811 from zsh-users/develop
Some checks failed
/ determine-versions (push) Successful in 3s
/ test (push) Failing after 15s
v0.7.1
v0.7.1
2024-11-15 12:47:51 -07:00
Eric Freese
f8907cf32b v0.7.1
Some checks failed
/ determine-versions (push) Successful in 11s
/ test (push) Failing after 49s
2024-11-15 12:36:08 -07:00
Eric Freese
a50468ef4b Update changelog for v0.7.1 release 2024-11-15 12:35:58 -07:00
Eric Freese
9aceef9646 Remove circle ci reference left over from switch to github actions 2024-11-15 12:28:27 -07:00
Joe Schaefer
11d17e7fea Clear POSTDISPLAY instead of unsetting
We don't have any particular reason to unset. Clearing should be good
enough, and avoid any errors using unset parameters.

Cherry-picked from PR #634
2023-09-07 09:54:04 -06:00
Eric Freese
a593f4dfec
Merge pull request #630 from codicodi/reset-fd
Always reset file descriptor after consuming it
2023-09-07 09:39:17 -06:00
Eric Freese
2c9e57fd50
Merge pull request #628 from jeebak/develop
Ensure that we're using the builtin exec
2023-09-07 09:31:03 -06:00
Eric Freese
c3d4e576c9
Merge pull request #687 from japanese-goblinn/master
fix: Makefile SRC_DIR spacing
2023-09-07 08:58:48 -06:00
Pablo Speciale
23f2943455 Add more common widgets to list of clear widgets
Cherry-picked from PR #706 and updates made to src/config.zsh.

Fixes issues #678
2023-09-07 08:49:25 -06:00
Eric Freese
95602e2dea
Merge pull request #723 from migimigi/migimigi-patch-1
Create .gitignore for *.zwc
2023-09-07 08:46:09 -06:00
Eric Freese
39aa7bed3a
Merge pull request #671 from jirutka/patch-1
Install: Add Alpine Linux package
2023-09-04 09:56:08 -06:00
Eric Freese
27c298cf1a
Merge pull request #711 from dpthegrey/patch-1
Update Install.md
2023-09-04 09:54:44 -06:00
Eric Freese
a84d78f8b5
Merge pull request #758 from mjperrone/patch-1
Update INSTALL link for Mac OS - homebrew moved under z/
2023-09-04 09:53:24 -06:00
Mike Perrone
309d32ac9e
Update INSTALL link for Mac OS - homebrew moved under z/ 2023-09-03 10:00:21 -07:00
Eric Freese
9908eb49a3
Merge pull request #755 from rweir/master
Update README.md
2023-08-17 20:15:04 -06:00
Rob Weir
2b97cf3b30
Update README.md
Clarify where to get `zpty` from.

Info from https://apple.stackexchange.com/a/416099 and https://zsh.sourceforge.io/releases.html .
2023-08-17 23:42:12 +01:00
Eric Freese
9b0272944f Add support for 5.9 2023-05-26 19:57:30 -06:00
Eric Freese
c5044edd48 Support latest minor version of 5.8 2023-05-26 19:57:14 -06:00
Eric Freese
2cc34c015e Switch from Circle CI to GitHub Actions
The testing docker image has been split up. Instead of having one image
with all supported versions of zsh installed, we now have a separate
image for each supported zsh version.

We use GitHub Action matrices to run jobs in parallel for all of the
supported versions.

We no longer need to publish images to Docker Hub. The images are just
built by CI (or developers) as needed from the Dockerfile in the repo.
2023-05-26 19:44:39 -06:00
migimigi
f29bb7f032
Create .gitignore for *.zwc 2023-02-14 01:08:57 +09:00
D
c14ad9fc46
Update Install.md
Adds steps to install zsh-autosuggestions via Homebrew Formulae.
2022-10-12 13:10:21 +05:30
japanese-goblinn
fc391d6bf6 fix: Makefile SRC_DIR spacing 2022-05-16 22:11:12 +03:00
Jakub Jirutka
7795a357e6
Install: Add Alpine Linux package 2022-03-15 22:52:50 +01:00
Robert Cegliński
56f10c3b5d Always reset file descriptor after consuming it
This prevents the request cancelling logic from closing an unrelated fd that happens to reuse the same number.
2021-09-17 00:15:07 +02:00
JeeBak Kim
8072e52d96 Run: make 2021-08-28 22:15:54 -07:00
JeeBak Kim
69bf058c23 Ensure we're using the builtin exec 2021-08-28 22:15:54 -07:00
Eric Freese
a411ef3e09
Merge pull request #613 from zsh-users/develop v0.7.0
v0.7.0
2021-06-04 16:05:04 -06:00
Eric Freese
fcca87555f v0.7.0 2021-06-04 16:02:12 -06:00
Eric Freese
74ba3739bb Update changelog for v0.7.0 release 2021-06-04 16:02:12 -06:00
Eric Freese
3ecc53dfe2 Update license copyright year 2021-06-04 16:02:12 -06:00
Eric Freese
aa05920a4a Merge remote-tracking branch 'origin/pull/541' into develop 2021-06-04 15:33:29 -06:00
Eric Freese
89c600c873 Support new zsh version: 5.8 2021-06-04 14:42:16 -06:00
Eric Freese
3474c87d67
Merge pull request #612 from abcdw/develop
Disable ^C async workaround for zsh version 5.8 and later
2021-06-04 14:30:13 -06:00
Andrew Tropin
590c1cd84c
Disable ^C async workaround for zsh version 5.8 and later 2021-06-03 19:42:58 +03:00
Eric Freese
58c98a7739
Merge pull request #588 from keskinsaf/#587-fix-installation-aside-other-plugins
Update INSTALL.md
2021-03-09 06:38:25 -07:00
keskinsaf
bb18c4f677
Update INSTALL.md 2021-03-09 11:08:18 +03:00
keskinsaf
9ad305c906
Update INSTALL.md
[fix] install this plugin aside other plugins
2021-03-08 14:44:01 +03:00
Eric Freese
eff0894a13
Merge pull request #530 from zsh-users/fixes/flaky-ci
Fixes/flaky ci
2020-06-05 14:51:33 -06:00
Roman Perepelitsa
e0b96e1bd6 fix a bug in partial acceptance of suggestions
To reproduce:

1. Run `zsh -f`.
2. Run this:
  function bye() { BUFFER=bye }
  zle -N bye
  bindkey '^B' bye
  print -s 'hibye unexpected'
  source ~/zsh-autosuggestions/zsh-autosuggestions.zsh
3. Type `hi` and press Ctrl-B.

Expected: POSTBUFFER is empty.

Actual: POSTBUFFER is " unexpected".
2020-05-29 09:41:39 +02:00