Thank you for your interest in contributing to wave-notes-setup!
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/wave-notes-setup.git cd wave-notes-setup - Install development dependencies:
brew install bats-core shellcheck
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes following the code style guidelines below
-
Run the test suite:
./test/run_tests.sh
-
Run shellcheck:
shellcheck install.sh uninstall.sh
-
Test manually:
./install.sh -v # Verify widgets appear in Wave Terminal ./install.sh --uninstall
- Always use
set -euo pipefailat the top of scripts - Use
localfor function variables - Quote all variable expansions:
"$var"not$var - Use
[[ ]]for conditionals, not[ ] - Use meaningful function and variable names
- Add comments for non-obvious logic
- Never hardcode user-specific paths - use
$HOME,$NOTES_DIR,$BIN_DIR - Never add
colorproperty - widgets must follow Wave Terminal theme - Always include
cmd:closeonexit: trueandcmd:closeonexitdelay: 0for term widgets - Use
view: "preview"for file/directory browsing, notview: "term"with commands
- Always use security functions for file operations:
check_not_symlink()- Call before writing to any filevalidate_safe_path()- Call for user-configurable pathssafe_rmdir()- Call instead of directrm -rf
- Never embed paths in Python code - pass via
sys.argvor stdin - Never use
xargsfor whitespace trimming - use bash parameter expansion
- Write tests for new functionality
- Follow existing test patterns in
test/*.bats - Use descriptive test names:
@test "function_name: describes what is tested" - Use the Arrange-Act-Assert pattern
Tests are organized by file:
test/test_helper.bash- Shared utilities, mocks, and assertionstest/install.bats- Tests for install.sh functionstest/uninstall.bats- Tests for uninstall.sh functions
@test "function_name: describes the scenario being tested" {
# Arrange - set up test conditions
SOME_VAR="value"
# Act - call the function
run function_name "$arg1" "$arg2"
# Assert - verify results
[ "$status" -eq 0 ]
[ "$output" = "expected output" ]
}- Ensure all tests pass - PRs with failing tests will not be merged
- Ensure shellcheck passes - No warnings or errors
- Update documentation if your changes affect user-facing behavior
- Add tests for new functionality
- Keep commits focused - One logical change per commit
- Write clear commit messages - Explain what and why
type: short description
Longer explanation if needed. Explain the problem being solved
and why this approach was chosen.
Fixes #123
Types: feat, fix, docs, test, refactor, chore
Configuration is resolved in order of precedence (lowest to highest):
-
Defaults - Hardcoded in
install.shNOTES_DIR="$HOME/Documents/WaveNotes"BIN_DIR="$HOME/bin"
-
Config File -
~/.wave-notes.confNOTES_DIR="$HOME/Dropbox/Notes" BIN_DIR="$HOME/.local/bin"
-
Environment Variables - Override everything
WAVE_NOTES_DIR="$HOME/iCloud/Notes" WAVE_BIN_DIR="/usr/local/bin"
The installer supports both old and new Wave Terminal config paths:
- v0.9+:
~/.config/waveterm/ - < v0.9:
~/.waveterm/config/
Detection is handled by detect_waveterm_config().
Widget configuration uses JSON. The installer supports two backends:
- jq (preferred) - Fast, installed on many systems
- Python (fallback) - Available on all macOS systems
Both are tested to ensure consistent behavior.
| Widget | View Type | Purpose |
|---|---|---|
| note | term |
Runs script to create note |
The term view requires special handling:
cmd:closeonexit: true- Close terminal on successcmd:closeonexitdelay: 0- No delay before closing
The wave-scratch.sh script includes a find_wsh() function that searches:
$PATH$HOME/Library/Application Support/waveterm/bin/wsh/usr/local/bin/wsh/opt/homebrew/bin/wsh
If adding new search paths, add them to this function.
This occurs when using an invalid view type. For directory browsing, use:
{
"view": "preview",
"file": "/path/to/directory"
}Not:
{
"view": "term",
"cmd": "wsh view /path/to/directory"
}This is a Wave Terminal limitation when using view: "term". Minimize with:
cmd:closeonexit: truecmd:closeonexitdelay: 0
Open an issue at github.com/qbandev/wave-notes-setup/issues