Skip to content

feat(tui): context-aware jot target (batch 1/3) - #17

Merged
chris-regnier merged 8 commits into
mainfrom
feature/context-aware-jot
Feb 28, 2026
Merged

feat(tui): context-aware jot target (batch 1/3)#17
chris-regnier merged 8 commits into
mainfrom
feature/context-aware-jot

Conversation

@chris-regnier

Copy link
Copy Markdown
Owner

Summary

  • Adds resolveJotTarget() method that determines which entry to jot into based on the current screen and selection state
  • Wires it into startJot() and refactors doJot() to use the resolved target instead of always querying for the daily entry
  • Adds /gavel slash command for running code analysis on branch diffs

This is batch 1 of 3 for the context-aware jot feature (design doc). Remaining batches:

  • Batch 2: Jot target indicator label, entry detail refresh, today screen integration test
  • Batch 3: Help overlay update, full test suite verification, manual smoke test

Jot target resolution

Screen Selection State Jot Target
Today Viewport focus (default) Daily entry
Today Entry selected in list Selected entry
Day Detail Entry selected Selected entry
Entry Detail Viewing entry That entry
Date List Jot disabled

Test plan

  • resolveJotTarget unit tests for all 5 screen states (6 tests)
  • End-to-end jot into selected entry from day detail screen
  • Existing jot tests updated and passing (create new, append, multiline, escape, empty)
  • Full internal/ui test suite: 68 tests passing
  • Gavel analysis run — 2 false positives triaged (Bubble Tea value receiver pattern), 1 warning fixed

🤖 Generated with Claude Code

chris-regnier and others added 7 commits February 18, 2026 08:25
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
startJot now resolves the jot target based on current screen/selection.
doJot appends to the targeted entry instead of always querying for the
daily entry. Existing tests updated to set dailyEntry for the today
screen.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Consistent with Bubble Tea convention — read-only methods use value
receivers. Addresses Gavel finding about receiver type inconsistency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Runs gavel analyze on the current branch diff against main, triages
findings, and fixes genuine issues.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread .claude/commands/gavel.md Fixed
Comment thread docs/plans/2026-02-18-context-aware-jot-target-plan.md Fixed
Comment thread internal/ui/picker.go Fixed
Comment thread internal/ui/picker.go Fixed
Comment thread .claude/commands/gavel.md Fixed
Comment thread docs/plans/2026-02-18-context-aware-jot-target-design.md Fixed
Comment thread docs/plans/2026-02-18-context-aware-jot-target-plan.md Fixed
Comment thread docs/plans/2026-02-18-context-aware-jot-target-plan.md Fixed
Comment thread internal/ui/picker.go Fixed
Comment thread internal/ui/picker.go Fixed
Filter the PR diff to *.go files so Gavel doesn't analyze markdown
docs and instruction files as code.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread internal/ui/picker.go
// Append to existing daily entry (oldest)
daily := entries[len(entries)-1]
if m.jotTarget != nil {
// Append to the targeted entry

Check failure

Code scanning / gavel

Detect critical bugs, logic errors, and potential runtime failures Error

Potential null pointer dereference when accessing m.jotTarget.ID without nil check
Comment thread internal/ui/picker.go
Comment on lines +942 to +962
func (m pickerModel) resolveJotTarget() *entry.Entry {
switch m.screen {
case screenToday:
if m.todayFocus == focusEntryList {
if item, ok := m.todayList.SelectedItem().(entryItem); ok {
e := item.entry
return &e
}
}
return m.dailyEntry
case screenDayDetail:
if item, ok := m.dayList.SelectedItem().(entryItem); ok {
e := item.entry
return &e
}
return nil
case screenEntryDetail:
return &m.entry
default:
return nil
}

Check warning

Code scanning / gavel

Assess test quality, coverage gaps, and testing best practices Warning

New jotTarget functionality lacks visible test coverage for edge cases and error conditions
@chris-regnier
chris-regnier merged commit e41a024 into main Feb 28, 2026
3 of 4 checks passed
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.

2 participants