Add live run preflight checklist

This commit is contained in:
Зарубин Филипп
2026-06-24 12:21:42 +03:00
parent fb70104fd1
commit 8f2fc2f8ee
7 changed files with 162 additions and 0 deletions
+2
View File
@@ -47,6 +47,8 @@ jobs:
run: npm run audit:local run: npm run audit:local
- name: Run setup dry-run smoke - name: Run setup dry-run smoke
run: printf '2\n2\n2\n' | MNEMAZINE_SETUP_DRYRUN=1 bash setup.sh run: printf '2\n2\n2\n' | MNEMAZINE_SETUP_DRYRUN=1 bash setup.sh
- name: Run live preflight smoke
run: MNEMAZINE_PREFLIGHT_ALLOW_EMPTY=1 MNEMAZINE_PREFLIGHT_SKIP_REMOTE=1 npm run preflight:live
- name: Run release test suite - name: Run release test suite
run: npm test run: npm test
- name: Run release gate directly - name: Run release gate directly
+23
View File
@@ -170,6 +170,29 @@ To test the Desktop path without touching the live inbox or vault:
npm run protocol:desktop:dry-run npm run protocol:desktop:dry-run
``` ```
Before a real live run, run the preflight:
```bash
npm run preflight:live
```
It checks that tracked code is clean, `HEAD` matches `origin/main`, local
security gates pass, the Desktop dry-run passes, and the inbox has active
files. If preflight fails, do not run `npm start`; fix the cause first.
After a live run, inspect the result:
```bash
cat .mnemazine/state/last-run.json
cat .mnemazine/state/last-action-brief.md
ls -t reports/* | head
npm run complete -- --require-deep
```
If a strict run fails before archive, that is safe: source files stay in the
inbox. Do not move or delete them by hand. Read
`.mnemazine/state/last-run.json`, fix the cause, and run again.
## Website Ingestion ## Website Ingestion
Mnemazine can ingest a website and convert its useful pages into structured notes: Mnemazine can ingest a website and convert its useful pages into structured notes:
+23
View File
@@ -169,6 +169,29 @@ mnemazine
npm run protocol:desktop:dry-run npm run protocol:desktop:dry-run
``` ```
Перед настоящим live-прогоном запусти preflight:
```bash
npm run preflight:live
```
Он проверяет, что код чистый, `HEAD` совпадает с `origin/main`, локальные
security gates зелёные, Desktop dry-run проходит, а в inbox есть активные
файлы. Если preflight упал — `npm start` не запускай, сначала исправь причину.
После live-прогона проверь итог:
```bash
cat .mnemazine/state/last-run.json
cat .mnemazine/state/last-action-brief.md
ls -t reports/* | head
npm run complete -- --require-deep
```
Если строгий прогон падает до архива — это нормально и безопасно: исходники
остаются в inbox. Не переносите и не удаляйте их руками. Читай
`.mnemazine/state/last-run.json`, исправляй причину и запускай снова.
## Парсинг сайтов ## Парсинг сайтов
Mnemazine умеет забирать сайт и превращать его полезные страницы в структурированные заметки: Mnemazine умеет забирать сайт и превращать его полезные страницы в структурированные заметки:
+15
View File
@@ -69,6 +69,21 @@ npm run protocol:desktop:dry-run
This runs the Desktop protocol against temporary inbox/vault/cache/archive paths. This runs the Desktop protocol against temporary inbox/vault/cache/archive paths.
It never archives, deletes, or rewrites the live Desktop inbox. It never archives, deletes, or rewrites the live Desktop inbox.
## Live Preflight
```bash
npm run preflight:live
```
Before a real `npm start`, this checks that tracked code is clean, `HEAD`
matches `origin/main`, the local security audit passes, the Desktop dry-run
passes, and the inbox has active files. Empty inbox or dirty code is a failure.
To test the command itself without files, temporarily set
`MNEMAZINE_PREFLIGHT_ALLOW_EMPTY=1`.
After a live run, inspect `.mnemazine/state/last-run.json`,
`.mnemazine/state/last-action-brief.md`, and the newest files in `reports/`.
## Agent Skills ## Agent Skills
If Codex or Claude skill folders exist, the installer copies portable skills there. If they do not exist, nothing breaks. If Codex or Claude skill folders exist, the installer copies portable skills there. If they do not exist, nothing breaks.
+14
View File
@@ -69,6 +69,20 @@ npm run protocol:desktop:dry-run
Команда гоняет Desktop-протокол на временных inbox/vault/cache/archive. Live Команда гоняет Desktop-протокол на временных inbox/vault/cache/archive. Live
Desktop inbox не архивируется, не удаляется и не переписывается. Desktop inbox не архивируется, не удаляется и не переписывается.
## Live preflight
```bash
npm run preflight:live
```
Перед настоящим `npm start` команда проверяет чистоту tracked-кода, совпадение
с `origin/main`, локальный security audit, Desktop dry-run и наличие файлов в
inbox. Пустой inbox или грязный код — fail. Для проверки самой команды без
файлов можно временно поставить `MNEMAZINE_PREFLIGHT_ALLOW_EMPTY=1`.
После live-прогона смотри `.mnemazine/state/last-run.json`,
`.mnemazine/state/last-action-brief.md` и свежие файлы в `reports/`.
## Agent Skills ## Agent Skills
Если есть папки skills для Codex или Claude — установщик копирует туда переносимые skills. Если их нет, ничего не ломается. Если есть папки skills для Codex или Claude — установщик копирует туда переносимые skills. Если их нет, ничего не ломается.
+1
View File
@@ -16,6 +16,7 @@
"test": "npm run release-check", "test": "npm run release-check",
"audit:security": "npm audit --audit-level=moderate", "audit:security": "npm audit --audit-level=moderate",
"audit:local": "bash scripts/mnemazine-audit-local.sh", "audit:local": "bash scripts/mnemazine-audit-local.sh",
"preflight:live": "bash scripts/mnemazine-live-preflight.sh",
"selftest:security": "node scripts/mnemazine-verify.mjs --selftest && node scripts/mnemazine-webapp-server.mjs --selftest && node scripts/mnemazine-telegram-bot.mjs --selftest && node scripts/mnemazine-weekly-state.mjs --selftest", "selftest:security": "node scripts/mnemazine-verify.mjs --selftest && node scripts/mnemazine-webapp-server.mjs --selftest && node scripts/mnemazine-telegram-bot.mjs --selftest && node scripts/mnemazine-weekly-state.mjs --selftest",
"run": "node scripts/mnemazine-run.mjs", "run": "node scripts/mnemazine-run.mjs",
"protocol:desktop": "bash scripts/mnemazine-desktop-protocol.sh", "protocol:desktop": "bash scripts/mnemazine-desktop-protocol.sh",
+84
View File
@@ -0,0 +1,84 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="${MNEMAZINE_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}"
cd "$ROOT"
fail=0
ok() { printf 'ok %s\n' "$*"; }
warn() { printf 'warn %s\n' "$*" >&2; }
bad() { printf 'fail %s\n' "$*" >&2; fail=1; }
need_cmd() {
if command -v "$1" >/dev/null 2>&1; then ok "$1 found"; else bad "$1 missing"; fi
}
active_count() {
local dir="$1"
find "$dir" -maxdepth 1 -type f ! -name '.*' 2>/dev/null | wc -l | tr -d ' '
}
need_cmd git
need_cmd node
need_cmd npm
if command -v node >/dev/null 2>&1; then
node_major="$(node -p 'process.versions.node.split(".")[0]' 2>/dev/null || echo 0)"
if [ "$node_major" -ge 20 ]; then ok "node >=20"; else bad "node >=20 required"; fi
fi
if [ ! -f package-lock.json ]; then
bad "package-lock.json missing; npm audit/ci are not reproducible"
fi
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
dirty="$(git status --porcelain --untracked-files=no)"
if [ -n "$dirty" ]; then
if [ "${MNEMAZINE_PREFLIGHT_ALLOW_DIRTY:-0}" = "1" ]; then
warn "tracked git changes present, allowed by MNEMAZINE_PREFLIGHT_ALLOW_DIRTY=1"
else
bad "tracked git changes present; commit or stash before live run"
printf '%s\n' "$dirty" >&2
fi
else
ok "tracked git tree clean"
fi
if [ "${MNEMAZINE_PREFLIGHT_SKIP_REMOTE:-0}" != "1" ] && git remote get-url origin >/dev/null 2>&1; then
if git fetch origin main >/dev/null 2>&1; then
head="$(git rev-parse HEAD)"
remote="$(git rev-parse origin/main)"
if [ "$head" = "$remote" ]; then ok "HEAD matches origin/main"; else bad "HEAD differs from origin/main"; fi
else
bad "could not fetch origin/main"
fi
fi
fi
npm run audit:local
npm run protocol:desktop:dry-run
env_inbox="${MNEMAZINE_INBOX:-}"
[ -f "$ROOT/.mnemazine/config.local.sh" ] && . "$ROOT/.mnemazine/config.local.sh"
base_inbox="${env_inbox:-${MNEMAZINE_INBOX:-$HOME/Desktop/Mnemazine Inbox}}"
nested_inbox="$base_inbox/mnemazine-inbox"
base_count="$(active_count "$base_inbox")"
nested_count=0
[ -d "$nested_inbox" ] && nested_count="$(active_count "$nested_inbox")"
total_count=$((base_count + nested_count))
printf 'live inbox: %s (%s files)\n' "$base_inbox" "$base_count"
[ "$nested_count" -gt 0 ] && printf 'nested legacy inbox: %s (%s files)\n' "$nested_inbox" "$nested_count"
if [ "$total_count" -eq 0 ] && [ "${MNEMAZINE_PREFLIGHT_ALLOW_EMPTY:-0}" != "1" ]; then
bad "no active inbox files; add files before live run"
fi
if [ "$fail" -ne 0 ]; then
echo "live preflight failed" >&2
exit 1
fi
echo "live preflight passed"
echo "next: npm start"