Overview
kdx sync has three operational commands:
| Command | Use it for |
|---|---|
kdx sync pull | Download resources from a platform environment into local YAML files |
kdx sync push | Upload local YAML resources to one environment |
kdx sync deploy | Select targets from branch or tag mappings and push them to mapped environments |
sync-config.yaml and one or more manifest files.
Pull
Pull is read-only with respect to the server. It creates or overwrites local files and updates.sync-state/.
First Pull With Discover
Use--discover when onboarding an existing organization:
- Queries the organization for resources.
- Merges discovered resources into the target manifest.
- Preserves existing entries and commented-out exclusions.
- Pulls the resources selected by the manifest.
- Writes state to
.sync-state/<env>.yaml.
Pull Flags
| Flag | Description |
|---|---|
--target | Target from sync-config.yaml. Repeatable. |
--env | Source environment from sync-config.yaml. |
--from-profile | Source profile override. |
--from-url | Source URL override. |
--from-api-key | Source API key override. |
--filter, -f | Regex matched against resource slug or project slug. |
--discover | Discover organization resources and merge the manifest before pulling. |
--discover-dir | Set metadata_dir in a generated manifest. |
--skip-missing | Skip manifest entries that no longer exist on the server. |
--threads | Parallel workers. Default is 4. |
--organization and --project flags are accepted for compatibility, but new workflows should use --target.
Filtering Pulls
--filter does not follow references automatically. If a project references a data definition or Activity Plan, include those slugs in the filter when you need them refreshed too.
Push
Push reads local YAML and creates or updates resources on the destination environment.Push Flags
| Flag | Description |
|---|---|
--target | Target from sync-config.yaml. Repeatable. |
--env | Destination environment from sync-config.yaml. |
--to-profile | Destination profile override. |
--to-url | Destination URL override. |
--to-api-key | Destination API key override. |
--filter, -f | Regex matched against resource slug. |
--dry-run | Validate, diff, and plan without server changes. |
--force | Overwrite resources even when conflict detection finds server drift. |
--threads | Parallel workers. Default is 4. |
What Push Does
- Reads target manifests.
- Resolves local resource files under each
metadata_dir. - Resolves destination environment credentials.
- Compares
.sync-state/<env>.yamlagainst serverchangeSequencevalues. - Skips unchanged resources.
- Pushes changed resources in dependency order.
- Uploads module implementation content when configured.
- Syncs knowledge-set content, items, features, and attachments.
- Updates
.sync-state/<env>.yaml. - Writes a push log under
<metadata_dir>/sync-logs/push/.
Dry Run First
Conflict Detection
Push compares local sync state to server state. If the server changed since the last pull, the resource is treated as conflicted and skipped.--force only after review:
Deploy
Deploy chooses targets and environments from branch or tag mappings, then runs the push workflow.Deploy Flags
| Flag | Description |
|---|---|
--target | Explicit target. Repeatable. Requires --env. |
--env | Explicit or filtering environment. |
--branch | Branch name override for branch mapping. |
--tag | Tag name override for tag mapping. |
--dry-run | Plan without server changes. |
--force | Overwrite conflicts. |
--confirm-each | Confirm each target. |
--confirm-all | Confirm once before all targets. |
--filter, -f | Regex filter for resource slugs. |
--output-json | Write a deployment report for CI/CD. |
--threads | Parallel workers. Default is 4. |
Endpoint Resolution
For pull, source credentials resolve in this order:--from-urlplus--from-api-key--from-profile--envfromsync-config.yaml
--to-urlplus--to-api-key--to-profile--envfromsync-config.yaml
--env and let sync-config.yaml define the URL and API key environment variable.
Push Order
The CLI pushes dependencies before dependents. The important Activity-era ordering is:- Labels and low-level shared resources
- Data definitions, data forms, stores, modules, prompts, and Service Bridges
- Knowledge type definitions and feature instances
- Intakes and Activity Plans
- Project templates and projects
- Task templates, task statuses, and knowledge sets
- Project-scoped knowledge items, triggers, and bindings
