Skip to content

Latest commit

 

History

History
78 lines (53 loc) · 2.54 KB

File metadata and controls

78 lines (53 loc) · 2.54 KB

Contributing to Toolpack SDK CLI

First, thank you for your interest in contributing to the Toolpack SDK CLI!

This CLI serves as the front-line interactive tool for the main Toolpack SDK. All contributions, from bug fixes and documentation improvements to new screen modes and commands, are welcome.

Architecture Overview

The toolpack-cli is built using a combination of technologies designed to bring a React-like reactive experience to the terminal:

  • Ink: Provides the core React reconciler for the terminal, allowing us to build TUI components logically using JSX.
  • React: Manages the component lifecycle and context providers (ToolpackContext, ConversationContext).
  • TypeScript: The entire codebase is strongly typed.

Directory Structure

  • source/components/: Reusable UI elements (Buttons, Layouts, Selectors).
  • source/commands/: Chat slash-commands (e.g. /help, /mode, /tool-log). If you want to add a new command, register it here.
  • source/screens/: High-level views (Home vs. Chat).
  • source/context/: React context providers managing the state between the CLI and the underlying toolpack-sdk.

Development Setup

  1. Clone the repository:

    git clone https://github.com/toolpack-ai/toolpack-cli.git
    cd toolpack-cli
  2. Install dependencies: Ensure you have Node.js 20+ installed.

    npm install
  3. Set up Environment: Copy the example environment file:

    cp .env.example .env

    Add at least one API key (e.g. TOOLPACK_OPENAI_KEY) so the CLI can function. Local Ollama instances work without keys.

  4. Run in Development Mode:

    npm run dev

    This will start tsx --watch so the CLI automatically restarts when you save file changes.

Testing Your Changes

Before submitting a Pull Request, please ensure the code lints and builds correctly:

  1. Format and Lint:

    npm run test

    We use xo for linting and prettier for formatting. ava is set up for basic tests.

  2. Build:

    npm run build

    This outputs to dist/, which is executed by the actual toolpack global bin command.

Pull Request Process

  1. Fork the repository and create your branch from main.
  2. Ensure any new functionality includes updated documentation in README.md and/or inline JSDoc comments.
  3. Reference any related issues in your PR description.
  4. Keep your PR scope focused to make it easier to review.

We're excited to see what you build!