detached 1b0d383

Expose zot execution to child processes

commit
1b0d3836c9a83260ff41a2426f0eca154c1cf268
author
Zeno Jiricek · · 2026-09-08 22:06 UTC
committer
Zeno Jiricek · · 2026-09-08 23:29 UTC
parent
6abb410
signature
unsigned
3 files · +17 -0
M README.md +2 -0
@@ -816,6 +816,8 @@ A model installed through Ollama is kept in Ollama's internal storage and is not
816816
817817 ## Inline images
818818
819+Scripts and shell commands launched by zot inherit `ZOT_AGENT=1`. Use this signal when a script needs to distinguish execution inside zot from a standalone invocation.
820+
819821 When a tool returns an image (for example `read` on a PNG), zot renders it inline on terminals that support it: **Ghostty**, **Kitty**, **iTerm2**, **WezTerm**. On other terminals you see a text placeholder with MIME type, pixel dimensions, and byte size. Control with the `ZOT_INLINE_IMAGES` env var:
820822
821823 | Value | Effect |
@@ -816,6 +816,8 @@ A model installed through Ollama is kept in Ollama's internal storage and is not
816 816
817 ## Inline images817 ## Inline images
818 818
819+Scripts and shell commands launched by zot inherit `ZOT_AGENT=1`. Use this signal when a script needs to distinguish execution inside zot from a standalone invocation.
820+
819 When a tool returns an image (for example `read` on a PNG), zot renders it inline on terminals that support it: **Ghostty**, **Kitty**, **iTerm2**, **WezTerm**. On other terminals you see a text placeholder with MIME type, pixel dimensions, and byte size. Control with the `ZOT_INLINE_IMAGES` env var:821 When a tool returns an image (for example `read` on a PNG), zot renders it inline on terminals that support it: **Ghostty**, **Kitty**, **iTerm2**, **WezTerm**. On other terminals you see a text placeholder with MIME type, pixel dimensions, and byte size. Control with the `ZOT_INLINE_IMAGES` env var:
820 822
821 | Value | Effect |823 | Value | Effect |
M packages/agent/args_test.go +10 -0
@@ -98,6 +98,16 @@ func TestRunHelpHelperProcess(t *testing.T) {
9898 os.Exit(0)
9999 }
100100
101+func TestRunSetsAgentEnvironment(t *testing.T) {
102+ t.Setenv("ZOT_AGENT", "")
103+ if err := Run([]string{"--help"}, "test"); err != nil {
104+ t.Fatalf("Run returned %v", err)
105+ }
106+ if got := os.Getenv("ZOT_AGENT"); got != "1" {
107+ t.Fatalf("ZOT_AGENT = %q, want %q", got, "1")
108+ }
109+}
110+
101111 func TestHelpOutputStreams(t *testing.T) {
102112 run := func(args string) (stdout, stderr string, err error) {
103113 t.Helper()
@@ -98,6 +98,16 @@ func TestRunHelpHelperProcess(t *testing.T) {
98 os.Exit(0)98 os.Exit(0)
99 }99 }
100 100
101+func TestRunSetsAgentEnvironment(t *testing.T) {
102+ t.Setenv("ZOT_AGENT", "")
103+ if err := Run([]string{"--help"}, "test"); err != nil {
104+ t.Fatalf("Run returned %v", err)
105+ }
106+ if got := os.Getenv("ZOT_AGENT"); got != "1" {
107+ t.Fatalf("ZOT_AGENT = %q, want %q", got, "1")
108+ }
109+}
110+
101 func TestHelpOutputStreams(t *testing.T) {111 func TestHelpOutputStreams(t *testing.T) {
102 run := func(args string) (stdout, stderr string, err error) {112 run := func(args string) (stdout, stderr string, err error) {
103 t.Helper()113 t.Helper()
M packages/agent/cli.go +5 -0
@@ -206,6 +206,11 @@ func fanoutAgentEvent(mgr *extensions.Manager, ev core.AgentEvent) {
206206
207207 // Run is the top-level entrypoint for the zot binary.
208208 func Run(rawArgs []string, version string) error {
209+ // Mark the process and all child processes as running under zot. This
210+ // lets shell tools, extensions, and scripts distinguish zot execution
211+ // from an ordinary invocation.
212+ _ = os.Setenv("ZOT_AGENT", "1")
213+
209214 // Apply network configuration before any subcommand can make an HTTP
210215 // request. Standard proxy environment variables retain precedence.
211216 applyConfiguredHTTPProxy()
@@ -206,6 +206,11 @@ func fanoutAgentEvent(mgr *extensions.Manager, ev core.AgentEvent) {
206 206
207 // Run is the top-level entrypoint for the zot binary.207 // Run is the top-level entrypoint for the zot binary.
208 func Run(rawArgs []string, version string) error {208 func Run(rawArgs []string, version string) error {
209+ // Mark the process and all child processes as running under zot. This
210+ // lets shell tools, extensions, and scripts distinguish zot execution
211+ // from an ordinary invocation.
212+ _ = os.Setenv("ZOT_AGENT", "1")
213+
209 // Apply network configuration before any subcommand can make an HTTP214 // Apply network configuration before any subcommand can make an HTTP
210 // request. Standard proxy environment variables retain precedence.215 // request. Standard proxy environment variables retain precedence.
211 applyConfiguredHTTPProxy()216 applyConfiguredHTTPProxy()

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