init-cursor: авто-bootstrap git на новом ПК, install.ps1 с Gitea.
Один вызов init-cursor настраивает SSH при необходимости и копирует rules в проект.
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
#Requires -Version 5.1
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Первая загрузка с Gitea: clone Rules и запуск init-cursor в текущем проекте.
|
||||
|
||||
.EXAMPLE
|
||||
cd C:\path\to\your-repo
|
||||
irm https://git.kalinamall.ru/PapaTramp/Rules/raw/branch/main/install.ps1 | iex
|
||||
#>
|
||||
[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.lan:2222/PapaTramp/Rules.git'
|
||||
|
||||
if (-not (Test-Path (Join-Path $rulesDest '.git'))) {
|
||||
Write-Host '[*] Cloning Rules from Gitea (HTTPS, login once if asked)...' -ForegroundColor Cyan
|
||||
if (Test-Path -LiteralPath $rulesDest) {
|
||||
throw "Path exists and is not a git repo: $rulesDest"
|
||||
}
|
||||
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
|
||||
Reference in New Issue
Block a user