SuperAPI AI Directory

cfe-borrow

General & other

View repository

Updated 10-15 21:33

About this skill

/cfe-borrow — Borrowing objects from the configuration

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:

  1. Read .v8-project.json from the project root
  2. Resolve the target base (by name, branch, or default — algorithm from /db-list)
  3. If the base has a field configSrc — use as -ConfigPath
  4. If configSrc is 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.Контрагенты — catalog
  • CommonModule.РаботаСФайлами — common module
  • Document.РеализацияТоваров — document
  • Enum.ВидыОплат — enumeration
  • Catalog.Контрагенты.Form.ФормаЭлемента — object form (form borrowing)
  • CommonForm.ВыборПериода — common form, together with contents (like an object form). With -BorrowMainAttribute the owner is taken from the type of the main attribute: object (DataProcessorObject.X etc.), the main table of a dynamic list, or constants of a constants set
  • Catalog.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:

  1. Form metadata — Forms/ИмяФормы.xml с ObjectBelonging=Adopted, FormType=Managed
  2. Form.xml — Forms/ИмяФормы/Ext/Form.xml with a copy of the source form + <BaseForm> (initial state)
  3. Module.bsl — empty file Forms/ИмяФормы/Ext/Form/Module.bsl
  4. 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 cases
  • All — 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):

  1. /cfe-borrow с -BorrowMainAttribute — borrow the form with attributes
  2. /meta-edit — add a new attribute to the extension object
  3. /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.