@wps365-open/comate-cli 0.0.18 → 0.0.20

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.
@@ -1 +1 @@
1
- function a28_0x4052(){const _0x51252a=['next','none','deploying','keys','short_url','created_at','allSettled','36566ErgVNy','interrupts','phase','tasks','sort','value','description','fulfilled','messages','object','string','isArray','access_url','resolve','result','1628748glgoks','deploy_status','223664eJCOWR','length','values','5ODZnTa','failed','26kiYWMB','813268TPbAfQ','message','2854158XkiPnV','87765sfNpfv','deployed','49BmWWcj','8705590bNoIpl'];a28_0x4052=function(){return _0x51252a;};return a28_0x4052();}(function(_0x3fc4aa,_0x3a28ce){const _0x2531fc=a28_0x3c54,_0x370655=_0x3fc4aa();while(!![]){try{const _0x24afbf=parseInt(_0x2531fc(0x1f5))/0x1*(-parseInt(_0x2531fc(0x1e6))/0x2)+-parseInt(_0x2531fc(0x1ea))/0x3+parseInt(_0x2531fc(0x1e7))/0x4*(-parseInt(_0x2531fc(0x1e4))/0x5)+parseInt(_0x2531fc(0x1e9))/0x6+-parseInt(_0x2531fc(0x1ec))/0x7*(parseInt(_0x2531fc(0x1e1))/0x8)+-parseInt(_0x2531fc(0x1df))/0x9+parseInt(_0x2531fc(0x1ed))/0xa;if(_0x24afbf===_0x3a28ce)break;else _0x370655['push'](_0x370655['shift']());}catch(_0x183e65){_0x370655['push'](_0x370655['shift']());}}}(a28_0x4052,0x3fe0c));import{getThreadState}from'./cloud-agent.js';import{getBuildStatus}from'./cloud-publish.js';import{getProjectVersions}from'./manage.js';function extractDescription(_0x42209d){const _0x3fb579=a28_0x3c54;if(typeof _0x42209d===_0x3fb579(0x1da))return _0x42209d;if(!_0x42209d||typeof _0x42209d!==_0x3fb579(0x1d9))return null;const _0x416163=_0x42209d;return _0x416163[_0x3fb579(0x1fb)]??_0x416163[_0x3fb579(0x1e8)]??_0x416163['type']??null;}function a28_0x3c54(_0x48879a,_0x1a9f2c){_0x48879a=_0x48879a-0x1d8;const _0x40525c=a28_0x4052();let _0x3c541f=_0x40525c[_0x48879a];return _0x3c541f;}function extractInterrupt(_0x4d5e98){const _0x1439e9=a28_0x3c54;for(const _0x885cc9 of _0x4d5e98){const _0x31bd82=_0x885cc9,_0x1f63d5=_0x31bd82[_0x1439e9(0x1f6)];if(_0x1f63d5?.[_0x1439e9(0x1e2)]){const _0x2f76a6=_0x1f63d5[0x0],_0x140130=_0x2f76a6[_0x1439e9(0x1fa)];return{'waiting':!![],'description':extractDescription(_0x140130),'value':_0x140130};}}return{'waiting':![]};}function settled(_0x5635e5){const _0x3481f3=a28_0x3c54;return _0x5635e5['status']===_0x3481f3(0x1fc)?_0x5635e5[_0x3481f3(0x1fa)]:null;}function buildAgentBlock(_0x2ab2f5){const _0x1a839e=a28_0x3c54;if(!_0x2ab2f5)return{'messages_count':0x0,'file_count':0x0,'has_todos':![],'tasks_count':0x0};const _0x552fcc=_0x2ab2f5['values']?.[_0x1a839e(0x1d8)],_0x32b35a=_0x2ab2f5[_0x1a839e(0x1e3)]?.['files'],_0xcee234=_0x2ab2f5[_0x1a839e(0x1e3)]?.['todos'];let _0x394e25=0x0;return _0x32b35a&&typeof _0x32b35a===_0x1a839e(0x1d9)&&(_0x394e25=Object[_0x1a839e(0x1f1)](_0x32b35a)[_0x1a839e(0x1e2)]),{'messages_count':Array[_0x1a839e(0x1db)](_0x552fcc)?_0x552fcc['length']:0x0,'file_count':_0x394e25,'has_todos':Array[_0x1a839e(0x1db)](_0xcee234)?_0xcee234['length']>0x0:![],'tasks_count':Array[_0x1a839e(0x1db)](_0x2ab2f5[_0x1a839e(0x1f8)])?_0x2ab2f5['tasks'][_0x1a839e(0x1e2)]:0x0};}function buildBuildBlock(_0x54c11f){const _0x415212=a28_0x3c54;if(!_0x54c11f)return{'phase':'none','message':''};return{'phase':_0x54c11f[_0x415212(0x1f7)],'message':_0x54c11f[_0x415212(0x1e8)]};}function buildDeployBlock(_0x3a2c3c){const _0x4bc462=a28_0x3c54;if(!_0x3a2c3c)return{'status':'none','access_url':null,'short_url':null};const _0x46790b=_0x3a2c3c[_0x4bc462(0x1de)]?.['publishResponse'];if(!_0x46790b)return{'status':_0x4bc462(0x1ef),'access_url':null,'short_url':null};const _0x59796c={'deployed':_0x4bc462(0x1eb),'deploying':_0x4bc462(0x1f0),'failed':_0x4bc462(0x1e5)};return{'status':_0x59796c[_0x46790b[_0x4bc462(0x1e0)]??'']??_0x4bc462(0x1ef),'access_url':_0x46790b[_0x4bc462(0x1dc)]||null,'short_url':_0x46790b[_0x4bc462(0x1f2)]||null};}function buildProjectBlock(_0x48eb24,_0x1cb46d){const _0x190345=a28_0x3c54;if(!_0x1cb46d)return{'id':_0x48eb24,'name':null,'versions_count':0x0,'latest_version':null};const _0x37e447=[..._0x1cb46d][_0x190345(0x1f9)]((_0x4534c8,_0x23ffa7)=>_0x23ffa7[_0x190345(0x1f3)]-_0x4534c8['created_at']);return{'id':_0x48eb24,'name':null,'versions_count':_0x1cb46d[_0x190345(0x1e2)],'latest_version':_0x37e447[0x0]?.['version_number']??null};}export async function getProjectContext(_0x3644ec,_0x34f557){const _0x6e5081=a28_0x3c54,[_0x3635ff,_0xe100f,_0x372eb5]=await Promise[_0x6e5081(0x1f4)]([getThreadState(_0x3644ec),getBuildStatus(_0x3644ec),_0x34f557?getProjectVersions(_0x34f557):Promise[_0x6e5081(0x1dd)](null)]),_0x14486f=settled(_0x3635ff),_0x28a463=settled(_0xe100f),_0x3ff460=settled(_0x372eb5),_0x5b4148=buildDeployBlock(_0x28a463),_0x59ad99=buildAgentBlock(_0x14486f),_0x152364=_0x14486f?(_0x14486f[_0x6e5081(0x1ee)]?.[_0x6e5081(0x1e2)]??0x0)>0x0:![];return{'thread_id':_0x3644ec,'agent':{..._0x59ad99,'running':_0x152364},'interrupt':extractInterrupt(_0x14486f?.[_0x6e5081(0x1f8)]??[]),'build':buildBuildBlock(_0x28a463),'deploy':_0x5b4148,'project':_0x34f557!=null?buildProjectBlock(_0x34f557,_0x3ff460):null,'urls':{'runtime':_0x5b4148[_0x6e5081(0x1f2)]||_0x5b4148['access_url'],'short_url':_0x5b4148[_0x6e5081(0x1f2)]}};}
1
+ (function(_0x1ddc88,_0xfca07b){const _0x3b7f5c=a31_0x29a2,_0x176e40=_0x1ddc88();while(!![]){try{const _0x1fb701=parseInt(_0x3b7f5c(0x1bc))/0x1*(parseInt(_0x3b7f5c(0x1b7))/0x2)+parseInt(_0x3b7f5c(0x1d8))/0x3*(-parseInt(_0x3b7f5c(0x1b3))/0x4)+parseInt(_0x3b7f5c(0x1c2))/0x5*(parseInt(_0x3b7f5c(0x1ba))/0x6)+parseInt(_0x3b7f5c(0x1b5))/0x7+parseInt(_0x3b7f5c(0x1bf))/0x8*(parseInt(_0x3b7f5c(0x1b1))/0x9)+-parseInt(_0x3b7f5c(0x1c7))/0xa*(-parseInt(_0x3b7f5c(0x1b8))/0xb)+parseInt(_0x3b7f5c(0x1b2))/0xc*(-parseInt(_0x3b7f5c(0x1ce))/0xd);if(_0x1fb701===_0xfca07b)break;else _0x176e40['push'](_0x176e40['shift']());}catch(_0x3515cd){_0x176e40['push'](_0x176e40['shift']());}}}(a31_0x4069,0x37354));function a31_0x29a2(_0x2e3ff4,_0x36d8b7){_0x2e3ff4=_0x2e3ff4-0x1b0;const _0x406919=a31_0x4069();let _0x29a29c=_0x406919[_0x2e3ff4];return _0x29a29c;}import{getThreadState}from'./cloud-agent.js';import{getBuildStatus}from'./cloud-publish.js';import{getProjectVersions}from'./manage.js';function extractDescription(_0x2d67a3){const _0x452a2a=a31_0x29a2;if(typeof _0x2d67a3==='string')return _0x2d67a3;if(!_0x2d67a3||typeof _0x2d67a3!==_0x452a2a(0x1c9))return null;const _0x291388=_0x2d67a3;return _0x291388[_0x452a2a(0x1b9)]??_0x291388['message']??_0x291388[_0x452a2a(0x1b0)]??null;}function extractInterrupt(_0x277866){const _0x402477=a31_0x29a2;for(const _0x575bee of _0x277866){const _0x2797f2=_0x575bee,_0x252fd5=_0x2797f2[_0x402477(0x1bd)];if(_0x252fd5?.[_0x402477(0x1b6)]){const _0x12dc0f=_0x252fd5[0x0],_0x46fd41=_0x12dc0f[_0x402477(0x1cb)];return{'waiting':!![],'description':extractDescription(_0x46fd41),'value':_0x46fd41};}}return{'waiting':![]};}function settled(_0x4d1b3c){const _0x207ecf=a31_0x29a2;return _0x4d1b3c[_0x207ecf(0x1d4)]===_0x207ecf(0x1bb)?_0x4d1b3c['value']:null;}function buildAgentBlock(_0x34936e){const _0x25e865=a31_0x29a2;if(!_0x34936e)return{'messages_count':0x0,'file_count':0x0,'has_todos':![],'tasks_count':0x0};const _0x55dc65=_0x34936e[_0x25e865(0x1d3)]?.[_0x25e865(0x1d2)],_0xd871a9=_0x34936e['values']?.['files'],_0x1607e9=_0x34936e[_0x25e865(0x1d3)]?.[_0x25e865(0x1d6)];let _0x44e8f8=0x0;return _0xd871a9&&typeof _0xd871a9===_0x25e865(0x1c9)&&(_0x44e8f8=Object[_0x25e865(0x1be)](_0xd871a9)[_0x25e865(0x1b6)]),{'messages_count':Array[_0x25e865(0x1c6)](_0x55dc65)?_0x55dc65['length']:0x0,'file_count':_0x44e8f8,'has_todos':Array['isArray'](_0x1607e9)?_0x1607e9[_0x25e865(0x1b6)]>0x0:![],'tasks_count':Array[_0x25e865(0x1c6)](_0x34936e[_0x25e865(0x1ca)])?_0x34936e['tasks'][_0x25e865(0x1b6)]:0x0};}function buildBuildBlock(_0x164d4c){const _0x3683a9=a31_0x29a2;if(!_0x164d4c)return{'phase':_0x3683a9(0x1cd),'message':''};return{'phase':_0x164d4c['phase'],'message':_0x164d4c['message']};}function buildDeployBlock(_0x54cf87){const _0x5cfc1e=a31_0x29a2;if(!_0x54cf87)return{'status':'none','access_url':null,'short_url':null};const _0xe26999=_0x54cf87['result']?.[_0x5cfc1e(0x1d0)];if(!_0xe26999)return{'status':_0x5cfc1e(0x1cd),'access_url':null,'short_url':null};const _0x363763={'deployed':_0x5cfc1e(0x1c5),'deploying':_0x5cfc1e(0x1c0),'failed':_0x5cfc1e(0x1c8)};return{'status':_0x363763[_0xe26999[_0x5cfc1e(0x1c1)]??'']??_0x5cfc1e(0x1cd),'access_url':_0xe26999[_0x5cfc1e(0x1d7)]||null,'short_url':_0xe26999[_0x5cfc1e(0x1d1)]||null};}function buildProjectBlock(_0x1b8240,_0x669525){const _0x133d7b=a31_0x29a2;if(!_0x669525)return{'id':_0x1b8240,'name':null,'versions_count':0x0,'latest_version':null};const _0x4659ea=[..._0x669525][_0x133d7b(0x1c4)]((_0x39c669,_0xf0b75)=>_0xf0b75[_0x133d7b(0x1d5)]-_0x39c669[_0x133d7b(0x1d5)]);return{'id':_0x1b8240,'name':null,'versions_count':_0x669525['length'],'latest_version':_0x4659ea[0x0]?.[_0x133d7b(0x1c3)]??null};}export async function getProjectContext(_0x32a3ef,_0x1dfe4a){const _0x2d67f9=a31_0x29a2,[_0x390e48,_0x39b3e7,_0x289fdb]=await Promise[_0x2d67f9(0x1b4)]([getThreadState(_0x32a3ef),getBuildStatus(_0x32a3ef),_0x1dfe4a?getProjectVersions(_0x1dfe4a):Promise[_0x2d67f9(0x1cc)](null)]),_0x3c26f2=settled(_0x390e48),_0x3e3312=settled(_0x39b3e7),_0x24fb55=settled(_0x289fdb),_0x4c3d15=buildDeployBlock(_0x3e3312),_0x378f1a=buildAgentBlock(_0x3c26f2),_0x345588=_0x3c26f2?(_0x3c26f2[_0x2d67f9(0x1cf)]?.[_0x2d67f9(0x1b6)]??0x0)>0x0:![];return{'thread_id':_0x32a3ef,'agent':{..._0x378f1a,'running':_0x345588},'interrupt':extractInterrupt(_0x3c26f2?.['tasks']??[]),'build':buildBuildBlock(_0x3e3312),'deploy':_0x4c3d15,'project':_0x1dfe4a!=null?buildProjectBlock(_0x1dfe4a,_0x24fb55):null,'urls':{'runtime':_0x4c3d15[_0x2d67f9(0x1d1)]||_0x4c3d15['access_url'],'short_url':_0x4c3d15[_0x2d67f9(0x1d1)]}};}function a31_0x4069(){const _0x2ae7d5=['528143LkTEUR','length','820xYeNIK','1276lcchrQ','description','12cadFmG','fulfilled','360xlgwxA','interrupts','keys','8Roazxs','deploying','deploy_status','528240VVCjSg','version_number','sort','deployed','isArray','32380amnOnt','failed','object','tasks','value','resolve','none','3506165YvSWxN','next','publishResponse','short_url','messages','values','status','created_at','todos','access_url','9441JsyrYR','type','3075597zVYHCT','36TislPb','148gyAIZF','allSettled'];a31_0x4069=function(){return _0x2ae7d5;};return a31_0x4069();}
@@ -128,6 +128,55 @@
128
128
  "status.js"
