Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"touched":[],"bashMutation":true,"reportedFindings":[],"findingEvents":[],"baseline":null,"stateErrors":[],"omittedReportedFindings":0,"omittedFindingEvents":0,"processing":null,"updatedAt":"2026-11-04T22:09:37.499Z"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"schemaVersion": "mimosa-hook-status/v1",
"recordedAt": "2026-11-04T22:12:45.504Z",
"sessionId": "sess_5b750df8-4e1d-4e41-af03-159099d06328",
"event": "PostToolUse",
"toolName": "Write",
"file": "C:\\Users\\Saraye Tell\\.zcode\\workspace\\1793817739219-f969f7f5-f09b-41b6-bbb8-59977b8fdd35\\pr-body.md",
"outcome": "clear",
"coverage": "complete",
"findingCount": 0,
"durationMs": 9,
"hostState": "hook_complete",
"reportHint": ".mimosa/reports/"
}
4 changes: 4 additions & 0 deletions external_plugins/graphify-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__/
*.pyc
.graphify/
.mimosa/
24 changes: 24 additions & 0 deletions external_plugins/graphify-plugin/.zcode-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "graphify-plugin",
"version": "0.1.0",
"description": "Turns a codebase into a queryable knowledge graph: scans code, docs and config files, extracts files, symbols, imports and doc references, and produces graph.json (9 query commands), an interactive graph.html and a markdown report under <target>/.graphify/.",
"description_i18n": {
"en": "Turns a codebase into a queryable knowledge graph: scans code, docs and config files, extracts files, symbols, imports and doc references, and produces graph.json (9 query commands), an interactive graph.html and a markdown report under <target>/.graphify/.",
"zh-CN": "将代码库转换为可查询的知识图谱:扫描代码、文档与配置文件,提取文件、符号、import 与文档引用,在 <target>/.graphify/ 下生成可查询的 graph.json(9 个查询命令)、自包含的交互式 graph.html 与 Markdown 报告。"
},
"author": {
"name": "Movti Group",
"url": "https://github.com/movtigroup"
},
"keywords": [
"knowledge-graph",
"code-analysis",
"dependency-graph",
"static-analysis",
"architecture",
"codebase"
],
"license": "MIT",
"repository": "https://github.com/movtigroup/Graphify-plugin",
"skills": "./skills"
}
21 changes: 21 additions & 0 deletions external_plugins/graphify-plugin/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Movti Group

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
94 changes: 94 additions & 0 deletions external_plugins/graphify-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Graphify — ZCode Knowledge-Graph Plugin

