@wkgeo/cli 1.0.0 → 1.1.1

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 (42) hide show
  1. package/CHANGELOG.md +249 -203
  2. package/README.md +151 -19
  3. package/SKILL.md +108 -27
  4. package/lib/args.mjs +2 -2
  5. package/lib/asset-role.mjs +68 -0
  6. package/lib/cms.mjs +2 -2
  7. package/lib/commands/billing.mjs +56 -10
  8. package/lib/commands/cms.mjs +49 -13
  9. package/lib/commands/content.mjs +108 -0
  10. package/lib/commands/crawl.mjs +219 -0
  11. package/lib/commands/geo.mjs +1673 -0
  12. package/lib/commands/index.mjs +640 -528
  13. package/lib/commands/member.mjs +930 -0
  14. package/lib/commands/seo.mjs +1386 -0
  15. package/lib/commands/siteops.mjs +3 -3
  16. package/lib/commands/sites.mjs +21 -125
  17. package/lib/commands/template.mjs +1474 -0
  18. package/lib/config.mjs +16 -13
  19. package/lib/content-apply.mjs +664 -0
  20. package/lib/content-check.mjs +887 -0
  21. package/lib/content-contract.mjs +957 -0
  22. package/lib/errors.mjs +6 -0
  23. package/lib/format.mjs +5 -1
  24. package/lib/manifest-apply.mjs +1499 -0
  25. package/lib/manifest-schema.json +476 -0
  26. package/lib/manifest.mjs +1082 -0
  27. package/lib/oauth-urls.mjs +1 -1
  28. package/lib/runtime.mjs +5 -1
  29. package/lib/site-create.mjs +536 -0
  30. package/lib/tar.mjs +207 -0
  31. package/lib/template-anim.mjs +1338 -0
  32. package/lib/template-animation.mjs +232 -0
  33. package/lib/template-capture.mjs +700 -0
  34. package/lib/template-gen.mjs +1204 -0
  35. package/lib/template-pack.mjs +206 -0
  36. package/lib/template-package.mjs +522 -0
  37. package/lib/template-publish.mjs +733 -0
  38. package/lib/template-score.mjs +865 -0
  39. package/lib/template-validate.mjs +368 -0
  40. package/lib/template-verify.mjs +434 -0
  41. package/lib/templates-sync.mjs +616 -0
  42. package/package.json +2 -2
