mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-29 16:11:01 +03:00
feat(cf-edit): set-panels принимает русские имена панелей silently
cf-info отображает «Открытых», «Разделов», «Избранного», «История», «Функций» (совпадает с подписями Конфигуратора). Если модель копирует эти названия в set-panels value — теперь они тихо мапятся в каноничные английские алиасы. Документация и сообщения об ошибках упоминают только английские формы. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
336dade274
commit
bd3b40852a
@@ -1,4 +1,4 @@
|
|||||||
# cf-edit v1.2 — Edit 1C configuration root (Configuration.xml)
|
# cf-edit v1.3 — Edit 1C configuration root (Configuration.xml)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory)][Alias('Path')][string]$ConfigPath,
|
[Parameter(Mandatory)][Alias('Path')][string]$ConfigPath,
|
||||||
@@ -445,6 +445,7 @@ function Do-RemoveDefaultRole([string]$batchVal) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# --- Operation: set-panels ---
|
# --- Operation: set-panels ---
|
||||||
|
# Canonical English aliases — preferred form, used in docs and error messages.
|
||||||
$script:panelUuids = @{
|
$script:panelUuids = @{
|
||||||
"sections" = "b553047f-c9aa-4157-978d-448ecad24248"
|
"sections" = "b553047f-c9aa-4157-978d-448ecad24248"
|
||||||
"open" = "cbab57f2-a0f3-4f0a-89ea-4cb19570ab75"
|
"open" = "cbab57f2-a0f3-4f0a-89ea-4cb19570ab75"
|
||||||
@@ -452,15 +453,26 @@ $script:panelUuids = @{
|
|||||||
"history" = "c933ac92-92cd-459d-81cc-e0c8a83ced99"
|
"history" = "c933ac92-92cd-459d-81cc-e0c8a83ced99"
|
||||||
"functions" = "b2735bd3-d822-4430-ba59-c9e869693b24"
|
"functions" = "b2735bd3-d822-4430-ba59-c9e869693b24"
|
||||||
}
|
}
|
||||||
|
# Russian synonyms — silently accepted (cf-info displays Russian names; users
|
||||||
|
# may copy them straight into cf-edit value).
|
||||||
|
$script:panelSynonyms = @{
|
||||||
|
"разделов" = "sections"; "разделы" = "sections"
|
||||||
|
"открытых" = "open"; "открытые" = "open"
|
||||||
|
"избранного" = "favorites";"избранное" = "favorites"
|
||||||
|
"истории" = "history"; "история" = "history"
|
||||||
|
"функций" = "functions";"функции" = "functions"
|
||||||
|
}
|
||||||
|
|
||||||
function Build-PanelEntryXml($entry, [string]$indent) {
|
function Build-PanelEntryXml($entry, [string]$indent) {
|
||||||
# String alias -> <panel><uuid>...</uuid></panel>
|
# String alias -> <panel><uuid>...</uuid></panel>
|
||||||
if ($entry -is [string]) {
|
if ($entry -is [string]) {
|
||||||
if (-not $script:panelUuids.ContainsKey($entry)) {
|
$key = $entry.ToLowerInvariant()
|
||||||
|
if ($script:panelSynonyms.ContainsKey($key)) { $key = $script:panelSynonyms[$key] }
|
||||||
|
if (-not $script:panelUuids.ContainsKey($key)) {
|
||||||
Write-Error "Unknown panel alias '$entry'. Allowed: $(($script:panelUuids.Keys | Sort-Object) -join ', ')"
|
Write-Error "Unknown panel alias '$entry'. Allowed: $(($script:panelUuids.Keys | Sort-Object) -join ', ')"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
$u = $script:panelUuids[$entry]
|
$u = $script:panelUuids[$key]
|
||||||
$instId = [guid]::NewGuid().ToString()
|
$instId = [guid]::NewGuid().ToString()
|
||||||
return "$indent<panel id=`"$instId`">`r`n$indent`t<uuid>$u</uuid>`r`n$indent</panel>"
|
return "$indent<panel id=`"$instId`">`r`n$indent`t<uuid>$u</uuid>`r`n$indent</panel>"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# cf-edit v1.2 — Edit 1C configuration root (Configuration.xml)
|
# cf-edit v1.3 — Edit 1C configuration root (Configuration.xml)
|
||||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
@@ -495,6 +495,7 @@ def main():
|
|||||||
info(f"Set DefaultRoles: {len(items)} roles")
|
info(f"Set DefaultRoles: {len(items)} roles")
|
||||||
|
|
||||||
# --- set-panels (writes Ext/ClientApplicationInterface.xml from scratch) ---
|
# --- set-panels (writes Ext/ClientApplicationInterface.xml from scratch) ---
|
||||||
|
# Canonical English aliases — preferred form, used in docs and error messages.
|
||||||
PANEL_UUIDS = {
|
PANEL_UUIDS = {
|
||||||
"sections": "b553047f-c9aa-4157-978d-448ecad24248",
|
"sections": "b553047f-c9aa-4157-978d-448ecad24248",
|
||||||
"open": "cbab57f2-a0f3-4f0a-89ea-4cb19570ab75",
|
"open": "cbab57f2-a0f3-4f0a-89ea-4cb19570ab75",
|
||||||
@@ -502,15 +503,26 @@ def main():
|
|||||||
"history": "c933ac92-92cd-459d-81cc-e0c8a83ced99",
|
"history": "c933ac92-92cd-459d-81cc-e0c8a83ced99",
|
||||||
"functions": "b2735bd3-d822-4430-ba59-c9e869693b24",
|
"functions": "b2735bd3-d822-4430-ba59-c9e869693b24",
|
||||||
}
|
}
|
||||||
|
# Russian synonyms — silently accepted (cf-info displays Russian names;
|
||||||
|
# users may copy them straight into cf-edit value).
|
||||||
|
PANEL_SYNONYMS = {
|
||||||
|
"разделов": "sections", "разделы": "sections",
|
||||||
|
"открытых": "open", "открытые": "open",
|
||||||
|
"избранного": "favorites","избранное": "favorites",
|
||||||
|
"истории": "history", "история": "history",
|
||||||
|
"функций": "functions", "функции": "functions",
|
||||||
|
}
|
||||||
|
|
||||||
def build_panel_entry_xml(entry, indent):
|
def build_panel_entry_xml(entry, indent):
|
||||||
if isinstance(entry, str):
|
if isinstance(entry, str):
|
||||||
if entry not in PANEL_UUIDS:
|
key = entry.lower()
|
||||||
|
key = PANEL_SYNONYMS.get(key, key)
|
||||||
|
if key not in PANEL_UUIDS:
|
||||||
allowed = ", ".join(sorted(PANEL_UUIDS.keys()))
|
allowed = ", ".join(sorted(PANEL_UUIDS.keys()))
|
||||||
print(f"Unknown panel alias '{entry}'. Allowed: {allowed}", file=sys.stderr)
|
print(f"Unknown panel alias '{entry}'. Allowed: {allowed}", file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
inst = str(_uuid.uuid4())
|
inst = str(_uuid.uuid4())
|
||||||
return f'{indent}<panel id="{inst}">\r\n{indent}\t<uuid>{PANEL_UUIDS[entry]}</uuid>\r\n{indent}</panel>'
|
return f'{indent}<panel id="{inst}">\r\n{indent}\t<uuid>{PANEL_UUIDS[key]}</uuid>\r\n{indent}</panel>'
|
||||||
if isinstance(entry, dict) and "group" in entry:
|
if isinstance(entry, dict) and "group" in entry:
|
||||||
children = entry["group"]
|
children = entry["group"]
|
||||||
if not children:
|
if not children:
|
||||||
|
|||||||
Reference in New Issue
Block a user