Simplify /skd-info overview to pure navigation map

Overview now shows only counts for calculated/totals/templates.
Links compressed to dataset pairs. Params split into visible/hidden
with only visible names listed. Add "Next:" hints with available
modes and dataset names to guide further exploration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Nick Shirokov
2026-02-10 17:39:16 +03:00
co-authored by Claude Opus 4.6
parent 9922f118d1
commit e86620dbd7
+80 -80
View File
@@ -347,116 +347,81 @@ if ($Mode -eq "overview") {
} }
} }
# Links # Links — only dataset pairs (not field-level)
$links = $root.SelectNodes("s:dataSetLink", $ns) $links = $root.SelectNodes("s:dataSetLink", $ns)
if ($links.Count -gt 0) { if ($links.Count -gt 0) {
$linkStrs = @() $linkPairs = [ordered]@{}
foreach ($lnk in $links) { foreach ($lnk in $links) {
$srcDs = $lnk.SelectSingleNode("s:sourceDataSet", $ns).InnerText $srcDs = $lnk.SelectSingleNode("s:sourceDataSet", $ns).InnerText
$dstDs = $lnk.SelectSingleNode("s:destinationDataSet", $ns).InnerText $dstDs = $lnk.SelectSingleNode("s:destinationDataSet", $ns).InnerText
$srcExpr = $lnk.SelectSingleNode("s:sourceExpression", $ns).InnerText $key = "$srcDs -> $dstDs"
$dstExpr = $lnk.SelectSingleNode("s:destinationExpression", $ns).InnerText if (-not $linkPairs.Contains($key)) { $linkPairs[$key] = 0 }
$paramNode = $lnk.SelectSingleNode("s:parameter", $ns) $linkPairs[$key] = $linkPairs[$key] + 1
$paramStr = if ($paramNode) { " param=$($paramNode.InnerText)" } else { "" }
$linkStrs += "$srcDs.$srcExpr -> $dstDs.$dstExpr$paramStr"
} }
if ($linkStrs.Count -le 2) { $linkStrs = @()
$lines.Add("Links: " + ($linkStrs -join "; ")) foreach ($key in $linkPairs.Keys) {
} else { $cnt = $linkPairs[$key]
$lines.Add("Links ($($linkStrs.Count)):") if ($cnt -gt 1) { $linkStrs += "$key (${cnt} fields)" }
foreach ($ls in $linkStrs) { $lines.Add(" $ls") } else { $linkStrs += $key }
} }
} else { $lines.Add("Links: " + ($linkStrs -join ", "))
$lines.Add("Links: (none)")
} }
# Calculated fields # Calculated fields — count only
$calcFields = $root.SelectNodes("s:calculatedField", $ns) $calcFields = $root.SelectNodes("s:calculatedField", $ns)
if ($calcFields.Count -gt 0) { if ($calcFields.Count -gt 0) {
$calcNames = @() $lines.Add("Calculated: $($calcFields.Count)")
foreach ($cf in $calcFields) {
$calcNames += $cf.SelectSingleNode("s:dataPath", $ns).InnerText
}
if ($calcNames.Count -le 10) {
$lines.Add("Calculated: " + ($calcNames -join ", "))
} else {
$lines.Add("Calculated ($($calcNames.Count)): " + (($calcNames[0..9] -join ", ")) + ", ...")
}
} }
# Totals # Totals — count + group flag
$totalFields = $root.SelectNodes("s:totalField", $ns) $totalFields = $root.SelectNodes("s:totalField", $ns)
if ($totalFields.Count -gt 0) { if ($totalFields.Count -gt 0) {
if ($totalFields.Count -le 5) { $hasGrouped = $false
$totalStrs = @() $uniquePaths = @{}
foreach ($tf in $totalFields) { foreach ($tf in $totalFields) {
$tfPath = $tf.SelectSingleNode("s:dataPath", $ns).InnerText $tfPath = $tf.SelectSingleNode("s:dataPath", $ns).InnerText
$tfExpr = $tf.SelectSingleNode("s:expression", $ns).InnerText $uniquePaths[$tfPath] = $true
$tfGroup = $tf.SelectSingleNode("s:group", $ns) if ($tf.SelectSingleNode("s:group", $ns)) { $hasGrouped = $true }
$groupStr = "" }
if ($tfGroup) { $groupStr = " [group:$($tfGroup.InnerText)]" } $groupNote = if ($hasGrouped) { ", with group formulas" } else { "" }
$totalStrs += "$tfPath=$tfExpr$groupStr" if ($uniquePaths.Count -eq $totalFields.Count) {
} $lines.Add("Totals: $($totalFields.Count)$groupNote")
$lines.Add("Totals: " + ($totalStrs -join ", "))
} else { } else {
# Compact: group by dataPath, show unique paths with count $lines.Add("Totals: $($totalFields.Count) ($($uniquePaths.Count) fields$groupNote)")
$pathCounts = [ordered]@{}
$hasGrouped = $false
foreach ($tf in $totalFields) {
$tfPath = $tf.SelectSingleNode("s:dataPath", $ns).InnerText
$tfGroup = $tf.SelectSingleNode("s:group", $ns)
if ($tfGroup) { $hasGrouped = $true }
if (-not $pathCounts.Contains($tfPath)) { $pathCounts[$tfPath] = 0 }
$pathCounts[$tfPath] = $pathCounts[$tfPath] + 1
}
$uniquePaths = @($pathCounts.Keys)
$groupNote = if ($hasGrouped) { ", some with group-specific formulas" } else { "" }
if ($uniquePaths.Count -le 10) {
$lines.Add("Totals ($($totalFields.Count) for $($uniquePaths.Count) fields$groupNote): " + ($uniquePaths -join ", "))
} else {
$lines.Add("Totals ($($totalFields.Count) for $($uniquePaths.Count) fields$groupNote):")
$lines.Add(" " + (($uniquePaths[0..14] -join ", ")) + ", ...")
}
} }
} }
# Templates # Templates — count only
$templates = $root.SelectNodes("s:template", $ns) $templates = $root.SelectNodes("s:template", $ns)
$groupTemplates = $root.SelectNodes("s:groupTemplate", $ns) $groupTemplates = $root.SelectNodes("s:groupTemplate", $ns)
if ($templates.Count -gt 0 -or $groupTemplates.Count -gt 0) { if ($templates.Count -gt 0 -or $groupTemplates.Count -gt 0) {
$tplNames = @() $parts = @()
foreach ($tpl in $templates) { if ($templates.Count -gt 0) { $parts += "$($templates.Count) templates" }
$tplNames += $tpl.SelectSingleNode("s:name", $ns).InnerText if ($groupTemplates.Count -gt 0) { $parts += "$($groupTemplates.Count) group bindings" }
} $lines.Add("Templates: " + ($parts -join ", "))
$gtStrs = @()
foreach ($gt in $groupTemplates) {
$gtField = $gt.SelectSingleNode("s:groupField", $ns).InnerText
$gtType = $gt.SelectSingleNode("s:templateType", $ns).InnerText
$gtTpl = $gt.SelectSingleNode("s:template", $ns).InnerText
$gtStrs += "$gtTpl($gtField/$gtType)"
}
$totalTpl = $tplNames.Count + $gtStrs.Count
if ($totalTpl -le 10) {
$all = $tplNames + $gtStrs
$lines.Add("Templates: " + ($all -join ", "))
} else {
$lines.Add("Templates: $($tplNames.Count) templates, $($groupTemplates.Count) group bindings")
}
} }
# Parameters # Parameters — split visible/hidden
$params = $root.SelectNodes("s:parameter", $ns) $params = $root.SelectNodes("s:parameter", $ns)
if ($params.Count -gt 0) { if ($params.Count -gt 0) {
$paramStrs = @() $visibleNames = @()
$hiddenCount = 0
foreach ($p in $params) { foreach ($p in $params) {
$pName = $p.SelectSingleNode("s:name", $ns).InnerText $pName = $p.SelectSingleNode("s:name", $ns).InnerText
$paramStrs += $pName $useRestrict = $p.SelectSingleNode("s:useRestriction", $ns)
$isHidden = ($useRestrict -and $useRestrict.InnerText -eq "true")
if ($isHidden) { $hiddenCount++ } else { $visibleNames += $pName }
} }
if ($params.Count -le 15) { $paramLine = "Params: $($params.Count)"
$lines.Add("Params ($($params.Count)): " + ($paramStrs -join ", ")) if ($hiddenCount -gt 0 -and $visibleNames.Count -gt 0) {
} else { $paramLine += " ($($visibleNames.Count) visible, $hiddenCount hidden)"
$lines.Add("Params ($($params.Count)): " + (($paramStrs[0..9] -join ", ")) + ", ...") } elseif ($hiddenCount -eq $params.Count) {
$paramLine += " (all hidden)"
} }
if ($visibleNames.Count -gt 0 -and $visibleNames.Count -le 8) {
$paramLine += ": " + ($visibleNames -join ", ")
}
$lines.Add($paramLine)
} else { } else {
$lines.Add("Params: (none)") $lines.Add("Params: (none)")
} }
@@ -509,6 +474,41 @@ if ($Mode -eq "overview") {
$lines.Add(" [$varIdx] $vName$vPresStr$structStr$filterStr") $lines.Add(" [$varIdx] $vName$vPresStr$structStr$filterStr")
} }
} }
# Hints — suggest next commands
$lines.Add("")
$hints = @()
# Collect query dataset names for hint
$queryDsNames = @()
foreach ($ds in $root.SelectNodes("s:dataSet", $ns)) {
$dsType = Get-DataSetType $ds
if ($dsType -eq "Query") {
$queryDsNames += $ds.SelectSingleNode("s:name", $ns).InnerText
} elseif ($dsType -eq "Union") {
foreach ($subDs in $ds.SelectNodes("s:item", $ns)) {
if ((Get-DataSetType $subDs) -eq "Query") {
$sn = $subDs.SelectSingleNode("s:name", $ns)
if ($sn) { $queryDsNames += $sn.InnerText }
}
}
}
}
if ($queryDsNames.Count -eq 1) {
$hints += "-Mode query query text"
} elseif ($queryDsNames.Count -gt 1) {
$hints += "-Mode query -Name <ds> query text ($($queryDsNames -join ', '))"
}
$hints += "-Mode fields field details + calculated + totals"
if ($params.Count -gt 0) {
$hints += "-Mode params parameter details"
}
if ($variants.Count -eq 1) {
$hints += "-Mode variant variant structure"
} elseif ($variants.Count -gt 1) {
$hints += "-Mode variant -Name <N> variant structure (1..$($variants.Count))"
}
$lines.Add("Next:")
foreach ($h in $hints) { $lines.Add(" $h") }
} }
# ============================================================ # ============================================================