Files
Rules/README.md
T
PapaTramp 7f8e7c0cb2 init-cursor: авто-bootstrap git на новом ПК, install.ps1 с Gitea.
Один вызов init-cursor настраивает SSH при необходимости и копирует rules в проект.
2026-06-18 11:23:30 +10:00

63 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Rules
Правила и скрипты для настройки нового компьютера: SSH-ключи, Cursor rules, git remotes, home Gitea.
## Один вызов: `init-cursor`
| Состояние машины | Что делает `init-cursor` |
|------------------|--------------------------|
| Ничего не настроено | SSH-ключи, Gitea API, clone Rules в `$HOME/CursorRules`, профиль shell |
| Git уже настроен | Только копирует rules в текущий проект + remotes |
Источник правил — локальный клон `$HOME/CursorRules` (после bootstrap). Обновить: `init-cursor -Update`.
## Новый Windows-ПК
В каталоге **вашего проекта** (один раз, Gitea спросит логин/пароль по HTTPS):
```powershell
irm https://git.kalinamall.ru/PapaTramp/Rules/raw/branch/main/install.ps1 | iex
```
Дальше в любом проекте:
```powershell
init-cursor
```
## Новый Linux-хост
```bash
cd ~/projects/your-repo
curl -fsSL https://git.kalinamall.ru/PapaTramp/Rules/raw/branch/main/install.sh | bash
```
Затем:
```bash
init-cursor
init-cursor --update
```
## Что происходит внутри
1. **install.ps1 / install.sh** — shallow clone Rules по HTTPS (первый раз)
2. **init-cursor** вызывает `Invoke-MachineBootstrap` / `invoke-machine-bootstrap.sh`:
- `local/git-user.conf` — git user.name / email
- `scripts/Setup-GitSsh*` — ключи и `~/.ssh/config`
- `scripts/Register-GiteaSshKeys*` — pubkey в Gitea API
- clone/update `$HOME/CursorRules` (SSH, fallback HTTPS)
3. Копирует `.cursorignore`, `.cursor/rules/*.mdc`, дополняет `.gitignore`
4. `Set-GitRemotes*` + `Ensure-GiteaHomeRepo.ps1` для текущего репозитория
`bootstrap.ps1` / `bootstrap.sh` оставлены для ручного запуска без проекта.
## Конфиги (local/)
| Файл | Назначение |
|------|------------|
| `git-ssh-hosts.conf` | Хосты и профили SSH-ключей |
| `git-user.conf` | `user.name` / `user.email` |
| `kalinamall-gitea.conf` | API kalinamall |
| `papatramp-gitea.conf` | API home Gitea |