Queries and unix pipes
Compose clai with standard input, placeholder substitution, raw output, and cron scripts.
clai query (shorthand q) is designed for unix pipelines: it accepts stdin, substitutes placeholders, and writes streamed responses to stdout.
Piping stdin
When you pipe data into clai q, stdin is prepended to your prompt by default:
cat build.log | clai q "Which compiler error caused the build to fail?"
Replacing placeholders with -i and -I
Use -i to replace every occurrence of {} in your prompt with stdin:
git diff --staged | clai -i q "Write a conventional commit message for: {}"
If your prompt already contains {}, specify a custom replacement token with -I (-replace):
cat schema.sql | clai -I "SCHEMA" q "Generate Go structs for SCHEMA"
Raw output for scripts and cron
By default, terminal output is formatted for readability. When piping clai into another program, file, or CI job, pass -r (-raw) to emit raw unformatted text:
clai -r q "Output only a valid JSON array of three HTTP status codes" | jq .
See CLI for all query flags.