[![CI](https://github.com/movtigroup/Graphify-plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/movtigroup/Graphify-plugin/actions/workflows/ci.yml)
[![Release](https://github.com/movtigroup/Graphify-plugin/actions/workflows/release.yml/badge.svg)](https://github.com/movtigroup/Graphify-plugin/actions/workflows/release.yml)

**EN** — Graphify turns a project directory into a **queryable knowledge graph**: it scans code,
docs and config files, extracts files, symbols, imports and doc references, and produces three
artifacts under `<target>/.graphify/`:

| Artifact | Purpose |
|---|---|
| `graph.json` | nodes (`code`, `doc`, `config`, `symbol`) + edges (`imports`, `contains`, `links`, `mentions`) — queryable with 9 commands |
| `graph.html` | self-contained interactive graph (no CDN, works offline) |
| `graph-report.md` | hubs, orphans (dead-code candidates), external deps, broken doc links |

**FA** — گرافیفای یک پوشهٔ پروژه را به **گراف دانش قابل کوئری** تبدیل می‌کند: کدها، مستندات و
فایل‌های کانفیگ را اسکن می‌کند و سه خروجی می‌سازد؛ بعد ایجنت به‌جای خواندن مکرر فایل‌ها از خود
گراف کوئری می‌گیرد (قلب سیستم، شعاع تأثیر تغییر، کد بی‌استفاده، لینک‌های خراب مستندات).

---

## Install (نصب)

### 1) As a ZCode plugin from this repo (recommended)

1. Open **Plugin Marketplace → Add → Add Plugin Marketplace**
2. Paste: `https://github.com/movtigroup/Graphify-plugin`
3. Install **Graphify** from the list and select the `graphify` skill in the composer picker.

### 2) Manual — copy the skill

```bash
# clone and copy the skill into your user skills directory
git clone https://github.com/movtigroup/Graphify-plugin.git
mkdir -p ~/.agents/skills
cp -r Graphify-plugin/skills/graphify ~/.agents/skills/graphify
```

### 3) Dev marketplace (local folder)

Clone the repo and add its **directory** as a marketplace:
**Plugin Marketplace → Add → Add Plugin Marketplace** → paste the cloned folder path.

---

## Usage (استفاده)

Ask your agent naturally — Persian or English:

```
graphify روی پوشهٔ X اجرا کن و بگو قلب سیستم کجاست
who imports utils.py? تغییرش چه چیزی را می‌شکند؟
این کدبیس رو graphify کن و فایل‌های مرده رو پیدا کن
```

Behind the scenes the agent runs `build_graph.py` once, reads `graph-report.md`, and answers
structural questions via `query_graph.py` (info / hubs / orphans / search / node / neighbors /
imports / imported-by / external). Full command reference in
[`skills/graphify/SKILL.md`](skills/graphify/SKILL.md).

## Requirements (نیازمندی‌ها)

- ZCode (or Claude Code) with plugin/skill support
- Python 3.8+ on PATH (`py -3` on Windows fallback). The scripts are **stdlib-only** — nothing to install.

## Side effects (اثرات جانبی)

- Runs only the two bundled Python scripts (`build_graph.py`, `query_graph.py`) — stdlib-only, **no
network access**, no third-party code or assets.
- Sole file writes: creates `.graphify/` inside the scanned project (graph.json, graph.html,
graph-report.md). Output paths are containment-checked (`realpath` + `commonpath`) and cannot
escape the output directory.
- No credentials, no machine-specific paths, no prebuilt binaries.

## Development (توسعه)

```bash
python tests/validate.py # manifest + skill structure checks
python tests/smoke_test.py # end-to-end: build + query on the sample fixture
```

CI runs both on **Ubuntu and Windows** for every push/PR; tagged releases (`v*`) are packaged as
zip and published on GitHub Releases automatically.

## Status (وضعیت)

- ✅ Plugin structure per ZCode manifest spec (`.zcode-plugin/plugin.json` + marketplace entry)
- ✅ CI on two OSes + tagged release pipeline
- ✅ Stdlib-only, no network access, writes only `<target>/.graphify/` (containment-checked)
- 🚀 Submitted to the official ZCode plugin marketplace

## License

MIT © Movti Group
57 changes: 57 additions & 0 deletions external_plugins/graphify-plugin/README_CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Graphify — ZCode 代码知识图谱插件

[![CI](https://github.com/movtigroup/Graphify-plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/movtigroup/Graphify-plugin/actions/workflows/ci.yml)
[![Release](https://github.com/movtigroup/Graphify-plugin/actions/workflows/release.yml/badge.svg)](https://github.com/movtigroup/Graphify-plugin/actions/workflows/release.yml)

**中文** — Graphify 将项目目录转换为**可查询的知识图谱**:扫描代码、文档与配置文件,提取文件、符号、import 与文档引用,并在 `<目标目录>/.graphify/` 下生成三个产物:

| 产物 | 用途 |
|---|---|
| `graph.json` | 节点(`code`/`doc`/`config`/`symbol`)+ 边(`imports`/`contains`/`links`/`mentions`),支持 9 个查询命令 |
| `graph.html` | 自包含的交互式图谱(无 CDN,可离线打开) |
| `graph-report.md` | 枢纽文件、孤立文件(疑似死代码)、外部依赖、失效文档链接 |

**English** — see [README.md](README.md). **فارسی** — [README.md](README.md) را ببینید.

## 安装

1. **Plugin Marketplace → Add → Add Plugin Marketplace**,粘贴本仓库地址;
2. 合入 ZCode 官方市场后,直接在市场列表安装 **Graphify**;
3. 手动方式:克隆后将 `skills/graphify` 复制到 `~/.agents/skills/`。

## 使用

用自然语言向智能体提问(中英文均可):

```
graphify 扫描这个项目,告诉我系统的核心文件在哪
谁 import 了 utils.py?改它会影响什么?
找出项目里的死代码
```

底层流程:智能体运行一次 `build_graph.py`,先读 `graph-report.md` 概览,再用 `query_graph.py`
的 9 个命令(info / hubs / orphans / search / node / neighbors / imports / imported-by / external)
回答结构性问题,而不是反复阅读源码文件。

## 运行要求

- Python 3.8+(仅标准库,无需 pip 安装;Windows 可用 `py -3`)。
- 支持 ZCode / Claude Code 插件或技能机制。

## 副作用与安全

- 仅运行插件自带的两个 Python 脚本(`build_graph.py` / `query_graph.py`),纯标准库,**无网络访问**。
- 唯一的文件写入:在被扫描项目下创建 `.graphify/` 目录;输出路径经过 `realpath` + `commonpath`
包含性校验,不会逃逸出输出目录。
- 不含凭据、机器特定路径、混淆代码、预编译二进制或第三方代码/资产。

## 开发

```bash
python tests/validate.py # 结构校验
python tests/smoke_test.py # 端到端:构建 + 查询
```

## 许可证

MIT © Movti Group
86 changes: 86 additions & 0 deletions external_plugins/graphify-plugin/skills/graphify/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
name: graphify
description: >
Build a queryable knowledge graph of a codebase — code, docs and config files — and answer
structural questions from the graph instead of re-reading the whole repo. Produces graph.json
(queryable), graph.html (interactive), graph-report.md (summary). Use whenever the user says
"graphify", asks for a knowledge graph, project map, architecture or dependency overview,
asks "who imports X", "where is X used", "how is this repo structured", or in Persian:
گراف دانش، نقشه پروژه، ساختار پروژه، گراف وابستگی. Trigger even when the user just wants to
understand a codebase before changing it.
---

# Graphify — codebase knowledge graph (گراف دانش کدبیس)

Scan a project directory, build a knowledge graph of what is in it and how things connect, then
answer structural questions from that graph instead of loading file after file into context.

> 🇮🇷 این اسکیل یک پوشهٔ پروژه را اسکن می‌کند، گراف دانشی از محتوا و ارتباط‌ها می‌سازد و بعد سؤال‌های ساختاری را از خود گراف جواب می‌دهد — نه با خواندن تک‌تک فایل‌ها.

## Artifacts — everything lands in `<target>/.graphify/`

| File | Purpose |
|---|---|
| `graph.json` | nodes (`code`, `doc`, `config`, `symbol`) + edges (`imports`, `contains`, `links`, `mentions`) |
| `graph.html` | self-contained interactive graph — give this path to the user to open in a browser |
| `graph-report.md` | summary: hubs, orphans, external deps, missing links — **read this first** |

> 🇮🇷 سه خروجی: JSON قابل کوئری، HTML تعاملی برای مرورگر، و گزارش مارک‌داون برای شروع.

## Workflow

1. If the target root is ambiguous, ask the user; otherwise default to the current working directory.
2. Build the graph (replace `<skill_dir>` with this skill's base directory, and `<target>` with the project root):
```bash
python "<skill_dir>/scripts/build_graph.py" "<target>"
```
On Windows, if `python` is not found use `py -3`. The script is stdlib-only — nothing to install.
3. Read `<target>/.graphify/graph-report.md` — it is short and answers most overview questions on its own.
4. For anything more specific, query the graph with `query_graph.py` (below) **instead of reading many
source files**. That is the whole point: a graph lookup is far cheaper than re-reading the repo.
5. Give the user the path to `graph.html` and summarize what you found.

> 🇮🇷 مراحل: بساز → گزارش را بخوان → برای سؤال‌های دقیق‌تر از گراف کوئری بگیر → مسیر HTML را به کاربر بده.

## Querying

```bash
python "<skill_dir>/scripts/query_graph.py" "<target>/.graphify/graph.json" <command>
```

| Command | Answers |
|---|---|
| `info` | size, node/edge counts, top external dependencies |
| `hubs [N]` | most-connected files — the core of the system |
| `orphans` | code files nothing imports — dead-code candidates |
| `search <term>` | find nodes by name or path |
| `node <ref>` | full detail + direct edges of one node |
| `neighbors <ref> [--kind K] [--dir in/out]` | first-degree graph around a node |
| `imports <ref>` | what this file imports (project-internal only) |
| `imported-by <ref>` | what depends on this file — the blast radius of changing it |
| `external [N]` | top third-party packages |

`<ref>` accepts a full node id (`src/app.py`), a bare file name (`app.py`), or a symbol id
(`src/app.py::main`). If several nodes match, the script lists them — pick the right one and re-run.
Add `--json` to any command for raw JSON output.

> 🇮🇷 دستورهای کلیدی: `hubs` قلب سیستم را نشان می‌دهد، `imported-by` شعاع تأثیر تغییرها، `orphans` کد بی‌استفاده.

## Reading the graph

- Edge kinds: `imports` (file→file), `contains` (file→symbol), `links` (doc→file via markdown link),
`mentions` (doc references a path in backticks).
- Symbol nodes are `file.py::name`. Treat them as cheap pointers: answer "where is X defined/used"
from the graph; open the real file only when the user needs the implementation itself.

> 🇮🇷 انواع یال: `imports` واردکردن فایل، `contains` داشتن نماد، `links` لینک مارک‌داون، `mentions` اشارهٔ متنی به مسیر.

## Limits (so you don't over-promise)

- Static and heuristic: regex/AST over text. Dynamic imports, reflection and re-exports may be missed.
A missing import edge is *not* a bug report.
- Scope is code + text docs + configs. Images, PDFs, binaries and notebooks are skipped.
- Very large repos: the HTML renders the 600 most-connected nodes (the JSON always has everything).
- The graph is a snapshot. If the user just made big edits, rebuild before answering.

> 🇮🇷 محدودیت‌ها: تحلیل ایستا و تقریبی است؛ فقط کد، متن و کانفیگ؛ در مخزن‌های خیلی بزرگ HTML تا ۶۰۰ گرهٔ پرارتفاع را نشان می‌دهد؛ بعد از تغییرهای بزرگ گراف را دوباره بساز.
Loading