From d1652727feab061205d1a9f570a4566570fbe653 Mon Sep 17 00:00:00 2001 From: Dominik Jain Date: Mon, 6 Apr 2026 20:29:12 +0200 Subject: [PATCH] Improve init command: Report version, add final success message Improve README: * Move LS deps back to prerequisites * Remove incorrect config path (redundant anyway, because user sees it upon init) * Some wording changes --- README.md | 21 +++++++++------------ src/serena/cli.py | 13 ++++++------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index d69520d5..8fdd463d 100644 --- a/README.md +++ b/README.md @@ -176,24 +176,21 @@ https://github.com/user-attachments/assets/6eaa9aa1-610d-4723-a2d6-bf1e487ba753 ## Quick Start -**Prerequisites**. Serena is managed by *uv*. If you don’t already have it, you need to [install uv](https://docs.astral.sh/uv/getting-started/installation/) before proceeding. +**Prerequisites**. Serena is managed by *uv*, and [installing uv](https://docs.astral.sh/uv/getting-started/installation/) is the only required prerequisite for running Serena. -**Initialize Serena**. To initialize Serena, simply run: +> [!NOTE] +> When using the language server backend, some additional dependencies may need to be installed to support certain languages; +> see the [Language Support](https://oraios.github.io/serena/01-about/020_programming-languages.html) page for details. + +**Initialise Serena**. To initialise Serena and verify that your setup works correctly, simply run: ```bash uvx -p 3.13 --from git+https://github.com/oraios/serena serena init ``` -This will create the global configuration file `~/.serena/config.yaml`. - -The default code intelligence backend for Serena is the free LSP backend. You can add `-b JetBrains` to the `init` command -to set up the JetBrains as the default code intelligence backend instead, see [JetBrains Plugin page](https://oraios.github.io/serena/02-usage/025_jetbrains_plugin.html) for more details. - - -> [!NOTE] -> When using the language server backend, some additional dependencies to be installed for certain languages; -> see the [Language Support](https://oraios.github.io/serena/01-about/020_programming-languages.html) page for details. - +By default, this will set up Serena to use the language server backend. To use the JetBrains backend instead, add the parameters `-b JetBrains` +(see the [JetBrains Plugin documentation page](https://oraios.github.io/serena/02-usage/025_jetbrains_plugin.html) for additional usage details). +Either way, you should receive a success message indicating that Serena has been initialised successfully. **Configuring Your Client**. To connect Serena to your preferred MCP client, you typically need to [configure a launch command in your client](https://oraios.github.io/serena/02-usage/030_clients.html). Follow the link for specific instructions on how to set up Serena for Claude Code, Codex, Claude Desktop, MCP-enabled IDEs and other clients (such as local and web-based GUIs). diff --git a/src/serena/cli.py b/src/serena/cli.py index 480821c9..8e1b3093 100644 --- a/src/serena/cli.py +++ b/src/serena/cli.py @@ -17,6 +17,7 @@ from sensai.util.logging import FileLoggerContext, datetime_tag from sensai.util.string import dict_string from tqdm import tqdm +from serena import serena_version from serena.agent import SerenaAgent from serena.config.context_mode import SerenaAgentContext, SerenaAgentMode from serena.config.serena_config import ( @@ -90,9 +91,6 @@ def find_project_root(root: str | Path | None = None) -> str | None: return None -# --------------------- Utilities ------------------------------------- - - def _open_in_editor(path: str) -> None: """Open the given file in the system's default editor or viewer.""" editor = os.environ.get("EDITOR") @@ -169,13 +167,14 @@ class TopLevelCommands(AutoRegisteringGroup): show_default=True, help="Default code intelligence backend (can be overridden in the project config).", ) - def init(language_backend: Literal["LSP", "JetBrains"] = "LSP"): + def init(language_backend: Literal["LSP", "JetBrains"] = "LSP") -> None: + click.echo(f"\nSerena version: {serena_version()}\n") serena_config = SerenaConfig.from_config_file() serena_config.language_backend = LanguageBackend(language_backend) serena_config.save() - click.echo( - f"Initialized Serena with default backend: {language_backend}.\nFind the global Serena config in:\n {serena_config.config_file_path}" - ) + click.echo(f"Configuration file: {serena_config.config_file_path}") + click.echo(f"Language backend: {language_backend}") + click.echo("\nSerena has been initialised successfully.\n") @staticmethod @click.command("start-mcp-server", help="Starts the Serena MCP server.", context_settings={"max_content_width": _MAX_CONTENT_WIDTH})