feat: add json metadata and storage read support#115
Conversation
b129543 to
9d819f4
Compare
|
Thanks for putting this together. The added docs and test coverage are appreciated, especially around the new JSON and storage-format flows. |
pchuri
left a comment
There was a problem hiding this comment.
I left a couple of inline notes below.
| limit: limit, | ||
| // Fetch lightweight payload; content fetched on-demand when copying | ||
| expand: 'space,version' | ||
| expand: 'space,version,ancestors' |
There was a problem hiding this comment.
Nice addition overall. One concern: getChildPages() is also used by children --recursive, recursive export, and copy-tree, so always requesting ancestors makes those paths fetch and retain the full ancestor chain even when they only need title/id/space. On large trees this can become a noticeable payload and memory regression. Could ancestor expansion be made opt-in for the JSON metadata path instead?
There was a problem hiding this comment.
Good call. I changed getChildPages() so ancestor expansion is opt-in instead of always enabled. Recursive traversal now only requests ancestors for the JSON metadata path, so children --recursive, export, and copy-tree keep using the lighter payload by default.
| title: raw?.title || '', | ||
| type: raw?.type || null, | ||
| status: raw?.status || null, | ||
| space, |
There was a problem hiding this comment.
info --format json is positioned as machine-readable output, but this currently forwards raw.space as-is. That leaks the Cloud/DC REST shape into the public JSON contract, so scripts may see different nested fields depending on deployment or API version. I think it would be safer to normalize space here, or omit it and rely on spaceKey.
There was a problem hiding this comment.
Agreed. I normalized space to a stable { key, name } shape in the machine-readable page metadata instead of passing through the raw REST payload. spaceKey is still present as the flat field for scripts that want the simplest contract.
madrover
left a comment
There was a problem hiding this comment.
Addressed both inline comments: ancestor fetching is now opt-in for the JSON metadata flow, and info --format json now returns a normalized space object. Tests and lint are passing locally.
| limit: limit, | ||
| // Fetch lightweight payload; content fetched on-demand when copying | ||
| expand: 'space,version' | ||
| expand: 'space,version,ancestors' |
There was a problem hiding this comment.
Good call. I changed getChildPages() so ancestor expansion is opt-in instead of always enabled. Recursive traversal now only requests ancestors for the JSON metadata path, so children --recursive, export, and copy-tree keep using the lighter payload by default.
| title: raw?.title || '', | ||
| type: raw?.type || null, | ||
| status: raw?.status || null, | ||
| space, |
There was a problem hiding this comment.
Agreed. I normalized space to a stable { key, name } shape in the machine-readable page metadata instead of passing through the raw REST payload. spaceKey is still present as the flat field for scripts that want the simplest contract.
# [1.32.0](v1.31.1...v1.32.0) (2026-04-24) ### Features * add json metadata and storage read support ([#115](#115)) ([179fe4f](179fe4f))
|
🎉 This PR is included in version 1.32.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
Add machine-readable metadata and native storage read support to improve
confluence-clifor automation and scripting use cases.This PR:
confluence info --format jsonconfluence read <pageId> --format storageconfluence children --format jsonwith stable metadata fields such asid,title,type,status,spaceKey,parentId,version, andurlType of Change
Testing
Checklist
Screenshots (if applicable)
Not applicable.
Additional Context
Local verification:
npm run lint -- --quietnpm test -- --runInBandNotes:
info,read, andchildrenremains unchangedinfo --format jsonreturns a single structured objectread --format storagereturns the page body in Confluence storage representation through the normal read pathchildren --format jsonnow returns structured metadata records for direct and recursive listings