diff --git a/.claude/skills/cfe-borrow/scripts/cfe-borrow.ps1 b/.claude/skills/cfe-borrow/scripts/cfe-borrow.ps1 index a64ec15b..22a6cff2 100644 --- a/.claude/skills/cfe-borrow/scripts/cfe-borrow.ps1 +++ b/.claude/skills/cfe-borrow/scripts/cfe-borrow.ps1 @@ -500,12 +500,12 @@ function Borrow-Form { # Get OuterXml and strip redundant namespace redeclarations (they're on root
) $nsStripPattern = '\s+xmlns(?::\w+)?="[^"]*"' - # AutoCommandBar: strip ChildItems (buttons), replace CommandName→0, Autofill→false + # AutoCommandBar: keep ChildItems (buttons with CommandName→0), Autofill→false $autoCmdXml = "" if ($srcAutoCmd) { $autoCmdXml = $srcAutoCmd.OuterXml $autoCmdXml = [regex]::Replace($autoCmdXml, $nsStripPattern, '') - $autoCmdXml = [regex]::Replace($autoCmdXml, '(?s)\s*.*?', '') + $autoCmdXml = [regex]::Replace($autoCmdXml, '[^<]*', '0') $autoCmdXml = $autoCmdXml -replace 'true', 'false' } diff --git a/.claude/skills/cfe-borrow/scripts/cfe-borrow.py b/.claude/skills/cfe-borrow/scripts/cfe-borrow.py index dca7c817..4c082d2e 100644 --- a/.claude/skills/cfe-borrow/scripts/cfe-borrow.py +++ b/.claude/skills/cfe-borrow/scripts/cfe-borrow.py @@ -671,12 +671,12 @@ def main(): ns_strip_pattern = re.compile(r'\s+xmlns(?::\w+)?="[^"]*"') - # AutoCommandBar: strip ChildItems (buttons), replace CommandName→0, Autofill→false + # AutoCommandBar: keep ChildItems (buttons with CommandName→0), Autofill→false auto_cmd_xml = "" if src_auto_cmd is not None: auto_cmd_xml = etree.tostring(src_auto_cmd, encoding="unicode") auto_cmd_xml = ns_strip_pattern.sub("", auto_cmd_xml) - auto_cmd_xml = re.sub(r'\s*.*?', '', auto_cmd_xml, flags=re.DOTALL) + auto_cmd_xml = re.sub(r'[^<]*', '0', auto_cmd_xml) auto_cmd_xml = auto_cmd_xml.replace('true', 'false') # ChildItems: copy full tree, clean up base-config references diff --git a/.claude/skills/cfe-patch-method/scripts/cfe-patch-method.py b/.claude/skills/cfe-patch-method/scripts/cfe-patch-method.py index 5901693e..490fb938 100644 --- a/.claude/skills/cfe-patch-method/scripts/cfe-patch-method.py +++ b/.claude/skills/cfe-patch-method/scripts/cfe-patch-method.py @@ -205,7 +205,7 @@ def main(): if os.path.isfile(bsl_file): # Append to existing file - with open(bsl_file, "r", encoding="utf-8-sig") as f: + with open(bsl_file, "r", encoding="utf-8-sig", newline="") as f: existing = f.read() separator = "\r\n" @@ -213,11 +213,11 @@ def main(): separator = "\r\n\r\n" new_content = existing + separator + bsl_text - with open(bsl_file, "w", encoding="utf-8-sig") as f: + with open(bsl_file, "w", encoding="utf-8-sig", newline="") as f: f.write(new_content) print("[OK] \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0447\u0438\u043a \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0444\u0430\u0439\u043b") # Добавлен перехватчик в существующий файл else: - with open(bsl_file, "w", encoding="utf-8-sig") as f: + with open(bsl_file, "w", encoding="utf-8-sig", newline="") as f: f.write(bsl_text) print("[OK] \u0421\u043e\u0437\u0434\u0430\u043d \u0444\u0430\u0439\u043b \u043c\u043e\u0434\u0443\u043b\u044f") # Создан файл модуля diff --git a/.claude/skills/form-edit/scripts/form-edit.ps1 b/.claude/skills/form-edit/scripts/form-edit.ps1 index 12b4d053..e80afe6e 100644 --- a/.claude/skills/form-edit/scripts/form-edit.ps1 +++ b/.claude/skills/form-edit/scripts/form-edit.ps1 @@ -1078,11 +1078,18 @@ if ($def.formEvents -and $def.formEvents.Count -gt 0) { $eventsSection = $xmlDoc.CreateElement("Events", $formNs) $insertAfter = $root.SelectSingleNode("f:AutoCommandBar", $nsMgr) if ($insertAfter) { - $refNode = $insertAfter - $ws = $xmlDoc.CreateWhitespace("`r`n`t") - # Insert before the AutoCommandBar (Events come before AutoCommandBar in 1C) - $root.InsertBefore($ws, $refNode) | Out-Null - $root.InsertBefore($eventsSection, $refNode) | Out-Null + # Insert after AutoCommandBar (Events come after AutoCommandBar in 1C) + $ws1 = $xmlDoc.CreateWhitespace("`r`n`t") + $ws2 = $xmlDoc.CreateWhitespace("`r`n`t") + if ($insertAfter.NextSibling) { + $root.InsertBefore($ws1, $insertAfter.NextSibling) | Out-Null + $root.InsertBefore($eventsSection, $ws1) | Out-Null + $root.InsertBefore($ws2, $eventsSection) | Out-Null + } else { + $root.AppendChild($xmlDoc.CreateWhitespace("`r`n`t")) | Out-Null + $root.AppendChild($eventsSection) | Out-Null + $root.AppendChild($xmlDoc.CreateWhitespace("`r`n")) | Out-Null + } } else { $firstChild = $root.FirstChild if ($firstChild) { diff --git a/.claude/skills/form-edit/scripts/form-edit.py b/.claude/skills/form-edit/scripts/form-edit.py index a9e3cd24..4aced255 100644 --- a/.claude/skills/form-edit/scripts/form-edit.py +++ b/.claude/skills/form-edit/scripts/form-edit.py @@ -1162,7 +1162,15 @@ form_events_list = defn.get("formEvents") or [] if form_events_list: events_section = root.find("f:Events", NS) if events_section is None: - events_section = etree.SubElement(root, f"{{{FORM_NS}}}Events") + events_section = etree.Element(f"{{{FORM_NS}}}Events") + # Insert after AutoCommandBar (Events come after AutoCommandBar in 1C) + acb_node = root.find("f:AutoCommandBar", NS) + if acb_node is not None: + acb_idx = list(root).index(acb_node) + acb_node.tail = (acb_node.tail or "") + "\r\n\t" + root.insert(acb_idx + 1, events_section) + else: + root.append(events_section) evt_child_indent = get_child_indent(events_section) if not evt_child_indent: