Documentation/Basic Usage

Basic Usage

Learn how to use MODL commands and interact with servers in your terminal.

Getting Started with MODL

Once you have installed MODL, you can start using it to enhance your AI terminal experience. This guide will walk you through the basic commands and usage patterns.

Before You Begin

Make sure you have MODL installed and running. You can verify this by running:

# Check MODL version
modl --version

# Should output something like:
# MODL Client v2.5.0

Core MODL Commands

MODL provides a set of core commands that you'll use frequently. Let's explore them.

Getting Help

You can get help on any MODL command by using the --help flag:

# Get general help
modl --help

# Get help on a specific command
modl install --help

Listing Available Servers

To see what servers are available for installation:

# List all available servers
modl list

# List servers by category
modl list --category=development
modl list --category=data-analysis
modl list --category=web

# Search for servers
modl list --search="code generation"

The output will show server names, versions, descriptions, and popularity metrics.

Viewing Server Details

To get detailed information about a specific server:

# View details of a server
modl info code-assistant

# This will show:
# - Full description
# - Author information
# - Required permissions
# - Dependencies
# - Usage examples
# - And more

Working with Servers

MODL's power comes from its servers. Here's how to install and use them.

Installing Servers

To install a server:

# Install a server
modl install code-assistant

# Install a specific version
modl install code-assistant@2.1.3

# Install multiple servers
modl install code-assistant data-processor web-crawler

# Install with specific options
modl install code-assistant --no-cache --verbose

Running Servers Directly

You can run a server directly from the command line:

# Run a server with a prompt
modl run code-assistant "Generate a React component for a login form"

# Run with additional options
modl run code-assistant --language=typescript "Generate a login form"

# Pipe input to a server
echo "Analyze this code" | modl run code-assistant

# Chain multiple servers
echo "Generate a login form" | modl run code-assistant | modl run security-audit

Using Servers in the Cognitive Architecture Terminal

MODL integrates with the Cognitive Architecture terminal for a more interactive experience:

# In the Cognitive Architecture terminal:

# Load a server
$ use code-assistant

# Now you can use the server's commands directly
$ generate-component "Login form with validation"

# Chain multiple servers
$ use code-assistant | use security-audit
$ generate-component "Login form" | audit-code

Server-Specific Commands

Each MODL server provides its own set of commands. Here are examples for some popular servers.

code-assistant

The code-assistant server helps with code generation, analysis, and refactoring.

# Generate code
modl run code-assistant generate "Create a React component that displays a list of items"

# Analyze existing code
modl run code-assistant analyze --file=./src/component.js

# Refactor code
modl run code-assistant refactor --file=./src/component.js --goal="Improve performance"

# Explain code
modl run code-assistant explain --file=./src/component.js

data-processor

The data-processor server helps with data analysis, transformation, and visualization.

# Analyze data
modl run data-processor analyze --file=./data.csv

# Transform data
modl run data-processor transform --file=./data.csv --output=./transformed.csv --format=json

# Generate visualizations
modl run data-processor visualize --file=./data.csv --type=bar-chart --output=./chart.png

web-crawler

The web-crawler server helps with web scraping and content extraction.

# Scrape a website
modl run web-crawler scrape --url=https://example.com

# Extract specific content
modl run web-crawler extract --url=https://example.com --selector=".article-content"

# Monitor a website for changes
modl run web-crawler monitor --url=https://example.com --interval=1h

Working with Files

MODL servers can work with files on your system. Here's how to use them.

Reading Files

Many MODL commands accept file inputs:

# Analyze a code file
modl run code-assistant analyze --file=./src/component.js

# Process a data file
modl run data-processor analyze --file=./data.csv

# You can also use stdin
cat ./src/component.js | modl run code-assistant analyze

Writing Files

MODL can also write output to files:

# Generate code and save to a file
modl run code-assistant generate "Create a React component" --output=./src/component.js

# Process data and save the result
modl run data-processor transform --file=./data.csv --output=./transformed.csv

# You can also use stdout redirection
modl run code-assistant generate "Create a React component" > ./src/component.js

Working with Directories

Some servers can work with entire directories:

# Analyze an entire project
modl run code-assistant analyze-project --dir=./my-project

# Process multiple data files
modl run data-processor batch-process --dir=./data-files --pattern="*.csv"

# Generate documentation for a project
modl run documentation-generator --dir=./my-project --output=./docs

Advanced Usage

MODL offers advanced features for power users.

Server Chaining

You can chain multiple servers together to create powerful workflows:

# Generate code, then audit it for security issues
modl run code-assistant generate "Login form" | modl run security-audit

# Scrape a website, then analyze the data
modl run web-crawler scrape --url=https://example.com | modl run data-processor analyze

# Generate code, format it, then create tests
modl run code-assistant generate "API endpoint" | modl run code-formatter | modl run test-generator

Using Profiles

MODL supports profiles to save and reuse configurations:

# Create a profile
modl profile create web-dev

# Configure the profile
modl profile set web-dev --server=code-assistant --language=javascript
modl profile set web-dev --server=security-audit --level=high

# Use the profile
modl run --profile=web-dev code-assistant generate "Create a React component"

# List profiles
modl profile list

Automation and Scripting

MODL can be used in scripts and automated workflows:

#!/bin/bash
# Example script to analyze all JavaScript files in a project

for file in $(find ./src -name "*.js"); do
  echo "Analyzing $file..."
  modl run code-assistant analyze --file="$file" --format=json >> analysis-results.json
done

# Process the results
modl run data-processor analyze --file=analysis-results.json --output=report.html

Next Steps

Now that you understand the basics of using MODL, you can explore more advanced topics.