Skip to content

feat(issues): add activity command with threaded discussion timeline - #267

Merged
iamfj merged 1 commit into
nextfrom
issue-144
Jul 4, 2026
Merged

feat(issues): add activity command with threaded discussion timeline#267
iamfj merged 1 commit into
nextfrom
issue-144

Conversation

@iamfj

@iamfj iamfj commented Jul 3, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Adds an issues activity <issue> command that merges comment threads (root comments plus nested replies) with issue history events into a single chronological timeline, paginated via an opaque id cursor. Flags --comments-only and --with-reactions control inclusion of history events and normalized reactions; history events normalize state/assignee/priority/project/cycle/title/estimate/label/archived changes and resolve label IDs to names. Also refactors discussion-service to expose reusable reply-index helpers (buildThreadRepliesIndex/collectThreadReplies) and issue-scoped reply-candidate fetchers consumed by the new activity service.

Closes #144

Type of change

  • Bug fix
  • New feature
  • Refactor (no behavior change)
  • Documentation
  • Tests
  • Build / CI

Checklist

  • npm run check:ci passes (lint + format)
  • npx tsc --noEmit passes (type check)
  • npm test passes (unit tests)
  • New code has tests (happy path + primary error case)
  • Commit messages follow Conventional Commits

Testing

Ran npm run build, npm run check:ci, npx tsc --noEmit, and npm test (873 tests passing, including the new activity-service suite).

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

✅ knip — no dead code

No unused files, exports, types, or dependencies detected.

@iamfj
iamfj force-pushed the issue-144 branch 3 times, most recently from f1ad2c7 to 994fbee Compare July 4, 2026 16:22
Add `issues activity <issue>`, which merges an issue's comment threads
(root comments plus their nested replies) with its history events into a
single chronological timeline, paginated with an opaque id cursor.

Why: users and agents inspecting an issue previously had to correlate the
separate `discussions` output with Linear's field-change history by hand.
Linear exposes no unified activity connection, so the service materializes
both connections, normalizes each history event into a compact list of
meaningful changes (state, assignee, priority, project, cycle, title,
estimate, labels, archived), resolves label IDs to names, and sorts the
combined set ascending by creation time.

Design notes and trade-offs:
- History and comment connections are independent, so both are exhausted
  concurrently before assembly; label names depend on the history nodes
  and are resolved afterwards. Empty-change history events are dropped so
  they do not consume pagination slots.
- As a stateless CLI there is no cross-invocation cache, so each `--after`
  page re-materializes the full timeline before slicing — the same
  materialize-then-slice model already used for discussion reply
  pagination. Cheap for typical issues; only pathological histories pay.
- `--comments-only` skips history (and the dependent label lookup);
  `--with-reactions` returns normalized reactions on roots and replies.

To feed the activity service, `discussion-service` is refactored to expose
reusable reply helpers (`buildThreadRepliesIndex` / `collectThreadReplies`,
with `filterThreadReplies` now layered on top) and issue-scoped
reply-candidate fetchers, and `GetLabels` gains an `includeArchived`
argument (default false) so historic label changes still resolve to names.
The fetch-until-empty loop shared by every full-connection fetcher is
extracted into a `collectConnection` helper in `common/types` so each
fetcher only declares its query, per-page guard, and cursor extraction.

Closes #144
@iamfj
iamfj merged commit 8f6bcef into next Jul 4, 2026
12 checks passed
@iamfj
iamfj deleted the issue-144 branch July 4, 2026 16:35
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(issues): add activity command with threaded discussion output

1 participant