From a6d70f3d14bbe5e58fa8e2254b18cf5586fe2b56 Mon Sep 17 00:00:00 2001 From: tanyar09 Date: Wed, 4 Mar 2026 15:03:18 -0500 Subject: [PATCH] :more instructions for git commit --- nanobot/agent/tools/shell.py | 9 ++++++++- workspace/AGENTS.md | 20 ++++++++++++++++++++ workspace/TOOLS.md | 8 ++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/nanobot/agent/tools/shell.py b/nanobot/agent/tools/shell.py index 9c079a1..9540c05 100644 --- a/nanobot/agent/tools/shell.py +++ b/nanobot/agent/tools/shell.py @@ -46,6 +46,7 @@ class ExecTool(Tool): IMPORTANT: - For READING files (including PDFs, text files, etc.), ALWAYS use read_file FIRST. Do NOT use exec to read files. - Only use exec for complex data processing AFTER you have already read the file content using read_file. +- For git commands (git commit, git push, git status, etc.), ALWAYS use exec tool, NOT write_file or edit_file. For data analysis tasks (Excel, CSV, JSON files), use Python with pandas: - Excel files: python3 -c "import pandas as pd; df = pd.read_excel('file.xlsx'); result = df['Column Name'].sum(); print(result)" @@ -53,7 +54,13 @@ For data analysis tasks (Excel, CSV, JSON files), use Python with pandas: - NEVER use pandas/openpyxl as command-line tools (they don't exist) - NEVER use non-existent tools like csvcalc, xlsxcalc, etc. - For calculations: Use pandas operations like .sum(), .mean(), .max(), etc. -- For total inventory value: (df['Unit Price'] * df['Quantity']).sum()""" +- For total inventory value: (df['Unit Price'] * df['Quantity']).sum() + +For git operations: +- git commit: exec(command="git commit -m 'message'") +- git status: exec(command="git status") +- git push: exec(command="git push") +- NEVER use write_file or edit_file for git commands""" @property def parameters(self) -> dict[str, Any]: diff --git a/workspace/AGENTS.md b/workspace/AGENTS.md index ad6e77b..3510b60 100644 --- a/workspace/AGENTS.md +++ b/workspace/AGENTS.md @@ -37,6 +37,26 @@ curl -H "Authorization: token $NANOBOT_GITLE_TOKEN" "http://10.0.30.169:3000/api - Use tools to help accomplish tasks - Remember important information in your memory files +## Git Operations + +**CRITICAL**: When user asks to commit, push, or perform git operations: +- **ALWAYS use the `exec` tool** to run git commands +- **NEVER use `write_file` or `edit_file`** for git commands +- Git commands are shell commands and must be executed, not written to files + +**Examples:** +- User: "commit with message 'Fix bug'" → `exec(command="git commit -m 'Fix bug'")` +- User: "commit the staged files" → `exec(command="git commit -m 'your message here'")` +- User: "push to remote" → `exec(command="git push")` +- User: "check git status" → `exec(command="git status")` + +**WRONG (will not work):** +- `write_file(path="git commit -m 'message'", content="...")` ❌ +- `edit_file(path="git commit", ...)` ❌ + +**CORRECT:** +- `exec(command="git commit -m 'Fix HTTPS to HTTP conversion for Gitea API'")` ✅ + ## When NOT to Use Tools **For simple acknowledgments, respond naturally and conversationally - no tools needed.** diff --git a/workspace/TOOLS.md b/workspace/TOOLS.md index 103c042..926e030 100644 --- a/workspace/TOOLS.md +++ b/workspace/TOOLS.md @@ -42,6 +42,14 @@ exec(command: str, working_dir: str = None) -> str - Output is truncated at 10,000 characters - Optional `restrictToWorkspace` config to limit paths +**Git Commands:** +- **ALWAYS use exec for git commands** (git commit, git push, git status, etc.) +- **NEVER use write_file or edit_file for git commands** +- Examples: + - `exec(command="git commit -m 'Fix bug'")` + - `exec(command="git status")` + - `exec(command="git push")` + ## Web Access ### web_search