Skip to content

Commit ca44fe7

Browse files
authored
Merge pull request #75 from drivecore/issue-67-github-mode-updated
Add GitHub mode to MyCoder for working with issues and PRs
2 parents 8e56dea + d686cbb commit ca44fe7

File tree

10 files changed

+379
-215
lines changed

10 files changed

+379
-215
lines changed

.changeset/github-mode.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'mycoder-agent': minor
3+
'mycoder': minor
4+
---
5+
6+
Add GitHub mode to MyCoder for working with issues and PRs

.changeset/text-editor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
"mycoder-agent": minor
2+
'mycoder-agent': minor
33
---
44

55
Add textEditor tool that combines readFile and updateFile functionality

README.md

Lines changed: 14 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# MyCoder Mono-repository
1+
# MyCoder
22

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

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

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

18-
## 🚀 Quick Start
19+
## Packages
1920

20-
### Prerequisites
21+
- [mycoder](packages/cli) - Command-line interface for MyCoder
22+
- [mycoder-agent](packages/agent) - Agent module for MyCoder
2123

22-
- Node.js >= 20.0.0
23-
- pnpm >= 10.2.1
24-
- ANTHROPIC_API_KEY (for AI features)
25-
26-
### Installation
24+
## Development
2725

2826
```bash
27+
# Clone the repository
28+
git clone https://github.com/drivecore/mycoder.git
29+
cd mycoder
30+
2931
# Install dependencies
3032
pnpm install
3133

3234
# Build all packages
3335
pnpm build
3436

35-
# Run locally built cli in interactive mode
36-
pnpm cli -i
37-
```
38-
39-
## 📦 Packages
40-
41-
### [`cli`](packages/cli)
42-
43-
Command-line interface for AI-powered coding tasks:
44-
45-
- Interactive mode
46-
- File-based prompt support
47-
- Code migration and refactoring capabilities
48-
49-
### [`agent`](packages/agent)
50-
51-
Core AI agent system powering MyCoder's intelligent features:
52-
53-
- Extensible Tool System
54-
- Parallel Execution with sub-agents
55-
- AI-Powered using Anthropic's Claude API
56-
57-
## 🛠 Development
58-
59-
### Common Commands
60-
61-
```bash
62-
# Development mode
63-
pnpm dev
64-
65-
# Build all packages
66-
pnpm build
67-
6837
# Run tests
6938
pnpm test
70-
71-
# Type checking
72-
pnpm typecheck
73-
74-
# Linting
75-
pnpm lint
76-
77-
# Formatting
78-
pnpm format
79-
80-
# Clean build artifacts
81-
pnpm clean
82-
83-
# Clean everything including node_modules
84-
pnpm clean:all
8539
```
8640

