just-bash-executor
Convert a GraphQL endpoint, OpenAPI spec, or MCP server into bash CLI commands and a `tools.*` JS API runnable inside `just-bash`'s `js-exec` sandbox. Use when the user wants to expose a remote API to a sandboxed bash agent, build a tool-calling agent on top of just-bash, or generate CLI commands fr
Оригинален текст · няма потвърден превод на българскиПърво прочетете инструкцията.
Файлът се зарежда от посочения източник само по ваше действие. Можете да го прочетете тук, да го копирате или да го запазите като .md.
GitHub хранилище- Звезди на репото
- 3729
- Лиценз
- Не е посочен. Проверете в репозитория.
- Последна проверка на записа
- Няма посочена дата
Добавете в своя инструмент.
Командата отваря избора на skills от репозитория. Прочетете файла и условията на автора преди изпълнение.
npx skills add vercel-labs/just-bashСтраницата копира текст. Не инсталира и не изпълнява нищо на устройството ви.
Откъс от SKILL.md
Началото на файла на автора, без превод.
@just-bash/executor — agent guide
This file is for an AI agent writing code that uses @just-bash/executor. It
maps each input (an OpenAPI spec, a GraphQL endpoint, an MCP server, or your
own JS functions) to the exact code to write and the exact surfaces (JS API +
bash CLI) the user gets back.
Read top to bottom on the first task; jump by section number on later tasks.
§1. Decide which source kind you have
Have an OpenAPI spec / Swagger doc? → §3 OpenAPI
Have a GraphQL endpoint or SDL? → §4 GraphQL
Have an MCP server (URL or stdio)? → §5 MCP
Defining tools yourself in code? → §2 Inline
Mixing several of the above? → call sources.add() once per source
inside the same setup(); paths stay
namespaced by `name`
For all four, the consuming code is identical (§6, §7) — what changes is the
createExecutor config.
§2. Inline tools
Use when there's no upstream spec — the user wants to expose specific JS functions to the sandbox.
import { Bash } from "just-bash";
import { createExecutor } from "@just-bash/executor";
const executor = await createExecutor({
tools: {
"ns.action": {
description: "What it does",
execute: async (args: { /* shape */ }, { abortSignal }) => {
// Forward abortSignal to cancellable I/O.
return { /* JSON-serializable */ };
},
},
},
});
const bash = new Bash({
customCommands: executor.commands,
javascript: { invokeTool: executor.invokeTool },
});
Conversion (single rule):
key in tools: {…} JS bash
"ns.action" → await tools.ns.action(args) ns action key=value
ns action --key value
ns action --json '{"key":1}'
The first dot-segment is the namespace command; the rest is the subcommand (kebab-cased, with the original form as an alias when different).
§3. OpenAPI → tools
Ask the user for: spec source, base endpoint, namespace name, and optional
auth headers.
The spec field accepts three forms:
spec: "https://petstore3.swagger.io/api/v3/openapi.json" // URL — fetched at setup
spec: fs.readFileSync("./openapi.yaml", "utf8") // YAML text
spec: JSON.stringify(specObject) // JSON text