deploy

Deployment instructions for serving a VitePress documentation site through Cloudflare, a web infrastructure provider. The setup uses a Worker to read built files from an R2 storage bucket and resolve friendly page URLs.

In plain words
What is it for?
Use it to deploy or troubleshoot docs.cutcli.com, configure the Cloudflare Worker and R2 bucket, handle page paths and 404 responses, and manage browser caching.
Why use it?
It records the required resources, URL routing, fallback behavior, and cache rules, so documentation deployments can be checked and maintained consistently.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/xuliang2024/cutcli-cookbook/deploy
Clone the repo
git clone --depth 1 https://github.com/xuliang2024/cutcli-cookbook

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,543 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01543
Opus 5 $0.00000 $0.00772
Sonnet 5 $0.00000 $0.00309
Haiku 4.5 $0.00000 $0.00154

Measured 2d ago against content hash b5e0eabac1bb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

deploy scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

→ smoke test (curl 5 个关键路径)
.cursor/rules/deploy.mdc · 176 lines

How it starts

The opening of the file, as written. The whole thing — 176 lines — stays where its author put it; the contents beside it link to each section on GitHub.

部署架构与流程

资源拓扑

flowchart LR
  user[Browser] -->|"https://docs.cutcli.com/*"| dns[Cloudflare DNS]
  dns -->|"proxied A 192.0.2.1"| route[Worker Route]
  route -->|"docs.cutcli.com/*"| worker[Worker docs-cutcli]
  worker -->|"R2 binding DOCS"| r2[(R2 cutcli-docs)]

资源清单

资源 标识
R2 bucket cutcli-docs(专放 VitePress build 产物)
Worker docs-cutcli(src 在本仓 worker/
Worker route docs.cutcli.com/* + docs.cutcli.com
DNS 记录 docs.cutcli.com A 192.0.2.1 (proxied)
Cloudflare account [email protected] (id 11c47779f0d4c3d0e69ccc6c484dc589)
Zone cutcli.com (zone id 064059cb21d36956c11381995b964467)

路径解析(worker 行为)

worker/src/index.ts 收到请求时按下面顺序解析 R2 key:

  1. /index.html
  2. /foo/foo/index.html
  3. /foo/bar.htmlfoo/bar.html (直接命中)
  4. /foo/bar(无扩展名)→ 依次试 foo/bar.htmlfoo/bar/index.html
  5. 都不命中 → 返回 R2 中的 404.html,HTTP 404

缓存策略

路径 Cache-Control
assets/<hash>.{js,css} public, max-age=31536000, immutable (VitePress 文件名带 hash,安全)
其他(含 .html public, max-age=3600, must-revalidate

本地部署

# 一键
npm run deploy

# 等价于
npm run docs:build      # vitepress build → docs/.vitepress/dist
npm run r2:upload       # 增量上传,仅 etag 变化的文件 (~10s)
npm run worker:deploy   # 仅 worker 改动时需要

r2:upload 用并发 6 路调用 worker/node_modules/.bin/wrangler,跳过 md5 相同的文件。设置 UPLOAD_CONCURRENCY=8 可提速。

CI 部署(推荐)

合并到 main 后,.github/workflows/deploy-docs.yml 自动跑:

checkout
  → setup-node v22
  → npm ci (root + worker)
  → npm run docs:build
  → node scripts/upload-r2.mjs        # 增量上传
  → cloudflare/wrangler-action@v3 deploy worker (仅 worker 有改动时)
  → smoke test (curl 5 个关键路径)

触发条件(paths):

  • docs/**
  • worker/**
  • scripts/upload-r2.mjs
  • package.json / package-lock.json
  • .github/workflows/deploy-docs.yml

也可手动 gh workflow run deploy-docs.yml

CF API Token 权限

GitHub Secrets 必须配:

Read the full file on GitHub · 176 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 176 lines · 0 tokens per session scan A b5e0eabac1bb

Subscribe to this mod's changes

deploy is a cursor rule published in the GitHub repository xuliang2024/cutcli-cookbook (192 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,543 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.