wcgw 5.4.2__tar.gz → 5.4.4__tar.gz
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-5.4.2 → wcgw-5.4.4}/PKG-INFO +17 -11
- {wcgw-5.4.2 → wcgw-5.4.4}/README.md +16 -10
- {wcgw-5.4.2 → wcgw-5.4.4}/pyproject.toml +1 -1
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/bash_state/bash_state.py +3 -2
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/tools.py +37 -26
- {wcgw-5.4.2 → wcgw-5.4.4}/uv.lock +658 -658
- {wcgw-5.4.2 → wcgw-5.4.4}/.github/workflows/python-publish.yml +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/.github/workflows/python-tests.yml +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/.github/workflows/python-types.yml +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/.gitignore +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/.gitmodules +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/.python-version +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/.vscode/settings.json +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/CLAUDE.md +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/Dockerfile +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/LICENSE +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/__init__.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/__init__.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/bash_state/parser/__init__.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/bash_state/parser/bash_statement_parser.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/common.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/diff-instructions.txt +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/encoder/__init__.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/file_ops/diff_edit.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/file_ops/extensions.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/file_ops/search_replace.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/mcp_server/Readme.md +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/mcp_server/__init__.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/mcp_server/server.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/memory.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/modes.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/repo_ops/display_tree.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/repo_ops/file_stats.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/repo_ops/path_prob.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/repo_ops/paths_model.vocab +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/repo_ops/paths_tokens.model +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/repo_ops/repo_context.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/schema_generator.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/client/tool_prompts.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/py.typed +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw/types_.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw_cli/__init__.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw_cli/__main__.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw_cli/anthropic_client.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw_cli/cli.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw_cli/openai_client.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/src/wcgw_cli/openai_utils.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/static/claude-ss.jpg +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/static/computer-use.jpg +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/static/example.jpg +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/static/rocket-icon.png +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/static/ss1.png +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/static/workflow-demo.gif +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/tests/test_bash_parser.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/tests/test_bash_parser_complex.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/tests/test_edit.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/tests/test_file_range_tracking.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/tests/test_mcp_server.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/tests/test_readfiles.py +0 -0
- {wcgw-5.4.2 → wcgw-5.4.4}/tests/test_tools.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: wcgw
|
|
3
|
-
Version: 5.4.
|
|
3
|
+
Version: 5.4.4
|
|
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>
|
|
@@ -86,7 +86,7 @@ wcgw is an MCP server with tightly integrated shell and code editing tools.
|
|
|
86
86
|
- By default it runs in 'wcgw' mode that has no restrictions and full authorisation.
|
|
87
87
|
- More details in [Modes section](#modes)
|
|
88
88
|
- ⚡ **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.
|
|
89
|
+
- ⚡ **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
90
|
|
|
91
91
|
## Top use cases examples
|
|
92
92
|
|
|
@@ -118,7 +118,7 @@ Then create or update `claude_desktop_config.json` (~/Library/Application Suppor
|
|
|
118
118
|
"mcpServers": {
|
|
119
119
|
"wcgw": {
|
|
120
120
|
"command": "uv",
|
|
121
|
-
"args": ["tool", "run", "--python", "3.12", "wcgw
|
|
121
|
+
"args": ["tool", "run", "--python", "3.12", "wcgw"]
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -129,10 +129,10 @@ Then restart claude app.
|
|
|
129
129
|
_If there's an error in setting up_
|
|
130
130
|
|
|
131
131
|
- 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
|
|
132
|
+
- 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
133
|
- Try removing ~/.cache/uv folder
|
|
134
134
|
- 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
|
|
135
|
+
- Debug the mcp server using `npx @modelcontextprotocol/inspector@0.1.7 uv tool run --python 3.12 wcgw`
|
|
136
136
|
|
|
137
137
|
### Windows on wsl
|
|
138
138
|
|
|
@@ -147,12 +147,12 @@ Then add or update the claude config file `%APPDATA%\Claude\claude_desktop_confi
|
|
|
147
147
|
"mcpServers": {
|
|
148
148
|
"wcgw": {
|
|
149
149
|
"command": "wsl.exe",
|
|
150
|
-
"args": ["uv", "tool", "run", "--python", "3.12", "wcgw
|
|
150
|
+
"args": ["uv", "tool", "run", "--python", "3.12", "wcgw"]
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
```
|
|
155
|
-
When you encounter an error, execute the command wsl uv --python 3.12 wcgw
|
|
155
|
+
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
156
|
1. Find where uv is installed:
|
|
157
157
|
```bash
|
|
158
158
|
whereis uv
|
|
@@ -162,7 +162,7 @@ Example output:
|
|
|
162
162
|
|
|
163
163
|
2. Test the full path works:
|
|
164
164
|
```
|
|
165
|
-
wsl /home/mywsl/.local/bin/uv tool run --python 3.12 wcgw
|
|
165
|
+
wsl /home/mywsl/.local/bin/uv tool run --python 3.12 wcgw
|
|
166
166
|
```
|
|
167
167
|
|
|
168
168
|
3. Update the config with the full path:
|
|
@@ -171,7 +171,7 @@ wsl /home/mywsl/.local/bin/uv tool run --python 3.12 wcgw@latest
|
|
|
171
171
|
"mcpServers": {
|
|
172
172
|
"wcgw": {
|
|
173
173
|
"command": "wsl.exe",
|
|
174
|
-
"args": ["/home/mywsl/.local/bin/uv", "tool", "run", "--python", "3.12", "wcgw
|
|
174
|
+
"args": ["/home/mywsl/.local/bin/uv", "tool", "run", "--python", "3.12", "wcgw"]
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
}
|
|
@@ -223,6 +223,12 @@ You can interact with the terminal but beware that the AI might be running in pa
|
|
|
223
223
|
|
|
224
224
|
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
225
|
|
|
226
|
+
Include the following in ~/.screenrc for better scrolling experience
|
|
227
|
+
```
|
|
228
|
+
defscrollback 10000
|
|
229
|
+
termcapinfo xterm* ti@:te@
|
|
230
|
+
```
|
|
231
|
+
|
|
226
232
|
### [Optional] Vs code extension
|
|
227
233
|
|
|
228
234
|
https://marketplace.visualstudio.com/items?itemName=AmanRusia.wcgw
|
|
@@ -267,7 +273,7 @@ Add `OPENAI_API_KEY` and `OPENAI_ORG_ID` env variables.
|
|
|
267
273
|
|
|
268
274
|
Then run
|
|
269
275
|
|
|
270
|
-
`uvx wcgw
|
|
276
|
+
`uvx wcgw wcgw_local --limit 0.1` # Cost limit $0.1
|
|
271
277
|
|
|
272
278
|
You can now directly write messages or press enter key to open vim for multiline message and text pasting.
|
|
273
279
|
|
|
@@ -277,7 +283,7 @@ Add `ANTHROPIC_API_KEY` env variable.
|
|
|
277
283
|
|
|
278
284
|
Then run
|
|
279
285
|
|
|
280
|
-
`uvx wcgw
|
|
286
|
+
`uvx wcgw wcgw_local --claude`
|
|
281
287
|
|
|
282
288
|
You can now directly write messages or press enter key to open vim for multiline message and text pasting.
|
|
283
289
|
|
|
@@ -55,7 +55,7 @@ wcgw is an MCP server with tightly integrated shell and code editing tools.
|
|
|
55
55
|
- By default it runs in 'wcgw' mode that has no restrictions and full authorisation.
|
|
56
56
|
- More details in [Modes section](#modes)
|
|
57
57
|
- ⚡ **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.
|
|
58
|
-
- ⚡ **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.
|
|
58
|
+
- ⚡ **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.
|
|
59
59
|
|
|
60
60
|
## Top use cases examples
|
|
61
61
|
|
|
@@ -87,7 +87,7 @@ Then create or update `claude_desktop_config.json` (~/Library/Application Suppor
|
|
|
87
87
|
"mcpServers": {
|
|
88
88
|
"wcgw": {
|
|
89
89
|
"command": "uv",
|
|
90
|
-
"args": ["tool", "run", "--python", "3.12", "wcgw
|
|
90
|
+
"args": ["tool", "run", "--python", "3.12", "wcgw"]
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -98,10 +98,10 @@ Then restart claude app.
|
|
|
98
98
|
_If there's an error in setting up_
|
|
99
99
|
|
|
100
100
|
- 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.
|
|
101
|
-
- If there's still an issue, check that `uv tool run --python 3.12 wcgw
|
|
101
|
+
- 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.
|
|
102
102
|
- Try removing ~/.cache/uv folder
|
|
103
103
|
- Try using `uv` version `0.6.0` for which this tool was tested.
|
|
104
|
-
- Debug the mcp server using `npx @modelcontextprotocol/inspector@0.1.7 uv tool run --python 3.12 wcgw
|
|
104
|
+
- Debug the mcp server using `npx @modelcontextprotocol/inspector@0.1.7 uv tool run --python 3.12 wcgw`
|
|
105
105
|
|
|
106
106
|
### Windows on wsl
|
|
107
107
|
|
|
@@ -116,12 +116,12 @@ Then add or update the claude config file `%APPDATA%\Claude\claude_desktop_confi
|
|
|
116
116
|
"mcpServers": {
|
|
117
117
|
"wcgw": {
|
|
118
118
|
"command": "wsl.exe",
|
|
119
|
-
"args": ["uv", "tool", "run", "--python", "3.12", "wcgw
|
|
119
|
+
"args": ["uv", "tool", "run", "--python", "3.12", "wcgw"]
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
```
|
|
124
|
-
When you encounter an error, execute the command wsl uv --python 3.12 wcgw
|
|
124
|
+
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.
|
|
125
125
|
1. Find where uv is installed:
|
|
126
126
|
```bash
|
|
127
127
|
whereis uv
|
|
@@ -131,7 +131,7 @@ Example output:
|
|
|
131
131
|
|
|
132
132
|
2. Test the full path works:
|
|
133
133
|
```
|
|
134
|
-
wsl /home/mywsl/.local/bin/uv tool run --python 3.12 wcgw
|
|
134
|
+
wsl /home/mywsl/.local/bin/uv tool run --python 3.12 wcgw
|
|
135
135
|
```
|
|
136
136
|
|
|
137
137
|
3. Update the config with the full path:
|
|
@@ -140,7 +140,7 @@ wsl /home/mywsl/.local/bin/uv tool run --python 3.12 wcgw@latest
|
|
|
140
140
|
"mcpServers": {
|
|
141
141
|
"wcgw": {
|
|
142
142
|
"command": "wsl.exe",
|
|
143
|
-
"args": ["/home/mywsl/.local/bin/uv", "tool", "run", "--python", "3.12", "wcgw
|
|
143
|
+
"args": ["/home/mywsl/.local/bin/uv", "tool", "run", "--python", "3.12", "wcgw"]
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -192,6 +192,12 @@ You can interact with the terminal but beware that the AI might be running in pa
|
|
|
192
192
|
|
|
193
193
|
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.
|
|
194
194
|
|
|
195
|
+
Include the following in ~/.screenrc for better scrolling experience
|
|
196
|
+
```
|
|
197
|
+
defscrollback 10000
|
|
198
|
+
termcapinfo xterm* ti@:te@
|
|
199
|
+
```
|
|
200
|
+
|
|
195
201
|
### [Optional] Vs code extension
|
|
196
202
|
|
|
197
203
|
https://marketplace.visualstudio.com/items?itemName=AmanRusia.wcgw
|
|
@@ -236,7 +242,7 @@ Add `OPENAI_API_KEY` and `OPENAI_ORG_ID` env variables.
|
|
|
236
242
|
|
|
237
243
|
Then run
|
|
238
244
|
|
|
239
|
-
`uvx wcgw
|
|
245
|
+
`uvx wcgw wcgw_local --limit 0.1` # Cost limit $0.1
|
|
240
246
|
|
|
241
247
|
You can now directly write messages or press enter key to open vim for multiline message and text pasting.
|
|
242
248
|
|
|
@@ -246,7 +252,7 @@ Add `ANTHROPIC_API_KEY` env variable.
|
|
|
246
252
|
|
|
247
253
|
Then run
|
|
248
254
|
|
|
249
|
-
`uvx wcgw
|
|
255
|
+
`uvx wcgw wcgw_local --claude`
|
|
250
256
|
|
|
251
257
|
You can now directly write messages or press enter key to open vim for multiline message and text pasting.
|
|
252
258
|
|
|
@@ -4,6 +4,7 @@ import os
|
|
|
4
4
|
import platform
|
|
5
5
|
import random
|
|
6
6
|
import subprocess
|
|
7
|
+
import tempfile
|
|
7
8
|
import threading
|
|
8
9
|
import time
|
|
9
10
|
import traceback
|
|
@@ -65,7 +66,7 @@ def is_mac() -> bool:
|
|
|
65
66
|
def get_tmpdir() -> str:
|
|
66
67
|
current_tmpdir = os.environ.get("TMPDIR", "")
|
|
67
68
|
if current_tmpdir or not is_mac():
|
|
68
|
-
return
|
|
69
|
+
return tempfile.gettempdir()
|
|
69
70
|
try:
|
|
70
71
|
# Fix issue while running ocrmypdf -> tesseract -> leptonica, set TMPDIR
|
|
71
72
|
# https://github.com/tesseract-ocr/tesseract/issues/4333
|
|
@@ -78,7 +79,7 @@ def get_tmpdir() -> str:
|
|
|
78
79
|
except (subprocess.CalledProcessError, FileNotFoundError):
|
|
79
80
|
return "//tmp"
|
|
80
81
|
except Exception:
|
|
81
|
-
return
|
|
82
|
+
return tempfile.gettempdir()
|
|
82
83
|
|
|
83
84
|
|
|
84
85
|
def check_if_screen_command_available() -> bool:
|
|
@@ -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 = ""
|
|
@@ -279,29 +279,38 @@ def initialize(
|
|
|
279
279
|
except Exception:
|
|
280
280
|
pass
|
|
281
281
|
|
|
282
|
-
#
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
282
|
+
# Check for global alignment doc in ~/.wcgw: prefer CLAUDE.md, else AGENTS.md
|
|
283
|
+
try:
|
|
284
|
+
global_dir = os.path.join(expanduser("~"), ".wcgw")
|
|
285
|
+
for fname in ("CLAUDE.md", "AGENTS.md"):
|
|
286
|
+
global_alignment_file_path = os.path.join(global_dir, fname)
|
|
287
|
+
if os.path.exists(global_alignment_file_path):
|
|
288
|
+
with open(global_alignment_file_path, "r") as f:
|
|
289
|
+
global_alignment_content = f.read()
|
|
290
|
+
alignment_context += f"---\n# Important guidelines from the user\n```\n{global_alignment_content}\n```\n---\n\n"
|
|
291
|
+
break
|
|
292
|
+
except Exception as e:
|
|
293
|
+
# Log any errors when reading the global file
|
|
294
|
+
context.console.log(f"Error reading global alignment file: {e}")
|
|
292
295
|
|
|
293
|
-
# Then check for workspace-specific CLAUDE.md
|
|
296
|
+
# Then check for workspace-specific alignment doc: prefer CLAUDE.md, else AGENTS.md
|
|
294
297
|
if folder_to_start:
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
298
|
+
try:
|
|
299
|
+
base_dir = str(folder_to_start)
|
|
300
|
+
selected_name = ""
|
|
301
|
+
alignment_content = ""
|
|
302
|
+
for fname in ("CLAUDE.md", "AGENTS.md"):
|
|
303
|
+
alignment_file_path = os.path.join(base_dir, fname)
|
|
304
|
+
if os.path.exists(alignment_file_path):
|
|
305
|
+
with open(alignment_file_path, "r") as f:
|
|
306
|
+
alignment_content = f.read()
|
|
307
|
+
selected_name = fname
|
|
308
|
+
break
|
|
309
|
+
if alignment_content:
|
|
310
|
+
alignment_context += f"---\n# {selected_name} - user shared project guidelines to follow\n```\n{alignment_content}\n```\n---\n\n"
|
|
311
|
+
except Exception as e:
|
|
312
|
+
# Log any errors when reading the workspace file
|
|
313
|
+
context.console.log(f"Error reading workspace alignment file: {e}")
|
|
305
314
|
|
|
306
315
|
uname_sysname = os.uname().sysname
|
|
307
316
|
uname_machine = os.uname().machine
|
|
@@ -591,7 +600,7 @@ def write_file(
|
|
|
591
600
|
return (
|
|
592
601
|
(
|
|
593
602
|
msg
|
|
594
|
-
+ f"Here's the existing file:\n<
|
|
603
|
+
+ f"Here's the existing file:\n<file-contents-numbered>\n{file_content_str}\n{final_message}\n</file-contents-numbered>"
|
|
595
604
|
),
|
|
596
605
|
{path_: file_ranges},
|
|
597
606
|
)
|
|
@@ -613,7 +622,7 @@ def write_file(
|
|
|
613
622
|
return (
|
|
614
623
|
(
|
|
615
624
|
msg
|
|
616
|
-
+ f"Here's the existing file:\n<
|
|
625
|
+
+ f"Here's the existing file:\n<file-contents-numbered>\n{file_content_str}\n</file-contents-numbered>\n{final_message}"
|
|
617
626
|
),
|
|
618
627
|
{path_: file_ranges},
|
|
619
628
|
)
|
|
@@ -1192,10 +1201,12 @@ def read_files(
|
|
|
1192
1201
|
noncoding_max_tokens = max(0, noncoding_max_tokens - tokens)
|
|
1193
1202
|
|
|
1194
1203
|
range_formatted = range_format(start_line_num, end_line_num)
|
|
1195
|
-
message +=
|
|
1204
|
+
message += (
|
|
1205
|
+
f'\n<file-contents-numbered path="{file}{range_formatted}">\n{content}\n'
|
|
1206
|
+
)
|
|
1196
1207
|
|
|
1197
1208
|
if not truncated:
|
|
1198
|
-
message += "</
|
|
1209
|
+
message += "</file-contents-numbered>"
|
|
1199
1210
|
|
|
1200
1211
|
# Check if we've hit both token limit
|
|
1201
1212
|
if (
|