Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ documentation site, [docs/](docs/src/content/docs/index.mdx).
```sh
make setup # once: the switch spool, all dependencies
make test # starts the test Postgres in Podman, runs every test
make lint # formatting, odoc, the release build, litany, and the dashboard's bundle rebuilt and compared
make lint # formatting, odoc, the release build, Hypha's rules by litany, and the dashboard's bundle rebuilt and compared
make fmt # format in place
make dashboard # the dashboard's page built into dashboard/assets, to commit
make docs # the documentation site into _build/docs, as Pages publishes it, and
Expand Down Expand Up @@ -163,4 +163,9 @@ you broke it. Cite an entry by its bold phrase.
run; and the dashboard page's entry, built without the element it draws
in -- each a constant written in source or a build. Symptom: `make
lint`'s litany reports `restricted-dependency` outside `src/spool.ml`
and `dashboard/web/src/main.ml`.
and `dashboard/web/src/main.ml`, by spool's own forbid among Hypha's.
- **The `litany` file's two `per-path`s are the page's client and its
printer**: `dashboard/web/printer/`, a build-time program that prints the
client and its errors, and the client, `dashboard/web/src/api.ml`, which
Spindle's printer writes as the build runs, so its code is Spindle's to
hold.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changes

## 0.7.2 (2026-12-03)

- Every package installs the documentation for agents, `llms.txt` and every
page, in `$(opam var <package>:doc)`, and every interface it installs
names its page there, or `llms.txt`. The README's *With an agent* says so.

## 0.7.1 (2026-11-22)

- The spool package installs its documentation for agents: each page as
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ build: ## build everything
test: db ## run the tests
SPOOL_TEST_PG=$(PG_TEST_URL) $(OPAM) dune test --force

# Release is the profile opam installs with.
lint: dashboard-check ## check formatting, docs, the release build, litany's rules and the dashboard's bundle
# Release is the profile opam installs with. litany holds the code to
# Hypha's rules, as the litany file selects them.
lint: dashboard-check ## check formatting, docs, the release build, Hypha's rules and the dashboard's bundle
$(OPAM) dune build @all @fmt @doc
$(OPAM) dune build --profile release @all
$(OPAM) litany check
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ and `Spool.Runner.stop` stops it.

## With an agent

Each release installs its documentation for an agent with it, at
`$(opam var spool:doc)`: `llms.txt`, and every page in Markdown. An agent
reads it when your project's `AGENTS.md` tells it to:
Every package of spool installs its documentation for an agent with it, at
`$(opam var <package>:doc)`: `llms.txt`, and every page in Markdown. An
agent reads it when your project's `AGENTS.md` tells it to:

```md
Before writing code with spool, read `$(opam var spool:doc)/llms.txt` and
the pages it lists for the parts you need, and use those parts rather than
writing your own.
Before working with spool, read `llms.txt` in `$(opam var <package>:doc)`, for
any spool package the project installs, then the pages it lists for the parts
you need, and use those parts rather than writing your own.
```

## Contributing
Expand Down
5 changes: 4 additions & 1 deletion dashboard/bundle.mli
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
(** The page's files, as Vite built them into [dashboard/assets/]: written by
[ocaml-crunch] as the package builds, by their path below that directory --
["index.html"], ["assets/index-<hash>.js"]. *)
["index.html"], ["assets/index-<hash>.js"].

Its documents, a page for each part:
[$(opam var spool-dashboard:doc)/llms.txt]. *)

val file_list : string list
val read : string -> string option
Expand Down
5 changes: 4 additions & 1 deletion dashboard/live.mli
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
(** The queue's live state, read once a second by one fiber of the process while
anyone watches, and sent to every viewer as what changed. *)
anyone watches, and sent to every viewer as what changed.

Its documents, a page for each part:
[$(opam var spool-dashboard:doc)/llms.txt]. *)

type stream
(** The live route's events. *)
Expand Down
6 changes: 6 additions & 0 deletions dashboard/spool_dashboard.mli
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
(** A live dashboard for spool's queue, as routes of the application's own
Spindle server.

Its documents, a page for each part:
[$(opam var spool-dashboard:doc)/llms.txt].

Its page, with its examples:
[$(opam var spool-dashboard:doc)/pages/guide/dashboard.md].

{[
let db : Spindle_postgres.Pool.t Spindle.Dep.t =
Spindle.Dep.of_resource "database"
Expand Down
5 changes: 4 additions & 1 deletion dashboard/wire.mli
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
(** What the dashboard's routes read and answer, as wiretype descriptions: the
one contract the page's client is printed from. *)
one contract the page's client is printed from.

Its documents, a page for each part:
[$(opam var spool-dashboard:doc)/llms.txt]. *)

type action =
| View
Expand Down
13 changes: 10 additions & 3 deletions dune
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@
(migrations/*.sql with_prefix migrations))))

; The documentation for a user's agent, agents/, written from the site's pages
; by `make docs`: spool installs it whole, so $(opam var spool:doc) holds
; llms.txt and each page.
; by `make docs`: every package installs it whole, so a package installed
; alone, spool-dashboard without spool, still holds llms.txt and each page in
; $(opam var <package>:doc).

(install
(section doc)
(package spool)
(section doc)
(source_trees
(agents as .)))

(install
(package spool-dashboard)
(section doc)
(source_trees
(agents as .)))
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
(timedesc (>= 3.1.2))
(eio_main (and :with-test (>= 1.5)))
(alcotest (and :with-test (>= 1.9.1)))
(hypha-litany (and :with-dev-setup (>= 1.2.2) (< 2.0.0)))
(hypha-litany (and :with-dev-setup (>= 1.3.0) (< 2.0.0)))
(merlin (and :with-dev-setup (>= 5.6-504)))
(ocaml-lsp-server (and :with-dev-setup (>= 1.25.0)))
(ocamlformat (and :with-dev-setup (= 0.29.0)))
Expand Down
236 changes: 233 additions & 3 deletions litany
Original file line number Diff line number Diff line change
@@ -1,9 +1,239 @@
; The rules of Hypha's and spool's own a lint holds, beyond litany's default set.
; Hypha's lint set, as litany holds it. Every Hypha repository's litany file
; selects each rule here and keeps each forbid as it is written here; what is
; the repository's own -- a forbid more, a per-path -- is added with its
; reason. Hypha's OCAML.md says what each rule is for.

(litany-config 1)

(lint
(select default)
(extend open-of-ordinary-module restricted-dependency))
(extend
unsafe-partial-stdlib
unsafe-obj-magic
untyped-ignore
ignored-result
wildcard-over-owned-variant
open-of-ordinary-module
restricted-dependency))

(rule restricted-dependency
; Refused in every file.
(forbid Stdlib.failwith
(use "a result; a test that raises on purpose declares its own exception"))
(forbid Stdlib.compare
(use "the type's own comparison: Int.compare, String.compare"))
(forbid Stdlib.min
(use "the type's own: Int.min, Float.min"))
(forbid Stdlib.max
(use "the type's own: Int.max, Float.max"))
(forbid Unix.time
(use "the clock the caller gives, read as a Ptime.t"))
(forbid Unix.gettimeofday
(use "the clock the caller gives, read as a Ptime.t"))
(forbid Stdlib.Sys.time
(use "Eio.Time.Mono.now, for time that has passed"))
(forbid Unix.sleep
(use "Eio.Time.Mono.sleep_span"))
(forbid Unix.alarm
(use "Eio.Time.Timeout.v"))
(forbid Unix.setitimer
(use "Eio.Time.Timeout.v"))
(forbid Unix.getitimer
(use "Eio.Time.Mono.now"))
(forbid Eio_unix.sleep
(use "Eio.Time.Mono.sleep_span"))
(forbid Eio.Time.sleep
(use "Eio.Time.Mono.sleep_span"))
(forbid Eio.Time.sleep_until
(use "Eio.Time.Mono.sleep_span, over the span from now to the instant"))
(forbid Eio.Time.with_timeout
(use "Eio.Time.Timeout.v, given an Mtime.Span.t"))
(forbid Eio.Time.with_timeout_exn
(use "Eio.Time.Timeout.v, given an Mtime.Span.t"))
(forbid Eio.Time.Timeout.seconds
(use "Eio.Time.Timeout.v, given an Mtime.Span.t"))
(forbid Eio.Time.Mono.sleep
(use "Eio.Time.Mono.sleep_span"))
(forbid Uri.query
(use "what the router decoded and validated"))
(forbid Uri.get_query_param
(use "what the router decoded and validated"))
; Refused outside a library's clock module.
(forbid Eio.Time.now
(use "the library's instant.ml, which gives a Ptime.t")
(except **/instant.ml))
(forbid Unix.sleepf
(use "the library's instant.ml, which takes an Mtime.Span.t")
(except **/instant.ml))
; Refused in a library: a program, a test and an example own their process,
; wherever in the tree its bin/, test/, examples/ or bench/ is.
(forbid Stdlib.Sys.getenv
(use "a value the executable read at startup and passed in")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Sys.getenv_opt
(use "a value the executable read at startup and passed in")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Unix.getenv
(use "a value the executable read at startup and passed in")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Unix.environment
(use "a value the executable read at startup and passed in")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Unix.putenv
(use "an argument: a library sets no global state")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Sys.argv
(use "a value the executable read at startup and passed in")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Sys.signal
(use "the executable: it owns the process's signals")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Sys.set_signal
(use "the executable: it owns the process's signals")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Sys.chdir
(use "a directory capability the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Sys.command
(use "Eio.Process, on the process manager the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.at_exit
(use "Eio.Switch.on_release, on the switch the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Random.self_init
(use "a Random.State.t, or the secure random source the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Random.init
(use "a Random.State.t, or the secure random source the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Logs.set_reporter
(use "the executable: it configures the log reporter")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Logs.set_level
(use "the executable: it configures the log level")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.print_string
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.print_endline
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.print_bytes
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.print_char
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.print_int
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.print_float
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.print_newline
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.prerr_string
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.prerr_endline
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.prerr_bytes
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.prerr_char
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.prerr_int
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.prerr_float
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.prerr_newline
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.stdout
(use "a sink the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.stderr
(use "a sink the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Printf.printf
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Printf.eprintf
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Format.printf
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Format.eprintf
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Format.print_string
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Format.std_formatter
(use "a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Stdlib.Format.err_formatter
(use "a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Fmt.pr
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Fmt.epr
(use "a log on the library's own source, or a formatter the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Eio_main.run
(use "the env, switch or capability the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Ptime_clock.now
(use "the clock or ~now the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Mtime_clock.now
(use "the clock the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Mtime_clock.elapsed
(use "the clock the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Mtime_clock.counter
(use "the clock the caller gives")
(except **/bin/** **/test/** **/examples/** **/bench/**))
; Refused in a Melange library: the console is the page's.
(forbid Js.log
(use "a value returned to the caller")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Js.log2
(use "a value returned to the caller")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Js.log3
(use "a value returned to the caller")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Js.log4
(use "a value returned to the caller")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Js.logMany
(use "a value returned to the caller")
(except **/bin/** **/test/** **/examples/** **/bench/**))
(forbid Js.Console
(use "a value returned to the caller")
(except **/bin/** **/test/** **/examples/** **/bench/**))
; spool's own: invalid_arg is a constant's alone, where AGENTS.md says.
(forbid Stdlib.invalid_arg
(use "a result: invalid_arg is a constant's, written in source: Kind.make's and Schedule.make's")
(except src/spool.ml dashboard/web/src/main.ml test/** examples/**)))
(except src/spool.ml dashboard/web/src/main.ml **/test/** **/examples/**)))

; spool's own.

(per-path
(paths dashboard/web/printer/**)
(ignore restricted-dependency)
(reason "a build-time program: it prints the page's client, which dune writes into api.ml, and its errors, and exits with its status"))

(per-path
(paths _build/default/dashboard/web/src/api.ml)
(ignore unsafe-obj-magic unsafe-partial-stdlib wildcard-over-owned-variant)
(reason "the page's client as Spindle prints it while dune builds, never kept: its code is Spindle's printer's to hold, and no attribute of spool's can reach it"))
2 changes: 1 addition & 1 deletion spool.opam
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ depends: [
"timedesc" {>= "3.1.2"}
"eio_main" {with-test & >= "1.5"}
"alcotest" {with-test & >= "1.9.1"}
"hypha-litany" {with-dev-setup & >= "1.2.2" & < "2.0.0"}
"hypha-litany" {with-dev-setup & >= "1.3.0" & < "2.0.0"}
"merlin" {with-dev-setup & >= "5.6-504"}
"ocaml-lsp-server" {with-dev-setup & >= "1.25.0"}
"ocamlformat" {with-dev-setup & = "0.29.0"}
Expand Down
Loading