@wkgeo/cli 1.1.5 → 2.0.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.
- package/lib/api.mjs +8 -26
- package/lib/cms.mjs +0 -2
- package/lib/commands/auth.mjs +10 -18
- package/lib/commands/cms.mjs +64 -16
- package/lib/commands/index.mjs +8 -74
- package/lib/commands/member.mjs +936 -985
- package/lib/commands/site.mjs +388 -435
- package/lib/commands/siteops.mjs +438 -1013
- package/lib/commands/template.mjs +1 -1
- package/lib/template-publish.mjs +36 -78
- package/package.json +1 -1
- package/lib/commands/dnscred.mjs +0 -428
- package/lib/commands/domainops.mjs +0 -546
- package/lib/commands/domainorder.mjs +0 -439
package/lib/api.mjs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* ⚠️ 2026-10-28(老板拍板「所有 cli 的操作都通过自己的云函数来实现」):业务面**收敛到 `/cli`**
|
|
8
8
|
* (云函数 `wkgeo-cli-fc`)—— 站点 / 域名 / 模板 / 发布 / 资产 / 钱包 / 套餐 / 应用授权
|
|
9
|
-
* 这些动作在 `wkgeo-cli-fc` 里**自持重建**(进程内副本),金融面
|
|
9
|
+
* 这些动作在 `wkgeo-cli-fc` 里**自持重建**(进程内副本),金融面 13 条由它**白名单转发**给
|
|
10
10
|
* `wkgeo-order`。CLI 侧不再需要「action → 哪个函数」那套路由表猜谜。
|
|
11
11
|
* · 默认:`data()` 一律打 `/cli`;只有**插件面**动作按 `GATEWAY_PREFIXES` 打各自前缀
|
|
12
12
|
* (`/form` `/member` `/channel`;`/ai` `/ai-tools` 仅显式 `prefix:` 时用)。
|
|
@@ -26,7 +26,7 @@ import { request, encodeForm } from './http.mjs';
|
|
|
26
26
|
import { classifyResponse, toCliError, networkError, CliError } from './errors.mjs';
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* 金融面动作(`wkgeo-order`
|
|
29
|
+
* 金融面动作(`FN_ORDER` 13 条;`wkgeo-order` 现 dispatch 20 个动作)—— 2026-10-28 起**不再由 CLI 直接寻址**,
|
|
30
30
|
* 而是 `wkgeo-cli-fc` 用白名单转发(`ORDER_FORWARD_ACTIONS`)。
|
|
31
31
|
*
|
|
32
32
|
* 这张表留在 CLI 侧只做两件事:
|
|
@@ -35,7 +35,8 @@ import { classifyResponse, toCliError, networkError, CliError } from './errors.m
|
|
|
35
35
|
*
|
|
36
36
|
* 为什么当初要把这份表搬到 CLI:CLI 以前统一打 `/api/data`,靠 data 内部转发;
|
|
37
37
|
* data 下线后必须自己决定打哪个函数。**只列 order / domain 的例外,其余一律 user**
|
|
38
|
-
* ——
|
|
38
|
+
* —— 逃生阀口径:`FN_ORDER` 13 条打 `/order`、`FN_DOMAIN` 9 条打 `/domain`、其余打 `/user`
|
|
39
|
+
* (data 当年那份 47 条映射已随 data 下线,不再是真源)。
|
|
39
40
|
*
|
|
40
41
|
* ⚠️ 加新 action 时:先确认它属于哪个函数,不在这两个集合里就当 user(user 会回"未知操作",与以前 data 的行为一致)。
|
|
41
42
|
*
|
|
@@ -48,7 +49,6 @@ const FN_ORDER = new Set([
|
|
|
48
49
|
'createRechargeTicket',
|
|
49
50
|
'createRechargeOrderByTicket',
|
|
50
51
|
'getRechargeTicketInfo',
|
|
51
|
-
'createSubscriptionOrder',
|
|
52
52
|
'createQuotaOrder',
|
|
53
53
|
'createSiteRenewOrder',
|
|
54
54
|
'userQuoteBundle',
|
|
@@ -60,26 +60,9 @@ const FN_ORDER = new Set([
|
|
|
60
60
|
'paymentNotify',
|
|
61
61
|
]);
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
* ⚠️ 这张表**漏一条,动作就会被发到 `/user`**,服务端回 `未知操作: <action>`,
|
|
67
|
-
* CLI 看起来像"后端没实现",其实是本地路由错(2026-10-28 task-9 / A7 踩过:
|
|
68
|
-
* `getSiteDomainReminders` 怎么调都 400)。加域名前先核对 domain 函数的 dispatch,
|
|
69
|
-
* 不要凭印象编。
|
|
70
|
-
*/
|
|
71
|
-
const FN_DOMAIN = new Set([
|
|
72
|
-
'provisionSiteDomain',
|
|
73
|
-
'checkSiteProvision',
|
|
74
|
-
'retrySiteProvision',
|
|
75
|
-
'releaseSiteDomain',
|
|
76
|
-
// 2026-10-28 task-9 / A7 补:只读查询类(dispatch 见 wkgeo-domain/src/index.js:1211-1259)
|
|
77
|
-
'getSiteProvisionStatus',
|
|
78
|
-
'siteDomainRecords',
|
|
79
|
-
'siteDomainCheck',
|
|
80
|
-
'getSiteDomainReminders',
|
|
81
|
-
'dnsProviderProbe',
|
|
82
|
-
]);
|
|
63
|
+
/* ★ 2026-11-19 task-1250(老板:CLI 只做 CMS 内容管理,跟域名没有关系):
|
|
64
|
+
原 `FN_DOMAIN`(`wkgeo-domain` 的 9 条动作 → 前缀 `/domain`)已整张删除 ——
|
|
65
|
+
CLI 不再有任何域名动作,逃生阀 `WKONGAI_LEGACY_ENDPOINTS=1` 也回不到 `/domain`。 */
|
|
83
66
|
|
|
84
67
|
/**
|
|
85
68
|
* 表单插件(`plug/contact-form/fn/src/index.js`)的后台动作 —— 前缀 `/form`。
|
|
@@ -159,7 +142,7 @@ export function legacyEndpointsEnabled(env = process.env) {
|
|
|
159
142
|
* 一律 `cli` —— `wkgeo-cli-fc` 自己分发;不认识的动作由它回 `400 未知动作`。
|
|
160
143
|
*
|
|
161
144
|
* 逃生阀 `WKONGAI_LEGACY_ENDPOINTS=1` 时退回老口径:
|
|
162
|
-
* order /
|
|
145
|
+
* order / form / member / channel 按显式表,其余 `user`(`/domain` 已随 task-1250 删除)。
|
|
163
146
|
*/
|
|
164
147
|
export function fnOf(action, { legacy = legacyEndpointsEnabled() } = {}) {
|
|
165
148
|
if (FN_FORM.has(action)) return 'form';
|
|
@@ -172,7 +155,6 @@ export function fnOf(action, { legacy = legacyEndpointsEnabled() } = {}) {
|
|
|
172
155
|
if (action === 'orderCreate') return 'cli';
|
|
173
156
|
if (legacy) {
|
|
174
157
|
if (FN_ORDER.has(action)) return 'order';
|
|
175
|
-
if (FN_DOMAIN.has(action)) return 'domain';
|
|
176
158
|
return 'user';
|
|
177
159
|
}
|
|
178
160
|
return 'cli';
|
package/lib/cms.mjs
CHANGED
|
@@ -69,8 +69,6 @@ export const CMS_ACTIONS = {
|
|
|
69
69
|
// 插件(插件中心)
|
|
70
70
|
pluginList: 'pluginList',
|
|
71
71
|
pluginToggle: 'pluginToggle',
|
|
72
|
-
// 域名巡检(只读;要「系统管理」权限,普通账号 403)
|
|
73
|
-
domainInspectionList: 'cmsSiteDomainInspectionList',
|
|
74
72
|
// 老网站导入 v2
|
|
75
73
|
importV2Start: 'importV2Start',
|
|
76
74
|
importV2Get: 'importV2Get',
|
package/lib/commands/auth.mjs
CHANGED
|
@@ -901,7 +901,7 @@ export const whoamiCommand = {
|
|
|
901
901
|
*
|
|
902
902
|
* 口径(与 `wkgeo-cli-fc` 的 `cliWhoami` / 映射文档一致):
|
|
903
903
|
* * 原生 —— 本函数 switch 里按 scope 过滤后的 `actions`;
|
|
904
|
-
* * 自持 —— 进程内重建(用户面 /
|
|
904
|
+
* * 自持 —— 进程内重建(用户面 / 内容 / 素材 / 发布 / 配置 / 站点 / 插件 / 控制台);
|
|
905
905
|
* * 转发 —— 金融面白名单转给 `wkgeo-order`(钱逻辑不复制)。
|
|
906
906
|
*/
|
|
907
907
|
export function summarizeActionSurface(who = {}) {
|
|
@@ -909,9 +909,6 @@ export function summarizeActionSurface(who = {}) {
|
|
|
909
909
|
const native = n(who.actions);
|
|
910
910
|
const batches = {
|
|
911
911
|
user: n(who.self_hosted_actions),
|
|
912
|
-
domain: n(who.domain_actions),
|
|
913
|
-
ops: n(who.ops_actions),
|
|
914
|
-
dns_credential: n(who.dns_credential_actions),
|
|
915
912
|
content: n(who.content_actions),
|
|
916
913
|
asset: n(who.asset_actions),
|
|
917
914
|
publish: n(who.publish_actions),
|
|
@@ -919,12 +916,13 @@ export function summarizeActionSurface(who = {}) {
|
|
|
919
916
|
site: n(who.site_actions),
|
|
920
917
|
finance_forwarded: n(who.forwarded_actions),
|
|
921
918
|
};
|
|
922
|
-
/* 口径对齐后端 `cliWhoami.action_total
|
|
923
|
-
|
|
924
|
-
|
|
919
|
+
/* 口径对齐后端 `cliWhoami.action_total`:自持各批次相加即总数。
|
|
920
|
+
★ 2026-11-19 task-1250:域名面(domain / ops / dns_credential)已从后端删除,
|
|
921
|
+
`uncounted_self_hosted` 恒为 0(字段保留,老脚本读它不会 undefined)。 */
|
|
922
|
+
const selfHosted = batches.user + batches.content + batches.asset + batches.publish
|
|
925
923
|
+ batches.config_auth + batches.site;
|
|
926
924
|
const forwarded = batches.finance_forwarded;
|
|
927
|
-
const uncounted =
|
|
925
|
+
const uncounted = 0;
|
|
928
926
|
const total = Number(who.action_total);
|
|
929
927
|
return {
|
|
930
928
|
action_total: Number.isFinite(total) && total > 0 ? total : native + selfHosted + forwarded,
|
|
@@ -937,21 +935,19 @@ export function summarizeActionSurface(who = {}) {
|
|
|
937
935
|
};
|
|
938
936
|
}
|
|
939
937
|
|
|
940
|
-
/** 「自持批次」的人话标签(顺序 =
|
|
938
|
+
/** 「自持批次」的人话标签(顺序 = 迁移批次;域名面已随 task-1250 删除) */
|
|
941
939
|
const SURFACE_BATCH_LABEL = [
|
|
942
940
|
['user', '账号/站点面(自持副本)'],
|
|
943
|
-
['domain', '域名面(自持副本)'],
|
|
944
|
-
['ops', '自持新链(域名购买/解析/ESA/建站收口)'],
|
|
945
941
|
['content', '内容类(B1)'],
|
|
946
942
|
['asset', '素材类(B2)'],
|
|
947
943
|
['publish', '发布类(B3)'],
|
|
948
944
|
['config_auth', '配置类 auth 面(B7:成员 / 角色 / 语言)'],
|
|
949
|
-
['site', '站点类(B4:公司信息 /
|
|
945
|
+
['site', '站点类(B4:公司信息 / 示例内容 / 站级同步)'],
|
|
950
946
|
['finance_forwarded', '金融面(白名单转发 wkgeo-order)'],
|
|
951
947
|
];
|
|
952
948
|
|
|
953
|
-
/** 不计入 `action_total`
|
|
954
|
-
const SURFACE_EXTRA_LABEL = [
|
|
949
|
+
/** 不计入 `action_total` 的批次:★ task-1250 起为空(域名面已删) */
|
|
950
|
+
const SURFACE_EXTRA_LABEL = [];
|
|
955
951
|
|
|
956
952
|
export const authStatusCommand = {
|
|
957
953
|
name: 'auth status',
|
|
@@ -966,7 +962,6 @@ export const authStatusCommand = {
|
|
|
966
962
|
'后端动作 `cliWhoami`(无 scope 要求、只读):返回账号标识 / client_id / scopes / 动作面清单,CLI 原样透出。',
|
|
967
963
|
'后端**没有** `account_id` 字段:账号唯一标识就是 `user_id`(本命令里 `account_id` ≡ `user_id`)。',
|
|
968
964
|
'动作面 = 原生(本函数 switch)+ 自持(进程内重建)+ 转发(金融面白名单给 wkgeo-order);`action_total` 与明细对不上时会标 `action_surface.consistent=false`。',
|
|
969
|
-
'口径:域名级 DNS 凭据 4 条**不计入** `action_total`(后端一致口径,防动作面漂移),单列在 `action_surface.uncounted_self_hosted`。',
|
|
970
965
|
'绝不打印令牌:要看"还剩多久、有多长"用 `wkgeo auth token`。',
|
|
971
966
|
],
|
|
972
967
|
async run(ctx) {
|
|
@@ -998,9 +993,6 @@ export const authStatusCommand = {
|
|
|
998
993
|
action_lists: {
|
|
999
994
|
actions: who.actions || [],
|
|
1000
995
|
self_hosted_actions: who.self_hosted_actions || [],
|
|
1001
|
-
domain_actions: who.domain_actions || [],
|
|
1002
|
-
ops_actions: who.ops_actions || [],
|
|
1003
|
-
dns_credential_actions: who.dns_credential_actions || [],
|
|
1004
996
|
content_actions: who.content_actions || [],
|
|
1005
997
|
asset_actions: who.asset_actions || [],
|
|
1006
998
|
publish_actions: who.publish_actions || [],
|
package/lib/commands/cms.mjs
CHANGED
|
@@ -1651,16 +1651,42 @@ function publishSiteOrThrow(ctx) {
|
|
|
1651
1651
|
/* ---- 发布前置:自有域名闸门(口径同 CMS 的 `siteCustomDomainState`) ---- */
|
|
1652
1652
|
|
|
1653
1653
|
/**
|
|
1654
|
-
*
|
|
1655
|
-
*
|
|
1656
|
-
*
|
|
1654
|
+
* 平台存储站没有自有域名时的提示 —— **一句中文说完「为什么不用发 + 下一步做什么」**。
|
|
1655
|
+
*
|
|
1656
|
+
* ⚠️ **必须与服务端逐字一致**(2026-11-18 task-985 老板改的文案):唯一真源是
|
|
1657
|
+
* `aliyun/fc/wkgeo-cms/src/cms-publish.js` 的 `PUBLISH_NO_CUSTOM_DOMAIN_MESSAGE`;
|
|
1658
|
+
* 同样逐字的一份副本在 `aliyun/fc/wkgeo-cli-fc/src/publish-core.js`。
|
|
1659
|
+
* 三处(CMS / cli-fc / 本文件)**任何一个字不同步,客户就会在不同入口看到两种说法**;
|
|
1660
|
+
* 三个包各自独立打包,没法共享常量,只能人工逐字同步 ⇒ 改文案时三处一起改。
|
|
1657
1661
|
*/
|
|
1658
1662
|
const PUBLISH_NO_CUSTOM_DOMAIN_MESSAGE =
|
|
1659
|
-
'
|
|
1663
|
+
'你的站点现在就能看:平台给的站点地址是实时预览,改完马上是最新的,这一步不用发布;绑定自己的域名之后,发布才会生效。';
|
|
1660
1664
|
|
|
1661
1665
|
/** 认「有自有域名」的 kind(与 CMS 的 SITE_PRIMARY_DOMAIN_SQL 一致,custom > root > other) */
|
|
1662
1666
|
const PUBLISH_CUSTOM_DOMAIN_KINDS = ['custom', 'root', 'other'];
|
|
1663
1667
|
|
|
1668
|
+
/**
|
|
1669
|
+
* 站点是不是「自有存储」(`own`)—— 与服务端判据的**前一半**同一口径。
|
|
1670
|
+
*
|
|
1671
|
+
* 服务端(CMS `publishPreconditionOf` / cli-fc `publishOwnStorageReady()`)读的是
|
|
1672
|
+
* `site_storage.mode='own'`;CLI 只读 `getSite` 回包的 `storage_kind`,而它正是服务端
|
|
1673
|
+
* `siteStorageKindOf()` 用同一份 `site_storage.mode` 归一出来的(`own ⇒ 'self'`)。
|
|
1674
|
+
*
|
|
1675
|
+
* ⚠️ **后一半(有启用的存储目标)CLI 拿不到**:服务端数的是 `site_remote_target` 上
|
|
1676
|
+
* 8 种 kind × `enabled` × `purpose` 的 `remote_count`,而 CLI 只有两条只读动作 ——
|
|
1677
|
+
* `cmsSitePublishTargetGet`(只覆盖 `purpose='publish'`)和 `cmsSiteStorageTargetGet`
|
|
1678
|
+
* (只覆盖 oss/cos/bos/s3 的**一行**)—— 凑不出与 `remote_count` 等价的数字。
|
|
1679
|
+
* ⇒ 本地**不猜**存储目标:自有存储站直接放行,由服务端 `publishOwnStorageReady()` 准确判
|
|
1680
|
+
* (真缺目标时服务端回 409 `no-storage-target`,文案由服务端给)。这样最坏只是"少拦一次、
|
|
1681
|
+
* 服务端再拦一次",绝不会用近似判据把客户的手动发布误封。
|
|
1682
|
+
*
|
|
1683
|
+
* 取不到 `storage_kind`(老服务端 / 字段缺失)⇒ 按平台存储处理 = 保持 2026-11-09 的原判据。
|
|
1684
|
+
*/
|
|
1685
|
+
function publishStorageKindOf(row) {
|
|
1686
|
+
const kind = String((row && row.storage_kind) || '').trim().toLowerCase();
|
|
1687
|
+
return kind === 'self' || kind === 'own' ? 'own' : 'platform';
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1664
1690
|
/** 站点行 / 域名接口上「客户自有域名」的候选列(平台面 custom_domain / CMS 面 cms_domain / 老列 domain) */
|
|
1665
1691
|
function publishSiteDomainOf(row) {
|
|
1666
1692
|
if (!row) return '';
|
|
@@ -1701,7 +1727,10 @@ function publishVerifiedDomainOf(payload) {
|
|
|
1701
1727
|
* **fail-open**(与 CMS 同口径):两级里只要有一级**读失败**、拿不到结论,就不下"没有域名"的判断,
|
|
1702
1728
|
* 照旧放行 —— 宁可多跑一次发布,也不能因为一次查询抖动把客户的手动发布永久封死。
|
|
1703
1729
|
*
|
|
1704
|
-
*
|
|
1730
|
+
* ★ 2026-11-18 task-992:同一次 `getSite` 顺手取回 `storage_kind`(见 `publishStorageKindOf()`),
|
|
1731
|
+
* 让闸门能按服务端口径区分「自有存储(不要求域名行)」与「平台存储(必须绑域名)」。
|
|
1732
|
+
*
|
|
1733
|
+
* @returns {Promise<{known:boolean, hasCustomDomain:boolean, customDomain:string, storage:'own'|'platform'}>}
|
|
1705
1734
|
*/
|
|
1706
1735
|
async function publishCustomDomainState(ctx, siteId) {
|
|
1707
1736
|
let siteRow = null;
|
|
@@ -1718,22 +1747,31 @@ async function publishCustomDomainState(ctx, siteId) {
|
|
|
1718
1747
|
readFailed = true;
|
|
1719
1748
|
}
|
|
1720
1749
|
|
|
1750
|
+
const storage = publishStorageKindOf(siteRow);
|
|
1721
1751
|
const verified = publishVerifiedDomainOf(records);
|
|
1722
|
-
if (verified) return { known: true, hasCustomDomain: true, customDomain: verified };
|
|
1752
|
+
if (verified) return { known: true, hasCustomDomain: true, customDomain: verified, storage };
|
|
1723
1753
|
|
|
1724
1754
|
const fallback = publishSiteDomainOf(siteRow) || publishSiteDomainOf(records);
|
|
1725
|
-
if (fallback) return { known: true, hasCustomDomain: true, customDomain: fallback };
|
|
1755
|
+
if (fallback) return { known: true, hasCustomDomain: true, customDomain: fallback, storage };
|
|
1726
1756
|
|
|
1727
|
-
if (readFailed) return { known: false, hasCustomDomain: true, customDomain: '' };
|
|
1728
|
-
return { known: true, hasCustomDomain: false, customDomain: '' };
|
|
1757
|
+
if (readFailed) return { known: false, hasCustomDomain: true, customDomain: '', storage };
|
|
1758
|
+
return { known: true, hasCustomDomain: false, customDomain: '', storage };
|
|
1729
1759
|
}
|
|
1730
1760
|
|
|
1731
1761
|
/**
|
|
1732
|
-
*
|
|
1762
|
+
* 发布前拦一道:**平台存储站没有客户自有域名 ⇒ 拒绝并给一句中文提示**(exit code 非 0)。
|
|
1733
1763
|
*
|
|
1734
1764
|
* 2026-11-09 口径:站点唯一地址 `<slug>.site.wkgeo.cn` 是动态实时渲染,
|
|
1735
1765
|
* 内容改完立刻生效;静态发布产物只服务客户自有域名 —— 没绑域名时发布对客户没有任何可见效果。
|
|
1736
1766
|
* `--cancel` / `publish status` 不受影响(取消永远要能用)。
|
|
1767
|
+
*
|
|
1768
|
+
* ★ 2026-11-18 task-992(老板口径,与 CMS / cli-fc 服务端同源):
|
|
1769
|
+
* **自有存储的站不再本地拦** —— 产物推到客户自己的 ftp / sftp / oss 主机,没有 `site_domain`
|
|
1770
|
+
* 行也送得到(「悟空GEO官网」这类 own-storage 站以前被这道客户端闸门误伤,exit 1)。
|
|
1771
|
+
* 判据的顺序与服务端一致:
|
|
1772
|
+
* ① `storage_kind='self'`(= `site_storage.mode='own'`)⇒ 放行,存储目标由服务端判;
|
|
1773
|
+
* ② 否则(平台存储)⇒ 照旧要求域名,没有就 409 `no-custom-domain`。
|
|
1774
|
+
* **平台存储站别放开**:它的静态产物只由客户自有域名回源,没域名发了也没人看。
|
|
1737
1775
|
*/
|
|
1738
1776
|
async function assertPublishHasCustomDomain(ctx, site) {
|
|
1739
1777
|
const state = await publishCustomDomainState(ctx, site.id);
|
|
@@ -1743,6 +1781,9 @@ async function assertPublishHasCustomDomain(ctx, site) {
|
|
|
1743
1781
|
}
|
|
1744
1782
|
return state;
|
|
1745
1783
|
}
|
|
1784
|
+
/** ① 自有存储:本地不判(服务端 `publishOwnStorageReady()` 会准确判"有没有启用的存储目标") */
|
|
1785
|
+
if (state.storage === 'own') return state;
|
|
1786
|
+
/** ② 平台存储:保持 2026-11-09 原判据 */
|
|
1746
1787
|
if (state.hasCustomDomain) return state;
|
|
1747
1788
|
throw new CliError(PUBLISH_NO_CUSTOM_DOMAIN_MESSAGE, {
|
|
1748
1789
|
kind: 'no_custom_domain',
|
|
@@ -1844,7 +1885,8 @@ export const publishCommand = {
|
|
|
1844
1885
|
notes: [
|
|
1845
1886
|
'**站点必须显式**:`--site` 或先 `wkgeo site use <id>`;都没配就报用法错误(不猜站点)。',
|
|
1846
1887
|
'不加 `--confirm` 一律 dry-run:只读 `overview` / `publishStatus` 算计划,**不发发布请求**。',
|
|
1847
|
-
'
|
|
1888
|
+
'**平台存储站没有客户自有域名会被拒**(exit 1,一个发布请求都不发):站点唯一地址是平台预览地址(动态实时渲染,内容改完立刻生效),静态发布只服务客户自有域名 —— 与 CMS 后台发布按钮同一口径;绑定域名后再发。',
|
|
1889
|
+
'**自有存储站不受上一条限制**:产物直接推到客户自己的 FTP / SFTP / 对象存储,没有域名行也送得到;有没有可用的存储目标由服务端判(缺了会回 409 并说明要补什么)。',
|
|
1848
1890
|
'真发前会打印站点名、域名、将发布页面数;需要「系统管理 / 全局配置」写权限,没有会回 403 并给权限提示。',
|
|
1849
1891
|
'后端没配 `INNER_PUBLISH_SECRET` 时会 fail-closed 回 503 —— 那是服务端部署问题,不是 CLI 的错。',
|
|
1850
1892
|
],
|
|
@@ -1857,8 +1899,8 @@ export const publishCommand = {
|
|
|
1857
1899
|
// 1) 取消分支:`--cancel` 与 `publish cancel` 同一个实现
|
|
1858
1900
|
if (ctx.flags.cancel) return runPublishCancel(ctx, site, row);
|
|
1859
1901
|
|
|
1860
|
-
// 2)
|
|
1861
|
-
//
|
|
1902
|
+
// 2) 前置闸门:**平台存储站**没有绑定客户自有域名 ⇒ 拒绝(exit code 非 0、一个发布请求都不发);
|
|
1903
|
+
// 自有存储站放行(判据见 `assertPublishHasCustomDomain()`)。口径同 CMS 后台的发布按钮。
|
|
1862
1904
|
const domainState = await assertPublishHasCustomDomain(ctx, site);
|
|
1863
1905
|
|
|
1864
1906
|
// 3) 先看清现状(只读):最新任务 + 内容计数
|
|
@@ -1889,7 +1931,8 @@ export const publishCommand = {
|
|
|
1889
1931
|
const data = {
|
|
1890
1932
|
...publishResultData(site, row, latest, { action: 'dry_run', confirmed: false }),
|
|
1891
1933
|
site_source: site.source,
|
|
1892
|
-
|
|
1934
|
+
/** 如实回:自有存储站可能真的没有域名行(闸门放行是因为存储方式,不是因为"有域名") */
|
|
1935
|
+
has_custom_domain: domainState.hasCustomDomain,
|
|
1893
1936
|
custom_domain: domainState.customDomain || '',
|
|
1894
1937
|
counts,
|
|
1895
1938
|
estimated_pages: estimate,
|
|
@@ -1898,7 +1941,12 @@ export const publishCommand = {
|
|
|
1898
1941
|
out.head('发布计划(dry-run,未发送任何发布请求)');
|
|
1899
1942
|
out.line(` 站点:${data.site_name || '(未取到站名)'}(${site.id})`);
|
|
1900
1943
|
out.line(` 域名:${domains.length ? domains.join('、') : '(平台没登记域名)'}`);
|
|
1901
|
-
out.line(
|
|
1944
|
+
out.line(
|
|
1945
|
+
` 自有域名:${
|
|
1946
|
+
domainState.customDomain ||
|
|
1947
|
+
(domainState.storage === 'own' ? '(自有存储站,不要求域名行)' : '(已绑定,平台没回具体域名)')
|
|
1948
|
+
}`,
|
|
1949
|
+
);
|
|
1902
1950
|
if (counts) {
|
|
1903
1951
|
out.line(
|
|
1904
1952
|
` 内容:栏目 ${counts.categories} 个 | 内容 ${counts.contents} 条(已发布 ${counts.published} / 草稿 ${counts.drafts})`,
|
|
@@ -2146,7 +2194,7 @@ export const publishRetryCommand = {
|
|
|
2146
2194
|
const { out } = ctx;
|
|
2147
2195
|
const site = publishSiteOrThrow(ctx);
|
|
2148
2196
|
const row = await publishSiteRow(ctx, site.id);
|
|
2149
|
-
// 重发同样是"真发"
|
|
2197
|
+
// 重发同样是"真发",先过同一道前置闸门(平台存储站没有自有域名 ⇒ 拒绝,见 publishCommand)
|
|
2150
2198
|
await assertPublishHasCustomDomain(ctx, site);
|
|
2151
2199
|
const previous = await publishJobOf(ctx, ctx.flags.job).catch(() => ({}));
|
|
2152
2200
|
const active = previous.status === 'queued' || previous.status === 'running';
|
package/lib/commands/index.mjs
CHANGED
|
@@ -67,13 +67,6 @@ import {
|
|
|
67
67
|
import {
|
|
68
68
|
formsListCommand,
|
|
69
69
|
formsEntriesCommand,
|
|
70
|
-
domainInspectionCommand,
|
|
71
|
-
domainBindCommand,
|
|
72
|
-
domainStatusCommand,
|
|
73
|
-
domainRecordsCommand,
|
|
74
|
-
domainDnsCommand,
|
|
75
|
-
domainCheckCommand,
|
|
76
|
-
domainRemindCommand,
|
|
77
70
|
previewCommand,
|
|
78
71
|
importV2StartCommand,
|
|
79
72
|
importV2StatusCommand,
|
|
@@ -93,36 +86,14 @@ import {
|
|
|
93
86
|
} from './orders.mjs';
|
|
94
87
|
import { appsListCommand, appsRevokeCommand } from './apps.mjs';
|
|
95
88
|
import { skillCommand } from './skill.mjs';
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
domainZoneListCommand,
|
|
105
|
-
domainZoneAddCommand,
|
|
106
|
-
domainZoneUpdateCommand,
|
|
107
|
-
domainZoneDeleteCommand,
|
|
108
|
-
esaSiteCommand,
|
|
109
|
-
esaRecordCommand,
|
|
110
|
-
esaHostnameCommand,
|
|
111
|
-
esaKvCommand,
|
|
112
|
-
siteCreateCommand,
|
|
113
|
-
} from './domainops.mjs';
|
|
114
|
-
/**
|
|
115
|
-
* 成品链路(task-21):在平台模板下注册 → 客户模板 → 收费 → 模板认证 → 快速过户。
|
|
116
|
-
* 与上面 12 条同住 `wkgeo-cli-fc`,同样走 `/cli`;命令名带三词(`domain order create`),
|
|
117
|
-
* 依赖 `lib/args.mjs#resolveCommand` 的最长前缀匹配。
|
|
118
|
-
*/
|
|
119
|
-
import { DOMAIN_ORDER_COMMANDS } from './domainorder.mjs';
|
|
120
|
-
/**
|
|
121
|
-
* 域名级 DNS 凭据(2026-10-28 老板单):`domain dns credential detect|set|status|delete`。
|
|
122
|
-
* 四词命令(`domain dns` 已被 siteops 的"照抄表"只读命令占用),依赖 `resolveCommand` 的最长前缀匹配。
|
|
123
|
-
* 秘密只从 stdin / 无回显交互读,**不进命令行**。
|
|
124
|
-
*/
|
|
125
|
-
import { DNS_CREDENTIAL_COMMANDS } from './dnscred.mjs';
|
|
89
|
+
/* ★ 2026-11-19 task-1250(老板:CLI 只做 CMS 内容管理,跟域名没有关系,不在那里操作):
|
|
90
|
+
命令面已删除 ——
|
|
91
|
+
· `domainops.mjs` :`domain search|buy|order` / `domain zone *` / `esa *`(12 条)
|
|
92
|
+
· `domainorder.mjs` :`domain order|template|charge|transfer *`(6 条成品链路)
|
|
93
|
+
· `dnscred.mjs` :`domain dns credential *`(4 条 DNS 凭据)
|
|
94
|
+
· `siteops.mjs` 里 :`domain inspection|bind|status|records|dns|check|remind`(7 条)
|
|
95
|
+
· `site.mjs` 里 :`site domain-recheck`
|
|
96
|
+
⇒ 建站(`sites create`)与站点信息(`site info` 等)仍在,走 `createSite` / site-core,不经域名链。 */
|
|
126
97
|
/**
|
|
127
98
|
* ★ task-75 / B7:配置类 auth 面 11 条迁入 `wkgeo-cli-fc` 自持(走 `/cli`,不再借 `/cms`)。
|
|
128
99
|
* 命令面:`lang list|save|set-default|delete|toggle`、`role list|save|delete`、
|
|
@@ -317,52 +288,15 @@ export const COMMANDS = [
|
|
|
317
288
|
publishStorageDeleteCommand,
|
|
318
289
|
publishStoragePublishCommand,
|
|
319
290
|
/**
|
|
320
|
-
* ★ 0.5.0 新增:站点运营面(表单 / 域名巡检 / 预览 / 导入 v2)。
|
|
321
291
|
* 共同约定:写操作默认 dry-run(`--confirm` 才真发);人产出的数据默认脱敏。
|
|
322
292
|
* ★ task-91 / B5:原来这儿的 `plugins list` / `plugins toggle` 改由 `PLUGIN_COMMANDS`
|
|
323
293
|
* 提供(走 `/cli` 自持通道,不再 `/cms` 转发),并补齐插件面另外 7 条命令。
|
|
324
294
|
*/
|
|
325
295
|
formsListCommand,
|
|
326
296
|
formsEntriesCommand,
|
|
327
|
-
domainInspectionCommand,
|
|
328
|
-
/**
|
|
329
|
-
* ★ task-9(0.5.2 未发布):域名只读命令 —— 状态 / 解析记录 / 照抄用 DNS 清单 / 可用性 / 到期提醒。
|
|
330
|
-
* 全部只读。
|
|
331
|
-
* ★ task-12(2026-10-28):补上 `domain bind` —— 走原生动作 `cliProvisionSiteDomain`
|
|
332
|
-
* (CLI 自己的函数接、代执行 domain 内部开通编排,免 OAuth 428)。
|
|
333
|
-
* `unbind` / `repair` **仍刻意没有**:`/cli` 动作面里没有等价动作
|
|
334
|
-
* (解绑只有 `releaseSiteDomain`,OAuth 下 428 短信二次验证),不造命令。
|
|
335
|
-
*/
|
|
336
|
-
domainBindCommand,
|
|
337
|
-
domainStatusCommand,
|
|
338
|
-
domainRecordsCommand,
|
|
339
|
-
domainDnsCommand,
|
|
340
|
-
domainCheckCommand,
|
|
341
|
-
domainRemindCommand,
|
|
342
297
|
previewCommand,
|
|
343
298
|
importV2StartCommand,
|
|
344
299
|
importV2StatusCommand,
|
|
345
|
-
/**
|
|
346
|
-
* ★ 2026-10-28 自持成交链:**真的**查价 / 下单 / 改云解析 / 开 ESA / 建站收口。
|
|
347
|
-
* 与上面那 5 条只读命令的区别:这些会写账号里的真实资源(所以下单默认 dry-run、
|
|
348
|
-
* 删解析强制 --yes),实现全在 `wkgeo-cli-fc` 自己的新模块里。
|
|
349
|
-
*/
|
|
350
|
-
domainSearchCommand,
|
|
351
|
-
domainBuyCommand,
|
|
352
|
-
domainOrderCommand,
|
|
353
|
-
domainZoneListCommand,
|
|
354
|
-
domainZoneAddCommand,
|
|
355
|
-
domainZoneUpdateCommand,
|
|
356
|
-
domainZoneDeleteCommand,
|
|
357
|
-
esaSiteCommand,
|
|
358
|
-
esaRecordCommand,
|
|
359
|
-
esaHostnameCommand,
|
|
360
|
-
esaKvCommand,
|
|
361
|
-
siteCreateCommand,
|
|
362
|
-
/* 成品链路(task-21):域名成交全链路 6 条 */
|
|
363
|
-
...DOMAIN_ORDER_COMMANDS,
|
|
364
|
-
/* 域名级 DNS 凭据(2026-10-28):客户自己的 DNS 托管商 AK,四词命令 */
|
|
365
|
-
...DNS_CREDENTIAL_COMMANDS,
|
|
366
300
|
/**
|
|
367
301
|
* 配置类 auth 面(task-75 / B7):语言 / 角色 / 站点成员 11 条。
|
|
368
302
|
* 排在发布面之后 —— 同属"后台配置",但权限面独立(角色写要 `role:write`)。
|