Skip to content

Commands

chef build

Build extensions with Rollup, Babel and PostCSS.

bash
chef build [extensions...] [options]
OptionDescription
extensionsExtension names or glob patterns (main.core, ui.bbcode.*)
-w, --watchWatch for changes and rebuild
-p, --path [path]Build a specific directory
-v, --verboseShow detailed build logs
-f, --forceSkip safety checks and force rebuild
--productionProduction mode (minification, no source maps)
bash
chef build main.core ui.buttons    # Build specific extensions
chef build main.core -w            # Build and watch for changes
chef build ui.bbcode.*             # Build direct children
chef build im.v2.**                # Build all nested extensions
chef build                         # Build all in current directory
chef build ui.buttons --production # Production build

Glob patterns

PatternDescriptionExample
*One level deepui.bbcode.*ui.bbcode.parser, ui.bbcode.model
**All levels deepim.v2.**im.v2.const, im.v2.provider.service.settings

TIP

In zsh, escape glob patterns to prevent shell expansion: chef build ui.\*

chef test

Run unit and E2E tests via Playwright.

bash
chef test [extensions...] [options]        # unit + e2e
chef test unit [extensions...] [file?]     # unit only
chef test e2e [extensions...] [file?]      # e2e only
OptionDescription
extensionsExtension names or glob patterns
fileFor unit/e2e only — test file name (dom.test.ts)
-w, --watchWatch for changes and rerun tests
-p, --path [path]Test a specific directory
--headedRun with visible browser window
--debugOpen browser with DevTools and sourcemaps
--grep <pattern>Run only tests matching the pattern
--project <names>Run in specific browsers (chromium, firefox, webkit)
bash
chef test main.core ui.buttons                    # All tests
chef test unit main.core                          # Unit only
chef test unit main.core ./render-tag.test.ts     # Specific file
chef test e2e ui.buttons                          # E2E only
chef test ui.* --headed                           # Direct children, with visible browser
chef test im.v2.**                                # All nested extensions
chef test main.core -w                            # Watch mode
chef test main.core --debug                       # Debug with DevTools
chef test --grep "should render"                  # Filter by name
chef test main.core --project chromium firefox    # Specific browsers

chef typecheck

Check TypeScript types in extensions.

bash
chef typecheck [extensions...] [options]
OptionDescription
extensionsExtension names or glob patterns
-p, --path [path]Search for extensions starting from this directory
--file <patterns...>Check specific files (paths relative to extension root)
--exclude <patterns...>Exclude files from type checking (paths or glob patterns relative to extension root)
bash
chef typecheck main.core                           # Check a specific extension
chef typecheck ui.bbcode.*                         # Check a group of extensions
chef typecheck main.core --file src/lib/dom.ts     # Check a specific file
chef typecheck main.core --exclude 'src/legacy/**' # Exclude files from checking
chef typecheck                                     # Check all in current directory

TIP

Types are checked automatically during build (chef build). The chef typecheck command is useful when you need to check types without a full build.

chef lint

Lint extensions with ESLint.

bash
chef lint [extensions...] [options]
OptionDescription
extensionsExtension names or glob patterns
-p, --path [path]Search for and lint extensions starting from this directory
--fixAutomatically fix problems
--file <patterns...>Lint specific files (glob patterns relative to src/)
--exclude <patterns...>Exclude files from linting (glob patterns relative to extension root)
--no-cacheDisable caching (cache is enabled by default)
bash
chef lint main.core                        # Lint a specific extension
chef lint ui.*                             # Lint a group of extensions
chef lint main.core --fix                  # Auto-fix problems
chef lint main.core --file "*.ts"          # Lint only .ts files
chef lint main.core --exclude 'src/old/**' # Exclude files from linting

TIP

chef lint requires an eslint.config.{js,mjs,cjs,ts,mts,cts} file in the project. If no config is found, linting is skipped.

chef diag

Diagnose and analyze extensions across the project.

bash
chef diag <subcommand> [options]

Subcommands

SubcommandDescription
top-usedMost depended-on extensions
top-depsExtensions with the most direct dependencies
top-deps-treeExtensions with the largest transitive dependency tree
top-bundle-sizeExtensions with the largest bundles (JS + CSS + assets)
top-total-sizeExtensions with the largest total size (own code + dependencies)
deps-treeDependency tree for an extension
bundle-sizeBundle size for an extension (JS + CSS + assets)
configSearch extensions by bundle.config parameters
unused-depsExtensions with unused dependencies
circular-depsCheck for circular dependencies
circular-importsCheck for circular imports between source files
find-usagesFind where an extension is used across JS, TS and PHP files
unusedExtensions that are never referenced anywhere
baselineCheck for web features not supported by target browsers

Common options

OptionDescription
-p, --path [path]Scan for extensions starting from this directory
-l, --limit <n>Limit the number of results (default: 20)
-i, --include <patterns>Show only extensions matching the glob pattern
-x, --exclude <patterns>Exclude extensions matching the glob pattern
--sort <column>Sort by column (for top-bundle-size and top-total-size)

Patterns support *, **, ?, [abc] and other glob constructs. Multiple patterns via comma or by repeating the option:

