v0.0.25 5dbbcb9

README.md RawHistoryFolder

scratchpad — TypeScript extension example

Real .ts (not .js), no build step, no SDK. Runs via npx tsx, which downloads itself into the npm cache on first invocation and runs from cache on every subsequent call.

Demonstrates:

  • registering slash commands (/note, /notes, /clear-notes)
  • registering an LLM-callable tool (read_notes)
  • the wire protocol from a typed TypeScript perspective
  • running TypeScript via npx tsx from extension.json

Requirements

Node 18+. The first time you use it, npx will quietly fetch tsx into the npm cache (~5 MB, one-shot). If you'd rather pre-install globally:

npm install -g tsx

…and change extension.json's exec to "tsx" and args to ["index.ts"] if you want.

Install

From this directory:

zot ext install .

Use

In zot:

  • /note remind me to update the changelog — appends to the scratchpad
  • /notes — shows everything stored
  • /clear-notes — wipes the scratchpad

The model also has a read_notes tool. Ask it:

"What did I tell you to remember?"

…and it will call the tool and tell you. The scratchpad is process-local: it lives only as long as the extension subprocess (i.e. the duration of one zot session).

Why TypeScript here

The extension protocol is small enough that you can hand-write it in any language. JS works fine; TS adds type safety on the frame shapes without any infrastructure beyond tsx. If you want richer ergonomics (decorators, schema-from-types), publish your own SDK on top.

See also

  • examples/extensions/clock — JS sibling (no tsx required)
  • examples/extensions/hello — Go SDK
  • examples/extensions/weather — Go SDK, exposes one tool
  • examples/extensions/guard — Go SDK, demonstrates intercepts
  • docs/extensions.md — full protocol reference
source
1# scratchpad — TypeScript extension example
2
3Real `.ts` (not `.js`), no build step, no SDK. Runs via `npx tsx`,
4which downloads itself into the npm cache on first invocation and
5runs from cache on every subsequent call.
6
7Demonstrates:
8
9- registering slash commands (`/note`, `/notes`, `/clear-notes`)
10- registering an LLM-callable tool (`read_notes`)
11- the wire protocol from a typed TypeScript perspective
12- running TypeScript via `npx tsx` from `extension.json`
13
14## Requirements
15
16Node 18+. The first time you use it, `npx` will quietly fetch `tsx`
17into the npm cache (~5 MB, one-shot). If you'd rather pre-install
18globally:
19
20```bash
21npm install -g tsx
22```
23
24…and change `extension.json`'s `exec` to `"tsx"` and `args` to
25`["index.ts"]` if you want.
26
27## Install
28
29From this directory:
30
31```bash
32zot ext install .
33```
34
35## Use
36
37In zot:
38
39- `/note remind me to update the changelog`  — appends to the scratchpad
40- `/notes`                                    — shows everything stored
41- `/clear-notes`                              — wipes the scratchpad
42
43The model also has a `read_notes` tool. Ask it:
44
45> "What did I tell you to remember?"
46
47…and it will call the tool and tell you. The scratchpad is
48process-local: it lives only as long as the extension subprocess
49(i.e. the duration of one `zot` session).
50
51## Why TypeScript here
52
53The extension protocol is small enough that you can hand-write it in
54any language. JS works fine; TS adds type safety on the frame shapes
55without any infrastructure beyond `tsx`. If you want richer ergonomics
56(decorators, schema-from-types), publish your own SDK on top.
57
58## See also
59
60- `examples/extensions/clock` — JS sibling (no tsx required)
61- `examples/extensions/hello` — Go SDK
62- `examples/extensions/weather` — Go SDK, exposes one tool
63- `examples/extensions/guard` — Go SDK, demonstrates intercepts
64- `docs/extensions.md` — full protocol reference

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