mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-11 13:33:41 +03:00
feat(skd,subsystem): add -Value param to skd-compile, full mode to skd-info and subsystem-info
- skd-compile: replace mandatory -JsonPath with -DefinitionFile/-Value pair, allowing inline JSON without temp files - skd-info: extract 6 mode bodies into functions, add -Mode full combining overview+query+fields+resources+params+variant in one call - subsystem-info: extract overview/content/ci into functions, add -Mode full combining all three in one call - Update SKILL.md docs and guides accordingly Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: skd-compile
|
||||
description: Компиляция схемы компоновки данных 1С (СКД) из компактного JSON-определения. Используй когда нужно создать СКД с нуля
|
||||
argument-hint: <JsonPath> <OutputPath>
|
||||
argument-hint: [-DefinitionFile <json> | -Value <json-string>] -OutputPath <Template.xml>
|
||||
allowed-tools:
|
||||
- Bash
|
||||
- Read
|
||||
@@ -17,11 +17,16 @@ allowed-tools:
|
||||
|
||||
| Параметр | Описание |
|
||||
|----------|----------|
|
||||
| `JsonPath` | Путь к JSON-определению СКД |
|
||||
| `DefinitionFile` | Путь к JSON-файлу с определением СКД (взаимоисключающий с Value) |
|
||||
| `Value` | JSON-строка с определением СКД (взаимоисключающий с DefinitionFile) |
|
||||
| `OutputPath` | Путь к выходному Template.xml |
|
||||
|
||||
```powershell
|
||||
powershell.exe -NoProfile -File .claude\skills\skd-compile\scripts\skd-compile.ps1 -JsonPath "<json>" -OutputPath "<Template.xml>"
|
||||
# Из файла
|
||||
powershell.exe -NoProfile -File .claude\skills\skd-compile\scripts\skd-compile.ps1 -DefinitionFile "<json>" -OutputPath "<Template.xml>"
|
||||
|
||||
# Из строки (без промежуточного файла)
|
||||
powershell.exe -NoProfile -File .claude\skills\skd-compile\scripts\skd-compile.ps1 -Value '<json-string>' -OutputPath "<Template.xml>"
|
||||
```
|
||||
|
||||
## JSON DSL — краткий справочник
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
# skd-compile v1.0 — Compile 1C DCS from JSON
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string]$JsonPath,
|
||||
|
||||
[string]$DefinitionFile,
|
||||
[string]$Value,
|
||||
[Parameter(Mandatory)]
|
||||
[string]$OutputPath
|
||||
)
|
||||
@@ -13,12 +12,28 @@ $ErrorActionPreference = "Stop"
|
||||
|
||||
# --- 1. Load and validate JSON ---
|
||||
|
||||
if (-not (Test-Path $JsonPath)) {
|
||||
Write-Error "File not found: $JsonPath"
|
||||
if ($DefinitionFile -and $Value) {
|
||||
Write-Error "Cannot use both -DefinitionFile and -Value"
|
||||
exit 1
|
||||
}
|
||||
if (-not $DefinitionFile -and -not $Value) {
|
||||
Write-Error "Either -DefinitionFile or -Value is required"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$json = Get-Content -Raw -Encoding UTF8 $JsonPath
|
||||
if ($DefinitionFile) {
|
||||
if (-not [System.IO.Path]::IsPathRooted($DefinitionFile)) {
|
||||
$DefinitionFile = Join-Path (Get-Location).Path $DefinitionFile
|
||||
}
|
||||
if (-not (Test-Path $DefinitionFile)) {
|
||||
Write-Error "Definition file not found: $DefinitionFile"
|
||||
exit 1
|
||||
}
|
||||
$json = Get-Content -Raw -Encoding UTF8 $DefinitionFile
|
||||
} else {
|
||||
$json = $Value
|
||||
}
|
||||
|
||||
$def = $json | ConvertFrom-Json
|
||||
|
||||
if (-not $def.dataSets -or $def.dataSets.Count -eq 0) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: skd-info
|
||||
description: Анализ структуры схемы компоновки данных 1С (СКД) — наборы, поля, параметры, варианты. Используй для понимания отчёта — источник данных (запрос), доступные поля, параметры
|
||||
argument-hint: <TemplatePath> [-Mode overview|query|fields|links|calculated|resources|params|variant|templates|trace] [-Name <dataset|variant|field|group>]
|
||||
argument-hint: <TemplatePath> [-Mode overview|query|fields|links|calculated|resources|params|variant|templates|trace|full] [-Name <dataset|variant|field|group>]
|
||||
allowed-tools:
|
||||
- Bash
|
||||
- Read
|
||||
@@ -54,8 +54,9 @@ powershell.exe -NoProfile -File .claude\skills\skd-info\scripts\skd-info.ps1 -Te
|
||||
| `variant` | Список вариантов | Структура группировок + фильтры + вывод |
|
||||
| `templates` | Карта привязок шаблонов (field/group) | Содержимое шаблона: строки, ячейки, выражения |
|
||||
| `trace` | — | Полная цепочка: набор → вычисление → ресурс |
|
||||
| `full` | Полная сводка: overview + query + fields + resources + params + variant | — |
|
||||
|
||||
Паттерн: без `-Name` — карта/индекс, с `-Name` — деталь конкретного элемента.
|
||||
Паттерн: без `-Name` — карта/индекс, с `-Name` — деталь конкретного элемента. Режим `full` объединяет 6 ключевых режимов в один вызов.
|
||||
|
||||
## Типичный workflow
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$TemplatePath,
|
||||
[ValidateSet("overview", "query", "fields", "links", "calculated", "resources", "params", "variant", "trace", "templates")]
|
||||
[ValidateSet("overview", "query", "fields", "links", "calculated", "resources", "params", "variant", "trace", "templates", "full")]
|
||||
[string]$Mode = "overview",
|
||||
[string]$Name,
|
||||
[int]$Batch = 0,
|
||||
@@ -289,11 +289,7 @@ for ($i = $pathParts.Count - 1; $i -ge 0; $i--) {
|
||||
|
||||
$totalXmlLines = (Get-Content $resolvedPath).Count
|
||||
|
||||
# ============================================================
|
||||
# MODE: overview
|
||||
# ============================================================
|
||||
if ($Mode -eq "overview") {
|
||||
|
||||
function Show-Overview {
|
||||
$lines.Add("=== DCS: $templateName ($totalXmlLines lines) ===")
|
||||
$lines.Add("")
|
||||
|
||||
@@ -482,7 +478,9 @@ if ($Mode -eq "overview") {
|
||||
$lines.Add(" [$varIdx] $vName$vPresStr$structStr$filterStr")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Show-OverviewHints {
|
||||
# Hints — suggest next commands
|
||||
$lines.Add("")
|
||||
$hints = @()
|
||||
@@ -519,27 +517,35 @@ if ($Mode -eq "overview") {
|
||||
if ($totalCount -gt 0) {
|
||||
$hints += "-Mode resources resource aggregation ($totalCount)"
|
||||
}
|
||||
$params = $root.SelectNodes("s:parameter", $ns)
|
||||
if ($params.Count -gt 0) {
|
||||
$hints += "-Mode params parameter details"
|
||||
}
|
||||
$variants = $root.SelectNodes("s:settingsVariant", $ns)
|
||||
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))"
|
||||
}
|
||||
$tplDefs = $root.SelectNodes("s:template", $ns)
|
||||
if ($tplDefs.Count -gt 0) {
|
||||
$hints += "-Mode templates template bindings and expressions"
|
||||
}
|
||||
$hints += "-Mode trace -Name <f> trace field origin (by name or title)"
|
||||
$hints += "-Mode full all sections at once"
|
||||
$lines.Add("Next:")
|
||||
foreach ($h in $hints) { $lines.Add(" $h") }
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# MODE: query
|
||||
# MODE: overview
|
||||
# ============================================================
|
||||
elseif ($Mode -eq "query") {
|
||||
if ($Mode -eq "overview") {
|
||||
Show-Overview
|
||||
Show-OverviewHints
|
||||
}
|
||||
|
||||
function Show-Query {
|
||||
# Find dataset
|
||||
$dataSets = $root.SelectNodes("s:dataSet", $ns)
|
||||
$targetDs = $null
|
||||
@@ -666,10 +672,13 @@ elseif ($Mode -eq "query") {
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# MODE: fields
|
||||
# MODE: query
|
||||
# ============================================================
|
||||
elseif ($Mode -eq "fields") {
|
||||
if ($Mode -eq "query") {
|
||||
Show-Query
|
||||
}
|
||||
|
||||
function Show-Fields {
|
||||
$dataSets = $root.SelectNodes("s:dataSet", $ns)
|
||||
|
||||
function Show-DataSetFields($dsNode) {
|
||||
@@ -881,6 +890,13 @@ elseif ($Mode -eq "fields") {
|
||||
}
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# MODE: fields
|
||||
# ============================================================
|
||||
if ($Mode -eq "fields") {
|
||||
Show-Fields
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# MODE: links
|
||||
# ============================================================
|
||||
@@ -980,11 +996,7 @@ elseif ($Mode -eq "calculated") {
|
||||
}
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# MODE: resources
|
||||
# ============================================================
|
||||
elseif ($Mode -eq "resources") {
|
||||
|
||||
function Show-Resources {
|
||||
$totalFields = $root.SelectNodes("s:totalField", $ns)
|
||||
if ($totalFields.Count -eq 0) {
|
||||
$lines.Add("(no resources)")
|
||||
@@ -1031,10 +1043,13 @@ elseif ($Mode -eq "resources") {
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# MODE: params
|
||||
# MODE: resources
|
||||
# ============================================================
|
||||
elseif ($Mode -eq "params") {
|
||||
if ($Mode -eq "resources") {
|
||||
Show-Resources
|
||||
}
|
||||
|
||||
function Show-Params {
|
||||
$params = $root.SelectNodes("s:parameter", $ns)
|
||||
$lines.Add("=== Parameters ($($params.Count)) ===")
|
||||
$lines.Add(" Name Type Default Visible Expression")
|
||||
@@ -1096,10 +1111,13 @@ elseif ($Mode -eq "params") {
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# MODE: variant
|
||||
# MODE: params
|
||||
# ============================================================
|
||||
elseif ($Mode -eq "variant") {
|
||||
if ($Mode -eq "params") {
|
||||
Show-Params
|
||||
}
|
||||
|
||||
function Show-Variant {
|
||||
$variants = $root.SelectNodes("s:settingsVariant", $ns)
|
||||
|
||||
if (-not $Name) {
|
||||
@@ -1274,6 +1292,30 @@ elseif ($Mode -eq "variant") {
|
||||
} # end else (variant detail)
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# MODE: variant
|
||||
# ============================================================
|
||||
if ($Mode -eq "variant") {
|
||||
Show-Variant
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# MODE: full
|
||||
# ============================================================
|
||||
elseif ($Mode -eq "full") {
|
||||
Show-Overview
|
||||
$lines.Add(""); $lines.Add("--- query ---"); $lines.Add("")
|
||||
Show-Query
|
||||
$lines.Add(""); $lines.Add("--- fields ---"); $lines.Add("")
|
||||
Show-Fields
|
||||
$lines.Add(""); $lines.Add("--- resources ---"); $lines.Add("")
|
||||
Show-Resources
|
||||
$lines.Add(""); $lines.Add("--- params ---"); $lines.Add("")
|
||||
Show-Params
|
||||
$lines.Add(""); $lines.Add("--- variant ---"); $lines.Add("")
|
||||
Show-Variant
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# MODE: trace
|
||||
# ============================================================
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: subsystem-info
|
||||
description: Анализ структуры подсистемы 1С из XML-выгрузки — состав, дочерние подсистемы, командный интерфейс, дерево иерархии. Используй для изучения структуры подсистем и навигации по конфигурации
|
||||
argument-hint: <SubsystemPath> [-Mode overview|content|ci|tree] [-Name <элемент>]
|
||||
argument-hint: <SubsystemPath> [-Mode overview|content|ci|tree|full] [-Name <элемент>]
|
||||
allowed-tools:
|
||||
- Bash
|
||||
- Read
|
||||
@@ -17,7 +17,7 @@ allowed-tools:
|
||||
| Параметр | Описание |
|
||||
|----------|----------|
|
||||
| `SubsystemPath` | Путь к XML-файлу подсистемы, каталогу подсистемы или каталогу `Subsystems/` (для tree) |
|
||||
| `Mode` | Режим: `overview` (default), `content`, `ci`, `tree` |
|
||||
| `Mode` | Режим: `overview` (default), `content`, `ci`, `tree`, `full` |
|
||||
| `Name` | Drill-down: тип объекта в content, секция в ci, имя подсистемы в tree |
|
||||
| `Limit` / `Offset` | Пагинация (по умолчанию 150 строк) |
|
||||
| `OutFile` | Записать результат в файл (UTF-8 BOM) |
|
||||
@@ -26,7 +26,7 @@ allowed-tools:
|
||||
powershell.exe -NoProfile -File .claude\skills\subsystem-info\scripts\subsystem-info.ps1 -SubsystemPath "<путь>"
|
||||
```
|
||||
|
||||
## Четыре режима
|
||||
## Пять режимов
|
||||
|
||||
| Режим | Что показывает |
|
||||
|---|---|
|
||||
@@ -34,6 +34,7 @@ powershell.exe -NoProfile -File .claude\skills\subsystem-info\scripts\subsystem-
|
||||
| `content` | Список Content с группировкой по типу объекта. `-Name Catalog` — только каталоги |
|
||||
| `ci` | Разбор CommandInterface.xml: видимость, размещение, порядок команд/подсистем/групп |
|
||||
| `tree` | Рекурсивное дерево иерархии подсистем с маркерами [CI], [OneCmd], [Скрыт] |
|
||||
| `full` | Полная сводка: overview + content + ci в одном вызове |
|
||||
|
||||
## Примеры
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][string]$SubsystemPath,
|
||||
[ValidateSet("overview","content","ci","tree")]
|
||||
[ValidateSet("overview","content","ci","tree","full")]
|
||||
[string]$Mode = "overview",
|
||||
[string]$Name,
|
||||
[int]$Limit = 150,
|
||||
@@ -113,6 +113,174 @@ function Get-SubsystemDir([string]$xmlPath) {
|
||||
return Join-Path $dir $baseName
|
||||
}
|
||||
|
||||
# --- Show functions for full mode ---
|
||||
function Show-Overview {
|
||||
Out "Подсистема: $subName"
|
||||
if ($synonym -and $synonym -ne $subName) { Out "Синоним: $synonym" }
|
||||
if ($commentText) { Out "Комментарий: $commentText" }
|
||||
Out "ВключатьВКомандныйИнтерфейс: $inclCI"
|
||||
Out "ИспользоватьОднуКоманду: $useOneCmd"
|
||||
if ($explanation) { Out "Пояснение: $explanation" }
|
||||
if ($picText) { Out "Картинка: $picText" }
|
||||
if ($contentItems.Count -gt 0) {
|
||||
$parts = @()
|
||||
foreach ($type in $groups.Keys) {
|
||||
$parts += "$type`: $($groups[$type].Count)"
|
||||
}
|
||||
Out "Состав: $($contentItems.Count) объектов ($($parts -join ', '))"
|
||||
} else {
|
||||
Out "Состав: пусто"
|
||||
}
|
||||
if ($childNames.Count -gt 0) {
|
||||
Out "Дочерние подсистемы ($($childNames.Count)): $($childNames -join ', ')"
|
||||
}
|
||||
if ($hasCI) {
|
||||
Out "Командный интерфейс: есть"
|
||||
}
|
||||
}
|
||||
|
||||
function Show-Content {
|
||||
Out "Состав подсистемы $subName ($($contentItems.Count) объектов):"
|
||||
Out ""
|
||||
if ($Name) {
|
||||
if ($groups.Contains($Name)) {
|
||||
$filtered = $groups[$Name]
|
||||
Out "$Name ($($filtered.Count)):"
|
||||
foreach ($n in $filtered) { Out " $n" }
|
||||
} else {
|
||||
Out "[INFO] Тип '$Name' не найден в составе."
|
||||
Out "Доступные типы: $($groups.Keys -join ', ')"
|
||||
}
|
||||
} else {
|
||||
foreach ($type in $groups.Keys) {
|
||||
Out "$type ($($groups[$type].Count)):"
|
||||
foreach ($n in $groups[$type]) { Out " $n" }
|
||||
Out ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Show-CI {
|
||||
$localSubDir = Get-SubsystemDir $SubsystemPath
|
||||
$localCiPath = Join-Path (Join-Path $localSubDir "Ext") "CommandInterface.xml"
|
||||
|
||||
if (-not (Test-Path $localCiPath)) {
|
||||
Out "Командный интерфейс: $subName"
|
||||
Out ""
|
||||
Out "Файл CommandInterface.xml не найден."
|
||||
Out "Путь: $localCiPath"
|
||||
} else {
|
||||
[xml]$ciDoc = Get-Content -Path $localCiPath -Encoding UTF8
|
||||
$ciNs = New-Object System.Xml.XmlNamespaceManager($ciDoc.NameTable)
|
||||
$ciNs.AddNamespace("ci", "http://v8.1c.ru/8.3/xcf/extrnprops")
|
||||
$ciNs.AddNamespace("xr", "http://v8.1c.ru/8.3/xcf/readable")
|
||||
|
||||
$ciRoot = $ciDoc.DocumentElement
|
||||
|
||||
Out "Командный интерфейс: $subName"
|
||||
Out ""
|
||||
|
||||
# --- CommandsVisibility ---
|
||||
$visSection = $ciRoot.SelectSingleNode("ci:CommandsVisibility", $ciNs)
|
||||
if ($visSection) {
|
||||
$hidden = @(); $shown = @()
|
||||
foreach ($cmd in $visSection.SelectNodes("ci:Command", $ciNs)) {
|
||||
$cmdName = $cmd.GetAttribute("name")
|
||||
$vis = $cmd.SelectSingleNode("ci:Visibility/xr:Common", $ciNs)
|
||||
if ($vis -and $vis.InnerText -eq "false") { $hidden += $cmdName }
|
||||
else { $shown += $cmdName }
|
||||
}
|
||||
$total = $hidden.Count + $shown.Count
|
||||
if (-not $Name -or $Name -eq "visibility") {
|
||||
Out "Видимость ($total):"
|
||||
if ($hidden.Count -gt 0) {
|
||||
Out " СКРЫТО ($($hidden.Count)):"
|
||||
foreach ($h in $hidden) { Out " $h" }
|
||||
}
|
||||
if ($shown.Count -gt 0) {
|
||||
Out " ПОКАЗАНО ($($shown.Count)):"
|
||||
foreach ($s in $shown) { Out " $s" }
|
||||
}
|
||||
Out ""
|
||||
}
|
||||
}
|
||||
|
||||
# --- CommandsPlacement ---
|
||||
$placeSection = $ciRoot.SelectSingleNode("ci:CommandsPlacement", $ciNs)
|
||||
if ($placeSection) {
|
||||
$placements = @()
|
||||
foreach ($cmd in $placeSection.SelectNodes("ci:Command", $ciNs)) {
|
||||
$cmdName = $cmd.GetAttribute("name")
|
||||
$grp = $cmd.SelectSingleNode("ci:CommandGroup", $ciNs)
|
||||
$pl = $cmd.SelectSingleNode("ci:Placement", $ciNs)
|
||||
$grpText = if ($grp) { $grp.InnerText } else { "?" }
|
||||
$plText = if ($pl) { $pl.InnerText } else { "?" }
|
||||
$placements += @{ Name=$cmdName; Group=$grpText; Placement=$plText }
|
||||
}
|
||||
if ((-not $Name -or $Name -eq "placement") -and $placements.Count -gt 0) {
|
||||
Out "Размещение ($($placements.Count)):"
|
||||
$arrow = [char]0x2192
|
||||
foreach ($p in $placements) {
|
||||
Out " $($p.Name) $arrow $($p.Group) ($($p.Placement))"
|
||||
}
|
||||
Out ""
|
||||
}
|
||||
}
|
||||
|
||||
# --- CommandsOrder ---
|
||||
$orderSection = $ciRoot.SelectSingleNode("ci:CommandsOrder", $ciNs)
|
||||
if ($orderSection) {
|
||||
$orderGroups = [ordered]@{}
|
||||
foreach ($cmd in $orderSection.SelectNodes("ci:Command", $ciNs)) {
|
||||
$cmdName = $cmd.GetAttribute("name")
|
||||
$grp = $cmd.SelectSingleNode("ci:CommandGroup", $ciNs)
|
||||
$grpText = if ($grp) { $grp.InnerText } else { "?" }
|
||||
if (-not $orderGroups.Contains($grpText)) { $orderGroups[$grpText] = @() }
|
||||
$orderGroups[$grpText] += $cmdName
|
||||
}
|
||||
$totalOrder = 0
|
||||
foreach ($k in $orderGroups.Keys) { $totalOrder += $orderGroups[$k].Count }
|
||||
if ((-not $Name -or $Name -eq "order") -and $totalOrder -gt 0) {
|
||||
Out "Порядок команд ($totalOrder):"
|
||||
foreach ($grpName in $orderGroups.Keys) {
|
||||
Out " [$grpName]:"
|
||||
foreach ($c in $orderGroups[$grpName]) { Out " $c" }
|
||||
}
|
||||
Out ""
|
||||
}
|
||||
}
|
||||
|
||||
# --- SubsystemsOrder ---
|
||||
$subOrderSection = $ciRoot.SelectSingleNode("ci:SubsystemsOrder", $ciNs)
|
||||
if ($subOrderSection) {
|
||||
$subOrder = @()
|
||||
foreach ($s in $subOrderSection.SelectNodes("ci:Subsystem", $ciNs)) {
|
||||
$subOrder += $s.InnerText
|
||||
}
|
||||
if ((-not $Name -or $Name -eq "subsystems") -and $subOrder.Count -gt 0) {
|
||||
Out "Порядок подсистем ($($subOrder.Count)):"
|
||||
for ($i = 0; $i -lt $subOrder.Count; $i++) {
|
||||
Out " $($i+1). $($subOrder[$i])"
|
||||
}
|
||||
Out ""
|
||||
}
|
||||
}
|
||||
|
||||
# --- GroupsOrder ---
|
||||
$grpOrderSection = $ciRoot.SelectSingleNode("ci:GroupsOrder", $ciNs)
|
||||
if ($grpOrderSection) {
|
||||
$grpOrder = @()
|
||||
foreach ($g in $grpOrderSection.SelectNodes("ci:Group", $ciNs)) {
|
||||
$grpOrder += $g.InnerText
|
||||
}
|
||||
if ((-not $Name -or $Name -eq "groups") -and $grpOrder.Count -gt 0) {
|
||||
Out "Порядок групп ($($grpOrder.Count)):"
|
||||
foreach ($g in $grpOrder) { Out " $g" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ============================================================
|
||||
# Mode: tree
|
||||
# ============================================================
|
||||
@@ -225,124 +393,7 @@ if ($Mode -eq "tree") {
|
||||
$props = $sub.SelectSingleNode("md:Properties", $ns)
|
||||
$subName = $props.SelectSingleNode("md:Name", $ns).InnerText
|
||||
|
||||
$subDir = Get-SubsystemDir $SubsystemPath
|
||||
$ciPath = Join-Path (Join-Path $subDir "Ext") "CommandInterface.xml"
|
||||
|
||||
if (-not (Test-Path $ciPath)) {
|
||||
Out "Командный интерфейс: $subName"
|
||||
Out ""
|
||||
Out "Файл CommandInterface.xml не найден."
|
||||
Out "Путь: $ciPath"
|
||||
} else {
|
||||
[xml]$ciDoc = Get-Content -Path $ciPath -Encoding UTF8
|
||||
$ciNs = New-Object System.Xml.XmlNamespaceManager($ciDoc.NameTable)
|
||||
$ciNs.AddNamespace("ci", "http://v8.1c.ru/8.3/xcf/extrnprops")
|
||||
$ciNs.AddNamespace("xr", "http://v8.1c.ru/8.3/xcf/readable")
|
||||
|
||||
$ciRoot = $ciDoc.DocumentElement
|
||||
|
||||
Out "Командный интерфейс: $subName"
|
||||
Out ""
|
||||
|
||||
# --- CommandsVisibility ---
|
||||
$visSection = $ciRoot.SelectSingleNode("ci:CommandsVisibility", $ciNs)
|
||||
if ($visSection) {
|
||||
$hidden = @(); $shown = @()
|
||||
foreach ($cmd in $visSection.SelectNodes("ci:Command", $ciNs)) {
|
||||
$cmdName = $cmd.GetAttribute("name")
|
||||
$vis = $cmd.SelectSingleNode("ci:Visibility/xr:Common", $ciNs)
|
||||
if ($vis -and $vis.InnerText -eq "false") { $hidden += $cmdName }
|
||||
else { $shown += $cmdName }
|
||||
}
|
||||
$total = $hidden.Count + $shown.Count
|
||||
if (-not $Name -or $Name -eq "visibility") {
|
||||
Out "Видимость ($total):"
|
||||
if ($hidden.Count -gt 0) {
|
||||
Out " СКРЫТО ($($hidden.Count)):"
|
||||
foreach ($h in $hidden) { Out " $h" }
|
||||
}
|
||||
if ($shown.Count -gt 0) {
|
||||
Out " ПОКАЗАНО ($($shown.Count)):"
|
||||
foreach ($s in $shown) { Out " $s" }
|
||||
}
|
||||
Out ""
|
||||
}
|
||||
}
|
||||
|
||||
# --- CommandsPlacement ---
|
||||
$placeSection = $ciRoot.SelectSingleNode("ci:CommandsPlacement", $ciNs)
|
||||
if ($placeSection) {
|
||||
$placements = @()
|
||||
foreach ($cmd in $placeSection.SelectNodes("ci:Command", $ciNs)) {
|
||||
$cmdName = $cmd.GetAttribute("name")
|
||||
$grp = $cmd.SelectSingleNode("ci:CommandGroup", $ciNs)
|
||||
$pl = $cmd.SelectSingleNode("ci:Placement", $ciNs)
|
||||
$grpText = if ($grp) { $grp.InnerText } else { "?" }
|
||||
$plText = if ($pl) { $pl.InnerText } else { "?" }
|
||||
$placements += @{ Name=$cmdName; Group=$grpText; Placement=$plText }
|
||||
}
|
||||
if ((-not $Name -or $Name -eq "placement") -and $placements.Count -gt 0) {
|
||||
Out "Размещение ($($placements.Count)):"
|
||||
$arrow = [char]0x2192
|
||||
foreach ($p in $placements) {
|
||||
Out " $($p.Name) $arrow $($p.Group) ($($p.Placement))"
|
||||
}
|
||||
Out ""
|
||||
}
|
||||
}
|
||||
|
||||
# --- CommandsOrder ---
|
||||
$orderSection = $ciRoot.SelectSingleNode("ci:CommandsOrder", $ciNs)
|
||||
if ($orderSection) {
|
||||
$orderGroups = [ordered]@{}
|
||||
foreach ($cmd in $orderSection.SelectNodes("ci:Command", $ciNs)) {
|
||||
$cmdName = $cmd.GetAttribute("name")
|
||||
$grp = $cmd.SelectSingleNode("ci:CommandGroup", $ciNs)
|
||||
$grpText = if ($grp) { $grp.InnerText } else { "?" }
|
||||
if (-not $orderGroups.Contains($grpText)) { $orderGroups[$grpText] = @() }
|
||||
$orderGroups[$grpText] += $cmdName
|
||||
}
|
||||
$totalOrder = 0
|
||||
foreach ($k in $orderGroups.Keys) { $totalOrder += $orderGroups[$k].Count }
|
||||
if ((-not $Name -or $Name -eq "order") -and $totalOrder -gt 0) {
|
||||
Out "Порядок команд ($totalOrder):"
|
||||
foreach ($grpName in $orderGroups.Keys) {
|
||||
Out " [$grpName]:"
|
||||
foreach ($c in $orderGroups[$grpName]) { Out " $c" }
|
||||
}
|
||||
Out ""
|
||||
}
|
||||
}
|
||||
|
||||
# --- SubsystemsOrder ---
|
||||
$subOrderSection = $ciRoot.SelectSingleNode("ci:SubsystemsOrder", $ciNs)
|
||||
if ($subOrderSection) {
|
||||
$subOrder = @()
|
||||
foreach ($s in $subOrderSection.SelectNodes("ci:Subsystem", $ciNs)) {
|
||||
$subOrder += $s.InnerText
|
||||
}
|
||||
if ((-not $Name -or $Name -eq "subsystems") -and $subOrder.Count -gt 0) {
|
||||
Out "Порядок подсистем ($($subOrder.Count)):"
|
||||
for ($i = 0; $i -lt $subOrder.Count; $i++) {
|
||||
Out " $($i+1). $($subOrder[$i])"
|
||||
}
|
||||
Out ""
|
||||
}
|
||||
}
|
||||
|
||||
# --- GroupsOrder ---
|
||||
$grpOrderSection = $ciRoot.SelectSingleNode("ci:GroupsOrder", $ciNs)
|
||||
if ($grpOrderSection) {
|
||||
$grpOrder = @()
|
||||
foreach ($g in $grpOrderSection.SelectNodes("ci:Group", $ciNs)) {
|
||||
$grpOrder += $g.InnerText
|
||||
}
|
||||
if ((-not $Name -or $Name -eq "groups") -and $grpOrder.Count -gt 0) {
|
||||
Out "Порядок групп ($($grpOrder.Count)):"
|
||||
foreach ($g in $grpOrder) { Out " $g" }
|
||||
}
|
||||
}
|
||||
}
|
||||
Show-CI
|
||||
|
||||
} else {
|
||||
# ============================================================
|
||||
@@ -398,56 +449,15 @@ if ($Mode -eq "tree") {
|
||||
$hasCI = Test-Path $ciPath
|
||||
|
||||
if ($Mode -eq "overview") {
|
||||
Out "Подсистема: $subName"
|
||||
if ($synonym -and $synonym -ne $subName) { Out "Синоним: $synonym" }
|
||||
if ($commentText) { Out "Комментарий: $commentText" }
|
||||
Out "ВключатьВКомандныйИнтерфейс: $inclCI"
|
||||
Out "ИспользоватьОднуКоманду: $useOneCmd"
|
||||
if ($explanation) { Out "Пояснение: $explanation" }
|
||||
if ($picText) { Out "Картинка: $picText" }
|
||||
|
||||
# Content summary
|
||||
if ($contentItems.Count -gt 0) {
|
||||
$parts = @()
|
||||
foreach ($type in $groups.Keys) {
|
||||
$parts += "$type`: $($groups[$type].Count)"
|
||||
}
|
||||
Out "Состав: $($contentItems.Count) объектов ($($parts -join ', '))"
|
||||
} else {
|
||||
Out "Состав: пусто"
|
||||
}
|
||||
|
||||
# Children
|
||||
if ($childNames.Count -gt 0) {
|
||||
Out "Дочерние подсистемы ($($childNames.Count)): $($childNames -join ', ')"
|
||||
}
|
||||
|
||||
# CI
|
||||
if ($hasCI) {
|
||||
Out "Командный интерфейс: есть"
|
||||
}
|
||||
|
||||
Show-Overview
|
||||
} elseif ($Mode -eq "content") {
|
||||
Out "Состав подсистемы $subName ($($contentItems.Count) объектов):"
|
||||
Out ""
|
||||
|
||||
if ($Name) {
|
||||
# Filter by type
|
||||
if ($groups.Contains($Name)) {
|
||||
$filtered = $groups[$Name]
|
||||
Out "$Name ($($filtered.Count)):"
|
||||
foreach ($n in $filtered) { Out " $n" }
|
||||
} else {
|
||||
Out "[INFO] Тип '$Name' не найден в составе."
|
||||
Out "Доступные типы: $($groups.Keys -join ', ')"
|
||||
}
|
||||
} else {
|
||||
foreach ($type in $groups.Keys) {
|
||||
Out "$type ($($groups[$type].Count)):"
|
||||
foreach ($n in $groups[$type]) { Out " $n" }
|
||||
Out ""
|
||||
}
|
||||
}
|
||||
Show-Content
|
||||
} elseif ($Mode -eq "full") {
|
||||
Show-Overview
|
||||
Out ""; Out "--- content ---"; Out ""
|
||||
Show-Content
|
||||
Out ""; Out "--- ci ---"; Out ""
|
||||
Show-CI
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -6,8 +6,8 @@
|
||||
|
||||
| Навык | Параметры | Описание |
|
||||
|-------|-----------|----------|
|
||||
| `/skd-info` | `<TemplatePath> [-Mode] [-Name]` | Анализ структуры СКД: наборы, поля, параметры, ресурсы, варианты (10 режимов) |
|
||||
| `/skd-compile` | `<JsonPath> <OutputPath>` | Генерация Template.xml из JSON DSL: наборы, поля, итоги, параметры, варианты |
|
||||
| `/skd-info` | `<TemplatePath> [-Mode] [-Name]` | Анализ структуры СКД: наборы, поля, параметры, ресурсы, варианты (11 режимов, включая full) |
|
||||
| `/skd-compile` | `[-DefinitionFile <json> \| -Value <json-string>] -OutputPath <Template.xml>` | Генерация Template.xml из JSON DSL: наборы, поля, итоги, параметры, варианты |
|
||||
| `/skd-edit` | `<TemplatePath> -Operation <op> -Value "<value>"` | Точечное редактирование: 25 атомарных операций (add/set/modify/clear/remove) |
|
||||
| `/skd-validate` | `<TemplatePath> [-MaxErrors 20]` | Валидация структурной корректности: ~30 проверок |
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
| Навык | Параметры | Описание |
|
||||
|-------|-----------|----------|
|
||||
| `/subsystem-info` | `<SubsystemPath> [-Mode] [-Name]` | Анализ структуры подсистемы: состав, дочерние, CI, дерево иерархии (4 режима) |
|
||||
| `/subsystem-info` | `<SubsystemPath> [-Mode] [-Name]` | Анализ структуры подсистемы: состав, дочерние, CI, дерево иерархии (5 режимов, включая full) |
|
||||
| `/subsystem-compile` | `<JsonPath> <OutputDir> [-Parent]` | Генерация подсистемы из JSON DSL: XML + регистрация в Configuration.xml |
|
||||
| `/subsystem-edit` | `<SubsystemPath> -Operation <op> -Value "<value>"` | Точечное редактирование: 5 операций (add/remove content/child, set-property) |
|
||||
| `/subsystem-validate` | `<SubsystemPath> [-MaxErrors 30]` | Валидация структурной корректности: 13 проверок |
|
||||
|
||||
Reference in New Issue
Block a user