v0.2.64 11b3818

prompt.sh RawHistoryFolder

1#!/usr/bin/env bash
2# Minimal shell client for the `zot rpc` JSON protocol.
3#
4# Usage:
5#   ./prompt.sh "fix the failing test"
6#
7# Sends one prompt, streams assistant text deltas to stdout, exits
8# when the turn finishes. Requires `jq`.
9
10set -euo pipefail
11
12if [ $# -lt 1 ]; then
13  echo "usage: $0 <prompt>" >&2
14  exit 2
15fi
16prompt="$*"
17
18# Build the prompt command frame with jq so quotes are escaped properly.
19cmd=$(jq -nc --arg msg "$prompt" '{id:"1",type:"prompt",message:$msg}')
20
21# Pipe the command into zot rpc; pipe its stdout through jq to react
22# to events. The trailing `cat` keeps the input pipe open until the
23# subprocess exits on its own (after `done`).
24{
25  if [ -n "${ZOTCORE_RPC_TOKEN:-}" ]; then
26    jq -nc --arg t "$ZOTCORE_RPC_TOKEN" '{id:"0",type:"hello",token:$t}'
27  fi
28  echo "$cmd"
29  # Block here so stdin stays open until zot exits.
30  cat
31} | zot rpc | while IFS= read -r line; do
32  type=$(echo "$line" | jq -r '.type // empty')
33  case "$type" in
34    text_delta)
35      echo "$line" | jq -rj '.delta // ""'
36      ;;
37    tool_call)
38      name=$(echo "$line" | jq -r '.name // ""')
39      echo >&2 ""
40      echo >&2 "[tool] $name"
41      ;;
42    error)
43      echo >&2 "[error] $(echo "$line" | jq -r '.message // ""')"
44      exit 1
45      ;;
46    done)
47      echo
48      exit 0
49      ;;
50  esac
51done

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close