Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix: resolve all CI failures — lint, co-changes test, integration db … (#22)
Raghav Chamadiyaf32d2f410be8
diff --git a/packages/cli/src/repowise/cli/commands/init_cmd.py b/packages/cli/src/repowise/cli/commands/init_cmd.pyindex f2dcbc3fb..ba3b92e31 100644--- a/packages/cli/src/repowise/cli/commands/init_cmd.py+++ b/packages/cli/src/repowise/cli/commands/init_cmd.py@@ -30,7 +30,7 @@ from repowise.cli.helpers import (def _register_mcp_with_claude(console_obj: Any, repo_path: Path) -> None:"""Register the repowise MCP server with Claude Desktop and Claude Code."""- from repowise.cli.mcp_config import register_with_claude_desktop, register_with_claude_code+ from repowise.cli.mcp_config import register_with_claude_code, register_with_claude_desktopdesktop = register_with_claude_desktop(repo_path)if desktop:@@ -733,8 +733,6 @@ def init_command(from repowise.cli.mcp_config import (save_mcp_config,save_root_mcp_config,- register_with_claude_desktop,- register_with_claude_code,)save_mcp_config(repo_path)diff --git a/packages/cli/src/repowise/cli/commands/serve_cmd.py b/packages/cli/src/repowise/cli/commands/serve_cmd.pyindex 48e6d1407..1209065c3 100644--- a/packages/cli/src/repowise/cli/commands/serve_cmd.py+++ b/packages/cli/src/repowise/cli/commands/serve_cmd.py@@ -39,9 +39,7 @@ def _setup_embedder() -> None:return# Detect which providers already have keys in the environment.- has_gemini = bool(- os.environ.get("GEMINI_API_KEY") or os.environ.get("GOOGLE_API_KEY")- )+ has_gemini = bool(os.environ.get("GEMINI_API_KEY") or os.environ.get("GOOGLE_API_KEY"))has_openai = bool(os.environ.get("OPENAI_API_KEY"))console.print(@@ -74,7 +72,11 @@ def _setup_embedder() -> None:raw = click.prompt(" Select", default=default).strip()# Map number or name to option.- choice = raw if raw in options else (options[int(raw) - 1] if raw.isdigit() and 1 <= int(raw) <= len(options) else "skip")+ choice = (+ raw+ if raw in options+ else (options[int(raw) - 1] if raw.isdigit() and 1 <= int(raw) <= len(options) else "skip")+ )if choice == "skip":console.print("[dim]Skipping embedder — chat and search will be unavailable.[/dim]\n")@@ -124,11 +126,13 @@ def _save_global_embedder(embedder: str, api_key: str) -> None:existing: dict = {}if config_path.exists():import yaml # type: ignore[import-untyped]+existing = yaml.safe_load(config_path.read_text(encoding="utf-8")) or {}existing["embedder"] = embedderif api_key:existing["embedder_api_key"] = api_keyimport yaml # type: ignore[import-untyped]+config_path.write_text(yaml.dump(existing, default_flow_style=False, sort_keys=False),encoding="utf-8",@@ -136,6 +140,7 @@ def _save_global_embedder(embedder: str, api_key: str) -> None:except Exception:pass # Non-fatal — user just gets prompted again next time.+_GITHUB_REPO = "RaghavChamadiya/repowise"_WEB_CACHE_DIR = Path.home() / ".repowise" / "web"_MARKER_FILE = _WEB_CACHE_DIR / ".version"@@ -345,7 +350,9 @@ def serve_command(port: int, host: str, workers: int, ui_port: int, no_ui: bool)if not ready:local_web = _find_local_web()if local_web:- standalone = local_web / ".next" / "standalone" / "packages" / "web" / "server.js"+ standalone = (+ local_web / ".next" / "standalone" / "packages" / "web" / "server.js"+ )if standalone.exists():ready = Trueelif npm:diff --git a/packages/cli/src/repowise/cli/mcp_config.py b/packages/cli/src/repowise/cli/mcp_config.pyindex 60a07e6e4..af53c56d5 100644--- a/packages/cli/src/repowise/cli/mcp_config.py+++ b/packages/cli/src/repowise/cli/mcp_config.py@@ -10,7 +10,13 @@ from pathlib import Pathdef _claude_desktop_config_path() -> Path | None:"""Return the Claude Desktop config path for this OS, or None if unsupported."""if sys.platform == "darwin":- return Path.home() / "Library" / "Application Support" / "Claude" / "claude_desktop_config.json"+ return (+ Path.home()+ / "Library"+ / "Application Support"+ / "Claude"+ / "claude_desktop_config.json"+ )if sys.platform == "win32":appdata = Path.home() / "AppData" / "Roaming"return appdata / "Claude" / "claude_desktop_config.json"diff --git a/packages/core/src/repowise/core/persistence/database.py b/packages/core/src/repowise/core/persistence/database.pyindex 88f263c78..ce61de687 100644--- a/packages/core/src/repowise/core/persistence/database.py+++ b/packages/core/src/repowise/core/persistence/database.py@@ -36,9 +36,11 @@ __all__ = ["init_db",]+def _default_db_url() -> str:"""Global SQLite DB at ~/.repowise/wiki.db — shared across all repos."""from pathlib import Path+db_path = Path.home() / ".repowise" / "wiki.db"db_path.parent.mkdir(parents=True, exist_ok=True)return f"sqlite+aiosqlite:///{db_path}"diff --git a/packages/server/src/repowise/server/routers/git.py b/packages/server/src/repowise/server/routers/git.pyindex 3221f62b3..f399e6a9a 100644--- a/packages/server/src/repowise/server/routers/git.py+++ b/packages/server/src/repowise/server/routers/git.py@@ -69,7 +69,9 @@ async def get_hotspots(lines_added_90d=r.lines_added_90d or 0,lines_deleted_90d=r.lines_deleted_90d or 0,avg_commit_size=r.avg_commit_size or 0.0,- commit_categories=json.loads(r.commit_categories_json) if r.commit_categories_json else {},+ commit_categories=json.loads(r.commit_categories_json)+ if r.commit_categories_json+ else {},)for r in rows]@@ -171,10 +173,7 @@ async def get_git_summary(owners[m.primary_owner_name] = owners.get(m.primary_owner_name, 0) + 1total = len(all_meta) or 1top_owners = sorted(- [- {"name": k, "file_count": v, "pct": v / total}- for k, v in owners.items()- ],+ [{"name": k, "file_count": v, "pct": v / total} for k, v in owners.items()],key=lambda x: x["file_count"],reverse=True,)[:10]diff --git a/packages/server/src/repowise/server/routers/graph.py b/packages/server/src/repowise/server/routers/graph.pyindex 8d3ba8507..520b00d34 100644--- a/packages/server/src/repowise/server/routers/graph.py+++ b/packages/server/src/repowise/server/routers/graph.py@@ -366,14 +366,15 @@ async def dead_code_graph("__init__.py","conftest.py","fixtures/",- "/app/", # Next.js app router pages- "/pages/", # Next.js pages router- "/routers/", # FastAPI routers- "/commands/", # CLI commands+ "/app/", # Next.js app router pages+ "/pages/", # Next.js pages router+ "/routers/", # FastAPI routers+ "/commands/", # CLI commands"/components/ui/", # UI component library)dead_nodes = [- n for n in all_candidates+ n+ for n in all_candidatesif not n.is_entry_pointand not n.is_testand not any(pat in n.node_id for pat in _framework_patterns)diff --git a/packages/server/src/repowise/server/schemas.py b/packages/server/src/repowise/server/schemas.pyindex 6498052af..bac0bfb0f 100644--- a/packages/server/src/repowise/server/schemas.py+++ b/packages/server/src/repowise/server/schemas.py@@ -344,7 +344,9 @@ class GitMetadataResponse(BaseModel):lines_added_90d=obj.lines_added_90d or 0, # type: ignore[attr-defined]lines_deleted_90d=obj.lines_deleted_90d or 0, # type: ignore[attr-defined]avg_commit_size=obj.avg_commit_size or 0.0, # type: ignore[attr-defined]- commit_categories=json.loads(obj.commit_categories_json) if obj.commit_categories_json else {}, # type: ignore[attr-defined]+ commit_categories=json.loads(obj.commit_categories_json)+ if obj.commit_categories_json+ else {}, # type: ignore[attr-defined]merge_commit_count_90d=obj.merge_commit_count_90d or 0, # type: ignore[attr-defined])diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.pyindex 8c47da76d..7f32b1e0f 100644--- a/tests/integration/test_cli.py+++ b/tests/integration/test_cli.py@@ -16,10 +16,14 @@ def runner():@pytest.fixture-def work_repo(tmp_path, sample_repo_path):+def work_repo(tmp_path, sample_repo_path, monkeypatch):"""Copy sample_repo into a temporary directory for isolation."""dest = tmp_path / "repo"shutil.copytree(sample_repo_path, dest)+ # Point the DB at the repo-local path so tests can assert on its existence+ db_path = dest / ".repowise" / "wiki.db"+ db_path.parent.mkdir(parents=True, exist_ok=True)+ monkeypatch.setenv("REPOWISE_DB_URL", f"sqlite+aiosqlite:///{db_path}")return destdiff --git a/tests/unit/server/test_git.py b/tests/unit/server/test_git.pyindex f0474ac93..53f21eb8b 100644--- a/tests/unit/server/test_git.py+++ b/tests/unit/server/test_git.py@@ -27,7 +27,9 @@ async def _insert_git_metadata(session_factory, repo_id: str) -> None:primary_owner_commit_pct=0.6,top_authors_json=json.dumps([{"name": "Alice", "commits": 30}]),significant_commits_json=json.dumps([{"sha": "abc", "message": "init"}]),- co_change_partners_json=json.dumps([{"file_path": "src/utils.py", "count": 5}]),+ co_change_partners_json=json.dumps(+ [{"file_path": "src/utils.py", "co_change_count": 5}]+ ),is_hotspot=True,is_stable=False,churn_percentile=0.85,