Use ~/.serena/serena_config.yml as the only location for the config file,

adding a migration for old files in the Serena directory
This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2025-07-02 23:49:07 +02:00
1 parent 22d4d32209
commit cf9ad6c5fb
2 files changed
+19 -16

No files matched your search

+10 -8
View File
@@ -201,11 +201,15 @@ This and other settings can be adjusted in the [configuration](#configuration) a
git clone https://github.com/oraios/serena
cd serena
```
2. Optionally create a config file from the template and adjust it according to your preferences.
You can either place it in your user directory (`~/.serena/serena_config.yml`) or into
the Serena installation directory:
2. Optionally create the configuration file in your home directory, i.e.
* `~/.serena/serena_config.yml` on Linux and macOS, or
* `%USERPROFILE%\.serena\serena_config.yml` on Windows.
by copying the template and then adjusting it according to your needs:
```shell
cp src/serena/resources/serena_config.template.yml serena_config.yml
mkdir ~/.serena
cp src/serena/resources/serena_config.template.yml ~/.serena/serena_config.yml
```
If you just want the default config, you can skip this part, and a config file will be created when you first run Serena.
3. Run the server with `uv`:
@@ -282,10 +286,8 @@ Run with parameter `--help` to get a list of available options.
Serena's behavior (active tools and prompts as well as logging configuration, etc.) is configured in four places:
1. The `serena_config.yml` for general settings that apply to all clients and projects.
Serena will look for this file in your user directory under `.serena/serena_config.yml`
or within the Serena installation directory.
If you do not explicitly create the file, it will be auto-generated in the former location
when you first run Serena.
It is located in your user directory under `.serena/serena_config.yml`.
If you do not explicitly create the file, it will be auto-generated when you first run Serena.
2. In the arguments passed to the `serena-mcp-server` in your client's config (see below),
which will apply to all sessions started by the respective client. In particular, the [context](#contexts) parameter
should be set appropriately for Serena to be best adjusted to existing tools and capabilities of your client.
+9 -8
View File
@@ -245,14 +245,15 @@ class SerenaConfig:
if is_running_in_docker():
return os.path.join(REPO_ROOT, cls.CONFIG_FILE_DOCKER)
else:
candidates = [
str(Path.home() / SERENA_MANAGED_DIR_NAME / cls.CONFIG_FILE),
os.path.join(REPO_ROOT, cls.CONFIG_FILE),
]
for candidate in candidates:
if os.path.exists(candidate):
return candidate
return candidates[0]
config_path = str(Path.home() / SERENA_MANAGED_DIR_NAME / cls.CONFIG_FILE)
# migrate configuration in old location
old_config_path = os.path.join(REPO_ROOT, cls.CONFIG_FILE)
if os.path.exists(old_config_path):
log.info(f"Moving Serena configuration file from {old_config_path} to {config_path}")
shutil.move(old_config_path, config_path)
return config_path
@classmethod
def from_config_file(cls, generate_if_missing: bool = True) -> "SerenaConfig":