From f06593339170159ed99eef675a8b6e25aff70b3e Mon Sep 17 00:00:00 2001 From: Safi Date: Sun, 3 May 2026 13:22:17 +0100 Subject: [PATCH] Fix #676 #678 #681: graphifyignore negation, Antigravity slash command, Gemini hook Windows Co-Authored-By: Claude Sonnet 4.6 --- graphify/__main__.py | 18 ++++++++++++------ graphify/detect.py | 5 ++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/graphify/__main__.py b/graphify/__main__.py index 638df19..ee67ebb 100644 --- a/graphify/__main__.py +++ b/graphify/__main__.py @@ -252,9 +252,13 @@ _GEMINI_HOOK = { { "type": "command", "command": ( - "[ -f graphify-out/graph.json ] && " - r"""echo '{"decision":"allow","additionalContext":"graphify: Knowledge graph exists. Read graphify-out/GRAPH_REPORT.md for god nodes and community structure before searching raw files."}' """ - r"""|| echo '{"decision":"allow"}'""" + 'python -c "' + "import sys,pathlib,json;" + "e=pathlib.Path('graphify-out/graph.json').exists();" + "d={'decision':'allow'};" + "e and d.update({'additionalContext':'graphify: Knowledge graph exists. Read graphify-out/GRAPH_REPORT.md for god nodes and community structure before searching raw files.'});" + "sys.stdout.write(json.dumps(d))" + '"' ), } ], @@ -448,11 +452,13 @@ Rules: """ _ANTIGRAVITY_WORKFLOW = """\ +--- +name: graphify +description: Turn any folder of files into a navigable knowledge graph +--- + # Workflow: graphify -**Command:** /graphify -**Description:** Turn any folder of files into a navigable knowledge graph -## Steps Follow the graphify skill installed at ~/.agents/skills/graphify/SKILL.md to run the full pipeline. If no path argument is given, use `.` (current directory). diff --git a/graphify/detect.py b/graphify/detect.py index 30de00e..e1df09d 100644 --- a/graphify/detect.py +++ b/graphify/detect.py @@ -656,11 +656,14 @@ def detect(root: Path, *, follow_symlinks: bool = False) -> dict: # Prune noise dirs in-place so os.walk never descends into them. # Hidden dirs are allowed through if they could contain an # explicitly included path (.graphifyinclude allowlist). + # When negation patterns (!) exist, skip directory-level ignore + # pruning so negated files inside can still be reached. + has_negation = any(p.startswith("!") for _, p in ignore_patterns) dirnames[:] = [ d for d in dirnames if (not d.startswith(".") or _could_contain_included_path(dp / d, root, include_patterns)) and not _is_noise_dir(d) - and not _is_ignored(dp / d, root, ignore_patterns) + and (has_negation or not _is_ignored(dp / d, root, ignore_patterns)) ] for fname in filenames: if fname in _SKIP_FILES: