mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-30 10:52:15 +00:00
- Rewrite .github/workflows/desktop.yml: 2-job pipeline (validate + build-and-release) with rolling desktop-latest pre-release on push to main and stable desktop-v* releases - Add UpdateChecker component: checks for updates on startup + every 30 min, background download with progress bar, one-click relaunch - Configure Tauri updater: endpoints pointing to desktop-latest release, pubkey placeholder - Add tauri-plugin-process for relaunch support (Cargo.toml, lib.rs, package.json) - Add macOS Entitlements.plist for notarization (network + file access, no sandbox) - Add scripts/bump-desktop-version.sh for atomic version bumps across 3 config files - Add desktop/README.md with dev setup, auto-update architecture, signing docs - Update .gitignore for desktop/node_modules, dist, target - Configure macOS minimumSystemVersion, Windows timestampUrl - Include all Phase 14-21 work: agent hardening, RBAC, taint tracking, workflows, skills, knowledge graph, sessions, A2A, MCP templates, WASM sandbox, TUI dashboard, production tools, CLI expansion, API expansion, learning productionization, Tauri desktop app, and 10 new channels Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
61 lines
2.2 KiB
Python
61 lines
2.2 KiB
Python
"""Tests for the ``jarvis add`` CLI command."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
from unittest import mock
|
|
|
|
from click.testing import CliRunner
|
|
|
|
from openjarvis.cli.add_cmd import _MCP_TEMPLATES, add
|
|
|
|
|
|
class TestAddCmd:
|
|
def test_add_help(self) -> None:
|
|
result = CliRunner().invoke(add, ["--help"])
|
|
assert result.exit_code == 0
|
|
assert "MCP server" in result.output
|
|
|
|
def test_add_unknown_server(self) -> None:
|
|
result = CliRunner().invoke(add, ["unknown_server"])
|
|
assert result.exit_code != 0
|
|
assert "Unknown MCP server" in result.output
|
|
# Should list known servers
|
|
assert "github" in result.output
|
|
assert "filesystem" in result.output
|
|
|
|
def test_add_known_server(self, tmp_path: Path) -> None:
|
|
mcp_dir = tmp_path / "mcp"
|
|
with mock.patch("openjarvis.cli.add_cmd._MCP_CONFIG_DIR", mcp_dir):
|
|
result = CliRunner().invoke(add, ["filesystem"])
|
|
assert result.exit_code == 0
|
|
assert "Added MCP server: filesystem" in result.output
|
|
|
|
config_file = mcp_dir / "filesystem.json"
|
|
assert config_file.exists()
|
|
data = json.loads(config_file.read_text())
|
|
assert data["command"] == "npx"
|
|
assert "@modelcontextprotocol/server-filesystem" in data["args"]
|
|
|
|
def test_add_with_key(self, tmp_path: Path) -> None:
|
|
mcp_dir = tmp_path / "mcp"
|
|
with mock.patch("openjarvis.cli.add_cmd._MCP_CONFIG_DIR", mcp_dir):
|
|
result = CliRunner().invoke(
|
|
add, ["github", "--key", "test_token"],
|
|
)
|
|
assert result.exit_code == 0
|
|
|
|
config_file = mcp_dir / "github.json"
|
|
assert config_file.exists()
|
|
data = json.loads(config_file.read_text())
|
|
assert "env" in data
|
|
assert data["env"]["GITHUB_PERSONAL_ACCESS_TOKEN"] == "test_token"
|
|
|
|
def test_mcp_templates_complete(self) -> None:
|
|
required_fields = {"command", "args", "env_key", "description"}
|
|
for name, tmpl in _MCP_TEMPLATES.items():
|
|
assert required_fields.issubset(
|
|
tmpl.keys()
|
|
), f"Template '{name}' missing fields: {required_fields - tmpl.keys()}"
|