wcgw 2.8.6__py3-none-any.whl → 2.8.9__py3-none-any.whl

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.

Potentially problematic release.


This version of wcgw might be problematic. Click here for more details.

@@ -318,7 +318,8 @@ async def main(computer_use: bool) -> None:
318
318
  if computer_use:
319
319
  COMPUTER_USE_ON_DOCKER_ENABLED = True
320
320
 
321
- version = importlib.metadata.version("wcgw")
321
+ version = str(importlib.metadata.version("wcgw"))
322
+ tools.console.log("wcgw version: " + version)
322
323
  # Run the server using stdin/stdout streams
323
324
  async with mcp_wcgw.server.stdio.stdio_server() as (read_stream, write_stream):
324
325
  await server.run(
wcgw/client/tools.py CHANGED
@@ -146,6 +146,7 @@ def start_shell(is_restricted_mode: bool, initial_dir: str) -> pexpect.spawn: #
146
146
  encoding="utf-8",
147
147
  timeout=TIMEOUT,
148
148
  cwd=initial_dir,
149
+ codec_errors="backslashreplace",
149
150
  )
150
151
  shell.sendline(
151
152
  f"export PROMPT_COMMAND= PS1={PROMPT_CONST}"
@@ -161,6 +162,7 @@ def start_shell(is_restricted_mode: bool, initial_dir: str) -> pexpect.spawn: #
161
162
  echo=False,
162
163
  encoding="utf-8",
163
164
  timeout=TIMEOUT,
165
+ codec_errors="backslashreplace",
164
166
  )
165
167
  shell.sendline(f"export PS1={PROMPT_CONST}")
166
168
  shell.expect(PROMPT_CONST, timeout=TIMEOUT)
@@ -256,7 +258,9 @@ class BashState:
256
258
  before = "\n".join(before_lines).strip()
257
259
  counts += 1
258
260
  if counts > 100:
259
- raise ValueError("Error in understanding shell output. This shouldn't happen, likely shell is in a bad state, please reset it")
261
+ raise ValueError(
262
+ "Error in understanding shell output. This shouldn't happen, likely shell is in a bad state, please reset it"
263
+ )
260
264
 
261
265
  try:
262
266
  return int(before)
@@ -273,7 +277,7 @@ class BashState:
273
277
  self._bash_command_mode.bash_mode == "restricted_mode",
274
278
  self._cwd,
275
279
  )
276
-
280
+
277
281
  self._pending_output = ""
278
282
 
279
283
  # Get exit info to ensure shell is ready
@@ -414,7 +418,9 @@ class BashState:
414
418
  index = self.shell.expect([self._prompt, pexpect.TIMEOUT], timeout=0.2)
415
419
  counts += 1
416
420
  if counts > 100:
417
- raise ValueError("Error in understanding shell output. This shouldn't happen, likely shell is in a bad state, please reset it")
421
+ raise ValueError(
422
+ "Error in understanding shell output. This shouldn't happen, likely shell is in a bad state, please reset it"
423
+ )
418
424
  console.print(f"Prompt updated to: {self._prompt}")
419
425
  return True
420
426
  return False
