feat: add content property commands (list, get, set, delete)#38
feat: add content property commands (list, get, set, delete)#38pchuri merged 4 commits intopchuri:mainfrom
Conversation
- Add listProperties, getProperty, setProperty, deleteProperty to client - Add property-list, property-get, property-set, property-delete CLI commands - setProperty auto-versions (creates at v1, increments on update) - Add 11 tests for content property methods - Update README with commands table and usage examples Closes pchuri#37 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds first-class CLI support for Confluence content properties (entity properties) by extending the Confluence client and wiring new commands into the CLI, with accompanying tests and documentation updates.
Changes:
- Added ConfluenceClient methods to list/get/set (with auto-versioning)/delete content properties.
- Added four CLI commands:
property-list,property-get,property-set,property-delete(with formatting and delete confirmation). - Added Jest tests for the new client methods and updated README with usage and command-table entries.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
lib/confluence-client.js |
Adds property CRUD methods (including auto-versioning for set). |
bin/confluence.js |
Adds 4 new CLI commands for managing content properties. |
tests/confluence-client.test.js |
Adds tests covering property list/get/set/delete and versioning behaviors. |
README.md |
Documents the new “Content Properties” feature, commands, and examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| async deleteProperty(pageIdOrUrl, key) { | ||
| const pageId = await this.extractPageId(pageIdOrUrl); | ||
| await this.client.delete(`/content/${pageId}/property/${key}`); | ||
| return { pageId: String(pageId), key }; |
There was a problem hiding this comment.
deleteProperty interpolates key directly into the URL path. Use URL-encoding for the key to ensure properties with reserved characters can be deleted reliably.
| test('getProperty should return property data', async () => { | ||
| const mock = new MockAdapter(client.client); | ||
| mock.onGet('/content/123/property/color').reply(200, { | ||
| key: 'color', | ||
| value: { hex: '#ff0000' }, |
There was a problem hiding this comment.
Consider adding a test case for a property key that requires URL-encoding (e.g., contains a space or "/"). This will catch regressions once the client encodes keys in request paths.
| async getProperty(pageIdOrUrl, key) { | ||
| const pageId = await this.extractPageId(pageIdOrUrl); | ||
| const response = await this.client.get(`/content/${pageId}/property/${key}`); | ||
| return response.data; |
There was a problem hiding this comment.
Property keys are interpolated directly into the URL path. If a key contains characters that require URL-encoding (e.g., spaces, slashes, unicode), requests will hit the wrong endpoint or fail. Encode the key when building the request URL (e.g., via encodeURIComponent) and keep the unencoded key in the request body.
Property keys containing reserved characters (spaces, slashes) would break API requests. Wrap keys with encodeURIComponent() in URL paths for getProperty, setProperty, and deleteProperty. Also update README to show <pageId_or_url> for property commands. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@pchuri All 5 review comments addressed in fdc63d6:
Ready for re-review when you get a chance. |
There was a problem hiding this comment.
Thanks for the additions! A few things to consider:
- Pagination:
listPropertiesonly returns the first page. The Confluence API paginates properties, so consider addinglimit/start+nextStartsupport (and agetAllPropertieshelper) to avoid missing data (lib/confluence-client.js:878). - CLI:
property-listcurrently has no pagination controls. Adding--limit/--start/--all(similar to comments/attachments) would let users access full results (bin/confluence.js:602). - Tests: URL-encoding coverage only exists for
getProperty. Add cases forsetPropertyanddeletePropertyto prevent regressions (tests/confluence-client.test.js:845).
…est coverage
listProperties now supports limit/start params and returns {results, nextStart}.
Added getAllProperties helper for fetching all pages. CLI property-list command
gains --limit, --start, and --all options. Added URL-encoding regression tests
for setProperty and deleteProperty.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
good points. Updated. Please recheck @pchuri |
pchuri
left a comment
There was a problem hiding this comment.
Thank you for the follow-up changes. I noticed one CI-related issue and a small doc update:
- CI:
npm audit --audit-level moderatefails because of themarkdown-itadvisory (>=13.0.0 <14.1.1). Would you mind bumpingmarkdown-itto^14.1.1(or runningnpm audit fix) and updatingpackage-lock.json? That should clear the audit gate. - Docs:
property-listnow supports--limit/--start/--all, but the README command table still lists only--format. Could we update the options list?
Thanks!
Updated! Please recheck when you have time @pchuri |
|
🎉 This PR is included in version 1.18.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
property-list— list all properties on a pageproperty-get— get a single property by keyproperty-set— create or update a property with auto-versioning (accepts--valueJSON or--file)property-delete— delete a property with confirmation promptChanges
lib/confluence-client.js— 4 new client methods (listProperties,getProperty,setProperty,deleteProperty)bin/confluence.js— 4 new CLI commands with standard analytics, chalk output, and error handlingtests/confluence-client.test.js— 11 new tests covering success, error, URL resolution, and auto-versioningREADME.md— Feature bullet, commands table entries, and usage examples sectionTest plan
npm test— all 60 tests pass (11 new)node bin/confluence.js property-list --help— help text renders correctlynode bin/confluence.js --help— all 4 new commands appear in help outputCloses #37
🤖 Generated with Claude Code