Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(skills): remove Claude plugin Skill discovery (#2547)

Call White23aae1edf89d
diff --git a/core/handlers/session_handler.py b/core/handlers/session_handler.py
index fe049484e..2d80a8ac5 100644
--- a/core/handlers/session_handler.py
+++ b/core/handlers/session_handler.py
@@ -46,7 +46,6 @@ from core.agent_tool_policy import (
from core.agent_session_context import resolve_context_agent_session_target
from core.caller_context import AVIBE_SESSION_ID_ENV, caller_env_for_platform_payload
from core.managed_skills import (
- managed_skill_claude_cli_path,
managed_skill_environment,
managed_skill_project_base,
)
@@ -556,9 +555,6 @@ class SessionHandler(BaseHandler):
!= managed_skill_environment(
working_path,
project_base=managed_skill_project_base(context),
- claude_cli_path=managed_skill_claude_cli_path(
- SimpleNamespace(claude=launch_inputs.config) if launch_inputs is not None else self.config
- ),
),
),
("git_path_changed", getattr(client, "_vibe_git_path_state", None) != self._claude_git_path_state(working_path)),
@@ -1738,7 +1734,6 @@ class SessionHandler(BaseHandler):
managed_skill_environment(
working_path,
project_base=managed_skill_project_base(context),
- claude_cli_path=managed_skill_claude_cli_path(launch_config),
)
)
prepend_managed_tools_to_path(
@@ -1828,7 +1823,6 @@ class SessionHandler(BaseHandler):
managed_skill_environment(
working_path,
project_base=managed_skill_project_base(context),
- claude_cli_path=managed_skill_claude_cli_path(launch_config),
),
)
setattr(client, "_vibe_git_path_state", git_path_state)
@@ -1968,7 +1962,6 @@ class SessionHandler(BaseHandler):
enabled_agents=get_enabled_agents_for_prompt(self.controller),
skills_cwd=working_path,
skills_project_base=managed_skill_project_base(context),
- skills_claude_cli_path=managed_skill_claude_cli_path(SimpleNamespace(claude=claude_config)),
skill_catalog_sink=skill_catalog_sink,
)
diff --git a/core/managed_skills.py b/core/managed_skills.py
index 8f54ef100..0b513b786 100644
--- a/core/managed_skills.py
+++ b/core/managed_skills.py
@@ -4,15 +4,10 @@ from __future__ import annotations
import errno
import html
-import json
import logging
import os
import re
-import shutil
import stat
-import subprocess
-import threading
-import time
import unicodedata
from dataclasses import dataclass, replace
from pathlib import Path
@@ -38,7 +33,6 @@ BUILTIN_SKILLS_SNAPSHOT_ENV = "AVIBE_BUILTIN_SKILLS_SNAPSHOT_ID"
SKILL_HOME_ENV = "AVIBE_SKILL_HOME"
SKILL_CODEX_HOME_ENV = "AVIBE_SKILL_CODEX_HOME"
SKILL_CLAUDE_HOME_ENV = "AVIBE_SKILL_CLAUDE_HOME"
-SKILL_CLAUDE_CLI_PATH_ENV = "AVIBE_SKILL_CLAUDE_CLI_PATH"
SKILL_XDG_CONFIG_HOME_ENV = "AVIBE_SKILL_XDG_CONFIG_HOME"
CATALOG_PAGE_SIZE = 25
@@ -53,9 +47,6 @@ DISCOVERY_CLASS_MAX_CHILDREN = 4096
PROJECT_ROOT_MAX_DIRECTORIES = 128
BUILTIN_TREE_MAX_ENTRIES = 4096
BUILTIN_TREE_MAX_BYTES = 32 * 1024 * 1024
-CLAUDE_PLUGIN_LIST_MAX_BYTES = 1024 * 1024
-CLAUDE_PLUGIN_LIST_MAX_ENTRIES = 256
-CLAUDE_PLUGIN_LIST_TIMEOUT_SECONDS = 1
_LEGACY_SNAPSHOT_ID_RE = re.compile(r"^[0-9a-f]{64}$")
_PORTABLE_NAME_RE = re.compile(r"^[a-z0-9]+(?:-[a-z0-9]+)*$")
@@ -757,7 +748,10 @@ def _project_base_for_working_directory(
raw = Path(project_base).expanduser()
if not raw.is_absolute():
return None
- resolved = raw.resolve()
+ try:
+ resolved = raw.resolve()
+ except (OSError, RuntimeError):
+ return None
try:
relative = working_directory.relative_to(resolved)
except ValueError:
@@ -776,17 +770,6 @@ def managed_skill_project_base(context: Any) -> str | None:
return str(value) if isinstance(value, str) and value else None
-def managed_skill_claude_cli_path(config: Any) -> str | None:
- """Return the Claude executable selected by the live runtime config."""
-
- claude = getattr(config, "claude", None)
- if claude is None:
- claude = getattr(getattr(config, "agents", None), "claude", None)
- value = getattr(claude, "cli_path", None)
- normalized = str(value).strip() if value is not None else ""
- return os.path.expanduser(normalized) if normalized else None
-
-
def _working_directory(cwd: str | Path | None) -> Path:
if cwd is not None:
return Path(cwd).expanduser().resolve()
@@ -888,143 +871,6 @@ def _readable_builtin_catalog(root: Path) -> bool:
return False
-def _claude_plugin_skill_roots(
- working_directory: Path,
- claude_home: Path,
- claude_cli_path: str | None,
-) -> list[Path]:
- registry = claude_home / "plugins" / "installed_plugins.json"
- try:
- if not registry.is_file():
- return []
- except OSError:
- return []
-
- command = (
- claude_cli_path
- or os.environ.get(SKILL_CLAUDE_CLI_PATH_ENV)
- or os.environ.get("CLAUDE_CLI_PATH")
- or shutil.which("claude")
- )
- if not command:
- return []
- environment = dict(os.environ)
- environment["CLAUDE_CONFIG_DIR"] = str(claude_home)
- output = _bounded_subprocess_stdout(
- [command, "plugin", "list", "--json"],
- cwd=working_directory,
- env=environment,
- timeout=CLAUDE_PLUGIN_LIST_TIMEOUT_SECONDS,
- max_bytes=CLAUDE_PLUGIN_LIST_MAX_BYTES,
- )
- if output is None:
- return []
- try:
- payload = json.loads(output.decode("utf-8"))
- except (UnicodeDecodeError, json.JSONDecodeError):
- return []
- if not isinstance(payload, list) or len(payload) > CLAUDE_PLUGIN_LIST_MAX_ENTRIES:
- return []
-
- roots: list[tuple[str, Path]] = []
- for item in payload:
- if not isinstance(item, dict) or item.get("enabled") is not True:
- continue
- plugin_id = item.get("id")
- install_path = item.get("installPath")
- if not isinstance(plugin_id, str) or not isinstance(install_path, str):
- continue
- raw_path = Path(install_path).expanduser()
- if not raw_path.is_absolute():
- continue
- root = _absolute_path(raw_path) / "skills"
- if not _path_is_utf8(root):
- continue
- roots.append((plugin_id, root))
- return [root for _, root in sorted(roots, key=lambda item: (item[0], str(item[1])))]
-
-
-def _bounded_subprocess_stdout(
- command: Sequence[str],
- *,
- cwd: Path,
- env: dict[str, str],
- timeout: float,
- max_bytes: int,
-) -> bytes | None:
- """Capture stdout while bounding combined stdout and stderr in memory."""
-
- try:
- process = subprocess.Popen(
- command,
- cwd=cwd,
- env=env,
- stdin=subprocess.DEVNULL,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- )
- except OSError:
- logger.info("Unable to start bounded subprocess", exc_info=True)
- return None
-
- stdout = bytearray()
- total_bytes = 0
- lock = threading.Lock()
- limit_exceeded = threading.Event()
-
- def drain(stream, *, collect: bool) -> None:
- nonlocal total_bytes
- try:
- while chunk := stream.read(64 * 1024):
- with lock:
- total_bytes += len(chunk)
- if collect and len(stdout) <= max_bytes:
- remaining = max_bytes + 1 - len(stdout)
- stdout.extend(chunk[:remaining])
- if total_bytes > max_bytes:
- limit_exceeded.set()
- except (OSError, ValueError):
- return
-
- assert process.stdout is not None
- assert process.stderr is not None
- streams = (process.stdout, process.stderr)
- threads = (
- threading.Thread(target=drain, args=(process.stdout,), kwargs={"collect": True}, daemon=True),
- threading.Thread(target=drain, args=(process.stderr,), kwargs={"collect": False}, daemon=True),
- )
- for thread in threads:
- thread.start()
-
- deadline = time.monotonic() + timeout
- timed_out = False
- while process.poll() is None:
- remaining = deadline - time.monotonic()
- if remaining <= 0:
- timed_out = True
- break
- if limit_exceeded.wait(min(0.02, remaining)):
- break
-
- if (timed_out or limit_exceeded.is_set()) and process.poll() is None:
- process.kill()
- try:
- process.wait(timeout=1)
- except subprocess.TimeoutExpired:
- process.kill()
- process.wait()
-
- for thread in threads:
- thread.join(timeout=1)
- if any(thread.is_alive() for thread in threads):
- for stream in streams:
- stream.close()
- return None
- if timed_out or limit_exceeded.is_set() or process.returncode != 0:
- return None
- return bytes(stdout)
-
-
def resolve_skills(
cwd: str | Path | None = None,
*,
@@ -1033,7 +879,6 @@ def resolve_skills(
avibe_home: str | Path | None = None,
codex_home: str | Path | None = None,
claude_home: str | Path | None = None,
- claude_cli_path: str | None = None,
xdg_config_home: str | Path | None = None,
builtin_catalog_root: str | Path | None = None,
) -> list[ManagedSkill]:
@@ -1145,27 +990,11 @@ def resolve_skills(
)
)
- for root in _claude_plugin_skill_roots(
- working_directory,
- resolved_claude_home,
- claude_cli_path,
- ):
- if compatibility_budget.exhausted:
- break
- candidates.extend(
- _scan_root(
- root,
- priority=(2, 0, 5),
- budget=compatibility_budget,
- seen_directory_identities=compatibility_directory_identities,
- )
- )
-
if not compatibility_budget.exhausted:
candidates.extend(
_scan_root(
resolved_codex_home / "skills" / ".system",
- priority=(2, 0, 6),
+ priority=(2, 0, 5),
budget=compatibility_budget,
seen_directory_identities=compatibility_directory_identities,
)
@@ -1691,7 +1520,6 @@ def managed_skill_environment(
*,
project_base: str | Path | None = None,
builtin_catalog_root: str | Path | None = None,
- claude_cli_path: str | None = None,
) -> dict[str, str]:
"""Return the per-backend shell bindings consumed by ``vibe skill``."""
@@ -1719,11 +1547,6 @@ def managed_skill_environment(
SKILL_XDG_CONFIG_HOME_ENV: str(resolved_xdg_home),
}
)
- normalized_claude_cli_path = str(claude_cli_path or "").strip()
- if normalized_claude_cli_path:
- env[SKILL_CLAUDE_CLI_PATH_ENV] = os.path.expanduser(
- normalized_claude_cli_path
- )
if builtin_catalog_root is not None:
bound_root = builtin_catalog_root
elif BUILTIN_SKILLS_ROOT_ENV in os.environ:
diff --git a/core/system_prompt_injection.py b/core/system_prompt_injection.py
index 1882272a1..8be8d5b2b 100644
--- a/core/system_prompt_injection.py
+++ b/core/system_prompt_injection.py
@@ -200,7 +200,6 @@ def build_system_prompt_blocks(
enabled_agents: Optional[Iterable[Any]] = None,
skills_cwd: str | Path | None = None,
skills_project_base: str | Path | None = None,
- skills_claude_cli_path: str | None = None,
skill_catalog_sink: list[dict[str, Any]] | None = None,
) -> list[RenderedPromptBlock]:
"""The production composition, also exported by the debug command."""
@@ -212,7 +211,6 @@ def build_system_prompt_blocks(
skills = resolve_skills(
skills_cwd,
project_base=skills_project_base,
- claude_cli_path=skills_claude_cli_path,
)
advertisable_skills = [] if skills is None else [skill for skill in skills if not skill.disable_model_invocation]
diff --git a/docs/CLI.md b/docs/CLI.md
index b4aed5db7..ccb4702c6 100644
--- a/docs/CLI.md
+++ b/docs/CLI.md
@@ -148,15 +148,13 @@ Avibe discovers existing Skills without moving them:
project base. This boundary can sit above a nested Git checkout. Standalone
commands without a bound project use the first Git root instead;
- global Skills under `~/.agents/skills`, the configured Codex and Claude Skill
- directories, the OpenCode directory under `XDG_CONFIG_HOME`, and enabled
- Claude plugin Skill directories; and
+ directories, and the OpenCode directory under `XDG_CONFIG_HOME`; and
- Avibe built-ins plus Codex's bundled system Skills.
Built-ins win name conflicts, then project Skills, then global Skills. Within a
project the nearer directory wins; at the same depth the order is `.agents`,
`.codex`, `.claude`, then `.opencode`. User Skills win over Codex bundled
-defaults; enabled Claude plugin Skills follow the four static user directories
-but also win over those defaults. New global installs should use
+defaults. Claude plugin Skills are not part of the static catalog. New global installs should use
`~/.agents/skills/<name>`; project installs should use
`<project>/.agents/skills/<name>`.
diff --git a/docs/CLI_ZH.md b/docs/CLI_ZH.md
index ca00149c5..003a7fb54 100644
--- a/docs/CLI_ZH.md
+++ b/docs/CLI_ZH.md
@@ -124,13 +124,13 @@ Avibe 会直接发现现有 Skill,无需迁移:
`.codex/skills`、`.claude/skills` 和 `.opencode/skills`。该边界可以位于嵌套 Git
仓库之上;未绑定项目的独立命令则以遇到的第一个 Git 根目录为边界;
- 全局:查找 `~/.agents/skills`、Codex 与 Claude 配置的 Skill 目录,以及
- `XDG_CONFIG_HOME` 下的 OpenCode 目录和已启用的 Claude 插件 Skill 目录;
+ `XDG_CONFIG_HOME` 下的 OpenCode 目录;
- Avibe 内置 Skill,以及 Codex 自带的 system Skill。
同名冲突时,内置 Skill 优先,其次是项目级,再次是全局。项目内更近的目录优先;
同一层级依次为 `.agents`、`.codex`、`.claude`、`.opencode`。用户 Skill 优先于
-Codex 自带的默认项;已启用的 Claude 插件 Skill 排在四个静态用户目录之后,但同样
-优先于这些默认项。新的全局 Skill 默认安装到 `~/.agents/skills/<name>`,项目级 Skill
+Codex 自带的默认项。Claude 插件中的 Skill 不属于静态目录。新的全局 Skill 默认安装到
+`~/.agents/skills/<name>`,项目级 Skill
安装到 `<project>/.agents/skills/<name>`。
每次命令都会从磁盘重新解析,每个由 Avibe 发起的新 Turn 也会重新生成 Catalog。
diff --git a/docs/plans/managed-skills.md b/docs/plans/managed-skills.md
index 8f847c649..69ff30d04 100644
--- a/docs/plans/managed-skills.md
+++ b/docs/plans/managed-skills.md
@@ -128,10 +128,9 @@ ${XDG_CONFIG_HOME:-$HOME/.config}/opencode/skills
${CODEX_HOME:-$HOME/.codex}/skills/.system
```
-When Claude reports enabled plugins through its supported CLI, their standard
-`skills` directories are also best-effort compatibility roots. Plugin lookup
-failure omits only plugin roots; it never prevents static discovery or a
-backend Turn.
+Claude plugin Skills are intentionally not part of this resolver. It reads only the ordinary static project and user
+Skill roots described above; it does not read plugin registries, caches, manifests, settings, or other plugin
+sources, and Skill resolution never starts the Claude CLI.
Native locations are read in place. Avibe does not migrate or rename them, and
the Catalog never annotates their source. A successful load still includes the
@@ -165,8 +164,8 @@ Within the same project depth or global scope, family order is:
Here `OpenCode` maps to `.opencode/skills` for project discovery and
`${XDG_CONFIG_HOME:-$HOME/.config}/opencode/skills` for global discovery. The
-`.avibe` family slot is reserved in v1. Enabled Claude plugin roots follow the
-static user roots, and Codex `.system` defaults are last. A final stable path
+`.avibe` family slot is reserved in v1, and Codex `.system` defaults are last.
+A final stable path
order breaks any remaining tie. Winners are sorted by name before Catalog
pagination.
diff --git a/modules/agents/codex/agent.py b/modules/agents/codex/agent.py
index fb8826629..60cb494d7 100644
--- a/modules/agents/codex/agent.py
+++ b/modules/agents/codex/agent.py
@@ -28,7 +28,6 @@ from core.agent_input import AgentInputMetadata
from core.caller_context import caller_env_for_platform_payload
from core.message_output import stop_output_for, terminal_output_for
from core.managed_skills import (
- managed_skill_claude_cli_path,
managed_skill_environment,
managed_skill_project_base,
)
@@ -3119,9 +3118,6 @@ class CodexAgent(BaseAgent):
managed_skill_environment(
getattr(request, "working_path", None),
project_base=managed_skill_project_base(context),
- claude_cli_path=managed_skill_claude_cli_path(
- getattr(getattr(self, "controller", None), "config", None)
- ),
)
)
return env
@@ -4025,9 +4021,6 @@ class CodexAgent(BaseAgent):
enabled_agents=get_enabled_agents_for_prompt(self.controller),
skills_cwd=getattr(request, "working_path", None),
skills_project_base=managed_skill_project_base(request.context),
- skills_claude_cli_path=managed_skill_claude_cli_path(
- getattr(getattr(self, "controller", None), "config", None)
- ),
skill_catalog_sink=skill_catalog_sink,
)
diff --git a/modules/agents/opencode/agent.py b/modules/agents/opencode/agent.py
index 87e908133..f888f9686 100644
--- a/modules/agents/opencode/agent.py
+++ b/modules/agents/opencode/agent.py
@@ -32,7 +32,6 @@ from core.caller_context import (
from core.message_output import stop_output_for
from core.managed_skills import (
BUILTIN_SKILLS_ROOT_ENV,
- managed_skill_claude_cli_path,
managed_skill_environment,
managed_skill_project_base,
)
@@ -1802,9 +1801,6 @@ class OpenCodeAgent(OpenCodeMessageProcessorMixin, BaseAgent):
managed_skills_env = managed_skill_environment(
request.working_path,
project_base=project_base,
- claude_cli_path=managed_skill_claude_cli_path(
- getattr(getattr(self, "controller", None), "config", None)
- ),
)
binding_extra_env = {**caller_context_env, **managed_skills_env}
binding_token = secrets.token_hex(16)
@@ -1859,9 +1855,6 @@ class OpenCodeAgent(OpenCodeMessageProcessorMixin, BaseAgent):
enabled_agents=get_enabled_agents_for_prompt(self.controller),
skills_cwd=request.working_path if binding_bound else None,
skills_project_base=project_base,
- skills_claude_cli_path=managed_skill_claude_cli_path(
- getattr(getattr(self, "controller", None), "config", None)
- ),
skill_catalog_sink=skill_catalog_sink,
)
raw_settings_key = _raw_settings_key_from_session_key(request.session_key)
@@ -2997,9 +2990,6 @@ class OpenCodeAgent(OpenCodeMessageProcessorMixin, BaseAgent):
restored_managed_skills_env = managed_skill_environment(
poll_info.working_path,
project_base=restored_project_base,
- claude_cli_path=managed_skill_claude_cli_path(
- getattr(getattr(self, "controller", None), "config", None)
- ),
builtin_catalog_root=restored_catalog_root,
)
restored_bound = False
diff --git a/modules/agents/vibey/agent.py b/modules/agents/vibey/agent.py
index 9d10faeb1..7fb970d0d 100644
--- a/modules/agents/vibey/agent.py
+++ b/modules/agents/vibey/agent.py
@@ -1237,9 +1237,9 @@ class VibeyAgent(BaseAgent):
"""Avibe's injected prompt sections and the skill catalog they offered.
Built off the event loop as the other backends build them: skill resolution
- scans the filesystem and may run ``claude plugin list``.
+ scans the ordinary static Skill directories.
"""
- from core.managed_skills import managed_skill_claude_cli_path, managed_skill_project_base
+ from core.managed_skills import managed_skill_project_base
from core.system_prompt_injection import build_system_prompt_injection, get_enabled_agents_for_prompt
context = request.context
@@ -1257,7 +1257,6 @@ class VibeyAgent(BaseAgent):
enabled_agents=get_enabled_agents_for_prompt(self.controller),
skills_cwd=cwd or None,
skills_project_base=managed_skill_project_base(context),
- skills_claude_cli_path=managed_skill_claude_cli_path(self.config),
skill_catalog_sink=skill_catalog_sink,
)
@@ -1289,7 +1288,6 @@ class VibeyAgent(BaseAgent):
from core.caller_context import caller_env_for_platform_payload, environment_without_caller_context
from core.agent_path import prepend_managed_tools_to_path
from core.managed_skills import (
- managed_skill_claude_cli_path,
managed_skill_environment,
managed_skill_project_base,
)
@@ -1307,7 +1305,6 @@ class VibeyAgent(BaseAgent):
managed_skill_environment(
cwd or None,
project_base=managed_skill_project_base(context),
- claude_cli_path=managed_skill_claude_cli_path(self.config),
)
)
prepend_managed_tools_to_path(environment, base_env=environment, working_dir=cwd or None)
diff --git a/tests/conftest.py b/tests/conftest.py
index fb438eb2a..7353ae29d 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -114,7 +114,6 @@ _CALLER_ENV = (
"AVIBE_SKILL_HOME",
"AVIBE_SKILL_CODEX_HOME",
"AVIBE_SKILL_CLAUDE_HOME",
- "AVIBE_SKILL_CLAUDE_CLI_PATH",
"AVIBE_SKILL_XDG_CONFIG_HOME",
"AVIBE_BUILTIN_SKILLS_ROOT",
"AVIBE_BUILTIN_SKILLS_SNAPSHOT_ID",
diff --git a/tests/test_managed_skills.py b/tests/test_managed_skills.py
index 7e2428c3e..046b5cd5c 100644
--- a/tests/test_managed_skills.py
+++ b/tests/test_managed_skills.py
@@ -1,6 +1,5 @@
from __future__ import annotations
-import json
import os
import stat
import sys
@@ -12,11 +11,11 @@ import pytest
from core import managed_skills
from core.managed_skills import (
BUILTIN_SKILLS_ROOT_ENV,
+ BUILTIN_SKILLS_SNAPSHOT_ENV,
CATALOG_DESCRIPTION_MAX_CHARS,
CATALOG_PAGE_MAX_BYTES,
CATALOG_PAGE_SIZE,
SKILL_BODY_MAX_BYTES,
- SKILL_CLAUDE_CLI_PATH_ENV,
SKILL_CLAUDE_HOME_ENV,
SKILL_CODEX_HOME_ENV,
SKILL_HOME_ENV,
@@ -37,6 +36,8 @@ from core.system_prompt_injection import build_system_prompt_injection
from modules.im import MessageContext
+
+
def _write_skill(
root: Path,
directory: str,
@@ -1148,156 +1149,6 @@ def test_distinct_same_name_candidates_keep_precedence_winner(tmp_path: Path) ->
assert skills[0].description == "Codex"
-def test_enabled_claude_plugin_skills_join_the_managed_catalog(
- tmp_path: Path,
- monkeypatch,
-) -> None:
- home, cwd = _isolate_live_commands(monkeypatch, tmp_path)
- claude_home = home / ".claude"
- registry = claude_home / "plugins" / "installed_plugins.json"
- registry.parent.mkdir(parents=True)
- registry.write_text('{"version": 2, "plugins": {}}', encoding="utf-8")
- plugin = tmp_path / "plugin-cache" / "formatter"
- _write_skill(plugin / "skills", "format-code", "format-code", "Format code")
- captured = {}
-
- def plugin_list(command, **kwargs):
- captured.update(command=command, **kwargs)
- return json.dumps(
- [
- {
- "id": "formatter@example",
- "enabled": True,
- "installPath": str(plugin),
- },
- {
- "id": "disabled@example",
- "enabled": False,
- "installPath": str(tmp_path / "disabled"),
- },
- ]
- ).encode()
-
- monkeypatch.setattr(managed_skills, "_bounded_subprocess_stdout", plugin_list)
-
- skills = resolve_skills(
- cwd,
- home=home,
- avibe_home=tmp_path / "avibe",
- codex_home=home / ".codex",
- claude_home=claude_home,
- claude_cli_path="/opt/claude-custom",
- xdg_config_home=home / ".config",
- builtin_catalog_root="",
- )
-
- assert [skill.name for skill in skills] == ["format-code"]
- assert captured["command"] == [
- "/opt/claude-custom",
- "plugin",
- "list",
- "--json",
- ]
- assert captured["cwd"] == cwd
- assert captured["env"]["CLAUDE_CONFIG_DIR"] == str(claude_home)
- assert captured["timeout"] == managed_skills.CLAUDE_PLUGIN_LIST_TIMEOUT_SECONDS
- assert captured["max_bytes"] == managed_skills.CLAUDE_PLUGIN_LIST_MAX_BYTES
-
-
- ("stdout_bytes", "stderr_bytes"),
- [(4097, 0), (0, 4097), (2049, 2049)],
-)
-def test_bounded_subprocess_capture_rejects_oversized_combined_output(
- tmp_path: Path,
- stdout_bytes: int,
- stderr_bytes: int,
-) -> None:
- limit = 4096
-
- assert managed_skills._bounded_subprocess_stdout(
- [
- sys.executable,
- "-c",
- (
- "import os; "
- f"os.write(1, b'x' * {stdout_bytes}); "
- f"os.write(2, b'x' * {stderr_bytes})"
- ),
- ],
- cwd=tmp_path,
- env=dict(os.environ),
- timeout=1,
- max_bytes=limit,
- ) is None
-
-
-def test_bounded_subprocess_capture_rejects_timeout(tmp_path: Path) -> None:
- assert managed_skills._bounded_subprocess_stdout(
- [sys.executable, "-c", "import time; time.sleep(1)"],
- cwd=tmp_path,
- env=dict(os.environ),
- timeout=0.01,
- max_bytes=4096,
- ) is None
-
-
-def test_claude_plugin_discovery_fails_closed_when_capture_fails(
- tmp_path: Path,
- monkeypatch,
-) -> None:
- home, cwd = _isolate_live_commands(monkeypatch, tmp_path)
- claude_home = home / ".claude"
- registry = claude_home / "plugins" / "installed_plugins.json"
- registry.parent.mkdir(parents=True)
- registry.write_text("{}", encoding="utf-8")
- monkeypatch.setattr(managed_skills.shutil, "which", lambda _: "/usr/bin/claude")
-
- monkeypatch.setattr(managed_skills, "_bounded_subprocess_stdout", lambda *args, **kwargs: None)
-
- assert resolve_skills(
- cwd,
- home=home,
- avibe_home=tmp_path / "avibe",
- codex_home=home / ".codex",
- claude_home=claude_home,
- xdg_config_home=home / ".config",
- builtin_catalog_root="",
- ) == []
-
-
-def test_enabled_claude_plugin_skill_overrides_codex_system_default(
- tmp_path: Path,
- monkeypatch,
-) -> None:
- home, cwd = _isolate_live_commands(monkeypatch, tmp_path)
- claude_home = home / ".claude"
- registry = claude_home / "plugins" / "installed_plugins.json"
- registry.parent.mkdir(parents=True)
- registry.write_text("{}", encoding="utf-8")
- plugin = tmp_path / "plugin-cache" / "formatter"
- plugin_skill = _write_skill(plugin / "skills", "shared", "shared", "Plugin")
- _write_skill(home / ".codex" / "skills" / ".system", "shared", "shared", "System")
- payload = json.dumps(
- [{"id": "formatter@example", "enabled": True, "installPath": str(plugin)}]
- ).encode()
- monkeypatch.setattr(managed_skills, "_bounded_subprocess_stdout", lambda *args, **kwargs: payload)
-
- skills = resolve_skills(
- cwd,
- home=home,
- avibe_home=tmp_path / "avibe",
- codex_home=home / ".codex",
- claude_home=claude_home,
- claude_cli_path="/opt/claude-custom",
- xdg_config_home=home / ".config",
- builtin_catalog_root="",
- )
-
- assert len(skills) == 1
- assert skills[0].directory == plugin_skill.parent.resolve()
-
-
def test_publication_overwrites_the_named_catalog_and_preserves_executable_modes(
tmp_path: Path,
) -> None:
@@ -1925,19 +1776,6 @@ def test_managed_skill_environment_binds_valid_project_base(tmp_path: Path) -> N
)
-def test_managed_skill_environment_binds_configured_claude_cli_path(
- tmp_path: Path,
-) -> None:
- env = managed_skill_environment(
- tmp_path,
- claude_cli_path="~/tools/claude-custom",
- )
-
- assert env[SKILL_CLAUDE_CLI_PATH_ENV] == str(
- Path("~/tools/claude-custom").expanduser()
- )
-
-
def test_managed_skill_environment_can_retain_an_explicit_builtin_catalog(
tmp_path: Path,
) -> None: