From 75e5ef3d7687edd12291c06c3b6f8efe891877e2 Mon Sep 17 00:00:00 2001 From: vados-dev Date: Sun, 8 Mar 2026 21:42:40 +0300 Subject: [PATCH] Autocommit in repo: ros.vados.ru, generated by owner: root, in 21:42:40 08.03.2026. --- .config/config.mk | 4 + bin/check_repo.sh | 27 ++++ bin/notify_telegram.sh | 17 +++ html/func-collection/codex_recepts/Readme.md | 100 +++++++++++++ .../codex_recepts/repo_struct.md | 140 ++++++++++++++++++ 5 files changed, 288 insertions(+) create mode 100644 .config/config.mk create mode 100755 bin/check_repo.sh create mode 100755 bin/notify_telegram.sh create mode 100644 html/func-collection/codex_recepts/Readme.md create mode 100644 html/func-collection/codex_recepts/repo_struct.md diff --git a/.config/config.mk b/.config/config.mk new file mode 100644 index 000000000..ca800393f --- /dev/null +++ b/.config/config.mk @@ -0,0 +1,4 @@ + export BOT_TOKEN ?= "8390868324:AAG3_d1hfVR2M6pGAgDK6ZvhOe4J97nyopw" + export CHAT_ID ?= "454403445" + export REPO_DIR ?= $(BUILD_DIR) + export DRY_RUN ?= 0 diff --git a/bin/check_repo.sh b/bin/check_repo.sh new file mode 100755 index 000000000..7612e134f --- /dev/null +++ b/bin/check_repo.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +cd "${REPO_DIR:-.}" + +dirty="$(git status --porcelain || true)" +diff="$(git diff --quiet && git diff --cached --quiet || true)" +ls-files="$([ -z "$$(git ls-files --others --exclude-standard)" ] || true)" +if [[ -n "$diff" && -n "$ls-files" ]]; then + echo "[check] repo diff, go to proclean check." + if [[ -n "$dirty" ]]; then + echo "[check] repo dirty, stop" + bash scripts/notify_telegram.sh "STOP: repo dirty in $(pwd)" + exit 1 + else + echo "[check] repo clean" + fi +else + echo "[check] not clean. Go to autocommit him." + if [[ -n "$ls-files" ]]; then + git add . + git commit -m "${COMM_INFO}" + else + git -v brnch + git commit -am "${COMM_INFO}" + fi + git push +fi diff --git a/bin/notify_telegram.sh b/bin/notify_telegram.sh new file mode 100755 index 000000000..af2a3ce1f --- /dev/null +++ b/bin/notify_telegram.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + + +msg="${1:-no message}" + + if [[ "${DRY_RUN:-0}" == "1" ]]; then + echo "[notify][dry-run] $msg" + exit 0 + if [[ -z "${BOT_TOKEN:-}" || -z "${CHAT_ID:-}" ]]; then + echo "[notify] BOT_TOKEN/CHAT_ID not set, skip" + exit 0 + fi + + curl -fsS --connect-timeout 5 --max-time 10 \ + -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \ + -d "chat_id=${CHAT_ID}" \ + --data-urlencode "text=${msg}" >/dev/null || true diff --git a/html/func-collection/codex_recepts/Readme.md b/html/func-collection/codex_recepts/Readme.md new file mode 100644 index 000000000..f18371b46 --- /dev/null +++ b/html/func-collection/codex_recepts/Readme.md @@ -0,0 +1,100 @@ +
    +
  1. Makefile ������ ��� ����������� �����.
  2. +
  3. ��� ������ � scripts/*.sh.
  4. +
  5. ������� ����� � ��������: set -euo pipefail.
  6. +
  7. ������ ��������: .env/config.mk.
  8. +
  9. ���� � ����������� � ����� ����� (������� notify).
  10. +
  11. ������� ����� � ��������������, ���� ����� 3 ������ ����� ����������.
  12. +
+

������:

+ +

���� ������, � ��������� ��������� ��� ���� ����������� ��������� ������ �� 3 ������, ������� �� ������ �������� �� ����.

+

���� ������� )

+

�������. ��� ����������� ������ �� ����.

+

Makefile

+

SHELL := /bin/bash + .ONESHELL: + .DEFAULT_GOAL := run

+

include config.mk

+

.PHONY: run check notify test

+

run: check + @echo "[run] start main flow" + @# ��� ���� �������� + @echo "[run] done"

+

check: + @bash scripts/check_repo.sh

+

notify: + @bash scripts/notify_telegram.sh "manual notify from make"

+

test: + @bash -n scripts/check_repo.sh + @bash -n scripts/notify_telegram.sh + @echo "syntax ok"

+

config.mk

+

# �� ������� �������. ����� ������� �� ���������/CI. + export BOT_TOKEN ?= + export CHAT_ID ?= + export REPO_DIR ?= . + export DRY_RUN ?= 0

+

scripts/notify_telegram.sh

+

#!/usr/bin/env bash + msg="${1:-no message}"

+

if [[ "${DRY_RUN:-0}" == "1" ]]; then + echo "[notify][dry-run] $msg" + exit 0 + if [[ -z "${BOT_TOKEN:-}" || -z "${CHAT_ID:-}" ]]; then + echo "[notify] BOT_TOKEN/CHAT_ID not set, skip" + exit 0 + fi

+

curl -fsS --connect-timeout 5 --max-time 10 \ + -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \ + -d "chat_id=${CHAT_ID}" \ + --data-urlencode "text=${msg}" >/dev/null || true

+

scripts/check_repo.sh

+

cd "${REPO_DIR:-.}"

+

dirty="$(git status --porcelain || true)" + if [[ -n "$dirty" ]]; then + echo "[check] repo dirty, stop" + bash scripts/notify_telegram.sh "STOP: repo dirty in $(pwd)" + exit 1 + echo "[check] repo clean"

+

������:

+
    +
  1. chmod +x scripts/*.sh
  2. +
  3. BOT_TOKEN=... CHAT_ID=... make run
  4. +
  5. ��� ���������� �������� ��� ��������: DRY_RUN=1 make run
  6. +
+

���� ������, ��������� ����� ������� ����� ����� exit 0 ����� ��������� ��� ��������� �����.

+

��� ����,

+

����. + ��� ������ ������: ���������, exit-������, ��� Telegram-�����������?

+

��� ��� ������� ��� � ���������, � ����� ���� ��������� ���� ������ )))

+

��, ��� ��� ��� ������� ������� ���������: ����� �������� � �������� ����� � ��������.

+

����� �� ��������, ������ ���:

+
    +
  1. ������ docs/ops-notes.md.
  2. +
  3. ���� ��������� ������� ������� (make/git/cron/alerts).
  4. +
  5. ����� ����� scripts/ � �������� �������� ������.
  6. +
+

��� ����� ����� ���������� ���� ���� � �ӣ ��� �����.

+

��� ���� ������ � �� �������� ))

+

��. ������ ������ �� ��������: ����� ����������� � ����.

+

�������:

+
    +
  1. docs/runbook.md ��� ������ ��� ����.
  2. +
  3. make help ������ ����� � �������� ���������.
  4. +
  5. scripts/ ������ ����������� ������, ��� ����� � ����.
  6. +
+

����� ������ �� �����, �ӣ ����� � �������.

+

�� ����� ros.vados.ru � � ����� ������ ���� ������� � �������� ��� ��������

+

�������� ���. ��� ��� ��� ���������� ���� ��� ������: ���� runbook + ���� �������������.

+

����� ��������� �� �����������, ���������� �������:

+
    +
  1. docs/runbook.md
  2. +
  3. docs/decisions.md (������ ������� ������ ���)
  4. +
  5. scripts/ (��� ������)
  6. +
  7. Makefile (������ ������ �����)
  8. +
  9. configs/ (������� MikroTik)
  10. +
\ No newline at end of file diff --git a/html/func-collection/codex_recepts/repo_struct.md b/html/func-collection/codex_recepts/repo_struct.md new file mode 100644 index 000000000..1adf49d81 --- /dev/null +++ b/html/func-collection/codex_recepts/repo_struct.md @@ -0,0 +1,140 @@ + 1. Makefile ������ ��� ����������� �����. + 2. ��� ������ � scripts/*.sh. + 3. ������� ����� � ��������: set -euo pipefail. + 4. ������ ��������: .env/config.mk. + 5. ���� � ����������� � ����� ����� (������� notify). + 6. ������� ����� � ��������������, ���� ����� 3 ������ ����� ����������. + + ������: + + - Makefile -> scripts/check_repo.sh + - scripts/check_repo.sh -> git/telegram/exit-���� + + ���� ������, � ��������� ��������� ��� ���� ����������� ��������� ������ �� 3 ������, ������� �� ������ �������� �� ����. + + + ���� ������� ) + + + �������. ��� ����������� ������ �� ����. + + Makefile + + SHELL := /bin/bash + .ONESHELL: + .DEFAULT_GOAL := run + + include config.mk + + .PHONY: run check notify test + + run: check + @echo "[run] start main flow" + @# ��� ���� �������� + @echo "[run] done" + + check: + @bash scripts/check_repo.sh + + notify: + @bash scripts/notify_telegram.sh "manual notify from make" + + test: + @bash -n scripts/check_repo.sh + @bash -n scripts/notify_telegram.sh + @echo "syntax ok" + + config.mk + + # �� ������� �������. ����� ������� �� ���������/CI. + export BOT_TOKEN ?= + export CHAT_ID ?= + export REPO_DIR ?= . + export DRY_RUN ?= 0 + + scripts/notify_telegram.sh + + #!/usr/bin/env bash + msg="${1:-no message}" + + if [[ "${DRY_RUN:-0}" == "1" ]]; then + echo "[notify][dry-run] $msg" + exit 0 + if [[ -z "${BOT_TOKEN:-}" || -z "${CHAT_ID:-}" ]]; then + echo "[notify] BOT_TOKEN/CHAT_ID not set, skip" + exit 0 + fi + + curl -fsS --connect-timeout 5 --max-time 10 \ + -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \ + -d "chat_id=${CHAT_ID}" \ + --data-urlencode "text=${msg}" >/dev/null || true + + scripts/check_repo.sh + + + cd "${REPO_DIR:-.}" + + dirty="$(git status --porcelain || true)" + if [[ -n "$dirty" ]]; then + echo "[check] repo dirty, stop" + bash scripts/notify_telegram.sh "STOP: repo dirty in $(pwd)" + exit 1 + echo "[check] repo clean" + + ������: + + 1. chmod +x scripts/*.sh + 2. BOT_TOKEN=... CHAT_ID=... make run + 3. ��� ���������� �������� ��� ��������: DRY_RUN=1 make run + + ���� ������, ��������� ����� ������� ����� ����� exit 0 ����� ��������� ��� ��������� �����. + + + ��� ����, + + + ����. + ��� ������ ������: ���������, exit-������, ��� Telegram-�����������? + + + ��� ��� ������� ��� � ���������, � ����� ���� ��������� ���� ������ ))) + + + ��, ��� ��� ��� ������� ������� ���������: ����� �������� � �������� ����� � ��������. + + ����� �� ��������, ������ ���: + + 1. ������ docs/ops-notes.md. + 2. ���� ��������� ������� ������� (make/git/cron/alerts). + 3. ����� ����� scripts/ � �������� �������� ������. + + ��� ����� ����� ���������� ���� ���� � �ӣ ��� �����. + + + ��� ���� ������ � �� �������� )) + + + ��. ������ ������ �� ��������: ����� ����������� � ����. + + �������: + + 1. docs/runbook.md ��� ������ ��� ����. + 2. make help ������ ����� � �������� ���������. + 3. scripts/ ������ ����������� ������, ��� ����� � ����. + + ����� ������ �� �����, �ӣ ����� � �������. + + + �� ����� ros.vados.ru � � ����� ������ ���� ������� � �������� ��� �������� + + + �������� ���. ��� ��� ��� ���������� ���� ��� ������: ���� runbook + ���� �������������. + + ����� ��������� �� �����������, ���������� �������: + + 1. docs/runbook.md + 2. docs/decisions.md (������ ������� ������ ���) + 3. scripts/ (��� ������) + 4. Makefile (������ ������ �����) + 5. configs/ (������� MikroTik) -- 2.52.0