Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e374f8c
feat: lower minimum bash version requirement from 3.2 to 3.0
Chemaclass Feb 3, 2026
5100702
fix: complete Bash 3.0 compatibility fixes
Chemaclass Feb 4, 2026
3a10363
fix: Bash 3.0 compatibility for assert_contains_ignore_case
Chemaclass Feb 4, 2026
c2fbe67
ci: run Bash 3.0 tests in parallel jobs
Chemaclass Feb 4, 2026
01dba04
fix: resolve shellcheck and lint errors
Chemaclass Feb 4, 2026
05ffbe1
ci: remove read-only flag from Docker volume mount
Chemaclass Feb 4, 2026
032107b
ci: add procps package for ps command in Docker
Chemaclass Feb 4, 2026
bfd3d97
ci: trigger fresh build
Chemaclass Feb 4, 2026
46f94b6
test: skip mock/spy external script tests on Bash 3.0
Chemaclass Feb 4, 2026
9235356
fix: use local -a for safe Bash 3.0 array init, fix variable scoping
Chemaclass Feb 4, 2026
af54c95
Merge branch 'main' into feat/support-bash-3.0
Chemaclass Feb 9, 2026
e274b8a
Merge branch 'main' into feat/support-bash-3.0
Chemaclass Feb 10, 2026
313c540
fix: improve Bash 3.0 regex compatibility and assignment quoting
Chemaclass Feb 10, 2026
54a1ff1
fix: prevent variable leakage in loops across all source files
Chemaclass Feb 10, 2026
68941fc
fix: add local declarations for all remaining loop variables
Chemaclass Feb 10, 2026
d7cd950
fix: initialize all loop variables to prevent unbound variable errors…
Chemaclass Feb 10, 2026
d68762c
fix: make array iteration safe for strict mode (set -u)
Chemaclass Feb 10, 2026
de43885
fix: remove redundant array size check in benchmark print function
Chemaclass Feb 10, 2026
a0e86ea
fix(runner): expand test_file at trap definition time to prevent unbo…
Chemaclass Feb 10, 2026
9c8f621
fix(compat): harden regex matching, array expansion, and parameter subs
Chemaclass Feb 10, 2026
ec935c2
revert: remove unnecessary loop variable initializations from d7cd950
Chemaclass Feb 10, 2026
421fbee
fix(coverage): initialize lineno counter to prevent strict mode error
Chemaclass Feb 10, 2026
e9be71b
fix(compat): address PR feedback for Bash 3.0 compatibility
Chemaclass Feb 11, 2026
834bd32
fix(compat): convert all literal regex patterns to variables
Chemaclass Feb 11, 2026
ea2970a
fix(compat): move regex pattern outside loop in doc.sh
Chemaclass Feb 11, 2026
bc993e1
fix(compat): use glob pattern instead of regex for code fence
Chemaclass Feb 11, 2026
81d47c4
Update src/reports.sh
Chemaclass Feb 11, 2026
2915045
Update src/runner.sh
Chemaclass Feb 11, 2026
a8be738
Update src/reports.sh
Chemaclass Feb 11, 2026
4cc506e
Update src/helpers.sh
Chemaclass Feb 11, 2026
8758009
Update src/main.sh
Chemaclass Feb 11, 2026
ec1f282
Update src/helpers.sh
Chemaclass Feb 11, 2026
47ced2c
Update src/learn.sh
Chemaclass Feb 11, 2026
90ba80a
Update src/main.sh
Chemaclass Feb 11, 2026
1280a79
fix(compat): store literal regex patterns in variables for Bash 3.0
Chemaclass Feb 11, 2026
172026f
fix(compat): simplify array init and add IFS guards
Chemaclass Feb 11, 2026
eda74cc
style: fix indentation from 8 spaces to 2 in acceptance tests and con…
Chemaclass Feb 11, 2026
197f4b2
refactor(compat): inline regex matching and remove bashunit::regex_ma…
Chemaclass Feb 11, 2026
a4e0ea6
fix(compat): add IFS guards to assert functions and fix array expansi…
Chemaclass Feb 12, 2026
320942c
fix(style): revert formatting changes to bin/ files
Chemaclass Feb 12, 2026
0944c13
docs: update Bash version references from 3.2+ to 3.0+
Chemaclass Feb 12, 2026
6dbb3e4
fix(style): bashunit
Chemaclass Feb 12, 2026
2c62d75
fix(compat): guard empty array expansion in parse_result_parallel
Chemaclass Feb 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Project Overview

