Skip to content

Commit 2ec8efc

Browse files
committed
Fix GitHub newlines issue #83 using markdown files approach
1 parent 35cfaa4 commit 2ec8efc

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ export function getDefaultSystemPrompt(toolContext: ToolContext): string {
7676
'- Create additional GitHub issues for follow-up tasks or ideas',
7777
'',
7878
'You can use the GitHub CLI (`gh`) for all GitHub interactions.',
79+
'',
80+
'When creating GitHub issues, PRs, or comments, use temporary markdown files for the content instead of inline text:',
81+
'- Create a temporary markdown file with the content you want to include',
82+
'- Use the file with GitHub CLI commands (e.g., `gh issue create --body-file temp.md`)',
83+
'- Clean up the temporary file when done',
84+
'- This approach preserves formatting, newlines, and special characters correctly',
7985
].join('\n')
8086
: '';
8187

packages/cli/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,29 @@ Requirements for GitHub mode:
6161
- GitHub CLI (`gh`) needs to be installed and authenticated
6262
- User needs to have appropriate GitHub permissions for the target repository
6363

64+
When using GitHub mode, MyCoder uses temporary markdown files for creating issues, PRs, and comments to ensure proper formatting:
65+
66+
```bash
67+
# Example of how MyCoder handles GitHub content
68+
# 1. Creates a temporary markdown file
69+
cat > temp.md << 'EOF'
70+
## Description
71+
This is a description with proper
72+
newlines and formatting.
73+
74+
- Bullet point 1
75+
- Bullet point 2
76+
EOF
77+
78+
# 2. Uses the file with GitHub CLI
79+
gh issue create --title "Issue Title" --body-file temp.md
80+
81+
# 3. Cleans up the temporary file
82+
rm temp.md
83+
```
84+
85+
This approach ensures that formatting, newlines, and special characters are preserved correctly in GitHub content.
86+
6487
## Configuration
6588

6689
MyCoder stores configuration in `~/.mycoder/config.json`. You can manage configuration using the `config` command:
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# GitHub Mode Markdown File Approach Test
2+
3+
This is a test to verify that using temporary markdown files for GitHub issues, PRs, and comments works correctly.
4+
5+
## Key Benefits
6+
- Preserves formatting
7+
- Handles newlines properly
8+
- Supports special characters
9+
- More robust than inline text
10+
11+
## Example Usage
12+
```bash
13+
# Create a temporary markdown file
14+
cat > temp.md << 'EOF'
15+
# Issue Title
16+
17+
## Description
18+
This is a description with proper
19+
newlines and formatting.
20+
21+
- Bullet point 1
22+
- Bullet point 2
23+
24+
```code block
25+
example code
26+
```
27+
EOF
28+
29+
# Use the file with GitHub CLI
30+
gh issue create --title "Test Issue" --body-file temp.md
31+
32+
# Clean up
33+
rm temp.md
34+
```
35+
36+
This approach should fix issue #83.

0 commit comments

Comments
 (0)