| 1065 | except Exception: |
| 1066 | pass |
| 1067 | def install(platform: str = "claude", *, project: bool = False, project_dir: Path | None = None) -> None: |
| 1068 | _print_banner() |
| 1069 | platform = _canonical_platform(platform) |
| 1070 | if platform == "gemini": |
| 1071 | gemini_install(project_dir=project_dir, project=project) |
| 1072 | return |
| 1073 | if platform == "cursor": |
| 1074 | _cursor_install(Path(".")) |
| 1075 | return |
| 1076 | # On Windows, antigravity needs the PowerShell skill, not the bash one |
| 1077 | if platform == "antigravity" and sys.platform == "win32": |
| 1078 | platform = "antigravity-windows" |
| 1079 | if platform not in _PLATFORM_CONFIG: |
| 1080 | print( |
| 1081 | f"error: unknown platform '{platform}'. Choose from: {', '.join(_PLATFORM_CONFIG)}, gemini, cursor", |
| 1082 | file=sys.stderr, |
| 1083 | ) |
| 1084 | sys.exit(1) |
| 1085 | |
| 1086 | cfg = _PLATFORM_CONFIG[platform] |
| 1087 | project_dir = project_dir or Path(".") |
| 1088 | skill_dst = _copy_skill_file(platform, project=project, project_dir=project_dir) |
| 1089 | |
| 1090 | if platform == "kilo": |
| 1091 | # Kilo Code also supports a native /graphify command file. |
| 1092 | command_src = Path(__file__).parent / "command-kilo.md" |
| 1093 | if not command_src.exists(): |
| 1094 | print( |
| 1095 | f"error: command-kilo.md not found in package - reinstall graphify", |
| 1096 | file=sys.stderr, |
| 1097 | ) |
| 1098 | sys.exit(1) |
| 1099 | command_dst = Path.home() / ".config" / "kilo" / "command" / "graphify.md" |
| 1100 | command_dst.parent.mkdir(parents=True, exist_ok=True) |
| 1101 | shutil.copy(command_src, command_dst) |
| 1102 | print(f" command installed -> {command_dst}") |
| 1103 | |
| 1104 | if cfg["claude_md"]: |
| 1105 | # Register in the matching Claude Code scope. Honor CLAUDE_CONFIG_DIR |
| 1106 | # for the global (non-project) case, same as _platform_skill_destination |
| 1107 | # does for the skill copy path (#527) -- this always-on registration |
| 1108 | # path was missed by that fix (#2694). |
| 1109 | if project: |
| 1110 | # Never create .claude/CLAUDE.md beside an AGENTS.md Claude Code reads: |
| 1111 | # it would hide that AGENTS.md. Register in the AGENTS.md instead. |
| 1112 | claude_md = _claude_instructions_file(project_dir) |
| 1113 | if claude_md.name != "AGENTS.md": |
| 1114 | claude_md = project_dir / ".claude" / "CLAUDE.md" |
| 1115 | skill_ref = ".claude/skills/graphify/SKILL.md" |
| 1116 | elif os.environ.get("CLAUDE_CONFIG_DIR"): |
| 1117 | config_dir = Path(os.environ["CLAUDE_CONFIG_DIR"]) |
| 1118 | claude_md = config_dir / "CLAUDE.md" |
| 1119 | skill_ref = str(config_dir / "skills" / "graphify" / "SKILL.md") |
| 1120 | else: |
| 1121 | claude_md = Path.home() / ".claude" / "CLAUDE.md" |
| 1122 | skill_ref = "~/.claude/skills/graphify/SKILL.md" |
| 1123 | _register_always_on_block( |
| 1124 | claude_md, " CLAUDE.md -> ", _skill_registration(skill_ref) |