Skip to content

fix: allow Git write operations through bash tool - #181

Open
teddyli18000 wants to merge 3 commits into
Waishnav:mainfrom
teddyli18000:fix/bash-git-write-guidance
Open

fix: allow Git write operations through bash tool#181
teddyli18000 wants to merge 3 commits into
Waishnav:mainfrom
teddyli18000:fix/bash-git-write-guidance

Conversation

@teddyli18000

@teddyli18000 teddyli18000 commented Aug 10, 2026

Copy link
Copy Markdown

DevSpace's Bash tool can execute Git write operations, but the model-facing description frames Git usage as inspection-only and broadly forbids file modifications. MCP hosts can therefore reject git add, git commit, git fetch, git pull, and git push before DevSpace receives a tool call.

This change makes the existing capability explicit in the Bash descriptor, command schema, and server instructions while preserving the guidance against using shell redirection or generated scripts to edit project source files. The allowed Git writes are limited to git add, git commit, git fetch, git pull, and git push; destructive commands such as git reset --hard, git clean, git checkout --, and branch deletion remain explicitly unauthorized. The user workflow documentation now reflects the same boundary.

The MCP server regression test exercises both full and minimal tool modes through listTools() and the initialization instructions, including negative assertions for destructive Git commands. The focused server test, full test suite, typecheck, production build, Windows doctor, and git diff --check all pass.

Fixes #149

Summary by CodeRabbit

  • Documentation

    • Clarified shell guidance for Git operations, including permitted staging, committing, fetching, pulling, and pushing.
    • Documented restrictions on destructive Git commands and shell-based project-file modifications.
    • Clarified differences between minimal and full tool modes.
  • Tests

    • Added coverage verifying Git permissions and source-file modification restrictions across tool modes.
    • Confirmed outdated shell guidance is no longer presented.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 15073017-ad79-40ae-a8e9-e862000a821b

📥 Commits

Reviewing files that changed from the base of the PR and between a6b487c and e1a1de9.

📒 Files selected for processing (1)
  • docs/chatgpt-coding-workflow.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/chatgpt-coding-workflow.md

📝 Walkthrough

Walkthrough

The PR updates shell guidance to allow selected Git operations, prohibit destructive Git commands, and restrict project source-file changes to edit/write tools. Tests validate the policy in full and minimal tool modes, and documentation reflects the same rules.

Changes

Shell guidance and validation

Layer / File(s) Summary
Shell permission policy
src/server.ts, docs/chatgpt-coding-workflow.md
General and Bash-specific guidance now permits selected Git operations, prohibits destructive Git commands, and restricts project source-file changes through shell commands.
Tool-mode test coverage
src/server.test.ts
Tests validate the updated guidance in full and minimal tool modes. The fixture now accepts an optional toolMode and defaults to full mode.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

A rabbit checks the Git commands,
With careful paws and ears held high.
“Push and commit,” the shell now says,
“But destructive steps must pass by.”
Tests watch both tool modes glow.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the primary change: allowing Git write operations through the Bash tool.
Linked Issues check ✅ Passed The changes satisfy issue #149 by updating both tool modes and command guidance while preserving runtime behavior.
Out of Scope Changes check ✅ Passed The documentation, server guidance, and regression tests are directly related to the linked issue objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown

Greptile Summary

This follow-up narrows Bash’s Git-write exception to five named routine operations while explicitly withholding authorization for destructive Git commands.

  • Aligns full and minimal Bash descriptors, command schema guidance, server instructions, and workflow documentation.
  • Adds regression coverage for both the allowed operations and destructive-command boundary.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/server.ts Replaces the blanket Git exception with an explicit allowlist and clearly excludes destructive commands, resolving the previous finding.
src/server.test.ts Verifies the allowlist and destructive-command warning across full and minimal tool modes, command schemas, and initialization instructions.
docs/chatgpt-coding-workflow.md Documents the same bounded Git-write policy exposed by the server.

Reviews (2): Last reviewed commit: "fix: narrow Git write guidance" | Re-trigger Greptile

Comment thread src/server.ts Outdated
@teddyli18000
teddyli18000 marked this pull request as ready for review August 10, 2026 14:16
Copilot AI lite review requested due to automatic review settings August 10, 2026 14:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/chatgpt-coding-workflow.md`:
- Around line 206-210: Update the Git/source-write guidance in the documented
workflow to use a hard prohibition, matching the server instruction and Bash
descriptions. State that all shell commands that create or modify project source
files are prohibited outside explicitly allowed Git operations, and keep the
same comprehensive wording and examples across both policy surfaces, including
cp, mv, python -c, and other omitted writers.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 185213b0-e50a-463c-a7d4-16bfebc6332b

📥 Commits

Reviewing files that changed from the base of the PR and between 1def8ce and a6b487c.

📒 Files selected for processing (3)
  • docs/chatgpt-coding-workflow.md
  • src/server.test.ts
  • src/server.ts

Comment thread docs/chatgpt-coding-workflow.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bash tool description in v1.0.6 limits MCP hosts to git read-only, breaking git commit / push workflows

2 participants