Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a2d6672
fix: support Claude Code backend on Windows
Alejo2304 Nov 11, 2026
1c242b2
feat: add Windows validation and path portability
Alejo2304 Nov 11, 2026
5ab1178
test: cover Windows caw import compatibility
Alejo2304 Nov 11, 2026
e0b9aaa
fix: prevent false usage-limit waits in caw
Alejo2304 Nov 11, 2026
48dfb9b
fix: retry caw agents that skip documentation writes
Alejo2304 Nov 11, 2026
8474305
fix: recreate caw MCP server for write retries
Alejo2304 Nov 11, 2026
0823a4f
fix: authorize CodeWiki MCP tools in Claude
Alejo2304 Nov 11, 2026
79aaa15
fix: allow Claude native writer fallback
Alejo2304 Nov 11, 2026
4649313
fix: target docs path for Claude writer fallback
Alejo2304 Nov 11, 2026
001f0ea
fix: use valid docs paths for CodeWiki MCP writes
Alejo2304 Nov 11, 2026
e54cb2e
fix: require MCP editor for Claude documentation writes
Alejo2304 Nov 11, 2026
f0bdbac
fix: isolate Claude sessions to CodeWiki MCP
Alejo2304 Nov 11, 2026
88f1109
test: lock down isolated MCP writer permissions
Alejo2304 Nov 11, 2026
810e88a
fix: stop MCP retries when writer is unavailable
Alejo2304 Nov 11, 2026
a53f5fb
fix: report rejected MCP editor calls
Alejo2304 Nov 11, 2026
1ca11e0
fix: normalize Windows component and document paths
Alejo2304 Nov 11, 2026
d9d2464
test: make Unicode fixtures portable on Windows
Alejo2304 Nov 12, 2026
4e95875
fix: normalize Vue analyzer component IDs
Alejo2304 Nov 12, 2026
e2af11e
fix: reemplazar comandos POSIX y normalizar saltos de linea en Windows
Alejo2304 Nov 12, 2026
54c1804
fix: evitar doble escape de argumentos al lanzar claude.cmd en Windows
Alejo2304 Nov 12, 2026
f036959
fix: invocar claude.exe directamente en Windows para evitar cmd.exe
Alejo2304 Nov 12, 2026
643417a
fix: importar Path en Popen de caw_backend
Alejo2304 Nov 12, 2026
e2ea0f7
fix: eliminar imports sin uso y omitir pruebas de caw cuando no esta …
Alejo2304 Nov 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,35 @@ jobs:
- name: Run tests
run: pytest -p no:cacheprovider -o addopts="" tests/ -q

test-windows:
name: Test (Windows)
runs-on: windows-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip

- name: Install dependencies
shell: pwsh
run: |
python -m pip install -r requirements.txt
python -m pip install pytest pytest-asyncio pytest-cov ruff
python -m pip install -e . --no-deps

