Skip to content

Latest commit

Β 

History

History
560 lines (423 loc) Β· 16.6 KB

File metadata and controls

560 lines (423 loc) Β· 16.6 KB

πŸ”’ CloudSync-CLI

CloudSync Banner npm version GitHub package version License Node.js Version GitHub Actions GitHub Downloads

An open-source, Git-like version control CLI for secure cloud-to-local synchronization via encrypted SSH tunnels

"Your configs, your cloud, your rules - no public repos required."


πŸš€ Why CloudSync-CLI?

The Problem with Traditional Git

Limitation Git CloudSync-CLI
Sensitive Data Requires .gitignore hacks & external tools Built-in encrypted channels for .env, keys, configs
Large Binaries Poor handling, bloats repos Optimized chunking & delta compression
Binary Diffs Not supported Full delta compression with zstd/lz4
Transfer Protocols HTTPS only SSH, SFTP, RSYNC, WebSocket, Direct Pipe

| Real-time Sync | Manual push/pull cycles | Optional watch mode with instant sync | | P2P Sharing | Requires fork/clone | Session links with optional password protection | | Conflict Resolution | Manual 3-way merge | Visual diff + automated strategies | | Cloud-Native | Indirect integration | Direct SSH, any cloud platform | | Memory Safety | Disk-based temp files | Memory-only streams for sensitive data | | Speed | Compressed HTTPS | Raw SSH piping for maximum throughput |

Our Solution

CloudSync-CLI brings Git-like version control to sensitive configuration files and environment data, with enterprise-grade security and multiple transport options that Git simply wasn't designed for.


✨ Features

πŸ” Security First

  • Pure SSH2 Protocols - No middleman tracking, all traffic between your authorized keypairs
  • Memory-Only Streams - Temporary files bypass disk writes, protecting sensitive keys
  • SHA-256 Integrity - Every transfer verified with cryptographic checksums
  • Password Protection - Optional password for shareable session links

πŸš„ Multiple Transport Methods

Protocol Speed Compression Resume Best For
SSH-SCP ⚑⚑⚑ External ❌ Simple transfers
SSH-SFTP ⚑⚑⚑ Configurable βœ… Full features
RSYNC-DELTA ⚑⚑⚑⚑ Built-in βœ… Large syncs
WEBSOCKET ⚑⚑⚑⚑ Stream βœ… Real-time sync
DIRECT-PIPE ⚑⚑⚑⚑⚑ None ❌ Maximum speed
HYBRID-ZIP ⚑⚑⚑ High ❌ Archives

πŸ“¦ Git-Like Version Control

  • Staging Area - Stage specific files before committing
  • Commit History - Full version history with messages
  • Diff Comparison - Compare any two versions
  • Rollback - Revert to any previous version instantly
  • Branching Model - Profile-based configuration management

πŸ”— P2P Sharing

  • Generate shareable session links
  • Password-protected sessions
  • Real-time connection monitoring
  • Clipboard-ready URLs
  • Configurable expiration

πŸ–₯️ SSH Tunneling

  • Local and remote port forwarding
  • Background tunnel mode
  • Multi-port configuration
  • Verbose tunnel status

πŸ“₯ Installation

Via npm (Global)

npm install -g cloudsync-cli

Via Windows Installer

Download CloudSync-Setup.exe from our releases page and run the installer.

Verify Installation

cloudsync --version
# cloudsync/1.0.0 linux-x64 node-v18.17.0

πŸ“– Quick Start

1. Initialize Configuration

# Interactive setup
cloudsync init

# Or with all options
cloudsync init \
  --host your-server.com \
  --user myusername \
  --port 22 \
  --protocol ssh \
  --verbose

2. Stage Files

# Stage specific files
cloudsync stage .env config.json

# Stage all files
cloudsync stage --all

# Stage by pattern
cloudsync stage --include "*.config.js,*.json"

3. Commit Changes

cloudsync commit "Add production environment config"

4. Upload to Cloud

# Full upload with compression
cloudsync upload --compress zip --verbose

# Upload with custom protocol
cloudsync upload --protocol rsync --exclude node_modules,.git

# Dry run preview
cloudsync upload --dry-run

5. Download from Cloud

# Download latest
cloudsync download --latest

# Download specific version
cloudsync download --version v1234-abcd

# Download specific files
cloudsync download .env --verbose

6. Bidirectional Sync

# One-time sync
cloudsync sync

# Watch mode (continuous)
cloudsync sync --watch --interval 30

