@commonlyai/mcp 0.3.18 → 0.3.19

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/tools.js +22 -6
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@commonlyai/mcp",
3
3
  "mcpName": "io.github.Team-Commonly/commonly",
4
- "version": "0.3.18",
4
+ "version": "0.3.19",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
package/src/tools.js CHANGED
@@ -58,6 +58,14 @@ const reqWith = (props, requiredKeys) => ({ ...required(props), required: requir
58
58
 
59
59
  const STRING = { type: 'string' };
60
60
  const INT = { type: 'integer' };
61
+ const normalizePullRequestUrl = (value) => {
62
+ const url = typeof value === 'string' ? value.split(/[?#]/, 1)[0] : '';
63
+ const match = /^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/pull\/[1-9]\d*$/.exec(url);
64
+ if (!match || match[0] !== url || new URL(url).href !== url) {
65
+ throw new Error('prUrl must be https://github.com/<owner>/<repo>/pull/<n>');
66
+ }
67
+ return url;
68
+ };
61
69
  const CLAIM_OUTCOME = { type: 'string', enum: ['declined', 'completed'] };
62
70
  const DECISION_CLASS = { type: 'string', enum: ['strategy', 'implementation', 'prioritization'] };
63
71
  const DECISION_OPTION = {
@@ -409,19 +417,27 @@ export const buildTools = (config) => {
409
417
  },
410
418
  {
411
419
  name: 'commonly_update_task',
412
- description: 'Append an update note and optionally set priority (P0 highest through P3), without changing status — visible in the task drawer history. If a 409 reports unseen messages, read them and retry, or pass continueAnyway:true to update despite them.',
420
+ description: 'Append an update note and optionally set priority (P0 highest through P3), without changing status — visible in the task drawer history. Optionally set prUrl to a GitHub pull request URL before appending the note. If a 409 reports unseen messages, read them and retry, or pass continueAnyway:true to update despite them.',
413
421
  inputSchema: reqWith({
414
422
  podId: STRING,
415
423
  taskId: STRING,
416
424
  text: STRING,
417
425
  priority: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'] },
426
+ prUrl: STRING,
418
427
  continueAnyway: { type: 'boolean' },
419
428
  }, ['podId', 'taskId', 'text']),
420
- call: wrap(async ({ podId, taskId, text, priority, continueAnyway }) => request(config, {
421
- method: 'POST',
422
- path: `/api/v1/tasks/${encodeURIComponent(podId)}/${encodeURIComponent(taskId)}/updates`,
423
- body: { text, priority, continueAnyway },
424
- })),
429
+ call: wrap(async ({ podId, taskId, text, priority, prUrl, continueAnyway }) => {
430
+ const taskPath = `/api/v1/tasks/${encodeURIComponent(podId)}/${encodeURIComponent(taskId)}`;
431
+ if (prUrl !== undefined) {
432
+ const normalized = normalizePullRequestUrl(prUrl);
433
+ await request(config, { method: 'PATCH', path: taskPath, body: { prUrl: normalized } });
434
+ }
435
+ return request(config, {
436
+ method: 'POST',
437
+ path: `${taskPath}/updates`,
438
+ body: { text, priority, continueAnyway },
439
+ });
440
+ }),
425
441
  },
426
442
  {
427
443
  name: 'commonly_create_pod',