DoubleSync.Cli 0.3.0

DoubleSync

Umbraco environment synchronization tool. Sync schema (data types, document types) and content between Umbraco instances using the Management API.

Installation

# Add the private NuGet source
dotnet nuget add source https://nuget.double.pt/nuget --name DoubleDigital

# Install the CLI tool globally
dotnet tool install --global DoubleSync.Cli --add-source https://nuget.double.pt/nuget

Quick Start

1. Configure API User in Umbraco

In your Umbraco project's appsettings.json, add an API user:

{
  "Umbraco": {
    "CMS": {
      "Security": {
        "BackOfficeApiClients": {
          "doublesync": {
            "ClientId": "umbraco-back-office-doublesync",
            "ClientSecret": "your-secret-here",
            "AllowedGrantTypes": ["client_credentials"],
            "AllowedScopes": ["All"]
          }
        }
      }
    }
  }
}

2. Test Connection

doublesync test-connection \
  --url https://your-umbraco-site.com \
  --client-id umbraco-back-office-doublesync \
  --client-secret your-secret-here

3. Export Schema

doublesync schema-export \
  --url https://dev.example.com \
  --client-id umbraco-back-office-doublesync \
  --client-secret your-secret-here \
  --output .doublesync

4. Import Schema to Another Instance

doublesync schema-import \
  --url https://uat.example.com \
  --client-id umbraco-back-office-doublesync \
  --client-secret your-secret-here \
  --input .doublesync

5. Preview Changes (Dry Run)

doublesync schema-import \
  --url https://uat.example.com \
  --client-id umbraco-back-office-doublesync \
  --client-secret your-secret-here \
  --input .doublesync \
  --dry-run

Available Commands

Command Description
init Initialize .doublesync/ config directory
config set Set environment configuration (url, credentials)
config show Show current configuration
test-connection Test connection to an Umbraco instance
schema-export Export schema (data types + document types) to disk
schema-import Import schema from disk (supports --dry-run)
schema-diff Compare schema snapshot against target instance
content-export Export content (documents) to disk
content-import Import content from disk (supports --dry-run)
content-diff Compare content snapshot against target instance
media-export Export media metadata to disk
media-import Import media metadata from disk (supports --dry-run)
media-diff Compare media snapshot against target instance
push Push schema + content + media from source → target
pull Pull schema + content + media from target → local snapshot
status Show what's changed since last sync

Configuration

# Initialize config directory
doublesync init

# Configure environments
doublesync config set dev --url https://dev.example.com --client-id umbraco-back-office-doublesync --client-secret your-secret
doublesync config set uat --url https://uat.example.com --client-id umbraco-back-office-doublesync --client-secret your-secret

# Show current config
doublesync config show

Content Sync

# Export all content
doublesync content-export --url https://dev.example.com --client-id ... --client-secret ...

# Export specific content branch
doublesync content-export --url https://dev.example.com --client-id ... --client-secret ... --path /home

# Export specific culture only
doublesync content-export --url https://dev.example.com --client-id ... --client-secret ... --culture en-US

# Import content
doublesync content-import --url https://uat.example.com --client-id ... --client-secret ...

# Diff content
doublesync content-diff --url https://uat.example.com --client-id ... --client-secret ...

Schema Filtering

# Export only document types
doublesync schema-export --url https://dev.example.com --client-id ... --client-secret ... --type doctypes

# Export only data types
doublesync schema-export --url https://dev.example.com --client-id ... --client-secret ... --type datatypes

Media Sync

# Export media metadata
doublesync media-export --url https://dev.example.com --client-id ... --client-secret ...

# Import media metadata
doublesync media-import --url https://uat.example.com --client-id ... --client-secret ...

# Diff media
doublesync media-diff --url https://uat.example.com --client-id ... --client-secret ...

Push / Pull (Bidirectional Sync)

# Pull from DEV into local snapshot
doublesync pull \
  --url https://dev.example.com \
  --client-id umbraco-back-office-doublesync \
  --client-secret your-secret-here

