feat: list folders with the children command - #224
Merged
Conversation
Add a --type <pages|folders|all> option to the children command. The default remains pages for full backward compatibility. Folders are a Confluence Cloud content type, fetched via the v2 direct-children endpoint; on Server/DC the CLI warns and lists no folders instead of failing. Each item's content type is surfaced in both JSON (type field) and human-readable output (a [folder] tag and folder tree icon).
github-actions Bot
pushed a commit
that referenced
this pull request
Aug 6, 2026
# [2.20.0](v2.19.1...v2.20.0) (2026-08-06) ### Features * list folders with the children command ([#224](#224)) ([91a3b9d](91a3b9d))
|
🎉 This PR is included in version 2.20.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Implement GitHub issue #223: add support for listing folders as children in the 'confluence children ' command.
Goal: Confluence Cloud supports folders as a content type in page hierarchies, but 'children' only returned child pages, so folders could not be discovered/traversed. Requester mirrors repo docs to Confluence via CI/CD and needs folders visible to replicate directory structure.
What was implemented:
Deliberate scope decision: folder listing covers DIRECT children. Combining --recursive with --type folders/all recurses pages as before but lists only top-level folders; deep folder-tree traversal was intentionally left out as it would need a separate v2 traversal engine and is beyond the issue's acceptance criteria.
Docs: README (usage + --type explanation + Cloud-only note), plugin SKILL.md option table, and --help all document the option.
Tests: added client coverage for getChildFolders (v2 endpoint + folder filtering) and CLI coverage for default, folders, all, non-Cloud graceful degradation, and invalid --type. Full suite (857 tests) and eslint pass locally.
Constraint: public open-source repo; all public text is English with no company-internal references. Conventional commit, no AI/tool co-author.
What Changed
--type <pages|folders|all>tochildren, preserving page-only output by default.Risk Assessment
✅ Low: The change is well-bounded, satisfies the stated intent, preserves legacy page output, and resolves the previously identified pagination, warning, URL, and scope-documentation risks.
Testing
Focused and full Jest suites passed, while real CLI verification demonstrated legacy-compatible default output, v2 folder discovery, content-type presentation, direct-only folder traversal, valid Server/DC degradation, validation errors, and documented help.
Evidence: End-to-end CLI transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 4 issues found → auto-fixed (2) ✅
bin/confluence.js:824- The required criterion says Server/DCfolders|all“prints a stderr warning,” butelse if (!jsonMode)suppresses it for JSON output. Remove this guard or explicitly revise the acceptance criterion.lib/confluence-client.js:1793- Only the first v2 response is processed. The API paginates via itsLinkheader, so folders after the first 250 children are silently omitted—potentially all folders if pages precede them. Follownextuntil exhausted before filtering. See Atlassian’s API documentation.bin/confluence.js:822- Folders are passed into renderers that build URLs frompage.space.key, but normalized folders have nospace;--show-urltherefore prints/spaces/undefined/pages/<folder-id>in list and tree output. Preserve a usable folder URL or omit the URL when unavailable.README.md:591- The v2 direct-children endpoint requiresread:hierarchical-content:confluence, but the documented scoped-token minimum omits it, so least-privilege users following the README/SKILL guidance may receive 401 responses. Document the scope and include it in the scoped-token 401 hint. See Atlassian’s endpoint documentation.🔧 Fix: Fix folder pagination and output edge cases
2 issues (1 error, 1 warning) still open:
bin/confluence.js:928- Required criterion: defaultpagesoutput must remain “byte-compatible.” The newif (child.url) return child.urlchangeschildren --show-urloutput from the legacy synthesized/spaces/<key>/pages/<id>URL to the API-provided URL, commonly including the page title. Preserve legacy URL generation for pages and only suppress unavailable folder URLs.README.md:361-read:hierarchical-content:confluenceis a granular scope, but README and SKILL now include it under “classic scopes.” Rename the guidance to distinguish the required granular scope so scoped-token users can locate it correctly.🔧 Fix: Preserve legacy page URLs and clarify folder scope
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
npm test -- --runInBand tests/confluence-client.test.js tests/metadata-cli.test.jsRealnode bin/index.jsprocesses against a local mock Confluence API: default pages, folders JSON, combined list, recursive tree, Server/DC degradation, invalid type, and helpnpm test -- --runInBand✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.