@@ -0,0 +1,476 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://wkgeo.com/schema/wkgeo-site-manifest@1.json",
4
+ "title": "wkgeo-site-manifest@1",
5
+ "description": "A(agent)→ 平台的建站内容契约:A 交这份 manifest,`wkgeo content apply --file <它>` 负责校验、幂等落库、按需发布。未覆盖的跨引用与文件存在性由 CLI 内置校验负责。",
6
+ "type": "object",
7
+ "required": [
8
+ "_format",
9
+ "site",
10
+ "unfilled"
11
+ ],
12
+ "additionalProperties": true,
13
+ "properties": {
14
+ "_format": {
15
+ "const": "wkgeo-site-manifest@1"
16
+ },
17
+ "_source": {
18
+ "type": "object",
19
+ "description": "来源说明(给老板看的溯源信息;不进库)",
20
+ "additionalProperties": true
21
+ },
22
+ "_note": {
23
+ "type": "string",
24
+ "description": "给老板/接手下一位的一句话(不进库)"
25
+ },
26
+ "site": {
27
+ "type": "object",
28
+ "required": [
29
+ "name",
30
+ "lang"
31
+ ],
32
+ "additionalProperties": false,
33
+ "properties": {
34
+ "name": {
35
+ "type": "string",
36
+ "maxLength": 100,
37
+ "description": "必须与 --site 指到的站点同名(否则报错,防错站)"
38
+ },
39
+ "lang": {
40
+ "type": "string",
41
+ "pattern": "^[a-z]{2}(-[a-zA-Z]{2,4})?$"
42
+ },
43
+ "templateKey": {
44
+ "type": "string",
45
+ "description": "期望的模板 key(只校验/提示,apply 不自动装模板)"
46
+ }
47
+ }
48
+ },
49
+ "menus": {
50
+ "type": "array",
51
+ "maxItems": 50,
52
+ "items": {
53
+ "$ref": "#/definitions/menu"
54
+ }
55
+ },
56
+ "categories": {
57
+ "type": "array",
58
+ "maxItems": 200,
59
+ "items": {
60
+ "$ref": "#/definitions/category"
61
+ },
62
+ "description": "slug 必须唯一;parent 必须能在本数组或站点已有栏目里解析到"
63
+ },
64
+ "contents": {
65
+ "type": "array",
66
+ "maxItems": 500,
67
+ "items": {
68
+ "$ref": "#/definitions/content"
69
+ }
70
+ },
71
+ "assets": {
72
+ "type": "array",
73
+ "maxItems": 100,
74
+ "items": {
75
+ "$ref": "#/definitions/asset"
76
+ }
77
+ },
78
+ "singles": {
79
+ "type": "array",
80
+ "maxItems": 50,
81
+ "items": {
82
+ "$ref": "#/definitions/single"
83
+ }
84
+ },
85
+ "unfilled": {
86
+ "type": "array",
87
+ "maxItems": 200,
88
+ "items": {
89
+ "$ref": "#/definitions/unfilled"
90
+ },
91
+ "description": "必填:没填的项 + 原因;全填齐写 []"
92
+ }
93
+ },
94
+ "definitions": {
95
+ "field": {
96
+ "type": "object",
97
+ "required": [
98
+ "key"
99
+ ],
100
+ "additionalProperties": false,
101
+ "properties": {
102
+ "key": {
103
+ "type": "string",
104
+ "pattern": "^[a-zA-Z][a-zA-Z0-9_]{0,39}$",
105
+ "description": "字段 key(与后台自定义字段一致)"
106
+ },
107
+ "label": {
108
+ "type": "string",
109
+ "maxLength": 100,
110
+ "description": "默认取 key"
111
+ },
112
+ "type": {
113
+ "enum": [
114
+ "input",
115
+ "textarea",
116
+ "number",
117
+ "date",
118
+ "select",
119
+ "switch",
120
+ "image",
121
+ "images",
122
+ "imageGroup",
123
+ "file",
124
+ "richtext",
125
+ "video"
126
+ ],
127
+ "description": "默认 input"
128
+ },
129
+ "required": {
130
+ "type": "boolean",
131
+ "description": "默认 false"
132
+ },
133
+ "options": {
134
+ "description": "select 的选项:{\"值\":\"显示名\"} 或 [\"值\"]"
135
+ },
136
+ "sort": {
137
+ "type": "number",
138
+ "description": "默认按声明顺序 ×10"
139
+ },
140
+ "formGroup": {
141
+ "type": "string",
142
+ "description": "后台表单分组(可选)"
143
+ }
144
+ }
145
+ },
146
+ "category": {
147
+ "type": "object",
148
+ "required": [
149
+ "slug",
150
+ "name"
151
+ ],
152
+ "additionalProperties": false,
153
+ "properties": {
154
+ "slug": {
155
+ "type": "string",
156
+ "pattern": "^[a-z0-9][a-z0-9_-]{0,59}$",
157
+ "description": "栏目唯一标识;apply 按它幂等"
158
+ },
159
+ "name": {
160
+ "type": "string",
161
+ "maxLength": 100
162
+ },
163
+ "path": {
164
+ "type": "string",
165
+ "pattern": "^/[a-z0-9][a-z0-9_/-]*/$",
166
+ "description": "可选;给了就必须与 slug/层级算出来的一致"
167
+ },
168
+ "type": {
169
+ "enum": [
170
+ "list",
171
+ "single",
172
+ "channel"
173
+ ],
174
+ "description": "list=列表页(默认)| single=单页 | channel=频道页(首页/总览;子栏目继承父)"
175
+ },
176
+ "parent": {
177
+ "type": "string",
178
+ "description": "父栏目 slug 或 path;子栏目继承父的类型"
179
+ },
180
+ "sort": {
181
+ "type": "number",
182
+ "description": "同级排序,默认按声明顺序 ×10"
183
+ },
184
+ "templateFile": {
185
+ "type": "string",
186
+ "pattern": "\\.html$",
187
+ "description": "本站已有的模板文件(如 list.html),必须是 .html"
188
+ },
189
+ "description": {
190
+ "type": "string",
191
+ "description": "栏目简介,落 description"
192
+ },
193
+ "seoDescription": {
194
+ "type": "string",
195
+ "maxLength": 500,
196
+ "description": "回退读 seo.description"
197
+ },
198
+ "seoKeywords": {
199
+ "type": "string",
200
+ "maxLength": 300,
201
+ "description": "回退读 seo.keywords"
202
+ },
203
+ "fields": {
204
+ "type": "array",
205
+ "maxItems": 30,
206
+ "items": {
207
+ "$ref": "#/definitions/field"
208
+ }
209
+ }
210
+ }
211
+ },
212
+ "asset": {
213
+ "type": "object",
214
+ "required": [
215
+ "path"
216
+ ],
217
+ "additionalProperties": false,
218
+ "properties": {
219
+ "key": {
220
+ "type": "string",
221
+ "description": "给 contents[].attachments / cover 引用;默认取文件名"
222
+ },
223
+ "path": {
224
+ "type": "string",
225
+ "description": "相对 manifest 的本地路径(≤200MB)"
226
+ },
227
+ "use": {
228
+ "enum": [
229
+ "logo",
230
+ "banner",
231
+ "cover",
232
+ "content",
233
+ "download"
234
+ ],
235
+ "description": "默认 content;logo 会同时写进站点信息"
236
+ },
237
+ "role": {
238
+ "enum": [
239
+ "image",
240
+ "css",
241
+ "js",
242
+ "file"
243
+ ],
244
+ "description": "素材角色:缺省按扩展名推断(.css→css、.js→js、图片→image、其余→file);去重键是 (sha256, role)"
245
+ },
246
+ "alt": {
247
+ "type": "string",
248
+ "maxLength": 200,
249
+ "description": "alt / 素材显示名;apply 按它认领已有素材(重名会报错)"
250
+ },
251
+ "name": {
252
+ "type": "string",
253
+ "maxLength": 100,
254
+ "description": "alt 缺省时的显示名"
255
+ }
256
+ }
257
+ },
258
+ "content": {
259
+ "type": "object",
260
+ "required": [
261
+ "categorySlug",
262
+ "title"
263
+ ],
264
+ "additionalProperties": false,
265
+ "properties": {
266
+ "categorySlug": {
267
+ "type": "string",
268
+ "description": "挂到哪个栏目(slug)"
269
+ },
270
+ "title": {
271
+ "type": "string",
272
+ "maxLength": 200,
273
+ "description": "必填;空=这一条失败(其余照常)"
274
+ },
275
+ "slug": {
276
+ "type": "string",
277
+ "maxLength": 60,
278
+ "description": "内容 slug;缺省用 title 认领"
279
+ },
280
+ "status": {
281
+ "enum": [
282
+ "draft",
283
+ "published",
284
+ "hidden"
285
+ ],
286
+ "description": "默认 published(A 交的是成品)"
287
+ },
288
+ "seo": {
289
+ "type": "object",
290
+ "additionalProperties": false,
291
+ "properties": {
292
+ "title": {
293
+ "type": "string",
294
+ "maxLength": 200,
295
+ "description": "仅提示:平台无 seo_title 字段"
296
+ },
297
+ "description": {
298
+ "type": "string",
299
+ "maxLength": 500
300
+ },
301
+ "keywords": {
302
+ "type": "string",
303
+ "maxLength": 300
304
+ }
305
+ }
306
+ },
307
+ "bodyFile": {
308
+ "type": "string",
309
+ "description": "正文 HTML 文件(相对 manifest,≤512KB);与 body 二选一"
310
+ },
311
+ "body": {
312
+ "type": "string",
313
+ "description": "正文 HTML 字符串;与 bodyFile 二选一"
314
+ },
315
+ "attachments": {
316
+ "type": "array",
317
+ "items": {
318
+ "type": "string"
319
+ },
320
+ "description": "素材 key 或站点素材 uuid"
321
+ },
322
+ "cover": {
323
+ "type": "string",
324
+ "description": "封面素材 key 或 uuid"
325
+ },
326
+ "customFields": {
327
+ "type": "object",
328
+ "description": "栏目自定义字段的值(键必须是该栏目 fields[] 里的 key)"
329
+ },
330
+ "sort": {
331
+ "type": "number"
332
+ },
333
+ "pinned": {
334
+ "type": "boolean"
335
+ }
336
+ }
337
+ },
338
+ "single": {
339
+ "type": "object",
340
+ "required": [
341
+ "categorySlug"
342
+ ],
343
+ "additionalProperties": true,
344
+ "properties": {
345
+ "categorySlug": {
346
+ "type": "string",
347
+ "description": "挂到哪个栏目(slug)"
348
+ },
349
+ "title": {
350
+ "type": "string",
351
+ "maxLength": 200,
352
+ "description": "必填;空=这一条失败(其余照常)"
353
+ },
354
+ "slug": {
355
+ "type": "string",
356
+ "maxLength": 60,
357
+ "description": "内容 slug;缺省用 title 认领"
358
+ },
359
+ "status": {
360
+ "enum": [
361
+ "draft",
362
+ "published",
363
+ "hidden"
364
+ ],
365
+ "description": "默认 published(A 交的是成品)"
366
+ },
367
+ "seo": {
368
+ "type": "object",
369
+ "additionalProperties": false,
370
+ "properties": {
371
+ "title": {
372
+ "type": "string",
373
+ "maxLength": 200,
374
+ "description": "仅提示:平台无 seo_title 字段"
375
+ },
376
+ "description": {
377
+ "type": "string",
378
+ "maxLength": 500
379
+ },
380
+ "keywords": {
381
+ "type": "string",
382
+ "maxLength": 300
383
+ }
384
+ }
385
+ },
386
+ "bodyFile": {
387
+ "type": "string",
388
+ "description": "正文 HTML 文件(相对 manifest,≤512KB);与 body 二选一"
389
+ },
390
+ "body": {
391
+ "type": "string",
392
+ "description": "正文 HTML 字符串;与 bodyFile 二选一"
393
+ },
394
+ "attachments": {
395
+ "type": "array",
396
+ "items": {
397
+ "type": "string"
398
+ },
399
+ "description": "素材 key 或站点素材 uuid"
400
+ },
401
+ "cover": {
402
+ "type": "string",
403
+ "description": "封面素材 key 或 uuid"
404
+ },
405
+ "customFields": {
406
+ "type": "object",
407
+ "description": "栏目自定义字段的值(键必须是该栏目 fields[] 里的 key)"
408
+ },
409
+ "sort": {
410
+ "type": "number"
411
+ },
412
+ "pinned": {
413
+ "type": "boolean"
414
+ }
415
+ },
416
+ "description": "单页内容:绑一个 type=single 的栏目;title 缺省取栏目名"
417
+ },
418
+ "menu": {
419
+ "type": "object",
420
+ "required": [
421
+ "label",
422
+ "path"
423
+ ],
424
+ "additionalProperties": false,
425
+ "properties": {
426
+ "label": {
427
+ "type": "string",
428
+ "maxLength": 100
429
+ },
430
+ "path": {
431
+ "type": "string",
432
+ "pattern": "^/[a-z0-9][a-z0-9_/-]*/$",
433
+ "description": "必须等于某个栏目的 path"
434
+ },
435
+ "sort": {
436
+ "type": "number"
437
+ },
438
+ "children": {
439
+ "type": "array",
440
+ "maxItems": 50,
441
+ "items": {
442
+ "$ref": "#/definitions/menu"
443
+ },
444
+ "description": "最多 3 级"
445
+ }
446
+ }
447
+ },
448
+ "unfilled": {
449
+ "type": "object",
450
+ "required": [
451
+ "item",
452
+ "reason"
453
+ ],
454
+ "additionalProperties": false,
455
+ "properties": {
456
+ "item": {
457
+ "type": "string",
458
+ "description": "哪个位置没填,如 categories[2].seoDescription"
459
+ },
460
+ "reason": {
461
+ "enum": [
462
+ "来源缺失",
463
+ "需老板确认",
464
+ "版权不明",
465
+ "平台不支持"
466
+ ],
467
+ "description": "为什么没填"
468
+ },
469
+ "detail": {
470
+ "type": "string",
471
+ "description": "补充说明(谁去补 / 卡在哪)"
472
+ }
473
+ }
474
+ }
475
+ }
476
+ }