mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-08-26 21:19:42 +03:00
Compare commits
3
Commits
d574320849
...
e56a932ee2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e56a932ee2 | ||
|
|
69f5e0b7ae | ||
|
|
84462e3dd9 |
@@ -5110,6 +5110,58 @@ export async function highlight(text, opts = {}) {
|
||||
})()`);
|
||||
}
|
||||
|
||||
// 1b. Command group headers on the function panel (eAccentColor labels).
|
||||
// Match header text, then highlight the header + commands below it
|
||||
// until the next spacer/header/end.
|
||||
if (!elId) {
|
||||
const groupDone = await page.evaluate(({ target, color, padding }) => {
|
||||
const container = document.querySelector('#funcPanel_container');
|
||||
if (!container) return false;
|
||||
const norm = s => (s?.trim().replace(/\u00a0/g, ' ') || '').replace(/ё/gi, 'е').toLowerCase();
|
||||
const headers = [...container.querySelectorAll('.eAccentColor')].filter(e => e.offsetWidth > 0);
|
||||
if (!headers.length) return false;
|
||||
|
||||
let headerEl = headers.find(h => norm(h.textContent) === target);
|
||||
if (!headerEl) headerEl = headers.find(h => norm(h.textContent).startsWith(target));
|
||||
if (!headerEl) headerEl = headers.find(h => norm(h.textContent).includes(target));
|
||||
if (!headerEl) return false;
|
||||
|
||||
// Collect header + following cmd siblings until next spacer/header
|
||||
const parent = headerEl.parentElement;
|
||||
const children = [...parent.children];
|
||||
const startIdx = children.indexOf(headerEl);
|
||||
const groupEls = [headerEl];
|
||||
for (let i = startIdx + 1; i < children.length; i++) {
|
||||
const el = children[i];
|
||||
if (el.classList.contains('eAccentColor')) break;
|
||||
if (!el.id && !el.classList.contains('functionItem') && el.getBoundingClientRect().width < 10) break;
|
||||
groupEls.push(el);
|
||||
}
|
||||
|
||||
// Bounding box
|
||||
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
||||
for (const el of groupEls) {
|
||||
const r = el.getBoundingClientRect();
|
||||
if (r.width === 0 && r.height === 0) continue;
|
||||
minX = Math.min(minX, r.left); minY = Math.min(minY, r.top);
|
||||
maxX = Math.max(maxX, r.right); maxY = Math.max(maxY, r.bottom);
|
||||
}
|
||||
if (minX === Infinity) return false;
|
||||
|
||||
let div = document.getElementById('__web_test_highlight');
|
||||
if (!div) { div = document.createElement('div'); div.id = '__web_test_highlight'; document.body.appendChild(div); }
|
||||
div.style.cssText = [
|
||||
'position:fixed', 'pointer-events:none', 'z-index:999998',
|
||||
`top:${minY - padding}px`, `left:${minX - padding}px`,
|
||||
`width:${maxX - minX + padding * 2}px`, `height:${maxY - minY + padding * 2}px`,
|
||||
`outline:3px solid ${color}`, 'border-radius:4px',
|
||||
`box-shadow:0 0 16px ${color}80`,
|
||||
].join(';');
|
||||
return true;
|
||||
}, { target: normYo(text.toLowerCase()), color, padding });
|
||||
if (groupDone) return;
|
||||
}
|
||||
|
||||
// 2. Form groups/panels — checked BEFORE buttons/fields because group names
|
||||
// often collide with command bar buttons (e.g. "БизнесПроцессы" is both a
|
||||
// panel and a command bar element). Includes _container and _div elements
|
||||
@@ -5212,6 +5264,12 @@ export async function highlight(text, opts = {}) {
|
||||
// Commands
|
||||
const cmds = [...document.querySelectorAll('[id^="cmd_"][id$="_txt"]')].filter(e => e.offsetWidth > 0).map(e => norm(e.innerText));
|
||||
if (cmds.length) result.commands = cmds;
|
||||
// Command group headers
|
||||
const fp = document.querySelector('#funcPanel_container');
|
||||
if (fp) {
|
||||
const gh = [...fp.querySelectorAll('.eAccentColor')].filter(e => e.offsetWidth > 0).map(e => norm(e.textContent));
|
||||
if (gh.length) result.commandGroups = gh;
|
||||
}
|
||||
// Sections
|
||||
const secs = [...document.querySelectorAll('[id^="themesCell_theme_"]')].map(e => norm(e.innerText)).filter(Boolean);
|
||||
if (secs.length) result.sections = secs;
|
||||
|
||||
@@ -8,9 +8,7 @@
|
||||
|
||||
## Быстрый старт
|
||||
|
||||
Скопируйте каталог `.claude/skills/` в корень вашего проекта — или создайте ссылки на папки навыков из склонированного репозитория. Навыки станут доступны при запуске Claude Code из этого каталога.
|
||||
|
||||
Скопируйте каталог `.claude/skills/` из этого репозитория в корень вашего проекта:
|
||||
Скопируйте каталог `.claude/skills/` из этого репозитория в корень вашего проекта. Навыки станут доступны при запуске Claude Code из этого каталога.
|
||||
|
||||
```
|
||||
МойПроект/
|
||||
@@ -23,12 +21,12 @@
|
||||
```bash
|
||||
git clone https://github.com/Nikolay-Shirokov/cc-1c-skills.git tools/cc-1c-skills
|
||||
|
||||
# Ссылки (рекомендуется): обновления подхватываются через git pull
|
||||
python tools/cc-1c-skills/scripts/switch.py claude-code --project-dir . --link
|
||||
|
||||
# Копия: независимая копия, обновление — повторный запуск
|
||||
# Копия (рекомендуется): независимая копия, обновление — повторный запуск
|
||||
python tools/cc-1c-skills/scripts/switch.py claude-code --project-dir .
|
||||
|
||||
# Ссылки (экспериментально): обновления подхватываются через git pull
|
||||
python tools/cc-1c-skills/scripts/switch.py claude-code --project-dir . --link
|
||||
|
||||
# Интерактивный режим: пошаговый выбор платформы, способа установки и рантайма
|
||||
python tools/cc-1c-skills/scripts/switch.py
|
||||
```
|
||||
@@ -78,7 +76,9 @@ python scripts/switch.py --undo cursor # удалить
|
||||
|
||||
Если репозиторий склонирован внутрь проекта (например, в `tools/cc-1c-skills`), используйте `--project-dir` для установки навыков в целевой проект.
|
||||
|
||||
**Ссылки vs копии.** Флаг `--link` создаёт directory junction (Windows) или symlink (Linux/Mac) вместо копирования файлов. Обновления в источнике автоматически подхватываются во всех подключённых проектах — достаточно `git pull`. Ссылки доступны только для платформы Claude Code (для остальных платформ требуется перезапись путей в SKILL.md). Удаление ссылок: `--undo` — безопасно удаляет только ссылки, не трогая источник.
|
||||
**Ссылки vs копии.** Флаг `--link` (экспериментальный) создаёт directory junction (Windows) или symlink (Linux/Mac) вместо копирования файлов. Обновления в источнике автоматически подхватываются во всех подключённых проектах — достаточно `git pull`. Ссылки доступны только для платформы Claude Code (для остальных платформ требуется перезапись путей в SKILL.md). Удаление ссылок: `--undo` — безопасно удаляет только ссылки, не трогая источник.
|
||||
|
||||
> ⚠ **Известные ограничения `--link`:** Node.js резолвит `__dirname` через junction к реальному пути источника, а не к каталогу проекта. Это может приводить к тому, что навыки с Node.js-скриптами (например, `/web-test`) будут записывать файлы в каталог репозитория навыков вместо каталога проекта. При возникновении проблем переключитесь на копирование (без `--link`).
|
||||
|
||||
Поддерживаемые платформы:
|
||||
|
||||
|
||||
+4
-2
@@ -390,6 +390,8 @@ def cmd_link(platform, project_dir):
|
||||
print(f"\nГотово! {linked} навыков подключено через {link_type} "
|
||||
f"в {target_prefix}/")
|
||||
print("Обновления в источнике автоматически подхватятся.")
|
||||
print("⚠ Режим --link экспериментальный. При ошибках запуска "
|
||||
"скриптов переключитесь на копирование (без --link).")
|
||||
print_gitignore_recommendations(project_dir)
|
||||
print(f"\nДля удаления: python scripts/switch.py --undo claude-code"
|
||||
f" --project-dir \"{project_dir}\"")
|
||||
@@ -636,8 +638,8 @@ def main():
|
||||
parser.add_argument('--project-dir', default=os.getcwd(),
|
||||
help='путь к целевому проекту (по умолчанию: текущий каталог)')
|
||||
parser.add_argument('--link', action='store_true',
|
||||
help='создать ссылки (junction/symlink) вместо копирования '
|
||||
'(только для claude-code)')
|
||||
help='[экспериментально] создать ссылки (junction/symlink) '
|
||||
'вместо копирования (только для claude-code)')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user