CLI Reference
1c is the @1consent/cli command-line interface. Manage 1Consent designs, themes, and generated integration types locally.
Developer preview: @1consent/cli is still workspace-private. Do not publish installation commands until the provenance-backed package release is complete.
Authentication and workspace
Create an API key with the Design Manager right in Dashboard → API, then expose it as ONECONSENT_TOKEN. 1c init writes the key to .env and the resolved public scope to .1consentrc. Organization resources live at the workspace root; project and app resources mirror the tenant hierarchy below projects/{project-id}/. Existing project-slug directories remain push-compatible when the slug identifies exactly one project. Pull and push reject symbolic links anywhere in synchronized workspace paths so checkout files cannot redirect reads or writes outside the workspace.
| Environment variable | Required | Purpose |
|---|---|---|
ONECONSENT_TOKEN | Yes | Customer API key used by init, pull, and push. |
ONECONSENT_SYSTEM_PUBLISHER_TOKEN | Yes | Internal system-publisher token used only by push-system and publish. |
ONECONSENT_ENV | No | Environment selected by init: local, develop, or production. Defaults to production. |
NEXT_PUBLIC_1CONSENT_APP_ID | No | Application short ID fallback used by typegen. |
Customer push synchronizes draft assets. Activate the resulting CMP configuration through the Dashboard publication workflow.
1c init
Initialize a project with the 1Consent CLI.
Validates an API key, writes .1consentrc and .env, creates the workspace directories, and scaffolds a Design Kit project when required.
Options
| Option | Description | Default |
|---|---|---|
-f, --force | Force reinitialization even when .1consentrc already exists. | — |
Examples
1c initONECONSENT_ENV=develop 1c init --force1c pull
Download designs and themes from the platform.
Reads the hierarchy visible to the configured API key and mirrors authorized resources into the local workspace. Organization keys use projects/{projectId}/apps/{appId}; project keys place child apps in apps/{appId}; app keys use the workspace root.
Options
No command-specific options.
Examples
1c pull1c push
Upload local designs and themes to the platform.
Synchronizes customer draft collections, themes, and existing pulled standalone designs using the same credential-scoped layout as pull. The complete authorized checkout is parsed, metadata-resolved, and contract-validated before the first upload starts. Existing resource IDs and Dashboard display metadata are preserved while local files and theme tokens are updated; new collections, collection designs, and themes use their directory names. Publishing the resulting CMP configuration remains an explicit Dashboard action.
Options
No command-specific options.
Examples
1c push1c push-system
Stage drafts of official system design collections and themes.
Internal only: customer-scoped API keys are rejected by this command.
Internal-only system publisher command. Uploads official resources as drafts through the internal API before 1c publish activates them.
Options
No command-specific options.
Examples
1c push-system1c publish
Activate versions of official system design collections.
Internal only: customer-scoped API keys are rejected by this command.
Internal-only system publisher command. Customer scopes are rejected; customer designs use 1c push and the Dashboard CMP publication workflow.
Options
| Option | Description | Default |
|---|---|---|
--to <version> | Positive version number to activate, or latest. | latest |
Examples
1c publish1c publish --to 31c status
Show the configured scope and local resource counts.
Prints the active scope, endpoint, and collection, design, and theme counts throughout the local hierarchy.
Options
No command-specific options.
Examples
1c status1c typegen
Generate typed consent names and framework build stamps.
Fetches every published framework for an app and generates TypeScript service/category unions, ID maps, and framework-associated fast-path versions.
Options
| Option | Description | Default |
|---|---|---|
-a, --app <shortId> | Application short ID. Falls back to NEXT_PUBLIC_1CONSENT_APP_ID. | — |
-e, --env <environment> | 1Consent service environment: local, develop, or production. | production |
-u, --url <baseUrl> | Override the CMP API base URL. | — |
-o, --out <file> | Output file. Defaults to src/1consent.gen.ts when src exists, otherwise 1consent.gen.ts. | — |
--check | Fail when the generated file is missing or stale (CI mode). | — |
Examples
1c typegen --app app_demo1c typegen --app app_demo --check1c typegen --app app_demo --env develop --out src/consent.gen.ts