refactor: move operators/ TOML data into src/openjarvis/operators/data/

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jon Saad-Falcon
2026-03-02 20:57:52 +00:00
co-authored by Claude Opus 4.6
parent f236bf3012
commit 99d8f39613
7 changed files with 12 additions and 7 deletions
+8 -3
View File
@@ -10,6 +10,11 @@ from rich.console import Console
from rich.table import Table
def _builtin_operators_dir() -> Path:
"""Return the path to built-in operator manifests shipped with the package."""
return Path(__file__).resolve().parents[1] / "operators" / "data"
@click.group()
def operators() -> None:
"""Manage operators — persistent, scheduled autonomous agents."""
@@ -32,7 +37,7 @@ def list_operators() -> None:
# Also check project-local operators/ directory
project_dirs = [manifests_dir]
local_ops = Path("operators")
local_ops = _builtin_operators_dir()
if local_ops.is_dir():
project_dirs.append(local_ops)
@@ -244,7 +249,7 @@ def _find_manifest(operator_id: str):
from openjarvis.core.config import DEFAULT_CONFIG_DIR
from openjarvis.operators.loader import load_operator
dirs = [DEFAULT_CONFIG_DIR / "operators", Path("operators")]
dirs = [DEFAULT_CONFIG_DIR / "operators", _builtin_operators_dir()]
for d in dirs:
if not d.is_dir():
continue
@@ -271,7 +276,7 @@ def _build_system_with_operators():
# Discover from known directories
from openjarvis.core.config import DEFAULT_CONFIG_DIR
for d in [DEFAULT_CONFIG_DIR / "operators", Path("operators")]:
for d in [DEFAULT_CONFIG_DIR / "operators", _builtin_operators_dir()]:
if d.is_dir():
manager.discover(d)
+1 -1
View File
@@ -6,7 +6,7 @@ import pytest
from openjarvis.operators.loader import load_operator
_OPERATORS_DIR = Path(__file__).parent.parent.parent / "recipes" / "operators"
_OPERATORS_DIR = Path(__file__).parent.parent.parent / "src" / "openjarvis" / "recipes" / "data" / "operators"
class TestResearcherOperator:
+3 -3
View File
@@ -832,12 +832,12 @@ class TestLoadBundledOperators:
@pytest.fixture
def operators_dir(self):
# Find the project-level operators/ directory
# Find the package-level operators/data/ directory
here = Path(__file__).resolve()
project_root = here.parent.parent.parent
ops_dir = project_root / "operators"
ops_dir = project_root / "src" / "openjarvis" / "operators" / "data"
if not ops_dir.is_dir():
pytest.skip("operators/ directory not found")
pytest.skip("operators/data/ directory not found")
return ops_dir
def test_researcher_loads(self, operators_dir):