- Bash 3.2+ (test with
bash --version) - git
- bats-core (
brew install bats-coreor see https://bats-core.readthedocs.io) - ShellCheck (
brew install shellcheck) - shfmt (
brew install shfmt)
git clone https://github.com/K1-R1/smoosh
cd smoosh
git submodule update --init --recursive
cargo install prek # pre-commit hooks (Rust, one-time install)
prek install # activate hooks for this repoThis project uses prek for
pre-commit hooks. Run prek install once after cloning. The hooks run
automatically on git commit and check:
- Trailing whitespace and missing final newlines
- Markdown formatting (markdownlint-cli2)
- Spelling — British English (cspell)
- ShellCheck lint
- shfmt formatting
To check all files manually: prek run --all-files
bats test/*.bats # all tests
bats test/smoosh_args.bats # specific fileThe golden file suite (test/smoosh_golden.bats) verifies that smoosh output
is byte-for-byte correct across all modes, formats, and feature combinations.
If you intentionally change smoosh's output format (for example, adding a new header field or changing the section separator), regenerate the expected files:
UPDATE_GOLDEN=1 bats test/smoosh_golden.batsThen review the diff to confirm the changes are intentional before committing:
git diff test/golden/The golden files live in test/golden/expected/. Never edit them by hand —
always use UPDATE_GOLDEN=1 to regenerate them from a passing smoosh run.
The demos live in assets/. The interactive demo has a
VHS tape file (brew install vhs):
| Tape | Output | Shows |
|---|---|---|
assets/demo.tape |
assets/demo.gif |
Interactive mode flow |
The other GIFs (demo-logo.gif, demo-power.gif) are recorded manually.
Re-record when relevant:
| When to re-record | Files affected |
|---|---|
| Visual style changes (colours, banner, symbols) | assets/demo-logo.gif, assets/demo.gif |
| Interactive mode UI changes | assets/demo.gif |
| New major flags or output format changes | assets/demo-power.gif |
vhs assets/demo.tape # interactive flow — re-record when UI changesCommit the updated .gif files alongside the code change that prompted the
re-record.
- 2-space indentation
shellcheck smooshmust pass with zero warningsshfmt -d -i 2 smooshmust show no diff- Functions must be <= 100 lines
- Use
printf '%s\n' "$var"notecho "$var"for filenames - All non-content output to stderr
- Never use
sed -i— write to temp file thenmv - Always use
--before file arguments
macOS ships Bash 3.2. Keep the script compatible:
- No
declare -A(associative arrays) - No
readarrayormapfile - No
${var,,}(lowercase expansion) - No named references (
declare -n) - Use
tr '[:upper:]' '[:lower:]'for case conversion
This project uses Conventional Commits. Prefix every commit subject with a type:
| Type | When |
|---|---|
feat: |
New feature or user-visible change |
fix: |
Bug fix |
test: |
Adding or updating tests |
docs: |
Documentation only |
chore: |
Maintenance (CI, deps, tooling) |
refactor: |
Code change that doesn't fix a bug or add a feature |
Examples: feat: add --format csv, fix: handle empty repo gracefully.
Keep the subject line under 72 characters; use the body for detail.
This project uses the Developer Certificate of Origin
(DCO). Every commit in your PR must carry a Signed-off-by trailer certifying
that you have the right to submit it under the project's MIT licence.
Git adds the trailer automatically with the -s flag:
git commit -s -m "feat: add widget support"The DCO GitHub App checks every PR. Unsigned commits will fail the check. If you forget, amend and force-push your branch:
git commit --amend -s --no-edit
git push --force-with-lease- Fork the repo and create a branch:
git checkout -b feat/your-feature - Make your changes with tests
- Run
prek runandbats test/*.bats - Sign your commits (
git commit -s) - Open a PR against
main
PRs that break CI or have unsigned commits will not be merged.
Look for issues labelled good first issue — these are intentionally small
and well-scoped entry points.
Open an issue — no question is too small.