diff --git a/README.md b/README.md index 8204dac5..2192ca19 100644 --- a/README.md +++ b/README.md @@ -235,6 +235,7 @@ By adding selected `.mdc` files to `.cursor/rules/`, you can use these rules dir - [Cloudflare Email to Telegram](https://github.com/PatrickJS/awesome-cursorrules/blob/main/rules/cloudflare-email-telegram-cursorrules-prompt-file.mdc) - Setting up email-to-Telegram forwarding via Cloudflare Email Routing and Workers using the mail2tg CLI. - [Netlify](https://github.com/PatrickJS/awesome-cursorrules/blob/main/rules/netlify-official-cursorrules-prompt-file.mdc) - Official deployment platform integration. - [Vercel](https://github.com/PatrickJS/awesome-cursorrules/blob/main/rules/vercel-deployment-cursorrules-prompt-file.mdc) - Deployment with serverless functions, Edge Runtime, middleware, caching, CI/CD, and production-ready configuration. +- [HTML To Link](rules/html-to-link-deploy.mdc) - Deploy HTML projects to a live public URL without server setup. Supports anonymous temporary pages and authenticated managed deployments. ### Build Tools and Development diff --git a/rules/html-to-link-deploy.mdc b/rules/html-to-link-deploy.mdc new file mode 100644 index 00000000..b346861e --- /dev/null +++ b/rules/html-to-link-deploy.mdc @@ -0,0 +1,107 @@ +--- +description: Deploy HTML projects to a live public URL via htmlto.link - packages, uploads, and returns a shareable link without server setup +globs: +alwaysApply: false +--- + +# HTML To Link - Instant HTML Deployment + +You have the ability to deploy the current project to a live public URL using HTML To Link (https://htmlto.link). + +## When to use + +When the user asks to: +- Deploy, publish, or host the current project/page +- Get a shareable link for the current work +- Put the current HTML/site online +- Share the current page with others + +## Deployment workflow + +1. Read `.htmltolink.json` from the project root if it exists. + - If it contains `shareUrl` + `updateToken`: update that existing page. + - If it contains `shareUrl` + `versionNo` (authenticated): update that managed page. + - Otherwise: create a new deployment. + +2. Package the project into a ZIP archive. **Always exclude**: + - `.htmltolink.json` (contains credentials) + - `node_modules`, `.git`, `.next`, `dist`, `.cache`, `.turbo` + - `.env`, `.env.*`, `*.pem`, `*.key` (secrets) + +3. Call the deploy API: + +```bash +curl -X POST "https://htmlto.link/api/skill/deploy" \ + -F "file=@" \ + -F "entry_file=index.html" \ + -F "title=" +``` + +For authenticated users (when `HTML_TO_LINK_TOKEN` env var exists): +```bash +curl -X POST "https://htmlto.link/api/skill/deploy" \ + -H "Authorization: Bearer $HTML_TO_LINK_TOKEN" \ + -F "file=@" \ + -F "entry_file=index.html" \ + -F "title=" \ + -F "share_url=" +``` + +For anonymous updates (reusing project-owned temporary page): +```bash +curl -X POST "https://htmlto.link/api/skill/deploy" \ + -F "file=@" \ + -F "entry_file=index.html" \ + -F "title=" \ + -F "share_url=" \ + -F "update_token=" +``` + +4. After success, create or update `.htmltolink.json` in the project root: + +Anonymous mode: +```json +{ + "shareUrl": "https://htmlto.link/xxxxxxxx", + "updateToken": "", + "temporary": true, + "expiresAt": "" +} +``` + +Authenticated mode: +```json +{ + "shareUrl": "https://htmlto.link/xxxxxxxx", + "versionNo": "" +} +``` + +5. Ensure `.gitignore` contains `.htmltolink.json`. + +6. Return **only** the final share URL to the user. Never expose `updateToken`. + +## Important rules + +- Never display or log the `updateToken` value to the user. +- Never include `.htmltolink.json` in the upload ZIP. +- If the entry HTML file is ambiguous, ask the user which file to use. +- Anonymous deployments last 24 hours; updating resets the timer. +- The API returns JSON with `shareUrl`, and optionally `updateToken`, `expiresAt`, `versionNo`. + +## MCP Server (alternative) + +For native tool integration, users can add the MCP server instead: + +```json +{ + "mcpServers": { + "htmltolink": { + "command": "npx", + "args": ["-y", "htmltolink-mcp"] + } + } +} +``` + +GitHub: https://github.com/licc168/htmltolink-mcp