huly-mcp-selfhost 1.0.0
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/.env.example +16 -0
- package/README.md +522 -0
- package/dist/connection.d.ts +9 -0
- package/dist/connection.js +122 -0
- package/dist/connection.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas.d.ts +459 -0
- package/dist/schemas.js +196 -0
- package/dist/schemas.js.map +1 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +87 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/attachments.d.ts +28 -0
- package/dist/tools/attachments.js +61 -0
- package/dist/tools/attachments.js.map +1 -0
- package/dist/tools/channels.d.ts +44 -0
- package/dist/tools/channels.js +130 -0
- package/dist/tools/channels.js.map +1 -0
- package/dist/tools/comments.d.ts +27 -0
- package/dist/tools/comments.js +60 -0
- package/dist/tools/comments.js.map +1 -0
- package/dist/tools/components.d.ts +19 -0
- package/dist/tools/components.js +57 -0
- package/dist/tools/components.js.map +1 -0
- package/dist/tools/documents.d.ts +68 -0
- package/dist/tools/documents.js +207 -0
- package/dist/tools/documents.js.map +1 -0
- package/dist/tools/issues.d.ts +56 -0
- package/dist/tools/issues.js +262 -0
- package/dist/tools/issues.js.map +1 -0
- package/dist/tools/labels.d.ts +35 -0
- package/dist/tools/labels.js +150 -0
- package/dist/tools/labels.js.map +1 -0
- package/dist/tools/log-time.d.ts +10 -0
- package/dist/tools/log-time.js +31 -0
- package/dist/tools/log-time.js.map +1 -0
- package/dist/tools/members.d.ts +6 -0
- package/dist/tools/members.js +17 -0
- package/dist/tools/members.js.map +1 -0
- package/dist/tools/milestones.d.ts +19 -0
- package/dist/tools/milestones.js +80 -0
- package/dist/tools/milestones.js.map +1 -0
- package/dist/tools/organizations.d.ts +32 -0
- package/dist/tools/organizations.js +86 -0
- package/dist/tools/organizations.js.map +1 -0
- package/dist/tools/projects.d.ts +24 -0
- package/dist/tools/projects.js +64 -0
- package/dist/tools/projects.js.map +1 -0
- package/dist/tools/relations.d.ts +27 -0
- package/dist/tools/relations.js +103 -0
- package/dist/tools/relations.js.map +1 -0
- package/dist/tools/search.d.ts +9 -0
- package/dist/tools/search.js +32 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/statuses.d.ts +16 -0
- package/dist/tools/statuses.js +93 -0
- package/dist/tools/statuses.js.map +1 -0
- package/dist/utils/errors.d.ts +11 -0
- package/dist/utils/errors.js +24 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/format.d.ts +4 -0
- package/dist/utils/format.js +28 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/markdown.d.ts +14 -0
- package/dist/utils/markdown.js +144 -0
- package/dist/utils/markdown.js.map +1 -0
- package/dist/utils/storage.d.ts +7 -0
- package/dist/utils/storage.js +82 -0
- package/dist/utils/storage.js.map +1 -0
- package/package.json +68 -0
- package/scripts/cleanup-issues.js +132 -0
- package/scripts/demo.js +193 -0
- package/scripts/import-csv.js +242 -0
- package/scripts/sample-tasks.csv +11 -0
- package/scripts/setup.js +103 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
export declare const listTeamspaces: (args: Record<string, never>) => Promise<{
|
|
2
|
+
content: Array<{
|
|
3
|
+
type: "text";
|
|
4
|
+
text: string;
|
|
5
|
+
}>;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const createTeamspace: (args: {
|
|
8
|
+
name: string;
|
|
9
|
+
isPrivate: boolean;
|
|
10
|
+
description?: string | undefined;
|
|
11
|
+
}) => Promise<{
|
|
12
|
+
content: Array<{
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
}>;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const listDocuments: (args: {
|
|
18
|
+
teamspaceId: string;
|
|
19
|
+
}) => Promise<{
|
|
20
|
+
content: Array<{
|
|
21
|
+
type: "text";
|
|
22
|
+
text: string;
|
|
23
|
+
}>;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const getDocument: (args: {
|
|
26
|
+
documentId: string;
|
|
27
|
+
}) => Promise<{
|
|
28
|
+
content: Array<{
|
|
29
|
+
type: "text";
|
|
30
|
+
text: string;
|
|
31
|
+
}>;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const createDocument: (args: {
|
|
34
|
+
title: string;
|
|
35
|
+
teamspaceId: string;
|
|
36
|
+
parentId?: string | undefined;
|
|
37
|
+
}) => Promise<{
|
|
38
|
+
content: Array<{
|
|
39
|
+
type: "text";
|
|
40
|
+
text: string;
|
|
41
|
+
}>;
|
|
42
|
+
}>;
|
|
43
|
+
export declare const deleteDocument: (args: {
|
|
44
|
+
documentId: string;
|
|
45
|
+
}) => Promise<{
|
|
46
|
+
content: Array<{
|
|
47
|
+
type: "text";
|
|
48
|
+
text: string;
|
|
49
|
+
}>;
|
|
50
|
+
}>;
|
|
51
|
+
export declare const updateDocument: (args: {
|
|
52
|
+
documentId: string;
|
|
53
|
+
markdown: string;
|
|
54
|
+
}) => Promise<{
|
|
55
|
+
content: Array<{
|
|
56
|
+
type: "text";
|
|
57
|
+
text: string;
|
|
58
|
+
}>;
|
|
59
|
+
}>;
|
|
60
|
+
export declare const linkDocument: (args: {
|
|
61
|
+
identifier: string;
|
|
62
|
+
documentId: string;
|
|
63
|
+
}) => Promise<{
|
|
64
|
+
content: Array<{
|
|
65
|
+
type: "text";
|
|
66
|
+
text: string;
|
|
67
|
+
}>;
|
|
68
|
+
}>;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.linkDocument = exports.updateDocument = exports.deleteDocument = exports.createDocument = exports.getDocument = exports.listDocuments = exports.createTeamspace = exports.listTeamspaces = void 0;
|
|
40
|
+
const document_1 = __importDefault(require("@hcengineering/document"));
|
|
41
|
+
const core_1 = __importStar(require("@hcengineering/core"));
|
|
42
|
+
const document_2 = require("@hcengineering/document");
|
|
43
|
+
const connection_1 = require("../connection");
|
|
44
|
+
const errors_1 = require("../utils/errors");
|
|
45
|
+
const markdown_1 = require("../utils/markdown");
|
|
46
|
+
const storage_1 = require("../utils/storage");
|
|
47
|
+
const tracker_1 = __importDefault(require("@hcengineering/tracker"));
|
|
48
|
+
exports.listTeamspaces = (0, errors_1.wrapToolHandler)(async () => {
|
|
49
|
+
const client = await (0, connection_1.getConnection)();
|
|
50
|
+
const teamspaces = await client.findAll(document_1.default.class.Teamspace, {});
|
|
51
|
+
if (teamspaces.length === 0)
|
|
52
|
+
return 'No teamspaces found in this workspace.';
|
|
53
|
+
const lines = teamspaces.map((t) => `- **${t.name}** (id: \`${t._id}\`)${t.description != null && t.description !== '' ? `\n ${t.description}` : ''}`);
|
|
54
|
+
return `## Teamspaces (${teamspaces.length})\n\n${lines.join('\n')}`;
|
|
55
|
+
});
|
|
56
|
+
exports.createTeamspace = (0, errors_1.wrapToolHandler)(async (args) => {
|
|
57
|
+
const client = await (0, connection_1.getConnection)();
|
|
58
|
+
const teamspaceId = (0, core_1.generateId)();
|
|
59
|
+
await client.createDoc(document_1.default.class.Teamspace, core_1.default.space.Space, {
|
|
60
|
+
name: args.name,
|
|
61
|
+
description: args.description ?? '',
|
|
62
|
+
private: args.isPrivate ?? false,
|
|
63
|
+
members: [client.user],
|
|
64
|
+
owners: [client.user],
|
|
65
|
+
autoJoin: false,
|
|
66
|
+
archived: false,
|
|
67
|
+
icon: undefined,
|
|
68
|
+
color: undefined,
|
|
69
|
+
type: document_1.default.spaceType.DefaultTeamspaceType
|
|
70
|
+
}, teamspaceId);
|
|
71
|
+
return `✅ Teamspace **"${args.name}"** created (id: \`${teamspaceId}\`).`;
|
|
72
|
+
});
|
|
73
|
+
exports.listDocuments = (0, errors_1.wrapToolHandler)(async (args) => {
|
|
74
|
+
const client = await (0, connection_1.getConnection)();
|
|
75
|
+
const docs = await client.findAll(document_1.default.class.Document, { space: args.teamspaceId }, { sort: { rank: core_1.SortingOrder.Ascending }, limit: 100 });
|
|
76
|
+
if (docs.length === 0)
|
|
77
|
+
return 'No documents found in this teamspace.';
|
|
78
|
+
// Build parent-child tree display
|
|
79
|
+
const noParentId = document_1.default.ids.NoParent;
|
|
80
|
+
const lines = docs.map((d) => {
|
|
81
|
+
const isNested = d.parent != null && String(d.parent) !== noParentId;
|
|
82
|
+
const prefix = isNested ? ' - ' : '- ';
|
|
83
|
+
return `${prefix}**${d.title}** (id: \`${d._id}\`)${d.snapshots != null && d.snapshots > 0 ? ` [${d.snapshots} snapshots]` : ''}`;
|
|
84
|
+
});
|
|
85
|
+
return `## Documents (${docs.length})\n\n${lines.join('\n')}`;
|
|
86
|
+
});
|
|
87
|
+
exports.getDocument = (0, errors_1.wrapToolHandler)(async (args) => {
|
|
88
|
+
const client = await (0, connection_1.getConnection)();
|
|
89
|
+
const doc = await client.findOne(document_1.default.class.Document, { _id: args.documentId });
|
|
90
|
+
if (doc == null)
|
|
91
|
+
throw new Error(`Document '${args.documentId}' not found.`);
|
|
92
|
+
const teamspace = await client.findOne(document_1.default.class.Teamspace, { _id: doc.space });
|
|
93
|
+
const lines = [
|
|
94
|
+
`## ${doc.title}`,
|
|
95
|
+
`**ID:** \`${doc._id}\``,
|
|
96
|
+
`**Teamspace:** ${teamspace?.name ?? doc.space}`,
|
|
97
|
+
`**Comments:** ${doc.comments ?? 0}`,
|
|
98
|
+
`**Attachments:** ${doc.attachments ?? 0}`,
|
|
99
|
+
`**Snapshots:** ${doc.snapshots ?? 0}`
|
|
100
|
+
];
|
|
101
|
+
// Provide content access instructions if content blob ref exists
|
|
102
|
+
if (doc.content != null) {
|
|
103
|
+
const frontUrl = process.env.HULY_FRONT_URL;
|
|
104
|
+
if (frontUrl != null && frontUrl !== '') {
|
|
105
|
+
const { wsToken, workspaceUuid } = await (0, connection_1.getWorkspaceInfo)();
|
|
106
|
+
const blobUrl = `${frontUrl}/files?file=${encodeURIComponent(doc.content)}&workspace=${workspaceUuid}&token=${wsToken}`;
|
|
107
|
+
lines.push(`\n**Content:** Available at blob ref \`${doc.content}\``);
|
|
108
|
+
lines.push(`**Content URL:** ${blobUrl}`);
|
|
109
|
+
// Try to fetch content
|
|
110
|
+
try {
|
|
111
|
+
const res = await fetch(blobUrl);
|
|
112
|
+
if (res.ok) {
|
|
113
|
+
const text = await res.text();
|
|
114
|
+
// Huly stores content as JSON markup — extract plain text if possible
|
|
115
|
+
try {
|
|
116
|
+
const parsed = JSON.parse(text);
|
|
117
|
+
const extracted = (0, markdown_1.extractText)(parsed);
|
|
118
|
+
if (extracted.length > 0) {
|
|
119
|
+
lines.push(`\n**Content:**\n${extracted}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
lines.push(`\n**Content (raw):**\n${text.substring(0, 2000)}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
lines.push(`_(Set HULY_FRONT_URL env var to fetch content)_`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
lines.push(`\n**Content blob ref:** \`${doc.content}\``);
|
|
133
|
+
lines.push(`_(Set HULY_FRONT_URL env var to fetch document content, e.g. https://front.huly.app)_`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
lines.push('\n**Content:** _(empty document)_');
|
|
138
|
+
}
|
|
139
|
+
return lines.join('\n');
|
|
140
|
+
});
|
|
141
|
+
exports.createDocument = (0, errors_1.wrapToolHandler)(async (args) => {
|
|
142
|
+
const client = await (0, connection_1.getConnection)();
|
|
143
|
+
const teamspace = await client.findOne(document_1.default.class.Teamspace, { _id: args.teamspaceId });
|
|
144
|
+
if (teamspace == null)
|
|
145
|
+
throw new Error(`Teamspace '${args.teamspaceId}' not found.`);
|
|
146
|
+
const noParent = document_1.default.ids.NoParent;
|
|
147
|
+
const parentId = args.parentId != null ? args.parentId : noParent;
|
|
148
|
+
// Compute rank (prepend before existing docs at same level)
|
|
149
|
+
const rank = await (0, document_2.getFirstRank)(client, teamspace._id, parentId);
|
|
150
|
+
const docId = (0, core_1.generateId)();
|
|
151
|
+
await client.createDoc(document_1.default.class.Document, teamspace._id, {
|
|
152
|
+
title: args.title,
|
|
153
|
+
content: null,
|
|
154
|
+
parent: parentId,
|
|
155
|
+
rank: rank ?? '',
|
|
156
|
+
icon: null,
|
|
157
|
+
color: undefined,
|
|
158
|
+
snapshots: 0,
|
|
159
|
+
attachments: 0,
|
|
160
|
+
comments: 0,
|
|
161
|
+
labels: 0,
|
|
162
|
+
references: 0,
|
|
163
|
+
embeddings: 0
|
|
164
|
+
}, docId);
|
|
165
|
+
return `✅ Document **"${args.title}"** created (id: \`${docId}\`) in teamspace "${teamspace.name}".\nOpen it in Huly to add content via the editor.`;
|
|
166
|
+
});
|
|
167
|
+
exports.deleteDocument = (0, errors_1.wrapToolHandler)(async (args) => {
|
|
168
|
+
const client = await (0, connection_1.getConnection)();
|
|
169
|
+
const doc = await client.findOne(document_1.default.class.Document, { _id: args.documentId });
|
|
170
|
+
if (doc == null)
|
|
171
|
+
throw new Error(`Document '${args.documentId}' not found.`);
|
|
172
|
+
await client.removeDoc(document_1.default.class.Document, doc.space, doc._id);
|
|
173
|
+
return `✅ Document **"${doc.title}"** (\`${doc._id}\`) deleted.`;
|
|
174
|
+
});
|
|
175
|
+
exports.updateDocument = (0, errors_1.wrapToolHandler)(async (args) => {
|
|
176
|
+
const client = await (0, connection_1.getConnection)();
|
|
177
|
+
const { wsToken, workspaceUuid } = await (0, connection_1.getWorkspaceInfo)();
|
|
178
|
+
const doc = await client.findOne(document_1.default.class.Document, { _id: args.documentId });
|
|
179
|
+
if (doc == null)
|
|
180
|
+
throw new Error(`Document '${args.documentId}' not found.`);
|
|
181
|
+
// Convert markdown to ProseMirror JSON
|
|
182
|
+
const prosemirror = (0, markdown_1.markdownToProseMirror)(args.markdown);
|
|
183
|
+
const content = JSON.stringify(prosemirror);
|
|
184
|
+
const blobId = `${args.documentId}-content-${Date.now()}`;
|
|
185
|
+
const uploadedId = await (0, storage_1.uploadMarkupBlob)(wsToken, workspaceUuid, blobId, content);
|
|
186
|
+
// Update document content ref
|
|
187
|
+
await client.updateDoc(document_1.default.class.Document, doc.space, doc._id, { content: uploadedId });
|
|
188
|
+
return `✅ Document **"${doc.title}"** updated (blob: \`${uploadedId}\`).`;
|
|
189
|
+
});
|
|
190
|
+
exports.linkDocument = (0, errors_1.wrapToolHandler)(async (args) => {
|
|
191
|
+
const client = await (0, connection_1.getConnection)();
|
|
192
|
+
const issue = await client.findOne(tracker_1.default.class.Issue, { identifier: args.identifier });
|
|
193
|
+
if (issue == null)
|
|
194
|
+
throw new Error(`Issue '${args.identifier}' not found.`);
|
|
195
|
+
const doc = await client.findOne(document_1.default.class.Document, { _id: args.documentId });
|
|
196
|
+
if (doc == null)
|
|
197
|
+
throw new Error(`Document '${args.documentId}' not found.`);
|
|
198
|
+
const existing = issue.relations ?? [];
|
|
199
|
+
if (existing.some((r) => r._id === doc._id)) {
|
|
200
|
+
return `ℹ️ Document **"${doc.title}"** is already linked to **${args.identifier}**.`;
|
|
201
|
+
}
|
|
202
|
+
await client.updateDoc(tracker_1.default.class.Issue, issue.space, issue._id, {
|
|
203
|
+
relations: [...existing, { _id: doc._id, _class: doc._class }]
|
|
204
|
+
});
|
|
205
|
+
return `✅ Document **"${doc.title}"** linked to **${args.identifier}** — visible in the Relations panel.`;
|
|
206
|
+
});
|
|
207
|
+
//# sourceMappingURL=documents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/tools/documents.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAA8C;AAC9C,4DAA8E;AAC9E,sDAAsD;AACtD,8CAA+D;AAC/D,4CAAiD;AACjD,gDAAsE;AACtE,8CAAmD;AACnD,qEAA4C;AAK/B,QAAA,cAAc,GAAG,IAAA,wBAAe,EAAwB,KAAK,IAAI,EAAE;IAC9E,MAAM,MAAM,GA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AC,aAAa,IAAI,CAAC,UAAU,cAAc,CAAC,CAAA;IAE5E,MAAM,QAAQ,GAAI,KAAa,CAAC,SAAS,IAAI,EAAE,CAAA;IAC/C,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QACjD,OAAO,kBAAkB,GAAG,CAAC,KAAK,8BAA8B,IAAI,CAAC,UAAU,KAAK,CAAA;IACtF,CAAC;IAED,MAAM,MAAM,CAAC,SAAS,CAAC,iBAAO,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE;QAClE,SAAS,EAAE,CAAC,GAAG,QAAQ,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;KACxD,CAAC,CAAA;IAET,OAAO,iBAAiB,GAAG,CAAC,KAAK,mBAAmB,IAAI,CAAC,UAAU,sCAAsC,CAAA;AAC3G,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const listIssues: (args: {
|
|
2
|
+
projectIdentifier: string;
|
|
3
|
+
limit: number;
|
|
4
|
+
status?: string | undefined;
|
|
5
|
+
priority?: "Medium" | "NoPriority" | "Urgent" | "High" | "Low" | undefined;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
content: Array<{
|
|
8
|
+
type: "text";
|
|
9
|
+
text: string;
|
|
10
|
+
}>;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const getIssue: (args: {
|
|
13
|
+
identifier: string;
|
|
14
|
+
}) => Promise<{
|
|
15
|
+
content: Array<{
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}>;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const createIssue: (args: {
|
|
21
|
+
title: string;
|
|
22
|
+
projectIdentifier: string;
|
|
23
|
+
priority: "Medium" | "NoPriority" | "Urgent" | "High" | "Low";
|
|
24
|
+
description?: string | undefined;
|
|
25
|
+
statusName?: string | undefined;
|
|
26
|
+
dueDate?: string | undefined;
|
|
27
|
+
}) => Promise<{
|
|
28
|
+
content: Array<{
|
|
29
|
+
type: "text";
|
|
30
|
+
text: string;
|
|
31
|
+
}>;
|
|
32
|
+
}>;
|
|
33
|
+
export declare const deleteIssue: (args: {
|
|
34
|
+
identifier: string;
|
|
35
|
+
}) => Promise<{
|
|
36
|
+
content: Array<{
|
|
37
|
+
type: "text";
|
|
38
|
+
text: string;
|
|
39
|
+
}>;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const updateIssue: (args: {
|
|
42
|
+
identifier: string;
|
|
43
|
+
title?: string | undefined;
|
|
44
|
+
priority?: "Medium" | "NoPriority" | "Urgent" | "High" | "Low" | undefined;
|
|
45
|
+
description?: string | undefined;
|
|
46
|
+
statusName?: string | undefined;
|
|
47
|
+
dueDate?: string | null | undefined;
|
|
48
|
+
assignee?: string | null | undefined;
|
|
49
|
+
componentLabel?: string | undefined;
|
|
50
|
+
milestoneLabel?: string | null | undefined;
|
|
51
|
+
}) => Promise<{
|
|
52
|
+
content: Array<{
|
|
53
|
+
type: "text";
|
|
54
|
+
text: string;
|
|
55
|
+
}>;
|
|
56
|
+
}>;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.updateIssue = exports.deleteIssue = exports.createIssue = exports.getIssue = exports.listIssues = void 0;
|
|
40
|
+
const tracker_1 = __importStar(require("@hcengineering/tracker"));
|
|
41
|
+
const task_1 = __importDefault(require("@hcengineering/task"));
|
|
42
|
+
const contact_1 = __importDefault(require("@hcengineering/contact"));
|
|
43
|
+
const core_1 = require("@hcengineering/core");
|
|
44
|
+
const rank_1 = require("@hcengineering/rank");
|
|
45
|
+
const connection_1 = require("../connection");
|
|
46
|
+
const errors_1 = require("../utils/errors");
|
|
47
|
+
const format_1 = require("../utils/format");
|
|
48
|
+
const markdown_1 = require("../utils/markdown");
|
|
49
|
+
const storage_1 = require("../utils/storage");
|
|
50
|
+
exports.listIssues = (0, errors_1.wrapToolHandler)(async (args) => {
|
|
51
|
+
const client = await (0, connection_1.getConnection)();
|
|
52
|
+
const project = await client.findOne(tracker_1.default.class.Project, { identifier: args.projectIdentifier });
|
|
53
|
+
if (project == null)
|
|
54
|
+
throw new Error(`Project '${args.projectIdentifier}' not found.`);
|
|
55
|
+
const query = { space: project._id };
|
|
56
|
+
if (args.status != null) {
|
|
57
|
+
const status = await client.findOne(tracker_1.default.class.IssueStatus, { name: args.status });
|
|
58
|
+
if (status == null)
|
|
59
|
+
throw new Error(`Status '${args.status}' not found in project '${args.projectIdentifier}'.`);
|
|
60
|
+
query.status = status._id;
|
|
61
|
+
}
|
|
62
|
+
if (args.priority != null) {
|
|
63
|
+
query.priority = tracker_1.IssuePriority[args.priority];
|
|
64
|
+
}
|
|
65
|
+
const issues = await client.findAll(tracker_1.default.class.Issue, query, { limit: args.limit, sort: { modifiedOn: core_1.SortingOrder.Descending } });
|
|
66
|
+
if (issues.length === 0)
|
|
67
|
+
return `No issues found in project ${args.projectIdentifier}.`;
|
|
68
|
+
// Resolve all statuses in one call
|
|
69
|
+
const statuses = await client.findAll(tracker_1.default.class.IssueStatus, {});
|
|
70
|
+
const statusMap = new Map(statuses.map((s) => [s._id, s.name]));
|
|
71
|
+
const lines = issues.map((issue) => {
|
|
72
|
+
const statusName = statusMap.get(issue.status) ?? 'Unknown';
|
|
73
|
+
const due = issue.dueDate != null ? ` | Due: ${(0, format_1.formatDate)(issue.dueDate)}` : '';
|
|
74
|
+
return `- **${issue.identifier}** [${statusName}] [${(0, format_1.priorityLabel)(issue.priority)}]${due}\n ${issue.title}`;
|
|
75
|
+
});
|
|
76
|
+
return `## Issues in ${args.projectIdentifier} (${issues.length})\n\n${lines.join('\n')}`;
|
|
77
|
+
});
|
|
78
|
+
exports.getIssue = (0, errors_1.wrapToolHandler)(async (args) => {
|
|
79
|
+
const client = await (0, connection_1.getConnection)();
|
|
80
|
+
const issue = await client.findOne(tracker_1.default.class.Issue, { identifier: args.identifier });
|
|
81
|
+
if (issue == null)
|
|
82
|
+
throw new Error(`Issue '${args.identifier}' not found.`);
|
|
83
|
+
const status = await client.findOne(tracker_1.default.class.IssueStatus, { _id: issue.status });
|
|
84
|
+
const lines = [
|
|
85
|
+
`## ${issue.identifier}: ${issue.title}`,
|
|
86
|
+
`**Status:** ${status?.name ?? 'Unknown'}`,
|
|
87
|
+
`**Priority:** ${(0, format_1.priorityLabel)(issue.priority)}`,
|
|
88
|
+
`**Due date:** ${(0, format_1.formatDate)(issue.dueDate)}`,
|
|
89
|
+
`**Comments:** ${issue.comments ?? 0}`,
|
|
90
|
+
`**Sub-issues:** ${issue.subIssues ?? 0}`,
|
|
91
|
+
`**Estimation:** ${issue.estimation > 0 ? `${issue.estimation}h` : 'None'}`,
|
|
92
|
+
`**Reported time:** ${issue.reportedTime > 0 ? `${issue.reportedTime}h` : 'None'}`
|
|
93
|
+
];
|
|
94
|
+
if (issue.description != null) {
|
|
95
|
+
const frontUrl = process.env.HULY_FRONT_URL;
|
|
96
|
+
if (frontUrl != null && frontUrl !== '') {
|
|
97
|
+
const { wsToken, workspaceUuid } = await (0, connection_1.getWorkspaceInfo)();
|
|
98
|
+
const blobUrl = `${frontUrl}/files?file=${encodeURIComponent(issue.description)}&workspace=${workspaceUuid}&token=${wsToken}`;
|
|
99
|
+
try {
|
|
100
|
+
const res = await fetch(blobUrl);
|
|
101
|
+
if (res.ok) {
|
|
102
|
+
const text = await res.text();
|
|
103
|
+
try {
|
|
104
|
+
const extracted = (0, markdown_1.extractText)(JSON.parse(text));
|
|
105
|
+
if (extracted.length > 0)
|
|
106
|
+
lines.push(`\n**Description:**\n${extracted}`);
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
lines.push(`\n**Description (raw):**\n${text.substring(0, 2000)}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
lines.push(`\n**Description:** _(fetch failed — blob ref \`${issue.description}\`)_`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
lines.push(`\n**Description blob ref:** \`${issue.description}\``);
|
|
119
|
+
lines.push('_(Set HULY_FRONT_URL env var to fetch description content)_');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return lines.join('\n');
|
|
123
|
+
});
|
|
124
|
+
exports.createIssue = (0, errors_1.wrapToolHandler)(async (args) => {
|
|
125
|
+
const client = await (0, connection_1.getConnection)();
|
|
126
|
+
// 1. Find project
|
|
127
|
+
const project = await client.findOne(tracker_1.default.class.Project, { identifier: args.projectIdentifier });
|
|
128
|
+
if (project == null)
|
|
129
|
+
throw new Error(`Project '${args.projectIdentifier}' not found.`);
|
|
130
|
+
// 2. Increment sequence counter
|
|
131
|
+
const incResult = await client.updateDoc(tracker_1.default.class.Project, project.space, project._id, { $inc: { sequence: 1 } }, true);
|
|
132
|
+
const issueNumber = incResult?.object?.sequence ?? project.sequence + 1;
|
|
133
|
+
const identifier = `${project.identifier}-${issueNumber}`;
|
|
134
|
+
// 3. Resolve status
|
|
135
|
+
const statuses = await client.findAll(tracker_1.default.class.IssueStatus, {});
|
|
136
|
+
const status = args.statusName != null
|
|
137
|
+
? (statuses.find((s) => s.name === args.statusName) ?? statuses[0])
|
|
138
|
+
: (project.defaultIssueStatus != null
|
|
139
|
+
? (statuses.find((s) => s._id === project.defaultIssueStatus) ?? statuses[0])
|
|
140
|
+
: statuses[0]);
|
|
141
|
+
if (status == null)
|
|
142
|
+
throw new Error(`No statuses found in project '${args.projectIdentifier}'.`);
|
|
143
|
+
// 4. Find TaskType (kind field — required)
|
|
144
|
+
const kind = await client.findOne(task_1.default.class.TaskType, project.type != null ? { parent: project.type } : {});
|
|
145
|
+
if (kind == null)
|
|
146
|
+
throw new Error('Could not find a TaskType for this project.');
|
|
147
|
+
// 5. Compute rank (append after last issue)
|
|
148
|
+
const lastIssue = await client.findOne(tracker_1.default.class.Issue, { space: project._id }, { sort: { rank: core_1.SortingOrder.Descending } });
|
|
149
|
+
const rank = (0, rank_1.makeRank)(lastIssue?.rank, undefined);
|
|
150
|
+
// 6. Create via addCollection (issues are AttachedDoc)
|
|
151
|
+
const issueId = (0, core_1.generateId)();
|
|
152
|
+
// Issue description is a MarkupBlobRef, same storage mechanism as document
|
|
153
|
+
// content — upload it the same way if provided.
|
|
154
|
+
let descriptionBlobId = null;
|
|
155
|
+
if (args.description != null && args.description !== '') {
|
|
156
|
+
const { wsToken, workspaceUuid } = await (0, connection_1.getWorkspaceInfo)();
|
|
157
|
+
const prosemirror = (0, markdown_1.markdownToProseMirror)(args.description);
|
|
158
|
+
descriptionBlobId = await (0, storage_1.uploadMarkupBlob)(wsToken, workspaceUuid, `${issueId}-description-${Date.now()}`, JSON.stringify(prosemirror));
|
|
159
|
+
}
|
|
160
|
+
await client.addCollection(tracker_1.default.class.Issue, project._id, tracker_1.default.ids.NoParent, tracker_1.default.class.Issue, 'subIssues', {
|
|
161
|
+
title: args.title,
|
|
162
|
+
description: descriptionBlobId,
|
|
163
|
+
status: status._id,
|
|
164
|
+
priority: tracker_1.IssuePriority[args.priority],
|
|
165
|
+
number: issueNumber,
|
|
166
|
+
identifier,
|
|
167
|
+
rank,
|
|
168
|
+
kind: kind._id,
|
|
169
|
+
comments: 0,
|
|
170
|
+
subIssues: 0,
|
|
171
|
+
dueDate: args.dueDate != null ? new Date(args.dueDate).getTime() : null,
|
|
172
|
+
assignee: null,
|
|
173
|
+
component: null,
|
|
174
|
+
milestone: null,
|
|
175
|
+
parents: [],
|
|
176
|
+
remainingTime: 0,
|
|
177
|
+
estimation: 0,
|
|
178
|
+
reportedTime: 0,
|
|
179
|
+
reports: 0,
|
|
180
|
+
childInfo: [],
|
|
181
|
+
relations: []
|
|
182
|
+
}, issueId);
|
|
183
|
+
return `✅ Created **${identifier}**: ${args.title}\nStatus: ${status.name} | Priority: ${(0, format_1.priorityLabel)(tracker_1.IssuePriority[args.priority])}`;
|
|
184
|
+
});
|
|
185
|
+
exports.deleteIssue = (0, errors_1.wrapToolHandler)(async (args) => {
|
|
186
|
+
const client = await (0, connection_1.getConnection)();
|
|
187
|
+
const issue = await client.findOne(tracker_1.default.class.Issue, { identifier: args.identifier });
|
|
188
|
+
if (issue == null)
|
|
189
|
+
throw new Error(`Issue '${args.identifier}' not found.`);
|
|
190
|
+
await client.removeCollection(tracker_1.default.class.Issue, issue.space, issue._id, issue.attachedTo, issue.attachedToClass, issue.collection);
|
|
191
|
+
return `✅ Deleted **${args.identifier}**: ${issue.title}`;
|
|
192
|
+
});
|
|
193
|
+
exports.updateIssue = (0, errors_1.wrapToolHandler)(async (args) => {
|
|
194
|
+
const client = await (0, connection_1.getConnection)();
|
|
195
|
+
const issue = await client.findOne(tracker_1.default.class.Issue, { identifier: args.identifier });
|
|
196
|
+
if (issue == null)
|
|
197
|
+
throw new Error(`Issue '${args.identifier}' not found.`);
|
|
198
|
+
const updates = {};
|
|
199
|
+
if (args.title != null)
|
|
200
|
+
updates.title = args.title;
|
|
201
|
+
if (args.description != null && args.description !== '') {
|
|
202
|
+
const { wsToken, workspaceUuid } = await (0, connection_1.getWorkspaceInfo)();
|
|
203
|
+
const prosemirror = (0, markdown_1.markdownToProseMirror)(args.description);
|
|
204
|
+
const descriptionBlobId = await (0, storage_1.uploadMarkupBlob)(wsToken, workspaceUuid, `${issue._id}-description-${Date.now()}`, JSON.stringify(prosemirror));
|
|
205
|
+
updates.description = descriptionBlobId;
|
|
206
|
+
}
|
|
207
|
+
if (args.statusName != null) {
|
|
208
|
+
const status = await client.findOne(tracker_1.default.class.IssueStatus, { name: args.statusName });
|
|
209
|
+
if (status == null)
|
|
210
|
+
throw new Error(`Status '${args.statusName}' not found.`);
|
|
211
|
+
updates.status = status._id;
|
|
212
|
+
}
|
|
213
|
+
if (args.priority != null) {
|
|
214
|
+
updates.priority = tracker_1.IssuePriority[args.priority];
|
|
215
|
+
}
|
|
216
|
+
if (args.dueDate !== undefined) {
|
|
217
|
+
updates.dueDate = args.dueDate != null ? new Date(args.dueDate).getTime() : null;
|
|
218
|
+
}
|
|
219
|
+
if (args.assignee !== undefined) {
|
|
220
|
+
if (args.assignee === null) {
|
|
221
|
+
updates.assignee = null;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
const employees = await client.findAll(contact_1.default.class.Member, {});
|
|
225
|
+
const match = employees.find((e) => {
|
|
226
|
+
const name = e.name ?? '';
|
|
227
|
+
return name.toLowerCase().includes(args.assignee.toLowerCase());
|
|
228
|
+
});
|
|
229
|
+
if (match == null)
|
|
230
|
+
throw new Error(`Member '${args.assignee}' not found.`);
|
|
231
|
+
updates.assignee = match._id;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (args.componentLabel !== undefined) {
|
|
235
|
+
if (args.componentLabel === null) {
|
|
236
|
+
updates.component = null;
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
const component = await client.findOne(tracker_1.default.class.Component, { space: issue.space, label: args.componentLabel });
|
|
240
|
+
if (component == null)
|
|
241
|
+
throw new Error(`Component '${args.componentLabel}' not found in this project.`);
|
|
242
|
+
updates.component = component._id;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (args.milestoneLabel !== undefined) {
|
|
246
|
+
if (args.milestoneLabel === null) {
|
|
247
|
+
updates.milestone = null;
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
const milestone = await client.findOne(tracker_1.default.class.Milestone, { space: issue.space, label: args.milestoneLabel });
|
|
251
|
+
if (milestone == null)
|
|
252
|
+
throw new Error(`Milestone '${args.milestoneLabel}' not found in this project.`);
|
|
253
|
+
updates.milestone = milestone._id;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (Object.keys(updates).length === 0)
|
|
257
|
+
return `No changes made to ${args.identifier}.`;
|
|
258
|
+
await client.updateDoc(tracker_1.default.class.Issue, issue.space, issue._id, updates);
|
|
259
|
+
const changed = Object.keys(updates).join(', ');
|
|
260
|
+
return `✅ Updated **${args.identifier}** — changed: ${changed}`;
|
|
261
|
+
});
|
|
262
|
+
//# sourceMappingURL=issues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issues.js","sourceRoot":"","sources":["../../src/tools/issues.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAA2E;AAC3E,+DAAsC;AACtC,qEAA4C;AAC5C,8CAA6F;AAE7F,8CAA8C;AAC9C,8CAA+D;AAC/D,4CAAiD;AACjD,4CAA2D;AAC3D,gDAAsE;AACtE,8CAAmD;AAUtC,QAAA,UAAU,GAAG,IAAA,wBAAe,EAAmC,KAAK,EAAE,IAAI,EAAE,EAAE;IACzF,MAAM,MAAM,GAAG,MAAM,IAAA,0BAAa,GAAE,CAAA;IACpC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,iBAAO,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,iBAAiB,EAAE,CAAC,CAAA;IACnG,IAAI,OAAO,IAAI,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,YAAY,IAAI,CAAC,iBAAiB,cAAc,CAAC,CAAA;IAEtF,MAAM,KAAK,GAA4B,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,CAAA;IAE7D,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;QACxB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,iBAAO,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;QACrF,IAAI,MAAM,IAAI,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,WAAW,IAAI,CAAC,MAAM,2BAA2B,IAAI,CAAC,iBAAiB,IAAI,CAAC,CAAA;QAChH,KAA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