Skip to content
Merged
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
27 changes: 18 additions & 9 deletions .codebuddy/hooks/capture_session_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@

Stdout is emitted in the CodeBuddy-expected ``{continue, systemMessage}`` shape.
"""

from __future__ import annotations

import json
import os
import subprocess
import sys
import tempfile
from datetime import datetime, timezone
from pathlib import Path

REPO = Path(__file__).resolve().parents[2] # <repo>/.codebuddy/hooks/ -> <repo>
Expand Down Expand Up @@ -166,9 +166,12 @@ def main() -> int:
json.dump(event, fh)

cmd = [
sys.executable, "-m", "codewiki.mcp._ide_hook",
sys.executable,
"-m",
"codewiki.mcp._ide_hook",
"--enable",
"--repo-path", repo_path,
"--repo-path",
repo_path,
]
if tmp:
cmd += ["--conversation", tmp]
Expand All @@ -185,8 +188,12 @@ def main() -> int:
child_env = dict(env)
if tmp:
child_env["CODEWIKI_HOOK_EVENT_FILE"] = tmp
kwargs: dict = {"cwd": str(REPO), "env": child_env, "stdout": subprocess.DEVNULL,
"stderr": subprocess.DEVNULL}
kwargs: dict = {
"cwd": str(REPO),
"env": child_env,
"stdout": subprocess.DEVNULL,
"stderr": subprocess.DEVNULL,
}
if sys.platform == "win32":
kwargs["creationflags"] = getattr(subprocess, "DETACHED_PROCESS", 0)
else:
Expand All @@ -195,12 +202,14 @@ def main() -> int:
except Exception as e: # noqa: BLE001 - never crash the IDE hook
# If we cannot even spawn the child, surface a non-blocking hint but
# still let the session end cleanly.
print(json.dumps({"continue": True,
"systemMessage": f"team-memory capture not started: {e}"}))
print(
json.dumps({"continue": True, "systemMessage": f"team-memory capture not started: {e}"})
)
return 0

print(json.dumps({"continue": True,
"systemMessage": "team-memory capture started in background"}))
print(
json.dumps({"continue": True, "systemMessage": "team-memory capture started in background"})
)
return 0


Expand Down
29 changes: 24 additions & 5 deletions .codebuddy/plans/multi-ide-hook-wiring_458a6f24.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,34 @@ repowiki/
```python
# codewiki/cli/utils/ide_config.py
IDE_SPECS: dict[str, dict] = {
"codebuddy": {"dir": ".codebuddy", "settings": "settings.json", "agents_dir": "agents", "copy_agent": True},
"qoder": {"dir": ".qoder", "settings": "settings.json", "agents_dir": "agents", "copy_agent": True},
"claude-code": {"dir": ".claude", "settings": "settings.json", "agents_dir": "agents", "copy_agent": True},
"codebuddy": {
"dir": ".codebuddy",
"settings": "settings.json",
"agents_dir": "agents",
"copy_agent": True,
},
"qoder": {
"dir": ".qoder",
"settings": "settings.json",
"agents_dir": "agents",
"copy_agent": True,
},
"claude-code": {
"dir": ".claude",
"settings": "settings.json",
"agents_dir": "agents",
"copy_agent": True,
},
}
HOOK_FILES = ("capture_session_end.py", "task_session_start.py")
AGENT_FILE = "distill-worker.md"
HOOKS_REGISTRATION = { # 事件注册骨架,command 运行时补全绝对路径
"SessionStart": [{"matcher": "startup", "hooks": [{"type": "command", "command": "<cmd>", "timeout": 15}]}],
"SessionEnd": [{"matcher": "other", "hooks": [{"type": "command", "command": "<cmd>", "timeout": 30}]}],
"SessionStart": [
{"matcher": "startup", "hooks": [{"type": "command", "command": "<cmd>", "timeout": 15}]}
],
"SessionEnd": [
{"matcher": "other", "hooks": [{"type": "command", "command": "<cmd>", "timeout": 30}]}
],
}
```

Expand Down
29 changes: 24 additions & 5 deletions .codebuddy/plans/multi-ide-hook-wiring_f1a46cd6(未完成).md
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,34 @@ repowiki/
```python
# codewiki/cli/utils/ide_config.py
IDE_SPECS: dict[str, dict] = {
"codebuddy": {"dir": ".codebuddy", "settings": "settings.json", "agents_dir": "agents", "copy_agent": True},
"qoder": {"dir": ".qoder", "settings": "settings.json", "agents_dir": "agents", "copy_agent": True},
"claude-code": {"dir": ".claude", "settings": "settings.json", "agents_dir": "agents", "copy_agent": True},
"codebuddy": {
"dir": ".codebuddy",
"settings": "settings.json",
"agents_dir": "agents",
"copy_agent": True,
},
"qoder": {
"dir": ".qoder",
"settings": "settings.json",
"agents_dir": "agents",
"copy_agent": True,
},
"claude-code": {
"dir": ".claude",
"settings": "settings.json",
"agents_dir": "agents",
"copy_agent": True,
},
}
HOOK_FILES = ("capture_session_end.py", "task_session_start.py")
AGENT_FILE = "distill-worker.md"
HOOKS_REGISTRATION = { # 事件注册骨架,command 运行时补全绝对路径
"SessionStart": [{"matcher": "startup", "hooks": [{"type": "command", "command": "<cmd>", "timeout": 15}]}],
"SessionEnd": [{"matcher": "other", "hooks": [{"type": "command", "command": "<cmd>", "timeout": 30}]}],
"SessionStart": [
{"matcher": "startup", "hooks": [{"type": "command", "command": "<cmd>", "timeout": 15}]}
],
"SessionEnd": [
{"matcher": "other", "hooks": [{"type": "command", "command": "<cmd>", "timeout": 30}]}
],
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ d:/repos/CodeWiki-CN/
def pending_raws_by_task(output_dir: Path) -> Dict[str, List[Dict[str, str]]]:
"""按 task_id 聚合未蒸馏 raw 条目;无 task_id 的归入 "" 键。"""


# distill_conversation 新参数(现有参数不变)
# arguments["task_id"]: Optional[str] — 仅蒸馏该任务的积压对话

Expand Down
5 changes: 5 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore bulk format commit(s) in git blame
# After this PR merges, replace the placeholder below with the actual bulk-format commit hash:
# git log --oneline --grep="ruff format whole repo" | head -n1
# Then add the hash here (one per line, with comment). GitHub respects this file for blame view.
# Configure locally: git config blame.ignoreRevsFile .git-blame-ignore-revs
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,8 @@ jobs:
run: |
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 uv run ruff format --check \
< "$RUNNER_TEMP/changed-python-files"
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Pre-commit hooks for CodeWiki-Plus
# Setup: uv sync --frozen && uv run pre-commit install
# Run manually: uv run pre-commit run --all-files
# CI also enforces these on changed files (see .github/workflows/ci.yml)

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.3 # must match ruff pin in pyproject.toml
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
27 changes: 18 additions & 9 deletions .qoder/hooks/capture_session_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@

Stdout is emitted in the CodeBuddy-expected ``{continue, systemMessage}`` shape.
"""

