From b3792a304be9686349a50dec84299d808e2bfadb Mon Sep 17 00:00:00 2001 From: Aleksey Sabilin Date: Mon, 27 Jul 2026 23:10:45 +0300 Subject: [PATCH] docs: forbid bare git push; use git-push.sh helpers. [skip ci] --- .cursor/rules/agent-pitfalls.mdc | 3 +++ .cursor/rules/shell-wsl-not-powershell.mdc | 16 ++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.cursor/rules/agent-pitfalls.mdc b/.cursor/rules/agent-pitfalls.mdc index 53b0a99..ee1bb6f 100644 --- a/.cursor/rules/agent-pitfalls.mdc +++ b/.cursor/rules/agent-pitfalls.mdc @@ -27,10 +27,13 @@ alwaysApply: true | `editor` / not a terminal | Не `git commit` без `-F` в WSL; из Windows: `git commit -F file` | | Сотни `M` после reset на `/mnt/c` | `git config core.filemode false` (локально); не «чинить» код | | Удалились `.cursor/`, `.idea/` | **`git clean -fdx` только с backup** env + certs; IDE-директории **не трогать** | +| Push «висит» / ждёт login | **Не** `git push origin` — только `~/.cursor/eventhub/git-push.sh` / `git-push-main.sh` | | Push заблокирован Auto-review | Push в `master` — только по явной просьбе; `request_smart_mode_approval` | **`git clean` / reset к origin:** сначала сохранить `docker/.env*`, `.env.development`, `docker/traefik/certs/*`. +**Push:** запрещены голые `git push` / `git push origin …`. Канон — `bash ~/.cursor/eventhub/git-push.sh ` (токен из secrets). + ## 3. Docker dev (Swarm локально) | Ошибка | Правильно | diff --git a/.cursor/rules/shell-wsl-not-powershell.mdc b/.cursor/rules/shell-wsl-not-powershell.mdc index da0b704..d585587 100644 --- a/.cursor/rules/shell-wsl-not-powershell.mdc +++ b/.cursor/rules/shell-wsl-not-powershell.mdc @@ -47,13 +47,25 @@ npm / npx / node из Windows # сломан | Front lint/build/e2e | `wsl -e bash` + `cd …/EventHubFront && npm …` | | Front перед push main | сначала `npm run test:e2e:ift` в WSL, потом `~/.cursor/eventhub/git-push-main.sh` | | Back rebar/eunit | `source scripts/wsl-dev-env.sh` в WSL | -| Git commit/push | `~/.cursor/eventhub/git-commit.sh` / `git-push.sh` / `git-push-main.sh` | +| Git commit/push | **только** `~/.cursor/eventhub/git-commit.sh` / `git-push.sh` / `git-push-main.sh` | | JSON/API/python | скрипт `.sh` или `.py` на диске, запуск из WSL | +## Git push (обязательно) + +**Запрещено агентам:** `git push`, `git push origin`, `git push origin HEAD` / `master` напрямую — без токена зависают на HTTPS prompt. + +**Канон:** +```text +bash ~/.cursor/eventhub/git-push.sh /mnt/c/Users/alexc/IdeaProjects/eventHub/EventHubBack +bash ~/.cursor/eventhub/git-push-main.sh /mnt/c/Users/alexc/IdeaProjects/eventHub/EventHubFront +``` + +Credential store в WSL уже настроен (`credential.helper=store` + `git.sabilin.com`); хелпер всё равно предпочтителен (явный URL с токеном из secrets). + ## Перед push Front 1. WSL: `npm run lint && npm run build` (ловит синтаксис/TS) 2. WSL: `npm run test:e2e:ift` -3. Только потом push. **Не пушить**, если lint/build/IFT красные. +3. Только потом push через `git-push-main.sh`. **Не пушить**, если lint/build/IFT красные. ## Частые сбои (подробнее) См. **`agent-pitfalls.mdc`**: git `-F` вместо heredoc, `&&` в PS, docker dev scale, `git clean` vs `.cursor/`.