Добавить bootstrap для новых ПК и Linux-скрипты.
SSH-ключи и Gitea API до clone Rules; init-cursor копирует из локального $HOME/CursorRules.
This commit is contained in:
+21
-6
@@ -1,21 +1,23 @@
|
||||
#Requires -Version 5.1
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Копирует Cursor rules в текущий каталог и настраивает git remotes.
|
||||
Копирует Cursor rules из локального $HOME\CursorRules в текущий проект.
|
||||
|
||||
.DESCRIPTION
|
||||
1. .cursorignore из $HOME\CursorRules
|
||||
2. .cursor/rules/*.mdc
|
||||
3. В git-репо: Set-GitRemotes.ps1 + Ensure-GiteaHomeRepo.ps1 (home Gitea)
|
||||
Источник — локальный клон репозитория Rules ($HOME\CursorRules), не remote напрямую.
|
||||
На новом ПК сначала: bootstrap.ps1 / bootstrap.sh (SSH + clone Rules).
|
||||
Обновить правила из remote: init-cursor -Update
|
||||
|
||||
.EXAMPLE
|
||||
cd C:\Users\papat\Projects\MyRepo
|
||||
init-cursor
|
||||
init-cursor -Update
|
||||
#>
|
||||
function init-cursor {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[switch]$SkipGitRemotes
|
||||
[switch]$SkipGitRemotes,
|
||||
[switch]$Update
|
||||
)
|
||||
|
||||
$source = Join-Path $HOME 'CursorRules'
|
||||
@@ -23,10 +25,23 @@ function init-cursor {
|
||||
$scripts = Join-Path $source 'scripts'
|
||||
|
||||
if (-not (Test-Path $source)) {
|
||||
Write-Host "Error: $source not found" -ForegroundColor Red
|
||||
Write-Host "Error: $source not found — run bootstrap.ps1 on this machine first" -ForegroundColor Red
|
||||
return
|
||||
}
|
||||
|
||||
if ($Update) {
|
||||
if (Test-Path (Join-Path $source '.git')) {
|
||||
Write-Host '[*] Updating CursorRules from remote...' -ForegroundColor Cyan
|
||||
git -C $source pull --ff-only
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host '[!] git pull failed in CursorRules' -ForegroundColor Yellow
|
||||
}
|
||||
else {
|
||||
Write-Host '[+] CursorRules updated' -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$cursorIgnore = Join-Path $source '.cursorignore'
|
||||
if (Test-Path $cursorIgnore) {
|
||||
Copy-Item $cursorIgnore . -Force
|
||||
|
||||
Reference in New Issue
Block a user