Skip to content

Commit b2ec0a0

Browse files
digital-teamsss-odependabot[bot]
committed
CI Workflow Improvements and Repository Cleanup (#174)
* 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 * Checksum e470ca3 * ci: add org project tracker scripts (#158) * 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> * feat: add color.zsh from molovo/color (MIT) * feat: add revolver from molovo/revolver (MIT) * 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) * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sall <59910950+ss-o@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sall <59910950+ss-o@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Sall <59910950+ss-o@users.noreply.github.com> * fix: address review feedback for revolver process check and installer URLs Agent-Logs-Url: https://github.com/z-shell/src/sessions/3295a818-69b9-4b0d-99f8-bf27b90e3b7c Co-authored-by: ss-o <59910950+ss-o@users.noreply.github.com> * fix: validate revolver pid before liveness check Agent-Logs-Url: https://github.com/z-shell/src/sessions/3295a818-69b9-4b0d-99f8-bf27b90e3b7c Co-authored-by: ss-o <59910950+ss-o@users.noreply.github.com> --------- Signed-off-by: Sall <59910950+ss-o@users.noreply.github.com> * chore(ci): remove emoji prefixes from workflow names * build(deps): bump the github-actions group across 1 directory with 5 updates (#173) Bumps the github-actions group with 5 updates in the / directory: | Package | From | To | | --- | --- | --- | | [actions/checkout](https://github.com/actions/checkout) | `6.0.2` | `7.0.1` | | [z-shell/.github/actions/commit](https://github.com/z-shell/.github) | `1.0.8` | `1.1.1` | | [peaceiris/actions-gh-pages](https://github.com/peaceiris/actions-gh-pages) | `4.0.0` | `4.1.0` | | [z-shell/.github/actions/rclone](https://github.com/z-shell/.github) | `1.0.8` | `1.1.1` | | [egor-tensin/setup-cygwin](https://github.com/egor-tensin/setup-cygwin) | `4.0.1` | `4.0.2` | Updates `actions/checkout` from 6.0.2 to 7.0.1 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@de0fac2...3d3c42e) Updates `z-shell/.github/actions/commit` from 1.0.8 to 1.1.1 - [Release notes](https://github.com/z-shell/.github/releases) - [Commits](z-shell/.github@91068ee...3222f53) Updates `peaceiris/actions-gh-pages` from 4.0.0 to 4.1.0 - [Release notes](https://github.com/peaceiris/actions-gh-pages/releases) - [Changelog](https://github.com/peaceiris/actions-gh-pages/blob/main/CHANGELOG.md) - [Commits](peaceiris/actions-gh-pages@4f9cc66...84c30a8) Updates `z-shell/.github/actions/rclone` from 1.0.8 to 1.1.1 - [Release notes](https://github.com/z-shell/.github/releases) - [Commits](z-shell/.github@91068ee...3222f53) Updates `egor-tensin/setup-cygwin` from 4.0.1 to 4.0.2 - [Release notes](https://github.com/egor-tensin/setup-cygwin/releases) - [Changelog](https://github.com/egor-tensin/setup-cygwin/blob/master/CHANGELOG.md) - [Commits](egor-tensin/setup-cygwin@d2c752b...fca9069) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: github-actions - dependency-name: z-shell/.github/actions/commit dependency-version: 1.1.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: peaceiris/actions-gh-pages dependency-version: 4.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: z-shell/.github/actions/rclone dependency-version: 1.1.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: egor-tensin/setup-cygwin dependency-version: 4.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: resolve merge conflicts with origin/main * fix: address code review issues from PR review - Fix mktemp -d portability: add template to all calls for BSD/macOS compat (tests/installers.sh, public/sh/install.sh, install_zpmod.sh, sync-init.sh, scripts/add-project-workflow.sh) - Fix add-project-workflow.sh: fail fast if mktemp fails - Fix _comps[zi] in public/zsh/init.zsh to register function name _zi instead of absolute file path (fixes completion loading) - Fix ANSI escape sequences in public/sh/sync-init.sh: use printf '%b' with real ESC prefix so color codes render correctly - Fix merged comment with duplicated # in public/zsh/snippets/revolver * fix: add completion dir to fpath in _zi_comps before registering _zi * revert: remove fpath manipulation from _zi_comps, defer to zi.zsh * chore: remove deprecated scripts/ directory * fix: update checksums to match current script files --------- Signed-off-by: Sall <59910950+ss-o@users.noreply.github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Salvydas Lukosius <ss-o@users.noreply.github.com> Co-authored-by: digital-teams[bot] <actions@zshell.dev> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> 47f0510
1 parent b4ddf81 commit b2ec0a0

7 files changed

Lines changed: 31 additions & 31 deletions

File tree

checksum.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
348b78e992d28ecebd23940d06944629ef7f8f9d93c17ef3469cd6eebd288451 public/sh/install_zpmod.sh
2-
7408a1045f330a6e73bda55c6c7b48be7873a4e7f1fb00d7db989827cc9224a9 public/sh/install.sh
3-
f8519bf7e3e42ad67cc9cff6d82a8367641611fc687b2f6793e26bd55dbbb553 public/sh/sync-init.sh
4-
98f54a779985719e390b3e4559b7b0ac22101caac91d0569d41cd9229a05c6de public/zsh/init.zsh
1+
0140801e80b2d8767e95d215850b6feab3642ee2b6fd70fbf4aab09afcfe7fca public/sh/install_zpmod.sh
2+
0cca0bb9f95101b4bf392d6aa3c23123602d99a7cbb0decacaa72973e016d89d public/sh/install.sh
3+
08cc893ceb982fc99d17db1966c6c30790cc571e16e4f5392352d995f5252952 public/sh/sync-init.sh
4+
5c7af31d7fc848d80f9fedf69c75e6844503f550a3d5e020bc7cdfdaca624763 public/zsh/init.zsh

sh/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
set -eu
66

7-
WORKDIR="$(mktemp -d)" || exit 1
7+
WORKDIR="$(mktemp -d "${TMPDIR:-/tmp}/zi-install.XXXXXX")" || exit 1
88
trap 'rm -rf "${WORKDIR:?}"' EXIT INT TERM
99
ZOPT=""
1010
AOPT=""

sh/install_zpmod.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
set -eu
66

7-
WORKDIR="$(mktemp -d)" || exit 1
7+
WORKDIR="$(mktemp -d "${TMPDIR:-/tmp}/zi-zpmod.XXXXXX")" || exit 1
88
trap 'rm -rf "${WORKDIR:?}"' EXIT INT TERM
99

1010
# Returns 0 if version $1 >= version $2 (dot-separated integers)

sh/sync-init.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
set -eu
2424

25-
WORKDIR="$(mktemp -d)" || exit 1
25+
WORKDIR="$(mktemp -d "${TMPDIR:-/tmp}/zi-sync.XXXXXX")" || exit 1
2626
trap 'rm -rf "${WORKDIR:?}"' EXIT INT TERM
2727

2828
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
@@ -70,7 +70,7 @@ _fetch_url() {
7070
elif command -v wget >/dev/null 2>&1; then
7171
command wget -qO- "${_url}"
7272
else
73-
printf '%s\n' "[1;31m▓▒░[0m No curl or wget available." >&2
73+
printf '%b\n' "[1;31m▓▒░[0m No curl or wget available." >&2
7474
return 1
7575
fi
7676
}
@@ -114,14 +114,14 @@ _fetch() {
114114
return 0
115115
fi
116116
fi
117-
printf '%s\n' "[1;31m▓▒░[0m Failed to fetch: ${_src}" >&2
117+
printf '%b\n' "[1;31m▓▒░[0m Failed to fetch: ${_src}" >&2
118118
return 1
119119
;;
120120
*)
121121
if [ -r "${_src}" ]; then
122122
command cat "${_src}"
123123
else
124-
printf '%s\n' "[1;31m▓▒░[0m Cannot read local path: ${_src}" >&2
124+
printf '%b\n' "[1;31m▓▒░[0m Cannot read local path: ${_src}" >&2
125125
return 1
126126
fi
127127
;;
@@ -136,7 +136,7 @@ _sha256() {
136136
elif command -v shasum >/dev/null 2>&1; then
137137
shasum -a 256 "${_file}" | command awk '{print $1}'
138138
else
139-
printf '%s\n' "[1;31m▓▒░[0m No sha256sum or shasum available." >&2
139+
printf '%b\n' "[1;31m▓▒░[0m No sha256sum or shasum available." >&2
140140
return 1
141141
fi
142142
}
@@ -191,8 +191,8 @@ done
191191
# ── Validate Inputs ───────────────────────────────────────────────────────────
192192

193193
if [ ! -f "${OPT_LOCAL}" ] && [ "${OPT_WRITE}" -eq 0 ]; then
194-
printf '%s\n' "[1;31m▓▒░[0m Local file not found: ${OPT_LOCAL}" >&2
195-
printf '%s\n' "[1;33m▓▒░[0m Use --write to create it from remote." >&2
194+
printf '%b\n' "[1;31m▓▒░[0m Local file not found: ${OPT_LOCAL}" >&2
195+
printf '%b\n' "[1;33m▓▒░[0m Use --write to create it from remote." >&2
196196
exit 1
197197
fi
198198

@@ -202,7 +202,7 @@ REMOTE_FILE="${WORKDIR}/remote-init.zsh"
202202
printf '%s\n' "▓▒░ Fetching remote: ${OPT_REMOTE}"
203203
# shellcheck disable=SC2310
204204
if ! _fetch "${OPT_REMOTE}" >"${REMOTE_FILE}"; then
205-
printf '%s\n' "[1;31m▓▒░[0m Failed to fetch remote file." >&2
205+
printf '%b\n' "[1;31m▓▒░[0m Failed to fetch remote file." >&2
206206
exit 1
207207
fi
208208

@@ -213,19 +213,19 @@ if [ "${OPT_NO_CHECKSUM}" -eq 0 ]; then
213213
printf '%s\n' "▓▒░ Fetching checksum: ${OPT_CHECKSUM_URL}"
214214
# shellcheck disable=SC2310
215215
if ! _fetch "${OPT_CHECKSUM_URL}" >"${CHECKSUM_FILE}"; then
216-
printf '%s\n' "[1;31m▓▒░[0m Failed to fetch checksum file." >&2
216+
printf '%b\n' "[1;31m▓▒░[0m Failed to fetch checksum file." >&2
217217
exit 1
218218
fi
219219

220220
EXPECTED_HASH="$(grep "${CHECKSUM_KEY}" "${CHECKSUM_FILE}" | command awk '{print $1}')"
221221
if [ -z "${EXPECTED_HASH}" ]; then
222-
printf '%s\n' "[1;31m▓▒░[0m No checksum entry for '${CHECKSUM_KEY}' in checksum.txt." >&2
222+
printf '%b\n' "[1;31m▓▒░[0m No checksum entry for '${CHECKSUM_KEY}' in checksum.txt." >&2
223223
exit 1
224224
fi
225225

226226
REMOTE_HASH="$(_sha256 "${REMOTE_FILE}")"
227227
if [ "${REMOTE_HASH}" != "${EXPECTED_HASH}" ]; then
228-
printf '%s\n' "[1;31m▓▒░[0m Remote checksum mismatch!" >&2
228+
printf '%b\n' "[1;31m▓▒░[0m Remote checksum mismatch!" >&2
229229
printf '%s\n' " expected : ${EXPECTED_HASH}" >&2
230230
printf '%s\n' " got : ${REMOTE_HASH}" >&2
231231
exit 1
@@ -245,13 +245,13 @@ else
245245
fi
246246

247247
if [ "${LOCAL_HASH}" = "${REMOTE_HASH}" ]; then
248-
printf '%s\n' "[1;32m▓▒░[0m Local file matches remote. No sync needed."
248+
printf '%b\n' "[1;32m▓▒░[0m Local file matches remote. No sync needed."
249249
printf '%s\n' " hash : ${LOCAL_HASH}"
250250
printf '%s\n' " path : ${OPT_LOCAL}"
251251
exit 0
252252
fi
253253

254-
printf '%s\n' "[1;33m▓▒░[0m Local and remote differ."
254+
printf '%b\n' "[1;33m▓▒░[0m Local and remote differ."
255255
printf '%s\n' " local : ${LOCAL_HASH}"
256256
printf '%s\n' " remote : ${REMOTE_HASH}"
257257
printf '%s\n' " source : ${OPT_REMOTE}"
@@ -286,7 +286,7 @@ fi
286286
command mv "${TMP_TARGET}" "${OPT_LOCAL}"
287287

288288
NEW_HASH="$(_sha256 "${OPT_LOCAL}")"
289-
printf '%s\n' "[1;32m▓▒░[0m Sync complete."
289+
printf '%b\n' "[1;32m▓▒░[0m Sync complete."
290290
printf '%s\n' " before : ${LOCAL_HASH}"
291291
printf '%s\n' " after : ${NEW_HASH}"
292292
printf '%s\n' " path : ${OPT_LOCAL}"

zsh/init.zsh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ _zi_pmod() {
119119
# Register Zi completion if the completion system is active.
120120
_zi_comps() {
121121
builtin emulate -L zsh
122-
if (( ${+_comps} )) && [[ -f "${ZI[BIN_DIR]}/lib/_zi" ]]; then
123-
(( ${+_comps[zi]} )) || _comps[zi]="${ZI[BIN_DIR]}/lib/_zi"
122+
if (( ${+_comps} )); then
123+
(( ${+_comps[zi]} )) || _comps[zi]=_zi
124124
fi
125125
return 0
126126
}

zsh/snippets/color.zsh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# Source: https://github.com/molovo/color
44
# License: MIT — Copyright (c) 2015 Joe Letchford
55
# Maintained by z-shell/src — https://github.com/z-shell/src
6-
#
7-
#!/usr/bin/env zsh
86

97
function color() {
108
local color=$1 style=$2 b=0

zsh/snippets/revolver

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env zsh
2+
23
# Source: https://github.com/molovo/revolver
34
# License: MIT — Copyright (c) 2016 Joe Letchford
45
# Maintained by z-shell/src — https://github.com/z-shell/src
5-
#
66

77
local -A _revolver_spinners
88
_revolver_spinners=(
@@ -79,7 +79,7 @@ function _revolver_usage() {
7979
echo " start <message> Start the spinner"
8080
echo " update <message> Update the message"
8181
echo " stop Stop the spinner"
82-
echo " demo Display an demo of each style"
82+
echo " demo Display a demo of each style"
8383
}
8484

8585
###
@@ -88,6 +88,10 @@ function _revolver_usage() {
8888
function _revolver_process() {
8989
local dir statefile state msg pid="$1" spinner_index=0
9090

91+
if [[ -z $pid || $pid != <-> ]]; then
92+
exit 1
93+
fi
94+
9195
# Find the directory and load the statefile
9296
dir=${REVOLVER_DIR:-"${ZDOTDIR:-$HOME}/.revolver"}
9397
statefile="$dir/$pid"
@@ -107,11 +111,9 @@ function _revolver_process() {
107111
fi
108112

109113
# Check for the existence of the parent process
110-
$(kill -s 0 $pid 2&>/dev/null)
111-
112-
# If process doesn't exist, exit the script
113-
# to prevent it from being orphaned
114-
if [[ $? -ne 0 ]]; then
114+
# and exit if process doesn't exist to prevent
115+
# the spinner from being orphaned
116+
if ! kill -s 0 "$pid" 2>/dev/null; then
115117
exit 1
116118
fi
117119

0 commit comments

Comments
 (0)