npm package: @orchestree/cli
Description: Command-line interface for the Orchestree Platform
Author: Orchestree
Latest version: 2.1.0

# Orchestree CLI

🚀 **Orchestree CLI** - The intelligent command-line interface for the Orchestree Platform

A production-quality CLI tool for managing your Orchestree workspace, modules, automations, and deployments. Full-featured terminal UI with colorful output, powerful workflows, and zero-dependency design.

## Features

- **Authentication** - Seamless login/logout with session management
- **Workspace Management** - Create and manage multiple workspaces
- **Module Management** - Enable, disable, and monitor 23+ Orchestree modules
- **Workflow Automation** - Create and execute Conductor workflows
- **Social Publishing** - Post to multiple platforms with analytics
- **Code Generation** - AI-powered code generation with Codenza
- **Brand Studio** - Create branded assets with Forge
- **Development Tools** - Scaffolding, testing, auditing, and deployment
- **Zero Dependencies** - Pure JavaScript, no heavy npm packages
- **Colorful Output** - Beautiful ANSI terminal colors and formatting
- **Fully Typed** - Complete TypeScript declarations included

## Installation

### Via NPM

```bash
npm install -g @orchestree/cli
```

### Via Yarn

```bash
yarn global add @orchestree/cli
```

### From Source

```bash
git clone https://github.com/orchestree/orchestree.git
cd packages/cli
npm install -g .
```

## Quick Start

```bash
# Login to your Orchestree account
orchestree auth login

# Check your authentication status
orchestree auth status

# List available modules
orchestree modules list

# View your workspaces
orchestree workspace list

# Create a new workspace
orchestree workspace create my-workspace

# Start the development server
orchestree dev serve
```

## Commands

### Authentication

```bash
orchestree auth login              # Log in to your Orchestree account
orchestree auth logout             # Log out from Orchestree
orchestree auth status             # Check authentication status
```

### Workspace Management

```bash
orchestree workspace list          # List all workspaces
orchestree workspace create <name> # Create a new workspace
orchestree workspace switch <name> # Switch to a workspace
```

### Module Management

Manage and monitor the 23 available Orchestree modules:

```bash
orchestree modules list            # List all available modules
orchestree modules enable <name>   # Enable a specific module
orchestree modules status          # Show status of all modules
orchestree modules health          # Check health of all modules
```

**Available Modules:**
- `social` - Social media publishing and management
- `conductor` - Workflow orchestration and automation
- `codenza` - AI-powered code generation and review
- `forge` - Brand studio for visual asset creation
- `enhance` - Module enhancement and optimization
- `analytics` - Advanced analytics and reporting
- `webhook` - Webhook management and integration
- `ai-assist` - AI assistance and guidance
- `integrations` - Third-party integrations
- `api` - API management and monitoring
- `templates` - Template library and customization
- `components` - Reusable component library
- `workflows` - Workflow management
- `scheduler` - Task scheduling
- `monitoring` - System monitoring and alerts
- `security` - Security features and compliance
- `performance` - Performance optimization
- `notifications` - Notification system
- `storage` - Data storage management
- `billing` - Billing and usage tracking
- `admin` - Administrative features
- `export` - Data export capabilities
- `import` - Data import capabilities

### Conductor Workflows

Manage automation workflows and processes:

```bash
orchestree conductor workflows      # List all automation workflows
orchestree conductor run <workflow> # Run a specific workflow
orchestree conductor logs           # View workflow execution logs
```

**Examples:**
```bash
orchestree conductor run daily-sync
orchestree conductor run lead-nurture
orchestree conductor logs
```

### Social Media Publishing

Publish and manage social media content:

```bash
orchestree social post "Your content here"     # Post to social media
orchestree social schedule                     # Schedule a post
orchestree social analytics                    # View social analytics
```

**Examples:**
```bash
orchestree social post "Check out our latest update!"
orchestree social schedule --date 2025-12-25 --time 09:00 --content "Holiday special!"
orchestree social analytics
```

### Code Generation (Codenza)

AI-powered code generation, review, and documentation:

```bash
orchestree codenza generate                    # Generate code
orchestree codenza review <file>               # Review code with AI
orchestree codenza docs                        # Generate documentation
```

**Examples:**
```bash
orchestree codenza generate --type component --name MyButton
orchestree codenza review src/main.js
orchestree codenza docs --input ./src
```

### Brand Studio (Forge)

Create branded assets and manage your brand kit:

```bash
orchestree forge create                        # Create branded assets
orchestree forge brand-kit                     # Manage brand kit
```

**Examples:**
```bash
orchestree forge create --type social-post --topic "Product Launch"
orchestree forge create --type banner --size 1200x630
orchestree forge brand-kit
```

### Module Enhancement

Enhance any Orchestree module with optimization and security hardening:

```bash
orchestree enhance <module>
```

**Examples:**
```bash
orchestree enhance social
orchestree enhance conductor
orchestree enhance codenza
orchestree enhance forge
```

