> For the complete documentation index, see [llms.txt](https://developers.raycast.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.raycast.com/information/developer-tools/cli.md).

# CLI

The Raycast CLI allows you to build, develop, and lint your extension.

The CLI is part of the `@raycast/api` package and is automatically installed in your extension directory during setup. To get a list of the available CLI commands, run the following command inside your extension directory:

```bash
 npx ray help
```

## Build

`npx ray build` creates an optimized production build of your extension for distribution. This command is used by our CI to publish your extension to the store.

You can use `npx ray build -e dist` to validate that your extension builds properly.

## Bundle

`npx ray bundle` creates a `.rayext` zip archive containing the optimized extension build. The archive contains `package.json` and all built files at its root and defaults to `<extension-name>.rayext` in the current directory. Use `--output` or `-o` to choose another path.

## Development

`npx ray develop` starts your extension in development mode. The mode includes the following:

* Extension shows up at the top of the root search for quick access
* Commands get automatically reloaded when you save your changes (you can toggle auto-reloading in Raycast Settings > Extensions > Developer > "Auto-reload on save").
* Error overlays include detailed stack traces for faster debugging
* Log messages are displayed in the terminal
* The command icon in the bottom-left shows when the extension is rebuilding or failed to build. Build errors include actions to open the source location in your editor or copy the diagnostic, while the last successful command keeps running.
* Imports the extension to Raycast if it wasn't before

## Lint

`npx ray lint` runs [ESLint](http://eslint.org) for all files in the `src` directory.

## Migrate

`npx ray migrate` [migrates](/misc/migration.md) your extension to the latest version of the `@raycast/api`.

## Publish

`npx ray publish` verifies, builds, and publishes an extension.

If the extension is private (eg. has an `owner` and no public `access`), it will be published to the organization's private store. This command is only available to users that are part of that organization. Learn more about it [here](/teams/getting-started.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.raycast.com/information/developer-tools/cli.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
