dev-loop
Dev Loop Workflow
Run the app via ./dev.sh in the background, monitor its logs, make code changes, and verify the expected behavior appears in the output. cargo-watch auto-rebuilds on file changes, so you just edit and check logs.
Quick Start
1. Spawn ./dev.sh in background using Bash tool (run_in_background: true)
2. Wait ~10s for initial build + app startup
3. Read the log output (tail the task output)
4. Make code changes
5. cargo-watch auto-rebuilds — wait ~15s, then check logs again
6. Repeat until expected output appears
7. Stop the background task when done
Step 1: Launch dev.sh
Use the Bash tool with run_in_background: true:
cd /Users/johnlindquist/dev/script-kit-gpui && ./dev.sh
This starts cargo-watch which auto-rebuilds on any src/ file change. Save the task_id from the result.
Step 2: Check Logs
Use TaskOutput with block: false to read current output without waiting:
TaskOutput(task_id=<id>, block=false, timeout=5000)
Or use Bash to tail the session log file:
tail -50 ~/.scriptkit/logs/latest-session.jsonl
The app uses compact AI log format by default (SS.mmm|L|C|message):
SS.mmm= seconds.milliseconds since startL= level (i=info, d=debug, w=warn, e=error)C= component (EXEC, KEY, FOCUS, RENDER, etc.)
Step 3: Edit Code and Wait for Rebuild
After editing files in src/, cargo-watch detects the change and rebuilds automatically. Wait ~15 seconds for:
- File change detection (~1s)
- Incremental compile (~10-14s)
- App restart (~1-2s)
Then check logs again via TaskOutput or tail.
Step 4: Verify Expected Behavior
Look for specific log patterns that confirm the change worked. Examples:
| What you're verifying | Log pattern to look for |
|---|---|
| Webcam opens | EXEC.*Opening Webcam |
| Camera started | EXEC.*start_capture or camera frames flowing |
| Key handled | KEY.*<keyname> |
| View changed | RENDER.*current_view |
| Error occurred | e| (error level) or ERROR |
| Script executed | EXEC.*Running script |
Step 5: Interact with the Running App
Send stdin JSON commands to the app via its session log or interact directly. Common commands:
# Show the window (it starts hidden)
echo '{"type":"show"}' | socat - UNIX-CONNECT:/tmp/scriptkit.sock
# Or use the log to confirm manual interaction
# (click the app, press keys, watch logs)
Step 6: Stop When Done
Use TaskStop with the task_id to kill the background dev.sh process.
Iteration Patterns
"I changed X, did it work?"
- Make the edit
- Wait 15s for rebuild
TaskOutput(block=false)— scan for rebuild success (Compiling...→Finished)- Check for your specific log output
- If not present, check for compile errors in the output
"The app crashes on startup"
TaskOutput(block=false)— look for panic/error in output- Fix the code
- cargo-watch auto-rebuilds
- Check output again
"I need to test a specific interaction"
- Make sure app is running (check TaskOutput for
Finished+ startup logs) - Manually interact with the app window (or send stdin commands)
- Check logs for the expected behavior
Log File Locations
| File | Contents |
|---|---|
| Task output | cargo-watch build output + app stdout/stderr |
~/.scriptkit/logs/latest-session.jsonl |
Structured session logs |
/tmp/sk-test-stdout.log |
Test script output (if using visual-test) |
Gotchas
- First build takes ~60s. Incremental rebuilds are ~10-15s.
- cargo-watch needs to be installed.
cargo install cargo-watchif missing. - App starts hidden. You need to trigger it via global hotkey or stdin commands.
- Don't edit test files — cargo-watch ignores them, so changes won't trigger rebuild.
- Multiple dev.sh instances conflict. Stop the old one before starting a new one.
- Check compile errors first. If TaskOutput shows
error[E...], fix the code before checking behavior.