@jarkkojs/readseek-api
@jarkkojs/readseek-api
Shared ReadSeek contracts, validation, argument builders, binary resolution, and
a bounded node:child_process runner that also works under Bun.
Install
npm install @jarkkojs/readseek-api
@jarkkojs/readseek installs the optional platform binary and provides the
readseek CLI. Linux packages supply bin/readseek.AppImage; macOS and Windows
supply native executables. Installing the API also installs @jarkkojs/readseek
and its platform binary; plugins declare both packages directly.
Example
import {
buildTreeArgs,
resolveReadSeekBinaryFromPackages,
resolveReadSeekBinaryOverride,
runReadSeekNodeKdl,
} from "@jarkkojs/readseek-api";
const binary =
resolveReadSeekBinaryOverride() ?? resolveReadSeekBinaryFromPackages();
const args = buildTreeArgs({ path: "src/index.ts", depth: 2 });
const result = await runReadSeekNodeKdl(binary, args);
The API follows the CLI's single-word command grammar: show, tree,
meta, assets, search, grep, def, refs, syntax, check,
caption, objects, ocr, edit, and rename. Selection uses at.
Document content and asset results include usable cached image paths. There is no separate extraction step or destination argument. Cache population is an internal write; reading never invokes inference. Syntax checks return diagnostics even when the native process exits 1 (findings); exit 2 is a failure.
presentShowResult() and formatShowResult() provide shared readable output for
show, tree, meta, and assets. Summaries
identify selections and counts; bodies contain anchored lines, document sections,
structure trees, fields, or asset paths. Notices identify omitted source ranges
and how to continue. Formatting never mutates the decoded result.
This is a breaking contract: two-word verb-object methods, legacy inspect/extract
methods, and old command names are removed, not aliased.
Licensing
@jarkkojs/readseek-api is licensed under the Apache 2.0 license. See
LICENSE for more information.