@clawhub-trandactruong-50c859227a
Deploy static websites to W-Spaces. Use when deploying HTML/CSS/JS sites, landing pages, or single-page apps to wspaces.app. Supports project creation, code...
--- name: wspaces-deploy description: Deploy static websites to W-Spaces. Use when deploying HTML/CSS/JS sites, landing pages, or single-page apps to wspaces.app. Supports project creation, code push, and deployment via API key authentication. --- # W-Spaces Deployment Deploy static websites to W-Spaces (wspaces.app). Create projects, push HTML, and deploy to a live URL — all via API. ## Configuration ### Get your API key 1. Register: `scripts/wspaces_auth.sh --register --email [email protected] --password yourpass --name "Your Name"` 2. Verify your email (check inbox) 3. Login: `scripts/wspaces_auth.sh --login --email [email protected] --password yourpass` 4. Copy the API key from the response ### Set the API key ```bash export WSPACES_API_KEY="wsk_live_xxxx..." ``` Or store in `.env`: ``` WSPACES_API_KEY=wsk_live_xxxx... ``` ## Operations ### Create a project ```bash scripts/wspaces_project.sh --create --name "My Landing Page" ``` Response includes project ID and slug. ### Push HTML code ```bash # From a file scripts/wspaces_push.sh --project <project-id> --file ./index.html # From inline HTML scripts/wspaces_push.sh --project <project-id> --html "<html><body><h1>Hello</h1></body></html>" ``` ### Deploy to live URL ```bash scripts/wspaces_deploy.sh --project <project-id> ``` Result: `https://<slug>.wspaces.app` ### List projects ```bash scripts/wspaces_project.sh --list ``` ### Check project details ```bash scripts/wspaces_project.sh --get --id <project-id> ``` ### View deployments ```bash scripts/wspaces_deploy.sh --list --project <project-id> ``` ## Common Workflows ### Deploy a landing page ```bash # 1. Create project scripts/wspaces_project.sh --create --name "Startup Landing" # → project ID: abc-123 # 2. Push code scripts/wspaces_push.sh --project abc-123 --file ./index.html # 3. Deploy scripts/wspaces_deploy.sh --project abc-123 # → https://startup-landing-xyz.wspaces.app ``` ### Update existing site ```bash # Push new code (creates new version) scripts/wspaces_push.sh --project abc-123 --file ./index.html # Redeploy scripts/wspaces_deploy.sh --project abc-123 ``` ### Full flow from scratch Tell your agent: - **"Create a W-Spaces project called My Portfolio"** - **"Push this HTML to my W-Spaces project"** - **"Deploy my project to wspaces.app"** ## API Key Management ```bash # Create additional API key scripts/wspaces_auth.sh --create-key --name "CI/CD Key" # List all keys scripts/wspaces_auth.sh --list-keys # Revoke a key scripts/wspaces_auth.sh --revoke-key --id <key-id> ``` ## API Reference See [wspaces-api.md](references/wspaces-api.md) for complete API documentation. ## Troubleshooting **"WSPACES_API_KEY not set"** ```bash export WSPACES_API_KEY="wsk_live_xxx..." ``` **"Invalid API key"** - Key may be revoked — generate a new one via login - Check for extra spaces when copying **"Please verify your email"** - Check your inbox for verification email - Verify before logging in **"Project not found"** - Verify project ID with `scripts/wspaces_project.sh --list` FILE:README.md # W-Spaces Deploy Skill **Deploy static websites to [wspaces.app](https://wspaces.app). Create projects, push HTML code, and deploy to a live URL — all via the W-Spaces Public API.** ## What This Skill Does - Deploy static HTML/CSS/JS websites to wspaces.app - Create and manage projects via API - Push code and create versioned deployments - Get live URLs like `https://your-project.wspaces.app` ## Quick Start ### 1. Register & Get API Key ```bash # Register (sends verification email) scripts/wspaces_auth.sh --register --email [email protected] --password yourpass --name "Your Name" # Verify email, then login scripts/wspaces_auth.sh --login --email [email protected] --password yourpass # → Returns: wsk_live_xxxx... ``` ### 2. Set the API Key ```bash export WSPACES_API_KEY="wsk_live_xxxx..." ``` ### 3. Deploy Tell your agent: - **"Create a project called My Site on W-Spaces"** - **"Push index.html to my W-Spaces project"** - **"Deploy my W-Spaces project"** Or use scripts directly: ```bash scripts/wspaces_project.sh --create --name "My Site" scripts/wspaces_push.sh --project <id> --file ./index.html scripts/wspaces_deploy.sh --project <id> # → https://my-site-abc123.wspaces.app ``` ## Use Cases - Landing pages for startups - Portfolio sites - Quick prototypes - HTML/CSS demos - AI-generated websites ## Requirements - W-Spaces account (free, 10 credits on signup) - API key (via login endpoint) - `curl` and `jq` installed ## License MIT FILE:SETUP.md # W-Spaces Deploy - Setup Guide ## Setup ### 1. Get your API key **Register a new account:** ```bash scripts/wspaces_auth.sh --register --email [email protected] --password yourpass --name "Your Name" ``` **Check your email** and click the verification link. **Login to get API key:** ```bash scripts/wspaces_auth.sh --login --email [email protected] --password yourpass ``` Copy the `apiKey` from the response. ### 2. Set the API key ```bash export WSPACES_API_KEY="wsk_live_xxxx..." ``` To persist: ```bash echo 'export WSPACES_API_KEY="wsk_live_xxxx..."' >> ~/.bashrc source ~/.bashrc ``` ### 3. Verify ```bash scripts/wspaces_auth.sh --me ``` Should return your user info and credits balance. ## Usage Just tell your agent: - **"Create a W-Spaces project called My App"** - **"Push this HTML to W-Spaces"** - **"Deploy to wspaces.app"** ## What It Does - Create projects on W-Spaces - Push HTML/CSS/JS code - Deploy to live URLs (`*.wspaces.app`) - Manage API keys - View deployment history ## What It Doesn't Do - No code generation - No AI website builders - No magic — just deploys what you give it FILE:references/wspaces-api.md # W-Spaces Public API v1 Base URL: `https://api.wspaces.app` ## Authentication All protected endpoints accept: - `X-API-Key: wsk_live_xxxx...` header - `Authorization: Bearer wsk_live_xxxx...` header ## Rate Limits - Auth endpoints: 10 requests/minute - All other endpoints: 60 requests/minute --- ## Auth ### POST /api/v1/auth/register Register a new account. Sends verification email. **Body:** ```json { "email": "string", "password": "string (min 8 chars)", "name": "string" } ``` **Response 200:** ```json { "message": "Registration successful. Please check your email to verify your account.", "email": "string" } ``` ### POST /api/v1/auth/login Login and receive an API key. Requires verified email. **Body:** ```json { "email": "string", "password": "string" } ``` **Response 200:** ```json { "apiKey": "wsk_live_xxxx...", "user": { "id": "guid", "email": "string", "name": "string", "creditsBalance": 10 } } ``` ### POST /api/v1/auth/api-keys Create an additional API key. **Requires auth.** **Body:** ```json { "name": "string" } ``` **Response 200:** ```json { "id": "guid", "name": "string", "prefix": "wsk_live_xxxx", "rawKey": "wsk_live_full_key...", "createdAt": "datetime" } ``` ### GET /api/v1/auth/api-keys List all API keys. **Requires auth.** **Response 200:** ```json [{ "id": "guid", "name": "string", "prefix": "wsk_live_xxxx", "createdAt": "datetime", "lastUsedAt": "datetime|null", "isRevoked": false }] ``` ### DELETE /api/v1/auth/api-keys/{id} Revoke an API key. **Requires auth.** **Response 204** No Content --- ## Me ### GET /api/v1/me Get current user profile. **Requires auth.** **Response 200:** ```json { "id": "guid", "email": "string", "name": "string", "avatarUrl": "string|null", "creditsBalance": 10, "roles": [] } ``` --- ## Projects ### POST /api/v1/projects Create a new project. **Requires auth.** **Body:** ```json { "name": "string", "category": "string|null", "style": "string|null", "description": "string|null" } ``` **Response 201:** ```json { "id": "guid", "name": "string", "slug": "string", "status": "Draft", "createdAt": "datetime", ... } ``` ### GET /api/v1/projects List all projects. **Requires auth.** ### GET /api/v1/projects/{id} Get project details. **Requires auth.** ### PUT /api/v1/projects/{id}/code Push HTML code to a project. Creates a new version. **Requires auth.** **Body:** ```json { "html": "<html>...</html>" } ``` **Response 200:** ```json { "id": "guid", "versionNumber": 1, "htmlContent": "...", "source": "Api", "createdAt": "datetime" } ``` ### POST /api/v1/projects/{id}/deploy Deploy the current version to a live URL. **Requires auth.** **Response 200:** ```json { "id": "guid", "projectId": "guid", "versionId": "guid", "status": "Active", "url": "https://slug.wspaces.app", "deployedAt": "datetime" } ``` ### GET /api/v1/projects/{id}/deployments List deployment history. **Requires auth.** FILE:scripts/wspaces_auth.sh #!/bin/bash # W-Spaces authentication script set -euo pipefail API_BASE="-https://api.wspaces.app" # Parse arguments ACTION="" EMAIL="" PASSWORD="" NAME="" KEY_NAME="" KEY_ID="" while [[ $# -gt 0 ]]; do case $1 in --register) ACTION="register"; shift ;; --login) ACTION="login"; shift ;; --me) ACTION="me"; shift ;; --create-key) ACTION="create-key"; shift ;; --list-keys) ACTION="list-keys"; shift ;; --revoke-key) ACTION="revoke-key"; shift ;; --email) EMAIL="$2"; shift 2 ;; --password) PASSWORD="$2"; shift 2 ;; --name) NAME="$2"; shift 2 ;; --key-name) KEY_NAME="$2"; shift 2 ;; --id) KEY_ID="$2"; shift 2 ;; *) echo "Unknown option: $1"; exit 1 ;; esac done case "$ACTION" in register) if [ -z "$EMAIL" ] || [ -z "$PASSWORD" ] || [ -z "$NAME" ]; then echo "Error: --email, --password, and --name required" exit 1 fi curl -s -X POST "$API_BASE/api/v1/auth/register" \ -H "Content-Type: application/json" \ -d "{\"email\":\"$EMAIL\",\"password\":\"$PASSWORD\",\"name\":\"$NAME\"}" | jq . ;; login) if [ -z "$EMAIL" ] || [ -z "$PASSWORD" ]; then echo "Error: --email and --password required" exit 1 fi curl -s -X POST "$API_BASE/api/v1/auth/login" \ -H "Content-Type: application/json" \ -d "{\"email\":\"$EMAIL\",\"password\":\"$PASSWORD\"}" | jq . ;; me) if [ -z "-" ]; then echo "Error: WSPACES_API_KEY not set" exit 1 fi curl -s -X GET "$API_BASE/api/v1/me" \ -H "X-API-Key: $WSPACES_API_KEY" | jq . ;; create-key) if [ -z "-" ]; then echo "Error: WSPACES_API_KEY not set" exit 1 fi KEY_NAME="-API Key" curl -s -X POST "$API_BASE/api/v1/auth/api-keys" \ -H "X-API-Key: $WSPACES_API_KEY" \ -H "Content-Type: application/json" \ -d "{\"name\":\"$KEY_NAME\"}" | jq . ;; list-keys) if [ -z "-" ]; then echo "Error: WSPACES_API_KEY not set" exit 1 fi curl -s -X GET "$API_BASE/api/v1/auth/api-keys" \ -H "X-API-Key: $WSPACES_API_KEY" | jq . ;; revoke-key) if [ -z "-" ]; then echo "Error: WSPACES_API_KEY not set" exit 1 fi if [ -z "$KEY_ID" ]; then echo "Error: --id required" exit 1 fi curl -s -X DELETE "$API_BASE/api/v1/auth/api-keys/$KEY_ID" \ -H "X-API-Key: $WSPACES_API_KEY" echo "Key revoked." ;; *) echo "Usage: wspaces_auth.sh <action> [options]" echo "" echo "Actions:" echo " --register --email <email> --password <pass> --name <name>" echo " --login --email <email> --password <pass>" echo " --me" echo " --create-key [--key-name <name>]" echo " --list-keys" echo " --revoke-key --id <key-id>" exit 1 ;; esac FILE:scripts/wspaces_deploy.sh #!/bin/bash # W-Spaces deployment script set -euo pipefail API_BASE="-https://api.wspaces.app" if [ -z "-" ]; then echo "Error: WSPACES_API_KEY not set" exit 1 fi # Parse arguments ACTION="deploy" PROJECT_ID="" while [[ $# -gt 0 ]]; do case $1 in --project) PROJECT_ID="$2"; shift 2 ;; --list) ACTION="list"; shift ;; *) echo "Unknown option: $1"; exit 1 ;; esac done if [ -z "$PROJECT_ID" ]; then echo "Error: --project required" exit 1 fi case "$ACTION" in deploy) echo "Deploying project $PROJECT_ID..." RESULT=$(curl -s -X POST "$API_BASE/api/v1/projects/$PROJECT_ID/deploy" \ -H "X-API-Key: $WSPACES_API_KEY") echo "$RESULT" | jq . URL=$(echo "$RESULT" | jq -r '.url // empty') if [ -n "$URL" ]; then echo "" echo "Live at: $URL" fi ;; list) curl -s -X GET "$API_BASE/api/v1/projects/$PROJECT_ID/deployments" \ -H "X-API-Key: $WSPACES_API_KEY" | jq . ;; esac FILE:scripts/wspaces_project.sh #!/bin/bash # W-Spaces project management script set -euo pipefail API_BASE="-https://api.wspaces.app" if [ -z "-" ]; then echo "Error: WSPACES_API_KEY not set" exit 1 fi # Parse arguments ACTION="" PROJECT_NAME="" PROJECT_ID="" CATEGORY="" DESCRIPTION="" while [[ $# -gt 0 ]]; do case $1 in --create) ACTION="create"; shift ;; --list) ACTION="list"; shift ;; --get) ACTION="get"; shift ;; --name) PROJECT_NAME="$2"; shift 2 ;; --id) PROJECT_ID="$2"; shift 2 ;; --category) CATEGORY="$2"; shift 2 ;; --description) DESCRIPTION="$2"; shift 2 ;; *) echo "Unknown option: $1"; exit 1 ;; esac done case "$ACTION" in create) if [ -z "$PROJECT_NAME" ]; then echo "Error: --name required" exit 1 fi BODY="{\"name\":\"$PROJECT_NAME\"" [ -n "$CATEGORY" ] && BODY="$BODY,\"category\":\"$CATEGORY\"" [ -n "$DESCRIPTION" ] && BODY="$BODY,\"description\":\"$DESCRIPTION\"" BODY="$BODY}" curl -s -X POST "$API_BASE/api/v1/projects" \ -H "X-API-Key: $WSPACES_API_KEY" \ -H "Content-Type: application/json" \ -d "$BODY" | jq . ;; list) curl -s -X GET "$API_BASE/api/v1/projects" \ -H "X-API-Key: $WSPACES_API_KEY" | jq . ;; get) if [ -z "$PROJECT_ID" ]; then echo "Error: --id required" exit 1 fi curl -s -X GET "$API_BASE/api/v1/projects/$PROJECT_ID" \ -H "X-API-Key: $WSPACES_API_KEY" | jq . ;; *) echo "Usage: wspaces_project.sh <action> [options]" echo "" echo "Actions:" echo " --create --name <name> [--category <cat>] [--description <desc>]" echo " --list" echo " --get --id <project-id>" exit 1 ;; esac FILE:scripts/wspaces_push.sh #!/bin/bash # W-Spaces code push script set -euo pipefail API_BASE="-https://api.wspaces.app" if [ -z "-" ]; then echo "Error: WSPACES_API_KEY not set" exit 1 fi # Parse arguments PROJECT_ID="" HTML_CONTENT="" FILE_PATH="" while [[ $# -gt 0 ]]; do case $1 in --project) PROJECT_ID="$2"; shift 2 ;; --html) HTML_CONTENT="$2"; shift 2 ;; --file) FILE_PATH="$2"; shift 2 ;; *) echo "Unknown option: $1"; exit 1 ;; esac done if [ -z "$PROJECT_ID" ]; then echo "Error: --project required" exit 1 fi if [ -z "$HTML_CONTENT" ] && [ -z "$FILE_PATH" ]; then echo "Error: --html or --file required" exit 1 fi # Read from file if provided if [ -n "$FILE_PATH" ]; then if [ ! -f "$FILE_PATH" ]; then echo "Error: File not found: $FILE_PATH" exit 1 fi HTML_CONTENT=$(cat "$FILE_PATH") fi # Escape JSON special characters HTML_ESCAPED=$(echo "$HTML_CONTENT" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))') curl -s -X PUT "$API_BASE/api/v1/projects/$PROJECT_ID/code" \ -H "X-API-Key: $WSPACES_API_KEY" \ -H "Content-Type: application/json" \ -d "{\"html\":$HTML_ESCAPED}" | jq .