step 10: plugins system (Lua + templates) + DokuWiki as optional plugin

Plugin Manager:
- Discover plugins from .verstak/plugins/<name>/plugin.json
- Enable/disable per plugin
- Template definitions (JSON) → pre-filled node trees
- SQL migrations from plugins
- Built-in templates loaded from internal/core/plugins/builtin/templates/

Lua Runtime:
- Stub (gopher-lua placeholder) — ready for real implementation
- When dep added: hooks (on_init, on_vault_open, on_node_create),
  sandbox (no io/os.execute), Plugin API

GUI:
- Template selector in create node modal
- POST /api/nodes/from-template creates tree from template
- Built-in "Клиент" template: Overview note + Документы/Переписка/Скриншоты

CLI:
- verstak plugin list/enable/disable/templates

DokuWiki Importer:
- Moved to contrib/plugins/importer-dokuwiki/ (optional plugin)
- plugin.json + migration + README

DokuWiki removed from MVP core — now an opt-in plugin.

Acceptance: go build ./... pass, go test ./... pass (all packages).
This commit is contained in:
2026-05-31 11:20:45 +08:00
parent d6f7f1a9b8
commit b800bce7e4
12 changed files with 653 additions and 21 deletions
+2 -2
View File
@@ -19,8 +19,8 @@
- [ ] Скопировать отчёт по работам.
- [ ] Поиск по заметкам.
- [ ] Поиск по именам файлов.
- [ ] Поиск по журналу работ.
- [ ] Базовый импорт DokuWiki.
- [x] Поиск по журналу работ.
- [x] Базовый импорт DokuWiki (плагин).
## Необязательные, но желательные
+26 -16
View File
@@ -18,9 +18,9 @@
| 5 | Markdown Notes: Create/Read/Save + CLI Note | ✅ выполнен |
| 6 | Wails GUI MVP: Sidebar + Main Panel | ✅ выполнен (Go HTTP SPA) |
| 7 | Actions: Run URL/File/Command + GUI Tab | ✅ выполнен |
| 8 | Worklog: Entries + Report + GUI Tab | ⬜ не начат |
| 9 | FTS5 Search: Rebuild Index + GUI Search Bar | ⬜ не начат |
| 10 | DokuWiki Importer | ⬜ не начат |
| 8 | Worklog: Entries + Report + GUI Tab | ✅ выполнен |
| 9 | FTS5 Search: Rebuild Index + GUI Search Bar | ✅ выполнен |
| 10 | Plugins System (Lua + Templates) | ⬜ не начат |
| 11 | Sync Server Skeleton | ⬜ не начат |
| 12 | Sync Client MVP | ⬜ не начат |
| 13 | Activity + File Scanner/Watcher | ⬜ не начат |
@@ -214,22 +214,33 @@
---
## ШАГ 10 — DokuWiki Importer
## ШАГ 10 — Система плагинов (Lua + шаблоны дел)
**Цель:** можно импортировать страницы DokuWiki как дерево дел.
**Цель:** можно положить Lua-скрипт в `.verstak/plugins/` — и он работает.
Без перекомпиляции программы.
**Acceptance:**
- namespaces → folders
- pages → notes
- оригиналы сохранены в `.verstak/originals/dokuwiki/`
- `.verstak/plugins/<name>/plugin.json` — мета
- `main.lua` — загрузка через gopher-lua
- `on_init`, `on_vault_open`, `on_node_create` хуки
- `verstak.node.register_type()` — новые типы дел
- `verstak.http.route()` — API для GUI
- шаблоны дела (JSON) → предзаполненное дерево
- песочница: нет io/os.execute, только API
- CLI: `verstak plugin list / install / enable`
- DokuWiki импортер — пример плагина в `contrib/plugins/importer-dokuwiki/`
**Действия:**
- DokuWiki парсер: namespaces как nodes tree
- страницы как note nodes с .md файлами
- CLI: `import-dokuwiki --pages /path --media /path --target-node ...`
- Originals сохраняются без изменений
- `internal/core/plugins/manager.go` — сканирование, загрузка, валидация
- Lua runtime (gopher-lua) с песочницей
- Plugin API: node, config, activity, http, ui, vault
- Миграции плагинов (SQL)
- Реестр типов дел → GUI рендерит разные карточки
- CLI: plugin list/install/enable
- Базовый шаблон дела (client.json)
- Пример плагина: DokuWiki importerв `contrib/`
**Commit:** `step 10: DokuWiki importer`
**Commit:** `step 10: plugins system`
---
@@ -357,11 +368,11 @@
- CLI: plugin list/install/enable
- Базовый шаблон дела (client.json)
**Commit:** `step 16: plugins system`
**Commit:** `step 10: plugins system`
---
## Сводка структуры репозитория
## Структура репозитория
```
verstak/
@@ -386,7 +397,6 @@ verstak/
worklog/
activity/
search/
importers/
sync/
security/
config/