- name: Run Windows-compatible tests
shell: pwsh
run: |
python -m pytest -p no:cacheprovider -o addopts="" `
tests/test_caw_windows_compat.py `
tests/test_gitignore_filtering.py `
tests/test_parse_timeout.py -q

lint:
name: Lint
runs-on: ubuntu-latest
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ overview, with Mermaid diagrams. It works on codebases from a few thousand to
over a million lines, in 11 languages. It needs an LLM API key, or a Claude or
Codex subscription, or an AI IDE that speaks MCP.

## Windows support

CodeWiki supports Windows 11 with Python 3.12 or newer. In PowerShell, create
and activate a virtual environment with:

```powershell
py -3.12 -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -e .
```

Git must be installed and available on `PATH` for repository-aware filtering.
The `claude-code` provider also requires the Claude CLI and its normal
authentication. CodeWiki adapts the subscription backend's POSIX file locking
on Windows; no `fcntl` package or Unix shell is required.

## Quick start

**1. Install**
Expand Down
8 changes: 4 additions & 4 deletions codewiki/mcp/tools/doc_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ async def handle_write_doc_file(
{"error": f"File already exists: {filename}. Use edit_doc_file to modify it."}
)

await asyncio.to_thread(doc_path.write_text, content, "utf-8")
await asyncio.to_thread(doc_path.write_text, content, encoding="utf-8", newline="\n")
session.docs_written += 1

# Mermaid validation
Expand Down Expand Up @@ -143,7 +143,7 @@ async def handle_edit_doc_file(
old_content = path_history.pop()
history[str(doc_path)] = path_history
session.registry["file_history"] = history
await asyncio.to_thread(doc_path.write_text, old_content, "utf-8")
await asyncio.to_thread(doc_path.write_text, old_content, encoding="utf-8", newline="\n")

# Validate Mermaid after undo
mermaid_result = await _validate_mermaid(str(doc_path), filename, repair=False)
Expand Down Expand Up @@ -181,7 +181,7 @@ async def handle_edit_doc_file(
# Save history only for edits that actually happen, so undo never
# pops a no-op entry left behind by a failed/rejected command.
_save_history(session, doc_path, current_content)
await asyncio.to_thread(doc_path.write_text, new_content, "utf-8")
await asyncio.to_thread(doc_path.write_text, new_content, encoding="utf-8", newline="\n")

# Snippet around the edit
replacement_line = current_content.split(old_str)[0].count("\n")
Expand All @@ -202,7 +202,7 @@ async def handle_edit_doc_file(
lines = lines[:insert_line] + new_str_lines + lines[insert_line:]
new_content = "\n".join(lines)
_save_history(session, doc_path, current_content)
await asyncio.to_thread(doc_path.write_text, new_content, "utf-8")
await asyncio.to_thread(doc_path.write_text, new_content, encoding="utf-8", newline="\n")

start = max(0, insert_line - 4)
end = min(len(lines), start + len(new_str_lines) + 8)
Expand Down
7 changes: 7 additions & 0 deletions codewiki/src/be/agent_tools/doc_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ def summarize_tool_activity(messages: list[Any]) -> str:
if isinstance(part, ToolReturnPart) and part.tool_call_id in writes:
lines = str(part.content).strip().splitlines()
results[part.tool_call_id] = _excerpt(lines[0] if lines else "")
if isinstance(part.content, list) and any(
isinstance(item, dict) and item.get("type") == "missing"
for item in part.content
):
rejected.append(
f"{getattr(part, 'tool_name', 'unknown')}: {_excerpt(part.content)}"
)
elif isinstance(part, RetryPromptPart) and part.tool_name:
rejected.append(f"{part.tool_name}: {_excerpt(part.model_response())}")

Expand Down
47 changes: 30 additions & 17 deletions codewiki/src/be/agent_tools/str_replace_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import logging
import os
import re
import shlex
import subprocess
import sys
from collections import defaultdict
Expand Down Expand Up @@ -229,9 +228,15 @@ def flake8(file_path: str) -> str:
"""Run flake8 on a given file and return the output as a string"""
if Path(file_path).suffix != ".py":
return ""
cmd = "flake8 --isolated --select=F821,F822,F831,E111,E112,E113,E999,E902 {file_path}"
out = subprocess.run(
cmd.format(file_path=file_path), shell=True, check=False, capture_output=True
[
"flake8",
"--isolated",
"--select=F821,F822,F831,E111,E112,E113,E999,E902",
str(file_path),
],
check=False,
capture_output=True,
)
# Use errors="replace" so non-UTF-8 bytes (e.g. GBK-encoded paths on Windows) don't crash decoding.
return out.stdout.decode("utf-8", errors="replace")
Expand Down Expand Up @@ -560,21 +565,29 @@ def view(self, path: Path, view_range: list[int] | None = None):

# Hidden entries are skipped except `.github` (CI workflows are
# documentation-relevant artifacts the agent must be able to find).
out = subprocess.run(
rf"find {shlex.quote(str(path))} -maxdepth 2 "
r"\( -not -path '*/.*' -o -name .github -o -path '*/.github/*' \)",
shell=True,
check=False,
capture_output=True,
display_root = self._get_display_path(path)
entries = [display_root]
try:
for child in sorted(path.iterdir(), key=lambda p: p.name):
if child.name.startswith(".") and child.name != ".github":
continue
entries.append(f"{display_root}/{child.name}")
if child.is_dir():
try:
for grandchild in sorted(child.iterdir(), key=lambda p: p.name):
if grandchild.name.startswith(".") and child.name != ".github":
continue
entries.append(f"{display_root}/{child.name}/{grandchild.name}")
except OSError:
pass
except OSError as exc:
self.logs.append(f"Error listing directory {display_root}: {exc}")
return

stdout = "\n".join(entries)
self.logs.append(
f"Here's the files and directories up to 2 levels deep in {display_root}, excluding hidden items (except .github):\n{stdout}\n"
)
# Use errors="replace" so non-UTF-8 bytes (e.g. GBK-encoded filenames on Windows) don't crash decoding.
stdout = out.stdout.decode("utf-8", errors="replace")
stderr = out.stderr.decode("utf-8", errors="replace")

if not stderr:
stdout = stdout.replace(str(path), self._get_display_path(path))
stdout = f"Here's the files and directories up to 2 levels deep in {self._get_display_path(path)}, excluding hidden items (except .github):\n{stdout}\n"
self.logs.append(stdout)
return

file_content = self.read_file(path)
Expand Down
Loading