from __future__ import annotations

import json
import os
import subprocess
import sys
import tempfile
from datetime import datetime, timezone
from pathlib import Path

REPO = Path(__file__).resolve().parents[2] # <repo>/.codebuddy/hooks/ -> <repo>
Expand Down Expand Up @@ -166,9 +166,12 @@ def main() -> int:
json.dump(event, fh)

cmd = [
sys.executable, "-m", "codewiki.mcp._ide_hook",
sys.executable,
"-m",
"codewiki.mcp._ide_hook",
"--enable",
"--repo-path", repo_path,
"--repo-path",
repo_path,
]
if tmp:
cmd += ["--conversation", tmp]
Expand All @@ -185,8 +188,12 @@ def main() -> int:
child_env = dict(env)
if tmp:
child_env["CODEWIKI_HOOK_EVENT_FILE"] = tmp
kwargs: dict = {"cwd": str(REPO), "env": child_env, "stdout": subprocess.DEVNULL,
"stderr": subprocess.DEVNULL}
kwargs: dict = {
"cwd": str(REPO),
"env": child_env,
"stdout": subprocess.DEVNULL,
"stderr": subprocess.DEVNULL,
}
if sys.platform == "win32":
kwargs["creationflags"] = getattr(subprocess, "DETACHED_PROCESS", 0)
else:
Expand All @@ -195,12 +202,14 @@ def main() -> int:
except Exception as e: # noqa: BLE001 - never crash the IDE hook
# If we cannot even spawn the child, surface a non-blocking hint but
# still let the session end cleanly.
print(json.dumps({"continue": True,
"systemMessage": f"team-memory capture not started: {e}"}))
print(
json.dumps({"continue": True, "systemMessage": f"team-memory capture not started: {e}"})
)
return 0

print(json.dumps({"continue": True,
"systemMessage": "team-memory capture started in background"}))
print(
json.dumps({"continue": True, "systemMessage": "team-memory capture started in background"})
)
return 0


Expand Down
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Contributing

Prerequisites: Python 3.12+, [uv](https://docs.astral.sh/uv/) (or `pip`).

1. Fork https://github.com/mambo-wang/CodeWiki-Plus on GitHub, then:

```bash
git clone https://github.com/<YOUR_USERNAME>/CodeWiki-Plus.git
cd CodeWiki-Plus
git remote add upstream https://github.com/mambo-wang/CodeWiki-Plus.git
uv sync --frozen # installs project dependencies
uv run pre-commit install # enables ruff check + format on commit
uv run pytest -q # verify setup
```

2. Create a feature branch, push to your fork, and open a PR against `mambo-wang:develop`.
2 changes: 1 addition & 1 deletion codewiki/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
from codewiki.cli.main import cli

if __name__ == "__main__":
cli()
cli()
1 change: 0 additions & 1 deletion codewiki/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"""CLI module for CodeWiki."""

__all__ = []

1 change: 0 additions & 1 deletion codewiki/cli/adapters/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"""Adapters for integrating with backend modules."""

__all__ = []

Loading