# With conflict strategy
cloudsync sync --strategy local --verbose

πŸ› οΈ Command Reference

Core Commands

Command Description
cloudsync init Initialize configuration profile
cloudsync upload [files] Upload files to remote
cloudsync download [files] Download files from remote
cloudsync sync Bidirectional synchronization
cloudsync port <local:remote> Create SSH tunnel
cloudsync share [path] Generate shareable session link

Version Control Commands

Command Description
cloudsync stage [files] Stage files for commit
cloudsync unstage [files] Remove from staging
cloudsync commit [msg] Commit staged changes
cloudsync history View commit history
cloudsync diff [versions] Compare versions
cloudsync rollback <version> Revert to version
cloudsync status Show repository status
cloudsync log View operation logs

Utility Commands

Command Description
cloudsync config [key] [value] Manage configuration
cloudsync doctor Run diagnostics
cloudsync clone <remote> Clone remote workspace
cloudsync help [topic] Show help

Global Flags

Flag Description
-v, --verbose Enable verbose output
-q, --quiet Suppress messages
-c, --config <path> Custom config file
--no-color Disable colors

πŸ“‹ Command Options Reference

upload Options

cloudsync upload [files...]
  --include <patterns>     # Files to include (comma-separated)
  --exclude <patterns>      # Files to exclude (default: node_modules,.git,dist,build)
  --message <msg>           # Commit message
  --all                     # Upload all changes
  --force                   # Force overwrite
  --compress <method>       # zip|lz4|zstd (default: zip)
  --chunk-size <MB>        # Chunk size (default: 10)
  --protocol <proto>       # ssh|sftp|rsync|websocket|pipe
  --verbose                # Detailed progress
  --dry-run                # Preview only
  --profile <name>         # Config profile

download Options

cloudsync download [files...]
  --include <patterns>     # Specific files to fetch
  --exclude <patterns>     # Skip certain files
  --version <id>          # Specific version
  --latest                # Fetch latest
  --verbose               # Detailed progress
  --dry-run               # Preview only
  --profile <name>        # Config profile
  --output <path>         # Output directory

sync Options

cloudsync sync
  --strategy <type>       # local|remote|manual
  --watch                 # Continuous watching
  --interval <seconds>    # Sync interval (default: 30)
  --verbose               # Detailed logs
  --dry-run               # Preview
  --profile <name>        # Config profile
  --include <patterns>    # Files to sync
  --exclude <patterns>    # Files to skip

share Options

cloudsync share [path]
  --type <type>           # file|folder|session
  --port <number>         # Server port (default: 3000)
  --expires <minutes>     # Expiration (default: 60)
  --password <pwd>         # Password protection
  --verbose               # Show details
  --open                  # Auto-open URL
  --profile <name>        # Config profile

port Options

cloudsync port <local:remote>
  --host <hostname>       # Bind host (default: 0.0.0.0)
  --verbose               # Show tunnel details
  --background            # Run in background
  --profile <name>        # Config profile

πŸ”§ Configuration

Profile Structure

{
  "profiles": {
    "default": {
      "host": "your-server.com",
      "user": "myusername",
      "port": 22,
      "key": "~/.ssh/id_rsa",
      "protocol": "ssh",
      "workspace": "/home/myuser/project",
      "createdAt": "2024-01-15T10:30:00Z"
    },
    "production": {
      "host": "prod.example.com",
      "user": "deploy",
      "protocol": "rsync"
    }
  },
  "settings": {
    "compression": "zip",
    "chunkSize": 10,
    "verbose": false,
    "defaultProfile": "default"
  }
}

Config Commands

# List all config
cloudsync config --list

# Get specific value
cloudsync config profiles.default.host

# Set value
cloudsync config settings.compression zstd

# Use global config
cloudsync config --global settings.verbose true

# Unset value
cloudsync config --unset profiles.production

πŸ”’ Security Architecture

