2cddf06b6c
Co-authored-by: 旅行呀~ <travelxiao@qq.com>
39 lines
1.4 KiB
PowerShell
39 lines
1.4 KiB
PowerShell
# Install git-init into the personal Cursor skills directory.
|
|
# Does not copy tokens, profiles, or SSH/GPG keys.
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$source = Join-Path $PSScriptRoot '.cursor\skills\git-init'
|
|
$skillsRoot = Join-Path $env:USERPROFILE '.cursor\skills'
|
|
$destination = Join-Path $skillsRoot 'git-init'
|
|
|
|
if (-not (Test-Path -LiteralPath $source)) {
|
|
throw "Skill source not found: $source"
|
|
}
|
|
|
|
$reserved = Join-Path $env:USERPROFILE '.cursor\skills-cursor'
|
|
if ([IO.Path]::GetFullPath($destination).StartsWith([IO.Path]::GetFullPath($reserved), [StringComparison]::OrdinalIgnoreCase)) {
|
|
throw 'Refusing to install into ~/.cursor/skills-cursor (reserved).'
|
|
}
|
|
|
|
if (-not (Test-Path -LiteralPath $skillsRoot)) {
|
|
New-Item -ItemType Directory -Path $skillsRoot -Force | Out-Null
|
|
}
|
|
|
|
if (Test-Path -LiteralPath $destination) {
|
|
Remove-Item -LiteralPath $destination -Recurse -Force
|
|
}
|
|
|
|
Copy-Item -LiteralPath $source -Destination $destination -Recurse -Force
|
|
|
|
$profileScript = Join-Path $destination 'scripts\store-profile.ps1'
|
|
$tokenScript = Join-Path $destination 'scripts\store-token.ps1'
|
|
|
|
Write-Output "status=installed"
|
|
Write-Output "path=$destination"
|
|
Write-Output 'secrets=not_copied'
|
|
Write-Output ''
|
|
Write-Output 'Next (run in your own terminal, not in chat):'
|
|
Write-Output (" powershell -NoProfile -ExecutionPolicy Bypass -File `"{0}`"" -f $profileScript)
|
|
Write-Output (" powershell -NoProfile -ExecutionPolicy Bypass -File `"{0}`"" -f $tokenScript)
|