From 4cb12b2e2a0eea220cd39a7be758f130bfe7fb9c Mon Sep 17 00:00:00 2001 From: Pierre Martin Date: Mon, 23 Mar 2026 18:43:15 +0100 Subject: [PATCH] docs(02-03): complete CLI + wiring plan --- .../02-daemon-et-i3-bridge/02-03-SUMMARY.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .planning/phases/02-daemon-et-i3-bridge/02-03-SUMMARY.md diff --git a/.planning/phases/02-daemon-et-i3-bridge/02-03-SUMMARY.md b/.planning/phases/02-daemon-et-i3-bridge/02-03-SUMMARY.md new file mode 100644 index 0000000..c52505e --- /dev/null +++ b/.planning/phases/02-daemon-et-i3-bridge/02-03-SUMMARY.md @@ -0,0 +1,91 @@ +--- +phase: 02-daemon-et-i3-bridge +plan: 03 +subsystem: cli +tags: [unix-socket, i3, fuzzy-match] + +requires: + - phase: 02-01 + provides: Daemon server, registry, protocol types + - phase: 02-02 + provides: Workspace resolution, fuzzy match, i3 commander +provides: + - CLI client with list/switch/label/stop subcommands + - Autostart daemon on first CLI use + - Enriched display with workspace, label, waiting duration +affects: [phase-3-hook-server, phase-4-notifications] + +tech-stack: + added: [] + patterns: [client-server unix socket, autostart daemon, fuzzy match CLI] + +key-files: + created: [client.go, client_test.go, sysattr_linux.go] + modified: [main.go, display.go, display_test.go, daemon.go] + +key-decisions: + - "vmux label accepts fuzzy match queries (not just session UUIDs)" + - "Permission prompt stale detection (>10s tool_use = NeedsInput)" + +patterns-established: + - "CLI dispatch via os.Args switch (no framework)" + - "Autostart: EnsureDaemon() checks socket, spawns vmux daemon if missing" + +requirements-completed: [DISC-04, I3-01, I3-02, STATE-04] + +duration: 8min +completed: 2026-03-23 +--- + +# Plan 02-03 Summary + +**CLI complet avec list/switch/label/stop, autostart daemon, affichage enrichi (workspace, label, temps d'attente)** + +## Performance + +- **Duration:** 8 min +- **Tasks:** 3 (2 code + 1 human-verify) +- **Files modified:** 7 + +## Accomplishments +- Client Unix socket avec autostart daemon transparent +- Sous-commandes list, switch, label, stop +- Affichage enrichi : workspace `[ws:N]`, label entre guillemets, "depuis X min" +- Fix : vmux label accepte fuzzy match (pas besoin de connaître le UUID) +- Fix : détection permission prompts comme NeedsInput quand tool_use > 10s + +## Task Commits + +1. **Task 1: Client socket + wiring** - `a79a0e1` +2. **Task 2: main.go sous-commandes + display** - `170790f` +3. **Task 3: Human verification** - approved +4. **Fixes post-checkpoint** - `8594c48` + +## Files Created/Modified +- `client.go` — Client Unix socket, EnsureDaemon(), autostart +- `client_test.go` — Tests client + autostart +- `sysattr_linux.go` — SysProcAttr pour le daemon fork +- `main.go` — Dispatch sous-commandes (list/switch/label/stop/daemon) +- `display.go` — DisplaySessionInfos avec workspace, label, temps d'attente +- `daemon.go` — Label handler avec fuzzy match, switch handler +- `state.go` — PermissionStallThreshold pour tool_use stale + +## Decisions Made +- vmux label résout via fuzzy match au lieu d'exiger le session UUID +- Permission prompts détectés via heuristique temporelle (tool_use > 10s = NeedsInput) + +## Deviations from Plan +- Ajout de PermissionStallThreshold dans state.go (découvert pendant la vérification humaine) +- Fuzzy match pour labels (découvert pendant la vérification humaine) + +## Issues Encountered +- Label indexé par UUID non-affichable → corrigé par fuzzy match +- Sessions en attente de permission affichées comme Idle → corrigé par stale detection + +## Next Phase Readiness +- Daemon fonctionnel avec i3 bridge +- Phase 3 (Hook Server) peut ajouter le endpoint HTTP dans le daemon existant + +--- +*Phase: 02-daemon-et-i3-bridge* +*Completed: 2026-03-23*