Skip to content

feat: show tags in zhe get detail and zhe list table#41

Merged
nocoo merged 2 commits into
mainfrom
agent/sde-01/8f7eaebc
May 15, 2026
Merged

feat: show tags in zhe get detail and zhe list table#41
nocoo merged 2 commits into
mainfrom
agent/sde-01/8f7eaebc

Conversation

@nocoo
Copy link
Copy Markdown
Owner

@nocoo nocoo commented May 15, 2026

Closes #39

Summary

  • API: /api/v1/links and /api/v1/links/[id] now return tagIds: string[] for each link, fetched in a single batched query via a new ScopedDB.getLinkTagMap helper (chunked to stay within D1's parameter limit, ownership-checked via JOIN to links).
  • CLI zhe get: 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).
  • CLI zhe list: New --show-tags flag opts into a TAGS column in the default and wide table modes. The column also auto-enables when --tag is used to filter. The column stays off by default to keep the table compact.

Test plan

  • L1 unit tests: 6 new tests in cli/tests/utils.test.ts covering TAGS column rendering, tag-name resolution, and detail-view Tags: line behavior.
  • L2 API tests: extended structure assertions in tests/api/v1/links.test.ts and tests/api/v1/links-by-id.test.ts to verify tagIds is present and is an array.
  • Pre-commit hooks (L1 + G1 typecheck + ESLint + gitleaks) pass on both commits.

nocoo added 2 commits May 15, 2026 08:33
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.
@nocoo nocoo merged commit 2d918b4 into main May 15, 2026
7 checks passed
@nocoo nocoo deleted the agent/sde-01/8f7eaebc branch May 15, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: show tags in get detail view and list table output

1 participant