From dcbf422cb64ab5b17e9828857a4e503067115607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=97=D0=B0=D1=80=D1=83=D0=B1=D0=B8=D0=BD=20=D0=A4=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=D0=BF=D0=BF?= <289370046+zarubinphil@users.noreply.github.com> Date: Tue, 16 Jun 2026 12:38:24 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=D0=B1=D0=B5=D0=B7=D0=BE=D0=BF=D0=B0?= =?UTF-8?q?=D1=81=D0=BD=D1=8B=D0=B9=20P1-=D0=B1=D0=B0=D1=82=D1=87=20=D0=B8?= =?UTF-8?q?=D0=B7=20re-=D0=B0=D1=83=D0=B4=D0=B8=D1=82=D0=B0=20(Brewfile=20?= =?UTF-8?q?=C2=B7=20launchd-guard=20=C2=B7=20--only=3D0b=20=C2=B7=20guard-?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Взяты in-repo, не-live-мутирующие находки (безопасно): - KGB-6: shellcheck в Brewfile (CLAUDE.md-команда теперь работает после bootstrap). - KGB-11: launchd-guard.plist PATH +$HOME/.local/bin (симметрия с health.plist, само-консистентность guard'а при сверке своего PATH). - KGB-12: --only=0b изолирован (layer_tools phase 0→0b) — теперь --only=0=база, --only=0b=инструменты раздельно; задокументировано в CLAUDE.md. - CIA-6: guard functional-тест расширен (.env.production, secrets/db.key → блок). Проверено ПЕРЕД коммитом (урок прошлой прорухи): --only изоляция, plutil, smoke зелёный. Отложено как НЕБЕЗОПАСНОЕ на боевой (live-мутация, машина владельца): - нормализация абс.путей в ~/.agents (CIA-3) · реальный launchctl на чистом таргете (KGB-14). --- Brewfile | 1 + CLAUDE.md | 2 +- bootstrap.sh | 2 +- launchd/com.athena.launchd-guard.plist | 5 +++-- smoke/smoke.sh | 2 ++ 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Brewfile b/Brewfile index d5e48b7..ae97e82 100644 --- a/Brewfile +++ b/Brewfile @@ -11,6 +11,7 @@ brew "jq" brew "ripgrep" brew "fd" brew "coreutils" # gtimeout, gdate — для хуков с таймаутами +brew "shellcheck" # линт bootstrap.sh + smoke/*.sh (команда из CLAUDE.md) # Опционально (под проекты) brew "yt-dlp" # Мнемозина: kb-yt-watch diff --git a/CLAUDE.md b/CLAUDE.md index 1526aa3..333d89c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -15,7 +15,7 @@ Athena — переносимая агентная ОС: разворот все ## Команды - Линт: `shellcheck bootstrap.sh smoke/*.sh` - Сухой прогон: `./bootstrap.sh --dry-run` -- Slice: `./bootstrap.sh --only=<0..6>` +- Slice: `./bootstrap.sh --only=<0|0b|1..6>` (`0`=база, `0b`=инструменты ~/tools — раздельно) - Smoke: `smoke/smoke.sh` - Dry-validate шаблонов (без chezmoi): `smoke/dry-validate.sh` (merge → рендер → plist/json/bash-n + лов неизвестных `{{ }}`) diff --git a/bootstrap.sh b/bootstrap.sh index 5e9048f..aa54611 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -54,7 +54,7 @@ layer0_base() { # ───────── Слой 0b: инструменты (~/tools — боты и т.п., ДО Сознания) ───────── # Клонится ДО Слоя 1: chezmoi run_once_ генерит .env бота при apply, если бот уже на месте. layer_tools() { - phase 0 || return 0; say "Слой 0b — инструменты (~/tools)" + phase 0b || return 0; say "Слой 0b — инструменты (~/tools)" ensure_private [ -f "$ATHENA_TOOLS_MANIFEST" ] || { warn "нет tools.manifest — пропуск"; return 0; } mkdir -p "$HOME/tools" diff --git a/launchd/com.athena.launchd-guard.plist b/launchd/com.athena.launchd-guard.plist index 076805b..3ffd605 100644 --- a/launchd/com.athena.launchd-guard.plist +++ b/launchd/com.athena.launchd-guard.plist @@ -1,7 +1,8 @@ + Сам guard зависит от системных бинарей (PlistBuddy/plutil по абс. пути), но включает + $HOME/.local/bin для само-консистентности (guard сверяет PATH всех агентов, в т.ч. свой). --> Labelcom.athena.launchd-guard @@ -12,7 +13,7 @@ EnvironmentVariables - PATH/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin + PATH$HOME/.local/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin StartCalendarInterval Hour9Minute30 diff --git a/smoke/smoke.sh b/smoke/smoke.sh index 79bbf6d..d56977b 100755 --- a/smoke/smoke.sh +++ b/smoke/smoke.sh @@ -48,6 +48,8 @@ chk ".env → блок (exit 2)" '[ "$(ge /proj/.env)" = 2 ]' chk ".env.example → пропуск (exit 0)" '[ "$(ge /proj/.env.example)" = 0 ]' chk "~/.secrets/* → блок" '[ "$(ge /Users/u/.secrets/db)" = 2 ]' chk "secret-shaped имя (db.key) → блок" '[ "$(ge /proj/db.key)" = 2 ]' +chk ".env.production → блок" '[ "$(ge /proj/.env.production)" = 2 ]' +chk "secrets/db.key (в подпапке) → блок" '[ "$(ge /proj/secrets/db.key)" = 2 ]' chk "id_ed25519 → блок" '[ "$(ge /Users/u/.ssh/id_ed25519)" = 2 ]' chk "обычный .md → пропуск" '[ "$(ge /proj/readme.md)" = 0 ]' chk "кириллический путь .env → блок (unicode-safe)" '[ "$(ge /Пользователь/проект/.env)" = 2 ]'