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.sh

47lines · modecode

1#!/usr/bin/env bash
2# Copyright (c) Microsoft Corporation.
3# SPDX-License-Identifier: MIT
4# Detects file collisions before copying HVE-Core agents.
5# Usage: collision-detection.sh <hve_core_base_path> <selection> [collection_agents...]
6# selection: 'hve-core' for RPI core bundle, or collection id
7# collection_agents: space-separated relative paths (when selection is a collection)
8set -euo pipefail
9
10hve_core_base_path="${1:?Usage: $0 <hve_core_base_path> <selection> [collection_agents...]}"
11selection="${2:?Usage: $0 <hve_core_base_path> <selection> [collection_agents...]}"
12shift 2
13
14target_dir=".github/agents"
15
16# Build file list based on selection
17case "$selection" in
18 hve-core)
19 files_to_copy=(
20 "hve-core/task-researcher.agent.md"
21 "hve-core/task-planner.agent.md"
22 "hve-core/task-implementor.agent.md"
23 "hve-core/task-reviewer.agent.md"
24 "hve-core/rpi-agent.agent.md"
25 )
26 ;;
27 *)
28 files_to_copy=("$@")
29 ;;
30esac
31
32# Check for collisions (target uses filename only)
33collisions=()
34for file in "${files_to_copy[@]}"; do
35 filename=$(basename "$file")
36 target_path="$target_dir/$filename"
37 if [ -f "$target_path" ]; then
38 collisions+=("$target_path")
39 fi
40done
41
42if [ ${#collisions[@]} -gt 0 ]; then
43 echo "COLLISIONS_DETECTED=true"
44 IFS=','; echo "COLLISION_FILES=${collisions[*]}"
45else
46 echo "COLLISIONS_DETECTED=false"
47fi