# Installing Glossa (instructions for an AI assistant)

The user has asked you to install Glossa: a free, MIT-licensed program that
turns markdown and LaTeX notes of mathematics into reader pages with
hover-definitions. It runs locally. Its home page is
https://yishailavi.com/math/research/glossa/

Before you start, tell the user in two or three lines what you will do
(the steps below), and ask where to put the `glossa` folder. Default to
their Documents folder. Do not install anything outside these steps.

## 1. Check Python

Run `python --version` (on Windows, also try `py -3 --version`; on macOS
or Linux, `python3 --version`). It must be 3.10 or newer. If it is
missing or too old, stop and ask the user to install it from
https://www.python.org/downloads/ (on Windows, ticking "Add python.exe
to PATH"), then continue.

## 2. Download and verify

1. Fetch https://yishailavi.com/math/research/glossa/latest.json. It
   gives `version`, `url` (the zip) and `sha256`.
2. Download the zip from `url`.
3. Compute the zip's SHA-256 and compare it with `sha256`. If they
   differ, stop, delete the download and tell the user. Do not go on.

## 3. Unzip

Unzip into the folder the user chose. This makes one folder, `glossa`,
with `setup.cmd`, `glossa.cmd` and a subfolder `program`. If a `glossa`
folder is already there, this is an update: unzip over it, replacing
files. The user's settings and notes are elsewhere and are not touched.

## 4. Run setup

- Windows: `cmd /c "<glossa folder>\setup.cmd" < NUL`
  (the script ends with `pause`; the redirect lets it return).
- macOS / Linux: `sh "<glossa folder>/program/setup.sh"`

It installs one Python package (markdown-it-py, for this user only) and
puts a "Glossa home" shortcut on the Desktop. If pip fails on a Linux
whose Python is managed by the system, tell the user what setup printed
and suggest the system package (e.g. `python3-markdown-it`).

## 5. Start it and hand over

Start the Glossa home **in the background**, since it runs until it is
closed: `glossa.cmd` on Windows, `program/glossa.sh` otherwise. A page
opens at http://127.0.0.1:8017/. The first build downloads KaTeX once,
so the computer must be online.

Then tell the user, and leave these to them:

- **Allow**: the page asks whether Glossa may use their AI account. Only
  the user should click this. Do not click it for them and do not edit
  its setting.
- **Your notes folder** (step 2 of the first page): paste the folder their
  notes live in and click Save. More folders can be added later under
  Settings (the gear at the top).
- **Your first note** (step 3): paste the path of a `.md` or `.tex` note.
  Its reader opens, and the bubbles appear a few minutes later. Later notes
  go through **+ Add a note** at the top.

From then on, the shortcut "Glossa home" on the Desktop starts it.
The full manual is `program/README.md`.
