wcgw 5.4.3__py3-none-any.whl → 5.4.5__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.

wcgw/client/tools.py CHANGED
@@ -1,5 +1,4 @@
1
1
  import base64
2
- import fnmatch
3
2
  import glob
4
3
  import json
5
4
  import mimetypes
@@ -29,6 +28,7 @@ from openai.types.chat import (
29
28
  from pydantic import BaseModel, TypeAdapter, ValidationError
30
29
  from syntax_checker import Output as SCOutput
31
30
  from syntax_checker import check_syntax as raw_check_syntax
31
+ from wcmatch import glob as wcglob
32
32
 
33
33
  from ..client.bash_state.bash_state import (
34
34
  BashState,
@@ -267,7 +267,7 @@ def initialize(
267
267
  initial_files, initial_paths_with_ranges, _ = read_files(
268
268
  read_files_, coding_max_tokens, noncoding_max_tokens, context
269
269
  )
270
- initial_files_context = f"---\n# Requested files\n{initial_files}\n---\n"
270
+ initial_files_context = f"---\n# Requested files\nHere are the contents of the requested files:\n{initial_files}\n---\n"
271
271
 
272
272
  # Check for global CLAUDE.md and workspace CLAUDE.md
273
273
  alignment_context = ""
@@ -570,8 +570,8 @@ def write_file(
570
570
 
571
571
  # Validate using write_if_empty_mode after checking whitelist
572
572
  allowed_globs = context.bash_state.write_if_empty_mode.allowed_globs
573
- if allowed_globs != "all" and not any(
574
- fnmatch.fnmatch(path_, pattern) for pattern in allowed_globs
573
+ if allowed_globs != "all" and not wcglob.globmatch(
574
+ path_, allowed_globs, flags=wcglob.GLOBSTAR
575
575
  ):
576
576
  return (
577
577
  f"Error: updating file {path_} not allowed in current mode. Doesn't match allowed globs: {allowed_globs}",
@@ -600,7 +600,7 @@ def write_file(
600
600
  return (
601
601
  (
602
602
  msg
603
- + f"Here's the existing file:\n<wcgw:file>\n{file_content_str}\n{final_message}\n</wcgw:file>"
603
+ + f"Here's the existing file:\n<file-contents-numbered>\n{file_content_str}\n{final_message}\n</file-contents-numbered>"
604
604
  ),
605
605
  {path_: file_ranges},
606
606
  )
@@ -622,7 +622,7 @@ def write_file(
622
622
  return (
623
623
  (
624
624
  msg
625
- + f"Here's the existing file:\n<wcgw:file>\n{file_content_str}\n</wcgw:file>\n{final_message}"
625
+ + f"Here's the existing file:\n<file-contents-numbered>\n{file_content_str}\n</file-contents-numbered>\n{final_message}"
626
626
  ),
627
627
  {path_: file_ranges},
628
628
  )
@@ -762,8 +762,8 @@ def _do_diff_edit(
762
762
 
763
763
  # Validate using file_edit_mode
764
764
  allowed_globs = context.bash_state.file_edit_mode.allowed_globs
765
- if allowed_globs != "all" and not any(
766
- fnmatch.fnmatch(path_, pattern) for pattern in allowed_globs
765
+ if allowed_globs != "all" and not wcglob.globmatch(
766
+ path_, allowed_globs, flags=wcglob.GLOBSTAR
767
767
  ):
768
768
  raise Exception(
769
769
  f"Error: updating file {path_} not allowed in current mode. Doesn't match allowed globs: {allowed_globs}"
@@ -1201,10 +1201,12 @@ def read_files(
1201
1201
  noncoding_max_tokens = max(0, noncoding_max_tokens - tokens)
1202
1202
 
1203
1203
  range_formatted = range_format(start_line_num, end_line_num)
1204
- message += f'\n<wcgw:file path="{file}{range_formatted}">\n{content}\n'
1204
+ message += (
1205
+ f'\n<file-contents-numbered path="{file}{range_formatted}">\n{content}\n'
1206
+ )
1205
1207
 
1206
1208
  if not truncated:
1207
- message += "</wcgw:file>"
1209
+ message += "</file-contents-numbered>"
1208
1210
 
1209
1211
  # Check if we've hit both token limit
1210
1212
  if (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wcgw
3
- Version: 5.4.3
3
+ Version: 5.4.5
4
4
  Summary: Shell and coding agent for Claude and other mcp clients
5
5
  Project-URL: Homepage, https://github.com/rusiaaman/wcgw
6
6
  Author-email: Aman Rusia <gapypi@arcfu.com>
@@ -26,6 +26,7 @@ Requires-Dist: tree-sitter-bash>=0.23.3
26
26
  Requires-Dist: tree-sitter>=0.24.0
27
27
  Requires-Dist: typer>=0.12.5
28
28
  Requires-Dist: uvicorn>=0.31.0
29
+ Requires-Dist: wcmatch>=10.1
29
30
  Requires-Dist: websockets>=13.1
30
31
  Description-Content-Type: text/markdown
31
32
 
@@ -86,7 +87,7 @@ wcgw is an MCP server with tightly integrated shell and code editing tools.
86
87
  - By default it runs in 'wcgw' mode that has no restrictions and full authorisation.
87
88
  - More details in [Modes section](#modes)
88
89
  - ⚡ **Runs in multiplex terminal** Run `screen -x` to attach to the terminal that the AI runs commands on. See history or interrupt process or interact with the same terminal that AI uses.
89
- - ⚡ **Automatically load CLAUDE.md** Loads "CLAUDE.md" file in project root and sends as instructions during initialisation. Instructions in a global "~/.wcgw/CLAUDE.md" file are loaded and added along with project specific CLAUDE.md. The file name is case sensitive.
90
+ - ⚡ **Automatically load CLAUDE.md/AGENTS.md** Loads "CLAUDE.md" or "AGENTS.md" file in project root and sends as instructions during initialisation. Instructions in a global "~/.wcgw/CLAUDE.md" or "~/.wcgw/AGENTS.md" file are loaded and added along with project specific CLAUDE.md. The file name is case sensitive. CLAUDE.md is attached if it's present otherwise AGENTS.md is attached.
90
91
 
91
92
  ## Top use cases examples
92
93
 
@@ -118,7 +119,7 @@ Then create or update `claude_desktop_config.json` (~/Library/Application Suppor
118
119
  "mcpServers": {
119
120
  "wcgw": {
120
121
  "command": "uv",
121
- "args": ["tool", "run", "--python", "3.12", "wcgw@latest"]
122
+ "args": ["tool", "run", "--python", "3.12", "wcgw"]
122
123
  }
123
124
  }
124
125
  }
@@ -129,10 +130,10 @@ Then restart claude app.
129
130
  _If there's an error in setting up_
130
131
 
131
132
  - If there's an error like "uv ENOENT", make sure `uv` is installed. Then run 'which uv' in the terminal, and use its output in place of "uv" in the configuration.
132
- - If there's still an issue, check that `uv tool run --python 3.12 wcgw@latest` runs in your terminal. It should have no output and shouldn't exit.
133
+ - If there's still an issue, check that `uv tool run --python 3.12 wcgw` runs in your terminal. It should have no output and shouldn't exit.
133
134
  - Try removing ~/.cache/uv folder
134
135
  - Try using `uv` version `0.6.0` for which this tool was tested.
135
- - Debug the mcp server using `npx @modelcontextprotocol/inspector@0.1.7 uv tool run --python 3.12 wcgw@latest`
136
+ - Debug the mcp server using `npx @modelcontextprotocol/inspector@0.1.7 uv tool run --python 3.12 wcgw`
136
137
 
137
138
  ### Windows on wsl
138
139
 
@@ -147,12 +148,12 @@ Then add or update the claude config file `%APPDATA%\Claude\claude_desktop_confi
147
148
  "mcpServers": {
148
149
  "wcgw": {
149
150
  "command": "wsl.exe",
150
- "args": ["uv", "tool", "run", "--python", "3.12", "wcgw@latest"]
151
+ "args": ["uv", "tool", "run", "--python", "3.12", "wcgw"]
151
152
  }
152
153
  }
153
154
  }
154
155
  ```
155
- When you encounter an error, execute the command wsl uv --python 3.12 wcgw@latest in command prompt. If you get the `error /bin/bash: line 1: uv: command not found`, it means uv was not installed globally and you need to point to the correct path of uv.
156
+ When you encounter an error, execute the command wsl uv --python 3.12 wcgw in command prompt. If you get the `error /bin/bash: line 1: uv: command not found`, it means uv was not installed globally and you need to point to the correct path of uv.
156
157
  1. Find where uv is installed:
157
158
  ```bash
158
159
  whereis uv
@@ -162,7 +163,7 @@ Example output:
162
163
 
163
164
  2. Test the full path works:
164
165
  ```
165
- wsl /home/mywsl/.local/bin/uv tool run --python 3.12 wcgw@latest
166
+ wsl /home/mywsl/.local/bin/uv tool run --python 3.12 wcgw
166
167
  ```
167
168
 
168
169
  3. Update the config with the full path:
@@ -171,7 +172,7 @@ wsl /home/mywsl/.local/bin/uv tool run --python 3.12 wcgw@latest
171
172
  "mcpServers": {
172
173
  "wcgw": {
173
174
  "command": "wsl.exe",
174
- "args": ["/home/mywsl/.local/bin/uv", "tool", "run", "--python", "3.12", "wcgw@latest"]
175
+ "args": ["/home/mywsl/.local/bin/uv", "tool", "run", "--python", "3.12", "wcgw"]
175
176
  }
176
177
  }
177
178
  }
@@ -223,6 +224,12 @@ You can interact with the terminal but beware that the AI might be running in pa
223
224
 
224
225
  You shouldn't exit the session using `exit `or Ctrl-d, instead you should use `ctrl+a+d` to safely detach without destroying the screen session.
225
226
 
227
+ Include the following in ~/.screenrc for better scrolling experience
228
+ ```
229
+ defscrollback 10000
230
+ termcapinfo xterm* ti@:te@
231
+ ```
232
+
226
233
  ### [Optional] Vs code extension
227
234
 
228
235
  https://marketplace.visualstudio.com/items?itemName=AmanRusia.wcgw
@@ -267,7 +274,7 @@ Add `OPENAI_API_KEY` and `OPENAI_ORG_ID` env variables.
267
274
 
268
275
  Then run
269
276
 
270
- `uvx wcgw@latest wcgw_local --limit 0.1` # Cost limit $0.1
277
+ `uvx wcgw wcgw_local --limit 0.1` # Cost limit $0.1
271
278
 
272
279
  You can now directly write messages or press enter key to open vim for multiline message and text pasting.
273
280
 
@@ -277,7 +284,7 @@ Add `ANTHROPIC_API_KEY` env variable.
277
284
 
278
285
  Then run
279
286
 
280
- `uvx wcgw@latest wcgw_local --claude`
287
+ `uvx wcgw wcgw_local --claude`
281
288
 
282
289
  You can now directly write messages or press enter key to open vim for multiline message and text pasting.
283
290
 
@@ -8,7 +8,7 @@ wcgw/client/memory.py,sha256=U2Nw2si3Zg7n_RhNAuaYcmrrDtZ_Mooi-kfAOKflT-I,3079
8
8
  wcgw/client/modes.py,sha256=roH6SPBokJMr5IzAlccdI-vJyvyS5vqSMMyth7TE86A,10315
9
9
  wcgw/client/schema_generator.py,sha256=mEIy6BgHlfJeAjJtwY_VwoIDmu-Fax2H9bVtj7IMuEo,2282
10
10
  wcgw/client/tool_prompts.py,sha256=1EFQZeXlebOvrDb9t4g63FyzRWCnTwDzwrqwPHg-7sE,4757
11
- wcgw/client/tools.py,sha256=GrJ9bXAkayd4bgKFdRXJ1wtdUmeE5dD7l2ef-dMOjZQ,49877
11
+ wcgw/client/tools.py,sha256=J_Ofbs7jBQXLfS4x9d7gZtTxNiaVbAmc0puCiyum9Ls,50038
12
12
  wcgw/client/bash_state/bash_state.py,sha256=bd5RtLbaRzCtrmeDTl3JKZwzmIR-8iAMQpl7Fqyt56M,41918
13
13
  wcgw/client/bash_state/parser/__init__.py,sha256=AnlNSmoQTSoqqlLOLX4P1uXfzc5VGeCGJsGgtisq2zE,207
14
14
  wcgw/client/bash_state/parser/bash_statement_parser.py,sha256=9a8vPO1r3_tXmaAcubTQ5UY-NseWlalgm8LZA17LXuY,6058
@@ -31,8 +31,8 @@ wcgw_cli/anthropic_client.py,sha256=8bjDY59-aioyTJgpB-NBHZNhZaq6rqcTJcOf81kzCyA,
31
31
  wcgw_cli/cli.py,sha256=-7FBe_lahKyUOhf65iurTA1M1gXXXAiT0OVKQVcZKKo,948
32
32
  wcgw_cli/openai_client.py,sha256=GOqoSFazTV-cFjpdZGPM0DIwec8Up2TEcKUbsN40AGY,15990
33
33
  wcgw_cli/openai_utils.py,sha256=xGOb3W5ALrIozV7oszfGYztpj0FnXdD7jAxm5lEIVKY,2439
34
- wcgw-5.4.3.dist-info/METADATA,sha256=fNaQqNspbdo8tWK0-dVsYeaFr6i3kPdNffHoHn-JYss,15679
35
- wcgw-5.4.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
36
- wcgw-5.4.3.dist-info/entry_points.txt,sha256=UnjK-MAH4Qssh0tGJDMeij1oi-oRKokItkknP_BwShE,94
37
- wcgw-5.4.3.dist-info/licenses/LICENSE,sha256=BvY8xqjOfc3X2qZpGpX3MZEmF-4Dp0LqgKBbT6L_8oI,11142
38
- wcgw-5.4.3.dist-info/RECORD,,
34
+ wcgw-5.4.5.dist-info/METADATA,sha256=xyfj7lO9bVE6gJ8EKwkCHMwjkkZMQtRmojieBYyQ6y4,15888
35
+ wcgw-5.4.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
36
+ wcgw-5.4.5.dist-info/entry_points.txt,sha256=UnjK-MAH4Qssh0tGJDMeij1oi-oRKokItkknP_BwShE,94
37
+ wcgw-5.4.5.dist-info/licenses/LICENSE,sha256=BvY8xqjOfc3X2qZpGpX3MZEmF-4Dp0LqgKBbT6L_8oI,11142
38
+ wcgw-5.4.5.dist-info/RECORD,,
File without changes