Commit Graph

59 Commits

Author SHA1 Message Date
Pierre Martin
c921124bcc feat: sort sessions by workspace number in list output
Also restart daemon on make watch so new binary is used.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 20:42:10 +01:00
Pierre Martin
afa238e29a docs(state): record phase 4 context session 2026-03-23 20:31:54 +01:00
Pierre Martin
719d389d01 docs(04): capture phase context 2026-03-23 20:31:54 +01:00
Pierre Martin
5b7c9c5157 feat: add make watch for live dashboard with colors 2026-03-23 19:54:44 +01:00
Pierre Martin
9d43cb204a docs(phase-03): complete phase execution 2026-03-23 19:51:09 +01:00
Pierre Martin
bed07b1552 docs(03-02): complete hook server integration plan
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 19:48:15 +01:00
Pierre Martin
9cf0480510 feat(03-02): display WaitType in vmux list for sessions awaiting input
- Show "Needs Input: permission" or "Needs Input: question" when WaitType set
- No WaitType shown for Working state or when WaitType empty
- No regression on existing display tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 19:46:52 +01:00
Pierre Martin
e60524961a test(03-02): add failing tests for WaitType display in vmux list
- TestDisplayWaitTypePermission, TestDisplayWaitTypeQuestion
- TestDisplayWaitTypeEmpty, TestDisplayWorkingNoWaitType

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 19:46:18 +01:00
Pierre Martin
79ad8fb16a feat(03-02): integrate hook server into daemon with graceful degradation and dynamic poll
- Add hookPort, httpServer, lastHookTime, mu to Daemon struct
- startHookServer binds HTTP on hookPort, degrades if port busy
- Stop() closes httpServer before unix listener
- pollLoop uses time.After(currentPollInterval()) instead of fixed ticker
- currentPollInterval returns 20s when hooks active (<60s), 5s otherwise
- processHookEvent records lastHookTime on each hook event

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 19:45:48 +01:00
Pierre Martin
5f13eb174b test(03-02): add failing tests for hook server integration and poll slowdown
- TestHookServerStartsWithDaemon, TestHookServerStopsWithDaemon
- TestHookServerPortBusy (graceful degradation)
- TestPollSlowdown (20s when hooks active, 5s otherwise)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 19:44:30 +01:00
Pierre Martin
a59fc01933 docs(03-01): complete hook event processing plan
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 19:42:43 +01:00
Pierre Martin
5bec9430b7 feat(03-01): HTTP handler POST /hook with validation and body size limit
- handleHook validates POST method (405 on others)
- MaxBytesReader limits body to 64KB (400 on overflow)
- JSON decode errors return 400
- Valid payloads update registry via processHookEvent
- 4 tests cover OK, method not allowed, bad JSON, body too large

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 19:41:11 +01:00
Pierre Martin
e1b176cf55 feat(03-01): HookEvent struct, processHookEvent mapping, UpdateFromHook, WaitType
- HookEvent struct parses Claude Code hook JSON payload
- processHookEvent maps Notification/Stop/PostToolUse/PreToolUse to State+WaitType
- UpdateFromHook creates new entries and manages WaitingSince transitions
- SessionInfo.WaitType serialized in JSON with omitempty
- 12 tests cover all event mappings, edge cases, and JSON serialization

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 19:40:02 +01:00
Pierre Martin
10a9d95116 docs(03): phase 3 plans, validation, and research 2026-03-23 19:36:15 +01:00
Pierre Martin
005c6c1214 docs(03): create phase plan for hook server 2026-03-23 19:33:24 +01:00
Pierre Martin
f7228922cc docs(phase-3): research hook server domain 2026-03-23 19:29:45 +01:00
Pierre Martin
e0e6486c19 docs(state): record phase 3 context session 2026-03-23 19:24:41 +01:00
Pierre Martin
a990c1a1b4 docs(03): capture phase context 2026-03-23 19:24:41 +01:00
Pierre Martin
2375374f2f docs(phase-02): complete phase execution 2026-03-23 19:20:03 +01:00
Pierre Martin
4cb12b2e2a docs(02-03): complete CLI + wiring plan 2026-03-23 18:43:15 +01:00
Pierre Martin
8594c48f84 fix: detect permission prompts as NeedsInput when tool_use is stale (>10s)
When Claude requests a tool permission approval, the last JSONL entry is
type=assistant with stop_reason=tool_use. Previously this was always
classified as Working. Now, if the tool_use entry is older than 10s with
no new activity, it's classified as NeedsInput.

