1- # Bitrix BPT Tool
1+ # 🛠️ Bitrix BPT CLI Tool
22
3- Утилита командной строки для работы с файлами ** ` .bpt ` ** (шаблоны Bitrix).
4- Позволяет:
3+ <p align =" center " >
4+ <strong >Инструмент командной строки для работы с файлами .bpt (шаблоны бизнес-процессов Bitrix)</strong >
5+ </p >
56
6- - извлекать содержимое (` dump ` );
7- - собирать обратно из текста (` build ` );
8- - смотреть информацию о файле (` info ` ).
7+ <p align =" center " >
8+ <a href =" #english-version " >🇺🇸 English</a > •
9+ <a href =" #русская-версия " >🇷🇺 Русский</a >
10+ </p >
911
10- Поддерживаются форматы сжатия: ** gzip ** , ** zlib (gzcompress) ** , ** deflate (gzdeflate) ** , а также несжатый текст.
12+ ---
1113
12- ## Установка и сборка
14+ ## 🇷🇺 Русская версия
15+
16+ ### ✨ Возможности
17+
18+ CLI-утилита для работы с файлами ** ` .bpt ` ** (шаблоны бизнес-процессов Bitrix):
19+
20+ - 📤 ** Извлечение** содержимого (` dump ` )
21+ - 📦 ** Сборка** обратно из текста (` build ` )
22+ - ℹ️ ** Просмотр** информации о файле (` info ` )
23+
24+ ### 🗜️ Поддерживаемые форматы сжатия
25+
26+ - ** gzip** (gzencode)
27+ - ** zlib** (gzcompress)
28+ - ** deflate** (gzdeflate)
29+ - ** plain** (без сжатия)
30+
31+ ### 📥 Загрузка
32+
33+ 📋 ** Готовые сборки** (Windows/Linux/macOS):
34+ 👉 [ ** Releases · bitrix-bpt-tool** ] ( https://github.com/bslie/bitrix-bpt-tool/releases/latest )
35+
36+ ### 🔧 Установка из исходников
1337
1438``` bash
15- git clone https://github.com/ВАШ_АККАУНТ /bitrix-bpt-tool.git
39+ git clone https://github.com/bslie /bitrix-bpt-tool.git
1640cd bitrix-bpt-tool
1741dotnet build
1842```
19- (Требуется .NET 8.0 SDK или новее.)
2043
21- Использование
22- Выгрузка содержимого файла
44+ > ** Требования:** .NET 9.0 SDK или новее
45+
46+ ### 🚀 Быстрый старт
47+
48+ #### 📤 Извлечение содержимого .bpt
49+
2350``` bash
51+ # Основная выгрузка
2452dotnet run -- dump bp-179.bpt -o bp-179.txt
25- ```
26- Человекочитаемый вывод:
2753
28- ``` bash
54+ # Человекочитаемый вывод (unserialize + дерево)
2955dotnet run -- dump bp-179.bpt --pretty
3056```
31- Сборка обратно в .bpt
57+
58+ #### 📦 Сборка обратно в .bpt
59+
3260``` bash
3361# gzip (gzencode)
3462dotnet run -- build bp-179.txt -o bp-179.bpt --gzip
@@ -42,16 +70,187 @@ dotnet run -- build bp-179.txt -o bp-179.bpt --deflate
4270# без сжатия
4371dotnet run -- build bp-179.txt -o bp-179.bpt --plain
4472```
45- ⚠️ Важно: bp-179.txt должен содержать «сырой» PHP-serialized текст (результат dump без --pretty).
4673
47- Просмотр информации о файле
74+ > ⚠️ ** Важно:** ` bp-179.txt ` должен содержать сырой PHP-serialized текст (результат ` dump ` без ` --pretty ` ).
75+ > Не изменяйте содержимое внутри ` s:<len>:"..." ` — длины должны точно совпадать по байтам.
76+
77+ #### ℹ️ Просмотр информации о файле
78+
79+ ``` bash
80+ # Базовая информация
81+ dotnet run -- info bp-179.bpt
82+
83+ # С предпросмотром содержимого
84+ dotnet run -- info bp-179.bpt --peek 200
85+ ```
86+
87+ ### 🔄 Работа с потоками
88+
89+ Поддерживаются ** stdin/stdout** для конвейерной обработки:
90+
91+ ``` bash
92+ # Цепочка команд через pipe
93+ dotnet run -- dump data/bp-179.bpt -o - | \
94+ dotnet run -- build - --out out/bp-179-deflate.bpt --deflate
95+
96+ # Автосоздание директорий
97+ dotnet run -- build data/bp-179.txt --out out/rebuilt/bp-179.bpt --zlib
98+ ```
99+
100+ ** Альтернативные флаги:**
101+
102+ - ` --in <path> ` и ` --out <path> ` (эквивалентны позиционным аргументам и ` -o ` )
103+
104+ ### 🔍 Определение формата упаковки
105+
106+ Чтобы правильно пересобрать файл, сначала определите формат исходного .bpt:
107+
48108``` bash
49109dotnet run -- info bp-179.bpt
50110```
51- С «подсмотром» первых 200 символов содержимого:
111+
112+ Обратите внимание на:
113+
114+ - ** Заголовок** — магические байты
115+ - ** Фактический формат** — что сработало при распаковке
116+
117+ Используйте соответствующий флаг: ` --gzip ` , ` --zlib ` , ` --deflate ` или ` --plain `
118+
119+ ### 📂 Получение .bpt файлов из Bitrix
120+
121+ #### 🏢 On-Premise (1С-Битрикс: Управление сайтом)
122+
123+ 1 . ** Настройки** → ** Инструменты** → ** Бизнес-процессы**
124+ 2 . ** Шаблоны бизнес-процессов**
125+ 3 . Меню действий нужного шаблона → ** Экспорт**
126+
127+ #### ☁️ Bitrix24 (облако)
128+
129+ 1 . ** CRM** → ** Настройки CRM** → ** Бизнес-процессы** или ** Списки** → ** Бизнес-процессы**
130+ 2 . Найдите шаблон → меню действий → ** Экспорт**
131+
132+ ---
133+
134+ ## 🇺🇸 English Version
135+
136+ ### ✨ Features
137+
138+ CLI utility for working with ** ` .bpt ` ** files (Bitrix business process templates):
139+
140+ - 📤 ** Extract** content (` dump ` )
141+ - 📦 ** Build** back from text (` build ` )
142+ - ℹ️ ** Display** file information (` info ` )
143+
144+ ### 🗜️ Supported Compression Formats
145+
146+ - ** gzip** (gzencode)
147+ - ** zlib** (gzcompress)
148+ - ** deflate** (gzdeflate)
149+ - ** plain** (uncompressed)
150+
151+ ### 📥 Download
152+
153+ 📋 ** Pre-built binaries** (Windows/Linux/macOS):
154+ 👉 [ ** Releases · bitrix-bpt-tool** ] ( https://github.com/bslie/bitrix-bpt-tool/releases/latest )
155+
156+ ### 🔧 Build from Source
157+
158+ ``` bash
159+ git clone https://github.com/bslie/bitrix-bpt-tool.git
160+ cd bitrix-bpt-tool
161+ dotnet build
162+ ```
163+
164+ > ** Requirements:** .NET 9.0 SDK or later
165+
166+ ### 🚀 Quick Start
167+
168+ #### 📤 Extract .bpt Content
169+
170+ ``` bash
171+ # Basic extraction
172+ dotnet run -- dump bp-179.bpt -o bp-179.txt
173+
174+ # Human-readable output (unserialized + tree structure)
175+ dotnet run -- dump bp-179.bpt --pretty
176+ ```
177+
178+ #### 📦 Build Back to .bpt
179+
180+ ``` bash
181+ # gzip (gzencode)
182+ dotnet run -- build bp-179.txt -o bp-179.bpt --gzip
183+
184+ # zlib (gzcompress)
185+ dotnet run -- build bp-179.txt -o bp-179.bpt --zlib
186+
187+ # deflate (gzdeflate)
188+ dotnet run -- build bp-179.txt -o bp-179.bpt --deflate
189+
190+ # plain (uncompressed)
191+ dotnet run -- build bp-179.txt -o bp-179.bpt --plain
192+ ```
193+
194+ > ⚠️ ** Important:** ` bp-179.txt ` must contain raw PHP-serialized text (result of ` dump ` without ` --pretty ` ).
195+ > Don't modify content inside ` s:<len>:"..." ` — lengths must match exactly by bytes.
196+
197+ #### ℹ️ View File Information
52198
53199``` bash
200+ # Basic information
201+ dotnet run -- info bp-179.bpt
202+
203+ # With content preview
54204dotnet run -- info bp-179.bpt --peek 200
55205```
56- ## Лицензия
57- MIT
206+
207+ ### 🔄 Stream Processing
208+
209+ Support for ** stdin/stdout** for pipeline processing:
210+
211+ ``` bash
212+ # Command chaining via pipe
213+ dotnet run -- dump data/bp-179.bpt -o - | \
214+ dotnet run -- build - --out out/bp-179-deflate.bpt --deflate
215+
216+ # Auto-create directories
217+ dotnet run -- build data/bp-179.txt --out out/rebuilt/bp-179.bpt --zlib
218+ ```
219+
220+ ** Alternative flags:**
221+
222+ - ` --in <path> ` and ` --out <path> ` (equivalent to positional arguments and ` -o ` )
223+
224+ ### 🔍 Detecting Compression Format
225+
226+ To properly rebuild a file, first determine the original .bpt format:
227+
228+ ``` bash
229+ dotnet run -- info bp-179.bpt
230+ ```
231+
232+ Pay attention to:
233+
234+ - ** Header** — magic bytes detection
235+ - ** Actual format** — what worked during unpacking
236+
237+ Use the corresponding flag: ` --gzip ` , ` --zlib ` , ` --deflate ` , or ` --plain `
238+
239+ ### 📂 Getting .bpt Files from Bitrix
240+
241+ #### 🏢 On-Premise (1C-Bitrix: Site Management)
242+
243+ 1 . ** Settings** → ** Tools** → ** Business Processes**
244+ 2 . ** Business Process Templates**
245+ 3 . Template action menu → ** Export**
246+
247+ #### ☁️ Bitrix24 (Cloud)
248+
249+ 1 . ** CRM** → ** CRM Settings** → ** Business Processes** or ** Lists** → ** Business Processes**
250+ 2 . Find template → action menu → ** Export**
251+
252+ ---
253+
254+ ## 📄 License
255+
256+ ** MIT License** - see [ LICENSE.txt] ( LICENSE.txt ) for details
0 commit comments