yuke Docs
Modules

Modules

What index.js may import. yuke ships every module, so there is no package manager and no install step.

yuke

The public facade, and the only name most configs need. It is a reserved import: a file called yuke.js beside your index.js does not shadow it.

defineConfig Validate and merge settings, then export the result.
tools tools.define({ name, description, parameters, execute }).
commands commands.define({ name, title, description, run }), optionally with slash.
plugins The plugin registry — see Plugins.

yuke:fs

File access. A config can read a value off disk instead of an inline copy. Every call is async. A relative path anchors at the directory the host runs in. Each call also takes an optional workspaceRoot, which anchors it elsewhere.

import { defineConfig } from "yuke";
import { fs } from "yuke:fs";

const prompt = (await fs.readFile("prompt.txt")).trim();

export default defineConfig({ systemPrompt: prompt });
Method Resolves Meaning
readFile(path, root?) string Read a whole file. Rejects on invalid UTF-8.
readRange(path, range?, root?) RangeRead Read bounded whole lines. Not a string — see below.
writeFile(path, contents, root?) number Replace the whole file, and answer the byte count.
stat(path?) Stat | null Null when nothing is at the path.
list(path?) Page One page of directory entries.

The three shapes those return:

Stat      { isDirectory, lastModifiedMs }
RangeRead { text, next, longLines }   // `next` is the line to resume at, or null
Page      { path, parent, entries, more }
PageEntry { name, path, is_git_repo }

yuke:exec

Runs one shell line in a fresh shell. Nothing carries to the next call and stdin is closed. A deadline stops the whole process group, so a background child never outlives the call.

import { exec } from "yuke:exec";

const { stdout, code } = await exec("git rev-parse --short HEAD");

The options are cwd, timeoutMs (default 120000, maximum 600000) and signal.

The result carries stdout, stderr, code, signal and timedOut. code is null after a signal or a deadline. stdoutDropped and stderrDropped count the bytes that the stream dropped between its head and its tail.

yuke:tools

The lower-level form of tools on the facade, plus a removal. yuke calls execute with three arguments: the parsed arguments, an abort signal, and a context. The context always holds workspaceRoot. It also holds sessionId, messageId and partId when the call belongs to a turn.

import { defineTool, removeTool } from "yuke:tools";

defineTool("head", {
  description: "Read the first bytes of a file.",
  parameters: { type: "object", properties: { path: { type: "string" } }, required: ["path"] },
  async execute({ path }, signal, { workspaceRoot }) {
    const { text } = await fs.readRange(path, { end: 4096 }, workspaceRoot);
    return text;
  },
});

yuke:diff

diff(path, before, after) compares two texts and resolves { path, hunks }. path only labels the result. Hunk starts are 1-based, and a side with no line carries start 0 and count 0. An equal pair, a side above the size cap, and a change too large to describe all answer no hunk.

yuke:core

The interface toolkit, for a config that rebinds a key or restyles the view. It loads under --rpc too, where nothing renders.

import { keymap, style } from "yuke:core";

keymap.add({ "ctrl+q": "home:quit" });
style.groups.YukeRule = { fg: "danger", dim: false };

Colours are named highlight groups, in the vim sense. They are not loose hex values. style.palette holds fg, bg and danger. style.groups maps a name such as YukeHeader to a style. It can also map that name to another group through link.

It also carries config and defineConfig, the command and context registries, route, slot, events and Emitter. It adds text helpers for measurement, wrap points and caret arithmetic.

yuke:term

The raw terminal surface underneath yuke:core: beginFrame, endFrame, fill, text, measure, cursor, copy, quit, and the width, height and cwd readings. Use it only when yuke:core cannot express what you must draw.

The interface's own modules

Around twenty more yuke: names are the parts of the built-in interface. They include yuke:chat, yuke:sessions, yuke:catalog, yuke:agents, yuke:auth and yuke:vim.

They import cleanly, and the interface builds on them. A plugin that replaces a piece of the UI will therefore use them. They carry no stability promise. The modules above ship hand-written type declarations, and these do not.