mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-13 14:25:17 +03:00
cd3a242b12
Replace literal `.claude/skills/<owner>/...` paths in SKILL.md with the
`${CLAUDE_SKILL_DIR}` variable that Claude Code substitutes at invocation
time. Same-skill references become `${CLAUDE_SKILL_DIR}/<rest>`,
cross-skill references (erf-* → epf-*) become
`${CLAUDE_SKILL_DIR}/../<other>/<rest>`. All paths now wrapped in double
quotes to handle install locations with spaces.
This unblocks plugin-mode installation: literal `.claude/skills/...`
paths fail when the skill is loaded from `~/.claude/plugins/cache/...`
or from a personal `~/.claude/skills/` install. Drop-in mode continues
to work because Claude Code resolves the variable in all install scopes.
Verified via pilot:
- Project drop-in (cc-1c-skills repo)
- Personal `~/.claude/skills/cf-info/`
- Plugin via `/plugin marketplace add <local-path>`
Scope: 61 SKILL.md, 125 path replacements (8 cross-skill).
Scripts unchanged — they already use \$PSScriptRoot and ../<sibling>
patterns that resolve correctly under the bundled cache layout.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4.0 KiB
4.0 KiB
name, description, argument-hint, allowed-tools
| name | description | argument-hint | allowed-tools | |||
|---|---|---|---|---|---|---|
| cfe-patch-method | Генерация перехватчика метода в расширении 1С (CFE). Используй когда нужно перехватить метод заимствованного объекта — вставить код до, после или вместо оригинального | -ExtensionPath <path> -ModulePath "Catalog.X.ObjectModule" -MethodName "ПриЗаписи" -InterceptorType Before |
|
/cfe-patch-method — Генерация перехватчика метода
Генерирует .bsl файл с декоратором перехвата для заимствованного объекта расширения. Создаёт файл или дописывает в существующий.
Предусловие
Объект должен быть заимствован в расширение (/cfe-borrow). Скрипт читает NamePrefix из Configuration.xml расширения для формирования имени процедуры.
Параметры
| Параметр | Описание | По умолчанию |
|---|---|---|
ExtensionPath |
Путь к расширению (обязат.) | — |
ModulePath |
Путь к модулю (обязат.) | — |
MethodName |
Имя перехватываемого метода (обязат.) | — |
InterceptorType |
Before / After / ModificationAndControl (обязат.) |
— |
Context |
Директива контекста | НаСервере |
IsFunction |
Метод — функция (добавит Возврат) |
false |
Формат ModulePath
| ModulePath | Файл |
|---|---|
Catalog.X.ObjectModule |
Catalogs/X/Ext/ObjectModule.bsl |
Catalog.X.ManagerModule |
Catalogs/X/Ext/ManagerModule.bsl |
Catalog.X.Form.Y |
Catalogs/X/Forms/Y/Ext/Form/Module.bsl |
CommonModule.X |
CommonModules/X/Ext/Module.bsl |
Document.X.ObjectModule |
Documents/X/Ext/ObjectModule.bsl |
Document.X.Form.Y |
Documents/X/Forms/Y/Ext/Form/Module.bsl |
Аналогично для Report, DataProcessor, InformationRegister и других типов.
Типы перехвата
| InterceptorType | Декоратор | Назначение |
|---|---|---|
Before |
&Перед |
Код до вызова оригинального метода |
After |
&После |
Код после вызова оригинального метода |
ModificationAndControl |
&ИзменениеИКонтроль |
Копия тела метода с маркерами #Вставка/#Удаление |
Команда
powershell.exe -NoProfile -File "${CLAUDE_SKILL_DIR}/scripts/cfe-patch-method.ps1" -ExtensionPath src -ModulePath "Catalog.Контрагенты.ObjectModule" -MethodName "ПриЗаписи" -InterceptorType Before
Примеры
# Перехват &Перед на сервере
... -ExtensionPath src -ModulePath "Catalog.Контрагенты.ObjectModule" -MethodName "ПриЗаписи" -InterceptorType Before
# Перехват &После на клиенте
... -ExtensionPath src -ModulePath "Document.Заказ.Form.ФормаДокумента" -MethodName "ПослеЗаписиНаСервере" -InterceptorType After -Context "НаКлиенте"
# ИзменениеИКонтроль для функции
... -ExtensionPath src -ModulePath "CommonModule.ОбщийМодуль" -MethodName "ПолучитьДанные" -InterceptorType ModificationAndControl -IsFunction
Генерируемый код (Before)
&НаСервере
&Перед("ПриЗаписи")
Процедура Расш1_ПриЗаписи()
// TODO: код перед вызовом оригинального метода
КонецПроцедуры