From 12e1ba79bab7c67823169f84fbbe96906ab74e73 Mon Sep 17 00:00:00 2001 From: Pierre Martin Date: Mon, 23 Mar 2026 13:24:24 +0100 Subject: [PATCH] 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) --- go.mod | 3 +++ shell.nix | 4 ++++ types.go | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 go.mod create mode 100644 shell.nix create mode 100644 types.go diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..27ebc40 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module github.com/pieMusic/vmux + +go 1.25 diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..c741684 --- /dev/null +++ b/shell.nix @@ -0,0 +1,4 @@ +{ pkgs ? import {} }: +pkgs.mkShell { + buildInputs = with pkgs; [ go gopls ]; +} diff --git a/types.go b/types.go new file mode 100644 index 0000000..8212789 --- /dev/null +++ b/types.go @@ -0,0 +1,42 @@ +package main + +// SessionState represents the current activity state of a Claude Code session. +type SessionState int + +const ( + Working SessionState = iota + NeedsInput + Idle + Unknown +) + +func (s SessionState) String() string { + switch s { + case Working: + return "Working" + case NeedsInput: + return "Needs Input" + case Idle: + return "Idle" + default: + return "Unknown" + } +} + +// Process represents a Claude Code OS process detected via /proc. +type Process struct { + PID int + Cmd []string // cmdline arguments + Cwd string // readlink /proc/PID/cwd +} + +// Session represents a Claude Code session enriched with JSONL metadata. +type Session struct { + Process Process + SessionID string + GitBranch string + State SessionState + Preview string // last lines of output + CwdPath string // process cwd + Worktree string // git worktree (may differ from cwd) +}