Overview

NikCLI provides powerful terminal operation capabilities that allow you to execute system commands, manage processes, and interact with your development environment directly from the chat interface. All terminal operations include built-in security policies and approval workflows.

Command Execution

Execute terminal commands with security policies

Process Management

Monitor and control running processes

Security Policies

Built-in protection against harmful commands

Output Streaming

Real-time command output with progress tracking

Terminal Commands

/run - Execute Commands

Execute terminal commands with built-in security and approval workflows.
# Basic command execution
/run ls -la
/run pwd
/run whoami

# Development commands
/run npm install
/run npm test
/run npm run build

# Git operations
/run git status
/run git add .
/run git commit -m "Update documentation"

/sh - Shell Alias

Convenient alias for /run command with identical functionality.
# These commands are equivalent
/sh npm test
/run npm test

# Shell scripting
/sh "cd src && find . -name '*.ts' | wc -l"
/sh "grep -r 'TODO' src/ | head -10"

/kill - Process Management

Terminate running background processes by PID or name.

/ps - Process List

Display running processes with filtering and sorting options.
# List all processes
/ps

# List processes by user
/ps --user $(whoami)

# List processes by name pattern
/ps --name node
/ps --pattern "npm.*"

# List with detailed information
/ps --detailed
/ps --tree
/ps --sort cpu
/ps --sort memory

/env - Environment Variables

Manage environment variables for the current session.
# Show all environment variables
/env

# Show specific variables
/env PATH
/env NODE_ENV
/env API_KEY

# Search variables by pattern
/env --pattern "npm.*"
/env --pattern ".*key.*"

/pwd - Working Directory

Display and manage the current working directory.
# Show current directory
/pwd

# Show with full path resolution
/pwd --resolved

# Show directory tree
/pwd --tree

# Show directory with git status
/pwd --git

/cd - Change Directory

Change the working directory for subsequent commands.

/which - Command Location

Find the location of executable commands and check availability.
# Find command location
/which node
/which npm
/which git
/which docker

# Check multiple commands
/which node npm git python

# Show all matching executables
/which --all python

# Check command exists
/which --exists docker-compose

/exec - Execute with Context

Execute commands with enhanced context awareness and logging.
# Execute with project context
/exec npm test
/exec yarn build
/exec docker-compose up

# Execute with enhanced logging
/exec --log npm run build
/exec --verbose docker build .

# Execute with performance monitoring
/exec --profile npm run build
/exec --time ./benchmark.sh

Security Policies

Command Approval

NikCLI implements multi-level command approval based on risk assessment:
Automatically Approved:
ls, pwd, whoami, cat, grep, find
npm test, npm run build, npm install
git status, git log, git diff
node --version, npm --version

Security Modes

Configure security levels for different development scenarios:

Command Output Management

Streaming Output

Real-time command output with progress tracking:
# Stream output in real-time
/run --stream npm run build
/run --stream docker build .
/run --stream npm test -- --watch

# Control output buffering
/run --buffer-lines 100 npm run build
/run --no-buffer tail -f log.txt

Output Formatting

Control how command output is displayed:
# Syntax highlighting for common outputs
/run --highlight cat package.json
/run --highlight git log --oneline

# Compact output format
/run --compact npm list
/run --compact docker ps

# Verbose output with metadata
/run --verbose npm run build
/run --debug docker-compose up

Output History

Access and manage command output history:
# Show recent command outputs
/output list
/output history

# View specific command output
/output show 123
/output replay "npm run build"

# Search output history
/output search "error"
/output grep "warning"

# Export output
/output export build-logs.txt
/output save 123 command-output.txt

Process Monitoring

Background Process Management

Monitor and manage long-running processes:

Performance Monitoring

Track resource usage and performance metrics:
# System resource usage
/monitor cpu
/monitor memory
/monitor disk
/monitor network

# Process-specific monitoring
/monitor process dev-server
/monitor --pid 1234

# Performance profiling
/profile npm run build
/profile --flame-graph node app.js
/profile --memory-usage npm test

Integration with Development Tools

Package Managers

Enhanced support for common package managers:
# Smart npm commands
/npm install express
/npm run build
/npm test -- --coverage

# npm with enhanced features
/npm --profile install  # Profile installation
/npm --verify audit     # Verify after audit
/npm --update outdated  # Update outdated packages

Version Control

Git integration with enhanced features:

Docker Integration

Container management with enhanced monitoring:
# Docker commands with enhancements
/docker ps --format "table"
/docker logs --follow --tail 100 container
/docker exec -it container /bin/bash

# Docker Compose integration
/docker-compose --profile dev up
/docker-compose logs --follow service
/docker-compose exec service bash

# Container health monitoring
/docker health container-name
/docker stats --no-stream
/docker system df

Best Practices

Security Best Practices

Command Verification

Always review commands before execution, especially in production environments
# Use --dry-run when available
/run --dry-run rm -rf old-files/
/run --preview docker-compose up

Environment Isolation

Use proper environment separation and variable management
# Isolate environments
/env --file .env.development
/run --env-file .env.production npm run deploy

Output Sanitization

Be cautious with sensitive information in command outputs
# Mask sensitive outputs
/run --mask-secrets env
/run --no-log curl -H "Authorization: Bearer $TOKEN"

Audit Logging

Maintain comprehensive audit logs for security compliance
# Enable detailed logging
/security audit enable
/run --audit-log critical-operation.sh

Performance Optimization

# Use efficient commands
/run --parallel npm run build:components
/run --jobs 4 npm run test

# Optimize resource usage
/run --memory-limit 1G node build.js
/run --cpu-limit 0.5 npm run build

Troubleshooting

Common Issues

Debugging Commands

Enable detailed debugging for command execution:
# Enable debug mode
/debug terminal enable

# Show command parsing
/debug command "npm run build"

# Trace command execution
/trace /run npm test

# Profile command performance
/profile --detailed npm run build

# Inspect security policies
/debug security check "rm file.txt"

Next Steps

Use /run --help to see all available options for command execution. The help system is context-aware and will show relevant flags based on your current environment and security settings.