Overview
The GenAIScript CLI genaiscript
runs GenAIScript scripts
outside of Visual Studio and in your automation.
where --yes
skips the confirmation prompt to install the package.
Prerequisites
The CLI is a Node.JS package hosted on npm.
- Install Node.JS LTS (Node.JS includes npm and npx).
Installation
- Install locally as a
devDependency
in your project.
- Install it globally.
- Check that your node version is at least 20._ and npm 10._ by running this command.
No Installation (npx
)
npx
is installed with Node.JS.
Using npx, you can run the cli without any prior installation steps. npx will install the tool on demand. npx also takes care of tricky operating system issues where the tool is not found in the path.
- Add
--yes
to skip the confirmation prompt, which is useful in a CI scenario.
- Specify the version range to avoid unexpected behavior with cached installations of the CLI using npx.
Configuration
The CLI will load the secrets from the environment variables or a ./.env
file.
You can override the default .env
file name by adding the --env myother.env
file.
Create a new script
Creates a new script file in the genaisrc
folder.
Compile scripts
Runs the TypeScript compiler to find errors in the scripts.
Run a script
Run a script on file and streams the LLM output to stdout. Run from the workspace root.
where <script>
is the id or file path of the tool to run, and [files...]
is the name of the spec file to run it on.
Listing model configuration
Run the script model
command to list the available scripts and their model configuration. This can be useful to diagnose configuration issues in CI/CD environments.
where [script] can be a script id or a file path.