@bragduck/cli 2.9.7 → 2.10.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.
@@ -3379,12 +3379,19 @@ var JiraService = class {
3379
3379
  */
3380
3380
  buildJQL(options) {
3381
3381
  const queries = [];
3382
- queries.push("status IN (Done, Resolved, Closed)");
3383
3382
  if (options.days) {
3384
- queries.push(`updated >= -${options.days}d`);
3383
+ queries.push(
3384
+ `(created >= -${options.days}d OR resolved >= -${options.days}d OR updated >= -${options.days}d)`
3385
+ );
3385
3386
  }
3386
3387
  if (options.author) {
3387
- queries.push(`creator = "${options.author}"`);
3388
+ if (options.author.includes("@")) {
3389
+ queries.push("(creator = currentUser() OR assignee = currentUser())");
3390
+ } else {
3391
+ queries.push(`(creator = "${options.author}" OR assignee = "${options.author}")`);
3392
+ }
3393
+ } else {
3394
+ queries.push("(creator = currentUser() OR assignee = currentUser())");
3388
3395
  }
3389
3396
  if (options.jql) {
3390
3397
  queries.push(`(${options.jql})`);
@@ -3409,6 +3416,7 @@ var JiraService = class {
3409
3416
  */
3410
3417
  async getIssues(options = {}) {
3411
3418
  const jql = this.buildJQL(options);
3419
+ logger.debug(`Using JQL query: ${jql}`);
3412
3420
  const fields = [
3413
3421
  "summary",
3414
3422
  "description",
@@ -3696,15 +3704,26 @@ var ConfluenceService = class {
3696
3704
  }
3697
3705
  /**
3698
3706
  * Build CQL query from options
3707
+ * Returns empty string if no filters need CQL (will use simple endpoint instead)
3699
3708
  */
3700
3709
  buildCQL(options) {
3710
+ if (!options.days && !options.author && !options.cql) {
3711
+ return "";
3712
+ }
3701
3713
  const queries = [];
3702
- queries.push("type=page");
3714
+ queries.push("type = page");
3715
+ queries.push("status = current");
3703
3716
  if (options.days) {
3704
- queries.push(`lastModified >= now("-${options.days}d")`);
3717
+ queries.push(`lastModified >= -${options.days}d`);
3705
3718
  }
3706
3719
  if (options.author) {
3707
- queries.push(`creator = "${options.author}"`);
3720
+ if (options.author.includes("@")) {
3721
+ queries.push("(creator = currentUser() OR contributor = currentUser())");
3722
+ } else {
3723
+ queries.push(`(creator = "${options.author}" OR contributor = "${options.author}")`);
3724
+ }
3725
+ } else {
3726
+ queries.push("(creator = currentUser() OR contributor = currentUser())");
3708
3727
  }
3709
3728
  if (options.cql) {
3710
3729
  queries.push(`(${options.cql})`);
@@ -3723,6 +3742,9 @@ var ConfluenceService = class {
3723
3742
  */
3724
3743
  async getPages(options = {}) {
3725
3744
  const cql = this.buildCQL(options);
3745
+ if (cql) {
3746
+ logger.debug(`Using CQL query: ${cql}`);
3747
+ }
3726
3748
  const allPages = [];
3727
3749
  const seenPageIds = /* @__PURE__ */ new Set();
3728
3750
  let start = 0;
@@ -3737,18 +3759,29 @@ var ConfluenceService = class {
3737
3759
  );
3738
3760
  break;
3739
3761
  }
3740
- const params = {
3741
- type: "page",
3742
- status: "current",
3743
- start: start.toString(),
3744
- limit: limit.toString(),
3745
- expand: "version,body.storage"
3746
- };
3762
+ let endpoint;
3763
+ let params;
3747
3764
  if (cql) {
3748
- params.cql = cql;
3765
+ params = {
3766
+ cql,
3767
+ start: start.toString(),
3768
+ limit: limit.toString(),
3769
+ expand: "version,body.storage"
3770
+ };
3771
+ const queryString = Object.entries(params).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
3772
+ endpoint = `/wiki/rest/api/content/search?${queryString}`;
3773
+ } else {
3774
+ logger.debug("Using simple content list (no CQL filters)");
3775
+ params = {
3776
+ type: "page",
3777
+ status: "current",
3778
+ start: start.toString(),
3779
+ limit: limit.toString(),
3780
+ expand: "version,body.storage"
3781
+ };
3782
+ const queryString = Object.entries(params).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
3783
+ endpoint = `/wiki/rest/api/content?${queryString}`;
3749
3784
  }
3750
- const queryString = Object.entries(params).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
3751
- const endpoint = `/wiki/rest/api/content?${queryString}`;
3752
3785
  try {
3753
3786
  const response = await this.request(endpoint);
3754
3787
  if (response.results.length === 0) {
@@ -3801,7 +3834,7 @@ var ConfluenceService = class {
3801
3834
  return allPages.map((page) => this.transformPageToCommit(page));
3802
3835
  }
3803
3836
  /**
3804
- * Fetch pages for the current authenticated user
3837
+ * Fetch pages for the current authenticated user (created or contributed to)
3805
3838
  */
3806
3839
  async getPagesByCurrentUser(options = {}) {
3807
3840
  const email = await this.getCurrentUser();
@@ -4700,6 +4733,7 @@ async function syncAllAuthenticatedServices(options) {
4700
4733
  const results = [];
4701
4734
  for (let i = 0; i < servicesToSync.length; i++) {
4702
4735
  const service = servicesToSync[i];
4736
+ if (!service) continue;
4703
4737
  const serviceLabel = service.charAt(0).toUpperCase() + service.slice(1);
4704
4738
  logger.log(
4705
4739
  colors.highlight(`\u2501\u2501\u2501 Syncing ${i + 1}/${servicesToSync.length}: ${serviceLabel} \u2501\u2501\u2501`)