Plugins Overview
Learn how Redenv's plugin system works and how to extend the CLI with custom commands.
Redenv features an extensible plugin system that allows you to add custom commands to the CLI.
What are Plugins?#
Plugins are npm packages that extend the Redenv CLI with additional commands. They integrate seamlessly with the core CLI and have access to the same project configuration and Redis connection.
Official Plugins#
Studio Plugin#
The official visual dashboard for managing secrets.
Package: @redenv/studio
Installation:
npm install -D @redenv/studioConfiguration:
// redenv.config.ts
import { defineConfig } from "@redenv/core";
import { studioPlugin } from "@redenv/studio";
export default defineConfig({
name: "my-app",
plugins: [studioPlugin],
});Usage:
redenv studioFeatures:
- Visual secret management
- Environment switching
- Token management
- Version history viewer
- Runs locally (no data sent to external servers)
Creating Custom Plugins#
Plugins are TypeScript/JavaScript modules that export a RedenvPlugin object.
Plugin Structure#
import type { RedenvPlugin } from "@redenv/core";
export const myPlugin: RedenvPlugin = {
name: "my-plugin",
version: "1.0.0",
commands: [
{
name: "my-command",
description: "Custom command description",
action: async (args, options, context) => {
// Your command logic
console.log("Running custom command!");
},
},
],
};Plugin Context#
Each command receives a context object with:
| Property | Type | Description |
|---|---|---|
config | ProjectConfig | Current project configuration |
redis | Redis | Upstash Redis client instance |
cwd | string | Current working directory |
redisUrl | string | Redis REST URL |
redisToken | string | Redis authentication token |
getEphemeralToken() | Function | Generate temporary Service Token |
Command Arguments#
{
name: "deploy",
description: "Deploy secrets to environment",
args: [
{
name: "environment",
description: "Target environment",
required: true
}
],
flags: [
{
name: "force",
short: "f",
description: "Force deployment",
defaultValue: false
}
],
action: async (args, options, context) => {
const env = args.environment; // From args
const force = options.force; // From flags
// Your logic
}
}Using the Context#
action: async (args, options, context) => {
// Access Redis
const data = await context.redis.get("some-key");
// Access project config
console.log(`Project: ${context.config.name}`);
// Generate ephemeral token
const token = await context.getEphemeralToken();
console.log(`Token: ${token.tokenId}`);
};Publishing Plugins#
Package Structure#
my-redenv-plugin/
├── package.json
├── src/
│ └── index.ts
└── README.mdpackage.json#
{
"name": "@yourname/redenv-my-plugin",
"version": "1.0.0",
"keywords": ["redenv", "plugin"],
"peerDependencies": {
"@redenv/core": "^1.0.0"
}
}Publishing#
npm publishInstalling Third-Party Plugins#
npm install -D @yourname/redenv-my-plugin// redenv.config.ts
import { defineConfig } from "@redenv/core";
import { myPlugin } from "@yourname/redenv-my-plugin";
export default defineConfig({
name: "my-app",
plugins: [myPlugin],
});Next Steps#
- Studio Plugin - Official visual dashboard
- Core API - Understanding Redenv internals