**bashunit** is a comprehensive, lightweight Bash testing framework (requires Bash 3.2+) focused on developer experience. It provides assertions, test doubles (spies/mocks), data providers, snapshots, and more.
**bashunit** is a comprehensive, lightweight Bash testing framework (requires Bash 3.0+) focused on developer experience. It provides assertions, test doubles (spies/mocks), data providers, snapshots, and more.

**Documentation:** https://bashunit.typeddevs.com

Expand All @@ -11,7 +11,7 @@
This directory (`.claude/`) contains comprehensive Claude Code configuration:
- **Custom skills**: `/tdd-cycle`, `/fix-test`, `/add-assertion`, `/check-coverage`, `/pre-release`
- **Custom commands**: `/gh-issue` (complete GitHub issue → PR workflow)
- **Modular rules**: Bash 3.2+ compatibility, testing patterns, TDD workflow
- **Modular rules**: Bash 3.0+ compatibility, testing patterns, TDD workflow
- **Automation**: Agent SDK examples for CI/CD

See `README.md` in this directory for complete documentation.
Expand All @@ -27,7 +27,7 @@ See `README.md` in this directory for complete documentation.

Every change starts from a failing test. No exceptions.

### Bash 3.2+ Compatible
### Bash 3.0+ Compatible

Works on macOS default bash. **Prohibited features:**
- ❌ `declare -A` (associative arrays - Bash 4.0+)
Expand All @@ -52,7 +52,7 @@ shfmt -w . # Code formatting

