Skip to main content

1C Enterprise BSL: MCP server, LSP server, and CLI linter

Project description

1C HBK BSL

Инструменты для разработки на 1C Enterprise / BSL: расширение VS Code / Cursor, CLI-линтер, formatter, LSP-сервер и MCP-сервер для AI-агентов.

CI VS Marketplace PyPI License: MIT

Быстрый Гид

VS Code / Cursor

  1. Установите расширение mussolene.1c-hbk-bsl.
  2. Откройте проект с файлами .bsl / .os.
  3. Диагностики появятся в Problems, навигация и форматирование заработают через LSP.

Рекомендуемые настройки проекта:

{
  "[bsl]": {
    "editor.defaultFormatter": "mussolene.1c-hbk-bsl",
    "editor.formatOnSave": true,
    "editor.tabSize": 4,
    "editor.insertSpaces": false
  }
}

CLI / CI

uv tool install onec-hbk-bsl
onec-hbk-bsl check .
onec-hbk-bsl check . --format sarif > bsl-results.sarif
onec-hbk-bsl format . --check

Для GitHub Code Scanning загрузите SARIF:

- name: 1C HBK BSL
  run: |
    pip install onec-hbk-bsl
    onec-hbk-bsl check . --format sarif > bsl-results.sarif

- uses: github/codeql-action/upload-sarif@v3
  with:
    sarif_file: bsl-results.sarif

Что Входит

Поверхность Назначение
VS Code / Cursor Диагностики, навигация, hover, completion, rename, formatting, inlay hints
CLI check, format, SARIF/JSON/text output, baseline для постепенного внедрения
LSP Сервер для редакторов и локальных интеграций
MCP Поиск символов, граф вызовов, диагностики, форматирование и метаданные для AI-агентов
Python API check_files(...) и диагностический движок для встраивания

onec-hbk-bsl не запускает Java-анализатор в рантайме. Совместимость с существующими BSL-практиками поддерживается там, где она полезна: например, комментарии // BSLLS-off/on в коде учитываются как suppression comments.

Конфигурация

Основной конфиг проекта: onec-hbk-bsl.toml.

# onec-hbk-bsl.toml
ignore = ["BSL012"]
exclude = ["vendor", "build", "*.gen.bsl"]
format = "text"
jobs = 0

[per-file-ignores]
"legacy/*.bsl" = ["BSL002", "BSL011"]

Также поддерживается секция [tool."onec-hbk-bsl"] в pyproject.toml. Явные CLI-флаги имеют приоритет над конфигом.

Подавление в коде:

Пароль = "dev_only";  // noqa: BSL012
// BSLLS:MethodSize-off

Основные Команды

# Линтинг
onec-hbk-bsl check .
onec-hbk-bsl check . --select BSL001,BSL012
onec-hbk-bsl check . --ignore BSL014

# CI / отчеты
onec-hbk-bsl check . --format json
onec-hbk-bsl check . --format sarif > bsl-results.sarif
onec-hbk-bsl check . --exit-zero

# Gradual adoption
onec-hbk-bsl check . --update-baseline bsl-baseline.json
onec-hbk-bsl check . --baseline bsl-baseline.json

# Форматирование
onec-hbk-bsl format .
onec-hbk-bsl format . --check

# Серверы и индекс
onec-hbk-bsl lsp
onec-hbk-bsl mcp --stdio --workspace /path/to/project
onec-hbk-bsl index /path/to/project

Полная классификация публичных, CI и внутренних команд: docs/public-surface.md.

Python API

from onec_hbk_bsl import check_files

diagnostics = check_files(["src/Модуль.bsl"], jobs=1)
for diagnostic in diagnostics:
    print(diagnostic.code, diagnostic.file, diagnostic.line)

Документация

Документ Для чего
docs/public-surface.md Публичный контракт CLI, API, VS Code и MCP
docs/architecture.md Архитектура сервера, индекса и анализатора
docs/Production-Notes.md Эксплуатация, релизы, проверки
docs/metadata_registry.md Метаданные конфигураций 1С
docs/THIRD_PARTY_NOTICES.md Лицензии и источники данных

Разработка

git clone https://github.com/mussolene/1c_hbk_bsl
cd 1c_hbk_bsl
make install
make lint
make test
make build

Для локальной сборки VSIX используйте make vsix, чтобы в расширение попал актуальный бинарник.

Лицензия

MIT © 2024 1C HBK BSL Contributors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onec_hbk_bsl-0.8.0.tar.gz (351.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onec_hbk_bsl-0.8.0-py3-none-any.whl (374.2 kB view details)

Uploaded Python 3

File details

Details for the file onec_hbk_bsl-0.8.0.tar.gz.

File metadata

  • Download URL: onec_hbk_bsl-0.8.0.tar.gz
  • Upload date:
  • Size: 351.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for onec_hbk_bsl-0.8.0.tar.gz
Algorithm Hash digest
SHA256 6639838ffd6af7ad37694e1cd3b34e3770d21dcec51cef50722614172989c2c6
MD5 ab29fd99e18807091946de652b5280f1
BLAKE2b-256 fe26ff783c2d0d7841ad0d2d2680d53633286ee2595821f9c5cbc7d9b3a75ad4

See more details on using hashes here.

Provenance

The following attestation bundles were made for onec_hbk_bsl-0.8.0.tar.gz:

Publisher: release.yml on mussolene/1c_hbk_bsl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file onec_hbk_bsl-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: onec_hbk_bsl-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 374.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for onec_hbk_bsl-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d808e8588088453479f059986fb04d872692b00969abf13d46b3853ab0b5240
MD5 7b1ef12e6d3a695b02a8f22601b650c2
BLAKE2b-256 a466cfcad0d89938120454b4f688a035e65809ce34253aaef5070591350c3f70

See more details on using hashes here.

Provenance

The following attestation bundles were made for onec_hbk_bsl-0.8.0-py3-none-any.whl:

Publisher: release.yml on mussolene/1c_hbk_bsl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page