@wkgeo/cli 1.1.0 → 1.1.2
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/CHANGELOG.md +45 -0
- package/README.md +163 -25
- package/SKILL.md +121 -36
- package/lib/args.mjs +2 -2
- package/lib/asset-role.mjs +68 -0
- package/lib/cms.mjs +2 -2
- package/lib/commands/billing.mjs +56 -10
- package/lib/commands/cms.mjs +49 -13
- package/lib/commands/content.mjs +108 -0
- package/lib/commands/crawl.mjs +219 -0
- package/lib/commands/geo.mjs +1673 -0
- package/lib/commands/index.mjs +640 -541
- package/lib/commands/member.mjs +930 -0
- package/lib/commands/seo.mjs +1386 -0
- package/lib/commands/siteops.mjs +3 -3
- package/lib/commands/sites.mjs +21 -125
- package/lib/commands/template.mjs +1222 -6
- package/lib/config.mjs +16 -13
- package/lib/content-apply.mjs +664 -0
- package/lib/content-check.mjs +887 -0
- package/lib/content-contract.mjs +957 -0
- package/lib/errors.mjs +6 -0
- package/lib/format.mjs +5 -1
- package/lib/login.mjs +15 -3
- package/lib/manifest-apply.mjs +1499 -0
- package/lib/manifest-schema.json +476 -0
- package/lib/manifest.mjs +1082 -0
- package/lib/oauth-urls.mjs +1 -1
- package/lib/runtime.mjs +5 -1
- package/lib/site-create.mjs +536 -0
- package/lib/template-anim.mjs +1338 -0
- package/lib/template-animation.mjs +232 -0
- package/lib/template-capture.mjs +700 -0
- package/lib/template-gen.mjs +1204 -0
- package/lib/template-pack.mjs +206 -0
- package/lib/template-publish.mjs +733 -0
- package/lib/template-score.mjs +865 -0
- package/lib/template-validate.mjs +368 -0
- package/lib/template-verify.mjs +434 -0
- package/lib/templates-sync.mjs +616 -0
- package/package.json +2 -2
package/lib/errors.mjs
CHANGED
|
@@ -45,6 +45,12 @@ export class CliError extends Error {
|
|
|
45
45
|
this.exitCode = opts.exitCode === undefined ? EXIT.ERROR : opts.exitCode;
|
|
46
46
|
/** 原始响应(已脱敏),--verbose 时打印,便于排查"服务端到底说了什么" */
|
|
47
47
|
this.raw = opts.raw === undefined ? null : opts.raw;
|
|
48
|
+
/**
|
|
49
|
+
* 结构化失败明细(`errorEnvelope` 会原样带进 `--json` 信封的 `error.details`)。
|
|
50
|
+
* 典型用途:`content apply` 的 `rejected[]`、`content check` 的 `score/fixes`、
|
|
51
|
+
* `template verify` 的动画对账 —— 让 AI 端拿到明细自己决定下一步,而不是只看一句话。
|
|
52
|
+
*/
|
|
53
|
+
this.details = opts.details === undefined ? null : opts.details;
|
|
48
54
|
this.cause = opts.cause;
|
|
49
55
|
}
|
|
50
56
|
}
|
package/lib/format.mjs
CHANGED
|
@@ -63,7 +63,11 @@ function isSecretKey(key, value) {
|
|
|
63
63
|
|
|
64
64
|
/** 递归脱敏一个对象(用于 --verbose / --debug 打印原始响应) */
|
|
65
65
|
export function redact(value, depth = 0) {
|
|
66
|
-
|
|
66
|
+
// 深度上限只是"防巨型结构",不是"防泄漏":脱敏靠的是键名(`isSecretKey`),每一层都判。
|
|
67
|
+
// 2026-10-30 从 6 提到 12:`content apply` 的 `sections[].items[].changed[]` 与
|
|
68
|
+
// `content check` 的 `score.dimensions[].findings[]` 都在第 7 层,上限 6 时整片被压成「…」,
|
|
69
|
+
// AI 端拿到的 JSON 里看不到"哪几个字段变了 / 哪条 finding",等于白给。
|
|
70
|
+
if (depth > 12) return '…';
|
|
67
71
|
if (value === null || value === undefined) return value;
|
|
68
72
|
if (Array.isArray(value)) return value.map((v) => redact(v, depth + 1));
|
|
69
73
|
if (typeof value === 'object') {
|
package/lib/login.mjs
CHANGED
|
@@ -648,12 +648,24 @@ export function nonInteractiveBrowserHintLines({ kind = 'auth', reason = '', cmd
|
|
|
648
648
|
export function resolveBrowserIntent({ isTTY = false, json = false, forceOpen = false, noBrowser = false, env = {} } = {}) {
|
|
649
649
|
// ① 用户明确关掉:连 `--open-browser` 也不许把它顶回来(--no-browser 优先)
|
|
650
650
|
if (noBrowser === true) return { allow: false, mode: 'off', skipped_reason: 'no_browser' };
|
|
651
|
-
|
|
651
|
+
/**
|
|
652
|
+
* ② **显式要求弹浏览器**:压过"非交互环境"判定(老板 2026-11-09 定)。
|
|
653
|
+
*
|
|
654
|
+
* 背景:AI 子进程 / 管道里 stdout 不是终端,旧逻辑一律只打印链接;
|
|
655
|
+
* 但"AI 代跑 CLI、由人在本机浏览器里点授权"是常见场景(老板就是这样用),
|
|
656
|
+
* 而且用户写了 `--open-browser` 就是明确要开浏览器 —— 这条不能被非交互判定吃掉。
|
|
657
|
+
* 想保持"只打印链接"就写 `--no-browser`(① 优先级最高)。
|
|
658
|
+
*/
|
|
659
|
+
const envForce = ['1', 'true', 'yes', 'on'].includes(
|
|
660
|
+
String((env && env.WKONGAI_OPEN_BROWSER) || '').trim().toLowerCase(),
|
|
661
|
+
);
|
|
662
|
+
if (forceOpen === true || envForce) {
|
|
663
|
+
return { allow: true, mode: forceOpen === true ? 'forced' : 'agent', skipped_reason: null };
|
|
664
|
+
}
|
|
665
|
+
// ③ 非交互 / CI:**只输出链接**,不 spawn 任何浏览器
|
|
652
666
|
if (detectNonInteractive({ isTTY, env }).nonInteractive) {
|
|
653
667
|
return { allow: false, mode: 'off', skipped_reason: 'non_interactive' };
|
|
654
668
|
}
|
|
655
|
-
// ③ 用户明确要求打开(已在终端里):保留显式语义与兼容
|
|
656
|
-
if (forceOpen === true) return { allow: true, mode: 'forced', skipped_reason: null };
|
|
657
669
|
// ④ 人在终端:保持 CLI 一直以来的体验(这条**不能**破坏)
|
|
658
670
|
if (isTTY === true && json !== true) return { allow: true, mode: 'terminal', skipped_reason: null };
|
|
659
671
|
// ⑤ TTY + --json:人还在终端,照旧打开(`json` 只影响 mode 诊断字段)
|