Transport Security

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    CloudSync Security                    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                          β”‚
β”‚  Your Local Machine                                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                    β”‚
β”‚  β”‚  Private Key πŸ”  │──── Encrypted Tunnel ──────►      β”‚
β”‚  β”‚  (never leaves)  β”‚        SSH2                         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚                     β”‚
β”‚                                    β–Ό                     β”‚
β”‚  Memory-Only Streams ◄───────────────                     β”‚
β”‚  (no disk writes)                   β”‚                     β”‚
β”‚                                     β–Ό                     β”‚
β”‚  Remote Server (SSH or cloud)         β”‚                     β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”       Authenticated & Encrypted    β”‚
β”‚  β”‚  Public Key πŸ”“  │◄──────────────────────────         β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                    β”‚
β”‚                                                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Security Features

  1. Zero-Trust Architecture - Keys never leave your machine
  2. Memory-Only Processing - Sensitive data never touches disk
  3. End-to-End Encryption - SSH2 with strong cipher suites
  4. Integrity Verification - SHA-256 checksums on all transfers
  5. Session Tokens - Unique, expirable shareable links
  6. No Third-Party Tracking - 100% peer-to-peer

πŸ—οΈ Architecture Overview

cloudsync-cli/
β”œβ”€β”€ bin/
β”‚   └── cloudsync.js          # Entry point
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ cli/
β”‚   β”‚   β”œβ”€β”€ index.js          # Commander.js setup
β”‚   β”‚   └── commands/         # Command definitions
β”‚   β”‚       β”œβ”€β”€ init.js
β”‚   β”‚       β”œβ”€β”€ upload.js
β”‚   β”‚       β”œβ”€β”€ download.js
β”‚   β”‚       β”œβ”€β”€ sync.js
β”‚   β”‚       β”œβ”€β”€ port.js
β”‚   β”‚       β”œβ”€β”€ share.js
β”‚   β”‚       β”œβ”€β”€ stage.js
β”‚   β”‚       β”œβ”€β”€ commit.js
β”‚   β”‚       β”œβ”€β”€ history.js
β”‚   β”‚       β”œβ”€β”€ diff.js
β”‚   β”‚       β”œβ”€β”€ rollback.js
β”‚   β”‚       β”œβ”€β”€ status.js
β”‚   β”‚       β”œβ”€β”€ config.js
β”‚   β”‚       β”œβ”€β”€ doctor.js
β”‚   β”‚       β”œβ”€β”€ clone.js
β”‚   β”‚       └── log.js
β”‚   β”œβ”€β”€ transport/            # Protocol implementations
β”‚   β”œβ”€β”€ vcs/                  # Version control system
β”‚   └── utils/                # Helper functions
β”œβ”€β”€ package.json
└── README.md

πŸ“Š Comparison with Git Workflows

Traditional Git Workflow (With Sensitive Files)

# Problem: Sensitive files need special handling
git add .env                    # ❌ Danger! May commit secrets
echo ".env" >> .gitignore      # βœ“ But now it's untracked
git add .env.example            # βœ“ Manual workaround

# Or use git-crypt (complex setup)
git crypt init                  # Complex
git crypt lock                  # Lock when done

# Environment-specific repos (messy)
git remote add prod git@github.com:myorg/prod-configs.git

CloudSync Workflow (Same Project)

# Simple and secure
cloudsync init --host your-server.com --user myuser
cloudsync stage .env config.json
cloudsync commit "Update environment config"
cloudsync upload                # Encrypted, versioned, done

# Files stay private, never in Git

🌐 Use Cases

1. Cloud Environment Sync

# Sync local .env to your cloud server
cloudsync upload --include .env,config.json --exclude node_modules

# Pull latest from your cloud server
cloudsync download --latest

# Create persistent tunnel for local dev
cloudsync port 3000:3000 --background

2. Multi-Environment Configs

# Development profile
cloudsync init --profile dev --host dev.server.com

# Production profile
cloudsync init --profile prod --host prod.server.com

# Switch and sync
cloudsync upload --profile prod

3. Team Sharing (Without Git Access)

# Generate secure share link
cloudsync share --type folder . --expires 120 --password MyPass123

# Share the link with team
πŸ”— http://localhost:3000/share/abc123

4. CI/CD Integration

# In CI pipeline
cloudsync download --version $COMMIT_SHA --dry-run
cloudsync download --version $COMMIT_SHA

πŸ” Troubleshooting

Doctor Command

Run diagnostics to identify issues:

cloudsync doctor --verbose

Common Issues

Issue Solution
SSH connection fails Run cloudsync doctor to test credentials
Permission denied Check SSH key permissions: chmod 600 ~/.ssh/id_rsa
No files to upload Ensure --include patterns match your files
Config not found Run cloudsync init first

🀝 Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing)
  5. Open a Pull Request

πŸ“„ License

MIT License - see LICENSE for details.


πŸ™ Acknowledgments


Made with ❀️ for developers who value security and simplicity

Star on GitHub Tweet