docs: align vault storage documentation with code

This commit is contained in:
mirivlad 2026-06-04 03:32:02 +08:00
parent 58795b66b2
commit a526661825
5 changed files with 65 additions and 55 deletions

View File

@ -53,7 +53,7 @@
```bash ```bash
# Всё сразу (GUI + сервер) # Всё сразу (GUI + сервер)
./build.sh ./scripts/build.sh
# Или по отдельности # Или по отдельности
./scripts/build.sh gui # только GUI ./scripts/build.sh gui # только GUI
@ -107,8 +107,7 @@ go run ./cmd/verstak/ --help
│ └── ...svelte # Компоненты │ └── ...svelte # Компоненты
├── migrations/ # SQL-миграции ├── migrations/ # SQL-миграции
├── docs/ # Документация ├── docs/ # Документация
├── build.sh # Скрипт полной сборки └── scripts/ # Вспомогательные скрипты и сборка
└── scripts/ # Вспомогательные скрипты
``` ```
## CLI команды ## CLI команды
@ -125,7 +124,7 @@ go run ./cmd/verstak/ sync status # Статус синхронизации
``` ```
vault/ vault/
.verstak/ # Служебные данные (БД, кеш, бэкапы) .verstak/ # Служебные данные: index.db, config.yml, trash, blobs
Проекты/ # Пользовательские папки-дела Проекты/ # Пользовательские папки-дела
Клиенты/ Клиенты/
Рабочие/ Рабочие/

View File

