coder-agent 2.8.3 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -0
- package/dist/agent.js +8 -0
- package/dist/tools.js +11 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -100,5 +100,37 @@ Type these commands directly inside the interactive session:
|
|
|
100
100
|
- `gemini-2.0-flash` (Ultra-fast, lightweight)
|
|
101
101
|
- `gemini-2.0-pro-exp` (Experimental reasoning model)
|
|
102
102
|
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## macOS & Linux Troubleshooting
|
|
106
|
+
|
|
107
|
+
If you encounter permission errors on macOS or Linux (such as `EACCES: permission denied` or `zsh: permission denied`):
|
|
108
|
+
|
|
109
|
+
### 1. Run Directly using Node
|
|
110
|
+
If global linking fails or is blocked by system directory permissions, you can skip `npm link` and run the build file directly using Node.js:
|
|
111
|
+
```bash
|
|
112
|
+
npm run build
|
|
113
|
+
node dist/index.js
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 2. Fix Executable Permissions
|
|
117
|
+
If you get a "permission denied" when executing the bin file directly, ensure it has executable rights:
|
|
118
|
+
```bash
|
|
119
|
+
chmod +x dist/index.js
|
|
120
|
+
```
|
|
121
|
+
*(Note: The `npm run build` task now automatically applies the correct Unix execution permission (`755`) on macOS/Linux environments).*
|
|
122
|
+
|
|
123
|
+
### 3. Avoid npm link EACCES failures
|
|
124
|
+
If `npm link` fails because your standard global folder belongs to `root`:
|
|
125
|
+
- **Use nvm (Recommended)**: Installing Node.js via [nvm](https://github.com/nvm-sh/nvm) places Node and npm in your home directory where you have full ownership.
|
|
126
|
+
- **Adjust npm global prefix**: Change npm's default path to your home folder:
|
|
127
|
+
```bash
|
|
128
|
+
mkdir ~/.npm-global
|
|
129
|
+
npm config set prefix '~/.npm-global'
|
|
130
|
+
```
|
|
131
|
+
Then add `export PATH=~/.npm-global/bin:$PATH` to your shell profile (`~/.zshrc` or `~/.bashrc`).
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
103
135
|
## License
|
|
104
136
|
MIT
|
package/dist/agent.js
CHANGED
|
@@ -783,6 +783,14 @@ export class Agent {
|
|
|
783
783
|
let args = {};
|
|
784
784
|
try {
|
|
785
785
|
args = JSON.parse(toolCall.function.arguments);
|
|
786
|
+
if (args && typeof args === "object") {
|
|
787
|
+
if (args.filepath && !args.file_path)
|
|
788
|
+
args.file_path = args.filepath;
|
|
789
|
+
if (args.path && !args.file_path)
|
|
790
|
+
args.file_path = args.path;
|
|
791
|
+
if (args.dirpath && !args.dir_path)
|
|
792
|
+
args.dir_path = args.dirpath;
|
|
793
|
+
}
|
|
786
794
|
}
|
|
787
795
|
catch { }
|
|
788
796
|
// Render tool execution card
|
package/dist/tools.js
CHANGED
|
@@ -423,15 +423,22 @@ export async function patch_file({ file_path, target_code, replacement_code }) {
|
|
|
423
423
|
}
|
|
424
424
|
const targetPath = normalizeFilePath(file_path);
|
|
425
425
|
const content = await fs.readFile(targetPath, "utf-8");
|
|
426
|
-
|
|
426
|
+
// Normalize all line endings to LF (\n) for comparison and patching
|
|
427
|
+
const normalizedContent = content.replace(/\r\n/g, "\n");
|
|
428
|
+
const normalizedTarget = target_code.replace(/\r\n/g, "\n");
|
|
429
|
+
const normalizedReplacement = replacement_code.replace(/\r\n/g, "\n");
|
|
430
|
+
if (!normalizedContent.includes(normalizedTarget)) {
|
|
427
431
|
return `ERROR: Target code not found in file ${file_path}. Please verify target content.`;
|
|
428
432
|
}
|
|
429
|
-
const occurrences =
|
|
433
|
+
const occurrences = normalizedContent.split(normalizedTarget).length - 1;
|
|
430
434
|
if (occurrences > 1) {
|
|
431
435
|
return `ERROR: Target code matches ${occurrences} times in file ${file_path}. Please provide more unique context to target the exact edit.`;
|
|
432
436
|
}
|
|
433
|
-
const
|
|
434
|
-
|
|
437
|
+
const newNormalizedContent = normalizedContent.replace(normalizedTarget, normalizedReplacement);
|
|
438
|
+
// Restore original CRLF line endings if the original file had them
|
|
439
|
+
const hasCrlf = content.includes("\r\n");
|
|
440
|
+
const finalContent = hasCrlf ? newNormalizedContent.replace(/\n/g, "\r\n") : newNormalizedContent;
|
|
441
|
+
await fs.writeFile(targetPath, finalContent, "utf-8");
|
|
435
442
|
return `✓ Patched file ${file_path} successfully.`;
|
|
436
443
|
}
|
|
437
444
|
catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "coder-agent",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "CLI coding agent powered by Google Gemini",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"start": "tsx src/index.ts",
|
|
28
28
|
"dev": "tsx watch src/index.ts",
|
|
29
|
-
"build": "tsc && node -e \"const fs = require('fs'); const f = 'dist/index.js'; let c = fs.readFileSync(f, 'utf8'); if (!c.startsWith('#!/usr/bin/env node')) c = '#!/usr/bin/env node\\n' + c; fs.writeFileSync(f, c.replace(/\\r\\n/g, '\\n'), 'utf8')\"",
|
|
29
|
+
"build": "tsc && node -e \"const fs = require('fs'); const f = 'dist/index.js'; let c = fs.readFileSync(f, 'utf8'); if (!c.startsWith('#!/usr/bin/env node')) c = '#!/usr/bin/env node\\n' + c; fs.writeFileSync(f, c.replace(/\\r\\n/g, '\\n'), 'utf8'); if (process.platform !== 'win32') fs.chmodSync(f, '755')\"",
|
|
30
30
|
"prepublishOnly": "npm run build",
|
|
31
31
|
"start:build": "node dist/index.js"
|
|
32
32
|
},
|