npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@tinykode/tinykode

v1.0.0

Published

A lightweight code assistant library with CLI support

Downloads

6

Readme

TinyKode

A lightweight code assistant library with CLI support.

Installation

As a global CLI tool

npm install -g tinykode

Then use the CLI:

tinykode

As a local dependency

npm install tinykode

Usage

Programmatic Usage

import { TinyKode } from "tinykode";

const tinykode = new TinyKode({
    workspaceRoot: process.cwd()
});

const messages = await tinykode.processQuery({
    query: "Create a file named hello.txt with the content 'Hello, World!'",
});

CLI Usage

After installing globally, run:

tinykode

This will start an interactive session where you can type your queries.

Available commands in CLI:

  • Type any query and press Enter
  • Type exit or quit to close the CLI
  • Use Ctrl+C for immediate exit

Programmatic CLI Usage

You can also create and customize the CLI programmatically:

import { createCLI, setupEventHandlers } from "tinykode";

const cli = createCLI({
    prompt: "my-cli> ",
    welcomeMessage: "Welcome to my custom CLI!",
    exitCommands: ['exit', 'quit', 'bye'],
    tinykodeConfig: {
        workspaceRoot: process.cwd()
    },
    onExit: () => {
        console.log('Custom goodbye message!');
        process.exit(0);
    }
});

setupEventHandlers(cli);
await cli.start();

Configuration

TinyKode CLI can be configured using a JSON file located at ~/.tinykode/tinykode.json.

Example Configuration

{
  "workspaceRoot": "/path/to/your/projects",
  "customOption": "value"
}

The configuration object is passed directly to the TinyKode constructor, so any valid TinyKode configuration options can be specified.

TinyKode

Main class for interacting with the code assistant.

Constructor

new TinyKode(config, tools, messages)
  • config: Configuration object (optional, uses default config if not provided)
  • tools: Tools map (optional, uses default tools if not provided)
  • messages: Initial messages array (optional, defaults to empty array)

Methods

processQuery(options)

Process a user query and return the conversation messages.

const messages = await tinykode.processQuery({
    query: "Your query here",
    onUpdate: (chunk) => console.log(chunk),
    onToolCalls: (toolCalls) => console.log('Tool calls:', toolCalls),
    onToolResults: (toolResults) => console.log('Tool results:', toolResults),
    onToolConfirm: async ({ tool, params }) => {
        // Return true to confirm tool execution, false to deny
        return true;
    }
});

Options:

  • query (string, required): The user query to process
  • onUpdate (function, optional): Callback for streaming text updates
  • onToolCalls (function, optional): Callback when tools are called
  • onToolResults (function, optional): Callback when tool results are available
  • onToolConfirm (function, optional): Callback to confirm tool execution

CLI API

createCLI(options)

Create a customizable CLI instance.

const cli = createCLI({
    prompt: "> ",                    // CLI prompt (default: ">")
    welcomeMessage: null,            // Welcome message (default: none)
    tinykodeConfig: {},              // TinyKode configuration
    exitCommands: ['exit', 'quit'],  // Commands that exit the CLI
    onExit: () => process.exit(0)    // Custom exit handler
});

Returns an object with:

  • start(): Start the CLI loop
  • processQuery(query): Process a single query
  • cleanup(): Clean up resources
  • tinykode: Access to the underlying TinyKode instance

setupEventHandlers(cli)

Set up standard event handlers for the CLI (SIGINT, SIGTERM, uncaught exceptions).

input(question)

Utility function for prompting user input in CLI applications.

License

ISC