Skip to content

feat(review): add grouped review mode with viewed/commented indicators - #10

Merged
jfyne merged 5 commits into
masterfrom
worktree-review-view
Mar 7, 2026
Merged

feat(review): add grouped review mode with viewed/commented indicators#10
jfyne merged 5 commits into
masterfrom
worktree-review-view

Conversation

@jfyne

@jfyne jfyne commented Mar 7, 2026

Copy link
Copy Markdown
Owner

What's changed

Adds --groups flag with Group type and ParseGroupsFile, buildGroupedTree for sidebar organization, per-file viewed/commented indicators on TreeItem, nextUnviewedFile navigation, rebuildTree/selectFile helpers, mark-viewed event handler, and corresponding template/CSS updates for group headers, indicator icons, and a content footer button.

Requirements

Functional Requirements (EARS):

  • When --groups flag is provided with a JSON file path, the system shall parse the file as an ordered array of {name, files} objects and organize the tree sidebar by groups
  • When a file is not assigned to any group, the system shall place it in an auto-created "Other" group at the bottom
  • When a user clicks "Mark as viewed" on a file, the system shall toggle the viewed state and navigate to the next unviewed file in the current group, then the next group
  • When all files are marked as viewed, the system shall stay on the current file
  • While a file within a group is selected, the system shall highlight the group header in the tree
  • The system shall show a checkmark indicator next to viewed files in the tree
  • The system shall show a comment dot indicator next to files with comments in the tree
  • When a comment is added or deleted, the system shall update the comment indicator in the tree

Acceptance Criteria:

Feature: Grouped review mode with viewed and commented indicators

  Scenario: Groups flag loads and organizes files into groups
    Given a groups JSON file with groups "Auth" containing "auth.go" and "API" containing "handler.go"
    And meatcheck is invoked with --groups groups.json and files auth.go handler.go utils.go
    When the UI loads
    Then the tree sidebar shows group headers "Auth" and "API" in order
    And "auth.go" appears under "Auth"
    And "handler.go" appears under "API"
    And "utils.go" appears under an "Other" group at the bottom

  Scenario: Groups work with diff mode
    Given a groups JSON file with group "Frontend" containing "src/app.tsx" and group "Backend" containing "api/handler.go"
    And a unified diff file containing changes to "src/app.tsx", "api/handler.go", and "config.yaml"
    And meatcheck is invoked with --groups groups.json --diff changes.diff
    When the UI loads
    Then the tree sidebar shows group headers "Frontend" and "Backend" in order
    And "src/app.tsx" appears under "Frontend"
    And "api/handler.go" appears under "Backend"
    And "config.yaml" appears under an "Other" group at the bottom

  Scenario: Marking a file as viewed shows indicator and advances
    Given a file is selected in the review UI
    When the user clicks "Mark as viewed"
    Then a green checkmark appears next to the file in the tree
    And the file name is dimmed in the tree
    And the UI navigates to the next unviewed file

  Scenario: Mark as viewed advances across groups
    Given grouped mode with groups A and B
    And the last unviewed file in group A is selected
    When the user clicks "Mark as viewed"
    Then the UI navigates to the first unviewed file in group B

  Scenario: All files viewed stays on current file
    Given all files except the current one are marked as viewed
    When the user clicks "Mark as viewed" on the last unviewed file
    Then the file is marked as viewed
    And the UI stays on the current file

  Scenario: Comment indicator appears in tree after adding comment
    Given a file with no comments
    When the user adds a comment on a line in the file
    Then a comment dot indicator appears next to the file in the tree

  Scenario: Comment indicator disappears when last comment is deleted
    Given a file with exactly one comment
    When the user deletes the comment
    Then the comment dot indicator is removed from the file in the tree

  Scenario: Active group is highlighted when file is selected
    Given grouped mode with multiple groups
    When the user selects a file within a group
    Then the group header for that file's group is highlighted

  Scenario: Viewed and commented indicators work in ungrouped mode
    Given meatcheck is invoked without --groups flag
    When the user marks a file as viewed and adds a comment to another file
    Then the viewed checkmark appears on the viewed file
    And the comment dot appears on the commented file

  Scenario: Unmarking a viewed file removes indicator
    Given a file that has been marked as viewed
    When the user clicks the "Viewed" button on that file
    Then the checkmark is removed from the file in the tree
    And the file name is no longer dimmed
    And the button text changes back to "Mark as viewed"
    And the UI stays on the current file

  Scenario: Invalid groups JSON produces error
    Given a groups JSON file with invalid syntax
    When meatcheck is invoked with --groups pointing to it
    Then the CLI exits with an error message describing the JSON problem

