mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-09-17 15:25:23 +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:
co-authored by
Claude Opus 4.6
parent
2a4d2bf8df
commit
7268b169d8
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: skd-compile
|
name: skd-compile
|
||||||
description: Компиляция схемы компоновки данных 1С (СКД) из компактного JSON-определения. Используй когда нужно создать СКД с нуля
|
description: Компиляция схемы компоновки данных 1С (СКД) из компактного JSON-определения. Используй когда нужно создать СКД с нуля
|
||||||
argument-hint: <JsonPath> <OutputPath>
|
argument-hint: [-DefinitionFile <json> | -Value <json-string>] -OutputPath <Template.xml>
|
||||||
allowed-tools:
|
allowed-tools:
|
||||||
- Bash
|
- Bash
|
||||||
- Read
|
- Read
|
||||||
@@ -17,11 +17,16 @@ allowed-tools:
|
|||||||
|
|
||||||
| Параметр | Описание |
|
| Параметр | Описание |
|
||||||
|----------|----------|
|
|----------|----------|
|
||||||
| `JsonPath` | Путь к JSON-определению СКД |
|
| `DefinitionFile` | Путь к JSON-файлу с определением СКД (взаимоисключающий с Value) |
|
||||||
|
| `Value` | JSON-строка с определением СКД (взаимоисключающий с DefinitionFile) |
|
||||||
| `OutputPath` | Путь к выходному Template.xml |
|
| `OutputPath` | Путь к выходному Template.xml |
|
||||||
|
|
||||||
```powershell
|
```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 — краткий справочник
|
## JSON DSL — краткий справочник
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
# skd-compile v1.0 — Compile 1C DCS from JSON
|
# skd-compile v1.0 — Compile 1C DCS from JSON
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)]
|
[string]$DefinitionFile,
|
||||||
[string]$JsonPath,
|
[string]$Value,
|
||||||
|
|
||||||
[Parameter(Mandatory)]
|
[Parameter(Mandatory)]
|
||||||
[string]$OutputPath
|
[string]$OutputPath
|
||||||
)
|
)
|
||||||
@@ -13,12 +12,28 @@ $ErrorActionPreference = "Stop"
|
|||||||
|
|
||||||
# --- 1. Load and validate JSON ---
|
# --- 1. Load and validate JSON ---
|
||||||
|
|
||||||
if (-not (Test-Path $JsonPath)) {
|
if ($DefinitionFile -and $Value) {
|
||||||
Write-Error "File not found: $JsonPath"
|
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
|
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
|
$def = $json | ConvertFrom-Json
|
||||||
|
|
||||||
if (-not $def.dataSets -or $def.dataSets.Count -eq 0) {
|
if (-not $def.dataSets -or $def.dataSets.Count -eq 0) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: skd-info
|
name: skd-info
|
||||||
description: Анализ структуры схемы компоновки данных 1С (СКД) — наборы, поля, параметры, варианты. Используй для понимания отчёта — источник данных (запрос), доступные поля, параметры
|
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:
|
allowed-tools:
|
||||||
- Bash
|
- Bash
|
||||||
- Read
|
- Read
|
||||||
@@ -54,8 +54,9 @@ powershell.exe -NoProfile -File .claude\skills\skd-info\scripts\skd-info.ps1 -Te
|
|||||||
| `variant` | Список вариантов | Структура группировок + фильтры + вывод |
|
| `variant` | Список вариантов | Структура группировок + фильтры + вывод |
|
||||||
| `templates` | Карта привязок шаблонов (field/group) | Содержимое шаблона: строки, ячейки, выражения |
|
| `templates` | Карта привязок шаблонов (field/group) | Содержимое шаблона: строки, ячейки, выражения |
|
||||||
| `trace` | — | Полная цепочка: набор → вычисление → ресурс |
|
| `trace` | — | Полная цепочка: набор → вычисление → ресурс |
|
||||||
|
| `full` | Полная сводка: overview + query + fields + resources + params + variant | — |
|
||||||
|
|
||||||
Паттерн: без `-Name` — карта/индекс, с `-Name` — деталь конкретного элемента.
|
Паттерн: без `-Name` — карта/индекс, с `-Name` — деталь конкретного элемента. Режим `full` объединяет 6 ключевых режимов в один вызов.
|
||||||
|
|
||||||
## Типичный workflow
|
## Типичный workflow
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory=$true)]
|
||||||
[string]$TemplatePath,
|
[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]$Mode = "overview",
|
||||||
[string]$Name,
|
[string]$Name,
|
||||||
[int]$Batch = 0,
|
[int]$Batch = 0,
|
||||||
@@ -289,11 +289,7 @@ for ($i = $pathParts.Count - 1; $i -ge 0; $i--) {
|
|||||||
|
|
||||||
$totalXmlLines = (Get-Content $resolvedPath).Count
|
$totalXmlLines = (Get-Content $resolvedPath).Count
|
||||||
|
|
||||||
# ============================================================
|
function Show-Overview {
|
||||||
# MODE: overview
|
|
||||||
# ============================================================
|
|
||||||
if ($Mode -eq "overview") {
|
|
||||||
|
|
||||||
$lines.Add("=== DCS: $templateName ($totalXmlLines lines) ===")
|
$lines.Add("=== DCS: $templateName ($totalXmlLines lines) ===")
|
||||||
$lines.Add("")
|
$lines.Add("")
|
||||||
|
|
||||||
@@ -482,7 +478,9 @@ if ($Mode -eq "overview") {
|
|||||||
$lines.Add(" [$varIdx] $vName$vPresStr$structStr$filterStr")
|
$lines.Add(" [$varIdx] $vName$vPresStr$structStr$filterStr")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Show-OverviewHints {
|
||||||
# Hints — suggest next commands
|
# Hints — suggest next commands
|
||||||
$lines.Add("")
|
$lines.Add("")
|
||||||
$hints = @()
|
$hints = @()
|
||||||
@@ -519,27 +517,35 @@ if ($Mode -eq "overview") {
|
|||||||
if ($totalCount -gt 0) {
|
if ($totalCount -gt 0) {
|
||||||
$hints += "-Mode resources resource aggregation ($totalCount)"
|
$hints += "-Mode resources resource aggregation ($totalCount)"
|
||||||
}
|
}
|
||||||
|
$params = $root.SelectNodes("s:parameter", $ns)
|
||||||
if ($params.Count -gt 0) {
|
if ($params.Count -gt 0) {
|
||||||
$hints += "-Mode params parameter details"
|
$hints += "-Mode params parameter details"
|
||||||
}
|
}
|
||||||
|
$variants = $root.SelectNodes("s:settingsVariant", $ns)
|
||||||
if ($variants.Count -eq 1) {
|
if ($variants.Count -eq 1) {
|
||||||
$hints += "-Mode variant variant structure"
|
$hints += "-Mode variant variant structure"
|
||||||
} elseif ($variants.Count -gt 1) {
|
} elseif ($variants.Count -gt 1) {
|
||||||
$hints += "-Mode variant -Name <N> variant structure (1..$($variants.Count))"
|
$hints += "-Mode variant -Name <N> variant structure (1..$($variants.Count))"
|
||||||
}
|
}
|
||||||
|
$tplDefs = $root.SelectNodes("s:template", $ns)
|
||||||
if ($tplDefs.Count -gt 0) {
|
if ($tplDefs.Count -gt 0) {
|
||||||
$hints += "-Mode templates template bindings and expressions"
|
$hints += "-Mode templates template bindings and expressions"
|
||||||
}
|
}
|
||||||
$hints += "-Mode trace -Name <f> trace field origin (by name or title)"
|
$hints += "-Mode trace -Name <f> trace field origin (by name or title)"
|
||||||
|
$hints += "-Mode full all sections at once"
|
||||||
$lines.Add("Next:")
|
$lines.Add("Next:")
|
||||||
foreach ($h in $hints) { $lines.Add(" $h") }
|
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
|
# Find dataset
|
||||||
$dataSets = $root.SelectNodes("s:dataSet", $ns)
|
$dataSets = $root.SelectNodes("s:dataSet", $ns)
|
||||||
$targetDs = $null
|
$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)
|
$dataSets = $root.SelectNodes("s:dataSet", $ns)
|
||||||
|
|
||||||
function Show-DataSetFields($dsNode) {
|
function Show-DataSetFields($dsNode) {
|
||||||
@@ -881,6 +890,13 @@ elseif ($Mode -eq "fields") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# MODE: fields
|
||||||
|
# ============================================================
|
||||||
|
if ($Mode -eq "fields") {
|
||||||
|
Show-Fields
|
||||||
|
}
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# MODE: links
|
# MODE: links
|
||||||
# ============================================================
|
# ============================================================
|
||||||
@@ -980,11 +996,7 @@ elseif ($Mode -eq "calculated") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# ============================================================
|
function Show-Resources {
|
||||||
# MODE: resources
|
|
||||||
# ============================================================
|
|
||||||
elseif ($Mode -eq "resources") {
|
|
||||||
|
|
||||||
$totalFields = $root.SelectNodes("s:totalField", $ns)
|
$totalFields = $root.SelectNodes("s:totalField", $ns)
|
||||||
if ($totalFields.Count -eq 0) {
|
if ($totalFields.Count -eq 0) {
|
||||||
$lines.Add("(no resources)")
|
$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)
|
$params = $root.SelectNodes("s:parameter", $ns)
|
||||||
$lines.Add("=== Parameters ($($params.Count)) ===")
|
$lines.Add("=== Parameters ($($params.Count)) ===")
|
||||||
$lines.Add(" Name Type Default Visible Expression")
|
$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)
|
$variants = $root.SelectNodes("s:settingsVariant", $ns)
|
||||||
|
|
||||||
if (-not $Name) {
|
if (-not $Name) {
|
||||||
@@ -1274,6 +1292,30 @@ elseif ($Mode -eq "variant") {
|
|||||||
} # end else (variant detail)
|
} # 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
|
# MODE: trace
|
||||||
# ============================================================
|
# ============================================================
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: subsystem-info
|
name: subsystem-info
|
||||||
description: Анализ структуры подсистемы 1С из XML-выгрузки — состав, дочерние подсистемы, командный интерфейс, дерево иерархии. Используй для изучения структуры подсистем и навигации по конфигурации
|
description: Анализ структуры подсистемы 1С из XML-выгрузки — состав, дочерние подсистемы, командный интерфейс, дерево иерархии. Используй для изучения структуры подсистем и навигации по конфигурации
|
||||||
argument-hint: <SubsystemPath> [-Mode overview|content|ci|tree] [-Name <элемент>]
|
argument-hint: <SubsystemPath> [-Mode overview|content|ci|tree|full] [-Name <элемент>]
|
||||||
allowed-tools:
|
allowed-tools:
|
||||||
- Bash
|
- Bash
|
||||||
- Read
|
- Read
|
||||||
@@ -17,7 +17,7 @@ allowed-tools:
|
|||||||
| Параметр | Описание |
|
| Параметр | Описание |
|
||||||
|----------|----------|
|
|----------|----------|
|
||||||
| `SubsystemPath` | Путь к XML-файлу подсистемы, каталогу подсистемы или каталогу `Subsystems/` (для tree) |
|
| `SubsystemPath` | Путь к XML-файлу подсистемы, каталогу подсистемы или каталогу `Subsystems/` (для tree) |
|
||||||
| `Mode` | Режим: `overview` (default), `content`, `ci`, `tree` |
|
| `Mode` | Режим: `overview` (default), `content`, `ci`, `tree`, `full` |
|
||||||
| `Name` | Drill-down: тип объекта в content, секция в ci, имя подсистемы в tree |
|
| `Name` | Drill-down: тип объекта в content, секция в ci, имя подсистемы в tree |
|
||||||
| `Limit` / `Offset` | Пагинация (по умолчанию 150 строк) |
|
| `Limit` / `Offset` | Пагинация (по умолчанию 150 строк) |
|
||||||
| `OutFile` | Записать результат в файл (UTF-8 BOM) |
|
| `OutFile` | Записать результат в файл (UTF-8 BOM) |
|
||||||
@@ -26,7 +26,7 @@ allowed-tools:
|
|||||||
powershell.exe -NoProfile -File .claude\skills\subsystem-info\scripts\subsystem-info.ps1 -SubsystemPath "<путь>"
|
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` — только каталоги |
|
| `content` | Список Content с группировкой по типу объекта. `-Name Catalog` — только каталоги |
|
||||||
| `ci` | Разбор CommandInterface.xml: видимость, размещение, порядок команд/подсистем/групп |
|
| `ci` | Разбор CommandInterface.xml: видимость, размещение, порядок команд/подсистем/групп |
|
||||||
| `tree` | Рекурсивное дерево иерархии подсистем с маркерами [CI], [OneCmd], [Скрыт] |
|
| `tree` | Рекурсивное дерево иерархии подсистем с маркерами [CI], [OneCmd], [Скрыт] |
|
||||||
|
| `full` | Полная сводка: overview + content + ci в одном вызове |
|
||||||
|
|
||||||
## Примеры
|
## Примеры
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true)][string]$SubsystemPath,
|
[Parameter(Mandatory=$true)][string]$SubsystemPath,
|
||||||
[ValidateSet("overview","content","ci","tree")]
|
[ValidateSet("overview","content","ci","tree","full")]
|
||||||
[string]$Mode = "overview",
|
[string]$Mode = "overview",
|
||||||
[string]$Name,
|
[string]$Name,
|
||||||
[int]$Limit = 150,
|
[int]$Limit = 150,
|
||||||
@@ -113,6 +113,174 @@ function Get-SubsystemDir([string]$xmlPath) {
|
|||||||
return Join-Path $dir $baseName
|
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
|
# Mode: tree
|
||||||
# ============================================================
|
# ============================================================
|
||||||
@@ -225,124 +393,7 @@ if ($Mode -eq "tree") {
|
|||||||
$props = $sub.SelectSingleNode("md:Properties", $ns)
|
$props = $sub.SelectSingleNode("md:Properties", $ns)
|
||||||
$subName = $props.SelectSingleNode("md:Name", $ns).InnerText
|
$subName = $props.SelectSingleNode("md:Name", $ns).InnerText
|
||||||
|
|
||||||
$subDir = Get-SubsystemDir $SubsystemPath
|
Show-CI
|
||||||
$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" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
# ============================================================
|
# ============================================================
|
||||||
@@ -398,56 +449,15 @@ if ($Mode -eq "tree") {
|
|||||||
$hasCI = Test-Path $ciPath
|
$hasCI = Test-Path $ciPath
|
||||||
|
|
||||||
if ($Mode -eq "overview") {
|
if ($Mode -eq "overview") {
|
||||||
Out "Подсистема: $subName"
|
Show-Overview
|
||||||
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 "Командный интерфейс: есть"
|
|
||||||
}
|
|
||||||
|
|
||||||
} elseif ($Mode -eq "content") {
|
} elseif ($Mode -eq "content") {
|
||||||
Out "Состав подсистемы $subName ($($contentItems.Count) объектов):"
|
Show-Content
|
||||||
Out ""
|
} elseif ($Mode -eq "full") {
|
||||||
|
Show-Overview
|
||||||
if ($Name) {
|
Out ""; Out "--- content ---"; Out ""
|
||||||
# Filter by type
|
Show-Content
|
||||||
if ($groups.Contains($Name)) {
|
Out ""; Out "--- ci ---"; Out ""
|
||||||
$filtered = $groups[$Name]
|
Show-CI
|
||||||
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 ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
| Навык | Параметры | Описание |
|
| Навык | Параметры | Описание |
|
||||||
|-------|-----------|----------|
|
|-------|-----------|----------|
|
||||||
| `/skd-info` | `<TemplatePath> [-Mode] [-Name]` | Анализ структуры СКД: наборы, поля, параметры, ресурсы, варианты (10 режимов) |
|
| `/skd-info` | `<TemplatePath> [-Mode] [-Name]` | Анализ структуры СКД: наборы, поля, параметры, ресурсы, варианты (11 режимов, включая full) |
|
||||||
| `/skd-compile` | `<JsonPath> <OutputPath>` | Генерация Template.xml из JSON DSL: наборы, поля, итоги, параметры, варианты |
|
| `/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-edit` | `<TemplatePath> -Operation <op> -Value "<value>"` | Точечное редактирование: 25 атомарных операций (add/set/modify/clear/remove) |
|
||||||
| `/skd-validate` | `<TemplatePath> [-MaxErrors 20]` | Валидация структурной корректности: ~30 проверок |
|
| `/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-compile` | `<JsonPath> <OutputDir> [-Parent]` | Генерация подсистемы из JSON DSL: XML + регистрация в Configuration.xml |
|
||||||
| `/subsystem-edit` | `<SubsystemPath> -Operation <op> -Value "<value>"` | Точечное редактирование: 5 операций (add/remove content/child, set-property) |
|
| `/subsystem-edit` | `<SubsystemPath> -Operation <op> -Value "<value>"` | Точечное редактирование: 5 операций (add/remove content/child, set-property) |
|
||||||
| `/subsystem-validate` | `<SubsystemPath> [-MaxErrors 30]` | Валидация структурной корректности: 13 проверок |
|
| `/subsystem-validate` | `<SubsystemPath> [-MaxErrors 30]` | Валидация структурной корректности: 13 проверок |
|
||||||
|
|||||||
Reference in New Issue
Block a user