Skip to content

About

Check Strudel files and query pattern events from a headless CLI

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

strudel-cli

Check a Strudel file and inspect its pattern events without a browser or audio device.

Website: tudorandrei.github.io/strudel-cli. Agent guide: agent-guide.md. Machine-readable command schema: command-schema.json.

Install

Requires Node.js 20 or later.

npm install
npm link

npm install builds the command. You can also run it with node bin/strudel.mjs without linking it.

To install the standalone command with mise on macOS ARM64 or Linux x64:

mise use -g github:TudorAndrei/[email protected]
strudel --help

For one project, omit -g. Choose a newer version from releases when one is available. The GitHub release has one archive for each supported system.

Commands

strudel check song.strudel
strudel check song.strudel --json
strudel query song.strudel --from 0 --to 4
strudel query song.strudel --limit 16
strudel describe

check evaluates the file and queries the pattern over one cycle by default. It exits with code 0 if that succeeds and code 1 if it fails. query writes one JSON object to standard output. Both commands accept --from and --to with nonnegative cycle numbers. The end must be greater than the start. --limit cuts the JSON event list and reports the full eventCount with truncated. Use --limit 0 to get only the count. check --json also writes JSON. Errors in JSON mode have valid: false and an error message. describe returns the command schema as JSON without reading a file.

For a file containing s("bd hh"), query returns:

{"valid":true,"range":[0,1],"eventCount":2,"events":[{"begin":"0","end":"1/2","value":{"s":"bd"}},{"begin":"1/2","end":"1","value":{"s":"hh"}}],"truncated":false}

The file must return a Strudel pattern. The command includes functions from @strudel/core, @strudel/mini, and @strudel/tonal. It uses the Strudel transpiler, so double quoted strings use mini notation. The command runs the file as JavaScript. Run files that you trust.

The CLI checks the selected cycle range. A pattern can fail in a later range even if check succeeds for the default range. The command does not check audio samples or produce sound.

Development

npm test

Standalone executable

Install Bun, then run:

npm run build:binary
dist/strudel check song.strudel
npm run test:binary

The build writes dist/strudel for the current operating system and CPU. It includes the Bun runtime and Strudel packages, so the executable does not need Node.js, Bun, or node_modules when you run it. To build for another system, use Bun's --target option as shown in the Bun executable guide.

npm run build:release makes the macOS ARM64 and Linux x64 archives for a GitHub release. A v* tag runs the release workflow.

npm run build:site builds the static GitHub Pages site and checks its AgentMarkup output.

About

Check Strudel files and query pattern events from a headless CLI

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages