z-mcp-codesign 0.1.3 → 0.1.5
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/README.md +11 -22
- package/dist/index.js +32 -140
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,50 +21,39 @@
|
|
|
21
21
|
}
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
24
|
# 提供的工具
|
|
27
25
|
|
|
28
|
-
| 工具名
|
|
29
|
-
|
|
|
30
|
-
| `codesign_open_login`
|
|
31
|
-
| `
|
|
32
|
-
| `
|
|
33
|
-
| `codesign_screen_list` | 获取 CoDesign 设计页面左侧菜单中的所有页面名称和访问地址 |
|
|
26
|
+
| 工具名 | 说明 |
|
|
27
|
+
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
|
|
28
|
+
| `codesign_open_login` | 有界面打开 CoDesign 登录页,用于在本机 Edge 用户数据目录中完成登录 |
|
|
29
|
+
| `codesign_screen_viewer_download_save` | 打开 CoDesign 页面,点击 `.screen-viewer__action` 选择“下载图片”,捕获下载并保存到项目根目录 `_z-mcp-imgs/` |
|
|
30
|
+
| `codesign_screen_list` | 获取 CoDesign 设计页面左侧菜单中的所有页面名称和访问地址 |
|
|
34
31
|
|
|
35
32
|
# 使用示例
|
|
36
33
|
|
|
37
34
|
**打开登录页(用于后续抓图)**
|
|
38
35
|
|
|
39
36
|
```bash
|
|
40
|
-
|
|
37
|
+
调用MCP 打开CoDesign登录页
|
|
41
38
|
```
|
|
42
39
|
|
|
43
40
|
**列出当前项目的页面列表**
|
|
44
41
|
|
|
45
42
|
```bash
|
|
46
|
-
|
|
47
|
-
URL为:https://codesign.qq.com/app/design/<projectId>/<pageId>/inspect
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
**抓图并保存到本地**
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
使用MCP 获取CoDesign页面图片,把截图保存到本地,并告诉我保存路径。
|
|
43
|
+
调用MCP 获取CoDesign所有页面列表使用表格展示。
|
|
54
44
|
URL为:https://codesign.qq.com/app/design/<projectId>/<pageId>/inspect
|
|
55
45
|
```
|
|
56
46
|
|
|
57
47
|
**通过页面“下载图片”保存到本地**
|
|
58
48
|
|
|
59
49
|
```bash
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
调用MCP 打开CoDesign页面,下载图片保存到本地,并告诉我保存路径。
|
|
51
|
+
传入参数url为:https://codesign.qq.com/app/design/<projectId>/<pageId>/inspect
|
|
62
52
|
```
|
|
63
53
|
|
|
64
54
|
**生成项目**
|
|
65
55
|
|
|
66
56
|
```bash
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
调用MCP 打开CoDesign页面,下载图片保存到本地,并识别图片内容生成Vue3+Vite项目。
|
|
58
|
+
传入参数url为:https://codesign.qq.com/app/design/<projectId>/<pageId>/inspect
|
|
69
59
|
```
|
|
70
|
-
|
package/dist/index.js
CHANGED
|
@@ -3222,8 +3222,8 @@ var require_utils = __commonJS({
|
|
|
3222
3222
|
}
|
|
3223
3223
|
return ind;
|
|
3224
3224
|
}
|
|
3225
|
-
function removeDotSegments(
|
|
3226
|
-
let input =
|
|
3225
|
+
function removeDotSegments(path2) {
|
|
3226
|
+
let input = path2;
|
|
3227
3227
|
const output = [];
|
|
3228
3228
|
let nextSlash = -1;
|
|
3229
3229
|
let len = 0;
|
|
@@ -3422,8 +3422,8 @@ var require_schemes = __commonJS({
|
|
|
3422
3422
|
wsComponent.secure = void 0;
|
|
3423
3423
|
}
|
|
3424
3424
|
if (wsComponent.resourceName) {
|
|
3425
|
-
const [
|
|
3426
|
-
wsComponent.path =
|
|
3425
|
+
const [path2, query] = wsComponent.resourceName.split("?");
|
|
3426
|
+
wsComponent.path = path2 && path2 !== "/" ? path2 : void 0;
|
|
3427
3427
|
wsComponent.query = query;
|
|
3428
3428
|
wsComponent.resourceName = void 0;
|
|
3429
3429
|
}
|
|
@@ -7281,8 +7281,8 @@ function getErrorMap() {
|
|
|
7281
7281
|
|
|
7282
7282
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
7283
7283
|
var makeIssue = (params) => {
|
|
7284
|
-
const { data, path:
|
|
7285
|
-
const fullPath = [...
|
|
7284
|
+
const { data, path: path2, errorMaps, issueData } = params;
|
|
7285
|
+
const fullPath = [...path2, ...issueData.path || []];
|
|
7286
7286
|
const fullIssue = {
|
|
7287
7287
|
...issueData,
|
|
7288
7288
|
path: fullPath
|
|
@@ -7398,11 +7398,11 @@ var errorUtil;
|
|
|
7398
7398
|
|
|
7399
7399
|
// node_modules/zod/v3/types.js
|
|
7400
7400
|
var ParseInputLazyPath = class {
|
|
7401
|
-
constructor(parent, value,
|
|
7401
|
+
constructor(parent, value, path2, key) {
|
|
7402
7402
|
this._cachedPath = [];
|
|
7403
7403
|
this.parent = parent;
|
|
7404
7404
|
this.data = value;
|
|
7405
|
-
this._path =
|
|
7405
|
+
this._path = path2;
|
|
7406
7406
|
this._key = key;
|
|
7407
7407
|
}
|
|
7408
7408
|
get path() {
|
|
@@ -11039,10 +11039,10 @@ function assignProp(target, prop, value) {
|
|
|
11039
11039
|
configurable: true
|
|
11040
11040
|
});
|
|
11041
11041
|
}
|
|
11042
|
-
function getElementAtPath(obj,
|
|
11043
|
-
if (!
|
|
11042
|
+
function getElementAtPath(obj, path2) {
|
|
11043
|
+
if (!path2)
|
|
11044
11044
|
return obj;
|
|
11045
|
-
return
|
|
11045
|
+
return path2.reduce((acc, key) => acc?.[key], obj);
|
|
11046
11046
|
}
|
|
11047
11047
|
function promiseAllObject(promisesObj) {
|
|
11048
11048
|
const keys = Object.keys(promisesObj);
|
|
@@ -11362,11 +11362,11 @@ function aborted(x, startIndex = 0) {
|
|
|
11362
11362
|
}
|
|
11363
11363
|
return false;
|
|
11364
11364
|
}
|
|
11365
|
-
function prefixIssues(
|
|
11365
|
+
function prefixIssues(path2, issues) {
|
|
11366
11366
|
return issues.map((iss) => {
|
|
11367
11367
|
var _a;
|
|
11368
11368
|
(_a = iss).path ?? (_a.path = []);
|
|
11369
|
-
iss.path.unshift(
|
|
11369
|
+
iss.path.unshift(path2);
|
|
11370
11370
|
return iss;
|
|
11371
11371
|
});
|
|
11372
11372
|
}
|
|
@@ -21008,8 +21008,7 @@ import { resolve as resolve4 } from "node:path";
|
|
|
21008
21008
|
import { join } from "node:path";
|
|
21009
21009
|
var ENV_EDGE_USER_DATA = "Z_MCP_CODESIGN_EDGE_USER_DATA";
|
|
21010
21010
|
var DEFAULT_CODESIGN_LOGIN_URL = "https://codesign.qq.com/app/login";
|
|
21011
|
-
var
|
|
21012
|
-
var DEFAULT_MCP_EDGE_PROFILE = join(process.cwd(), ".z-mcp-codesign-edge");
|
|
21011
|
+
var DEFAULT_MCP_EDGE_PROFILE = join(process.cwd(), "_z-mcp-edge");
|
|
21013
21012
|
|
|
21014
21013
|
// src/lib/login-window.ts
|
|
21015
21014
|
import { resolve as resolve2 } from "node:path";
|
|
@@ -21205,7 +21204,6 @@ var toolError = (text) => ({
|
|
|
21205
21204
|
// src/tools/open-login.ts
|
|
21206
21205
|
var codesignLoginInput = external_exports.object({
|
|
21207
21206
|
loginUrl: external_exports.string().url().optional().describe(`\u53EF\u9009\uFF1B\u9ED8\u8BA4 ${DEFAULT_CODESIGN_LOGIN_URL}`),
|
|
21208
|
-
userDataDir: external_exports.string().optional().describe("\u6D4F\u89C8\u5668\u7528\u6237\u6570\u636E\u6839\u76EE\u5F55\uFF1B\u672A\u4F20\u65F6\u540C\u6293\u56FE\u5DE5\u5177\uFF08\u73AF\u5883\u53D8\u91CF\u6216\u4E34\u65F6\u76EE\u5F55\uFF09\u3002"),
|
|
21209
21207
|
profileDirectory: external_exports.string().optional().describe(
|
|
21210
21208
|
"User Data \u4E0B Edge profile \u76EE\u5F55\u540D\uFF08\u5982 Default\uFF09\uFF1B\u4E0E\u6293\u56FE\u5DE5\u5177\u4F7F\u7528\u540C\u4E00\u76EE\u5F55\u65F6\u987B\u4F20\u76F8\u540C\u503C\u3002"
|
|
21211
21209
|
)
|
|
@@ -21226,7 +21224,7 @@ function registerOpenLoginTool(mcpServer2, deps2) {
|
|
|
21226
21224
|
return toolError("loginUrl \u4E0D\u662F\u5408\u6CD5 URL\u3002");
|
|
21227
21225
|
}
|
|
21228
21226
|
}
|
|
21229
|
-
const persistentDir = resolveEdgeUserDataDir(
|
|
21227
|
+
const persistentDir = resolveEdgeUserDataDir(void 0);
|
|
21230
21228
|
const ok = await openOrNavigateCodesignLogin(
|
|
21231
21229
|
deps2,
|
|
21232
21230
|
loginUrl,
|
|
@@ -21243,7 +21241,7 @@ function registerOpenLoginTool(mcpServer2, deps2) {
|
|
|
21243
21241
|
{
|
|
21244
21242
|
loginUrl,
|
|
21245
21243
|
userDataDir: resolve4(persistentDir),
|
|
21246
|
-
hint: "\u5728\u5F39\u51FA\u7684\u6D4F\u89C8\u5668\u4E2D\u5B8C\u6210\u767B\u5F55\u540E\u5173\u95ED\u7A97\u53E3\uFF0C\u518D\u8C03\u7528\u6293\u56FE\
|
|
21244
|
+
hint: "\u5728\u5F39\u51FA\u7684\u6D4F\u89C8\u5668\u4E2D\u5B8C\u6210\u767B\u5F55\u540E\u5173\u95ED\u7A97\u53E3\uFF0C\u518D\u8C03\u7528\u6293\u56FE/\u5217\u8868/\u4E0B\u8F7D\u7B49\u5DE5\u5177\u3002"
|
|
21247
21245
|
},
|
|
21248
21246
|
null,
|
|
21249
21247
|
2
|
|
@@ -21253,10 +21251,6 @@ function registerOpenLoginTool(mcpServer2, deps2) {
|
|
|
21253
21251
|
);
|
|
21254
21252
|
}
|
|
21255
21253
|
|
|
21256
|
-
// src/tools/screen-inspect-save.ts
|
|
21257
|
-
import { mkdir as mkdir2, writeFile } from "node:fs/promises";
|
|
21258
|
-
import path from "node:path";
|
|
21259
|
-
|
|
21260
21254
|
// src/lib/codesign-page.ts
|
|
21261
21255
|
import { chromium as chromium2 } from "playwright";
|
|
21262
21256
|
var DEFAULT_CODESIGN_PAGE_DEFAULTS = {
|
|
@@ -21271,9 +21265,9 @@ async function withCodesignPage(deps2, input, fn, opts = {}) {
|
|
|
21271
21265
|
...opts.defaults ?? {}
|
|
21272
21266
|
};
|
|
21273
21267
|
const url = input.url;
|
|
21274
|
-
const headless =
|
|
21268
|
+
const headless = opts.allowHeaded ? merged.headless : true;
|
|
21275
21269
|
const timeoutMs = input.timeoutMs ?? merged.timeoutMs;
|
|
21276
|
-
const persistentDir = resolveEdgeUserDataDir(
|
|
21270
|
+
const persistentDir = resolveEdgeUserDataDir(void 0);
|
|
21277
21271
|
const context = await chromium2.launchPersistentContext(
|
|
21278
21272
|
persistentDir,
|
|
21279
21273
|
persistentBrowserContextOptions({
|
|
@@ -21312,109 +21306,12 @@ async function withCodesignPage(deps2, input, fn, opts = {}) {
|
|
|
21312
21306
|
}
|
|
21313
21307
|
}
|
|
21314
21308
|
|
|
21315
|
-
// src/lib/screen-inspect-png.ts
|
|
21316
|
-
async function screenshotLargestScreenInspectPng(page) {
|
|
21317
|
-
const handles = await page.$$(SCREEN_INSPECT_SELECTOR);
|
|
21318
|
-
let best = null;
|
|
21319
|
-
for (const h of handles) {
|
|
21320
|
-
const box = await h.boundingBox();
|
|
21321
|
-
if (!box || box.width < 1 || box.height < 1) continue;
|
|
21322
|
-
const area = box.width * box.height;
|
|
21323
|
-
const bestArea = best ? best.box.width * best.box.height : 0;
|
|
21324
|
-
if (!best || area > bestArea) best = { handle: h, box };
|
|
21325
|
-
}
|
|
21326
|
-
if (!best) return null;
|
|
21327
|
-
const buffer = Buffer.from(await best.handle.screenshot({ type: "png" }));
|
|
21328
|
-
return { buffer, boundingBox: best.box };
|
|
21329
|
-
}
|
|
21330
|
-
|
|
21331
|
-
// src/tools/screen-inspect-save.ts
|
|
21332
|
-
function safeSegment(s) {
|
|
21333
|
-
return s.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
21334
|
-
}
|
|
21335
|
-
function timestampCompact(d) {
|
|
21336
|
-
const pad = (n) => String(n).padStart(2, "0");
|
|
21337
|
-
return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}_${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`;
|
|
21338
|
-
}
|
|
21339
|
-
function deriveCodesignIds(url) {
|
|
21340
|
-
try {
|
|
21341
|
-
const u = new URL(url);
|
|
21342
|
-
const parts = u.pathname.split("/").filter(Boolean);
|
|
21343
|
-
const projectId = parts.find((p) => /^\d{10,}$/.test(p));
|
|
21344
|
-
const pageId = parts.find((p) => /^\d+$/.test(p));
|
|
21345
|
-
return { projectId, pageId };
|
|
21346
|
-
} catch {
|
|
21347
|
-
return {};
|
|
21348
|
-
}
|
|
21349
|
-
}
|
|
21350
|
-
var screenInspectSaveInput = external_exports.object({
|
|
21351
|
-
url: external_exports.string().url().describe("CoDesign \u9875\u9762\u5730\u5740"),
|
|
21352
|
-
headless: external_exports.boolean().optional().describe("\u65E0\u5934\u6A21\u5F0F\uFF0C\u9ED8\u8BA4 true"),
|
|
21353
|
-
timeoutMs: external_exports.number().int().positive().optional().describe("\u6574\u4F53\u8D85\u65F6\u6BEB\u79D2\u6570\uFF0C\u9ED8\u8BA4 60000"),
|
|
21354
|
-
userDataDir: external_exports.string().optional().describe(
|
|
21355
|
-
"\u6D4F\u89C8\u5668\u7528\u6237\u6570\u636E\u6839\u76EE\u5F55\uFF08\u987B\u5148\u9000\u51FA\u5360\u7528\u8BE5\u76EE\u5F55\u7684\u6D4F\u89C8\u5668\uFF09\u3002\u672A\u4F20\u65F6\u4F7F\u7528\u73AF\u5883\u53D8\u91CF Z_MCP_CODESIGN_EDGE_USER_DATA \u6216\u7CFB\u7EDF\u4E34\u65F6\u76EE\u5F55\u4E0B\u9ED8\u8BA4\u914D\u7F6E\u3002"
|
|
21356
|
-
),
|
|
21357
|
-
profileDirectory: external_exports.string().optional().describe("User Data \u4E0B\u914D\u7F6E\u540D\uFF0C\u5982 Default\u3002")
|
|
21358
|
-
});
|
|
21359
|
-
async function runScreenInspectSave(deps2, input) {
|
|
21360
|
-
return withCodesignPage(
|
|
21361
|
-
deps2,
|
|
21362
|
-
input,
|
|
21363
|
-
async (page) => {
|
|
21364
|
-
const shot = await screenshotLargestScreenInspectPng(page);
|
|
21365
|
-
if (!shot) {
|
|
21366
|
-
return toolError("\u672A\u627E\u5230\u53EF\u89C1\u7684 .screen-inspect \u533A\u57DF\u3002");
|
|
21367
|
-
}
|
|
21368
|
-
const outDir = path.resolve(process.cwd(), ".codesign_screen_imgs");
|
|
21369
|
-
const { projectId, pageId } = deriveCodesignIds(input.url);
|
|
21370
|
-
const filenameParts = [
|
|
21371
|
-
"codesign",
|
|
21372
|
-
projectId ? `p${safeSegment(projectId)}` : void 0,
|
|
21373
|
-
pageId ? `s${safeSegment(pageId)}` : void 0,
|
|
21374
|
-
timestampCompact(/* @__PURE__ */ new Date())
|
|
21375
|
-
].filter(Boolean);
|
|
21376
|
-
const finalPath = path.join(outDir, `${filenameParts.join("_")}.png`);
|
|
21377
|
-
await mkdir2(path.dirname(finalPath), { recursive: true });
|
|
21378
|
-
await writeFile(finalPath, shot.buffer);
|
|
21379
|
-
return toolResult(
|
|
21380
|
-
JSON.stringify(
|
|
21381
|
-
{
|
|
21382
|
-
url: input.url,
|
|
21383
|
-
title: await page.title(),
|
|
21384
|
-
mimeType: "image/png",
|
|
21385
|
-
savedPath: finalPath,
|
|
21386
|
-
boundingBox: shot.boundingBox
|
|
21387
|
-
},
|
|
21388
|
-
null,
|
|
21389
|
-
2
|
|
21390
|
-
)
|
|
21391
|
-
);
|
|
21392
|
-
},
|
|
21393
|
-
{
|
|
21394
|
-
waitForSelector: { selector: ".screen-inspect", state: "visible" },
|
|
21395
|
-
defaults: { afterLoadWaitMs: 250 }
|
|
21396
|
-
}
|
|
21397
|
-
);
|
|
21398
|
-
}
|
|
21399
|
-
function registerScreenInspectSaveTool(mcpServer2, deps2) {
|
|
21400
|
-
mcpServer2.registerTool(
|
|
21401
|
-
"codesign_screen_inspect_save",
|
|
21402
|
-
{
|
|
21403
|
-
description: "\u6253\u5F00 CoDesign \u9875\u9762\uFF0C\u4EC5\u622A\u53D6\u9762\u79EF\u6700\u5927\u7684\u53EF\u89C1 .screen-inspect \u533A\u57DF\uFF0C\u4FDD\u5B58\u4E3A\u672C\u5730 PNG \u6587\u4EF6\u5E76\u8FD4\u56DE\u8DEF\u5F84\uFF08\u9ED8\u8BA4\u4FDD\u5B58\u5230\u9879\u76EE\u6839\u76EE\u5F55 .codesign_screen_imgs\uFF09\u3002",
|
|
21404
|
-
inputSchema: screenInspectSaveInput
|
|
21405
|
-
},
|
|
21406
|
-
(input) => runScreenInspectSave(deps2, input)
|
|
21407
|
-
);
|
|
21408
|
-
}
|
|
21409
|
-
|
|
21410
21309
|
// src/tools/screen-list.ts
|
|
21411
21310
|
var screenListInput = external_exports.object({
|
|
21412
21311
|
url: external_exports.string().url().describe(
|
|
21413
21312
|
"CoDesign \u8BBE\u8BA1\u9875\u9762\u5730\u5740\uFF0C\u5982 https://codesign.qq.com/app/design/<projectId>/<pageId>/inspect"
|
|
21414
21313
|
),
|
|
21415
|
-
headless: external_exports.boolean().optional().describe("\u65E0\u5934\u6A21\u5F0F\uFF0C\u9ED8\u8BA4 true"),
|
|
21416
21314
|
timeoutMs: external_exports.number().int().positive().optional().describe("\u6574\u4F53\u8D85\u65F6\u6BEB\u79D2\u6570\uFF0C\u9ED8\u8BA4 60000"),
|
|
21417
|
-
userDataDir: external_exports.string().optional().describe("\u6D4F\u89C8\u5668\u7528\u6237\u6570\u636E\u6839\u76EE\u5F55\uFF1B\u672A\u4F20\u65F6\u540C\u6293\u56FE\u5DE5\u5177\uFF08\u73AF\u5883\u53D8\u91CF\u6216\u4E34\u65F6\u76EE\u5F55\uFF09\u3002"),
|
|
21418
21315
|
profileDirectory: external_exports.string().optional().describe("User Data \u4E0B\u914D\u7F6E\u540D\uFF0C\u5982 Default\u3002")
|
|
21419
21316
|
});
|
|
21420
21317
|
async function runScreenList(deps2, input) {
|
|
@@ -21489,16 +21386,16 @@ function registerScreenListTool(mcpServer2, deps2) {
|
|
|
21489
21386
|
}
|
|
21490
21387
|
|
|
21491
21388
|
// src/tools/screen-viewer-download-save.ts
|
|
21492
|
-
import { mkdir as
|
|
21493
|
-
import
|
|
21494
|
-
function
|
|
21389
|
+
import { mkdir as mkdir2 } from "node:fs/promises";
|
|
21390
|
+
import path from "node:path";
|
|
21391
|
+
function safeSegment(s) {
|
|
21495
21392
|
return s.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
21496
21393
|
}
|
|
21497
|
-
function
|
|
21394
|
+
function timestampCompact(d) {
|
|
21498
21395
|
const pad = (n) => String(n).padStart(2, "0");
|
|
21499
21396
|
return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}_${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`;
|
|
21500
21397
|
}
|
|
21501
|
-
function
|
|
21398
|
+
function deriveCodesignIds(url) {
|
|
21502
21399
|
try {
|
|
21503
21400
|
const u = new URL(url);
|
|
21504
21401
|
const parts = u.pathname.split("/").filter(Boolean);
|
|
@@ -21511,11 +21408,7 @@ function deriveCodesignIds2(url) {
|
|
|
21511
21408
|
}
|
|
21512
21409
|
var screenViewerDownloadSaveInput = external_exports.object({
|
|
21513
21410
|
url: external_exports.string().url().describe("CoDesign \u9875\u9762\u5730\u5740"),
|
|
21514
|
-
headless: external_exports.boolean().optional().describe("\u65E0\u5934\u6A21\u5F0F\uFF0C\u9ED8\u8BA4 true"),
|
|
21515
21411
|
timeoutMs: external_exports.number().int().positive().optional().describe("\u6574\u4F53\u8D85\u65F6\u6BEB\u79D2\u6570\uFF0C\u9ED8\u8BA4 60000"),
|
|
21516
|
-
userDataDir: external_exports.string().optional().describe(
|
|
21517
|
-
"\u6D4F\u89C8\u5668\u7528\u6237\u6570\u636E\u6839\u76EE\u5F55\uFF08\u987B\u5148\u9000\u51FA\u5360\u7528\u8BE5\u76EE\u5F55\u7684\u6D4F\u89C8\u5668\uFF09\u3002\u672A\u4F20\u65F6\u4F7F\u7528\u73AF\u5883\u53D8\u91CF Z_MCP_CODESIGN_EDGE_USER_DATA \u6216\u7CFB\u7EDF\u4E34\u65F6\u76EE\u5F55\u4E0B\u9ED8\u8BA4\u914D\u7F6E\u3002"
|
|
21518
|
-
),
|
|
21519
21412
|
profileDirectory: external_exports.string().optional().describe("User Data \u4E0B\u914D\u7F6E\u540D\uFF0C\u5982 Default\u3002")
|
|
21520
21413
|
});
|
|
21521
21414
|
async function clickFirstVisibleText(page, candidates) {
|
|
@@ -21565,18 +21458,18 @@ async function runScreenViewerDownloadSave(deps2, input) {
|
|
|
21565
21458
|
return toolError("\u672A\u6355\u83B7\u5230\u4E0B\u8F7D\u4E8B\u4EF6\uFF08\u70B9\u51FB\u540E\u672A\u89E6\u53D1\u4E0B\u8F7D\uFF09\u3002");
|
|
21566
21459
|
}
|
|
21567
21460
|
const suggested = download.suggestedFilename() || "codesign_download.png";
|
|
21568
|
-
const ext =
|
|
21569
|
-
const outDir =
|
|
21570
|
-
const { projectId, pageId } =
|
|
21461
|
+
const ext = path.extname(suggested) || ".png";
|
|
21462
|
+
const outDir = path.resolve(process.cwd(), "_z-mcp-imgs");
|
|
21463
|
+
const { projectId, pageId } = deriveCodesignIds(input.url);
|
|
21571
21464
|
const filenameParts = [
|
|
21572
21465
|
"codesign",
|
|
21573
21466
|
"viewer_download",
|
|
21574
|
-
projectId ? `p${
|
|
21575
|
-
pageId ? `s${
|
|
21576
|
-
|
|
21467
|
+
projectId ? `p${safeSegment(projectId)}` : void 0,
|
|
21468
|
+
pageId ? `s${safeSegment(pageId)}` : void 0,
|
|
21469
|
+
timestampCompact(/* @__PURE__ */ new Date())
|
|
21577
21470
|
].filter(Boolean);
|
|
21578
|
-
const finalPath =
|
|
21579
|
-
await
|
|
21471
|
+
const finalPath = path.join(outDir, `${filenameParts.join("_")}${ext}`);
|
|
21472
|
+
await mkdir2(path.dirname(finalPath), { recursive: true });
|
|
21580
21473
|
await download.saveAs(finalPath);
|
|
21581
21474
|
return toolResult(
|
|
21582
21475
|
JSON.stringify(
|
|
@@ -21601,7 +21494,7 @@ function registerScreenViewerDownloadSaveTool(mcpServer2, deps2) {
|
|
|
21601
21494
|
mcpServer2.registerTool(
|
|
21602
21495
|
"codesign_screen_viewer_download_save",
|
|
21603
21496
|
{
|
|
21604
|
-
description: "\u6253\u5F00 CoDesign \u9875\u9762\uFF0C\u70B9\u51FB
|
|
21497
|
+
description: "\u6253\u5F00 CoDesign \u9875\u9762\uFF0C\u70B9\u51FB\u201C\u4E0B\u8F7D\u56FE\u7247\u201D\uFF0C\u6355\u83B7\u6D4F\u89C8\u5668\u4E0B\u8F7D\u5E76\u4FDD\u5B58\u5230\u9879\u76EE\u6839\u76EE\u5F55 _z-mcp-imgs/\u3002\u4E0B\u8F7DCoDesign\u9875\u9762\u56FE\u7247\u5230\u672C\u5730",
|
|
21605
21498
|
inputSchema: screenViewerDownloadSaveInput
|
|
21606
21499
|
},
|
|
21607
21500
|
(input) => runScreenViewerDownloadSave(deps2, input)
|
|
@@ -21610,7 +21503,6 @@ function registerScreenViewerDownloadSaveTool(mcpServer2, deps2) {
|
|
|
21610
21503
|
|
|
21611
21504
|
// src/tools/register-all.ts
|
|
21612
21505
|
function registerAllCodesignTools(mcpServer2, deps2) {
|
|
21613
|
-
registerScreenInspectSaveTool(mcpServer2, deps2);
|
|
21614
21506
|
registerScreenViewerDownloadSaveTool(mcpServer2, deps2);
|
|
21615
21507
|
registerScreenListTool(mcpServer2, deps2);
|
|
21616
21508
|
registerOpenLoginTool(mcpServer2, deps2);
|