Skip to content

Commit fec868f

Browse files
authored
Merge pull request #320 from drivecore/update-cli-readme
docs: update CLI README with comprehensive documentation
2 parents 670a10b + 7440f58 commit fec868f

File tree

2 files changed

+240
-51
lines changed

2 files changed

+240
-51
lines changed

packages/agent/README.md

Lines changed: 128 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# MyCoder Agent
22

3-
Core AI agent system that powers the MyCoder CLI tool. This package provides a modular tool-based architecture that allows AI agents to interact with files, execute commands, make network requests, and spawn sub-agents for parallel task execution.
3+
Core AI agent system that powers the MyCoder CLI tool. This package provides a modular tool-based architecture that allows AI agents to interact with files, execute commands, make network requests, spawn sub-agents for parallel task execution, and automate browser interactions.
44

55
## Overview
66

7-
The MyCoder Agent system is built around a few key concepts:
7+
The MyCoder Agent system is built around these key concepts:
88

99
- 🛠️ **Extensible Tool System**: Modular architecture with various tool categories
1010
- 🔄 **Parallel Execution**: Ability to spawn sub-agents for concurrent task processing
11-
- 🤖 **AI-Powered**: Leverages Anthropic's Claude API for intelligent decision making
11+
- 🔌 **Multi-LLM Support**: Works with Anthropic Claude, OpenAI GPT models, and Ollama
12+
- 🌐 **Web Automation**: Built-in browser automation for web interactions
1213
- 🔍 **Smart Logging**: Hierarchical, color-coded logging system for clear output
14+
- 📝 **Advanced Text Editing**: Powerful file manipulation capabilities
15+
- 🔄 **MCP Integration**: Support for the Model Context Protocol
1316

1417
Please join the MyCoder.ai discord for support: https://discord.gg/5K6TYrHGHt
1518

@@ -21,65 +24,149 @@ npm install mycoder-agent
2124

2225
## API Key Required
2326

24-
Before using MyCoder Agent, you must have an ANTHROPIC_API_KEY specified either:
27+
Before using MyCoder Agent, you must have one of the following API keys:
2528

