@yinuo-ngm/mcp-server 0.1.2 → 0.1.4
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 +191 -208
- package/lib/audit/audit-event.d.ts +14 -0
- package/lib/audit/audit-event.js +2 -0
- package/lib/audit/audit-log.service.d.ts +7 -0
- package/lib/audit/audit-log.service.js +187 -0
- package/lib/audit/redact.d.ts +3 -0
- package/lib/audit/redact.js +28 -0
- package/lib/catalog/capabilities/blocked-local-actions.d.ts +1 -0
- package/lib/catalog/capabilities/blocked-local-actions.js +18 -0
- package/lib/catalog/capabilities/frontend-standard.d.ts +2 -0
- package/lib/catalog/capabilities/frontend-standard.js +36 -0
- package/lib/catalog/capabilities/hub-v2.d.ts +2 -0
- package/lib/catalog/capabilities/hub-v2.js +34 -0
- package/lib/catalog/capabilities/nginx.d.ts +2 -0
- package/lib/catalog/capabilities/nginx.js +23 -0
- package/lib/catalog/capabilities/project.d.ts +2 -0
- package/lib/catalog/capabilities/project.js +23 -0
- package/lib/catalog/capabilities/router.d.ts +2 -0
- package/lib/catalog/capabilities/router.js +11 -0
- package/lib/catalog/capabilities/runtime.d.ts +2 -0
- package/lib/catalog/capabilities/runtime.js +17 -0
- package/lib/catalog/capabilities/workspace.d.ts +2 -0
- package/lib/catalog/capabilities/workspace.js +23 -0
- package/lib/catalog/helpers.d.ts +3 -0
- package/lib/catalog/helpers.js +42 -0
- package/lib/catalog/index.d.ts +4 -0
- package/lib/catalog/index.js +23 -0
- package/lib/catalog/tools/frontend-standard.d.ts +2 -0
- package/lib/catalog/tools/frontend-standard.js +166 -0
- package/lib/catalog/tools/hub-v2-api.d.ts +2 -0
- package/lib/catalog/tools/hub-v2-api.js +124 -0
- package/lib/catalog/tools/hub-v2-docs.d.ts +2 -0
- package/lib/catalog/tools/hub-v2-docs.js +40 -0
- package/lib/catalog/tools/nginx.d.ts +2 -0
- package/lib/catalog/tools/nginx.js +82 -0
- package/lib/catalog/tools/project.d.ts +2 -0
- package/lib/catalog/tools/project.js +124 -0
- package/lib/catalog/tools/router.d.ts +2 -0
- package/lib/catalog/tools/router.js +26 -0
- package/lib/catalog/tools/runtime.d.ts +2 -0
- package/lib/catalog/tools/runtime.js +40 -0
- package/lib/catalog/tools/workspace.d.ts +2 -0
- package/lib/catalog/tools/workspace.js +75 -0
- package/lib/catalog/types.d.ts +15 -0
- package/lib/catalog/types.js +2 -0
- package/lib/context/create-tool-context.js +11 -10
- package/lib/context/local-server-client.d.ts +2 -0
- package/lib/context/local-server-client.js +174 -0
- package/lib/context/tool-context.d.ts +36 -0
- package/lib/doctor.d.ts +8 -0
- package/lib/doctor.js +194 -0
- package/lib/errors/error-codes.d.ts +12 -0
- package/lib/errors/error-codes.js +14 -0
- package/lib/errors/mcp-tool-error.d.ts +8 -0
- package/lib/errors/mcp-tool-error.js +14 -0
- package/lib/filesystem/project-files.d.ts +18 -0
- package/lib/filesystem/project-files.js +112 -0
- package/lib/git/local-git-read-service.d.ts +2 -0
- package/lib/git/local-git-read-service.js +96 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -0
- package/lib/policy/assert-tool-policy.js +10 -1
- package/lib/register-tools.js +67 -10
- package/lib/registry/tool-names.d.ts +95 -0
- package/lib/registry/tool-names.js +97 -0
- package/lib/services/path-guard.service.d.ts +4 -0
- package/lib/services/path-guard.service.js +75 -0
- package/lib/services/permission.service.d.ts +5 -0
- package/lib/services/permission.service.js +38 -0
- package/lib/services/project-resolver.service.d.ts +32 -0
- package/lib/services/project-resolver.service.js +95 -0
- package/lib/standard/frontend-standard.default.d.ts +2 -0
- package/lib/standard/frontend-standard.default.js +51 -0
- package/lib/standard/frontend-standard.schema.d.ts +196 -0
- package/lib/standard/frontend-standard.schema.js +61 -0
- package/lib/standard/frontend-standard.service.d.ts +79 -0
- package/lib/standard/frontend-standard.service.js +115 -0
- package/lib/standard/project-scan.d.ts +9 -0
- package/lib/standard/project-scan.js +91 -0
- package/lib/standard/validators/angular-structure.validator.d.ts +4 -0
- package/lib/standard/validators/angular-structure.validator.js +75 -0
- package/lib/standard/validators/component.validator.d.ts +4 -0
- package/lib/standard/validators/component.validator.js +94 -0
- package/lib/standard/validators/git.validator.d.ts +8 -0
- package/lib/standard/validators/git.validator.js +32 -0
- package/lib/standard/validators/review.validator.d.ts +15 -0
- package/lib/standard/validators/review.validator.js +67 -0
- package/lib/standard/validators/test.validator.d.ts +19 -0
- package/lib/standard/validators/test.validator.js +89 -0
- package/lib/tool-catalog.d.ts +2 -0
- package/lib/tool-catalog.js +6 -0
- package/lib/tools/angular/angular-standard.tools.d.ts +2 -0
- package/lib/tools/angular/angular-standard.tools.js +53 -0
- package/lib/tools/angular/index.d.ts +1 -0
- package/lib/tools/angular/index.js +5 -0
- package/lib/tools/capability.tools.d.ts +2 -0
- package/lib/tools/capability.tools.js +205 -0
- package/lib/tools/controlled/index.d.ts +2 -0
- package/lib/tools/controlled/index.js +13 -0
- package/lib/tools/controlled/local-server.d.ts +6 -0
- package/lib/tools/controlled/local-server.js +17 -0
- package/lib/tools/controlled/operation-policy.d.ts +22 -0
- package/lib/tools/controlled/operation-policy.js +50 -0
- package/lib/tools/controlled/operation-result.d.ts +30 -0
- package/lib/tools/controlled/operation-result.js +33 -0
- package/lib/tools/controlled/schemas.d.ts +159 -0
- package/lib/tools/controlled/schemas.js +49 -0
- package/lib/tools/controlled.tools.d.ts +1 -0
- package/lib/tools/controlled.tools.js +5 -0
- package/lib/tools/file-write.tools.d.ts +2 -0
- package/lib/tools/file-write.tools.js +70 -0
- package/lib/tools/git.tools.js +109 -8
- package/lib/tools/hub-v2/client.d.ts +6 -1
- package/lib/tools/hub-v2/client.js +15 -0
- package/lib/tools/hub-v2/config/config-paths.d.ts +2 -0
- package/lib/tools/hub-v2/config/config-paths.js +17 -0
- package/lib/tools/hub-v2/config/env.d.ts +1 -0
- package/lib/tools/hub-v2/config/env.js +12 -0
- package/lib/tools/hub-v2/config/index.d.ts +8 -0
- package/lib/tools/hub-v2/config/index.js +18 -0
- package/lib/tools/hub-v2/config/jsonc.d.ts +5 -0
- package/lib/tools/hub-v2/config/jsonc.js +86 -0
- package/lib/tools/hub-v2/config/load-config.d.ts +18 -0
- package/lib/tools/hub-v2/config/load-config.js +93 -0
- package/lib/tools/hub-v2/config/project-selector.d.ts +5 -0
- package/lib/tools/hub-v2/config/project-selector.js +92 -0
- package/lib/tools/hub-v2/config/resolve-context.d.ts +13 -0
- package/lib/tools/hub-v2/config/resolve-context.js +33 -0
- package/lib/tools/hub-v2/docs.tools.js +138 -4
- package/lib/tools/hub-v2/index.js +2 -0
- package/lib/tools/hub-v2/issues-workflow.tools.d.ts +2 -0
- package/lib/tools/hub-v2/issues-workflow.tools.js +199 -0
- package/lib/tools/hub-v2/issues.tools.js +96 -6
- package/lib/tools/hub-v2/projects.tools.js +16 -3
- package/lib/tools/hub-v2/raw.d.ts +8 -0
- package/lib/tools/hub-v2/raw.js +33 -0
- package/lib/tools/hub-v2/rd.tools.js +167 -8
- package/lib/tools/hub-v2/schemas.d.ts +668 -71
- package/lib/tools/hub-v2/schemas.js +152 -1
- package/lib/tools/hub-v2/upload.tools.js +53 -5
- package/lib/tools/index.d.ts +1 -0
- package/lib/tools/index.js +22 -0
- package/lib/tools/log.tools.js +33 -6
- package/lib/tools/nginx/index.d.ts +1 -0
- package/lib/tools/nginx/index.js +5 -0
- package/lib/tools/nginx/nginx-control.tools.d.ts +2 -0
- package/lib/tools/nginx/nginx-control.tools.js +133 -0
- package/lib/tools/nginx/nginx-proxy.d.ts +24 -0
- package/lib/tools/nginx/nginx-proxy.js +154 -0
- package/lib/tools/nginx.tools.d.ts +2 -0
- package/lib/tools/nginx.tools.js +111 -0
- package/lib/tools/project/index.d.ts +2 -0
- package/lib/tools/project/index.js +7 -0
- package/lib/tools/project/launch-status.d.ts +10 -0
- package/lib/tools/project/launch-status.js +78 -0
- package/lib/tools/project/local-diagnostics.d.ts +19 -0
- package/lib/tools/project/local-diagnostics.js +97 -0
- package/lib/tools/project/observe-redaction.d.ts +3 -0
- package/lib/tools/project/observe-redaction.js +25 -0
- package/lib/tools/project/observe-runtime.d.ts +72 -0
- package/lib/tools/project/observe-runtime.js +147 -0
- package/lib/tools/project/project-control.tools.d.ts +2 -0
- package/lib/tools/project/project-control.tools.js +216 -0
- package/lib/tools/project/project-observe.tools.d.ts +2 -0
- package/lib/tools/project/project-observe.tools.js +191 -0
- package/lib/tools/project/runtime-config.d.ts +7 -0
- package/lib/tools/project/runtime-config.js +50 -0
- package/lib/tools/project-observe.tools.d.ts +1 -0
- package/lib/tools/project-observe.tools.js +5 -0
- package/lib/tools/project.tools.d.ts +8 -0
- package/lib/tools/project.tools.js +97 -6
- package/lib/tools/proxy.tools.js +4 -4
- package/lib/tools/review/index.d.ts +1 -0
- package/lib/tools/review/index.js +5 -0
- package/lib/tools/review/review.tools.d.ts +2 -0
- package/lib/tools/review/review.tools.js +152 -0
- package/lib/tools/runtime/index.d.ts +1 -0
- package/lib/tools/runtime/index.js +5 -0
- package/lib/tools/runtime/runtime-control.tools.d.ts +2 -0
- package/lib/tools/runtime/runtime-control.tools.js +89 -0
- package/lib/tools/runtime.tools.js +41 -4
- package/lib/tools/standard/index.d.ts +1 -0
- package/lib/tools/standard/index.js +5 -0
- package/lib/tools/standard/standard.tools.d.ts +2 -0
- package/lib/tools/standard/standard.tools.js +91 -0
- package/lib/tools/task.tools.js +44 -9
- package/lib/tools/test/index.d.ts +1 -0
- package/lib/tools/test/index.js +5 -0
- package/lib/tools/test/test-standard.tools.d.ts +2 -0
- package/lib/tools/test/test-standard.tools.js +51 -0
- package/lib/tools/tool-catalog.d.ts +2 -0
- package/lib/tools/tool-catalog.js +7 -0
- package/lib/tools/workflow/frontend-workflow.tools.d.ts +2 -0
- package/lib/tools/workflow/frontend-workflow.tools.js +364 -0
- package/lib/tools/workflow/index.d.ts +1 -0
- package/lib/tools/workflow/index.js +5 -0
- package/lib/tools/workspace-package.d.ts +22 -0
- package/lib/tools/workspace-package.js +130 -0
- package/lib/tools/workspace.tools.d.ts +7 -0
- package/lib/tools/workspace.tools.js +336 -0
- package/lib/utils/errors.js +6 -1
- package/lib/utils/result.d.ts +9 -0
- package/lib/utils/result.js +9 -0
- package/lib/workflow/frontend-task.schema.d.ts +83 -0
- package/lib/workflow/frontend-task.schema.js +25 -0
- package/lib/workflow/frontend-task.service.d.ts +57 -0
- package/lib/workflow/frontend-task.service.js +195 -0
- package/lib/workflow/workflow-status.d.ts +2 -0
- package/lib/workflow/workflow-status.js +14 -0
- package/lib/workflow/workflow-transition.d.ts +9 -0
- package/lib/workflow/workflow-transition.js +38 -0
- package/package.json +5 -3
- package/lib/tools/hub-v2/config.d.ts +0 -34
- package/lib/tools/hub-v2/config.js +0 -297
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hubV2RdTools = hubV2RdTools;
|
|
4
4
|
const client_1 = require("./client");
|
|
5
|
-
const
|
|
5
|
+
const index_1 = require("./config/index");
|
|
6
6
|
const schemas_1 = require("./schemas");
|
|
7
7
|
const result_1 = require("../../utils/result");
|
|
8
|
+
const raw_1 = require("./raw");
|
|
8
9
|
function hubV2RdTools() {
|
|
9
10
|
return [
|
|
10
11
|
{
|
|
@@ -13,7 +14,7 @@ function hubV2RdTools() {
|
|
|
13
14
|
riskLevel: "read",
|
|
14
15
|
inputSchema: schemas_1.rdListSchema,
|
|
15
16
|
async handler(args) {
|
|
16
|
-
const ctx = (0,
|
|
17
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "project");
|
|
17
18
|
const client = new client_1.HubV2Client(ctx);
|
|
18
19
|
const data = await client.request("GET", client.tokenUrl("/rd-items", {
|
|
19
20
|
page: args.page ?? 1,
|
|
@@ -34,24 +35,52 @@ function hubV2RdTools() {
|
|
|
34
35
|
riskLevel: "read",
|
|
35
36
|
inputSchema: schemas_1.rdGetSchema,
|
|
36
37
|
async handler(args) {
|
|
37
|
-
const ctx = (0,
|
|
38
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "project");
|
|
38
39
|
const client = new client_1.HubV2Client(ctx);
|
|
39
40
|
const data = await client.request("GET", client.tokenUrl(`/rd-items/${encodeURIComponent(args.itemId)}`));
|
|
40
41
|
return (0, result_1.ok)("hub_v2_rd_get", data);
|
|
41
42
|
},
|
|
42
43
|
},
|
|
44
|
+
{
|
|
45
|
+
name: "hub_v2_rd_stages_list",
|
|
46
|
+
description: "List Hub V2 RD stage dictionary with Project Token.",
|
|
47
|
+
riskLevel: "read",
|
|
48
|
+
inputSchema: schemas_1.projectSelectorSchema,
|
|
49
|
+
async handler(args) {
|
|
50
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "project");
|
|
51
|
+
const client = new client_1.HubV2Client(ctx);
|
|
52
|
+
const data = await client.request("GET", client.tokenUrl("/rd-stages"));
|
|
53
|
+
return (0, result_1.ok)("hub_v2_rd_stages_list", data);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
rdReadTool("hub_v2_rd_logs_list", "List Hub V2 RD item logs with Project Token.", "logs"),
|
|
57
|
+
rdReadTool("hub_v2_rd_stage_history_list", "List Hub V2 RD item stage history with Project Token.", "stage-history"),
|
|
43
58
|
{
|
|
44
59
|
name: "hub_v2_rd_stage_tasks_list",
|
|
45
60
|
description: "List Hub V2 RD current stage tasks with Project Token.",
|
|
46
61
|
riskLevel: "read",
|
|
47
62
|
inputSchema: schemas_1.rdStageTasksListSchema,
|
|
48
63
|
async handler(args) {
|
|
49
|
-
const ctx = (0,
|
|
64
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "project");
|
|
50
65
|
const client = new client_1.HubV2Client(ctx);
|
|
51
66
|
const data = await client.request("GET", client.tokenUrl(`/rd-items/${encodeURIComponent(args.itemId)}/stage-tasks`));
|
|
52
67
|
return (0, result_1.ok)("hub_v2_rd_stage_tasks_list", data);
|
|
53
68
|
},
|
|
54
69
|
},
|
|
70
|
+
rdReadTool("hub_v2_rd_progress_list", "List Hub V2 RD item member progress with Project Token.", "progress"),
|
|
71
|
+
rdReadTool("hub_v2_rd_progress_history_list", "List Hub V2 RD item progress history with Project Token.", "progress/history"),
|
|
72
|
+
{
|
|
73
|
+
name: "hub_v2_rd_upload_raw_get",
|
|
74
|
+
description: "Read one Hub V2 RD Markdown upload raw file as base64 with Project Token.",
|
|
75
|
+
riskLevel: "read",
|
|
76
|
+
inputSchema: schemas_1.rdUploadRawSchema,
|
|
77
|
+
async handler(args) {
|
|
78
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "project");
|
|
79
|
+
const client = new client_1.HubV2Client(ctx);
|
|
80
|
+
const data = await (0, raw_1.readRawAsBase64)(client, client.tokenUrl(`/rd-items/${encodeURIComponent(args.itemId)}/uploads/${encodeURIComponent(args.uploadId)}/raw`), args.maxBytes);
|
|
81
|
+
return (0, result_1.ok)("hub_v2_rd_upload_raw_get", data);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
55
84
|
{
|
|
56
85
|
name: "hub_v2_rd_create",
|
|
57
86
|
description: "Preview or create a Hub V2 RD item with Personal Token.",
|
|
@@ -86,7 +115,7 @@ function hubV2RdTools() {
|
|
|
86
115
|
},
|
|
87
116
|
});
|
|
88
117
|
}
|
|
89
|
-
const ctx = (0,
|
|
118
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "personal");
|
|
90
119
|
const client = new client_1.HubV2Client(ctx);
|
|
91
120
|
const data = await client.request("POST", client.personalUrl(path), body);
|
|
92
121
|
return (0, result_1.ok)("hub_v2_rd_create", data);
|
|
@@ -122,12 +151,55 @@ function hubV2RdTools() {
|
|
|
122
151
|
},
|
|
123
152
|
});
|
|
124
153
|
}
|
|
125
|
-
const ctx = (0,
|
|
154
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "personal");
|
|
126
155
|
const client = new client_1.HubV2Client(ctx);
|
|
127
156
|
const data = await client.request("POST", client.personalUrl(path), body);
|
|
128
157
|
return (0, result_1.ok)("hub_v2_rd_advance_stage", data);
|
|
129
158
|
},
|
|
130
159
|
},
|
|
160
|
+
rdSimpleWriteTool("hub_v2_rd_start", "Preview or start a Hub V2 RD item with Personal Token.", "start"),
|
|
161
|
+
{
|
|
162
|
+
name: "hub_v2_rd_block",
|
|
163
|
+
description: "Preview or block a Hub V2 RD item with Personal Token.",
|
|
164
|
+
riskLevel: "write",
|
|
165
|
+
inputSchema: schemas_1.rdBlockSchema,
|
|
166
|
+
allowPreviewWhenBlocked: true,
|
|
167
|
+
isConfirmed: (args) => args.confirm === true,
|
|
168
|
+
async handler(args) {
|
|
169
|
+
return rdBodyWrite("hub_v2_rd_block", args, "block", {
|
|
170
|
+
blockerReason: args.blockerReason,
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
rdSimpleWriteTool("hub_v2_rd_resume", "Preview or resume a Hub V2 RD item with Personal Token.", "resume"),
|
|
175
|
+
{
|
|
176
|
+
name: "hub_v2_rd_complete",
|
|
177
|
+
description: "Preview or complete a Hub V2 RD item with Personal Token.",
|
|
178
|
+
riskLevel: "write",
|
|
179
|
+
inputSchema: schemas_1.rdCompleteSchema,
|
|
180
|
+
allowPreviewWhenBlocked: true,
|
|
181
|
+
isConfirmed: (args) => args.confirm === true,
|
|
182
|
+
async handler(args) {
|
|
183
|
+
return rdBodyWrite("hub_v2_rd_complete", args, "complete", {
|
|
184
|
+
reason: args.reason,
|
|
185
|
+
});
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
rdSimpleWriteTool("hub_v2_rd_accept", "Preview or accept a Hub V2 RD item with Personal Token.", "accept"),
|
|
189
|
+
rdSimpleWriteTool("hub_v2_rd_reopen", "Preview or reopen a Hub V2 RD item with Personal Token.", "reopen"),
|
|
190
|
+
{
|
|
191
|
+
name: "hub_v2_rd_close",
|
|
192
|
+
description: "Preview or close a Hub V2 RD item with Personal Token.",
|
|
193
|
+
riskLevel: "write",
|
|
194
|
+
inputSchema: schemas_1.rdCloseSchema,
|
|
195
|
+
allowPreviewWhenBlocked: true,
|
|
196
|
+
isConfirmed: (args) => args.confirm === true,
|
|
197
|
+
async handler(args) {
|
|
198
|
+
return rdBodyWrite("hub_v2_rd_close", args, "close", {
|
|
199
|
+
reason: args.reason,
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
},
|
|
131
203
|
{
|
|
132
204
|
name: "hub_v2_rd_stage_tasks_create",
|
|
133
205
|
description: "Preview or create a Hub V2 RD stage task on the current stage with Personal Token.",
|
|
@@ -158,7 +230,7 @@ function hubV2RdTools() {
|
|
|
158
230
|
},
|
|
159
231
|
});
|
|
160
232
|
}
|
|
161
|
-
const ctx = (0,
|
|
233
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "personal");
|
|
162
234
|
const client = new client_1.HubV2Client(ctx);
|
|
163
235
|
const data = await client.request("POST", client.personalUrl(path), body);
|
|
164
236
|
return (0, result_1.ok)("hub_v2_rd_stage_tasks_create", data);
|
|
@@ -192,11 +264,98 @@ function hubV2RdTools() {
|
|
|
192
264
|
},
|
|
193
265
|
});
|
|
194
266
|
}
|
|
195
|
-
const ctx = (0,
|
|
267
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "personal");
|
|
196
268
|
const client = new client_1.HubV2Client(ctx);
|
|
197
269
|
const data = await client.request("POST", client.personalUrl(path), body);
|
|
198
270
|
return (0, result_1.ok)("hub_v2_rd_update_progress", data);
|
|
199
271
|
},
|
|
200
272
|
},
|
|
273
|
+
{
|
|
274
|
+
name: "hub_v2_rd_update",
|
|
275
|
+
description: "Preview or update Hub V2 RD item basic fields with Personal Token.",
|
|
276
|
+
riskLevel: "write",
|
|
277
|
+
inputSchema: schemas_1.rdUpdateSchema,
|
|
278
|
+
allowPreviewWhenBlocked: true,
|
|
279
|
+
isConfirmed: (args) => args.confirm === true,
|
|
280
|
+
async handler(args) {
|
|
281
|
+
const path = `/rd-items/${encodeURIComponent(args.itemId)}`;
|
|
282
|
+
const body = (0, client_1.compactUndefined)({
|
|
283
|
+
version: args.version,
|
|
284
|
+
title: args.title,
|
|
285
|
+
description: args.description,
|
|
286
|
+
stageId: args.stageId,
|
|
287
|
+
type: args.type,
|
|
288
|
+
priority: args.priority,
|
|
289
|
+
memberIds: args.memberIds,
|
|
290
|
+
verifierId: args.verifierId,
|
|
291
|
+
planStartAt: args.planStartAt,
|
|
292
|
+
planEndAt: args.planEndAt,
|
|
293
|
+
stageDescription: args.stageDescription,
|
|
294
|
+
});
|
|
295
|
+
if (!args.confirm) {
|
|
296
|
+
return (0, result_1.ok)("hub_v2_rd_update", {
|
|
297
|
+
code: "PREVIEW",
|
|
298
|
+
message: "set confirm=true to execute this write operation",
|
|
299
|
+
data: {
|
|
300
|
+
method: "PATCH",
|
|
301
|
+
path,
|
|
302
|
+
requiredScope: "rd:edit:write",
|
|
303
|
+
body,
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "personal");
|
|
308
|
+
const client = new client_1.HubV2Client(ctx);
|
|
309
|
+
const data = await client.request("PATCH", client.personalUrl(path), body, { preserveNull: true });
|
|
310
|
+
return (0, result_1.ok)("hub_v2_rd_update", data);
|
|
311
|
+
},
|
|
312
|
+
},
|
|
201
313
|
];
|
|
202
314
|
}
|
|
315
|
+
function rdReadTool(name, description, suffix) {
|
|
316
|
+
return {
|
|
317
|
+
name,
|
|
318
|
+
description,
|
|
319
|
+
riskLevel: "read",
|
|
320
|
+
inputSchema: schemas_1.rdReadDetailSchema,
|
|
321
|
+
async handler(args) {
|
|
322
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "project");
|
|
323
|
+
const client = new client_1.HubV2Client(ctx);
|
|
324
|
+
const data = await client.request("GET", client.tokenUrl(`/rd-items/${encodeURIComponent(args.itemId)}/${suffix}`));
|
|
325
|
+
return (0, result_1.ok)(name, data);
|
|
326
|
+
},
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
function rdSimpleWriteTool(name, description, suffix) {
|
|
330
|
+
return {
|
|
331
|
+
name,
|
|
332
|
+
description,
|
|
333
|
+
riskLevel: "write",
|
|
334
|
+
inputSchema: schemas_1.rdSimpleWriteSchema,
|
|
335
|
+
allowPreviewWhenBlocked: true,
|
|
336
|
+
isConfirmed: (args) => args.confirm === true,
|
|
337
|
+
async handler(args) {
|
|
338
|
+
return rdBodyWrite(name, args, suffix);
|
|
339
|
+
},
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
async function rdBodyWrite(name, args, suffix, body = {}) {
|
|
343
|
+
const path = `/rd-items/${encodeURIComponent(args.itemId)}/${suffix}`;
|
|
344
|
+
const compactBody = (0, client_1.compact)(body);
|
|
345
|
+
if (!args.confirm) {
|
|
346
|
+
return (0, result_1.ok)(name, {
|
|
347
|
+
code: "PREVIEW",
|
|
348
|
+
message: "set confirm=true to execute this write operation",
|
|
349
|
+
data: {
|
|
350
|
+
method: "POST",
|
|
351
|
+
path,
|
|
352
|
+
requiredScope: "rd:transition:write",
|
|
353
|
+
...(Object.keys(compactBody).length > 0 ? { body: compactBody } : {}),
|
|
354
|
+
},
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "personal");
|
|
358
|
+
const client = new client_1.HubV2Client(ctx);
|
|
359
|
+
const data = await client.request("POST", client.personalUrl(path), compactBody);
|
|
360
|
+
return (0, result_1.ok)(name, data);
|
|
361
|
+
}
|