Remove complex DiffWidget detection and context menu injection.
Add 'Review Staged Changes' and 'Review Unstaged Changes' to editor
context menu when in a git repo. Uses git diff directly.
-119 lines of code removed.
Based on Kate source analysis (apps/lib/diff/diffwidget.*):
- DiffWidget uses DiffEditor children (QPlainTextEdit subclass)
- In Raw/Unified mode, editors contain the actual diff text
- Use looksLikeDiff() to identify which editor has valid diff
Simplified from multi-strategy approach to single focused method.
Removed unused QTextEdit and functional includes.
Make the six context-menu action methods (askAboutFile, explainSelection,
submitSelectionPrompt, sendVerbatim, reviewDiff, startSession) public
Q_INVOKABLE so sibling plugins can trigger them by name via
QMetaObject::invokeMethod. The Deft radial menu uses this to offer an 'Ollie'
submenu when this plugin is enabled. No behaviour change for existing callers.
Right-click on files/directories in Kate's project panel now shows
Ollie actions:
For directories:
- Ask about directory (explain purpose/structure)
- Start Session Here
For files:
- Ask about file (explain purpose/design)
- Review file (code review)
- Write tests
Constructs file paths by walking up the tree model and joining with
the project base directory.
The GitWidget delays initialization until showEvent. Find the
QHBoxLayout containing QToolButtons (the button bar) and insert
our button there, next to Commit/Push/Pull buttons.
The GitWidget creates local QMenu objects that can't be intercepted.
Instead, add a QToolButton with dropdown menu to the git tool view:
- Review Staged Changes
- Review Unstaged Changes
- Explain Selected Files
This approach doesn't require Kate source modification.
The previous approach using QMetaObject::invokeMethod on gitWidget()
failed because that method isn't Q_INVOKABLE. The new approach:
- Find git tool view by object name or 'git' in name
- Install event filter to catch QEvent::ChildAdded
- When a QMenu child is added, connect to aboutToShow
- Add Ollie actions to the menu before it's shown
Also add retry timer for setupProjectGitWidget since the plugin
view may not exist at construction time.
- setupProjectGitWidget(): Hook into kateprojectplugin's GitWidget
via gitWidget() method, install event filter on tree view
- addOllieActionsToGitContextMenu(): Add 'Review Staged Changes' and
'Ask About Selection' to the git widget's context menu
- reviewStagedChanges(): Get staged (or unstaged) diff via git process
- askAboutGitSelection(): Ask Ollie about selected files in git view
- onWidgetAdded(): Detect DiffWidget additions by shouldClose() method
- onDiffWidgetContextMenu(): Add 'Review This Diff' to diff widget
- reviewDiffFromWidget(): Extract diff from widget and send to Ollie
- Agent cwd is optional; empty = inherit session cwd (the common case)
- Session cwd is required at creation and is the inheritance root
- toolsrv maintains agentCWD map, resolved per call from agent= field
- Override set via agent cfg (cwd=...) or ctl (cwd [<dir>|-])
- Agent.SyncCwdToToolServer re-pushes on every (re)connect
- GUI NewAgentDialog shows '(inherit: <sessionCwd>)' as placeholder
- proc_test.go covers per-agent cwd isolation
- Kate and acme scripts updated for new session/agent creation flow
- AGENTS.md documents the architecture
Agent names derived from cwd using parent:prefix format:
- /home/user/src/ollie -> src:ollie
- /home/user/proj/ABC-123_feature/repo -> abc-123:repo
Updates:
- Kate plugin: one agent per project, git root fallback if no project plugin
- acme-ollie-ensure: single 'acme' session, per-project agents
- ollie-session-here: single 'default' session, per-project agents
Also fixed write -> rdwr for session/agent creation endpoints
Backend:
- Add proc.start/proc.exit events for background process lifecycle
- Add proc idx ctl command for machine-readable process listing (TSV)
- Add event.pub file for external event publishing
- Add ListProcsIdx to toolclient and toolsrv
- Fix bypass commands to use Setpgid for process group isolation
GUI:
- Add configurable bypass approval shortcuts (Ctrl+Y/Ctrl+N default)
- Add Keyboard Shortcuts section to Settings dialog
- Store shortcuts in theme.conf
Kate:
- Fix 'Start Session Here' - use rdwr for session/new endpoint
Drop the OLLIE_KF5 CMake option and the entire Qt5/KF5 build branch;
delete KF5-only assets (99-ollie-kf5.sh, ollie-actions-kf5.desktop);
collapse all QT_VERSION_MAJOR and KTEXTEDITOR_VERSION_MAJOR conditionals
to the KF6 path in the KRunner, Kate, KIO, and GUI sources; update
Makefile, README, and docs. Verified: KF6 configure + full build of
ollie-gui, krunner_ollie, ollie_kate, kio_ollie.
Session creation now requires cwd= parameter (no fallback to daemon cwd).
Agent cwd is read-only — agents inherit from session, cannot override.
Frontends updated:
- NewSessionDialog: added Directory field with Browse button
- NewAgentDialog: removed Directory field
- createAgent(): removed cwd parameter
- Kate plugin: passes cwd when creating kate session
- Dolphin: removed cwd from agent/new call
Message history sanitization (backend.SanitizeMessages):
- Removes dangling tool calls (assistant with ToolCalls but missing results)
- Removes orphan tool results (tool message without preceding call)
- Applied before sub-agent context inheritance
- Applied before session persistence save
- Applied after compaction (defensive)
Includes unit tests for all sanitization cases.