Skip to content

feat: enhanced agent detection, clickable columns, PR integration, and cleanup#28

Merged
guodong-sq merged 5 commits intomainfrom
guodong/intellij_plugin
Mar 10, 2026
Merged

feat: enhanced agent detection, clickable columns, PR integration, and cleanup#28
guodong-sq merged 5 commits intomainfrom
guodong/intellij_plugin

Conversation

@guodong-sq
Copy link
Copy Markdown
Collaborator

@guodong-sq guodong-sq commented Mar 10, 2026

Summary

Adds enhanced agent session detection, clickable table columns, GitHub PR integration, and pre-PR code cleanup to the IntelliJ plugin.

Enhanced agent session detection

  • Lock file PID validation (~/.claude/ide/*.lock) alongside existing lsof detection
  • Tiered session states: running (file growing or active within 60s) vs idle (active within 10min)
  • File size growth tracking to distinguish actively-writing sessions
  • Per-session terminal kind resolution (iTerm2, Terminal.app, IntelliJ) via process tree walk
  • TTY resolution per PID for terminal tab matching
  • Fallback: synthesize RUNNING sessions for PIDs with no .jsonl yet
  • Multi-line agent column with per-session display (e.g. "🤖 running (3m) · iTerm2")
  • Settings toggle for enhanced vs legacy detection

Clickable table columns

  • Status → opens Commit tool window (linked worktree with dirty status)
  • Branch → opens Git log filtered to that branch (linked worktree)
  • Agent → navigates to the agent's terminal tab (iTerm2 via AppleScript, Terminal.app via AppleScript, IntelliJ terminal via tab index matching by TTY)
  • PR → opens in Pull Requests tool window, browser fallback, or "Create PR" flow
  • Hand cursor on hoverable cells, settings toggle for agent terminal navigation

Agent session tooltips

  • Session state indicator (🟢 running / 🟡 idle), terminal kind, PID
  • Parsed stats from .jsonl transcripts: model, tokens (in/out/cache), turns, tool uses
  • Duration (API) and Duration (wall) matching /cost output format
  • Version display

GitHub PR integration

  • PullRequestLoader fetches PR state per branch via gh pr list
  • PR column shows #number (color-coded: green/gray/purple/red) or "Create PR" (blue)
  • PR tooltip with number, state, and title
  • Repo slug detection from git remote URL

Code cleanup

  • Extract shared utilities: DurationFormat (3x→1), PlatformUtil (4x→1), ClaudeSessionPaths (2x→1)
  • Extract SessionTooltipBuilder from WorktreePanel (removed 60 lines of HTML generation)
  • Remove dead code: FakeAgentDetection.sessions, duplicate formatDuration methods, custom forEachLine
  • Replace custom forEachLine with stdlib useLines, simplify countOccurrences
  • Consistent visibility (formatAgent internal→private), debug logging in process execution

CI

  • Fix plugin-build.yml path filter (wt-intellij-pluginwt-jetbrains-plugin)
  • Add workflow self-trigger so CI changes are tested

@guodong-sq guodong-sq changed the title refactor: deduplicate and clean up IntelliJ plugin feat: IntelliJ plugin for worktree management Mar 10, 2026
guodong-sq and others added 2 commits March 10, 2026 01:52
Extract shared utilities to reduce duplication across the plugin:
- DurationFormat: compact/detailed duration formatting (was duplicated 3x)
- PlatformUtil: OS detection (was duplicated 4x)
- ClaudeSessionPaths: session dir/file resolution (was duplicated 2x)
- SessionTooltipBuilder: agent tooltip HTML rendering (extracted from WorktreePanel)

Remove dead code:
- FakeAgentDetection: removed unused `sessions` param and `detectAgentSessions()`
- WorktreeTableModel: removed private `formatDuration()`, use DurationFormat
- WorktreePanel: removed `formatTooltipDuration()`, use DurationFormat
- SessionStatsParser: removed custom `forEachLine`, use stdlib `useLines`

Align patterns:
- WorktreeTableModel.formatAgent: internal → private (tested via getValueAt)
- TerminalNavigator: add debug logging to process execution catch blocks
- EnhancedAgentDetector: delegate TTY resolution to TerminalNavigator.resolveTty()
- SessionStatsParser: simplify countOccurrences using String.replace
- Tooltip duration labels: "Duration (API)" / "Duration (wall)" to match /cost

Co-authored-by: Claude Code <noreply@anthropic.com>
Ai-assisted: true
The plugin-build.yml referenced the old directory name (wt-intellij-plugin)
instead of wt-jetbrains-plugin, so CI never triggered for plugin changes.
Also add the workflow file itself as a path trigger.

Co-authored-by: Claude Code <noreply@anthropic.com>
Ai-assisted: true
@guodong-sq guodong-sq force-pushed the guodong/intellij_plugin branch from 3a8c57c to 3757faf Compare March 10, 2026 05:52
@guodong-sq guodong-sq changed the title feat: IntelliJ plugin for worktree management feat: enhanced agent detection, clickable columns, PR integration, and cleanup Mar 10, 2026
guodong-sq and others added 3 commits March 10, 2026 01:54
The .gitignore excluded it, causing GradleWrapperMain ClassNotFoundException in CI.

Co-authored-by: Claude Code <noreply@anthropic.com>
Ai-assisted: true
The internal maven.global.square repo is not accessible from GitHub Actions.
All dependencies resolve from mavenCentral + IntelliJ platform default repos.

Co-authored-by: Claude Code <noreply@anthropic.com>
Ai-assisted: true
Co-authored-by: Claude Code <noreply@anthropic.com>
Ai-assisted: true
@guodong-sq guodong-sq merged commit e92a7e9 into main Mar 10, 2026
6 checks passed
@guodong-sq guodong-sq deleted the guodong/intellij_plugin branch March 10, 2026 06:02
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