@clize/clize 0.32.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +19 -17
  2. package/dist/cli.js +484 -373
  3. package/dist/cli.js.map +1 -1
  4. package/dist/core/addresses.js +12 -11
  5. package/dist/core/addresses.js.map +1 -1
  6. package/dist/core/analytics.js +6 -5
  7. package/dist/core/analytics.js.map +1 -1
  8. package/dist/core/authz.js +6 -5
  9. package/dist/core/authz.js.map +1 -1
  10. package/dist/core/billing.js +83 -12
  11. package/dist/core/billing.js.map +1 -1
  12. package/dist/core/credentials.js +3 -1
  13. package/dist/core/credentials.js.map +1 -1
  14. package/dist/core/dns.js +3 -2
  15. package/dist/core/dns.js.map +1 -1
  16. package/dist/core/domain-health.js +74 -50
  17. package/dist/core/domain-health.js.map +1 -1
  18. package/dist/core/domains.js +74 -44
  19. package/dist/core/domains.js.map +1 -1
  20. package/dist/core/email-tx.js +8 -6
  21. package/dist/core/email-tx.js.map +1 -1
  22. package/dist/core/email.js +13 -12
  23. package/dist/core/email.js.map +1 -1
  24. package/dist/core/env-detect.js +7 -14
  25. package/dist/core/env-detect.js.map +1 -1
  26. package/dist/core/handle.js +33 -30
  27. package/dist/core/handle.js.map +1 -1
  28. package/dist/core/install.js +114 -56
  29. package/dist/core/install.js.map +1 -1
  30. package/dist/core/media.js +37 -36
  31. package/dist/core/media.js.map +1 -1
  32. package/dist/core/payments.js +5 -4
  33. package/dist/core/payments.js.map +1 -1
  34. package/dist/core/projects.js +38 -26
  35. package/dist/core/projects.js.map +1 -1
  36. package/dist/core/redirect.js +4 -3
  37. package/dist/core/redirect.js.map +1 -1
  38. package/dist/core/serve.js +2 -1
  39. package/dist/core/serve.js.map +1 -1
  40. package/dist/core/setup.js +11 -9
  41. package/dist/core/setup.js.map +1 -1
  42. package/dist/core/shop.js +17 -16
  43. package/dist/core/shop.js.map +1 -1
  44. package/dist/core/site.js +2 -1
  45. package/dist/core/site.js.map +1 -1
  46. package/dist/core/sites.js +41 -40
  47. package/dist/core/sites.js.map +1 -1
  48. package/dist/core/triage.js +39 -5
  49. package/dist/core/triage.js.map +1 -1
  50. package/dist/core/video.js +45 -43
  51. package/dist/core/video.js.map +1 -1
  52. package/dist/github.js +4 -3
  53. package/dist/github.js.map +1 -1
  54. package/dist/i18n/t.js +65 -0
  55. package/dist/i18n/t.js.map +1 -0
  56. package/dist/i18n/zh.js +1265 -0
  57. package/dist/i18n/zh.js.map +1 -0
  58. package/dist/index.js +61 -40
  59. package/dist/index.js.map +1 -1
  60. package/dist/lib/cloudflare.js +8 -7
  61. package/dist/lib/cloudflare.js.map +1 -1
  62. package/dist/lib/crypto.js +2 -1
  63. package/dist/lib/crypto.js.map +1 -1
  64. package/dist/lib/vercel.js +2 -1
  65. package/dist/lib/vercel.js.map +1 -1
  66. package/dist/lib/zone.js +2 -1
  67. package/dist/lib/zone.js.map +1 -1
  68. package/dist/mcp-profiles.js +5 -1
  69. package/dist/mcp-profiles.js.map +1 -1
  70. package/dist/providers/deploy/cloudflare.js +3 -2
  71. package/dist/providers/deploy/cloudflare.js.map +1 -1
  72. package/dist/providers/email/cloudflare-inbound.js +4 -3
  73. package/dist/providers/email/cloudflare-inbound.js.map +1 -1
  74. package/dist/providers/email/cloudflare-outbound.js +2 -1
  75. package/dist/providers/email/cloudflare-outbound.js.map +1 -1
  76. package/dist/providers/email/resend.js +3 -2
  77. package/dist/providers/email/resend.js.map +1 -1
  78. package/dist/providers/email/ses.js +3 -2
  79. package/dist/providers/email/ses.js.map +1 -1
  80. package/dist/providers/index.js +3 -2
  81. package/dist/providers/index.js.map +1 -1
  82. package/dist/providers/media/google.js +10 -9
  83. package/dist/providers/media/google.js.map +1 -1
  84. package/dist/providers/media/kie.js +12 -11
  85. package/dist/providers/media/kie.js.map +1 -1
  86. package/dist/providers/media/kunavo.js +10 -9
  87. package/dist/providers/media/kunavo.js.map +1 -1
  88. package/dist/providers/media/openai.js +5 -4
  89. package/dist/providers/media/openai.js.map +1 -1
  90. package/dist/providers/media/suno.js +7 -6
  91. package/dist/providers/media/suno.js.map +1 -1
  92. package/dist/providers/registrar/routing.js +2 -1
  93. package/dist/providers/registrar/routing.js.map +1 -1
  94. package/dist/providers/registrar/vercel.js +2 -1
  95. package/dist/providers/registrar/vercel.js.map +1 -1
  96. package/dist/providers/seo/dataforseo.js +5 -4
  97. package/dist/providers/seo/dataforseo.js.map +1 -1
  98. package/dist/providers/seo/gsc.js +5 -4
  99. package/dist/providers/seo/gsc.js.map +1 -1
  100. package/dist/remote.js +25 -22
  101. package/dist/remote.js.map +1 -1
  102. package/dist/selfcheck.js +23 -22
  103. package/dist/selfcheck.js.map +1 -1
  104. package/dist/state/file-store.js +17 -16
  105. package/dist/state/file-store.js.map +1 -1
  106. package/package.json +4 -3
  107. package/skills/clize/SKILL.md +171 -143
  108. package/skills/clize-seo/SKILL.md +2 -2
  109. package/skills/clize-site-build/SKILL.md +97 -41
  110. package/skills/clize-site-debug/SKILL.md +73 -45
