$npx -y skills add comol/ai_rules_1c --skill v8unpack-cfUnpack and repack 1C binary files (CF / CFE / EPF) with the Python v8unpack utility — no 1C platform required. Use when you need to extract a configuration, extension or data processor into human-readable sources (JSON + BSL), or build a binary back from sources, and the 1C:Ent
| 1 | # v8unpack-cf — unpack and repack 1C binary files |
| 2 | |
| 3 | `v8unpack` is a Python utility that unpacks 1C binary files (CF / CFE / EPF) into a |
| 4 | human-readable source tree (JSON + BSL) **without the 1C:Enterprise platform**, and |
| 5 | builds the binary back from those sources. |
| 6 | |
| 7 | Use this skill when you only have a binary artifact (a `.cf` configuration dump, a |
| 8 | `.cfe` extension, or an `.epf` external data processor) and no running infobase or |
| 9 | Designer / `ibcmd` at hand. When the configuration lives in an infobase, extract it |
| 10 | through the platform instead — see the `getconfigfiles` rule. |
| 11 | |
| 12 | ## Dependency |
| 13 | |
| 14 | - `v8unpack` Python package — install with `pip install v8unpack` (or a dev install |
| 15 | from its repository). Verify with `python -m v8unpack --help`. |
| 16 | |
| 17 | ## Commands |
| 18 | |
| 19 | ### Extract (`-E`) |
| 20 | |
| 21 | ```bash |
| 22 | python -m v8unpack -E "<file.cf>" "<sources_dir>" --temp "<temp_dir>" |
| 23 | ``` |
| 24 | |
| 25 | | Parameter | Description | |
| 26 | |-----------|-------------| |
| 27 | | `<file.cf>` | Path to a CF, CFE or EPF file | |
| 28 | | `<sources_dir>` | Destination for the unpacked sources (created automatically) | |
| 29 | | `--temp <path>` | Folder for intermediate data (kept, not deleted — useful for debugging) | |
| 30 | | `--processes N` | Number of worker processes (default: `cpu_count - 2`) | |
| 31 | | `--descent XYYZZZ` | Extension versioning mode (configuration version suffix) | |
| 32 | | `--auto_include` | Build the table of contents dynamically from the folder, not from the header | |
| 33 | | `--prefix STR` | Prefix for first-level metadata names | |
| 34 | |
| 35 | ### Build (`-B`) |
| 36 | |
| 37 | ```bash |
| 38 | python -m v8unpack -B "<sources_dir>" "<file.cf>" |
| 39 | ``` |
| 40 | |
| 41 | | Parameter | Description | |
| 42 | |-----------|-------------| |
| 43 | | `<sources_dir>` | Folder with the unpacked sources | |
| 44 | | `<file.cf>` | Path to the output CF / CFE / EPF file | |
| 45 | | `--index <path>` | JSON table-of-contents file (maps files across folders) | |
| 46 | | `--version XYYZZ` | Compatibility-mode version (for extensions), e.g. `80306` = 8.3.6 | |
| 47 | | `--descent XYYZZZ` | Configuration version suffix | |
| 48 | |
| 49 | ### Index (`-I`) |
| 50 | |
| 51 | ```bash |
| 52 | python -m v8unpack -I "<sources_dir>" --index index.json --core core |
| 53 | ``` |
| 54 | |
| 55 | Generates / updates `index.json` — the table-of-contents file that controls how sources |
| 56 | are laid out across subfolders. |
| 57 | |
| 58 | ### Batch operations (`-EA`, `-BA`, `-IA`) |
| 59 | |
| 60 | ```bash |
| 61 | python -m v8unpack -EA products.json # extract all products |
| 62 | python -m v8unpack -BA products.json # build all products |
| 63 | python -m v8unpack -BA products.json --index KEY # build a specific product |
| 64 | ``` |
| 65 | |
| 66 | `products.json` describes several products with their individual build parameters. |
| 67 | |
| 68 | ## Python API |
| 69 | |
| 70 | ```python |
| 71 | import v8unpack |
| 72 | |
| 73 | v8unpack.extract('d:/sample.cf', 'd:/src') |
| 74 | v8unpack.extract('d:/sample.cf', 'd:/src', temp_dir='d:/temp', |
| 75 | options={'descent': 4100200, 'auto_include': True}) |
| 76 | |
| 77 | v8unpack.build('d:/src', 'd:/repacked.cf') |
| 78 | v8unpack.build('d:/src', 'd:/repacked.cf', index='index.json', |
| 79 | options={'descent': 4100200, 'version': '80306'}) |
| 80 | ``` |
| 81 | |
| 82 | ## Examples |
| 83 | |
| 84 | ### Extract a configuration |
| 85 | |
| 86 | ```bash |
| 87 | python -m v8unpack -E "<project>/1Cv8.cf" "<project>/src" --temp "<project>/temp" |
| 88 | ``` |
| 89 | |
| 90 | ### Build it back |
| 91 | |
| 92 | ```bash |
| 93 | python -m v8unpack -B "<project>/src" "<project>/1Cv8_new.cf" |
| 94 | ``` |
| 95 | |
| 96 | ### Extract an external data processor |
| 97 | |
| 98 | ```bash |
| 99 | python -m v8unpack -E "MyDataProcessor.epf" "src_epf" |
| 100 | ``` |
| 101 | |
| 102 | ### Extract an extension |
| 103 | |
| 104 | ```bash |
| 105 | python -m v8unpack -E "MyExtension.cfe" "src_cfe" --descent 3000112 |
| 106 | ``` |
| 107 | |
| 108 | ### Build an extension |
| 109 | |
| 110 | ```bash |
| 111 | python -m v8unpack -B "src_cfe" "bin/ext.cfe" --index cmd/index.json --descent 3000112 --version 80316 |
| 112 | ``` |
| 113 | |
| 114 | ## Version compatibility |
| 115 | |
| 116 | The utility version is recorded in `Configuration.json` (`"v8unpack": "1.2.6"`). On |
| 117 | build, `major.minor` must match. If the versions differ: |
| 118 | |
| 119 | 1. Build with the old version. |
| 120 | 2. Upgrade the utility. |
| 121 | 3. Re-extract with the new version. |
| 122 | 4. Commit. |
| 123 | |
| 124 | ## Intermediate stages (`--temp`) |
| 125 | |
| 126 | | Stage | Description | |
| 127 | |-------|-------------| |
| 128 | | `decode_stage_0/` | Extraction from the 1C container | |
| 129 | | `decode_stage_1/` | Decompression (zlib), bracket-files | |
| 130 | | `decode_stage_3/` | Metadata parsing → tree | |
| 131 | | Destination folder | Code organization (include, form elements) | |
| 132 | |
| 133 | ## Limitations |
| 134 | |
| 135 | - Object properties and form layout are stored in `header` / `raw` as raw arrays. |
| 136 | - Files larger than 1 MB (layouts, HTML) are stored as `.bin` without decoding. |
| 137 | - Encrypted modules are kept in binary form. |
| 138 | - With `--auto_include`, nested objects are sorted alphabetically. |
| 139 | |
| 140 | ## Relationship to other rules |
| 141 | |
| 142 | - `getconfigfiles` — extracts configuration objects from a running infobase through the |
| 143 | platform. Prefer it when an infobase is available; use `v8unpack-cf` when you only have |
| 144 | a binary artifact and no platform. |
| 145 | - `1c-metadata-manage` — M |