690427:0812 Update Infras #01
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
# audit-skills.sh - Verify skill completeness and health
|
||||
# Part of LCBP3-DMS Phase 2 improvements
|
||||
|
||||
set -euo pipefail
|
||||
set -uo pipefail
|
||||
# Note: no -e — we let per-skill checks accumulate issues without terminating
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
@@ -13,7 +14,7 @@ BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Base directory
|
||||
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
|
||||
AGENTS_DIR="$BASE_DIR/.agents"
|
||||
SKILLS_DIR="$AGENTS_DIR/skills"
|
||||
|
||||
@@ -25,9 +26,9 @@ echo
|
||||
check_skill_health() {
|
||||
local skill_dir="$1"
|
||||
local skill_name="$(basename "$skill_dir")"
|
||||
|
||||
|
||||
local issues=0
|
||||
|
||||
|
||||
# Check for SKILL.md
|
||||
if [[ -f "$skill_dir/SKILL.md" ]]; then
|
||||
echo -e "${GREEN} OK${NC}: $skill_name/SKILL.md"
|
||||
@@ -35,7 +36,7 @@ check_skill_health() {
|
||||
echo -e "${RED} MISSING${NC}: $skill_name/SKILL.md"
|
||||
((issues++))
|
||||
fi
|
||||
|
||||
|
||||
# Check for templates directory (optional)
|
||||
if [[ -d "$skill_dir/templates" ]]; then
|
||||
template_count=$(find "$skill_dir/templates" -name "*.md" -type f | wc -l)
|
||||
@@ -45,7 +46,7 @@ check_skill_health() {
|
||||
echo -e "${YELLOW} EMPTY${NC}: $skill_name/templates (no files)"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Check SKILL.md content if exists
|
||||
local skill_file="$skill_dir/SKILL.md"
|
||||
if [[ -f "$skill_file" ]]; then
|
||||
@@ -56,27 +57,21 @@ check_skill_health() {
|
||||
echo -e " ${GREEN} FIELD${NC}: $field"
|
||||
else
|
||||
echo -e " ${RED} MISSING FIELD${NC}: $field"
|
||||
((issues++))
|
||||
((issues++)) || true
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for Role section
|
||||
if grep -q "^## Role$" "$skill_file"; then
|
||||
echo -e " ${GREEN} SECTION${NC}: Role"
|
||||
else
|
||||
echo -e " ${YELLOW} MISSING SECTION${NC}: Role"
|
||||
((issues++))
|
||||
fi
|
||||
|
||||
# Check for Task section
|
||||
if grep -q "^## Task$" "$skill_file"; then
|
||||
echo -e " ${GREEN} SECTION${NC}: Task"
|
||||
else
|
||||
echo -e " ${YELLOW} MISSING SECTION${NC}: Task"
|
||||
((issues++))
|
||||
|
||||
# Check for LCBP3 context reference (speckit-* skills only)
|
||||
if [[ "$skill_name" == speckit-* ]]; then
|
||||
if grep -q '_LCBP3-CONTEXT\.md' "$skill_file"; then
|
||||
echo -e " ${GREEN} CONTEXT${NC}: LCBP3 appendix referenced"
|
||||
else
|
||||
echo -e " ${YELLOW} MISSING${NC}: LCBP3 context reference"
|
||||
((issues++)) || true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
return $issues
|
||||
}
|
||||
|
||||
@@ -84,7 +79,15 @@ check_skill_health() {
|
||||
get_skill_version() {
|
||||
local skill_file="$1"
|
||||
if [[ -f "$skill_file" ]]; then
|
||||
grep "^version:" "$skill_file" | head -1 | sed 's/version: *//' || echo "unknown"
|
||||
# Match 'version: X.Y.Z' (or quoted) at a LINE START only; ignore nested ` version:` fields.
|
||||
# Output: bare X.Y.Z with no quotes/whitespace.
|
||||
local raw
|
||||
raw=$(grep -E "^version:[[:space:]]*['\"]?[0-9]+\.[0-9]+\.[0-9]+" "$skill_file" | head -1 || true)
|
||||
if [[ -n "$raw" ]]; then
|
||||
printf '%s' "$raw" | sed -E "s/^version:[[:space:]]*['\"]?([0-9]+\.[0-9]+\.[0-9]+).*/\1/"
|
||||
else
|
||||
echo "unknown"
|
||||
fi
|
||||
else
|
||||
echo "no_file"
|
||||
fi
|
||||
@@ -114,15 +117,19 @@ SKILL_SUMMARY=()
|
||||
|
||||
for skill_dir in "${SKILL_DIRS[@]}"; do
|
||||
skill_name="$(basename "$skill_dir")"
|
||||
# Skip non-skill entries (e.g. _LCBP3-CONTEXT.md would not match here; safe)
|
||||
[[ "$skill_name" == _* ]] && continue
|
||||
echo "Auditing: $skill_name"
|
||||
echo "------------------------"
|
||||
|
||||
|
||||
set +e
|
||||
check_skill_health "$skill_dir"
|
||||
issues=$?
|
||||
|
||||
set -u
|
||||
|
||||
skill_version=$(get_skill_version "$skill_dir/SKILL.md")
|
||||
SKILL_SUMMARY+=("$skill_name:$issues:$skill_version")
|
||||
|
||||
|
||||
TOTAL_ISSUES=$((TOTAL_ISSUES + issues))
|
||||
echo
|
||||
done
|
||||
@@ -147,15 +154,15 @@ echo
|
||||
# Check skills.md version consistency
|
||||
SKILLS_VERSION_FILE="$SKILLS_DIR/VERSION"
|
||||
if [[ -f "$SKILLS_VERSION_FILE" ]]; then
|
||||
global_version=$(grep "^version:" "$SKILLS_VERSION_FILE" | sed 's/version: *//')
|
||||
global_version=$(grep "^version:" "$SKILLS_VERSION_FILE" | sed 's/version: *//' | tr -d '\r\n ')
|
||||
echo "Global skills version: v$global_version"
|
||||
echo
|
||||
|
||||
|
||||
# Check for version mismatches
|
||||
echo "Version Consistency Check:"
|
||||
echo "------------------------"
|
||||
VERSION_MISMATCHES=0
|
||||
|
||||
|
||||
for summary in "${SKILL_SUMMARY[@]}"; do
|
||||
IFS=':' read -r name issues version <<< "$summary"
|
||||
if [[ "$version" != "unknown" && "$version" != "no_file" && "$version" != "$global_version" ]]; then
|
||||
@@ -163,7 +170,7 @@ if [[ -f "$SKILLS_VERSION_FILE" ]]; then
|
||||
((VERSION_MISMATCHES++))
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
if [[ $VERSION_MISMATCHES -eq 0 ]]; then
|
||||
echo -e "${GREEN} All skills match global version${NC}"
|
||||
fi
|
||||
|
||||
@@ -12,11 +12,11 @@ YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Base directory
|
||||
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
|
||||
AGENTS_DIR="$BASE_DIR/.agents"
|
||||
|
||||
# Expected version (should match LCBP3 version)
|
||||
EXPECTED_VERSION="1.8.6"
|
||||
EXPECTED_VERSION="1.8.9"
|
||||
|
||||
echo "=== .agents Version Validation ==="
|
||||
echo "Base directory: $BASE_DIR"
|
||||
@@ -27,7 +27,7 @@ echo
|
||||
extract_version() {
|
||||
local file="$1"
|
||||
local pattern="$2"
|
||||
|
||||
|
||||
if [[ -f "$file" ]]; then
|
||||
grep -o "$pattern" "$file" | head -1 | sed 's/.*\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/' || echo "NOT_FOUND"
|
||||
else
|
||||
@@ -37,10 +37,8 @@ extract_version() {
|
||||
|
||||
# Files to check
|
||||
declare -A FILES_TO_CHECK=(
|
||||
["$AGENTS_DIR/README.md"]="Version: \([0-9]\+\.[0-9]\+\.[0-9]\+\)"
|
||||
["$AGENTS_DIR/skills/VERSION"]="version: \([0-9]\+\.[0-9]\+\.[0-9]\+\)"
|
||||
["$AGENTS_DIR/rules/00-project-context.md"]="Version: \([0-9]\+\.[0-9]\+\.[0-9]\+\)"
|
||||
["$AGENTS_DIR/skills/skills.md"]="V\([0-9]\+\.[0-9]\+\.[0-9]\+\)"
|
||||
["$AGENTS_DIR/skills/skills.md"]="[Vv]\([0-9]\+\.[0-9]\+\.[0-9]\+\)"
|
||||
)
|
||||
|
||||
# Track issues
|
||||
@@ -52,9 +50,9 @@ echo
|
||||
for file in "${!FILES_TO_CHECK[@]}"; do
|
||||
pattern="${FILES_TO_CHECK[$file]}"
|
||||
relative_path="${file#$BASE_DIR/}"
|
||||
|
||||
|
||||
version=$(extract_version "$file" "$pattern")
|
||||
|
||||
|
||||
if [[ "$version" == "NOT_FOUND" ]] || [[ "$version" == "FILE_NOT_FOUND" ]]; then
|
||||
echo -e "${RED} ERROR${NC}: $relative_path - Version not found"
|
||||
((ISSUES++))
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
# Part of LCBP3-DMS Phase 2 improvements
|
||||
|
||||
param(
|
||||
[string]$BaseDir = (Split-Path -Parent (Split-Path -Parent $PSScriptRoot))
|
||||
[string]$BaseDir = (Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)))
|
||||
)
|
||||
|
||||
# Colors for output
|
||||
# Map to ConsoleColor enum (Write-Host expects enum, not ANSI strings)
|
||||
$Colors = @{
|
||||
Red = "`e[0;31m"
|
||||
Green = "`e[0;32m"
|
||||
Yellow = "`e[1;33m"
|
||||
Blue = "`e[0;34m"
|
||||
NoColor = "`e[0m"
|
||||
Red = 'Red'
|
||||
Green = 'Green'
|
||||
Yellow = 'Yellow'
|
||||
Blue = 'Blue'
|
||||
NoColor = 'Gray'
|
||||
}
|
||||
|
||||
$AgentsDir = Join-Path $BaseDir ".agents"
|
||||
@@ -26,10 +26,10 @@ function Test-SkillHealth {
|
||||
param(
|
||||
[string]$SkillDir
|
||||
)
|
||||
|
||||
|
||||
$skillName = Split-Path $SkillDir -Leaf
|
||||
$issues = 0
|
||||
|
||||
|
||||
# Check for SKILL.md
|
||||
$skillFile = Join-Path $SkillDir "SKILL.md"
|
||||
if (Test-Path $skillFile) {
|
||||
@@ -38,7 +38,7 @@ function Test-SkillHealth {
|
||||
Write-Host " MISSING: $skillName/SKILL.md" -ForegroundColor $Colors.Red
|
||||
$issues++
|
||||
}
|
||||
|
||||
|
||||
# Check for templates directory (optional)
|
||||
$templatesDir = Join-Path $SkillDir "templates"
|
||||
if (Test-Path $templatesDir) {
|
||||
@@ -49,39 +49,34 @@ function Test-SkillHealth {
|
||||
Write-Host " EMPTY: $skillName/templates (no files)" -ForegroundColor $Colors.Yellow
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Check SKILL.md content if exists
|
||||
if (Test-Path $skillFile) {
|
||||
$content = Get-Content $skillFile -Raw
|
||||
|
||||
|
||||
# Check for required front matter fields
|
||||
$requiredFields = @("name", "description", "version")
|
||||
$requiredFields = @('name', 'description', 'version')
|
||||
foreach ($field in $requiredFields) {
|
||||
if ($content -match "^$field:") {
|
||||
$pattern = "(?m)^${field}:"
|
||||
if ($content -match $pattern) {
|
||||
Write-Host " FIELD: $field" -ForegroundColor $Colors.Green
|
||||
} else {
|
||||
Write-Host " MISSING FIELD: $field" -ForegroundColor $Colors.Red
|
||||
$issues++
|
||||
}
|
||||
}
|
||||
|
||||
# Check for Role section
|
||||
if ($content -match "^## Role$") {
|
||||
Write-Host " SECTION: Role" -ForegroundColor $Colors.Green
|
||||
} else {
|
||||
Write-Host " MISSING SECTION: Role" -ForegroundColor $Colors.Yellow
|
||||
$issues++
|
||||
}
|
||||
|
||||
# Check for Task section
|
||||
if ($content -match "^## Task$") {
|
||||
Write-Host " SECTION: Task" -ForegroundColor $Colors.Green
|
||||
} else {
|
||||
Write-Host " MISSING SECTION: Task" -ForegroundColor $Colors.Yellow
|
||||
$issues++
|
||||
|
||||
# Check for LCBP3 context reference (speckit-* skills)
|
||||
if ($skillName -like 'speckit-*') {
|
||||
if ($content -match '_LCBP3-CONTEXT\.md') {
|
||||
Write-Host " CONTEXT: LCBP3 appendix referenced" -ForegroundColor $Colors.Green
|
||||
} else {
|
||||
Write-Host " MISSING: LCBP3 context reference" -ForegroundColor $Colors.Yellow
|
||||
$issues++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $issues
|
||||
}
|
||||
|
||||
@@ -90,11 +85,11 @@ function Get-SkillVersion {
|
||||
param(
|
||||
[string]$SkillFile
|
||||
)
|
||||
|
||||
|
||||
if (Test-Path $SkillFile) {
|
||||
try {
|
||||
$content = Get-Content $SkillFile -Raw
|
||||
if ($content -match "^version:\s*(.+)") {
|
||||
if ($content -match "(?m)^version:\s*['""]?([0-9]+\.[0-9]+\.[0-9]+)['""]?") {
|
||||
return $matches[1].Trim()
|
||||
}
|
||||
} catch {
|
||||
@@ -127,16 +122,16 @@ foreach ($skillDir in $skillDirs) {
|
||||
$skillName = $skillDir.Name
|
||||
Write-Host "Auditing: $skillName"
|
||||
Write-Host "------------------------"
|
||||
|
||||
|
||||
$issues = Test-SkillHealth -SkillDir $skillDir.FullName
|
||||
|
||||
|
||||
$skillVersion = Get-SkillVersion -SkillFile (Join-Path $skillDir.FullName "SKILL.md")
|
||||
$skillSummary += @{
|
||||
Name = $skillName
|
||||
Issues = $issues
|
||||
Version = $skillVersion
|
||||
}
|
||||
|
||||
|
||||
$totalIssues += $issues
|
||||
Write-Host ""
|
||||
}
|
||||
@@ -165,19 +160,19 @@ if (Test-Path $skillsVersionFile) {
|
||||
$globalVersion = $matches[1].Trim()
|
||||
Write-Host "Global skills version: v$globalVersion"
|
||||
Write-Host ""
|
||||
|
||||
|
||||
# Check for version mismatches
|
||||
Write-Host "Version Consistency Check:"
|
||||
Write-Host "------------------------"
|
||||
$versionMismatches = 0
|
||||
|
||||
|
||||
foreach ($summary in $skillSummary) {
|
||||
if ($summary.Version -ne "unknown" -and $summary.Version -ne "no_file" -and $summary.Version -ne $globalVersion) {
|
||||
Write-Host " MISMATCH: $($summary.Name) is v$($summary.Version), global is v$globalVersion" -ForegroundColor $Colors.Yellow
|
||||
$versionMismatches++
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($versionMismatches -eq 0) {
|
||||
Write-Host " All skills match global version" -ForegroundColor $Colors.Green
|
||||
}
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
# Part of LCBP3-DMS Phase 2 improvements
|
||||
|
||||
param(
|
||||
[string]$BaseDir = (Split-Path -Parent (Split-Path -Parent $PSScriptRoot)),
|
||||
[string]$ExpectedVersion = "1.8.6"
|
||||
[string]$BaseDir = (Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $PSScriptRoot))),
|
||||
[string]$ExpectedVersion = "1.8.9"
|
||||
)
|
||||
|
||||
# Colors for output
|
||||
# Map to ConsoleColor enum (Write-Host expects enum, not ANSI)
|
||||
$Colors = @{
|
||||
Red = "`e[0;31m"
|
||||
Green = "`e[0;32m"
|
||||
Yellow = "`e[1;33m"
|
||||
NoColor = "`e[0m"
|
||||
Red = 'Red'
|
||||
Green = 'Green'
|
||||
Yellow = 'Yellow'
|
||||
NoColor = 'Gray'
|
||||
}
|
||||
|
||||
$AgentsDir = Join-Path $BaseDir ".agents"
|
||||
@@ -27,7 +27,7 @@ function Get-VersionFromFile {
|
||||
[string]$FilePath,
|
||||
[string]$Pattern
|
||||
)
|
||||
|
||||
|
||||
if (Test-Path $FilePath) {
|
||||
try {
|
||||
$content = Get-Content $FilePath -Raw
|
||||
@@ -46,9 +46,7 @@ function Get-VersionFromFile {
|
||||
|
||||
# Files to check
|
||||
$FilesToCheck = @{
|
||||
(Join-Path $AgentsDir "README.md") = "Version: ([0-9]+\.[0-9]+\.[0-9]+)"
|
||||
(Join-Path $AgentsDir "skills\VERSION") = "version: ([0-9]+\.[0-9]+\.[0-9]+)"
|
||||
(Join-Path $AgentsDir "rules\00-project-context.md") = "Version: ([0-9]+\.[0-9]+\.[0-9]+)"
|
||||
(Join-Path $AgentsDir "skills\skills.md") = "V([0-9]+\.[0-9]+\.[0-9]+)"
|
||||
}
|
||||
|
||||
@@ -61,9 +59,9 @@ Write-Host ""
|
||||
foreach ($file in $FilesToCheck.Keys) {
|
||||
$pattern = $FilesToCheck[$file]
|
||||
$relativePath = $file.Replace($BaseDir + "\", "")
|
||||
|
||||
|
||||
$version = Get-VersionFromFile -FilePath $file -Pattern $pattern
|
||||
|
||||
|
||||
if ($version -eq "NOT_FOUND" -or $version -eq "FILE_NOT_FOUND") {
|
||||
Write-Host " ERROR: $relativePath - Version not found" -ForegroundColor $Colors.Red
|
||||
$Issues++
|
||||
|
||||
Reference in New Issue
Block a user