chore(home): mirror from kalinamall (c53704a) with papatramp URLs
This commit is contained in:
+65
@@ -0,0 +1,65 @@
|
||||
#Requires -Version 5.1
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Точка входа на новом ПК: clone Rules, bootstrap, init-cursor в текущем проекте.
|
||||
|
||||
.DESCRIPTION
|
||||
SSH / HTTPS / ключи / remotes — автоматически. Запускать из каталога проекта.
|
||||
На голом ПК: скопируйте этот файл с рабочей машины (scp/USB), затем:
|
||||
& .\install.ps1
|
||||
|
||||
.EXAMPLE
|
||||
cd C:\path\to\your-repo
|
||||
& $env:TEMP\install.ps1
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[switch]$SkipGitRemotes,
|
||||
[switch]$Update
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$rulesDest = Join-Path $HOME 'CursorRules'
|
||||
$httpsUrl = 'https://git.papatramp.ru/PapaTramp/Rules.git'
|
||||
$sshUrl = 'ssh://git@git.papatramp.ru:2222/PapaTramp/Rules.git'
|
||||
|
||||
function Ensure-RulesClone {
|
||||
if (Test-Path (Join-Path $rulesDest '.git')) {
|
||||
Write-Host '[*] Updating CursorRules...' -ForegroundColor Cyan
|
||||
git -C $rulesDest pull --ff-only
|
||||
return
|
||||
}
|
||||
|
||||
if (Test-Path -LiteralPath $rulesDest) {
|
||||
$backup = "${rulesDest}.bak-$(Get-Date -Format 'yyyyMMdd-HHmmss')"
|
||||
Write-Host "[!] Replacing non-git folder: $rulesDest -> $backup" -ForegroundColor Yellow
|
||||
Move-Item -LiteralPath $rulesDest -Destination $backup
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
Ensure-RulesClone
|
||||
|
||||
. (Join-Path $rulesDest 'init-cursor.ps1')
|
||||
|
||||
if ($Update) {
|
||||
init-cursor -Update -SkipGitRemotes:$SkipGitRemotes
|
||||
}
|
||||
elseif ($SkipGitRemotes) {
|
||||
init-cursor -SkipGitRemotes
|
||||
}
|
||||
else {
|
||||
init-cursor
|
||||
}
|
||||
Reference in New Issue
Block a user