previousToken returns the word immediately before the cursor — either the last completed token (when the line ends in whitespace) or the second-to-last token otherwise.
(args []string, line string)
| 196 | // last completed token (when the line ends in whitespace) or the |
| 197 | // second-to-last token otherwise. |
| 198 | func previousToken(args []string, line string) string { |
| 199 | if strings.HasSuffix(line, " ") { |
| 200 | return args[len(args)-1] |
| 201 | } |
| 202 | if len(args) > 1 { |
| 203 | return args[len(args)-2] |
| 204 | } |
| 205 | return "" |
| 206 | } |
| 207 | |
| 208 | // completeBareSlash powers the "/" → list of slash commands flow, merging |
| 209 | // user-invocable skills so they surface alongside built-ins. |
no outgoing calls