bash
--include 'ui.*'                # Only ui.* extensions
--exclude 'main.*,im.*'        # Everything except main.* and im.*
--include 'ui.*' -x 'ui.vue.*' # ui.*, but without ui.vue.*

Examples

bash
chef diag top-used                             # Most depended-on extensions
chef diag top-bundle-size --limit 10           # TOP 10 largest bundles
chef diag top-bundle-size --sort js            # Sort by JS size
chef diag top-total-size --sort own            # Sort by own bundle size
chef diag top-used --exclude 'main.*,im.*'     # Exclude main and im from results
chef diag deps-tree im.v2.application.core     # Dependency tree for an extension
chef diag deps-tree main.core --depth 2        # Limit tree depth
chef diag deps-tree main.core --why ui.vue3    # Find path to a specific dependency
chef diag bundle-size ui.buttons               # Bundle size for an extension
chef diag bundle-size crm.timeline --with-deps # Including all dependencies
chef diag circular-deps                        # All circular dependencies
chef diag circular-deps main.core              # Check a specific extension
chef diag unused-deps                          # Unused dependencies
chef diag find-usages ui.buttons               # Where ui.buttons is used
chef diag config --key namespace               # Extensions with namespace in config
chef diag config --key minification --missing  # Extensions without minification
chef diag config --key input --except          # Extensions with params other than input
chef diag unused                               # Unused extensions
chef diag baseline                             # Overview of unsupported features across all extensions
chef diag baseline ui.buttons                  # Check a specific extension

chef aliases

Regenerate TypeScript path aliases (aliases.tsconfig.json).

bash
chef aliases [options]
OptionDescription
-p, --path [path]Project root to scan for extensions
-q, --quietQuiet mode — single-line output without colors
bash
chef aliases                       # Regenerate aliases
chef aliases -q                    # Quiet mode (for scripts and hooks)

Usually runs automatically via VCS hooks (see chef init hooks).

chef create

Create a new Bitrix extension with standard file structure.

bash
chef create <name> [options]
OptionDescription
nameExtension name (my.extension)
-p, --path [path]Create in a specific directory
-t, --tech [tech]Technology: ts or js. Auto-detected from the environment by default
-f, --forceOverwrite without confirmation
bash
chef create my.extension                          # TypeScript extension
chef create my.extension --tech js                # JavaScript extension
chef create my.extension -p ./local/js/vendor     # In a specific directory

Generated files:

my.extension/
├── bundle.config.ts
├── config.php
└── src/
    └── my.extension.ts

chef init

Initialize build and test environment.

chef init build

Initialize TypeScript, path aliases and browserslist.

bash
chef init build [options]
OptionDescription
-p, --path [path]Initialize in a specific directory

The command:

  1. Scans all extensions in the project
  2. Generates aliases.tsconfig.json with path aliases for each extension
  3. Creates tsconfig.json with recommended settings
  4. Creates .browserslistrc with recommended browser targets

See TypeScript for details.

chef init tests

Initialize the Playwright test environment.

bash
chef init tests [options]
OptionDescription
-p, --path [path]Initialize in a specific directory

Creates playwright.config.ts and .env.test in the project root.

See Testing for details.

chef init hooks

Install VCS hooks to auto-update path aliases.

bash
chef init hooks [options]
OptionDescription
-p, --path [path]Project root where hooks will be installed

Supports Git and Mercurial. Hooks run chef aliases --quiet after pull, merge, checkout and rebase to keep aliases.tsconfig.json up to date.

chef baseline

Check web feature availability for your project's browser targets.

bash
chef baseline [query] [options]
OptionDescription
queryFeature ID or search query (subgrid, "private fields", Promise.any)
--listList all supported and transpiled features
-p, --path [path]Path to project (for reading .browserslistrc)

Without arguments or with --list, outputs a full list of available features grouped by category (JavaScript, CSS, API, HTML).

Searching features

Search works by ID, name, description and MDN identifiers (compat_features). Queries are automatically normalized — spaces are converted to hyphens for ID matching.

bash
chef baseline subgrid                 # Search by ID
chef baseline "private fields"        # Search by compat_features
chef baseline "container queries"     # Search CSS feature
chef baseline "Promise.any"           # Search JS API

Statuses

Results show the status relative to current targets:

  • ✓ supported — natively supported by all target browsers
  • ~ transpiled — JS syntax, transpiled by Babel
  • ✗ unsupported — not supported, requires a polyfill or fallback

For Babel-transpiled features, a per-transform breakdown shows which parts work natively and which will be transpiled.

Examples

bash
chef baseline                         # All available features (supported + transpiled)
chef baseline class-syntax            # Feature details with Babel transforms
chef baseline "arrow functions"       # Search by description
chef baseline --list                  # Full list by category

chef flow-to-ts

Migrate Flow.js typed code to TypeScript.

bash
chef flow-to-ts [extensions...] [options]
OptionDescription
extensionsExtension names or glob patterns (main.core, ui.bbcode.*)
-p, --path [path]Migrate a specific directory
--rm-tsRemove existing .ts files after migration
--rm-jsRemove original .js files after migration

What it does:

  • Renames .js files to .ts via hg rename
  • Converts Flow syntax to TypeScript equivalents
  • Updates bundle.config.jsbundle.config.ts

See Flow.js → TypeScript for details.

Released under the MIT License.