@ -25,7 +25,7 @@ import (
type StartupStatus struct { type StartupStatus struct {
Status string `json:"status"` // "first_run", "recovery", "ready" Status string `json:"status"` // "first_run", "recovery", "ready"
VaultPath string `json:"vaultPath"` // configured or default vault path VaultPath string `json:"vaultPath"` // configured or default vault path
VaultExists bool `json:"vaultExists"` // whether vault.db exists at the path VaultExists bool `json:"vaultExists"` // whether index.db exists at the path
DefaultPath string `json:"defaultPath"` // default vault path suggestion DefaultPath string `json:"defaultPath"` // default vault path suggestion
Error string `json:"error,omitempty"` Error string `json:"error,omitempty"`
AppConfig *config.AppConfig `json:"appConfig,omitempty"` AppConfig *config.AppConfig `json:"appConfig,omitempty"`
@ -336,7 +336,7 @@ func (a *App) CheckVaultPath(vaultPath string) (*CheckVaultPathResult, error) {
} }
} }
desc := describeVaultPath(vaultPath, exists, hasVault) desc := describeVaultPath(exists, hasVault)
return &CheckVaultPathResult{ return &CheckVaultPathResult{
Exists: exists, Exists: exists,
@ -355,7 +355,7 @@ func checkDirWritable(dir string) bool {
return true return true
} }
func describeVaultPath(path string, exists, hasVault bool) string { func describeVaultPath(exists, hasVault bool) string {
if !exists { if !exists {
return "Путь не существует. Будет создан новый vault." return "Путь не существует. Будет создан новый vault."
} }

View File

@ -9,8 +9,9 @@
.verstak/ .verstak/
index.db index.db
config.yml config.yml
device.yml device_token.json
sync_state.db blobs/
plugins/
trash/ trash/
history/ history/
originals/ originals/
@ -51,6 +52,10 @@ CREATE TABLE nodes (
title TEXT NOT NULL, title TEXT NOT NULL,
slug TEXT NOT NULL, slug TEXT NOT NULL,
path TEXT NULL, path TEXT NULL,
section TEXT NULL,
template_id TEXT NOT NULL DEFAULT '',
fs_path TEXT NOT NULL DEFAULT '',
archived INTEGER NOT NULL DEFAULT 0,
sort_order INTEGER NOT NULL DEFAULT 0, sort_order INTEGER NOT NULL DEFAULT 0,
created_at TEXT NOT NULL, created_at TEXT NOT NULL,
updated_at TEXT NOT NULL, updated_at TEXT NOT NULL,
@ -135,6 +140,7 @@ CREATE TABLE worklog_entries (
billable INTEGER NOT NULL DEFAULT 0, billable INTEGER NOT NULL DEFAULT 0,
summary TEXT NOT NULL, summary TEXT NOT NULL,
details TEXT NULL, details TEXT NULL,
source TEXT NOT NULL DEFAULT 'unknown',
created_at TEXT NOT NULL, created_at TEXT NOT NULL,
updated_at TEXT NOT NULL updated_at TEXT NOT NULL
); );
@ -145,38 +151,25 @@ CREATE TABLE worklog_entries (
```sql ```sql
CREATE TABLE activity_events ( CREATE TABLE activity_events (
id TEXT PRIMARY KEY, id TEXT PRIMARY KEY,
node_id TEXT NULL REFERENCES nodes(id), node_id TEXT NOT NULL,
source TEXT NOT NULL, parent_id TEXT,
event_type TEXT NOT NULL, event_type TEXT NOT NULL,
title TEXT NULL, target_type TEXT,
path TEXT NULL, target_id TEXT,
url TEXT NULL, target_path TEXT,
app_name TEXT NULL, title TEXT NOT NULL DEFAULT '',
process_name TEXT NULL, metadata TEXT NOT NULL DEFAULT '{}',
started_at TEXT NOT NULL,
ended_at TEXT NULL,
duration_seconds INTEGER NULL,
metadata_json TEXT NULL,
confidence INTEGER NOT NULL DEFAULT 100,
created_at TEXT NOT NULL created_at TEXT NOT NULL
); );
``` ```
### worklog_suggestions ### worklog_entry_events
```sql ```sql
CREATE TABLE worklog_suggestions ( CREATE TABLE worklog_entry_events (
id TEXT PRIMARY KEY, entry_id TEXT NOT NULL REFERENCES worklog_entries(id) ON DELETE CASCADE,
node_id TEXT NOT NULL REFERENCES nodes(id), event_id TEXT NOT NULL,
date TEXT NOT NULL, PRIMARY KEY (entry_id, event_id)
started_at TEXT NULL,
ended_at TEXT NULL,
suggested_minutes INTEGER NULL,
summary TEXT NOT NULL,
evidence_json TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'pending',
created_at TEXT NOT NULL,
updated_at TEXT NOT NULL
); );
``` ```
@ -208,6 +201,16 @@ CREATE TABLE sync_ops (
pushed_at TEXT NULL, pushed_at TEXT NULL,
applied_at TEXT NULL applied_at TEXT NULL
); );
CREATE TABLE sync_state (
device_id TEXT PRIMARY KEY,
server_url TEXT NOT NULL DEFAULT '',
api_key TEXT NOT NULL DEFAULT '',
last_push_rev INTEGER NOT NULL DEFAULT 0,
last_pull_rev INTEGER NOT NULL DEFAULT 0,
last_sync_at TEXT,
last_pull_seq INTEGER NOT NULL DEFAULT 0
);
``` ```
## 3. Правила хранения ## 3. Правила хранения

View File

@ -312,7 +312,7 @@ verstak/
```bash ```bash
# Полная сборка # Полная сборка
./build.sh ./scripts/build.sh
# По отдельности # По отдельности
./scripts/build.sh gui # Wails v2 GUI ./scripts/build.sh gui # Wails v2 GUI

View File

@ -10,11 +10,13 @@ in any file manager, and find materials by browsing the folder structure.
``` ```
vault/ vault/
.verstak/ # App data — not user-facing .verstak/ # App data — not user-facing
vault.db index.db
backups/ config.yml
device_token.json
blobs/
originals/
thumbnails/ thumbnails/
cache/ plugins/
sync/
trash/ trash/
history/ history/
@ -56,14 +58,20 @@ vault/
Contains all application internal data: Contains all application internal data:
- `vault.db` — SQLite database - `index.db` — SQLite database
- `backups/` — automatic vault backups - `config.yml` — vault-local settings and vault id
- `device_token.json` — sync device token, stored separately from general config
- `blobs/` — sync blob cache
- `originals/` — imported originals
- `thumbnails/` — generated thumbnails - `thumbnails/` — generated thumbnails
- `cache/` — temporary cache - `plugins/` — optional local plugins
- `sync/` — sync state and blobs
- `trash/` — moved here on deletion - `trash/` — moved here on deletion
- `history/` — file version history - `history/` — file version history
Global application settings live outside the vault at
`~/.config/verstak/config.json`. This includes the active vault path, UI
settings, enabled templates and sync UI settings.
## Migration ## Migration
Existing vaults can be migrated with the `MigrateVaultLayout()` command, Existing vaults can be migrated with the `MigrateVaultLayout()` command,