feat: Add role shortcuts to gt nudge (mayor, witness, refinery)
gt nudge now accepts role shortcuts that expand to session names: - mayor → gt-mayor - witness → gt-<rig>-witness (uses current rig) - refinery → gt-<rig>-refinery (uses current rig) This makes it easier to nudge common targets without needing to remember the full session naming conventions. (gt-w1te9) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Steve Yegge
parent
4a84f68d48
commit
fb041145ab
@@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/steveyegge/gastown/internal/events"
|
"github.com/steveyegge/gastown/internal/events"
|
||||||
|
"github.com/steveyegge/gastown/internal/session"
|
||||||
"github.com/steveyegge/gastown/internal/style"
|
"github.com/steveyegge/gastown/internal/style"
|
||||||
"github.com/steveyegge/gastown/internal/tmux"
|
"github.com/steveyegge/gastown/internal/tmux"
|
||||||
"github.com/steveyegge/gastown/internal/workspace"
|
"github.com/steveyegge/gastown/internal/workspace"
|
||||||
@@ -32,12 +33,17 @@ Uses a reliable delivery pattern:
|
|||||||
This is the ONLY way to send messages to Claude sessions.
|
This is the ONLY way to send messages to Claude sessions.
|
||||||
Do not use raw tmux send-keys elsewhere.
|
Do not use raw tmux send-keys elsewhere.
|
||||||
|
|
||||||
Special targets:
|
Role shortcuts (expand to session names):
|
||||||
deacon Maps to the Deacon session (gt-deacon)
|
mayor Maps to gt-mayor
|
||||||
|
deacon Maps to gt-deacon
|
||||||
|
witness Maps to gt-<rig>-witness (uses current rig)
|
||||||
|
refinery Maps to gt-<rig>-refinery (uses current rig)
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
gt nudge greenplace/furiosa "Check your mail and start working"
|
gt nudge greenplace/furiosa "Check your mail and start working"
|
||||||
gt nudge greenplace/alpha -m "What's your status?"
|
gt nudge greenplace/alpha -m "What's your status?"
|
||||||
|
gt nudge mayor "Status update requested"
|
||||||
|
gt nudge witness "Check polecat health"
|
||||||
gt nudge deacon session-started`,
|
gt nudge deacon session-started`,
|
||||||
Args: cobra.RangeArgs(1, 2),
|
Args: cobra.RangeArgs(1, 2),
|
||||||
RunE: runNudge,
|
RunE: runNudge,
|
||||||
@@ -82,6 +88,27 @@ func runNudge(cmd *cobra.Command, args []string) error {
|
|||||||
|
|
||||||
t := tmux.NewTmux()
|
t := tmux.NewTmux()
|
||||||
|
|
||||||
|
// Expand role shortcuts to session names
|
||||||
|
// These shortcuts let users type "mayor" instead of "gt-mayor"
|
||||||
|
switch target {
|
||||||
|
case "mayor":
|
||||||
|
target = session.MayorSessionName()
|
||||||
|
case "witness", "refinery":
|
||||||
|
// These need the current rig
|
||||||
|
roleInfo, err := GetRole()
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot determine rig for %s shortcut: %w", target, err)
|
||||||
|
}
|
||||||
|
if roleInfo.Rig == "" {
|
||||||
|
return fmt.Errorf("cannot determine rig for %s shortcut (not in a rig context)", target)
|
||||||
|
}
|
||||||
|
if target == "witness" {
|
||||||
|
target = session.WitnessSessionName(roleInfo.Rig)
|
||||||
|
} else {
|
||||||
|
target = session.RefinerySessionName(roleInfo.Rig)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Special case: "deacon" target maps to the Deacon session
|
// Special case: "deacon" target maps to the Deacon session
|
||||||
if target == "deacon" {
|
if target == "deacon" {
|
||||||
// Check if Deacon session exists
|
// Check if Deacon session exists
|
||||||
|
|||||||
Reference in New Issue
Block a user