Borrows objects from the main configuration into the extension. Creates XML files with ObjectBelonging=Adopted и ExtendedConfigurationObject, adds an entry to the extension's ChildObjects.
Precondition
The extension must be created (/cfe-init) and contain a valid Configuration.xml.
Auto-detection of ConfigPath
If the user did not specify -ConfigPath — try to determine automatically:
- Read
.v8-project.jsonfrom the project root - Resolve the target base (by name, branch, or
default— algorithm from/db-list) - If the base has a field
configSrc— use as-ConfigPath - If
configSrcis absent — ask the user
Parameters
| Parameter | Description |
|---|---|
ExtensionPath |
Path to the extension directory (required) |
ConfigPath |
Path to the source configuration (required) |
Object |
What to borrow (required), batch via ;; |
Module |
Create empty object modules: ObjectModule, ManagerModule, RecordSetModule, ValueManagerModule (comma-separated) or None. For types with a single module (CommonModule, HTTPService, WebService) it is created even without the parameter |
BorrowMainAttribute |
Borrow the main form attribute: Form — attributes used on the form, All — all object attributes. Not specified — does not borrow. Requires a form in -Object |
Format of -Object
Catalog.Контрагенты— catalogCommonModule.РаботаСФайлами— common moduleDocument.РеализацияТоваров— documentEnum.ВидыОплат— enumerationCatalog.Контрагенты.Form.ФормаЭлемента— object form (form borrowing)CommonForm.ВыборПериода— common form, together with contents (like an object form). With-BorrowMainAttributethe owner is taken from the type of the main attribute: object (DataProcessorObject.Xetc.), the main table of a dynamic list, or constants of a constants setCatalog.X ;; CommonModule.Y ;; Enum.Z— multiple objects
Borrowing forms
Format Тип.Имя.Form.ИмяФормы borrows the form of a specific object. If the parent object has not yet been borrowed, it will be borrowed automatically.
Created:
- Form metadata —
Forms/ИмяФормы.xmlсObjectBelonging=Adopted,FormType=Managed - Form.xml —
Forms/ИмяФормы/Ext/Form.xmlwith a copy of the source form +<BaseForm>(initial state) - Module.bsl — empty file
Forms/ИмяФормы/Ext/Form/Module.bsl - Registration —
<Form>in ChildObjects of the parent object
Borrowing the main form attribute (-BorrowMainAttribute)
When needed: the user wants to add a new attribute to an existing configuration object and display it on a borrowed form. Without -BorrowMainAttribute the form is borrowed "empty" — only visual elements, without binding to object data. With -BorrowMainAttribute the form preserves bindings to object attributes (DataPath), which allows then adding new elements to it via /form-edit.
Two modes:
Form— borrows only those object attributes that are already displayed on the form. The optimal choice for most casesAll— borrows all attributes and tabular sections of the object. Use if you plan to display attributes on the form that are not yet on it
Typical scenario (adding an attribute + displaying on the form):
/cfe-borrowс-BorrowMainAttribute— borrow the form with attributes/meta-edit— add a new attribute to the extension object/form-edit— display the attribute on the borrowed form
Protection of existing data: an already borrowed object is not overwritten — only what is missing is added. Repeated invocation is safe: the extension's own attributes, borrowed subordinate objects, and code in modules are preserved.
Command
powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/cfe-borrow.ps1" -ExtensionPath src\cfe\extname -ConfigPath src\cf -Object "Catalog.Контрагенты"
Examples
# Заимствовать один объект
... -ExtensionPath src\cfe\extname -ConfigPath src\cf -Object "Catalog.Контрагенты"
# Заимствовать справочник вместе с модулями объекта и менеджера
... -ExtensionPath src\cfe\extname -ConfigPath src\cf -Object "Catalog.Контрагенты" -Module ObjectModule,ManagerModule
# Общий модуль без файла модуля
... -ExtensionPath src\cfe\extname -ConfigPath src\cf -Object "CommonModule.РаботаСФайлами" -Module None
# Заимствовать форму (автоматически заимствует родительский объект)
... -ExtensionPath src\cfe\extname -ConfigPath src\cf -Object "Catalog.Контрагенты.Form.ФормаЭлемента"
# Несколько объектов за раз
... -ExtensionPath src\cfe\extname -ConfigPath src\cf -Object "Catalog.Контрагенты ;; CommonModule.ОбщийМодуль ;; Enum.ВидыОплат"
# Заимствовать форму с основным реквизитом (реквизиты по DataPath формы)
... -ExtensionPath src\cfe\extname -ConfigPath src\cf -Object "Catalog.Номенклатура.Form.ФормаЭлемента" -BorrowMainAttribute Form
# Заимствовать форму с ВСЕМИ реквизитами объекта
... -ExtensionPath src\cfe\extname -ConfigPath src\cf -Object "Catalog.Номенклатура.Form.ФормаЭлемента" -BorrowMainAttribute All
Verification
/cfe-validate <ExtensionPath> -ConfigPath <ConfigPath>
Pass the source configuration to the validator as well: it checks borrowed forms against it.