Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 10 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,15 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v6
with:
python-version: "3.12"
cache: pip
enable-cache: true

- name: Install dependencies
run: |
pip install -r requirements.txt
pip install pytest pytest-asyncio pytest-cov ruff
pip install -e . --no-deps
run: uv sync --frozen --extra dev

- name: Run tests
run: pytest -p no:cacheprovider -o addopts="" tests/ -q
run: uv run pytest -p no:cacheprovider -o addopts="" tests/ -q

lint:
name: Lint
Expand All @@ -42,12 +38,12 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v6
with:
python-version: "3.12"
enable-cache: true

- name: Install ruff
run: pip install ruff
- name: Install dependencies
run: uv sync --frozen --extra dev

- name: Collect changed Python files
env:
Expand All @@ -66,10 +62,10 @@ jobs:

- name: Ruff check changed files
run: |
xargs -0 -r ruff check --output-format=github \
xargs -0 -r uv run ruff check --output-format=github \
< "$RUNNER_TEMP/changed-python-files"

- name: Ruff format check changed files
run: |
xargs -0 -r ruff format --check \
xargs -0 -r uv run ruff format --check \
< "$RUNNER_TEMP/changed-python-files"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ htmlcov/
tests/*
!tests/test_gitignore_filtering.py
!tests/test_module_tree_validation.py
!tests/test_latest_compat.py

# Jupyter
*.ipynb
Expand Down
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
19 changes: 9 additions & 10 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ codewiki/
├── paper/ # Research paper source
├── tests/ # Test suite
├── output/ # Generated documentation output
├── pyproject.toml # Project metadata
├── requirements.txt # Python dependencies
└── README.md # Main documentation
├── pyproject.toml # Project metadata + dependencies
└── README.md # Main documentation
```

## Development Setup
Expand All @@ -59,15 +58,15 @@ codewiki/
git clone https://github.com/FSoft-AI4Code/CodeWiki.git
cd CodeWiki

# Create virtual environment
python3.12 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install uv (if not already installed)
# curl -LsSf https://astral.sh/uv/install.sh | sh

# Install in development mode
pip install -e .
# Create virtual environment and install dependencies (reads .python-version)
uv sync --extra dev
source .venv/bin/activate # On Windows: .venv\Scripts\activate

# Install development dependencies
pip install -r requirements.txt
# Run the test suite
uv run pytest
```

## Core Components
Expand Down
6 changes: 3 additions & 3 deletions IDE_DRIVEN_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ git clone https://github.com/FSoft-AI4Code/CodeWiki.git
cd CodeWiki

# 2. Install dependencies
pip install -e .
uv sync --extra dev

# 3. Verify
python -c "from codewiki.mcp.server import server; print('MCP Server OK')"
uv run python -c "from codewiki.mcp.server import server; print('MCP Server OK')"
```

### CodeBuddy Configuration
Expand Down Expand Up @@ -359,7 +359,7 @@ See the Quick Start section in [README.md](README.md) for details.
## FAQ

**Q: MCP Server fails to start with missing dependencies?**
A: Make sure you have run `pip install -e .` to install CodeWiki and its dependencies. The MCP Server no longer requires CLI-specific packages like `keyring` or `click`.
A: Make sure you have run `uv sync --extra dev` to install CodeWiki and its dependencies. The MCP Server no longer requires CLI-specific packages like `keyring` or `click`.

**Q: analyze_repo is slow?**
A: Tree-sitter parsing for large repositories (>100K lines) takes some time, usually completing within 30 seconds. Use `include_patterns` / `exclude_patterns` to narrow the analysis scope. There are no component count or source code length truncation limits.
Expand Down
10 changes: 8 additions & 2 deletions codewiki/src/be/agent_tools/str_replace_editor.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/usr/bin/env python3

Check failure on line 1 in codewiki/src/be/agent_tools/str_replace_editor.py

View workflow job for this annotation

GitHub Actions / Lint

ruff (EXE001)

codewiki/src/be/agent_tools/str_replace_editor.py:1:1: EXE001 Shebang is present but file is not executable

"""Source: https://github.com/SWE-agent/SWE-agent/blob/main/tools/edit_anthropic/bin/str_replace_editor
This tool is used to view the given source code and view/edit the documentation files in the separate docs directory.
"""

import json
import re
import subprocess
import sys
from collections import defaultdict
from pathlib import Path
from typing import Annotated, List, Literal, Optional, Tuple

Check failure on line 13 in codewiki/src/be/agent_tools/str_replace_editor.py

View workflow job for this annotation

GitHub Actions / Lint

ruff (UP035)

codewiki/src/be/agent_tools/str_replace_editor.py:13:1: UP035 `typing.Tuple` is deprecated, use `tuple` instead

Check failure on line 13 in codewiki/src/be/agent_tools/str_replace_editor.py

View workflow job for this annotation

GitHub Actions / Lint

ruff (UP035)

codewiki/src/be/agent_tools/str_replace_editor.py:13:1: UP035 `typing.List` is deprecated, use `list` instead
import io

import logging

Check failure on line 16 in codewiki/src/be/agent_tools/str_replace_editor.py

View workflow job for this annotation

GitHub Actions / Lint

ruff (I001)

codewiki/src/be/agent_tools/str_replace_editor.py:7:1: I001 Import block is un-sorted or un-formatted help: Organize imports
Expand All @@ -19,11 +19,11 @@

logger = logging.getLogger(__name__)

from pydantic import BeforeValidator
from pydantic_ai import RunContext, Tool

from .deps import CodeWikiDeps
from ..utils import validate_mermaid_diagrams

Check failure on line 26 in codewiki/src/be/agent_tools/str_replace_editor.py

View workflow job for this annotation

GitHub Actions / Lint

ruff (I001)

codewiki/src/be/agent_tools/str_replace_editor.py:22:1: I001 Import block is un-sorted or un-formatted help: Organize imports


def _coerce_json_string(value):
Expand All @@ -45,14 +45,20 @@
return value


ViewRange = Annotated[Optional[List[int]], BeforeValidator(_coerce_json_string)]

Check failure on line 48 in codewiki/src/be/agent_tools/str_replace_editor.py

View workflow job for this annotation

GitHub Actions / Lint

ruff (UP006)

codewiki/src/be/agent_tools/str_replace_editor.py:48:32: UP006 Use `list` instead of `List` for type annotation help: Replace with `list`

Check failure on line 48 in codewiki/src/be/agent_tools/str_replace_editor.py

View workflow job for this annotation

GitHub Actions / Lint

ruff (UP045)

codewiki/src/be/agent_tools/str_replace_editor.py:48:23: UP045 Use `X | None` for type annotations help: Convert to `X | None`
InsertLine = Annotated[Optional[int], BeforeValidator(_coerce_json_string)]

Check failure on line 49 in codewiki/src/be/agent_tools/str_replace_editor.py

View workflow job for this annotation

GitHub Actions / Lint

ruff (UP045)

codewiki/src/be/agent_tools/str_replace_editor.py:49:24: UP045 Use `X | None` for type annotations help: Convert to `X | None`


# There are some super strange "ascii can't decode x" errors,
# that can be solved with setting the default encoding for stdout
# (note that python3.6 doesn't have the reconfigure method)
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
# (note that python3.6 doesn't have the reconfigure method).
# Only re-wrap a real TextIOWrapper whose encoding is not already utf-8,
# so pytest's capture object (EncodedFile) is never clobbered.
if isinstance(sys.stdout, io.TextIOWrapper) and (
sys.stdout.encoding is None
or sys.stdout.encoding.lower() not in ("utf-8", "utf8")
):
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")

TRUNCATED_MESSAGE: str = "<response clipped><NOTE>To save on context only part of this file has been shown to you. You should retry this tool after you have searched inside the file with `grep -n` in order to find the line numbers of what you are looking for.</NOTE>"
MAX_RESPONSE_LEN: int = 16000
Expand Down Expand Up @@ -84,7 +90,7 @@
"""


def maybe_truncate(content: str, truncate_after: Optional[int] = MAX_RESPONSE_LEN):

Check failure on line 93 in codewiki/src/be/agent_tools/str_replace_editor.py

View workflow job for this annotation

GitHub Actions / Lint

ruff (UP045)

codewiki/src/be/agent_tools/str_replace_editor.py:93:50: UP045 Use `X | None` for type annotations help: Convert to `X | None`
"""Truncate content and append a notice if content exceeds the specified length."""
return (
content
Expand Down Expand Up @@ -127,7 +133,7 @@


def _update_previous_errors(
previous_errors: List[Flake8Error], replacement_window: Tuple[int, int], replacement_n_lines: int

Check failure on line 136 in codewiki/src/be/agent_tools/str_replace_editor.py

View workflow job for this annotation

GitHub Actions / Lint

ruff (UP006)

codewiki/src/be/agent_tools/str_replace_editor.py:136:22: UP006 Use `list` instead of `List` for type annotation help: Replace with `list`
) -> List[Flake8Error]:
"""Update the line numbers of the previous errors to what they would be after the edit window.
This is a helper function for `_filter_previous_errors`.
Expand Down
6 changes: 3 additions & 3 deletions docker/DOCKER_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ The Dockerfile (`docker/Dockerfile`) builds the CodeWiki image with:
- `nodejs` and `npm` - For mermaid diagram validation

### Application Setup
1. Copies `requirements.txt` first (for better caching)
2. Installs Python dependencies
3. Copies entire application code
1. Copies `pyproject.toml`, `README.md`, and the `codewiki` package
2. Installs the package and its dependencies via `pip install .`
3. Copies remaining assets (`img`)
4. Creates output directories:
- `output/cache`
- `output/temp`
Expand Down
15 changes: 7 additions & 8 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,16 @@ RUN apt-get update && apt-get install -y \
npm \
&& rm -rf /var/lib/apt/lists/*

# Copy requirements first for better caching
COPY requirements.txt .
# Copy package source and metadata, then install
COPY pyproject.toml .
COPY README.md .
COPY codewiki ./codewiki

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Install Python dependencies and package
RUN pip install --no-cache-dir .

# Copy application code
COPY codewiki ./codewiki
# Copy remaining assets
COPY img ./img
COPY pyproject.toml .
COPY README.md .

# Create output directories
RUN mkdir -p output/cache output/temp output/docs output/dependency_graphs
Expand Down
8 changes: 1 addition & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,7 @@ dependencies = [
"colorama>=0.4.6",
"logfire>=4.1.0",
"coding-agent-wrapper>=0.1.2",
"mcp>=1.0.0"
]

[external]
# Node.js is required for mermaid-py which validates mermaid diagrams in generated documentation
build-requires = [
{ name = "nodejs", version = ">=14.0.0" }
"mcp>=1.0.0,<2"
]

[project.optional-dependencies]
Expand Down
165 changes: 0 additions & 165 deletions requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion skills/codewiki-wiki-generator/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ If tools are unavailable, prompt the user to install and configure CodeWiki:

```bash
git clone https://github.com/FSoft-AI4Code/CodeWiki.git
cd CodeWiki && pip install -e .
cd CodeWiki && uv sync --extra dev
```

Then add to MCP configuration:
Expand Down
Loading
Loading