129
129
  ]
130
130
  },
131
+ "code:config": {
132
+ "aliases": [],
133
+ "args": {},
134
+ "description": "读写项目配置(session_id、task_type 等),用于追踪会话上下文",
135
+ "examples": [
136
+ "<%= config.bin %> code config --project-id 206 --json",
137
+ "<%= config.bin %> code config --project-id 206 --set session_id=thread_xxx --set task_type=cloud --json",
138
+ "<%= config.bin %> code config --project-id 206 --set session_id=1388246512-b7aa-... --set task_type=local --json"
139
+ ],
140
+ "flags": {
141
+ "json": {
142
+ "description": "Format output as json.",
143
+ "helpGroup": "GLOBAL",
144
+ "name": "json",
145
+ "allowNo": false,
146
+ "type": "boolean"
147
+ },
148
+ "project-id": {
149
+ "description": "项目 ID(必填)",
150
+ "name": "project-id",
151
+ "required": true,
152
+ "hasDynamicHelp": false,
153
+ "multiple": false,
154
+ "type": "option"
155
+ },
156
+ "set": {
157
+ "description": "设置配置项(格式: key=value,可多次使用)",
158
+ "name": "set",
159
+ "hasDynamicHelp": false,
160
+ "multiple": true,
161
+ "type": "option"
162
+ }
163
+ },
164
+ "hasDynamicHelp": false,
165
+ "hiddenAliases": [],
166
+ "id": "code:config",
167
+ "pluginAlias": "@wps365-open/comate-cli",
168
+ "pluginName": "@wps365-open/comate-cli",
169
+ "pluginType": "core",
170
+ "strict": true,
171
+ "enableJsonFlag": true,
172
+ "isESM": true,
173
+ "relativePath": [
174
+ "dist",
175
+ "commands",
176
+ "code",
177
+ "config.js"
178
+ ]
179
+ },
131
180
  "code:create": {
132
181
  "aliases": [],
133
182
  "args": {},
@@ -270,6 +319,109 @@
270
319
  "deploy.js"
271
320
  ]
