# Grayspar for agents

A coding agent such as Claude Code, Codex or Cursor can deploy and share your app through the Grayspar CLI. You approve the login in your browser, and the agent runs the commands.

## Set up your agent

Paste this prompt into your agent:

```text
Read https://grayspar.com/SKILL.md and follow it to deploy this app on Grayspar.
```

The agent reads the instructions and asks before it installs the CLI. It then asks you to run `grayspar login`, because logging in opens your browser. Before the first command that changes anything, the agent shows you the command and waits for your approval.

## Install the skill

The prompt above lasts for one session. To give your agent the same instructions in every session, install the Grayspar skill in your project:

```sh
npx skills add grayspar/skills
```

In Claude Code, you can install the skill as a plugin instead:

```text
/plugin marketplace add grayspar/skills
/plugin install grayspar@grayspar
```

Then describe what you want in your own words, for example: "Deploy this app and share it with alice@example.com."

## How agents use the CLI

The CLI never waits for an answer that can't come. When no terminal is attached, a question the CLI would ask becomes a refusal that names the flag answering it. The agent reads the refusal, adds the flag and runs the command again.

Add `--json` to any command to get its result as data. A refusal looks like this:

```json
{
  "status": "error",
  "error": "needs_an_answer",
  "message": "2 variables in .env files are new to <project-name>, and there is no terminal to ask whether to send them.\nSend them with --yes, or deploy without .env files with --no-env.",
  "supply_with": "--yes"
}
```

The command also exits with code 1, so a script can tell a refusal from a success. [Global flags](/docs/cli/global-flags/) lists what `--json` prints for each kind of command.

## What happens in the dashboard

Two tasks have no CLI command: rolling back to an earlier deployment, and answering a request to open a project. Your agent can tell you when one of them is needed, and you finish it in the [dashboard](https://app.grayspar.com).

## Keep your app's files

An agent often decides where an app writes its files, and only a [volume](/docs/deploy/volumes/) keeps files across deploys. The skill checks whether your app keeps data, and the agent names the folder on the deploy itself:

```sh
grayspar deploy --yes --volume app=/app/data
```