Install the OpenCode user-level plugin for code-review-graph. Writes ``~/.config/opencode/plugins/crg-plugin.ts``. Creates the directories if they don't exist. If the file already exists it is overwritten (the plugin is self-contained and idempotent). Returns: Path to the
()
| 1462 | |
| 1463 | |
| 1464 | def install_opencode_plugin() -> Path: |
| 1465 | """Install the OpenCode user-level plugin for code-review-graph. |
| 1466 | |
| 1467 | Writes ``~/.config/opencode/plugins/crg-plugin.ts``. Creates the |
| 1468 | directories if they don't exist. If the file already exists it is |
| 1469 | overwritten (the plugin is self-contained and idempotent). |
| 1470 | |
| 1471 | Returns: |
| 1472 | Path to the plugin file that was written. |
| 1473 | """ |
| 1474 | plugins_dir = Path.home() / ".config" / "opencode" / "plugins" |
| 1475 | plugin_path = plugins_dir / "crg-plugin.ts" |
| 1476 | |
| 1477 | plugins_dir.mkdir(parents=True, exist_ok=True) |
| 1478 | plugin_path.write_text(_opencode_plugin_content(), encoding="utf-8") |
| 1479 | logger.info("Wrote OpenCode plugin: %s", plugin_path) |
| 1480 | |
| 1481 | return plugin_path |