Skip to content

feat(client): add limit configurable in getSpaces and spaces command#163

Merged
pchuri merged 2 commits into
pchuri:mainfrom
rsk-ymst:feat/get-spaces-limit-params
May 3, 2026
Merged

feat(client): add limit configurable in getSpaces and spaces command#163
pchuri merged 2 commits into
pchuri:mainfrom
rsk-ymst:feat/get-spaces-limit-params

Conversation

@rsk-ymst
Copy link
Copy Markdown
Contributor

@rsk-ymst rsk-ymst commented May 2, 2026

Description

Previously the spaces API call had a hardcoded limit of 500.
This change allows callers to request more than 500 spaces by passing an explicit limit to getSpaces(),
and exposes it as a --limit option on the confluence spaces CLI command.

  • getSpaces(limit = 500): limit is now a parameter (default 500)
  • confluence spaces --limit <n>: new CLI option, defaults to 500
  • Add tests verifying the limit param is forwarded to the API request

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Code refactoring

Testing

  • Tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have made corresponding changes to the documentation

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes generate no new warnings

closes #166

Previously the spaces API call had a hardcoded limit of 500.
This change allows callers to request more than 500 spaces by
passing an explicit limit to getSpaces(), and exposes it as a
--limit option on the `confluence spaces` CLI command.

- getSpaces(limit = 500): limit is now a parameter (default 500)
- `confluence spaces --limit <n>`: new CLI option, defaults to 500
- Add tests verifying the limit param is forwarded to the API request
@rsk-ymst rsk-ymst force-pushed the feat/get-spaces-limit-params branch from 0c0bdf9 to b071307 Compare May 2, 2026 06:38
Comment thread lib/confluence-client.js
}

/**
* Get all spaces
Copy link
Copy Markdown
Contributor Author

@rsk-ymst rsk-ymst May 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed "all" since the command does not retrieve all spaces by default.

Comment thread bin/confluence.js
// List spaces command
program
.command('spaces')
.description('List all Confluence spaces')
Copy link
Copy Markdown
Contributor Author

@rsk-ymst rsk-ymst May 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed "all" since the command does not retrieve all spaces by default.

@rsk-ymst rsk-ymst changed the title feat(client): add limit configurable in getSpaces and spaces command WIP: feat(client): add limit configurable in getSpaces and spaces command May 2, 2026
The spaces command fetches up to --limit results (default 500),
so describing it as "all spaces" is inaccurate. Replace with
"spaces" or "available spaces" throughout docs and examples.
@rsk-ymst rsk-ymst changed the title WIP: feat(client): add limit configurable in getSpaces and spaces command feat(client): add limit configurable in getSpaces and spaces command May 3, 2026
@rsk-ymst rsk-ymst marked this pull request as ready for review May 3, 2026 02:18
Copy link
Copy Markdown
Owner

@pchuri pchuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! Clean, focused change that addresses #166 well, and the second commit polishing the "all" wording across docs/examples/SKILL.md after self-review is much appreciated.

LGTM — approving. A couple of optional nits that could be addressed here or in a follow-up:

  1. Input validationparseInt(options.limit) in bin/confluence.js will produce NaN for --limit abc and accepts non-positive values. The attachments, properties, and comments commands already use this pattern for consistency:

    const limit = parseInt(options.limit, 10);
    if (Number.isNaN(limit) || limit <= 0) {
      throw new Error('Limit must be a positive number.');
    }
  2. parseInt radix — minor, but newer commands in this file pass 10 explicitly (parseInt(x, 10)).

  3. (Out of scope, just flagging) The Confluence /space endpoint may cap results server-side, so --limit 1000 may not always return 1000 entries in a single call. True "fetch more than the server cap" support would need pagination via start (similar to getAllProperties). Worth a follow-up issue if users hit this.

None of these are blockers — the PR is a clear improvement as-is. Thanks again!

@pchuri pchuri merged commit c4d3830 into pchuri:main May 3, 2026
6 checks passed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 3, 2026

🎉 This PR is included in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@rsk-ymst
Copy link
Copy Markdown
Contributor Author

rsk-ymst commented May 3, 2026

Thanks for the review and feedback! I really appreciate it :)
I'll keep an eye on this project going forward !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Allow configurable result limit for confluence spaces command

2 participants