Skip to content

Search and transform files

Execute commands through POST /v1/disks/DISK/exec?kind=bash. Paths and search roots refer to the selected disk. The shell reference defines supported syntax.

Search a directory
curl --fail-with-body --no-buffer \
"https://api.wabe.sh/v1/disks/demo/exec?kind=bash" \
-H "Authorization: Bearer YOUR_PROJECT_API_KEY" \
--data-binary "rg -n -F 'TODO' /notes"

rg searches recursively. Use -F for literal text and quote patterns passed to commands.

Command examples inside wabe Disk
rg -n -g '*.md' 'TODO|FIXME' /notes
find /notes -maxdepth 2 -type f -name '*.txt'
cat /notes/tasks.txt | grep -i 'open' | head -n 20
printf 'beta\nalpha\nalpha\n' | sort -u

These command snippets are the source sent to exec. They run after the requested files have been created.

Put the command in the query parameter to make the request body its stdin. This request searches a local file without storing it first:

Stream a local file into a remote command
curl --fail-with-body --no-buffer \
"https://api.wabe.sh/v1/disks/demo/exec?kind=bash&script=grep%20-n%20TODO" \
-H "Authorization: Bearer YOUR_PROJECT_API_KEY" \
--data-binary @./notes.txt

For rg, use rg PATTERN - when reading the outer request body. A pipe or input redirect inside a wabe Disk shell script selects stdin automatically.

Write a derived file
curl --fail-with-body --no-buffer \
"https://api.wabe.sh/v1/disks/demo/exec?kind=bash" \
-H "Authorization: Bearer YOUR_PROJECT_API_KEY" \
--data-binary 'cat /notes/tasks.txt | sort -u > /notes/sorted.txt'

Use a different destination for a streaming transform. For replacement in place, use supported sed -i or sort -o, which complete the transform before publishing the replacement.

rg uses Rust regex syntax. It reads .ignore and .rgignore, and reads .gitignore when the search directory has a .git entry. Ignore files above an explicitly selected search root are not loaded. --hidden, --no-ignore, -a and quoted -g patterns adjust traversal and matching.

Text commands have a default 1 MiB line limit. Sort and selected operations use temporary storage. See command behavior and flags and limits.