баг репорт и графифай
This commit is contained in:
1
.agents/skills/graphify/.graphify_version
Normal file
1
.agents/skills/graphify/.graphify_version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
0.9.5
|
||||||
674
.agents/skills/graphify/SKILL.md
Normal file
674
.agents/skills/graphify/SKILL.md
Normal file
@@ -0,0 +1,674 @@
|
|||||||
|
---
|
||||||
|
name: graphify
|
||||||
|
description: "Use for any question about a codebase, its architecture, file relationships, or project content — especially when graphify-out/ exists, where the question should be treated as a graphify query first. Turns any input (code, docs, papers, images, videos) into a persistent knowledge graph with god nodes, community detection, and query/path/explain tools."
|
||||||
|
---
|
||||||
|
|
||||||
|
# /graphify
|
||||||
|
|
||||||
|
Turn any folder of files into a navigable knowledge graph with community detection, an honest audit trail, and three outputs: interactive HTML, GraphRAG-ready JSON, and a plain-language GRAPH_REPORT.md.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
/graphify # full pipeline on current directory → Obsidian vault
|
||||||
|
/graphify <path> # full pipeline on specific path
|
||||||
|
/graphify https://github.com/<owner>/<repo> # clone repo then run full pipeline on it
|
||||||
|
/graphify https://github.com/<owner>/<repo> --branch <branch> # clone a specific branch
|
||||||
|
/graphify <url1> <url2> ... # clone multiple repos, build each, merge into one cross-repo graph
|
||||||
|
/graphify <path> --mode deep # thorough extraction, richer INFERRED edges
|
||||||
|
/graphify <path> --update # incremental - re-extract only new/changed files
|
||||||
|
/graphify <path> --directed # build directed graph (preserves edge direction: source→target)
|
||||||
|
/graphify <path> --whisper-model medium # use a larger Whisper model for better transcription accuracy
|
||||||
|
/graphify <path> --cluster-only # rerun clustering on existing graph
|
||||||
|
/graphify <path> --no-viz # skip visualization, just report + JSON
|
||||||
|
/graphify <path> --html # (HTML is generated by default - this flag is a no-op)
|
||||||
|
/graphify <path> --svg # also export graph.svg (embeds in Notion, GitHub)
|
||||||
|
/graphify <path> --graphml # export graph.graphml (Gephi, yEd)
|
||||||
|
/graphify <path> --neo4j # generate graphify-out/cypher.txt for Neo4j
|
||||||
|
/graphify <path> --neo4j-push bolt://localhost:7687 # push directly to Neo4j
|
||||||
|
/graphify <path> --falkordb # generate graphify-out/cypher.txt for FalkorDB
|
||||||
|
/graphify <path> --falkordb-push falkordb://localhost:6379 # push directly to FalkorDB
|
||||||
|
/graphify <path> --mcp # start MCP stdio server for agent access
|
||||||
|
/graphify <path> --watch # watch folder, auto-rebuild on code changes (no LLM needed)
|
||||||
|
/graphify <path> --wiki # build agent-crawlable wiki (index.md + one article per community)
|
||||||
|
/graphify <path> --obsidian --obsidian-dir ~/vaults/my-project # write vault to custom path (e.g. existing vault)
|
||||||
|
/graphify add <url> # fetch URL, save to ./raw, update graph
|
||||||
|
/graphify add <url> --author "Name" # tag who wrote it
|
||||||
|
/graphify add <url> --contributor "Name" # tag who added it to the corpus
|
||||||
|
/graphify query "<question>" # BFS traversal - broad context
|
||||||
|
/graphify query "<question>" --dfs # DFS - trace a specific path
|
||||||
|
/graphify query "<question>" --budget 1500 # cap answer at N tokens
|
||||||
|
/graphify path "AuthModule" "Database" # shortest path between two concepts
|
||||||
|
/graphify explain "SwinTransformer" # plain-language explanation of a node
|
||||||
|
```
|
||||||
|
|
||||||
|
## What graphify is for
|
||||||
|
|
||||||
|
Drop any folder of code, docs, papers, images, or video into graphify and get a queryable knowledge graph. Persistent across sessions, honest audit trail (EXTRACTED/INFERRED/AMBIGUOUS), community detection surfaces cross-document connections you wouldn't think to ask about.
|
||||||
|
|
||||||
|
## What You Must Do When Invoked
|
||||||
|
|
||||||
|
If the user invoked `/graphify --help` or `/graphify -h` (with no other arguments), print the contents of the `## Usage` section above verbatim and stop. Do not run any commands, do not detect files, do not default the path to `.`. Just print the Usage block and return.
|
||||||
|
|
||||||
|
**Fast path — existing graph:** Before doing anything else, check whether `graphify-out/graph.json` exists. The expected location is `graphify-out/graph.json` relative to the **current working directory** (i.e. the project root where you are running commands). If it exists AND the user's request is a natural-language question about the codebase (e.g. "How does X work?", "What calls Y?", "Trace the data flow through Z") and NOT an explicit rebuild command (`--update`, `--cluster-only`, or a bare path/URL that implies fresh extraction): **skip Steps 1–5 entirely and jump straight to `## For /graphify query`.** Run `graphify query "<question>"` immediately. Do not run detect. Do not check corpus size. Do not ask the user to narrow. The graph is already built — use it.
|
||||||
|
|
||||||
|
If no path was given, use `.` (current directory). Do not ask the user for a path.
|
||||||
|
|
||||||
|
If the path argument starts with `https://github.com/` or `http://github.com/`, treat it as a GitHub URL - run Step 0 before anything else, then continue with the resolved local path.
|
||||||
|
|
||||||
|
Follow these steps in order. Do not skip steps.
|
||||||
|
|
||||||
|
### Step 0 - GitHub repos and multi-path merge (only if a URL or several paths)
|
||||||
|
|
||||||
|
Only when the path is one or more `https://github.com/...` URLs, or several local subfolders to merge. See `references/github-and-merge.md` for the clone, cross-repo merge, and monorepo flow, then continue with the resolved local path. A plain local path skips this step.
|
||||||
|
|
||||||
|
### Step 1 - Ensure graphify is installed
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Detect the correct Python interpreter (handles uv tool, pipx, venv, system installs)
|
||||||
|
PYTHON=""
|
||||||
|
GRAPHIFY_BIN=$(which graphify 2>/dev/null)
|
||||||
|
# 1. uv tool installs — most reliable on modern Mac/Linux
|
||||||
|
if [ -z "$PYTHON" ] && command -v uv >/dev/null 2>&1; then
|
||||||
|
_UV_PY=$(uv tool run graphifyy python -c "import sys; print(sys.executable)" 2>/dev/null)
|
||||||
|
if [ -n "$_UV_PY" ]; then PYTHON="$_UV_PY"; fi
|
||||||
|
fi
|
||||||
|
# 2. Read shebang from graphify binary (pipx and direct pip installs)
|
||||||
|
if [ -z "$PYTHON" ] && [ -n "$GRAPHIFY_BIN" ]; then
|
||||||
|
_SHEBANG=$(head -1 "$GRAPHIFY_BIN" | tr -d '#!')
|
||||||
|
case "$_SHEBANG" in
|
||||||
|
*[!a-zA-Z0-9/_.@-]*) ;;
|
||||||
|
*) "$_SHEBANG" -c "import graphify" 2>/dev/null && PYTHON="$_SHEBANG" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
# 3. Fall back to python3
|
||||||
|
if [ -z "$PYTHON" ]; then PYTHON="python3"; fi
|
||||||
|
if ! "$PYTHON" -c "import graphify" 2>/dev/null; then
|
||||||
|
if command -v uv >/dev/null 2>&1; then
|
||||||
|
uv tool install --upgrade graphifyy -q 2>&1 | tail -3
|
||||||
|
_UV_PY=$(uv tool run graphifyy python -c "import sys; print(sys.executable)" 2>/dev/null)
|
||||||
|
if [ -n "$_UV_PY" ]; then PYTHON="$_UV_PY"; fi
|
||||||
|
else
|
||||||
|
"$PYTHON" -m pip install graphifyy -q 2>/dev/null \
|
||||||
|
|| "$PYTHON" -m pip install graphifyy -q --break-system-packages 2>&1 | tail -3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Write interpreter path for all subsequent steps (persists across invocations)
|
||||||
|
mkdir -p graphify-out
|
||||||
|
"$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)"
|
||||||
|
# Save scan root so `graphify update` (no args) knows where to look next time
|
||||||
|
echo "$(cd INPUT_PATH && pwd)" > graphify-out/.graphify_root
|
||||||
|
```
|
||||||
|
|
||||||
|
If the import succeeds, print nothing and move straight to Step 2.
|
||||||
|
|
||||||
|
**In every subsequent bash block, replace `python3` with `$(cat graphify-out/.graphify_python)` to use the correct interpreter.**
|
||||||
|
|
||||||
|
### Step 2 - Detect files
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from graphify.detect import detect
|
||||||
|
from pathlib import Path
|
||||||
|
result = detect(Path('INPUT_PATH'))
|
||||||
|
print(json.dumps(result, ensure_ascii=False))
|
||||||
|
" > graphify-out/.graphify_detect.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace INPUT_PATH with the actual path the user provided. Do NOT cat or print the JSON - read it silently and present a clean summary instead:
|
||||||
|
|
||||||
|
```
|
||||||
|
Corpus: X files · ~Y words
|
||||||
|
code: N files (.py .ts .go ...)
|
||||||
|
docs: N files (.md .txt ...)
|
||||||
|
papers: N files (.pdf ...)
|
||||||
|
images: N files
|
||||||
|
video: N files (.mp4 .mp3 ...)
|
||||||
|
```
|
||||||
|
|
||||||
|
Omit any category with 0 files from the summary.
|
||||||
|
|
||||||
|
Then act on it:
|
||||||
|
- If `total_files` is 0: stop with "No supported files found in [path]."
|
||||||
|
- If `skipped_sensitive` is non-empty: mention file count skipped, not the file names.
|
||||||
|
- If `total_words` > 2,000,000 OR `total_files` > 500: show the warning. Then compute the top 5 first-level subdirectories by file count:
|
||||||
|
- Read `scan_root` from the detect JSON (always an absolute path to the resolved INPUT_PATH).
|
||||||
|
- Concatenate all file lists across all types (`code`, `document`, `paper`, `image`, `video`).
|
||||||
|
- Filter out any path that starts with `scan_root + "/graphify-out/"` to exclude converted sidecars.
|
||||||
|
- For each file, strip the `scan_root` prefix and take the first path component. Files directly in `scan_root` with no subdirectory count as `(root)`.
|
||||||
|
- If all files are in `(root)` with no subdirectories, do not ask to narrow — no subfolders exist. Instead suggest `--no-cluster` to skip the expensive clustering step and proceed.
|
||||||
|
- Otherwise rank by count, show the top 5 with file counts, then ask which subfolder to run on. Wait for the user's answer before proceeding.
|
||||||
|
- Otherwise: proceed directly to Step 2.5 if video files were detected, or Step 3 if not.
|
||||||
|
|
||||||
|
### Step 2.5 - Video and audio (only if video files detected)
|
||||||
|
|
||||||
|
Skip this step entirely if `detect` returned zero `video` files. When the corpus has video or audio, see `references/transcribe.md` to transcribe them to text first, then treat the transcripts as doc files in Step 3.
|
||||||
|
|
||||||
|
### Step 3 - Extract entities and relationships
|
||||||
|
|
||||||
|
**Before starting:** note whether `--mode deep` was given. You must pass `DEEP_MODE=true` to every subagent in Step B2 if it was. Track this from the original invocation - do not lose it.
|
||||||
|
|
||||||
|
This step has two parts: **structural extraction** (deterministic, free) and **semantic extraction** (LLM, costs tokens).
|
||||||
|
|
||||||
|
> **graphify needs no API key. Never ask the user for one, and never block on one.** Code is extracted structurally (AST) with no LLM and no key at all — a code-only corpus (the common `/graphify .` on a repo) skips semantic extraction entirely, so it needs nothing here: go straight to Part A and skip Part B. Semantic extraction (only for docs, papers, and images) uses Gemini **only if** `GEMINI_API_KEY`/`GOOGLE_API_KEY` is already set; otherwise the host agent itself is the LLM. graphify does **not** read `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, or any other provider key. If you catch yourself about to prompt for, wait on, or stop because of a missing API key, that is a misread of this skill — proceed without one.
|
||||||
|
|
||||||
|
**Before semantic extraction:** check whether `GEMINI_API_KEY` or `GOOGLE_API_KEY` is set. If neither is set, print this one-liner to the user:
|
||||||
|
> Tip: set `GEMINI_API_KEY` or `GOOGLE_API_KEY` to use Gemini for semantic extraction (`pip install 'graphifyy[gemini]'`).
|
||||||
|
|
||||||
|
Print it once, then continue — do not wait for the user to supply a key. If `GEMINI_API_KEY` or `GOOGLE_API_KEY` IS set, use `graphify.llm.extract_corpus_parallel(files, backend="gemini")` for semantic extraction instead of dispatching subagents. The default Gemini model is `gemini-3-flash-preview`; set `GRAPHIFY_GEMINI_MODEL` or pass `--model` in headless CLI flows to override it.
|
||||||
|
|
||||||
|
> **No other API keys are read.** When `GEMINI_API_KEY`/`GOOGLE_API_KEY` are unset, semantic extraction falls to the host agent itself — the running session is the LLM. On a host that dispatches subagents (e.g. Claude Code), dispatch them as written in Part B. On a host that runs the CLI directly in a terminal and cannot dispatch subagents, do not stall: a code-only corpus has no semantic work, so write the empty semantic file (Part B "Fast path") and continue to Part C; for a corpus with docs/papers/images, either set a Gemini key or extract those inline yourself, but in no case prompt for `ANTHROPIC_API_KEY` — that prompt is a misread of this skill.
|
||||||
|
|
||||||
|
**Run Part A (AST) and Part B (semantic) in parallel. Dispatch all semantic subagents AND start AST extraction in the same message. Both can run simultaneously since they operate on different file types. Merge results in Part C as before.**
|
||||||
|
|
||||||
|
Note: Parallelizing AST + semantic saves 5-15s on large corpora. AST is deterministic and fast; start it while subagents are processing docs/papers.
|
||||||
|
|
||||||
|
#### Part A - Structural extraction for code files
|
||||||
|
|
||||||
|
For any code files detected, run AST extraction in parallel with Part B subagents:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys, json
|
||||||
|
from graphify.extract import collect_files, extract
|
||||||
|
from pathlib import Path
|
||||||
|
import json
|
||||||
|
|
||||||
|
code_files = []
|
||||||
|
detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
|
||||||
|
for f in detect.get('files', {}).get('code', []):
|
||||||
|
code_files.extend(collect_files(Path(f)) if Path(f).is_dir() else [Path(f)])
|
||||||
|
|
||||||
|
if code_files:
|
||||||
|
result = extract(code_files, cache_root=Path('INPUT_PATH'))
|
||||||
|
Path('graphify-out/.graphify_ast.json').write_text(json.dumps(result, indent=2, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print(f'AST: {len(result[\"nodes\"])} nodes, {len(result[\"edges\"])} edges')
|
||||||
|
else:
|
||||||
|
Path('graphify-out/.graphify_ast.json').write_text(json.dumps({'nodes':[],'edges':[],'input_tokens':0,'output_tokens':0}, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print('No code files - skipping AST extraction')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Part B - Semantic extraction (parallel subagents)
|
||||||
|
|
||||||
|
**Fast path:** If detection found zero docs, papers, and images (code-only corpus), skip Part B entirely and go straight to Part C. AST handles code - there is nothing for semantic subagents to do. **First write an empty semantic file** so Part C's merge has its input (it reads `.graphify_semantic.json` unconditionally; without this a code-only run hits `FileNotFoundError`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
Path('graphify-out/.graphify_semantic.json').write_text(json.dumps({'nodes':[],'edges':[],'hyperedges':[],'input_tokens':0,'output_tokens':0}), encoding='utf-8')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
**MANDATORY: You MUST use the Agent tool here. Reading files yourself one-by-one is forbidden - it is 5-10x slower. If you do not use the Agent tool you are doing this wrong.**
|
||||||
|
|
||||||
|
Before dispatching subagents, print a timing estimate:
|
||||||
|
- Load `total_words` and file counts from `graphify-out/.graphify_detect.json`
|
||||||
|
- Estimate agents needed: `ceil(uncached_non_code_files / 22)` (chunk size is 20-25)
|
||||||
|
- Estimate time: ~45s per agent batch (they run in parallel, so total ≈ 45s × ceil(agents/parallel_limit))
|
||||||
|
- Print: "Semantic extraction: ~N files → X agents, estimated ~Ys"
|
||||||
|
|
||||||
|
**Step B0 - Check extraction cache first**
|
||||||
|
|
||||||
|
Before dispatching any subagents, check which files already have cached extraction results:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from graphify.cache import check_semantic_cache
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
|
||||||
|
# Only content files go to semantic extraction. Code is already covered structurally
|
||||||
|
# by the AST pass (Part A); flattening every category here makes subagents re-read
|
||||||
|
# every source file (#1392). Video is transcribed to a document in Step 2.5 first.
|
||||||
|
all_files = [f for cat in ('document', 'paper', 'image') for f in detect['files'].get(cat, [])]
|
||||||
|
|
||||||
|
cached_nodes, cached_edges, cached_hyperedges, uncached = check_semantic_cache(all_files, root='INPUT_PATH')
|
||||||
|
|
||||||
|
# Always (re)write the cache file: write hits, else DELETE any leftover from a prior
|
||||||
|
# run so Part C never merges a stale .graphify_cached.json (#1392).
|
||||||
|
if cached_nodes or cached_edges or cached_hyperedges:
|
||||||
|
Path('graphify-out/.graphify_cached.json').write_text(json.dumps({'nodes': cached_nodes, 'edges': cached_edges, 'hyperedges': cached_hyperedges}, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
else:
|
||||||
|
Path('graphify-out/.graphify_cached.json').unlink(missing_ok=True)
|
||||||
|
Path('graphify-out/.graphify_uncached.txt').write_text('\n'.join(uncached), encoding=\"utf-8\")
|
||||||
|
print(f'Cache: {len(all_files)-len(uncached)} files hit, {len(uncached)} files need extraction')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Only dispatch subagents for files listed in `graphify-out/.graphify_uncached.txt`. If all files are cached, skip to Part C directly.
|
||||||
|
|
||||||
|
**Step B1 - Split into chunks**
|
||||||
|
|
||||||
|
Load files from `graphify-out/.graphify_uncached.txt`. Split into chunks of 20-25 files each. Each image gets its own chunk (vision needs separate context). When splitting, group files from the same directory together so related artifacts land in the same chunk and cross-file relationships are more likely to be extracted.
|
||||||
|
|
||||||
|
**Step B2 - Dispatch ALL subagents in a single message (Codex)**
|
||||||
|
|
||||||
|
> **Codex platform:** Uses `spawn_agent` + `wait_agent` + `close_agent` instead of the Agent tool.
|
||||||
|
> Requires `multi_agent = true` under `[features]` in `~/.codex/config.toml`.
|
||||||
|
> If `spawn_agent` is unavailable, tell the user to add that config and restart Codex.
|
||||||
|
|
||||||
|
Call `spawn_agent` once per chunk — ALL in the same response so they run in parallel. Build the message by wrapping the extraction prompt in task-delegation framing:
|
||||||
|
|
||||||
|
```
|
||||||
|
spawn_agent(agent_type="worker", message="Your task is to perform the following. Follow the instructions below exactly.\n\n<agent-instructions>\n[extraction prompt, with FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, DEEP_MODE substituted]\n</agent-instructions>\n\nExecute this now. Output ONLY the structured JSON response.")
|
||||||
|
```
|
||||||
|
|
||||||
|
After all agents are dispatched, collect results sequentially in memory:
|
||||||
|
```
|
||||||
|
result = wait_agent(handle); close_agent(handle) # repeat per handle
|
||||||
|
```
|
||||||
|
|
||||||
|
Parse each result as JSON. Accumulate nodes/edges/hyperedges across all results and write to `graphify-out/.graphify_semantic_new.json`. Codex collects in memory, so there are no per-chunk files on disk; the disk-based success checks in Step B3 do not apply — a chunk that returns invalid JSON is the failure signal instead.
|
||||||
|
|
||||||
|
Subagent prompt template:
|
||||||
|
|
||||||
|
See `references/extraction-spec.md` for the compact subagent prompt (rules, node-ID format, confidence rubric, hyperedge and vision rules, JSON schema). Load it only here, only when at least one chunk holds a doc, paper, or image; a pure-code corpus has skipped Part B and never reads it. Pass each agent that prompt verbatim with FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, and DEEP_MODE substituted, and have it return the JSON inline.
|
||||||
|
|
||||||
|
**Step B3 - Collect, cache, and merge**
|
||||||
|
|
||||||
|
Wait for all subagents. For each result:
|
||||||
|
- Check that `graphify-out/.graphify_chunk_NN.json` exists on disk — this is the success signal
|
||||||
|
- If the file exists and contains valid JSON with `nodes` and `edges`, include it and save to cache
|
||||||
|
- If the file is missing, the subagent was likely dispatched as read-only (Explore type) — print a warning: "chunk N missing from disk — subagent may have been read-only. Re-run with general-purpose agent." Do not silently skip.
|
||||||
|
- If a subagent failed or returned invalid JSON, print a warning and skip that chunk - do not abort
|
||||||
|
|
||||||
|
If more than half the chunks failed or are missing, stop and tell the user to re-run and ensure `subagent_type="general-purpose"` is used.
|
||||||
|
|
||||||
|
Merge all chunk files into `.graphify_semantic_new.json`. **After each Agent call completes, read the real token counts from the Agent tool result's `usage` field and write them back into the chunk JSON before merging** — the chunk JSON itself always has placeholder zeros. Then run:
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json, glob
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
chunks = sorted(glob.glob('graphify-out/.graphify_chunk_*.json'))
|
||||||
|
all_nodes, all_edges, all_hyperedges = [], [], []
|
||||||
|
total_in, total_out = 0, 0
|
||||||
|
for c in chunks:
|
||||||
|
d = json.loads(Path(c).read_text(encoding=\"utf-8\"))
|
||||||
|
all_nodes += d.get('nodes', [])
|
||||||
|
all_edges += d.get('edges', [])
|
||||||
|
all_hyperedges += d.get('hyperedges', [])
|
||||||
|
total_in += d.get('input_tokens', 0)
|
||||||
|
total_out += d.get('output_tokens', 0)
|
||||||
|
Path('graphify-out/.graphify_semantic_new.json').write_text(json.dumps({
|
||||||
|
'nodes': all_nodes, 'edges': all_edges, 'hyperedges': all_hyperedges,
|
||||||
|
'input_tokens': total_in, 'output_tokens': total_out,
|
||||||
|
}, indent=2, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print(f'Merged {len(chunks)} chunks: {total_in:,} in / {total_out:,} out tokens')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Save new results to cache:
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from graphify.cache import save_semantic_cache
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
new = json.loads(Path('graphify-out/.graphify_semantic_new.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_semantic_new.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]}
|
||||||
|
saved = save_semantic_cache(new.get('nodes', []), new.get('edges', []), new.get('hyperedges', []), root='INPUT_PATH')
|
||||||
|
print(f'Cached {saved} files')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Merge cached + new results into `graphify-out/.graphify_semantic.json`:
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
cached = json.loads(Path('graphify-out/.graphify_cached.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_cached.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]}
|
||||||
|
new = json.loads(Path('graphify-out/.graphify_semantic_new.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_semantic_new.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]}
|
||||||
|
|
||||||
|
all_nodes = cached['nodes'] + new.get('nodes', [])
|
||||||
|
all_edges = cached['edges'] + new.get('edges', [])
|
||||||
|
all_hyperedges = cached.get('hyperedges', []) + new.get('hyperedges', [])
|
||||||
|
seen = set()
|
||||||
|
deduped = []
|
||||||
|
for n in all_nodes:
|
||||||
|
if n['id'] not in seen:
|
||||||
|
seen.add(n['id'])
|
||||||
|
deduped.append(n)
|
||||||
|
|
||||||
|
merged = {
|
||||||
|
'nodes': deduped,
|
||||||
|
'edges': all_edges,
|
||||||
|
'hyperedges': all_hyperedges,
|
||||||
|
'input_tokens': new.get('input_tokens', 0),
|
||||||
|
'output_tokens': new.get('output_tokens', 0),
|
||||||
|
}
|
||||||
|
Path('graphify-out/.graphify_semantic.json').write_text(json.dumps(merged, indent=2, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print(f'Extraction complete - {len(deduped)} nodes, {len(all_edges)} edges ({len(cached[\"nodes\"])} from cache, {len(new.get(\"nodes\",[]))} new)')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
Clean up temp files: `rm -f graphify-out/.graphify_cached.json graphify-out/.graphify_uncached.txt graphify-out/.graphify_semantic_new.json`
|
||||||
|
|
||||||
|
#### Part C - Merge AST + semantic into final extraction
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys, json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
ast = json.loads(Path('graphify-out/.graphify_ast.json').read_text(encoding=\"utf-8\"))
|
||||||
|
sem = json.loads(Path('graphify-out/.graphify_semantic.json').read_text(encoding=\"utf-8\"))
|
||||||
|
|
||||||
|
# Merge: AST nodes first, semantic nodes deduplicated by id
|
||||||
|
seen = {n['id'] for n in ast['nodes']}
|
||||||
|
merged_nodes = list(ast['nodes'])
|
||||||
|
for n in sem['nodes']:
|
||||||
|
if n['id'] not in seen:
|
||||||
|
merged_nodes.append(n)
|
||||||
|
seen.add(n['id'])
|
||||||
|
|
||||||
|
merged_edges = ast['edges'] + sem['edges']
|
||||||
|
merged_hyperedges = sem.get('hyperedges', [])
|
||||||
|
merged = {
|
||||||
|
'nodes': merged_nodes,
|
||||||
|
'edges': merged_edges,
|
||||||
|
'hyperedges': merged_hyperedges,
|
||||||
|
'input_tokens': sem.get('input_tokens', 0),
|
||||||
|
'output_tokens': sem.get('output_tokens', 0),
|
||||||
|
}
|
||||||
|
Path('graphify-out/.graphify_extract.json').write_text(json.dumps(merged, indent=2, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
total = len(merged_nodes)
|
||||||
|
edges = len(merged_edges)
|
||||||
|
print(f'Merged: {total} nodes, {edges} edges ({len(ast[\"nodes\"])} AST + {len(sem[\"nodes\"])} semantic)')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 4 - Build graph, cluster, analyze, generate outputs
|
||||||
|
|
||||||
|
**Before starting:** the code blocks below pass `directed=IS_DIRECTED` to `build_from_json()`. Replace `IS_DIRECTED` with `True` if `--directed` was given (builds a `DiGraph` preserving edge direction source→target), otherwise `False` (the default undirected `Graph`). Substitute it the same way you substitute `INPUT_PATH` — do not leave the literal `IS_DIRECTED` in the code.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p graphify-out
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys, json
|
||||||
|
from graphify.build import build_from_json
|
||||||
|
from graphify.cluster import cluster, score_all
|
||||||
|
from graphify.analyze import god_nodes, surprising_connections, suggest_questions
|
||||||
|
from graphify.report import generate
|
||||||
|
from graphify.export import to_json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
|
||||||
|
detection = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
|
||||||
|
|
||||||
|
# root= mirrors the --update runbook (#1361): relativize source_file to the same
|
||||||
|
# base so the full build and incremental --update never drift apart on re-extract.
|
||||||
|
G = build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED)
|
||||||
|
# Guard BEFORE any write: an empty extraction must not clobber a good graph.json /
|
||||||
|
# GRAPH_REPORT.md / analysis sidecar. Check immediately after build (#1392).
|
||||||
|
if G.number_of_nodes() == 0:
|
||||||
|
print('ERROR: Graph is empty - extraction produced no nodes.')
|
||||||
|
print('Possible causes: all files were skipped, binary-only corpus, or extraction failed.')
|
||||||
|
raise SystemExit(1)
|
||||||
|
communities = cluster(G)
|
||||||
|
cohesion = score_all(G, communities)
|
||||||
|
tokens = {'input': extraction.get('input_tokens', 0), 'output': extraction.get('output_tokens', 0)}
|
||||||
|
gods = god_nodes(G)
|
||||||
|
surprises = surprising_connections(G, communities)
|
||||||
|
labels = {cid: 'Community ' + str(cid) for cid in communities}
|
||||||
|
# Placeholder questions - regenerated with real labels in Step 5
|
||||||
|
questions = suggest_questions(G, communities, labels)
|
||||||
|
|
||||||
|
# Export FIRST and honor the #479 shrink-guard: to_json returns False (writing
|
||||||
|
# nothing) when the new graph is smaller than the existing graph.json. Only write
|
||||||
|
# GRAPH_REPORT.md + the analysis sidecar when the graph was actually written, so
|
||||||
|
# they never describe a graph that graph.json doesn't contain (#1392).
|
||||||
|
wrote = to_json(G, communities, 'graphify-out/graph.json')
|
||||||
|
if not wrote:
|
||||||
|
print('ERROR: refused to shrink graphify-out/graph.json (existing graph has more nodes; #479).')
|
||||||
|
print('If this shrink is intentional (you deleted files), re-run a full build with --force.')
|
||||||
|
raise SystemExit(1)
|
||||||
|
report = generate(G, communities, cohesion, labels, gods, surprises, detection, tokens, 'INPUT_PATH', suggested_questions=questions)
|
||||||
|
Path('graphify-out/GRAPH_REPORT.md').write_text(report, encoding=\"utf-8\")
|
||||||
|
analysis = {
|
||||||
|
'communities': {str(k): v for k, v in communities.items()},
|
||||||
|
'cohesion': {str(k): v for k, v in cohesion.items()},
|
||||||
|
'gods': gods,
|
||||||
|
'surprises': surprises,
|
||||||
|
'questions': questions,
|
||||||
|
}
|
||||||
|
Path('graphify-out/.graphify_analysis.json').write_text(json.dumps(analysis, indent=2, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print(f'Graph: {G.number_of_nodes()} nodes, {G.number_of_edges()} edges, {len(communities)} communities')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
If this step prints `ERROR: Graph is empty`, stop and tell the user what happened - do not proceed to labeling or visualization.
|
||||||
|
|
||||||
|
Replace INPUT_PATH with the actual path.
|
||||||
|
|
||||||
|
### Step 4.5 - Graph health check (read-only integrity gate)
|
||||||
|
|
||||||
|
A non-destructive diagnostic on the extraction, before labeling. It surfaces edge collapse, dangling/missing endpoints, and self-loops — the silent-corruption modes of incremental updates and AST/LLM id mismatches. Read-only; never aborts.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
from graphify.diagnostics import diagnose_extraction, format_diagnostic_report
|
||||||
|
|
||||||
|
extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
|
||||||
|
summary = diagnose_extraction(extraction, directed=IS_DIRECTED, root='INPUT_PATH')
|
||||||
|
print(format_diagnostic_report(summary))
|
||||||
|
flags = [f'{summary[k]} {label}' for k, label in (
|
||||||
|
('dangling_endpoint_edges', 'dangling-endpoint edges'),
|
||||||
|
('missing_endpoint_edges', 'missing-endpoint edges'),
|
||||||
|
('self_loop_edges', 'self-loop edges'),
|
||||||
|
('directed_same_endpoint_collapsed_edges', 'collapsed (directed) edges'),
|
||||||
|
('undirected_same_endpoint_collapsed_edges', 'collapsed (undirected) edges'),
|
||||||
|
) if summary.get(k, 0)]
|
||||||
|
print('GRAPH HEALTH WARNING: ' + '; '.join(flags) + ' - graph may be incomplete/corrupt.' if flags else 'Graph health: OK (no dangling/missing/collapsed edges).')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Substitute `IS_DIRECTED` and `INPUT_PATH` as in Step 4. If a `GRAPH HEALTH WARNING` prints, surface it in the final summary (do not abort — the graph is still usable, but the integrity issue must be visible, per the Honesty Rules).
|
||||||
|
|
||||||
|
### Step 5 - Label communities
|
||||||
|
|
||||||
|
Read `graphify-out/.graphify_analysis.json`. For each community key, look at its node labels and write a 2-5 word plain-language name (e.g. "Attention Mechanism", "Training Pipeline", "Data Loading").
|
||||||
|
|
||||||
|
Then regenerate the report and save the labels for the visualizer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys, json
|
||||||
|
from graphify.build import build_from_json
|
||||||
|
from graphify.cluster import score_all
|
||||||
|
from graphify.analyze import god_nodes, surprising_connections, suggest_questions
|
||||||
|
from graphify.report import generate
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
|
||||||
|
detection = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
|
||||||
|
analysis = json.loads(Path('graphify-out/.graphify_analysis.json').read_text(encoding=\"utf-8\"))
|
||||||
|
|
||||||
|
# root= as in Step 4 / the --update runbook (#1361) — same base for node-key parity.
|
||||||
|
G = build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED)
|
||||||
|
communities = {int(k): v for k, v in analysis['communities'].items()}
|
||||||
|
cohesion = {int(k): v for k, v in analysis['cohesion'].items()}
|
||||||
|
tokens = {'input': extraction.get('input_tokens', 0), 'output': extraction.get('output_tokens', 0)}
|
||||||
|
|
||||||
|
# LABELS - replace these with the names you chose above
|
||||||
|
labels = LABELS_DICT
|
||||||
|
|
||||||
|
# Regenerate questions with real community labels (labels affect question phrasing)
|
||||||
|
questions = suggest_questions(G, communities, labels)
|
||||||
|
|
||||||
|
report = generate(G, communities, cohesion, labels, analysis['gods'], analysis['surprises'], detection, tokens, 'INPUT_PATH', suggested_questions=questions)
|
||||||
|
Path('graphify-out/GRAPH_REPORT.md').write_text(report, encoding=\"utf-8\")
|
||||||
|
Path('graphify-out/.graphify_labels.json').write_text(json.dumps({str(k): v for k, v in labels.items()}, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print('Report updated with community labels')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `LABELS_DICT` with the actual dict you constructed (e.g. `{0: "Attention Mechanism", 1: "Training Pipeline"}`).
|
||||||
|
Replace INPUT_PATH with the actual path.
|
||||||
|
|
||||||
|
### Step 6 - Generate Obsidian vault (opt-in) + HTML
|
||||||
|
|
||||||
|
**Generate HTML always** (unless `--no-viz`). **Obsidian vault only if `--obsidian` was explicitly given** — skip it otherwise, it generates one file per node.
|
||||||
|
|
||||||
|
If `--obsidian` was given:
|
||||||
|
|
||||||
|
- If `--obsidian-dir <path>` was also given, pass it via `--dir`. Otherwise defaults to `graphify-out/obsidian`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export obsidian
|
||||||
|
# or with custom dir: graphify export obsidian --dir ~/vaults/my-project
|
||||||
|
```
|
||||||
|
|
||||||
|
Generate the HTML graph (always, unless `--no-viz`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export html # auto-aggregates to community view if graph > 5000 nodes
|
||||||
|
# or: graphify export html --no-viz
|
||||||
|
```
|
||||||
|
|
||||||
|
### Steps 6b-8 - Wiki, Neo4j, FalkorDB, SVG, GraphML, MCP, benchmark (only on their flags)
|
||||||
|
|
||||||
|
These run only when their flag is present (`--wiki`, `--neo4j`/`--neo4j-push`, `--falkordb`/`--falkordb-push`, `--svg`, `--graphml`, `--mcp`) or, for the token-reduction benchmark, when `total_words` exceeds 5,000. A default run with no export flags skips all of them. See `references/exports.md` for each one. Run any `--wiki` export before Step 9 cleanup so `.graphify_labels.json` is still available.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Step 9 - Save manifest, update cost tracker, clean up, and report
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
from graphify.detect import save_manifest
|
||||||
|
|
||||||
|
# Save manifest for --update
|
||||||
|
detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
|
||||||
|
# In --update mode, 'all_files' carries the full corpus; 'files' is the changed
|
||||||
|
# subset. Full-rebuild mode populates only 'files', so the fallback handles that.
|
||||||
|
# root= relativizes the manifest keys to the scan root (same base as the build),
|
||||||
|
# so the on-disk manifest is portable across clones/machines and a later --update
|
||||||
|
# matches cached files instead of missing every one (#1417).
|
||||||
|
save_manifest(detect.get('all_files') or detect['files'], root='INPUT_PATH')
|
||||||
|
|
||||||
|
# Update cumulative cost tracker
|
||||||
|
extract = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
|
||||||
|
input_tok = extract.get('input_tokens', 0)
|
||||||
|
output_tok = extract.get('output_tokens', 0)
|
||||||
|
|
||||||
|
cost_path = Path('graphify-out/cost.json')
|
||||||
|
if cost_path.exists():
|
||||||
|
cost = json.loads(cost_path.read_text(encoding=\"utf-8\"))
|
||||||
|
else:
|
||||||
|
cost = {'runs': [], 'total_input_tokens': 0, 'total_output_tokens': 0}
|
||||||
|
|
||||||
|
cost['runs'].append({
|
||||||
|
'date': datetime.now(timezone.utc).isoformat(),
|
||||||
|
'input_tokens': input_tok,
|
||||||
|
'output_tokens': output_tok,
|
||||||
|
'files': detect.get('total_files', 0),
|
||||||
|
})
|
||||||
|
cost['total_input_tokens'] += input_tok
|
||||||
|
cost['total_output_tokens'] += output_tok
|
||||||
|
cost_path.write_text(json.dumps(cost, indent=2, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
|
||||||
|
print(f'This run: {input_tok:,} input tokens, {output_tok:,} output tokens')
|
||||||
|
print(f'All time: {cost[\"total_input_tokens\"]:,} input, {cost[\"total_output_tokens\"]:,} output ({len(cost[\"runs\"])} runs)')
|
||||||
|
"
|
||||||
|
rm -f graphify-out/.graphify_detect.json graphify-out/.graphify_extract.json graphify-out/.graphify_ast.json graphify-out/.graphify_semantic.json graphify-out/.graphify_analysis.json
|
||||||
|
find graphify-out -maxdepth 1 -name '.graphify_chunk_*.json' -delete 2>/dev/null
|
||||||
|
rm -f graphify-out/.needs_update 2>/dev/null || true
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace INPUT_PATH with the actual path (same value used in Steps 4-5) so the manifest is relativized to the scan root.
|
||||||
|
|
||||||
|
Tell the user (omit the obsidian line unless --obsidian was given):
|
||||||
|
```
|
||||||
|
Graph complete. Outputs in PATH_TO_DIR/graphify-out/
|
||||||
|
|
||||||
|
graph.html - interactive graph, open in browser
|
||||||
|
GRAPH_REPORT.md - audit report
|
||||||
|
graph.json - raw graph data
|
||||||
|
obsidian/ - Obsidian vault (only if --obsidian was given)
|
||||||
|
```
|
||||||
|
|
||||||
|
If graphify saved you time, consider supporting it: https://github.com/sponsors/safishamsi
|
||||||
|
|
||||||
|
Replace PATH_TO_DIR with the actual absolute path of the directory that was processed.
|
||||||
|
|
||||||
|
Then paste these sections from GRAPH_REPORT.md directly into the chat:
|
||||||
|
- God Nodes
|
||||||
|
- Surprising Connections
|
||||||
|
- Suggested Questions
|
||||||
|
|
||||||
|
Do NOT paste the full report - just those three sections. Keep it concise.
|
||||||
|
|
||||||
|
Then immediately offer to explore. Pick the single most interesting suggested question from the report - the one that crosses the most community boundaries or has the most surprising bridge node - and ask:
|
||||||
|
|
||||||
|
> "The most interesting question this graph can answer: **[question]**. Want me to trace it?"
|
||||||
|
|
||||||
|
If the user says yes, run `/graphify query "[question]"` on the graph and walk them through the answer using the graph structure - which nodes connect, which community boundaries get crossed, what the path reveals. Keep going as long as they want to explore. Each answer should end with a natural follow-up ("this connects to X - want to go deeper?") so the session feels like navigation, not a one-shot report.
|
||||||
|
|
||||||
|
The graph is the map. Your job after the pipeline is to be the guide.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Interpreter guard for subcommands
|
||||||
|
|
||||||
|
Before running any subcommand below (`--update`, `--cluster-only`, `query`, `path`, `explain`, `add`), check that `.graphify_python` exists. If it's missing (e.g. user deleted `graphify-out/`), re-resolve the interpreter first:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ ! -f graphify-out/.graphify_python ]; then
|
||||||
|
GRAPHIFY_BIN=$(which graphify 2>/dev/null)
|
||||||
|
if [ -n "$GRAPHIFY_BIN" ]; then
|
||||||
|
PYTHON=$(head -1 "$GRAPHIFY_BIN" | tr -d '#!')
|
||||||
|
case "$PYTHON" in *[!a-zA-Z0-9/_.@-]*) PYTHON="python3" ;; esac
|
||||||
|
else
|
||||||
|
PYTHON="python3"
|
||||||
|
fi
|
||||||
|
mkdir -p graphify-out
|
||||||
|
"$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
## For --update and --cluster-only
|
||||||
|
|
||||||
|
Both are non-default subcommands. `--update` re-extracts only new or changed files; `--cluster-only` reruns clustering on the existing graph. See `references/update.md` for both flows.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For /graphify query
|
||||||
|
|
||||||
|
When `graphify-out/graph.json` already exists and the user asks a question about the corpus, answer from the graph rather than rebuilding it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify query "<question>"
|
||||||
|
```
|
||||||
|
|
||||||
|
Before traversal, expand the question against the graph's own vocabulary so a wording mismatch does not collapse the answer to noise. If the `graphify query` CLI is unavailable, fall back to an inline NetworkX traversal of `graphify-out/graph.json`. Answer using only what the graph output contains, and quote `source_location` when citing a specific fact. For that vocab-expansion step, the BFS/DFS traversal modes, the `--budget` cap, the NetworkX fallback, `save-result` feedback, and the `/graphify path` and `/graphify explain` flows, see `references/query.md`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For /graphify add and --watch
|
||||||
|
|
||||||
|
Neither is part of the default build. When the user runs `/graphify add <url>` to fetch a URL into the corpus, or passes `--watch` to auto-rebuild on file changes, see `references/add-watch.md`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For the commit hook and native CLAUDE.md integration
|
||||||
|
|
||||||
|
When the user asks to install the post-commit auto-rebuild hook or wire graphify into a project's CLAUDE.md, see `references/hooks.md`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Honesty Rules
|
||||||
|
|
||||||
|
- Never invent an edge. If unsure, use AMBIGUOUS.
|
||||||
|
- Never skip the corpus check warning.
|
||||||
|
- Always show token cost in the report.
|
||||||
|
- Never hide cohesion scores behind symbols - show the raw number.
|
||||||
|
- Never run HTML viz on a graph with more than 5,000 nodes without warning the user.
|
||||||
56
.agents/skills/graphify/references/add-watch.md
Normal file
56
.agents/skills/graphify/references/add-watch.md
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# graphify reference: add a URL and watch a folder
|
||||||
|
|
||||||
|
Load this when the user ran `/graphify add <url>` or passed `--watch`. Neither is part of the default build.
|
||||||
|
|
||||||
|
## For /graphify add
|
||||||
|
|
||||||
|
Fetch a URL and add it to the corpus, then update the graph.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys
|
||||||
|
from graphify.ingest import ingest
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
try:
|
||||||
|
out = ingest('URL', Path('./raw'), author='AUTHOR', contributor='CONTRIBUTOR')
|
||||||
|
print(f'Saved to {out}')
|
||||||
|
except ValueError as e:
|
||||||
|
print(f'error: {e}', file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
except RuntimeError as e:
|
||||||
|
print(f'error: {e}', file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `URL` with the actual URL, `AUTHOR` with the user's name if provided, `CONTRIBUTOR` likewise. If the command exits with an error, tell the user what went wrong - do not silently continue. After a successful save, automatically run the `--update` pipeline on `./raw` to merge the new file into the existing graph.
|
||||||
|
|
||||||
|
Supported URL types (auto-detected):
|
||||||
|
- YouTube / any video URL → audio downloaded via yt-dlp, transcribed to `.txt` on next run (requires `pip install 'graphifyy[video]'`)
|
||||||
|
- Twitter/X → fetched via oEmbed, saved as `.md` with tweet text and author
|
||||||
|
- arXiv → abstract + metadata saved as `.md`
|
||||||
|
- PDF → downloaded as `.pdf`
|
||||||
|
- Images (.png/.jpg/.webp) → downloaded, Claude vision extracts on next run
|
||||||
|
- Any webpage → converted to markdown via html2text
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For --watch
|
||||||
|
|
||||||
|
Start a background watcher that monitors a folder and auto-updates the graph when files change.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -m graphify.watch INPUT_PATH --debounce 3
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace INPUT_PATH with the folder to watch. Behavior depends on what changed:
|
||||||
|
|
||||||
|
- **Code files only (.py, .ts, .go, etc.):** re-runs AST extraction + rebuild + cluster immediately, no LLM needed. `graph.json` and `GRAPH_REPORT.md` are updated automatically.
|
||||||
|
- **Docs, papers, or images:** writes a `graphify-out/needs_update` flag and prints a notification to run `/graphify --update` (LLM semantic re-extraction required).
|
||||||
|
|
||||||
|
Debounce (default 3s): waits until file activity stops before triggering, so a wave of parallel agent writes doesn't trigger a rebuild per file.
|
||||||
|
|
||||||
|
Press Ctrl+C to stop.
|
||||||
|
|
||||||
|
For agentic workflows: run `--watch` in a background terminal. Code changes from agent waves are picked up automatically between waves. If agents are also writing docs or notes, you'll need a manual `/graphify --update` after those waves.
|
||||||
87
.agents/skills/graphify/references/exports.md
Normal file
87
.agents/skills/graphify/references/exports.md
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
# graphify reference: extra exports and benchmark
|
||||||
|
|
||||||
|
Load this when the user passed one of the export flags (`--wiki`, `--neo4j`, `--neo4j-push`, `--falkordb`, `--falkordb-push`, `--svg`, `--graphml`, `--mcp`), or when the corpus is large enough for the token-reduction benchmark. Each step runs only for its own flag.
|
||||||
|
|
||||||
|
### Step 6b - Wiki (only if --wiki flag)
|
||||||
|
|
||||||
|
**Only run this step if `--wiki` was explicitly given in the original command.**
|
||||||
|
|
||||||
|
Run this before Step 9 (cleanup) so `.graphify_labels.json` is still available.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export wiki
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 7 - Neo4j export (only if --neo4j or --neo4j-push flag)
|
||||||
|
|
||||||
|
**If `--neo4j`** - generate a Cypher file for manual import:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export neo4j
|
||||||
|
```
|
||||||
|
|
||||||
|
**If `--neo4j-push <uri>`** - push directly to a running Neo4j instance. Ask the user for credentials if not provided:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export neo4j --push bolt://localhost:7687 --user neo4j --password PASSWORD
|
||||||
|
```
|
||||||
|
|
||||||
|
Default URI is `bolt://localhost:7687`, default user is `neo4j`. Uses MERGE - safe to re-run without creating duplicates.
|
||||||
|
|
||||||
|
### Step 7a - FalkorDB export (only if --falkordb or --falkordb-push flag)
|
||||||
|
|
||||||
|
**If `--falkordb`** - generate a Cypher file. The statements are OpenCypher, but FalkorDB's `GRAPH.QUERY` runs one statement at a time (no bulk script import like Neo4j's `cypher-shell`), so prefer `--falkordb-push` to load a graph. Use this only when you want the portable `cypher.txt` artifact:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export falkordb
|
||||||
|
```
|
||||||
|
|
||||||
|
**If `--falkordb-push <uri>`** - push directly to a running FalkorDB instance. Credentials are optional; ask the user only if the instance requires auth:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export falkordb --push falkordb://localhost:6379
|
||||||
|
```
|
||||||
|
|
||||||
|
Default URI is `falkordb://localhost:6379` (the scheme is informational - `redis://` or a bare `host:port` work too), auth is optional, and the target graph defaults to `graphify`. Uses MERGE - safe to re-run without creating duplicates.
|
||||||
|
|
||||||
|
### Step 7b - SVG export (only if --svg flag)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export svg
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 7c - GraphML export (only if --graphml flag)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export graphml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 7d - MCP server (only if --mcp flag)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -m graphify.serve graphify-out/graph.json
|
||||||
|
```
|
||||||
|
|
||||||
|
This starts a stdio MCP server that exposes tools: `query_graph`, `get_node`, `get_neighbors`, `get_community`, `god_nodes`, `graph_stats`, `shortest_path`. Add to Claude Desktop or any MCP-compatible agent orchestrator so other agents can query the graph live.
|
||||||
|
|
||||||
|
To configure in Claude Desktop, add to `claude_desktop_config.json`. Claude Desktop can't run `$(...)`, and under `uv tool install` the system `python3` can't import graphify — so set `command` to the **absolute interpreter path** printed by `cat graphify-out/.graphify_python`:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"graphify": {
|
||||||
|
"command": "<absolute path from: cat graphify-out/.graphify_python>",
|
||||||
|
"args": ["-m", "graphify.serve", "/absolute/path/to/graphify-out/graph.json"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 8 - Token reduction benchmark (only if total_words > 5000)
|
||||||
|
|
||||||
|
If `total_words` from `graphify-out/.graphify_detect.json` is greater than 5,000, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify benchmark
|
||||||
|
```
|
||||||
|
|
||||||
|
Print the output directly in chat. If `total_words <= 5000`, skip silently - the graph value is structural clarity, not token compression, for small corpora.
|
||||||
31
.agents/skills/graphify/references/extraction-spec.md
Normal file
31
.agents/skills/graphify/references/extraction-spec.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# graphify reference: extraction subagent prompt (compact)
|
||||||
|
|
||||||
|
Load this in Step 3 Part B when the corpus has at least one doc, paper, or image chunk. A pure-code corpus skips Part B and never reads this file. Each semantic subagent receives the prompt below verbatim (substitute FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, and DEEP_MODE).
|
||||||
|
|
||||||
|
```
|
||||||
|
You are a graphify extraction subagent. Read the files listed and extract a knowledge graph fragment.
|
||||||
|
Output ONLY valid JSON matching the schema below - no explanation, no markdown fences, no preamble.
|
||||||
|
|
||||||
|
Files (chunk CHUNK_NUM of TOTAL_CHUNKS):
|
||||||
|
FILE_LIST
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- EXTRACTED: relationship explicit in source (import, call, citation)
|
||||||
|
- INFERRED: reasonable inference (shared structure, implied dependency)
|
||||||
|
- AMBIGUOUS: uncertain — flag it, do not omit
|
||||||
|
- Code files: semantic edges AST cannot find. Do not re-extract imports. When adding `calls` edges: source is the caller, target is the callee, never reversed; keep `calls` within one language.
|
||||||
|
- Doc/paper files: named concepts, entities, citations. Store rationale (WHY decisions were made) as a `rationale` attribute on the relevant node, not as a separate node. Use `file_type:"rationale"` for concept-like nodes (ideas, principles, mechanisms) and `file_type:"concept"` for named concepts. `file_type` MUST be one of exactly these six values: `code`, `document`, `paper`, `image`, `rationale`, `concept`. Any other value is invalid and will be rejected.
|
||||||
|
- Image files: use vision — understand what the image IS, not just OCR
|
||||||
|
- DEEP_MODE (if --mode deep): be aggressive with INFERRED edges — indirect deps, shared assumptions, latent couplings. Mark uncertain ones AMBIGUOUS instead of omitting.
|
||||||
|
- Semantic similarity: if two concepts solve the same problem or represent the same idea without a structural link (no import, call, or citation), add a `semantically_similar_to` edge marked INFERRED with confidence_score 0.6-0.95. Non-obvious cross-file links only.
|
||||||
|
- Hyperedges: if 3+ nodes share a concept, flow, or pattern not captured by pairwise edges, add a hyperedge to a top-level `hyperedges` array. Use sparingly. Max 3 per chunk.
|
||||||
|
- If a file has YAML frontmatter (--- ... ---), copy source_url, captured_at, author, contributor onto every node from that file.
|
||||||
|
- confidence_score is REQUIRED on every edge — never omit it, never use 0.5 as a default. EXTRACTED = 1.0 always. INFERRED: pick exactly ONE of 0.95 (direct structural evidence), 0.85 (strong inference), 0.75 (reasonable inference), 0.65 (weak inference), 0.55 (speculative but plausible) — never 0.5; if none fit, mark the edge AMBIGUOUS. AMBIGUOUS = 0.1-0.3.
|
||||||
|
|
||||||
|
Node ID format: lowercase, only `[a-z0-9_]`, no dots or slashes. Format `{stem}_{entity}` where stem is the full repo-relative path with the extension dropped, every segment joined with `_` (each lowercased with non-alphanumeric chars replaced by `_`) and entity is the symbol name similarly normalized. Use every directory level, not just the immediate parent. `src/auth/session.py` + `ValidateToken` → `src_auth_session_validatetoken`. Top-level files use just the filename stem. This must match the AST extractor's ID. Never append chunk or sequence suffixes — IDs must be deterministic from the label alone.
|
||||||
|
|
||||||
|
Output exactly this JSON (no other text):
|
||||||
|
{"nodes":[{"id":"auth_session_validatetoken","label":"Human Readable Name","file_type":"code|document|paper|image|rationale|concept","source_file":"<FILE_LIST path verbatim>","source_location":null,"source_url":null,"captured_at":null,"author":null,"contributor":null}],"edges":[{"source":"node_id","target":"node_id","relation":"calls|implements|references|cites|conceptually_related_to|shares_data_with|semantically_similar_to|rationale_for","confidence":"EXTRACTED|INFERRED|AMBIGUOUS","confidence_score":1.0,"source_file":"<FILE_LIST path verbatim>","source_location":null,"weight":1.0}],"hyperedges":[{"id":"snake_case_id","label":"Human Readable Label","nodes":["node_id1","node_id2","node_id3"],"relation":"participate_in|implement|form","confidence":"EXTRACTED|INFERRED","confidence_score":0.75,"source_file":"<FILE_LIST path verbatim>"}],"input_tokens":0,"output_tokens":0}
|
||||||
|
|
||||||
|
source_file RULE: set source_file to the FILE_LIST path for that file VERBATIM (absolute, no shortening to basename, no re-relativizing, no separator change). Keeps full build and --update on one base so build_merge's replace matches instead of duplicating.
|
||||||
|
```
|
||||||
46
.agents/skills/graphify/references/github-and-merge.md
Normal file
46
.agents/skills/graphify/references/github-and-merge.md
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# graphify reference: GitHub clone and cross-repo merge
|
||||||
|
|
||||||
|
Load this when the user passed one or more `https://github.com/...` URLs, or named several local subfolders to merge into one graph.
|
||||||
|
|
||||||
|
### Step 0 - Clone GitHub repo(s) (only if a GitHub URL was given)
|
||||||
|
|
||||||
|
**Single repo:**
|
||||||
|
```bash
|
||||||
|
LOCAL_PATH=$(graphify clone <github-url> [--branch <branch>])
|
||||||
|
# Use LOCAL_PATH as the target for all subsequent steps
|
||||||
|
```
|
||||||
|
|
||||||
|
**Multiple repos (cross-repo graph):**
|
||||||
|
```bash
|
||||||
|
# Clone each repo, run the full pipeline on each, then merge
|
||||||
|
graphify clone <url1> # → ~/.graphify/repos/<owner1>/<repo1>
|
||||||
|
graphify clone <url2> # → ~/.graphify/repos/<owner2>/<repo2>
|
||||||
|
# Run /graphify on each local path to produce their graph.json files
|
||||||
|
# Then merge:
|
||||||
|
graphify merge-graphs \
|
||||||
|
~/.graphify/repos/<owner1>/<repo1>/graphify-out/graph.json \
|
||||||
|
~/.graphify/repos/<owner2>/<repo2>/graphify-out/graph.json \
|
||||||
|
--out graphify-out/cross-repo-graph.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Graphify clones into `~/.graphify/repos/<owner>/<repo>` and reuses existing clones on repeat runs. Each node in the merged graph carries a `repo` attribute so you can filter by origin.
|
||||||
|
|
||||||
|
**Multiple local subfolders (monorepo or multi-service layout):**
|
||||||
|
|
||||||
|
The skill pipeline writes all intermediate and final outputs to `graphify-out/` in the current working directory. Running the skill on each subfolder separately will clobber the same output dir. Instead, use the CLI directly for each subfolder — it places `graphify-out/` *inside* the scanned path:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify extract ./core/ # → ./core/graphify-out/graph.json
|
||||||
|
graphify extract ./service/ # → ./service/graphify-out/graph.json
|
||||||
|
graphify extract ./platform/ # → ./platform/graphify-out/graph.json
|
||||||
|
# Add --backend gemini|kimi|openai|deepseek|claude-cli depending on which API key you have set
|
||||||
|
|
||||||
|
# Then merge at the project root:
|
||||||
|
graphify merge-graphs \
|
||||||
|
./core/graphify-out/graph.json \
|
||||||
|
./service/graphify-out/graph.json \
|
||||||
|
./platform/graphify-out/graph.json \
|
||||||
|
--out graphify-out/graph.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Once `graphify-out/graph.json` exists, the fast path above takes over: any codebase question runs `graphify query` directly on the merged graph — no re-extraction, no size gate.
|
||||||
33
.agents/skills/graphify/references/hooks.md
Normal file
33
.agents/skills/graphify/references/hooks.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# graphify reference: commit hook and native CLAUDE.md integration
|
||||||
|
|
||||||
|
Load this when the user asked to install the post-commit hook or wire graphify into a project's CLAUDE.md.
|
||||||
|
|
||||||
|
## For git commit hook
|
||||||
|
|
||||||
|
Install a post-commit hook that auto-rebuilds the graph after every commit. No background process needed - triggers once per commit, works with any editor.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify hook install # install
|
||||||
|
graphify hook uninstall # remove
|
||||||
|
graphify hook status # check
|
||||||
|
```
|
||||||
|
|
||||||
|
After every `git commit`, the hook detects which code files changed (via `git diff HEAD~1`), re-runs AST extraction on those files, and rebuilds `graph.json` and `GRAPH_REPORT.md`. Doc/image changes are ignored by the hook - run `/graphify --update` manually for those.
|
||||||
|
|
||||||
|
If a post-commit hook already exists, graphify appends to it rather than replacing it.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For native CLAUDE.md integration
|
||||||
|
|
||||||
|
Run once per project to make graphify always-on in Claude Code sessions:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify claude install
|
||||||
|
```
|
||||||
|
|
||||||
|
This writes a `## graphify` section to the local `CLAUDE.md` that instructs Claude to check the graph before answering codebase questions and rebuild it after code changes. No manual `/graphify` needed in future sessions.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify claude uninstall # remove the section
|
||||||
|
```
|
||||||
311
.agents/skills/graphify/references/query.md
Normal file
311
.agents/skills/graphify/references/query.md
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
# graphify reference: query, path, explain
|
||||||
|
|
||||||
|
Load this when the user asks a question against an existing graph, or runs `/graphify path` or `/graphify explain`. The core's query stub points here for the full traversal flow. These flows use the `graphify query` CLI when it is available and fall back to an inline NetworkX traversal otherwise.
|
||||||
|
|
||||||
|
Two traversal modes - choose based on the question:
|
||||||
|
|
||||||
|
| Mode | Flag | Best for |
|
||||||
|
|------|------|----------|
|
||||||
|
| BFS (default) | _(none)_ | "What is X connected to?" - broad context, nearest neighbors first |
|
||||||
|
| DFS | `--dfs` | "How does X reach Y?" - trace a specific chain or dependency path |
|
||||||
|
|
||||||
|
First check the graph exists:
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
from pathlib import Path
|
||||||
|
if not Path('graphify-out/graph.json').exists():
|
||||||
|
print('ERROR: No graph found. Run /graphify <path> first to build the graph.')
|
||||||
|
raise SystemExit(1)
|
||||||
|
"
|
||||||
|
```
|
||||||
|
If it fails, stop and tell the user to run `/graphify <path>` first.
|
||||||
|
|
||||||
|
### Step 0 — Constrained query expansion (REQUIRED before traversal)
|
||||||
|
|
||||||
|
graphify's `query` CLI matches nodes via case-folded substring + IDF — there is **no stemming, no synonyms, no cross-language match** inside the binary, and the inline fallback below matches the same way. If the user's question uses different language or different domain vocabulary than the graph's labels (user says "обработчик" / graph says "handler"; user says "authentication" / graph says "Guardian"), the literal matcher returns 0 hits and the answer collapses to noise.
|
||||||
|
|
||||||
|
Fix this **without inventing tokens** by expanding the query against the actual graph vocabulary first:
|
||||||
|
|
||||||
|
1. Extract the token vocabulary from node labels:
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json, re
|
||||||
|
from pathlib import Path
|
||||||
|
data = json.loads(Path('graphify-out/graph.json').read_text())
|
||||||
|
vocab = set()
|
||||||
|
for n in data['nodes']:
|
||||||
|
for c in re.findall(r'[^\W\d_]+', n.get('label','') or '', re.UNICODE):
|
||||||
|
parts = re.findall(r'[A-Z]+(?=[A-Z][a-z])|[A-Z]?[a-z]+|[A-Z]+', c) or [c]
|
||||||
|
for p in parts:
|
||||||
|
t = p.lower()
|
||||||
|
if 3 <= len(t) <= 30:
|
||||||
|
vocab.add(t)
|
||||||
|
Path('graphify-out/.vocab.txt').write_text('\n'.join(sorted(vocab)))
|
||||||
|
print(f'vocab: {len(vocab)} tokens')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Read `graphify-out/.vocab.txt`. Then for the user's question, select **up to 12 tokens from this exact list** that semantically match the query intent. Hard constraints:
|
||||||
|
- You MUST pick only tokens present in the vocabulary file. Do NOT invent tokens.
|
||||||
|
- If a query concept has no plausible token in the vocab, skip it — do not substitute a near-synonym from training memory.
|
||||||
|
- If **no** vocab tokens match the query at all, output an empty list and tell the user the corpus has no relevant vocabulary for this question. Do not fabricate a search.
|
||||||
|
- Translate cross-language: Russian "аутентификация" → look for `auth`, `credential`, `token`, `security` IFF present in vocab.
|
||||||
|
- Morphology: "handlers" maps to `handler` IFF present; "todos" maps to `todo` IFF present.
|
||||||
|
|
||||||
|
3. Print the selection explicitly to the user before running the query, so the expansion is auditable:
|
||||||
|
```
|
||||||
|
Query expanded to (from graph vocab, N tokens): [token1, token2, ...]
|
||||||
|
```
|
||||||
|
If the list is empty, say so plainly and stop — do not proceed to traversal.
|
||||||
|
|
||||||
|
### Step 1 — Traversal
|
||||||
|
|
||||||
|
Build the **expanded query string** by joining the selected tokens with spaces. Use this string as `QUESTION` below — NOT the original user question. (The original question is preserved only for `save-result` at the end.)
|
||||||
|
|
||||||
|
Prefer the CLI when it is installed:
|
||||||
|
```bash
|
||||||
|
graphify query "QUESTION"
|
||||||
|
# or: graphify query "QUESTION" --dfs --budget 3000
|
||||||
|
```
|
||||||
|
|
||||||
|
If the CLI is unavailable, load `graphify-out/graph.json` and run the traversal inline:
|
||||||
|
|
||||||
|
1. Find the 1-3 nodes whose label best matches the expanded tokens.
|
||||||
|
2. Run the appropriate traversal from each starting node.
|
||||||
|
3. Read the subgraph - node labels, edge relations, confidence tags, source locations.
|
||||||
|
4. Answer using **only** what the graph contains. Quote `source_location` when citing a specific fact.
|
||||||
|
5. If the graph lacks enough information, say so - do not hallucinate edges.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys, json
|
||||||
|
from networkx.readwrite import json_graph
|
||||||
|
import networkx as nx
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
data = json.loads(Path('graphify-out/graph.json').read_text())
|
||||||
|
G = json_graph.node_link_graph(data, edges='links')
|
||||||
|
|
||||||
|
question = 'QUESTION'
|
||||||
|
mode = 'MODE' # 'bfs' or 'dfs'
|
||||||
|
terms = [t.lower() for t in question.split() if len(t) >= 3] # match the vocab threshold; keeps api/jwt/ios (#1392)
|
||||||
|
|
||||||
|
# Find best-matching start nodes
|
||||||
|
scored = []
|
||||||
|
for nid, ndata in G.nodes(data=True):
|
||||||
|
label = ndata.get('label', '').lower()
|
||||||
|
score = sum(1 for t in terms if t in label)
|
||||||
|
if score > 0:
|
||||||
|
scored.append((score, nid))
|
||||||
|
scored.sort(reverse=True)
|
||||||
|
start_nodes = [nid for _, nid in scored[:3]]
|
||||||
|
|
||||||
|
if not start_nodes:
|
||||||
|
print('No matching nodes found for query terms:', terms)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
subgraph_nodes = set()
|
||||||
|
subgraph_edges = []
|
||||||
|
|
||||||
|
if mode == 'dfs':
|
||||||
|
# DFS: follow one path as deep as possible before backtracking.
|
||||||
|
# Depth-limited to 6 to avoid traversing the whole graph.
|
||||||
|
visited = set()
|
||||||
|
stack = [(n, 0) for n in reversed(start_nodes)]
|
||||||
|
while stack:
|
||||||
|
node, depth = stack.pop()
|
||||||
|
if node in visited or depth > 6:
|
||||||
|
continue
|
||||||
|
visited.add(node)
|
||||||
|
subgraph_nodes.add(node)
|
||||||
|
for neighbor in G.neighbors(node):
|
||||||
|
if neighbor not in visited:
|
||||||
|
stack.append((neighbor, depth + 1))
|
||||||
|
subgraph_edges.append((node, neighbor))
|
||||||
|
else:
|
||||||
|
# BFS: explore all neighbors layer by layer up to depth 3.
|
||||||
|
frontier = set(start_nodes)
|
||||||
|
subgraph_nodes = set(start_nodes)
|
||||||
|
for _ in range(3):
|
||||||
|
next_frontier = set()
|
||||||
|
for n in frontier:
|
||||||
|
for neighbor in G.neighbors(n):
|
||||||
|
if neighbor not in subgraph_nodes:
|
||||||
|
next_frontier.add(neighbor)
|
||||||
|
subgraph_edges.append((n, neighbor))
|
||||||
|
subgraph_nodes.update(next_frontier)
|
||||||
|
frontier = next_frontier
|
||||||
|
|
||||||
|
# Token-budget aware output: rank by relevance, cut at budget (~4 chars/token)
|
||||||
|
token_budget = BUDGET # default 2000
|
||||||
|
char_budget = token_budget * 4
|
||||||
|
|
||||||
|
# Score each node by term overlap for ranked output
|
||||||
|
def relevance(nid):
|
||||||
|
label = G.nodes[nid].get('label', '').lower()
|
||||||
|
return sum(1 for t in terms if t in label)
|
||||||
|
|
||||||
|
ranked_nodes = sorted(subgraph_nodes, key=relevance, reverse=True)
|
||||||
|
|
||||||
|
lines = [f'Traversal: {mode.upper()} | Start: {[G.nodes[n].get(\"label\",n) for n in start_nodes]} | {len(subgraph_nodes)} nodes']
|
||||||
|
for nid in ranked_nodes:
|
||||||
|
d = G.nodes[nid]
|
||||||
|
lines.append(f' NODE {d.get(\"label\", nid)} [src={d.get(\"source_file\",\"\")} loc={d.get(\"source_location\",\"\")}]')
|
||||||
|
for u, v in subgraph_edges:
|
||||||
|
if u in subgraph_nodes and v in subgraph_nodes:
|
||||||
|
_raw = G[u][v]; d = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw
|
||||||
|
lines.append(f' EDGE {G.nodes[u].get(\"label\",u)} --{d.get(\"relation\",\"\")} [{d.get(\"confidence\",\"\")}]--> {G.nodes[v].get(\"label\",v)}')
|
||||||
|
|
||||||
|
output = '\n'.join(lines)
|
||||||
|
if len(output) > char_budget:
|
||||||
|
output = output[:char_budget] + f'\n... (truncated at ~{token_budget} token budget - use --budget N for more)'
|
||||||
|
print(output)
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `QUESTION` with the **expanded** query string, `MODE` with `bfs` or `dfs`, and `BUDGET` with the token budget (default `2000`, or whatever `--budget N` specifies). Then answer based on the subgraph output above, using only what the graph contains.
|
||||||
|
|
||||||
|
After writing the answer, save it back into the graph so it improves future queries. Include the expanded tokens inside the `--answer` text (e.g. `"Expanded from original query via vocab: [tokens]. Then traversed..."`) so the next `--update` extracts the expansion history as a graph node:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINAL_QUESTION" --answer "ANSWER" --type query --nodes NODE1 NODE2
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph.
|
||||||
|
|
||||||
|
**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting):
|
||||||
|
|
||||||
|
- `useful` — the cited nodes answered the question well (they become *preferred sources*).
|
||||||
|
- `dead_end` — the question/path led nowhere; don't re-derive it next time.
|
||||||
|
- `corrected` — the saved answer was wrong; `--correction` records what was right.
|
||||||
|
|
||||||
|
At the **start** of graph work, refresh and read the lessons: run `graphify reflect --if-stale` (cheap, deterministic, no LLM; `--if-stale` makes it a no-op when `LESSONS.md` is already newer than every input, e.g. when the git hook just refreshed it), then read `graphify-out/reflections/LESSONS.md`. It lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. Running `reflect` yourself keeps the lessons current even without the git hook installed; if the post-commit hook *is* installed, `--if-stale` means your session-start run costs almost nothing.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For /graphify path
|
||||||
|
|
||||||
|
Find the shortest path between two named concepts in the graph. Prefer the CLI when installed:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify path "NODE_A" "NODE_B"
|
||||||
|
```
|
||||||
|
|
||||||
|
If the CLI is unavailable, run it inline:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json, sys
|
||||||
|
import networkx as nx
|
||||||
|
from networkx.readwrite import json_graph
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
data = json.loads(Path('graphify-out/graph.json').read_text())
|
||||||
|
G = json_graph.node_link_graph(data, edges='links')
|
||||||
|
|
||||||
|
a_term = 'NODE_A'
|
||||||
|
b_term = 'NODE_B'
|
||||||
|
|
||||||
|
def find_node(term):
|
||||||
|
term = term.lower()
|
||||||
|
scored = sorted(
|
||||||
|
[(sum(1 for w in term.split() if w in G.nodes[n].get('label','').lower()), n)
|
||||||
|
for n in G.nodes()],
|
||||||
|
reverse=True
|
||||||
|
)
|
||||||
|
return scored[0][1] if scored and scored[0][0] > 0 else None
|
||||||
|
|
||||||
|
src = find_node(a_term)
|
||||||
|
tgt = find_node(b_term)
|
||||||
|
|
||||||
|
if not src or not tgt:
|
||||||
|
print(f'Could not find nodes matching: {a_term!r} or {b_term!r}')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
try:
|
||||||
|
path = nx.shortest_path(G, src, tgt)
|
||||||
|
print(f'Shortest path ({len(path)-1} hops):')
|
||||||
|
for i, nid in enumerate(path):
|
||||||
|
label = G.nodes[nid].get('label', nid)
|
||||||
|
if i < len(path) - 1:
|
||||||
|
_raw = G[nid][path[i+1]]; edge = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw
|
||||||
|
rel = edge.get('relation', '')
|
||||||
|
conf = edge.get('confidence', '')
|
||||||
|
print(f' {label} --{rel}--> [{conf}]')
|
||||||
|
else:
|
||||||
|
print(f' {label}')
|
||||||
|
except nx.NetworkXNoPath:
|
||||||
|
print(f'No path found between {a_term!r} and {b_term!r}')
|
||||||
|
except nx.NodeNotFound as e:
|
||||||
|
print(f'Node not found: {e}')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `NODE_A` and `NODE_B` with the actual concept names from the user. Then explain the path in plain language - what each hop means, why it's significant.
|
||||||
|
|
||||||
|
After writing the explanation, save it back:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -m graphify save-result --question "Path from NODE_A to NODE_B" --answer "ANSWER" --type path_query --nodes NODE_A NODE_B
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For /graphify explain
|
||||||
|
|
||||||
|
Give a plain-language explanation of a single node - everything connected to it. Prefer the CLI when installed:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify explain "NODE_NAME"
|
||||||
|
```
|
||||||
|
|
||||||
|
If the CLI is unavailable, run it inline:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json, sys
|
||||||
|
import networkx as nx
|
||||||
|
from networkx.readwrite import json_graph
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
data = json.loads(Path('graphify-out/graph.json').read_text())
|
||||||
|
G = json_graph.node_link_graph(data, edges='links')
|
||||||
|
|
||||||
|
term = 'NODE_NAME'
|
||||||
|
term_lower = term.lower()
|
||||||
|
|
||||||
|
# Find best matching node
|
||||||
|
scored = sorted(
|
||||||
|
[(sum(1 for w in term_lower.split() if w in G.nodes[n].get('label','').lower()), n)
|
||||||
|
for n in G.nodes()],
|
||||||
|
reverse=True
|
||||||
|
)
|
||||||
|
if not scored or scored[0][0] == 0:
|
||||||
|
print(f'No node matching {term!r}')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
nid = scored[0][1]
|
||||||
|
data_n = G.nodes[nid]
|
||||||
|
print(f'NODE: {data_n.get(\"label\", nid)}')
|
||||||
|
print(f' source: {data_n.get(\"source_file\",\"unknown\")}')
|
||||||
|
print(f' type: {data_n.get(\"file_type\",\"unknown\")}')
|
||||||
|
print(f' degree: {G.degree(nid)}')
|
||||||
|
print()
|
||||||
|
print('CONNECTIONS:')
|
||||||
|
for neighbor in G.neighbors(nid):
|
||||||
|
_raw = G[nid][neighbor]; edge = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw
|
||||||
|
nlabel = G.nodes[neighbor].get('label', neighbor)
|
||||||
|
rel = edge.get('relation', '')
|
||||||
|
conf = edge.get('confidence', '')
|
||||||
|
src_file = G.nodes[neighbor].get('source_file', '')
|
||||||
|
print(f' --{rel}--> {nlabel} [{conf}] ({src_file})')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `NODE_NAME` with the concept the user asked about. Then write a 3-5 sentence explanation of what this node is, what it connects to, and why those connections are significant. Use the source locations as citations.
|
||||||
|
|
||||||
|
After writing the explanation, save it back:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -m graphify save-result --question "Explain NODE_NAME" --answer "ANSWER" --type explain --nodes NODE_NAME
|
||||||
|
```
|
||||||
52
.agents/skills/graphify/references/transcribe.md
Normal file
52
.agents/skills/graphify/references/transcribe.md
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# graphify reference: transcribe video and audio
|
||||||
|
|
||||||
|
Load this only when `detect` reported one or more `video` files. A corpus with no video never reads this.
|
||||||
|
|
||||||
|
### Step 2.5 - Transcribe video / audio files (only if video files detected)
|
||||||
|
|
||||||
|
Skip this step entirely if `detect` returned zero `video` files.
|
||||||
|
|
||||||
|
Video and audio files cannot be read directly. Transcribe them to text first, then treat the transcripts as doc files in Step 3.
|
||||||
|
|
||||||
|
**Strategy:** Read the god nodes from `graphify-out/.graphify_detect.json` (or the analysis file if it exists from a previous run). You are already a language model — write a one-sentence domain hint yourself from those labels. Then pass it to Whisper as the initial prompt. No separate API call needed.
|
||||||
|
|
||||||
|
**However**, if the corpus has *only* video files and no other docs/code, use the generic fallback prompt: `"Use proper punctuation and paragraph breaks."`
|
||||||
|
|
||||||
|
**Step 1 - Write the Whisper prompt yourself.**
|
||||||
|
|
||||||
|
Read the top god node labels from detect output or analysis, then compose a short domain hint sentence, for example:
|
||||||
|
|
||||||
|
- Labels: `transformer, attention, encoder, decoder` → `"Machine learning research on transformer architectures and attention mechanisms. Use proper punctuation and paragraph breaks."`
|
||||||
|
- Labels: `kubernetes, deployment, pod, helm` → `"DevOps discussion about Kubernetes deployments and Helm charts. Use proper punctuation and paragraph breaks."`
|
||||||
|
|
||||||
|
**Export** it as `GRAPHIFY_WHISPER_PROMPT` (the exact name the transcriber reads — and it must be `export`ed so the child Python process sees it) for the next command.
|
||||||
|
|
||||||
|
**Step 2 - Transcribe:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export GRAPHIFY_WHISPER_MODEL=base # or whatever --whisper-model the user passed (must be exported)
|
||||||
|
export GRAPHIFY_WHISPER_PROMPT="<the one-sentence domain hint you composed in Step 1>"
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json, os, sys
|
||||||
|
from pathlib import Path
|
||||||
|
from graphify.transcribe import transcribe_all
|
||||||
|
|
||||||
|
detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
|
||||||
|
video_files = detect.get('files', {}).get('video', [])
|
||||||
|
prompt = os.environ.get('GRAPHIFY_WHISPER_PROMPT', 'Use proper punctuation and paragraph breaks.')
|
||||||
|
|
||||||
|
transcript_paths = transcribe_all(video_files, initial_prompt=prompt)
|
||||||
|
# Write the JSON from Python (NOT a shell '>' redirect): transcribe_all/Whisper
|
||||||
|
# print progress to stdout, which would otherwise corrupt the JSON file (#1392).
|
||||||
|
Path('graphify-out/.graphify_transcripts.json').write_text(json.dumps(transcript_paths, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print(f'Transcribed {len(transcript_paths)} file(s)', file=sys.stderr)
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
After transcription:
|
||||||
|
- Read the transcript paths from `graphify-out/.graphify_transcripts.json`
|
||||||
|
- Add them to the docs list before dispatching semantic subagents in Step 3B
|
||||||
|
- Print how many transcripts were created: `Transcribed N video file(s) -> treating as docs`
|
||||||
|
- If transcription fails for a file, print a warning and continue with the rest
|
||||||
|
|
||||||
|
**Whisper model:** Default is `base`. If the user passed `--whisper-model <name>`, `export GRAPHIFY_WHISPER_MODEL=<name>` (it must be exported, not just assigned) before running the command above.
|
||||||
192
.agents/skills/graphify/references/update.md
Normal file
192
.agents/skills/graphify/references/update.md
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
# graphify reference: incremental update and cluster-only
|
||||||
|
|
||||||
|
Load this only when the user passed `--update` or `--cluster-only`. A first-time full build never reads this file.
|
||||||
|
|
||||||
|
## For --update (incremental re-extraction)
|
||||||
|
|
||||||
|
Use when you've added or modified files since the last run. Only re-extracts changed files - saves tokens and time.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys, json
|
||||||
|
from graphify.detect import detect_incremental, save_manifest
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
result = detect_incremental(Path('INPUT_PATH'))
|
||||||
|
new_total = result.get('new_total', 0)
|
||||||
|
print(json.dumps(result, indent=2, ensure_ascii=False))
|
||||||
|
Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
deleted = list(result.get('deleted_files', []))
|
||||||
|
if new_total == 0 and not deleted:
|
||||||
|
print('No files changed since last run. Nothing to update.')
|
||||||
|
raise SystemExit(0)
|
||||||
|
if deleted:
|
||||||
|
print(f'{len(deleted)} deleted file(s) to prune.')
|
||||||
|
if new_total > 0:
|
||||||
|
print(f'{new_total} new/changed file(s) to re-extract.')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Then populate `.graphify_detect.json` so Steps 3A–6 (which read it unconditionally) see the right state for an incremental run. `files` carries the changed subset (drives Step 3A AST + Step 3B0 cache check on only what changed); `all_files` carries the full corpus for any step that needs corpus-wide context:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
r = json.loads(Path('graphify-out/.graphify_incremental.json').read_text(encoding=\"utf-8\"))
|
||||||
|
Path('graphify-out/.graphify_detect.json').write_text(json.dumps({
|
||||||
|
'files': r.get('new_files', {}),
|
||||||
|
'all_files': r.get('files', {}),
|
||||||
|
'total_files': r.get('new_total', 0),
|
||||||
|
'total_words': r.get('total_words', 0),
|
||||||
|
'skipped_sensitive': r.get('skipped_sensitive', []),
|
||||||
|
'needs_graph': True,
|
||||||
|
}, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
If new files exist, first check whether all changed files are code files:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
result = json.loads(open('graphify-out/.graphify_incremental.json', encoding='utf-8').read()) if Path('graphify-out/.graphify_incremental.json').exists() else {}
|
||||||
|
code_exts = {'.py','.ts','.js','.go','.rs','.java','.cpp','.c','.rb','.swift','.kt','.cs','.scala','.php','.cc','.cxx','.hpp','.h','.kts','.lua','.toc','.f','.F','.f90','.F90','.f95','.F95','.f03','.F03','.f08','.F08'}
|
||||||
|
new_files = result.get('new_files', {})
|
||||||
|
all_changed = [f for files in new_files.values() for f in files]
|
||||||
|
code_only = all(Path(f).suffix.lower() in code_exts for f in all_changed)
|
||||||
|
print('code_only:', code_only)
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
If `code_only` is True: print `[graphify update] Code-only changes detected - skipping semantic extraction (no LLM needed)`, run only Step 3A (AST) on the changed files, skip Step 3B entirely (no subagents), then go straight to merge and Steps 4–8.
|
||||||
|
|
||||||
|
If `code_only` is False (any changed file is a doc/paper/image/video): **first, if any changed file is in `new_files['video']`, run `references/transcribe.md` (Step 2.5) on those files, then rewrite `.graphify_detect.json` to move the resulting transcript paths into `files['document']` and drop `files['video']`** — otherwise raw `.mp4/.mp3` paths are fed to semantic subagents as unreadable media (#1392). Then run the full Steps 3A–3C pipeline as normal.
|
||||||
|
|
||||||
|
|
||||||
|
If no new files exist (only deletions), create an empty extraction so the merge step can prune:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ ! -f graphify-out/.graphify_extract.json ]; then
|
||||||
|
echo '[graphify update] Only deletions -- creating empty extraction for merge.'
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
Path('graphify-out/.graphify_extract.json').write_text(json.dumps({'nodes':[],'edges':[],'hyperedges':[],'input_tokens':0,'output_tokens':0}), encoding='utf-8')
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Then:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
from graphify.build import build_merge
|
||||||
|
from graphify.detect import save_manifest
|
||||||
|
|
||||||
|
# Load new extraction and incremental state
|
||||||
|
new_extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
|
||||||
|
incremental = json.loads(Path('graphify-out/.graphify_incremental.json').read_text(encoding=\"utf-8\"))
|
||||||
|
deleted = list(incremental.get('deleted_files', []))
|
||||||
|
# prune_sources is ONLY for genuinely DELETED files. Changed/re-extracted files are
|
||||||
|
# handled by build_merge's replace-on-re-extract (#1344): every source_file in
|
||||||
|
# new_chunks is dropped from the base before merge, so old/stale nodes don't survive.
|
||||||
|
# Do NOT add `changed` here: with root= passed, prune_set relativizes to the same base
|
||||||
|
# as the freshly merged nodes and would DELETE the re-extracted content (#1178 is moot
|
||||||
|
# now that replace — not the dedup pass — reconciles changed files).
|
||||||
|
prune = list(deleted) or None
|
||||||
|
|
||||||
|
# Use build_merge() — reads graph.json directly without NetworkX round-trip
|
||||||
|
# so edge direction (calls, implements, imports) is always preserved (#801).
|
||||||
|
# Pass root= so prune_sources (absolute paths from detect_incremental) are
|
||||||
|
# relativized to match the graph's relative source_file values; without it
|
||||||
|
# nothing is pruned and stale nodes accumulate on every update (#1361).
|
||||||
|
# directed=IS_DIRECTED: replace IS_DIRECTED with True if --directed was given, else
|
||||||
|
# False. Without it a --directed --update silently rebuilds undirected and collapses
|
||||||
|
# reciprocal A<->B edges (#1392).
|
||||||
|
G = build_merge(
|
||||||
|
[new_extraction],
|
||||||
|
graph_path='graphify-out/graph.json',
|
||||||
|
prune_sources=prune,
|
||||||
|
root='INPUT_PATH',
|
||||||
|
directed=IS_DIRECTED,
|
||||||
|
)
|
||||||
|
print(f'[graphify update] Merged: {G.number_of_nodes()} nodes, {G.number_of_edges()} edges')
|
||||||
|
|
||||||
|
# Write merged result back to .graphify_extract.json so Step 4 sees the full graph
|
||||||
|
merged_out = {
|
||||||
|
'nodes': [{'id': n, **d} for n, d in G.nodes(data=True)],
|
||||||
|
'edges': [
|
||||||
|
# Explicit source/target last so they win over any stale attrs in d.
|
||||||
|
{**{k: val for k, val in d.items() if k not in ('_src', '_tgt', 'source', 'target')},
|
||||||
|
'source': d.get('_src', u), 'target': d.get('_tgt', v)}
|
||||||
|
for u, v, d in G.edges(data=True)
|
||||||
|
],
|
||||||
|
# G.graph["hyperedges"] holds hyperedges from both existing graph.json
|
||||||
|
# and new_extraction (build_merge combines them). Falling back to
|
||||||
|
# new_extraction only would silently drop prior-run hyperedges (#801).
|
||||||
|
'hyperedges': list(G.graph.get('hyperedges', [])),
|
||||||
|
'input_tokens': new_extraction.get('input_tokens', 0),
|
||||||
|
'output_tokens': new_extraction.get('output_tokens', 0),
|
||||||
|
}
|
||||||
|
Path('graphify-out/.graphify_extract.json').write_text(json.dumps(merged_out, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print(f'[graphify update] Merged extraction written ({len(merged_out[\"nodes\"])} nodes, {len(merged_out[\"edges\"])} edges)')
|
||||||
|
|
||||||
|
# Save manifest so next --update diffs against today's state, not the
|
||||||
|
# prior run's baseline (prevents ghost-node reports on subsequent updates).
|
||||||
|
# root= matches the build_merge call above so the manifest keys stay relative to
|
||||||
|
# the scan root — portable across clones/machines, so --update keeps matching
|
||||||
|
# cached files instead of missing every one after a move (#1417).
|
||||||
|
save_manifest(incremental['files'], root='INPUT_PATH')
|
||||||
|
print('[graphify update] Manifest saved.')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Then run Steps 4–8 on the merged graph as normal.
|
||||||
|
|
||||||
|
After Step 4, show the graph diff:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from graphify.analyze import graph_diff
|
||||||
|
from graphify.build import build_from_json
|
||||||
|
from networkx.readwrite import json_graph
|
||||||
|
import networkx as nx
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Load old graph (before update) from backup written before merge
|
||||||
|
old_data = json.loads(Path('graphify-out/.graphify_old.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_old.json').exists() else None
|
||||||
|
new_extract = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
|
||||||
|
G_new = build_from_json(new_extract, directed=IS_DIRECTED)
|
||||||
|
|
||||||
|
if old_data:
|
||||||
|
G_old = json_graph.node_link_graph(old_data, edges='links')
|
||||||
|
diff = graph_diff(G_old, G_new)
|
||||||
|
print(diff['summary'])
|
||||||
|
if diff['new_nodes']:
|
||||||
|
print('New nodes:', ', '.join(n['label'] for n in diff['new_nodes'][:5]))
|
||||||
|
if diff['new_edges']:
|
||||||
|
print('New edges:', len(diff['new_edges']))
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Before the merge step, save the old graph: `cp graphify-out/graph.json graphify-out/.graphify_old.json`
|
||||||
|
Clean up after: `rm -f graphify-out/.graphify_old.json`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For --cluster-only
|
||||||
|
|
||||||
|
Skip Steps 1–3. Re-run clustering on the existing graph:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify cluster-only .
|
||||||
|
```
|
||||||
|
|
||||||
|
`graphify cluster-only .` is **self-contained**: it re-clusters, names communities, and regenerates `GRAPH_REPORT.md`, `graph.json`, and `graph.html` from the existing graph. **Do not re-run Steps 5–9** — they read intermediate files (`.graphify_extract.json`, `.graphify_detect.json`, `.graphify_analysis.json`) that a prior build's cleanup (Step 9) already deleted, so they raise `FileNotFoundError` (#1392). When it finishes, present the refreshed `GRAPH_REPORT.md` summary as usual.
|
||||||
1
.codex/graphify/.graphify_version
Normal file
1
.codex/graphify/.graphify_version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
0.9.5
|
||||||
674
.codex/graphify/SKILL.md
Normal file
674
.codex/graphify/SKILL.md
Normal file
@@ -0,0 +1,674 @@
|
|||||||
|
---
|
||||||
|
name: graphify
|
||||||
|
description: "Use for any question about a codebase, its architecture, file relationships, or project content — especially when graphify-out/ exists, where the question should be treated as a graphify query first. Turns any input (code, docs, papers, images, videos) into a persistent knowledge graph with god nodes, community detection, and query/path/explain tools."
|
||||||
|
---
|
||||||
|
|
||||||
|
# /graphify
|
||||||
|
|
||||||
|
Turn any folder of files into a navigable knowledge graph with community detection, an honest audit trail, and three outputs: interactive HTML, GraphRAG-ready JSON, and a plain-language GRAPH_REPORT.md.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
/graphify # full pipeline on current directory → Obsidian vault
|
||||||
|
/graphify <path> # full pipeline on specific path
|
||||||
|
/graphify https://github.com/<owner>/<repo> # clone repo then run full pipeline on it
|
||||||
|
/graphify https://github.com/<owner>/<repo> --branch <branch> # clone a specific branch
|
||||||
|
/graphify <url1> <url2> ... # clone multiple repos, build each, merge into one cross-repo graph
|
||||||
|
/graphify <path> --mode deep # thorough extraction, richer INFERRED edges
|
||||||
|
/graphify <path> --update # incremental - re-extract only new/changed files
|
||||||
|
/graphify <path> --directed # build directed graph (preserves edge direction: source→target)
|
||||||
|
/graphify <path> --whisper-model medium # use a larger Whisper model for better transcription accuracy
|
||||||
|
/graphify <path> --cluster-only # rerun clustering on existing graph
|
||||||
|
/graphify <path> --no-viz # skip visualization, just report + JSON
|
||||||
|
/graphify <path> --html # (HTML is generated by default - this flag is a no-op)
|
||||||
|
/graphify <path> --svg # also export graph.svg (embeds in Notion, GitHub)
|
||||||
|
/graphify <path> --graphml # export graph.graphml (Gephi, yEd)
|
||||||
|
/graphify <path> --neo4j # generate graphify-out/cypher.txt for Neo4j
|
||||||
|
/graphify <path> --neo4j-push bolt://localhost:7687 # push directly to Neo4j
|
||||||
|
/graphify <path> --falkordb # generate graphify-out/cypher.txt for FalkorDB
|
||||||
|
/graphify <path> --falkordb-push falkordb://localhost:6379 # push directly to FalkorDB
|
||||||
|
/graphify <path> --mcp # start MCP stdio server for agent access
|
||||||
|
/graphify <path> --watch # watch folder, auto-rebuild on code changes (no LLM needed)
|
||||||
|
/graphify <path> --wiki # build agent-crawlable wiki (index.md + one article per community)
|
||||||
|
/graphify <path> --obsidian --obsidian-dir ~/vaults/my-project # write vault to custom path (e.g. existing vault)
|
||||||
|
/graphify add <url> # fetch URL, save to ./raw, update graph
|
||||||
|
/graphify add <url> --author "Name" # tag who wrote it
|
||||||
|
/graphify add <url> --contributor "Name" # tag who added it to the corpus
|
||||||
|
/graphify query "<question>" # BFS traversal - broad context
|
||||||
|
/graphify query "<question>" --dfs # DFS - trace a specific path
|
||||||
|
/graphify query "<question>" --budget 1500 # cap answer at N tokens
|
||||||
|
/graphify path "AuthModule" "Database" # shortest path between two concepts
|
||||||
|
/graphify explain "SwinTransformer" # plain-language explanation of a node
|
||||||
|
```
|
||||||
|
|
||||||
|
## What graphify is for
|
||||||
|
|
||||||
|
Drop any folder of code, docs, papers, images, or video into graphify and get a queryable knowledge graph. Persistent across sessions, honest audit trail (EXTRACTED/INFERRED/AMBIGUOUS), community detection surfaces cross-document connections you wouldn't think to ask about.
|
||||||
|
|
||||||
|
## What You Must Do When Invoked
|
||||||
|
|
||||||
|
If the user invoked `/graphify --help` or `/graphify -h` (with no other arguments), print the contents of the `## Usage` section above verbatim and stop. Do not run any commands, do not detect files, do not default the path to `.`. Just print the Usage block and return.
|
||||||
|
|
||||||
|
**Fast path — existing graph:** Before doing anything else, check whether `graphify-out/graph.json` exists. The expected location is `graphify-out/graph.json` relative to the **current working directory** (i.e. the project root where you are running commands). If it exists AND the user's request is a natural-language question about the codebase (e.g. "How does X work?", "What calls Y?", "Trace the data flow through Z") and NOT an explicit rebuild command (`--update`, `--cluster-only`, or a bare path/URL that implies fresh extraction): **skip Steps 1–5 entirely and jump straight to `## For /graphify query`.** Run `graphify query "<question>"` immediately. Do not run detect. Do not check corpus size. Do not ask the user to narrow. The graph is already built — use it.
|
||||||
|
|
||||||
|
If no path was given, use `.` (current directory). Do not ask the user for a path.
|
||||||
|
|
||||||
|
If the path argument starts with `https://github.com/` or `http://github.com/`, treat it as a GitHub URL - run Step 0 before anything else, then continue with the resolved local path.
|
||||||
|
|
||||||
|
Follow these steps in order. Do not skip steps.
|
||||||
|
|
||||||
|
### Step 0 - GitHub repos and multi-path merge (only if a URL or several paths)
|
||||||
|
|
||||||
|
Only when the path is one or more `https://github.com/...` URLs, or several local subfolders to merge. See `references/github-and-merge.md` for the clone, cross-repo merge, and monorepo flow, then continue with the resolved local path. A plain local path skips this step.
|
||||||
|
|
||||||
|
### Step 1 - Ensure graphify is installed
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Detect the correct Python interpreter (handles uv tool, pipx, venv, system installs)
|
||||||
|
PYTHON=""
|
||||||
|
GRAPHIFY_BIN=$(which graphify 2>/dev/null)
|
||||||
|
# 1. uv tool installs — most reliable on modern Mac/Linux
|
||||||
|
if [ -z "$PYTHON" ] && command -v uv >/dev/null 2>&1; then
|
||||||
|
_UV_PY=$(uv tool run graphifyy python -c "import sys; print(sys.executable)" 2>/dev/null)
|
||||||
|
if [ -n "$_UV_PY" ]; then PYTHON="$_UV_PY"; fi
|
||||||
|
fi
|
||||||
|
# 2. Read shebang from graphify binary (pipx and direct pip installs)
|
||||||
|
if [ -z "$PYTHON" ] && [ -n "$GRAPHIFY_BIN" ]; then
|
||||||
|
_SHEBANG=$(head -1 "$GRAPHIFY_BIN" | tr -d '#!')
|
||||||
|
case "$_SHEBANG" in
|
||||||
|
*[!a-zA-Z0-9/_.@-]*) ;;
|
||||||
|
*) "$_SHEBANG" -c "import graphify" 2>/dev/null && PYTHON="$_SHEBANG" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
# 3. Fall back to python3
|
||||||
|
if [ -z "$PYTHON" ]; then PYTHON="python3"; fi
|
||||||
|
if ! "$PYTHON" -c "import graphify" 2>/dev/null; then
|
||||||
|
if command -v uv >/dev/null 2>&1; then
|
||||||
|
uv tool install --upgrade graphifyy -q 2>&1 | tail -3
|
||||||
|
_UV_PY=$(uv tool run graphifyy python -c "import sys; print(sys.executable)" 2>/dev/null)
|
||||||
|
if [ -n "$_UV_PY" ]; then PYTHON="$_UV_PY"; fi
|
||||||
|
else
|
||||||
|
"$PYTHON" -m pip install graphifyy -q 2>/dev/null \
|
||||||
|
|| "$PYTHON" -m pip install graphifyy -q --break-system-packages 2>&1 | tail -3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Write interpreter path for all subsequent steps (persists across invocations)
|
||||||
|
mkdir -p graphify-out
|
||||||
|
"$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)"
|
||||||
|
# Save scan root so `graphify update` (no args) knows where to look next time
|
||||||
|
echo "$(cd INPUT_PATH && pwd)" > graphify-out/.graphify_root
|
||||||
|
```
|
||||||
|
|
||||||
|
If the import succeeds, print nothing and move straight to Step 2.
|
||||||
|
|
||||||
|
**In every subsequent bash block, replace `python3` with `$(cat graphify-out/.graphify_python)` to use the correct interpreter.**
|
||||||
|
|
||||||
|
### Step 2 - Detect files
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from graphify.detect import detect
|
||||||
|
from pathlib import Path
|
||||||
|
result = detect(Path('INPUT_PATH'))
|
||||||
|
print(json.dumps(result, ensure_ascii=False))
|
||||||
|
" > graphify-out/.graphify_detect.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace INPUT_PATH with the actual path the user provided. Do NOT cat or print the JSON - read it silently and present a clean summary instead:
|
||||||
|
|
||||||
|
```
|
||||||
|
Corpus: X files · ~Y words
|
||||||
|
code: N files (.py .ts .go ...)
|
||||||
|
docs: N files (.md .txt ...)
|
||||||
|
papers: N files (.pdf ...)
|
||||||
|
images: N files
|
||||||
|
video: N files (.mp4 .mp3 ...)
|
||||||
|
```
|
||||||
|
|
||||||
|
Omit any category with 0 files from the summary.
|
||||||
|
|
||||||
|
Then act on it:
|
||||||
|
- If `total_files` is 0: stop with "No supported files found in [path]."
|
||||||
|
- If `skipped_sensitive` is non-empty: mention file count skipped, not the file names.
|
||||||
|
- If `total_words` > 2,000,000 OR `total_files` > 500: show the warning. Then compute the top 5 first-level subdirectories by file count:
|
||||||
|
- Read `scan_root` from the detect JSON (always an absolute path to the resolved INPUT_PATH).
|
||||||
|
- Concatenate all file lists across all types (`code`, `document`, `paper`, `image`, `video`).
|
||||||
|
- Filter out any path that starts with `scan_root + "/graphify-out/"` to exclude converted sidecars.
|
||||||
|
- For each file, strip the `scan_root` prefix and take the first path component. Files directly in `scan_root` with no subdirectory count as `(root)`.
|
||||||
|
- If all files are in `(root)` with no subdirectories, do not ask to narrow — no subfolders exist. Instead suggest `--no-cluster` to skip the expensive clustering step and proceed.
|
||||||
|
- Otherwise rank by count, show the top 5 with file counts, then ask which subfolder to run on. Wait for the user's answer before proceeding.
|
||||||
|
- Otherwise: proceed directly to Step 2.5 if video files were detected, or Step 3 if not.
|
||||||
|
|
||||||
|
### Step 2.5 - Video and audio (only if video files detected)
|
||||||
|
|
||||||
|
Skip this step entirely if `detect` returned zero `video` files. When the corpus has video or audio, see `references/transcribe.md` to transcribe them to text first, then treat the transcripts as doc files in Step 3.
|
||||||
|
|
||||||
|
### Step 3 - Extract entities and relationships
|
||||||
|
|
||||||
|
**Before starting:** note whether `--mode deep` was given. You must pass `DEEP_MODE=true` to every subagent in Step B2 if it was. Track this from the original invocation - do not lose it.
|
||||||
|
|
||||||
|
This step has two parts: **structural extraction** (deterministic, free) and **semantic extraction** (LLM, costs tokens).
|
||||||
|
|
||||||
|
> **graphify needs no API key. Never ask the user for one, and never block on one.** Code is extracted structurally (AST) with no LLM and no key at all — a code-only corpus (the common `/graphify .` on a repo) skips semantic extraction entirely, so it needs nothing here: go straight to Part A and skip Part B. Semantic extraction (only for docs, papers, and images) uses Gemini **only if** `GEMINI_API_KEY`/`GOOGLE_API_KEY` is already set; otherwise the host agent itself is the LLM. graphify does **not** read `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, or any other provider key. If you catch yourself about to prompt for, wait on, or stop because of a missing API key, that is a misread of this skill — proceed without one.
|
||||||
|
|
||||||
|
**Before semantic extraction:** check whether `GEMINI_API_KEY` or `GOOGLE_API_KEY` is set. If neither is set, print this one-liner to the user:
|
||||||
|
> Tip: set `GEMINI_API_KEY` or `GOOGLE_API_KEY` to use Gemini for semantic extraction (`pip install 'graphifyy[gemini]'`).
|
||||||
|
|
||||||
|
Print it once, then continue — do not wait for the user to supply a key. If `GEMINI_API_KEY` or `GOOGLE_API_KEY` IS set, use `graphify.llm.extract_corpus_parallel(files, backend="gemini")` for semantic extraction instead of dispatching subagents. The default Gemini model is `gemini-3-flash-preview`; set `GRAPHIFY_GEMINI_MODEL` or pass `--model` in headless CLI flows to override it.
|
||||||
|
|
||||||
|
> **No other API keys are read.** When `GEMINI_API_KEY`/`GOOGLE_API_KEY` are unset, semantic extraction falls to the host agent itself — the running session is the LLM. On a host that dispatches subagents (e.g. Claude Code), dispatch them as written in Part B. On a host that runs the CLI directly in a terminal and cannot dispatch subagents, do not stall: a code-only corpus has no semantic work, so write the empty semantic file (Part B "Fast path") and continue to Part C; for a corpus with docs/papers/images, either set a Gemini key or extract those inline yourself, but in no case prompt for `ANTHROPIC_API_KEY` — that prompt is a misread of this skill.
|
||||||
|
|
||||||
|
**Run Part A (AST) and Part B (semantic) in parallel. Dispatch all semantic subagents AND start AST extraction in the same message. Both can run simultaneously since they operate on different file types. Merge results in Part C as before.**
|
||||||
|
|
||||||
|
Note: Parallelizing AST + semantic saves 5-15s on large corpora. AST is deterministic and fast; start it while subagents are processing docs/papers.
|
||||||
|
|
||||||
|
#### Part A - Structural extraction for code files
|
||||||
|
|
||||||
|
For any code files detected, run AST extraction in parallel with Part B subagents:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys, json
|
||||||
|
from graphify.extract import collect_files, extract
|
||||||
|
from pathlib import Path
|
||||||
|
import json
|
||||||
|
|
||||||
|
code_files = []
|
||||||
|
detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
|
||||||
|
for f in detect.get('files', {}).get('code', []):
|
||||||
|
code_files.extend(collect_files(Path(f)) if Path(f).is_dir() else [Path(f)])
|
||||||
|
|
||||||
|
if code_files:
|
||||||
|
result = extract(code_files, cache_root=Path('INPUT_PATH'))
|
||||||
|
Path('graphify-out/.graphify_ast.json').write_text(json.dumps(result, indent=2, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print(f'AST: {len(result[\"nodes\"])} nodes, {len(result[\"edges\"])} edges')
|
||||||
|
else:
|
||||||
|
Path('graphify-out/.graphify_ast.json').write_text(json.dumps({'nodes':[],'edges':[],'input_tokens':0,'output_tokens':0}, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print('No code files - skipping AST extraction')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Part B - Semantic extraction (parallel subagents)
|
||||||
|
|
||||||
|
**Fast path:** If detection found zero docs, papers, and images (code-only corpus), skip Part B entirely and go straight to Part C. AST handles code - there is nothing for semantic subagents to do. **First write an empty semantic file** so Part C's merge has its input (it reads `.graphify_semantic.json` unconditionally; without this a code-only run hits `FileNotFoundError`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
Path('graphify-out/.graphify_semantic.json').write_text(json.dumps({'nodes':[],'edges':[],'hyperedges':[],'input_tokens':0,'output_tokens':0}), encoding='utf-8')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
**MANDATORY: You MUST use the Agent tool here. Reading files yourself one-by-one is forbidden - it is 5-10x slower. If you do not use the Agent tool you are doing this wrong.**
|
||||||
|
|
||||||
|
Before dispatching subagents, print a timing estimate:
|
||||||
|
- Load `total_words` and file counts from `graphify-out/.graphify_detect.json`
|
||||||
|
- Estimate agents needed: `ceil(uncached_non_code_files / 22)` (chunk size is 20-25)
|
||||||
|
- Estimate time: ~45s per agent batch (they run in parallel, so total ≈ 45s × ceil(agents/parallel_limit))
|
||||||
|
- Print: "Semantic extraction: ~N files → X agents, estimated ~Ys"
|
||||||
|
|
||||||
|
**Step B0 - Check extraction cache first**
|
||||||
|
|
||||||
|
Before dispatching any subagents, check which files already have cached extraction results:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from graphify.cache import check_semantic_cache
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
|
||||||
|
# Only content files go to semantic extraction. Code is already covered structurally
|
||||||
|
# by the AST pass (Part A); flattening every category here makes subagents re-read
|
||||||
|
# every source file (#1392). Video is transcribed to a document in Step 2.5 first.
|
||||||
|
all_files = [f for cat in ('document', 'paper', 'image') for f in detect['files'].get(cat, [])]
|
||||||
|
|
||||||
|
cached_nodes, cached_edges, cached_hyperedges, uncached = check_semantic_cache(all_files, root='INPUT_PATH')
|
||||||
|
|
||||||
|
# Always (re)write the cache file: write hits, else DELETE any leftover from a prior
|
||||||
|
# run so Part C never merges a stale .graphify_cached.json (#1392).
|
||||||
|
if cached_nodes or cached_edges or cached_hyperedges:
|
||||||
|
Path('graphify-out/.graphify_cached.json').write_text(json.dumps({'nodes': cached_nodes, 'edges': cached_edges, 'hyperedges': cached_hyperedges}, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
else:
|
||||||
|
Path('graphify-out/.graphify_cached.json').unlink(missing_ok=True)
|
||||||
|
Path('graphify-out/.graphify_uncached.txt').write_text('\n'.join(uncached), encoding=\"utf-8\")
|
||||||
|
print(f'Cache: {len(all_files)-len(uncached)} files hit, {len(uncached)} files need extraction')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Only dispatch subagents for files listed in `graphify-out/.graphify_uncached.txt`. If all files are cached, skip to Part C directly.
|
||||||
|
|
||||||
|
**Step B1 - Split into chunks**
|
||||||
|
|
||||||
|
Load files from `graphify-out/.graphify_uncached.txt`. Split into chunks of 20-25 files each. Each image gets its own chunk (vision needs separate context). When splitting, group files from the same directory together so related artifacts land in the same chunk and cross-file relationships are more likely to be extracted.
|
||||||
|
|
||||||
|
**Step B2 - Dispatch ALL subagents in a single message (Codex)**
|
||||||
|
|
||||||
|
> **Codex platform:** Uses `spawn_agent` + `wait_agent` + `close_agent` instead of the Agent tool.
|
||||||
|
> Requires `multi_agent = true` under `[features]` in `~/.codex/config.toml`.
|
||||||
|
> If `spawn_agent` is unavailable, tell the user to add that config and restart Codex.
|
||||||
|
|
||||||
|
Call `spawn_agent` once per chunk — ALL in the same response so they run in parallel. Build the message by wrapping the extraction prompt in task-delegation framing:
|
||||||
|
|
||||||
|
```
|
||||||
|
spawn_agent(agent_type="worker", message="Your task is to perform the following. Follow the instructions below exactly.\n\n<agent-instructions>\n[extraction prompt, with FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, DEEP_MODE substituted]\n</agent-instructions>\n\nExecute this now. Output ONLY the structured JSON response.")
|
||||||
|
```
|
||||||
|
|
||||||
|
After all agents are dispatched, collect results sequentially in memory:
|
||||||
|
```
|
||||||
|
result = wait_agent(handle); close_agent(handle) # repeat per handle
|
||||||
|
```
|
||||||
|
|
||||||
|
Parse each result as JSON. Accumulate nodes/edges/hyperedges across all results and write to `graphify-out/.graphify_semantic_new.json`. Codex collects in memory, so there are no per-chunk files on disk; the disk-based success checks in Step B3 do not apply — a chunk that returns invalid JSON is the failure signal instead.
|
||||||
|
|
||||||
|
Subagent prompt template:
|
||||||
|
|
||||||
|
See `references/extraction-spec.md` for the compact subagent prompt (rules, node-ID format, confidence rubric, hyperedge and vision rules, JSON schema). Load it only here, only when at least one chunk holds a doc, paper, or image; a pure-code corpus has skipped Part B and never reads it. Pass each agent that prompt verbatim with FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, and DEEP_MODE substituted, and have it return the JSON inline.
|
||||||
|
|
||||||
|
**Step B3 - Collect, cache, and merge**
|
||||||
|
|
||||||
|
Wait for all subagents. For each result:
|
||||||
|
- Check that `graphify-out/.graphify_chunk_NN.json` exists on disk — this is the success signal
|
||||||
|
- If the file exists and contains valid JSON with `nodes` and `edges`, include it and save to cache
|
||||||
|
- If the file is missing, the subagent was likely dispatched as read-only (Explore type) — print a warning: "chunk N missing from disk — subagent may have been read-only. Re-run with general-purpose agent." Do not silently skip.
|
||||||
|
- If a subagent failed or returned invalid JSON, print a warning and skip that chunk - do not abort
|
||||||
|
|
||||||
|
If more than half the chunks failed or are missing, stop and tell the user to re-run and ensure `subagent_type="general-purpose"` is used.
|
||||||
|
|
||||||
|
Merge all chunk files into `.graphify_semantic_new.json`. **After each Agent call completes, read the real token counts from the Agent tool result's `usage` field and write them back into the chunk JSON before merging** — the chunk JSON itself always has placeholder zeros. Then run:
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json, glob
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
chunks = sorted(glob.glob('graphify-out/.graphify_chunk_*.json'))
|
||||||
|
all_nodes, all_edges, all_hyperedges = [], [], []
|
||||||
|
total_in, total_out = 0, 0
|
||||||
|
for c in chunks:
|
||||||
|
d = json.loads(Path(c).read_text(encoding=\"utf-8\"))
|
||||||
|
all_nodes += d.get('nodes', [])
|
||||||
|
all_edges += d.get('edges', [])
|
||||||
|
all_hyperedges += d.get('hyperedges', [])
|
||||||
|
total_in += d.get('input_tokens', 0)
|
||||||
|
total_out += d.get('output_tokens', 0)
|
||||||
|
Path('graphify-out/.graphify_semantic_new.json').write_text(json.dumps({
|
||||||
|
'nodes': all_nodes, 'edges': all_edges, 'hyperedges': all_hyperedges,
|
||||||
|
'input_tokens': total_in, 'output_tokens': total_out,
|
||||||
|
}, indent=2, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print(f'Merged {len(chunks)} chunks: {total_in:,} in / {total_out:,} out tokens')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Save new results to cache:
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from graphify.cache import save_semantic_cache
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
new = json.loads(Path('graphify-out/.graphify_semantic_new.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_semantic_new.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]}
|
||||||
|
saved = save_semantic_cache(new.get('nodes', []), new.get('edges', []), new.get('hyperedges', []), root='INPUT_PATH')
|
||||||
|
print(f'Cached {saved} files')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Merge cached + new results into `graphify-out/.graphify_semantic.json`:
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
cached = json.loads(Path('graphify-out/.graphify_cached.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_cached.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]}
|
||||||
|
new = json.loads(Path('graphify-out/.graphify_semantic_new.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_semantic_new.json').exists() else {'nodes':[],'edges':[],'hyperedges':[]}
|
||||||
|
|
||||||
|
all_nodes = cached['nodes'] + new.get('nodes', [])
|
||||||
|
all_edges = cached['edges'] + new.get('edges', [])
|
||||||
|
all_hyperedges = cached.get('hyperedges', []) + new.get('hyperedges', [])
|
||||||
|
seen = set()
|
||||||
|
deduped = []
|
||||||
|
for n in all_nodes:
|
||||||
|
if n['id'] not in seen:
|
||||||
|
seen.add(n['id'])
|
||||||
|
deduped.append(n)
|
||||||
|
|
||||||
|
merged = {
|
||||||
|
'nodes': deduped,
|
||||||
|
'edges': all_edges,
|
||||||
|
'hyperedges': all_hyperedges,
|
||||||
|
'input_tokens': new.get('input_tokens', 0),
|
||||||
|
'output_tokens': new.get('output_tokens', 0),
|
||||||
|
}
|
||||||
|
Path('graphify-out/.graphify_semantic.json').write_text(json.dumps(merged, indent=2, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print(f'Extraction complete - {len(deduped)} nodes, {len(all_edges)} edges ({len(cached[\"nodes\"])} from cache, {len(new.get(\"nodes\",[]))} new)')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
Clean up temp files: `rm -f graphify-out/.graphify_cached.json graphify-out/.graphify_uncached.txt graphify-out/.graphify_semantic_new.json`
|
||||||
|
|
||||||
|
#### Part C - Merge AST + semantic into final extraction
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys, json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
ast = json.loads(Path('graphify-out/.graphify_ast.json').read_text(encoding=\"utf-8\"))
|
||||||
|
sem = json.loads(Path('graphify-out/.graphify_semantic.json').read_text(encoding=\"utf-8\"))
|
||||||
|
|
||||||
|
# Merge: AST nodes first, semantic nodes deduplicated by id
|
||||||
|
seen = {n['id'] for n in ast['nodes']}
|
||||||
|
merged_nodes = list(ast['nodes'])
|
||||||
|
for n in sem['nodes']:
|
||||||
|
if n['id'] not in seen:
|
||||||
|
merged_nodes.append(n)
|
||||||
|
seen.add(n['id'])
|
||||||
|
|
||||||
|
merged_edges = ast['edges'] + sem['edges']
|
||||||
|
merged_hyperedges = sem.get('hyperedges', [])
|
||||||
|
merged = {
|
||||||
|
'nodes': merged_nodes,
|
||||||
|
'edges': merged_edges,
|
||||||
|
'hyperedges': merged_hyperedges,
|
||||||
|
'input_tokens': sem.get('input_tokens', 0),
|
||||||
|
'output_tokens': sem.get('output_tokens', 0),
|
||||||
|
}
|
||||||
|
Path('graphify-out/.graphify_extract.json').write_text(json.dumps(merged, indent=2, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
total = len(merged_nodes)
|
||||||
|
edges = len(merged_edges)
|
||||||
|
print(f'Merged: {total} nodes, {edges} edges ({len(ast[\"nodes\"])} AST + {len(sem[\"nodes\"])} semantic)')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 4 - Build graph, cluster, analyze, generate outputs
|
||||||
|
|
||||||
|
**Before starting:** the code blocks below pass `directed=IS_DIRECTED` to `build_from_json()`. Replace `IS_DIRECTED` with `True` if `--directed` was given (builds a `DiGraph` preserving edge direction source→target), otherwise `False` (the default undirected `Graph`). Substitute it the same way you substitute `INPUT_PATH` — do not leave the literal `IS_DIRECTED` in the code.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p graphify-out
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys, json
|
||||||
|
from graphify.build import build_from_json
|
||||||
|
from graphify.cluster import cluster, score_all
|
||||||
|
from graphify.analyze import god_nodes, surprising_connections, suggest_questions
|
||||||
|
from graphify.report import generate
|
||||||
|
from graphify.export import to_json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
|
||||||
|
detection = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
|
||||||
|
|
||||||
|
# root= mirrors the --update runbook (#1361): relativize source_file to the same
|
||||||
|
# base so the full build and incremental --update never drift apart on re-extract.
|
||||||
|
G = build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED)
|
||||||
|
# Guard BEFORE any write: an empty extraction must not clobber a good graph.json /
|
||||||
|
# GRAPH_REPORT.md / analysis sidecar. Check immediately after build (#1392).
|
||||||
|
if G.number_of_nodes() == 0:
|
||||||
|
print('ERROR: Graph is empty - extraction produced no nodes.')
|
||||||
|
print('Possible causes: all files were skipped, binary-only corpus, or extraction failed.')
|
||||||
|
raise SystemExit(1)
|
||||||
|
communities = cluster(G)
|
||||||
|
cohesion = score_all(G, communities)
|
||||||
|
tokens = {'input': extraction.get('input_tokens', 0), 'output': extraction.get('output_tokens', 0)}
|
||||||
|
gods = god_nodes(G)
|
||||||
|
surprises = surprising_connections(G, communities)
|
||||||
|
labels = {cid: 'Community ' + str(cid) for cid in communities}
|
||||||
|
# Placeholder questions - regenerated with real labels in Step 5
|
||||||
|
questions = suggest_questions(G, communities, labels)
|
||||||
|
|
||||||
|
# Export FIRST and honor the #479 shrink-guard: to_json returns False (writing
|
||||||
|
# nothing) when the new graph is smaller than the existing graph.json. Only write
|
||||||
|
# GRAPH_REPORT.md + the analysis sidecar when the graph was actually written, so
|
||||||
|
# they never describe a graph that graph.json doesn't contain (#1392).
|
||||||
|
wrote = to_json(G, communities, 'graphify-out/graph.json')
|
||||||
|
if not wrote:
|
||||||
|
print('ERROR: refused to shrink graphify-out/graph.json (existing graph has more nodes; #479).')
|
||||||
|
print('If this shrink is intentional (you deleted files), re-run a full build with --force.')
|
||||||
|
raise SystemExit(1)
|
||||||
|
report = generate(G, communities, cohesion, labels, gods, surprises, detection, tokens, 'INPUT_PATH', suggested_questions=questions)
|
||||||
|
Path('graphify-out/GRAPH_REPORT.md').write_text(report, encoding=\"utf-8\")
|
||||||
|
analysis = {
|
||||||
|
'communities': {str(k): v for k, v in communities.items()},
|
||||||
|
'cohesion': {str(k): v for k, v in cohesion.items()},
|
||||||
|
'gods': gods,
|
||||||
|
'surprises': surprises,
|
||||||
|
'questions': questions,
|
||||||
|
}
|
||||||
|
Path('graphify-out/.graphify_analysis.json').write_text(json.dumps(analysis, indent=2, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print(f'Graph: {G.number_of_nodes()} nodes, {G.number_of_edges()} edges, {len(communities)} communities')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
If this step prints `ERROR: Graph is empty`, stop and tell the user what happened - do not proceed to labeling or visualization.
|
||||||
|
|
||||||
|
Replace INPUT_PATH with the actual path.
|
||||||
|
|
||||||
|
### Step 4.5 - Graph health check (read-only integrity gate)
|
||||||
|
|
||||||
|
A non-destructive diagnostic on the extraction, before labeling. It surfaces edge collapse, dangling/missing endpoints, and self-loops — the silent-corruption modes of incremental updates and AST/LLM id mismatches. Read-only; never aborts.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
from graphify.diagnostics import diagnose_extraction, format_diagnostic_report
|
||||||
|
|
||||||
|
extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
|
||||||
|
summary = diagnose_extraction(extraction, directed=IS_DIRECTED, root='INPUT_PATH')
|
||||||
|
print(format_diagnostic_report(summary))
|
||||||
|
flags = [f'{summary[k]} {label}' for k, label in (
|
||||||
|
('dangling_endpoint_edges', 'dangling-endpoint edges'),
|
||||||
|
('missing_endpoint_edges', 'missing-endpoint edges'),
|
||||||
|
('self_loop_edges', 'self-loop edges'),
|
||||||
|
('directed_same_endpoint_collapsed_edges', 'collapsed (directed) edges'),
|
||||||
|
('undirected_same_endpoint_collapsed_edges', 'collapsed (undirected) edges'),
|
||||||
|
) if summary.get(k, 0)]
|
||||||
|
print('GRAPH HEALTH WARNING: ' + '; '.join(flags) + ' - graph may be incomplete/corrupt.' if flags else 'Graph health: OK (no dangling/missing/collapsed edges).')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Substitute `IS_DIRECTED` and `INPUT_PATH` as in Step 4. If a `GRAPH HEALTH WARNING` prints, surface it in the final summary (do not abort — the graph is still usable, but the integrity issue must be visible, per the Honesty Rules).
|
||||||
|
|
||||||
|
### Step 5 - Label communities
|
||||||
|
|
||||||
|
Read `graphify-out/.graphify_analysis.json`. For each community key, look at its node labels and write a 2-5 word plain-language name (e.g. "Attention Mechanism", "Training Pipeline", "Data Loading").
|
||||||
|
|
||||||
|
Then regenerate the report and save the labels for the visualizer:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys, json
|
||||||
|
from graphify.build import build_from_json
|
||||||
|
from graphify.cluster import score_all
|
||||||
|
from graphify.analyze import god_nodes, surprising_connections, suggest_questions
|
||||||
|
from graphify.report import generate
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
|
||||||
|
detection = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
|
||||||
|
analysis = json.loads(Path('graphify-out/.graphify_analysis.json').read_text(encoding=\"utf-8\"))
|
||||||
|
|
||||||
|
# root= as in Step 4 / the --update runbook (#1361) — same base for node-key parity.
|
||||||
|
G = build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED)
|
||||||
|
communities = {int(k): v for k, v in analysis['communities'].items()}
|
||||||
|
cohesion = {int(k): v for k, v in analysis['cohesion'].items()}
|
||||||
|
tokens = {'input': extraction.get('input_tokens', 0), 'output': extraction.get('output_tokens', 0)}
|
||||||
|
|
||||||
|
# LABELS - replace these with the names you chose above
|
||||||
|
labels = LABELS_DICT
|
||||||
|
|
||||||
|
# Regenerate questions with real community labels (labels affect question phrasing)
|
||||||
|
questions = suggest_questions(G, communities, labels)
|
||||||
|
|
||||||
|
report = generate(G, communities, cohesion, labels, analysis['gods'], analysis['surprises'], detection, tokens, 'INPUT_PATH', suggested_questions=questions)
|
||||||
|
Path('graphify-out/GRAPH_REPORT.md').write_text(report, encoding=\"utf-8\")
|
||||||
|
Path('graphify-out/.graphify_labels.json').write_text(json.dumps({str(k): v for k, v in labels.items()}, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print('Report updated with community labels')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `LABELS_DICT` with the actual dict you constructed (e.g. `{0: "Attention Mechanism", 1: "Training Pipeline"}`).
|
||||||
|
Replace INPUT_PATH with the actual path.
|
||||||
|
|
||||||
|
### Step 6 - Generate Obsidian vault (opt-in) + HTML
|
||||||
|
|
||||||
|
**Generate HTML always** (unless `--no-viz`). **Obsidian vault only if `--obsidian` was explicitly given** — skip it otherwise, it generates one file per node.
|
||||||
|
|
||||||
|
If `--obsidian` was given:
|
||||||
|
|
||||||
|
- If `--obsidian-dir <path>` was also given, pass it via `--dir`. Otherwise defaults to `graphify-out/obsidian`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export obsidian
|
||||||
|
# or with custom dir: graphify export obsidian --dir ~/vaults/my-project
|
||||||
|
```
|
||||||
|
|
||||||
|
Generate the HTML graph (always, unless `--no-viz`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export html # auto-aggregates to community view if graph > 5000 nodes
|
||||||
|
# or: graphify export html --no-viz
|
||||||
|
```
|
||||||
|
|
||||||
|
### Steps 6b-8 - Wiki, Neo4j, FalkorDB, SVG, GraphML, MCP, benchmark (only on their flags)
|
||||||
|
|
||||||
|
These run only when their flag is present (`--wiki`, `--neo4j`/`--neo4j-push`, `--falkordb`/`--falkordb-push`, `--svg`, `--graphml`, `--mcp`) or, for the token-reduction benchmark, when `total_words` exceeds 5,000. A default run with no export flags skips all of them. See `references/exports.md` for each one. Run any `--wiki` export before Step 9 cleanup so `.graphify_labels.json` is still available.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Step 9 - Save manifest, update cost tracker, clean up, and report
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
from datetime import datetime, timezone
|
||||||
|
from graphify.detect import save_manifest
|
||||||
|
|
||||||
|
# Save manifest for --update
|
||||||
|
detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
|
||||||
|
# In --update mode, 'all_files' carries the full corpus; 'files' is the changed
|
||||||
|
# subset. Full-rebuild mode populates only 'files', so the fallback handles that.
|
||||||
|
# root= relativizes the manifest keys to the scan root (same base as the build),
|
||||||
|
# so the on-disk manifest is portable across clones/machines and a later --update
|
||||||
|
# matches cached files instead of missing every one (#1417).
|
||||||
|
save_manifest(detect.get('all_files') or detect['files'], root='INPUT_PATH')
|
||||||
|
|
||||||
|
# Update cumulative cost tracker
|
||||||
|
extract = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
|
||||||
|
input_tok = extract.get('input_tokens', 0)
|
||||||
|
output_tok = extract.get('output_tokens', 0)
|
||||||
|
|
||||||
|
cost_path = Path('graphify-out/cost.json')
|
||||||
|
if cost_path.exists():
|
||||||
|
cost = json.loads(cost_path.read_text(encoding=\"utf-8\"))
|
||||||
|
else:
|
||||||
|
cost = {'runs': [], 'total_input_tokens': 0, 'total_output_tokens': 0}
|
||||||
|
|
||||||
|
cost['runs'].append({
|
||||||
|
'date': datetime.now(timezone.utc).isoformat(),
|
||||||
|
'input_tokens': input_tok,
|
||||||
|
'output_tokens': output_tok,
|
||||||
|
'files': detect.get('total_files', 0),
|
||||||
|
})
|
||||||
|
cost['total_input_tokens'] += input_tok
|
||||||
|
cost['total_output_tokens'] += output_tok
|
||||||
|
cost_path.write_text(json.dumps(cost, indent=2, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
|
||||||
|
print(f'This run: {input_tok:,} input tokens, {output_tok:,} output tokens')
|
||||||
|
print(f'All time: {cost[\"total_input_tokens\"]:,} input, {cost[\"total_output_tokens\"]:,} output ({len(cost[\"runs\"])} runs)')
|
||||||
|
"
|
||||||
|
rm -f graphify-out/.graphify_detect.json graphify-out/.graphify_extract.json graphify-out/.graphify_ast.json graphify-out/.graphify_semantic.json graphify-out/.graphify_analysis.json
|
||||||
|
find graphify-out -maxdepth 1 -name '.graphify_chunk_*.json' -delete 2>/dev/null
|
||||||
|
rm -f graphify-out/.needs_update 2>/dev/null || true
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace INPUT_PATH with the actual path (same value used in Steps 4-5) so the manifest is relativized to the scan root.
|
||||||
|
|
||||||
|
Tell the user (omit the obsidian line unless --obsidian was given):
|
||||||
|
```
|
||||||
|
Graph complete. Outputs in PATH_TO_DIR/graphify-out/
|
||||||
|
|
||||||
|
graph.html - interactive graph, open in browser
|
||||||
|
GRAPH_REPORT.md - audit report
|
||||||
|
graph.json - raw graph data
|
||||||
|
obsidian/ - Obsidian vault (only if --obsidian was given)
|
||||||
|
```
|
||||||
|
|
||||||
|
If graphify saved you time, consider supporting it: https://github.com/sponsors/safishamsi
|
||||||
|
|
||||||
|
Replace PATH_TO_DIR with the actual absolute path of the directory that was processed.
|
||||||
|
|
||||||
|
Then paste these sections from GRAPH_REPORT.md directly into the chat:
|
||||||
|
- God Nodes
|
||||||
|
- Surprising Connections
|
||||||
|
- Suggested Questions
|
||||||
|
|
||||||
|
Do NOT paste the full report - just those three sections. Keep it concise.
|
||||||
|
|
||||||
|
Then immediately offer to explore. Pick the single most interesting suggested question from the report - the one that crosses the most community boundaries or has the most surprising bridge node - and ask:
|
||||||
|
|
||||||
|
> "The most interesting question this graph can answer: **[question]**. Want me to trace it?"
|
||||||
|
|
||||||
|
If the user says yes, run `/graphify query "[question]"` on the graph and walk them through the answer using the graph structure - which nodes connect, which community boundaries get crossed, what the path reveals. Keep going as long as they want to explore. Each answer should end with a natural follow-up ("this connects to X - want to go deeper?") so the session feels like navigation, not a one-shot report.
|
||||||
|
|
||||||
|
The graph is the map. Your job after the pipeline is to be the guide.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Interpreter guard for subcommands
|
||||||
|
|
||||||
|
Before running any subcommand below (`--update`, `--cluster-only`, `query`, `path`, `explain`, `add`), check that `.graphify_python` exists. If it's missing (e.g. user deleted `graphify-out/`), re-resolve the interpreter first:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ ! -f graphify-out/.graphify_python ]; then
|
||||||
|
GRAPHIFY_BIN=$(which graphify 2>/dev/null)
|
||||||
|
if [ -n "$GRAPHIFY_BIN" ]; then
|
||||||
|
PYTHON=$(head -1 "$GRAPHIFY_BIN" | tr -d '#!')
|
||||||
|
case "$PYTHON" in *[!a-zA-Z0-9/_.@-]*) PYTHON="python3" ;; esac
|
||||||
|
else
|
||||||
|
PYTHON="python3"
|
||||||
|
fi
|
||||||
|
mkdir -p graphify-out
|
||||||
|
"$PYTHON" -c "import sys; open('graphify-out/.graphify_python', 'w', encoding='utf-8').write(sys.executable)"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
## For --update and --cluster-only
|
||||||
|
|
||||||
|
Both are non-default subcommands. `--update` re-extracts only new or changed files; `--cluster-only` reruns clustering on the existing graph. See `references/update.md` for both flows.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For /graphify query
|
||||||
|
|
||||||
|
When `graphify-out/graph.json` already exists and the user asks a question about the corpus, answer from the graph rather than rebuilding it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify query "<question>"
|
||||||
|
```
|
||||||
|
|
||||||
|
Before traversal, expand the question against the graph's own vocabulary so a wording mismatch does not collapse the answer to noise. If the `graphify query` CLI is unavailable, fall back to an inline NetworkX traversal of `graphify-out/graph.json`. Answer using only what the graph output contains, and quote `source_location` when citing a specific fact. For that vocab-expansion step, the BFS/DFS traversal modes, the `--budget` cap, the NetworkX fallback, `save-result` feedback, and the `/graphify path` and `/graphify explain` flows, see `references/query.md`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For /graphify add and --watch
|
||||||
|
|
||||||
|
Neither is part of the default build. When the user runs `/graphify add <url>` to fetch a URL into the corpus, or passes `--watch` to auto-rebuild on file changes, see `references/add-watch.md`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For the commit hook and native CLAUDE.md integration
|
||||||
|
|
||||||
|
When the user asks to install the post-commit auto-rebuild hook or wire graphify into a project's CLAUDE.md, see `references/hooks.md`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Honesty Rules
|
||||||
|
|
||||||
|
- Never invent an edge. If unsure, use AMBIGUOUS.
|
||||||
|
- Never skip the corpus check warning.
|
||||||
|
- Always show token cost in the report.
|
||||||
|
- Never hide cohesion scores behind symbols - show the raw number.
|
||||||
|
- Never run HTML viz on a graph with more than 5,000 nodes without warning the user.
|
||||||
56
.codex/graphify/references/add-watch.md
Normal file
56
.codex/graphify/references/add-watch.md
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
# graphify reference: add a URL and watch a folder
|
||||||
|
|
||||||
|
Load this when the user ran `/graphify add <url>` or passed `--watch`. Neither is part of the default build.
|
||||||
|
|
||||||
|
## For /graphify add
|
||||||
|
|
||||||
|
Fetch a URL and add it to the corpus, then update the graph.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys
|
||||||
|
from graphify.ingest import ingest
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
try:
|
||||||
|
out = ingest('URL', Path('./raw'), author='AUTHOR', contributor='CONTRIBUTOR')
|
||||||
|
print(f'Saved to {out}')
|
||||||
|
except ValueError as e:
|
||||||
|
print(f'error: {e}', file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
except RuntimeError as e:
|
||||||
|
print(f'error: {e}', file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `URL` with the actual URL, `AUTHOR` with the user's name if provided, `CONTRIBUTOR` likewise. If the command exits with an error, tell the user what went wrong - do not silently continue. After a successful save, automatically run the `--update` pipeline on `./raw` to merge the new file into the existing graph.
|
||||||
|
|
||||||
|
Supported URL types (auto-detected):
|
||||||
|
- YouTube / any video URL → audio downloaded via yt-dlp, transcribed to `.txt` on next run (requires `pip install 'graphifyy[video]'`)
|
||||||
|
- Twitter/X → fetched via oEmbed, saved as `.md` with tweet text and author
|
||||||
|
- arXiv → abstract + metadata saved as `.md`
|
||||||
|
- PDF → downloaded as `.pdf`
|
||||||
|
- Images (.png/.jpg/.webp) → downloaded, Claude vision extracts on next run
|
||||||
|
- Any webpage → converted to markdown via html2text
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For --watch
|
||||||
|
|
||||||
|
Start a background watcher that monitors a folder and auto-updates the graph when files change.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -m graphify.watch INPUT_PATH --debounce 3
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace INPUT_PATH with the folder to watch. Behavior depends on what changed:
|
||||||
|
|
||||||
|
- **Code files only (.py, .ts, .go, etc.):** re-runs AST extraction + rebuild + cluster immediately, no LLM needed. `graph.json` and `GRAPH_REPORT.md` are updated automatically.
|
||||||
|
- **Docs, papers, or images:** writes a `graphify-out/needs_update` flag and prints a notification to run `/graphify --update` (LLM semantic re-extraction required).
|
||||||
|
|
||||||
|
Debounce (default 3s): waits until file activity stops before triggering, so a wave of parallel agent writes doesn't trigger a rebuild per file.
|
||||||
|
|
||||||
|
Press Ctrl+C to stop.
|
||||||
|
|
||||||
|
For agentic workflows: run `--watch` in a background terminal. Code changes from agent waves are picked up automatically between waves. If agents are also writing docs or notes, you'll need a manual `/graphify --update` after those waves.
|
||||||
87
.codex/graphify/references/exports.md
Normal file
87
.codex/graphify/references/exports.md
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
# graphify reference: extra exports and benchmark
|
||||||
|
|
||||||
|
Load this when the user passed one of the export flags (`--wiki`, `--neo4j`, `--neo4j-push`, `--falkordb`, `--falkordb-push`, `--svg`, `--graphml`, `--mcp`), or when the corpus is large enough for the token-reduction benchmark. Each step runs only for its own flag.
|
||||||
|
|
||||||
|
### Step 6b - Wiki (only if --wiki flag)
|
||||||
|
|
||||||
|
**Only run this step if `--wiki` was explicitly given in the original command.**
|
||||||
|
|
||||||
|
Run this before Step 9 (cleanup) so `.graphify_labels.json` is still available.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export wiki
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 7 - Neo4j export (only if --neo4j or --neo4j-push flag)
|
||||||
|
|
||||||
|
**If `--neo4j`** - generate a Cypher file for manual import:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export neo4j
|
||||||
|
```
|
||||||
|
|
||||||
|
**If `--neo4j-push <uri>`** - push directly to a running Neo4j instance. Ask the user for credentials if not provided:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export neo4j --push bolt://localhost:7687 --user neo4j --password PASSWORD
|
||||||
|
```
|
||||||
|
|
||||||
|
Default URI is `bolt://localhost:7687`, default user is `neo4j`. Uses MERGE - safe to re-run without creating duplicates.
|
||||||
|
|
||||||
|
### Step 7a - FalkorDB export (only if --falkordb or --falkordb-push flag)
|
||||||
|
|
||||||
|
**If `--falkordb`** - generate a Cypher file. The statements are OpenCypher, but FalkorDB's `GRAPH.QUERY` runs one statement at a time (no bulk script import like Neo4j's `cypher-shell`), so prefer `--falkordb-push` to load a graph. Use this only when you want the portable `cypher.txt` artifact:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export falkordb
|
||||||
|
```
|
||||||
|
|
||||||
|
**If `--falkordb-push <uri>`** - push directly to a running FalkorDB instance. Credentials are optional; ask the user only if the instance requires auth:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export falkordb --push falkordb://localhost:6379
|
||||||
|
```
|
||||||
|
|
||||||
|
Default URI is `falkordb://localhost:6379` (the scheme is informational - `redis://` or a bare `host:port` work too), auth is optional, and the target graph defaults to `graphify`. Uses MERGE - safe to re-run without creating duplicates.
|
||||||
|
|
||||||
|
### Step 7b - SVG export (only if --svg flag)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export svg
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 7c - GraphML export (only if --graphml flag)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify export graphml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 7d - MCP server (only if --mcp flag)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -m graphify.serve graphify-out/graph.json
|
||||||
|
```
|
||||||
|
|
||||||
|
This starts a stdio MCP server that exposes tools: `query_graph`, `get_node`, `get_neighbors`, `get_community`, `god_nodes`, `graph_stats`, `shortest_path`. Add to Claude Desktop or any MCP-compatible agent orchestrator so other agents can query the graph live.
|
||||||
|
|
||||||
|
To configure in Claude Desktop, add to `claude_desktop_config.json`. Claude Desktop can't run `$(...)`, and under `uv tool install` the system `python3` can't import graphify — so set `command` to the **absolute interpreter path** printed by `cat graphify-out/.graphify_python`:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"graphify": {
|
||||||
|
"command": "<absolute path from: cat graphify-out/.graphify_python>",
|
||||||
|
"args": ["-m", "graphify.serve", "/absolute/path/to/graphify-out/graph.json"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 8 - Token reduction benchmark (only if total_words > 5000)
|
||||||
|
|
||||||
|
If `total_words` from `graphify-out/.graphify_detect.json` is greater than 5,000, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify benchmark
|
||||||
|
```
|
||||||
|
|
||||||
|
Print the output directly in chat. If `total_words <= 5000`, skip silently - the graph value is structural clarity, not token compression, for small corpora.
|
||||||
31
.codex/graphify/references/extraction-spec.md
Normal file
31
.codex/graphify/references/extraction-spec.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# graphify reference: extraction subagent prompt (compact)
|
||||||
|
|
||||||
|
Load this in Step 3 Part B when the corpus has at least one doc, paper, or image chunk. A pure-code corpus skips Part B and never reads this file. Each semantic subagent receives the prompt below verbatim (substitute FILE_LIST, CHUNK_NUM, TOTAL_CHUNKS, and DEEP_MODE).
|
||||||
|
|
||||||
|
```
|
||||||
|
You are a graphify extraction subagent. Read the files listed and extract a knowledge graph fragment.
|
||||||
|
Output ONLY valid JSON matching the schema below - no explanation, no markdown fences, no preamble.
|
||||||
|
|
||||||
|
Files (chunk CHUNK_NUM of TOTAL_CHUNKS):
|
||||||
|
FILE_LIST
|
||||||
|
|
||||||
|
Rules:
|
||||||
|
- EXTRACTED: relationship explicit in source (import, call, citation)
|
||||||
|
- INFERRED: reasonable inference (shared structure, implied dependency)
|
||||||
|
- AMBIGUOUS: uncertain — flag it, do not omit
|
||||||
|
- Code files: semantic edges AST cannot find. Do not re-extract imports. When adding `calls` edges: source is the caller, target is the callee, never reversed; keep `calls` within one language.
|
||||||
|
- Doc/paper files: named concepts, entities, citations. Store rationale (WHY decisions were made) as a `rationale` attribute on the relevant node, not as a separate node. Use `file_type:"rationale"` for concept-like nodes (ideas, principles, mechanisms) and `file_type:"concept"` for named concepts. `file_type` MUST be one of exactly these six values: `code`, `document`, `paper`, `image`, `rationale`, `concept`. Any other value is invalid and will be rejected.
|
||||||
|
- Image files: use vision — understand what the image IS, not just OCR
|
||||||
|
- DEEP_MODE (if --mode deep): be aggressive with INFERRED edges — indirect deps, shared assumptions, latent couplings. Mark uncertain ones AMBIGUOUS instead of omitting.
|
||||||
|
- Semantic similarity: if two concepts solve the same problem or represent the same idea without a structural link (no import, call, or citation), add a `semantically_similar_to` edge marked INFERRED with confidence_score 0.6-0.95. Non-obvious cross-file links only.
|
||||||
|
- Hyperedges: if 3+ nodes share a concept, flow, or pattern not captured by pairwise edges, add a hyperedge to a top-level `hyperedges` array. Use sparingly. Max 3 per chunk.
|
||||||
|
- If a file has YAML frontmatter (--- ... ---), copy source_url, captured_at, author, contributor onto every node from that file.
|
||||||
|
- confidence_score is REQUIRED on every edge — never omit it, never use 0.5 as a default. EXTRACTED = 1.0 always. INFERRED: pick exactly ONE of 0.95 (direct structural evidence), 0.85 (strong inference), 0.75 (reasonable inference), 0.65 (weak inference), 0.55 (speculative but plausible) — never 0.5; if none fit, mark the edge AMBIGUOUS. AMBIGUOUS = 0.1-0.3.
|
||||||
|
|
||||||
|
Node ID format: lowercase, only `[a-z0-9_]`, no dots or slashes. Format `{stem}_{entity}` where stem is the full repo-relative path with the extension dropped, every segment joined with `_` (each lowercased with non-alphanumeric chars replaced by `_`) and entity is the symbol name similarly normalized. Use every directory level, not just the immediate parent. `src/auth/session.py` + `ValidateToken` → `src_auth_session_validatetoken`. Top-level files use just the filename stem. This must match the AST extractor's ID. Never append chunk or sequence suffixes — IDs must be deterministic from the label alone.
|
||||||
|
|
||||||
|
Output exactly this JSON (no other text):
|
||||||
|
{"nodes":[{"id":"auth_session_validatetoken","label":"Human Readable Name","file_type":"code|document|paper|image|rationale|concept","source_file":"<FILE_LIST path verbatim>","source_location":null,"source_url":null,"captured_at":null,"author":null,"contributor":null}],"edges":[{"source":"node_id","target":"node_id","relation":"calls|implements|references|cites|conceptually_related_to|shares_data_with|semantically_similar_to|rationale_for","confidence":"EXTRACTED|INFERRED|AMBIGUOUS","confidence_score":1.0,"source_file":"<FILE_LIST path verbatim>","source_location":null,"weight":1.0}],"hyperedges":[{"id":"snake_case_id","label":"Human Readable Label","nodes":["node_id1","node_id2","node_id3"],"relation":"participate_in|implement|form","confidence":"EXTRACTED|INFERRED","confidence_score":0.75,"source_file":"<FILE_LIST path verbatim>"}],"input_tokens":0,"output_tokens":0}
|
||||||
|
|
||||||
|
source_file RULE: set source_file to the FILE_LIST path for that file VERBATIM (absolute, no shortening to basename, no re-relativizing, no separator change). Keeps full build and --update on one base so build_merge's replace matches instead of duplicating.
|
||||||
|
```
|
||||||
46
.codex/graphify/references/github-and-merge.md
Normal file
46
.codex/graphify/references/github-and-merge.md
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# graphify reference: GitHub clone and cross-repo merge
|
||||||
|
|
||||||
|
Load this when the user passed one or more `https://github.com/...` URLs, or named several local subfolders to merge into one graph.
|
||||||
|
|
||||||
|
### Step 0 - Clone GitHub repo(s) (only if a GitHub URL was given)
|
||||||
|
|
||||||
|
**Single repo:**
|
||||||
|
```bash
|
||||||
|
LOCAL_PATH=$(graphify clone <github-url> [--branch <branch>])
|
||||||
|
# Use LOCAL_PATH as the target for all subsequent steps
|
||||||
|
```
|
||||||
|
|
||||||
|
**Multiple repos (cross-repo graph):**
|
||||||
|
```bash
|
||||||
|
# Clone each repo, run the full pipeline on each, then merge
|
||||||
|
graphify clone <url1> # → ~/.graphify/repos/<owner1>/<repo1>
|
||||||
|
graphify clone <url2> # → ~/.graphify/repos/<owner2>/<repo2>
|
||||||
|
# Run /graphify on each local path to produce their graph.json files
|
||||||
|
# Then merge:
|
||||||
|
graphify merge-graphs \
|
||||||
|
~/.graphify/repos/<owner1>/<repo1>/graphify-out/graph.json \
|
||||||
|
~/.graphify/repos/<owner2>/<repo2>/graphify-out/graph.json \
|
||||||
|
--out graphify-out/cross-repo-graph.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Graphify clones into `~/.graphify/repos/<owner>/<repo>` and reuses existing clones on repeat runs. Each node in the merged graph carries a `repo` attribute so you can filter by origin.
|
||||||
|
|
||||||
|
**Multiple local subfolders (monorepo or multi-service layout):**
|
||||||
|
|
||||||
|
The skill pipeline writes all intermediate and final outputs to `graphify-out/` in the current working directory. Running the skill on each subfolder separately will clobber the same output dir. Instead, use the CLI directly for each subfolder — it places `graphify-out/` *inside* the scanned path:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify extract ./core/ # → ./core/graphify-out/graph.json
|
||||||
|
graphify extract ./service/ # → ./service/graphify-out/graph.json
|
||||||
|
graphify extract ./platform/ # → ./platform/graphify-out/graph.json
|
||||||
|
# Add --backend gemini|kimi|openai|deepseek|claude-cli depending on which API key you have set
|
||||||
|
|
||||||
|
# Then merge at the project root:
|
||||||
|
graphify merge-graphs \
|
||||||
|
./core/graphify-out/graph.json \
|
||||||
|
./service/graphify-out/graph.json \
|
||||||
|
./platform/graphify-out/graph.json \
|
||||||
|
--out graphify-out/graph.json
|
||||||
|
```
|
||||||
|
|
||||||
|
Once `graphify-out/graph.json` exists, the fast path above takes over: any codebase question runs `graphify query` directly on the merged graph — no re-extraction, no size gate.
|
||||||
33
.codex/graphify/references/hooks.md
Normal file
33
.codex/graphify/references/hooks.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# graphify reference: commit hook and native CLAUDE.md integration
|
||||||
|
|
||||||
|
Load this when the user asked to install the post-commit hook or wire graphify into a project's CLAUDE.md.
|
||||||
|
|
||||||
|
## For git commit hook
|
||||||
|
|
||||||
|
Install a post-commit hook that auto-rebuilds the graph after every commit. No background process needed - triggers once per commit, works with any editor.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify hook install # install
|
||||||
|
graphify hook uninstall # remove
|
||||||
|
graphify hook status # check
|
||||||
|
```
|
||||||
|
|
||||||
|
After every `git commit`, the hook detects which code files changed (via `git diff HEAD~1`), re-runs AST extraction on those files, and rebuilds `graph.json` and `GRAPH_REPORT.md`. Doc/image changes are ignored by the hook - run `/graphify --update` manually for those.
|
||||||
|
|
||||||
|
If a post-commit hook already exists, graphify appends to it rather than replacing it.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For native CLAUDE.md integration
|
||||||
|
|
||||||
|
Run once per project to make graphify always-on in Claude Code sessions:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify claude install
|
||||||
|
```
|
||||||
|
|
||||||
|
This writes a `## graphify` section to the local `CLAUDE.md` that instructs Claude to check the graph before answering codebase questions and rebuild it after code changes. No manual `/graphify` needed in future sessions.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify claude uninstall # remove the section
|
||||||
|
```
|
||||||
311
.codex/graphify/references/query.md
Normal file
311
.codex/graphify/references/query.md
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
# graphify reference: query, path, explain
|
||||||
|
|
||||||
|
Load this when the user asks a question against an existing graph, or runs `/graphify path` or `/graphify explain`. The core's query stub points here for the full traversal flow. These flows use the `graphify query` CLI when it is available and fall back to an inline NetworkX traversal otherwise.
|
||||||
|
|
||||||
|
Two traversal modes - choose based on the question:
|
||||||
|
|
||||||
|
| Mode | Flag | Best for |
|
||||||
|
|------|------|----------|
|
||||||
|
| BFS (default) | _(none)_ | "What is X connected to?" - broad context, nearest neighbors first |
|
||||||
|
| DFS | `--dfs` | "How does X reach Y?" - trace a specific chain or dependency path |
|
||||||
|
|
||||||
|
First check the graph exists:
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
from pathlib import Path
|
||||||
|
if not Path('graphify-out/graph.json').exists():
|
||||||
|
print('ERROR: No graph found. Run /graphify <path> first to build the graph.')
|
||||||
|
raise SystemExit(1)
|
||||||
|
"
|
||||||
|
```
|
||||||
|
If it fails, stop and tell the user to run `/graphify <path>` first.
|
||||||
|
|
||||||
|
### Step 0 — Constrained query expansion (REQUIRED before traversal)
|
||||||
|
|
||||||
|
graphify's `query` CLI matches nodes via case-folded substring + IDF — there is **no stemming, no synonyms, no cross-language match** inside the binary, and the inline fallback below matches the same way. If the user's question uses different language or different domain vocabulary than the graph's labels (user says "обработчик" / graph says "handler"; user says "authentication" / graph says "Guardian"), the literal matcher returns 0 hits and the answer collapses to noise.
|
||||||
|
|
||||||
|
Fix this **without inventing tokens** by expanding the query against the actual graph vocabulary first:
|
||||||
|
|
||||||
|
1. Extract the token vocabulary from node labels:
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json, re
|
||||||
|
from pathlib import Path
|
||||||
|
data = json.loads(Path('graphify-out/graph.json').read_text())
|
||||||
|
vocab = set()
|
||||||
|
for n in data['nodes']:
|
||||||
|
for c in re.findall(r'[^\W\d_]+', n.get('label','') or '', re.UNICODE):
|
||||||
|
parts = re.findall(r'[A-Z]+(?=[A-Z][a-z])|[A-Z]?[a-z]+|[A-Z]+', c) or [c]
|
||||||
|
for p in parts:
|
||||||
|
t = p.lower()
|
||||||
|
if 3 <= len(t) <= 30:
|
||||||
|
vocab.add(t)
|
||||||
|
Path('graphify-out/.vocab.txt').write_text('\n'.join(sorted(vocab)))
|
||||||
|
print(f'vocab: {len(vocab)} tokens')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Read `graphify-out/.vocab.txt`. Then for the user's question, select **up to 12 tokens from this exact list** that semantically match the query intent. Hard constraints:
|
||||||
|
- You MUST pick only tokens present in the vocabulary file. Do NOT invent tokens.
|
||||||
|
- If a query concept has no plausible token in the vocab, skip it — do not substitute a near-synonym from training memory.
|
||||||
|
- If **no** vocab tokens match the query at all, output an empty list and tell the user the corpus has no relevant vocabulary for this question. Do not fabricate a search.
|
||||||
|
- Translate cross-language: Russian "аутентификация" → look for `auth`, `credential`, `token`, `security` IFF present in vocab.
|
||||||
|
- Morphology: "handlers" maps to `handler` IFF present; "todos" maps to `todo` IFF present.
|
||||||
|
|
||||||
|
3. Print the selection explicitly to the user before running the query, so the expansion is auditable:
|
||||||
|
```
|
||||||
|
Query expanded to (from graph vocab, N tokens): [token1, token2, ...]
|
||||||
|
```
|
||||||
|
If the list is empty, say so plainly and stop — do not proceed to traversal.
|
||||||
|
|
||||||
|
### Step 1 — Traversal
|
||||||
|
|
||||||
|
Build the **expanded query string** by joining the selected tokens with spaces. Use this string as `QUESTION` below — NOT the original user question. (The original question is preserved only for `save-result` at the end.)
|
||||||
|
|
||||||
|
Prefer the CLI when it is installed:
|
||||||
|
```bash
|
||||||
|
graphify query "QUESTION"
|
||||||
|
# or: graphify query "QUESTION" --dfs --budget 3000
|
||||||
|
```
|
||||||
|
|
||||||
|
If the CLI is unavailable, load `graphify-out/graph.json` and run the traversal inline:
|
||||||
|
|
||||||
|
1. Find the 1-3 nodes whose label best matches the expanded tokens.
|
||||||
|
2. Run the appropriate traversal from each starting node.
|
||||||
|
3. Read the subgraph - node labels, edge relations, confidence tags, source locations.
|
||||||
|
4. Answer using **only** what the graph contains. Quote `source_location` when citing a specific fact.
|
||||||
|
5. If the graph lacks enough information, say so - do not hallucinate edges.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys, json
|
||||||
|
from networkx.readwrite import json_graph
|
||||||
|
import networkx as nx
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
data = json.loads(Path('graphify-out/graph.json').read_text())
|
||||||
|
G = json_graph.node_link_graph(data, edges='links')
|
||||||
|
|
||||||
|
question = 'QUESTION'
|
||||||
|
mode = 'MODE' # 'bfs' or 'dfs'
|
||||||
|
terms = [t.lower() for t in question.split() if len(t) >= 3] # match the vocab threshold; keeps api/jwt/ios (#1392)
|
||||||
|
|
||||||
|
# Find best-matching start nodes
|
||||||
|
scored = []
|
||||||
|
for nid, ndata in G.nodes(data=True):
|
||||||
|
label = ndata.get('label', '').lower()
|
||||||
|
score = sum(1 for t in terms if t in label)
|
||||||
|
if score > 0:
|
||||||
|
scored.append((score, nid))
|
||||||
|
scored.sort(reverse=True)
|
||||||
|
start_nodes = [nid for _, nid in scored[:3]]
|
||||||
|
|
||||||
|
if not start_nodes:
|
||||||
|
print('No matching nodes found for query terms:', terms)
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
subgraph_nodes = set()
|
||||||
|
subgraph_edges = []
|
||||||
|
|
||||||
|
if mode == 'dfs':
|
||||||
|
# DFS: follow one path as deep as possible before backtracking.
|
||||||
|
# Depth-limited to 6 to avoid traversing the whole graph.
|
||||||
|
visited = set()
|
||||||
|
stack = [(n, 0) for n in reversed(start_nodes)]
|
||||||
|
while stack:
|
||||||
|
node, depth = stack.pop()
|
||||||
|
if node in visited or depth > 6:
|
||||||
|
continue
|
||||||
|
visited.add(node)
|
||||||
|
subgraph_nodes.add(node)
|
||||||
|
for neighbor in G.neighbors(node):
|
||||||
|
if neighbor not in visited:
|
||||||
|
stack.append((neighbor, depth + 1))
|
||||||
|
subgraph_edges.append((node, neighbor))
|
||||||
|
else:
|
||||||
|
# BFS: explore all neighbors layer by layer up to depth 3.
|
||||||
|
frontier = set(start_nodes)
|
||||||
|
subgraph_nodes = set(start_nodes)
|
||||||
|
for _ in range(3):
|
||||||
|
next_frontier = set()
|
||||||
|
for n in frontier:
|
||||||
|
for neighbor in G.neighbors(n):
|
||||||
|
if neighbor not in subgraph_nodes:
|
||||||
|
next_frontier.add(neighbor)
|
||||||
|
subgraph_edges.append((n, neighbor))
|
||||||
|
subgraph_nodes.update(next_frontier)
|
||||||
|
frontier = next_frontier
|
||||||
|
|
||||||
|
# Token-budget aware output: rank by relevance, cut at budget (~4 chars/token)
|
||||||
|
token_budget = BUDGET # default 2000
|
||||||
|
char_budget = token_budget * 4
|
||||||
|
|
||||||
|
# Score each node by term overlap for ranked output
|
||||||
|
def relevance(nid):
|
||||||
|
label = G.nodes[nid].get('label', '').lower()
|
||||||
|
return sum(1 for t in terms if t in label)
|
||||||
|
|
||||||
|
ranked_nodes = sorted(subgraph_nodes, key=relevance, reverse=True)
|
||||||
|
|
||||||
|
lines = [f'Traversal: {mode.upper()} | Start: {[G.nodes[n].get(\"label\",n) for n in start_nodes]} | {len(subgraph_nodes)} nodes']
|
||||||
|
for nid in ranked_nodes:
|
||||||
|
d = G.nodes[nid]
|
||||||
|
lines.append(f' NODE {d.get(\"label\", nid)} [src={d.get(\"source_file\",\"\")} loc={d.get(\"source_location\",\"\")}]')
|
||||||
|
for u, v in subgraph_edges:
|
||||||
|
if u in subgraph_nodes and v in subgraph_nodes:
|
||||||
|
_raw = G[u][v]; d = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw
|
||||||
|
lines.append(f' EDGE {G.nodes[u].get(\"label\",u)} --{d.get(\"relation\",\"\")} [{d.get(\"confidence\",\"\")}]--> {G.nodes[v].get(\"label\",v)}')
|
||||||
|
|
||||||
|
output = '\n'.join(lines)
|
||||||
|
if len(output) > char_budget:
|
||||||
|
output = output[:char_budget] + f'\n... (truncated at ~{token_budget} token budget - use --budget N for more)'
|
||||||
|
print(output)
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `QUESTION` with the **expanded** query string, `MODE` with `bfs` or `dfs`, and `BUDGET` with the token budget (default `2000`, or whatever `--budget N` specifies). Then answer based on the subgraph output above, using only what the graph contains.
|
||||||
|
|
||||||
|
After writing the answer, save it back into the graph so it improves future queries. Include the expanded tokens inside the `--answer` text (e.g. `"Expanded from original query via vocab: [tokens]. Then traversed..."`) so the next `--update` extracts the expansion history as a graph node:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -m graphify save-result --question "ORIGINAL_QUESTION" --answer "ANSWER" --type query --nodes NODE1 NODE2
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `ORIGINAL_QUESTION` with the user's verbatim question, `ANSWER` with your full answer text (containing the expanded-token trace), `NODE1 NODE2` with the list of node labels you cited. This closes the feedback loop: the next `--update` will extract this Q&A as a node in the graph.
|
||||||
|
|
||||||
|
**Work memory (self-improving loop).** Add an `--outcome` so future sessions learn from this one — append `--outcome useful|dead_end|corrected` to the `save-result` command (and `--correction "the right answer"` when correcting):
|
||||||
|
|
||||||
|
- `useful` — the cited nodes answered the question well (they become *preferred sources*).
|
||||||
|
- `dead_end` — the question/path led nowhere; don't re-derive it next time.
|
||||||
|
- `corrected` — the saved answer was wrong; `--correction` records what was right.
|
||||||
|
|
||||||
|
At the **start** of graph work, refresh and read the lessons: run `graphify reflect --if-stale` (cheap, deterministic, no LLM; `--if-stale` makes it a no-op when `LESSONS.md` is already newer than every input, e.g. when the git hook just refreshed it), then read `graphify-out/reflections/LESSONS.md`. It lists **preferred sources** (start there), **known dead ends** (skip them), and prior **corrections**. Running `reflect` yourself keeps the lessons current even without the git hook installed; if the post-commit hook *is* installed, `--if-stale` means your session-start run costs almost nothing.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For /graphify path
|
||||||
|
|
||||||
|
Find the shortest path between two named concepts in the graph. Prefer the CLI when installed:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify path "NODE_A" "NODE_B"
|
||||||
|
```
|
||||||
|
|
||||||
|
If the CLI is unavailable, run it inline:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json, sys
|
||||||
|
import networkx as nx
|
||||||
|
from networkx.readwrite import json_graph
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
data = json.loads(Path('graphify-out/graph.json').read_text())
|
||||||
|
G = json_graph.node_link_graph(data, edges='links')
|
||||||
|
|
||||||
|
a_term = 'NODE_A'
|
||||||
|
b_term = 'NODE_B'
|
||||||
|
|
||||||
|
def find_node(term):
|
||||||
|
term = term.lower()
|
||||||
|
scored = sorted(
|
||||||
|
[(sum(1 for w in term.split() if w in G.nodes[n].get('label','').lower()), n)
|
||||||
|
for n in G.nodes()],
|
||||||
|
reverse=True
|
||||||
|
)
|
||||||
|
return scored[0][1] if scored and scored[0][0] > 0 else None
|
||||||
|
|
||||||
|
src = find_node(a_term)
|
||||||
|
tgt = find_node(b_term)
|
||||||
|
|
||||||
|
if not src or not tgt:
|
||||||
|
print(f'Could not find nodes matching: {a_term!r} or {b_term!r}')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
try:
|
||||||
|
path = nx.shortest_path(G, src, tgt)
|
||||||
|
print(f'Shortest path ({len(path)-1} hops):')
|
||||||
|
for i, nid in enumerate(path):
|
||||||
|
label = G.nodes[nid].get('label', nid)
|
||||||
|
if i < len(path) - 1:
|
||||||
|
_raw = G[nid][path[i+1]]; edge = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw
|
||||||
|
rel = edge.get('relation', '')
|
||||||
|
conf = edge.get('confidence', '')
|
||||||
|
print(f' {label} --{rel}--> [{conf}]')
|
||||||
|
else:
|
||||||
|
print(f' {label}')
|
||||||
|
except nx.NetworkXNoPath:
|
||||||
|
print(f'No path found between {a_term!r} and {b_term!r}')
|
||||||
|
except nx.NodeNotFound as e:
|
||||||
|
print(f'Node not found: {e}')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `NODE_A` and `NODE_B` with the actual concept names from the user. Then explain the path in plain language - what each hop means, why it's significant.
|
||||||
|
|
||||||
|
After writing the explanation, save it back:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -m graphify save-result --question "Path from NODE_A to NODE_B" --answer "ANSWER" --type path_query --nodes NODE_A NODE_B
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For /graphify explain
|
||||||
|
|
||||||
|
Give a plain-language explanation of a single node - everything connected to it. Prefer the CLI when installed:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify explain "NODE_NAME"
|
||||||
|
```
|
||||||
|
|
||||||
|
If the CLI is unavailable, run it inline:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json, sys
|
||||||
|
import networkx as nx
|
||||||
|
from networkx.readwrite import json_graph
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
data = json.loads(Path('graphify-out/graph.json').read_text())
|
||||||
|
G = json_graph.node_link_graph(data, edges='links')
|
||||||
|
|
||||||
|
term = 'NODE_NAME'
|
||||||
|
term_lower = term.lower()
|
||||||
|
|
||||||
|
# Find best matching node
|
||||||
|
scored = sorted(
|
||||||
|
[(sum(1 for w in term_lower.split() if w in G.nodes[n].get('label','').lower()), n)
|
||||||
|
for n in G.nodes()],
|
||||||
|
reverse=True
|
||||||
|
)
|
||||||
|
if not scored or scored[0][0] == 0:
|
||||||
|
print(f'No node matching {term!r}')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
nid = scored[0][1]
|
||||||
|
data_n = G.nodes[nid]
|
||||||
|
print(f'NODE: {data_n.get(\"label\", nid)}')
|
||||||
|
print(f' source: {data_n.get(\"source_file\",\"unknown\")}')
|
||||||
|
print(f' type: {data_n.get(\"file_type\",\"unknown\")}')
|
||||||
|
print(f' degree: {G.degree(nid)}')
|
||||||
|
print()
|
||||||
|
print('CONNECTIONS:')
|
||||||
|
for neighbor in G.neighbors(nid):
|
||||||
|
_raw = G[nid][neighbor]; edge = next(iter(_raw.values()), {}) if isinstance(G, nx.MultiGraph) else _raw
|
||||||
|
nlabel = G.nodes[neighbor].get('label', neighbor)
|
||||||
|
rel = edge.get('relation', '')
|
||||||
|
conf = edge.get('confidence', '')
|
||||||
|
src_file = G.nodes[neighbor].get('source_file', '')
|
||||||
|
print(f' --{rel}--> {nlabel} [{conf}] ({src_file})')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace `NODE_NAME` with the concept the user asked about. Then write a 3-5 sentence explanation of what this node is, what it connects to, and why those connections are significant. Use the source locations as citations.
|
||||||
|
|
||||||
|
After writing the explanation, save it back:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -m graphify save-result --question "Explain NODE_NAME" --answer "ANSWER" --type explain --nodes NODE_NAME
|
||||||
|
```
|
||||||
52
.codex/graphify/references/transcribe.md
Normal file
52
.codex/graphify/references/transcribe.md
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
# graphify reference: transcribe video and audio
|
||||||
|
|
||||||
|
Load this only when `detect` reported one or more `video` files. A corpus with no video never reads this.
|
||||||
|
|
||||||
|
### Step 2.5 - Transcribe video / audio files (only if video files detected)
|
||||||
|
|
||||||
|
Skip this step entirely if `detect` returned zero `video` files.
|
||||||
|
|
||||||
|
Video and audio files cannot be read directly. Transcribe them to text first, then treat the transcripts as doc files in Step 3.
|
||||||
|
|
||||||
|
**Strategy:** Read the god nodes from `graphify-out/.graphify_detect.json` (or the analysis file if it exists from a previous run). You are already a language model — write a one-sentence domain hint yourself from those labels. Then pass it to Whisper as the initial prompt. No separate API call needed.
|
||||||
|
|
||||||
|
**However**, if the corpus has *only* video files and no other docs/code, use the generic fallback prompt: `"Use proper punctuation and paragraph breaks."`
|
||||||
|
|
||||||
|
**Step 1 - Write the Whisper prompt yourself.**
|
||||||
|
|
||||||
|
Read the top god node labels from detect output or analysis, then compose a short domain hint sentence, for example:
|
||||||
|
|
||||||
|
- Labels: `transformer, attention, encoder, decoder` → `"Machine learning research on transformer architectures and attention mechanisms. Use proper punctuation and paragraph breaks."`
|
||||||
|
- Labels: `kubernetes, deployment, pod, helm` → `"DevOps discussion about Kubernetes deployments and Helm charts. Use proper punctuation and paragraph breaks."`
|
||||||
|
|
||||||
|
**Export** it as `GRAPHIFY_WHISPER_PROMPT` (the exact name the transcriber reads — and it must be `export`ed so the child Python process sees it) for the next command.
|
||||||
|
|
||||||
|
**Step 2 - Transcribe:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
export GRAPHIFY_WHISPER_MODEL=base # or whatever --whisper-model the user passed (must be exported)
|
||||||
|
export GRAPHIFY_WHISPER_PROMPT="<the one-sentence domain hint you composed in Step 1>"
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json, os, sys
|
||||||
|
from pathlib import Path
|
||||||
|
from graphify.transcribe import transcribe_all
|
||||||
|
|
||||||
|
detect = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
|
||||||
|
video_files = detect.get('files', {}).get('video', [])
|
||||||
|
prompt = os.environ.get('GRAPHIFY_WHISPER_PROMPT', 'Use proper punctuation and paragraph breaks.')
|
||||||
|
|
||||||
|
transcript_paths = transcribe_all(video_files, initial_prompt=prompt)
|
||||||
|
# Write the JSON from Python (NOT a shell '>' redirect): transcribe_all/Whisper
|
||||||
|
# print progress to stdout, which would otherwise corrupt the JSON file (#1392).
|
||||||
|
Path('graphify-out/.graphify_transcripts.json').write_text(json.dumps(transcript_paths, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print(f'Transcribed {len(transcript_paths)} file(s)', file=sys.stderr)
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
After transcription:
|
||||||
|
- Read the transcript paths from `graphify-out/.graphify_transcripts.json`
|
||||||
|
- Add them to the docs list before dispatching semantic subagents in Step 3B
|
||||||
|
- Print how many transcripts were created: `Transcribed N video file(s) -> treating as docs`
|
||||||
|
- If transcription fails for a file, print a warning and continue with the rest
|
||||||
|
|
||||||
|
**Whisper model:** Default is `base`. If the user passed `--whisper-model <name>`, `export GRAPHIFY_WHISPER_MODEL=<name>` (it must be exported, not just assigned) before running the command above.
|
||||||
192
.codex/graphify/references/update.md
Normal file
192
.codex/graphify/references/update.md
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
# graphify reference: incremental update and cluster-only
|
||||||
|
|
||||||
|
Load this only when the user passed `--update` or `--cluster-only`. A first-time full build never reads this file.
|
||||||
|
|
||||||
|
## For --update (incremental re-extraction)
|
||||||
|
|
||||||
|
Use when you've added or modified files since the last run. Only re-extracts changed files - saves tokens and time.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import sys, json
|
||||||
|
from graphify.detect import detect_incremental, save_manifest
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
result = detect_incremental(Path('INPUT_PATH'))
|
||||||
|
new_total = result.get('new_total', 0)
|
||||||
|
print(json.dumps(result, indent=2, ensure_ascii=False))
|
||||||
|
Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
deleted = list(result.get('deleted_files', []))
|
||||||
|
if new_total == 0 and not deleted:
|
||||||
|
print('No files changed since last run. Nothing to update.')
|
||||||
|
raise SystemExit(0)
|
||||||
|
if deleted:
|
||||||
|
print(f'{len(deleted)} deleted file(s) to prune.')
|
||||||
|
if new_total > 0:
|
||||||
|
print(f'{new_total} new/changed file(s) to re-extract.')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Then populate `.graphify_detect.json` so Steps 3A–6 (which read it unconditionally) see the right state for an incremental run. `files` carries the changed subset (drives Step 3A AST + Step 3B0 cache check on only what changed); `all_files` carries the full corpus for any step that needs corpus-wide context:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
r = json.loads(Path('graphify-out/.graphify_incremental.json').read_text(encoding=\"utf-8\"))
|
||||||
|
Path('graphify-out/.graphify_detect.json').write_text(json.dumps({
|
||||||
|
'files': r.get('new_files', {}),
|
||||||
|
'all_files': r.get('files', {}),
|
||||||
|
'total_files': r.get('new_total', 0),
|
||||||
|
'total_words': r.get('total_words', 0),
|
||||||
|
'skipped_sensitive': r.get('skipped_sensitive', []),
|
||||||
|
'needs_graph': True,
|
||||||
|
}, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
If new files exist, first check whether all changed files are code files:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
result = json.loads(open('graphify-out/.graphify_incremental.json', encoding='utf-8').read()) if Path('graphify-out/.graphify_incremental.json').exists() else {}
|
||||||
|
code_exts = {'.py','.ts','.js','.go','.rs','.java','.cpp','.c','.rb','.swift','.kt','.cs','.scala','.php','.cc','.cxx','.hpp','.h','.kts','.lua','.toc','.f','.F','.f90','.F90','.f95','.F95','.f03','.F03','.f08','.F08'}
|
||||||
|
new_files = result.get('new_files', {})
|
||||||
|
all_changed = [f for files in new_files.values() for f in files]
|
||||||
|
code_only = all(Path(f).suffix.lower() in code_exts for f in all_changed)
|
||||||
|
print('code_only:', code_only)
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
If `code_only` is True: print `[graphify update] Code-only changes detected - skipping semantic extraction (no LLM needed)`, run only Step 3A (AST) on the changed files, skip Step 3B entirely (no subagents), then go straight to merge and Steps 4–8.
|
||||||
|
|
||||||
|
If `code_only` is False (any changed file is a doc/paper/image/video): **first, if any changed file is in `new_files['video']`, run `references/transcribe.md` (Step 2.5) on those files, then rewrite `.graphify_detect.json` to move the resulting transcript paths into `files['document']` and drop `files['video']`** — otherwise raw `.mp4/.mp3` paths are fed to semantic subagents as unreadable media (#1392). Then run the full Steps 3A–3C pipeline as normal.
|
||||||
|
|
||||||
|
|
||||||
|
If no new files exist (only deletions), create an empty extraction so the merge step can prune:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
if [ ! -f graphify-out/.graphify_extract.json ]; then
|
||||||
|
echo '[graphify update] Only deletions -- creating empty extraction for merge.'
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
Path('graphify-out/.graphify_extract.json').write_text(json.dumps({'nodes':[],'edges':[],'hyperedges':[],'input_tokens':0,'output_tokens':0}), encoding='utf-8')
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Then:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
from graphify.build import build_merge
|
||||||
|
from graphify.detect import save_manifest
|
||||||
|
|
||||||
|
# Load new extraction and incremental state
|
||||||
|
new_extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
|
||||||
|
incremental = json.loads(Path('graphify-out/.graphify_incremental.json').read_text(encoding=\"utf-8\"))
|
||||||
|
deleted = list(incremental.get('deleted_files', []))
|
||||||
|
# prune_sources is ONLY for genuinely DELETED files. Changed/re-extracted files are
|
||||||
|
# handled by build_merge's replace-on-re-extract (#1344): every source_file in
|
||||||
|
# new_chunks is dropped from the base before merge, so old/stale nodes don't survive.
|
||||||
|
# Do NOT add `changed` here: with root= passed, prune_set relativizes to the same base
|
||||||
|
# as the freshly merged nodes and would DELETE the re-extracted content (#1178 is moot
|
||||||
|
# now that replace — not the dedup pass — reconciles changed files).
|
||||||
|
prune = list(deleted) or None
|
||||||
|
|
||||||
|
# Use build_merge() — reads graph.json directly without NetworkX round-trip
|
||||||
|
# so edge direction (calls, implements, imports) is always preserved (#801).
|
||||||
|
# Pass root= so prune_sources (absolute paths from detect_incremental) are
|
||||||
|
# relativized to match the graph's relative source_file values; without it
|
||||||
|
# nothing is pruned and stale nodes accumulate on every update (#1361).
|
||||||
|
# directed=IS_DIRECTED: replace IS_DIRECTED with True if --directed was given, else
|
||||||
|
# False. Without it a --directed --update silently rebuilds undirected and collapses
|
||||||
|
# reciprocal A<->B edges (#1392).
|
||||||
|
G = build_merge(
|
||||||
|
[new_extraction],
|
||||||
|
graph_path='graphify-out/graph.json',
|
||||||
|
prune_sources=prune,
|
||||||
|
root='INPUT_PATH',
|
||||||
|
directed=IS_DIRECTED,
|
||||||
|
)
|
||||||
|
print(f'[graphify update] Merged: {G.number_of_nodes()} nodes, {G.number_of_edges()} edges')
|
||||||
|
|
||||||
|
# Write merged result back to .graphify_extract.json so Step 4 sees the full graph
|
||||||
|
merged_out = {
|
||||||
|
'nodes': [{'id': n, **d} for n, d in G.nodes(data=True)],
|
||||||
|
'edges': [
|
||||||
|
# Explicit source/target last so they win over any stale attrs in d.
|
||||||
|
{**{k: val for k, val in d.items() if k not in ('_src', '_tgt', 'source', 'target')},
|
||||||
|
'source': d.get('_src', u), 'target': d.get('_tgt', v)}
|
||||||
|
for u, v, d in G.edges(data=True)
|
||||||
|
],
|
||||||
|
# G.graph["hyperedges"] holds hyperedges from both existing graph.json
|
||||||
|
# and new_extraction (build_merge combines them). Falling back to
|
||||||
|
# new_extraction only would silently drop prior-run hyperedges (#801).
|
||||||
|
'hyperedges': list(G.graph.get('hyperedges', [])),
|
||||||
|
'input_tokens': new_extraction.get('input_tokens', 0),
|
||||||
|
'output_tokens': new_extraction.get('output_tokens', 0),
|
||||||
|
}
|
||||||
|
Path('graphify-out/.graphify_extract.json').write_text(json.dumps(merged_out, ensure_ascii=False), encoding=\"utf-8\")
|
||||||
|
print(f'[graphify update] Merged extraction written ({len(merged_out[\"nodes\"])} nodes, {len(merged_out[\"edges\"])} edges)')
|
||||||
|
|
||||||
|
# Save manifest so next --update diffs against today's state, not the
|
||||||
|
# prior run's baseline (prevents ghost-node reports on subsequent updates).
|
||||||
|
# root= matches the build_merge call above so the manifest keys stay relative to
|
||||||
|
# the scan root — portable across clones/machines, so --update keeps matching
|
||||||
|
# cached files instead of missing every one after a move (#1417).
|
||||||
|
save_manifest(incremental['files'], root='INPUT_PATH')
|
||||||
|
print('[graphify update] Manifest saved.')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Then run Steps 4–8 on the merged graph as normal.
|
||||||
|
|
||||||
|
After Step 4, show the graph diff:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$(cat graphify-out/.graphify_python) -c "
|
||||||
|
import json
|
||||||
|
from graphify.analyze import graph_diff
|
||||||
|
from graphify.build import build_from_json
|
||||||
|
from networkx.readwrite import json_graph
|
||||||
|
import networkx as nx
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Load old graph (before update) from backup written before merge
|
||||||
|
old_data = json.loads(Path('graphify-out/.graphify_old.json').read_text(encoding=\"utf-8\")) if Path('graphify-out/.graphify_old.json').exists() else None
|
||||||
|
new_extract = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
|
||||||
|
G_new = build_from_json(new_extract, directed=IS_DIRECTED)
|
||||||
|
|
||||||
|
if old_data:
|
||||||
|
G_old = json_graph.node_link_graph(old_data, edges='links')
|
||||||
|
diff = graph_diff(G_old, G_new)
|
||||||
|
print(diff['summary'])
|
||||||
|
if diff['new_nodes']:
|
||||||
|
print('New nodes:', ', '.join(n['label'] for n in diff['new_nodes'][:5]))
|
||||||
|
if diff['new_edges']:
|
||||||
|
print('New edges:', len(diff['new_edges']))
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
Before the merge step, save the old graph: `cp graphify-out/graph.json graphify-out/.graphify_old.json`
|
||||||
|
Clean up after: `rm -f graphify-out/.graphify_old.json`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## For --cluster-only
|
||||||
|
|
||||||
|
Skip Steps 1–3. Re-run clustering on the existing graph:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
graphify cluster-only .
|
||||||
|
```
|
||||||
|
|
||||||
|
`graphify cluster-only .` is **self-contained**: it re-clusters, names communities, and regenerates `GRAPH_REPORT.md`, `graph.json`, and `graph.html` from the existing graph. **Do not re-run Steps 5–9** — they read intermediate files (`.graphify_extract.json`, `.graphify_detect.json`, `.graphify_analysis.json`) that a prior build's cleanup (Step 9) already deleted, so they raise `FileNotFoundError` (#1392). When it finishes, present the refreshed `GRAPH_REPORT.md` summary as usual.
|
||||||
219
BUG_REPORT.md
Normal file
219
BUG_REPORT.md
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
# Отчёт по ошибкам и рискам проекта Magistr
|
||||||
|
|
||||||
|
Дата проверки: 2026-07-03
|
||||||
|
|
||||||
|
Проверено вручную: backend Spring Boot, мультитенантность, авторизация, генерация расписания, основные frontend JS-файлы. Автотесты не запущены: в окружении нет `mvn` и `./mvnw`.
|
||||||
|
|
||||||
|
## Нужно исправить в первую очередь
|
||||||
|
|
||||||
|
### 1. Высокая — JWT имеет небезопасные production-дефолты
|
||||||
|
|
||||||
|
**Файлы:**
|
||||||
|
- `backend/src/main/java/com/magistr/app/config/auth/JwtProperties.java:13-17`
|
||||||
|
- `backend/src/main/resources/application.properties:18-22`
|
||||||
|
- `backend/src/main/java/com/magistr/app/controller/AuthController.java:162-168`
|
||||||
|
|
||||||
|
**Проблема:** если на проде не задан `JWT_SECRET`, приложение использует известный дефолтный секрет `dev-only-change-this-jwt-secret-32-bytes-minimum`. При этом `JWT_REFRESH_COOKIE_SECURE` по умолчанию `false`, и refresh-cookie может уходить без флага `Secure`.
|
||||||
|
|
||||||
|
**Риск:** подделка access-токенов при известном секрете; утечка refresh-cookie при ошибочной HTTP/прокси-конфигурации.
|
||||||
|
|
||||||
|
**Как исправить:**
|
||||||
|
- На production-профиле падать при отсутствии `JWT_SECRET` и при секрете короче требуемой длины.
|
||||||
|
- Для production сделать `app.jwt.refresh-cookie-secure=true` обязательным.
|
||||||
|
- Разделить dev/prod профили: дефолтный секрет оставить только в `application-dev.properties`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2. Высокая — race condition при ротации refresh-токена
|
||||||
|
|
||||||
|
**Файл:** `backend/src/main/java/com/magistr/app/config/auth/RefreshTokenService.java:50-78`
|
||||||
|
|
||||||
|
**Проблема:** `rotate()` читает refresh-токен через `findByTokenHash()`, проверяет активность, затем отзывает старый и создаёт новый. Нет блокировки строки или атомарного `UPDATE ... WHERE revoked_at IS NULL`. Два параллельных запроса с одним refresh-токеном могут оба пройти проверку и создать две активные сессии.
|
||||||
|
|
||||||
|
**Риск:** повторное использование одного refresh-токена, раздвоение сессий, некорректная ротация `rotatedToTokenHash`.
|
||||||
|
|
||||||
|
**Как исправить:**
|
||||||
|
- Добавить pessimistic lock в репозиторий (`@Lock(PESSIMISTIC_WRITE)` для поиска по `tokenHash`) внутри транзакции.
|
||||||
|
- Либо сделать атомарное обновление: `UPDATE auth_refresh_tokens SET revoked_at = now, rotated_to_token_hash = :newHash WHERE token_hash = :hash AND revoked_at IS NULL AND expires_at > now` и создавать новый токен только если обновлена 1 строка.
|
||||||
|
- Добавить тест на два параллельных refresh-запроса.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3. Высокая — `AuthContext` может протечь между запросами при `403`
|
||||||
|
|
||||||
|
**Файл:** `backend/src/main/java/com/magistr/app/config/auth/AuthorizationInterceptor.java:35-49`
|
||||||
|
|
||||||
|
**Проблема:** пользователь кладётся в `AuthContext` на строке 45, а при нехватке роли метод возвращает `false` на строке 49. В таком сценарии `afterCompletion()` текущего interceptor'а может не выполниться, и `ThreadLocal` останется в потоке до следующей очистки.
|
||||||
|
|
||||||
|
**Риск:** утечка контекста пользователя между запросами в servlet thread pool. Сейчас это в основном риск безопасности и будущих багов, но его лучше устранить сразу.
|
||||||
|
|
||||||
|
**Как исправить:** перед каждым `return false` после `AuthContext.setCurrentUser(user)` вызывать `AuthContext.clear()`. Ещё лучше — не устанавливать `AuthContext`, пока не пройдена ролевая проверка, или обернуть обработку отказов в безопасный helper.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4. Высокая — точечные изменения расписания не проверяются на конфликты
|
||||||
|
|
||||||
|
**Файл:** `backend/src/main/java/com/magistr/app/controller/ScheduleOverrideController.java:71-127`
|
||||||
|
|
||||||
|
**Проблема:** при `MOVE`/`REPLACE` валидируется только существование нового преподавателя, аудитории и слота. Не проверяется, свободны ли преподаватель/аудитория/группа в выбранную дату и пару.
|
||||||
|
|
||||||
|
**Риск:** учебный отдел может создать override, который назначит преподавателя или аудиторию на две пары одновременно. Основные правила расписания конфликты проверяют, а override — нет.
|
||||||
|
|
||||||
|
**Как исправить:**
|
||||||
|
- Перед сохранением override построить расписание на `lessonDate` и проверить занятость нового `timeSlot`, `teacher`, `classroom`, групп/подгрупп базового слота.
|
||||||
|
- Переиспользовать/вынести конфликтную логику из `ScheduleRuleAdminController` в сервис.
|
||||||
|
- Вернуть `409 Conflict` с описанием конфликтующего занятия.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 5. Средняя/высокая — расписание преподавателя не показывает пары, где он назначен через override
|
||||||
|
|
||||||
|
**Файлы:**
|
||||||
|
- `backend/src/main/java/com/magistr/app/service/ScheduleQueryService.java:47-58`
|
||||||
|
- `backend/src/main/java/com/magistr/app/repository/ScheduleRuleRepository.java:36-54`
|
||||||
|
|
||||||
|
**Проблема:** если поиск выполняется только по `teacherId`, сервис строит расписание через `buildScheduleForTeacher(teacherId)`, то есть берёт только базовые правила, где преподаватель указан в слоте. Если override заменил преподавателя на этого teacherId, базовое правило в выборку не попадёт, и после `applyOverrides()` такая пара не появится.
|
||||||
|
|
||||||
|
**Риск:** преподаватель не увидит замену/переназначенную ему пару в своём расписании.
|
||||||
|
|
||||||
|
**Как исправить:**
|
||||||
|
- При поиске по `teacherId` дополнительно учитывать overrides с `newTeacher.id = teacherId` за период.
|
||||||
|
- Либо строить расписание по группам для затронутых override-слотов и после применения override фильтровать по преподавателю.
|
||||||
|
- Добавить тест: базовый преподаватель A, override `newTeacher=B`, поиск по `teacherId=B` должен вернуть пару.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 6. Средняя — обновление существующего тенанта может удалить рабочее подключение и сохранить нерабочее
|
||||||
|
|
||||||
|
**Файлы:**
|
||||||
|
- `backend/src/main/java/com/magistr/app/controller/DatabaseController.java:104-116`
|
||||||
|
- `backend/src/main/java/com/magistr/app/config/tenant/TenantRoutingDataSource.java:135-148`
|
||||||
|
- `backend/src/main/java/com/magistr/app/config/tenant/TenantConfigWatcher.java:147-158`
|
||||||
|
|
||||||
|
**Проблема:** при добавлении тенанта с уже существующим доменом старый DataSource сначала удаляется и закрывается (`removeTenant()`), затем добавляется новый. Hikari настроен с `setInitializationFailTimeout(-1)`, поэтому невалидная БД может быть добавлена без ошибки. `initDatabaseForTenant()` ловит исключения Flyway и не пробрасывает их наружу, поэтому API может вернуть успех и записать нерабочий конфиг.
|
||||||
|
|
||||||
|
**Риск:** админ одной ошибкой в JDBC URL/пароле может выключить рабочий tenant и разнести нерабочую конфигурацию через ConfigMap.
|
||||||
|
|
||||||
|
**Как исправить:**
|
||||||
|
- Сначала создать и проверить новый DataSource во временном объекте (`testConnection`, Flyway migrate) и только после успеха атомарно заменить старый.
|
||||||
|
- `initDatabaseForTenant()` должен возвращать результат или бросать исключение, чтобы `DatabaseController` не писал невалидный ConfigMap.
|
||||||
|
- При ошибке оставлять старое подключение активным.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 7. Средняя — watcher не применяет изменения URL/логина/пароля существующего тенанта
|
||||||
|
|
||||||
|
**Файл:** `backend/src/main/java/com/magistr/app/config/tenant/TenantConfigWatcher.java:102-125`
|
||||||
|
|
||||||
|
**Проблема:** `syncTenants()` добавляет только новые домены и удаляет исчезнувшие. Если в `tenants.json` изменились `url`, `username` или `password` для уже существующего `domain`, текущий DataSource не заменяется.
|
||||||
|
|
||||||
|
**Риск:** после обновления ConfigMap часть pod'ов продолжит ходить в старую БД/со старыми credentials до рестарта.
|
||||||
|
|
||||||
|
**Как исправить:** сравнивать весь `TenantConfig` для существующих доменов. При отличии — безопасно пересоздавать DataSource после успешной проверки нового подключения.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 8. Средняя — отключена проверка TLS-сертификата Kubernetes API
|
||||||
|
|
||||||
|
**Файл:** `backend/src/main/java/com/magistr/app/config/tenant/ConfigMapUpdater.java:74-76,104-119`
|
||||||
|
|
||||||
|
**Проблема:** `createInsecureClient()` доверяет любому сертификату (`checkServerTrusted` пустой). Комментарий объясняет это self-signed CA, но в Kubernetes правильный CA доступен в serviceaccount volume.
|
||||||
|
|
||||||
|
**Риск:** MITM внутри сети кластера может подменить Kubernetes API и получить serviceaccount token/подменить ConfigMap.
|
||||||
|
|
||||||
|
**Как исправить:** использовать CA из `/var/run/secrets/kubernetes.io/serviceaccount/ca.crt` и стандартную проверку hostname/cert chain. Не использовать trust-all клиент.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 9. Средняя — кабинет кафедры может перезаписать дисциплину другой кафедры при импорте
|
||||||
|
|
||||||
|
**Файл:** `backend/src/main/java/com/magistr/app/controller/DepartmentWorkspaceController.java:80-90`
|
||||||
|
|
||||||
|
**Проблема:** импорт ищет дисциплину только по глобальному имени (`findByName`) и затем без проверки меняет `departmentId` на кафедру текущего пользователя. Если дисциплина с таким названием уже принадлежит другой кафедре, она будет переназначена.
|
||||||
|
|
||||||
|
**Риск:** потеря принадлежности дисциплины и связей расписания/календарей у другой кафедры.
|
||||||
|
|
||||||
|
**Как исправить:**
|
||||||
|
- Не менять `departmentId` существующей дисциплины другой кафедры.
|
||||||
|
- Сделать уникальность по `(department_id, lower(name))`, если одинаковые названия допустимы у разных кафедр.
|
||||||
|
- При конфликте возвращать понятную ошибку или создавать отдельную запись в рамках кафедры.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 10. Средняя — кафедра может смотреть workload по чужим кафедрам
|
||||||
|
|
||||||
|
**Файл:** `backend/src/main/java/com/magistr/app/controller/WorkloadController.java:43-130`
|
||||||
|
|
||||||
|
**Проблема:** endpoints `/api/workload/*` доступны роли `DEPARTMENT` и принимают произвольный `departmentId`, но не сверяют его с `AuthContext.departmentId`. Также при `departmentId` отсутствующем запрос строится по всем группам/кафедрам.
|
||||||
|
|
||||||
|
**Риск:** оператор кафедры может получить загруженность преподавателей/аудиторий/кафедр за другие подразделения, если это не было задумано бизнес-правилами.
|
||||||
|
|
||||||
|
**Как исправить:** для роли `DEPARTMENT` принудительно использовать `AuthContext.getCurrentUser().departmentId()` и игнорировать/запрещать чужой `departmentId`. Аналогично проверить `ScheduleSearchController`, если расписание не должно быть глобально видимым.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 11. Средняя — семестры можно создать вне учебного года или с пересечениями
|
||||||
|
|
||||||
|
**Файлы:**
|
||||||
|
- `backend/src/main/java/com/magistr/app/controller/AcademicCalendarAdminController.java:95-129,201-211`
|
||||||
|
- `backend/src/main/java/com/magistr/app/service/AcademicDateService.java:32-34`
|
||||||
|
- `backend/src/main/java/com/magistr/app/repository/SemesterRepository.java:13`
|
||||||
|
|
||||||
|
**Проблема:** при создании/обновлении семестра проверяется только `endDate >= startDate`. Нет проверки, что семестр лежит внутри своего учебного года и не пересекается с другим семестром. При этом расписание ищет `findFirstByStartDateLessThanEqualAndEndDateGreaterThanEqual()`, то есть при пересечении дата будет сопоставляться с произвольным первым семестром.
|
||||||
|
|
||||||
|
**Риск:** генерация расписания и чётность недель будут работать некорректно на пересекающихся датах.
|
||||||
|
|
||||||
|
**Как исправить:**
|
||||||
|
- Валидировать границы семестра относительно `AcademicYear.startDate/endDate`.
|
||||||
|
- Запрещать пересечение семестров в рамках учебного года.
|
||||||
|
- Желательно добавить DB-level exclusion constraint/range constraint или хотя бы сервисную проверку и тест.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 12. Низкая/средняя — access-токен хранится в `localStorage`
|
||||||
|
|
||||||
|
**Файл:** `frontend/admin/js/api.js:5-7,155-163`
|
||||||
|
|
||||||
|
**Проблема:** access JWT хранится в `localStorage`, откуда его может украсть любой XSS в админке. Refresh-токен уже вынесен в HttpOnly cookie, но access-токен остаётся доступным JS.
|
||||||
|
|
||||||
|
**Риск:** при XSS злоумышленник получает Bearer token и может выполнять API-запросы до истечения TTL.
|
||||||
|
|
||||||
|
**Как исправить:**
|
||||||
|
- По возможности держать access token в памяти и обновлять через HttpOnly refresh cookie.
|
||||||
|
- Усилить CSP (`script-src` без inline), запретить небезопасные вставки HTML.
|
||||||
|
- Провести отдельный XSS-аудит всех `innerHTML`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 13. Низкая — frontend местами вставляет текст ошибки через `innerHTML` без экранирования
|
||||||
|
|
||||||
|
**Файл:** `frontend/admin/settings/js/views/database.js:37-49`
|
||||||
|
|
||||||
|
**Проблема:** `e.message` вставляется в `innerHTML` без `escapeHtml()`. Сейчас большинство серверных ошибок фиксированные, но часть ошибок может включать текст из внешних систем/драйверов.
|
||||||
|
|
||||||
|
**Риск:** потенциальный XSS в настройках БД при попадании HTML в сообщение ошибки.
|
||||||
|
|
||||||
|
**Как исправить:** заменить на `textContent` или оборачивать `escapeHtml(e.message)`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 14. Низкая — backend image скачивает OpenTelemetry javaagent по `latest`
|
||||||
|
|
||||||
|
**Файл:** `backend/Dockerfile:7`
|
||||||
|
|
||||||
|
**Проблема:** сборка всегда скачивает `latest` javaagent с GitHub без pin версии/checksum.
|
||||||
|
|
||||||
|
**Риск:** невоспроизводимые сборки; внезапные несовместимости; supply-chain риск.
|
||||||
|
|
||||||
|
**Как исправить:** закрепить конкретную версию javaagent и проверять checksum.
|
||||||
|
|
||||||
|
## Дополнительно проверить после исправлений
|
||||||
|
|
||||||
|
1. Добавить Maven Wrapper (`mvnw`), чтобы проверки запускались одинаково в CI и локально.
|
||||||
|
2. Прогнать `mvn test` и добавить тесты на:
|
||||||
|
- параллельную ротацию refresh-токена;
|
||||||
|
- override с конфликтом преподавателя/аудитории;
|
||||||
|
- расписание преподавателя, назначенного через override;
|
||||||
|
- обновление существующего tenant config;
|
||||||
|
- запрет чужого `departmentId` для роли `DEPARTMENT`.
|
||||||
|
3. Не изменять существующие Flyway-миграции. Если нужны DB constraints/indexes — добавлять новую миграцию `V3__...sql`.
|
||||||
54
DEVOPS.md
54
DEVOPS.md
@@ -98,8 +98,9 @@ graph TD
|
|||||||
* Для связи с Ingress настроен ClusterIP-сервис на порту 8080.
|
* Для связи с Ingress настроен ClusterIP-сервис на порту 8080.
|
||||||
|
|
||||||
* **Ingress (`ingress.yaml`)**:
|
* **Ingress (`ingress.yaml`)**:
|
||||||
* В роли Ingress-контроллера выступает стандартный для K3s **Traefik**.
|
* В роли Ingress-контроллера выступает встроенный **Traefik** (`kube-system/traefik`).
|
||||||
* Мной настроены строгие правила маршрутизации по доменным именам (например, `magistr.zuev.company` для тестового окружения, `n8n.zuev.company` и т.д.). Маршрутизация по путям разделяет трафик: запросы к API (`/api`) проксируются на бэкенд-сервис, а запросы к статическим ресурсам и страницам (`/`) — на фронтенд-сервис.
|
* Он доступен извне через Klipper Service LoadBalancer (DaemonSet), который прокидывает порты 80/443 (hostPort) на внешние IP адреса нод кластера (`192.168.1.104`, `192.168.1.105`, `192.168.1.106`).
|
||||||
|
* Мной настроены строгие правила маршрутизации по доменным именам (например, `magistr.zuev.company` и `n8n.zuev.company`). Запросы к API (`/api`) проксируются на бэкенд, а к корню (`/`) — на фронтенд.
|
||||||
|
|
||||||
### 3.2 Реализация динамической мультитенантности через K8s API
|
### 3.2 Реализация динамической мультитенантности через K8s API
|
||||||
Одним из наиболее сложных этапов проектирования стала организация бесшовного добавления новых университетов без перезапуска бэкенда и изменения исходного кода приложения.
|
Одним из наиболее сложных этапов проектирования стала организация бесшовного добавления новых университетов без перезапуска бэкенда и изменения исходного кода приложения.
|
||||||
@@ -199,19 +200,16 @@ graph TD
|
|||||||
4. **Build & Push**: Параллельная сборка Docker-образов для бэкенда и фронтенда с тегом `latest` и отправка их в приватный реестр.
|
4. **Build & Push**: Параллельная сборка Docker-образов для бэкенда и фронтенда с тегом `latest` и отправка их в приватный реестр.
|
||||||
|
|
||||||
### 5.2 Доставка в кластер (CD)
|
### 5.2 Доставка в кластер (CD)
|
||||||
Для авторизации нод K3s в приватном реестре Gitea мной был создан секрет типа `docker-registry` в пространстве имен `magistr`:
|
Для авторизации нод K3s в приватном реестре Gitea мной был создан секрет `gitea-registry` типа `docker-registry` в пространстве имен `magistr`. Этот секрет ассоциирован со спецификациями деплоев через директиву `imagePullSecrets`.
|
||||||
|
|
||||||
|
Непосредственно Gitea Actions Runner работает как демон `act_runner` внутри изолированного LXC контейнера (CTID 107). В пайплайне шаг развертывания (`deploy-to-k8s`) динамически генерирует `kubeconfig` из секрета, устанавливает утилиту `kubectl` и выполняет императивное обновление релизов без использования тяжеловесных GitOps операторов:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
kubectl create secret docker-registry gitea-registry \
|
kubectl rollout restart deployment backend frontend -n magistr
|
||||||
--docker-server=gitea.zuev.company \
|
kubectl rollout status deployment/frontend -n magistr --timeout=120s
|
||||||
--docker-username=Zuev \
|
kubectl rollout status deployment/backend -n magistr --timeout=300s
|
||||||
--docker-password=${ZUEV_TOKEN} \
|
|
||||||
--namespace=magistr
|
|
||||||
```
|
|
||||||
Этот секрет ассоциирован со спецификациями деплоев в `backend.yaml` и `frontend.yaml` через директиву `imagePullSecrets`. Обновление приложений в кластере после завершения сборки образов выполняется путем контролируемого перезапуска подов:
|
|
||||||
```bash
|
|
||||||
kubectl rollout restart deployment backend -n magistr
|
|
||||||
kubectl rollout restart deployment frontend -n magistr
|
|
||||||
```
|
```
|
||||||
|
Поскольку манифесты используют `imagePullPolicy: Always` и тег `:main`, поды автоматически скачивают свежие слои собранных образов.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -226,23 +224,35 @@ kubectl rollout restart deployment frontend -n magistr
|
|||||||
* Полноценной поддержке протокола HTTP/3 «из коробки».
|
* Полноценной поддержке протокола HTTP/3 «из коробки».
|
||||||
|
|
||||||
### 6.2 Конфигурация балансировки
|
### 6.2 Конфигурация балансировки
|
||||||
Внешний Caddy-сервер принимает запросы ко всем поддоменам `*.zuev.company` и перенаправляет их на ноды кластера K3s, выполняя роль внешнего балансировщика нагрузки (L4/L7 Load Balancer):
|
Внешний Caddy-сервер развернут в изолированном LXC контейнере (CTID 101) и обрабатывает запросы ко всем поддоменам проекта. Он перенаправляет их на ноды кластера K3s, выполняя роль внешнего балансировщика, а также проксирует телеметрию с фронтенда напрямую в сборщик OTel:
|
||||||
|
|
||||||
```caddyfile
|
```caddyfile
|
||||||
*.zuev.company {
|
(otel_proxy) {
|
||||||
reverse_proxy 192.168.1.104:80 192.168.1.105:80 192.168.1.106:80 {
|
handle_path /otel/* { reverse_proxy 192.168.1.100:4318 }
|
||||||
lb_policy round_robin
|
|
||||||
lb_try_duration 5s
|
|
||||||
lb_try_interval 250ms
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(k8s_nodes) {
|
||||||
|
handle {
|
||||||
|
reverse_proxy 192.168.1.104:80 192.168.1.105:80 192.168.1.106:80 {
|
||||||
|
lb_policy round_robin
|
||||||
|
lb_try_duration 5s
|
||||||
|
lb_try_interval 250ms
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
magistr.zuev.company { import otel_proxy; import k8s_nodes }
|
||||||
|
n8n.zuev.company { import otel_proxy; import k8s_nodes }
|
||||||
```
|
```
|
||||||
Сетевые запросы распределяются по нодам K3s по алгоритму Round-Robin. В случае недоступности одной из нод, Caddy временно исключает ее из пула, обеспечивая отказоустойчивость инфраструктуры на сетевом уровне.
|
Сетевые запросы к приложениям распределяются по 3 физическим нодам K3s. Благодаря сниппетам, добавление нового тенанта в инфраструктуре Caddy требует всего двух строчек конфигурации.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## РАЗДЕЛ 7. СКВОЗНОЙ МОНИТОРИНГ И ОБСЕРВАБИЛИТИ (SigNoz + OpenTelemetry)
|
## РАЗДЕЛ 7. СКВОЗНОЙ МОНИТОРИНГ И ОБСЕРВАБИЛИТИ (SigNoz + OpenTelemetry)
|
||||||
|
|
||||||
Для контроля здоровья системы и оперативного выявления аномалий мной была спроектирована и внедрена централизованная система мониторинга на базе APM-платформы **SigNoz** и стандартов **OpenTelemetry (OTel)**.
|
Для контроля здоровья системы и оперативного выявления аномалий мной была спроектирована и внедрена централизованная система мониторинга на базе APM-платформы **SigNoz** (с хранилищем **ClickHouse**) и стандартов **OpenTelemetry (OTel)**.
|
||||||
|
|
||||||
|
Платформа SigNoz вынесена в отдельный LXC контейнер (CTID 100) по адресу `192.168.1.100` и развернута через `docker-compose`. Данные ClickHouse и SQLite метаданные персистентно хранятся в Docker volumes хоста для обеспечения сохранности при рестартах.
|
||||||
|
|
||||||
### 7.1 Сбор телеметрии Backend
|
### 7.1 Сбор телеметрии Backend
|
||||||
Java-приложение бэкенда запускается с подключением агента OpenTelemetry (`opentelemetry-javaagent.jar`). Это позволяет без изменения кода собирать:
|
Java-приложение бэкенда запускается с подключением агента OpenTelemetry (`opentelemetry-javaagent.jar`). Это позволяет без изменения кода собирать:
|
||||||
|
|||||||
1
graphify-out/.graphify_labels.json
Normal file
1
graphify-out/.graphify_labels.json
Normal file
File diff suppressed because one or more lines are too long
5
graphify-out/.graphify_learning.json
Normal file
5
graphify-out/.graphify_learning.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"generated_at": "2026-07-04T10:57:14.633512+00:00",
|
||||||
|
"nodes": {},
|
||||||
|
"version": 1
|
||||||
|
}
|
||||||
1
graphify-out/.graphify_python
Normal file
1
graphify-out/.graphify_python
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/home/zuev/.local/share/uv/tools/graphifyy/bin/python
|
||||||
1
graphify-out/.graphify_root
Normal file
1
graphify-out/.graphify_root
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/mnt/HDD/ProjectMagistr/magistr
|
||||||
6222
graphify-out/.graphify_semantic_new.json
Normal file
6222
graphify-out/.graphify_semantic_new.json
Normal file
File diff suppressed because it is too large
Load Diff
48
graphify-out/.graphify_uncached.txt
Normal file
48
graphify-out/.graphify_uncached.txt
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/mnt/HDD/ProjectMagistr/magistr/.agents/skills/AutoUpdateDocs.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/.agents/skills/auto-update-docs/SKILL.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/.agents/skills/frontend-design/LICENSE.txt
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/.agents/skills/frontend-design/SKILL.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/.gitea/workflows/docker-build.yaml
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/AGENTS.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/BUG_REPORT.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/DEVOPS.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/backend/src/main/java/com/magistr/app/README.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/compose.yaml
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/ACADEMIC_CALENDAR.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/API.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/ARCHITECTURE.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/BUSINESS_LOGIC.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/DATABASE.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/DEVELOPMENT.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/DYNAMIC_SCHEDULE_IMPLEMENTATION.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/FRONTEND.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/INFRASTRUCTURE.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/LOGGING.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/README.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/SCHEDULE_PROPOSAL.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/SCHEDULE_TASKS.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/docs/UI_COMPONENTS.md
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/index.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/settings/index.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/settings/views/database.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/settings/views/edu-forms.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/settings/views/general.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/settings/views/time-slots.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/views/academic-calendar.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/views/auditorium-workload.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/views/classrooms.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/views/dashboard.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/views/department-workspace.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/views/groups.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/views/schedule-view.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/views/schedule.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/views/subjects.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/views/teacher-requests.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/views/university-structure.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/admin/views/users.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/department/index.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/edu-office/index.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/index.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/student/index.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/frontend/teacher/index.html
|
||||||
|
/mnt/HDD/ProjectMagistr/magistr/resume/index.html
|
||||||
885
graphify-out/.vocab.txt
Normal file
885
graphify-out/.vocab.txt
Normal file
@@ -0,0 +1,885 @@
|
|||||||
|
abstract
|
||||||
|
academic
|
||||||
|
access
|
||||||
|
action
|
||||||
|
actions
|
||||||
|
active
|
||||||
|
activity
|
||||||
|
actual
|
||||||
|
add
|
||||||
|
address
|
||||||
|
admin
|
||||||
|
advice
|
||||||
|
after
|
||||||
|
agent
|
||||||
|
agents
|
||||||
|
alert
|
||||||
|
all
|
||||||
|
allow
|
||||||
|
allowed
|
||||||
|
allows
|
||||||
|
ambiguous
|
||||||
|
and
|
||||||
|
ansible
|
||||||
|
any
|
||||||
|
api
|
||||||
|
app
|
||||||
|
application
|
||||||
|
applies
|
||||||
|
apply
|
||||||
|
approve
|
||||||
|
archive
|
||||||
|
archived
|
||||||
|
are
|
||||||
|
argument
|
||||||
|
asc
|
||||||
|
assignment
|
||||||
|
assignments
|
||||||
|
audience
|
||||||
|
auditorium
|
||||||
|
auth
|
||||||
|
authenticate
|
||||||
|
authenticated
|
||||||
|
authenticates
|
||||||
|
author
|
||||||
|
authorization
|
||||||
|
authorized
|
||||||
|
auto
|
||||||
|
availability
|
||||||
|
available
|
||||||
|
backend
|
||||||
|
bad
|
||||||
|
badge
|
||||||
|
base
|
||||||
|
bean
|
||||||
|
bearer
|
||||||
|
before
|
||||||
|
between
|
||||||
|
blank
|
||||||
|
blocks
|
||||||
|
boolean
|
||||||
|
boot
|
||||||
|
broad
|
||||||
|
btn
|
||||||
|
bucket
|
||||||
|
build
|
||||||
|
building
|
||||||
|
but
|
||||||
|
button
|
||||||
|
buttons
|
||||||
|
bytes
|
||||||
|
cachable
|
||||||
|
cache
|
||||||
|
caddy
|
||||||
|
calculator
|
||||||
|
calendar
|
||||||
|
calendars
|
||||||
|
can
|
||||||
|
canonical
|
||||||
|
capacity
|
||||||
|
caption
|
||||||
|
case
|
||||||
|
category
|
||||||
|
cell
|
||||||
|
changes
|
||||||
|
checkbox
|
||||||
|
checkboxes
|
||||||
|
checkmark
|
||||||
|
class
|
||||||
|
classroom
|
||||||
|
classrooms
|
||||||
|
clean
|
||||||
|
clear
|
||||||
|
cleared
|
||||||
|
click
|
||||||
|
client
|
||||||
|
close
|
||||||
|
code
|
||||||
|
collect
|
||||||
|
collection
|
||||||
|
color
|
||||||
|
com
|
||||||
|
combined
|
||||||
|
command
|
||||||
|
comment
|
||||||
|
comments
|
||||||
|
compare
|
||||||
|
complete
|
||||||
|
completion
|
||||||
|
component
|
||||||
|
compose
|
||||||
|
config
|
||||||
|
configs
|
||||||
|
configuration
|
||||||
|
configure
|
||||||
|
configurer
|
||||||
|
conflict
|
||||||
|
connection
|
||||||
|
constructor
|
||||||
|
consumed
|
||||||
|
consumption
|
||||||
|
container
|
||||||
|
content
|
||||||
|
context
|
||||||
|
controller
|
||||||
|
cookie
|
||||||
|
copy
|
||||||
|
count
|
||||||
|
course
|
||||||
|
coverage
|
||||||
|
create
|
||||||
|
created
|
||||||
|
creation
|
||||||
|
crypt
|
||||||
|
css
|
||||||
|
current
|
||||||
|
custom
|
||||||
|
dashboard
|
||||||
|
data
|
||||||
|
database
|
||||||
|
date
|
||||||
|
dates
|
||||||
|
day
|
||||||
|
days
|
||||||
|
decoder
|
||||||
|
deduplicate
|
||||||
|
default
|
||||||
|
defaults
|
||||||
|
delete
|
||||||
|
department
|
||||||
|
departments
|
||||||
|
desc
|
||||||
|
description
|
||||||
|
descriptor
|
||||||
|
design
|
||||||
|
details
|
||||||
|
determine
|
||||||
|
dev
|
||||||
|
dictionaries
|
||||||
|
different
|
||||||
|
display
|
||||||
|
docker
|
||||||
|
docs
|
||||||
|
does
|
||||||
|
domain
|
||||||
|
dropdown
|
||||||
|
dropdowns
|
||||||
|
dto
|
||||||
|
duplicate
|
||||||
|
duplicates
|
||||||
|
duration
|
||||||
|
each
|
||||||
|
edu
|
||||||
|
education
|
||||||
|
effect
|
||||||
|
effective
|
||||||
|
element
|
||||||
|
eligible
|
||||||
|
empty
|
||||||
|
enable
|
||||||
|
encoder
|
||||||
|
end
|
||||||
|
endpoint
|
||||||
|
engineer
|
||||||
|
entities
|
||||||
|
entity
|
||||||
|
equal
|
||||||
|
equals
|
||||||
|
equipment
|
||||||
|
equipments
|
||||||
|
error
|
||||||
|
escape
|
||||||
|
excel
|
||||||
|
exception
|
||||||
|
excluding
|
||||||
|
existing
|
||||||
|
exists
|
||||||
|
expired
|
||||||
|
expires
|
||||||
|
exporter
|
||||||
|
external
|
||||||
|
factory
|
||||||
|
fallback
|
||||||
|
fetch
|
||||||
|
field
|
||||||
|
fields
|
||||||
|
file
|
||||||
|
fill
|
||||||
|
find
|
||||||
|
first
|
||||||
|
floor
|
||||||
|
flow
|
||||||
|
flyway
|
||||||
|
for
|
||||||
|
form
|
||||||
|
format
|
||||||
|
forms
|
||||||
|
found
|
||||||
|
free
|
||||||
|
from
|
||||||
|
frontend
|
||||||
|
full
|
||||||
|
function
|
||||||
|
future
|
||||||
|
generate
|
||||||
|
generation
|
||||||
|
generator
|
||||||
|
get
|
||||||
|
gitea
|
||||||
|
global
|
||||||
|
graduated
|
||||||
|
greater
|
||||||
|
grid
|
||||||
|
group
|
||||||
|
groups
|
||||||
|
handle
|
||||||
|
handler
|
||||||
|
has
|
||||||
|
hash
|
||||||
|
have
|
||||||
|
head
|
||||||
|
headers
|
||||||
|
hex
|
||||||
|
hide
|
||||||
|
highlight
|
||||||
|
hikari
|
||||||
|
historical
|
||||||
|
history
|
||||||
|
homelab
|
||||||
|
hours
|
||||||
|
html
|
||||||
|
http
|
||||||
|
ids
|
||||||
|
ignore
|
||||||
|
illegal
|
||||||
|
import
|
||||||
|
incident
|
||||||
|
include
|
||||||
|
infrastructure
|
||||||
|
init
|
||||||
|
initialized
|
||||||
|
initializer
|
||||||
|
inner
|
||||||
|
insecure
|
||||||
|
integer
|
||||||
|
interceptor
|
||||||
|
interceptors
|
||||||
|
interface
|
||||||
|
invalid
|
||||||
|
invalidate
|
||||||
|
iso
|
||||||
|
issued
|
||||||
|
item
|
||||||
|
items
|
||||||
|
java
|
||||||
|
job
|
||||||
|
jpa
|
||||||
|
json
|
||||||
|
junior
|
||||||
|
jwt
|
||||||
|
keeps
|
||||||
|
key
|
||||||
|
keys
|
||||||
|
kubeconfig
|
||||||
|
kubernetes
|
||||||
|
label
|
||||||
|
labels
|
||||||
|
laboratory
|
||||||
|
latest
|
||||||
|
layout
|
||||||
|
lecture
|
||||||
|
less
|
||||||
|
lesson
|
||||||
|
lessons
|
||||||
|
lifecycle
|
||||||
|
limit
|
||||||
|
limits
|
||||||
|
line
|
||||||
|
linked
|
||||||
|
list
|
||||||
|
load
|
||||||
|
loading
|
||||||
|
local
|
||||||
|
logger
|
||||||
|
login
|
||||||
|
logout
|
||||||
|
long
|
||||||
|
lookup
|
||||||
|
magistr
|
||||||
|
main
|
||||||
|
manage
|
||||||
|
manager
|
||||||
|
manual
|
||||||
|
map
|
||||||
|
mapped
|
||||||
|
mapper
|
||||||
|
mapping
|
||||||
|
maps
|
||||||
|
max
|
||||||
|
may
|
||||||
|
mdc
|
||||||
|
menu
|
||||||
|
merge
|
||||||
|
message
|
||||||
|
metric
|
||||||
|
min
|
||||||
|
minutes
|
||||||
|
missing
|
||||||
|
mobile
|
||||||
|
mode
|
||||||
|
modifying
|
||||||
|
multi
|
||||||
|
mutable
|
||||||
|
mutation
|
||||||
|
mvc
|
||||||
|
name
|
||||||
|
names
|
||||||
|
natural
|
||||||
|
nav
|
||||||
|
navigation
|
||||||
|
negative
|
||||||
|
new
|
||||||
|
next
|
||||||
|
normalize
|
||||||
|
not
|
||||||
|
noz
|
||||||
|
npe
|
||||||
|
null
|
||||||
|
number
|
||||||
|
object
|
||||||
|
observability
|
||||||
|
observer
|
||||||
|
only
|
||||||
|
open
|
||||||
|
ops
|
||||||
|
option
|
||||||
|
optional
|
||||||
|
options
|
||||||
|
order
|
||||||
|
otel
|
||||||
|
otlp
|
||||||
|
outside
|
||||||
|
overlap
|
||||||
|
overlaps
|
||||||
|
overlay
|
||||||
|
override
|
||||||
|
overrides
|
||||||
|
page
|
||||||
|
parity
|
||||||
|
parse
|
||||||
|
password
|
||||||
|
per
|
||||||
|
period
|
||||||
|
persist
|
||||||
|
pipeline
|
||||||
|
platform
|
||||||
|
post
|
||||||
|
postgre
|
||||||
|
postgres
|
||||||
|
practice
|
||||||
|
pre
|
||||||
|
prefixes
|
||||||
|
primary
|
||||||
|
prime
|
||||||
|
print
|
||||||
|
process
|
||||||
|
production
|
||||||
|
profile
|
||||||
|
profiles
|
||||||
|
progress
|
||||||
|
properties
|
||||||
|
provider
|
||||||
|
proxmox
|
||||||
|
proxy
|
||||||
|
public
|
||||||
|
put
|
||||||
|
query
|
||||||
|
random
|
||||||
|
range
|
||||||
|
raw
|
||||||
|
reason
|
||||||
|
rebuild
|
||||||
|
record
|
||||||
|
red
|
||||||
|
redirect
|
||||||
|
refresh
|
||||||
|
registry
|
||||||
|
reject
|
||||||
|
rejects
|
||||||
|
remains
|
||||||
|
remove
|
||||||
|
render
|
||||||
|
rendered
|
||||||
|
replace
|
||||||
|
replay
|
||||||
|
repository
|
||||||
|
request
|
||||||
|
requested
|
||||||
|
requests
|
||||||
|
require
|
||||||
|
resolve
|
||||||
|
response
|
||||||
|
rest
|
||||||
|
restore
|
||||||
|
retention
|
||||||
|
reveal
|
||||||
|
review
|
||||||
|
reviewed
|
||||||
|
revoke
|
||||||
|
revoked
|
||||||
|
revokes
|
||||||
|
ripple
|
||||||
|
role
|
||||||
|
roles
|
||||||
|
room
|
||||||
|
rotate
|
||||||
|
rotated
|
||||||
|
rotates
|
||||||
|
rotation
|
||||||
|
routes
|
||||||
|
routing
|
||||||
|
rule
|
||||||
|
rules
|
||||||
|
run
|
||||||
|
runbook
|
||||||
|
runbooks
|
||||||
|
runner
|
||||||
|
same
|
||||||
|
save
|
||||||
|
schedule
|
||||||
|
scheduled
|
||||||
|
scheduling
|
||||||
|
scope
|
||||||
|
scopes
|
||||||
|
script
|
||||||
|
search
|
||||||
|
sec
|
||||||
|
secondary
|
||||||
|
secret
|
||||||
|
section
|
||||||
|
sections
|
||||||
|
secure
|
||||||
|
select
|
||||||
|
selectable
|
||||||
|
selection
|
||||||
|
semester
|
||||||
|
semesters
|
||||||
|
september
|
||||||
|
serializable
|
||||||
|
service
|
||||||
|
servlet
|
||||||
|
session
|
||||||
|
set
|
||||||
|
settings
|
||||||
|
sha
|
||||||
|
short
|
||||||
|
show
|
||||||
|
sidebar
|
||||||
|
sig
|
||||||
|
signature
|
||||||
|
single
|
||||||
|
size
|
||||||
|
skill
|
||||||
|
skips
|
||||||
|
slot
|
||||||
|
slots
|
||||||
|
sort
|
||||||
|
sorted
|
||||||
|
source
|
||||||
|
spa
|
||||||
|
speciality
|
||||||
|
specialties
|
||||||
|
specialty
|
||||||
|
split
|
||||||
|
spring
|
||||||
|
sql
|
||||||
|
start
|
||||||
|
started
|
||||||
|
starts
|
||||||
|
state
|
||||||
|
status
|
||||||
|
storage
|
||||||
|
store
|
||||||
|
stores
|
||||||
|
string
|
||||||
|
structure
|
||||||
|
student
|
||||||
|
study
|
||||||
|
style
|
||||||
|
subgroup
|
||||||
|
subgroups
|
||||||
|
subject
|
||||||
|
subjects
|
||||||
|
success
|
||||||
|
such
|
||||||
|
sum
|
||||||
|
summarize
|
||||||
|
summary
|
||||||
|
superclass
|
||||||
|
switch
|
||||||
|
sync
|
||||||
|
system
|
||||||
|
tab
|
||||||
|
table
|
||||||
|
tabs
|
||||||
|
target
|
||||||
|
targets
|
||||||
|
teacher
|
||||||
|
teachers
|
||||||
|
telemetry
|
||||||
|
tenant
|
||||||
|
tenants
|
||||||
|
test
|
||||||
|
text
|
||||||
|
than
|
||||||
|
theme
|
||||||
|
theory
|
||||||
|
thread
|
||||||
|
time
|
||||||
|
title
|
||||||
|
tls
|
||||||
|
toast
|
||||||
|
toggle
|
||||||
|
token
|
||||||
|
too
|
||||||
|
touch
|
||||||
|
trace
|
||||||
|
transaction
|
||||||
|
transactional
|
||||||
|
transfer
|
||||||
|
trigger
|
||||||
|
trim
|
||||||
|
trust
|
||||||
|
ttl
|
||||||
|
two
|
||||||
|
type
|
||||||
|
types
|
||||||
|
unauthorized
|
||||||
|
unavailable
|
||||||
|
unexpected
|
||||||
|
unified
|
||||||
|
university
|
||||||
|
unsupported
|
||||||
|
update
|
||||||
|
updated
|
||||||
|
updater
|
||||||
|
url
|
||||||
|
use
|
||||||
|
user
|
||||||
|
username
|
||||||
|
users
|
||||||
|
uses
|
||||||
|
utils
|
||||||
|
valid
|
||||||
|
validate
|
||||||
|
validation
|
||||||
|
validity
|
||||||
|
value
|
||||||
|
view
|
||||||
|
watch
|
||||||
|
watcher
|
||||||
|
web
|
||||||
|
week
|
||||||
|
weeks
|
||||||
|
when
|
||||||
|
whole
|
||||||
|
with
|
||||||
|
without
|
||||||
|
workflow
|
||||||
|
workload
|
||||||
|
workspace
|
||||||
|
write
|
||||||
|
xss
|
||||||
|
year
|
||||||
|
years
|
||||||
|
zero
|
||||||
|
zone
|
||||||
|
zuev
|
||||||
|
автоматическая
|
||||||
|
авторизации
|
||||||
|
адаптивная
|
||||||
|
админ
|
||||||
|
администратора
|
||||||
|
администрирование
|
||||||
|
активностей
|
||||||
|
алексеевич
|
||||||
|
архивация
|
||||||
|
архитектура
|
||||||
|
аудит
|
||||||
|
аудитории
|
||||||
|
аудиторным
|
||||||
|
аутентификации
|
||||||
|
баз
|
||||||
|
базы
|
||||||
|
безопасный
|
||||||
|
быстрый
|
||||||
|
валидация
|
||||||
|
видимости
|
||||||
|
визуальное
|
||||||
|
владения
|
||||||
|
внешняя
|
||||||
|
возврат
|
||||||
|
времени
|
||||||
|
временной
|
||||||
|
временных
|
||||||
|
вуза
|
||||||
|
входа
|
||||||
|
выбор
|
||||||
|
выхода
|
||||||
|
генерации
|
||||||
|
глобальный
|
||||||
|
годами
|
||||||
|
годового
|
||||||
|
гонка
|
||||||
|
границ
|
||||||
|
график
|
||||||
|
графика
|
||||||
|
групп
|
||||||
|
группами
|
||||||
|
группе
|
||||||
|
группы
|
||||||
|
данных
|
||||||
|
дашборд
|
||||||
|
дашборда
|
||||||
|
действия
|
||||||
|
деплоя
|
||||||
|
диалог
|
||||||
|
дизайн
|
||||||
|
динамические
|
||||||
|
динамического
|
||||||
|
динамическое
|
||||||
|
дисциплин
|
||||||
|
дисциплинам
|
||||||
|
дисциплинами
|
||||||
|
дисциплине
|
||||||
|
для
|
||||||
|
дневная
|
||||||
|
документации
|
||||||
|
документация
|
||||||
|
доставка
|
||||||
|
егор
|
||||||
|
жизненного
|
||||||
|
заглушка
|
||||||
|
загруженности
|
||||||
|
загрузка
|
||||||
|
задачи
|
||||||
|
замены
|
||||||
|
занятий
|
||||||
|
заявка
|
||||||
|
заявок
|
||||||
|
зуев
|
||||||
|
идентификатор
|
||||||
|
изоляции
|
||||||
|
импорте
|
||||||
|
индекс
|
||||||
|
индикатор
|
||||||
|
инженера
|
||||||
|
инженерная
|
||||||
|
интерфейса
|
||||||
|
инфраструктура
|
||||||
|
инфраструктуре
|
||||||
|
инфраструктуры
|
||||||
|
инцидентах
|
||||||
|
кабинет
|
||||||
|
кабинета
|
||||||
|
как
|
||||||
|
календарного
|
||||||
|
календарный
|
||||||
|
календарю
|
||||||
|
календаря
|
||||||
|
карта
|
||||||
|
кастомного
|
||||||
|
кафедрам
|
||||||
|
кафедрами
|
||||||
|
кафедре
|
||||||
|
кафедры
|
||||||
|
кластер
|
||||||
|
клиент
|
||||||
|
клиента
|
||||||
|
коды
|
||||||
|
комментарии
|
||||||
|
компонентов
|
||||||
|
конструктор
|
||||||
|
контекст
|
||||||
|
конфигурации
|
||||||
|
конфликта
|
||||||
|
конфликтов
|
||||||
|
концепция
|
||||||
|
лабораторных
|
||||||
|
логирования
|
||||||
|
магистр
|
||||||
|
маршрут
|
||||||
|
меню
|
||||||
|
миграции
|
||||||
|
миграций
|
||||||
|
модальное
|
||||||
|
модель
|
||||||
|
мониторинг
|
||||||
|
мультиселект
|
||||||
|
мультитенантная
|
||||||
|
мышление
|
||||||
|
наблюдаемость
|
||||||
|
навигация
|
||||||
|
навык
|
||||||
|
нагрузки
|
||||||
|
назначение
|
||||||
|
назначения
|
||||||
|
настроек
|
||||||
|
настройки
|
||||||
|
нативный
|
||||||
|
начала
|
||||||
|
небезопасные
|
||||||
|
недели
|
||||||
|
недельная
|
||||||
|
неизменяемости
|
||||||
|
нового
|
||||||
|
обертка
|
||||||
|
обзор
|
||||||
|
области
|
||||||
|
область
|
||||||
|
обновления
|
||||||
|
оболочка
|
||||||
|
оборудования
|
||||||
|
обоснование
|
||||||
|
образа
|
||||||
|
образов
|
||||||
|
обучения
|
||||||
|
общих
|
||||||
|
обязательная
|
||||||
|
ограничения
|
||||||
|
окно
|
||||||
|
отдела
|
||||||
|
отказоустойчивая
|
||||||
|
отказоустойчивость
|
||||||
|
ошибок
|
||||||
|
панели
|
||||||
|
панель
|
||||||
|
пар
|
||||||
|
паттерн
|
||||||
|
переменная
|
||||||
|
пересечения
|
||||||
|
переход
|
||||||
|
подгруппами
|
||||||
|
подгруппы
|
||||||
|
подключениями
|
||||||
|
подключенных
|
||||||
|
политика
|
||||||
|
пользователя
|
||||||
|
пользователями
|
||||||
|
порядок
|
||||||
|
права
|
||||||
|
правил
|
||||||
|
правила
|
||||||
|
правило
|
||||||
|
практика
|
||||||
|
представления
|
||||||
|
предупреждений
|
||||||
|
преподавателей
|
||||||
|
преподавателя
|
||||||
|
при
|
||||||
|
привязка
|
||||||
|
привязки
|
||||||
|
принципы
|
||||||
|
пробел
|
||||||
|
проверка
|
||||||
|
проверки
|
||||||
|
провижининг
|
||||||
|
проекта
|
||||||
|
проектной
|
||||||
|
проектный
|
||||||
|
просмотр
|
||||||
|
просмотра
|
||||||
|
против
|
||||||
|
профилями
|
||||||
|
публикации
|
||||||
|
рабочая
|
||||||
|
разработке
|
||||||
|
разработчика
|
||||||
|
разрешение
|
||||||
|
раскладка
|
||||||
|
расписание
|
||||||
|
расписаний
|
||||||
|
расписания
|
||||||
|
реализация
|
||||||
|
регламент
|
||||||
|
редактор
|
||||||
|
редирект
|
||||||
|
результаты
|
||||||
|
резюме
|
||||||
|
риск
|
||||||
|
рисков
|
||||||
|
ролевая
|
||||||
|
ролей
|
||||||
|
роли
|
||||||
|
ротации
|
||||||
|
роутинг
|
||||||
|
руководство
|
||||||
|
русского
|
||||||
|
ручной
|
||||||
|
сборки
|
||||||
|
связи
|
||||||
|
секрета
|
||||||
|
семестрами
|
||||||
|
семестров
|
||||||
|
сервис
|
||||||
|
сетка
|
||||||
|
сетки
|
||||||
|
сеть
|
||||||
|
синхронизация
|
||||||
|
система
|
||||||
|
системы
|
||||||
|
слой
|
||||||
|
слота
|
||||||
|
слотов
|
||||||
|
создания
|
||||||
|
состояние
|
||||||
|
специальностями
|
||||||
|
справочник
|
||||||
|
старта
|
||||||
|
стартап
|
||||||
|
стек
|
||||||
|
стилизации
|
||||||
|
страница
|
||||||
|
странице
|
||||||
|
страницы
|
||||||
|
структура
|
||||||
|
студента
|
||||||
|
схема
|
||||||
|
таблица
|
||||||
|
таблицы
|
||||||
|
тега
|
||||||
|
текущих
|
||||||
|
тенанта
|
||||||
|
тенантами
|
||||||
|
тенантов
|
||||||
|
тенанты
|
||||||
|
токенов
|
||||||
|
умное
|
||||||
|
университетов
|
||||||
|
университетского
|
||||||
|
управление
|
||||||
|
устойчивость
|
||||||
|
утечка
|
||||||
|
учебного
|
||||||
|
учебный
|
||||||
|
учебными
|
||||||
|
файлов
|
||||||
|
фильтр
|
||||||
|
фильтры
|
||||||
|
фондом
|
||||||
|
форма
|
||||||
|
формами
|
||||||
|
форме
|
||||||
|
фронтенда
|
||||||
|
хосты
|
||||||
|
центр
|
||||||
|
цикла
|
||||||
|
часы
|
||||||
|
чекбоксами
|
||||||
|
через
|
||||||
|
экспорт
|
||||||
|
эндпоинта
|
||||||
|
эндпоинты
|
||||||
|
эстетики
|
||||||
|
языка
|
||||||
|
ячейки
|
||||||
713
graphify-out/GRAPH_REPORT.md
Normal file
713
graphify-out/GRAPH_REPORT.md
Normal file
@@ -0,0 +1,713 @@
|
|||||||
|
# Graph Report - . (2026-07-04)
|
||||||
|
|
||||||
|
## Corpus Check
|
||||||
|
- 242 files · ~107,825 words
|
||||||
|
- Verdict: corpus is large enough that graph structure adds value.
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
- 2675 nodes · 6377 edges · 135 communities (127 shown, 8 thin omitted)
|
||||||
|
- Extraction: 87% EXTRACTED · 13% INFERRED · 0% AMBIGUOUS · INFERRED: 801 edges (avg confidence: 0.81)
|
||||||
|
- Token cost: 0 input · 0 output
|
||||||
|
|
||||||
|
## Community Hubs (Navigation)
|
||||||
|
- [[_COMMUNITY_Модель расписание override|Модель расписание override]]
|
||||||
|
- [[_COMMUNITY_Сервис расписание Query|Сервис расписание Query]]
|
||||||
|
- [[_COMMUNITY_Модель преподаватели создание|Модель преподаватели создание]]
|
||||||
|
- [[_COMMUNITY_Контроллер расписание правила Админ|Контроллер расписание правила Админ]]
|
||||||
|
- [[_COMMUNITY_Модель дисциплины комментарии|Модель дисциплины комментарии]]
|
||||||
|
- [[_COMMUNITY_Модель Авторизация refresh токены|Модель Авторизация refresh токены]]
|
||||||
|
- [[_COMMUNITY_Модель расписание правила|Модель расписание правила]]
|
||||||
|
- [[_COMMUNITY_Контроллер преподаватели дисциплины|Контроллер преподаватели дисциплины]]
|
||||||
|
- [[_COMMUNITY_Контроллер подгруппы|Контроллер подгруппы]]
|
||||||
|
- [[_COMMUNITY_расписание экран|расписание экран]]
|
||||||
|
- [[_COMMUNITY_Модель пользователи|Модель пользователи]]
|
||||||
|
- [[_COMMUNITY_Конфигурация Авторизация Interceptor|Конфигурация Авторизация Interceptor]]
|
||||||
|
- [[_COMMUNITY_Контроллер пользователи|Контроллер пользователи]]
|
||||||
|
- [[_COMMUNITY_Сервис расписание Generator|Сервис расписание Generator]]
|
||||||
|
- [[_COMMUNITY_расписание|расписание]]
|
||||||
|
- [[_COMMUNITY_Контроллер Учебный календарь Админ|Контроллер Учебный календарь Админ]]
|
||||||
|
- [[_COMMUNITY_Модель занятия Type|Модель занятия Type]]
|
||||||
|
- [[_COMMUNITY_Модель преподаватели кафедры Assignment|Модель преподаватели кафедры Assignment]]
|
||||||
|
- [[_COMMUNITY_Модель студенты группы|Модель студенты группы]]
|
||||||
|
- [[_COMMUNITY_Контроллер Учебный календарь|Контроллер Учебный календарь]]
|
||||||
|
- [[_COMMUNITY_Модель Учебный календарь дисциплины|Модель Учебный календарь дисциплины]]
|
||||||
|
- [[_COMMUNITY_Контроллер Speciality|Контроллер Speciality]]
|
||||||
|
- [[_COMMUNITY_Контроллер кафедры кабинет|Контроллер кафедры кабинет]]
|
||||||
|
- [[_COMMUNITY_Контроллер Авторизация|Контроллер Авторизация]]
|
||||||
|
- [[_COMMUNITY_Модель кафедры|Модель кафедры]]
|
||||||
|
- [[_COMMUNITY_Контроллер группы|Контроллер группы]]
|
||||||
|
- [[_COMMUNITY_Контроллер аудитории|Контроллер аудитории]]
|
||||||
|
- [[_COMMUNITY_Модель Lifecycle сущность|Модель Lifecycle сущность]]
|
||||||
|
- [[_COMMUNITY_кафедры кабинет контроллер Test|кафедры кабинет контроллер Test]]
|
||||||
|
- [[_COMMUNITY_Контроллер Education формы|Контроллер Education формы]]
|
||||||
|
- [[_COMMUNITY_DTO аудитории|DTO аудитории]]
|
||||||
|
- [[_COMMUNITY_DTO группы|DTO группы]]
|
||||||
|
- [[_COMMUNITY_main|main]]
|
||||||
|
- [[_COMMUNITY_Модель специальности профили|Модель специальности профили]]
|
||||||
|
- [[_COMMUNITY_Модель время слоты Scope|Модель время слоты Scope]]
|
||||||
|
- [[_COMMUNITY_Модель Semester|Модель Semester]]
|
||||||
|
- [[_COMMUNITY_Модель Speciality|Модель Speciality]]
|
||||||
|
- [[_COMMUNITY_Модель аудитории|Модель аудитории]]
|
||||||
|
- [[_COMMUNITY_Сервис студенты группы Lifecycle|Сервис студенты группы Lifecycle]]
|
||||||
|
- [[_COMMUNITY_JWT токены сервис Test|JWT токены сервис Test]]
|
||||||
|
- [[_COMMUNITY_Модель Учебный календарь Activity|Модель Учебный календарь Activity]]
|
||||||
|
- [[_COMMUNITY_Контроллер время слоты Админ|Контроллер время слоты Админ]]
|
||||||
|
- [[_COMMUNITY_Модель время слоты Date|Модель время слоты Date]]
|
||||||
|
- [[_COMMUNITY_Модель Учебный Year|Модель Учебный Year]]
|
||||||
|
- [[_COMMUNITY_Модель студенты группы календарь|Модель студенты группы календарь]]
|
||||||
|
- [[_COMMUNITY_DTO Create кафедры|DTO Create кафедры]]
|
||||||
|
- [[_COMMUNITY_DTO Create группы|DTO Create группы]]
|
||||||
|
- [[_COMMUNITY_Конфигурация тенанты конфигурация|Конфигурация тенанты конфигурация]]
|
||||||
|
- [[_COMMUNITY_Контроллер Global Exception Handler|Контроллер Global Exception Handler]]
|
||||||
|
- [[_COMMUNITY_Модель Учебный календарь Day|Модель Учебный календарь Day]]
|
||||||
|
- [[_COMMUNITY_Контроллер расписание правила Админ|Контроллер расписание правила Админ]]
|
||||||
|
- [[_COMMUNITY_Контроллер БД|Контроллер БД]]
|
||||||
|
- [[_COMMUNITY_Модель время слоты|Модель время слоты]]
|
||||||
|
- [[_COMMUNITY_DTO аудитории|DTO аудитории]]
|
||||||
|
- [[_COMMUNITY_Конфигурация тенанты конфигурация Watcher|Конфигурация тенанты конфигурация Watcher]]
|
||||||
|
- [[_COMMUNITY_DTO Login|DTO Login]]
|
||||||
|
- [[_COMMUNITY_main|main]]
|
||||||
|
- [[_COMMUNITY_DTO пользователи|DTO пользователи]]
|
||||||
|
- [[_COMMUNITY_Утилиты Course And Semester|Утилиты Course And Semester]]
|
||||||
|
- [[_COMMUNITY_DTO Create пользователи|DTO Create пользователи]]
|
||||||
|
- [[_COMMUNITY_SCHEDULE TASKS|SCHEDULE TASKS]]
|
||||||
|
- [[_COMMUNITY_Конфигурация JWT Properties|Конфигурация JWT Properties]]
|
||||||
|
- [[_COMMUNITY_Контроллер дисциплины|Контроллер дисциплины]]
|
||||||
|
- [[_COMMUNITY_Контроллер время слоты Админ|Контроллер время слоты Админ]]
|
||||||
|
- [[_COMMUNITY_DTO Review преподаватели создание|DTO Review преподаватели создание]]
|
||||||
|
- [[_COMMUNITY_Модель Учебный календарь|Модель Учебный календарь]]
|
||||||
|
- [[_COMMUNITY_API|API]]
|
||||||
|
- [[_COMMUNITY_Конфигурация тенанты Context|Конфигурация тенанты Context]]
|
||||||
|
- [[_COMMUNITY_Конфигурация тенанты данные источник|Конфигурация тенанты данные источник]]
|
||||||
|
- [[_COMMUNITY_DevOps инфраструктура|DevOps инфраструктура]]
|
||||||
|
- [[_COMMUNITY_ACADEMIC CALENDAR|ACADEMIC CALENDAR]]
|
||||||
|
- [[_COMMUNITY_кафедры кабинет|кафедры кабинет]]
|
||||||
|
- [[_COMMUNITY_Конфигурация тенанты Routing данные|Конфигурация тенанты Routing данные]]
|
||||||
|
- [[_COMMUNITY_Репозиторий время слоты Scope|Репозиторий время слоты Scope]]
|
||||||
|
- [[_COMMUNITY_DTO Create преподаватели создание|DTO Create преподаватели создание]]
|
||||||
|
- [[_COMMUNITY_Модель подгруппы|Модель подгруппы]]
|
||||||
|
- [[_COMMUNITY_Репозиторий Учебный календарь Day|Репозиторий Учебный календарь Day]]
|
||||||
|
- [[_COMMUNITY_index|index]]
|
||||||
|
- [[_COMMUNITY_кафедры кабинет|кафедры кабинет]]
|
||||||
|
- [[_COMMUNITY_index|index]]
|
||||||
|
- [[_COMMUNITY_Проектные навыки|Проектные навыки]]
|
||||||
|
- [[_COMMUNITY_Конфигурация конфигурация Updater|Конфигурация конфигурация Updater]]
|
||||||
|
- [[_COMMUNITY_Модель оборудование|Модель оборудование]]
|
||||||
|
- [[_COMMUNITY_DTO Create дисциплины|DTO Create дисциплины]]
|
||||||
|
- [[_COMMUNITY_Аудит рисков|Аудит рисков]]
|
||||||
|
- [[_COMMUNITY_UI COMPONENTS|UI COMPONENTS]]
|
||||||
|
- [[_COMMUNITY_Контроллер аудитории|Контроллер аудитории]]
|
||||||
|
- [[_COMMUNITY_Контроллер расписание правила Админ|Контроллер расписание правила Админ]]
|
||||||
|
- [[_COMMUNITY_Модель Education формы|Модель Education формы]]
|
||||||
|
- [[_COMMUNITY_аудитории нагрузка|аудитории нагрузка]]
|
||||||
|
- [[_COMMUNITY_вуз структура|вуз структура]]
|
||||||
|
- [[_COMMUNITY_Контроллер Учебный календарь Админ|Контроллер Учебный календарь Админ]]
|
||||||
|
- [[_COMMUNITY_DTO группы календарь Assignment|DTO группы календарь Assignment]]
|
||||||
|
- [[_COMMUNITY_DTO кафедры|DTO кафедры]]
|
||||||
|
- [[_COMMUNITY_Сервис Учебный Date|Сервис Учебный Date]]
|
||||||
|
- [[_COMMUNITY_Репозиторий Учебный календарь Activity|Репозиторий Учебный календарь Activity]]
|
||||||
|
- [[_COMMUNITY_DTO Speciality|DTO Speciality]]
|
||||||
|
- [[_COMMUNITY_Репозиторий расписание правила|Репозиторий расписание правила]]
|
||||||
|
- [[_COMMUNITY_Репозиторий время слоты|Репозиторий время слоты]]
|
||||||
|
- [[_COMMUNITY_index|index]]
|
||||||
|
- [[_COMMUNITY_script|script]]
|
||||||
|
- [[_COMMUNITY_Проектный регламент|Проектный регламент]]
|
||||||
|
- [[_COMMUNITY_Контроллер Учебный календарь|Контроллер Учебный календарь]]
|
||||||
|
- [[_COMMUNITY_DTO дисциплины|DTO дисциплины]]
|
||||||
|
- [[_COMMUNITY_DTO преподаватели дисциплины|DTO преподаватели дисциплины]]
|
||||||
|
- [[_COMMUNITY_Модель преподаватели дисциплины Id|Модель преподаватели дисциплины Id]]
|
||||||
|
- [[_COMMUNITY_Репозиторий Учебный календарь|Репозиторий Учебный календарь]]
|
||||||
|
- [[_COMMUNITY_dropdown|dropdown]]
|
||||||
|
- [[_COMMUNITY_index|index]]
|
||||||
|
- [[_COMMUNITY_FRONTEND|FRONTEND]]
|
||||||
|
- [[_COMMUNITY_CICD workflow|CI/CD workflow]]
|
||||||
|
- [[_COMMUNITY_DTO Create Speciality|DTO Create Speciality]]
|
||||||
|
- [[_COMMUNITY_DTO Login|DTO Login]]
|
||||||
|
- [[_COMMUNITY_index|index]]
|
||||||
|
- [[_COMMUNITY_index|index]]
|
||||||
|
- [[_COMMUNITY_Контроллер время слоты Админ|Контроллер время слоты Админ]]
|
||||||
|
- [[_COMMUNITY_тенанты конфигурация Watcher Test|тенанты конфигурация Watcher Test]]
|
||||||
|
- [[_COMMUNITY_Аудит рисков|Аудит рисков]]
|
||||||
|
- [[_COMMUNITY_время слоты|время слоты]]
|
||||||
|
- [[_COMMUNITY_script|script]]
|
||||||
|
- [[_COMMUNITY_Конфигурация App конфигурация|Конфигурация App конфигурация]]
|
||||||
|
- [[_COMMUNITY_нагрузка контроллер Test|нагрузка контроллер Test]]
|
||||||
|
- [[_COMMUNITY_Docker Compose|Docker Compose]]
|
||||||
|
- [[_COMMUNITY_дашборд|дашборд]]
|
||||||
|
- [[_COMMUNITY_index|index]]
|
||||||
|
- [[_COMMUNITY_Проектные навыки|Проектные навыки]]
|
||||||
|
- [[_COMMUNITY_index|index]]
|
||||||
|
- [[_COMMUNITY_index|index]]
|
||||||
|
- [[_COMMUNITY_Конфигурация refresh токены Rotation|Конфигурация refresh токены Rotation]]
|
||||||
|
- [[_COMMUNITY_Аудит рисков|Аудит рисков]]
|
||||||
|
- [[_COMMUNITY_otel|otel]]
|
||||||
|
- [[_COMMUNITY_Аудит рисков|Аудит рисков]]
|
||||||
|
- [[_COMMUNITY_DevOps инфраструктура|DevOps инфраструктура]]
|
||||||
|
- [[_COMMUNITY_pom|pom]]
|
||||||
|
|
||||||
|
## God Nodes (most connected - your core abstractions)
|
||||||
|
1. `ScheduleRule` - 75 edges
|
||||||
|
2. `User` - 74 edges
|
||||||
|
3. `StudentGroup` - 72 edges
|
||||||
|
4. `RequireRoles` - 68 edges
|
||||||
|
5. `ScheduleRuleSlot` - 67 edges
|
||||||
|
6. `ScheduleRuleAdminController` - 59 edges
|
||||||
|
7. `ScheduleGeneratorService` - 51 edges
|
||||||
|
8. `TeacherCreationRequest` - 44 edges
|
||||||
|
9. `AcademicCalendar` - 43 edges
|
||||||
|
10. `Classroom` - 41 edges
|
||||||
|
|
||||||
|
## Surprising Connections (you probably didn't know these)
|
||||||
|
- `Динамическое управление тенантами через ConfigMap` --semantically_similar_to--> `Tenants ConfigMap` [INFERRED] [semantically similar]
|
||||||
|
DEVOPS.md → docs/INFRASTRUCTURE.md
|
||||||
|
- `Паттерн database-per-tenant` --semantically_similar_to--> `Мультитенантная архитектура` [INFERRED] [semantically similar]
|
||||||
|
DEVOPS.md → docs/ARCHITECTURE.md
|
||||||
|
- `CI/CD через Gitea Actions` --semantically_similar_to--> `CI/CD Gitea Actions в инфраструктуре` [INFERRED] [semantically similar]
|
||||||
|
DEVOPS.md → docs/INFRASTRUCTURE.md
|
||||||
|
- `Наблюдаемость SigNoz и OpenTelemetry` --semantically_similar_to--> `OTLP экспорт в SigNoz` [INFERRED] [semantically similar]
|
||||||
|
DEVOPS.md → docs/LOGGING.md
|
||||||
|
- `Навык frontend-design` --semantically_similar_to--> `CSS-архитектура` [INFERRED] [semantically similar]
|
||||||
|
.agents/skills/frontend-design/SKILL.md → docs/FRONTEND.md
|
||||||
|
|
||||||
|
## Import Cycles
|
||||||
|
- None detected.
|
||||||
|
|
||||||
|
## Hyperedges (group relationships)
|
||||||
|
- **Документация динамического расписания** — docs_business_logic_dynamic_schedule_model, docs_api_dynamic_schedule_endpoints, docs_database_dynamic_schedule_tables, docs_academic_calendar_calendar_model, docs_frontend_schedule_views, docs_dynamic_schedule_implementation_dynamic_schedule_implementation, docs_schedule_proposal_dynamic_schedule_concept [INFERRED 0.85]
|
||||||
|
- **Паттерн мультитенантной инфраструктуры** — docs_architecture_multitenant_architecture, devops_database_per_tenant_pattern, docs_infrastructure_tenants_configmap, compose_db_service, docs_logging_tenant_mdc_context [INFERRED 0.85]
|
||||||
|
- **Политика ведения документации** — agents_project_regulation, _agents_skills_autoupdatedocs_autoupdatedocs_skill, docs_development_flyway_rules, docs_database_flyway_migrations [EXTRACTED 1.00]
|
||||||
|
- **Маршруты админской SPA** — frontend_admin_index_admin_spa_shell, frontend_admin_index_sidebar_navigation, frontend_admin_views_dashboard_dashboard_view, frontend_admin_views_teacher_requests_teacher_requests_admin_view, frontend_admin_views_department_workspace_department_workspace_view, frontend_admin_views_schedule_schedule_rule_constructor, frontend_admin_views_academic_calendar_academic_calendar_view, frontend_admin_views_auditorium_workload_workload_view, frontend_admin_views_schedule_view_schedule_view_shell, frontend_admin_views_classrooms_classroom_management, frontend_admin_views_groups_group_management, frontend_admin_views_university_structure_university_structure_view, frontend_admin_views_subjects_subject_management, frontend_admin_views_users_user_management [INFERRED 0.95]
|
||||||
|
- **Маршруты SPA настроек** — frontend_admin_settings_index_settings_spa_shell, frontend_admin_settings_index_settings_navigation, frontend_admin_settings_views_general_general_settings_placeholder, frontend_admin_settings_views_time_slots_time_slots_settings, frontend_admin_settings_views_edu_forms_education_forms_management, frontend_admin_settings_views_database_tenant_connection_management [INFERRED 0.95]
|
||||||
|
- **Рабочий контур генерации расписания** — docs_schedule_tasks_dynamic_schedule_tasks, docs_schedule_tasks_daily_academic_calendar_grid, docs_schedule_tasks_group_calendar_assignment, frontend_admin_views_academic_calendar_academic_calendar_view, frontend_admin_views_groups_group_management, frontend_admin_views_schedule_schedule_rule_constructor, frontend_admin_views_schedule_view_schedule_view_shell, frontend_admin_settings_views_time_slots_time_slots_settings [INFERRED 0.85]
|
||||||
|
- **Общий сценарий просмотра недельного расписания** — frontend_student_index_loadschedule, frontend_student_index_renderweek, frontend_teacher_index_loadschedule, frontend_teacher_index_renderweek, frontend_edu_office_index_admin_schedule_view_route [INFERRED 0.85]
|
||||||
|
- **Общий браузерный поток авторизации** — frontend_student_index_fetchjson, frontend_student_index_refreshaccesstoken, frontend_student_index_logout, frontend_teacher_index_fetchjson, frontend_teacher_index_refreshaccesstoken, frontend_teacher_index_logout [INFERRED 0.95]
|
||||||
|
- **Цепочка DevOps-доставки в резюме** — resume_index_kubernetes_k3s_delivery, resume_index_dynamic_tenants_configmap, resume_index_gitea_actions_cicd, resume_index_opentelemetry_signoz_observability, resume_index_database_per_tenant [EXTRACTED 1.00]
|
||||||
|
|
||||||
|
## Communities (135 total, 8 thin omitted)
|
||||||
|
|
||||||
|
### Community 0 - "Модель расписание override"
|
||||||
|
Cohesion: 0.05
|
||||||
|
Nodes (35): DeleteMapping, Long, Map, PostMapping, ResponseEntity, String, DeleteMapping, GetMapping (+27 more)
|
||||||
|
|
||||||
|
### Community 1 - "Сервис расписание Query"
|
||||||
|
Cohesion: 0.06
|
||||||
|
Nodes (44): GetMapping, LocalDate, Logger, Long, RequestMapping, ResponseEntity, RestController, ScheduleController (+36 more)
|
||||||
|
|
||||||
|
### Community 2 - "Модель преподаватели создание"
|
||||||
|
Cohesion: 0.06
|
||||||
|
Nodes (27): BCryptPasswordEncoder, GetMapping, List, Long, PostMapping, RequestMapping, ResponseEntity, RestController (+19 more)
|
||||||
|
|
||||||
|
### Community 3 - "Контроллер расписание правила Админ"
|
||||||
|
Cohesion: 0.08
|
||||||
|
Nodes (18): Collection, Integer, LinkedHashSet, Long, Map, RequestMapping, RestController, Set (+10 more)
|
||||||
|
|
||||||
|
### Community 4 - "Модель дисциплины комментарии"
|
||||||
|
Cohesion: 0.05
|
||||||
|
Nodes (25): LocalDateTime, Long, String, SubjectCommentDto, Entity, Long, String, Table (+17 more)
|
||||||
|
|
||||||
|
### Community 5 - "Модель Авторизация refresh токены"
|
||||||
|
Cohesion: 0.10
|
||||||
|
Nodes (18): Optional, Service, String, Transactional, RefreshTokenService, AuthRefreshToken, Entity, LocalDateTime (+10 more)
|
||||||
|
|
||||||
|
### Community 6 - "Модель расписание правила"
|
||||||
|
Cohesion: 0.07
|
||||||
|
Nodes (14): GetMapping, List, Entity, Integer, JsonIgnore, LocalDate, Long, Set (+6 more)
|
||||||
|
|
||||||
|
### Community 7 - "Контроллер преподаватели дисциплины"
|
||||||
|
Cohesion: 0.08
|
||||||
|
Nodes (24): DeleteMapping, GetMapping, List, Long, Map, PostMapping, RequestMapping, ResponseEntity (+16 more)
|
||||||
|
|
||||||
|
### Community 8 - "Контроллер подгруппы"
|
||||||
|
Cohesion: 0.09
|
||||||
|
Nodes (25): DeleteMapping, GetMapping, Integer, List, Long, PostMapping, PutMapping, ResponseEntity (+17 more)
|
||||||
|
|
||||||
|
### Community 9 - "расписание экран"
|
||||||
|
Cohesion: 0.07
|
||||||
|
Nodes (31): initAuditoriumWorkload(), addDays(), buildCombinedWeekBlocks(), buildDatesByDay(), CELL_PARITY_LAYOUT, collectSlots(), compareSlots(), datesBetween() (+23 more)
|
||||||
|
|
||||||
|
### Community 10 - "Модель пользователи"
|
||||||
|
Cohesion: 0.08
|
||||||
|
Nodes (14): Role, Entity, Long, String, Table, User, List, Long (+6 more)
|
||||||
|
|
||||||
|
### Community 11 - "Конфигурация Авторизация Interceptor"
|
||||||
|
Cohesion: 0.09
|
||||||
|
Nodes (24): AuthorizationInterceptor, Component, Exception, HttpServletRequest, HttpServletResponse, Object, ObjectMapper, Override (+16 more)
|
||||||
|
|
||||||
|
### Community 12 - "Контроллер пользователи"
|
||||||
|
Cohesion: 0.10
|
||||||
|
Nodes (23): Long, BCryptPasswordEncoder, DeleteMapping, GetMapping, List, LocalDate, Logger, Long (+15 more)
|
||||||
|
|
||||||
|
### Community 13 - "Сервис расписание Generator"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (18): fromLessonType(), getDisplayName(), String, ScheduleLessonCategory, ActiveLessonScope, Integer, List, LocalDate (+10 more)
|
||||||
|
|
||||||
|
### Community 14 - "расписание"
|
||||||
|
Cohesion: 0.11
|
||||||
|
Nodes (18): api, ESCAPE_MAP, escapeHtml(), hideAlert(), showAlert(), DAY_OPTIONS, initAcademicCalendar(), SEMESTER_LABELS (+10 more)
|
||||||
|
|
||||||
|
### Community 15 - "Контроллер Учебный календарь Админ"
|
||||||
|
Cohesion: 0.13
|
||||||
|
Nodes (18): AcademicCalendarAdminController, DeleteMapping, Long, PostMapping, PutMapping, RequestMapping, ResponseEntity, RestController (+10 more)
|
||||||
|
|
||||||
|
### Community 16 - "Модель занятия Type"
|
||||||
|
Cohesion: 0.09
|
||||||
|
Nodes (18): GetMapping, List, RequestMapping, RestController, LessonTypeController, Long, String, LessonTypeResponse (+10 more)
|
||||||
|
|
||||||
|
### Community 17 - "Модель преподаватели кафедры Assignment"
|
||||||
|
Cohesion: 0.12
|
||||||
|
Nodes (13): Entity, LocalDate, LocalDateTime, Long, String, Table, TeacherDepartmentAssignment, List (+5 more)
|
||||||
|
|
||||||
|
### Community 18 - "Модель студенты группы"
|
||||||
|
Cohesion: 0.12
|
||||||
|
Nodes (12): Entity, Integer, Long, String, Table, StudentGroup, GroupRepository, List (+4 more)
|
||||||
|
|
||||||
|
### Community 19 - "Контроллер Учебный календарь"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (16): AcademicCalendarController, DeleteMapping, GetMapping, List, Long, PostMapping, PutMapping, RequestMapping (+8 more)
|
||||||
|
|
||||||
|
### Community 20 - "Модель Учебный календарь дисциплины"
|
||||||
|
Cohesion: 0.11
|
||||||
|
Nodes (14): AcademicCalendarSubjectDto, Integer, Long, String, AcademicCalendarSubject, Entity, Integer, Long (+6 more)
|
||||||
|
|
||||||
|
### Community 21 - "Контроллер Speciality"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (14): DeleteMapping, GetMapping, List, Logger, Long, PutMapping, RequestMapping, ResponseEntity (+6 more)
|
||||||
|
|
||||||
|
### Community 22 - "Контроллер кафедры кабинет"
|
||||||
|
Cohesion: 0.20
|
||||||
|
Nodes (13): DepartmentWorkspaceController, GetMapping, List, LocalDate, Long, Map, Object, PostMapping (+5 more)
|
||||||
|
|
||||||
|
### Community 23 - "Контроллер Авторизация"
|
||||||
|
Cohesion: 0.17
|
||||||
|
Nodes (13): AuthController, BCryptPasswordEncoder, GetMapping, HttpServletRequest, Map, Object, Optional, PostMapping (+5 more)
|
||||||
|
|
||||||
|
### Community 24 - "Модель кафедры"
|
||||||
|
Cohesion: 0.11
|
||||||
|
Nodes (14): DepartmentController, GetMapping, List, Logger, RequestMapping, RestController, Department, Entity (+6 more)
|
||||||
|
|
||||||
|
### Community 25 - "Контроллер группы"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (14): GroupController, DeleteMapping, GetMapping, List, Long, Map, PostMapping, PutMapping (+6 more)
|
||||||
|
|
||||||
|
### Community 26 - "Контроллер аудитории"
|
||||||
|
Cohesion: 0.11
|
||||||
|
Nodes (18): RequireRoles, ClassroomController, GetMapping, List, RequestMapping, RestController, EquipmentController, GetMapping (+10 more)
|
||||||
|
|
||||||
|
### Community 27 - "Модель Lifecycle сущность"
|
||||||
|
Cohesion: 0.14
|
||||||
|
Nodes (8): JsonIgnore, LocalDate, LocalDateTime, String, LifecycleEntity, Test, LifecycleEntityTest, MappedSuperclass
|
||||||
|
|
||||||
|
### Community 28 - "кафедры кабинет контроллер Test"
|
||||||
|
Cohesion: 0.11
|
||||||
|
Nodes (14): AuthContext, ThreadLocal, AuthenticatedUser, Long, String, Boolean, AuthControllerTest, AfterEach (+6 more)
|
||||||
|
|
||||||
|
### Community 29 - "Контроллер Education формы"
|
||||||
|
Cohesion: 0.11
|
||||||
|
Nodes (17): EducationFormController, DeleteMapping, GetMapping, List, Long, Map, Object, PostMapping (+9 more)
|
||||||
|
|
||||||
|
### Community 30 - "DTO аудитории"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (7): ClassroomResponse, Boolean, Integer, List, LocalDateTime, Long, String
|
||||||
|
|
||||||
|
### Community 31 - "DTO группы"
|
||||||
|
Cohesion: 0.14
|
||||||
|
Nodes (6): GroupResponse, Boolean, Integer, JsonInclude, Long, String
|
||||||
|
|
||||||
|
### Community 32 - "main"
|
||||||
|
Cohesion: 0.08
|
||||||
|
Nodes (24): allowedTabs, appContent, AUTHORIZED_ROLES, btnLogout, btnSettings, currentRole, hashTab, main (+16 more)
|
||||||
|
|
||||||
|
### Community 33 - "Модель специальности профили"
|
||||||
|
Cohesion: 0.12
|
||||||
|
Nodes (10): Entity, Long, String, Table, SpecialtyProfile, List, Long, Optional (+2 more)
|
||||||
|
|
||||||
|
### Community 34 - "Модель время слоты Scope"
|
||||||
|
Cohesion: 0.12
|
||||||
|
Nodes (9): PostMapping, Boolean, Entity, Integer, Long, String, Table, TimeSlotScope (+1 more)
|
||||||
|
|
||||||
|
### Community 35 - "Модель Semester"
|
||||||
|
Cohesion: 0.14
|
||||||
|
Nodes (11): Entity, LocalDate, Long, Table, Semester, SemesterType, List, LocalDate (+3 more)
|
||||||
|
|
||||||
|
### Community 36 - "Модель Speciality"
|
||||||
|
Cohesion: 0.14
|
||||||
|
Nodes (11): PostMapping, Entity, Long, String, Table, Speciality, List, Long (+3 more)
|
||||||
|
|
||||||
|
### Community 37 - "Модель аудитории"
|
||||||
|
Cohesion: 0.13
|
||||||
|
Nodes (8): Classroom, Boolean, Entity, Integer, Long, Set, String, Table
|
||||||
|
|
||||||
|
### Community 38 - "Сервис студенты группы Lifecycle"
|
||||||
|
Cohesion: 0.18
|
||||||
|
Nodes (11): getLabel(), String, StudentGroupStudyState, Integer, LocalDate, Optional, Service, StudentGroupLifecycleService (+3 more)
|
||||||
|
|
||||||
|
### Community 39 - "JWT токены сервис Test"
|
||||||
|
Cohesion: 0.18
|
||||||
|
Nodes (12): Long, Object, Optional, Service, String, JwtTokenService, Duration, String (+4 more)
|
||||||
|
|
||||||
|
### Community 40 - "Модель Учебный календарь Activity"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (7): AcademicCalendarActivityType, Boolean, Entity, Integer, Long, String, Table
|
||||||
|
|
||||||
|
### Community 41 - "Контроллер время слоты Админ"
|
||||||
|
Cohesion: 0.18
|
||||||
|
Nodes (13): DeleteMapping, Long, PutMapping, RequestMapping, ResponseEntity, RestController, String, TimeSlotAdminController (+5 more)
|
||||||
|
|
||||||
|
### Community 42 - "Модель время слоты Date"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (10): Entity, LocalDate, Long, Table, TimeSlotDateAssignment, List, LocalDate, Long (+2 more)
|
||||||
|
|
||||||
|
### Community 43 - "Модель Учебный Year"
|
||||||
|
Cohesion: 0.13
|
||||||
|
Nodes (8): AcademicYear, Entity, LocalDate, Long, String, Table, Optional, String
|
||||||
|
|
||||||
|
### Community 44 - "Модель студенты группы календарь"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (9): Entity, Long, Table, StudentGroupCalendarAssignment, List, Long, Optional, Query (+1 more)
|
||||||
|
|
||||||
|
### Community 45 - "DTO Create кафедры"
|
||||||
|
Cohesion: 0.14
|
||||||
|
Nodes (10): DeleteMapping, Long, PostMapping, PutMapping, ResponseEntity, CreateDepartmentRequest, Long, String (+2 more)
|
||||||
|
|
||||||
|
### Community 46 - "DTO Create группы"
|
||||||
|
Cohesion: 0.16
|
||||||
|
Nodes (4): CreateGroupRequest, Integer, Long, String
|
||||||
|
|
||||||
|
### Community 47 - "Конфигурация тенанты конфигурация"
|
||||||
|
Cohesion: 0.21
|
||||||
|
Nodes (5): String, TenantConfig, List, HikariDataSource, JsonIgnoreProperties
|
||||||
|
|
||||||
|
### Community 48 - "Контроллер Global Exception Handler"
|
||||||
|
Cohesion: 0.28
|
||||||
|
Nodes (13): List, GlobalExceptionHandler, Exception, HttpServletRequest, Logger, Map, Object, ResponseEntity (+5 more)
|
||||||
|
|
||||||
|
### Community 49 - "Модель Учебный календарь Day"
|
||||||
|
Cohesion: 0.17
|
||||||
|
Nodes (6): AcademicCalendarDay, Entity, Integer, LocalDate, Long, Table
|
||||||
|
|
||||||
|
### Community 50 - "Контроллер расписание правила Админ"
|
||||||
|
Cohesion: 0.18
|
||||||
|
Nodes (11): DeleteMapping, PostMapping, PutMapping, ResponseEntity, Transactional, ScheduleRuleConflict, Integer, List (+3 more)
|
||||||
|
|
||||||
|
### Community 51 - "Контроллер БД"
|
||||||
|
Cohesion: 0.26
|
||||||
|
Nodes (11): DatabaseController, DeleteMapping, GetMapping, List, Map, Object, PostMapping, RequestMapping (+3 more)
|
||||||
|
|
||||||
|
### Community 52 - "Модель время слоты"
|
||||||
|
Cohesion: 0.22
|
||||||
|
Nodes (6): Entity, Integer, LocalTime, Long, Table, TimeSlot
|
||||||
|
|
||||||
|
### Community 53 - "DTO аудитории"
|
||||||
|
Cohesion: 0.19
|
||||||
|
Nodes (6): ClassroomRequest, Boolean, Integer, List, Long, String
|
||||||
|
|
||||||
|
### Community 54 - "Конфигурация тенанты конфигурация Watcher"
|
||||||
|
Cohesion: 0.20
|
||||||
|
Nodes (11): DataInitializer, Component, Logger, Component, DataSource, Logger, ObjectMapper, String (+3 more)
|
||||||
|
|
||||||
|
### Community 55 - "DTO Login"
|
||||||
|
Cohesion: 0.20
|
||||||
|
Nodes (3): Long, String, LoginResponse
|
||||||
|
|
||||||
|
### Community 56 - "main"
|
||||||
|
Cohesion: 0.13
|
||||||
|
Nodes (15): initAllCustomDropdowns(), startDropdownAutoObserver(), allowedTabs, appContent, main, menuToggle, navItems, pageTitle (+7 more)
|
||||||
|
|
||||||
|
### Community 57 - "DTO пользователи"
|
||||||
|
Cohesion: 0.21
|
||||||
|
Nodes (4): JsonInclude, Long, String, UserResponse
|
||||||
|
|
||||||
|
### Community 58 - "Утилиты Course And Semester"
|
||||||
|
Cohesion: 0.23
|
||||||
|
Nodes (7): CourseAndSemesterCalculator, Integer, LocalDate, Service, String, CourseAndSemesterCalculatorTest, Test
|
||||||
|
|
||||||
|
### Community 59 - "DTO Create пользователи"
|
||||||
|
Cohesion: 0.21
|
||||||
|
Nodes (3): CreateUserRequest, Long, String
|
||||||
|
|
||||||
|
### Community 60 - "SCHEDULE TASKS"
|
||||||
|
Cohesion: 0.14
|
||||||
|
Nodes (17): AcademicDateService, Коды активностей Excel-графика, Дневная сетка учебного календаря, Задачи динамического расписания, Назначение календаря группе, Подгруппы лабораторных слотов, Проверка конфликтов правил расписания, GET /api/schedule (+9 more)
|
||||||
|
|
||||||
|
### Community 61 - "Конфигурация JWT Properties"
|
||||||
|
Cohesion: 0.22
|
||||||
|
Nodes (5): Component, Duration, String, JwtProperties, ConfigurationProperties
|
||||||
|
|
||||||
|
### Community 62 - "Контроллер дисциплины"
|
||||||
|
Cohesion: 0.18
|
||||||
|
Nodes (10): DeleteMapping, GetMapping, List, Logger, Long, PostMapping, RequestMapping, ResponseEntity (+2 more)
|
||||||
|
|
||||||
|
### Community 63 - "Контроллер время слоты Админ"
|
||||||
|
Cohesion: 0.19
|
||||||
|
Nodes (8): GetMapping, List, LocalDate, Boolean, Integer, Long, String, TimeSlotScopeDto
|
||||||
|
|
||||||
|
### Community 64 - "DTO Review преподаватели создание"
|
||||||
|
Cohesion: 0.23
|
||||||
|
Nodes (3): Long, String, ReviewTeacherCreationRequest
|
||||||
|
|
||||||
|
### Community 65 - "Модель Учебный календарь"
|
||||||
|
Cohesion: 0.17
|
||||||
|
Nodes (6): AcademicCalendar, Entity, Integer, Long, String, Table
|
||||||
|
|
||||||
|
### Community 66 - "API"
|
||||||
|
Cohesion: 0.20
|
||||||
|
Nodes (13): apiFetch(), AUTH_KEYS, CACHABLE_PREFIXES, cache, clearAuthState(), clearCache(), getHeaders(), getToken() (+5 more)
|
||||||
|
|
||||||
|
### Community 67 - "Конфигурация тенанты Context"
|
||||||
|
Cohesion: 0.17
|
||||||
|
Nodes (8): Application, String, Override, String, ThreadLocal, TenantContext, EnableScheduling, SpringBootApplication
|
||||||
|
|
||||||
|
### Community 68 - "Конфигурация тенанты данные источник"
|
||||||
|
Cohesion: 0.28
|
||||||
|
Nodes (10): Bean, Configuration, DataSource, Logger, String, TenantDataSourceConfig, EntityManagerFactory, LocalContainerEntityManagerFactoryBean (+2 more)
|
||||||
|
|
||||||
|
### Community 69 - "DevOps инфраструктура"
|
||||||
|
Cohesion: 0.14
|
||||||
|
Nodes (15): Риск latest-тега OpenTelemetry, Ansible-хосты баз данных, Caddy proxy, Паттерн database-per-tenant, Обоснование изоляции данных по ФЗ-152, K3s-кластер, ВМ баз данных в Proxmox, Отказоустойчивая мультитенантная инфраструктура (+7 more)
|
||||||
|
|
||||||
|
### Community 70 - "ACADEMIC CALENDAR"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (15): Риск пересечения границ семестров, Коды активностей учебного календаря, Модель учебного календаря, Фильтр генерации расписания по календарю, API назначения календаря группе, Эндпоинты правил расписания, Модель динамического расписания, Валидация расписания (+7 more)
|
||||||
|
|
||||||
|
### Community 71 - "кафедры кабинет"
|
||||||
|
Cohesion: 0.19
|
||||||
|
Nodes (9): fillSelect(), initDepartmentWorkspace(), loadDepartments(), normalizeTeacherName(), renderTeacherMetric(), setDefaultDates(), toIsoDate(), workloadKeys() (+1 more)
|
||||||
|
|
||||||
|
### Community 72 - "Конфигурация тенанты Routing данные"
|
||||||
|
Cohesion: 0.23
|
||||||
|
Nodes (7): AbstractRoutingDataSource, Logger, Map, Object, Override, String, TenantRoutingDataSource
|
||||||
|
|
||||||
|
### Community 73 - "Репозиторий время слоты Scope"
|
||||||
|
Cohesion: 0.21
|
||||||
|
Nodes (6): Integer, List, Long, Optional, String, TimeSlotScopeRepository
|
||||||
|
|
||||||
|
### Community 74 - "DTO Create преподаватели создание"
|
||||||
|
Cohesion: 0.25
|
||||||
|
Nodes (3): CreateTeacherCreationRequest, Long, String
|
||||||
|
|
||||||
|
### Community 75 - "Модель подгруппы"
|
||||||
|
Cohesion: 0.19
|
||||||
|
Nodes (5): Entity, Long, String, Table, Subgroup
|
||||||
|
|
||||||
|
### Community 76 - "Репозиторий Учебный календарь Day"
|
||||||
|
Cohesion: 0.26
|
||||||
|
Nodes (8): AcademicCalendarDayRepository, Integer, List, LocalDate, Long, Optional, Query, Modifying
|
||||||
|
|
||||||
|
### Community 77 - "index"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (14): Оболочка админ-панели, Меню настроек и выхода, Индикатор заявок преподавателей, Возврат в админ-панель, Навигация настроек, Оболочка SPA настроек, Управление подключениями тенантов, Таблица подключенных университетов (+6 more)
|
||||||
|
|
||||||
|
### Community 78 - "кафедры кабинет"
|
||||||
|
Cohesion: 0.20
|
||||||
|
Nodes (14): Навигация админ-панели, Фильтры загруженности, Просмотр загруженности, Управление аудиторным фондом, Справочник оборудования, Комментарии кафедры по дисциплинам, Рабочая область кафедры, Привязка преподавателя к кафедре (+6 more)
|
||||||
|
|
||||||
|
### Community 79 - "index"
|
||||||
|
Cohesion: 0.15
|
||||||
|
Nodes (14): Маршрут /admin/#schedule-view, Редирект учебного отдела, GET /api/schedule по groupId, GET /api/schedule по teacherId, Ansible и безопасный провижининг, Отказоустойчивость старта backend, Database-per-Tenant, Принципы DevSecOps (+6 more)
|
||||||
|
|
||||||
|
### Community 80 - "Проектные навыки"
|
||||||
|
Cohesion: 0.26
|
||||||
|
Nodes (13): SKILL.md AutoUpdateDocs, Навык AutoUpdateDocs, Карта файлов к документации, Индекс проектной документации, REST API, Права ролей API, Архитектура системы, Архивация жизненного цикла (+5 more)
|
||||||
|
|
||||||
|
### Community 81 - "Конфигурация конфигурация Updater"
|
||||||
|
Cohesion: 0.24
|
||||||
|
Nodes (8): ConfigMapUpdater, List, Logger, ObjectMapper, Service, String, HttpClient, SecureRandom
|
||||||
|
|
||||||
|
### Community 82 - "Модель оборудование"
|
||||||
|
Cohesion: 0.23
|
||||||
|
Nodes (5): Equipment, Entity, Long, String, Table
|
||||||
|
|
||||||
|
### Community 83 - "DTO Create дисциплины"
|
||||||
|
Cohesion: 0.28
|
||||||
|
Nodes (3): CreateSubjectRequest, Long, String
|
||||||
|
|
||||||
|
### Community 84 - "Аудит рисков"
|
||||||
|
Cohesion: 0.19
|
||||||
|
Nodes (13): Небезопасные production-defaults JWT, Риск Kubernetes TLS trust-all, Аудит рисков проекта, Пробел проверки конфликтов override расписания, Пробел обновления watcher конфигурации тенантов, Риск замены DataSource тенанта, Динамическое управление тенантами через ConfigMap, Эндпоинты override расписания (+5 more)
|
||||||
|
|
||||||
|
### Community 85 - "UI COMPONENTS"
|
||||||
|
Cohesion: 0.17
|
||||||
|
Nodes (13): Ограничения стилизации option, checkbox-item и checkmark, Обертка кастомного select, CustomSelect, Автоматическая синхронизация option, frontend/admin/js/dropdown.js, Глобальный MutationObserver для select, Multi-select с чекбоксами (+5 more)
|
||||||
|
|
||||||
|
### Community 86 - "Контроллер аудитории"
|
||||||
|
Cohesion: 0.26
|
||||||
|
Nodes (6): DeleteMapping, Long, PostMapping, PutMapping, ResponseEntity, String
|
||||||
|
|
||||||
|
### Community 87 - "Контроллер расписание правила Админ"
|
||||||
|
Cohesion: 0.20
|
||||||
|
Nodes (6): Integer, List, Long, String, ScheduleRuleSlotDto, ScheduleParity
|
||||||
|
|
||||||
|
### Community 88 - "Модель Education формы"
|
||||||
|
Cohesion: 0.23
|
||||||
|
Nodes (5): EducationForm, Entity, Long, String, Table
|
||||||
|
|
||||||
|
### Community 89 - "аудитории нагрузка"
|
||||||
|
Cohesion: 0.20
|
||||||
|
Nodes (9): initMultiSelect(), updateSelectText(), CELL_PARITY_LAYOUT, DAY_FULL_LABELS, DAY_ORDER, DAY_SHORT_LABELS, WORKLOAD_TARGETS, initClassrooms() (+1 more)
|
||||||
|
|
||||||
|
### Community 90 - "вуз структура"
|
||||||
|
Cohesion: 0.29
|
||||||
|
Nodes (12): Календарный учебный график, Управление учебными годами, Привязки дисциплин графика, Загрузка дисциплин кафедры, Назначение календарного графика группе, Управление группами обучения, Фильтры просмотра расписаний, Управление дисциплинами (+4 more)
|
||||||
|
|
||||||
|
### Community 91 - "Контроллер Учебный календарь Админ"
|
||||||
|
Cohesion: 0.22
|
||||||
|
Nodes (7): GetMapping, List, AcademicCalendarActivityTypeDto, Boolean, Integer, Long, String
|
||||||
|
|
||||||
|
### Community 92 - "DTO группы календарь Assignment"
|
||||||
|
Cohesion: 0.20
|
||||||
|
Nodes (5): Logger, GroupCalendarAssignmentDto, List, Long, String
|
||||||
|
|
||||||
|
### Community 93 - "DTO кафедры"
|
||||||
|
Cohesion: 0.33
|
||||||
|
Nodes (3): DepartmentResponse, Long, String
|
||||||
|
|
||||||
|
### Community 94 - "Сервис Учебный Date"
|
||||||
|
Cohesion: 0.36
|
||||||
|
Nodes (4): AcademicDateService, LocalDate, Optional, Service
|
||||||
|
|
||||||
|
### Community 95 - "Репозиторий Учебный календарь Activity"
|
||||||
|
Cohesion: 0.24
|
||||||
|
Nodes (5): AcademicCalendarActivityTypeRepository, List, Long, Optional, String
|
||||||
|
|
||||||
|
### Community 96 - "DTO Speciality"
|
||||||
|
Cohesion: 0.38
|
||||||
|
Nodes (3): Long, String, SpecialityResponse
|
||||||
|
|
||||||
|
### Community 97 - "Репозиторий расписание правила"
|
||||||
|
Cohesion: 0.42
|
||||||
|
Nodes (5): List, Long, Optional, Query, ScheduleRuleRepository
|
||||||
|
|
||||||
|
### Community 98 - "Репозиторий время слоты"
|
||||||
|
Cohesion: 0.33
|
||||||
|
Nodes (5): Integer, List, Long, Optional, TimeSlotRepository
|
||||||
|
|
||||||
|
### Community 99 - "index"
|
||||||
|
Cohesion: 0.24
|
||||||
|
Nodes (10): POST /api/auth/logout, POST /api/auth/refresh, GET /api/groups, clearAuthState, fetchJson, loadGroups, logout, refreshAccessToken (+2 more)
|
||||||
|
|
||||||
|
### Community 100 - "script"
|
||||||
|
Cohesion: 0.22
|
||||||
|
Nodes (3): escapeHtml(), formatRunbookText(), incidentRunbooks
|
||||||
|
|
||||||
|
### Community 101 - "Проектный регламент"
|
||||||
|
Cohesion: 0.22
|
||||||
|
Nodes (9): Правило неизменяемости Flyway-миграций, Система университетского расписания Магистр, Проектный регламент AGENTS.md, Правило русского языка, Flyway-миграции, Code style, Руководство разработчика, Правила Flyway в разработке (+1 more)
|
||||||
|
|
||||||
|
### Community 102 - "Контроллер Учебный календарь"
|
||||||
|
Cohesion: 0.25
|
||||||
|
Nodes (6): AcademicCalendarGridDayDto, Boolean, Integer, LocalDate, Long, String
|
||||||
|
|
||||||
|
### Community 103 - "DTO дисциплины"
|
||||||
|
Cohesion: 0.39
|
||||||
|
Nodes (3): Long, String, SubjectResponse
|
||||||
|
|
||||||
|
### Community 104 - "DTO преподаватели дисциплины"
|
||||||
|
Cohesion: 0.39
|
||||||
|
Nodes (3): Long, String, TeacherSubjectResponse
|
||||||
|
|
||||||
|
### Community 105 - "Модель преподаватели дисциплины Id"
|
||||||
|
Cohesion: 0.39
|
||||||
|
Nodes (3): Long, TeacherSubjectId, Serializable
|
||||||
|
|
||||||
|
### Community 106 - "Репозиторий Учебный календарь"
|
||||||
|
Cohesion: 0.42
|
||||||
|
Nodes (5): AcademicCalendarRepository, List, Long, Optional, Query
|
||||||
|
|
||||||
|
### Community 108 - "index"
|
||||||
|
Cohesion: 0.28
|
||||||
|
Nodes (9): Выбор группы студента, Сетка расписания студента, Страница расписания студента, Недельная навигация студента, Адаптивная раскладка расписания преподавателя, Сетка расписания преподавателя, Идентификатор преподавателя из userId, Страница расписания преподавателя (+1 more)
|
||||||
|
|
||||||
|
### Community 109 - "FRONTEND"
|
||||||
|
Cohesion: 0.25
|
||||||
|
Nodes (8): Карта документации настроек фронтенда, Риск XSS через innerHTML ошибок, Пробел видимости override для преподавателей, Эндпоинты динамического расписания, Роутинг admin SPA, Frontend-архитектура, Frontend-представления расписания, SPA настроек администратора
|
||||||
|
|
||||||
|
### Community 110 - "CI/CD workflow"
|
||||||
|
Cohesion: 0.29
|
||||||
|
Nodes (8): Pipeline backend-образа, Workflow сборки и публикации Docker-образов, Job деплоя в Kubernetes, Pipeline frontend-образа, Secret KUBECONFIG_DATA, Secret ZUEV_TOKEN, CI/CD через Gitea Actions, CI/CD Gitea Actions в инфраструктуре
|
||||||
|
|
||||||
|
### Community 113 - "index"
|
||||||
|
Cohesion: 0.32
|
||||||
|
Nodes (8): POST /api/auth/logout, POST /api/auth/refresh, clearAuthState, fetchJson, logout, refreshAccessToken, storeAuthState, Состояние авторизации преподавателя
|
||||||
|
|
||||||
|
### Community 114 - "index"
|
||||||
|
Cohesion: 0.36
|
||||||
|
Nodes (8): collectSlots, loadSchedule, renderCell, renderEmptyWeek, renderHead, renderLesson, renderMobileWeek, renderWeek
|
||||||
|
|
||||||
|
### Community 115 - "Контроллер время слоты Админ"
|
||||||
|
Cohesion: 0.38
|
||||||
|
Nodes (4): LocalDate, Long, String, TimeSlotDateAssignmentDto
|
||||||
|
|
||||||
|
### Community 116 - "тенанты конфигурация Watcher Test"
|
||||||
|
Cohesion: 0.38
|
||||||
|
Nodes (3): Override, Test, TenantConfigWatcherTest
|
||||||
|
|
||||||
|
### Community 117 - "Аудит рисков"
|
||||||
|
Cohesion: 0.33
|
||||||
|
Nodes (7): Утечка ThreadLocal AuthContext, Риск access token в localStorage, Гонка ротации refresh-токенов, Эндпоинты аутентификации, Архитектура аутентификации, Таблица refresh-токенов, Refresh-flow API-клиента
|
||||||
|
|
||||||
|
### Community 118 - "время слоты"
|
||||||
|
Cohesion: 0.38
|
||||||
|
Nodes (5): APPLY_MODE_LABELS, DAY_SHORT_LABELS, dayShort(), scopeBadgeLabel(), scopeOptionLabel()
|
||||||
|
|
||||||
|
### Community 119 - "script"
|
||||||
|
Cohesion: 0.38
|
||||||
|
Nodes (3): hideAlert(), setFieldError(), validate()
|
||||||
|
|
||||||
|
### Community 120 - "Конфигурация App конфигурация"
|
||||||
|
Cohesion: 0.53
|
||||||
|
Nodes (4): AppConfig, BCryptPasswordEncoder, Bean, Configuration
|
||||||
|
|
||||||
|
### Community 121 - "нагрузка контроллер Test"
|
||||||
|
Cohesion: 0.40
|
||||||
|
Nodes (4): Boolean, Long, Test, WorkloadControllerTest
|
||||||
|
|
||||||
|
### Community 122 - "Docker Compose"
|
||||||
|
Cohesion: 0.60
|
||||||
|
Nodes (6): Backend-сервис Docker Compose, PostgreSQL-сервис Docker Compose, Frontend-сервис Docker Compose, Обязательная переменная POSTGRES_PASSWORD, Внешняя proxy-сеть Docker, Docker Compose инфраструктура
|
||||||
|
|
||||||
|
### Community 123 - "дашборд"
|
||||||
|
Cohesion: 0.33
|
||||||
|
Nodes (6): Центр предупреждений Red Zone, Дашборд администратора, Быстрый переход дашборда, Мониторинг текущих пар, Результаты просмотра расписаний, Просмотр расписаний
|
||||||
|
|
||||||
|
### Community 124 - "index"
|
||||||
|
Cohesion: 0.40
|
||||||
|
Nodes (5): loadSchedule, renderDay, renderEmptyWeek, renderLesson, renderWeek
|
||||||
|
|
||||||
|
### Community 125 - "Проектные навыки"
|
||||||
|
Cohesion: 0.50
|
||||||
|
Nodes (4): Дизайн-мышление интерфейса, Навык frontend-design, Правило против AI-эстетики, CSS-архитектура
|
||||||
|
|
||||||
|
### Community 126 - "index"
|
||||||
|
Cohesion: 0.50
|
||||||
|
Nodes (4): Форма входа, Страница авторизации, script.js страницы входа, theme-toggle.js на странице входа
|
||||||
|
|
||||||
|
### Community 127 - "index"
|
||||||
|
Cohesion: 0.50
|
||||||
|
Nodes (4): Резюме DevOps-инженера, Homelab как инженерная практика, Junior DevOps / Infrastructure Engineer, Зуев Егор Алексеевич
|
||||||
|
|
||||||
|
### Community 129 - "Аудит рисков"
|
||||||
|
Cohesion: 0.67
|
||||||
|
Nodes (3): Риск владения дисциплинами при импорте кафедры, Эндпоинты кабинета кафедры, Привязки преподавателей к кафедрам
|
||||||
|
|
||||||
|
## Knowledge Gaps
|
||||||
|
- **135 isolated node(s):** `com.magistr:app`, `AUTH_KEYS`, `cache`, `CACHABLE_PREFIXES`, `AUTHORIZED_ROLES` (+130 more)
|
||||||
|
These have ≤1 connection - possible missing edges or undocumented components.
|
||||||
|
- **8 thin communities (<3 nodes) omitted from report** — run `graphify query` to explore isolated nodes.
|
||||||
|
|
||||||
|
## Suggested Questions
|
||||||
|
_Questions this graph is uniquely positioned to answer:_
|
||||||
|
|
||||||
|
- **Why does `RequireRoles` connect `Контроллер аудитории` to `Модель расписание override`, `Сервис расписание Query`, `Модель преподаватели создание`, `Контроллер расписание правила Админ`, `Контроллер преподаватели дисциплины`, `Контроллер подгруппы`, `Конфигурация Авторизация Interceptor`, `Контроллер пользователи`, `Контроллер Учебный календарь Админ`, `Модель занятия Type`, `Модель преподаватели кафедры Assignment`, `Контроллер Учебный календарь`, `Контроллер Speciality`, `Контроллер кафедры кабинет`, `Модель кафедры`, `Контроллер группы`, `Контроллер Education формы`, `Контроллер время слоты Админ`, `Контроллер расписание правила Админ`, `Контроллер БД`, `Контроллер дисциплины`, `Контроллер время слоты Админ`, `DTO группы календарь Assignment`?**
|
||||||
|
_High betweenness centrality (0.167) - this node is a cross-community bridge._
|
||||||
|
- **Why does `initDepartmentWorkspace()` connect `кафедры кабинет` to `Контроллер кафедры кабинет`, `расписание`?**
|
||||||
|
_High betweenness centrality (0.086) - this node is a cross-community bridge._
|
||||||
|
- **Why does `LifecycleEntity` connect `Модель Lifecycle сущность` to `Модель специальности профили`, `Модель Speciality`, `Модель аудитории`, `Модель дисциплины комментарии`, `Контроллер преподаватели дисциплины`, `Модель пользователи`, `Модель подгруппы`, `Контроллер пользователи`, `Модель оборудование`, `Модель студенты группы`, `Контроллер Speciality`, `Модель кафедры`, `Контроллер аудитории`, `Модель Education формы`?**
|
||||||
|
_High betweenness centrality (0.055) - this node is a cross-community bridge._
|
||||||
|
- **Are the 2 inferred relationships involving `ScheduleRule` (e.g. with `.activeOnUsesStatusAndValidityRange()` and `.archiveAndRestoreToggleStatus()`) actually correct?**
|
||||||
|
_`ScheduleRule` has 2 INFERRED edges - model-reasoned connections that need verification._
|
||||||
|
- **What connects `com.magistr:app`, `AUTH_KEYS`, `cache` to the rest of the system?**
|
||||||
|
_139 weakly-connected nodes found - possible documentation gaps or missing edges._
|
||||||
|
- **Should `Модель расписание override` be split into smaller, more focused modules?**
|
||||||
|
_Cohesion score 0.05189189189189189 - nodes in this community are weakly interconnected._
|
||||||
|
- **Should `Сервис расписание Query` be split into smaller, more focused modules?**
|
||||||
|
_Cohesion score 0.0649452269170579 - nodes in this community are weakly interconnected._
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
{"nodes": [], "edges": [], "skipped": "data json (non-object root)"}
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
{"nodes": [{"id": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_workloadsummarydto_java", "label": "WorkloadSummaryDto.java", "file_type": "code", "source_file": "backend/src/main/java/com/magistr/app/dto/WorkloadSummaryDto.java", "source_location": "L1"}, {"id": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_workloadsummarydto_workloadsummarydto", "label": "WorkloadSummaryDto", "file_type": "code", "source_file": "backend/src/main/java/com/magistr/app/dto/WorkloadSummaryDto.java", "source_location": "L3", "_callable": true}, {"id": "long", "label": "Long", "file_type": "code", "source_file": "", "source_location": "", "origin_file": "/mnt/HDD/ProjectMagistr/magistr/backend/src/main/java/com/magistr/app/dto/WorkloadSummaryDto.java"}, {"id": "string", "label": "String", "file_type": "code", "source_file": "", "source_location": "", "origin_file": "/mnt/HDD/ProjectMagistr/magistr/backend/src/main/java/com/magistr/app/dto/WorkloadSummaryDto.java"}], "edges": [{"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_workloadsummarydto_java", "target": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_workloadsummarydto_workloadsummarydto", "relation": "contains", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/WorkloadSummaryDto.java", "source_location": "L3", "weight": 1.0}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_workloadsummarydto_workloadsummarydto", "target": "long", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/WorkloadSummaryDto.java", "source_location": "L4", "weight": 1.0, "context": "field"}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_workloadsummarydto_workloadsummarydto", "target": "string", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/WorkloadSummaryDto.java", "source_location": "L5", "weight": 1.0, "context": "field"}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_workloadsummarydto_workloadsummarydto", "target": "long", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/WorkloadSummaryDto.java", "source_location": "L6", "weight": 1.0, "context": "field"}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_workloadsummarydto_workloadsummarydto", "target": "string", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/WorkloadSummaryDto.java", "source_location": "L7", "weight": 1.0, "context": "field"}], "raw_calls": []}
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
{"nodes": [{"id": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_model_scheduleparity_java", "label": "ScheduleParity.java", "file_type": "code", "source_file": "backend/src/main/java/com/magistr/app/model/ScheduleParity.java", "source_location": "L1"}, {"id": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_model_scheduleparity_scheduleparity", "label": "ScheduleParity", "file_type": "code", "source_file": "backend/src/main/java/com/magistr/app/model/ScheduleParity.java", "source_location": "L3", "_callable": true}], "edges": [{"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_model_scheduleparity_java", "target": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_model_scheduleparity_scheduleparity", "relation": "contains", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/model/ScheduleParity.java", "source_location": "L3", "weight": 1.0}], "raw_calls": []}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"nodes": [{"id": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_model_teachercreationrequeststatus_java", "label": "TeacherCreationRequestStatus.java", "file_type": "code", "source_file": "backend/src/main/java/com/magistr/app/model/TeacherCreationRequestStatus.java", "source_location": "L1"}, {"id": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_model_teachercreationrequeststatus_teachercreationrequeststatus", "label": "TeacherCreationRequestStatus", "file_type": "code", "source_file": "backend/src/main/java/com/magistr/app/model/TeacherCreationRequestStatus.java", "source_location": "L3", "_callable": true}], "edges": [{"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_model_teachercreationrequeststatus_java", "target": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_model_teachercreationrequeststatus_teachercreationrequeststatus", "relation": "contains", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/model/TeacherCreationRequestStatus.java", "source_location": "L3", "weight": 1.0}], "raw_calls": []}
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
{"nodes": [{"id": "pkg_com_magistr_app", "label": "com.magistr:app", "file_type": "code", "type": "package", "ecosystem": "maven", "source_file": "backend/pom.xml", "source_location": "L1", "version": "1.0.0"}], "edges": [{"source": "pkg_com_magistr_app", "target": "pkg_org_springframework_boot_spring_boot_starter_web", "relation": "depends_on", "context": "dependency", "confidence": "EXTRACTED", "confidence_score": 1.0, "source_file": "backend/pom.xml", "source_location": "L1", "weight": 1.0}, {"source": "pkg_com_magistr_app", "target": "pkg_org_springframework_boot_spring_boot_starter_data_jpa", "relation": "depends_on", "context": "dependency", "confidence": "EXTRACTED", "confidence_score": 1.0, "source_file": "backend/pom.xml", "source_location": "L1", "weight": 1.0}, {"source": "pkg_com_magistr_app", "target": "pkg_org_flywaydb_flyway_core", "relation": "depends_on", "context": "dependency", "confidence": "EXTRACTED", "confidence_score": 1.0, "source_file": "backend/pom.xml", "source_location": "L1", "weight": 1.0}, {"source": "pkg_com_magistr_app", "target": "pkg_org_postgresql_postgresql", "relation": "depends_on", "context": "dependency", "confidence": "EXTRACTED", "confidence_score": 1.0, "source_file": "backend/pom.xml", "source_location": "L1", "weight": 1.0}, {"source": "pkg_com_magistr_app", "target": "pkg_org_springframework_security_spring_security_crypto", "relation": "depends_on", "context": "dependency", "confidence": "EXTRACTED", "confidence_score": 1.0, "source_file": "backend/pom.xml", "source_location": "L1", "weight": 1.0}, {"source": "pkg_com_magistr_app", "target": "pkg_org_springframework_security_spring_security_oauth2_jose", "relation": "depends_on", "context": "dependency", "confidence": "EXTRACTED", "confidence_score": 1.0, "source_file": "backend/pom.xml", "source_location": "L1", "weight": 1.0}, {"source": "pkg_com_magistr_app", "target": "pkg_com_h2database_h2", "relation": "depends_on", "context": "dependency", "confidence": "EXTRACTED", "confidence_score": 1.0, "source_file": "backend/pom.xml", "source_location": "L1", "weight": 1.0}, {"source": "pkg_com_magistr_app", "target": "pkg_io_opentelemetry_opentelemetry_api", "relation": "depends_on", "context": "dependency", "confidence": "EXTRACTED", "confidence_score": 1.0, "source_file": "backend/pom.xml", "source_location": "L1", "weight": 1.0}, {"source": "pkg_com_magistr_app", "target": "pkg_org_springframework_boot_spring_boot_starter_test", "relation": "depends_on", "context": "dependency", "confidence": "EXTRACTED", "confidence_score": 1.0, "source_file": "backend/pom.xml", "source_location": "L1", "weight": 1.0}]}
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
{"nodes": [{"id": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_specialtyprofiledto_java", "label": "SpecialtyProfileDto.java", "file_type": "code", "source_file": "backend/src/main/java/com/magistr/app/dto/SpecialtyProfileDto.java", "source_location": "L1"}, {"id": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_specialtyprofiledto_specialtyprofiledto", "label": "SpecialtyProfileDto", "file_type": "code", "source_file": "backend/src/main/java/com/magistr/app/dto/SpecialtyProfileDto.java", "source_location": "L3", "_callable": true}, {"id": "long", "label": "Long", "file_type": "code", "source_file": "", "source_location": "", "origin_file": "/mnt/HDD/ProjectMagistr/magistr/backend/src/main/java/com/magistr/app/dto/SpecialtyProfileDto.java"}, {"id": "string", "label": "String", "file_type": "code", "source_file": "", "source_location": "", "origin_file": "/mnt/HDD/ProjectMagistr/magistr/backend/src/main/java/com/magistr/app/dto/SpecialtyProfileDto.java"}], "edges": [{"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_specialtyprofiledto_java", "target": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_specialtyprofiledto_specialtyprofiledto", "relation": "contains", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/SpecialtyProfileDto.java", "source_location": "L3", "weight": 1.0}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_specialtyprofiledto_specialtyprofiledto", "target": "long", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/SpecialtyProfileDto.java", "source_location": "L4", "weight": 1.0, "context": "field"}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_specialtyprofiledto_specialtyprofiledto", "target": "long", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/SpecialtyProfileDto.java", "source_location": "L5", "weight": 1.0, "context": "field"}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_specialtyprofiledto_specialtyprofiledto", "target": "string", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/SpecialtyProfileDto.java", "source_location": "L6", "weight": 1.0, "context": "field"}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_specialtyprofiledto_specialtyprofiledto", "target": "string", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/SpecialtyProfileDto.java", "source_location": "L7", "weight": 1.0, "context": "field"}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_specialtyprofiledto_specialtyprofiledto", "target": "string", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/SpecialtyProfileDto.java", "source_location": "L8", "weight": 1.0, "context": "field"}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_specialtyprofiledto_specialtyprofiledto", "target": "string", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/SpecialtyProfileDto.java", "source_location": "L9", "weight": 1.0, "context": "field"}], "raw_calls": []}
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
|||||||
|
{"nodes": [{"id": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_timeslotdateassignmentdto_java", "label": "TimeSlotDateAssignmentDto.java", "file_type": "code", "source_file": "backend/src/main/java/com/magistr/app/dto/TimeSlotDateAssignmentDto.java", "source_location": "L1"}, {"id": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_timeslotdateassignmentdto_timeslotdateassignmentdto", "label": "TimeSlotDateAssignmentDto", "file_type": "code", "source_file": "backend/src/main/java/com/magistr/app/dto/TimeSlotDateAssignmentDto.java", "source_location": "L5", "_callable": true}, {"id": "long", "label": "Long", "file_type": "code", "source_file": "", "source_location": "", "origin_file": "/mnt/HDD/ProjectMagistr/magistr/backend/src/main/java/com/magistr/app/dto/TimeSlotDateAssignmentDto.java"}, {"id": "localdate", "label": "LocalDate", "file_type": "code", "source_file": "", "source_location": "", "origin_file": "/mnt/HDD/ProjectMagistr/magistr/backend/src/main/java/com/magistr/app/dto/TimeSlotDateAssignmentDto.java"}, {"id": "string", "label": "String", "file_type": "code", "source_file": "", "source_location": "", "origin_file": "/mnt/HDD/ProjectMagistr/magistr/backend/src/main/java/com/magistr/app/dto/TimeSlotDateAssignmentDto.java"}], "edges": [{"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_timeslotdateassignmentdto_java", "target": "localdate", "relation": "imports", "context": "import", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/TimeSlotDateAssignmentDto.java", "source_location": "L3", "weight": 1.0}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_timeslotdateassignmentdto_java", "target": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_timeslotdateassignmentdto_timeslotdateassignmentdto", "relation": "contains", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/TimeSlotDateAssignmentDto.java", "source_location": "L5", "weight": 1.0}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_timeslotdateassignmentdto_timeslotdateassignmentdto", "target": "long", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/TimeSlotDateAssignmentDto.java", "source_location": "L6", "weight": 1.0, "context": "field"}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_timeslotdateassignmentdto_timeslotdateassignmentdto", "target": "localdate", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/TimeSlotDateAssignmentDto.java", "source_location": "L7", "weight": 1.0, "context": "field"}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_timeslotdateassignmentdto_timeslotdateassignmentdto", "target": "long", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/TimeSlotDateAssignmentDto.java", "source_location": "L8", "weight": 1.0, "context": "field"}, {"source": "mnt_hdd_projectmagistr_magistr_backend_src_main_java_com_magistr_app_dto_timeslotdateassignmentdto_timeslotdateassignmentdto", "target": "string", "relation": "references", "confidence": "EXTRACTED", "source_file": "backend/src/main/java/com/magistr/app/dto/TimeSlotDateAssignmentDto.java", "source_location": "L9", "weight": 1.0, "context": "field"}], "raw_calls": []}
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user