mirror of
https://github.com/hansjone/netxops.git
synced 2026-10-13 02:13:18 +08:00
Auto-install the Netx Ops agent preset on plugin activate.
Copy presets into ~/.dsh/.agent-presets (not a Windows junction — DSH discovery skips those) so dsh plugin add alone surfaces Custom → Netx Ops with skills. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
4854101afd
commit
5179eb74b1
9 changed files with 174 additions and 82 deletions
|
|
@ -1,4 +1,6 @@
|
|||
# Link presets/netxops into the DSH user agent-presets root (Windows junction).
|
||||
# Link / install presets/netxops into the DSH user agent-presets root.
|
||||
# Prefer a real directory copy: DSH discovery skips Windows junctions
|
||||
# (Dirent.isDirectory() is false for reparse points).
|
||||
$ErrorActionPreference = "Stop"
|
||||
$RepoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$Source = Join-Path $RepoRoot "presets\netxops"
|
||||
|
|
@ -6,18 +8,14 @@ $DshHome = if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $env:USERPROFIL
|
|||
$TargetParent = Join-Path $DshHome ".agent-presets"
|
||||
$Target = Join-Path $TargetParent "netxops"
|
||||
|
||||
if (-not (Test-Path $Source)) {
|
||||
if (-not (Test-Path (Join-Path $Source "agent.cordis.yml"))) {
|
||||
throw "Missing preset dir: $Source"
|
||||
}
|
||||
New-Item -ItemType Directory -Force -Path $TargetParent | Out-Null
|
||||
if (Test-Path $Target) {
|
||||
$item = Get-Item $Target -Force
|
||||
if ($item.Attributes -band [IO.FileAttributes]::ReparsePoint) {
|
||||
cmd /c "rmdir `"$Target`""
|
||||
} else {
|
||||
throw "Target exists and is not a junction: $Target — remove or rename it first."
|
||||
}
|
||||
Remove-Item -Recurse -Force $Target
|
||||
}
|
||||
cmd /c "mklink /J `"$Target`" `"$Source`""
|
||||
Write-Host "Linked $Target -> $Source"
|
||||
Write-Host "Restart dsh / open a new session and select preset 'netxops' (Netx Ops)."
|
||||
Copy-Item -Recurse -Force $Source $Target
|
||||
Set-Content -Path (Join-Path $Target ".dsh-netxops-managed") -Value ((Get-Date).ToString("o"))
|
||||
Write-Host "Installed $Target (copy from $Source)"
|
||||
Write-Host "Open Settings → Agent presets → Custom → Netx Ops (or new session)."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue