@firfi/huly-mcp 0.5.0 → 0.5.2

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
@@ -82791,7 +82791,7 @@ var require_client6 = __commonJS({
82791
82791
  var import_core46 = require_lib4();
82792
82792
  var import_platform2 = require_lib();
82793
82793
  var import_config8 = require_config();
82794
- var import_markup = require_markup();
82794
+ var import_markup8 = require_markup();
82795
82795
  var import_utils14 = require_utils9();
82796
82796
  async function connect(url4, options) {
82797
82797
  const config3 = await (0, import_config8.loadServerConfig)(url4);
@@ -82832,7 +82832,7 @@ var require_client6 = __commonJS({
82832
82832
  this.connection = connection;
82833
82833
  this.account = account;
82834
82834
  this.client = new import_core46.TxOperations(connection, account.primarySocialId);
82835
- this.markup = (0, import_markup.createMarkupOperations)(url4, workspace, token, config3);
82835
+ this.markup = (0, import_markup8.createMarkupOperations)(url4, workspace, token, config3);
82836
82836
  }
82837
82837
  static {
82838
82838
  __name(this, "PlatformClientImpl");
@@ -82861,7 +82861,7 @@ var require_client6 = __commonJS({
82861
82861
  async processMarkup(_class, id, data) {
82862
82862
  const result = {};
82863
82863
  for (const [key, value3] of Object.entries(data)) {
82864
- if (value3 instanceof import_markup.MarkupContent) {
82864
+ if (value3 instanceof import_markup8.MarkupContent) {
82865
82865
  result[key] = this.markup.uploadMarkup(_class, id, key, value3.content, value3.kind);
82866
82866
  } else {
82867
82867
  result[key] = value3;
@@ -172154,10 +172154,26 @@ var import_text3 = __toESM(require_lib9(), 1);
172154
172154
 
172155
172155
  // src/huly/operations/channels.ts
172156
172156
  var import_core20 = __toESM(require_lib4(), 1);
172157
+
172158
+ // src/huly/operations/markup.ts
172157
172159
  var import_text2 = __toESM(require_lib9(), 1);
172158
172160
  var import_text_markdown2 = __toESM(require_lib17(), 1);
172159
- var personIdsAsSocialIdentityRefs = (ids3) => ids3;
172160
172161
  var jsonAsMarkup = import_text2.jsonToMarkup;
172162
+ var markupToMarkdownString = (markup) => {
172163
+ const json3 = (0, import_text2.markupToJSON)(markup);
172164
+ return (0, import_text_markdown2.markupToMarkdown)(json3, { refUrl: "", imageUrl: "" });
172165
+ };
172166
+ var markdownToMarkupString = (markdown) => {
172167
+ const json3 = (0, import_text_markdown2.markdownToMarkup)(markdown, { refUrl: "", imageUrl: "" });
172168
+ return jsonAsMarkup(json3);
172169
+ };
172170
+ var optionalMarkdownToMarkup = (md, fallback = "") => md && md.trim() !== "" ? markdownToMarkupString(md) : fallback;
172171
+ function optionalMarkupToMarkdown(markup, fallback = "") {
172172
+ return markup ? markupToMarkdownString(markup) : fallback;
172173
+ }
172174
+
172175
+ // src/huly/operations/channels.ts
172176
+ var personIdsAsSocialIdentityRefs = (ids3) => ids3;
172161
172177
  var findChannel = (identifier2) => Effect_exports.gen(function* () {
172162
172178
  const client = yield* HulyClient;
172163
172179
  const channel = yield* findByNameOrId(
@@ -172171,14 +172187,6 @@ var findChannel = (identifier2) => Effect_exports.gen(function* () {
172171
172187
  }
172172
172188
  return { client, channel };
172173
172189
  });
172174
- var markupToMarkdownString = (markup) => {
172175
- const json3 = (0, import_text2.markupToJSON)(markup);
172176
- return (0, import_text_markdown2.markupToMarkdown)(json3, { refUrl: "", imageUrl: "" });
172177
- };
172178
- var markdownToMarkupString = (markdown) => {
172179
- const json3 = (0, import_text_markdown2.markdownToMarkup)(markdown, { refUrl: "", imageUrl: "" });
172180
- return jsonAsMarkup(json3);
172181
- };
172182
172190
  var buildSocialIdToPersonNameMap = (client, socialIds) => Effect_exports.gen(function* () {
172183
172191
  if (socialIds.length === 0) {
172184
172192
  return /* @__PURE__ */ new Map();
@@ -172489,7 +172497,7 @@ var listInlineComments = (params) => Effect_exports.gen(function* () {
172489
172497
  const threadReplies = threadRepliesMap.get(comment.threadId) ?? [];
172490
172498
  const replies = threadReplies.map((r) => ({
172491
172499
  id: r._id,
172492
- body: r.message ? markupToMarkdownString(r.message) : "",
172500
+ body: optionalMarkupToMarkdown(r.message),
172493
172501
  sender: r.createdBy !== void 0 ? nameMap.get(r.createdBy) : void 0,
172494
172502
  createdOn: r.createdOn
172495
172503
  }));
@@ -177290,7 +177298,7 @@ var listComments = (params) => Effect_exports.gen(function* () {
177290
177298
  const validated = yield* Schema_exports.decodeUnknown(Schema_exports.Array(CommentSchema))(
177291
177299
  messages.map((msg) => ({
177292
177300
  id: msg._id,
177293
- body: msg.message,
177301
+ body: optionalMarkupToMarkdown(msg.message),
177294
177302
  authorId: msg.modifiedBy,
177295
177303
  createdOn: msg.createdOn,
177296
177304
  modifiedOn: msg.modifiedOn,
@@ -177313,7 +177321,7 @@ var addComment = (params) => Effect_exports.gen(function* () {
177313
177321
  });
177314
177322
  const commentId = (0, import_core28.generateId)();
177315
177323
  const commentData = {
177316
- message: params.body
177324
+ message: markdownToMarkupString(params.body)
177317
177325
  };
177318
177326
  yield* client.addCollection(
177319
177327
  chunter.class.ChatMessage,
@@ -177331,7 +177339,8 @@ var addComment = (params) => Effect_exports.gen(function* () {
177331
177339
  });
177332
177340
  var updateComment = (params) => Effect_exports.gen(function* () {
177333
177341
  const { client, comment, issue: issue2, project: project3 } = yield* findComment(params);
177334
- if (params.body === comment.message) {
177342
+ const newMarkup = markdownToMarkupString(params.body);
177343
+ if (newMarkup === comment.message) {
177335
177344
  return {
177336
177345
  commentId: CommentId.make(params.commentId),
177337
177346
  issueIdentifier: IssueIdentifier.make(issue2.identifier),
@@ -177340,7 +177349,7 @@ var updateComment = (params) => Effect_exports.gen(function* () {
177340
177349
  }
177341
177350
  const now2 = yield* Clock_exports.currentTimeMillis;
177342
177351
  const updateOps = {
177343
- message: params.body,
177352
+ message: newMarkup,
177344
177353
  editedOn: now2
177345
177354
  };
177346
177355
  yield* client.updateDoc(
@@ -178085,7 +178094,7 @@ var getComponent = (params) => Effect_exports.gen(function* () {
178085
178094
  const result = {
178086
178095
  id: ComponentId.make(component._id),
178087
178096
  label: ComponentLabel.make(component.label),
178088
- description: component.description,
178097
+ description: optionalMarkupToMarkdown(component.description, void 0),
178089
178098
  lead: leadName !== void 0 ? PersonName.make(leadName) : void 0,
178090
178099
  project: params.project,
178091
178100
  modifiedOn: component.modifiedOn,
@@ -178106,7 +178115,7 @@ var createComponent = (params) => Effect_exports.gen(function* () {
178106
178115
  }) : null;
178107
178116
  const componentData = {
178108
178117
  label: params.label,
178109
- description: params.description ?? "",
178118
+ description: optionalMarkdownToMarkup(params.description),
178110
178119
  lead: leadRef,
178111
178120
  comments: 0
178112
178121
  };
@@ -178125,7 +178134,7 @@ var updateComponent = (params) => Effect_exports.gen(function* () {
178125
178134
  updateOps.label = params.label;
178126
178135
  }
178127
178136
  if (params.description !== void 0) {
178128
- updateOps.description = params.description;
178137
+ updateOps.description = optionalMarkdownToMarkup(params.description);
178129
178138
  }
178130
178139
  if (params.lead !== void 0) {
178131
178140
  if (params.lead === null) {
@@ -179281,7 +179290,7 @@ var resolveChild = (client, child) => Effect_exports.gen(function* () {
179281
179290
  title: child.title,
179282
179291
  priority: priorityToString(child.priority)
179283
179292
  };
179284
- const withDescription3 = child.description ? { ...base, description: child.description } : base;
179293
+ const withDescription3 = child.description ? { ...base, description: optionalMarkupToMarkdown(child.description) } : base;
179285
179294
  const withAssignee = assigneeName !== void 0 ? { ...withDescription3, assignee: PersonName.make(assigneeName) } : withDescription3;
179286
179295
  const withComponent = componentLabel !== void 0 ? { ...withAssignee, component: ComponentLabel.make(componentLabel) } : withAssignee;
179287
179296
  const estimation = zeroAsUnset(NonNegativeNumber.make(child.estimation));
@@ -179311,7 +179320,7 @@ var buildTemplateChild = (client, projectId, projectIdentifier, input) => Effect
179311
179320
  return {
179312
179321
  id: (0, import_core35.generateId)(),
179313
179322
  title: input.title,
179314
- description: input.description ?? "",
179323
+ description: optionalMarkdownToMarkup(input.description),
179315
179324
  priority: stringToPriority(input.priority || "no-priority"),
179316
179325
  assignee: assigneeRef,
179317
179326
  component: componentRef,
@@ -179354,7 +179363,7 @@ var getIssueTemplate = (params) => Effect_exports.gen(function* () {
179354
179363
  const result = {
179355
179364
  id: IssueTemplateId.make(template._id),
179356
179365
  title: template.title,
179357
- description: template.description,
179366
+ description: optionalMarkupToMarkdown(template.description),
179358
179367
  priority: priorityToString(template.priority),
179359
179368
  assignee: assigneeName !== void 0 ? PersonName.make(assigneeName) : void 0,
179360
179369
  component: componentLabel !== void 0 ? ComponentLabel.make(componentLabel) : void 0,
@@ -179399,7 +179408,7 @@ var createIssueTemplate = (params) => Effect_exports.gen(function* () {
179399
179408
  }
179400
179409
  const templateData = {
179401
179410
  title: params.title,
179402
- description: params.description ?? "",
179411
+ description: optionalMarkdownToMarkup(params.description),
179403
179412
  priority,
179404
179413
  assignee: assigneeRef,
179405
179414
  component: componentRef,
@@ -179418,7 +179427,7 @@ var createIssueTemplate = (params) => Effect_exports.gen(function* () {
179418
179427
  var createIssueFromTemplate = (params) => Effect_exports.gen(function* () {
179419
179428
  const { client, project: project3, template } = yield* findProjectAndTemplate(params);
179420
179429
  const title = params.title ?? template.title;
179421
- const description = params.description ?? template.description;
179430
+ const description = params.description ?? optionalMarkupToMarkdown(template.description, void 0);
179422
179431
  const priority = params.priority ?? priorityToString(template.priority);
179423
179432
  const templateAssigneeRef = template.assignee;
179424
179433
  const assignee = params.assignee !== void 0 ? params.assignee : templateAssigneeRef !== null ? yield* Effect_exports.gen(function* () {
@@ -179458,7 +179467,7 @@ var createIssueFromTemplate = (params) => Effect_exports.gen(function* () {
179458
179467
  const includeChildren = params.includeChildren !== false;
179459
179468
  if (includeChildren && template.children.length > 0) {
179460
179469
  for (const child of template.children) {
179461
- const childDescription = child.description !== "" ? child.description : void 0;
179470
+ const childDescription = optionalMarkupToMarkdown(child.description, void 0);
179462
179471
  const childResult = yield* createIssue({
179463
179472
  project: params.project,
179464
179473
  title: child.title,
@@ -179502,7 +179511,7 @@ var updateIssueTemplate = (params) => Effect_exports.gen(function* () {
179502
179511
  updateOps.title = params.title;
179503
179512
  }
179504
179513
  if (params.description !== void 0) {
179505
- updateOps.description = params.description;
179514
+ updateOps.description = optionalMarkdownToMarkup(params.description);
179506
179515
  }
179507
179516
  if (params.priority !== void 0) {
179508
179517
  updateOps.priority = stringToPriority(params.priority);
@@ -180275,7 +180284,7 @@ var getMilestone = (params) => Effect_exports.gen(function* () {
180275
180284
  const result = {
180276
180285
  id: MilestoneId.make(milestone._id),
180277
180286
  label: MilestoneLabel.make(milestone.label),
180278
- description: milestone.description,
180287
+ description: optionalMarkupToMarkdown(milestone.description),
180279
180288
  status: milestoneStatusToString(milestone.status),
180280
180289
  targetDate: milestone.targetDate,
180281
180290
  project: params.project,
@@ -180289,7 +180298,7 @@ var createMilestone = (params) => Effect_exports.gen(function* () {
180289
180298
  const milestoneId = (0, import_core38.generateId)();
180290
180299
  const milestoneData = {
180291
180300
  label: params.label,
180292
- description: params.description ?? "",
180301
+ description: optionalMarkdownToMarkup(params.description),
180293
180302
  status: import_tracker5.MilestoneStatus.Planned,
180294
180303
  targetDate: params.targetDate,
180295
180304
  comments: 0
@@ -180300,6 +180309,15 @@ var createMilestone = (params) => Effect_exports.gen(function* () {
180300
180309
  milestoneData,
180301
180310
  milestoneId
180302
180311
  );
180312
+ if (params.description !== void 0 && params.description.trim() !== "") {
180313
+ yield* client.uploadMarkup(
180314
+ tracker.class.Milestone,
180315
+ milestoneId,
180316
+ "description",
180317
+ params.description,
180318
+ "markdown"
180319
+ );
180320
+ }
180303
180321
  return { id: MilestoneId.make(milestoneId), label: MilestoneLabel.make(params.label) };
180304
180322
  });
180305
180323
  var updateMilestone = (params) => Effect_exports.gen(function* () {
@@ -180309,7 +180327,16 @@ var updateMilestone = (params) => Effect_exports.gen(function* () {
180309
180327
  updateOps.label = params.label;
180310
180328
  }
180311
180329
  if (params.description !== void 0) {
180312
- updateOps.description = params.description;
180330
+ if (params.description.trim() !== "") {
180331
+ yield* client.uploadMarkup(
180332
+ tracker.class.Milestone,
180333
+ milestone._id,
180334
+ "description",
180335
+ params.description,
180336
+ "markdown"
180337
+ );
180338
+ }
180339
+ updateOps.description = optionalMarkdownToMarkup(params.description);
180313
180340
  }
180314
180341
  if (params.targetDate !== void 0) {
180315
180342
  updateOps.targetDate = params.targetDate;
package/dist/index.js CHANGED
File without changes