Skip to content

Overview

The GenAIScript CLI genaiscript runs GenAIScript scripts outside of Visual Studio.

Terminal window
npx --yes genaiscript ...

where --yes skips the confirmation prompt to install the package.

Installation

The CLI is a Node.JS package hosted on npm.

  1. Install Node.JS LTS (Node.JS includes npm and npx).

  2. Install locally as a devDependency in your project.

    Terminal window
    npm install -D genaiscript

    or install it globally.

    Terminal window
    npm install -g genaiscript

No Installation (npx)

Make sure to install Node.JS as described in step 1 above.

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.

Terminal window
npx genaiscript ...

Add --yes to skip the confirmation prompt, which is useful in a CI scenario.

Terminal window
npx --yes genaiscript ...

You can also lock this call to a particular version.

Terminal window
npx --yes genaiscript@^1.16.0 ...

Create a new script

Creates a new script file in the genaisrc folder.

Terminal window
npx genaiscript scripts create <name>

Compile scripts

Runs the TypeScript compiler to find errors in the scripts.

Terminal window
npx genaiscript scripts compile

Run a script

Runs a genai script on file and streams the LLM output to stdout.

Terminal window
npx genaiscript run <script> [files...]

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.

Secrets

The CLI will load the secrets from the environment variables or a ./.env file. You can also specify a different .env file using the --env option.