feat(document): add comments, count, add-tag and remove-tag commands - #170
Open
lollipop-onl wants to merge 2 commits into
Open
lollipop-onl wants to merge 2 commits into
lollipop-onl wants to merge 2 commits into
Conversation
Backlog's document API now covers comment threads, a per-project count and tag management, but backlog-js (including 0.20.1) has no methods for them, so they were only reachable through `bee api` with hand-written paths and parameters such as `tagNames[]` and `projectIdOrKey`. The requests live in @repo/backlog-utils as typed wrappers over backlog-js's generic request helpers, so switching to the library methods once they ship touches one file. Tags are positional arguments rather than a comma-split flag because tag names may contain commas; the add/remove prefix follows `bee project add-user` / `remove-user`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 4 tasks
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4 tasks done
Running the commands against a real space showed that POST tags echoes only the tags given in the request, that adding a tag the document already has and removing one it lacks both succeed silently, and that new tag names are created. The help now says so, since the success message alone would claim a removal that never happened. The comment types now share one base entry instead of deriving the thread from the reply with Omit, and `document count` drops a `json === true` branch that `opt.json()`'s preset makes unreachable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Summary
Adds the document commands whose endpoints backlog-js does not wrap yet (including 0.20.1):
bee document comments <document>GET /documents/:documentId/commentsbee document count -p PROJECTGET /documents/countbee document add-tag <document> <tags...>POST /documents/:documentId/tagsbee document remove-tag <document> <tags...>DELETE /documents/:documentId/tags(204)@repo/backlog-utils(document-api.ts) over backlog-js's genericget/post/delete, so moving to library methods later touches one file. Array params go through backlog-js'sqsbracket encoding, which yieldstagNames[].commentsprints each thread's replies one level deeper, using theplaintext (thecontentfield is a ProseMirror JSON tree).--jsonreturns the raw response.POST tagsechoes only the tags in the request, new tag names are created, re-adding a tag and removing one the document lacks both succeed silently. The help says so.a,bworks). Theadd-/remove-prefix followsbee project add-user/remove-user.generate:skill).Related issues are handled separately in #172 (backlog-js already wraps those endpoints).
Test plan
vp checkpassesvp test: all tests pass, including new command tests anddocument-api.test.tsvp run --filter @nulab/bee generate:skill:checkpassesbee document --help/bee document add-tag --helprendercount,comments(threads without replies),add-tag/remove-tagincluding duplicates, missing tags and a comma in the name; test document deleted afterwardscommentswith replies. No live document had any, and the API cannot create them.🤖 Generated with Claude Code