# Push local snapshot to UAT
doublesync push \
  --url https://uat.example.com \
  --client-id umbraco-back-office-doublesync \
  --client-secret your-secret-here

# Push schema only (no content/media)
doublesync push \
  --url https://uat.example.com \
  --client-id umbraco-back-office-doublesync \
  --client-secret your-secret-here \
  --schema-only

# Interactive mode (preview + confirm)
doublesync push \
  --url https://uat.example.com \
  --client-id umbraco-back-office-doublesync \
  --client-secret your-secret-here \
  --interactive

# Conflict resolution strategy
doublesync push \
  --url https://uat.example.com \
  --client-id umbraco-back-office-doublesync \
  --client-secret your-secret-here \
  --strategy source-wins

# Preview push changes before applying
doublesync push \
  --url https://uat.example.com \
  --client-id umbraco-back-office-doublesync \
  --client-secret your-secret-here \
  --dry-run

# Check what's changed since last sync
doublesync status \
  --url https://uat.example.com \
  --client-id umbraco-back-office-doublesync \
  --client-secret your-secret-here

Requirements

  • .NET 10.0 SDK
  • Umbraco v17+ with Management API enabled
  • API User configured with client_credentials grant type

Development

Prerequisites

Build

dotnet build -c Release

Run Tests

dotnet test

Pack NuGet Packages

dotnet pack src/DoubleSync.Core/DoubleSync.Core.csproj -c Release
dotnet pack src/DoubleSync.Cli/DoubleSync.Cli.csproj -c Release

Packages are output to src/DoubleSync.Core/bin/Release/ and src/DoubleSync.Cli/bin/Release/.

Publish to NuGet Feed

# Push Core library
dotnet nuget push src/DoubleSync.Core/bin/Release/DoubleSync.Core.{VERSION}.nupkg \
  --source https://nuget.double.pt/nuget \
  --api-key "YOUR_API_KEY"

# Push CLI tool
dotnet nuget push src/DoubleSync.Cli/bin/Release/DoubleSync.Cli.{VERSION}.nupkg \
  --source https://nuget.double.pt/nuget \
  --api-key "YOUR_API_KEY"

Version Bumping

Update the <Version> in both project files before packing:

  • src/DoubleSync.Core/DoubleSync.Core.csproj
  • src/DoubleSync.Cli/DoubleSync.Cli.csproj

Demo Instances

Two Umbraco test instances are included in demo-instances/ for testing:

# Start DEV instance (https://localhost:44311)
dotnet run --project demo-instances/dev/DemoUmbraco.Dev.csproj

# Start UAT instance (https://localhost:44312)
dotnet run --project demo-instances/uat/DemoUmbraco.Uat.csproj

API Credentials:

Instance URL Client ID Client Secret
DEV https://localhost:44311 umbraco-back-office-doublesync-dev doublesync-dev-secret
UAT https://localhost:44312 umbraco-back-office-doublesync-uat doublesync-uat-secret

Test sync workflow:

# Install the CLI tool
dotnet tool install --global DoubleSync.Cli --add-source https://nuget.double.pt/nuget

# Test connection to DEV
doublesync test-connection --url https://localhost:44311 --client-id umbraco-back-office-doublesync-dev --client-secret doublesync-dev-secret

# Pull from DEV
doublesync pull --url https://localhost:44311 --client-id umbraco-back-office-doublesync-dev --client-secret doublesync-dev-secret --output .doublesync

# Push to UAT
doublesync push --url https://localhost:44312 --client-id umbraco-back-office-doublesync-uat --client-secret doublesync-uat-secret --input .doublesync

# Check status against UAT
doublesync status --url https://localhost:44312 --client-id umbraco-back-office-doublesync-uat --client-secret doublesync-uat-secret --input .doublesync

License

MITthink

This package has no dependencies.

Version Downloads Last updated
0.4.0 0 02/09/2026
0.3.0 0 02/09/2026
0.1.0 0 02/09/2026