@@ -1,92 +1,120 @@
1
1
  ---
2
2
  name: clize-site-debug
3
3
  description: >-
4
- 当用户说某个用 clize 部署的站点 / 域名「打不开、访问不了、部署了但没生效、还是占位页」时,用这个 skill 系统排查。
5
- clize 站点托管 = 共享 worker clize-handle-site + KV clize-sites,按 hostname serve;域名经 CF Workers custom domain 绑到 worker。
6
- v0.22.0+ 先跑 `clize domain check <域名>`(一条命令四层体检:注册局委派 DoH zone 绑定 内容);
7
- 没定位到再按「先排代理 内容层(KV) 绑定层(workers/domains) DNS 层(zone/NS)」手工四步,Vercel 注册域名要切 NS→CF。
8
- 触发:"我的站打不开"、"X 域名访问不了"、"deploy 了没生效"、"还是占位页"、"freevideocompressor 这种站不能用"。
4
+ Use when the user says a site or domain deployed with clize "does not open, is unreachable, was deployed
5
+ but nothing changed, still shows the placeholder page". Systematic diagnosis. clize site hosting = the
6
+ shared worker clize-handle-site + the KV namespace clize-sites, served by hostname; domains bind to the
7
+ worker as Cloudflare Workers custom domains. On v0.22.0+ run `clize domain check <domain>` first (one
8
+ command, four layers: registry delegation via DoH → zone → binding → content); if that does not locate
9
+ it, work by hand in the order proxy → content layer (KV) → binding layer (workers/domains) → DNS layer
10
+ (zone/NS); Vercel-registered domains need their NS moved to Cloudflare. Triggers: "my site does not
11
+ open", "X is unreachable", "deployed but no effect", "still the placeholder", "我的站打不开".
9
12
  ---
10
13
 
11
- # clize 托管站点打不开 —— 系统排查
14
+ # A clize-hosted site does not open — systematic diagnosis
12
15
 
13
- clize 站点托管 = 共享 worker **`clize-handle-site`** + KV **`clize-sites`**,worker 按 hostname 从 KV 取 `${host}${path}`(无内容→占位页)。域名通过 **CF Workers custom domain** 绑到这个 worker,要求域名 zone 在 CF 且 **active**(NS 指向 CF)。
16
+ clize site hosting = the shared worker **`clize-handle-site`** + the KV namespace **`clize-sites`**; the
17
+ worker reads `${host}${path}` from KV by hostname (no content → the placeholder page). A domain reaches the
18
+ worker through a **Cloudflare Workers custom domain**, which requires the zone to be on Cloudflare and
19
+ **active** (NS pointing at Cloudflare).
14
20
 
