Environment
The Environment APIs are useful to get context about the setup in which your command runs. You can get information about the the extension and command itself as well as Raycast. Furthermore, a few paths are injected that are helpful to construct file paths that are related to the command's assets.

API Reference

environment

1
environment: Environment = ...
Copied!
Contains environment values such as the Raycast version, extension info, and paths.

Example

1
import { environment } from "@raycast/api";
2
3
console.log(`Raycast version: ${environment.raycastVersion}`);
4
console.log(`Extension name: ${environment.extensionName}`);
5
console.log(`Command name: ${environment.commandName}`);
6
console.log(`Assets path: ${environment.assetsPath}`);
7
console.log(`Support path: ${environment.supportPath}`);
8
console.log(`Is development mode: ${environment.isDevelopment}`);
Copied!

Environment

Holds data about the environment the command is running in. Use the global environment object to retrieve values.

Properties

Name
Type
Required
Description
assetsPath
string
Yes
The absolute path to the assets directory of the extension.
commandName
string
Yes
The name of the launched command, as specified in package.json
extensionName
string
Yes
The name of the extension, as specified in package.json
isDevelopment
boolean
Yes
Indicates whether the command is a development command (vs. an installed command from the Store).
raycastVersion
string
Yes
The version of the main Raycast app
supportPath
string
Yes
The absolute path for the support directory of an extension. Use it to read and write files related to your extension or command.
Last modified 1d ago