mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-02 09:47:45 +03:00
fix(skd-compile): object-form structure, OrGroup string items, useRestriction alias
- Default structure item type to 'group' when omitted; accept groupFields as alias for groupBy
- Parse string shorthand items inside OrGroup/AndGroup/NotGroup filter recursion
- Accept useRestriction key (object form { field: true }) alongside restrict array
- Deduplicate SelectedItemAuto in skd-edit add-selection
- Update SKILL.md with object structure and useRestriction docs
- Add test cases for all 4 fixes
skd-compile v1.9→v1.10, skd-edit v1.8→v1.9
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
46e065adb9
commit
384e68cab4
@@ -1,4 +1,4 @@
|
||||
# skd-edit v1.8 — Atomic 1C DCS editor
|
||||
# skd-edit v1.9 — Atomic 1C DCS editor
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
@@ -1924,6 +1924,23 @@ switch ($Operation) {
|
||||
}
|
||||
|
||||
$selection = Ensure-SettingsChild $targetEl "selection" @()
|
||||
|
||||
# Dedup: skip if SelectedItemAuto already exists
|
||||
if ($fieldName -eq "Auto") {
|
||||
$isDup = $false
|
||||
foreach ($ch in $selection.ChildNodes) {
|
||||
if ($ch.NodeType -eq 'Element' -and $ch.LocalName -eq 'item') {
|
||||
$typeAttr = $ch.GetAttribute("type", "http://www.w3.org/2001/XMLSchema-instance")
|
||||
if ($typeAttr -and $typeAttr.Contains("SelectedItemAuto")) { $isDup = $true; break }
|
||||
}
|
||||
}
|
||||
if ($isDup) {
|
||||
$target = if ($groupName) { "group `"$groupName`"" } else { "variant `"$varName`"" }
|
||||
Write-Host "[WARN] SelectedItemAuto already exists in $target — skipped"
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
$selIndent = Get-ContainerChildIndent $selection
|
||||
|
||||
$selXml = Build-SelectionItemFragment -fieldName $fieldName -indent $selIndent
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# skd-edit v1.8 — Atomic 1C DCS editor (Python port)
|
||||
# skd-edit v1.9 — Atomic 1C DCS editor (Python port)
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
import argparse
|
||||
import os
|
||||
@@ -1642,6 +1642,21 @@ elif operation == "add-selection":
|
||||
target_el = settings
|
||||
|
||||
selection = ensure_settings_child(target_el, "selection", [])
|
||||
|
||||
# Dedup: skip if SelectedItemAuto already exists
|
||||
if field_name == "Auto":
|
||||
is_dup = False
|
||||
for ch in selection:
|
||||
if isinstance(ch.tag, str) and local_name(ch) == "item":
|
||||
type_attr = ch.get(XSI_TYPE, "")
|
||||
if "SelectedItemAuto" in type_attr:
|
||||
is_dup = True
|
||||
break
|
||||
if is_dup:
|
||||
target = f'group "{group_name}"' if group_name else f'variant "{var_name}"'
|
||||
print(f'[WARN] SelectedItemAuto already exists in {target} -- skipped')
|
||||
continue
|
||||
|
||||
sel_indent = get_container_child_indent(selection)
|
||||
sel_xml = build_selection_item_fragment(field_name, sel_indent)
|
||||
sel_nodes = import_fragment(xml_doc, sel_xml)
|
||||
|
||||
Reference in New Issue
Block a user