15
- 「打不开」基本是这条链某一环断了。
21
+ "Does not open" almost always means one link in that chain is broken.
16
22
 
17
- ## 先试一条命令(v0.22.0+)
23
+ ## Try one command first (v0.22.0+)
18
24
 
19
25
  ```bash
20
- clize domain check <域名> # 四层体检:注册局委派(DoH 公网权威)→ CF zone → worker 绑定 → KV 内容,带修复建议
21
- clize domain check # 不带域名 = 全部域名轻检,汇总不可达清单
26
+ clize domain check <domain> # four layers: registry delegation (public authoritative DoH) → CF zone → worker binding → KV content, with fix suggestions
27
+ clize domain check # no domain = a light check of every domain, listing the unreachable ones
22
28
  ```
23
29
 
24
- 它以**公网权威 DNS 为准**(不吃本机代理假象、不信 CF zone 缓存),能直接定位 2026-06 断链事故那类注册局委派故障(NXDOMAIN / NS 指向别处)。注意 `domain list` `status` 是接入方式(registered/external/pending),**不代表健康**,别拿它判断。平台每 30 分钟还会自动巡检,持续异常向账户邮箱(`clize account email` 配置)发告警。
30
+ It uses **public authoritative DNS** as the truth (immune to local proxy illusions and to CF's cached zone
31
+ status) and directly locates registry-delegation faults like the June 2026 outage (NXDOMAIN / NS pointing
32
+ elsewhere). Note that the `status` in `domain list` is the access mode (registered / external / handle /
33
+ pending), **not health**; do not judge by it. The platform also sweeps every 30 minutes and emails the
34
+ account address (set with `clize account email`) when a domain stays broken.
25
35
 
26
- `domain check` 没定位到、或要查 TLS/边缘/KV key 细节时,再走下面手工四步。**按顺序查,别跳步。**
36
+ If `domain check` does not locate it, or you need TLS / edge / KV-key detail, go through the four manual
37
+ steps below. **In order; do not skip.**
27
38
 
28
- ## 0. 先排除本机代理(最容易误判,务必第一步)
39
+ ## 0. Rule out the local proxy first (the most common misdiagnosis; always step one)
29
40
 
30
- 用户本机若跑 Clash/Surge(TUN / fake-ip 模式),`dig` 会把域名解析到 **`198.18.x.x`**(fake-ip 段)或**连不上公共 DNS**。这种情况本机 `dig` / `curl` / 浏览器结果**全部不可信** —— 站点可能完全正常,只是被本机代理拦了。
41
+ If the user's machine runs Clash / Surge (TUN / fake-ip mode), `dig` resolves the domain to **`198.18.x.x`**
42
+ (the fake-ip range) or **cannot reach public DNS**. In that state every local `dig` / `curl` / browser
43
+ result is **untrustworthy** — the site may be perfectly fine and only blocked by the local proxy.
31
44
 
32
- - 判据:`dig +short A <域名>` 返回 `198.18.*` / `198.19.*`,或 `dig @1.1.1.1 <域名>` 超时。
33
- - 对策:**从云端验证,别信本机**:
34
- - `WebFetch https://<域名>` —— 从云端抓真实内容 / 看能否访问。
35
- - `WebFetch "https://dns.google/resolve?name=<域名>&type=NS"` —— 查权威 NS
36
- - 先让用户**关代理 / 换手机流量**再访问一次,很多「打不开」到此就解决。
45
+ - Signs: `dig +short A <domain>` returns `198.18.*` / `198.19.*`, or `dig @1.1.1.1 <domain>` times out.
46
+ - Fix: **verify from the cloud, not the machine**:
47
+ - `WebFetch https://<domain>` fetch the real content from the cloud / see whether it responds.
48
+ - `WebFetch "https://dns.google/resolve?name=<domain>&type=NS"` the authoritative NS.
49
+ - Have the user **turn off the proxy / switch to mobile data** and try once more; many "does not open"
50
+ reports end right here.
37
51
 
38
- ## 1. 内容层:站点真写进 KV 了吗
52
+ ## 1. Content layer: did the site actually land in KV?
39
53
 
