serena
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 navigat
Install
npx skills add https://github.com/Dianel555/DSkills/tree/main/skills/serena
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install dianel555-dskills@llmmart
git clone https://github.com/Dianel555/DSkills.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole dianel555/dskills collection as a plugin from our marketplace. Git is the plain clone.
README
Serena CLI
Semantic code understanding with IDE-like symbol operations and Web Dashboard. MCP-independent CLI for code navigation, editing, and project memory.
Features
- Web Dashboard: Real-time configuration monitoring and management
- Symbol Operations: Find, rename, replace, insert symbols with language-aware precision
- Cross-file References: Track symbol usages across entire codebase
- Project Memory: Persist and retrieve project knowledge across sessions
- Extended Tools: Shell commands, config file operations
- Cross-Drive Support: Work with projects on any drive (Windows) or path (Unix)
- Auto Project Registration: Automatically registers projects in global Serena config
Installation
pip install serena-agent typer pyyaml
Quick Start
First-time setup: Launch the Web Dashboard to initialize and register the project:
# Start Web Dashboard (recommended for first-time use)
python -m tools dashboard serve --open-browser
# Or manually open browser after starting
python -m tools dashboard serve
# Then open: http://127.0.0.1:24282/dashboard/index.html
Configuration: Create .env file in skills/serena/ directory:
SERENA_CONTEXT=claude-code
SERENA_MODES=interactive,editing,onboarding
SERENA_PROJECT=.
SERENA_DASHBOARD_ENABLED=true
SERENA_DASHBOARD_PORT=24282
Basic Usage:
# Find a symbol
python -m tools symbol find MyClass --body
# List symbols in file
python -m tools symbol overview src/main.py
# Find references
python -m tools symbol refs MyClass/method
# List available tools
python -m tools workflow tools
Command Structure
python -m tools [GLOBAL OPTIONS] <command> [COMMAND OPTIONS]
Global Options
Global options must be specified before the command:
-p, --project PATH- Project directory (default: current directory, env: SERENA_PROJECT)-c, --context TEXT- Execution context (auto-detected if not specified, env: SERENA_CONTEXT)-m, --mode TEXT- Operation modes (can be specified multiple times, env: SERENA_MODES)
Working with Different Projects
Important: When working with projects in different locations (especially cross-drive on Windows), use --project:
# Correct: Specify project path with --project
python -m tools --project "E:\MyProject" file search "pattern"
python -m tools --project "/home/user/project" symbol find MyClass
python -m tools --project "D:\workspace\app" symbol refs MyClass
# Incorrect: Don't use --path with absolute paths from different drives
python -m tools file search "pattern" --path "E:\MyProject" # Will fail!
Why? The --path option in subcommands expects relative paths within the project. Always use --project to set the project root first.
CLI Commands
Dashboard Commands
| Command | Description |
|---|---|
dashboard serve [--open-browser] [--browser-cmd <path>] |
Start Web Dashboard server |
dashboard info |
Show current configuration overview |
dashboard tools |
List active and available tools |
dashboard modes |
List active and available modes |
dashboard contexts |
List active and available contexts |
Dashboard Options:
--open-browser/--no-open-browser: Auto-open browser (default: False)--browser-cmd <path>: Specify browser executable path--host <address>: Listen address (default: 127.0.0.1)--port <number>: Listen port (default: 24282, 0 for auto-select)SERENA_BROWSER_CMD: Environment variable for browser command
Symbol Operations
| Command | Description |
|---|---|
symbol find <name> [--body] [--depth N] [--path file] |
Find symbols by name |
symbol overview <path> |
List all symbols in file |
symbol refs <name> [--path file] |
Find symbol references |
symbol replace <name> --path <file> --body <code> |
Replace symbol body |
symbol insert-after <name> --path <file> --content <code> |
Insert after symbol |
symbol insert-before <name> --path <file> --content <code> |
Insert before symbol |
symbol rename <name> <new> --path <file> |
Rename symbol |
Memory Operations
| Command | Description |
|---|---|
memory list |
List all memories |
memory read <name> |
Read memory content |
memory write <name> --content <text> |
Create/update memory |
memory edit <name> --content <text> |
Edit memory |
memory delete <name> |
Delete memory |
File Operations
| Command | Description |
|---|---|
file list [--path <dir>] [--recursive] |
List directory contents |
file find <pattern> |
Find files by glob pattern |
file search <pattern> [--path <dir>] |
Search for regex pattern in files |
Extended Tools
| Command | Description |
|---|---|
cmd run <cmd> [--cwd <dir>] [--timeout <N>] |
Execute shell command |
cmd script <path> [--args "..."] |
Execute script file |
config read <path> [--format json\|yaml] |
Read JSON/YAML config |
config update <path> <key> <value> |
Update config value |
Workflow
| Command | Description |
|---|---|
workflow onboarding |
Run project onboarding |
workflow check |
Check onboarding status |
workflow tools [--scope all] |
List available tools |
Output Format
All CLI output is JSON:
// Success
{"result": <data>}
// Error
{"error": {"code": "ERROR_CODE", "message": "description"}}
Error codes: INVALID_ARGS, TOOL_NOT_FOUND, INIT_FAILED, RUNTIME_ERROR
Web Dashboard Features
The Web Dashboard provides:
- Real-time Configuration: View active context, modes, and tools
- Project Management: See registered projects and active project
- Tool Monitoring: Track active and available tools
- Configuration Editing: Edit
.envfile directly from browser - Auto Registration: Automatically adds project to
~/.serena/serena_config.yml
Access the dashboard at: http://127.0.0.1:24282/dashboard/index.html
Project Structure
skills/serena/
├── SKILL.md
├── README.md
├── .env.example
└── tools/
├── core.py # SerenaCore wrapper
├── paths.py # Path utilities
├── output.py # JSON output utilities
├── cli/ # Typer CLI commands
│ ├── dashboard.py
│ ├── symbol.py
│ ├── memory.py
│ ├── file.py
│ ├── workflow.py
│ ├── cmd.py
│ └── config.py
├── server/ # Web Dashboard server
│ └── dashboard_server.py # Flask HTTP server
└── extended/ # Extended tools
├── cmd_tools.py
└── config_tools.py
License
MIT
Skill manifest
Serena - Semantic Code Understanding
IDE-like semantic code operations via CLI. Provides symbol-level code navigation, editing, and project memory.
Prerequisites
pip install serena-agent typer pyyaml
Quick Start
First-time setup: Launch the Web Dashboard to initialize and register the project:
python -m tools dashboard serve --open-browser
This will:
- Initialize Serena configuration
- Register the current project in
~/.serena/serena_config.yml - Open the Web Dashboard for monitoring and configuration
Configuration: Edit .env file in skills/serena/ directory:
SERENA_CONTEXT=claude-code
SERENA_MODES=interactive,editing,onboarding
SERENA_PROJECT=.
Usage
Basic Command Structure
python -m tools [GLOBAL OPTIONS] <command> [COMMAND OPTIONS]
Global Options (must be specified before the command):
-p, --project PATH- Project directory (default: current directory, env: SERENA_PROJECT)-c, --context TEXT- Execution context (auto-detected if not specified, env: SERENA_CONTEXT)-m, --mode TEXT- Operation modes (can be specified multiple times, env: SERENA_MODES)
Working with Different Projects
Important: When working with projects in different locations (especially cross-drive on Windows), use --project:
# Correct: Use --project for different project locations
python -m tools --project "/path/to/project" symbol find MyClass
python -m tools --project "E:\MyProject" file search "pattern"
# Incorrect: Don't use --path with absolute paths from different drives
python -m tools file search "pattern" --path "E:\MyProject" # Will fail!
The --path option in subcommands expects relative paths within the project. Always use --project to set the project root first.
Common Operations
# Dashboard
python -m tools dashboard serve --open-browser
python -m tools dashboard info
# Symbol operations
python -m tools symbol find MyClass --body
python -m tools symbol overview src/main.py
python -m tools symbol refs MyClass/method
python -m tools symbol rename OldName NewName --path src/file.py
# Memory operations
python -m tools memory list
python -m tools memory read project_overview
python -m tools memory write api_notes --content "..."
# File operations
python -m tools file list --recursive
python -m tools file find "**/*.py"
python -m tools file search "TODO:.*" --path src
# Extended tools
python -m tools cmd run "git status"
python -m tools config read config.json
Tool Routing Policy
Prefer Serena Over Built-in Tools
| Task | Avoid | Use Serena CLI |
|---|---|---|
| Find function | grep "def func" |
symbol find func --body |
| List file structure | cat file.py |
symbol overview file.py |
| Find usages | grep "func(" |
symbol refs func |
| Edit function | Edit tool |
symbol replace func --path file.py |
| Rename | Manual find/replace | symbol rename old new --path file.py |
When to Use Built-in Tools
- Simple text search (non-code patterns)
- Configuration files (JSON, YAML)
- Documentation files (Markdown)
Command Reference
Dashboard Commands
| Command | Description |
|---|---|
dashboard serve [--open-browser] [--browser-cmd <path>] |
Start Web Dashboard server |
dashboard info |
Show current configuration |
dashboard tools |
List active and available tools |
dashboard modes |
List active and available modes |
dashboard contexts |
List active and available contexts |
Symbol Commands
| Command | Description |
|---|---|
symbol find <name> [--body] [--depth N] [--path file] |
Find symbols by name |
symbol overview <path> |
List all symbols in file |
symbol refs <name> [--path file] |
Find symbol references |
symbol replace <name> --path <file> --body <code> |
Replace symbol body |
symbol insert-after <name> --path <file> --content <code> |
Insert after symbol |
symbol insert-before <name> --path <file> --content <code> |
Insert before symbol |
symbol rename <name> <new> --path <file> |
Rename symbol |
Memory Commands
| Command | Description |
|---|---|
memory list |
List all memories |
memory read <name> |
Read memory content |
memory write <name> --content <text> |
Create/update memory |
memory edit <name> --content <text> |
Edit memory |
memory delete <name> |
Delete memory |
File Commands
| Command | Description |
|---|---|
file list [--path dir] [--recursive] |
List directory |
file find <pattern> |
Find files by glob pattern |
file search <pattern> [--path dir] |
Search for regex pattern |
Extended Commands
| Command | Description |
|---|---|
cmd run <command> [--cwd dir] [--timeout N] |
Execute shell command |
cmd script <path> [--args "..."] |
Execute script file |
config read <path> [--format json\|yaml] |
Read config file |
config update <path> <key> <value> |
Update config value |
Workflow Commands
| Command | Description |
|---|---|
workflow onboarding |
Run project onboarding |
workflow check |
Check onboarding status |
workflow tools [--scope all] |
List available tools |
Workflow Examples
Phase 1: Exploration
python -m tools symbol overview src/main.py # Understand file structure
python -m tools symbol find MyClass --depth 1 # Explore class members
python -m tools symbol find MyClass/method --body # Get implementation details
Phase 2: Analysis
python -m tools symbol refs MyClass/method # Impact analysis
python -m tools memory list # Check project knowledge
python -m tools memory read architecture # Retrieve context
Phase 3: Modification
python -m tools symbol find target --body # Verify target
python -m tools symbol replace target --path f --body "..." # Edit
python -m tools symbol rename old new --path f # Refactor
Error Handling
All CLI output is JSON:
// Success
{"result": <data>}
// Error
{"error": {"code": "ERROR_CODE", "message": "description"}}
| Error Code | Recovery |
|---|---|
INVALID_ARGS |
Check --help |
TOOL_NOT_FOUND |
Use workflow tools |
INIT_FAILED |
Check serena-agent installation |
RUNTIME_ERROR |
Check error message |
Anti-Patterns
| Prohibited | Correct |
|---|---|
| Read entire file to find function | symbol find func --body |
| Grep for function calls | symbol refs func |
| Manual search-replace rename | symbol rename old new --path f |
| Skip impact analysis | symbol refs before editing |
Files (dskills)
-
tools
-
cli
-
cmd.py 1 KB
Loading… -
config.py 1.1 KB
Loading… -
dashboard.py 5.3 KB
Loading… -
file.py 1.4 KB
Loading… -
memory.py 1.5 KB
Loading… -
symbol.py 3.7 KB
Loading… -
workflow.py 780 B
Loading… -
__init__.py 3.4 KB
Loading…
-
-
extended
-
cmd_tools.py 3.7 KB
Loading… -
config_tools.py 4.9 KB
Loading… -
__init__.py 30 B
Loading…
-
-
server
-
dashboard_server.py 14.1 KB
Loading… -
__init__.py 110 B
Loading…
-
-
tests
-
conftest.py 256 B
Loading… -
test_cli_dashboard.py 3 KB
Loading… -
test_cli_file.py 3.4 KB
Loading… -
test_cli_memory.py 2.6 KB
Loading… -
test_core.py 5.4 KB
Loading… -
test_module_path.py 3 KB
Loading… -
test_paths.py 2.8 KB
Loading… -
__init__.py 30 B
Loading…
-
-
core.py 7.8 KB
Loading… -
output.py 402 B
Loading… -
paths.py 1.5 KB
Loading… -
__init__.py 310 B
Loading… -
__main__.py 94 B
Loading…
-
-
.env.example 619 B · in bundle
-
README.md 6.8 KB
# Serena CLI Semantic code understanding with IDE-like symbol operations and Web Dashboard. MCP-independent CLI for code navigation, editing, and project memory. ## Features - **Web Dashboard**: Real-time configuration monitoring and management - **Symbol Operations**: Find, rename, replace, insert symbols with language-aware precision - **Cross-file References**: Track symbol usages across entire codebase - **Project Memory**: Persist and retrieve project knowledge across sessions - **Extended Tools**: Shell commands, config file operations - **Cross-Drive Support**: Work with projects on any drive (Windows) or path (Unix) - **Auto Project Registration**: Automatically registers projects in global Serena config ## Installation ```bash pip install serena-agent typer pyyaml ``` ## Quick Start **First-time setup**: Launch the Web Dashboard to initialize and register the project: ```bash # Start Web Dashboard (recommended for first-time use) python -m tools dashboard serve --open-browser # Or manually open browser after starting python -m tools dashboard serve # Then open: http://127.0.0.1:24282/dashboard/index.html ``` **Configuration**: Create `.env` file in `skills/serena/` directory: ```bash SERENA_CONTEXT=claude-code SERENA_MODES=interactive,editing,onboarding SERENA_PROJECT=. SERENA_DASHBOARD_ENABLED=true SERENA_DASHBOARD_PORT=24282 ``` **Basic Usage**: ```bash # Find a symbol python -m tools symbol find MyClass --body # List symbols in file python -m tools symbol overview src/main.py # Find references python -m tools symbol refs MyClass/method # List available tools python -m tools workflow tools ``` ## Command Structure ```bash python -m tools [GLOBAL OPTIONS] <command> [COMMAND OPTIONS] ``` ### Global Options Global options must be specified **before** the command: - `-p, --project PATH` - Project directory (default: current directory, env: SERENA_PROJECT) - `-c, --context TEXT` - Execution context (auto-detected if not specified, env: SERENA_CONTEXT) - `-m, --mode TEXT` - Operation modes (can be specified multiple times, env: SERENA_MODES) ### Working with Different Projects **Important**: When working with projects in different locations (especially cross-drive on Windows), use `--project`: ```bash # Correct: Specify project path with --project python -m tools --project "E:\MyProject" file search "pattern" python -m tools --project "/home/user/project" symbol find MyClass python -m tools --project "D:\workspace\app" symbol refs MyClass # Incorrect: Don't use --path with absolute paths from different drives python -m tools file search "pattern" --path "E:\MyProject" # Will fail! ``` **Why?** The `--path` option in subcommands expects **relative paths** within the project. Always use `--project` to set the project root first. ## CLI Commands ### Dashboard Commands | Command | Description | |---------|-------------| | `dashboard serve [--open-browser] [--browser-cmd <path>]` | Start Web Dashboard server | | `dashboard info` | Show current configuration overview | | `dashboard tools` | List active and available tools | | `dashboard modes` | List active and available modes | | `dashboard contexts` | List active and available contexts | **Dashboard Options**: - `--open-browser` / `--no-open-browser`: Auto-open browser (default: False) - `--browser-cmd <path>`: Specify browser executable path - `--host <address>`: Listen address (default: 127.0.0.1) - `--port <number>`: Listen port (default: 24282, 0 for auto-select) - `SERENA_BROWSER_CMD`: Environment variable for browser command ### Symbol Operations | Command | Description | |---------|-------------| | `symbol find <name> [--body] [--depth N] [--path file]` | Find symbols by name | | `symbol overview <path>` | List all symbols in file | | `symbol refs <name> [--path file]` | Find symbol references | | `symbol replace <name> --path <file> --body <code>` | Replace symbol body | | `symbol insert-after <name> --path <file> --content <code>` | Insert after symbol | | `symbol insert-before <name> --path <file> --content <code>` | Insert before symbol | | `symbol rename <name> <new> --path <file>` | Rename symbol | ### Memory Operations | Command | Description | |---------|-------------| | `memory list` | List all memories | | `memory read <name>` | Read memory content | | `memory write <name> --content <text>` | Create/update memory | | `memory edit <name> --content <text>` | Edit memory | | `memory delete <name>` | Delete memory | ### File Operations | Command | Description | |---------|-------------| | `file list [--path <dir>] [--recursive]` | List directory contents | | `file find <pattern>` | Find files by glob pattern | | `file search <pattern> [--path <dir>]` | Search for regex pattern in files | ### Extended Tools | Command | Description | |---------|-------------| | `cmd run <cmd> [--cwd <dir>] [--timeout <N>]` | Execute shell command | | `cmd script <path> [--args "..."]` | Execute script file | | `config read <path> [--format json\|yaml]` | Read JSON/YAML config | | `config update <path> <key> <value>` | Update config value | ### Workflow | Command | Description | |---------|-------------| | `workflow onboarding` | Run project onboarding | | `workflow check` | Check onboarding status | | `workflow tools [--scope all]` | List available tools | ## Output Format All CLI output is JSON: ```json // Success {"result": <data>} // Error {"error": {"code": "ERROR_CODE", "message": "description"}} ``` **Error codes**: `INVALID_ARGS`, `TOOL_NOT_FOUND`, `INIT_FAILED`, `RUNTIME_ERROR` ## Web Dashboard Features The Web Dashboard provides: - **Real-time Configuration**: View active context, modes, and tools - **Project Management**: See registered projects and active project - **Tool Monitoring**: Track active and available tools - **Configuration Editing**: Edit `.env` file directly from browser - **Auto Registration**: Automatically adds project to `~/.serena/serena_config.yml` Access the dashboard at: `http://127.0.0.1:24282/dashboard/index.html` ## Project Structure ``` skills/serena/ ├── SKILL.md ├── README.md ├── .env.example └── tools/ ├── core.py # SerenaCore wrapper ├── paths.py # Path utilities ├── output.py # JSON output utilities ├── cli/ # Typer CLI commands │ ├── dashboard.py │ ├── symbol.py │ ├── memory.py │ ├── file.py │ ├── workflow.py │ ├── cmd.py │ └── config.py ├── server/ # Web Dashboard server │ └── dashboard_server.py # Flask HTTP server └── extended/ # Extended tools ├── cmd_tools.py └── config_tools.py ``` ## License MIT -
SKILL.md 7.1 KB
--- name: serena description: | 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. --- # Serena - Semantic Code Understanding IDE-like semantic code operations via CLI. Provides symbol-level code navigation, editing, and project memory. ## Prerequisites ```bash pip install serena-agent typer pyyaml ``` ## Quick Start **First-time setup**: Launch the Web Dashboard to initialize and register the project: ```bash python -m tools dashboard serve --open-browser ``` This will: - Initialize Serena configuration - Register the current project in `~/.serena/serena_config.yml` - Open the Web Dashboard for monitoring and configuration **Configuration**: Edit `.env` file in `skills/serena/` directory: ```bash SERENA_CONTEXT=claude-code SERENA_MODES=interactive,editing,onboarding SERENA_PROJECT=. ``` ## Usage ### Basic Command Structure ```bash python -m tools [GLOBAL OPTIONS] <command> [COMMAND OPTIONS] ``` **Global Options** (must be specified before the command): - `-p, --project PATH` - Project directory (default: current directory, env: SERENA_PROJECT) - `-c, --context TEXT` - Execution context (auto-detected if not specified, env: SERENA_CONTEXT) - `-m, --mode TEXT` - Operation modes (can be specified multiple times, env: SERENA_MODES) ### Working with Different Projects **Important**: When working with projects in different locations (especially cross-drive on Windows), use `--project`: ```bash # Correct: Use --project for different project locations python -m tools --project "/path/to/project" symbol find MyClass python -m tools --project "E:\MyProject" file search "pattern" # Incorrect: Don't use --path with absolute paths from different drives python -m tools file search "pattern" --path "E:\MyProject" # Will fail! ``` The `--path` option in subcommands expects **relative paths** within the project. Always use `--project` to set the project root first. ### Common Operations ```bash # Dashboard python -m tools dashboard serve --open-browser python -m tools dashboard info # Symbol operations python -m tools symbol find MyClass --body python -m tools symbol overview src/main.py python -m tools symbol refs MyClass/method python -m tools symbol rename OldName NewName --path src/file.py # Memory operations python -m tools memory list python -m tools memory read project_overview python -m tools memory write api_notes --content "..." # File operations python -m tools file list --recursive python -m tools file find "**/*.py" python -m tools file search "TODO:.*" --path src # Extended tools python -m tools cmd run "git status" python -m tools config read config.json ``` ## Tool Routing Policy ### Prefer Serena Over Built-in Tools | Task | Avoid | Use Serena CLI | |------|-------|----------------| | Find function | `grep "def func"` | `symbol find func --body` | | List file structure | `cat file.py` | `symbol overview file.py` | | Find usages | `grep "func("` | `symbol refs func` | | Edit function | `Edit` tool | `symbol replace func --path file.py` | | Rename | Manual find/replace | `symbol rename old new --path file.py` | ### When to Use Built-in Tools - Simple text search (non-code patterns) - Configuration files (JSON, YAML) - Documentation files (Markdown) ## Command Reference ### Dashboard Commands | Command | Description | |---------|-------------| | `dashboard serve [--open-browser] [--browser-cmd <path>]` | Start Web Dashboard server | | `dashboard info` | Show current configuration | | `dashboard tools` | List active and available tools | | `dashboard modes` | List active and available modes | | `dashboard contexts` | List active and available contexts | ### Symbol Commands | Command | Description | |---------|-------------| | `symbol find <name> [--body] [--depth N] [--path file]` | Find symbols by name | | `symbol overview <path>` | List all symbols in file | | `symbol refs <name> [--path file]` | Find symbol references | | `symbol replace <name> --path <file> --body <code>` | Replace symbol body | | `symbol insert-after <name> --path <file> --content <code>` | Insert after symbol | | `symbol insert-before <name> --path <file> --content <code>` | Insert before symbol | | `symbol rename <name> <new> --path <file>` | Rename symbol | ### Memory Commands | Command | Description | |---------|-------------| | `memory list` | List all memories | | `memory read <name>` | Read memory content | | `memory write <name> --content <text>` | Create/update memory | | `memory edit <name> --content <text>` | Edit memory | | `memory delete <name>` | Delete memory | ### File Commands | Command | Description | |---------|-------------| | `file list [--path dir] [--recursive]` | List directory | | `file find <pattern>` | Find files by glob pattern | | `file search <pattern> [--path dir]` | Search for regex pattern | ### Extended Commands | Command | Description | |---------|-------------| | `cmd run <command> [--cwd dir] [--timeout N]` | Execute shell command | | `cmd script <path> [--args "..."]` | Execute script file | | `config read <path> [--format json\|yaml]` | Read config file | | `config update <path> <key> <value>` | Update config value | ### Workflow Commands | Command | Description | |---------|-------------| | `workflow onboarding` | Run project onboarding | | `workflow check` | Check onboarding status | | `workflow tools [--scope all]` | List available tools | ## Workflow Examples ### Phase 1: Exploration ```bash python -m tools symbol overview src/main.py # Understand file structure python -m tools symbol find MyClass --depth 1 # Explore class members python -m tools symbol find MyClass/method --body # Get implementation details ``` ### Phase 2: Analysis ```bash python -m tools symbol refs MyClass/method # Impact analysis python -m tools memory list # Check project knowledge python -m tools memory read architecture # Retrieve context ``` ### Phase 3: Modification ```bash python -m tools symbol find target --body # Verify target python -m tools symbol replace target --path f --body "..." # Edit python -m tools symbol rename old new --path f # Refactor ``` ## Error Handling All CLI output is JSON: ```json // Success {"result": <data>} // Error {"error": {"code": "ERROR_CODE", "message": "description"}} ``` | Error Code | Recovery | |------------|----------| | `INVALID_ARGS` | Check `--help` | | `TOOL_NOT_FOUND` | Use `workflow tools` | | `INIT_FAILED` | Check serena-agent installation | | `RUNTIME_ERROR` | Check error message | ## Anti-Patterns | Prohibited | Correct | |------------|---------| | Read entire file to find function | `symbol find func --body` | | Grep for function calls | `symbol refs func` | | Manual search-replace rename | `symbol rename old new --path f` | | Skip impact analysis | `symbol refs` before editing |
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.