Refactor installer scripts and update CI workflows#160
Conversation
Remove obsolete cspell word lists, editorconfig, vscode settings, and retired workflows (rebase, stale, sync-labels, wrangler). Drop legacy installer scripts i.sh and install_alpha.sh.
- Bump actions/checkout to v6.0.2 and shellcheck to 2.0.0 - Add lib/zsh/** and tests/** to push/PR path triggers - Add permissions: contents: read and timeout-minutes: 10 - Use github.ref in concurrency group - Replace ~/.zi hard-coded paths with XDG_DATA_HOME equivalents - Add unit-fixture step calling tests/installers.sh - Remove wrangler deploy job; update trunk linter config
sync-init.sh verifies (and optionally replaces) the local lib/zsh/init.zsh against the canonical GitHub raw main copy. Supports --write, --local, --remote, --checksum-url and --no-checksum flags. tests/installers.sh provides a POSIX sh test suite covering: - script syntax validation (sh -n / zsh -n) - checksum integrity checks - loader install with XDG path and branch-override assertions - standalone zpmod delegation test - sync-init fixture round-trip test
install.sh: - Add set -eu; use WORKDIR=$(mktemp -d) with safe trap cleanup - Replace ~/.zi with XDG_DATA_HOME-aware path - Fix sed command for ZI[STREAM] substitution - Correct cd fallback from return to exit 1 - Guard branch pull with BOPT; add exit 1 on failed clone - Fix .zshrc loader snippet variable quoting install_zpmod.sh: - Add set -eu, file header and WORKDIR trap - Add pure-POSIX _zi_ver_ge() replacing expr string comparison - Honour XDG_DATA_HOME for ZI_HOME default - Replace exit 255 with exit 1 throughout lib/zsh/init.zsh: - Update default branch to use ZI[STREAM] parameter - Align loader paths with XDG layout
- Exclude AI agent instruction files from git tracking (AGENTS.md, CLAUDE.md, GEMINI.md, .github/copilot-instructions.md) - Add .geminiignore - Regenerate lib/checksum.txt to reflect updated scripts - Document sync-init.sh usage in docs/README.md - Remove deprecated git.io short URLs from README
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update all internal references to reflect the repository rename: - .trunk/trunk.yaml repo name - workflow repository guards (checksum, rclone-action, deploy-gh-pages) - win-install safe.directory path - docs/README.md VSCode and jsDelivr URLs
Deploying src with
|
| Latest commit: |
07e7143
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://76cbaea8.zi-src.pages.dev |
| Branch Preview URL: | https://ci-org-project-tracker-scrip.zi-src.pages.dev |
* chore: remove deprecated files and configs Remove obsolete cspell word lists, editorconfig, vscode settings, and retired workflows (rebase, stale, sync-labels, wrangler). Drop legacy installer scripts i.sh and install_alpha.sh. * ci: update workflows and trunk configuration - Bump actions/checkout to v6.0.2 and shellcheck to 2.0.0 - Add lib/zsh/** and tests/** to push/PR path triggers - Add permissions: contents: read and timeout-minutes: 10 - Use github.ref in concurrency group - Replace ~/.zi hard-coded paths with XDG_DATA_HOME equivalents - Add unit-fixture step calling tests/installers.sh - Remove wrangler deploy job; update trunk linter config * feat: add sync-init.sh and tests/installers.sh sync-init.sh verifies (and optionally replaces) the local lib/zsh/init.zsh against the canonical GitHub raw main copy. Supports --write, --local, --remote, --checksum-url and --no-checksum flags. tests/installers.sh provides a POSIX sh test suite covering: - script syntax validation (sh -n / zsh -n) - checksum integrity checks - loader install with XDG path and branch-override assertions - standalone zpmod delegation test - sync-init fixture round-trip test * refactor: migrate installer scripts to XDG paths and harden POSIX install.sh: - Add set -eu; use WORKDIR=$(mktemp -d) with safe trap cleanup - Replace ~/.zi with XDG_DATA_HOME-aware path - Fix sed command for ZI[STREAM] substitution - Correct cd fallback from return to exit 1 - Guard branch pull with BOPT; add exit 1 on failed clone - Fix .zshrc loader snippet variable quoting install_zpmod.sh: - Add set -eu, file header and WORKDIR trap - Add pure-POSIX _zi_ver_ge() replacing expr string comparison - Honour XDG_DATA_HOME for ZI_HOME default - Replace exit 255 with exit 1 throughout lib/zsh/init.zsh: - Update default branch to use ZI[STREAM] parameter - Align loader paths with XDG layout * chore: update gitignore, checksums, and docs - Exclude AI agent instruction files from git tracking (AGENTS.md, CLAUDE.md, GEMINI.md, .github/copilot-instructions.md) - Add .geminiignore - Regenerate lib/checksum.txt to reflect updated scripts - Document sync-init.sh usage in docs/README.md - Remove deprecated git.io short URLs from README * ci(check-linux): add init.zsh sync-drift detection step * fix(install.sh): verify zi.zsh exists after clone, not just directory * ci: add concurrency to checksum.yml; add smoke-test to win-install.yml Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: rename repo references from zi-src to src Update all internal references to reflect the repository rename: - .trunk/trunk.yaml repo name - workflow repository guards (checksum, rclone-action, deploy-gh-pages) - win-install safe.directory path - docs/README.md VSCode and jsDelivr URLs * ci: add org project tracker scripts (label sync + workflow rollout) * fix(ci): continue label sync after repo failures * chore: fix lint issues and syntax errors reported by trunk --------- Co-authored-by: Salvydas Lukosius <ss-o@users.noreply.github.com> e53c4fb
There was a problem hiding this comment.
Pull request overview
This PR is a large modernization pass: it rewrites the Zi loader (lib/zsh/init.zsh) to use XDG paths and cleaner helper functions, refactors the install.sh / install_zpmod.sh scripts (adding set -eu, fixing the infinite-loop MAIN wrapper, delegating zpmod to a dedicated script), introduces a new sync-init.sh drift checker plus a POSIX test harness (tests/installers.sh), modernizes all CI workflows (pinned action SHAs, explicit permissions:/concurrency:, repo-rename to z-shell/src, XDG-aware paths), removes obsolete workflows and helper configs, and adds maintenance scripts (sync-labels.sh, add-project-workflow.sh).
Changes:
- Loader/installer refactor with XDG-compliant paths, branch override via
ZI[STREAM], and removal of legacyinstall_alpha.sh/i.sh. - New
sync-init.shplustests/installers.shtest harness wired into Linux/macOS/Windows CI; updated checksum manifest. - CI/workflow hygiene: SHA-pinned actions,
permissions,concurrency, repository-name guards, removal ofrebase/stale/sync-labels/wranglerworkflows.
Reviewed changes
Copilot reviewed 29 out of 31 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/sh/install.sh | Rewrites installer to use XDG paths, delegates zpmod build to install_zpmod.sh, removes infinite while loop. |
| lib/sh/install_zpmod.sh | Adds POSIX _zi_ver_ge version compare, XDG dir resolution, normalized exit codes. |
| lib/sh/sync-init.sh | New script verifying/syncing local init.zsh against canonical remote with checksum check. |
| lib/zsh/init.zsh | Rewritten loader: XDG paths, internal _zi_* helpers, history defaults, cleaner bootstrap. |
| lib/sh/install_alpha.sh, lib/sh/i.sh | Deleted obsolete installer variants. |
| lib/checksum.txt | Regenerated for new script set, adds sync-init.sh. |
| lib/index.html | New CDN landing page. |
| tests/installers.sh | New shell test harness validating syntax, checksums, install flows, sync-init. |
| scripts/sync-labels.sh, scripts/add-project-workflow.sh, scripts/repos.txt | New org-wide maintenance helpers. |
| docs/README.md | Updated URLs and adds sync-init maintainer docs. |
| .github/workflows/check-linux.yml, check-macos.yml, win-install.yml | Add tests/init paths, pin actions, XDG paths in cleanup, new smoke tests. |
| .github/workflows/checksum.yml, deploy-gh-pages.yml, rclone-action.yml | Add permissions/concurrency, repo guards, prepare-metadata step, pinned actions. |
| .github/workflows/rebase-action.yml, stale-action.yml, sync-labels.yml, wrangler.yml | Removed obsolete workflows. |
| .trunk/trunk.yaml | Bumped tool versions, added shfmt definition, renamed repo to src. |
| .cspell/* | Removed obsolete custom dictionaries. |
| .editorconfig, .vscode/settings.json | Deleted. |
| .gitignore | Ignores AI-agent instruction files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| printf '%s\n' "${col_error}-- Zsh version 5.8.1 and above required --${col_rst}" | ||
| exit 1 | ||
| _zpmod_sh="${WORKDIR}/install_zpmod.sh" | ||
| _zpmod_url="https://raw.githubusercontent.com/z-shell/zi-src/main/lib/sh/install_zpmod.sh" |
| DEFAULT_REMOTE="https://raw.githubusercontent.com/z-shell/zi-src/main/lib/zsh/init.zsh" | ||
| DEFAULT_CHECKSUM_URL="https://raw.githubusercontent.com/z-shell/zi-src/main/lib/checksum.txt" |
| command git clean -d -f -f | ||
| command git reset --hard HEAD | ||
| command git pull -q origin HEAD | ||
| command git pull -q origin "${BOPT}" |
| export LD_LIBRARY_PATH="${INSTALL_PATH}"/lib:"${LD_LIBRARY_PATH}" | ||
| export CFLAGS=-I"${INSTALL_PATH}"/include | ||
| export CPPFLAGS="-I${INSTALL_PATH}/include" LDFLAGS="-L${INSTALL_PATH}/lib" | ||
| export LD_LIBRARY_PATH="${INSTALL_PATH}/lib:${LD_LIBRARY_PATH-}" |
| tmpdir=$(mktemp -d) | ||
| trap 'rm -rf "$tmpdir"' EXIT INT TERM |
| # History defaults | ||
| : ${HISTFILE:=${XDG_STATE_HOME:-$HOME/.local/state}/zsh/history} | ||
| [[ -e "$HISTFILE" ]] || { command mkdir -p "${HISTFILE:h}"; command touch "$HISTFILE"; } | ||
| [[ -w "$HISTFILE" ]] && typeset -gx SAVEHIST=440000 HISTSIZE=441000 |
| ZOPT='skip' | ||
| fi | ||
| if [ "${ZOPT}" != skip ]; then | ||
| if [ "${ZOPT}" != skip ] && [ "${AOPT}" != loader ]; then |
| - https://ipfs.zshell.dev | ||
| - jsDeliver: | ||
| - https://cdn.jsdelivr.net/gh/z-shell/zi-src@main/ | ||
| - https://cdn.jsdelivr.net/gh/z-shell/src@main/ |
This pull request makes significant updates to the project's CI/CD workflows, focusing on improving automation reliability, coverage, and maintainability. It also cleans up custom dictionary files and removes several unused or deprecated GitHub Actions workflows. The most important changes are grouped below:
CI/CD Workflow Improvements:
.github/workflows/check-linux.yml,.github/workflows/check-macos.yml, and.github/workflows/win-install.ymlto includelib/zsh/**,tests/**, and updated install/uninstall logic to better handle XDG-compliant paths and add new verification steps. [1] [2] [3] [4] [5]actions/checkout@v6.0.2,ludeeus/action-shellcheck@2.0.0). [1] [2] [3] [4] [5] [6] [7] [8] [9]Workflow Removals and Cleanups:
rebase-action.yml,stale-action.yml,sync-labels.yml, andwrangler.yml, reducing maintenance overhead and potential for confusion. [1] [2] [3] [4]Project Dictionary and Editor Config Updates:
.cspell/project-words.txt,.github/.cspell/project-words.txt,.github/.cspell/project-ignored.txt, and.github/.cspell/project-usernames.txt. [1] [2] [3] [4].editorconfigfor clarity and maintainability.Other Notable Improvements:
Overall, these changes modernize and streamline the project's automation, improve test reliability, and reduce technical debt.