@yinuo-ngm/mcp-server 0.1.1 → 0.1.3
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 +225 -188
- 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 +96 -0
- package/lib/catalog/tools/project.d.ts +2 -0
- package/lib/catalog/tools/project.js +138 -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 +47 -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 +221 -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 +70 -9
- 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 +20 -0
- package/lib/tools/hub-v2/client.js +112 -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.d.ts +2 -0
- package/lib/tools/hub-v2/docs.tools.js +215 -0
- package/lib/tools/hub-v2/errors.d.ts +8 -0
- package/lib/tools/hub-v2/errors.js +27 -0
- package/lib/tools/hub-v2/index.d.ts +2 -0
- package/lib/tools/hub-v2/index.js +19 -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.d.ts +2 -0
- package/lib/tools/hub-v2/issues.tools.js +244 -0
- package/lib/tools/hub-v2/projects.tools.d.ts +2 -0
- package/lib/tools/hub-v2/projects.tools.js +41 -0
- 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.d.ts +2 -0
- package/lib/tools/hub-v2/rd.tools.js +361 -0
- package/lib/tools/hub-v2/schemas.d.ts +1182 -0
- package/lib/tools/hub-v2/schemas.js +318 -0
- package/lib/tools/hub-v2/upload.tools.d.ts +2 -0
- package/lib/tools/hub-v2/upload.tools.js +198 -0
- package/lib/tools/index.d.ts +3 -0
- package/lib/tools/index.js +24 -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.d.ts +5 -0
- package/lib/utils/errors.js +17 -0
- package/lib/utils/result.d.ts +20 -2
- package/lib/utils/result.js +108 -3
- 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 +10 -4
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hubV2IssuesTools = hubV2IssuesTools;
|
|
4
|
+
const client_1 = require("./client");
|
|
5
|
+
const index_1 = require("./config/index");
|
|
6
|
+
const schemas_1 = require("./schemas");
|
|
7
|
+
const result_1 = require("../../utils/result");
|
|
8
|
+
function hubV2IssuesTools() {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
name: "hub_v2_issues_list",
|
|
12
|
+
description: "List Hub V2 issues with Project Token.",
|
|
13
|
+
riskLevel: "read",
|
|
14
|
+
inputSchema: schemas_1.issuesListSchema,
|
|
15
|
+
async handler(args) {
|
|
16
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "project");
|
|
17
|
+
const client = new client_1.HubV2Client(ctx);
|
|
18
|
+
const data = await client.request("GET", client.tokenUrl("/issues", {
|
|
19
|
+
page: args.page ?? 1,
|
|
20
|
+
pageSize: args.pageSize ?? 20,
|
|
21
|
+
keyword: args.keyword,
|
|
22
|
+
status: args.status,
|
|
23
|
+
priority: args.priority,
|
|
24
|
+
assigneeId: args.assigneeId,
|
|
25
|
+
verifierId: args.verifierId,
|
|
26
|
+
rdItemId: args.rdItemId,
|
|
27
|
+
}));
|
|
28
|
+
return (0, result_1.ok)("hub_v2_issues_list", data);
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: "hub_v2_issues_get",
|
|
33
|
+
description: "Read one Hub V2 issue by id with Project Token.",
|
|
34
|
+
riskLevel: "read",
|
|
35
|
+
inputSchema: schemas_1.issueGetSchema,
|
|
36
|
+
async handler(args) {
|
|
37
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "project");
|
|
38
|
+
const client = new client_1.HubV2Client(ctx);
|
|
39
|
+
const data = await client.request("GET", client.tokenUrl(`/issues/${encodeURIComponent(args.issueId)}`));
|
|
40
|
+
return (0, result_1.ok)("hub_v2_issues_get", data);
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "hub_v2_issues_create",
|
|
45
|
+
description: "Preview or create a Hub V2 issue with Personal Token.",
|
|
46
|
+
riskLevel: "write",
|
|
47
|
+
inputSchema: schemas_1.issueCreateSchema,
|
|
48
|
+
allowPreviewWhenBlocked: true,
|
|
49
|
+
isConfirmed: (args) => args.confirm === true,
|
|
50
|
+
async handler(args) {
|
|
51
|
+
const path = "/issues";
|
|
52
|
+
const body = (0, client_1.compact)({
|
|
53
|
+
title: args.title,
|
|
54
|
+
description: args.description,
|
|
55
|
+
type: args.type,
|
|
56
|
+
priority: args.priority,
|
|
57
|
+
assigneeId: args.assigneeId,
|
|
58
|
+
verifierId: args.verifierId,
|
|
59
|
+
rdItemId: args.rdItemId,
|
|
60
|
+
moduleCode: args.moduleCode,
|
|
61
|
+
versionCode: args.versionCode,
|
|
62
|
+
environmentCode: args.environmentCode,
|
|
63
|
+
});
|
|
64
|
+
if (!args.confirm) {
|
|
65
|
+
return (0, result_1.ok)("hub_v2_issues_create", {
|
|
66
|
+
code: "PREVIEW",
|
|
67
|
+
message: "set confirm=true to execute this write operation",
|
|
68
|
+
data: {
|
|
69
|
+
method: "POST",
|
|
70
|
+
path,
|
|
71
|
+
requiredScope: "issue:create:write",
|
|
72
|
+
body,
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "personal");
|
|
77
|
+
const client = new client_1.HubV2Client(ctx);
|
|
78
|
+
const data = await client.request("POST", client.personalUrl(path), body);
|
|
79
|
+
return (0, result_1.ok)("hub_v2_issues_create", data);
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "hub_v2_issues_comment",
|
|
84
|
+
description: "Preview or add a Hub V2 issue comment with Personal Token.",
|
|
85
|
+
riskLevel: "write",
|
|
86
|
+
inputSchema: schemas_1.issueCommentSchema,
|
|
87
|
+
allowPreviewWhenBlocked: true,
|
|
88
|
+
isConfirmed: (args) => args.confirm === true,
|
|
89
|
+
async handler(args) {
|
|
90
|
+
const path = `/issues/${encodeURIComponent(args.issueId)}/comments`;
|
|
91
|
+
const body = (0, client_1.compact)({
|
|
92
|
+
content: args.content,
|
|
93
|
+
mentions: args.mentions,
|
|
94
|
+
});
|
|
95
|
+
if (!args.confirm) {
|
|
96
|
+
return (0, result_1.ok)("hub_v2_issues_comment", {
|
|
97
|
+
code: "PREVIEW",
|
|
98
|
+
message: "set confirm=true to execute this write operation",
|
|
99
|
+
data: {
|
|
100
|
+
method: "POST",
|
|
101
|
+
path,
|
|
102
|
+
requiredScope: "issue:comment:write",
|
|
103
|
+
body,
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "personal");
|
|
108
|
+
const client = new client_1.HubV2Client(ctx);
|
|
109
|
+
const data = await client.request("POST", client.personalUrl(path), body);
|
|
110
|
+
return (0, result_1.ok)("hub_v2_issues_comment", data);
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "hub_v2_issues_assign",
|
|
115
|
+
description: "Preview or assign a Hub V2 issue assignee with Personal Token.",
|
|
116
|
+
riskLevel: "write",
|
|
117
|
+
inputSchema: schemas_1.issueAssignSchema,
|
|
118
|
+
allowPreviewWhenBlocked: true,
|
|
119
|
+
isConfirmed: (args) => args.confirm === true,
|
|
120
|
+
async handler(args) {
|
|
121
|
+
const path = `/issues/${encodeURIComponent(args.issueId)}/assign`;
|
|
122
|
+
const body = { assigneeId: args.assigneeId };
|
|
123
|
+
if (!args.confirm) {
|
|
124
|
+
return (0, result_1.ok)("hub_v2_issues_assign", {
|
|
125
|
+
code: "PREVIEW",
|
|
126
|
+
message: "set confirm=true to execute this write operation",
|
|
127
|
+
data: {
|
|
128
|
+
method: "POST",
|
|
129
|
+
path,
|
|
130
|
+
requiredScope: "issue:assign:write",
|
|
131
|
+
body,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "personal");
|
|
136
|
+
const client = new client_1.HubV2Client(ctx);
|
|
137
|
+
const data = await client.request("POST", client.personalUrl(path), body);
|
|
138
|
+
return (0, result_1.ok)("hub_v2_issues_assign", data);
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "hub_v2_issues_participant_add",
|
|
143
|
+
description: "Preview or add a Hub V2 issue collaborator, optionally creating a collaborator task branch.",
|
|
144
|
+
riskLevel: "write",
|
|
145
|
+
inputSchema: schemas_1.issueParticipantAddSchema,
|
|
146
|
+
allowPreviewWhenBlocked: true,
|
|
147
|
+
isConfirmed: (args) => args.confirm === true,
|
|
148
|
+
async handler(args) {
|
|
149
|
+
const path = `/issues/${encodeURIComponent(args.issueId)}/participants`;
|
|
150
|
+
const body = (0, client_1.compact)({
|
|
151
|
+
userId: args.userId,
|
|
152
|
+
taskTitle: args.taskTitle,
|
|
153
|
+
});
|
|
154
|
+
if (!args.confirm) {
|
|
155
|
+
return (0, result_1.ok)("hub_v2_issues_participant_add", {
|
|
156
|
+
code: "PREVIEW",
|
|
157
|
+
message: "set confirm=true to execute this write operation",
|
|
158
|
+
data: {
|
|
159
|
+
method: "POST",
|
|
160
|
+
path,
|
|
161
|
+
requiredScope: "issue:participant:write",
|
|
162
|
+
body,
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "personal");
|
|
167
|
+
const client = new client_1.HubV2Client(ctx);
|
|
168
|
+
const data = await client.request("POST", client.personalUrl(path), body);
|
|
169
|
+
return (0, result_1.ok)("hub_v2_issues_participant_add", data);
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: "hub_v2_issues_branch_create",
|
|
174
|
+
description: "Preview or create a Hub V2 issue collaboration branch for an existing collaborator.",
|
|
175
|
+
riskLevel: "write",
|
|
176
|
+
inputSchema: schemas_1.issueBranchCreateSchema,
|
|
177
|
+
allowPreviewWhenBlocked: true,
|
|
178
|
+
isConfirmed: (args) => args.confirm === true,
|
|
179
|
+
async handler(args) {
|
|
180
|
+
const path = `/issues/${encodeURIComponent(args.issueId)}/branches`;
|
|
181
|
+
const body = {
|
|
182
|
+
ownerUserId: args.ownerUserId,
|
|
183
|
+
title: args.title,
|
|
184
|
+
};
|
|
185
|
+
if (!args.confirm) {
|
|
186
|
+
return (0, result_1.ok)("hub_v2_issues_branch_create", {
|
|
187
|
+
code: "PREVIEW",
|
|
188
|
+
message: "set confirm=true to execute this write operation",
|
|
189
|
+
data: {
|
|
190
|
+
method: "POST",
|
|
191
|
+
path,
|
|
192
|
+
requiredScope: "issue:branch:write",
|
|
193
|
+
body,
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "personal");
|
|
198
|
+
const client = new client_1.HubV2Client(ctx);
|
|
199
|
+
const data = await client.request("POST", client.personalUrl(path), body);
|
|
200
|
+
return (0, result_1.ok)("hub_v2_issues_branch_create", data);
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: "hub_v2_issues_update",
|
|
205
|
+
description: "Preview or update Hub V2 issue basic fields with Personal Token.",
|
|
206
|
+
riskLevel: "write",
|
|
207
|
+
inputSchema: schemas_1.issueUpdateSchema,
|
|
208
|
+
allowPreviewWhenBlocked: true,
|
|
209
|
+
isConfirmed: (args) => args.confirm === true,
|
|
210
|
+
async handler(args) {
|
|
211
|
+
const path = `/issues/${encodeURIComponent(args.issueId)}`;
|
|
212
|
+
const body = (0, client_1.compactUndefined)({
|
|
213
|
+
title: args.title,
|
|
214
|
+
description: args.description,
|
|
215
|
+
type: args.type,
|
|
216
|
+
priority: args.priority,
|
|
217
|
+
rdItemId: args.rdItemId,
|
|
218
|
+
moduleCode: args.moduleCode,
|
|
219
|
+
versionCode: args.versionCode,
|
|
220
|
+
environmentCode: args.environmentCode,
|
|
221
|
+
});
|
|
222
|
+
if (Object.keys(body).length === 0) {
|
|
223
|
+
return (0, result_1.fail)("hub_v2_issues_update", "at least one issue field is required");
|
|
224
|
+
}
|
|
225
|
+
if (!args.confirm) {
|
|
226
|
+
return (0, result_1.ok)("hub_v2_issues_update", {
|
|
227
|
+
code: "PREVIEW",
|
|
228
|
+
message: "set confirm=true to execute this write operation",
|
|
229
|
+
data: {
|
|
230
|
+
method: "PATCH",
|
|
231
|
+
path,
|
|
232
|
+
requiredScope: "issue:update:write",
|
|
233
|
+
body,
|
|
234
|
+
},
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "personal");
|
|
238
|
+
const client = new client_1.HubV2Client(ctx);
|
|
239
|
+
const data = await client.request("PATCH", client.personalUrl(path), body, { preserveNull: true });
|
|
240
|
+
return (0, result_1.ok)("hub_v2_issues_update", data);
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
];
|
|
244
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hubV2ProjectsTools = hubV2ProjectsTools;
|
|
4
|
+
const client_1 = require("./client");
|
|
5
|
+
const index_1 = require("./config/index");
|
|
6
|
+
const schemas_1 = require("./schemas");
|
|
7
|
+
const result_1 = require("../../utils/result");
|
|
8
|
+
function hubV2ProjectsTools() {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
name: "hub_v2_projects_list",
|
|
12
|
+
description: "List locally configured Hub V2 project aliases without exposing tokens.",
|
|
13
|
+
riskLevel: "read",
|
|
14
|
+
inputSchema: schemas_1.projectSelectorSchema,
|
|
15
|
+
handler(args) {
|
|
16
|
+
return (0, result_1.ok)("hub_v2_projects_list", (0, index_1.listConfiguredProjects)(args.project ?? args.projectKey));
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "hub_v2_projects_get",
|
|
21
|
+
description: "Get one locally configured Hub V2 project summary without exposing tokens.",
|
|
22
|
+
riskLevel: "read",
|
|
23
|
+
inputSchema: schemas_1.projectSelectorSchema,
|
|
24
|
+
handler(args) {
|
|
25
|
+
return (0, result_1.ok)("hub_v2_projects_get", (0, index_1.getConfiguredProject)(args));
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "hub_v2_project_members_list",
|
|
30
|
+
description: "List Hub V2 project members with Project Token for assignment and mention candidates.",
|
|
31
|
+
riskLevel: "read",
|
|
32
|
+
inputSchema: schemas_1.projectMembersListSchema,
|
|
33
|
+
async handler(args) {
|
|
34
|
+
const ctx = (0, index_1.resolveHubV2Context)(args, "project");
|
|
35
|
+
const client = new client_1.HubV2Client(ctx);
|
|
36
|
+
const data = await client.request("GET", client.tokenUrl("/members"));
|
|
37
|
+
return (0, result_1.ok)("hub_v2_project_members_list", data);
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HubV2Client } from "./client";
|
|
2
|
+
export declare function readRawAsBase64(client: HubV2Client, url: string, maxBytes?: number): Promise<{
|
|
3
|
+
contentBase64: string;
|
|
4
|
+
contentType: string;
|
|
5
|
+
fileName: string | null;
|
|
6
|
+
sizeBytes: number;
|
|
7
|
+
truncated: boolean;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readRawAsBase64 = readRawAsBase64;
|
|
4
|
+
async function readRawAsBase64(client, url, maxBytes) {
|
|
5
|
+
const limit = maxBytes ?? 1024 * 1024;
|
|
6
|
+
const raw = await client.raw("GET", url);
|
|
7
|
+
if (raw.content.byteLength > limit) {
|
|
8
|
+
throw new Error(`raw file is too large: ${raw.content.byteLength} bytes exceeds maxBytes=${limit}`);
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
contentBase64: raw.content.toString("base64"),
|
|
12
|
+
contentType: raw.contentType,
|
|
13
|
+
fileName: extractFileName(raw.contentDisposition),
|
|
14
|
+
sizeBytes: raw.content.byteLength,
|
|
15
|
+
truncated: false,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function extractFileName(contentDisposition) {
|
|
19
|
+
if (!contentDisposition) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const utf8Match = /filename\*=UTF-8''([^;]+)/i.exec(contentDisposition);
|
|
23
|
+
if (utf8Match) {
|
|
24
|
+
try {
|
|
25
|
+
return decodeURIComponent(utf8Match[1]);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return utf8Match[1];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const asciiMatch = /filename="([^"]+)"/i.exec(contentDisposition);
|
|
32
|
+
return asciiMatch?.[1] ?? null;
|
|
33
|
+
}
|