40
54
  ```bash
41
55
  NSID=$(curl -s ".../accounts/<ACCT>/storage/kv/namespaces?per_page=100" "${A[@]}" | jq -r '.result[]|select(.title=="clize-sites").id')
42
- curl -s ".../accounts/<ACCT>/storage/kv/namespaces/$NSID/keys?limit=1000" "${A[@]}" | jq -r '.result[].name' | grep -i "<域名>"
56
+ curl -s ".../accounts/<ACCT>/storage/kv/namespaces/$NSID/keys?limit=1000" "${A[@]}" | jq -r '.result[].name' | grep -i "<domain>"
43
57
  ```
44
- `<域名>/index.html` key → deploy 的「写 KV」成功了,进第 2 步。没有 站点根本没部署,重新 `clize deploy ./site --domain <域名>`。
58
+ Keys like `<domain>/index.html` existthe deploy's KV write succeeded; go to step 2. Nothing the site
59
+ was never deployed; run `clize deploy ./site --domain <domain>` again.
45
60
 
46
- ## 2. 绑定层:域名绑到 handle-site 了吗
61
+ ## 2. Binding layer: is the domain bound to handle-site?
47
62
 
48
63
  ```bash
49
- curl -s ".../accounts/<ACCT>/workers/domains" "${A[@]}" | jq -r '.result[]|select(.service=="clize-handle-site").hostname' | grep -i "<域名>"
64
+ curl -s ".../accounts/<ACCT>/workers/domains" "${A[@]}" | jq -r '.result[]|select(.service=="clize-handle-site").hostname' | grep -i "<domain>"
50
65
  ```
51
- 绑定 OK(若仍打不开,回第 0 步查代理 / SSL)。**没有 域名没接到 worker(最常见的打不开原因)**,进第 3 步。
66
+ Presentthe binding is fine (if it still does not open, go back to step 0 or wait for SSL). **Absent
67
+ the domain is not attached to the worker (the most common cause)**; go to step 3.
52
68
 
53
- ## 3. DNS 层:CF zone active / NS CF
69
+ ## 3. DNS layer: is the CF zone active / does the NS point at CF?
54
70
 
55
71
  ```bash
56
- curl -s ".../zones?name=<域名>" "${A[@]}" | jq -r '.result[0]|{id, status, name_servers}'
72
+ curl -s ".../zones?name=<domain>" "${A[@]}" | jq -r '.result[0]|{id, status, name_servers}'
57
73
  ```
58
- - `status=active` → NS 已指 CF,直接跳第 5 步绑定。
59
- - `status=pending` → **NS 没委派给 CF**,这是断点。CF 注册的域名 NS 本应在 CF(异常,查 NS 记录);**Vercel 注册的域名**默认 `vercel-dns.com`,要切 4 步。
74
+ - `status=active` → the NS is on CF; jump to step 5 and bind.
75
+ - `status=pending` → **the NS is not delegated to CF**; that is the break. A CF-registered domain should
76
+ already have its NS on CF (abnormal; check the NS records); a **Vercel-registered domain** defaults to
77
+ `vercel-dns.com` and must be switched → step 4.
60
78
 
61
- ## 4. ⚠️ Vercel 注册域名的 NS
79
+ ## 4. ⚠️ The NS trap for Vercel-registered domains
62
80
 
63
- Vercel 注册(`boughtAt` 有值、`serviceType:"zeit.world"`)的域名默认用 Vercel DNS。切到 CF:
81
+ Vercel-registered domains (`boughtAt` set, `serviceType:"zeit.world"`) use Vercel DNS by default. Switch to CF:
64
82
  ```bash
65
- # CF 的两个 NS = 3 步查到的 name_servers
66
- curl -s -X PATCH ".../v1/registrar/domains/<域名>/nameservers?teamId=<TEAM>" \
83
+ # the two CF nameservers = the name_servers from step 3
84
+ curl -s -X PATCH ".../v1/registrar/domains/<domain>/nameservers?teamId=<TEAM>" \
67
85
  -H "Authorization: Bearer <VERCEL_TOKEN>" -H "Content-Type: application/json" \
68
86
  -d '{"nameservers":["xxx.ns.cloudflare.com","yyy.ns.cloudflare.com"]}'
69
87
  ```
