A powerful, type-safe CLI framework for Deno featuring comprehensive command management, workflow automation, and plugin architecture.
Stega is a modern CLI framework built for Deno that enables developers to create sophisticated command-line applications with features like workflow automation, template generation, and service management. It combines type safety with powerful abstractions to streamline CLI development.
- Type-Safe Command System: Declarative command definitions with TypeScript support
- Advanced Workflow Automation: Define and execute complex task sequences
- Template Engine: Generate code and content using customizable templates
- Service Management: Control and monitor long-running services
- HTTP Client: Make HTTP requests directly from the command line
- Plugin Architecture: Extend functionality through a modular plugin system
- Internationalization: Built-in i18n support for multiple languages
- Configuration Management: Flexible configuration through files and environment variables
# Install from deno.land/x
deno install --allow-all -n stega https://deno.land/x/stega/mod.ts
# Or clone and install locally
git clone https://github.com/layerdynamics/stega.git
cd stega
deno install --allow-all -n stega mod.ts
- Create a new CLI application:
// main.ts
import { CLI, Command } from "https://deno.land/x/stega/mod.ts";
const cli = new CLI();
// Define a command
const greetCommand: Command = {
name: "greet",
description: "Greet a user",
options: [
{
name: "name",
alias: "n",
type: "string",
required: true,
description: "Name to greet"
},
{
name: "excited",
alias: "e",
type: "boolean",
default: false,
description: "Add excitement"
}
],
action: (args) => {
const name = args.flags.name;
const excited = args.flags.excited;
console.log(`Hello, ${name}${excited ? "!" : "."}`);
}
};
// Register and run
cli.register(greetCommand);
await cli.run();
- Run your CLI:
deno run --allow-all main.ts greet --name="World" --excited
Define commands with rich metadata and validation:
const command: Command = {
name: "deploy",
description: "Deploy the application",
category: "operations",
options: [
{
name: "environment",
type: "string",
required: true,
description: "Target environment"
}
],
action: async (args) => {
// Command implementation
}
};
Create complex automation workflows:
{
"name": "deploy-pipeline",
"steps": [
{
"name": "build",
"command": "build --target=production"
},
{
"name": "test",
"command": "test --coverage",
"parallel": true
},
{
"name": "deploy",
"command": "deploy --env=prod",
"condition": "process.env.BRANCH === 'main'"
}
]
}
Generate code and content using templates:
await cli.runCommand([
"template",
"generate",
"--template=component",
"--output=src/components/Button.tsx",
"--variables",
JSON.stringify({
name: "Button",
props: ["label", "onClick"]
})
]);
Control and monitor services:
# Start a service
stega service start --name=api --config=services/api.json
# Monitor service status
stega service status --name=api --format=json
# View service logs
stega service logs --name=api --follow
Make HTTP requests:
stega http --method=POST \
--url=https://api.example.com/data \
--data='{"key": "value"}' \
--headers="Content-Type:application/json"
Extend functionality through plugins:
const plugin: Plugin = {
metadata: {
name: "custom-plugin",
version: "1.0.0"
},
init: (cli) => {
cli.register({
name: "custom-command",
action: () => {
console.log("Custom command executed");
}
});
}
};
export default plugin;
Create a stega.config.json
for project-wide settings:
{
"plugins": [
"stega-plugin-typescript",
"stega-plugin-docker"
],
"commands": {
"build": {
"target": "es2020",
"outDir": "dist"
}
},
"i18n": {
"defaultLocale": "en",
"locales": ["en", "es", "fr"]
}
}
# Clone repository
git clone https://github.com/layerdynamics/stega.git
cd stega
# Install dependencies
deno cache mod.ts
# Run tests
deno task test
# Build
deno task build
# Format code
deno task fmt
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Special thanks to all our contributors and the Deno community.