@page.su/ai-blog-cli 0.1.0-beta.4 → 0.1.0-beta.6
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/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/post.d.ts.map +1 -1
- package/dist/commands/post.js +12 -0
- package/dist/commands/post.js.map +1 -1
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +44 -11
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/syntax.d.ts +4 -0
- package/dist/commands/syntax.d.ts.map +1 -0
- package/dist/commands/syntax.js +29 -0
- package/dist/commands/syntax.js.map +1 -0
- package/package.json +4 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -100
- package/dist/index.js.map +0 -1
- package/dist/prompts/index.d.ts +0 -9
- package/dist/prompts/index.d.ts.map +0 -1
- package/dist/prompts/index.js +0 -178
- package/dist/prompts/index.js.map +0 -1
- package/dist/resources/syntax-spec.d.ts +0 -23
- package/dist/resources/syntax-spec.d.ts.map +0 -1
- package/dist/resources/syntax-spec.js +0 -105
- package/dist/resources/syntax-spec.js.map +0 -1
- package/dist/resources/syntax-spec.test.d.ts +0 -2
- package/dist/resources/syntax-spec.test.d.ts.map +0 -1
- package/dist/resources/syntax-spec.test.js +0 -47
- package/dist/resources/syntax-spec.test.js.map +0 -1
- package/dist/tools/build.d.ts +0 -13
- package/dist/tools/build.d.ts.map +0 -1
- package/dist/tools/build.js +0 -181
- package/dist/tools/build.js.map +0 -1
- package/dist/tools/code-repos.d.ts +0 -5
- package/dist/tools/code-repos.d.ts.map +0 -1
- package/dist/tools/code-repos.js +0 -149
- package/dist/tools/code-repos.js.map +0 -1
- package/dist/tools/comments.d.ts +0 -12
- package/dist/tools/comments.d.ts.map +0 -1
- package/dist/tools/comments.js +0 -87
- package/dist/tools/comments.js.map +0 -1
- package/dist/tools/demos.d.ts +0 -5
- package/dist/tools/demos.d.ts.map +0 -1
- package/dist/tools/demos.js +0 -98
- package/dist/tools/demos.js.map +0 -1
- package/dist/tools/glossary.d.ts +0 -4
- package/dist/tools/glossary.d.ts.map +0 -1
- package/dist/tools/glossary.js +0 -139
- package/dist/tools/glossary.js.map +0 -1
- package/dist/tools/helpers.d.ts +0 -44
- package/dist/tools/helpers.d.ts.map +0 -1
- package/dist/tools/helpers.js +0 -65
- package/dist/tools/helpers.js.map +0 -1
- package/dist/tools/knowledge.d.ts +0 -4
- package/dist/tools/knowledge.d.ts.map +0 -1
- package/dist/tools/knowledge.js +0 -140
- package/dist/tools/knowledge.js.map +0 -1
- package/dist/tools/math-concepts.d.ts +0 -4
- package/dist/tools/math-concepts.d.ts.map +0 -1
- package/dist/tools/math-concepts.js +0 -158
- package/dist/tools/math-concepts.js.map +0 -1
- package/dist/tools/posts.d.ts +0 -35
- package/dist/tools/posts.d.ts.map +0 -1
- package/dist/tools/posts.js +0 -278
- package/dist/tools/posts.js.map +0 -1
- package/dist/tools/scout.d.ts +0 -10
- package/dist/tools/scout.d.ts.map +0 -1
- package/dist/tools/scout.js +0 -111
- package/dist/tools/scout.js.map +0 -1
- package/dist/tools/series.d.ts +0 -12
- package/dist/tools/series.d.ts.map +0 -1
- package/dist/tools/series.js +0 -120
- package/dist/tools/series.js.map +0 -1
- package/dist/tools/syntax-capabilities.d.ts +0 -15
- package/dist/tools/syntax-capabilities.d.ts.map +0 -1
- package/dist/tools/syntax-capabilities.js +0 -859
- package/dist/tools/syntax-capabilities.js.map +0 -1
- package/dist/tools/taxonomy.d.ts +0 -4
- package/dist/tools/taxonomy.d.ts.map +0 -1
- package/dist/tools/taxonomy.js +0 -73
- package/dist/tools/taxonomy.js.map +0 -1
- package/dist/tools/uploads.d.ts +0 -15
- package/dist/tools/uploads.d.ts.map +0 -1
- package/dist/tools/uploads.js +0 -56
- package/dist/tools/uploads.js.map +0 -1
- package/dist/tools/workflows.d.ts +0 -9
- package/dist/tools/workflows.d.ts.map +0 -1
- package/dist/tools/workflows.js +0 -249
- package/dist/tools/workflows.js.map +0 -1
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/** 13 个章节(spec 主文档 + checklist 附录) */
|
|
2
|
-
const SYNTAX_SPEC_SECTIONS = [
|
|
3
|
-
{
|
|
4
|
-
uri: "mcp://syntax-spec/overview",
|
|
5
|
-
section: "overview",
|
|
6
|
-
name: "syntax-spec / overview",
|
|
7
|
-
description: "ai-blog 12 类非标准语法总览(不超过 800 字)",
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
uri: "mcp://syntax-spec/frontmatter",
|
|
11
|
-
section: "frontmatter",
|
|
12
|
-
name: "syntax-spec / frontmatter",
|
|
13
|
-
description: "§1 Frontmatter(YAML)规范",
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
uri: "mcp://syntax-spec/callout",
|
|
17
|
-
section: "callout",
|
|
18
|
-
name: "syntax-spec / callout",
|
|
19
|
-
description: "§2 Callout(>[!TIP] 等)规范",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
uri: "mcp://syntax-spec/mermaid",
|
|
23
|
-
section: "mermaid",
|
|
24
|
-
name: "syntax-spec / mermaid",
|
|
25
|
-
description: "§4 Mermaid 图表代码块规范",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
uri: "mcp://syntax-spec/live-demo",
|
|
29
|
-
section: "live-demo",
|
|
30
|
-
name: "syntax-spec / live-demo",
|
|
31
|
-
description: "§5 Live Demo 多文件代码块规范(含 tailwind / cdn meta)",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
uri: "mcp://syntax-spec/math",
|
|
35
|
-
section: "math",
|
|
36
|
-
name: "syntax-spec / math",
|
|
37
|
-
description: "§6 数学公式 $..$ / $$..$$ 规范",
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
uri: "mcp://syntax-spec/image-attributes",
|
|
41
|
-
section: "image-attributes",
|
|
42
|
-
name: "syntax-spec / image-attributes",
|
|
43
|
-
description: "§7 图片扩展属性(title 编码 w= / align= / ratio= 等)",
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
uri: "mcp://syntax-spec/image-gallery",
|
|
47
|
-
section: "image-gallery",
|
|
48
|
-
name: "syntax-spec / image-gallery",
|
|
49
|
-
description: "§8 图片宫格自动检测规则",
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
uri: "mcp://syntax-spec/image-whitelist",
|
|
53
|
-
section: "image-whitelist",
|
|
54
|
-
name: "syntax-spec / image-whitelist",
|
|
55
|
-
description: "§9 图片 src 白名单(前台严格模式)",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
uri: "mcp://syntax-spec/url-whitelist",
|
|
59
|
-
section: "url-whitelist",
|
|
60
|
-
name: "syntax-spec / url-whitelist",
|
|
61
|
-
description: "§10 URL 协议白名单(链接)",
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
uri: "mcp://syntax-spec/footnote",
|
|
65
|
-
section: "footnote",
|
|
66
|
-
name: "syntax-spec / footnote",
|
|
67
|
-
description: "§11 GFM 脚注规范",
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
uri: "mcp://syntax-spec/site-post-reference",
|
|
71
|
-
section: "site-post-reference",
|
|
72
|
-
name: "syntax-spec / site-post-reference",
|
|
73
|
-
description: "§12 站内文章引用 [标题](../posts/<slug>) 规范",
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
uri: "mcp://syntax-spec/checklist",
|
|
77
|
-
section: "checklist",
|
|
78
|
-
name: "syntax-spec / checklist",
|
|
79
|
-
description: "附录 D:保存前 Checklist(AI 自检清单)",
|
|
80
|
-
},
|
|
81
|
-
];
|
|
82
|
-
/** 把全部 syntax-spec 章节注册为静态 MCP resource */
|
|
83
|
-
export function registerSyntaxSpecResources(server, api) {
|
|
84
|
-
for (const section of SYNTAX_SPEC_SECTIONS) {
|
|
85
|
-
server.registerResource(section.name, section.uri, {
|
|
86
|
-
title: section.name,
|
|
87
|
-
description: section.description,
|
|
88
|
-
mimeType: "text/markdown",
|
|
89
|
-
}, async (uri) => {
|
|
90
|
-
const text = await api.getText(`/api/mcp/syntax-spec/${section.section}`);
|
|
91
|
-
return {
|
|
92
|
-
contents: [
|
|
93
|
-
{
|
|
94
|
-
uri: uri.href,
|
|
95
|
-
mimeType: "text/markdown",
|
|
96
|
-
text,
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
};
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/** 测试用:导出全部章节列表,便于单测断言注册数量与 URI 完整性 */
|
|
104
|
-
export const SYNTAX_SPEC_SECTIONS_FOR_TEST = SYNTAX_SPEC_SECTIONS;
|
|
105
|
-
//# sourceMappingURL=syntax-spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-spec.js","sourceRoot":"","sources":["../../src/resources/syntax-spec.ts"],"names":[],"mappings":"AAoBA,sCAAsC;AACtC,MAAM,oBAAoB,GAAiC;IACzD;QACE,GAAG,EAAE,4BAA4B;QACjC,OAAO,EAAE,UAAU;QACnB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,gCAAgC;KAC9C;IACD;QACE,GAAG,EAAE,+BAA+B;QACpC,OAAO,EAAE,aAAa;QACtB,IAAI,EAAE,2BAA2B;QACjC,WAAW,EAAE,wBAAwB;KACtC;IACD;QACE,GAAG,EAAE,2BAA2B;QAChC,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EAAE,yBAAyB;KACvC;IACD;QACE,GAAG,EAAE,2BAA2B;QAChC,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EAAE,oBAAoB;KAClC;IACD;QACE,GAAG,EAAE,6BAA6B;QAClC,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,yBAAyB;QAC/B,WAAW,EAAE,8CAA8C;KAC5D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1B,EACD,KAAK,EAAE,GAAG,EAAE,EAAE;YACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,wBAAwB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;YAC1E,OAAO;gBACL,QAAQ,EAAE;oBACR;wBACE,GAAG,EAAE,GAAG,CAAC,IAAI;wBACb,QAAQ,EAAE,eAAe;wBACzB,IAAI;qBACL;iBACF;aACF,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC;AACH,CAAC;AAED,uCAAuC;AACvC,MAAM,CAAC,MAAM,6BAA6B,GAAG,oBAAoB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-spec.test.d.ts","sourceRoot":"","sources":["../../src/resources/syntax-spec.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { SYNTAX_SPEC_SECTIONS_FOR_TEST } from "./syntax-spec.js";
|
|
3
|
-
/**
|
|
4
|
-
* 验证 syntax-spec resource 列表:
|
|
5
|
-
* - 共 13 条(与 spec 文档章节一一对应)
|
|
6
|
-
* - URI 形如 mcp://syntax-spec/<section>
|
|
7
|
-
* - section slug 在 ai-blog 后端的 SECTION_HEADING_MAP 范围内
|
|
8
|
-
*
|
|
9
|
-
* 这里不做"读真实文档"的端到端测试(属于 P1.5 集成测试范畴),
|
|
10
|
-
* 仅做静态契约校验,确保两端 section 定义不漂移。
|
|
11
|
-
*/
|
|
12
|
-
const EXPECTED_SLUGS = [
|
|
13
|
-
"overview",
|
|
14
|
-
"frontmatter",
|
|
15
|
-
"callout",
|
|
16
|
-
"mermaid",
|
|
17
|
-
"live-demo",
|
|
18
|
-
"math",
|
|
19
|
-
"image-attributes",
|
|
20
|
-
"image-gallery",
|
|
21
|
-
"image-whitelist",
|
|
22
|
-
"url-whitelist",
|
|
23
|
-
"footnote",
|
|
24
|
-
"site-post-reference",
|
|
25
|
-
"checklist",
|
|
26
|
-
];
|
|
27
|
-
describe("SYNTAX_SPEC_SECTIONS_FOR_TEST", () => {
|
|
28
|
-
it("正好 13 个章节", () => {
|
|
29
|
-
expect(SYNTAX_SPEC_SECTIONS_FOR_TEST).toHaveLength(13);
|
|
30
|
-
});
|
|
31
|
-
it("section slug 与后端 SECTION_HEADING_MAP 完全一致", () => {
|
|
32
|
-
const slugs = SYNTAX_SPEC_SECTIONS_FOR_TEST.map((section) => section.section);
|
|
33
|
-
expect(slugs.sort()).toEqual([...EXPECTED_SLUGS].sort());
|
|
34
|
-
});
|
|
35
|
-
it("URI 形如 mcp://syntax-spec/<section>", () => {
|
|
36
|
-
for (const section of SYNTAX_SPEC_SECTIONS_FOR_TEST) {
|
|
37
|
-
expect(section.uri).toBe(`mcp://syntax-spec/${section.section}`);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
it("name / description 都非空", () => {
|
|
41
|
-
for (const section of SYNTAX_SPEC_SECTIONS_FOR_TEST) {
|
|
42
|
-
expect(section.name.length).toBeGreaterThan(0);
|
|
43
|
-
expect(section.description.length).toBeGreaterThan(0);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
//# sourceMappingURL=syntax-spec.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"syntax-spec.test.js","sourceRoot":"","sources":["../../src/resources/syntax-spec.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAEjE;;;;;;;;GAQG;AAEH,MAAM,cAAc,GAAG;IACrB,UAAU;IACV,aAAa;IACb,SAAS;IACT,SAAS;IACT,WAAW;IACX,MAAM;IACN,kBAAkB;IAClB,eAAe;IACf,iBAAiB;IACjB,eAAe;IACf,UAAU;IACV,qBAAqB;IACrB,WAAW;CACZ,CAAC;AAEF,QAAQ,CAAC,+BAA+B,EAAE,GAAG,EAAE;IAC7C,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;QACnB,MAAM,CAAC,6BAA6B,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,MAAM,KAAK,GAAG,6BAA6B,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC9E,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,KAAK,MAAM,OAAO,IAAI,6BAA6B,EAAE,CAAC;YACpD,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,qBAAqB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QACnE,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QAChC,KAAK,MAAM,OAAO,IAAI,6BAA6B,EAAE,CAAC;YACpD,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;YAC/C,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACxD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/tools/build.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import type { ApiClient } from "../api-client.js";
|
|
3
|
-
/**
|
|
4
|
-
* 高级语法构造工具:post.build_frontmatter / build_live_demo / build_image
|
|
5
|
-
*
|
|
6
|
-
* 设计要点:
|
|
7
|
-
* - mcp-server **不直接 import** ai-blog 项目里的 ts 文件(避免路径耦合 + 打包难题)
|
|
8
|
-
* - 全部通过 HTTP 调用 ai-blog 后端的 `/api/mcp/build/*` 端点,复用真正的
|
|
9
|
-
* `buildLiveDemoBlockText` / `serializeImageAttributes` 等函数
|
|
10
|
-
* - 工具返回的字符串是"可以原样写进文章"的 markdown 片段
|
|
11
|
-
*/
|
|
12
|
-
export declare function registerBuildTools(server: McpServer, api: ApiClient): void;
|
|
13
|
-
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/tools/build.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CAyN1E"}
|
package/dist/tools/build.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { toolReplyHelpers } from "./posts.js";
|
|
3
|
-
/**
|
|
4
|
-
* 高级语法构造工具:post.build_frontmatter / build_live_demo / build_image
|
|
5
|
-
*
|
|
6
|
-
* 设计要点:
|
|
7
|
-
* - mcp-server **不直接 import** ai-blog 项目里的 ts 文件(避免路径耦合 + 打包难题)
|
|
8
|
-
* - 全部通过 HTTP 调用 ai-blog 后端的 `/api/mcp/build/*` 端点,复用真正的
|
|
9
|
-
* `buildLiveDemoBlockText` / `serializeImageAttributes` 等函数
|
|
10
|
-
* - 工具返回的字符串是"可以原样写进文章"的 markdown 片段
|
|
11
|
-
*/
|
|
12
|
-
export function registerBuildTools(server, api) {
|
|
13
|
-
// ─── post.build_frontmatter ────────────────────────────────────────────
|
|
14
|
-
server.registerTool("post.build_frontmatter", {
|
|
15
|
-
title: "Build frontmatter block",
|
|
16
|
-
description: "把字段拼装成合法的 YAML frontmatter(含起止 ---)。字段顺序与编辑器 MARKDOWN_METADATA_FIELDS 一致。返回字符串可直接拼到文章正文最前面。",
|
|
17
|
-
inputSchema: {
|
|
18
|
-
title: z.string().min(1),
|
|
19
|
-
slug: z.string().optional(),
|
|
20
|
-
excerpt: z.string().optional(),
|
|
21
|
-
status: z.enum(["draft", "published"]),
|
|
22
|
-
publishedAt: z.string().describe("ISO 字符串").optional(),
|
|
23
|
-
coverImage: z.string().optional(),
|
|
24
|
-
tags: z.array(z.string()).optional(),
|
|
25
|
-
seoTitle: z.string().optional(),
|
|
26
|
-
seoDescription: z.string().optional(),
|
|
27
|
-
canonicalUrl: z.string().optional(),
|
|
28
|
-
},
|
|
29
|
-
}, async (args) => toolReplyHelpers.safe(() => api.post("/api/mcp/build/frontmatter", args)));
|
|
30
|
-
// ─── post.build_live_demo ──────────────────────────────────────────────
|
|
31
|
-
server.registerTool("post.build_live_demo", {
|
|
32
|
-
title: "Build live-demo code block",
|
|
33
|
-
description: "构造一段合法的 ```live-demo 代码块,包含 fence meta(title / tailwind / cdn)和多文件 @file 标记。直接调用项目内 buildLiveDemoBlockText,输出可直接写入文章。",
|
|
34
|
-
inputSchema: {
|
|
35
|
-
title: z.string().describe("代码块右上角显示的标题"),
|
|
36
|
-
files: z
|
|
37
|
-
.array(z.object({
|
|
38
|
-
name: z.string().describe("文件名,含扩展名,如 index.html / app.tsx"),
|
|
39
|
-
content: z.string().describe("文件内容;保留原样缩进与换行"),
|
|
40
|
-
}))
|
|
41
|
-
.min(1),
|
|
42
|
-
tailwind: z.boolean().describe("是否在 iframe 内启用 Tailwind Play CDN").optional(),
|
|
43
|
-
cdn: z
|
|
44
|
-
.array(z.string())
|
|
45
|
-
.describe("外部 CDN URL(必须 https://),按顺序注入")
|
|
46
|
-
.optional(),
|
|
47
|
-
height: z
|
|
48
|
-
.number()
|
|
49
|
-
.int()
|
|
50
|
-
.min(80)
|
|
51
|
-
.max(720)
|
|
52
|
-
.describe("iframe 初始高度(像素),避免内容加载后页面跳动。范围 80-720")
|
|
53
|
-
.optional(),
|
|
54
|
-
},
|
|
55
|
-
}, async (args) => toolReplyHelpers.safe(() => api.post("/api/mcp/build/live-demo", args)));
|
|
56
|
-
// ─── post.build_reference ──────────────────────────────────────────────
|
|
57
|
-
server.registerTool("post.build_reference", {
|
|
58
|
-
title: "Build reference (```ref) block",
|
|
59
|
-
description: "构造一段合法的 ```ref 代码块,用于定义结构化参考文献 / 引用(论文 / 文档 / 仓库 / 视频等)。" +
|
|
60
|
-
"正文用 [ref:key] 行内标记引用它,渲染成可 hover 的上标角标 + 文末参考文献区。" +
|
|
61
|
-
"直接调用项目内 buildReferenceBlockText,输出可直接写入文章。引用外部资料首选此工具,体验优于 GFM 脚注。",
|
|
62
|
-
inputSchema: {
|
|
63
|
-
key: z
|
|
64
|
-
.string()
|
|
65
|
-
.describe("引用唯一标识,仅字母/数字/连字符/下划线;正文用 [ref:key] 引用它"),
|
|
66
|
-
title: z.string().describe("引用资料标题(必填)"),
|
|
67
|
-
authors: z.string().describe("作者 / 团队,如 'Vaswani et al.'").optional(),
|
|
68
|
-
source: z.string().describe("出处 / venue / 站点名,如 'NeurIPS 2017'").optional(),
|
|
69
|
-
url: z.string().describe("原文链接").optional(),
|
|
70
|
-
type: z
|
|
71
|
-
.enum(["paper", "blog", "doc", "repo", "video", "spec", "link"])
|
|
72
|
-
.describe("引用类型,决定图标与标签;默认 link")
|
|
73
|
-
.optional(),
|
|
74
|
-
note: z.string().describe("补充说明").optional(),
|
|
75
|
-
},
|
|
76
|
-
}, async (args) => toolReplyHelpers.safe(() => api.post("/api/mcp/build/reference", args)));
|
|
77
|
-
// ─── post.build_image ──────────────────────────────────────────────────
|
|
78
|
-
server.registerTool("post.build_image", {
|
|
79
|
-
title: "Build markdown image syntax",
|
|
80
|
-
description: "根据 url / alt / 扩展属性(width / align / ratio / rounded)构造合法的 markdown 图片语法。属性会被序列化进 title 字段(双引号、空格分隔)。直接调用 serializeImageAttributes + buildMarkdownImageSyntax。",
|
|
81
|
-
inputSchema: {
|
|
82
|
-
url: z.string().describe("图片 URL;推荐站内 /api/assets/oss/... 或合规 https"),
|
|
83
|
-
alt: z.string(),
|
|
84
|
-
width: z
|
|
85
|
-
.number()
|
|
86
|
-
.int()
|
|
87
|
-
.min(1)
|
|
88
|
-
.max(100)
|
|
89
|
-
.describe("百分比,预设 25 / 33 / 50 / 66 / 75 / 100")
|
|
90
|
-
.optional(),
|
|
91
|
-
align: z.enum(["left", "center", "right"]).optional(),
|
|
92
|
-
ratio: z.string().describe("如 16:9 / 4:3 / 1:1,用于骨架屏防抖").optional(),
|
|
93
|
-
rounded: z.boolean().describe("false 输出 no-rounded;true 不输出(默认就是有圆角)").optional(),
|
|
94
|
-
},
|
|
95
|
-
}, async (args) => toolReplyHelpers.safe(() => api.post("/api/mcp/build/image", args)));
|
|
96
|
-
// ─── post.build_code_group ─────────────────────────────────────────────
|
|
97
|
-
server.registerTool("post.build_code_group", {
|
|
98
|
-
title: "Build code-group block",
|
|
99
|
-
description: "构造一段合法的 ```code-group 代码块,包含多个 /* @tab */ 标记的语言 tab。" +
|
|
100
|
-
"适用于展示同一功能在不同语言中的实现(如 Python / JavaScript / cURL)。" +
|
|
101
|
-
"输出可直接写入文章。",
|
|
102
|
-
inputSchema: {
|
|
103
|
-
tabs: z
|
|
104
|
-
.array(z.object({
|
|
105
|
-
label: z.string().describe("Tab 显示标签,如 'Python'、'JavaScript'"),
|
|
106
|
-
lang: z
|
|
107
|
-
.string()
|
|
108
|
-
.describe("高亮语言(可选),如 'python'。不传则从 label 自动推断")
|
|
109
|
-
.optional(),
|
|
110
|
-
code: z.string().describe("该 tab 的代码内容"),
|
|
111
|
-
}))
|
|
112
|
-
.min(2, "至少需要 2 个 tab"),
|
|
113
|
-
},
|
|
114
|
-
}, async ({ tabs }) => {
|
|
115
|
-
const inner = tabs
|
|
116
|
-
.map((tab) => {
|
|
117
|
-
const langAttr = tab.lang ? ` lang=${tab.lang}` : "";
|
|
118
|
-
return `/* @tab ${tab.label}${langAttr} */\n${tab.code}`;
|
|
119
|
-
})
|
|
120
|
-
.join("\n\n");
|
|
121
|
-
const block = "```code-group\n" + inner + "\n```";
|
|
122
|
-
return toolReplyHelpers.toToolText(block);
|
|
123
|
-
});
|
|
124
|
-
// ─── post.build_details ────────────────────────────────────────────────
|
|
125
|
-
server.registerTool("post.build_details", {
|
|
126
|
-
title: "Build details block",
|
|
127
|
-
description: "构造一段合法的 :::details 折叠块,基于 HTML5 <details>/<summary> 原生标签。" +
|
|
128
|
-
"适用于补充说明、FAQ、技术细节等可选内容。" +
|
|
129
|
-
"输出可直接写入文章。",
|
|
130
|
-
inputSchema: {
|
|
131
|
-
title: z.string().describe("折叠块的标题,显示在 summary 区域"),
|
|
132
|
-
content: z.string().describe("折叠内容(支持完整 Markdown)"),
|
|
133
|
-
defaultOpen: z
|
|
134
|
-
.boolean()
|
|
135
|
-
.describe("是否默认展开;true 添加 {open} 标记,false 默认收起")
|
|
136
|
-
.optional(),
|
|
137
|
-
},
|
|
138
|
-
}, async ({ title, content, defaultOpen }) => {
|
|
139
|
-
const openAttr = defaultOpen ? "{open}" : "";
|
|
140
|
-
const block = `:::details[${title}]${openAttr}\n${content}\n:::`;
|
|
141
|
-
return toolReplyHelpers.toToolText(block);
|
|
142
|
-
});
|
|
143
|
-
// ─── post.build_timeline ───────────────────────────────────────────────
|
|
144
|
-
server.registerTool("post.build_timeline", {
|
|
145
|
-
title: "Build timeline block",
|
|
146
|
-
description: "构造一段合法的 :::timeline 时间轴块,展示项目里程碑、版本历史、事件发展等。" +
|
|
147
|
-
"每个事件用列表项格式定义,支持激活状态标记。" +
|
|
148
|
-
"输出可直接写入文章。",
|
|
149
|
-
inputSchema: {
|
|
150
|
-
events: z
|
|
151
|
-
.array(z.object({
|
|
152
|
-
time: z.string().describe("事件发生的时间,如 '2024-01'、'2024-Q1'"),
|
|
153
|
-
title: z.string().describe("事件的简短标题"),
|
|
154
|
-
content: z.string().describe("事件的详细描述(可选)").optional(),
|
|
155
|
-
active: z
|
|
156
|
-
.boolean()
|
|
157
|
-
.describe("是否标记为激活状态(实心圆点 + 高亮)")
|
|
158
|
-
.optional(),
|
|
159
|
-
}))
|
|
160
|
-
.min(1, "至少需要 1 个事件"),
|
|
161
|
-
},
|
|
162
|
-
}, async ({ events }) => {
|
|
163
|
-
const eventLines = events
|
|
164
|
-
.map((event) => {
|
|
165
|
-
const activeMarker = event.active ? " [active]" : "";
|
|
166
|
-
const titleLine = `- ${event.time} | ${event.title}${activeMarker}`;
|
|
167
|
-
if (event.content) {
|
|
168
|
-
const contentLines = event.content
|
|
169
|
-
.split("\n")
|
|
170
|
-
.map((line) => ` ${line}`)
|
|
171
|
-
.join("\n");
|
|
172
|
-
return `${titleLine}\n${contentLines}`;
|
|
173
|
-
}
|
|
174
|
-
return titleLine;
|
|
175
|
-
})
|
|
176
|
-
.join("\n\n");
|
|
177
|
-
const block = `:::timeline\n${eventLines}\n:::`;
|
|
178
|
-
return toolReplyHelpers.toToolText(block);
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
//# sourceMappingURL=build.js.map
|
package/dist/tools/build.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/tools/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,GAAc;IAClE,0EAA0E;IAC1E,MAAM,CAAC,YAAY,CACjB,wBAAwB,EACxB;QACE,KAAK,EAAE,yBAAyB;QAChC,WAAW,EACT,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E;qBACT,QAAQ,CAAC,sBAAsB,CAAC;qBAChC,QAAQ,EAAE;aACd,CAAC,CACH;iBACA,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC;SACxB;KACF,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QACnB,MAAM,UAAU,GAAG,MAAM;aACtB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YACb,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;YACrD,MAAM,SAAS,GAAG,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,KAAK,GAAG,YAAY,EAAE,CAAC;YACpE,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;gBAClB,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO;qBAC/B,KAAK,CAAC,IAAI,CAAC;qBACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;qBAC1B,IAAI,CAAC,IAAI,CAAC,CAAC;gBACd,OAAO,GAAG,SAAS,KAAK,YAAY,EAAE,CAAC;YACzC,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC;aACD,IAAI,CAAC,MAAM,CAAC,CAAC;QAEhB,MAAM,KAAK,GAAG,gBAAgB,UAAU,OAAO,CAAC;QAChD,OAAO,gBAAgB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
-
import type { ApiClient } from "../api-client.js";
|
|
3
|
-
/** 注册全部代码仓库相关工具 */
|
|
4
|
-
export declare function registerCodeRepoTools(server: McpServer, api: ApiClient): void;
|
|
5
|
-
//# sourceMappingURL=code-repos.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-repos.d.ts","sourceRoot":"","sources":["../../src/tools/code-repos.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAiBlD,mBAAmB;AACnB,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CA2L7E"}
|
package/dist/tools/code-repos.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { toolReplyHelpers } from "./helpers.js";
|
|
3
|
-
/**
|
|
4
|
-
* 代码仓库相关 MCP 工具:
|
|
5
|
-
* post.get_code_repo / post.upsert_code_repo / post.delete_code_repo / post.patch_code_file
|
|
6
|
-
* code_repo.list / post.link_code_repo / code_repo.get_links
|
|
7
|
-
*
|
|
8
|
-
* 设计原则:
|
|
9
|
-
* - 工具的入参 schema 用 zod raw shape 形态
|
|
10
|
-
* - upsert_code_repo 是幂等操作,文章已有关联仓库则更新,否则创建新仓库并关联
|
|
11
|
-
* - 一篇文章最多关联一个仓库,一个仓库可被多篇文章共享
|
|
12
|
-
* - code_repo.list + post.link_code_repo 让 Agent 可搜索并复用已有仓库
|
|
13
|
-
* - tool 的返回统一打包为 { content: [{ type: "text", text: <json> }] }
|
|
14
|
-
*/
|
|
15
|
-
const { safe } = toolReplyHelpers;
|
|
16
|
-
/** 注册全部代码仓库相关工具 */
|
|
17
|
-
export function registerCodeRepoTools(server, api) {
|
|
18
|
-
// ─── post.get_code_repo ───────────────────────────────────────────────
|
|
19
|
-
server.registerTool("post.get_code_repo", {
|
|
20
|
-
title: "Get code repository",
|
|
21
|
-
description: "获取指定文章关联的代码仓库,包含所有文件的完整内容。" +
|
|
22
|
-
"一篇文章最多关联一个代码仓库,一个仓库可被多篇文章共享。" +
|
|
23
|
-
"返回的 files 数组中每项包含 path(支持文件夹层级)和 content。",
|
|
24
|
-
inputSchema: {
|
|
25
|
-
id: z.string().describe("文章 id (uuid)"),
|
|
26
|
-
},
|
|
27
|
-
}, async ({ id }) => safe(() => api.get(`/api/mcp/posts/${encodeURIComponent(id)}/code`)));
|
|
28
|
-
// ─── post.upsert_code_repo ────────────────────────────────────────────
|
|
29
|
-
server.registerTool("post.upsert_code_repo", {
|
|
30
|
-
title: "Create or update code repository",
|
|
31
|
-
description: "创建或更新文章关联的代码仓库。如果该文章已有关联仓库则更新,否则创建新仓库并关联。" +
|
|
32
|
-
"一篇文章最多关联一个仓库。files 数组中每项的 path 支持文件夹层级(如 'src/components/Button.tsx')。" +
|
|
33
|
-
"⚠️ path 必须为相对路径,禁止以 / 开头或包含 ..。" +
|
|
34
|
-
"💡 如果想复用已有仓库而非创建新的,请先用 code_repo.list 搜索,再用 post.link_code_repo 关联。",
|
|
35
|
-
inputSchema: {
|
|
36
|
-
id: z.string().describe("文章 id (uuid)"),
|
|
37
|
-
title: z.string().max(255).optional().describe("仓库展示名称"),
|
|
38
|
-
description: z.string().optional().describe("仓库描述"),
|
|
39
|
-
defaultFilePath: z
|
|
40
|
-
.string()
|
|
41
|
-
.optional()
|
|
42
|
-
.describe("默认打开的文件路径,如 'README.md'"),
|
|
43
|
-
meta: z
|
|
44
|
-
.object({
|
|
45
|
-
branch: z.string().optional().describe("展示用分支名"),
|
|
46
|
-
license: z.string().optional().describe("展示用许可证"),
|
|
47
|
-
repoUrl: z.string().optional().describe("关联的外部仓库链接"),
|
|
48
|
-
})
|
|
49
|
-
.optional()
|
|
50
|
-
.describe("仓库元信息"),
|
|
51
|
-
files: z
|
|
52
|
-
.array(z.object({
|
|
53
|
-
path: z
|
|
54
|
-
.string()
|
|
55
|
-
.describe("文件相对路径,如 'src/index.ts'(禁止绝对路径或 ..)"),
|
|
56
|
-
content: z.string().describe("文件内容"),
|
|
57
|
-
}))
|
|
58
|
-
.min(1)
|
|
59
|
-
.describe("代码文件列表,至少包含一个文件"),
|
|
60
|
-
},
|
|
61
|
-
}, async ({ id, title, description, defaultFilePath, meta, files }) => safe(() => api.post(`/api/mcp/posts/${encodeURIComponent(id)}/code`, {
|
|
62
|
-
title,
|
|
63
|
-
description,
|
|
64
|
-
defaultFilePath,
|
|
65
|
-
meta,
|
|
66
|
-
files,
|
|
67
|
-
})));
|
|
68
|
-
// ─── post.delete_code_repo ────────────────────────────────────────────
|
|
69
|
-
server.registerTool("post.delete_code_repo", {
|
|
70
|
-
title: "Delete code repository",
|
|
71
|
-
description: "解除文章与代码仓库的关联。若文章是仓库的唯一所有者,则同时删除仓库。文章本身不受影响。" +
|
|
72
|
-
"💡 解除前可用 code_repo.get_links 确认是否有其他文章共享此仓库。",
|
|
73
|
-
inputSchema: {
|
|
74
|
-
id: z.string().describe("文章 id (uuid)"),
|
|
75
|
-
},
|
|
76
|
-
}, async ({ id }) => safe(() => api.delete(`/api/mcp/posts/${encodeURIComponent(id)}/code`)));
|
|
77
|
-
// ─── code_repo.list ─────────────────────────────────────────────────────
|
|
78
|
-
server.registerTool("code_repo.list", {
|
|
79
|
-
title: "List code repositories",
|
|
80
|
-
description: "列出所有代码仓库(支持搜索和分页)。" +
|
|
81
|
-
"用于发现可复用的已有仓库,避免重复创建。" +
|
|
82
|
-
"返回每个仓库的 id、标题、文件数和被关联的文章数量。",
|
|
83
|
-
inputSchema: {
|
|
84
|
-
search: z.string().optional().describe("按标题模糊搜索"),
|
|
85
|
-
page: z.number().int().min(1).optional().describe("页码,默认 1"),
|
|
86
|
-
pageSize: z
|
|
87
|
-
.number()
|
|
88
|
-
.int()
|
|
89
|
-
.min(1)
|
|
90
|
-
.max(50)
|
|
91
|
-
.optional()
|
|
92
|
-
.describe("每页条数,默认 20"),
|
|
93
|
-
},
|
|
94
|
-
}, async ({ search, page, pageSize }) => {
|
|
95
|
-
const params = new URLSearchParams();
|
|
96
|
-
if (search)
|
|
97
|
-
params.set("search", search);
|
|
98
|
-
if (page)
|
|
99
|
-
params.set("page", String(page));
|
|
100
|
-
if (pageSize)
|
|
101
|
-
params.set("pageSize", String(pageSize));
|
|
102
|
-
const qs = params.toString();
|
|
103
|
-
return safe(() => api.get(`/api/mcp/code-repos${qs ? `?${qs}` : ""}`));
|
|
104
|
-
});
|
|
105
|
-
// ─── post.link_code_repo ────────────────────────────────────────────────
|
|
106
|
-
server.registerTool("post.link_code_repo", {
|
|
107
|
-
title: "Link article to existing code repository",
|
|
108
|
-
description: "将文章关联到一个已有的代码仓库(不创建新仓库)。" +
|
|
109
|
-
"适用于系列文章共享同一个代码库的场景。" +
|
|
110
|
-
"一篇文章最多关联一个仓库,若已有关联需先解除。" +
|
|
111
|
-
"先用 code_repo.list 搜索可复用的仓库,再用此工具关联。",
|
|
112
|
-
inputSchema: {
|
|
113
|
-
id: z.string().describe("文章 id (uuid)"),
|
|
114
|
-
codeRepoId: z
|
|
115
|
-
.string()
|
|
116
|
-
.describe("要关联的仓库 id (uuid),从 code_repo.list 获取"),
|
|
117
|
-
},
|
|
118
|
-
}, async ({ id, codeRepoId }) => safe(() => api.post(`/api/mcp/posts/${encodeURIComponent(id)}/code/link`, {
|
|
119
|
-
codeRepoId,
|
|
120
|
-
})));
|
|
121
|
-
// ─── code_repo.get_links ────────────────────────────────────────────────
|
|
122
|
-
server.registerTool("code_repo.get_links", {
|
|
123
|
-
title: "Get articles linked to a code repository",
|
|
124
|
-
description: "查看某个代码仓库被哪些文章关联。" +
|
|
125
|
-
"用于了解仓库的共享情况,避免误删正在被使用的仓库。",
|
|
126
|
-
inputSchema: {
|
|
127
|
-
repoId: z.string().describe("仓库 id (uuid)"),
|
|
128
|
-
},
|
|
129
|
-
}, async ({ repoId }) => safe(() => api.get(`/api/mcp/code-repos/${encodeURIComponent(repoId)}/links`)));
|
|
130
|
-
// ─── post.patch_code_file ─────────────────────────────────────────────
|
|
131
|
-
server.registerTool("post.patch_code_file", {
|
|
132
|
-
title: "Update a single file in code repository",
|
|
133
|
-
description: "更新代码仓库中的单个文件内容(不影响其他文件)。" +
|
|
134
|
-
"⚠️ 修改单个文件的首选方式,无需重传整个仓库。" +
|
|
135
|
-
"先用 post.get_code_repo 查看现有文件列表,修改后用此工具写回。",
|
|
136
|
-
inputSchema: {
|
|
137
|
-
id: z.string().describe("文章 id (uuid)"),
|
|
138
|
-
filePath: z
|
|
139
|
-
.string()
|
|
140
|
-
.min(1)
|
|
141
|
-
.describe("要更新的文件路径(与仓库中的 path 一致),如 'src/index.ts'"),
|
|
142
|
-
content: z.string().describe("该文件的新内容"),
|
|
143
|
-
},
|
|
144
|
-
}, async ({ id, filePath, content }) => safe(() => api.patch(`/api/mcp/posts/${encodeURIComponent(id)}/code/file`, {
|
|
145
|
-
filePath,
|
|
146
|
-
content,
|
|
147
|
-
})));
|
|
148
|
-
}
|
|
149
|
-
//# sourceMappingURL=code-repos.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"code-repos.js","sourceRoot":"","sources":["../../src/tools/code-repos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,MAAM,EAAE,IAAI,EAAE,GAAG,gBAAgB,CAAC;AAElC,mBAAmB;AACnB,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,GAAc;IACrE,yEAAyE;IACzE,MAAM,CAAC,YAAY,CACjB,oBAAoB,EACpB;QACE,KAAK,EAAE,qBAAqB;QAC5B,WAAW,EACT,4BAA4B;YAC5B,8BAA8B;YAC9B,2CAA2C;QAC7C,WAAW,EAAE;YACX,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;SACxC;KACF,EACD,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CACf,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,kBAAkB,kBAAkB,CAAC,EAAE,CAAC,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ApiClient } from "../api-client.js";
|
|
3
|
-
/**
|
|
4
|
-
* 评论相关 MCP 工具:comment.create。
|
|
5
|
-
*
|
|
6
|
-
* 支持:
|
|
7
|
-
* - 在指定文章下创建一级评论(仅传 postId + content)
|
|
8
|
-
* - 回复指定评论(额外传 parentId)
|
|
9
|
-
*/
|
|
10
|
-
/** 注册评论相关 MCP 工具 */
|
|
11
|
-
export declare function registerCommentTools(server: McpServer, api: ApiClient): void;
|
|
12
|
-
//# sourceMappingURL=comments.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../src/tools/comments.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;;;GAMG;AAEH,oBAAoB;AACpB,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,GAAG,IAAI,CAiG5E"}
|