microsoft/hve-core

Public

mirrored from https://github.com/microsoft/hve-coreAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
feat/devcontainer-python-uv-887

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/skills/installer/hve-core-installer/scripts/collision-detection.ps1

56lines · modecode

1# Copyright (c) Microsoft Corporation.
2# SPDX-License-Identifier: MIT
3<#
4.SYNOPSIS
5 Detects file collisions before copying HVE-Core agents.
6.DESCRIPTION
7 Checks the target directory for existing agent files that would conflict
8 with the selected agent bundle or collection.
9.PARAMETER Selection
10 Agent bundle to check. Use 'hve-core' for the default set or a collection identifier.
11.PARAMETER CollectionAgents
12 Array of agent file paths relative to the agents directory for non-default collections.
13.EXAMPLE
14 ./scripts/collision-detection.ps1 -Selection hve-core
15.EXAMPLE
16 ./scripts/collision-detection.ps1 -Selection my-collection -CollectionAgents @('my-collection/custom.agent.md')
17.OUTPUTS
18 COLLISIONS_DETECTED=true/false and COLLISION_FILES list.
19#>
20[CmdletBinding()]
21param(
22 [Parameter(Mandatory)]
23 [ValidateNotNullOrEmpty()]
24 [string]$Selection,
25
26 [Parameter()]
27 [string[]]$CollectionAgents = @()
28)
29
30$ErrorActionPreference = 'Stop'
31
32$targetDir = ".github/agents"
33
34# Get files to copy based on selection (paths relative to agents/)
35$filesToCopy = switch ($selection) {
36 "hve-core" { @("hve-core/task-researcher.agent.md", "hve-core/task-planner.agent.md", "hve-core/task-implementor.agent.md", "hve-core/task-reviewer.agent.md", "hve-core/rpi-agent.agent.md") }
37 default {
38 # Collection-based: paths from collection manifest relative to agents/
39 $collectionAgents
40 }
41}
42
43# Check for collisions (target uses filename only)
44$collisions = @()
45foreach ($file in $filesToCopy) {
46 $fileName = Split-Path $file -Leaf
47 $targetPath = Join-Path $targetDir $fileName
48 if (Test-Path $targetPath) { $collisions += $targetPath }
49}
50
51if ($collisions.Count -gt 0) {
52 Write-Host "COLLISIONS_DETECTED=true"
53 Write-Host "COLLISION_FILES=$($collisions -join ',')"
54} else {
55 Write-Host "COLLISIONS_DETECTED=false"
56}
57