@bragduck/cli 2.9.7 → 2.10.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.
@@ -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,10 +3704,15 @@ 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
3714
  queries.push("type=page");
3715
+ queries.push("status=current");
3703
3716
  if (options.days) {
3704
3717
  queries.push(`lastModified >= now("-${options.days}d")`);
3705
3718
  }
@@ -3737,18 +3750,30 @@ var ConfluenceService = class {
3737
3750
  );
3738
3751
  break;
3739
3752
  }
3740
- const params = {
3741
- type: "page",
3742
- status: "current",
3743
- start: start.toString(),
3744
- limit: limit.toString(),
3745
- expand: "version,body.storage"
3746
- };
3753
+ let endpoint;
3754
+ let params;
3747
3755
  if (cql) {
3748
- params.cql = cql;
3756
+ logger.debug(`Using CQL search: ${cql}`);
3757
+ params = {
3758
+ cql,
3759
+ start: start.toString(),
3760
+ limit: limit.toString(),
3761
+ expand: "version,body.storage"
3762
+ };
3763
+ const queryString = Object.entries(params).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
3764
+ endpoint = `/wiki/rest/api/content/search?${queryString}`;
3765
+ } else {
3766
+ logger.debug("Using simple content list (no CQL filters)");
3767
+ params = {
3768
+ type: "page",
3769
+ status: "current",
3770
+ start: start.toString(),
3771
+ limit: limit.toString(),
3772
+ expand: "version,body.storage"
3773
+ };
3774
+ const queryString = Object.entries(params).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
3775
+ endpoint = `/wiki/rest/api/content?${queryString}`;
3749
3776
  }
3750
- const queryString = Object.entries(params).map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join("&");
3751
- const endpoint = `/wiki/rest/api/content?${queryString}`;
3752
3777
  try {
3753
3778
  const response = await this.request(endpoint);
3754
3779
  if (response.results.length === 0) {
@@ -4700,6 +4725,7 @@ async function syncAllAuthenticatedServices(options) {
4700
4725
  const results = [];
4701
4726
  for (let i = 0; i < servicesToSync.length; i++) {
4702
4727
  const service = servicesToSync[i];
4728
+ if (!service) continue;
4703
4729
  const serviceLabel = service.charAt(0).toUpperCase() + service.slice(1);
4704
4730
  logger.log(
4705
4731
  colors.highlight(`\u2501\u2501\u2501 Syncing ${i + 1}/${servicesToSync.length}: ${serviceLabel} \u2501\u2501\u2501`)