Skip to content

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.

License

Notifications You must be signed in to change notification settings

LayerDynamics/stega

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stega: Advanced CLI Framework for Deno

A powerful, type-safe CLI framework for Deno featuring comprehensive command management, workflow automation, and plugin architecture.

CI Status Documentation License: MIT

Overview

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.

Key Features

  • 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

Installation

# 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

Quick Start

  1. 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();
  1. Run your CLI:
deno run --allow-all main.ts greet --name="World" --excited

Core Features

Command Management

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
    }
};

Workflow Automation

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'"
        }
    ]
}

Template Generation

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"]
    })
]);

Service Management

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

HTTP Client

Make HTTP requests:

stega http --method=POST \
           --url=https://api.example.com/data \
           --data='{"key": "value"}' \
           --headers="Content-Type:application/json"

Plugin System

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;

Configuration

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"]
    }
}

Development

# 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

Documentation

Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Acknowledgments

Special thanks to all our contributors and the Deno community.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published