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

135 lines
2.6 KiB
Markdown

# Milestone 03: Hosting CLI
> CLI integration for deploying web applications to Synor Hosting
## Status: Complete
## Tasks
- [x] Add `synor deploy` command group to CLI
- [x] Implement `deploy push` for uploading projects
- [x] Implement `deploy init` for creating synor.json
- [x] Implement `deploy list` for listing deployments
- [x] Implement `deploy delete` for removing deployments
- [x] Add synor.json parsing with framework detection
- [x] Add build command execution
- [x] Add multipart file upload to storage gateway
- [x] Add deployment registration with hosting gateway
- [x] Add name validation (reserved names, format)
- [x] 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
```bash
# 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
```bash
# 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
```bash
# List all deployments
synor deploy list
# Delete a deployment
synor deploy delete myapp
# Get deployment info
synor deploy info myapp
```
## synor.json Schema
```json
{
"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
```bash
cargo test -p synor-cli
cargo run -p synor-cli -- deploy --help
cargo run -p synor-cli -- deploy push --help
```
---
*Completed: January 2026*