libs directory, default main function

This commit is contained in:
Shivering Ocelot committed 2026-10-02 08:28:51 -05:00
1 parent a08c41a426
commit 80454f9a2a
3 files changed
+50 -12

No files matched your search

+3 -1
View File
@@ -2,12 +2,14 @@
Clone the repository, then install with `npm install -g .`.
Usage: `gral <function> -p <prompt>`, or pass a file as a prompt instead with the `-f <prompt-file>` option.
Usage: `gral <function> -p <prompt>`, or pass a file as a prompt instead with the `-f <prompt-file>` option. 'main' is the default function if it exists, otherwise a function name is required.
Gral uses the `.gral` directory from the working path for its configuration. The horde connection uses the 'host' and 'token' values stored in `.gral/config.json`, or loads them from the environment if not present.
Every javascript module in `.gral/functions` exports a default function, it receives a single prompt string argument. These are the functions invoked by the gral command, you can list them with `gral -l`.
Shared libraries live in `.gral/lib`. Any module there can be imported from a function module using the `@lib/` prefix.
The `Gral` global is available in the function module scopes, and exposes:
- `path`: the working directory
- `run`: the run command for sending prompts to agents