mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-06-11 16:34:57 +03:00
meta-edit v1.3: positional TS-attr insert, modify-ts, JSON combo example
- add-ts-attribute now respects >> after / << before positioning - Add modify-ts inline operation for TS properties (synonym, fillChecking, etc.) - Add JSON combo example (create + edit TS in one definition) to SKILL.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: meta-edit
|
||||
description: Точечное редактирование объекта метаданных 1С (добавление/удаление/модификация реквизитов, реквизитов внутри ТЧ, ТЧ, измерений, ресурсов, значений перечислений, свойств объекта, владельцев, движений, ввода по строке)
|
||||
description: Точечное редактирование объекта метаданных 1С (добавление/удаление/модификация реквизитов, реквизитов внутри ТЧ, свойств ТЧ, ТЧ, измерений, ресурсов, значений перечислений, свойств объекта, владельцев, движений, ввода по строке)
|
||||
argument-hint: <ObjectPath> -Operation <op> -Value "<val>" | -DefinitionFile <json> [-NoValidate]
|
||||
allowed-tools:
|
||||
- Bash
|
||||
@@ -89,6 +89,22 @@ Shorthand-формат: `Имя: Тип | флаги`
|
||||
|
||||
Batch через `;;` — можно указать разные ТЧ: `"Товары.А: Строка(50) ;; Услуги.Б: Число(10)"`.
|
||||
|
||||
Позиционная вставка в ТЧ: `>> after` / `<< before` работает так же, как и для обычных реквизитов:
|
||||
```powershell
|
||||
-Operation add-ts-attribute -Value "Товары.Скидка: Число(15,2) >> after Цена"
|
||||
```
|
||||
|
||||
### modify-ts
|
||||
|
||||
Изменение свойств **самой табличной части** (Synonym, FillChecking, Use и др.):
|
||||
|
||||
```powershell
|
||||
-Operation modify-ts -Value "Товары: synonym=Товарный состав"
|
||||
-Operation modify-ts -Value "Товары: fillChecking=ShowError"
|
||||
```
|
||||
|
||||
Формат аналогичен `modify-attribute`: `ИмяТЧ: ключ=значение, ключ=значение`.
|
||||
|
||||
### add-enumValue / add-form / add-template / add-command
|
||||
|
||||
Просто имена (batch через `;;`):
|
||||
@@ -227,6 +243,21 @@ Batch через `;;` — можно указать разные ТЧ: `"Тов
|
||||
|
||||
Все три операции можно указать в одном JSON-файле. Для сложных сценариев (ТЧ с реквизитами + удаление + модификация) используйте JSON DSL.
|
||||
|
||||
Пример: создать новую ТЧ и одновременно отредактировать реквизиты существующей ТЧ:
|
||||
```json
|
||||
{
|
||||
"add": { "tabularSections": [{ "name": "НоваяТЧ", "attrs": ["Имя: Строка(100)"] }] },
|
||||
"modify": {
|
||||
"tabularSections": {
|
||||
"СуществующаяТЧ": {
|
||||
"add": ["НовыйРекв: Число(15,2)"],
|
||||
"remove": ["СтарыйРекв"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Синонимы ключей (case-insensitive)
|
||||
|
||||
**Операции:** `add`/`добавить`, `remove`/`удалить`, `modify`/`изменить`
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# meta-edit v1.2 — Edit existing 1C metadata object XML (inline mode + complex properties + TS attribute ops)
|
||||
# meta-edit v1.3 — Edit existing 1C metadata object XML (inline mode + complex properties + TS attribute ops + modify-ts)
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[string]$DefinitionFile,
|
||||
@@ -14,7 +14,7 @@ param(
|
||||
"remove-attribute", "remove-ts", "remove-dimension", "remove-resource",
|
||||
"remove-enumValue", "remove-column", "remove-form", "remove-template", "remove-command",
|
||||
"remove-owner", "remove-registerRecord", "remove-basedOn", "remove-inputByString",
|
||||
"add-ts-attribute", "remove-ts-attribute", "modify-ts-attribute",
|
||||
"add-ts-attribute", "remove-ts-attribute", "modify-ts-attribute", "modify-ts",
|
||||
"modify-attribute", "modify-dimension", "modify-resource",
|
||||
"modify-enumValue", "modify-column",
|
||||
"modify-property",
|
||||
@@ -1818,8 +1818,12 @@ function Modify-ChildElements($modifyDef, [string]$childType) {
|
||||
$tsAttrIndent = Get-ChildIndent $tsChildObjEl
|
||||
$fragmentXml = Build-AttributeFragment $parsed "tabular" $tsAttrIndent
|
||||
$nodes = Import-Fragment $fragmentXml
|
||||
$savedCO = $script:childObjectsEl
|
||||
$script:childObjectsEl = $tsChildObjEl
|
||||
$refNode = Find-InsertionPoint "Attribute" $parsed
|
||||
$script:childObjectsEl = $savedCO
|
||||
foreach ($node in $nodes) {
|
||||
Insert-BeforeElement $tsChildObjEl $node $null $tsAttrIndent
|
||||
Insert-BeforeElement $tsChildObjEl $node $refNode $tsAttrIndent
|
||||
}
|
||||
Info "Added attribute to TS '$elemName': $($parsed.name)"
|
||||
$script:addCount++
|
||||
|
||||
Reference in New Issue
Block a user