Commit graph

452 commits

Author SHA1 Message Date
Vladislav Doster b8855c7887 feat(ziextract): support zst archive format
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-09-01 17:22:49 -05:00
Vladislav Doster eaa1056699 fix(install): retry and auth github api downloads
.zinit-download-file-stdout made every request anonymously and gave
up on the first transient error. The gh-r test suite alone exceeds
GitHub's anonymous API limit of 60 requests/hour/IP, and racing CI
runs trip per-IP abuse throttling, failing whole zunit slices (run
33138613456: 28 failures, all rate-limited downloads).

Send Authorization from GITHUB_TOKEN/GH_TOKEN, strictly limited to
api.github.com so tokens never reach asset CDNs, mirrors, or snippet
hosts, and retry transient HTTP errors in curl and wget.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-08-28 02:53:53 -05:00
vladislav doster 98b004ba5b
Merge pull request #787 from zdharma-continuum/fix/ziextract-install
fix(install): treat non-archive single file gracefully in ziextract.
2026-08-27 22:23:06 -05:00
Vladislav Doster 4819677018 refactor(ices): simplify the cwd helpers
Drop the anonymous-function indirection in .zinit-cd-quiet and pass --,
collapse the duplicated landing cd in .zinit-restore-dir, and convert the
six remaining hand-rolled copies of the idiom in zinit-install.zsh to the
named helper.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-08-27 04:30:41 -05:00
Vladislav Doster 736403cb39 fix(install): restore cwd on early atclone return
atclone evals inline, unlike the atpull hooks, which go through
.zinit-at-eval and get a function frame that absorbs a return from the
ice body. Wrap the eval so the restore runs on every path.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-08-27 04:30:41 -05:00
Vladislav Doster 264526ab26 fix(ices): restore cwd even when the ice body cds
The ___moved guard skipped the restore whenever zinit did not cd
itself, so an ice body that cds under nocd stranded the shell wherever
the plugin left it. Make the restore unconditional and give
.zinit-restore-dir a fast path so the case where nothing moved stays
free.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-08-27 04:30:41 -05:00
Vladislav Doster d875651d59 fix(install): restore cwd after the configure hook
∞zinit-configure-base-hook cd'd into the plugin directory inside a plain
{ } block -- not a subshell -- and every one of its four return paths
left the shell parked there. A `zinit update' on a plugin using the
configure ice moved the user's shell and never moved it back.

Wrap the block in an always clause so the directory is restored on all
paths, and use .zinit-cd-quiet instead of a bare `cd --', which was also
firing chpwd hooks and AUTO_PUSHD.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-08-27 03:28:26 -05:00
Vladislav Doster 712cac1952 fix(ices): restore $OLDPWD around plugin directory hooks
Every ice that runs code inside a plugin or snippet directory (atinit,
atload, multisrc, atclone, atpull, ps-on-unload) saved and restored $PWD
around the temporary cd, but never $OLDPWD. `cd -q' suppresses chpwd
hooks and `noautopushd' suppresses the directory stack, but neither
suppresses $OLDPWD, so the cd back left it pointing at the directory
just visited. Opening a new shell and pressing `cd -' jumped into a
zinit plugin directory without the user ever having gone there.

Add .zinit-cd-quiet/.zinit-restore-dir, which return to the original
$PWD by cd'ing through the original $OLDPWD for real. A plain $OLDPWD
assignment is not enough: `cd -' reads zsh's internal previous-directory
state, not the parameter, so assigning it leaves the parameter looking
correct while `cd -' still navigates to the plugin directory. When the
original $OLDPWD is empty or has since been deleted, bounce through
$PWD instead, which degrades `cd -' to a harmless no-op rather than
emitting an error and leaking the plugin directory anyway.

Also gate the restore on the cd having actually happened. It ran
unconditionally, so with the nocd ice -- where no cd takes place -- the
no-op cd back to $PWD still set OLDPWD=$PWD, silently discarding the
user's real previous directory.

