A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: opencode marimo-pair skill discovery (#9225)
Myles Scolnick711512405384
diff --git a/marimo/_cli/pair/commands.py b/marimo/_cli/pair/commands.pyindex baf73e2f37..adf618091c 100644--- a/marimo/_cli/pair/commands.py+++ b/marimo/_cli/pair/commands.py@@ -48,26 +48,52 @@ def _claude_skill_dirs() -> list[Path]:return [root / sub for root in roots for sub in subdirs]-AGENTS: dict[str, AgentConfig] = {- "claude": AgentConfig(- name="Claude Code",- skill_dirs=_claude_skill_dirs(),- ),- "codex": AgentConfig(- name="Codex",- skill_dirs=[- Path.home() / ".codex" / "skills",- Path.cwd() / ".codex" / "skills",- ],- ),- "opencode": AgentConfig(- name="opencode",- skill_dirs=[- Path.home() / ".config" / "opencode" / "skills",- Path.cwd() / ".config" / "opencode" / "skills",- ],- ),-}+def _opencode_skill_dirs() -> list[Path]:+ """Return directories where an opencode skill (or compatible layout) may live.++ https://opencode.ai/docs/skills/+ Checked roots are the parent of ``<skill-name>/SKILL.md`` for:++ - Project opencode: ``.opencode/skills/``+ - Global opencode: ``~/.config/opencode/skills/``+ - Project Claude-compatible: ``.claude/skills/``+ - Global Claude-compatible: ``~/.claude/skills/``+ - Project agent-compatible: ``.agents/skills/``+ - Global agent-compatible: ``~/.agents/skills/``+ """+ cwd = Path.cwd()+ home = Path.home()+ return [+ cwd / ".opencode" / "skills",+ home / ".config" / "opencode" / "skills",+ cwd / ".claude" / "skills",+ home / ".claude" / "skills",+ cwd / ".agents" / "skills",+ home / ".agents" / "skills",+ ]+++def pair_agents() -> dict[str, AgentConfig]:+ """Return agent configs; paths use ``Path.cwd()`` at call time."""+ cwd = Path.cwd()+ home = Path.home()+ return {+ "claude": AgentConfig(+ name="Claude Code",+ skill_dirs=_claude_skill_dirs(),+ ),+ "codex": AgentConfig(+ name="Codex",+ skill_dirs=[+ home / ".codex" / "skills",+ cwd / ".codex" / "skills",+ ],+ ),+ "opencode": AgentConfig(+ name="opencode",+ skill_dirs=_opencode_skill_dirs(),+ ),+ }@click.group(@@ -137,7 +163,7 @@ def prompt("codex": codex,"opencode": opencode,}- for key, agent in AGENTS.items():+ for key, agent in pair_agents().items():if not selected_agents[key]:continueif not agent.has_skill():diff --git a/tests/_cli/test_cli_pair.py b/tests/_cli/test_cli_pair.pyindex 0939f840d9..2499d1199c 100644--- a/tests/_cli/test_cli_pair.py+++ b/tests/_cli/test_cli_pair.py@@ -3,21 +3,18 @@ from __future__ import annotationsimport hashlibimport sys-from typing import TYPE_CHECKING+from pathlib import Pathfrom unittest.mock import patchfrom click.testing import CliRunnerfrom marimo._cli.cli import main as cli_main-from marimo._cli.pair.commands import AgentConfig+from marimo._cli.pair.commands import AgentConfig, _opencode_skill_dirs_runner = CliRunner()TEST_URL = "https://localhost:8000?auth=tok123"-if TYPE_CHECKING:- from pathlib import Path-class TestPairGroup:def test_pair_help(self) -> None:@@ -152,6 +149,20 @@ class TestPairPromptWithToken:assert "cat" not in result.output+class TestOpencodeSkillDirs:+ def test_opencode_skill_dirs(self) -> None:+ cwd = Path.cwd()+ home = Path.home()+ assert _opencode_skill_dirs() == [+ cwd / ".opencode" / "skills",+ home / ".config" / "opencode" / "skills",+ cwd / ".claude" / "skills",+ home / ".claude" / "skills",+ cwd / ".agents" / "skills",+ home / ".agents" / "skills",+ ]++class TestAgentConfig:def test_has_skill_true(self, tmp_path: Path) -> None:skill_dir = tmp_path / "skills"