Add variant list mode, fix stale SKILL.md references

- variant without -Name now shows variant list (progressive disclosure)
- Fix Mode parameter: totals -> calculated, resources
- Fix fields -Name example: dataset name -> field name
- Improved error message when variant not found

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-02-10 18:52:20 +03:00
parent dddb9e3dac
commit 0ca6d3f089
2 changed files with 78 additions and 24 deletions
+11 -3
View File
@@ -24,7 +24,7 @@ allowed-tools:
| Параметр | Обязательный | По умолчанию | Описание |
|--------------|:------------:|--------------|---------------------------------------------------|
| TemplatePath | да | — | Путь к Template.xml или каталогу макета |
| Mode | нет | `overview` | Режим: `overview`, `query`, `fields`, `links`, `totals`, `params`, `variant`, `trace` |
| Mode | нет | `overview` | Режим: `overview`, `query`, `fields`, `links`, `calculated`, `resources`, `params`, `variant`, `trace` |
| Name | нет | — | Имя набора (query), поля (fields/calculated/resources/trace) или варианта (variant) |
| Batch | нет | `0` | Номер пакета запроса (0 = все). Только для query |
| Limit | нет | `150` | Макс. строк вывода (защита от переполнения) |
@@ -42,7 +42,7 @@ powershell.exe -NoProfile -File .claude\skills\skd-info\scripts\skd-info.ps1 -Te
... -Mode query -Name НоменклатураСЦенами
... -Mode query -Name ДанныеТ13 -Batch 3
... -Mode fields
... -Mode fields -Name НаборДанных1
... -Mode fields -Name КадастроваяСтоимость
... -Mode links
... -Mode calculated
... -Mode calculated -Name КоэффициентКи
@@ -202,8 +202,16 @@ Restrict: condition
Организация CatalogRef.Организации null yes -
```
### variant — структура варианта
### variant — варианты отчёта
Без `-Name` — список вариантов:
```
=== Variants (2) ===
[1] НоменклатураИЦены "Номенклатура и цены" Table(detail) 3 filters
[2] НоменклатураБезЦен "Номенклатура без цен" Group(detail) 2 filters
```
С `-Name <N|имя>` — структура конкретного варианта:
```
=== Variant [1]: НоменклатураИЦены "Номенклатура и цены" ===
+67 -21
View File
@@ -1091,32 +1091,77 @@ elseif ($Mode -eq "variant") {
$variants = $root.SelectNodes("s:settingsVariant", $ns)
$targetVariant = $null
if ($Name) {
# Try by name
$varIdx = 0
foreach ($v in $variants) {
$varIdx++
$vName = $v.SelectSingleNode("dcsset:name", $ns).InnerText
if ($vName -eq $Name -or "$varIdx" -eq $Name) {
$targetVariant = $v
$matchIdx = $varIdx
break
if (-not $Name) {
# --- Variant list (map) ---
if ($variants.Count -eq 0) {
$lines.Add("=== Variants: (none) ===")
} else {
$lines.Add("=== Variants ($($variants.Count)) ===")
$varIdx = 0
foreach ($v in $variants) {
$varIdx++
$vName = $v.SelectSingleNode("dcsset:name", $ns).InnerText
$vPres = $v.SelectSingleNode("dcsset:presentation", $ns)
$vPresStr = ""
if ($vPres) {
$pt = Get-MLText $vPres
if ($pt) { $vPresStr = " `"$pt`"" }
}
$settings = $v.SelectSingleNode("dcsset:settings", $ns)
$structItems = @()
if ($settings) {
foreach ($si in $settings.SelectNodes("dcsset:item", $ns)) {
$siType = Get-StructureItemType $si
$groupFields = Get-GroupFields $si
$groupStr = if ($groupFields.Count -gt 0) { "(" + ($groupFields -join ",") + ")" } else { "(detail)" }
$structItems += "$siType$groupStr"
}
}
if ($structItems.Count -gt 3) {
$grouped = $structItems | Group-Object | Sort-Object Count -Descending
$compactParts = @()
foreach ($g in $grouped) {
if ($g.Count -gt 1) { $compactParts += "$($g.Count)x $($g.Name)" }
else { $compactParts += $g.Name }
}
$structItems = $compactParts
}
$structStr = if ($structItems.Count -gt 0) { " " + ($structItems -join ", ") } else { "" }
$filterCount = 0
if ($settings) {
$filterCount = $settings.SelectNodes("dcsset:filter/dcsset:item", $ns).Count
}
$filterStr = if ($filterCount -gt 0) { " $filterCount filters" } else { "" }
# Selection fields
$selFields = @()
if ($settings) { $selFields = Get-SelectionFields $settings }
$selStr = if ($selFields.Count -gt 0) { " sel: " + ($selFields -join ", ") } else { "" }
$lines.Add(" [$varIdx] $vName$vPresStr$structStr$filterStr")
if ($selStr) { $lines.Add(" $selStr") }
}
}
if (-not $targetVariant) {
Write-Error "Variant '$Name' not found"
exit 1
}
} else {
# Take first
$targetVariant = $variants[0]
$matchIdx = 1
if (-not $targetVariant) {
Write-Error "No variants found"
exit 1
# --- Variant detail ---
$targetVariant = $null
$varIdx = 0
foreach ($v in $variants) {
$varIdx++
$vName = $v.SelectSingleNode("dcsset:name", $ns).InnerText
if ($vName -eq $Name -or "$varIdx" -eq $Name) {
$targetVariant = $v
$matchIdx = $varIdx
break
}
}
if (-not $targetVariant) {
Write-Error "Variant '$Name' not found. Use -Mode variant without -Name to see list."
exit 1
}
$vName = $targetVariant.SelectSingleNode("dcsset:name", $ns).InnerText
$vPres = $targetVariant.SelectSingleNode("dcsset:presentation", $ns)
@@ -1215,6 +1260,7 @@ elseif ($Mode -eq "variant") {
}
}
}
} # end else (variant detail)
}
# ============================================================