From 9d0b5b5aa7d6fede131e91939667c08b99017e74 Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 24 Jun 2026 13:22:16 +0300 Subject: [PATCH] =?UTF-8?q?feat(devtools):=20scaffolding=20(just=20new-plu?= =?UTF-8?q?gin)=20+=20just-=D1=82=D0=B0=D1=80=D0=B3=D0=B5=D1=82=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit templates/plugin (валидный манифест+locales+README); new-plugin генерит и валидирует; validate-manifest / plugin-dev-run (каркас, App-Host v3) / sim (плейсхолдер v2). plugins/ — в .gitignore. Co-Authored-By: Claude Opus 4.8 Signed-off-by: Alexander --- .gitignore | 3 +++ justfile | 29 +++++++++++++++++++++++++++++ templates/plugin/README.md | 6 ++++++ templates/plugin/locales/ru.yaml | 4 ++++ templates/plugin/manifest.yaml | 11 +++++++++++ 5 files changed, 53 insertions(+) create mode 100644 templates/plugin/README.md create mode 100644 templates/plugin/locales/ru.yaml create mode 100644 templates/plugin/manifest.yaml diff --git a/.gitignore b/.gitignore index 2a71a95..ef88c8c 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,6 @@ venv/ # Локальные dev-артефакты *.log + +# Сгенерированные каркасы плагинов (just new-plugin) +/plugins/ diff --git a/justfile b/justfile index ce4ee69..64b632e 100644 --- a/justfile +++ b/justfile @@ -28,3 +28,32 @@ test-integration: # полный локальный гейт ci: lint test deny + +# --- плагины (F02/F03) --- + +# валидировать манифест плагина +validate-manifest path: + cargo run -q -p shturman-manifest-validator -- {{path}} + +# сгенерировать каркас плагина в plugins/ и проверить валидатором +new-plugin name: + #!/usr/bin/env bash + set -euo pipefail + dest="plugins/{{name}}" + [ -e "$dest" ] && { echo "уже существует: $dest"; exit 1; } + mkdir -p "$dest" + cp -R templates/plugin/. "$dest/" + for f in $(find "$dest" -type f); do + tmp=$(mktemp); sed "s/__NAME__/{{name}}/g" "$f" > "$tmp" && mv "$tmp" "$f" + done + echo "создан плагин: $dest" + cargo run -q -p shturman-manifest-validator -- "$dest/manifest.yaml" + +# dev-запуск плагина (каркас; полноценно — с App-Host, v3) +plugin-dev-run path: + @echo "plugin-dev-run {{path}}: нужен App-Host (приходит в v3). Пока — валидация манифеста:" + cargo run -q -p shturman-manifest-validator -- {{path}}/manifest.yaml + +# Vehicle Simulator (плейсхолдер; домен E, v2) +sim: + @echo "Vehicle Simulator — v2 (домен E): vcan + ELM327-emu; каркас в sim/." diff --git a/templates/plugin/README.md b/templates/plugin/README.md new file mode 100644 index 0000000..ef9a314 --- /dev/null +++ b/templates/plugin/README.md @@ -0,0 +1,6 @@ +# Плагин __NAME__ + +Сгенерирован `just new-plugin __NAME__`. Манифест — `manifest.yaml`. + +Проверка: `just validate-manifest plugins/__NAME__/manifest.yaml`. +Запуск в dev (появится с App-Host, v3): `just plugin-dev-run plugins/__NAME__`. diff --git a/templates/plugin/locales/ru.yaml b/templates/plugin/locales/ru.yaml new file mode 100644 index 0000000..23cb172 --- /dev/null +++ b/templates/plugin/locales/ru.yaml @@ -0,0 +1,4 @@ +# Русские строки плагина (ru обязателен; i18n-ready — другие локали добавляются рядом). +name: "__NAME__" +tiles: + main: "__NAME__" diff --git a/templates/plugin/manifest.yaml b/templates/plugin/manifest.yaml new file mode 100644 index 0000000..4f26be9 --- /dev/null +++ b/templates/plugin/manifest.yaml @@ -0,0 +1,11 @@ +plugin: + id: dev.example.__NAME__ + name: "__NAME__" + version: 0.1.0 + shturman_api: "1" +capabilities: + ui_tiles: 1 +extension_points: + tiles: + - id: main + title: "__NAME__"