Sites already protected by a real subshell, and the user-facing `zinit
cd' and `zinit create' commands that are meant to leave you in the
target directory, are left untouched.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-08-27 03:28:26 -05:00
Vladislav Doster 981cb1582e fix(install): treat non-archive single file gracefully in ziextract.
Change `ziextract` when no extractor case matches and no explicit type was passed (-z $ext), file is treated as plain single file with info message
`'<file>' is not an archive — keeping it as a plain file.` plus chmod a+x. The existing exec-bit collection then picks it up, sets REPLY for --move, prints normal
success. Error message retained for explicit bogus types (ziextract file bogus-type). One iteration mid-verify: dropped -- from chmod — BSD/macOS chmod rejects it (chmod: --:
No such file or directory).

Why it broke: commit 1334994f (PR #771) made +x detection archive-exec-bit-only. Bare gh-r binaries arrive over HTTP with 644 and no extension => no extractor, no exec bit →
error branch. Pre-#771, file(1) detection covered this case.

Tests (tests/ices.zunit): two new — plain-file success path (asserts no error, message present, file executable) and bogus-explicit-type error
retention. Suite 16/16, including #771's ziextract-permissions. Regression-validated: plain-file test fails 15/16 with fix stashed.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2026-07-02 06:58:41 -05:00
Tom Hale 424b241bc7
feat: validate ice arguments (#778)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-24 10:09:43 +02:00
Andrea Alberti 1334994f20
fix: trust archive permissions instead of file(1) heuristics in ziextract (#771) 2026-03-14 23:39:35 +01:00
Andrea Alberti 4fd38b34e7
fix: prevent double extraction when exclamation mark modifier is used in extract'!'
When using extract'!' with from'gh-r', ziextract was called twice:
1. First by the gh-r download code (line 407) — extracting the archive directly
2. Then by the ∞zinit-extract-hook — calling ziextract --auto --move

On the second call, the .tar.gz was already gone, so --auto mode fell through to file-command detection, which identified .jar files as zip archives
and tried to extract them — corrupting the plugin and producing errors.

Fix: Both the gh-r download path (line 407) and the tarball path (line 272) now skip their direct ziextract call when the extract ice is set,
deferring entirely to the ∞zinit-extract-hook which handles it correctly.
2026-03-06 01:15:30 +01:00
Andrea Alberti 55d19f86f6
Fix(self-update): Honor current branch instead of hardcoding 'main' (#751) 2026-01-03 14:38:58 +01:00
Douglas de Campos Held 5784ef17f4
Fix: Timeout on downloading from GH releases (#741) 2025-09-10 09:27:45 +02:00
Xie Zejian f1e503dc3b
fix: impl gh-r version detection using GitHub API (#731) 2025-09-05 14:27:03 +02:00
sienks 991e4a816e
fix: correct SSH URL format for private repos (#721)
Co-authored-by: sienks <sienks@sienk.dev>
2025-06-05 11:53:41 +02:00
NICHOLAS85 773852f588
fix: global variable in ∞zinit-file-cp-mv-operation (#699)
Some checks failed
Container images / build-containers-with-zsh (5.2.4) (push) Has been cancelled
Container images / build-containers-with-zsh (5.3.1) (push) Has been cancelled
Container images / build-containers-with-zsh (5.4.2) (push) Has been cancelled
Container images / build-containers-with-zsh (5.5.1) (push) Has been cancelled
Container images / build-containers-with-zsh (5.6.2) (push) Has been cancelled
Container images / build-containers-with-zsh (5.7.1) (push) Has been cancelled
Container images / build-containers-with-zsh (5.8) (push) Has been cancelled
Container images / build-containers-with-zsh (5.9) (push) Has been cancelled
Container images / build-container-latest (push) Has been cancelled
Documentation / zshelldoc (push) Has been cancelled
Lint / Markdown Lint (push) Has been cancelled
Lint / ZSH Lint (zsh-noexec) (push) Has been cancelled
Lint / ZSH Lint (zsh-zcompile) (push) Has been cancelled
Unit Tests / zunit-tests (macos-latest, annexes) (push) Has been cancelled
Unit Tests / zunit-tests (macos-latest, commands) (push) Has been cancelled
Unit Tests / zunit-tests (macos-latest, compile) (push) Has been cancelled
Unit Tests / zunit-tests (macos-latest, gh-r) (push) Has been cancelled
Unit Tests / zunit-tests (macos-latest, ices) (push) Has been cancelled
Unit Tests / zunit-tests (macos-latest, plugins) (push) Has been cancelled
Unit Tests / zunit-tests (macos-latest, snippets) (push) Has been cancelled
Unit Tests / zunit-tests (ubuntu-latest, annexes) (push) Has been cancelled
Unit Tests / zunit-tests (ubuntu-latest, commands) (push) Has been cancelled
Unit Tests / zunit-tests (ubuntu-latest, compile) (push) Has been cancelled
Unit Tests / zunit-tests (ubuntu-latest, gh-r) (push) Has been cancelled
Unit Tests / zunit-tests (ubuntu-latest, ices) (push) Has been cancelled
Unit Tests / zunit-tests (ubuntu-latest, plugins) (push) Has been cancelled
Unit Tests / zunit-tests (ubuntu-latest, snippets) (push) Has been cancelled
2025-02-01 08:45:31 +01:00
Andrea Alberti e5fe687489
Allows the user to provide multiple files in the cp / mv ICE separated by ; (#690)
Co-authored-by: Philipp Schmitt <pschmitt@users.noreply.github.com>
2025-01-26 00:15:44 +01:00
vladislav doster e8c3205a2f
fix(zinit-install): simplify protocol pattern (#645)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2024-03-20 01:18:37 -05:00
vladislav doster b7b8347cad
fix: compile command logic when using id-as ice (#619)
- Updated README.md `compiling` section
- Compile commands now work with `id-as` ice
- Compile command options added to tab completion  

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2024-03-03 23:43:48 -06:00
vladislav doster 22e66db478
feat: configure, make, cmake, and build ices (#613) (#616)
* Refactored 'configure' and 'make' ices
* New 'build' ice sets 'configure' and 'make ices if no flags are needed.
* New 'cmake' ice will build/install using 'cmake'
* Delete command now handles programs using 'make' and 'cmake' ices
* Setting `$ZINIT[DEBUG]` enables debug logging (i.e., `+zi-log "{dbg} message ..."`)
2024-01-09 04:11:39 -06:00
yyykt e2d477cde4
fix: tar permissions when ziextract ran as root user (#557) 2024-01-02 17:40:17 -06:00
vladislav doster 71764bf2ca
fix: silence unzip command in ziextract (#614) 2023-12-29 18:39:09 -06:00
vladislav doster 2ccac85e37
feat: remove zpextract and use ziextract (#611)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-12-24 10:36:51 -06:00
vladislav doster 358ef03785
fix: link ice check in .zinit-download-snippet function (#608) 2023-12-15 22:40:25 -06:00
vladislav doster 3c7e5be07d
fix: debug logging logic and format (#592)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-11-20 17:59:43 -06:00
vladislav doster 1f52eee1b1
fix: from'gh-r' skips compile by default (#590)
Skip compile when from'gh-r' ice is set unless compile is also set.

Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-11-20 05:50:12 -06:00
Philipp Schmitt bcf70e8268
fix: use $MACHTYPE instead of arch command (#588) 2023-10-31 11:39:56 -05:00
vladislav doster e458e8288e
refactor: clist subcommand renamed to completions (#583)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-09-30 18:46:19 -05:00
vladislav doster 207ab9f281
fix: gh-r linux regex & gh-r zunit tests (#564)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-08-29 23:33:00 -05:00
vladislav doster 14cc16167f
refactor: rename +zinit-message to +zi-log (#563)
- Rename all instances of +zinit-message to +zi-log
- Maintain compatibility with community plugins/annexes by forwarding +zinit-message calls to +zi-log

Signed-off-by: Doster, Vladislav <mvdoster@gmail.com>
2023-08-20 00:59:44 -05:00
Sebastian Gniazdowski 1375adf8f8
fix: quote parens so that they aren't used as globs (#549) 2023-08-02 17:47:29 +02:00
Philipp Schmitt 113cfc47fb
fix: Ignore .yaml and .py files when installing completions (#528)
Signed-off-by: Doster, Vladislav <mvdoster@gmail.com>
Co-authored-by: vladislav doster <10052309+vladdoster@users.noreply.github.com>
2023-06-15 19:08:56 +02:00
Philipp Schmitt de85908f8d
fix: jq has moved from stedolan/jq to jqlang/jq (#530) 2023-06-05 10:02:55 +02:00
Vladislav Doster c4446da57e
fix: compile and completion log messages
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-05-04 06:37:30 -05:00
wzy fccb5080ab
fix: add .gitignore with '*' pattern in a plugins ._zinit/ directory (#397)
Zinit creates a directory named `._zinit` to store metadata. However, this
metadata should not be added to git.

Closes #395

Signed-off-by: wzy <32936898+Freed-Wu@users.noreply.github.com>
Co-authored-by: Vladislav Doster <mvdoster@gmail.com>
2023-04-08 16:24:46 -05:00
Vladislav Doster 3eb75b7ee9 fix: make gh-r release search case-insensitive
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-02-22 01:05:50 +00:00
Miles Liu da0d6b712c
fix: broken symbolic link after creinstall .
Signed-off-by: Miles Liu <miles@bung.cc>
2023-02-01 12:00:36 +08:00
Vladislav Doster b5a31c07f2 fix: gh-r pattern for 64bit linux-gnu systems
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-01-14 00:01:00 +00:00
Vladislav Doster ad88a890ad fix: gh-r & bpick ice log format and content
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-01-08 02:24:40 -06:00
Vladislav Doster 7e486519d7 fix: gh-r parsing logic for arm64 & logging style
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2023-01-05 10:02:44 -06:00
Vladislav Doster 515688bc97 revert: "Merge branch 'refactor/zinit-function-names' into main"
This reverts commit b979847bd4, reversing
changes made to da924a21a1.

I (@vladdoster) accidentally merged this into the wrong repository. Apologies for the lack of due diligence.
2022-12-17 21:11:41 -06:00
Vladislav Doster 0e45493e36 fix: change prefix ~zi:: to __zi::
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2022-12-16 03:45:16 +00:00
Vladislav Doster 75bb73547e fix: file modelines
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2022-12-15 12:01:15 -06:00
Vladislav Doster c28580c3fc refactor: rename zinit functions
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2022-12-09 15:40:31 -06:00
Jan Katins 59975d70d7
feat: add completions ice (#417)
This can be used to overwrite `as'null'`, which would otherwise not trigger
completion detection and installation.

It will override the `nocompletions` ice when both are specified (e.g., using
the default ice annex).
2022-12-05 07:21:28 -06:00
vladislav doster 529aa20f42
fix: rm linux32 assets in aarch64/arm64 gh-r regex (#414)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2022-11-06 10:28:23 -06:00
vladislav doster fcd2aa6791
style: update ziextract log messages prefix (#411)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2022-11-05 04:41:13 -05:00
vladislav doster 105b38a195
fix: ziextract execs discovery regex (#410)
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2022-11-05 02:51:23 -05:00
Vladislav Doster 1864c0be09 fix: gh-r removes linux32 assets on 64 bit OS
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
2022-10-30 22:53:58 -05:00