@midewev/midewev-cli
v0.2.1
Published
Autonomous coding agent with MCP, LangGraph and Docker - npm wrapper
Maintainers
Readme
@midewev/midewev-cli
🤖 Autonomous coding agent powered by MCP, LangGraph, and Docker - npm wrapper
Installation
Step 1: Install the npm package
# npm
npm install -g @midewev/midewev-cli
# yarn
yarn global add @midewev/midewev-cli
# pnpm
pnpm add -g @midewev/midewev-cliStep 2: Install the Python backend
The npm package provides a CLI wrapper, but requires the Python backend to be installed separately:
# Clone the repository
git clone https://github.com/LunarBs7/Midewev-CLI.git
cd Midewev-CLI
# Install Poetry (if not already installed)
pip install poetry
# Install Python dependencies
poetry install
# Verify installation
poetry run codeforge --versionRequirements
- Node.js 18.0.0 or higher
- Python 3.11 or higher
- Poetry for Python dependency management
- Docker (optional, for sandbox execution)
Quick Start
🎨 Interactive Mode (New!)
Simply run midewev without arguments to launch the beautiful interactive interface:
midewevYou'll be greeted with:
- Stunning ASCII art logo with welcome message
- Interactive menu with arrow key navigation
- Quick action templates: Tests, Bug Fixes, Refactoring, Documentation, Code Review
- Real-time spinners and colored output
- Easy-to-use prompts for all options
See INTERFACE.md for a complete visual guide!
💻 Command Line Mode
Or use direct commands for automation and scripting:
# Initialize in your project
midewev init
# Execute a task directly
midewev execute "Add unit tests for authentication module"
# Start interactive chat mode
midewev interactive
# Start MCP server
midewev agent --mcp-server
# View statistics
midewev statsCLI Commands
midewev init
Initialize Midewev CLI in your project:
midewev init
midewev init --project-path /path/to/project
midewev init --force # Overwrite existing configurationmidewev execute
Execute a coding task:
midewev execute --prompt "Task description"
midewev execute --prompt "Fix bug in auth.py" --output-format json
midewev execute --prompt "Refactor user service" --thread-id my-threadOptions:
--prompt(required): Task description--output-format: Output format (markdownorjson)--checkpoint: Enable checkpointing (default: true)--thread-id: Thread ID for checkpointing
midewev interactive
Start interactive mode:
midewev interactiveType your requests naturally, type exit to quit.
midewev agent
Start the MCP server:
midewev agent --mcp-servermidewev stats
View agent statistics:
midewev statsmidewev github
Start GitHub webhook handler:
midewev github --port 8080Programmatic API
You can also use Midewev CLI programmatically from Node.js:
import midewev from '@lunarbsdev/midewev-cli';
// Initialize project
await midewev.init('./my-project');
// Execute a task
const result = await midewev.executeTask(
'Add error handling to user service',
{
format: 'json',
threadId: 'task-123',
onProgress: (output) => console.log(output)
}
);
console.log(result.summary);
// Get statistics
const stats = await midewev.getStats();
console.log(`Total tasks: ${stats.tool_calls.total}`);
// Start MCP server
const server = midewev.startMCPServer({ detached: true });API Reference
execute(command, args, options)
Execute any Midewev CLI command:
const result = await midewev.execute('execute', ['--prompt', 'Task'], {
env: { LOG_LEVEL: 'DEBUG' },
onStdout: (data) => console.log(data),
onStderr: (data) => console.error(data)
});init(projectPath)
Initialize Midewev in a project:
await midewev.init('./my-project');executeTask(prompt, options)
Execute a task:
const result = await midewev.executeTask('Add tests', {
format: 'json',
threadId: 'thread-1',
onProgress: (output) => {}
});getStats()
Get agent statistics:
const stats = await midewev.getStats();startMCPServer(options)
Start MCP server:
const server = midewev.startMCPServer({
stdio: 'inherit',
detached: false
});
// Stop server
server.kill();Configuration
Create a .env file in your project:
# Required
OPENAI_API_KEY=sk-...
# Optional
ANTHROPIC_API_KEY=sk-ant-...
GITHUB_TOKEN=ghp_...
DOCKER_ENABLED=true
MIN_TEST_COVERAGE=90
LOG_LEVEL=INFOArchitecture
Midewev CLI consists of:
- Node.js Wrapper (this package) - Provides npm installation and CLI interface
- Python Backend - Core agent with MCP server, LangGraph orchestration, and Docker sandbox
- MCP Protocol - Communication between components
┌─────────────────────────────────────┐
│ Node.js CLI (midewev command) │
└──────────────┬──────────────────────┘
│ (spawn)
┌──────────────▼──────────────────────┐
│ Python Backend (Poetry/pip) │
│ - MCP Server (13 tools) │
│ - LangGraph Orchestrator │
│ - Docker Sandbox │
│ - ChromaDB Memory │
└─────────────────────────────────────┘Features
- 🤖 Autonomous Agent: Plan, execute, validate, and report
- 🔧 13 MCP Tools: File ops, git, code analysis, testing, web fetch, monitoring
- 🧠 LangGraph Workflow: Planner → Executor → Validator → Reporter
- 🔒 Secure Sandbox: Docker isolation with resource limits
- 💾 Vector Memory: ChromaDB for long-term context
- ✅ Validation Pipeline: Static analysis, security scan, style check, tests
- 📊 Observability: Comprehensive metrics and logging
- 🔌 Extensible: Custom tool registry
Troubleshooting
Python not found
# Install Python 3.11+
# macOS
brew install [email protected]
# Ubuntu/Debian
sudo apt install python3.11
# Windows
# Download from https://www.python.org/downloads/Poetry installation fails
The installer will fall back to pip automatically. You can also install Poetry manually:
curl -sSL https://install.python-poetry.org | python3 -Docker not available
Docker is optional. Disable it in .env:
DOCKER_ENABLED=falsePermission denied
On Linux/macOS, you may need to add execute permissions:
chmod +x $(which midewev)Development
# Clone repository
git clone https://github.com/LunarBs7/Midewev-CLI.git
cd Midewev-CLI
# Install npm dependencies
cd npm
npm install
# Link locally
npm link
# Now you can use 'midewev' command globally
midewev --helpDocumentation
License
MIT © Midewev Team
Support
- Issues: https://github.com/LunarBs7/Midewev-CLI/issues
- Discussions: https://github.com/LunarBs7/Midewev-CLI/discussions
