技能 编程开发 代码知识图谱可视化

代码知识图谱可视化

v20260406
understand-dashboard
该工具用于启动一个交互式Web仪表板,以可视化地展示目标代码库的知识图谱。它可以帮助开发者直观地掌握整个项目的结构和复杂关系,清晰地描绘出模块间的依赖关系和代码的知识网络,从而大幅提升对复杂代码库的理解效率。
获取技能
382 次下载
概览

/understand-dashboard

Start the Understand Anything dashboard to visualize the knowledge graph for the current project.

Instructions

  1. Determine the project directory:
  • If $ARGUMENTS contains a path, use that as the project directory
  • Otherwise, use the current working directory
  1. Check that .understand-anything/knowledge-graph.json exists in the project directory. If not, tell the user:

```
No knowledge graph found. Run /understand first to analyze this project.
```

  1. Find the dashboard code. The dashboard is at packages/dashboard/ relative to this plugin's root directory. Check these paths in order and use the first that exists:
  • ~/.understand-anything-plugin/packages/dashboard/ (universal symlink, all installs)
  • ${CLAUDE_PLUGIN_ROOT}/packages/dashboard/ (Claude Code plugin)
  • Two levels up from this skill file's real path: ../../packages/dashboard/ (self-relative fallback)

Use the Bash tool to resolve:
```bash
SKILL_REAL=$(realpath ~/.agents/skills/understand-dashboard 2>/dev/null || readlink -f ~/.agents/skills/understand-dashboard 2>/dev/null || echo "")
SELFRELATIVE=$([ -n "$SKILLREAL" ] && cd "$SKILL_REAL/../.." 2>/dev/null && pwd || echo "")

PLUGIN_ROOT=""
for candidate in \
"$HOME/.understand-anything-plugin" \
"${CLAUDEPLUGINROOT}" \
"$SELF_RELATIVE"; do
if [ -n "$candidate" ] && [ -d "$candidate/packages/dashboard" ]; then
PLUGIN_ROOT="$candidate"; break
fi
done

if [ -z "$PLUGIN_ROOT" ]; then
echo "Error: Cannot find the understand-anything plugin root. Make sure you followed the installation instructions and that ~/.understand-anything-plugin exists."
exit 1
fi
```

  1. Install dependencies and build if needed:

```bash
cd && pnpm install --frozen-lockfile 2>/dev/null || pnpm install
```
Then ensure the core package is built (the dashboard depends on it):
```bash
cd && pnpm --filter @understand-anything/core build
```

  1. Start the Vite dev server pointing at the project's knowledge graph:

```bash
cd && GRAPH_DIR= npx vite --host 127.0.0.1 --open
```
Run this in the background so the user can continue working.

  1. Report to the user:

```
Dashboard started at http://localhost:5173
Viewing: /.understand-anything/knowledge-graph.json

The dashboard is running in the background. Press Ctrl+C in the terminal to stop it.
```

Notes

  • The dashboard auto-opens in the default browser via --open
  • If port 5173 is already in use, Vite will pick the next available port
  • The GRAPH_DIR environment variable tells the dashboard where to find the knowledge graph
信息
分类 编程开发
名称 understand-dashboard
版本 v20260406
大小 2.85KB
更新时间 2026-04-17
语言