Skip to content

feat: add content property commands (list, get, set, delete)#38

Merged
pchuri merged 4 commits intopchuri:mainfrom
mshddev:feature/add-content-properties
Feb 15, 2026
Merged

feat: add content property commands (list, get, set, delete)#38
pchuri merged 4 commits intopchuri:mainfrom
mshddev:feature/add-content-properties

Conversation

@mshddev
Copy link
Copy Markdown
Contributor

@mshddev mshddev commented Feb 14, 2026

Summary

  • Add four new commands for managing Confluence content properties (key-value metadata on pages)
  • property-list — list all properties on a page
  • property-get — get a single property by key
  • property-set — create or update a property with auto-versioning (accepts --value JSON or --file)
  • property-delete — delete a property with confirmation prompt

Changes

  • 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 handling
  • tests/confluence-client.test.js — 11 new tests covering success, error, URL resolution, and auto-versioning
  • README.md — Feature bullet, commands table entries, and usage examples section

Test plan

  • npm test — all 60 tests pass (11 new)
  • node bin/confluence.js property-list --help — help text renders correctly
  • node bin/confluence.js --help — all 4 new commands appear in help output

Closes #37

🤖 Generated with Claude Code

- 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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread lib/confluence-client.js Outdated
Comment thread lib/confluence-client.js
Comment on lines +920 to +923
async deleteProperty(pageIdOrUrl, key) {
const pageId = await this.extractPageId(pageIdOrUrl);
await this.client.delete(`/content/${pageId}/property/${key}`);
return { pageId: String(pageId), key };
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

deleteProperty interpolates key directly into the URL path. Use URL-encoding for the key to ensure properties with reserved characters can be deleted reliably.

Copilot uses AI. Check for mistakes.
Comment thread README.md Outdated
Comment on lines +767 to +771
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' },
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment thread lib/confluence-client.js
Comment on lines +887 to +890
async getProperty(pageIdOrUrl, key) {
const pageId = await this.extractPageId(pageIdOrUrl);
const response = await this.client.get(`/content/${pageId}/property/${key}`);
return response.data;
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
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>
@mshddev
Copy link
Copy Markdown
Contributor Author

mshddev commented Feb 14, 2026

@pchuri All 5 review comments addressed in fdc63d6:

  • Property keys are now encodeURIComponent()-encoded in all URL paths (getProperty, setProperty, deleteProperty)
  • README updated to <pageId_or_url> for property commands
  • Added test covering keys with reserved characters (my prop/key)

Ready for re-review when you get a chance.

pchuri

This comment was marked as duplicate.

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 additions! A few things to consider:

  1. Pagination: listProperties only returns the first page. The Confluence API paginates properties, so consider adding limit/start + nextStart support (and a getAllProperties helper) to avoid missing data (lib/confluence-client.js:878).
  2. CLI: property-list currently has no pagination controls. Adding --limit/--start/--all (similar to comments/attachments) would let users access full results (bin/confluence.js:602).
  3. Tests: URL-encoding coverage only exists for getProperty. Add cases for setProperty and deleteProperty to 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>
@mshddev
Copy link
Copy Markdown
Contributor Author

mshddev commented Feb 14, 2026

Thanks for the additions! A few things to consider:

  1. Pagination: listProperties only returns the first page. The Confluence API paginates properties, so consider adding limit/start + nextStart support (and a getAllProperties helper) to avoid missing data (lib/confluence-client.js:878).
  2. CLI: property-list currently has no pagination controls. Adding --limit/--start/--all (similar to comments/attachments) would let users access full results (bin/confluence.js:602).
  3. Tests: URL-encoding coverage only exists for getProperty. Add cases for setProperty and deleteProperty to prevent regressions (tests/confluence-client.test.js:845).

good points. Updated. Please recheck @pchuri

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.

Thank you for the follow-up changes. I noticed one CI-related issue and a small doc update:

  • CI: npm audit --audit-level moderate fails because of the markdown-it advisory (>=13.0.0 <14.1.1). Would you mind bumping markdown-it to ^14.1.1 (or running npm audit fix) and updating package-lock.json? That should clear the audit gate.
  • Docs: property-list now supports --limit/--start/--all, but the README command table still lists only --format. Could we update the options list?

Thanks!

@mshddev
Copy link
Copy Markdown
Contributor Author

mshddev commented Feb 15, 2026

Thank you for the follow-up changes. I noticed one CI-related issue and a small doc update:

  • CI: npm audit --audit-level moderate fails because of the markdown-it advisory (>=13.0.0 <14.1.1). Would you mind bumping markdown-it to ^14.1.1 (or running npm audit fix) and updating package-lock.json? That should clear the audit gate.
  • Docs: property-list now 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

@pchuri pchuri merged commit 506515d into pchuri:main Feb 15, 2026
5 checks passed
github-actions Bot pushed a commit that referenced this pull request Feb 15, 2026
# [1.18.0](v1.17.0...v1.18.0) (2026-02-15)

### Features

* add content property commands (list, get, set, delete) ([#38](#38)) ([506515d](506515d)), closes [#37](#37)
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.18.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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] Add support for content properties (get, set, update, delete)

3 participants