46 lines
1.5 KiB
PowerShell
46 lines
1.5 KiB
PowerShell
#Requires -Version 5.1
|
|
<#
|
|
.SYNOPSIS
|
|
Первая загрузка Rules и запуск init-cursor в текущем проекте.
|
|
|
|
.DESCRIPTION
|
|
Репозиторий приватный — irm .../raw/.../install.ps1 без логина вернёт 404.
|
|
Запускайте этот файл после clone или однострочник из README.
|
|
|
|
.EXAMPLE
|
|
git clone --depth 1 ssh://git@git.kalinamall.ru:2222/PapaTramp/Rules.git $HOME\CursorRules
|
|
& $HOME\CursorRules\install.ps1
|
|
#>
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(ValueFromRemainingArguments = $true)]
|
|
[object[]]$InitCursorArgs
|
|
)
|
|
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$rulesDest = Join-Path $HOME 'CursorRules'
|
|
$httpsUrl = 'https://git.kalinamall.ru/PapaTramp/Rules.git'
|
|
$sshUrl = 'ssh://git@git.kalinamall.ru:2222/PapaTramp/Rules.git'
|
|
|
|
if (-not (Test-Path (Join-Path $rulesDest '.git'))) {
|
|
if (Test-Path -LiteralPath $rulesDest) {
|
|
throw "Path exists and is not a git repo: $rulesDest"
|
|
}
|
|
|
|
Write-Host '[*] Cloning Rules via SSH...' -ForegroundColor Cyan
|
|
git clone --depth 1 $sshUrl $rulesDest 2>&1 | Out-Null
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host '[!] SSH clone failed - trying HTTPS (enter Gitea login once)...' -ForegroundColor Yellow
|
|
git clone --depth 1 $httpsUrl $rulesDest
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw 'git clone failed'
|
|
}
|
|
}
|
|
Write-Host "[+] Cloned to $rulesDest" -ForegroundColor Green
|
|
}
|
|
|
|
. (Join-Path $rulesDest 'init-cursor.ps1')
|
|
init-cursor @InitCursorArgs
|