yeet global
O yeet
The yeet object is the primary host-provided API surface, installed as a global before script evaluation begins.
P yeet.args
yeet.args: Record<string, string | boolean | (string | boolean)[]> & { _: string[] }
A parsed, read-only object containing CLI arguments passed when the script was run. Parsing follows minimist conventions:
| Input | Result |
|---|---|
--foo bar | { foo: "bar" } |
--foo=bar | { foo: "bar" } |
--foo | { foo: true } |
--no-foo | { foo: false } |
--multi-word-flag | { multi_word_flag: true } — kebab-case is converted to snake_case |
-f bar | { f: "bar" } |
-abc | { a: true, b: true, c: true } |
bare-word | appended to _: [...] |
-- | halts flag parsing; remaining words go to _ |
| Duplicate flags | coalesce into arrays |
// yeet run script.js --verbose --tag alpha --count 3 file.txt
console.log(yeet.args);
// { verbose: true, tag: "alpha", count: "3", _: ["file.txt"] }
All values are strings or booleans. Numeric strings are not coerced to numbers automatically.
F yeet.exit
exit(): void
Terminates the running isolate. Any registered exit handlers run first.
yeet.exit();
O yeet.graph
Interface to the yeet system graph — a structured data query layer backed by GraphQL.
F yeet.graph.query
query(gql: string): Promise<{ data?: any; errors?: { message: string }[] }>
Executes a one-shot GraphQL query. Rejects with { code, message } only on transport-level failures.
const { data, errors } = await yeet.graph.query(
`{ host { uptime { uptime } } }`
);
if (errors) throw new Error(errors[0].message);
console.log(data.host.uptime.uptime);
A successful response looks like:
{
"data": { "host": { "uptime": { "uptime": 12345 } } }
}
On a GraphQL error:
{
"data": null,
"errors": [{ "message": "field 'foo' not found" }]
}
To explore what the graph exposes, run yeet graph dump for the full SDL or yeet graph query '<gql>' for ad-hoc queries from the shell.
F yeet.graph.subscribe
subscribe(gql: string, callback: (data: any) => void): string
Starts a live subscription to a GraphQL query. The callback fires each time new data arrives. Returns a ticket string — capture it if you intend to unsubscribe later.
const ticket = yeet.graph.subscribe(
`subscription {
network_interface_stats(interval_ms: 1000) {
name recv_bytes sent_bytes
}
}`,
(data) => console.log(data)
);
F yeet.graph.unsubscribe
unsubscribe(ticket: string): Promise<boolean>
Cancels a running subscription. Returns true if found and removed, false otherwise.
await yeet.graph.unsubscribe(ticket);