Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/github-mode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'mycoder-agent': minor
'mycoder': minor
---

Add GitHub mode to MyCoder for working with issues and PRs
2 changes: 1 addition & 1 deletion .changeset/text-editor.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"mycoder-agent": minor
'mycoder-agent': minor
---

Add textEditor tool that combines readFile and updateFile functionality
120 changes: 14 additions & 106 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# MyCoder Mono-repository
# MyCoder

An open-source mono-repository containing the MyCoder agent and cli.

Expand All @@ -12,128 +12,36 @@ An open-source mono-repository containing the MyCoder agent and cli.
- 📝 **Self-Modification**: Can modify code, it was built and tested by writing itself
- 🔍 **Smart Logging**: Hierarchical, color-coded logging system for clear output
- 👤 **Human Compatible**: Uses README.md, project files and shell commands to build its own context
- 🌐 **GitHub Integration**: GitHub mode for working with issues and PRs as part of workflow

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

## 🚀 Quick Start
## Packages

### Prerequisites
- [mycoder](packages/cli) - Command-line interface for MyCoder
- [mycoder-agent](packages/agent) - Agent module for MyCoder

- Node.js >= 20.0.0
- pnpm >= 10.2.1
- ANTHROPIC_API_KEY (for AI features)

### Installation
## Development

```bash
# Clone the repository
git clone https://github.com/drivecore/mycoder.git
cd mycoder

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Run locally built cli in interactive mode
pnpm cli -i
```

## 📦 Packages

### [`cli`](packages/cli)

Command-line interface for AI-powered coding tasks:

- Interactive mode
- File-based prompt support
- Code migration and refactoring capabilities

### [`agent`](packages/agent)

Core AI agent system powering MyCoder's intelligent features:

- Extensible Tool System
- Parallel Execution with sub-agents
- AI-Powered using Anthropic's Claude API

## 🛠 Development

### Common Commands

```bash
# Development mode
pnpm dev

# Build all packages
pnpm build

# Run tests
pnpm test

# Type checking
pnpm typecheck

# Linting
pnpm lint

# Formatting
pnpm format

# Clean build artifacts
pnpm clean

# Clean everything including node_modules
pnpm clean:all
```

## 📚 Documentation

Each package contains detailed documentation in its respective README.md file. See individual package directories for:

- Detailed setup instructions
- API documentation
- Development guidelines
- Package-specific commands

## 📦 Publishing

This monorepo uses [Changesets](https://github.com/changesets/changesets) to manage versions and publish packages. The following packages are published to npm:

- `mycoder` - CLI package
- `mycoder-agent` - Core agent functionality

To publish changes:

1. Make your code changes
2. Create a changeset (documents your changes):

```bash
pnpm changeset
```

3. Select the packages that have changes
4. Write a clear description of the changes
5. Commit the generated changeset file

When ready to publish:

1. Update versions based on changesets:

```bash
pnpm changeset version
```

2. Review the changes
3. Publish packages:

```bash
pnpm publish -r
```
## Contributing

Note: Both packages are versioned together to ensure compatibility.
Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.

## 🤝 Contributing
## License

1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
77 changes: 77 additions & 0 deletions docs/github-mode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# GitHub Mode for MyCoder

GitHub mode enables MyCoder to work with GitHub issues and PRs as part of its workflow. This feature provides better continuity between sessions and makes it easier to track progress on larger projects.

## Overview

When GitHub mode is enabled, MyCoder will:

- Start from existing GitHub issues or create new ones for tasks
- Create branches for issues it's working on
- Make commits with descriptive messages
- Create PRs when work is complete
- Create additional GitHub issues for follow-up tasks or ideas

## Prerequisites

Before using GitHub mode, ensure you have:

1. Installed the GitHub CLI (`gh`)
2. Authenticated with GitHub (`gh auth login`)
3. Appropriate permissions for your target repository

## Enabling GitHub Mode

You can enable GitHub mode using the `config` command:

```bash
mycoder config set githubMode true
```

To disable GitHub mode:

```bash
mycoder config set githubMode false
```

To check if GitHub mode is enabled:

```bash
mycoder config get githubMode
```

## Using GitHub Mode

When GitHub mode is enabled, MyCoder will automatically include GitHub-specific instructions in its system prompt. You can ask MyCoder to:

1. **Work on existing issues**:

```bash
mycoder "Implement GitHub issue #42"
```

2. **Create new issues**:

```bash
mycoder "Create a GitHub issue for adding dark mode to the UI"
```

3. **Create PRs for completed work**:
```bash
mycoder "Create a PR for the changes I just made to fix issue #42"
```

## GitHub Commands

MyCoder uses the GitHub CLI directly. Here are some common commands it may use:

- **View issues**: `gh issue list --state open`
- **View a specific issue**: `gh issue view <number>`
- **Create an issue**: `gh issue create --title "Title" --body "Description"`
- **Create a PR**: `gh pr create --title "Title" --body "Description"`
- **Create a branch**: `git checkout -b branch-name`
- **Make commits**: `git commit -m "Descriptive message"`

## Configuration Storage

GitHub mode settings are stored in the `.mycoder/config.json` file in your home directory, along with other MyCoder settings.
21 changes: 20 additions & 1 deletion packages/agent/src/core/toolAgent/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export const DEFAULT_CONFIG = {
/**
* Gets the default system prompt with contextual information about the environment
*/
export function getDefaultSystemPrompt(): string {
export function getDefaultSystemPrompt(options?: {
githubMode?: boolean;
}): string {
// Gather context with error handling
const getCommandOutput = (command: string, label: string): string => {
try {
Expand All @@ -31,8 +33,24 @@ export function getDefaultSystemPrompt(): string {
files: getCommandOutput('ls -la', 'file listing'),
system: getCommandOutput('uname -a', 'system information'),
datetime: new Date().toString(),
githubMode: options?.githubMode || false,
};

const githubModeInstructions = context.githubMode
? [
'',
'## GitHub Mode',
'GitHub mode is enabled. You should work with GitHub issues and PRs as part of your workflow:',
'- Start from existing GitHub issues or create new ones for tasks',
"- Create branches for issues you're working on",
'- Make commits with descriptive messages',
'- Create PRs when work is complete',
'- Create additional GitHub issues for follow-up tasks or ideas',
'',
'You can use the GitHub CLI (`gh`) for all GitHub interactions.',
].join('\n')
: '';

return [
'You are an AI agent that can use tools to accomplish tasks.',
'',
Expand All @@ -42,6 +60,7 @@ export function getDefaultSystemPrompt(): string {
context.files,
`System: ${context.system}`,
`DateTime: ${context.datetime}`,
githubModeInstructions,
'',
'You prefer to call tools in parallel when possible because it leads to faster execution and less resource usage.',
'When done, call the sequenceComplete tool with your results to indicate that the sequence has completed.',
Expand Down
Loading
Loading