Suggested review order

# File What it does Link
1 main.go CLI entry point — adds --groups flag and calls ParseGroupsFile View
2 model.go Data types — adds Group struct, extends TreeItem and ReviewModel with group/viewed/comment fields View
3 io_helpers.go File I/O — adds ParseGroupsFile to read, validate, and normalize group JSON View
4 tree.go Tree building — adds fileHasComments, findFileBySlash, updates buildTree signature, implements buildGroupedTree View
5 viewed.go Navigation — implements nextUnviewedFile with group-aware traversal including "Other" files View
6 app.go Event handlers — adds rebuildTree, selectFile, mark-viewed handler, wires group init and comment handler updates View
7 template.html Template — adds group header branch, viewed/commented indicators, content footer with mark-viewed button View
8 styles.css Styles — adds group header, indicator, and content footer CSS rules View
9 skill.md Agent skill docs — adds --groups usage and JSON format documentation View
10 groups_test.go Tests for ParseGroupsFile — valid JSON, validation errors, path normalization View
11 tree_test.go Tests for fileHasComments, buildTree viewed/comments, buildGroupedTree View
12 viewed_test.go Tests for nextUnviewedFile — ungrouped, grouped, wrap-around, edge cases View
13 http_render_test.go Updated existing render tests — new buildTree signature, Viewed map init View

jfyne added 4 commits March 6, 2026 23:47
Document comprehensive analysis of meatcheck codebase architecture and design decisions for implementing grouped file review mode with viewed/commented indicators. Includes CLI config, data model, tree building, template, event handling, and resolved implementation questions.
Plan covers adding --groups flag, per-file viewed/commented indicators
in the tree sidebar, mark-as-viewed navigation, and group header
highlighting. Includes 11 tasks across 3 execution stages with 11
Gherkin acceptance scenarios.
Add --groups flag to organize files into named feature groups in the
tree sidebar. Groups are specified via a JSON file containing an ordered
array of {name, files} objects. Files not in any group appear under an
auto-created "Other" group.

New features:
- Per-file "viewed" tracking with green checkmark and dimmed name
- Per-file "commented" indicator (dot) updated on comment add/delete
- "Mark as viewed" button below each file that advances to next unviewed
- Group headers with active highlighting when a file in the group is selected
- All indicators work in both grouped and ungrouped modes
- Works with both file mode and diff mode

Implementation:
- Group type, ParseGroupsFile with validation and path normalization
- buildGroupedTree for grouped sidebar, updated buildTree signature
- rebuildTree/selectFile helpers to centralize tree and view updates
- nextUnviewedFile navigation with wrap-around across groups
- Tree rebuilt on comment changes to keep indicators current
…ewed"

Move the mark-viewed button from a content footer into the column
header row, right-aligned next to the file path. Change button label
from "Mark as viewed" to "Mark Viewed" / "Viewed ✓". Remove the
content-footer CSS and revert .main grid back to auto 1fr.
@jfyne
jfyne marked this pull request as ready for review March 7, 2026 00:44
Apply gofmt formatting to tree.go and refactor buildGroupedTree to use
slices.Contains instead of manual loop for checking group membership.
@jfyne
jfyne merged commit acdd046 into master Mar 7, 2026
1 check passed
@jfyne
jfyne deleted the worktree-review-view branch March 7, 2026 14:51
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