87-
## 📚 Documentation
88-
89-
Each package contains detailed documentation in its respective README.md file. See individual package directories for:
90-
91-
- Detailed setup instructions
92-
- API documentation
93-
- Development guidelines
94-
- Package-specific commands
95-
96-
## 📦 Publishing
97-
98-
This monorepo uses [Changesets](https://github.com/changesets/changesets) to manage versions and publish packages. The following packages are published to npm:
99-
100-
- `mycoder` - CLI package
101-
- `mycoder-agent` - Core agent functionality
102-
103-
To publish changes:
104-
105-
1. Make your code changes
106-
2. Create a changeset (documents your changes):
107-
108-
```bash
109-
pnpm changeset
110-
```
111-
112-
3. Select the packages that have changes
113-
4. Write a clear description of the changes
114-
5. Commit the generated changeset file
115-
116-
When ready to publish:
117-
118-
1. Update versions based on changesets:
119-
120-
```bash
121-
pnpm changeset version
122-
```
123-
124-
2. Review the changes
125-
3. Publish packages:
126-
127-
```bash
128-
pnpm publish -r
129-
```
41+
## Contributing
13042

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

133-
## 🤝 Contributing
45+
## License
13446

135-
1. Fork the repository
136-
2. Create your feature branch
137-
3. Commit your changes
138-
4. Push to the branch
139-
5. Create a Pull Request
47+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

docs/github-mode.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# GitHub Mode for MyCoder
2+
3+
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.
4+
5+
## Overview
6+
7+
When GitHub mode is enabled, MyCoder will:
8+
9+
- Start from existing GitHub issues or create new ones for tasks
10+
- Create branches for issues it's working on
11+
- Make commits with descriptive messages
12+
- Create PRs when work is complete
13+
- Create additional GitHub issues for follow-up tasks or ideas
14+
15+
## Prerequisites
16+
17+
Before using GitHub mode, ensure you have:
18+
19+
1. Installed the GitHub CLI (`gh`)
20+
2. Authenticated with GitHub (`gh auth login`)
21+
3. Appropriate permissions for your target repository
22+
23+
## Enabling GitHub Mode
24+
25+
You can enable GitHub mode using the `config` command:
26+
27+
```bash
28+
mycoder config set githubMode true
29+
```
30+
31+
To disable GitHub mode:
32+
33+
```bash
34+
mycoder config set githubMode false
35+
```
36+
37+
To check if GitHub mode is enabled:
38+
39+
```bash
40+
mycoder config get githubMode
41+
```
42+
43+
## Using GitHub Mode
44+
45+
When GitHub mode is enabled, MyCoder will automatically include GitHub-specific instructions in its system prompt. You can ask MyCoder to:
46+
47+
1. **Work on existing issues**:
48+
49+
```bash
50+
mycoder "Implement GitHub issue #42"
51+
```
52+
53+
2. **Create new issues**:
54+
55+
```bash
56+
mycoder "Create a GitHub issue for adding dark mode to the UI"
57+
```
58+
59+
3. **Create PRs for completed work**:
60+
```bash
61+
mycoder "Create a PR for the changes I just made to fix issue #42"
62+
```
63+
64+
## GitHub Commands
65+
66+
MyCoder uses the GitHub CLI directly. Here are some common commands it may use:
67+
68+
- **View issues**: `gh issue list --state open`
69+
- **View a specific issue**: `gh issue view <number>`
70+
- **Create an issue**: `gh issue create --title "Title" --body "Description"`
71+
- **Create a PR**: `gh pr create --title "Title" --body "Description"`
72+
- **Create a branch**: `git checkout -b branch-name`
73+
- **Make commits**: `git commit -m "Descriptive message"`
74+
75+
## Configuration Storage
76+
77+
GitHub mode settings are stored in the `.mycoder/config.json` file in your home directory, along with other MyCoder settings.

packages/agent/src/core/toolAgent/config.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ export const DEFAULT_CONFIG = {
1616
/**
1717
* Gets the default system prompt with contextual information about the environment
1818
*/
19-
export function getDefaultSystemPrompt(): string {
19+
export function getDefaultSystemPrompt(options?: {
20+
githubMode?: boolean;
21+
}): string {
2022
// Gather context with error handling
2123
const getCommandOutput = (command: string, label: string): string => {
2224
try {
@@ -31,8 +33,24 @@ export function getDefaultSystemPrompt(): string {
3133
files: getCommandOutput('ls -la', 'file listing'),
3234
system: getCommandOutput('uname -a', 'system information'),
3335
datetime: new Date().toString(),
36+
githubMode: options?.githubMode || false,
3437
};
3538

39+
const githubModeInstructions = context.githubMode
40+
? [
41+
'',
42+
'## GitHub Mode',
43+
'GitHub mode is enabled. You should work with GitHub issues and PRs as part of your workflow:',
44+
'- Start from existing GitHub issues or create new ones for tasks',
45+
"- Create branches for issues you're working on",
46+
'- Make commits with descriptive messages',
47+
'- Create PRs when work is complete',
48+
'- Create additional GitHub issues for follow-up tasks or ideas',
49+
'',
50+
'You can use the GitHub CLI (`gh`) for all GitHub interactions.',
51+
].join('\n')
52+
: '';
53+
3654
return [
3755
'You are an AI agent that can use tools to accomplish tasks.',
3856
'',
@@ -42,6 +60,7 @@ export function getDefaultSystemPrompt(): string {
4260
context.files,
4361
`System: ${context.system}`,
4462
`DateTime: ${context.datetime}`,
63+
githubModeInstructions,
4564
'',
4665
'You prefer to call tools in parallel when possible because it leads to faster execution and less resource usage.',
4766
'When done, call the sequenceComplete tool with your results to indicate that the sequence has completed.',

0 commit comments

Comments
 (0)