272
321
  },
322
+ "code:download": {
323
+ "aliases": [],
324
+ "args": {},
325
+ "description": "下载已部署应用的前端构建产物(通过短链或 project-id + version-id),解压到本地目录供编辑",
326
+ "examples": [
327
+ "<%= config.bin %> code download --url https://o.wpsgo.com/app/41000207/rmFkBq1nbMEO/ --json",
328
+ "<%= config.bin %> code download --project-id 477 --version-id 864 --json",
329
+ "<%= config.bin %> code download --url https://o.wpsgo.com/app/41000207/rmFkBq1nbMEO/ --output-dir ./my-app --json"
330
+ ],
331
+ "flags": {
332
+ "json": {
333
+ "description": "Format output as json.",
334
+ "helpGroup": "GLOBAL",
335
+ "name": "json",
336
+ "allowNo": false,
337
+ "type": "boolean"
338
+ },
339
+ "url": {
340
+ "description": "应用短链 URL(与 --project-id + --version-id 二选一)",
341
+ "name": "url",
342
+ "hasDynamicHelp": false,
343
+ "multiple": false,
344
+ "type": "option"
345
+ },
346
+ "project-id": {
347
+ "description": "项目 ID(与 --url 二选一)",
348
+ "name": "project-id",
349
+ "hasDynamicHelp": false,
350
+ "multiple": false,
351
+ "type": "option"
352
+ },
353
+ "version-id": {
354
+ "description": "版本 ID(与 --url 二选一,需配合 --project-id)",
355
+ "name": "version-id",
356
+ "hasDynamicHelp": false,
357
+ "multiple": false,
358
+ "type": "option"
359
+ },
360
+ "output-dir": {
361
+ "char": "o",
362
+ "description": "解压目标目录(默认: ./<short_slug> 或 ./download-<project_id>)",
363
+ "name": "output-dir",
364
+ "hasDynamicHelp": false,
365
+ "multiple": false,
366
+ "type": "option"
367
+ }
368
+ },
369
+ "hasDynamicHelp": false,
370
+ "hiddenAliases": [],
371
+ "id": "code:download",
372
+ "pluginAlias": "@wps365-open/comate-cli",
373
+ "pluginName": "@wps365-open/comate-cli",
374
+ "pluginType": "core",
375
+ "strict": true,
376
+ "enableJsonFlag": true,
377
+ "isESM": true,
378
+ "relativePath": [
379
+ "dist",
380
+ "commands",
381
+ "code",
382
+ "download.js"
383
+ ]
384
+ },
385
+ "code:fetch-html": {
386
+ "aliases": [],
387
+ "args": {},
388
+ "description": "获取已部署应用的 HTML 页面内容,分析静态资源(仅允许 o.wpsgo.com 应用地址)",
389
+ "examples": [
390
+ "<%= config.bin %> code fetch-html --url https://o.wpsgo.com/app/41000207/6Ne2UkWT3ytn/ --json"
391
+ ],
392
+ "flags": {
393
+ "json": {
394
+ "description": "Format output as json.",
395
+ "helpGroup": "GLOBAL",
396
+ "name": "json",
397
+ "allowNo": false,
398
+ "type": "boolean"
399
+ },
400
+ "url": {
401
+ "description": "应用 URL(格式: https://o.wpsgo.com/app/<company_id>/<short_slug>/)",
402
+ "name": "url",
403
+ "required": true,
404
+ "hasDynamicHelp": false,
405
+ "multiple": false,
406
+ "type": "option"
407
+ }
408
+ },
409
+ "hasDynamicHelp": false,
410
+ "hiddenAliases": [],
411
+ "id": "code:fetch-html",
412
+ "pluginAlias": "@wps365-open/comate-cli",
413
+ "pluginName": "@wps365-open/comate-cli",
414
+ "pluginType": "core",
415
+ "strict": true,
416
+ "enableJsonFlag": true,
417
+ "isESM": true,
418
+ "relativePath": [
419
+ "dist",
420
+ "commands",
421
+ "code",
422
+ "fetch-html.js"
423
+ ]
424
+ },
273
425
  "code:files": {
274
426
  "aliases": [],
275
427
  "args": {},
@@ -725,5 +877,5 @@
725
877
  ]
726
878
  }
727
879
  },
728
- "version": "0.0.18"
880
+ "version": "0.0.20"
729
881
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wps365-open/comate-cli",
3
3
  "description": "comate-cli: A CLI for WpsCode application development",
4
- "version": "0.0.18",
4
+ "version": "0.0.20",
5
5
  "author": "xiaoyefang",
6
6
  "bin": {
7
7
  "comate-cli": "./bin/run.js"