fix(skills): add sibling XML auto-resolve for directory paths

When a directory is passed (e.g. src/Name or Catalogs/Name), the
auto-resolve now also checks for a sibling file ../Name.xml, which
is the standard layout for both 1C config dumps and EPF/ERF sources.

Affected: meta-info, meta-edit, meta-validate, epf-validate,
subsystem-edit, subsystem-info, subsystem-validate (7 scripts).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-02-21 19:04:55 +03:00
co-authored by Claude Opus 4.6
parent 4c5e10a958
commit 78e252af1e
7 changed files with 22 additions and 3 deletions
@@ -22,8 +22,11 @@ if (-not [System.IO.Path]::IsPathRooted($ObjectPath)) {
if (Test-Path $ObjectPath -PathType Container) { if (Test-Path $ObjectPath -PathType Container) {
$dirName = Split-Path $ObjectPath -Leaf $dirName = Split-Path $ObjectPath -Leaf
$candidate = Join-Path $ObjectPath "$dirName.xml" $candidate = Join-Path $ObjectPath "$dirName.xml"
$sibling = Join-Path (Split-Path $ObjectPath) "$dirName.xml"
if (Test-Path $candidate) { if (Test-Path $candidate) {
$ObjectPath = $candidate $ObjectPath = $candidate
} elseif (Test-Path $sibling) {
$ObjectPath = $sibling
} else { } else {
$xmlFiles = @(Get-ChildItem $ObjectPath -Filter "*.xml" -File | Select-Object -First 1) $xmlFiles = @(Get-ChildItem $ObjectPath -Filter "*.xml" -File | Select-Object -First 1)
if ($xmlFiles.Count -gt 0) { if ($xmlFiles.Count -gt 0) {
@@ -58,10 +58,13 @@ if ($DefinitionFile) {
if (Test-Path $ObjectPath -PathType Container) { if (Test-Path $ObjectPath -PathType Container) {
$dirName = Split-Path $ObjectPath -Leaf $dirName = Split-Path $ObjectPath -Leaf
$candidate = Join-Path $ObjectPath "$dirName.xml" $candidate = Join-Path $ObjectPath "$dirName.xml"
$sibling = Join-Path (Split-Path $ObjectPath) "$dirName.xml"
if (Test-Path $candidate) { if (Test-Path $candidate) {
$ObjectPath = $candidate $ObjectPath = $candidate
} elseif (Test-Path $sibling) {
$ObjectPath = $sibling
} else { } else {
Write-Error "Directory given but no $dirName.xml found inside" Write-Error "Directory given but no $dirName.xml found inside or as sibling"
exit 1 exit 1
} }
} }
@@ -22,12 +22,15 @@ if (-not [System.IO.Path]::IsPathRooted($ObjectPath)) {
$ObjectPath = Join-Path (Get-Location).Path $ObjectPath $ObjectPath = Join-Path (Get-Location).Path $ObjectPath
} }
# Directory -> find XML inside # Directory -> find XML inside or as sibling
if (Test-Path $ObjectPath -PathType Container) { if (Test-Path $ObjectPath -PathType Container) {
$dirName = Split-Path $ObjectPath -Leaf $dirName = Split-Path $ObjectPath -Leaf
$candidate = Join-Path $ObjectPath "$dirName.xml" $candidate = Join-Path $ObjectPath "$dirName.xml"
$sibling = Join-Path (Split-Path $ObjectPath) "$dirName.xml"
if (Test-Path $candidate) { if (Test-Path $candidate) {
$ObjectPath = $candidate $ObjectPath = $candidate
} elseif (Test-Path $sibling) {
$ObjectPath = $sibling
} else { } else {
$xmlFiles = @(Get-ChildItem $ObjectPath -Filter "*.xml" -File | Select-Object -First 1) $xmlFiles = @(Get-ChildItem $ObjectPath -Filter "*.xml" -File | Select-Object -First 1)
if ($xmlFiles.Count -gt 0) { if ($xmlFiles.Count -gt 0) {
@@ -21,8 +21,11 @@ if (-not [System.IO.Path]::IsPathRooted($ObjectPath)) {
if (Test-Path $ObjectPath -PathType Container) { if (Test-Path $ObjectPath -PathType Container) {
$dirName = Split-Path $ObjectPath -Leaf $dirName = Split-Path $ObjectPath -Leaf
$candidate = Join-Path $ObjectPath "$dirName.xml" $candidate = Join-Path $ObjectPath "$dirName.xml"
$sibling = Join-Path (Split-Path $ObjectPath) "$dirName.xml"
if (Test-Path $candidate) { if (Test-Path $candidate) {
$ObjectPath = $candidate $ObjectPath = $candidate
} elseif (Test-Path $sibling) {
$ObjectPath = $sibling
} else { } else {
$xmlFiles = @(Get-ChildItem $ObjectPath -Filter "*.xml" -File | Select-Object -First 1) $xmlFiles = @(Get-ChildItem $ObjectPath -Filter "*.xml" -File | Select-Object -First 1)
if ($xmlFiles.Count -gt 0) { if ($xmlFiles.Count -gt 0) {
@@ -23,8 +23,10 @@ if (-not [System.IO.Path]::IsPathRooted($SubsystemPath)) {
if (Test-Path $SubsystemPath -PathType Container) { if (Test-Path $SubsystemPath -PathType Container) {
$dirName = Split-Path $SubsystemPath -Leaf $dirName = Split-Path $SubsystemPath -Leaf
$candidate = Join-Path $SubsystemPath "$dirName.xml" $candidate = Join-Path $SubsystemPath "$dirName.xml"
$sibling = Join-Path (Split-Path $SubsystemPath) "$dirName.xml"
if (Test-Path $candidate) { $SubsystemPath = $candidate } if (Test-Path $candidate) { $SubsystemPath = $candidate }
else { Write-Error "No $dirName.xml found in directory"; exit 1 } elseif (Test-Path $sibling) { $SubsystemPath = $sibling }
else { Write-Error "No $dirName.xml found in directory or as sibling"; exit 1 }
} }
if (-not (Test-Path $SubsystemPath)) { Write-Error "File not found: $SubsystemPath"; exit 1 } if (-not (Test-Path $SubsystemPath)) { Write-Error "File not found: $SubsystemPath"; exit 1 }
$resolvedPath = (Resolve-Path $SubsystemPath).Path $resolvedPath = (Resolve-Path $SubsystemPath).Path
@@ -402,8 +402,11 @@ if ($Mode -eq "tree") {
if (Test-Path $SubsystemPath -PathType Container) { if (Test-Path $SubsystemPath -PathType Container) {
$dirName = Split-Path $SubsystemPath -Leaf $dirName = Split-Path $SubsystemPath -Leaf
$candidate = Join-Path $SubsystemPath "$dirName.xml" $candidate = Join-Path $SubsystemPath "$dirName.xml"
$sibling = Join-Path (Split-Path $SubsystemPath) "$dirName.xml"
if (Test-Path $candidate) { if (Test-Path $candidate) {
$SubsystemPath = $candidate $SubsystemPath = $candidate
} elseif (Test-Path $sibling) {
$SubsystemPath = $sibling
} else { } else {
Write-Host "[ERROR] No $dirName.xml found in directory. Use -Mode tree for directory listing." Write-Host "[ERROR] No $dirName.xml found in directory. Use -Mode tree for directory listing."
exit 1 exit 1
@@ -16,7 +16,9 @@ if (-not [System.IO.Path]::IsPathRooted($SubsystemPath)) {
if (Test-Path $SubsystemPath -PathType Container) { if (Test-Path $SubsystemPath -PathType Container) {
$dirName = Split-Path $SubsystemPath -Leaf $dirName = Split-Path $SubsystemPath -Leaf
$candidate = Join-Path $SubsystemPath "$dirName.xml" $candidate = Join-Path $SubsystemPath "$dirName.xml"
$sibling = Join-Path (Split-Path $SubsystemPath) "$dirName.xml"
if (Test-Path $candidate) { $SubsystemPath = $candidate } if (Test-Path $candidate) { $SubsystemPath = $candidate }
elseif (Test-Path $sibling) { $SubsystemPath = $sibling }
else { else {
Write-Host "[ERROR] No $dirName.xml found in directory: $SubsystemPath" Write-Host "[ERROR] No $dirName.xml found in directory: $SubsystemPath"
exit 1 exit 1