Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

chore: remove code nothing uses (#3487)

Raghav Chamadiya30ab508e2b55
diff --git a/packages/cli/src/repowise/cli/mcp_config.py b/packages/cli/src/repowise/cli/mcp_config.py
index aab7e3cc4..1e54c9e4c 100644
--- a/packages/cli/src/repowise/cli/mcp_config.py
+++ b/packages/cli/src/repowise/cli/mcp_config.py
@@ -273,21 +273,6 @@ def save_vscode_extensions_config(repo_path: Path) -> Path:
return vscode.write_extensions_config(repo_path).path
-#: Re-exported for the Codex hooks writer's own use and for callers that used
-#: to reach it through this module.
-def _is_repowise_hook(hook: dict) -> bool:
- from repowise.cli.agent_targets.targets.codex import _is_augment_hook
-
- return _is_augment_hook(hook)
-
-
-def _has_repowise_hook_for_matcher(hook_list: list, matcher: object) -> bool:
- """Check if a repowise augment hook is registered for a matcher group."""
- from repowise.cli.agent_targets.targets.codex import _has_augment_hook_for_matcher
-
- return _has_augment_hook_for_matcher(hook_list, matcher)
-
-
__all__ = [
"enable_codex_hooks_feature",
"generate_codex_hooks_config",
diff --git a/packages/core/src/repowise/core/analysis/actions/rules/_text.py b/packages/core/src/repowise/core/analysis/actions/rules/_text.py
index 634496b2f..6d57d005e 100644
--- a/packages/core/src/repowise/core/analysis/actions/rules/_text.py
+++ b/packages/core/src/repowise/core/analysis/actions/rules/_text.py
@@ -19,7 +19,3 @@ def code(text: str) -> str:
def plural(n: int, noun: str) -> str:
return f"{n:,} {noun}" if n == 1 else f"{n:,} {noun}s"
-
-
-def humanize(token: str) -> str:
- return token.replace("_", " ")
diff --git a/packages/server/src/repowise/server/routers/graph/_common.py b/packages/server/src/repowise/server/routers/graph/_common.py
index 07497f96e..d6ac2bce7 100644
--- a/packages/server/src/repowise/server/routers/graph/_common.py
+++ b/packages/server/src/repowise/server/routers/graph/_common.py
@@ -3,11 +3,10 @@
from __future__ import annotations
from fastapi import Depends, HTTPException
-from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from repowise.core.persistence import crud
-from repowise.core.persistence.models import Page, Repository
+from repowise.core.persistence.models import Repository
from repowise.server.deps import get_db_session
@@ -26,9 +25,3 @@ async def with_repo(
if repo is None:
raise HTTPException(status_code=404, detail="Repository not found")
return repo
-
-
-async def _get_documented_paths(session: AsyncSession, repo_id: str) -> set[str]:
- """Return the set of node_ids (file paths) that have a wiki page."""
- result = await session.execute(select(Page.target_path).where(Page.repository_id == repo_id))
- return {row.target_path for row in result.all() if row.target_path}
diff --git a/packages/server/src/repowise/server/services/module_health.py b/packages/server/src/repowise/server/services/module_health.py
index cfd2828c9..55a6cf543 100644
--- a/packages/server/src/repowise/server/services/module_health.py
+++ b/packages/server/src/repowise/server/services/module_health.py
@@ -39,12 +39,6 @@ from repowise.core.persistence.models import (
top_level_module = module_label
-def _under_module(file_path: str, module_path: str) -> bool:
- if module_path in ("", "root"):
- return "/" not in file_path
- return file_path == module_path or file_path.startswith(module_path + "/")
-
-
async def aggregate_modules(session: AsyncSession, repo_id: str) -> dict[str, ModuleAccumulator]:
"""Fetch the four inputs for *repo_id* and fold them by top-level module."""
diff --git a/packages/ui/src/graph/symbol-relations.ts b/packages/ui/src/graph/symbol-relations.ts
index 133ee216b..db94af2bb 100644
--- a/packages/ui/src/graph/symbol-relations.ts
+++ b/packages/ui/src/graph/symbol-relations.ts
@@ -68,7 +68,3 @@ export function relationLabel(
export function relationHint(group: SymbolRelationGroup["group"]): string | undefined {
return GROUP_HINTS[group];
}
-
-/** Edge types this module can name, for the cross-language pin test. */
-export const KNOWN_RELATION_EDGE_TYPES: readonly string[] =
- Object.keys(RELATION_LABELS).sort();
diff --git a/packages/ui/src/workspace/system-map/system-map-model.ts b/packages/ui/src/workspace/system-map/system-map-model.ts
index bc5d079d7..f67486db6 100644
--- a/packages/ui/src/workspace/system-map/system-map-model.ts
+++ b/packages/ui/src/workspace/system-map/system-map-model.ts
@@ -337,10 +337,6 @@ export function neighbourGroups(
return groups;
}
-export function nodeName(graph: SystemGraph, id: string): string {
- return graph.nodes.find((n) => n.id === id)?.name ?? id;
-}
-
/** Where a service lives: "repo / service/path", or "repo repository" for a repo root. */
export function nodeLocation(node: Pick<SystemNode, "repo" | "service_path">): string {
return node.service_path ? `${node.repo} / ${node.service_path}` : `${node.repo} repository`;
diff --git a/packages/web/src/components/dashboard/community-summary-grid-wrapper.tsx b/packages/web/src/components/dashboard/community-summary-grid-wrapper.tsx
deleted file mode 100644
index a6eb1c213..000000000
--- a/packages/web/src/components/dashboard/community-summary-grid-wrapper.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-"use client";
-
-import { useState } from "react";
-import { CommunitySummaryGrid as CommunitySummaryGridShell } from "@repowise-dev/ui/dashboard/community-summary-grid";
-import { useCommunityDetail } from "@/lib/hooks/use-graph";
-import type { CommunityDetail, CommunitySummaryItem } from "@repowise-dev/types/graph";
-
-interface Props {
- communities: CommunitySummaryItem[];
- repoId: string;
-}
-
-/**
- * Lifts `useCommunityDetail` into the wrapper. The original component
- * spawned the hook inside an inner `CommunityDetail` subcomponent which
- * was rendered (and unmounted) per-row; pulling the active id up here
- * keeps a single SWR subscription per click and lets the shell stay
- * presentational.
- */
-export function CommunitySummaryGridWrapper({ communities, repoId }: Props) {
- const [activeId, setActiveId] = useState<number | null>(null);
- const { community, isLoading } = useCommunityDetail(repoId, activeId);
-
- const details: Record<number, CommunityDetail | null> =
- activeId != null && community ? { [activeId]: community } : {};
-
- return (
- <CommunitySummaryGridShell
- communities={communities}
- repoId={repoId}
- details={details}
- loadingDetailId={isLoading ? activeId : null}
- onExpand={(id) => setActiveId(id)}
- />
- );
-}
diff --git a/packages/web/src/lib/api/c4.ts b/packages/web/src/lib/api/c4.ts
deleted file mode 100644
index d30bb9fde..000000000
--- a/packages/web/src/lib/api/c4.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import "./client";
-
-export * from "@repowise-dev/api-client/c4";
diff --git a/packages/web/src/lib/api/external-systems.ts b/packages/web/src/lib/api/external-systems.ts
deleted file mode 100644
index 324dc87e6..000000000
--- a/packages/web/src/lib/api/external-systems.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import "./client";
-
-export * from "@repowise-dev/api-client/external-systems";
diff --git a/packages/web/src/lib/api/knowledge-map.ts b/packages/web/src/lib/api/knowledge-map.ts
deleted file mode 100644
index b6d765062..000000000
--- a/packages/web/src/lib/api/knowledge-map.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import "./client";
-
-export * from "@repowise-dev/api-client/knowledge-map";
diff --git a/packages/web/src/lib/hooks/use-c4-context.ts b/packages/web/src/lib/hooks/use-c4-context.ts
deleted file mode 100644
index 45ff33649..000000000
--- a/packages/web/src/lib/hooks/use-c4-context.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-"use client";
-
-/**
- * Side-data hooks for the C4 inspector.
- *
- * - useC4DocsPathSet: one fetch per repo → Set of paths that already have a
- * generated wiki page. Used to render the "has docs" badge on container /
- * component nodes without N+1 round-trips.
- *
- * - useC4SelectionContext: per-selection fetch → module health + page body
- * for the active container/component path. Skipped for system / person /
- * external selections.
- */
-
-import { useMemo } from "react";
-import useSWR from "swr";
-import { listAllPages, getPageById } from "@/lib/api/pages";
-import { getModuleHealth } from "@/lib/api/modules";
-import type { ModuleHealthDetail, PageResponse } from "@/lib/api/types";
-
-const SWR_OPTS = { revalidateOnFocus: false, revalidateOnReconnect: false };
-
-const DOC_PAGE_TYPES = new Set(["module_page", "file_page"]);
-
-interface DocsIndex {
- pathSet: ReadonlySet<string>;
- pageIdByPath: ReadonlyMap<string, string>;
-}
-
-const EMPTY_DOCS_INDEX: DocsIndex = {
- pathSet: new Set(),
- pageIdByPath: new Map(),
-};
-
-export function useC4DocsPathSet(repoId: string | null): DocsIndex {
- const { data } = useSWR<PageResponse[]>(
- repoId ? `c4-docs-index:${repoId}` : null,
- () => listAllPages(repoId!),
- SWR_OPTS,
- );
- return useMemo(() => {
- if (!data) return EMPTY_DOCS_INDEX;
- const pathSet = new Set<string>();
- const pageIdByPath = new Map<string, string>();
- for (const p of data) {
- if (!DOC_PAGE_TYPES.has(p.page_type)) continue;
- if (!p.target_path) continue;
- pathSet.add(p.target_path);
- // Prefer module_page over file_page when both exist for the same path.
- const existingId = pageIdByPath.get(p.target_path);
- if (!existingId || p.page_type === "module_page") {
- pageIdByPath.set(p.target_path, p.id);
- }
- }
- return { pathSet, pageIdByPath };
- }, [data]);
-}
-
-export interface C4SelectionContext {
- health: ModuleHealthDetail | null;
- page: PageResponse | null;
- isLoading: boolean;
-}
-
-export function useC4SelectionContext(
- repoId: string | null,
- path: string | null,
- pageId: string | null,
-): C4SelectionContext {
- const { data: health, isLoading: healthLoading } = useSWR<ModuleHealthDetail>(
- repoId && path ? `c4-health:${repoId}:${path}` : null,
- () => getModuleHealth(repoId!, path!),
- SWR_OPTS,
- );
-
- const { data: page, isLoading: pageLoading } = useSWR<PageResponse>(
- pageId ? `c4-page:${pageId}` : null,
- () => getPageById(pageId!, repoId ?? undefined),
- SWR_OPTS,
- );
-
- return {
- health: (health as ModuleHealthDetail | undefined) ?? null,
- page: (page as PageResponse | undefined) ?? null,
- isLoading: healthLoading || pageLoading,
- };
-}
diff --git a/packages/web/src/lib/hooks/use-graph.ts b/packages/web/src/lib/hooks/use-graph.ts
index df6ad317f..50916910f 100644
--- a/packages/web/src/lib/hooks/use-graph.ts
+++ b/packages/web/src/lib/hooks/use-graph.ts
@@ -4,7 +4,6 @@ import type { ZoomMap } from "@repowise-dev/ui/zoom";
import useSWR from "swr";
import {
getArchitecture,
- getArchitectureGraph,
getCallersCallees,
getCommunities,
getCommunityDetail,
@@ -83,15 +82,6 @@ export function useArchitectureCommunityGraph(
return { graph: data, error, isLoading };
}
-export function useArchitectureGraph(repoId: string | null) {
- const { data, error, isLoading } = useSWR<GraphExportResponse>(
- repoId ? `arch-graph:${repoId}` : null,
- () => getArchitectureGraph(repoId!),
- SWR_OPTS,
- );
- return { graph: data, error, isLoading };
-}
-
export function useDeadCodeGraph(repoId: string | null) {
const { data, error, isLoading } = useSWR<DeadCodeGraphResponse>(
repoId ? `dead-graph:${repoId}` : null,
diff --git a/packages/web/src/lib/hooks/use-workspace.ts b/packages/web/src/lib/hooks/use-workspace.ts
index 3103d64ba..9b4064ea6 100644
--- a/packages/web/src/lib/hooks/use-workspace.ts
+++ b/packages/web/src/lib/hooks/use-workspace.ts
@@ -2,9 +2,6 @@
import useSWR from "swr";
import {
- getWorkspace,
- getWorkspaceContracts,
- getWorkspaceCoChanges,
getWorkspaceSystemGraph,
getWorkspaceGraph,
getWorkspaceBlastRadius,
@@ -13,9 +10,6 @@ import {
getWorkspaceArchitecture,
} from "@/lib/api/workspace";
import type {
- WorkspaceResponse,
- WorkspaceContractsResponse,
- WorkspaceCoChangesResponse,
WorkspaceSystemGraphResponse,
WorkspaceGraphResponse,
WorkspaceBlastRadiusResponse,
@@ -24,48 +18,6 @@ import type {
WorkspaceArchitectureResponse,
} from "@/lib/api/types";
-export function useWorkspace() {
- const { data, error, isLoading } = useSWR<WorkspaceResponse>(
- "workspace",
- () => getWorkspace(),
- { refreshInterval: 60_000, revalidateOnFocus: false },
- );
- return {
- workspace: data ?? null,
- isWorkspace: data?.is_workspace ?? false,
- isLoading,
- error,
- };
-}
-
-export function useWorkspaceContracts(opts?: {
- contract_type?: string;
- repo?: string;
- role?: string;
-}) {
- const key = `workspace:contracts:${JSON.stringify(opts ?? {})}`;
- const { data, error, isLoading } = useSWR<WorkspaceContractsResponse>(
- key,
- () => getWorkspaceContracts(opts),
- { revalidateOnFocus: false },
- );
- return { data: data ?? null, isLoading, error };
-}
-
-export function useWorkspaceCoChanges(opts?: {
- repo?: string;
- min_strength?: number;
- limit?: number;
-}) {
- const key = `workspace:co-changes:${JSON.stringify(opts ?? {})}`;
- const { data, error, isLoading } = useSWR<WorkspaceCoChangesResponse>(
- key,
- () => getWorkspaceCoChanges(opts),
- { revalidateOnFocus: false },
- );
- return { data: data ?? null, isLoading, error };
-}
-
export function useWorkspaceSystemGraph() {
const { data, error, isLoading } = useSWR<WorkspaceSystemGraphResponse>(
"workspace:system-graph",