> For the complete documentation index, see [llms.txt](https://raito-kyokai.gitbook.io/catalib/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://raito-kyokai.gitbook.io/catalib/readme.md).

# Введение

**catalib** — инструмент, который позволяет писать плагины exteraGram как нормальное дерево пакетов (папки, подпапки, много модулей, тесты) и собирать их в один самодостаточный `<plugin_id>.py`, пригодный для штатной установки и распространения.

## Проблема

exteraGram загружает плагин как **ровно один файл** `<plugin_id>.py`. Любой нетривиальный плагин при этом превращается в гигантский модуль с ручными `try/except`-заглушками SDK. Нельзя разнести код по слоям, переиспользовать модули, нормально тестировать доменную логику.

## Решение

Разработчик пишет обычный пакет:

```
my_plugin/
├── catalib.toml
└── src/
    ├── plugin.py            # точка входа
    ├── core/ ...            # любые пакеты и подпакеты
    └── services/ ...
```

`catalib build` собирает это в один файл со встроенным загрузчиком на `sys.meta_path`. Внутри плагина работают обычные `import` и относительные импорты, а трейсбеки указывают на исходные файлы.

## Ключевые свойства

* **Один файл на выходе** — совместим со штатной установкой exteraGram (импорт одного `.py`/`.plugin`).
* **Настоящая модульность** — пакеты, подпакеты, относительные импорты без изменения кода.
* **Мини-фреймворк** `catalib.support`: автоматическая регистрация хуков и пунктов меню, типизированные настройки, безопасные импорты SDK с заглушками для офлайн-тестов. Вшивается в собранный файл (на устройстве `catalib` не установлен).
* **Корректные трейсбеки** — ошибки указывают на исходные файлы плагина.
* **Деплой на устройство** через встроенный dev server exteraGram.
* **Подтверждено на реальном устройстве** под Chaquopy.

## С чего начать

* [Установка](/catalib/nachalo-raboty/installation.md)
* [Быстрый старт](/catalib/nachalo-raboty/quickstart.md)
* [Как это устроено](/catalib/nachalo-raboty/concepts.md)

Если что-то идёт не так — раздел [Решение проблем](/catalib/reshenie-problem/troubleshooting.md) покрывает все известные подводные камни exteraGram.

## Автор и контакты

Автор — catalyst. Плагины, обновления и обратная связь — Telegram-канал [@catalystdevplugins](https://t.me/catalystdevplugins). Исходный код: [github.com/cataIystdev/catalib](https://github.com/cataIystdev/catalib).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://raito-kyokai.gitbook.io/catalib/readme.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
