@bragduck/cli 2.12.1 → 2.13.1

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.
@@ -3381,17 +3381,23 @@ var JiraService = class {
3381
3381
  const queries = [];
3382
3382
  if (options.days) {
3383
3383
  queries.push(
3384
- `(created >= -${options.days}d OR resolved >= -${options.days}d OR updated >= -${options.days}d)`
3384
+ `(created >= -${options.days}d OR resolutiondate >= -${options.days}d OR updated >= -${options.days}d)`
3385
3385
  );
3386
3386
  }
3387
3387
  if (options.author) {
3388
3388
  if (options.author.includes("@")) {
3389
- queries.push("(creator = currentUser() OR assignee = currentUser())");
3389
+ queries.push(
3390
+ "(creator = currentUser() OR reporter = currentUser() OR assignee = currentUser())"
3391
+ );
3390
3392
  } else {
3391
- queries.push(`(creator = "${options.author}" OR assignee = "${options.author}")`);
3393
+ queries.push(
3394
+ `(creator = "${options.author}" OR reporter = "${options.author}" OR assignee = "${options.author}")`
3395
+ );
3392
3396
  }
3393
3397
  } else {
3394
- queries.push("(creator = currentUser() OR assignee = currentUser())");
3398
+ queries.push(
3399
+ "(creator = currentUser() OR reporter = currentUser() OR assignee = currentUser())"
3400
+ );
3395
3401
  }
3396
3402
  if (options.jql) {
3397
3403
  queries.push(`(${options.jql})`);
@@ -3413,15 +3419,23 @@ var JiraService = class {
3413
3419
  }
3414
3420
  /**
3415
3421
  * Determine the type of contribution the current user made to an issue
3416
- * Returns: 'created' | 'assigned-resolved' | 'edited'
3422
+ * Returns: 'created' | 'reported' | 'assigned-resolved' | 'edited'
3417
3423
  */
3418
3424
  async determineJiraContributionType(issue, userEmail) {
3419
- if (issue.fields.creator.emailAddress === userEmail) {
3425
+ const isCreator = issue.fields.creator.emailAddress === userEmail;
3426
+ const isReporter = issue.fields.reporter?.emailAddress === userEmail;
3427
+ if (isCreator) {
3420
3428
  return {
3421
3429
  type: "created",
3422
3430
  details: `Created ${issue.fields.issuetype.name}: ${issue.fields.status.name}`
3423
3431
  };
3424
3432
  }
3433
+ if (isReporter && !isCreator) {
3434
+ return {
3435
+ type: "reported",
3436
+ details: `Reported ${issue.fields.issuetype.name}: ${issue.fields.status.name}`
3437
+ };
3438
+ }
3425
3439
  const isAssigned = issue.fields.assignee?.emailAddress === userEmail;
3426
3440
  const isResolved = issue.fields.resolutiondate !== null && issue.fields.resolutiondate !== void 0;
3427
3441
  const userEdits = issue.changelog?.histories?.filter((history) => history.author.emailAddress === userEmail) || [];
@@ -3450,6 +3464,8 @@ var JiraService = class {
3450
3464
  const multipliers = {
3451
3465
  created: 1,
3452
3466
  // 100% - highest impact (created the issue)
3467
+ reported: 0.9,
3468
+ // 90% - very high impact (reported/initiated the issue)
3453
3469
  "assigned-resolved": 0.8,
3454
3470
  // 80% - high impact (owned and resolved)
3455
3471
  edited: 0.4
@@ -3470,6 +3486,7 @@ var JiraService = class {
3470
3486
  "updated",
3471
3487
  "resolutiondate",
3472
3488
  "creator",
3489
+ "reporter",
3473
3490
  "assignee",
3474
3491
  "status",
3475
3492
  "issuetype"
@@ -3579,6 +3596,8 @@ var JiraService = class {
3579
3596
  if (contribution) {
3580
3597
  if (contribution.type === "created") {
3581
3598
  contributionPrefix = "\u{1F3AB} Created: ";
3599
+ } else if (contribution.type === "reported") {
3600
+ contributionPrefix = "\u{1F4CB} Reported: ";
3582
3601
  } else if (contribution.type === "assigned-resolved") {
3583
3602
  contributionPrefix = "\u2705 Resolved: ";
3584
3603
  } else {
@@ -3605,7 +3624,7 @@ ${truncatedDesc}`;
3605
3624
  }
3606
3625
  }
3607
3626
  let date;
3608
- if (contribution?.type === "created") {
3627
+ if (contribution?.type === "created" || contribution?.type === "reported") {
3609
3628
  date = issue.fields.created;
3610
3629
  } else if (contribution?.type === "assigned-resolved" && issue.fields.resolutiondate) {
3611
3630
  date = issue.fields.resolutiondate;
@@ -3840,24 +3859,24 @@ var ConfluenceService = class {
3840
3859
  if (page.history?.createdBy?.email === userEmail) {
3841
3860
  return {
3842
3861
  type: "created",
3843
- details: `Created page with ${page.version.number} version${page.version.number > 1 ? "s" : ""}`
3862
+ details: `Created page with ${page.version?.number || 1} version${(page.version?.number || 1) > 1 ? "s" : ""}`
3844
3863
  };
3845
3864
  }
3846
- const hasEdits = page.version.by.email === userEmail && page.version.number > 1;
3865
+ const hasEdits = page.version?.by?.email === userEmail && (page.version?.number || 0) > 1;
3847
3866
  const userComments = page.children?.comment?.results?.filter(
3848
- (comment) => comment.version.by.email === userEmail
3867
+ (comment) => comment.version?.by?.email === userEmail
3849
3868
  ) || [];
3850
3869
  const hasComments = userComments.length > 0;
3851
3870
  if (hasEdits && hasComments) {
3852
3871
  return {
3853
3872
  type: "edited",
3854
- details: `Edited page (v${page.version.number}) and added ${userComments.length} comment${userComments.length > 1 ? "s" : ""}`
3873
+ details: `Edited page (v${page.version?.number || 1}) and added ${userComments.length} comment${userComments.length > 1 ? "s" : ""}`
3855
3874
  };
3856
3875
  }
3857
3876
  if (hasEdits) {
3858
3877
  return {
3859
3878
  type: "edited",
3860
- details: `Edited page to version ${page.version.number}`
3879
+ details: `Edited page to version ${page.version?.number || 1}`
3861
3880
  };
3862
3881
  }
3863
3882
  if (hasComments) {
@@ -4021,11 +4040,11 @@ var ConfluenceService = class {
4021
4040
  message = `${contributionPrefix}${page.title}
4022
4041
 
4023
4042
  ${contribution.details}
4024
- [Confluence Page v${page.version.number}]`;
4043
+ [Confluence Page v${page.version?.number || 1}]`;
4025
4044
  } else {
4026
4045
  message = `${page.title}
4027
4046
 
4028
- [Confluence Page v${page.version.number}]`;
4047
+ [Confluence Page v${page.version?.number || 1}]`;
4029
4048
  }
4030
4049
  let baseUrl = "https://confluence.atlassian.net";
4031
4050
  if (instanceUrl) {
@@ -4042,9 +4061,9 @@ ${contribution.details}
4042
4061
  const url = `${baseUrl}/wiki${page._links.webui}`;
4043
4062
  const baseSize = this.estimatePageSize(page);
4044
4063
  const impactScore = contribution ? this.calculateContributionImpact(contribution.type, baseSize) : baseSize;
4045
- const author = page.history?.createdBy?.displayName || page.version.by.displayName;
4046
- const authorEmail = page.history?.createdBy?.email || page.version.by.email;
4047
- const date = contribution?.type === "created" ? page.history?.createdDate || page.version.when : page.version.when;
4064
+ const author = page.history?.createdBy?.displayName || page.version?.by?.displayName || "Unknown Author";
4065
+ const authorEmail = page.history?.createdBy?.email || page.version?.by?.email || "unknown@example.com";
4066
+ const date = contribution?.type === "created" ? page.history?.createdDate || page.version?.when : page.version?.when || (/* @__PURE__ */ new Date()).toISOString();
4048
4067
  return {
4049
4068
  sha: page.id,
4050
4069
  message,