Last Update
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
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"
|
||||
Reference in New Issue
Block a user