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>
This commit is contained in:
Pierre Martin
2026-03-23 13:24:24 +01:00
parent 929ee4ce7d
commit 12e1ba79ba
3 changed files with 49 additions and 0 deletions

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module github.com/pieMusic/vmux
go 1.25

4
shell.nix Normal file
View File

@@ -0,0 +1,4 @@
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
buildInputs = with pkgs; [ go gopls ];
}

42
types.go Normal file
View File

@@ -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)
}