All 23 modules can be enhanced:
```bash
orchestree enhance social
orchestree enhance conductor
orchestree enhance codenza
orchestree enhance forge
orchestree enhance analytics
orchestree enhance webhook
orchestree enhance ai-assist
orchestree enhance audit
orchestree enhance integrations
orchestree enhance api
orchestree enhance templates
orchestree enhance components
orchestree enhance workflows
orchestree enhance scheduler
orchestree enhance monitoring
orchestree enhance security
orchestree enhance performance
orchestree enhance notifications
orchestree enhance storage
orchestree enhance billing
orchestree enhance admin
orchestree enhance export
orchestree enhance import
```

### Code Scaffolding

Generate boilerplate code for new features:

```bash
orchestree scaffold api-endpoint <name>       # Scaffold API endpoint
orchestree scaffold new-module <name>         # Scaffold new module
```

**Examples:**
```bash
orchestree scaffold api-endpoint users-api
orchestree scaffold new-module reporting
```

### System Audit

Audit system health, code quality, and security:

```bash
orchestree audit                               # Full system audit
orchestree audit --type ui                     # UI quality audit
orchestree audit --type code                   # Code quality audit
orchestree audit --type security               # Security audit
orchestree audit --module social               # Audit specific module
```

**Examples:**
```bash
orchestree audit
orchestree audit --type code --module conductor
orchestree audit --type security
```

### Testing

Run the test suite:

```bash
orchestree test                                # Run all tests
```

### Development Commands

Manage local development and deployment:

```bash
orchestree dev serve                          # Start development server
orchestree dev deploy                         # Deploy to staging
orchestree dev logs                           # View server logs
```

**Examples:**
```bash
orchestree dev serve
# Server runs on http://localhost:3000

orchestree dev deploy
# Deploys to staging: https://staging.orchestree.ai/dashboard

orchestree dev logs
# Shows server logs and events
```

## Global Options

Use these flags with any command:

```bash
-h, --help          Display help menu
-v, --version       Show version number
--verbose           Enable verbose logging
--json              Output as JSON
```

**Examples:**
```bash
orchestree auth login --verbose
orchestree modules list --json
orchestree --help
orchestree --version
```

## Configuration

The CLI stores configuration in your home directory:

**macOS/Linux:** `~/.orchestree`
**Windows:** `%USERPROFILE%\.orchestree`

Configuration is stored as JSON:

```json
{
  "authenticated": true,
  "workspace": "default",
  "userId": "user_abc123xyz",
  "debug": false
}
```

## Examples

### Complete Workflow

```bash
# 1. Login
orchestree auth login

# 2. Create a new workspace
orchestree workspace create my-project

# 3. Switch to the workspace
orchestree workspace switch my-project

# 4. Enable modules
orchestree modules enable social
orchestree modules enable conductor

# 5. Check module health
orchestree modules health

# 6. Create an API endpoint scaffold
orchestree scaffold api-endpoint users

# 7. Start development server
orchestree dev serve

# 8. Create a workflow
orchestree conductor workflows

# 9. Deploy to staging
orchestree dev deploy
```

### Social Media Campaign

```bash
# Generate content with AI
orchestree codenza generate --type "social-post" --topic "Product Launch"

# Create branded assets
orchestree forge create --type "social-post"

# Schedule posts
orchestree social schedule --date 2025-12-25 --time 09:00 --content "Merry Christmas!"

# Monitor analytics
orchestree social analytics
```

### Code Development

```bash
# Scaffold new feature
orchestree scaffold api-endpoint orders

# Generate code with AI
orchestree codenza generate --type component

# Review code
orchestree codenza review src/components/Button.js

# Run tests
orchestree test

# Start dev server
orchestree dev serve

# Deploy when ready
orchestree dev deploy
```

## Troubleshooting

### "Command not found"

Make sure the CLI is installed globally:

```bash
npm install -g @orchestree/cli
```

Check the installation:

```bash
orchestree --version
```

### "Not authenticated"

Log in first:

```bash
orchestree auth login
```

Check status:

```bash
orchestree auth status
```

### "Module not found"

List available modules:

```bash
orchestree modules list
```

Enable the module:

```bash
orchestree modules enable module-name
```

### Enable Debug Mode

For detailed error messages:

```bash
orchestree command --verbose
```

## Development

### Building from Source

```bash
git clone https://github.com/orchestree/orchestree.git
cd packages/cli
npm install
npm link
```

### Running in Development

```bash
node bin/orchestree.js --help
```

### Testing

```bash
npm test
```

## API Usage

Use the CLI programmatically in your Node.js code:

```javascript
const OrchestreeCLI = require('@orchestree/cli');

const cli = new OrchestreeCLI();

// Access configuration
console.log(cli.config);

// Log messages
cli.success('Operation completed');
cli.error('Something went wrong');

// Run commands
await cli.run(['auth', 'login']);
```

## TypeScript Support

Full TypeScript definitions are included:

```typescript
import OrchestreeCLI, { CommandContext } from '@orchestree/cli';

const cli = new OrchestreeCLI();

// Types are fully supported
const parsed = cli.parseArgs(['auth', 'login']);
console.log(parsed.command); // 'auth'
```

## License

MIT - See LICENSE file for details

## Support

- 📚 [Documentation](https://orchestree.ai/docs)
- 🐛 [Report Issues](https://github.com/orchestree/orchestree/issues)
- 💬 [Community Chat](https://discord.gg/orchestree)
- 📧 [Email Support](mailto:support@orchestree.ai)

## Contributing

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

---

Made with ❤️ by the Orchestree Team