Expand description
re-ghidra-cc-hook — the plugin’s SessionStart preflight.
The four ways this plugin fails to start are all environmental: no
GHIDRA_INSTALL_DIR, a directory that is not actually a Ghidra root, a JDK
older than 21, and an unconfigured project. Without this hook each of them
surfaces only on the first tool call, as an error from inside a JVM that
never booted.
Two rules govern what it may do:
- Silent when healthy. It runs on every session start, so a clean environment must produce no output at all. Anything else is noise the user reads once and then learns to ignore.
- Never blocks. It always exits 0. A preflight that can stop a session is worse than the problem it reports — the user may not even intend to touch Ghidra this session.
Every check is filesystem-or-java -version cheap: no JVM boot, no Ghidra
project open.
Functions§
- detect_
java_ 🔒major java -versionwrites to stderr, not stdout. Any spawn failure means “no usable java”, which is exactly what the preflight wants to hear.- event_
cwd 🔒 - Pull
cwdout of the hook event without a full deserialization struct — the field is the only one we want and the schema may grow. - launcher_
exists 🔒 - A Ghidra install root is identified by its headless launcher, the same file the server’s own config validation looks for.
- main 🔒
- overlay_
env 🔒 - Layer the environment over the settings file, matching the server’s own precedence. Empty is treated as unset, as it is there.