@firfi/huly-mcp 0.1.44 → 0.1.46

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/index.cjs CHANGED
@@ -83046,20 +83046,20 @@ var require_rest = __commonJS({
83046
83046
  __export2(rest_exports, {
83047
83047
  RestClientImpl: () => RestClientImpl,
83048
83048
  connectRest: () => connectRest2,
83049
- createRestClient: () => createRestClient
83049
+ createRestClient: () => createRestClient2
83050
83050
  });
83051
83051
  module2.exports = __toCommonJS2(rest_exports);
83052
83052
  var import_core42 = require_lib4();
83053
83053
  var import_platform2 = require_lib();
83054
83054
  var import_utils14 = require_utils9();
83055
83055
  var import_utils22 = require_utils10();
83056
- function createRestClient(endpoint, workspaceId, token) {
83056
+ function createRestClient2(endpoint, workspaceId, token) {
83057
83057
  return new RestClientImpl(endpoint, workspaceId, token);
83058
83058
  }
83059
- __name(createRestClient, "createRestClient");
83059
+ __name(createRestClient2, "createRestClient");
83060
83060
  async function connectRest2(url4, options) {
83061
83061
  const { endpoint, token, workspaceId } = await (0, import_utils14.getWorkspaceToken)(url4, options);
83062
- return createRestClient(endpoint, workspaceId, token);
83062
+ return createRestClient2(endpoint, workspaceId, token);
83063
83063
  }
83064
83064
  __name(connectRest2, "connectRest");
83065
83065
  var rateLimitError = "rate-limit";
@@ -154184,7 +154184,7 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
154184
154184
  _HulyClient,
154185
154185
  Effect_exports.gen(function* () {
154186
154186
  const config3 = yield* HulyConfigService;
154187
- const { client, markupOps } = yield* connectRestWithRetry({
154187
+ const { accountUuid, client, markupOps } = yield* connectRestWithRetry({
154188
154188
  url: config3.url,
154189
154189
  auth: config3.auth,
154190
154190
  workspace: config3.workspace
@@ -154197,6 +154197,7 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
154197
154197
  })
154198
154198
  });
154199
154199
  const operations = {
154200
+ getAccountUuid: () => accountUuid,
154200
154201
  findAll: (_class, query, options) => withClient(
154201
154202
  (client2) => client2.findAll(_class, query, options),
154202
154203
  "findAll failed"
@@ -154260,6 +154261,8 @@ var HulyClient = class _HulyClient extends Context_exports.Tag("@hulymcp/HulyCli
154260
154261
  const notImplemented = (name) => () => Effect_exports.die(new Error(`${name} not implemented in test layer`));
154261
154262
  const noopFetchMarkup = () => Effect_exports.succeed("");
154262
154263
  const defaultOps = {
154264
+ // AccountUuid is a double-branded string type with no public constructor
154265
+ getAccountUuid: () => "test-account-uuid",
154263
154266
  findAll: noopFindAll,
154264
154267
  findOne: noopFindOne,
154265
154268
  createDoc: notImplemented("createDoc"),
@@ -154301,6 +154304,8 @@ var connectRest = async (config3) => {
154301
154304
  authOptions,
154302
154305
  serverConfig
154303
154306
  );
154307
+ const restClient = (0, import_api_client.createRestClient)(endpoint, workspaceId, token);
154308
+ const account = await restClient.getAccount();
154304
154309
  const client = await (0, import_api_client.createRestTxOperations)(endpoint, workspaceId, token);
154305
154310
  const markupOps = createMarkupOps(
154306
154311
  config3.url,
@@ -154308,7 +154313,7 @@ var connectRest = async (config3) => {
154308
154313
  token,
154309
154314
  serverConfig.COLLABORATOR_URL
154310
154315
  );
154311
- return { client, markupOps };
154316
+ return { client, accountUuid: account.uuid, markupOps };
154312
154317
  };
154313
154318
  var connectRestWithRetry = (config3) => connectWithRetry(() => connectRest(config3), "Connection failed");
154314
154319
 
@@ -174027,7 +174032,7 @@ var PostHog = class extends PostHogBackendClient {
174027
174032
  };
174028
174033
 
174029
174034
  // src/version.ts
174030
- var VERSION = true ? "0.1.43" : "0.0.0-dev";
174035
+ var VERSION = true ? "0.1.45" : "0.0.0-dev";
174031
174036
 
174032
174037
  // src/telemetry/posthog.ts
174033
174038
  var POSTHOG_API_KEY = "phc_TGfFqCGdnF0p68wuFzd5WSw1IsBvOJW0YgoMJDyZPjm";
@@ -174536,7 +174541,8 @@ var UPDATE_PREFIXES = [
174536
174541
  "stop_",
174537
174542
  "save_",
174538
174543
  "unsave_",
174539
- "remove_"
174544
+ "remove_",
174545
+ "move_"
174540
174546
  ];
174541
174547
  var DELETE_PREFIXES = ["delete_"];
174542
174548
  var matchesPrefix = (name, prefixes) => prefixes.some((p) => name.startsWith(p));
@@ -174951,7 +174957,8 @@ var createTeamspace = (params) => Effect_exports.gen(function* () {
174951
174957
  description: params.description ?? "",
174952
174958
  private: params.private ?? false,
174953
174959
  archived: false,
174954
- members: [],
174960
+ members: [client.getAccountUuid()],
174961
+ owners: [client.getAccountUuid()],
174955
174962
  icon: documentPlugin.icon.Teamspace,
174956
174963
  type: documentPlugin.spaceType.DefaultTeamspaceType
174957
174964
  };
@@ -176424,6 +176431,8 @@ var IssueSummarySchema = Schema_exports.Struct({
176424
176431
  status: StatusName,
176425
176432
  priority: Schema_exports.optional(IssuePrioritySchema),
176426
176433
  assignee: Schema_exports.optional(PersonName),
176434
+ parentIssue: Schema_exports.optional(IssueIdentifier),
176435
+ subIssues: Schema_exports.optional(Schema_exports.Number),
176427
176436
  modifiedOn: Schema_exports.optional(Timestamp)
176428
176437
  }).annotations({
176429
176438
  title: "IssueSummary",
@@ -176439,6 +176448,8 @@ var IssueSchema = Schema_exports.Struct({
176439
176448
  assigneeRef: Schema_exports.optional(PersonRefSchema),
176440
176449
  labels: Schema_exports.optional(Schema_exports.Array(LabelSchema)),
176441
176450
  project: ProjectIdentifier,
176451
+ parentIssue: Schema_exports.optional(IssueIdentifier),
176452
+ subIssues: Schema_exports.optional(Schema_exports.Number),
176442
176453
  modifiedOn: Schema_exports.optional(Timestamp),
176443
176454
  createdOn: Schema_exports.optional(Timestamp),
176444
176455
  dueDate: Schema_exports.optional(Schema_exports.NullOr(Timestamp)),
@@ -176457,6 +176468,9 @@ var ListIssuesParamsSchema = Schema_exports.Struct({
176457
176468
  assignee: Schema_exports.optional(Email.annotations({
176458
176469
  description: "Filter by assignee email"
176459
176470
  })),
176471
+ parentIssue: Schema_exports.optional(IssueIdentifier.annotations({
176472
+ description: "Filter to children of this parent issue (e.g., 'HULY-42')"
176473
+ })),
176460
176474
  titleSearch: Schema_exports.optional(Schema_exports.String.annotations({
176461
176475
  description: "Search issues by title substring (case-insensitive)"
176462
176476
  })),
@@ -176584,6 +176598,20 @@ var RemoveLabelParamsSchema = Schema_exports.Struct({
176584
176598
  title: "RemoveLabelParams",
176585
176599
  description: "Parameters for removing a label from an issue"
176586
176600
  });
176601
+ var MoveIssueParamsSchema = Schema_exports.Struct({
176602
+ project: ProjectIdentifier.annotations({
176603
+ description: "Project identifier (e.g., 'HULY')"
176604
+ }),
176605
+ identifier: IssueIdentifier.annotations({
176606
+ description: "Issue to move (e.g., 'HULY-123')"
176607
+ }),
176608
+ newParent: Schema_exports.NullOr(IssueIdentifier).annotations({
176609
+ description: "New parent issue identifier, or null to make top-level"
176610
+ })
176611
+ }).annotations({
176612
+ title: "MoveIssueParams",
176613
+ description: "Parameters for moving an issue to a new parent or to top-level"
176614
+ });
176587
176615
  var listIssuesParamsJsonSchema = JSONSchema_exports.make(ListIssuesParamsSchema);
176588
176616
  var getIssueParamsJsonSchema = JSONSchema_exports.make(GetIssueParamsSchema);
176589
176617
  var createIssueParamsJsonSchema = JSONSchema_exports.make(CreateIssueParamsSchema);
@@ -176591,6 +176619,7 @@ var updateIssueParamsJsonSchema = JSONSchema_exports.make(UpdateIssueParamsSchem
176591
176619
  var addLabelParamsJsonSchema = JSONSchema_exports.make(AddLabelParamsSchema);
176592
176620
  var removeLabelParamsJsonSchema = JSONSchema_exports.make(RemoveLabelParamsSchema);
176593
176621
  var deleteIssueParamsJsonSchema = JSONSchema_exports.make(DeleteIssueParamsSchema);
176622
+ var moveIssueParamsJsonSchema = JSONSchema_exports.make(MoveIssueParamsSchema);
176594
176623
  var parseIssue = Schema_exports.decodeUnknown(IssueSchema);
176595
176624
  var parseIssueSummary = Schema_exports.decodeUnknown(IssueSummarySchema);
176596
176625
  var parseListIssuesParams = Schema_exports.decodeUnknown(ListIssuesParamsSchema);
@@ -176600,6 +176629,7 @@ var parseUpdateIssueParams = Schema_exports.decodeUnknown(UpdateIssueParamsSchem
176600
176629
  var parseAddLabelParams = Schema_exports.decodeUnknown(AddLabelParamsSchema);
176601
176630
  var parseRemoveLabelParams = Schema_exports.decodeUnknown(RemoveLabelParamsSchema);
176602
176631
  var parseDeleteIssueParams = Schema_exports.decodeUnknown(DeleteIssueParamsSchema);
176632
+ var parseMoveIssueParams = Schema_exports.decodeUnknown(MoveIssueParamsSchema);
176603
176633
 
176604
176634
  // src/domain/schemas/components.ts
176605
176635
  var ComponentSummarySchema = Schema_exports.Struct({
@@ -179161,7 +179191,8 @@ var createChannel = (params) => Effect_exports.gen(function* () {
179161
179191
  description: "",
179162
179192
  private: params.private ?? false,
179163
179193
  archived: false,
179164
- members: []
179194
+ members: [client.getAccountUuid()],
179195
+ owners: [client.getAccountUuid()]
179165
179196
  };
179166
179197
  yield* client.createDoc(
179167
179198
  chunter.class.Channel,
@@ -180651,6 +180682,10 @@ var listIssues = (params) => Effect_exports.gen(function* () {
180651
180682
  if (params.descriptionSearch !== void 0 && params.descriptionSearch.trim() !== "") {
180652
180683
  query.$search = params.descriptionSearch;
180653
180684
  }
180685
+ if (params.parentIssue !== void 0) {
180686
+ const parentIssue = yield* findIssueInProject(client, project3, params.parentIssue);
180687
+ query.attachedTo = parentIssue._id;
180688
+ }
180654
180689
  if (params.component !== void 0) {
180655
180690
  const component = yield* findComponentByIdOrLabel(client, project3._id, params.component);
180656
180691
  if (component !== void 0) {
@@ -180677,12 +180712,15 @@ var listIssues = (params) => Effect_exports.gen(function* () {
180677
180712
  for (const issue2 of issues) {
180678
180713
  const statusName = resolveStatusName(statuses, issue2.status);
180679
180714
  const assigneeName = issue2.$lookup?.assignee?.name;
180715
+ const directParent = issue2.parents.length > 0 ? issue2.parents[issue2.parents.length - 1] : void 0;
180680
180716
  summaries.push({
180681
180717
  identifier: IssueIdentifier.make(issue2.identifier),
180682
180718
  title: issue2.title,
180683
180719
  status: StatusName.make(statusName),
180684
180720
  priority: priorityToString(issue2.priority),
180685
180721
  assignee: assigneeName !== void 0 ? PersonName.make(assigneeName) : void 0,
180722
+ parentIssue: directParent !== void 0 ? IssueIdentifier.make(directParent.identifier) : void 0,
180723
+ subIssues: issue2.subIssues > 0 ? issue2.subIssues : void 0,
180686
180724
  modifiedOn: issue2.modifiedOn
180687
180725
  });
180688
180726
  }
@@ -180730,6 +180768,7 @@ var getIssue = (params) => Effect_exports.gen(function* () {
180730
180768
  "markdown"
180731
180769
  );
180732
180770
  }
180771
+ const directParent = issue2.parents.length > 0 ? issue2.parents[issue2.parents.length - 1] : void 0;
180733
180772
  const result = {
180734
180773
  identifier: IssueIdentifier.make(issue2.identifier),
180735
180774
  title: issue2.title,
@@ -180739,6 +180778,8 @@ var getIssue = (params) => Effect_exports.gen(function* () {
180739
180778
  assignee: assigneeName !== void 0 ? PersonName.make(assigneeName) : void 0,
180740
180779
  assigneeRef,
180741
180780
  project: params.project,
180781
+ parentIssue: directParent !== void 0 ? IssueIdentifier.make(directParent.identifier) : void 0,
180782
+ subIssues: issue2.subIssues > 0 ? issue2.subIssues : void 0,
180742
180783
  modifiedOn: issue2.modifiedOn,
180743
180784
  createdOn: issue2.createdOn,
180744
180785
  dueDate: issue2.dueDate ?? void 0,
@@ -180973,6 +181014,101 @@ var deleteIssue = (params) => Effect_exports.gen(function* () {
180973
181014
  );
180974
181015
  return { identifier: IssueIdentifier.make(issue2.identifier), deleted: true };
180975
181016
  });
181017
+ var moveIssue = (params) => Effect_exports.gen(function* () {
181018
+ const { client, issue: issue2, project: project3 } = yield* findProjectAndIssue(params);
181019
+ const oldParentIsIssue = issue2.attachedToClass === tracker.class.Issue;
181020
+ let newAttachedTo;
181021
+ let newAttachedToClass;
181022
+ let newCollection;
181023
+ let newParents;
181024
+ let newParentIdentifier;
181025
+ if (params.newParent !== null) {
181026
+ const parentIssue = yield* findIssueInProject(client, project3, params.newParent);
181027
+ newAttachedTo = parentIssue._id;
181028
+ newAttachedToClass = tracker.class.Issue;
181029
+ newCollection = "subIssues";
181030
+ newParents = [
181031
+ ...parentIssue.parents,
181032
+ {
181033
+ parentId: parentIssue._id,
181034
+ identifier: parentIssue.identifier,
181035
+ parentTitle: parentIssue.title,
181036
+ space: project3._id
181037
+ }
181038
+ ];
181039
+ newParentIdentifier = parentIssue.identifier;
181040
+ } else {
181041
+ newAttachedTo = project3._id;
181042
+ newAttachedToClass = tracker.class.Project;
181043
+ newCollection = "issues";
181044
+ newParents = [];
181045
+ }
181046
+ const updateOps = {
181047
+ attachedTo: toRef(newAttachedTo),
181048
+ attachedToClass: newAttachedToClass,
181049
+ collection: newCollection,
181050
+ parents: newParents
181051
+ };
181052
+ yield* client.updateDoc(
181053
+ tracker.class.Issue,
181054
+ project3._id,
181055
+ issue2._id,
181056
+ updateOps
181057
+ );
181058
+ if (oldParentIsIssue) {
181059
+ yield* client.updateDoc(
181060
+ tracker.class.Issue,
181061
+ project3._id,
181062
+ // issue.attachedTo is Ref<Doc>; for sub-issues it points to the parent issue.
181063
+ // Cast needed because updateDoc expects Ref<HulyIssue> but attachedTo is Ref<Doc>.
181064
+ toRef(issue2.attachedTo),
181065
+ { $inc: { subIssues: -1 } }
181066
+ );
181067
+ }
181068
+ if (params.newParent !== null) {
181069
+ yield* client.updateDoc(
181070
+ tracker.class.Issue,
181071
+ project3._id,
181072
+ toRef(newAttachedTo),
181073
+ { $inc: { subIssues: 1 } }
181074
+ );
181075
+ }
181076
+ if (issue2.subIssues > 0) {
181077
+ yield* updateDescendantParents(client, project3._id, issue2, newParents);
181078
+ }
181079
+ const result = {
181080
+ identifier: IssueIdentifier.make(issue2.identifier),
181081
+ moved: true
181082
+ };
181083
+ if (newParentIdentifier !== void 0) {
181084
+ return { ...result, newParent: IssueIdentifier.make(newParentIdentifier) };
181085
+ }
181086
+ return result;
181087
+ });
181088
+ var updateDescendantParents = (client, spaceId, parentIssue, parentNewParents) => Effect_exports.gen(function* () {
181089
+ const thisParentInfo = {
181090
+ parentId: parentIssue._id,
181091
+ identifier: parentIssue.identifier,
181092
+ parentTitle: parentIssue.title,
181093
+ space: spaceId
181094
+ };
181095
+ const children = yield* client.findAll(
181096
+ tracker.class.Issue,
181097
+ { attachedTo: parentIssue._id, space: spaceId }
181098
+ );
181099
+ for (const child of children) {
181100
+ const childNewParents = [...parentNewParents, thisParentInfo];
181101
+ yield* client.updateDoc(
181102
+ tracker.class.Issue,
181103
+ spaceId,
181104
+ child._id,
181105
+ { parents: childNewParents }
181106
+ );
181107
+ if (child.subIssues > 0) {
181108
+ yield* updateDescendantParents(client, spaceId, child, childNewParents);
181109
+ }
181110
+ }
181111
+ });
180976
181112
 
180977
181113
  // src/huly/operations/issue-templates.ts
180978
181114
  var findTemplateByIdOrTitle = (client, projectId, templateIdOrTitle) => Effect_exports.gen(function* () {
@@ -181631,7 +181767,7 @@ var CATEGORY10 = "issues";
181631
181767
  var issueTools = [
181632
181768
  {
181633
181769
  name: "list_issues",
181634
- description: "Query Huly issues with optional filters. Returns issues sorted by modification date (newest first). Supports filtering by project, status, assignee, and milestone. Supports searching by title substring (titleSearch) and description content (descriptionSearch).",
181770
+ description: "Query Huly issues with optional filters. Returns issues sorted by modification date (newest first). Supports filtering by project, status, assignee, component, and parentIssue (to list children of a specific issue). Supports searching by title substring (titleSearch) and description content (descriptionSearch).",
181635
181771
  category: CATEGORY10,
181636
181772
  inputSchema: listIssuesParamsJsonSchema,
181637
181773
  handler: createToolHandler(
@@ -181706,6 +181842,17 @@ var issueTools = [
181706
181842
  deleteIssue
181707
181843
  )
181708
181844
  },
181845
+ {
181846
+ name: "move_issue",
181847
+ description: "Move an issue to a new parent (making it a sub-issue) or to top-level (null). Updates parent/child relationships and sub-issue counts.",
181848
+ category: CATEGORY10,
181849
+ inputSchema: moveIssueParamsJsonSchema,
181850
+ handler: createToolHandler(
181851
+ "move_issue",
181852
+ parseMoveIssueParams,
181853
+ moveIssue
181854
+ )
181855
+ },
181709
181856
  {
181710
181857
  name: "list_components",
181711
181858
  description: "List components in a Huly project. Components organize issues by area/feature. Returns components sorted by modification date (newest first).",
@@ -182601,7 +182748,8 @@ var createProject = (params) => Effect_exports.gen(function* () {
182601
182748
  name: params.name,
182602
182749
  description: params.description ?? "",
182603
182750
  private: params.private ?? false,
182604
- members: [],
182751
+ members: [client.getAccountUuid()],
182752
+ owners: [client.getAccountUuid()],
182605
182753
  archived: false,
182606
182754
  identifier: params.identifier,
182607
182755
  sequence: 0,