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

@@ -427,6 +427,8 @@ class BashState:
427
427
  before_val = str(before_val)
428
428
  before_lines = render_terminal_output(before_val)
429
429
  current_dir = "\n".join(before_lines).strip()
430
+ if current_dir.startswith("pwd"):
431
+ current_dir = current_dir[3:].strip()
430
432
  self._cwd = current_dir
431
433
  return current_dir
432
434
 
@@ -31,7 +31,7 @@ TOOL_PROMPTS = [
31
31
  - Always call this at the start of the conversation before using any of the shell tools from wcgw.
32
32
  - Use `any_workspace_path` to initialize the shell in the appropriate project directory.
33
33
  - If the user has mentioned a workspace or project root or any other file or folder use it to set `any_workspace_path`.
34
- - If user has mentioned any files use `initial_files_to_read` to read, use absolute paths only.
34
+ - If user has mentioned any files use `initial_files_to_read` to read, use absolute paths only (~ allowed)
35
35
  - By default use mode "wcgw"
36
36
  - In "code-writer" mode, set the commands and globs which user asked to set, otherwise use 'all'.
37
37
  - Use type="first_call" if it's the first call to this tool.
@@ -61,7 +61,7 @@ TOOL_PROMPTS = [
61
61
  name="ReadFiles",
62
62
  description="""
63
63
  - Read full file content of one or more files.
64
- - Provide absolute file paths only
64
+ - Provide absolute paths only (~ allowed)
65
65
  """,
66
66
  ),
67
67
  Prompts(
@@ -69,7 +69,7 @@ TOOL_PROMPTS = [
69
69
  name="WriteIfEmpty",
70
70
  description="""
71
71
  - Write content to an empty or non-existent file. Provide file path and content. Use this instead of BashCommand for writing new files.
72
- - Provide absolute file path only.
72
+ - Provide absolute path only.
73
73
  - For editing existing files, use FileEdit instead of this tool.
74
74
  """,
75
75
  ),
@@ -82,7 +82,7 @@ TOOL_PROMPTS = [
82
82
  inputSchema=FileEdit.model_json_schema(),
83
83
  name="FileEdit",
84
84
  description="""
85
- - Use absolute file path only.
85
+ - Use absolute path only.
86
86
  - Use SEARCH/REPLACE blocks to edit the file.
87
87
  - If the edit fails due to block not matching, please retry with correct block till it matches. Re-read the file to ensure you've all the lines correct.
88
88
  """
wcgw/client/tools.py CHANGED
@@ -4,6 +4,7 @@ import glob
4
4
  import json
5
5
  import mimetypes
6
6
  import os
7
+ import subprocess
7
8
  import traceback
8
9
  from dataclasses import dataclass
9
10
  from os.path import expanduser
@@ -308,6 +309,30 @@ def expand_user(path: str) -> str:
308
309
  return expanduser(path)
309
310
 
310
311
 
312
+ def try_open_file(file_path: str) -> None:
313
+ """Try to open a file using the system's default application."""
314
+ # Determine the appropriate open command based on OS
315
+ open_cmd = None
316
+ if os.uname().sysname == "Darwin": # macOS
317
+ open_cmd = "open"
318
+ elif os.uname().sysname == "Linux":
319
+ # Try common Linux open commands
320
+ for cmd in ["xdg-open", "gnome-open", "kde-open"]:
321
+ try:
322
+ subprocess.run(["which", cmd], timeout=1, capture_output=True)
323
+ open_cmd = cmd
324
+ break
325
+ except:
326
+ continue
327
+
328
+ # Try to open the file if a command is available
329
+ if open_cmd:
330
+ try:
331
+ subprocess.run([open_cmd, file_path], timeout=2)
332
+ except:
333
+ pass
334
+
335
+
311
336
  MEDIA_TYPES = Literal["image/jpeg", "image/png", "image/gif", "image/webp"]
312
337
 
313
338
 
@@ -673,6 +698,7 @@ def get_tool_output(
673
698
  context.console.print("Calling task memory tool")
674
699
  relevant_files = []
675
700
  warnings = ""
701
+ arg.project_root_path = os.path.expanduser(arg.project_root_path)
676
702
  for fglob in arg.relevant_file_globs:
677
703
  fglob = expand_user(fglob)
678
704
  if not os.path.isabs(fglob) and arg.project_root_path:
@@ -682,11 +708,15 @@ def get_tool_output(
682
708
  if not globs:
683
709
  warnings += f"Warning: No files found for the glob: {fglob}\n"
684
710
  relevant_files_data = read_files(relevant_files[:10_000], None, context)
685
- output_ = save_memory(arg, relevant_files_data, context.bash_state.serialize())
711
+ save_path = save_memory(arg, relevant_files_data, context.bash_state.serialize())
686
712
  if not relevant_files and arg.relevant_file_globs:
687
- output_ = f'Error: No files found for the given globs. Context file successfully saved at "{output_}", but please fix the error.'
713
+ output_ = f'Error: No files found for the given globs. Context file successfully saved at "{save_path}", but please fix the error.'
688
714
  elif warnings:
689
- output_ = warnings + "\nContext file successfully saved at " + output_
715
+ output_ = warnings + "\nContext file successfully saved at " + save_path
716
+ else:
717
+ output_ = save_path
718
+ # Try to open the saved file
719
+ try_open_file(save_path)
690
720
  output = output_, 0.0
691
721
  else:
692
722
  raise ValueError(f"Unknown tool: {arg}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wcgw
3
- Version: 3.0.2
3
+ Version: 3.0.3
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>
@@ -77,6 +77,7 @@ Empowering chat applications to code, build and run on your local machine.
77
77
  - 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.
78
78
  - By default it runs in 'wcgw' mode that has no restrictions and full authorisation.
79
79
  - More details in [Modes section](#modes)
80
+ - ⚡ **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.
80
81
 
81
82
  ## Top use cases examples
82
83
 
@@ -6,9 +6,9 @@ wcgw/client/common.py,sha256=OCH7Tx64jojz3M3iONUrGMadE07W21DiZs5sOxWX1Qc,1456
6
6
  wcgw/client/diff-instructions.txt,sha256=tmJ9Fu9XdO_72lYXQQNY9RZyx91bjxrXJf9d_KBz57k,1611
7
7
  wcgw/client/memory.py,sha256=8LdYsOhvCOoC1kfvDr85kNy07WnhPMvE6B2FRM2w85Y,2902
8
8
  wcgw/client/modes.py,sha256=FjIQOjT5oI7dk9VG0oRemN1A6EHBvHnuSQGKuRbguJI,10352
9
- wcgw/client/tool_prompts.py,sha256=RzLO3XGMg2VJfURG1BiQzZ6IdDWXfH2syqM1N3w0770,3980
10
- wcgw/client/tools.py,sha256=UtVH_Q7E7A6ertdY9yPe5ukwSO2zg1Ojlp3z6MqmURI,24402
11
- wcgw/client/bash_state/bash_state.py,sha256=DND9vNIfFee-Djif3YZhIsnaXamI3TzXE-AhISnICZY,26476
9
+ wcgw/client/tool_prompts.py,sha256=H36Sr3yH2YuHZTc08Y6rTUWlYWjKMFtIGP6vbAVNwZo,3988
10
+ wcgw/client/tools.py,sha256=hwKF6Wydiw-xqVDBJ2wZJ5BhZhtEQikM0G_YpolZ4zg,25398
11
+ wcgw/client/bash_state/bash_state.py,sha256=RoNR5qyskYPeLtaBkatHNPWhAAJI2AaPJ7Z3gAKvONU,26568
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
14
14
  wcgw/client/file_ops/search_replace.py,sha256=Napa7IWaYPGMNdttunKyRDkb90elZE7r23B_o_htRxo,5585
@@ -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.2.dist-info/METADATA,sha256=VNXS8-pCPvOPt_Xdgq4UIxp4aeZ69V-7DbIe0WGT7Eo,13858
55
- wcgw-3.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
56
- wcgw-3.0.2.dist-info/entry_points.txt,sha256=vd3tj1_Kzfp55LscJ8-6WFMM5hm9cWTfNGFCrWBnH3Q,124
57
- wcgw-3.0.2.dist-info/licenses/LICENSE,sha256=BvY8xqjOfc3X2qZpGpX3MZEmF-4Dp0LqgKBbT6L_8oI,11142
58
- wcgw-3.0.2.dist-info/RECORD,,
54
+ wcgw-3.0.3.dist-info/METADATA,sha256=oG6kjnyYUCJzKiINctH5M0mlDo4dEwS88WN15WdafUg,14049
55
+ wcgw-3.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
56
+ wcgw-3.0.3.dist-info/entry_points.txt,sha256=vd3tj1_Kzfp55LscJ8-6WFMM5hm9cWTfNGFCrWBnH3Q,124
57
+ wcgw-3.0.3.dist-info/licenses/LICENSE,sha256=BvY8xqjOfc3X2qZpGpX3MZEmF-4Dp0LqgKBbT6L_8oI,11142
58
+ wcgw-3.0.3.dist-info/RECORD,,
File without changes