← 返回
未分类 中文

Nm Cartograph Code Communities

Detects architectural clusters and coupling boundaries via community detection on the code graph
通过代码图的社区检测识别架构聚类和耦合边界
athola athola 来源
未分类 clawhub v1.9.12 4 版本 99795.1 Key: 无需
★ 0
Stars
📥 487
下载
💾 1
安装
4
版本
#latest

概述

> Night Market Skill — ported from claude-night-market/cartograph. For the full experience with agents, hooks, and commands, install the Claude Code plugin.

Code Community Detection

Identify architectural clusters and module boundaries

in the codebase.

Prerequisites

This skill requires the gauntlet plugin for graph

data. Discover it:

GRAPH_QUERY=$(find ~/.claude/plugins -name "graph_query.py" -path "*/gauntlet/*" 2>/dev/null | head -1)

If gauntlet is not installed: Fall back to directory

structure analysis. Group files by directory and use

import statements to identify module boundaries. Generate

a Mermaid diagram from directory-level relationships.

If installed but no graph.db: Tell the user to run

/gauntlet-graph build.

Steps

  1. Run community detection (requires gauntlet):

```bash

python3 "$GRAPH_QUERY" --action communities

```

Fallback (no gauntlet): Analyze directory structure

and cross-directory imports:

```bash

# Directory-level grouping

find . -name ".py" -not -path "/node_modules/*" | \

sed 's|/[^/]*$||' | sort | uniq -c | sort -rn

# Cross-directory imports (rg preferred, grep fallback)

if command -v rg &>/dev/null; then

rg "^from |^import " --type py -l . | \

xargs -I{} rg "^from \w+ import|^import \w+" {} --no-filename

else

grep -rh "^from \|^import " --include="*.py" .

fi | sort | uniq -c | sort -rn | head -20

```

Group by top-level directories and count cross-directory

imports to estimate coupling.

  1. Display clusters:

```

Community | Nodes | Cohesion | Description

auth | 12 | 0.85 | Authentication module

db | 8 | 0.92 | Database access layer

api/handlers | 15 | 0.71 | API request handlers

utils | 6 | 0.45 | Shared utilities

```

  1. Show coupling warnings: If communities have

>10 cross-boundary edges, highlight them:

```

WARNING: High coupling between 'auth' and 'api/handlers'

(23 cross-community edges, severity: high)

```

  1. Generate Mermaid diagram:

```mermaid

flowchart TB

subgraph auth[Auth Module - cohesion 0.85]

verify_token

check_permissions

end

subgraph db[DB Layer - cohesion 0.92]

execute_query

connection_pool

end

auth -->|"23 edges"| api

db -->|"5 edges"| api

```

  1. Suggest improvements:
    • Low cohesion (<0.5): "Consider splitting this

module into more focused components"

  • High coupling (>20 edges): "Consider introducing

an interface to reduce direct dependencies"

Algorithm

Uses the Leiden algorithm (when igraph is available)

with edge-type-specific weights. Falls back to

file-based grouping otherwise.

Edge TypeWeight
-------------------
CALLS1.0
INHERITS0.8
IMPLEMENTS0.7
IMPORTS_FROM0.5
TESTED_BY0.4
CONTAINS0.3

版本历史

共 4 个版本

  • v1.9.12 当前
    2026-06-19 19:51 安全 安全
  • v1.0.3
    2026-06-09 17:47 安全 安全
  • v1.0.2
    2026-05-09 16:37 安全 安全
  • v1.0.1
    2026-05-07 10:51 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 72 📥 181,809
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 677 📥 327,219
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 195 📥 67,627