返回 Skill 列表
extension
分类: 开发与工程无需 API Key

librepl

librepl - 交互式REPL工具。Repl类可以创建带有自定义命令、状态持久化和终端格式化的命令行界面。支持依赖注入以提高可测试性。可用于构建CLI工具、交互式调试界面和开发者工具。

person作者: jakexiaohubgithub

librepl Skill

When to Use

  • Building interactive CLI tools
  • Creating debug and exploration interfaces
  • Adding REPL functionality to applications
  • Prototyping with persistent state

Key Concepts

Repl: Interactive command-line interface with custom commands, history, and state management.

Usage Patterns

Pattern 1: Create custom REPL

import { Repl } from "@copilot-ld/librepl";

const repl = new Repl({
  prompt: "agent> ",
  commands: {
    search: async (query) => {
      const results = await searchIndex(query);
      return JSON.stringify(results, null, 2);
    },
    help: () => "Commands: search <query>, help, exit",
  },
});

await repl.start();

Pattern 2: State persistence

const repl = new Repl({
  prompt: "> ",
  storage: storage,
  stateKey: "repl-state",
});
// State persists across sessions

Integration

Used by CLI tools like cli-chat and cli-search. Integrates with libformat for terminal output.