saoudrizwan / claude-dev

Autonomous coding agent right in your IDE, capable of creating/editing files, executing commands, and more with your permission every step of the way.
https://marketplace.visualstudio.com/items?itemName=saoudrizwan.claude-dev
MIT License
4.65k stars 438 forks source link

Shell Integration disruption after running pre-commit hook #276

Open ryanlukewatson opened 1 week ago

ryanlukewatson commented 1 week ago

Claude Dev Plugin: Terminal Output Reading Issue

Issue Description

The Claude Dev plugin lost the ability to read terminal output across different environments (local and GitHub Codespaces) after executing a pre-commit hook that runs a project summarization script. This issue persists even in new, clean branches and fresh Codespaces.

Key Observations

  1. The issue is specific to the Claude Dev plugin; terminal output is still visible to the user.
  2. The problem occurs in both local and GitHub Codespaces environments.
  3. The issue was triggered after running a pre-commit hook that executes a Python script.
  4. The problem persists across different sessions, branches, and newly created Codespaces.
  5. Pylance is the only other VS Code extension installed.
  6. A similar script in a different repository (express.js), also created by Claude, led to the same behavior in that development environment.

Triggering Script Details

The pre-commit hook that triggered the issue contains the following code:

#!/bin/sh

# Run the Python script to summarize the project
python3 /workspaces/credex-bot/summarize_project.py

# Add the generated summary to the commit
git add /workspaces/credex-bot/docs/code_summary.md

# Continue with the commit
exit 0

This hook runs a Python script (summarize_project.py) to generate a project summary and adds it to the commit.

Potential Causes

The issue likely stems from an internal bug in the Claude Dev plugin, possibly related to:

  1. Output buffering issues when executing external scripts
  2. Asynchronous processing problems with Git hooks
  3. State management errors after script execution
  4. Permission or security feature mishandling during Git operations
  5. Memory management issues triggered by the summarization process
  6. Interaction problems with Codespaces' terminal emulation during hook execution
  7. Version-specific bug related to handling Git hook outputs

Steps to Reproduce

  1. Set up a Git repository with the above pre-commit hook.
  2. Create or modify a file to trigger a commit.
  3. Attempt to commit the changes, which will execute the pre-commit hook.
  4. After the commit process, try to use the Claude Dev plugin to read any terminal output.
  5. Observe that the plugin cannot read the output, while it remains visible in the terminal.

Environment Details

Additional Context

Impact

This issue significantly impairs the functionality of the Claude Dev plugin, as it can no longer read terminal output after the hook execution. This limitation severely affects the plugin's usefulness in development workflows, especially in projects utilizing Git hooks for automated tasks.

ryanlukewatson commented 5 days ago

This issue occurs periodically, and then eventually seems to resolve itself. Right now it's maybe one in ten or twenty terminal outputs that I have to copypaste in.