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:
4
shell.nix
Normal file
4
shell.nix
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> {} }:
|
||||||
|
pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [ go gopls ];
|
||||||
|
}
|
||||||
42
types.go
Normal file
42
types.go
Normal 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)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user