26-
- As an environment variable, "export ANTHROPIC_API_KEY=[your-api-key]" or
27-
- In a .env file in your project root
28-
29-
Get an API key from https://www.anthropic.com/api
29+
- **Anthropic**: Set `ANTHROPIC_API_KEY` as an environment variable or in a .env file (Get from https://www.anthropic.com/api)
30+
- **OpenAI**: Set `OPENAI_API_KEY` as an environment variable or in a .env file
31+
- **Ollama**: Use locally running Ollama instance
3032

3133
## Core Components
3234

3335
### Tool System
3436

35-
- Modular tools for specific functionalities
36-
- Categories: Interaction, I/O, System, Data Management
37-
- Parallel execution capability
38-
- Type-safe definitions
39-
- Input token caching to reduce API costs
37+
The tool system is the foundation of the MyCoder agent's capabilities:
38+
39+
- **Modular Design**: Each tool is a standalone module with clear inputs and outputs
40+
- **Type Safety**: Tools use Zod for schema validation and TypeScript for type safety
41+
- **Token Tracking**: Built-in token usage tracking to optimize API costs
42+
- **Parallel Execution**: Tools can run concurrently for efficiency
4043

4144
### Agent System
4245

43-
- Main agent for orchestration
44-
- Sub-agents for parallel task execution
45-
- Anthropic Claude API integration
46-
- Hierarchical logging
46+
The agent system orchestrates the execution flow:
4747

48-
### Logger System
48+
- **Main Agent**: Primary agent that handles the overall task
49+
- **Sub-Agents**: Specialized agents for parallel task execution
50+
- **Agent State Management**: Tracking agent status and communication
51+
- **LLM Integration**: Supports multiple LLM providers (Anthropic, OpenAI, Ollama)
4952

50-
- Color-coded component output
51-
- Hierarchical indentation
52-
- Multiple log levels (info, verbose, warn, error)
53-
- Structured data logging
53+
### LLM Providers
5454

55-
## Project Structure
55+
The agent supports multiple LLM providers:
5656

57-
```
58-
src/
59-
├── core/ # Core agent and executor logic
60-
├── interfaces/ # Type definitions and interfaces
61-
├── tools/ # Tool implementations
62-
│ ├── interaction/
63-
│ ├── io/
64-
│ ├── system/
65-
│ └── record/
66-
└── utils/ # Utilities including logger
67-
```
57+
- **Anthropic**: Claude models with full tool use support
58+
- **OpenAI**: GPT-4 and other OpenAI models with function calling
59+
- **Ollama**: Local LLM support for privacy and offline use
60+
61+
### Model Context Protocol (MCP)
62+
63+
MyCoder Agent supports the Model Context Protocol:
64+
65+
- **Resource Loading**: Load context from MCP-compatible servers
66+
- **Server Configuration**: Configure multiple MCP servers
67+
- **Tool Integration**: Use MCP-provided tools
6868

6969
## Available Tools
7070

71-
The agent system provides various tools in different categories:
71+
### File & Text Manipulation
72+
- **textEditor**: View, create, and edit files with persistent state
73+
- Commands: view, create, str_replace, insert, undo_edit
74+
- Line number support and partial file viewing
75+
76+
### System Interaction
77+
- **shellStart**: Execute shell commands with sync/async modes
78+
- **shellMessage**: Interact with running shell processes
79+
- **shellExecute**: One-shot shell command execution
80+
- **listShells**: List all running shell processes
81+
82+
### Agent Management
83+
- **agentStart**: Create sub-agents for parallel tasks
84+
- **agentMessage**: Send messages to sub-agents
85+
- **agentDone**: Complete the current agent's execution
86+
- **listAgents**: List all running agents
87+
88+
### Network & Web
89+
- **fetch**: Make HTTP requests to APIs
90+
- **sessionStart**: Start browser automation sessions
91+
- **sessionMessage**: Control browser sessions (navigation, clicking, typing)
92+
- **listSessions**: List all browser sessions
93+
94+
### Utility Tools
95+
- **sleep**: Pause execution for a specified duration
96+
- **userPrompt**: Request input from the user
7297

73-
- **Interaction Tools**: User prompts, sub-agent creation
74-
- **I/O Tools**: File reading/writing, HTTP requests
75-
- **System Tools**: Shell command execution, process management
76-
- **Browser Tools**: Web automation and scraping capabilities
98+
## Project Structure
99+
100+
```
101+
src/
102+
├── core/ # Core agent and LLM abstraction
103+
│ ├── llm/ # LLM providers and interfaces
104+
│ │ └── providers/ # Anthropic, OpenAI, Ollama implementations
105+
│ ├── mcp/ # Model Context Protocol integration
106+
│ └── toolAgent/ # Tool agent implementation
107+
├── tools/ # Tool implementations
108+
│ ├── agent/ # Sub-agent tools
109+
│ ├── fetch/ # HTTP request tools
110+
│ ├── interaction/ # User interaction tools
111+
│ ├── session/ # Browser automation tools
112+
│ ├── shell/ # Shell execution tools
113+
│ ├── sleep/ # Execution pause tool
114+
│ └── textEditor/ # File manipulation tools
115+
└── utils/ # Utility functions and logger
116+
```
77117

78118
## Technical Requirements
79119

80-
- Node.js >= 20.0.0
120+
- Node.js >= 18.0.0
81121
- pnpm >= 10.2.1
82122

123+
## Browser Automation
124+
125+
The agent includes powerful browser automation capabilities using Playwright:
126+
127+
- **Web Navigation**: Visit websites and follow links
128+
- **Content Extraction**: Extract and filter page content
129+
- **Element Interaction**: Click buttons, fill forms, and interact with UI elements
130+
- **Waiting Strategies**: Smart waiting for page loads and element visibility
131+
132+
## Usage Example
133+
134+
```typescript
135+
import { toolAgent } from 'mycoder-agent';
136+
import { textEditorTool } from 'mycoder-agent';
137+
import { shellStartTool } from 'mycoder-agent';
138+
import { Logger, LogLevel } from 'mycoder-agent';
139+
140+
// Create a logger
141+
const logger = new Logger({ name: 'MyAgent', logLevel: LogLevel.info });
142+
143+
// Define available tools
144+
const tools = [textEditorTool, shellStartTool];
145+
146+
// Run the agent
147+
const result = await toolAgent(
148+
"Write a simple Node.js HTTP server and save it to server.js",
149+
tools,
150+
{
151+
getSystemPrompt: () => "You are a helpful coding assistant...",
152+
maxIterations: 10,
153+
},
154+
{
155+
logger,
156+
provider: 'anthropic',
157+
model: 'claude-3-opus-20240229',
158+
apiKey: process.env.ANTHROPIC_API_KEY,
159+
workingDirectory: process.cwd(),
160+
}
161+
);
162+
163+
console.log('Agent result:', result);
164+
```
165+
83166
## Contributing
84167

85-
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for development workflow and guidelines.
168+
We welcome contributions! Please see our [CONTRIBUTING.md](../CONTRIBUTING.md) for development workflow and guidelines.
169+
170+
## License
171+
172+
MIT

packages/docs/README.md

Lines changed: 112 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,62 @@
11
# MyCoder Documentation
22

3-
This package contains the official documentation for MyCoder, an AI-powered coding assistant. The documentation is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
3+
This package contains the official documentation for MyCoder, an AI-powered coding assistant. The documentation is built using [Docusaurus v3](https://docusaurus.io/), a modern static website generator maintained by Meta.
44

55
## What's Inside
66

7-
- **Product Documentation**: Comprehensive guides on how to use MyCoder
8-
- **Getting Started**: Platform-specific setup instructions for Windows, macOS, and Linux
9-
- **Usage Guides**: Detailed information on features and capabilities
10-
- **Blog**: Updates, tutorials, and insights about MyCoder
7+
### Documentation Structure
8+
9+
- **Core Documentation**
10+
- **Introduction**: Overview of MyCoder and its capabilities
11+
- **Getting Started**: Platform-specific setup instructions for Windows, macOS, and Linux
12+
- **Usage Guides**: Detailed information on features, configuration, and capabilities
13+
- **Examples**: Practical examples of using MyCoder for different scenarios
14+
- **Providers**: Information about supported AI providers (OpenAI, Anthropic, Ollama, XAI)
15+
16+
- **Blog**: Updates, tutorials, and insights about MyCoder and AI-assisted development
17+
18+
### Technical Structure
19+
20+
- **docs/**: Contains all markdown documentation files organized by topic
21+
- **blog/**: Contains blog posts with release notes and usage tips
22+
- **src/**: Custom React components and CSS for the documentation site
23+
- **components/**: Custom React components for the site
24+
- **css/**: Custom styling
25+
- **pages/**: Custom pages including the home page
26+
- **static/**: Static assets like images and icons
27+
- **.docusaurus/**: Build cache (gitignored)
28+
- **build/**: Output directory for the built documentation site
29+
30+
## Features
31+
32+
- **Responsive Design**: Works on desktop and mobile devices
33+
- **Search Functionality**: Built-in search for documentation
34+
- **Versioning Support**: Ability to maintain documentation for different versions
35+
- **Blog with RSS Feed**: Integrated blog with RSS support
36+
- **Analytics Integration**: Google Analytics for tracking site usage
37+
- **Error Tracking**: Sentry integration for monitoring errors
38+
- **Docker Deployment**: Containerized deployment option
1139

1240
## Development
1341

1442
### Prerequisites
1543

1644
- Node.js version 18.0 or above
17-
- pnpm (recommended)
45+
- pnpm (recommended package manager)
1846

1947
### Local Development
2048

2149
```bash
2250
# Navigate to the docs package
2351
cd packages/docs
2452

53+
# Install dependencies
54+
pnpm install
55+
2556
# Start the development server
2657
pnpm start
58+
# or
59+
pnpm dev
2760
```
2861

2962
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
@@ -37,24 +70,93 @@ pnpm build
3770

3871
This command generates static content into the `build` directory and can be served using any static contents hosting service.
3972

40-
### Deployment
73+
### Serve Built Site Locally
74+
75+
```bash
76+
# Serve the built website locally
77+
pnpm serve
78+
```
79+
80+
### Other Commands
81+
82+
```bash
83+
# Clean the build cache
84+
pnpm clean
85+
86+
# Clean everything including node_modules
87+
pnpm clean:all
88+
89+
# Type checking
90+
pnpm typecheck
91+
92+
# Generate translations
93+
pnpm write-translations
94+
95+
# Generate heading IDs
96+
pnpm write-heading-ids
97+
```
98+
99+
## Docker Deployment
100+
101+
The documentation site can be deployed using Docker:
41102

42-
The documentation site is automatically deployed when changes are pushed to the `docs-release` branch.
103+
```bash
104+
# Build the Docker image
105+
docker build -t mycoder-docs .
106+
107+
# Run the container
108+
docker run -p 8080:8080 mycoder-docs
109+
```
110+
111+
## Continuous Deployment
112+
113+
The documentation site is automatically deployed when changes are pushed to the `docs-release` branch. The deployment process uses semantic-release for versioning and release management.
43114

44115
## Contributing
45116

46117
We welcome contributions to improve the documentation:
47118

48119
1. Create a feature branch (`git checkout -b feature/amazing-improvement`)
49120
2. Make your changes
50-
3. Commit your changes (`git commit -m 'Add some amazing improvement'`)
121+
3. Commit your changes following [Conventional Commits](https://www.conventionalcommits.org/) format
51122
4. Push to the branch (`git push origin feature/amazing-improvement`)
52123
5. Open a Pull Request
53124

125+
### Adding New Documentation
126+
127+
1. Create markdown files in the appropriate directory under `docs/`
128+
2. The sidebar is automatically generated based on the file structure
129+
3. Use front matter to customize the page title, description, and other metadata
130+
131+
### Adding Blog Posts
132+
133+
Create new markdown files in the `blog/` directory with the following front matter:
134+
135+
```markdown
136+
---
137+
slug: your-post-slug
138+
title: Your Post Title
139+
authors: [yourname]
140+
tags: [tag1, tag2]
141+
---
142+
143+
Your content here...
144+
145+
<!-- truncate -->
146+
147+
More content here (this part won't appear in the blog list preview)
148+
```
149+
54150
## License
55151

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

58154
## Contact
59155

60-
If you have questions or feedback, please join our [Discord community](https://discord.gg/5K6TYrHGHt).
156+
If you have questions or feedback, please join our [Discord community](https://discord.gg/5K6TYrHGHt) or follow us on [X (Twitter)](https://twitter.com/mycoderAI).
157+
158+
## Links
159+
160+
- [MyCoder Website](https://mycoder.ai)
161+
- [GitHub Repository](https://github.com/drivecore/mycoder)
162+
- [Documentation Site](https://docs.mycoder.ai)

0 commit comments

Comments
 (0)