70
- **关键坑**:切完后 Vercel 自己的 `nameservers` / `intendedNameservers` 字段**会显示滞后**(还写着 vercel-dns),只有 `customNameservers` 是你设的值。**别信 Vercel 的字段** —— 用 `WebFetch "https://dns.google/resolve?name=<域名>&type=NS"` 查**注册局权威 NS**,看到 `cloudflare.com` 就是切成功了。(经验:Vercel 注册域名的 NS **是能切到 CF 的**,之前「NS 锁死」是被这个滞后字段误导。)
88
+ **The trap**: after switching, Vercel's own `nameservers` / `intendedNameservers` fields **lag** (still
89
+ showing vercel-dns); only `customNameservers` holds what you set. **Do not trust Vercel's fields** — check
90
+ the **registry's authoritative NS** with `WebFetch "https://dns.google/resolve?name=<domain>&type=NS"`;
91
+ seeing `cloudflare.com` means the switch worked. (Lesson: Vercel-registered domains **can** be switched to
92
+ CF; the earlier "NS locked" belief came from that lagging field.)
71
93
 
72
- ## 5. 修复:激活 zone + custom domain
94
+ ## 5. Fix: activate the zone + bind the custom domain
73
95
 
74
96
  ```bash
75
- # CF 立即重查 NS(pending→active)
97
+ # ask CF to re-check the NS now (pending active)
76
98
  curl -s -X PUT ".../zones/<ZID>/activation_check" "${A[@]}"
77
- # zone active 后,绑 custom domain handle-site
99
+ # once the zone is active, bind the custom domain to handle-site
78
100
  curl -s -X PUT ".../accounts/<ACCT>/workers/domains" "${A[@]}" \
79
101
  -H "Content-Type: application/json" \
80
- -d '{"hostname":"<域名>","service":"clize-handle-site","environment":"production","zone_id":"<ZID>"}'
102
+ -d '{"hostname":"<domain>","service":"clize-handle-site","environment":"production","zone_id":"<ZID>"}'
81
103
  ```
82
- 绑成功 + KV 有内容站点立刻上线(SSL 自动签,首访可能等几十秒)。
104
+ Binding succeeded + KV has content the site is live immediately (SSL is issued automatically; the first
105
+ visit may take a few dozen seconds).
83
106
 
84
- ## 认证速记 / 占位
107
+ ## Auth cheat sheet / placeholders
85
108
 
86
- - CF API base:`https://api.cloudflare.com/client/v4`;认证 `A=(-H "X-Auth-Email: <email>" -H "X-Auth-Key: <CF global key>")`。
87
- - Vercel base:`https://api.vercel.com`;认证 `-H "Authorization: Bearer <VERCEL_TOKEN>"` + `?teamId=<TEAM>`。
88
- - `<ACCT>` / `<ZID>` / `<NSID>` 都用上面的 list 接口现查,别硬编码。
109
+ - CF API base: `https://api.cloudflare.com/client/v4`; auth `A=(-H "X-Auth-Email: <email>" -H "X-Auth-Key: <CF global key>")`.
110
+ - Vercel base: `https://api.vercel.com`; auth `-H "Authorization: Bearer <VERCEL_TOKEN>"` + `?teamId=<TEAM>`.
111
+ - `<ACCT>` / `<ZID>` / `<NSID>`: look them up with the list endpoints above; never hard-code.
89
112
 
90
113
  ---
91
114
 
92
- > **此排查流程已固化进部署**:[`src/core/sites.ts`](../../src/core/sites.ts) `ensureZoneActiveForHandle` 会在 `clize deploy` 时自动建 zone / 切 NS(Vercel 域名)/ 激活 / 绑定,且绑定失败会**报错**(不再 `.catch(()=>{})` 假成功)。所以新部署一般不会再出这问题;这个 skill 主要用于**排查历史遗留**(那次 bug 期间「假成功」但没真接上的站)和**事后核验**已上线域名。建站流程见 `clize-site-build` skill。
115
+ > **This diagnosis is now built into deploy**: `ensureZoneActiveForHandle` in
116
+ > [`src/core/sites.ts`](../../src/core/sites.ts) creates the zone / switches the NS (Vercel domains) /
117
+ > activates / binds during `clize deploy`, and a failed binding **is an error** (no more
118
+ > `.catch(() => {})` false success). New deploys therefore rarely hit this; the skill is mainly for
119
+ > **legacy sites** (from the period when the bug reported success without binding) and for **verifying**
120
+ > live domains after the fact. Building a site is the `clize-site-build` skill.