@cloudglab/yapi-cli 0.0.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.
- package/CHANGELOG.md +5 -0
- package/README.md +131 -0
- package/dist/bin/yapi.d.ts +2 -0
- package/dist/bin/yapi.js +8 -0
- package/dist/bin/yapi.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +203 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/changelog.d.ts +17 -0
- package/dist/core/changelog.js +117 -0
- package/dist/core/changelog.js.map +1 -0
- package/dist/core/cli-output.d.ts +13 -0
- package/dist/core/cli-output.js +65 -0
- package/dist/core/cli-output.js.map +1 -0
- package/dist/core/cli-registry.d.ts +38 -0
- package/dist/core/cli-registry.js +189 -0
- package/dist/core/cli-registry.js.map +1 -0
- package/dist/core/completion.d.ts +3 -0
- package/dist/core/completion.js +94 -0
- package/dist/core/completion.js.map +1 -0
- package/dist/core/doctor.d.ts +13 -0
- package/dist/core/doctor.js +124 -0
- package/dist/core/doctor.js.map +1 -0
- package/dist/core/errors.d.ts +38 -0
- package/dist/core/errors.js +74 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/output.d.ts +27 -0
- package/dist/core/output.js +208 -0
- package/dist/core/output.js.map +1 -0
- package/dist/core/update-probe.d.ts +14 -0
- package/dist/core/update-probe.js +67 -0
- package/dist/core/update-probe.js.map +1 -0
- package/dist/core/write-guard.d.ts +25 -0
- package/dist/core/write-guard.js +36 -0
- package/dist/core/write-guard.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +13 -0
- package/dist/install.js +201 -0
- package/dist/install.js.map +1 -0
- package/dist/services/yapi/api.d.ts +696 -0
- package/dist/services/yapi/api.js +700 -0
- package/dist/services/yapi/api.js.map +1 -0
- package/dist/services/yapi/auth.d.ts +37 -0
- package/dist/services/yapi/auth.js +143 -0
- package/dist/services/yapi/auth.js.map +1 -0
- package/dist/services/yapi/authCache.d.ts +25 -0
- package/dist/services/yapi/authCache.js +80 -0
- package/dist/services/yapi/authCache.js.map +1 -0
- package/dist/services/yapi/cache.d.ts +27 -0
- package/dist/services/yapi/cache.js +88 -0
- package/dist/services/yapi/cache.js.map +1 -0
- package/dist/services/yapi/config.d.ts +12 -0
- package/dist/services/yapi/config.js +66 -0
- package/dist/services/yapi/config.js.map +1 -0
- package/dist/services/yapi/index.d.ts +6 -0
- package/dist/services/yapi/index.js +6 -0
- package/dist/services/yapi/index.js.map +1 -0
- package/dist/services/yapi/logger.d.ts +6 -0
- package/dist/services/yapi/logger.js +36 -0
- package/dist/services/yapi/logger.js.map +1 -0
- package/dist/services/yapi/types.d.ts +176 -0
- package/dist/services/yapi/types.js +2 -0
- package/dist/services/yapi/types.js.map +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.js +5 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/shared.d.ts +33 -0
- package/dist/tools/shared.js +46 -0
- package/dist/tools/shared.js.map +1 -0
- package/dist/tools/yapi/docs-sync.d.ts +29 -0
- package/dist/tools/yapi/docs-sync.js +243 -0
- package/dist/tools/yapi/docs-sync.js.map +1 -0
- package/dist/tools/yapi/index.d.ts +6 -0
- package/dist/tools/yapi/index.js +7 -0
- package/dist/tools/yapi/index.js.map +1 -0
- package/dist/tools/yapi/register-auth.d.ts +2 -0
- package/dist/tools/yapi/register-auth.js +182 -0
- package/dist/tools/yapi/register-auth.js.map +1 -0
- package/dist/tools/yapi/register-group.d.ts +2 -0
- package/dist/tools/yapi/register-group.js +178 -0
- package/dist/tools/yapi/register-group.js.map +1 -0
- package/dist/tools/yapi/register-interface.d.ts +2 -0
- package/dist/tools/yapi/register-interface.js +359 -0
- package/dist/tools/yapi/register-interface.js.map +1 -0
- package/dist/tools/yapi/register-project.d.ts +2 -0
- package/dist/tools/yapi/register-project.js +300 -0
- package/dist/tools/yapi/register-project.js.map +1 -0
- package/dist/tools/yapi/register-test.d.ts +2 -0
- package/dist/tools/yapi/register-test.js +267 -0
- package/dist/tools/yapi/register-test.js.map +1 -0
- package/dist/tools/yapi/register-util.d.ts +2 -0
- package/dist/tools/yapi/register-util.js +565 -0
- package/dist/tools/yapi/register-util.js.map +1 -0
- package/dist/tools/yapi/register.d.ts +6 -0
- package/dist/tools/yapi/register.js +19 -0
- package/dist/tools/yapi/register.js.map +1 -0
- package/dist/tools/yapi/utils.d.ts +11 -0
- package/dist/tools/yapi/utils.js +28 -0
- package/dist/tools/yapi/utils.js.map +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/package.json +38 -0
- package/skills/yapi-cli/SKILL.md +126 -0
- package/skills/yapi-cli/reference/auth.md +106 -0
- package/skills/yapi-cli/reference/cli.md +60 -0
- package/skills/yapi-cli/reference/commands.md +152 -0
- package/skills/yapi-cli/reference/group.md +77 -0
- package/skills/yapi-cli/reference/install.md +82 -0
- package/skills/yapi-cli/reference/interface.md +185 -0
- package/skills/yapi-cli/reference/overview.md +52 -0
- package/skills/yapi-cli/reference/project.md +115 -0
- package/skills/yapi-cli/reference/test.md +130 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/** YApi API 通用响应结构 */
|
|
2
|
+
export interface YApiResponse<T = unknown> {
|
|
3
|
+
errcode: number;
|
|
4
|
+
errmsg: string;
|
|
5
|
+
data: T;
|
|
6
|
+
}
|
|
7
|
+
/** YApi 接口/端点定义 */
|
|
8
|
+
export interface ApiInterface {
|
|
9
|
+
_id: number;
|
|
10
|
+
project_id: number;
|
|
11
|
+
catid: number;
|
|
12
|
+
title: string;
|
|
13
|
+
path: string;
|
|
14
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'PATCH';
|
|
15
|
+
status: 'undone' | 'done';
|
|
16
|
+
tag: string[];
|
|
17
|
+
uid: number;
|
|
18
|
+
query_path: Record<string, unknown>;
|
|
19
|
+
req_query: Array<{
|
|
20
|
+
name: string;
|
|
21
|
+
example: string;
|
|
22
|
+
desc: string;
|
|
23
|
+
required: string;
|
|
24
|
+
}>;
|
|
25
|
+
req_headers: Array<{
|
|
26
|
+
name: string;
|
|
27
|
+
example: string;
|
|
28
|
+
desc: string;
|
|
29
|
+
required: string;
|
|
30
|
+
}>;
|
|
31
|
+
req_body_form: Array<{
|
|
32
|
+
name: string;
|
|
33
|
+
type: string;
|
|
34
|
+
example: string;
|
|
35
|
+
desc: string;
|
|
36
|
+
required: string;
|
|
37
|
+
}>;
|
|
38
|
+
req_body_type: string;
|
|
39
|
+
req_body_other: string;
|
|
40
|
+
res_body_type: string;
|
|
41
|
+
res_body: string;
|
|
42
|
+
edit_uid: number;
|
|
43
|
+
api_opened: boolean;
|
|
44
|
+
index: number;
|
|
45
|
+
add_time: number;
|
|
46
|
+
up_time: number;
|
|
47
|
+
__v: number;
|
|
48
|
+
desc: string;
|
|
49
|
+
markdown: string;
|
|
50
|
+
username?: string;
|
|
51
|
+
}
|
|
52
|
+
/** YApi 项目信息 */
|
|
53
|
+
export interface ProjectInfo {
|
|
54
|
+
_id: number;
|
|
55
|
+
name: string;
|
|
56
|
+
basepath: string;
|
|
57
|
+
project_type: string;
|
|
58
|
+
uid: number;
|
|
59
|
+
group_id: number;
|
|
60
|
+
icon: string;
|
|
61
|
+
color: string;
|
|
62
|
+
desc: string;
|
|
63
|
+
members: Array<{
|
|
64
|
+
_id: number;
|
|
65
|
+
role: string;
|
|
66
|
+
username: string;
|
|
67
|
+
uid: number;
|
|
68
|
+
}>;
|
|
69
|
+
add_time: number;
|
|
70
|
+
up_time: number;
|
|
71
|
+
env: Array<{
|
|
72
|
+
_id: number;
|
|
73
|
+
name: string;
|
|
74
|
+
domain: string;
|
|
75
|
+
}>;
|
|
76
|
+
token: string;
|
|
77
|
+
msg: string;
|
|
78
|
+
switch_notice: boolean;
|
|
79
|
+
strice: boolean;
|
|
80
|
+
is_json5: boolean;
|
|
81
|
+
is_mock_open: boolean;
|
|
82
|
+
mock_custom_script: string;
|
|
83
|
+
}
|
|
84
|
+
/** YApi 分类/分组信息 */
|
|
85
|
+
export interface CategoryInfo {
|
|
86
|
+
_id: number;
|
|
87
|
+
name: string;
|
|
88
|
+
project_id: number;
|
|
89
|
+
desc: string;
|
|
90
|
+
uid: number;
|
|
91
|
+
add_time: number;
|
|
92
|
+
up_time: number;
|
|
93
|
+
list: ApiInterface[];
|
|
94
|
+
}
|
|
95
|
+
/** 搜索结果项 */
|
|
96
|
+
export interface ApiSearchResultItem {
|
|
97
|
+
_id: number;
|
|
98
|
+
project_id: number;
|
|
99
|
+
catid: number;
|
|
100
|
+
title: string;
|
|
101
|
+
path: string;
|
|
102
|
+
method: string;
|
|
103
|
+
status: string;
|
|
104
|
+
project_name?: string;
|
|
105
|
+
group_name?: string;
|
|
106
|
+
}
|
|
107
|
+
/** 登录结果 */
|
|
108
|
+
export interface LoginResult {
|
|
109
|
+
_id: number;
|
|
110
|
+
username: string;
|
|
111
|
+
password: string;
|
|
112
|
+
email: string;
|
|
113
|
+
add_time: number;
|
|
114
|
+
up_time: number;
|
|
115
|
+
__v: number;
|
|
116
|
+
role: string;
|
|
117
|
+
type: string;
|
|
118
|
+
token: string;
|
|
119
|
+
}
|
|
120
|
+
/** 用户信息 */
|
|
121
|
+
export interface YApiUserInfo {
|
|
122
|
+
_id: number;
|
|
123
|
+
username: string;
|
|
124
|
+
email: string;
|
|
125
|
+
role: string;
|
|
126
|
+
type: string;
|
|
127
|
+
add_time: number;
|
|
128
|
+
up_time: number;
|
|
129
|
+
}
|
|
130
|
+
/** 项目成员 */
|
|
131
|
+
export interface ProjectMember {
|
|
132
|
+
_id: number;
|
|
133
|
+
uid: number;
|
|
134
|
+
username: string;
|
|
135
|
+
email: string;
|
|
136
|
+
role: string;
|
|
137
|
+
type: string;
|
|
138
|
+
}
|
|
139
|
+
/** YApi 配置 */
|
|
140
|
+
export interface YApiConfig {
|
|
141
|
+
/** YApi 服务器地址 */
|
|
142
|
+
serverUrl: string;
|
|
143
|
+
/** API token */
|
|
144
|
+
token?: string;
|
|
145
|
+
/** Cookie 认证的 session */
|
|
146
|
+
cookie?: string;
|
|
147
|
+
/** 默认项目 ID */
|
|
148
|
+
projectId?: number;
|
|
149
|
+
/** 认证方式:token | cookie | ldap */
|
|
150
|
+
authMode?: 'token' | 'cookie' | 'ldap';
|
|
151
|
+
/** LDAP 密码加密 salt(默认 e6751eadaefc7af085fa0f9e047cfce6d2cce0cb95706ed5f9a0422b28f64407) */
|
|
152
|
+
ldapSalt?: string;
|
|
153
|
+
}
|
|
154
|
+
/** 认证缓存 */
|
|
155
|
+
export interface AuthCacheData {
|
|
156
|
+
cookie?: string;
|
|
157
|
+
token?: string;
|
|
158
|
+
username?: string;
|
|
159
|
+
userId?: number;
|
|
160
|
+
loginTime?: number;
|
|
161
|
+
expiresAt?: number;
|
|
162
|
+
}
|
|
163
|
+
/** 环境变量 */
|
|
164
|
+
export interface ProjectEnv {
|
|
165
|
+
_id: number;
|
|
166
|
+
name: string;
|
|
167
|
+
domain: string;
|
|
168
|
+
header?: Array<{
|
|
169
|
+
name: string;
|
|
170
|
+
value: string;
|
|
171
|
+
}>;
|
|
172
|
+
global: Array<{
|
|
173
|
+
name: string;
|
|
174
|
+
value: string;
|
|
175
|
+
}>;
|
|
176
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/services/yapi/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,UAAU,aAAa,CAAC,QAAqB;IACjD,oBAAoB,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 共享工具函数和 Zod schema 片段。
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import type { JsonContentResult } from '../core/cli-registry.js';
|
|
6
|
+
import { OutputFormatter } from '../core/output.js';
|
|
7
|
+
export declare function setOutputFormat(format: 'json' | 'pretty'): void;
|
|
8
|
+
export declare function getOutputFormatter(): OutputFormatter;
|
|
9
|
+
/** 包装数据为 MCP-compatible 的 JsonContentResult */
|
|
10
|
+
export declare function jsonResult(value: unknown): JsonContentResult;
|
|
11
|
+
export declare function prettyPrint(data: unknown): void;
|
|
12
|
+
/** 分页参数(page + limit,带默认值) */
|
|
13
|
+
export declare const paginationSchema: {
|
|
14
|
+
readonly page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
15
|
+
readonly limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
16
|
+
};
|
|
17
|
+
/** 项目 ID 参数(必填) */
|
|
18
|
+
export declare const projectIdSchema: {
|
|
19
|
+
readonly projectId: z.ZodNumber;
|
|
20
|
+
};
|
|
21
|
+
/** 可选的 ID 筛选参数 */
|
|
22
|
+
export declare const optionalIdFilter: {
|
|
23
|
+
readonly groupId: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
readonly projectId: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
};
|
|
26
|
+
/** 可选的可选文本(空字符串视为未提供) */
|
|
27
|
+
export declare const optionalTrimmedText: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, unknown>;
|
|
28
|
+
/** 可选的 boolean(默认 false) */
|
|
29
|
+
export declare const optionalBool: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
30
|
+
/** 标准的导出格式枚举 */
|
|
31
|
+
export declare const exportFormatEnum: z.ZodDefault<z.ZodEnum<["json", "swagger", "openapi3"]>>;
|
|
32
|
+
/** HTTP 方法枚举 */
|
|
33
|
+
export declare const httpMethodEnum: z.ZodEnum<["GET", "POST", "PUT", "DELETE", "PATCH"]>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 共享工具函数和 Zod schema 片段。
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { OutputFormatter } from '../core/output.js';
|
|
6
|
+
// ==================== 默认输出器 ====================
|
|
7
|
+
/** 创建全局 OutputFormatter(由 cli.ts 在启动时设置 format) */
|
|
8
|
+
let _globalFormatter = new OutputFormatter();
|
|
9
|
+
export function setOutputFormat(format) {
|
|
10
|
+
_globalFormatter = new OutputFormatter(format);
|
|
11
|
+
}
|
|
12
|
+
export function getOutputFormatter() {
|
|
13
|
+
return _globalFormatter;
|
|
14
|
+
}
|
|
15
|
+
// ==================== MCP 兼容输出 ====================
|
|
16
|
+
/** 包装数据为 MCP-compatible 的 JsonContentResult */
|
|
17
|
+
export function jsonResult(value) {
|
|
18
|
+
return _globalFormatter.result(value);
|
|
19
|
+
}
|
|
20
|
+
export function prettyPrint(data) {
|
|
21
|
+
_globalFormatter.printMessage(_globalFormatter['formatData'](data));
|
|
22
|
+
}
|
|
23
|
+
// ==================== Zod 公共片段 ====================
|
|
24
|
+
/** 分页参数(page + limit,带默认值) */
|
|
25
|
+
export const paginationSchema = {
|
|
26
|
+
page: z.coerce.number().optional().default(1).describe('页码(从 1 开始)'),
|
|
27
|
+
limit: z.coerce.number().optional().default(50).describe('每页数量'),
|
|
28
|
+
};
|
|
29
|
+
/** 项目 ID 参数(必填) */
|
|
30
|
+
export const projectIdSchema = {
|
|
31
|
+
projectId: z.coerce.number().describe('项目 ID'),
|
|
32
|
+
};
|
|
33
|
+
/** 可选的 ID 筛选参数 */
|
|
34
|
+
export const optionalIdFilter = {
|
|
35
|
+
groupId: z.coerce.number().optional().describe('分组 ID'),
|
|
36
|
+
projectId: z.coerce.number().optional().describe('项目 ID'),
|
|
37
|
+
};
|
|
38
|
+
/** 可选的可选文本(空字符串视为未提供) */
|
|
39
|
+
export const optionalTrimmedText = z.preprocess((value) => (typeof value === 'string' && value.trim() === '' ? undefined : value), z.string().trim().optional());
|
|
40
|
+
/** 可选的 boolean(默认 false) */
|
|
41
|
+
export const optionalBool = z.coerce.boolean().optional().default(false);
|
|
42
|
+
/** 标准的导出格式枚举 */
|
|
43
|
+
export const exportFormatEnum = z.enum(['json', 'swagger', 'openapi3']).default('json');
|
|
44
|
+
/** HTTP 方法枚举 */
|
|
45
|
+
export const httpMethodEnum = z.enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH']);
|
|
46
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/tools/shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,kDAAkD;AAElD,mDAAmD;AACnD,IAAI,gBAAgB,GAAG,IAAI,eAAe,EAAE,CAAC;AAE7C,MAAM,UAAU,eAAe,CAAC,MAAyB;IACvD,gBAAgB,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,qDAAqD;AAErD,+CAA+C;AAC/C,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,gBAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAa;IACvC,gBAAgB,CAAC,YAAY,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,qDAAqD;AAErD,8BAA8B;AAC9B,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAA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,CAAC,CAAC;AAExF,gBAAgB;AAChB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { YApiService } from '../../services/yapi/api.js';
|
|
2
|
+
/** 从 markdown 中提取的接口定义 */
|
|
3
|
+
export interface ParsedApiInterface {
|
|
4
|
+
title: string;
|
|
5
|
+
path: string;
|
|
6
|
+
method: string;
|
|
7
|
+
description: string;
|
|
8
|
+
reqBody?: string;
|
|
9
|
+
resBody?: string;
|
|
10
|
+
}
|
|
11
|
+
/** 解析 markdown 中的 API 接口定义 */
|
|
12
|
+
export declare function parseMarkdownApi(content: string): ParsedApiInterface[];
|
|
13
|
+
/** 同步结果 */
|
|
14
|
+
export interface SyncResult {
|
|
15
|
+
total: number;
|
|
16
|
+
created: number;
|
|
17
|
+
updated: number;
|
|
18
|
+
skipped: number;
|
|
19
|
+
errors: Array<{
|
|
20
|
+
title: string;
|
|
21
|
+
error: string;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
/** 同步 markdown 文档到 YApi 项目 */
|
|
25
|
+
export declare function syncDocsToProject(api: YApiService, projectId: number, catId: number, filePath: string, merge?: 'skip' | 'update' | 'create'): Promise<SyncResult>;
|
|
26
|
+
/** 监听文件变化并同步 */
|
|
27
|
+
export declare function watchAndSync(api: YApiService, projectId: number, catId: number, filePath: string, onChange: (result: SyncResult) => void): Promise<() => void>;
|
|
28
|
+
/** 格式化同步结果 */
|
|
29
|
+
export declare function formatSyncResult(result: SyncResult): string;
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { readFileSync, watch } from 'node:fs';
|
|
2
|
+
import { basename } from 'node:path';
|
|
3
|
+
/** 解析 markdown 中的 API 接口定义 */
|
|
4
|
+
export function parseMarkdownApi(content) {
|
|
5
|
+
const lines = content.split('\n');
|
|
6
|
+
const interfaces = [];
|
|
7
|
+
let currentTitle = '';
|
|
8
|
+
let currentDescription = '';
|
|
9
|
+
let inCodeBlock = false;
|
|
10
|
+
let codeBlockLang = '';
|
|
11
|
+
let codeBlockLines = [];
|
|
12
|
+
let inDescription = false;
|
|
13
|
+
for (let i = 0; i < lines.length; i++) {
|
|
14
|
+
const line = lines[i];
|
|
15
|
+
// 检测标题
|
|
16
|
+
const headingMatch = line.match(/^#{2,4}\s+(.+)/);
|
|
17
|
+
if (headingMatch) {
|
|
18
|
+
// 如果之前有未处理的 code block,跳过
|
|
19
|
+
if (inCodeBlock) {
|
|
20
|
+
inCodeBlock = false;
|
|
21
|
+
codeBlockLines = [];
|
|
22
|
+
}
|
|
23
|
+
currentTitle = headingMatch[1].trim();
|
|
24
|
+
currentDescription = '';
|
|
25
|
+
inDescription = false;
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
// 检测代码块开始
|
|
29
|
+
if (line.startsWith('```')) {
|
|
30
|
+
if (inCodeBlock) {
|
|
31
|
+
// code block 结束,解析
|
|
32
|
+
if (codeBlockLines.length > 0) {
|
|
33
|
+
const parsed = parseCodeBlock(currentTitle, currentDescription, codeBlockLang, codeBlockLines);
|
|
34
|
+
if (parsed) {
|
|
35
|
+
interfaces.push(parsed);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
inCodeBlock = false;
|
|
39
|
+
codeBlockLines = [];
|
|
40
|
+
codeBlockLang = '';
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
inCodeBlock = true;
|
|
44
|
+
codeBlockLang = line.slice(3).trim().toLowerCase();
|
|
45
|
+
codeBlockLines = [];
|
|
46
|
+
}
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
// 在代码块内
|
|
50
|
+
if (inCodeBlock) {
|
|
51
|
+
codeBlockLines.push(line);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
// 非代码块的描述文本(在标题和代码块之间)
|
|
55
|
+
const trimmed = line.trim();
|
|
56
|
+
if (trimmed && !trimmed.startsWith('```') && !headingMatch) {
|
|
57
|
+
if (currentDescription) {
|
|
58
|
+
currentDescription += '\n' + trimmed;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
currentDescription = trimmed;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return interfaces;
|
|
66
|
+
}
|
|
67
|
+
/** 解析代码块内容为 API 接口 */
|
|
68
|
+
function parseCodeBlock(title, description, lang, lines) {
|
|
69
|
+
if (lines.length === 0)
|
|
70
|
+
return null;
|
|
71
|
+
const firstLine = lines[0].trim();
|
|
72
|
+
// 支持多种格式:
|
|
73
|
+
// GET /api/xxx
|
|
74
|
+
// POST /api/xxx
|
|
75
|
+
// ```json {method:"POST", path:"/api/xxx"}
|
|
76
|
+
const methodMatch = firstLine.match(/^(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)\s+(\/\S+)/i);
|
|
77
|
+
if (!methodMatch) {
|
|
78
|
+
// 尝试从语言标签中提取
|
|
79
|
+
if (lang && /^(http|curl|bash|shell)$/i.test(lang)) {
|
|
80
|
+
const httpLine = firstLine.match(/^(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)\s+(\/\S+)/i);
|
|
81
|
+
if (!httpLine)
|
|
82
|
+
return null;
|
|
83
|
+
return buildParsedInterface(title, description, httpLine[1].toUpperCase(), httpLine[2], lines.slice(1));
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const method = methodMatch[1].toUpperCase();
|
|
88
|
+
const path = methodMatch[2];
|
|
89
|
+
const remainingLines = lines.slice(1);
|
|
90
|
+
return buildParsedInterface(title, description, method, path, remainingLines);
|
|
91
|
+
}
|
|
92
|
+
function buildParsedInterface(title, description, method, path, remainingLines) {
|
|
93
|
+
const result = {
|
|
94
|
+
title: title || `${method} ${path}`,
|
|
95
|
+
path,
|
|
96
|
+
method,
|
|
97
|
+
description,
|
|
98
|
+
};
|
|
99
|
+
if (remainingLines.length > 0) {
|
|
100
|
+
const body = remainingLines.join('\n').trim();
|
|
101
|
+
if (body) {
|
|
102
|
+
// 如果有多段 body,第一段作为 req_body,最后一段作为 res_body
|
|
103
|
+
const parts = body.split(/\n```/);
|
|
104
|
+
if (parts.length >= 2) {
|
|
105
|
+
result.reqBody = parts[0].trim();
|
|
106
|
+
result.resBody = parts[parts.length - 1].trim();
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
result.reqBody = body;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
/** 同步 markdown 文档到 YApi 项目 */
|
|
116
|
+
export async function syncDocsToProject(api, projectId, catId, filePath, merge = 'create') {
|
|
117
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
118
|
+
const interfaces = parseMarkdownApi(content);
|
|
119
|
+
const result = {
|
|
120
|
+
total: interfaces.length,
|
|
121
|
+
created: 0,
|
|
122
|
+
updated: 0,
|
|
123
|
+
skipped: 0,
|
|
124
|
+
errors: [],
|
|
125
|
+
};
|
|
126
|
+
// 获取项目已有接口
|
|
127
|
+
let existingInterfaces = [];
|
|
128
|
+
try {
|
|
129
|
+
const existing = await api.listInterfaces({ project_id: projectId, limit: 500 });
|
|
130
|
+
existingInterfaces = existing.data.list.map((i) => ({
|
|
131
|
+
_id: i._id,
|
|
132
|
+
title: i.title,
|
|
133
|
+
path: i.path,
|
|
134
|
+
method: i.method,
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
// 忽略获取已有接口的错误
|
|
139
|
+
}
|
|
140
|
+
for (const iface of interfaces) {
|
|
141
|
+
try {
|
|
142
|
+
// 查找是否已存在(按 path + method 匹配)
|
|
143
|
+
const existing = existingInterfaces.find((e) => e.path === iface.path && e.method.toUpperCase() === iface.method);
|
|
144
|
+
if (existing) {
|
|
145
|
+
if (merge === 'skip') {
|
|
146
|
+
result.skipped++;
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
if (merge === 'update') {
|
|
150
|
+
await api.updateInterface({
|
|
151
|
+
id: existing._id,
|
|
152
|
+
title: iface.title,
|
|
153
|
+
path: iface.path,
|
|
154
|
+
method: iface.method,
|
|
155
|
+
catid: catId,
|
|
156
|
+
desc: iface.description,
|
|
157
|
+
req_body_other: iface.reqBody,
|
|
158
|
+
res_body: iface.resBody,
|
|
159
|
+
res_body_type: iface.resBody ? 'json' : undefined,
|
|
160
|
+
req_body_type: iface.reqBody ? 'json' : undefined,
|
|
161
|
+
});
|
|
162
|
+
result.updated++;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
result.skipped++;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
// 创建新接口
|
|
170
|
+
await api.createInterface({
|
|
171
|
+
project_id: projectId,
|
|
172
|
+
catid: catId,
|
|
173
|
+
title: iface.title,
|
|
174
|
+
path: iface.path,
|
|
175
|
+
method: iface.method,
|
|
176
|
+
desc: iface.description,
|
|
177
|
+
req_body_other: iface.reqBody,
|
|
178
|
+
res_body: iface.resBody,
|
|
179
|
+
res_body_type: iface.resBody ? 'json' : undefined,
|
|
180
|
+
req_body_type: iface.reqBody ? 'json' : undefined,
|
|
181
|
+
});
|
|
182
|
+
result.created++;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
result.errors.push({
|
|
187
|
+
title: iface.title,
|
|
188
|
+
error: error instanceof Error ? error.message : String(error),
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return result;
|
|
193
|
+
}
|
|
194
|
+
/** 监听文件变化并同步 */
|
|
195
|
+
export async function watchAndSync(api, projectId, catId, filePath, onChange) {
|
|
196
|
+
let timeout = null;
|
|
197
|
+
const doSync = async () => {
|
|
198
|
+
try {
|
|
199
|
+
const result = await syncDocsToProject(api, projectId, catId, filePath, 'update');
|
|
200
|
+
onChange(result);
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
onChange({
|
|
204
|
+
total: 0,
|
|
205
|
+
created: 0,
|
|
206
|
+
updated: 0,
|
|
207
|
+
skipped: 0,
|
|
208
|
+
errors: [{ title: basename(filePath), error: error instanceof Error ? error.message : String(error) }],
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
const watcher = watch(filePath, (eventType) => {
|
|
213
|
+
if (eventType === 'change') {
|
|
214
|
+
if (timeout)
|
|
215
|
+
clearTimeout(timeout);
|
|
216
|
+
timeout = setTimeout(doSync, 500);
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
return () => {
|
|
220
|
+
watcher.close();
|
|
221
|
+
if (timeout)
|
|
222
|
+
clearTimeout(timeout);
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/** 格式化同步结果 */
|
|
226
|
+
export function formatSyncResult(result) {
|
|
227
|
+
const parts = [];
|
|
228
|
+
parts.push(`总计: ${result.total} 个接口`);
|
|
229
|
+
if (result.created > 0)
|
|
230
|
+
parts.push(`✅ 创建: ${result.created}`);
|
|
231
|
+
if (result.updated > 0)
|
|
232
|
+
parts.push(`🔄 更新: ${result.updated}`);
|
|
233
|
+
if (result.skipped > 0)
|
|
234
|
+
parts.push(`⏭️ 跳过: ${result.skipped}`);
|
|
235
|
+
if (result.errors.length > 0) {
|
|
236
|
+
parts.push(`❌ 错误: ${result.errors.length}`);
|
|
237
|
+
for (const err of result.errors.slice(0, 5)) {
|
|
238
|
+
parts.push(` - ${err.title}: ${err.error}`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return parts.join('\n');
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=docs-sync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-sync.js","sourceRoot":"","sources":["../../../src/tools/yapi/docs-sync.ts"],"names":[],"mappings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AC;IAC/D,IAAI,MAAM,CAAC,OAAO,GAAG,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAChE,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAC5C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YAC5C,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { registerYApiCommands } from './register.js';
|
|
2
|
+
export { registerAuthCommands } from './register-auth.js';
|
|
3
|
+
export { registerGroupCommands } from './register-group.js';
|
|
4
|
+
export { registerProjectCommands } from './register-project.js';
|
|
5
|
+
export { registerInterfaceCommands } from './register-interface.js';
|
|
6
|
+
export { registerUtilCommands } from './register-util.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { registerYApiCommands } from './register.js';
|
|
2
|
+
export { registerAuthCommands } from './register-auth.js';
|
|
3
|
+
export { registerGroupCommands } from './register-group.js';
|
|
4
|
+
export { registerProjectCommands } from './register-project.js';
|
|
5
|
+
export { registerInterfaceCommands } from './register-interface.js';
|
|
6
|
+
export { registerUtilCommands } from './register-util.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/yapi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC"}
|