@freelancercom/phabricator-mcp 2.0.17 → 2.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tools/maniphest.js +17 -10
- package/package.json +1 -1
package/dist/tools/maniphest.js
CHANGED
|
@@ -161,25 +161,32 @@ export function registerManiphestTools(server, client) {
|
|
|
161
161
|
if (params.comment !== undefined) {
|
|
162
162
|
transactions.push({ type: 'comment', value: params.comment });
|
|
163
163
|
}
|
|
164
|
+
const result = await client.call('maniphest.edit', { transactions });
|
|
165
|
+
const extras = {};
|
|
166
|
+
// Custom fields are applied in a second call because Phabricator validates
|
|
167
|
+
// transaction types against the default subtype during creation. Subtype-specific
|
|
168
|
+
// custom fields (e.g. incident fields) are only available after the task exists
|
|
169
|
+
// with the correct subtype.
|
|
164
170
|
if (params.customFields !== undefined) {
|
|
171
|
+
const customTransactions = [];
|
|
165
172
|
for (const [key, value] of Object.entries(params.customFields)) {
|
|
166
|
-
|
|
173
|
+
customTransactions.push({ type: key, value });
|
|
174
|
+
}
|
|
175
|
+
if (customTransactions.length > 0) {
|
|
176
|
+
extras.customFields = await client.call('maniphest.edit', {
|
|
177
|
+
objectIdentifier: result.object.phid,
|
|
178
|
+
transactions: customTransactions,
|
|
179
|
+
});
|
|
167
180
|
}
|
|
168
181
|
}
|
|
169
|
-
const result = await client.call('maniphest.edit', { transactions });
|
|
170
182
|
// Link revisions to the newly created task via differential.revision.edit
|
|
171
183
|
if (params.revisionIDs !== undefined && params.revisionIDs.length > 0) {
|
|
172
184
|
const revPHIDs = await resolveRevisionPHIDs(client, params.revisionIDs);
|
|
173
185
|
const taskId = `T${result.object.id}`;
|
|
174
|
-
|
|
175
|
-
return {
|
|
176
|
-
content: [{
|
|
177
|
-
type: 'text',
|
|
178
|
-
text: JSON.stringify({ ...result, linkedRevisions: linkResults }, null, 2),
|
|
179
|
-
}],
|
|
180
|
-
};
|
|
186
|
+
extras.linkedRevisions = await linkRevisionsToTask(client, taskId, revPHIDs, 'add');
|
|
181
187
|
}
|
|
182
|
-
|
|
188
|
+
const output = Object.keys(extras).length > 0 ? { ...result, ...extras } : result;
|
|
189
|
+
return { content: [{ type: 'text', text: JSON.stringify(output, null, 2) }] };
|
|
183
190
|
});
|
|
184
191
|
// Edit task
|
|
185
192
|
server.tool('phabricator_task_edit', 'Edit an existing Maniphest task', {
|
package/package.json
CHANGED