Dor Tools

Dor Tools

A Dor Tool is a command that Dormouse runs in a pane and shows as a page. The pane is a terminal and a browser at once: the command runs in the terminal, and the page it serves fills the pane. A dev server, a file viewer, and a review board are all Tools.

This repository holds the Tool protocol, helpers for building a Tool, and the Tools that Dormouse bundles.

1. Wrap a command you already run

Put a dormouse.yml at the root of your project:

tools:
  # This project's dev server.
  dev:
    run: npm run dev
    port: auto
    prespawn_dedupe: [dev, $HERE]

Then, in a Dormouse terminal anywhere inside the project:

dor tool dev

Dormouse asks once whether to allow this project's file, then opens a pane showing the page your dev server serves.

dor tool --list prints every Tool Dormouse can see from where you are.

2. Change a built-in Tool

Dormouse opens files and folders in its own Tools: a file viewer with text, Markdown, and image editors, a code editor, and a folder view. Their source is suite/. Build a copy, import it into your user file, and add rules for which files open in it. The bundled Tools stay the default for everything else, and stay available by name.

suite/README.md has the steps.

3. Write your own

A Tool is an entry under tools: in one of two files:

File Holds Approval
dormouse.yml in a project Tools for that project Asked once per project
~/.config/dormouse/dormouse.yml, your user file Your own Tools, in every project None

A Tool you keep across projects can live in a folder of its own beside the user file. Declare it in a dormouse.yml in that folder, then import it into the user file by name:

tools:
  # Notes board, declared as `notes` in notes-tool/dormouse.yml beside this file.
  notes:
    from: notes-tool

A Tool can also tell Dormouse things while it runs, by printing short escape sequences:

It says Dormouse then
which port and path to show shows that page
it has unsaved changes asks before closing the pane, and can ask the Tool to save
open this file opens it as dor open would
it can be restarted from its arguments stops it after a while out of sight, and starts it again when shown

dor skill tools prints the full guide, with every sequence and the loop for changing a running Tool. It is written for a coding agent.

PROTOCOL.md is the protocol itself, for a terminal that wants to host Tools and for a Tool written without these packages. It is a draft for 0.1.

Packages

Package Folder What it is
@dor-tools/api api/ The Tool protocol (OSC 367), for Tools and for the hosts that run them. No runtime dependencies.
@dor-tools/scaffold scaffold/ Helpers for building a Tool on api: the loopback server under a capability URL, the save relay, the page's theme. Depends only on api.
@dor-tools/suite suite/ The file, code, and folder Tools that Dormouse bundles as builtin:file, builtin:code, and builtin:folder, built on scaffold.

Each builds on the one above it, and each is published to npm under @dor-tools. They are at 0.x: the protocol and the APIs may change before 1.0.

Build

It needs pnpm, which fetches the Node.js version this repository pins:

pnpm install
pnpm build
pnpm test

Each package's test script builds it and runs its tests.

License

MIT, covering every package.