@shortcut/mcp 0.8.1 → 0.8.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.
Files changed (2) hide show
  1. package/dist/index.js +29 -25
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14771,16 +14771,16 @@ class ShortcutClientWrapper {
14771
14771
  return acc;
14772
14772
  if (startDate > today || endDate < today)
14773
14773
  return acc;
14774
+ if (!iteration.group_ids?.length)
14775
+ iteration.group_ids = ["none"];
14774
14776
  for (const groupId of iteration.group_ids) {
14775
- if (!teamIds.includes(groupId))
14777
+ if (groupId !== "none" && !teamIds.includes(groupId))
14776
14778
  continue;
14777
- const prevIteration = acc.get(groupId);
14778
- if (prevIteration) {
14779
- const [prevIterationEndDate] = new Date(prevIteration.end_date).toISOString().split("T");
14780
- if (endDate < prevIterationEndDate)
14781
- acc.set(groupId, iteration);
14779
+ const prevIterations = acc.get(groupId);
14780
+ if (prevIterations) {
14781
+ acc.set(groupId, prevIterations.concat([iteration]));
14782
14782
  } else
14783
- acc.set(groupId, iteration);
14783
+ acc.set(groupId, [iteration]);
14784
14784
  }
14785
14785
  return acc;
14786
14786
  }, new Map);
@@ -14801,16 +14801,16 @@ class ShortcutClientWrapper {
14801
14801
  return acc;
14802
14802
  if (startDate < today)
14803
14803
  return acc;
14804
+ if (!iteration.group_ids?.length)
14805
+ iteration.group_ids = ["none"];
14804
14806
  for (const groupId of iteration.group_ids) {
14805
- if (!teamIds.includes(groupId))
14807
+ if (groupId !== "none" && !teamIds.includes(groupId))
14806
14808
  continue;
14807
- const prevIteration = acc.get(groupId);
14808
- if (prevIteration) {
14809
- const [prevIterationEndDate] = new Date(prevIteration.end_date).toISOString().split("T");
14810
- if (endDate < prevIterationEndDate)
14811
- acc.set(groupId, iteration);
14809
+ const prevIterations = acc.get(groupId);
14810
+ if (prevIterations) {
14811
+ acc.set(groupId, prevIterations.concat([iteration]));
14812
14812
  } else
14813
- acc.set(groupId, iteration);
14813
+ acc.set(groupId, [iteration]);
14814
14814
  }
14815
14815
  return acc;
14816
14816
  }, new Map);
@@ -21669,7 +21669,7 @@ var import_client = __toESM(require_lib(), 1);
21669
21669
 
21670
21670
  // package.json
21671
21671
  var name = "@shortcut/mcp";
21672
- var version = "0.8.1";
21672
+ var version = "0.8.3";
21673
21673
 
21674
21674
  // src/tools/base.ts
21675
21675
  class BaseTools {
@@ -21788,8 +21788,8 @@ class BaseTools {
21788
21788
  getSimplifiedIteration(entity) {
21789
21789
  if (!entity)
21790
21790
  return null;
21791
- const { id, name: name2, app_url, group_ids, status } = entity;
21792
- return { id, name: name2, app_url, team_ids: group_ids, status };
21791
+ const { id, name: name2, app_url, group_ids, status, start_date, end_date } = entity;
21792
+ return { id, name: name2, app_url, team_ids: group_ids, status, start_date, end_date };
21793
21793
  }
21794
21794
  async getRelatedEntitiesForTeam(entity) {
21795
21795
  if (!entity)
@@ -22161,10 +22161,12 @@ class IterationTools extends BaseTools {
22161
22161
  if (!team)
22162
22162
  throw new Error(`No team found matching id: "${teamId}"`);
22163
22163
  const result = await this.client.getActiveIteration([teamId]);
22164
- const iteration = result.get(teamId);
22165
- if (!iteration)
22164
+ const iterations = result.get(teamId);
22165
+ if (!iterations?.length)
22166
22166
  return this.toResult(`Result: No active iterations found for team.`);
22167
- return this.toResult("The active iteration for the team is:", await this.entityWithRelatedEntities(iteration, "iteration"));
22167
+ if (iterations.length === 1)
22168
+ return this.toResult("The active iteration for the team is:", await this.entityWithRelatedEntities(iterations[0], "iteration"));
22169
+ return this.toResult("The active iterations for the team are:", await this.entitiesWithRelatedEntities(iterations, "iterations"));
22168
22170
  }
22169
22171
  const currentUser = await this.client.getCurrentUser();
22170
22172
  if (!currentUser)
@@ -22174,7 +22176,7 @@ class IterationTools extends BaseTools {
22174
22176
  if (!teamIds.length)
22175
22177
  throw new Error("Current user does not belong to any teams.");
22176
22178
  const resultsByTeam = await this.client.getActiveIteration(teamIds);
22177
- const allActiveIterations = [...resultsByTeam.values()];
22179
+ const allActiveIterations = [...resultsByTeam.values()].flat();
22178
22180
  if (!allActiveIterations.length)
22179
22181
  return this.toResult("Result: No active iterations found for any of your teams.");
22180
22182
  return this.toResult(`You have ${allActiveIterations.length} active iterations for your teams:`, await this.entitiesWithRelatedEntities(allActiveIterations, "iterations"));
@@ -22185,10 +22187,12 @@ class IterationTools extends BaseTools {
22185
22187
  if (!team)
22186
22188
  throw new Error(`No team found matching id: "${teamId}"`);
22187
22189
  const result = await this.client.getUpcomingIteration([teamId]);
22188
- const iteration = result.get(teamId);
22189
- if (!iteration)
22190
+ const iterations = result.get(teamId);
22191
+ if (!iterations?.length)
22190
22192
  return this.toResult(`Result: No upcoming iterations found for team.`);
22191
- return this.toResult("The next upcoming iteration for the team is:", await this.entityWithRelatedEntities(iteration, "iteration"));
22193
+ if (iterations.length === 1)
22194
+ return this.toResult("The next upcoming iteration for the team is:", await this.entityWithRelatedEntities(iterations[0], "iteration"));
22195
+ return this.toResult("The next upcoming iterations for the team are:", await this.entitiesWithRelatedEntities(iterations, "iterations"));
22192
22196
  }
22193
22197
  const currentUser = await this.client.getCurrentUser();
22194
22198
  if (!currentUser)
@@ -22198,7 +22202,7 @@ class IterationTools extends BaseTools {
22198
22202
  if (!teamIds.length)
22199
22203
  throw new Error("Current user does not belong to any teams.");
22200
22204
  const resultsByTeam = await this.client.getUpcomingIteration(teamIds);
22201
- const allUpcomingIterations = [...resultsByTeam.values()];
22205
+ const allUpcomingIterations = [...resultsByTeam.values()].flat();
22202
22206
  if (!allUpcomingIterations.length)
22203
22207
  return this.toResult("Result: No upcoming iterations found for any of your teams.");
22204
22208
  return this.toResult("The upcoming iterations for all your teams are:", await this.entitiesWithRelatedEntities(allUpcomingIterations, "iterations"));
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "modelcontextprotocol"
13
13
  ],
14
14
  "license": "MIT",
15
- "version": "0.8.1",
15
+ "version": "0.8.3",
16
16
  "type": "module",
17
17
  "main": "dist/index.js",
18
18
  "bin": {