Skip to main content

CLI Commands

Hexa CLI command groups:

  • hexa new
  • hexa build
  • hexa add
  • hexa generate

hexa new

Scaffold a new extension project.

hexa new [name] [--platform chrome,firefox,...]
Argument / OptionValuesNotes
[name]stringPrompted if omitted
--platformchrome, firefox, safari, opera, edge, braveComma-separated list

hexa build

Compile and generate extension artifacts.

hexa build [--platform chrome] [--mode production] [--target all] [--watch]
OptionValuesDefault
--platformchrome, firefox, safari, opera, edge, bravechrome
--modedevelopment, productionconfig or production
--targetall, ui, content, backgroundall
--verboseflagfalse
--watchflagfalse

Notes:

  • Watch mode is driven by hexa build --watch.
  • There is no separate hexa dev command.

Compiler options (hexa-cli.config.json)

compilerOptions supports Vite-style build flags with Hexa camelCase keys:

KeyTypeNotes
minifyboolean | "esbuild" | "terser"true maps to "esbuild"
cssMinifyboolean | "esbuild" | "lightningcss"CSS minifier strategy
sourceMapboolean | "inline" | "hidden"Mapped to Vite build.sourcemap
terserOptionsobjectUsed only when minify: "terser"

Example profiles:

{
"compilerOptions": {
"minify": false,
"cssMinify": false,
"sourceMap": true,
"terserOptions": {}
},
"environments": {
"production": {
"compilerOptions": {
"minify": "terser",
"cssMinify": "lightningcss",
"sourceMap": false,
"terserOptions": {
"compress": {
"drop_console": true
}
}
}
}
}
}

UI options (hexa-cli.config.json)

KeyTypeDefaultNotes
ui.parallelBuildbooleantrueRuns managed popup + managed devtools builds in parallel during standard build mode. Set to false to force sequential managed UI builds.

hexa add

Add feature blocks to an existing project.

add content

hexa add content <name> <urlList> [--run-at document-idle]

add background

hexa add background <name> [--allow-multiple]

add ui

hexa add ui popup
hexa add ui devtools

add handler

hexa add handler <name> <contentClass>

Shared options for add subcommands:

  • --cwd <path>
  • --dry-run
  • --force
  • --verbose

hexa generate

Generate classes and store scaffolds.

generate controller

hexa generate controller <name> [--namespace value]

generate handler

hexa generate handler <name> [--namespace value]

generate service

hexa generate service <name> <context>

Contexts: background, content, general, ui.

generate reducer

hexa generate reducer <name> <context>

Contexts: background, content.

generate state

hexa generate state <name> <context>

Requires an existing matching reducer file.

Shared options for generate subcommands:

  • --cwd <path>
  • --dry-run
  • --force
  • --verbose

generate output directories

CLI schematics commands (hexa generate ... and hexa add handler ...) use fixed source-root directories:

  • controllers: src/background
  • handlers: src/content
  • services: src/services

For reducers and state generation, directories are context-based under src/background/store and src/content/store.

Where to go next