synor/docs/PLAN/PHASE9-SynorHosting/01-Milestone-03-HostingCLI.md
Gulshan Yadav c829362729 feat(cli): add deploy command for Synor Hosting
Add `synor deploy` command group for deploying web applications:
- `synor deploy push` - upload project to Synor Hosting
- `synor deploy init` - create synor.json configuration
- `synor deploy list` - list all deployments
- `synor deploy delete` - remove a deployment

Features:
- synor.json configuration parsing with build/routes/headers
- Framework auto-detection (Next.js, Vite, Astro, Angular, SvelteKit)
- Build command execution with install support
- Multipart file upload to storage gateway
- Deployment name validation with reserved word protection
- Content type detection for 20+ MIME types

Also adds Phase 9 milestone documentation and marks Synor Hosting
as 100% complete in the roadmap.
2026-01-10 12:59:35 +05:30

2.6 KiB

Milestone 03: Hosting CLI

CLI integration for deploying web applications to Synor Hosting

Status: Complete

Tasks

  • Add synor deploy command group to CLI
  • Implement deploy push for uploading projects
  • Implement deploy init for creating synor.json
  • Implement deploy list for listing deployments
  • Implement deploy delete for removing deployments
  • Add synor.json parsing with framework detection
  • Add build command execution
  • Add multipart file upload to storage gateway
  • Add deployment registration with hosting gateway
  • Add name validation (reserved names, format)
  • Add comprehensive test coverage

Files

apps/cli/src/
├── main.rs              # DeployCommands enum
├── commands/
│   ├── mod.rs           # deploy module export
│   └── deploy.rs        # Deploy command handlers

CLI Commands

Deploy Push

# Deploy current directory
synor deploy push

# Deploy with custom name
synor deploy push --name myapp

# Deploy from specific output directory
synor deploy push --output build

# Skip build step
synor deploy push --skip-build

# Use custom gateway
synor deploy push --gateway http://hosting.example.com:8080

Deploy Init

# Initialize synor.json with auto-detection
synor deploy init

# Initialize as SPA
synor deploy init --spa

# Initialize with specific name
synor deploy init --name myproject

Other Commands

# List all deployments
synor deploy list

# Delete a deployment
synor deploy delete myapp

# Get deployment info
synor deploy info myapp

synor.json Schema

{
  "name": "myapp",
  "build": {
    "command": "npm run build",
    "output": "dist",
    "install": "npm install"
  },
  "routes": {
    "spa": true,
    "clean_urls": true
  },
  "headers": [
    {
      "source": "/**",
      "headers": [
        { "key": "X-Frame-Options", "value": "DENY" }
      ]
    }
  ],
  "redirects": [
    {
      "source": "/old",
      "destination": "/new",
      "status": 301
    }
  ],
  "error_pages": {
    "404": "/404.html"
  }
}

Framework Auto-Detection

The CLI automatically detects and configures:

Framework Config File Output Dir
Next.js next.config.js out
Vite vite.config.js dist
Astro astro.config.mjs dist
Angular angular.json dist
SvelteKit svelte.config.js build

Validation Commands

cargo test -p synor-cli
cargo run -p synor-cli -- deploy --help
cargo run -p synor-cli -- deploy push --help

Completed: January 2026