| Crates.io | aider-script |
| lib.rs | aider-script |
| version | 0.1.5 |
| created_at | 2025-03-10 22:00:10.566271+00 |
| updated_at | 2025-04-03 13:06:59.656605+00 |
| description | A CLI wrapper around aider to make calling reusable prompts convenient |
| homepage | https://github.com/sgrowe/aider-script#readme |
| repository | https://github.com/sgrowe/aider-script |
| max_upload_size | |
| id | 1587259 |
| size | 58,329 |
aider-script is a CLI tool that streamlines using aider for common tasks, by allowing you to use reusable prompts templates which support being passed arguments when run.
For example you might have a template which adds an API route to your backend server, and it could take the URL pattern as an argument. You might have another template to add unit tests for a React component given the component name, and another which generates mock data for a third-party API call given the object schema name.
Table of Contents
Make sure you've installed and set up aider first.
Install using Cargo:
cargo install aider-script
aider-script <template-file> [template-arguments...]
Each prompt template is a markdown document with a frontmatter section (in YAML) which configures:
args: the names of any arguments to be passed into the templateread: files to be added to the LLM’s context as read-onlyedit: files to be edited by aiderAll of the config options are optional.
---
args:
- QUERY_NAME # Arguments to be interpolated into the template below
read:
- "src/schema.graphql" # Files to read into the LLM context
edit:
- "src/fixtures/mocks.ts" # Files to be edited by aider
---
# Generate mock data for {{ QUERY_NAME }}
Create a new file called `src/mocks/{{ QUERY_NAME | kebab }}.ts`. Add a new mock response object that matches the type definition for {{ QUERY_NAME }}.
# Basic usage
aider-script example.md myFunctionName
Arguments should be passed to the CLI
The --preview-message lets you see the message that will be passed to aider without actually running it (handy for double checking you’ve got the template right).
# Preview without running
$ aider-script --preview-message example.md ListMyFavouritesQuery
Generated message:
------------------
# Generate mock data for ListMyFavouritesQuery
...
Templates use tera templating syntax (see the example above). You can use variables from template arguments in your markdown.
aider-script provides several case conversion filters to transform strings:
| Filter | Example output |
|---|---|
camel |
fooBarBaz |
pascal |
FooBarBaz |
kebab |
foo-bar-baz |
snake |
foo_bar_baz |
Example usage:
Create a file called `{{ name | kebab }}.tsx` that exports a component called `{{ name | pascal }}`.
Tera also provides several built-in casing filters:
upper: Converts a string to UPPERCASElower: Converts a string to lowercasetitle: Capitalizes each word inside a sentencecapitalize: Returns the string with all its characters lowercased apart from the first char which is uppercasedSee the Tera documentation for more details.
The template's frontmatter can specify:
args: Required template argumentsread: Files to be passed as read-only to aideredit: Files to be edited by aiderThese are all optional.