MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _opencode_loads_current_plugin

Function _opencode_loads_current_plugin

graphify/__main__.py:389–406  ·  view source on GitHub ↗

True when the ``opencode`` on PATH can load the plugin graphify writes now. That plugin is a default export, which OpenCode reads from 1.3.4 on. Older OpenCode 1 releases call every export as a function and fail on it, while the plugin they already have keeps working, so it must be left

()

Source from the content-addressed store, hash-verified

387
388
389def _opencode_loads_current_plugin() -> bool:
390 """True when the ``opencode`` on PATH can load the plugin graphify writes now.
391
392 That plugin is a default export, which OpenCode reads from 1.3.4 on. Older
393 OpenCode 1 releases call every export as a function and fail on it, while
394 the plugin they already have keeps working, so it must be left alone.
395 Unknown (no ``opencode`` on PATH, no version in its output) counts as no:
396 the refresh is a convenience, ``graphify opencode install`` still rewrites.
397 """
398 exe = shutil.which("opencode")
399 if exe is None:
400 return False
401 try:
402 out = subprocess.run([exe, "--version"], capture_output=True, text=True, timeout=10).stdout
403 except (OSError, subprocess.SubprocessError):
404 return False
405 found = re.search(r"(\d+)\.(\d+)\.(\d+)", out)
406 return found is not None and tuple(int(part) for part in found.groups()) >= (1, 3, 4)
407
408
409def _refresh_v1_opencode_plugins() -> None:

Callers 1

Calls 1

runMethod · 0.65

Tested by

no test coverage detected