Write .cursor/rules/graphify.mdc with alwaysApply: true.
(project_dir: Path)
| 1622 | - After modifying code files, run `graphify update .` to keep the graph current (AST-only, no API cost) |
| 1623 | """ |
| 1624 | def _cursor_install(project_dir: Path) -> None: |
| 1625 | """Write .cursor/rules/graphify.mdc with alwaysApply: true.""" |
| 1626 | rule_path = (project_dir or Path(".")) / _CURSOR_RULE_PATH |
| 1627 | rule_path.parent.mkdir(parents=True, exist_ok=True) |
| 1628 | if rule_path.exists() and rule_path.read_text(encoding="utf-8") == _CURSOR_RULE: |
| 1629 | print(f"graphify rule at {rule_path} already configured (no change)") |
| 1630 | return |
| 1631 | # File is wholly graphify-owned. Overwrite on upgrade so older |
| 1632 | # report-first wording does not silently linger (issue #580). |
| 1633 | action = "updated" if rule_path.exists() else "written" |
| 1634 | rule_path.write_text(_CURSOR_RULE, encoding="utf-8") |
| 1635 | print(f"graphify rule {action} at {rule_path.resolve()}") |
| 1636 | print() |
| 1637 | print("Cursor will now always include the knowledge graph context.") |
| 1638 | print("Run /graphify . first to build the graph if you haven't already.") |
| 1639 | def _cursor_uninstall(project_dir: Path) -> None: |
| 1640 | """Remove .cursor/rules/graphify.mdc.""" |
| 1641 | rule_path = (project_dir or Path(".")) / _CURSOR_RULE_PATH |