mirror of
https://github.com/safishamsi/graphify.git
synced 2026-09-21 04:56:18 +00:00
Add Gemini CLI support and sponsor nudge at pipeline completion (#105)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
38381597d6
commit
df26f85648
@@ -263,3 +263,58 @@ def test_cursor_uninstall_noop_if_not_installed(tmp_path):
|
||||
"""cursor uninstall does nothing if rule was never written."""
|
||||
from graphify.__main__ import _cursor_uninstall
|
||||
_cursor_uninstall(tmp_path) # should not raise
|
||||
|
||||
|
||||
# ── Gemini CLI ────────────────────────────────────────────────────────────────
|
||||
|
||||
def test_gemini_install_writes_gemini_md(tmp_path):
|
||||
from graphify.__main__ import gemini_install
|
||||
gemini_install(tmp_path)
|
||||
md = tmp_path / "GEMINI.md"
|
||||
assert md.exists()
|
||||
assert "graphify-out/GRAPH_REPORT.md" in md.read_text()
|
||||
|
||||
def test_gemini_install_writes_hook(tmp_path):
|
||||
import json as _json
|
||||
from graphify.__main__ import gemini_install
|
||||
gemini_install(tmp_path)
|
||||
settings = _json.loads((tmp_path / ".gemini" / "settings.json").read_text())
|
||||
hooks = settings["hooks"]["BeforeTool"]
|
||||
assert any("graphify" in str(h) for h in hooks)
|
||||
|
||||
def test_gemini_install_idempotent(tmp_path):
|
||||
from graphify.__main__ import gemini_install
|
||||
gemini_install(tmp_path)
|
||||
gemini_install(tmp_path)
|
||||
md = tmp_path / "GEMINI.md"
|
||||
assert md.read_text().count("## graphify") == 1
|
||||
|
||||
def test_gemini_install_merges_existing_gemini_md(tmp_path):
|
||||
from graphify.__main__ import gemini_install
|
||||
(tmp_path / "GEMINI.md").write_text("# My project rules\n")
|
||||
gemini_install(tmp_path)
|
||||
content = (tmp_path / "GEMINI.md").read_text()
|
||||
assert "# My project rules" in content
|
||||
assert "graphify-out/GRAPH_REPORT.md" in content
|
||||
|
||||
def test_gemini_uninstall_removes_section(tmp_path):
|
||||
from graphify.__main__ import gemini_install, gemini_uninstall
|
||||
gemini_install(tmp_path)
|
||||
gemini_uninstall(tmp_path)
|
||||
md = tmp_path / "GEMINI.md"
|
||||
assert not md.exists()
|
||||
|
||||
def test_gemini_uninstall_removes_hook(tmp_path):
|
||||
import json as _json
|
||||
from graphify.__main__ import gemini_install, gemini_uninstall
|
||||
gemini_install(tmp_path)
|
||||
gemini_uninstall(tmp_path)
|
||||
settings_path = tmp_path / ".gemini" / "settings.json"
|
||||
if settings_path.exists():
|
||||
settings = _json.loads(settings_path.read_text())
|
||||
hooks = settings.get("hooks", {}).get("BeforeTool", [])
|
||||
assert not any("graphify" in str(h) for h in hooks)
|
||||
|
||||
def test_gemini_uninstall_noop_if_not_installed(tmp_path):
|
||||
from graphify.__main__ import gemini_uninstall
|
||||
gemini_uninstall(tmp_path) # should not raise
|
||||
|
||||
Reference in New Issue
Block a user