===================================================================== A follow-up to V5 focused on hardening the environment system and expanding the ZSH logging/caching toolkit. No migration required from v5.0.x, though note the log-level reorganization below may quiet some messages at lower verbosities. --- New Features ------------------------- - persistent cross-runtime cache for ZSH-type scwrypts; extends the v5.0 runtime speedup cache to survive between runs with automatic hash-based invalidation (toggle via SCWRYPTS__ZSH_CACHE_ENABLED) - new 'trace' log level (5) and echo.trace, plus '-v VARNAME' state injection for echo.debug / echo.trace to surface variable values inline - additional scwrypts output formats: 'raw' and 'logfmt' (alongside pretty and json) - normalize.boolean utility for consistent truthy/falsey handling across ZSH-type scwrypts - utils.fzf.file-select for directory-scoped file selection prompts - automatic dependency wrappers providing default arguments, GNU coreutil resolution, and scwrypts trace on wrapped commands --- Changes ------------------------------ - log levels reorganized; success / status / reminder messages now emit at level 3, so lower verbosities will show fewer of these - environment library restructured around get-user-json as the single source of truth (replaces the previous user module and cache-output) - utility renames for consistency: user.Yn / user.yN (from utils.*) - utils.fail and utils.abort deprecated in favor of echo.error and echo.error.user-abort --- Bug Fixes ---------------------------- - CI runs now resolve config lookup-paths (.dotted.path) to their environment variable before reading, fixing false "not set" reports and invalid-export errors for lookup-path checks in CI - hardened environment type detection so array-valued configs reprint correctly after their first check - corrected exit-code capture in the cache layer (now reflects the cached command, not the downstream output filter) - scwrypt exit code now survives the logging pipeline - assorted script fixes (efs unmount file listing, postgres run-sql file discovery)
Scwrypts
Scwrypts is a CLI and API for safely running scripts in the terminal, CI, and other automated environments.
Local runs provide a user-friendly approach to quickly execute CI workflows and automations in your terminal. Each local run runs through an interactive, sandboxed environment so you never accidentally run dev credentials in production ever again!
Major Version Upgrade Notice
Please refer to Version 4 to Version 5 Upgrade Path when upgrading from scwrypts v4 to scwrypts v5!
Installation
Quick installation is supported through both the Arch User Repository and Homebrew
# AUR
yay -Syu scwrypts
# homebrew
brew install wrynegade/scwrypts
Manual Installation
To install scwrypts manually, clone this repository (and take note of where it is installed)
Replacing the /path/to/cloned-repo appropriately, add the following line to your ~/.zshrc:
source /path/to/cloned-repo/scwrypts.plugin.zsh
The next time you start your terminal, you can now execute scwrypts by using the plugin shortcut(s) (by default CTRL + SPACE).
Plugin shortcuts are configurable in your scwrypts configuration file found in ~/.config/scwrypts/config.zsh, and here is the default config.
If you want to use the scwrypts program directly, you can either invoke the executable ./scwrypts or link it in your PATH for easy access.
For example, if you have ~/.local/bin in your PATH, you might run:
ln -s /path/to/cloned-repo/scwrypts "${HOME}/.local/bin/scwrypts"
PATH Dependencies
Scwrypts provides a framework for workflows which often depend on a variety of other tools. Although the lazy-loaded dependency model allows hardening in CI and extendability, the user is expected to resolve required PATH dependencies.
When running locally, this is typically as simple as "install the missing program," but this may require additional steps when working in automated environments.
By default, the ci plugin is enabled which provides the check all dependencies scwrypt.
You can run this to output a comprehensive list of PATH dependencies across all scwrypts groups, but, at a bare minimum, you will need the following applications in your PATH:
zsh
grep # GNU
sed # GNU
sort # GNU
fzf # https://github.com/junegunn/fzf (only required for interactive / local)
jo # https://github.com/jpmens/jo
jq # https://github.com/jqlang/jq
yq # https://github.com/mikefarah/yq
Usage in CI and Automated Environments
Set environment variable CI=true to run scwrypts in an automated environment.
There are a few notable changes to this runtime:
- The Scwrypts sandbox environment will not load. All variables will be read directly from the current context.
- User yes/no prompts will always be YES
- Other user input will default to an empty string
- Logs will not be captured in the user's local cache
- In GitHub actions,
*.scwrypts.zshgroups are detected automatically from the$GITHUB_WORKSPACE; setSCWRYPTS_GITHUB_NO_AUTOLOAD=trueto disable
Contributing
Before contributing an issue, idea, or pull request, check out the super-brief contributing guide