Framework CLI

@equinor/fusion-framework-cli
Command-line toolkit for developing, building, and publishing Fusion Framework applications and portal templates. Provides a unified developer experience from local development to production deployment.
Features
- Application scaffolding β generate new Fusion apps from predefined templates
- Development server β hot-reload dev server with service discovery and authentication
- Build & bundle β Vite-based production builds with manifest generation
- Publish & tag β upload bundles and configs to the Fusion app/portal service
- Snapshot versions β timestamped preview builds for PRs and CI (
--snapshot) - Portal templates β build, bundle, and deploy portal configurations
- Service discovery β resolve Fusion service endpoints from any environment
- Authentication β Azure AD login, token management, CI/CD token support
- Plugin system β extend the CLI with optional plugin packages
Installation
pnpm add -D @equinor/fusion-framework-cliThe package exposes two binary aliases: fusion-framework-cli and ffc.
Usage
Create a new application
# Interactive template selection
pnpm fusion-framework-cli app create my-app
# Use a specific template
pnpm fusion-framework-cli app create my-app --template react-appLocal development
# Start the dev server (app)
pnpm fusion-framework-cli dev
# Start the dev server (portal)
pnpm fusion-framework-cli portal devBuild and publish
# Build an application
pnpm fusion-framework-cli app build
# Bundle into a zip archive
pnpm fusion-framework-cli app pack
# Publish bundle + config to an environment
pnpm fusion-framework-cli app publish --env ci --config
# Snapshot build for a PR
pnpm fusion-framework-cli app pack --snapshot pr-123Authentication
# Interactive login
pnpm fusion-framework-cli auth login
# Retrieve a token
pnpm fusion-framework-cli auth token
# CI/CD: set FUSION_TOKEN environment variable insteadCommand overview
| Command | Description |
|---|---|
app create | Scaffold a new Fusion application from a template |
app build | Build the application with Vite |
app pack | Bundle the build into a zip archive |
app publish | Build, pack, and upload in one step |
app upload | Upload a pre-built bundle |
app config | Generate or publish app configuration |
app tag | Tag a published version (e.g. latest) |
app check | Verify app registration in the app store |
app dev | Start the application dev server |
app serve | Preview a production build locally |
portal build | Build a portal template |
portal pack | Bundle the portal into a zip archive |
portal publish | Build, pack, and upload a portal |
portal upload | Upload a pre-built portal bundle |
portal config | Generate or publish portal configuration |
portal tag | Tag a published portal version |
portal dev | Start the portal dev server |
auth login | Authenticate with Azure AD |
auth logout | Clear stored credentials |
auth token | Print or acquire an access token |
disco resolve | Resolve a Fusion service endpoint |
Run pnpm fusion-framework-cli <command> --help for detailed options.
API Reference
The package exposes several sub-path exports for programmatic use:
@equinor/fusion-framework-cli (root)
defineDevServerConfig/defineFusionCliβ type-safe config definition helpersloadDevServerConfigβ load and merge dev-server configuration filesresolvePackage/resolveEntryPointβ package and entry-point resolutionRuntimeEnvβ runtime environment type used across the CLI
@equinor/fusion-framework-cli/app
defineAppManifest/defineAppConfigβ type-safe manifest and config helpersloadAppManifest/loadAppConfigβ load and validate app manifest/config filescreateAppManifestFromPackageβ generate a manifest frompackage.jsonmergeAppManifests/mergeAppConfigβ deep-merge manifest/config objectsApiAppConfigSchemaβ Zod schema for app config validation
@equinor/fusion-framework-cli/portal
definePortalManifest/definePortalConfig/definePortalSchemaβ type-safe helpersloadPortalManifest/loadPortalConfig/loadPortalSchemaβ load and validate filescreatePortalManifestFromPackageβ generate a portal manifest frompackage.jsonvalidatePortalManifestβ validate a manifest against the Zod schema
@equinor/fusion-framework-cli/bin
buildApplication/buildPortalβ programmatic Vite buildsbundleApp/bundlePortalβ build + pack into zipuploadApplication/uploadPortalBundleβ upload bundles to the servicetagApplication/tagPortalβ tag published versionsinitializeFramework/configureFrameworkβ set up the Fusion Framework for CLI operationsFusionEnvβ enum of supported Fusion environments
@equinor/fusion-framework-cli/utils
assert/assertFileExists/assertObjectβ assertion helpersfileExists/fileExistsSyncβ file-existence checkswriteFileβ write files with automatic directory creationresolveAnnotationsβ resolve CI/CD build annotationsgenerateSnapshotVersionβ create timestamped snapshot versions
Configuration
Application manifest (app.manifest.ts)
import { defineAppManifest } from '@equinor/fusion-framework-cli/app';
export default defineAppManifest((env, { base }) => ({
...base,
// override manifest fields here
}));Application config (app.config.ts)
import { defineAppConfig } from '@equinor/fusion-framework-cli/app';
export default defineAppConfig((env, { base }) => ({
environment: { MY_VAR: 'value' },
endpoints: {
api: { url: 'https://api.example.com', scopes: ['api://scope/.default'] },
},
}));Dev-server config (dev-server.config.ts)
import { defineDevServerConfig } from '@equinor/fusion-framework-cli';
export default defineDevServerConfig((env, { base }) => ({
...base,
// override dev-server options here
}));Local mock services (mocks/<service>.mock.ts)
Use executable service modules instead of handwritten routes in dev-server.config.ts. Install@equinor/fusion-framework-cli-plugin-mock-server, define each service with defineService, and
run ffc mock-server in a separate foreground terminal.
See Develop with mock services for normal discovery overlays,
isolated --mock development, and discovery modes.
CLI plugins (fusion-cli.config.ts)
import { defineFusionCli } from '@equinor/fusion-framework-cli';
export default defineFusionCli(() => ({
plugins: ['@equinor/fusion-framework-cli-plugin-ai'],
}));Request identification headers
Every request the CLI itself sends to Fusion services identifies the tool and its version, so
service operators can tell Fusion Framework traffic apart from other callers when investigating
unexpected requests (for example in Fusion Discovery logs).
| Header | Value |
|---|---|
X-Fusion-CLI-Name | fusion-framework-cli |
X-Fusion-CLI-Version | The installed CLI version, e.g. 15.5.3 |
User-Agent | fusion-framework-cli/<version> |
This covers service discovery lookups and every other client created by configureFramework,
publish, upload, check and tag calls, and the AI model, embedding and search index calls. It uses
the same X-Fusion-CLI-* convention as the other Fusion CLIs, so one filter on x-fusion-cli-name
finds all of them.
Requests forwarded by the dev server (ffc app dev, ffc app serve, ffc portal dev) are not CLI
calls. They identify the dev server instead with X-Fusion-Dev-Server-Name andX-Fusion-Dev-Server-Version, plus X-Fusion-Mock: true|false; see the
dev server README.
- Diagnostics only. The values can be faked, so never use them for access control. They never
contain tokens, secrets, or personal information. - Caller headers win. A header already set on a request is never overwritten.
- Programmatic use.
defaultHeadersis exported from@equinor/fusion-framework-cli/bin, andconfigureFrameworkregisters it on the framework HTTP client for you.
Telemetry
The CLI sends one anonymous usage record per invocation, including plugin commands, to the Fusion
Framework CLI Application Insights resource. The record helps maintainers see which commands are
used and how often they fail. It is sent with Microsoft's@azure/monitor-opentelemetry-exporter,
without automatic collection, offline storage or SDK self-telemetry. The client IP tag is sent as0.0.0.0, so Application Insights derives no city or country from the sender's address.
Collected: tool name and CLI version, the static command path (for example app build), the
names of the options used, exit code, outcome (success, failure or cancelled), duration, the
error type name, OS, architecture, Node.js version, whether the run is in CI, the target Fusion
environment when it is a known name (ci, fqa, tr, fprd, dev), and a SHA-256 hash of the
machine id.
Never collected: argument and option values, file paths, URLs, error messages, user names, host
names or tokens.
Opting out
Telemetry is on by default. Any of the following turns it off:
| Method | Scope |
|---|---|
FUSION_CLI_TELEMETRY_OPTOUT=1 (or true) | Current environment |
DO_NOT_TRACK=1 | Current environment |
ffc telemetry disable | Persisted for the user |
ffc telemetry status shows whether telemetry is enabled and why, and ffc telemetry enable turns
it back on. The setting is stored in fusion-framework-cli/telemetry.json under$XDG_CONFIG_HOME (default ~/.config), or %APPDATA% on Windows.
The first interactive run prints a short notice about collection and opting out to stderr, then
records that the notice was shown in a separate telemetry-notice-shown marker file in the same
folder. Recording the notice never rewrites telemetry.json, so it cannot undo an opt-out made at
the same time. The notice is not shown in CI or when stderr is not a terminal.
Behavior
- Never changes the command. Exit codes, output, errors and signals are unchanged. Export
failures are ignored, and waiting for delivery is capped at 3 seconds, after which the CLI
exits. Delivery is best effort, so a record can be lost on a slow or unreliable network. - Trace correlation. While enabled, requests to Fusion services carry a W3C
traceparent
header that shares the invocation'soperation_Id. Requests to the telemetry endpoint are not
traced. The request identification headers are sent whether
or not telemetry is enabled. - Custom destination. Set
FUSION_CLI_TELEMETRY_CONNECTION_STRINGto an Application Insights
connection string to send records elsewhere. - Known gap. Commands that end through their own
process.exit()call exit before the record
can be sent, so those runs are not recorded.
Documentation
- Developing Apps β build, configure, and deploy applications
- Developing Portals β build and publish portal templates
- Dev Server β architecture and configuration
- Authentication β local and CI/CD authentication setup
- Migration v10 β v11 β breaking changes and upgrade steps