Skip to content

Commit c0cd5a9

Browse files
committed
docs: update .agents.md with new functions and test count
1 parent a406801 commit c0cd5a9

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

.agents.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ wave-notes-setup/
2323
│ └── run_tests.sh # Local test runner
2424
└── .github/
2525
└── workflows/
26-
└── test.yml # CI workflow (shellcheck + bats)
26+
├── test.yml # CI workflow (shellcheck + bats)
27+
└── release-please.yml # Automated releases with release-please
2728
```
2829

2930
## Key Components
@@ -33,8 +34,10 @@ wave-notes-setup/
3334
- **Configuration Precedence**: defaults → ~/.wave-notes.conf → env vars
3435
- **Key Functions**:
3536
- `detect_waveterm_config()` - Finds Wave Terminal config path (supports v0.9+ and older)
37+
- `check_wave_installed()` - Blocks installation if Wave Terminal not found
38+
- `validate_widgets()` - Validates JSON with jq or python3 fallback
3639
- `install_scratchpad_script()` - Generates ~/bin/wave-scratch.sh
37-
- `install_widgets()` - Merges widgets into widgets.json (jq or Python fallback)
40+
- `install_widgets()` - Merges widgets into widgets.json with validation and rollback
3841
- `get_max_display_order()` - Preserves existing widget ordering
3942

4043
### 2. wave-scratch.sh (Generated)
@@ -124,7 +127,7 @@ This is a Wave Terminal limitation. Minimize with:
124127
## Development Workflow
125128

126129
```bash
127-
# Run automated tests (46 tests)
130+
# Run automated tests (54 tests)
128131
./test/run_tests.sh
129132

130133
# Or run bats directly
@@ -145,7 +148,7 @@ cat ~/.config/waveterm/widgets.json | jq .
145148

146149
## Test Coverage
147150

148-
The test suite includes **46 tests** covering:
151+
The test suite includes **54 tests** covering:
149152

150153
### Unit Tests (install.bats)
151154
- `detect_waveterm_config()` - Path detection for both v0.9+ and older
@@ -154,7 +157,9 @@ The test suite includes **46 tests** covering:
154157
- `get_existing_order()` - Preserve existing widget positions
155158
- `create_directories()` - Directory creation
156159
- `install_scratchpad_script()` - Script generation and content verification
157-
- `install_widgets()` - JSON merging, backup creation, no hardcoded colors
160+
- `install_widgets()` - JSON merging, backup creation, validation, rollback
161+
- `check_wave_installed()` - Wave Terminal detection (config dirs, wsh command)
162+
- `validate_widgets()` - JSON validation with jq/python3 fallback
158163

159164
### Unit Tests (uninstall.bats)
160165
- `remove_widgets()` - Selective removal of notes-* widgets
@@ -175,13 +180,13 @@ The test suite includes **46 tests** covering:
175180
| `detect_waveterm_config()` | Find Wave Terminal config directory | None |
176181
| `load_config()` | Load configuration (defaults → file → env) | None |
177182
| `check_macos()` | Verify running on macOS | None |
178-
| `check_wave_terminal()` | Verify Wave Terminal is installed | None |
179-
| `check_wsh()` | Check if wsh command is available | None |
183+
| `check_wave_installed()` | Block install if Wave Terminal not found | None |
184+
| `validate_widgets()` | Validate JSON with jq or python3 fallback | `$1`: widgets.json path |
180185
| `create_directories()` | Create notes and bin directories | None |
181186
| `install_scratchpad_script()` | Generate wave-scratch.sh | None |
182187
| `get_max_display_order()` | Find highest widget order | `$1`: widgets.json path |
183188
| `get_existing_order()` | Get widget's current order | `$1`: path, `$2`: key, `$3`: default |
184-
| `install_widgets()` | Merge widgets into widgets.json | None |
189+
| `install_widgets()` | Merge widgets with validation and rollback | None |
185190
| `run_uninstall()` | Execute uninstall procedure | None |
186191
| `parse_args()` | Parse CLI arguments | `$@`: arguments |
187192

@@ -224,8 +229,10 @@ The scripts use `set -euo pipefail`:
224229

225230
### Error Recovery
226231

227-
- **Backup before modify**: widgets.json is backed up before changes
232+
- **Backup before modify**: widgets.json is backed up with chmod 600 before changes
228233
- **Atomic writes**: Use temp file + mv for JSON writes
234+
- **JSON validation**: Validate widgets.json after generation (jq or python3 fallback)
235+
- **Rollback on failure**: Restore backup if validation fails; remove invalid file on fresh install
229236
- **Origin verification**: Only delete scripts with "Generated by" header
230237
- **User confirmation**: Destructive operations require explicit consent
231238

0 commit comments

Comments
 (0)