feat: show tags in zhe get detail and zhe list table#41
Merged
Conversation
Add a getLinkTagMap helper on ScopedDB that fetches the tag-id arrays for a batch of links in a single query (chunked to stay within D1's parameter limit and ownership-checked via JOIN to links). Extend linkToResponse with an optional tagIds parameter (defaults to []) and pass the per-link arrays from the list and detail routes so clients can render tag information without an extra round trip.
`zhe get` now renders a `Tags:` line in the human detail view when the link has any tags. Tag IDs are resolved to names via a best-effort `listTags` call (falls back to the raw IDs if the request fails). `zhe list` gains a `--show-tags` flag to opt into a TAGS column in the default and wide table modes. The column is also auto-enabled when `--tag` is used to filter, since the user clearly cares about tags in that case. The column stays off by default to keep the table compact.
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.
Closes #39
Summary
/api/v1/linksand/api/v1/links/[id]now returntagIds: string[]for each link, fetched in a single batched query via a newScopedDB.getLinkTagMaphelper (chunked to stay within D1's parameter limit, ownership-checked via JOIN tolinks).zhe get: Renders aTags:line in the human detail view when the link has any tags. Tag IDs are resolved to names via a best-effortlistTagscall (falls back to the raw IDs if the request fails).zhe list: New--show-tagsflag opts into a TAGS column in the default and wide table modes. The column also auto-enables when--tagis used to filter. The column stays off by default to keep the table compact.Test plan
cli/tests/utils.test.tscovering TAGS column rendering, tag-name resolution, and detail-viewTags:line behavior.tests/api/v1/links.test.tsandtests/api/v1/links-by-id.test.tsto verifytagIdsis present and is an array.