mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-20 01:20:59 +03:00
feat(validate): brief output by default, -Detailed for verbose
All 10 validation skills (meta, epf, skd, cf, cfe, form, mxl, role, subsystem, interface) now output a single summary line on success: === Validation OK: Type.Name (N checks) === Errors/warnings always shown. Full per-check [OK] output behind -Detailed flag. Removed all N/A check lines. Unified role-validate output format. Trimmed SKILL.md files from 42-119 to 51-67 lines. Version bumps: meta-validate v1.2, all others v1.1. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
93e4130ff2
commit
422e397381
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: interface-validate
|
||||
description: Валидация командного интерфейса 1С. Используй после настройки командного интерфейса подсистемы для проверки корректности
|
||||
argument-hint: <CIPath> [-MaxErrors 30]
|
||||
argument-hint: <CIPath> [-Detailed] [-MaxErrors 30]
|
||||
allowed-tools:
|
||||
- Bash
|
||||
- Read
|
||||
@@ -10,15 +10,23 @@ allowed-tools:
|
||||
|
||||
# /interface-validate — валидация CommandInterface.xml
|
||||
|
||||
Проверяет XML командного интерфейса из выгрузки конфигурации на структурные ошибки: корневой элемент, допустимые секции, порядок, формат ссылок на команды, дубликаты.
|
||||
Проверяет XML командного интерфейса на структурные ошибки: корневой элемент, допустимые секции, порядок, формат ссылок на команды, дубликаты.
|
||||
|
||||
## Использование
|
||||
|
||||
```
|
||||
/interface-validate <CIPath>
|
||||
/interface-validate Subsystems/Продажи/Ext/CommandInterface.xml
|
||||
```
|
||||
|
||||
## Параметры
|
||||
|
||||
| Параметр | Обязательный | По умолчанию | Описание |
|
||||
|-----------|:------------:|--------------|------------------------------------|
|
||||
| CIPath | да | — | Путь к CommandInterface.xml |
|
||||
| MaxErrors | нет | 30 | Остановиться после N ошибок |
|
||||
| OutFile | нет | — | Записать результат в файл (UTF-8 BOM) |
|
||||
| Параметр | Обяз. | Умолч. | Описание |
|
||||
|-----------|:-----:|---------|-----------------------------------------|
|
||||
| CIPath | да | — | Путь к CommandInterface.xml |
|
||||
| Detailed | нет | — | Показывать [OK] для каждой проверки |
|
||||
| MaxErrors | нет | 30 | Остановиться после N ошибок |
|
||||
| OutFile | нет | — | Записать результат в файл (UTF-8 BOM) |
|
||||
|
||||
## Команда
|
||||
|
||||
@@ -44,39 +52,4 @@ powershell.exe -NoProfile -File '.claude/skills/interface-validate/scripts/inter
|
||||
| 12 | GroupsOrder — нет дубликатов | WARN |
|
||||
| 13 | Формат ссылок на команды | WARN |
|
||||
|
||||
## Вывод
|
||||
|
||||
```
|
||||
=== Validation: CommandInterface (Продажи) ===
|
||||
|
||||
[OK] 1. Root structure: CommandInterface, version 2.17, namespace valid
|
||||
[OK] 2. Child elements: 5 valid sections
|
||||
[OK] 3. Section order: correct
|
||||
[OK] 4. No duplicate sections
|
||||
[OK] 5. CommandsVisibility: 55 entries, all valid
|
||||
[OK] 6. CommandsVisibility: no duplicates
|
||||
[OK] 7. CommandsPlacement: 3 entries, all valid
|
||||
[OK] 8. CommandsOrder: 12 entries, all valid
|
||||
[OK] 9. SubsystemsOrder: 9 entries, all valid format
|
||||
[OK] 10. SubsystemsOrder: no duplicates
|
||||
[OK] 11. GroupsOrder: 7 entries, all valid
|
||||
[OK] 12. GroupsOrder: no duplicates
|
||||
[OK] 13. Command reference format: all valid
|
||||
---
|
||||
Errors: 0, Warnings: 0
|
||||
```
|
||||
|
||||
Код возврата: 0 = все проверки пройдены, 1 = есть ошибки.
|
||||
|
||||
## Примеры
|
||||
|
||||
```powershell
|
||||
# CommandInterface подсистемы
|
||||
... -CIPath upload/acc_8.3.24/Subsystems/Продажи/Ext/CommandInterface.xml
|
||||
|
||||
# Корневой CommandInterface конфигурации
|
||||
... -CIPath upload/acc_8.3.24/Ext/CommandInterface.xml
|
||||
|
||||
# С лимитом ошибок
|
||||
... -CIPath <path> -MaxErrors 10
|
||||
```
|
||||
Exit code: 0 = OK, 1 = есть ошибки. По умолчанию краткий вывод. `-Detailed` для поштучной детализации.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# interface-validate v1.0 — Validate 1C CommandInterface.xml structure
|
||||
# interface-validate v1.1 — Validate 1C CommandInterface.xml structure
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)][string]$CIPath,
|
||||
[switch]$Detailed,
|
||||
[int]$MaxErrors = 30,
|
||||
[string]$OutFile
|
||||
)
|
||||
@@ -33,11 +34,15 @@ if (-not $contextName) { $contextName = "Root" }
|
||||
$script:errors = 0
|
||||
$script:warnings = 0
|
||||
$script:stopped = $false
|
||||
$script:okCount = 0
|
||||
$script:output = New-Object System.Text.StringBuilder 8192
|
||||
$script:allCommandNames = @()
|
||||
|
||||
function Out-Line([string]$msg) { $script:output.AppendLine($msg) | Out-Null }
|
||||
function Report-OK([string]$msg) { Out-Line "[OK] $msg" }
|
||||
function Report-OK([string]$msg) {
|
||||
$script:okCount++
|
||||
if ($Detailed) { Out-Line "[OK] $msg" }
|
||||
}
|
||||
function Report-Error([string]$msg) {
|
||||
$script:errors++
|
||||
Out-Line "[ERROR] $msg"
|
||||
@@ -358,16 +363,20 @@ if (-not $script:stopped) {
|
||||
$shown = $badRefs[0..([Math]::Min(4, $badRefs.Count - 1))]
|
||||
Report-Warn "13. Command reference format: $($badRefs.Count) unrecognized: $($shown -join ', ')$(if($badRefs.Count -gt 5){' ...'})"
|
||||
}
|
||||
} else {
|
||||
Report-OK "13. Command reference format: n/a (no commands)"
|
||||
}
|
||||
}
|
||||
|
||||
# --- Finalize ---
|
||||
Out-Line "---"
|
||||
Out-Line "Errors: $($script:errors), Warnings: $($script:warnings)"
|
||||
$checks = $script:okCount + $script:errors + $script:warnings
|
||||
|
||||
if ($script:errors -eq 0 -and $script:warnings -eq 0 -and -not $Detailed) {
|
||||
$result = "=== Validation OK: CommandInterface ($contextName) ($checks checks) ==="
|
||||
} else {
|
||||
Out-Line ""
|
||||
Out-Line "=== Result: $($script:errors) errors, $($script:warnings) warnings ($checks checks) ==="
|
||||
$result = $script:output.ToString()
|
||||
}
|
||||
|
||||
$result = $script:output.ToString()
|
||||
Write-Host $result
|
||||
|
||||
if ($OutFile) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# interface-validate v1.0 — Validate 1C CommandInterface.xml structure
|
||||
# interface-validate v1.1 — Validate 1C CommandInterface.xml structure
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
"""Validates CommandInterface.xml sections, command references, order, duplicates."""
|
||||
import sys, os, argparse, re
|
||||
@@ -31,18 +31,22 @@ UUID_CMD_PATTERN = re.compile(
|
||||
|
||||
|
||||
class Reporter:
|
||||
def __init__(self, max_errors):
|
||||
def __init__(self, max_errors, detailed=False):
|
||||
self.errors = 0
|
||||
self.warnings = 0
|
||||
self.ok_count = 0
|
||||
self.stopped = False
|
||||
self.max_errors = max_errors
|
||||
self.detailed = detailed
|
||||
self.lines = []
|
||||
|
||||
def out(self, msg=''):
|
||||
self.lines.append(msg)
|
||||
|
||||
def ok(self, msg):
|
||||
self.lines.append(f'[OK] {msg}')
|
||||
self.ok_count += 1
|
||||
if self.detailed:
|
||||
self.lines.append(f'[OK] {msg}')
|
||||
|
||||
def error(self, msg):
|
||||
self.errors += 1
|
||||
@@ -76,11 +80,13 @@ def main():
|
||||
description='Validate 1C CommandInterface.xml structure', allow_abbrev=False
|
||||
)
|
||||
parser.add_argument('-CIPath', dest='CIPath', required=True)
|
||||
parser.add_argument('-Detailed', action='store_true')
|
||||
parser.add_argument('-MaxErrors', dest='MaxErrors', type=int, default=30)
|
||||
parser.add_argument('-OutFile', dest='OutFile', default='')
|
||||
args = parser.parse_args()
|
||||
|
||||
ci_path = args.CIPath
|
||||
detailed = args.Detailed
|
||||
max_errors = args.MaxErrors
|
||||
out_file = args.OutFile
|
||||
|
||||
@@ -103,7 +109,7 @@ def main():
|
||||
if not context_name:
|
||||
context_name = 'Root'
|
||||
|
||||
r = Reporter(max_errors)
|
||||
r = Reporter(max_errors, detailed)
|
||||
all_command_names = []
|
||||
|
||||
r.out(f'=== Validation: CommandInterface ({context_name}) ===')
|
||||
@@ -210,8 +216,7 @@ def main():
|
||||
vis_ok = False
|
||||
if vis_ok:
|
||||
r.ok(f'5. CommandsVisibility: {vis_count} entries, all valid')
|
||||
else:
|
||||
r.ok('5. CommandsVisibility: not present')
|
||||
# CommandsVisibility not present — no check needed
|
||||
|
||||
# --- 6. CommandsVisibility duplicates ---
|
||||
if not r.stopped:
|
||||
@@ -221,8 +226,6 @@ def main():
|
||||
r.warn(f'6. CommandsVisibility: duplicates: {", ".join(dupes)}')
|
||||
else:
|
||||
r.ok('6. CommandsVisibility: no duplicates')
|
||||
else:
|
||||
r.ok('6. CommandsVisibility: no duplicates (empty)')
|
||||
|
||||
# --- 7. CommandsPlacement ---
|
||||
if not r.stopped:
|
||||
@@ -253,8 +256,7 @@ def main():
|
||||
r.warn(f"7. CommandsPlacement[{cmd_name}]: Placement='{(placement_el.text or '').strip()}' (expected Auto)")
|
||||
if plc_ok:
|
||||
r.ok(f'7. CommandsPlacement: {plc_count} entries, all valid')
|
||||
else:
|
||||
r.ok('7. CommandsPlacement: not present')
|
||||
# CommandsPlacement not present — no check needed
|
||||
|
||||
# --- 8. CommandsOrder ---
|
||||
if not r.stopped:
|
||||
@@ -278,8 +280,7 @@ def main():
|
||||
ord_ok = False
|
||||
if ord_ok:
|
||||
r.ok(f'8. CommandsOrder: {ord_count} entries, all valid')
|
||||
else:
|
||||
r.ok('8. CommandsOrder: not present')
|
||||
# CommandsOrder not present — no check needed
|
||||
|
||||
# --- 9. SubsystemsOrder format ---
|
||||
sub_names = []
|
||||
@@ -302,8 +303,7 @@ def main():
|
||||
sub_ok = False
|
||||
if sub_ok:
|
||||
r.ok(f'9. SubsystemsOrder: {sub_count} entries, all valid format')
|
||||
else:
|
||||
r.ok('9. SubsystemsOrder: not present')
|
||||
# SubsystemsOrder not present — no check needed
|
||||
|
||||
# --- 10. SubsystemsOrder duplicates ---
|
||||
if not r.stopped:
|
||||
@@ -313,8 +313,6 @@ def main():
|
||||
r.warn(f'10. SubsystemsOrder: duplicates: {", ".join(dupes)}')
|
||||
else:
|
||||
r.ok('10. SubsystemsOrder: no duplicates')
|
||||
else:
|
||||
r.ok('10. SubsystemsOrder: no duplicates (empty)')
|
||||
|
||||
# --- 11. GroupsOrder entries ---
|
||||
grp_names = []
|
||||
@@ -334,8 +332,7 @@ def main():
|
||||
grp_ok = False
|
||||
if grp_ok:
|
||||
r.ok(f'11. GroupsOrder: {grp_count} entries, all valid')
|
||||
else:
|
||||
r.ok('11. GroupsOrder: not present')
|
||||
# GroupsOrder not present — no check needed
|
||||
|
||||
# --- 12. GroupsOrder duplicates ---
|
||||
if not r.stopped:
|
||||
@@ -345,8 +342,6 @@ def main():
|
||||
r.warn(f'12. GroupsOrder: duplicates: {", ".join(dupes)}')
|
||||
else:
|
||||
r.ok('12. GroupsOrder: no duplicates')
|
||||
else:
|
||||
r.ok('12. GroupsOrder: no duplicates (empty)')
|
||||
|
||||
# --- 13. Command reference format ---
|
||||
if not r.stopped:
|
||||
@@ -368,14 +363,16 @@ def main():
|
||||
shown = bad_refs[:5]
|
||||
suffix = ' ...' if len(bad_refs) > 5 else ''
|
||||
r.warn(f'13. Command reference format: {len(bad_refs)} unrecognized: {", ".join(shown)}{suffix}')
|
||||
else:
|
||||
r.ok('13. Command reference format: n/a (no commands)')
|
||||
|
||||
# --- Finalize ---
|
||||
r.out('---')
|
||||
r.out(f'Errors: {r.errors}, Warnings: {r.warnings}')
|
||||
checks = r.ok_count + r.errors + r.warnings
|
||||
if r.errors == 0 and r.warnings == 0 and not detailed:
|
||||
result = f'=== Validation OK: CommandInterface ({context_name}) ({checks} checks) ==='
|
||||
else:
|
||||
r.out('')
|
||||
r.out(f'=== Result: {r.errors} errors, {r.warnings} warnings ({checks} checks) ===')
|
||||
result = '\r\n'.join(r.lines) + '\r\n'
|
||||
|
||||
result = r.text()
|
||||
print(result, end='')
|
||||
|
||||
if out_file:
|
||||
|
||||
Reference in New Issue
Block a user