From 9b063a24ce7045b3fc40f93ba378f5fad478cc11 Mon Sep 17 00:00:00 2001 From: Levi Neely Date: Fri, 9 Oct 2026 12:28:02 +0200 Subject: [PATCH] o: fix context parsing - slash is primary separator Agent names may contain colons (e.g., src:ollie), so slash must be the primary separator. Colon separator is only for the rare case where session names contain slashes. default/src:ollie now correctly parses as: session = default agent = src:ollie --- data/scripts/o | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/data/scripts/o b/data/scripts/o index 05916a1..c0e318c 100755 --- a/data/scripts/o +++ b/data/scripts/o @@ -7,9 +7,8 @@ # o / Agent level # o : Agent level (colon separator) # -# The slash or colon in session/agent disambiguates context level. -# Use colon when session or agent names contain slashes. -# Names with spaces can be quoted: o "my session:my agent" prompt +# Slash is the primary separator. Agent names may contain colons. +# Use colon separator only when session names contain slashes. # # Subcommands: # read Read a file (-l to loop) @@ -485,9 +484,8 @@ Context is determined by the first argument: o / Agent level o : Agent level (colon separator) -The slash or colon in session/agent disambiguates context level. -Use colon when session or agent names contain slashes. -Names with spaces can be quoted: o "my session:my agent" prompt +Slash is the primary separator. Agent names may contain colons. +Use colon separator only when session names contain slashes. Paths starting with / are root-relative (ignore context): o myproj ls /bypass List root bypass/ even in session context @@ -573,21 +571,23 @@ dispatch_cmd() { # Parse context from first argument # Supports: -# session/agent (slash separator) -# session:agent (colon separator) +# session/agent (slash separator - primary) +# session:agent (colon separator - for session names with slashes) # "session name/agent" (quoted with spaces) -# session\ name/agent (escaped spaces) +# +# Slash is the primary separator. Use colon only when session names contain slashes. +# Agent names may contain colons (e.g., "src:ollie"). parse_context() { local arg="$1" - # Check for colon or slash separator - # Colon takes precedence if both present (allows session with / in name) - if [[ "$arg" == *:* ]]; then - CTX_SESSION="${arg%%:*}" - CTX_AGENT="${arg#*:}" - elif [[ "$arg" == */* ]]; then + # Slash is the primary separator + if [[ "$arg" == */* ]]; then CTX_SESSION="${arg%%/*}" CTX_AGENT="${arg#*/}" + elif [[ "$arg" == *:* ]]; then + # Colon separator (for session names containing slashes) + CTX_SESSION="${arg%%:*}" + CTX_AGENT="${arg#*:}" else # session only CTX_SESSION="$arg"