Also fix vmux label to accept fuzzy match queries (not just session UUIDs).
2026-03-23 18:29:32 +01:00
Pierre Martin
170790fcda feat(02-03): main.go subcommands + display enrichi avec workspace, label, duree
- main.go dispatch list/switch/label/stop/daemon via client socket
- DisplaySessionInfos affiche [ws:N], label entre guillemets, "depuis X min"
- formatDuration pour duree relative humaine (< 1 min, 3 min, 1 h 5 min)
- Daemon mode integre i3 + X11 avec degradation gracieuse
- Tests complets pour tous les champs optionnels du display
2026-03-23 17:54:18 +01:00
Pierre Martin
a79a0e154c feat(02-03): client socket, autostart daemon, switch handler, workspace wiring
- Client struct sends JSON requests to daemon over Unix socket
- EnsureDaemon auto-starts the daemon if not running (retry 50ms x 20)
- Switch handler uses FuzzyMatch + SwitchToWorkspace via i3 IPC
- InitWorkspaceResolver wires BuildTerminalWorkspaceMap + ResolveWorkspace
- sysattr_linux.go for Setsid detach on daemon spawn
2026-03-23 17:51:31 +01:00
Pierre Martin
a388c9477d docs(02-02): complete i3 bridge plan
- SUMMARY.md with 2 tasks, 15 tests, 4 TDD commits
- STATE.md updated: plan 2/3, decisions recorded
- ROADMAP.md: phase 02 progress 2/3
- REQUIREMENTS.md: I3-01, I3-02 marked complete
2026-03-23 17:47:27 +01:00
Pierre Martin
185119e580 docs(02-01): complete daemon vmuxd plan
- SUMMARY.md with protocol types, registry, labels, socket server
- STATE.md updated: plan 3/3, decisions, metrics
- ROADMAP.md updated: phase 02 progress
- REQUIREMENTS.md: DISC-04, STATE-04 complete
2026-03-23 17:47:14 +01:00
Pierre Martin
4b142a79b5 feat(02-01): add Unix socket server, poll loop, and stop handler
- Daemon struct with Start/Stop/Wait lifecycle
- Unix socket server handling list/label/stop actions
- Poll loop scanning /proc every 5s
- Stale socket cleanup before listen
- Connection dispatch with JSON encoding
- Tests with -race: StartStop, ListOverSocket, LabelOverSocket, UnknownAction
2026-03-23 17:45:57 +01:00
Pierre Martin
9427dd3eda feat(02-02): implement fuzzy match + switch workspace + i3 commander
- FuzzyMatch searches label > branch > cwd (case-insensitive)
- SwitchToWorkspace sends 'workspace number N' via I3Commander interface
- RealI3Commander wraps go.i3wm.org/i3/v4 RunCommand
- 9 tests covering priority, no-match, case-insensitive, errors
2026-03-23 17:45:32 +01:00
Pierre Martin
4a298d5ad0 test(02-02): add failing tests for fuzzy match + switch workspace
- TestFuzzyMatchByLabel, TestFuzzyMatchByBranch, TestFuzzyMatchByCwd
- TestFuzzyMatchPriority (label wins over branch)
- TestFuzzyMatchNoResult, TestFuzzyMatchCaseInsensitive
- TestSwitchToWorkspace, TestSwitchToWorkspaceError, TestSwitchToWorkspaceI3Error
2026-03-23 17:44:56 +01:00
Pierre Martin
a2fb37e2b5 feat(02-02): implement PPID chain walk + workspace resolution
- ReadPPID parses PPid from /proc/PID/status
- ResolveWorkspace walks PPID chain (max 20 levels) to find terminal workspace
- BuildTerminalWorkspaceMap traverses i3 tree + X11 _NET_WM_PID
- RealX11Resolver wraps xgbutil/ewmh for production use
- Interfaces I3TreeProvider and X11PIDResolver for testability
- Fix unused imports in daemon.go (Rule 3: blocking build)
2026-03-23 17:43:58 +01:00
Pierre Martin
5315e88494 feat(02-01): implement protocol types, SessionRegistry, and LabelStore
- Enrich Session with Workspace, Label, WaitingSince fields
- Protocol types: Request, Response, SessionInfo, SwitchArgs, LabelArgs
- SessionRegistry with WaitingSince transition tracking
- LabelStore with JSON file persistence
2026-03-23 17:43:12 +01:00
Pierre Martin
c9a28df3dc test(02-02): add failing tests for PPID chain walk + workspace resolution
- TestReadPPID, TestReadPPIDMissing
- TestResolveWorkspace, TestResolveWorkspaceNotFound, TestResolveWorkspaceMaxDepth
- TestBuildTerminalWorkspaceMapUnit
- Add go.i3wm.org/i3/v4 dependency
2026-03-23 17:42:44 +01:00
Pierre Martin
a49f7d1c57 test(02-01): add failing tests for protocol types, registry, and label store
- TestRequestMarshal, TestResponseWithSessions
- TestRegistryUpdate, TestRegistryWaitingSince, TestRegistryRemoveStale
- TestLabelStoreSetGet, TestLabelStorePersistence, TestLabelStoreLoadMissing
2026-03-23 17:41:58 +01:00
Pierre Martin
51544cab0b docs(02): phase 2 plans 2026-03-23 17:37:09 +01:00
Pierre Martin
1d78b7dc3a docs(phase-2): add research and validation strategy 2026-03-23 15:33:41 +01:00
Pierre Martin
be223468bc docs(02): research daemon et i3 bridge phase domain 2026-03-23 15:32:48 +01:00
Pierre Martin
e1c42e2029 docs(state): record phase 2 context session 2026-03-23 15:22:11 +01:00
Pierre Martin
e84fb71812 docs(02): capture phase context 2026-03-23 15:22:05 +01:00
Pierre Martin
a6eb9f1406 chore: add Makefile and .envrc for dev environment 2026-03-23 14:44:36 +01:00
Pierre Martin
205499c00d docs(phase-01): evolve PROJECT.md after phase completion 2026-03-23 14:44:30 +01:00
Pierre Martin
f9a53632a3 docs(phase-01): complete phase execution 2026-03-23 14:44:06 +01:00
Pierre Martin
766ce541a1 chore(01-02): add .gitignore for vmux binary
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 13:31:25 +01:00
Pierre Martin
f1dcee0ae2 feat(01-02): add CLI display and main.go for vmux list
- DisplaySessions: colored output with state, cwd, branch, preview
- display_test.go: 5 tests covering color, noColor, empty, worktree, noBranch
- main.go: full pipeline FindClaudeProcesses -> FindSession -> DetectState -> Display
- Supports --no-color flag and NO_COLOR env var
- resolveWorktree via git rev-parse --show-toplevel

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 13:30:55 +01:00
Pierre Martin
e7ced9c3a3 test(01-02): add failing tests then implement session + state
- TailReadJSONL: reverse-read JSONL without loading entire file
- FindSessionForProcess: match PID to most recent JSONL via EncodePath
- DetectState: heuristic based on last message stop_reason + tool name
- ExtractPreview: extract first 3 lines of last assistant text
- All 17 tests pass (session_test.go + state_test.go)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 13:29:19 +01:00
Pierre Martin
d1c1239e1e docs(01-01): complete scaffolding + process detection plan
- SUMMARY.md with execution results
- STATE.md advanced to plan 2/2
- ROADMAP.md and REQUIREMENTS.md updated (DISC-01, DISC-02 complete)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 13:26:38 +01:00
Pierre Martin
166e44161d feat(01-01): implement FindClaudeProcesses and EncodePath
- Scan /proc for PIDs with "claude" in cmdline
- Read cwd via os.Readlink, skip errors silently
- EncodePath replaces / and . with - for ~/.claude/projects/ folder names

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 13:25:27 +01:00
Pierre Martin
81ee7dc49d test(01-01): add failing tests for proc scanning and path encoding
- TestFindClaudeProcesses with fake /proc (2 claude + 1 bash)
- TestFindClaudeProcesses_PermissionDenied (silent skip)
- TestFindClaudeProcesses_EmptyProc (empty slice)
- TestEncodePath and TestEncodePath_DotDir

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 13:24:59 +01:00
Pierre Martin
12e1ba79ba feat(01-01): scaffold Go project with types
- shell.nix with go and gopls for NixOS dev environment
- go.mod for github.com/pieMusic/vmux module
- types.go with Process, Session, SessionState (Working/NeedsInput/Idle/Unknown)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 13:24:24 +01:00
Pierre Martin
929ee4ce7d docs(01): phase 1 plans and research 2026-03-23 13:16:15 +01:00
Pierre Martin
1b81b56ae7 fix(01): revise plan 01-01 based on checker feedback 2026-03-23 13:14:33 +01:00
Pierre Martin
4916a75011 docs(01-session-discovery): create phase plan 2026-03-23 13:09:19 +01:00