```
bashunit/
├── src/ # Core framework code (Bash 3.2+ compatible)
├── src/ # Core framework code (Bash 3.0+ compatible)
│ ├── bashunit.sh # Main entry point
│ ├── assertions.sh # Assertion functions
│ ├── assert_*.sh # Specialized assertions
Expand Down Expand Up @@ -141,10 +141,10 @@ Comprehensive validation before releasing.

Specialized agents you can consult using the Task tool:

### Bash 3.2+ Expert
**When to use:** Reviewing code for Bash 3.2+ compatibility
### Bash 3.0+ Expert
**When to use:** Reviewing code for Bash 3.0+ compatibility
**Expertise:** Identifying incompatible features, suggesting portable alternatives
**Invoke:** Use Task tool with subagent_type="bash-3.2-expert"
**Invoke:** Use Task tool with subagent_type="bash-3.0-expert"

### Code Reviewer
**When to use:** Before committing, for comprehensive code review
Expand Down Expand Up @@ -185,7 +185,7 @@ Complete end-to-end workflow from issue to PR:

### Bash Style
@.claude/rules/bash-style.md
- Bash 3.2+ compatibility (critical!)
- Bash 3.0+ compatibility (critical!)
- ShellCheck compliance
- Function documentation
- Naming conventions
Expand All @@ -208,7 +208,7 @@ Complete end-to-end workflow from issue to PR:

### `src/**/*.sh`
- Small, portable functions
- Bash 3.2+ compatibility (no associative arrays, no `[[`, no `${var,,}`)
- Bash 3.0+ compatibility (no associative arrays, no `[[`, no `${var,,}`)
- Proper namespacing (`bashunit::*`)
- No external dependencies in core
- Function documentation required
Expand All @@ -235,7 +235,7 @@ Complete end-to-end workflow from issue to PR:

### Never:
- Invent commands/features not in the codebase
- Break Bash 3.2+ compatibility
- Break Bash 3.0+ compatibility
- Skip tests or quality checks
- Change public API without docs/CHANGELOG
- Use speculative/unproven patterns
Expand All @@ -249,7 +249,7 @@ Complete end-to-end workflow from issue to PR:
- Keep tests passing during REFACTOR
- Run quality checks before committing
- Update CHANGELOG.md for user-visible changes
- Maintain Bash 3.2+ compatibility
- Maintain Bash 3.0+ compatibility

## Definition of Done

Expand All @@ -258,7 +258,7 @@ Before marking work complete:
- ✅ `make sa` passes (ShellCheck)
- ✅ `make lint` passes (EditorConfig)
- ✅ Code formatted (`shfmt -w .`)
- ✅ Bash 3.2+ compatible
- ✅ Bash 3.0+ compatible
- ✅ Parallel tests passing (`./bashunit --parallel tests/`)
- ✅ CHANGELOG.md updated (if user-facing changes)
- ✅ Documentation updated (if needed)
Expand Down
6 changes: 3 additions & 3 deletions .claude/GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Welcome! This 5-minute guide will get you started with the custom Claude Code co
- `/gh-issue 42` - Complete GitHub issue → PR workflow

📚 **Code Standards** - Automatic enforcement:
- Bash 3.2+ compatibility
- Bash 3.0+ compatibility
- TDD methodology (RED → GREEN → REFACTOR)
- Testing patterns
- Quality checks
Expand Down Expand Up @@ -58,7 +58,7 @@ Claude automatically follows these rules (from `.claude/CLAUDE.md`):
- Minimal implementation
- Refactor while green

**Bash 3.2+ Compatible:**
**Bash 3.0+ Compatible:**
- No `declare -A` (associative arrays)
- No `[[ ]]` (use `[ ]`)
- No `${var,,}` (case conversion)
Expand Down Expand Up @@ -144,7 +144,7 @@ Study existing patterns:
## What Claude Automatically Enforces

✅ **TDD workflow** - Tests before code
✅ **Bash 3.2+ compatibility** - No modern bash features
✅ **Bash 3.0+ compatibility** - No modern bash features
✅ **Quality checks** - make sa && make lint
✅ **Test patterns** - Use existing patterns only
✅ **Commit format** - Conventional commits (no AI mentions!)
Expand Down
10 changes: 5 additions & 5 deletions .claude/QUICK_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
| File | Purpose |
|------|---------|
| `CLAUDE.md` | Main project instructions |
| `rules/bash-style.md` | Bash 3.2+ compatibility rules |
| `rules/bash-style.md` | Bash 3.0+ compatibility rules |
| `rules/testing.md` | Testing patterns & guidelines |
| `rules/tdd-workflow.md` | TDD methodology details |
| `AGENTS.md` | Comprehensive workflow guide |
Expand Down Expand Up @@ -100,7 +100,7 @@ Before marking work complete:

**Never:**
- Skip task file requirement
- Use Bash 4+ features (macOS = Bash 3.2)
- Use Bash 4+ features (macOS = Bash 3.0)
- Break public API without docs
- Commit without tests passing
- Skip quality checks
Expand All @@ -110,11 +110,11 @@ Before marking work complete:
- Use patterns from `tests/**` and `src/**`
- Update task file logbook
- Run tests after every change
- Bash 3.2+ compatible code
- Bash 3.0+ compatible code

## 🔍 Bash 3.2+ Compatibility
## 🔍 Bash 3.0+ Compatibility

| ❌ Don't Use (Bash 4+) | ✅ Use Instead (Bash 3.2+) |
| ❌ Don't Use (Bash 4+) | ✅ Use Instead (Bash 3.0+) |
|------------------------|----------------------------|
| `declare -A map` | Indexed arrays or workarounds |
| `[[ "$var" == "x" ]]` | `[ "$var" = "x" ]` |
Expand Down
12 changes: 6 additions & 6 deletions .claude/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This directory contains custom Claude Code configuration to enhance AI-assisted
.claude/
├── CLAUDE.md # Main project instructions (read this first!)
├── rules/ # Modular rules by topic
│ ├── bash-style.md # Bash 3.2+ compatibility & style
│ ├── bash-style.md # Bash 3.0+ compatibility & style
│ ├── testing.md # Testing patterns & guidelines
│ └── tdd-workflow.md # TDD Red-Green-Refactor cycle
├── skills/ # Custom reusable workflows
Expand Down Expand Up @@ -90,7 +90,7 @@ python .claude/agents/examples/pr-validator.py <pr-number>
### 2. Rules (Modular Guidelines)

#### `rules/bash-style.md`
- **Bash 3.2+ compatibility** (critical for macOS)
- **Bash 3.0+ compatibility** (critical for macOS)
- Coding standards
- ShellCheck compliance
- Documentation patterns
Expand Down Expand Up @@ -252,13 +252,13 @@ Workflow steps...
For specific domains, create custom agents:

```markdown
# .claude/agents/bash-3-expert/agent.md
# .claude/agents/bash-3.0-expert/agent.md

You are a Bash 3.2 compatibility expert for bashunit.
You are a Bash 3.0 compatibility expert for bashunit.

Your expertise:
- Identify Bash 4+ features
- Suggest Bash 3.2 alternatives
- Suggest Bash 3.0 alternatives
- Explain compatibility trade-offs

When consulted:
Expand Down Expand Up @@ -356,7 +356,7 @@ jobs:
/tdd-cycle

# Test rules are followed
# (Claude should enforce Bash 3.2+ compatibility)
# (Claude should enforce Bash 3.0+ compatibility)

# Test agents run
python .claude/agents/examples/tdd-bot.py --help
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Bash 3.2+ Compatibility Expert
# Bash 3.0+ Compatibility Expert

You are a Bash 3.2+ compatibility expert for the bashunit project.
You are a Bash 3.0+ compatibility expert for the bashunit project.

## Your Expertise

You specialize in:
- Bash 3.2+ compatibility (macOS default)
- Bash 3.0+ compatibility (macOS default)
- Identifying Bash 4.0+ features
- Providing Bash 3.2 alternatives
- Providing Bash 3.0 alternatives
- ShellCheck compliance
- Portable shell scripting

## When You're Consulted

Developers will ask you to:
- Review code for Bash 3.2+ compatibility
- Review code for Bash 3.0+ compatibility
- Identify incompatible features
- Suggest portable alternatives
- Explain why certain features don't work in Bash 3.2
- Explain why certain features don't work in Bash 3.0
- Fix compatibility issues

## Critical Knowledge
Expand All @@ -30,7 +30,7 @@ Developers will ask you to:
declare -A map
map["key"]="value"

# ✅ DO (Bash 3.2+)
# ✅ DO (Bash 3.0+)
# Use indexed arrays or alternative data structures
declare -a keys=("key1" "key2")
declare -a values=("val1" "val2")
Expand Down Expand Up @@ -110,7 +110,7 @@ When reviewing code:
- Explain why it's incompatible
- State which Bash version introduced it

3. **Provide Bash 3.2 alternative**
3. **Provide Bash 3.0 alternative**
- Show working alternative code
- Explain any trade-offs
- Ensure it's tested and verified
Expand Down Expand Up @@ -145,18 +145,18 @@ Found 3 Bash 4+ compatibility issues:

After fixes, run:
shellcheck -x file.sh
bash --version # Verify 3.2 compatibility
bash --version # Verify 3.0 compatibility
```

## Testing Compatibility

Suggest testing approaches:
```bash
# Test on macOS (usually Bash 3.2)
# Test on macOS (usually Bash 3.0)
bash --version

# Run with older bash if available
bash-3.2 script.sh
bash-3.0 script.sh

# Use shellcheck with appropriate shell directive
# shellcheck shell=bash
Expand All @@ -166,7 +166,7 @@ bash-3.2 script.sh

### Loops
```bash
# ✅ Bash 3.2 compatible
# ✅ Bash 3.0 compatible
for item in "${array[@]}"; do
echo "$item"
done
Expand All @@ -178,31 +178,31 @@ done < file

### String Manipulation
```bash
# ✅ Substring (works in 3.2)
# ✅ Substring (works in 3.0)
substring="${string:5:3}"

# ✅ Remove prefix/suffix (works in 3.2)
# ✅ Remove prefix/suffix (works in 3.0)
filename="${path##*/}"
extension="${filename##*.}"
```

### Arrays
```bash
# ✅ Array basics (works in 3.2)
# ✅ Array basics (works in 3.0)
declare -a array=("item1" "item2")
length="${#array[@]}"
last="${array[${#array[@]}-1]}"
```

## Resources

- Bash 3.2 was released in 2006 (macOS default)
- Bash 3.0 was released in 2004
- Major features added in Bash 4.0+ (2009) are not available
- Always test on macOS or with Bash 3.2
- Always test on macOS or with Bash 3.0

## Key Principles

1. **Assume Bash 3.2** - It's the lowest common denominator
1. **Assume Bash 3.0** - It's the lowest common denominator
2. **Test on macOS** - Most likely to catch issues
3. **Use ShellCheck** - It helps catch compatibility issues
4. **Prefer POSIX** - When possible, use POSIX-compatible constructs
Expand All @@ -221,4 +221,4 @@ If compatibility cannot be achieved:
fi
```

Your goal: Help maintain bashunit's Bash 3.2+ compatibility while writing clean, readable code.
Your goal: Help maintain bashunit's Bash 3.0+ compatibility while writing clean, readable code.
14 changes: 7 additions & 7 deletions .claude/agents/code-reviewer/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ You are a code reviewer for the bashunit project, specializing in validating cod
You review code for:
- Project standard compliance
- Code quality and readability
- Bash 3.2+ compatibility
- Bash 3.0+ compatibility
- Security issues
- Performance concerns
- Test coverage
Expand All @@ -24,7 +24,7 @@ You review code for:
- ✅ Variables quoted (`"$var"` not `$var`)
- ✅ Error handling (`set -euo pipefail` where appropriate)
- ✅ ShellCheck compliance
- ✅ Bash 3.2+ compatibility (no `[[`, `declare -A`, etc.)
- ✅ Bash 3.0+ compatibility (no `[[`, `declare -A`, etc.)

### 2. Testing Standards (@.claude/rules/testing.md)

Expand Down Expand Up @@ -90,7 +90,7 @@ Lines: +150 -0
**Bash Style:**
- Line 15: Missing function documentation
- Line 42: Variable not quoted: `$user_input`
- Line 58: Using `[[` instead of `[` (Bash 3.2 incompatible)
- Line 58: Using `[[` instead of `[` (Bash 3.0 incompatible)

**Testing:**
- Missing test for error case (when file not found)
Expand All @@ -115,7 +115,7 @@ result="$user_input"
# ❌ Line 58: Bash 4+ feature
if [[ "$var" == "value" ]]; then

# ✅ Fix: Use Bash 3.2 compatible syntax
# ✅ Fix: Use Bash 3.0 compatible syntax
if [ "$var" = "value" ]; then
```

Expand Down Expand Up @@ -174,7 +174,7 @@ Use this for each review:
- [ ] Functions documented
- [ ] Variables quoted
- [ ] ShellCheck clean
- [ ] Bash 3.2+ compatible
- [ ] Bash 3.0+ compatible

### Testing
- [ ] Test file names correct (_test.sh)
Expand Down Expand Up @@ -211,7 +211,7 @@ Use this for each review:

**Critical (Block Merge):**
- Security vulnerabilities
- Bash 3.2 incompatibility
- Bash 3.0 incompatibility
- Breaking changes without docs
- Failing tests

Expand Down Expand Up @@ -253,7 +253,7 @@ Complexity: Medium
2. **Compatibility: Bash 4+ Feature** (Line 78)
Using associative array (Bash 4.0+)

Fix: See @.claude/agents/bash-3.2-expert for alternatives
Fix: See @.claude/agents/bash-3.0-expert for alternatives

## Major Issues ⚠️

Expand Down
Loading
Loading