fix(mem0-agent): bundle a launcher so hooks never depend on a global CLI
SessionStart failed with 'pyenv: mem0-agent: command not found' in any repo whose
.python-version selects a Python the console script was not installed into. A
pip entry point is the wrong dependency for a plugin.
- bin/mem0-agent: POSIX launcher that picks the first CPython >= 3.10 it can find
and runs the package from source (there are no third-party dependencies)
- hooks now invoke ${CLAUDE_PLUGIN_ROOT}/bin/mem0-agent, matching how the v1
plugin calls its own scripts; the generator enforces this
- app_id override renamed to MEM0_AGENT_APP_ID: v1 exports MEM0_PROJECT_ID, which
was silently overriding this plugin's project scope while both are installed
Verified: all six hooks exit 0 from a pyenv-3.11 repo, and app_id resolves per
repository again.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
a07756f6d7
commit
dda5f21332
@@ -215,8 +215,16 @@ def validate(spec: dict) -> dict:
|
||||
raise SpecError(
|
||||
f"hook {entry['id']!r} runs on {entry['event']} and must declare local_only: true"
|
||||
)
|
||||
if not str(entry["command"]).startswith("mem0-agent "):
|
||||
raise SpecError(f"hook {entry['id']!r}: command must invoke the mem0-agent CLI")
|
||||
# Commands must invoke the plugin's own bundled launcher. A bare console script is
|
||||
# not dependable: under pyenv the shim resolves against whichever Python version the
|
||||
# current directory selects, so a repo pinning a different version fails with
|
||||
# "pyenv: mem0-agent: command not found".
|
||||
cmd = str(entry["command"])
|
||||
if not cmd.startswith("${CLAUDE_PLUGIN_ROOT}/bin/mem0-agent "):
|
||||
raise SpecError(
|
||||
f"hook {entry['id']!r}: command must invoke "
|
||||
"${CLAUDE_PLUGIN_ROOT}/bin/mem0-agent"
|
||||
)
|
||||
return spec
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user