diff --git a/.cursor/rules/01-context-control.md b/.cursor/rules/01-context-control.md new file mode 100644 index 0000000..a5754f1 --- /dev/null +++ b/.cursor/rules/01-context-control.md @@ -0,0 +1,32 @@ +--- +description: Global token-saving, cost control, and context management rules +globs: * +--- + +# Global Optimization & Cost Control + +## ?? Answers +-Always answer briefly and only to the point, otherwise only if it is stated in the question or when it is not possible to answer briefly. + +## ?? Context & Local Data +- **Strict file targeting:** Work ONLY with files explicitly provided via `@` or open in the active editor tab. Do not use global codebase search unless requested. +- **Local assets only:** Always work with local copies of repositories and dependencies. Never request external web resources or re-download packages without a explicit build error. +- **Size Limit:** Do not load files larger than 500 lines into the context unless strictly necessary. + +## ?? Git & Commits Management +- **Automatic commits are strictly FORBIDDEN.** Never execute `git commit` or `git push` without an explicit user command. +- Only suggest a commit after phrases like: " ", " ", "Push". +- Before committing: display `git diff --stat` and wait for explicit user confirmation. +- Use Conventional Commits format (`feat:`, `fix:`, `refactor:`, `docs:`). + +## ?? Output Format & Brevity +- **Strictly no fluff:** Omit greetings, apologies, and closing pleasantries. +- **Diff-style only:** Output only modified code fragments, never duplicate unchanged logic or whole files. +- **Extreme brevity:** Explanations must be 1-3 sentences max. Use documentation links instead of long texts. +- If a task doesn't require code, respond strictly with text. If in doubt, ask ONE precise clarifying question. + +## ?? Model Routing Reminder +- Simple questions, explanations, docs ? Use lightweight models (e.g., `gpt-4o-mini`, `claude-3-haiku`). +- Complex code generation, refactoring, and debugging ? Use advanced models (e.g., `claude-3.5-sonnet`). +- Do not switch models without an explicit reason. + diff --git a/.cursor/rules/agent-monitors-version-bump.mdc b/.cursor/rules/agent-monitors-version-bump.mdc index 2bea236..c5a6ae3 100644 --- a/.cursor/rules/agent-monitors-version-bump.mdc +++ b/.cursor/rules/agent-monitors-version-bump.mdc @@ -1,4 +1,4 @@ ---- +--- description: При правках агентских скриптов (RDP/SSH) всегда bump версии — иначе ПК не обновятся alwaysApply: true --- diff --git a/.cursor/rules/no-cursor-in-repositories.mdc b/.cursor/rules/no-cursor-in-repositories.mdc new file mode 100644 index 0000000..c714edc --- /dev/null +++ b/.cursor/rules/no-cursor-in-repositories.mdc @@ -0,0 +1,30 @@ +--- +description: Запрет упоминаний Cursor IDE/Agent в git-репозиториях (файлы и коммиты) +alwaysApply: true +--- + +# Не оставлять следов Cursor в репозиториях + +В **коммитах и файлах**, которые попадают в git (включая публичный GitHub), **запрещено** добавлять что-либо, связанное с Cursor как инструментом разработки. + +## Запрещено + +- Упоминания **Cursor**, **Cursor IDE**, **Cursor Agent**, **cursoragent**, **cursor.com**, **cursor.sh** в README, docs, комментариях, конфигах. +- Trailers в сообщениях коммитов: `Co-authored-by: Cursor …`, `Made-with: Cursor`, email `cursoragent@cursor.com`. +- Каталог **`.cursor/`**, файлы только для IDE (**`AGENTS.md`**, **`CURSOR.md`**) — **не коммитить** в публичные репозитории (должны быть в `.gitignore`, если репо public). +- Ссылки на Cursor в runbook, deploy-доках, issue templates. + +## Разрешено (не путать с IDE) + +- CSS: **`cursor: pointer`** (и аналоги). +- Предметный код: **poll cursor**, **CurrentCursor**, **Update-MonitorPollCursor**, **Console.CursorLeft**, **DB cursor** (sqlite/psycopg2), **MOEX `analytics.cursor`** и т.п. + +## Git / GitHub + +- **Author и committer** — только владелец проекта (**Andrey Lutsenko**, email, привязанный к GitHub), **без** co-author Cursor. +- Перед push в public remote: нет `cursoragent`, `Co-authored-by: Cursor` в истории и дереве (`git log --format=fuller`, поиск по репо). + +## При работе агента + +- Не добавлять «Powered by Cursor», бейджи, секции про Cursor в документацию продукта. +- Правила Cursor (`.cursor/rules/`) — локально или только в **приватном** remote; в публичный GitHub не попадают. diff --git a/.cursor/rules/powershell-spec.md b/.cursor/rules/powershell-spec.md new file mode 100644 index 0000000..f85d9d6 --- /dev/null +++ b/.cursor/rules/powershell-spec.md @@ -0,0 +1,18 @@ +--- +description: High-density PowerShell script generation rules for minimal token usage +globs: "*.ps1, *.psm1" +--- + +# PowerShell Token Optimization + +- **Use Short Aliases:** Use short aliases instead of full cmdlet names to drastically cut output tokens: + - Use `gc` instead of `Get-Content` + - Use `gci` instead of `Get-ChildItem` + - Use `%` instead of `ForEach-Object` + - Use `?` instead of `Where-Object` + - Use `measure` instead of `Measure-Object` +- **Pipeline Over Loops:** Prefer pipeline chains (`gci | % { ... }`) over multi-line `foreach ($item in $items) { ... }` blocks. +- **No Help/Comments:** Do not generate `.SYNOPSIS`, `.DESCRIPTION`, or comment-based help at the top of scripts. +- **Omit Parameter Names:** Drop explicit parameter names where positional arguments are clear (e.g., use `gc file.txt` instead of `Get-Content -Path file.txt`). +- **Silent Execution:** Do not add verbose logging, `Write-Host`, or `Write-Output` unless explicitly asked to create UI/logs. +- **Preserve CLI Arguments:** Do not duplicate full multi-line `yt-dlp` command-line arguments, format strings, or output templates if they are not the subject of the modifications. Use placeholders or variable references. diff --git a/.cursor/rules/python-spec.md b/.cursor/rules/python-spec.md new file mode 100644 index 0000000..fb0ad8e --- /dev/null +++ b/.cursor/rules/python-spec.md @@ -0,0 +1,14 @@ +--- +description: Ultra-dense Python code generation rules to save output tokens +globs: "*.py" +--- + +# Python Token Optimization + +- **Use Syntactic Sugar:** Prioritize list comprehensions, dict comprehensions, and ternary operators (`x if condition else y`) to keep code on a single line. +- **Built-in Libraries First:** Use standard libraries (`pathlib`, `json`, `subprocess`, `asyncio`) instead of introducing heavy external dependencies unless already in `requirements.txt`. +- **Type Hinting:** Do NOT add type hints (`def func(x: int) -> str:`) unless the existing file strictly uses them. Type hints consume significant tokens. +- **No Format Duplication:** When modifying scripts (like video downloaders), provide only the modified function or class method. Never output the `if __name__ == "__main__":` block or argument parsing logic if they haven't changed. +- **No Docstrings:** Strictly forbid writing `"""docstrings"""` or `# comments` explaining the logic. +- **Preserve yt-dlp Options:** Never rewrite, duplicate, or expand the `ydl_opts` configuration dictionary or custom extraction options. If changes are unrelated to download options, use a placeholder comment like `# ... existing ydl_opts ...` instead of outputting the full dictionary block. + diff --git a/.cursor/rules/version-bump-rdp.mdc b/.cursor/rules/version-bump-rdp.mdc new file mode 100644 index 0000000..ead828e --- /dev/null +++ b/.cursor/rules/version-bump-rdp.mdc @@ -0,0 +1,31 @@ +--- +description: При правке скриптов RDP-монитора обязательно поднимать version.txt и $ScriptVersion +globs: Login_Monitor.ps1,Deploy-LoginMonitor.ps1,Sac-Client.ps1,Exchange-MailSecurity.ps1,Watchdog_RDP_Monitor.ps1,version.txt +alwaysApply: false +--- + +# Bump версии RDP-login-monitor + +Без новой версии **`Deploy-LoginMonitor.ps1` на ПК не подхватит обновление** (сравнение `version.txt` на шаре с `deployed_version.txt`). + +## Что менять в одном коммите с правкой + +1. **`Login_Monitor.ps1`** — `$ScriptVersion` (например `2.0.7-SAC`) +2. **`version.txt`** — **та же строка**, одна строка без лишнего текста + +Строки должны **совпадать** (включая суффикс `-SAC`). + +## Как поднимать + +- Обычная правка монитора / deploy / SAC-клиента → **patch**: `2.0.6-SAC` → `2.0.7-SAC` +- Крупный релиз → по смыслу **minor** (`2.0.x` → `2.1.0-SAC`) + +## Другие скрипты с собственной версией + +- **`Exchange-MailSecurity.ps1`** — отдельный `$ScriptVersion`; bump только если меняли этот пакет +- После bump опубликовать на шару NETLOGON (`update-rdp-monitor.ps1` / pull на сервере публикации) + +## Чеклист перед push + +- [ ] `$ScriptVersion` и `version.txt` совпадают +- [ ] Версия на шаре будет **новее** локальной `deployed_version.txt` на клиентах diff --git a/.cursor/rules/version-bump-ssh.mdc b/.cursor/rules/version-bump-ssh.mdc new file mode 100644 index 0000000..f532984 --- /dev/null +++ b/.cursor/rules/version-bump-ssh.mdc @@ -0,0 +1,28 @@ +--- +description: При правке ssh-monitor обязательно поднимать version.txt и SSH_MONITOR_VERSION +globs: ssh-monitor,sac-client.sh,update_ssh_monitor.sh,version.txt +alwaysApply: false +--- + +# Bump версии ssh-monitor + +Без bump **`update_ssh_monitor.sh` не скопирует новый скрипт** на хост (сравнение sha256; версия нужна для отчётов, SAC и диагностики). + +## Что менять в одном коммите с правкой + +1. **`ssh-monitor`** — `SSH_MONITOR_VERSION="X.Y.Z-SAC"` (первая строка блока версии) +2. **`version.txt`** — **та же строка** + +Строки должны **совпадать**. + +## Как поднимать + +- Обычная правка → **patch**: `2.0.0-SAC` → `2.0.1-SAC` +- Крупный релиз → **minor** по смыслу + +`sac-client.sh` отдельный номер **не** задаёт — берёт `SSH_MONITOR_VERSION` из установленного `ssh-monitor`. + +## Чеклист перед push + +- [ ] `SSH_MONITOR_VERSION` и `version.txt` совпадают +- [ ] На хостах: `git pull` и запуск `update_ssh_monitor.sh` (или `--deploy`)