Skip to content

feat(document): add comments, count, add-tag and remove-tag commands - #170

Open
lollipop-onl wants to merge 2 commits into
mainfrom
lollipop-onl/feat-document-commands
Open

lollipop-onl wants to merge 2 commits into
mainfrom
lollipop-onl/feat-document-commands

Conversation

@lollipop-onl

@lollipop-onl lollipop-onl commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds the document commands whose endpoints backlog-js does not wrap yet (including 0.20.1):

Command Endpoint
bee document comments <document> GET /documents/:documentId/comments
bee document count -p PROJECT GET /documents/count
bee document add-tag <document> <tags...> POST /documents/:documentId/tags
bee document remove-tag <document> <tags...> DELETE /documents/:documentId/tags (204)
  • The requests are typed wrappers in @repo/backlog-utils (document-api.ts) over backlog-js's generic get / post / delete, so moving to library methods later touches one file. Array params go through backlog-js's qs bracket encoding, which yields tagNames[].
  • comments prints each thread's replies one level deeper, using the plain text (the content field is a ProseMirror JSON tree). --json returns the raw response.
  • Observed on a live space: POST tags echoes 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.
  • Tags are positional because tag names may contain commas (a tag named a,b works). The add- / remove- prefix follows bee project add-user / remove-user.
  • The Skill command table is regenerated (generate:skill).

Related issues are handled separately in #172 (backlog-js already wraps those endpoints).

Test plan

  • vp check passes
  • vp test: all tests pass, including new command tests and document-api.test.ts
  • vp run --filter @nulab/bee generate:skill:check passes
  • bee document --help / bee document add-tag --help render
  • Live space: count, comments (threads without replies), add-tag / remove-tag including duplicates, missing tags and a comma in the name; test document deleted afterwards
  • comments with replies. No live document had any, and the API cannot create them.

🤖 Generated with Claude Code

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>
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 92.87% 1980 / 2132
🔵 Statements 93.07% 2069 / 2223
🔵 Functions 93.04% 468 / 503
🔵 Branches 80.72% 850 / 1053
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/cli/src/commands/document/add-tag.ts 100% 100% 100% 100%
apps/cli/src/commands/document/comments.ts 100% 100% 100% 100%
apps/cli/src/commands/document/count.ts 100% 100% 100% 100%
apps/cli/src/commands/document/remove-tag.ts 100% 100% 100% 100%
packages/backlog-utils/src/document-api.ts 100% 100% 100% 100%
Generated in workflow #539 for commit e01a978 by the Vitest Coverage Report Action

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant