AdguardTeam / AdguardTeam/AdGuardCLI

Follow XDG Base Directory specification for user data

未關閉
#117 0 則留言 3 個 reaction 已指派 1 人 已被 @sfionov 認領 在 GitHub 檢視
Feature Request Priority: P3
主要語言
沒有語言資料
星號
160
分支
6
PR 合併指標
30 天內沒有已合併 PR

描述

### Issue Details

Currently, AdGuard CLI stores all user-specific data under:
`~/.local/share/adguard-cli`

This includes configuration files, logs, caches, and runtime/state files.
This layout does not comply with the XDG Base Directory Specification, which is widely followed on Linux systems. - [Source](https://specifications.freedesktop.org/basedir/latest/)

According to the spec:

Configuration files should go in `$XDG_CONFIG_HOME` (`~/.config`)

Cache/logs should go in `$XDG_CACHE_HOME` (`~/.cache`)

Persistent application data should go in `$XDG_DATA_HOME` (`~/.local/share`)

Runtime/state files can go in `$XDG_STATE_HOME` or appropriate runtime paths

While installing binaries under `/opt/adguard-cli` is fine (since it’s not managed by a package manager), mixing config, cache, and data files inside `~/.local/share` causes clutter and makes backups, syncing, and system hygiene harder.

### Proposed solution

Let me use my current install's structure as example for solution.
Currently files under `~/.local/share/adguard-cli` are:

```
AdGuard CLI CA.pem
adguard.conf
browsers.yaml
proxy.yaml
proxy.yaml.bak
https_exclusions.txt
user.txt
SSL/
logs/
userscripts/
/crlitedb
.sentry-native/
version
logs-adguard-cli_2026-01-20_05-24-38.zip
settings-adguard-cli_2026-01-20_05-24-46.zip
```

This is similar to legacy layouts (e.g., old Firefox dumping everything into `~/.mozilla`), which most Linux apps have since moved away from.

Below is the file structure I am proposing

`~/.config/adguard-cli/`
```
adguard.conf
browsers.yaml
proxy.yaml (+ .bak)
https_exclusions.txt
user.txt
```

`~/.cache/adguard-cli/`
```
logs/
logs-adguard-cli_*.zip
settings-adguard-cli_*.zip
any temporary or generated log/output files
```

`~/.local/share/adguard-cli/`
```
*.db
userscripts/
AdGuard CLI CA.pem
SSL/
version
other non-config, non-cache data
```

Also files which change every session but are not cache as per say like
```
adguard.pid
agcli.socket
```
These would be fine in `~/.local/share/adguard-cli/` but would be better off in `~/.local/state/adguard-cli/`

### Alternative solution

Alternative Solution is not caring about the spec.

貢獻指南

這個儲存庫沒有索引到貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。