Skip to content

Commit 1d4d1b6

Browse files
committed
Fixes wcgw_local command. Logging version in mcp log file. Update readme with tools description
1 parent 93d3f5c commit 1d4d1b6

File tree

3 files changed

+58
-18
lines changed

3 files changed

+58
-18
lines changed

README.md

Lines changed: 53 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Shell and Coding agent for Claude and Chatgpt
2+
23
Empowering chat applications to code, build and run on your local machine.
34

45
- Claude - An MCP server on claude desktop for autonomous shell and coding agent. (mac only)
56
- Chatgpt - Allows custom gpt to talk to your shell via a relay server. (linux or mac)
67

7-
88
⚠️ Warning: do not allow BashCommand tool without reviewing the command, it may result in data loss.
99

1010
[![Tests](https://github.com/rusiaaman/wcgw/actions/workflows/python-tests.yml/badge.svg?branch=main)](https://github.com/rusiaaman/wcgw/actions/workflows/python-tests.yml)
@@ -14,13 +14,14 @@ Empowering chat applications to code, build and run on your local machine.
1414
[![smithery badge](https://smithery.ai/badge/wcgw)](https://smithery.ai/server/wcgw)
1515

1616
## Updates
17-
- [15 Jan 2025] Modes introduced: architect, code-writer, and all powerful wcgw mode.
17+
18+
- [15 Jan 2025] Modes introduced: architect, code-writer, and all powerful wcgw mode.
1819

1920
- [8 Jan 2025] Context saving tool for saving relevant file paths along with a description in a single file. Can be used as a task checkpoint or for knowledge transfer.
2021

2122
- [29 Dec 2024] Syntax checking on file writing and edits is now stable. Made `initialize` tool call useful; sending smart repo structure to claude if any repo is referenced. Large file handling is also now improved.
2223

23-
- [9 Dec 2024] [Vscode extension to paste context on Claude app](https://marketplace.visualstudio.com/items?itemName=AmanRusia.wcgw)
24+
- [9 Dec 2024] [Vscode extension to paste context on Claude app](https://marketplace.visualstudio.com/items?itemName=AmanRusia.wcgw)
2425

2526
- [01 Dec 2024] Removed author hosted relay server for chatgpt.
2627

@@ -32,19 +33,19 @@ Empowering chat applications to code, build and run on your local machine.
3233
-**Large file edit**: Supports large file incremental edits to avoid token limit issues. Faster than full file write.
3334
-**Syntax checking on edits**: Reports feedback to the LLM if its edits have any syntax errors, so that it can redo it.
3435
-**Interactive Command Handling**: Supports interactive commands using arrow keys, interrupt, and ansi escape sequences.
35-
-**File protections**:
36-
- The AI needs to read a file at least once before it's allowed to edit or rewrite it. This avoids accidental overwrites.
37-
- Avoids context filling up while reading very large files. Files get chunked based on token length.
36+
-**File protections**:
37+
- The AI needs to read a file at least once before it's allowed to edit or rewrite it. This avoids accidental overwrites.
38+
- Avoids context filling up while reading very large files. Files get chunked based on token length.
3839
- On initialisation the provided workspace's directory structure is returned after selecting important files (based on .gitignore as well as a statistical approach)
3940
- File edit based on search-replace tries to find correct search block if it has multiple matches based on previous search blocks. Fails otherwise (for correctness).
4041
- File edit has spacing tolerant matching, with warning on issues like indentation mismatch. If there's no match, the closest match is returned to the AI to fix its mistakes.
4142
- Using Aider-like search and replace, which has better performance than tool call based search and replace.
42-
-**Shell optimizations**:
43+
-**Shell optimizations**:
4344
- Only one command is allowed to be run at a time, simplifying management and avoiding rogue processes. There's only single shell instance at any point of time.
44-
- Current working directory is always returned after any shell command to prevent AI from getting lost.
45+
- Current working directory is always returned after any shell command to prevent AI from getting lost.
4546
- Command polling exits after a quick timeout to avoid slow feedback. However, status checking has wait tolerance based on fresh output streaming from a command. Both of these approach combined provides a good shell interaction experience.
4647
-**Saving repo context in a single file**: Task checkpointing using "ContextSave" tool saves detailed context in a single file. Tasks can later be resumed in a new chat asking "Resume `task id`". The saved file can be used to do other kinds of knowledge transfer, such as taking help from another AI.
47-
-**Easily switch between various modes**:
48+
-**Easily switch between various modes**:
4849
- Ask it to run in 'architect' mode for planning. Inspired by adier's architect mode, work with Claude to come up with a plan first. Leads to better accuracy and prevents premature file editing.
4950
- Ask it to run in 'code-writer' mode for code editing and project building. You can provide specific paths with wild card support to prevent other files getting edited.
5051
- By default it runs in 'wcgw' mode that has no restrictions and full authorisation.
@@ -122,25 +123,29 @@ over here
122123
Then ask claude to execute shell commands, read files, edit files, run your code, etc.
123124

124125
#### Task checkpoint or knowledge transfer
126+
125127
- You can do a task checkpoint or a knowledge transfer by attaching "KnowledgeTransfer" prompt using "Attach from MCP" button.
126128
- On running "KnowledgeTransfer" prompt, the "ContextSave" tool will be called saving the task description and all file content together in a single file. An id for the task will be generated.
127129
- You can in a new chat say "Resume '<task id>'", the AI should then call "Initialize" with the task id and load the context from there.
128130
- Or you can directly open the file generated and share it with another AI for help.
129131

130132
#### Modes
133+
131134
There are three built-in modes. You may ask Claude to run in one of the modes, like "Use 'architect' mode"
132-
| **Mode** | **Description** | **Allows** | **Denies** | **Invoke prompt** |
135+
| **Mode** | **Description** | **Allows** | **Denies** | **Invoke prompt** |
133136
|-----------------|-----------------------------------------------------------------------------|---------------------------------------------------------|----------------------------------------------|----------------------------------------------------------------------------------------------------|
134-
| **Architect** | Designed for you to work with Claude to investigate and understand your repo. | Read-only commands | FileEdit and Write tool | Run in mode='architect' |
135-
| **Code-writer** | For code writing and development | Specified path globs for editing or writing, specified commands | FileEdit for paths not matching specified glob, Write for paths not matching specified glob | Run in code writer mode, only 'tests/**' allowed, only uv command allowed |
136-
| **wcgw** | Default mode with everything allowed | Everything | Nothing | No prompt, or "Run in wcgw mode" |
137+
| **Architect** | Designed for you to work with Claude to investigate and understand your repo. | Read-only commands | FileEdit and Write tool | Run in mode='architect' |
138+
| **Code-writer** | For code writing and development | Specified path globs for editing or writing, specified commands | FileEdit for paths not matching specified glob, Write for paths not matching specified glob | Run in code writer mode, only 'tests/**' allowed, only uv command allowed |
139+
| **wcgw\*\* | Default mode with everything allowed | Everything | Nothing | No prompt, or "Run in wcgw mode" |
137140

138141
Note: in code-writer mode either all commands are allowed or none are allowed for now. If you give a list of allowed commands, Claude is instructed to run only those commands, but no actual check happens. (WIP)
139142

140-
### [Optional] Vs code extension
143+
### [Optional] Vs code extension
144+
141145
https://marketplace.visualstudio.com/items?itemName=AmanRusia.wcgw
142146

143-
Commands:
147+
Commands:
148+
144149
- Select a text and press `cmd+'` and then enter instructions. This will switch the app to Claude and paste a text containing your instructions, file path, workspace dir, and the selected text.
145150

146151
## Chatgpt Setup
@@ -172,3 +177,36 @@ Then run
172177
`uvx --from wcgw@latest wcgw_local --claude`
173178

174179
You can now directly write messages or press enter key to open vim for multiline message and text pasting.
180+
181+
## Tools
182+
183+
The server provides the following MCP tools:
184+
185+
**Shell Operations:**
186+
187+
- `Initialize`: Reset shell and set up workspace environment
188+
- Parameters: `any_workspace_path` (string), `initial_files_to_read` (string[]), `mode_name` ("wcgw"|"architect"|"code_writer"), `task_id_to_resume` (string)
189+
- `BashCommand`: Execute shell commands with timeout control
190+
- Parameters: `command` (string), `wait_for_seconds` (int, optional)
191+
- `BashInteraction`: Send keyboard input to running programs
192+
- Parameters: `send_text` (string) or `send_specials` (["Enter"|"Key-up"|...]) or `send_ascii` (int[]), `wait_for_seconds` (int, optional)
193+
194+
**File Operations:**
195+
196+
- `ReadFiles`: Read content from one or more files
197+
- Parameters: `file_paths` (string[])
198+
- `WriteIfEmpty`: Create new files or write to empty files
199+
- Parameters: `file_path` (string), `file_content` (string)
200+
- `FileEdit`: Edit existing files using search/replace blocks
201+
- Parameters: `file_path` (string), `file_edit_using_search_replace_blocks` (string)
202+
- `ReadImage`: Read image files for display/processing
203+
- Parameters: `file_path` (string)
204+
205+
**Project Management:**
206+
207+
- `ContextSave`: Save project context and files for Knowledge Transfer or saving task checkpoints to be resumed later
208+
- Parameters: `id` (string), `project_root_path` (string), `description` (string), `relevant_file_globs` (string[])
209+
- `ResetShell`: Emergency reset for shell environment
210+
- Parameters: `should_reset` (boolean)
211+
212+
All tools support absolute paths and include built-in protections against common errors. See the [MCP specification](https://modelcontextprotocol.io/) for detailed protocol information.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
authors = [{ name = "Aman Rusia", email = "[email protected]" }]
33
name = "wcgw"
4-
version = "2.8.6"
4+
version = "2.8.7"
55
description = "Shell and coding agent on claude and chatgpt"
66
readme = "README.md"
77
requires-python = ">=3.11, <3.13"
@@ -35,11 +35,12 @@ requires = ["hatchling"]
3535
build-backend = "hatchling.build"
3636

3737
[tool.hatch.build.targets.wheel]
38-
packages = ["src/wcgw", "src/mcp_wcgw_fork/src/mcp_wcgw"]
38+
packages = ["src/wcgw", "src/mcp_wcgw_fork/src/mcp_wcgw", "src/wcgw_cli"]
3939

4040
[tool.hatch.build.targets.wheel.sources]
4141
"src/mcp_wcgw_fork/src/mcp_wcgw" = "mcp_wcgw"
4242
"src/wcgw" = "wcgw"
43+
"src/wcgw_cli" = "wcgw_cli"
4344

4445
[project.scripts]
4546
wcgw_local = "wcgw_cli:app"

src/wcgw/client/mcp_server/server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ async def main(computer_use: bool) -> None:
318318
if computer_use:
319319
COMPUTER_USE_ON_DOCKER_ENABLED = True
320320

321-
version = importlib.metadata.version("wcgw")
321+
version = str(importlib.metadata.version("wcgw"))
322+
tools.console.log("wcgw version: " + version)
322323
# Run the server using stdin/stdout streams
323324
async with mcp_wcgw.server.stdio.stdio_server() as (read_stream, write_stream):
324325
await server.run(

0 commit comments

Comments
 (0)