@@ -457,6 +463,12 @@ def initialize(
457
463
  folder_to_start = None
458
464
  if any_workspace_path:
459
465
  if os.path.exists(any_workspace_path):
466
+ if os.path.isfile(any_workspace_path):
467
+ # Set any_workspace_path to the directory containing the file
468
+ # Add the file to read_files_ only if empty to avoid duplicates
469
+ if not read_files_:
470
+ read_files_ = [any_workspace_path]
471
+ any_workspace_path = os.path.dirname(any_workspace_path)
460
472
  repo_context, folder_to_start = get_repo_context(any_workspace_path, 200)
461
473
 
462
474
  repo_context = f"---\n# Workspace structure\n{repo_context}\n---\n"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wcgw
3
- Version: 2.8.6
3
+ Version: 2.8.9
4
4
  Summary: Shell and coding agent on claude and chatgpt
5
5
  Project-URL: Homepage, https://github.com/rusiaaman/wcgw
6
6
  Author-email: Aman Rusia <gapypi@arcfu.com>
@@ -28,12 +28,12 @@ Requires-Dist: websockets>=13.1
28
28
  Description-Content-Type: text/markdown
29
29
 
30
30
  # Shell and Coding agent for Claude and Chatgpt
31
+
31
32
  Empowering chat applications to code, build and run on your local machine.
32
33
 
33
34
  - Claude - An MCP server on claude desktop for autonomous shell and coding agent. (mac only)
34
35
  - Chatgpt - Allows custom gpt to talk to your shell via a relay server. (linux or mac)
35
36
 
36
-
37
37
  ⚠️ Warning: do not allow BashCommand tool without reviewing the command, it may result in data loss.
38
38
 
39
39
  [![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)
@@ -43,13 +43,14 @@ Empowering chat applications to code, build and run on your local machine.
43
43
  [![smithery badge](https://smithery.ai/badge/wcgw)](https://smithery.ai/server/wcgw)
44
44
 
45
45
  ## Updates
46
- - [15 Jan 2025] Modes introduced: architect, code-writer, and all powerful wcgw mode.
46
+
47
+ - [15 Jan 2025] Modes introduced: architect, code-writer, and all powerful wcgw mode.
47
48
 
48
49
  - [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.
49
50
 
50
51
  - [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.
51
52
 
52
- - [9 Dec 2024] [Vscode extension to paste context on Claude app](https://marketplace.visualstudio.com/items?itemName=AmanRusia.wcgw)
53
+ - [9 Dec 2024] [Vscode extension to paste context on Claude app](https://marketplace.visualstudio.com/items?itemName=AmanRusia.wcgw)
53
54
 
54
55
  - [01 Dec 2024] Removed author hosted relay server for chatgpt.
55
56
 
@@ -61,19 +62,19 @@ Empowering chat applications to code, build and run on your local machine.
61
62
  - ⚡ **Large file edit**: Supports large file incremental edits to avoid token limit issues. Faster than full file write.
62
63
  - ⚡ **Syntax checking on edits**: Reports feedback to the LLM if its edits have any syntax errors, so that it can redo it.
63
64
  - ⚡ **Interactive Command Handling**: Supports interactive commands using arrow keys, interrupt, and ansi escape sequences.
64
- - ⚡ **File protections**:
65
- - The AI needs to read a file at least once before it's allowed to edit or rewrite it. This avoids accidental overwrites.
66
- - Avoids context filling up while reading very large files. Files get chunked based on token length.
65
+ - ⚡ **File protections**:
66
+ - The AI needs to read a file at least once before it's allowed to edit or rewrite it. This avoids accidental overwrites.
67
+ - Avoids context filling up while reading very large files. Files get chunked based on token length.
67
68
  - On initialisation the provided workspace's directory structure is returned after selecting important files (based on .gitignore as well as a statistical approach)
68
69
  - 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).
69
70
  - 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.
70
71
  - Using Aider-like search and replace, which has better performance than tool call based search and replace.
71
- - ⚡ **Shell optimizations**:
72
+ - ⚡ **Shell optimizations**:
72
73
  - 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.
73
- - Current working directory is always returned after any shell command to prevent AI from getting lost.
74
+ - Current working directory is always returned after any shell command to prevent AI from getting lost.
74
75
  - 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.
75
76
  - ⚡ **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.
76
- - ⚡ **Easily switch between various modes**:
77
+ - ⚡ **Easily switch between various modes**:
77
78
  - 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.
78
79
  - 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.
79
80
  - By default it runs in 'wcgw' mode that has no restrictions and full authorisation.
@@ -151,25 +152,29 @@ over here
151
152
  Then ask claude to execute shell commands, read files, edit files, run your code, etc.
152
153
 
153
154
  #### Task checkpoint or knowledge transfer
155
+
154
156
  - You can do a task checkpoint or a knowledge transfer by attaching "KnowledgeTransfer" prompt using "Attach from MCP" button.
155
157
  - 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.
156
158
  - 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.
157
159
  - Or you can directly open the file generated and share it with another AI for help.
158
160
 
159
161
  #### Modes
162
+
160
163
  There are three built-in modes. You may ask Claude to run in one of the modes, like "Use 'architect' mode"
161
- | **Mode** | **Description** | **Allows** | **Denies** | **Invoke prompt** |
164
+ | **Mode** | **Description** | **Allows** | **Denies** | **Invoke prompt** |
162
165
  |-----------------|-----------------------------------------------------------------------------|---------------------------------------------------------|----------------------------------------------|----------------------------------------------------------------------------------------------------|
163
- | **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' |
164
- | **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 |
165
- | **wcgw** | Default mode with everything allowed | Everything | Nothing | No prompt, or "Run in wcgw mode" |
166
+ | **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' |
167
+ | **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 |
168
+ | **wcgw\*\* | Default mode with everything allowed | Everything | Nothing | No prompt, or "Run in wcgw mode" |
166
169
 
167
170
  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)
168
171
 
169
- ### [Optional] Vs code extension
172
+ ### [Optional] Vs code extension
173
+
170
174
  https://marketplace.visualstudio.com/items?itemName=AmanRusia.wcgw
171
175
 
172
- Commands:
176
+ Commands:
177
+
173
178
  - 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.
174
179
 
175
180
  ## Chatgpt Setup
@@ -201,3 +206,36 @@ Then run
201
206
  `uvx --from wcgw@latest wcgw_local --claude`
202
207
 
203
208
  You can now directly write messages or press enter key to open vim for multiline message and text pasting.
209
+
210
+ ## Tools
211
+
212
+ The server provides the following MCP tools:
213
+
214
+ **Shell Operations:**
215
+
216
+ - `Initialize`: Reset shell and set up workspace environment
217
+ - Parameters: `any_workspace_path` (string), `initial_files_to_read` (string[]), `mode_name` ("wcgw"|"architect"|"code_writer"), `task_id_to_resume` (string)
218
+ - `BashCommand`: Execute shell commands with timeout control
219
+ - Parameters: `command` (string), `wait_for_seconds` (int, optional)
220
+ - `BashInteraction`: Send keyboard input to running programs
221
+ - Parameters: `send_text` (string) or `send_specials` (["Enter"|"Key-up"|...]) or `send_ascii` (int[]), `wait_for_seconds` (int, optional)
222
+
223
+ **File Operations:**
224
+
225
+ - `ReadFiles`: Read content from one or more files
226
+ - Parameters: `file_paths` (string[])
227
+ - `WriteIfEmpty`: Create new files or write to empty files
228
+ - Parameters: `file_path` (string), `file_content` (string)
229
+ - `FileEdit`: Edit existing files using search/replace blocks
230
+ - Parameters: `file_path` (string), `file_edit_using_search_replace_blocks` (string)
231
+ - `ReadImage`: Read image files for display/processing
232
+ - Parameters: `file_path` (string)
233
+
234
+ **Project Management:**
235
+
236
+ - `ContextSave`: Save project context and files for Knowledge Transfer or saving task checkpoints to be resumed later
237
+ - Parameters: `id` (string), `project_root_path` (string), `description` (string), `relevant_file_globs` (string[])
238
+ - `ResetShell`: Emergency reset for shell environment
239
+ - Parameters: `should_reset` (boolean)
240
+
241
+ All tools support absolute paths and include built-in protections against common errors. See the [MCP specification](https://modelcontextprotocol.io/) for detailed protocol information.
@@ -7,12 +7,12 @@ wcgw/client/diff-instructions.txt,sha256=tmJ9Fu9XdO_72lYXQQNY9RZyx91bjxrXJf9d_KB
7
7
  wcgw/client/memory.py,sha256=8LdYsOhvCOoC1kfvDr85kNy07WnhPMvE6B2FRM2w85Y,2902
8
8
  wcgw/client/modes.py,sha256=FkDJIgjKrlJEufLq3abWfqV25BdF2pH-HnoHafy9LrA,10484
9
9
  wcgw/client/sys_utils.py,sha256=GajPntKhaTUMn6EOmopENWZNR2G_BJyuVbuot0x6veI,1376
10
- wcgw/client/tools.py,sha256=ndIvlJlULCxqRlks9cfDJK8JqMK0Ry85Mt4kZQ0IZhQ,52216
10
+ wcgw/client/tools.py,sha256=xgLsgkWZ5qRiLpdyF_1oKIJGy-tj9_WmJQW30-6KhhQ,52759
11
11
  wcgw/client/file_ops/diff_edit.py,sha256=OlJCpPSE_3T41q9H0yDORm6trjm3w6zh1EkuPTxik2A,16832
12
12
  wcgw/client/file_ops/search_replace.py,sha256=Napa7IWaYPGMNdttunKyRDkb90elZE7r23B_o_htRxo,5585
13
13
  wcgw/client/mcp_server/Readme.md,sha256=I8N4dHkTUVGNQ63BQkBMBhCCBTgqGOSF_pUR6iOEiUk,2495
14
14
  wcgw/client/mcp_server/__init__.py,sha256=hyPPwO9cabAJsOMWhKyat9yl7OlSmIobaoAZKHu3DMc,381
15
- wcgw/client/mcp_server/server.py,sha256=CBOS_DSDcBf5VlHQMJJbDL-wnn_DAPDvxX3dO8yodRo,13144
15
+ wcgw/client/mcp_server/server.py,sha256=zMVa2nR2hapQZAtR34POch3VLVEEnJ6SQ8iWYLDxJrU,13199
16
16
  wcgw/client/repo_ops/display_tree.py,sha256=5FD4hfMkM2cIZnXlu7WfJswJLthj0SkuHlkGH6dpWQU,4632
17
17
  wcgw/client/repo_ops/path_prob.py,sha256=SWf0CDn37rtlsYRQ51ufSxay-heaQoVIhr1alB9tZ4M,2144
18
18
  wcgw/client/repo_ops/paths_model.vocab,sha256=M1pXycYDQehMXtpp-qAgU7rtzeBbCOiJo4qcYFY0kqk,315087
@@ -20,6 +20,12 @@ wcgw/client/repo_ops/paths_tokens.model,sha256=jiwwE4ae8ADKuTZISutXuM5Wfyc_FBmN5
20
20
  wcgw/client/repo_ops/repo_context.py,sha256=5NqRxBY0K-SBFXJ0Ybt7llzYOBD8pRkTpruMMJHWxv4,4336
21
21
  wcgw/relay/serve.py,sha256=Z5EwtaCAtKFBSnUw4mPYw0sze3Coc4Fa8gObRRG_bT0,9525
22
22
  wcgw/relay/static/privacy.txt,sha256=s9qBdbx2SexCpC_z33sg16TptmAwDEehMCLz4L50JLc,529
23
+ wcgw_cli/__init__.py,sha256=TNxXsTPgb52OhakIda9wTRh91cqoBqgQRx5TxjzQQFU,21
24
+ wcgw_cli/__main__.py,sha256=wcCrL4PjG51r5wVKqJhcoJPTLfHW0wNbD31DrUN0MWI,28
25
+ wcgw_cli/anthropic_client.py,sha256=ZMFHD6g6h_PAReL8tubI8LnxVeRA3hcFLGNitjt9XhQ,24047
26
+ wcgw_cli/cli.py,sha256=GEje9ZBIaD5_-HK3zxZCGYaeDF8bfFxImloOR3O66Fw,1019
27
+ wcgw_cli/openai_client.py,sha256=wp4XDf3t3W6XG5LHgr6bFckePyty24BGtsOEjOrIrk0,17955
28
+ wcgw_cli/openai_utils.py,sha256=xGOb3W5ALrIozV7oszfGYztpj0FnXdD7jAxm5lEIVKY,2439
23
29
  mcp_wcgw/__init__.py,sha256=fKCgOdN7cn7gR3YGFaGyV5Goe8A2sEyllLcsRkN0i-g,2601
24
30
  mcp_wcgw/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
31
  mcp_wcgw/types.py,sha256=Enq5vqOPaQdObK9OQuafdLuMxb5RsLQ3k_k613fK41k,30556
@@ -42,8 +48,8 @@ mcp_wcgw/shared/memory.py,sha256=dBsOghxHz8-tycdSVo9kSujbsC8xb_tYsGmuJobuZnw,281
42
48
  mcp_wcgw/shared/progress.py,sha256=ymxOsb8XO5Mhlop7fRfdbmvPodANj7oq6O4dD0iUcnw,1048
43
49
  mcp_wcgw/shared/session.py,sha256=e44a0LQOW8gwdLs9_DE9oDsxqW2U8mXG3d5KT95bn5o,10393
44
50
  mcp_wcgw/shared/version.py,sha256=d2LZii-mgsPIxpshjkXnOTUmk98i0DT4ff8VpA_kAvE,111
45
- wcgw-2.8.6.dist-info/METADATA,sha256=PnCOOeODRmn7ZBHmoQN7qjS63YXOc0Xd78i7OVSo07o,12019
46
- wcgw-2.8.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
47
- wcgw-2.8.6.dist-info/entry_points.txt,sha256=vd3tj1_Kzfp55LscJ8-6WFMM5hm9cWTfNGFCrWBnH3Q,124
48
- wcgw-2.8.6.dist-info/licenses/LICENSE,sha256=BvY8xqjOfc3X2qZpGpX3MZEmF-4Dp0LqgKBbT6L_8oI,11142
49
- wcgw-2.8.6.dist-info/RECORD,,
51
+ wcgw-2.8.9.dist-info/METADATA,sha256=5QkVxDqkY5Flyvrua5JMbLoKnbdDlXfr4UdiLAJ3Ad0,13053
52
+ wcgw-2.8.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
+ wcgw-2.8.9.dist-info/entry_points.txt,sha256=vd3tj1_Kzfp55LscJ8-6WFMM5hm9cWTfNGFCrWBnH3Q,124
54
+ wcgw-2.8.9.dist-info/licenses/LICENSE,sha256=BvY8xqjOfc3X2qZpGpX3MZEmF-4Dp0LqgKBbT6L_8oI,11142
55
+ wcgw-2.8.9.dist-info/RECORD,,
wcgw_cli/__init__.py ADDED
@@ -0,0 +1 @@
1
+ from .cli import app
wcgw_cli/__main__.py ADDED
@@ -0,0 +1,3 @@
1
+ from .cli import app
2
+
3
+ app()