Skip to content

Dianel555/DSkills / skills/serena

serena

Verified

Semantic code understanding with IDE-like symbol operations. Use when: (1) Large codebase analysis (>50 files), (2) Symbol-level operations (find, rename, refactor), (3) Cross-file reference tracking, (4) Project memory and session persistence, (5) Multi-language semantic navigation. Triggers: "find symbol", "rename function", "find references", "symbol overview", "project memory". IMPORTANT: Prioritize Serena's symbolic tools over file-based grep/read for code exploration.

tools/tests/test_cli_memory.py

View on GitHub
"""Tests for memory CLI commands parameter mapping."""


def test_read_memory_parameter_mapping():
    """Test that read_memory maps name to memory_file_name."""
    from unittest.mock import Mock, patch

    with patch('tools.output.output_json'):
        from tools.cli import State
        from tools.cli.memory import read_memory

        # Setup mock
        mock_core = Mock()
        State.core = mock_core
        mock_core.call_tool.return_value = {"content": "test"}

        # Execute
        read_memory("project_notes")

        # Verify
        mock_core.call_tool.assert_called_once_with(
            "read_memory",
            memory_file_name="project_notes",
        )


def test_write_memory_parameter_mapping():
    """Test that write_memory maps name to memory_name."""
    from unittest.mock import Mock, patch

    with patch('tools.output.output_json'):
        from tools.cli import State
        from tools.cli.memory import write_memory

        # Setup mock
        mock_core = Mock()
        State.core = mock_core
        mock_core.call_tool.return_value = {"success": True}

        # Execute
        write_memory("api_notes", content="test content")

        # Verify
        mock_core.call_tool.assert_called_once_with(
            "write_memory",
            memory_name="api_notes",
            content="test content",
        )


def test_edit_memory_parameter_mapping():
    """Test that edit_memory maps to write_memory with memory_name."""
    from unittest.mock import Mock, patch

    with patch('tools.output.output_json'):
        from tools.cli import State
        from tools.cli.memory import edit_memory

        # Setup mock
        mock_core = Mock()
        State.core = mock_core
        mock_core.call_tool.return_value = {"success": True}

        # Execute
        edit_memory("notes", content="new content")

        # Verify - edit should use write_memory tool
        mock_core.call_tool.assert_called_once_with(
            "write_memory",
            memory_name="notes",
            content="new content",
        )


def test_delete_memory_parameter_mapping():
    """Test that delete_memory maps name to memory_file_name."""
    from unittest.mock import Mock, patch

    with patch('tools.output.output_json'):
        from tools.cli import State
        from tools.cli.memory import delete_memory

        # Setup mock
        mock_core = Mock()
        State.core = mock_core
        mock_core.call_tool.return_value = {"success": True}

        # Execute
        delete_memory("old_notes")

        # Verify
        mock_core.call_tool.assert_called_once_with(
            "delete_memory",
            memory_file_name="old_notes",
        )
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall