mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-06 11:18:56 +03:00
chore(repo): нормализация EOL к LF + .gitattributes
Приводим авторский контент (.ps1/.psm1/.py/.mjs/.md/.json, пин .bsl) к единому LF и закрепляем политикой в .gitattributes. Инструмент правки всегда пишет LF, поэтому единый LF убирает EOL-шум в диффах, ложные срабатывания blame и налог на ручную синхронизацию CRLF-файлов. BOM на .ps1 сохранён (git с eol=lf меняет только CR<->LF, BOM не трогает). Данные 1С (*.xml) и бинарники под нормализацию не берём. Гейт: PS-порт 459/459, Python-порт 459/459, web-test E2E 22/22 (с пересборкой стенда). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+56
-56
@@ -1,56 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
# switch-to-python v1.1 — Switch skill .md files to use Python scripts
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
"""Replaces powershell.exe invocations with python in all .md files under .claude/skills/."""
|
||||
import os, re, glob, sys
|
||||
|
||||
def main():
|
||||
print("Совет: используйте 'python scripts/switch.py --runtime python' (новый интерфейс)\n")
|
||||
repo_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
skills_dir = os.path.join(repo_root, '.claude', 'skills')
|
||||
|
||||
# Collect all .md files in skill directories (SKILL.md, json-dsl.md, etc.)
|
||||
md_files = sorted(glob.glob(os.path.join(skills_dir, '*', '*.md')))
|
||||
if not md_files:
|
||||
print(f"Error: no .md files found in {skills_dir}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
rx = re.compile(r'powershell\.exe\s+(?:-NoProfile\s+)?-File\s+(.+?)\.ps1')
|
||||
switched = 0
|
||||
warnings = []
|
||||
|
||||
for md_path in md_files:
|
||||
with open(md_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
matches = rx.findall(content)
|
||||
if not matches:
|
||||
continue
|
||||
|
||||
# Check that .py files exist
|
||||
for m in matches:
|
||||
clean_path = m.lstrip("'")
|
||||
py_path = clean_path + '.py'
|
||||
py_full = os.path.join(repo_root, py_path)
|
||||
if not os.path.isfile(py_full):
|
||||
skill_name = os.path.basename(os.path.dirname(md_path))
|
||||
md_name = os.path.basename(md_path)
|
||||
warnings.append(f" WARN: {py_path} not found (referenced in {skill_name}/{md_name})")
|
||||
|
||||
new_content = rx.sub(r'python \1.py', content)
|
||||
if new_content != content:
|
||||
with open(md_path, 'w', encoding='utf-8') as f:
|
||||
f.write(new_content)
|
||||
skill_name = os.path.basename(os.path.dirname(md_path))
|
||||
md_name = os.path.basename(md_path)
|
||||
print(f" [OK] {skill_name}/{md_name}")
|
||||
switched += 1
|
||||
|
||||
print(f"\nSwitched {switched} file(s) to Python.")
|
||||
if warnings:
|
||||
print("\nWarnings (missing .py files):")
|
||||
for w in warnings:
|
||||
print(w)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
#!/usr/bin/env python3
|
||||
# switch-to-python v1.1 — Switch skill .md files to use Python scripts
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
"""Replaces powershell.exe invocations with python in all .md files under .claude/skills/."""
|
||||
import os, re, glob, sys
|
||||
|
||||
def main():
|
||||
print("Совет: используйте 'python scripts/switch.py --runtime python' (новый интерфейс)\n")
|
||||
repo_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
skills_dir = os.path.join(repo_root, '.claude', 'skills')
|
||||
|
||||
# Collect all .md files in skill directories (SKILL.md, json-dsl.md, etc.)
|
||||
md_files = sorted(glob.glob(os.path.join(skills_dir, '*', '*.md')))
|
||||
if not md_files:
|
||||
print(f"Error: no .md files found in {skills_dir}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
rx = re.compile(r'powershell\.exe\s+(?:-NoProfile\s+)?-File\s+(.+?)\.ps1')
|
||||
switched = 0
|
||||
warnings = []
|
||||
|
||||
for md_path in md_files:
|
||||
with open(md_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
matches = rx.findall(content)
|
||||
if not matches:
|
||||
continue
|
||||
|
||||
# Check that .py files exist
|
||||
for m in matches:
|
||||
clean_path = m.lstrip("'")
|
||||
py_path = clean_path + '.py'
|
||||
py_full = os.path.join(repo_root, py_path)
|
||||
if not os.path.isfile(py_full):
|
||||
skill_name = os.path.basename(os.path.dirname(md_path))
|
||||
md_name = os.path.basename(md_path)
|
||||
warnings.append(f" WARN: {py_path} not found (referenced in {skill_name}/{md_name})")
|
||||
|
||||
new_content = rx.sub(r'python \1.py', content)
|
||||
if new_content != content:
|
||||
with open(md_path, 'w', encoding='utf-8') as f:
|
||||
f.write(new_content)
|
||||
skill_name = os.path.basename(os.path.dirname(md_path))
|
||||
md_name = os.path.basename(md_path)
|
||||
print(f" [OK] {skill_name}/{md_name}")
|
||||
switched += 1
|
||||
|
||||
print(f"\nSwitched {switched} file(s) to Python.")
|
||||
if warnings:
|
||||
print("\nWarnings (missing .py files):")
|
||||
for w in warnings:
|
||||
print(w)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user