Skip to content

feat(extensions): add hunk_viewed and note_changed events - #939

Merged
benvinegar merged 1 commit into
mainfrom
feat/extension-hunk-viewed-note-changed
Aug 31, 2026
Merged

benvinegar merged 1 commit into
mainfrom
feat/extension-hunk-viewed-note-changed

Conversation

@benvinegar

Copy link
Copy Markdown
Member

Summary

  • Add hunk_viewed so extensions can observe settled hunk attention, including [/] within a file. file_viewed still fires only when the selected file object changes.
  • Add store-backed note_changed (created / updated / removed) for saved ReviewStore notes, including agent session comments and user deletes. Drafts and reload remaps stay out of this event.
  • Bump the extension API to v14. Review triage now marks visited hunks from hunk_viewed.

Test plan

  • bun test src/extensions/reviewSnapshot.test.ts src/ui/hooks/useExtensionReviewEvents.test.tsx src/extensions/events.test.ts src/extensions/runExtension.test.ts src/extensions/publicApiRobustness.test.ts
  • bun run lint
  • bun run deps:check
  • Smoke: load examples/extensions/review-triage, walk hunks with ] inside one file, confirm viewed marks advance

Let extensions observe settled hunk attention and saved ReviewStore note
mutations, including agent comments, without deriving them from selection
ids or TUI-only note events.
@vercel

vercel Bot commented Aug 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hunk-web Ready Ready Preview Aug 31, 2026 12:11am

Request Review

@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds extension API v14 lifecycle events for settled hunk attention and saved-note mutations.

  • Publishes hunk_viewed when navigation settles on a different file/hunk pair.
  • Projects and diffs saved ReviewStore notes to publish created, updated, and removed note_changed events.
  • Updates the registry, public types, documentation, packaging checks, tests, and review-triage example.

Confidence Score: 5/5

The PR appears safe to merge; no concrete blocking or independently actionable non-blocking issue was identified.

The new event paths preserve reload baselines, react to all store-backed note mutations, and distinguish file replacement from settled hunk navigation as documented.

Important Files Changed

Filename Overview
src/ui/hooks/useExtensionReviewEvents.ts Adds generation-aware saved-note diffing and hunk-level settled-selection event publication without exposing a concrete defect.
src/extensions/reviewSnapshot.ts Extracts saved-note projection and implements deterministic created, updated, and removed note comparisons.
src/ui/App.tsx Projects ReviewStore notes by state revision and supplies notes plus changeset generation to the event hook.
src/extension-api/types.ts Advances the API to v14 and defines the new public event payload contracts.
src/ui/hooks/useExtensionReviewEvents.test.tsx Covers initial baselines, in-generation note mutations, reload suppression, same-file hunk navigation, and empty selection behavior.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Navigation[Selection settles] --> SelectionEvent[selection_changed]
  SelectionEvent --> FileCheck{File object changed?}
  FileCheck -->|Yes| FileEvent[file_viewed]
  SelectionEvent --> HunkCheck{File and hunk changed?}
  HunkCheck -->|Yes| HunkEvent[hunk_viewed]
  Store[ReviewStore mutation] --> Project[Project saved notes]
  Project --> Generation{Same review generation?}
  Generation -->|Yes| Diff[Diff previous and current notes]
  Diff --> NoteEvent[note_changed]
  Generation -->|No| Seed[Seed reload baseline]
Loading

Reviews (1): Last reviewed commit: "feat(extensions): add hunk_viewed and no..." | Re-trigger Greptile

@benvinegar
benvinegar merged commit e1c292b into main Aug 31, 2026
13 checks passed

This branch was successfully deployed

1 active deployment
Preview — dd51d80a Deployed Aug 31, 2026 by vercel[bot]
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.

1 participant