CLI Reference
This reference describes the current @gxp-dev/tools source (2.1.40). Compare gxdev --version and your installed lockfile; an old local runtime can behave differently even when you launched a global binary.
Installation
npm install -g @gxp-dev/tools
# Or, inside a project:
npm install --save-dev @gxp-dev/tools
Use project npm scripts or npx gxdev for a local installation. The CLI finds a project by walking upward to the nearest package.json.
Quick Reference
| Command | Purpose |
|---|---|
gxdev, gxdev --help | Display help |
gxdev --version | Display toolkit version |
gxdev ui | Open an idle interactive TUI |
gxdev init [name] | Create a project or update an existing package |
gxdev dev | Start Vite and, by default, Socket.IO |
gxdev build | Compile/package a local app |
gxdev test [args..] | Run Vitest with toolkit resolution |
gxdev exec <tool> [args..] | Run a resolved tool binary |
gxdev lint [files..] | Validate manifest/configuration JSON |
gxdev storybook | Start installed AppUI Storybook |
gxdev datastore <action> | Legacy local test-data helpers |
gxdev socket <action> | List/send local simulated events |
gxdev assets <action> | List/create local development assets |
gxdev ext:chrome, ext:firefox | Launch a browser with an extension |
gxdev ext:build | Package browser extensions |
gxdev ext:install <browser> | Show installation instructions/open browser settings |
gxdev setup-ssl | Reuse/generate local mkcert certificates |
gxdev publish [file] | Copy a package runtime file into the project |
gxdev add-dependency | Run the API declaration wizard |
gxdev extract-config | Discover source declarations and merge the manifest |
The parser permits unknown flags. An accepted flag is not evidence that its handler uses it; prefer the options below over older examples.
Global mode and runtime selection
--use-global forces the launcher's own toolkit resources rather than the project's local package. It does not update dependencies or remove explicit local runtime-file overrides.
--ui selects the terminal UI. The dispatcher has auto-start mappings for dev, socket and extension launches; other commands can open an idle TUI instead of executing their ordinary handler. Run init/build/lint explicitly in plain CLI mode. TUI mode requires a TTY and compiled bundle.
exec/test dispatch first and pass subsequent flags to their underlying tool, including --help/--ui. They do not use --ui as a TUI request.
gxdev init
gxdev init my-plugin
gxdev init my-plugin --yes
gxdev init my-plugin --description "My app"
| Option | Alias | Effect |
|---|---|---|
--description | -d | Initial description; interactive configuration can subsequently change it |
--build | -b | Noninteractive AI scaffold prompt |
--provider | -p | claude, codex, gemini; Gemini default for --build |
--yes | -y | Skip configuration prompts |
--local | -l | Initialize in the current directory |
A named new project must have a nonexistent target directory. Without a name, init prompts only when it does not detect an existing package. With --yes, a new project needs a name unless --local is used.
Creation copies the scaffold, runs npm install and verifies the resulting lock with a dry-run npm ci. Failure aborts but can retain partial files. Interactive setup then asks name/description, SSL and optional AI CLI; choosing an agent replaces the later startup/browser prompts.
--build skips those prompts, makes a provider request and can apply generated files. --yes without it creates a non-agent setup and does not start services.
Update versus overwrite
Inside an existing package, unnamed init updates required ranges, migrates the old UI package name, adds missing scripts/config files and adjusts the base-framework declaration. It preserves existing scripts and copied files. It does not perform dependency installation on that update path; run npm install and review/test the diff.
--local --yes enables overwrite of package/scaffold files. Use it only when replacement is intended. --yes alone is not an “overwrite everything” flag.
See Getting Started for project contents and first-edit verification.
gxdev dev
gxdev dev
gxdev dev --no-https=true
gxdev dev --no-https=true --with-mock
gxdev dev --port 3070 --no-socket --json
gxdev dev --chrome
gxdev dev --ui
| Option | Current behavior |
|---|---|
--port <number> | Overrides NODE_PORT; plain CLI fallback is 3000 |
--no-https=true | Explicitly forces HTTP |
--no-socket | Disables the default Socket.IO child |
--with-mock, -m | Enables mock API on the socket service |
--chrome, --firefox | Adds a browser-extension child when resources are available |
--component-path | Default ./src/Plugin.vue; existing process environment can take precedence |
--node-log-level | Default info; existing process environment can take precedence |
--json | Emit newline-delimited JSON service logs |
--ui | Launch the TUI's development path; not the plain handler |
The generated .env normally sets port 3060. Read the printed URL. Vite and socket ports are separate, and custom HMR/client-port settings require consistent configuration.
HTTPS is attempted when suitable .certs/ files exist; missing certificates cause HTTP fallback. Bare --no-https currently parses as https=false, while the plain handler reads no-https. Use --no-https=true to force HTTP with certificates present. The generated dev-http script still has the bare form.
Socket.IO starts by default, rather than requiring old --with-socket/-s examples. Mock API requires that service; --no-socket --with-mock cannot provide a running mock backend.
The CLI uses managed runtime Vite configuration. Add vite.extend.js/.mjs for supported extensions; a root vite.config.js is not its replacement mechanism. Local main.js, index.html and server.cjs can override runtime files through their relevant paths.
Ctrl+C/SIGTERM shuts down children; service failure ends the group. Inspect the final service status and actual page/module load. A URL banner does not establish readiness.
gxdev build
gxdev build
gxdev build --component-path ./src/CustomPlugin.vue
Options are --component-path (default ./src/Plugin.vue) and --node-log-level (default error). Existing process values can take precedence.
The command runs managed Vite, moves JavaScript/CSS into dist/build/, copies the manifest's asset_dir, processes optional instructions/style/configuration and creates dist/{name}.gxpapp. The default scaffold uses /src/public for assets, while a missing declaration has a different packaging fallback.
Packaging rejects out-of-project paths, symlinks and asset trees containing the build directory. Inspect the declared paths and resulting ZIP contents. Missing optional files can produce warnings; a package file is not proof every intended asset/configuration was included.
Build does not run tests, publish a platform release or install the app. Hosted CI adds its own source/artifact limits and verification stages.
gxdev test
gxdev test
gxdev test src/MyComponent.test.js
gxdev test --watch
Resolves the project's Vitest first, then the toolkit's bundled binary. The fallback supplies the toolkit module path for the test environment. Other arguments are forwarded.
Default execution is vitest run --passWithNoTests; --watch selects watch mode. The scaffold config also permits an empty suite. Check that meaningful tests actually executed. This command's success alone is not test coverage or installed-platform acceptance.
gxdev exec
gxdev exec eslint .
gxdev exec prettier --check .
Resolves the binary from project node_modules/.bin, then toolkit node_modules/.bin, then PATH. Tool arguments pass through. Missing binaries/launch failures and child exit status are propagated. Formatting commands with --write modify files.
gxdev lint
gxdev lint --all
gxdev lint app-manifest.json configuration.json --json
With no file list, it checks existing known root targets. Explicit paths resolve relative to your current directory. --json emits a report; errors return a nonzero exit.
This validates supported JSON schemas, not Vue/JavaScript. Use npm run lint:js or gxdev exec eslint separately. No files or skipped/unrecognized schemas do not establish successful validation of an intended configuration.
gxdev storybook
gxdev storybook
gxdev storybook --build
Resolves the installed @gxp-dev/app-ui package and requires its shipped Storybook setup. Missing optional peers prompt for installation into the project. Declining or a failed install stops the command.
Development normally serves Storybook at http://localhost:6006; --build delegates to its static-build script. Actual configuration/version controls the result. The optional Storybook MCP endpoint exists while that server runs; it is separate from mcp-serve.
gxdev datastore
Actions: list, add, scan-strings, config, init.
gxdev datastore list
gxdev datastore add --type string --key welcome_title --value "Hello"
gxdev datastore scan-strings --component src/Plugin.vue
These are legacy local test-data helpers. List/add operate on src/stores/test-data.json; values are not installed platform grants/data. --type accepts string/setting/asset; settings attempt JSON parsing. Incomplete or empty add arguments can enter interactive prompting.
Scan uses a simple template-text heuristic and prompts for proposed keys; it does not comprehensively rewrite templates or infer all translatable text.
The current config handler looks in src/Store, inconsistent with list/add's src/stores. It is not a reliable configuration-switch recipe for the standard scaffold. init also references legacy template-store locations/versions; prefer current gxdev init, inspect its files and explicitly configure supported runtime fixtures.
gxdev socket
gxdev socket list
gxdev socket send --event AiSessionMessageCreated
List uses project socket-events/ when present, otherwise package templates. Send reads the named JSON file; --identifier rewrites its private model channel identifier.
The current sender posts to HTTPS localhost at process SOCKET_IO_PORT or 3069. It does not load the project's .env itself or follow an HTTP-only server automatically. For another port, supply the process setting. Inspect the received event: reported transport errors can be logged without a failing command exit. This is local simulation, not production broadcast authorization.
For an HTTP socket server, post to its actual advertised port/protocol. For example, with the default HTTP socket service running on 3069:
curl --fail-with-body http://localhost:3069/emit \
-H 'Content-Type: application/json' \
--data '{"event":"DocumentationExample","channel":"local","data":{"message":"Test event"}}'
The local service emits the named event to connected clients and returns JSON with success: true. Your app must subscribe to that event to show a change. The channel value is echoed for simulation; this endpoint broadcasts to all clients rather than enforcing production channel access.
The in-page inspector opens with Ctrl+Shift+D (Cmd+Shift+D on macOS), then Socket. It sends through a store socket's broadcast method when available; its fallback also hardcodes HTTPS/3069. Do not assume that fallback works on an HTTP-only or custom-port socket service. The preview's HTTP flag and the socket server's certificate-based protocol selection are separate; check both service logs.
gxdev assets
Actions: list, generate, init.
gxdev assets init
gxdev assets generate --size 800x600 --name hero
gxdev assets list
Init creates dev-assets/images/videos, copies missing starter images and can add dev-assets/ to an existing ignore file. Generation requires native ImageMagick (magick or convert).
| Generation option | Default |
|---|---|
--size | 400x300 |
--name | placeholder |
--format | png; png/jpg/jpeg/gif accepted |
--count | 1, with indexed names for multiple files |
--color | Random |
--text | Generated from name/size |
The helper prints HTTPS URLs using its resolved port even when your preview is HTTP. Verify the actual URL. Development placeholders are separate from the manifest's production asset directory; generation does not automatically declare/package them.
gxdev ext:chrome
gxdev ext:chrome
Uses a project extension/launcher when present, otherwise toolkit resources. Requires Chrome and the relevant files. The command launches a browser; it is separate from dev-server startup.
gxdev ext:firefox
gxdev ext:firefox
Uses project or toolkit Firefox resources through its web-ext launcher. Requires Firefox; temporary extension lifetime follows the browser/development flow.
gxdev ext:build
Builds available Firefox/Chrome extension resources into the project's distribution outputs. It does not sign a Firefox extension or prove marketplace approval. Review package results and the browser-extension guide before distribution.
gxdev ext:install
gxdev ext:install chrome
gxdev ext:install firefox
Prints instructions and attempts to open browser settings. It does not automatically complete installation. Use the current browser's supported development/temporary extension procedure; printed legacy instructions are not proof a persistent installation succeeded.
gxdev setup-ssl
gxdev setup-ssl
Uses native mkcert, not the similarly named npm package. Reuses existing nonempty localhost certificate/key files in .certs/, or generates certificates for localhost/loopback after installing its local CA. Updates paths in an existing .env. Suitable-file discovery is not certificate expiry/trust validation; inspect browser trust separately.
gxdev publish
gxdev publish
gxdev publish server.cjs
Copies runtime files for local customization; it does not publish a platform app/release.
| Supported file | Destination |
|---|---|
main.js | Project root |
index.html | Project root |
server.cjs | Project root |
gxpPortalConfigStore.js | src/stores/ |
gxpFormStore.js | src/stores/ |
Existing files prompt before overwrite. Publishing index HTML can rewrite its boot reference to local main.js; publish/check that entry as well. Publishing the portal store can also copy its missing form-store companion and attempt an import rewrite, but current import styles may not match the legacy replacement patterns. Inspect store exposure and aliases after copying.
server.js and vite.config.js are not current supported publish filenames. Extend Vite with vite.extend.js. Local overrides can outlive package upgrades; compare them before assuming newer runtime behavior.
Environment Variables
The generated file uses API_ENV/API_KEY/API_PROJECT_ID. Runtime configuration maps these into its browser-facing Vite values; do not copy older examples as if VITE_API_ENV were the current source file's selector.
| Setting | Purpose |
|---|---|
API_ENV | mock, develop, staging, testing, production, local |
API_BASE_URL | Explicit runtime API origin override |
API_KEY, API_PROJECT_ID | Browser development API context; use only appropriately scoped credentials |
NODE_PORT, CLIENT_PORT | Preview/server/client configuration |
SOCKET_IO_PORT | Socket service port, normally 3069 |
COMPONENT_PATH, NODE_LOG_LEVEL | Component/log defaults subject to handler/process precedence |
MOCK_API_ENABLED | Socket mock API enablement, also set by --with-mock |
CERT_PATH, KEY_PATH | Local certificate paths |
GXDEV_USE_GLOBAL=true | Force launcher-owned toolkit resources |
GXP_NO_VERSION_CHECK=1 | Disable the background registry-version check |
Use develop, not the historical development spelling. The reviewed API proxy falls back to production for an unknown non-mock selector; set the intended environment/origin explicitly before using a real token. The bundled local origin still uses a legacy host and may need API_BASE_URL for your stack.
Browser-development values are not a secret-storage boundary. Keep privileged Project/Admin tokens, provider keys and private credentials out of source, client configuration and shipped assets. Restart development after environment changes.
Global Configuration
The current loader reads ~/gxdev-default-config.json. It supplies yargs defaults and can supply the generated package author. There is no reviewed project/home .gxdevrc.json loader.
{
"port": 3060,
"author": "Your team"
}
Use actual CLI option names for defaults. Invalid JSON is logged and falls back to an empty configuration. Inspect your installed version rather than relying on unsupported keys such as defaultPort/preferHttps.
gxdev add-dependency
gxdev add-dependency --env develop
gxdev add-dependency --env local
The registered choices are develop/local, default develop. The interactive wizard loads OpenAPI, groups endpoints by tag and offers endpoints/events plus an identifier. AsyncAPI failure can yield an empty event set even after a “loaded” message.
Selecting no endpoints currently selects all endpoints for that tag. Saving replaces a declaration with the same identifier. Without a manifest, the wizard creates a dependencies-only file, which is not a complete build manifest.
The wizard emits legacy permission strings, operation-path maps and event names. Review this shape against current installed API/runtime/MCP binding contracts; it does not grant permissions or verify the installed app's authorization. API specification discovery is separate from an actual permitted request.
gxdev extract-config
gxdev extract-config --dry-run
gxdev extract-config
gxdev extract-config --overwrite --verbose
See analytics declarations and extraction for recognized tracking patterns and preserved property definitions.
Scans supported source files under src/ and extracts recognized literal strings/settings/assets/state, tracking declarations and dependency hints. Hidden directories/node_modules are skipped. Dynamic expressions and arbitrary code are not comprehensively evaluated.
--dry-run/-d previews; normal mode merges declarations; --overwrite/-o can replace existing values; --verbose/-v reports changes. Invalid existing JSON can be replaced by a default manifest, so inspect/back up it before applying. Extracted hints do not establish complete bindings, permissions or API correctness.