Files
warframe-bilder/wireframe-system/scripts/wireframe/update-research-registry.ps1
T
Vadim Flowed 1c7f9161f1 Added to Git
2026-05-10 19:01:57 +03:00

54 lines
1.3 KiB
PowerShell

param(
[Parameter(Mandatory = $false)]
[string]$RegistryPath = ".agents/skills/_shared/references/ux-research-registry.json",
[Parameter(Mandatory = $true)]
[string]$Id,
[Parameter(Mandatory = $true)]
[string]$Title,
[Parameter(Mandatory = $true)]
[string]$Url,
[Parameter(Mandatory = $false)]
[string]$Publisher = "",
[Parameter(Mandatory = $false)]
[string[]]$Domains = @(),
[Parameter(Mandatory = $false)]
[string[]]$Claims = @()
)
$ErrorActionPreference = "Stop"
if (-not (Test-Path -LiteralPath $RegistryPath)) {
throw "Registry not found: $RegistryPath"
}
$registry = Get-Content -LiteralPath $RegistryPath -Raw -Encoding UTF8 | ConvertFrom-Json
$sources = @($registry.sources)
$existing = $sources | Where-Object { $_.id -eq $Id } | Select-Object -First 1
$entry = [ordered]@{
id = $Id
title = $Title
url = $Url
publisher = $Publisher
domains = @($Domains)
claims = @($Claims)
last_checked = (Get-Date).ToString("yyyy-MM-dd")
}
if ($null -ne $existing) {
$sources = $sources | Where-Object { $_.id -ne $Id }
}
$sources += [pscustomobject]$entry
$registry.last_updated = (Get-Date).ToString("yyyy-MM-dd")
$registry.sources = @($sources | Sort-Object id)
$registry | ConvertTo-Json -Depth 10 | Set-Content -LiteralPath $RegistryPath -Encoding UTF8
Write-Output "Updated registry entry: $Id"