wcgw 3.0.6__py3-none-any.whl → 3.0.7__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
@@ -197,7 +197,10 @@ def initialize(
197
197
  if read_files_:
198
198
  if folder_to_start:
199
199
  read_files_ = [
200
- os.path.join(folder_to_start, f) if not os.path.isabs(f) else f
200
+ # Expand the path before checking if it's absolute
201
+ os.path.join(folder_to_start, f)
202
+ if not os.path.isabs(expand_user(f))
203
+ else expand_user(f)
201
204
  for f in read_files_
202
205
  ]
203
206
  initial_files = read_files(read_files_, max_tokens, context)
@@ -364,9 +367,10 @@ def truncate_if_over(content: str, max_tokens: Optional[int]) -> str:
364
367
 
365
368
 
366
369
  def read_image_from_shell(file_path: str, context: Context) -> ImageData:
367
- # Expand the path
370
+ # Expand the path before checking if it's absolute
368
371
  file_path = expand_user(file_path)
369
372
 
373
+ # If not absolute after expansion, join with current working directory
370
374
  if not os.path.isabs(file_path):
371
375
  file_path = os.path.join(context.bash_state.cwd, file_path)
372
376
 
@@ -402,10 +406,10 @@ def write_file(
402
406
  max_tokens: Optional[int],
403
407
  context: Context,
404
408
  ) -> str:
405
- if not os.path.isabs(writefile.file_path):
409
+ # Expand the path before checking if it's absolute
410
+ path_ = expand_user(writefile.file_path)
411
+ if not os.path.isabs(path_):
406
412
  return f"Failure: file_path should be absolute path, current working directory is {context.bash_state.cwd}"
407
- else:
408
- path_ = expand_user(writefile.file_path)
409
413
 
410
414
  error_on_exist_ = (
411
415
  error_on_exist and path_ not in context.bash_state.whitelist_for_overwrite
@@ -454,6 +458,9 @@ def write_file(
454
458
  syntax_errors = check.description
455
459
 
456
460
  if syntax_errors:
461
+ if extension in {"tsx", "ts"}:
462
+ syntax_errors += "\nNote: Ignore if 'tagged template literals' are used, they may raise false positive errors in tree-sitter."
463
+
457
464
  context_for_errors = get_context_for_errors(
458
465
  check.errors, writefile.file_content, max_tokens
459
466
  )
@@ -504,12 +511,12 @@ def do_diff_edit(fedit: FileEdit, max_tokens: Optional[int], context: Context) -
504
511
  def _do_diff_edit(fedit: FileEdit, max_tokens: Optional[int], context: Context) -> str:
505
512
  context.console.log(f"Editing file: {fedit.file_path}")
506
513
 
507
- if not os.path.isabs(fedit.file_path):
514
+ # Expand the path before checking if it's absolute
515
+ path_ = expand_user(fedit.file_path)
516
+ if not os.path.isabs(path_):
508
517
  raise Exception(
509
518
  f"Failure: file_path should be absolute path, current working directory is {context.bash_state.cwd}"
510
519
  )
511
- else:
512
- path_ = expand_user(fedit.file_path)
513
520
 
514
521
  # Validate using file_edit_mode
515
522
  allowed_globs = context.bash_state.file_edit_mode.allowed_globs
@@ -550,11 +557,13 @@ def _do_diff_edit(fedit: FileEdit, max_tokens: Optional[int], context: Context)
550
557
  context_for_errors = get_context_for_errors(
551
558
  check.errors, apply_diff_to, max_tokens
552
559
  )
560
+ if extension in {"tsx", "ts"}:
561
+ syntax_errors += "\nNote: Ignore if 'tagged template literals' are used, they may raise false positive errors in tree-sitter."
553
562
 
554
563
  context.console.print(f"W: Syntax errors encountered: {syntax_errors}")
555
564
  return f"""{comments}
556
565
  ---
557
- Tree-sitter reported syntax errors, please re-read the file and fix if there are any errors.
566
+ Warning: tree-sitter reported syntax errors, please re-read the file and fix if there are any errors.
558
567
  Syntax errors:
559
568
  {syntax_errors}
560
569
 
@@ -700,9 +709,12 @@ def get_tool_output(
700
709
  context.console.print("Calling task memory tool")
701
710
  relevant_files = []
702
711
  warnings = ""
712
+ # Expand user in project root path
703
713
  arg.project_root_path = os.path.expanduser(arg.project_root_path)
704
714
  for fglob in arg.relevant_file_globs:
715
+ # Expand user in glob pattern before checking if it's absolute
705
716
  fglob = expand_user(fglob)
717
+ # If not absolute after expansion, join with project root path
706
718
  if not os.path.isabs(fglob) and arg.project_root_path:
707
719
  fglob = os.path.join(arg.project_root_path, fglob)
708
720
  globs = glob.glob(fglob, recursive=True)
@@ -796,7 +808,7 @@ def read_file(
796
808
  rest = save_out_of_context(
797
809
  default_enc.decoder(tokens[max_tokens:]), Path(file_path).suffix
798
810
  )
799
- content += f"\n(...truncated)\n---\nI've saved the continuation in a new file. Please read: `{rest}`"
811
+ content += f"\n(...truncated)\n---\nI've saved the continuation in a new file. You may want to read: `{rest}`"
800
812
  truncated = True
801
813
  return content, truncated, tokens_counts
802
814
 
wcgw/relay/serve.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import asyncio
2
+ import os
2
3
  import threading
3
4
  import time
4
5
  from importlib import metadata
@@ -281,7 +282,7 @@ async def context_save(context_save_data: ContextSaveWithUUID) -> str:
281
282
  raise fastapi.HTTPException(status_code=500, detail="Timeout error")
282
283
 
283
284
 
284
- app.mount("/static", StaticFiles(directory="static"), name="static")
285
+ app.mount("/static", StaticFiles(directory=os.path.join(os.path.dirname(__file__), "static")), name="static")
285
286
 
286
287
 
287
288
  def run() -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wcgw
3
- Version: 3.0.6
3
+ Version: 3.0.7
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>
@@ -204,6 +204,32 @@ Read here: https://github.com/rusiaaman/wcgw/blob/main/openai.md
204
204
 
205
205
  ![example](https://github.com/rusiaaman/wcgw/blob/main/static/example.jpg?raw=true)
206
206
 
207
+
208
+ ## Using mcp server over docker
209
+
210
+ First build the docker image `docker build -t wcgw https://github.com/rusiaaman/wcgw.git`
211
+
212
+ Then you can update `/Users/username/Library/Application Support/Claude/claude_desktop_config.json` to have
213
+ ```
214
+ {
215
+ "mcpServers": {
216
+ "filesystem": {
217
+ "command": "docker",
218
+ "args": [
219
+ "run",
220
+ "-i",
221
+ "--rm",
222
+ "--mount",
223
+ "type=bind,src=/Users/username/Desktop,dst=/workspace/Desktop",
224
+ "wcgw",
225
+ ]
226
+ }
227
+ }
228
+ }
229
+ ```
230
+
231
+
232
+
207
233
  ## [Optional] Local shell access with openai API key or anthropic API key
208
234
 
209
235
  ### Openai
@@ -255,3 +281,4 @@ The server provides the following MCP tools:
255
281
  - Parameters: `id` (string), `project_root_path` (string), `description` (string), `relevant_file_globs` (string[])
256
282
 
257
283
  All tools support absolute paths and include built-in protections against common errors. See the [MCP specification](https://modelcontextprotocol.io/) for detailed protocol information.
284
+
@@ -7,7 +7,7 @@ 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=FjIQOjT5oI7dk9VG0oRemN1A6EHBvHnuSQGKuRbguJI,10352
9
9
  wcgw/client/tool_prompts.py,sha256=H36Sr3yH2YuHZTc08Y6rTUWlYWjKMFtIGP6vbAVNwZo,3988
10
- wcgw/client/tools.py,sha256=l0L7kuylDdZ5WA2_P1CfN4Ds0xD9IPqEZ0ot0pruhKs,26512
10
+ wcgw/client/tools.py,sha256=rboKbRHtIl_4Mhypc23CrDaswXOHjyovyxWkwbXswXk,27387
11
11
  wcgw/client/bash_state/bash_state.py,sha256=aY_hW9y7TyPWHR5799v6rxzuWb1VzgjiGjA4K0cpGjE,27287
12
12
  wcgw/client/encoder/__init__.py,sha256=Y-8f43I6gMssUCWpX5rLYiAFv3D-JPRs4uNEejPlke8,1514
13
13
  wcgw/client/file_ops/diff_edit.py,sha256=sIwXSSkWYff_Dp3oHfefqtSuFqLrxbhKvzkCoLuLqDE,18679
@@ -21,7 +21,7 @@ wcgw/client/repo_ops/paths_model.vocab,sha256=M1pXycYDQehMXtpp-qAgU7rtzeBbCOiJo4
21
21
  wcgw/client/repo_ops/paths_tokens.model,sha256=jiwwE4ae8ADKuTZISutXuM5Wfyc_FBmN5rxTjoNnCos,1569052
22
22
  wcgw/client/repo_ops/repo_context.py,sha256=5NqRxBY0K-SBFXJ0Ybt7llzYOBD8pRkTpruMMJHWxv4,4336
23
23
  wcgw/relay/client.py,sha256=BUeEKUsWts8RpYxXwXcyFyjBJhOCS-CxThAlL_-VCOI,3618
24
- wcgw/relay/serve.py,sha256=xFAFiRENPae723_kwaaCgBmqL5sffYHKPu3esrMu57M,7896
24
+ wcgw/relay/serve.py,sha256=UFaRlGTfeD9Oc2AcPF8rIdTRwROBKoT2HglOKrc-aoo,7947
25
25
  wcgw/relay/static/privacy.txt,sha256=s9qBdbx2SexCpC_z33sg16TptmAwDEehMCLz4L50JLc,529
26
26
  wcgw_cli/__init__.py,sha256=TNxXsTPgb52OhakIda9wTRh91cqoBqgQRx5TxjzQQFU,21
27
27
  wcgw_cli/__main__.py,sha256=wcCrL4PjG51r5wVKqJhcoJPTLfHW0wNbD31DrUN0MWI,28
@@ -51,8 +51,8 @@ mcp_wcgw/shared/memory.py,sha256=dBsOghxHz8-tycdSVo9kSujbsC8xb_tYsGmuJobuZnw,281
51
51
  mcp_wcgw/shared/progress.py,sha256=ymxOsb8XO5Mhlop7fRfdbmvPodANj7oq6O4dD0iUcnw,1048
52
52
  mcp_wcgw/shared/session.py,sha256=e44a0LQOW8gwdLs9_DE9oDsxqW2U8mXG3d5KT95bn5o,10393
53
53
  mcp_wcgw/shared/version.py,sha256=d2LZii-mgsPIxpshjkXnOTUmk98i0DT4ff8VpA_kAvE,111
54
- wcgw-3.0.6.dist-info/METADATA,sha256=tEFOApXxIWcCkeryPchiGvd0j_zhWFP1_JX2Aqj3CuU,14049
55
- wcgw-3.0.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
56
- wcgw-3.0.6.dist-info/entry_points.txt,sha256=vd3tj1_Kzfp55LscJ8-6WFMM5hm9cWTfNGFCrWBnH3Q,124
57
- wcgw-3.0.6.dist-info/licenses/LICENSE,sha256=BvY8xqjOfc3X2qZpGpX3MZEmF-4Dp0LqgKBbT6L_8oI,11142
58
- wcgw-3.0.6.dist-info/RECORD,,
54
+ wcgw-3.0.7.dist-info/METADATA,sha256=EUfU99SQ5awMMfYVqCS969KEJ_4sWvcd8Jn9DkbVq0s,14549
55
+ wcgw-3.0.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
56
+ wcgw-3.0.7.dist-info/entry_points.txt,sha256=vd3tj1_Kzfp55LscJ8-6WFMM5hm9cWTfNGFCrWBnH3Q,124
57
+ wcgw-3.0.7.dist-info/licenses/LICENSE,sha256=BvY8xqjOfc3X2qZpGpX3MZEmF-4Dp0LqgKBbT6L_8oI,11142
58
+ wcgw-3.0.7.dist-info/RECORD,,
File without changes