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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@markwylde/aitk

v1.8.1

Published

A set of utilities for working with ai tools

Downloads

11

Readme

aitk (the ai toolkit)

AI Toolkit is a command-line utility for listing and dumping file contents in a directory structure, designed to assist with AI-related tasks. It now includes functionality to extract types and function signatures from TypeScript and JavaScript files, as well as AI-powered features for asking questions and editing files.

Installation

To install the AI Toolkit globally, run:

npm install -g @markwylde/aitk

Usage

aitk [command] [options] [directory1] [directory2] ...

Configuration

If you want to use the litellm ai features, you will need to ensure the following environment variables are set either in a near .env file, or in your shell environment:

export LITELLM_API_URL="http://localhost:4000"
export LITELLM_AUTH_TOKEN="your auth token"

Commands

  • cat: Dump all file contents into a text file
  • ls: Show a recursive directory tree of all files
  • types: List all types and function signatures for TypeScript and JavaScript files
  • ask: Ask a question to an AI model
  • prompt: Ask an AI model to generate a prompt for changing your code
  • edit: Apply AI-powered edits to files in the current directory
  • help: Show the help message

Options

  • --help: Show help message

Examples

  1. List all files in the current directory:

    aitk ls
  2. Dump contents of all files in a specific directory:

    aitk cat /path/to/directory
  3. List files in multiple directories:

    aitk ls /path/to/dir1 /path/to/dir2
  4. Extract types and function signatures from TypeScript and JavaScript files:

    aitk types /path/to/directory
  5. Ask a question to an AI model:

    aitk ask "Who are you?"
  6. Apply AI-powered edits to files in the current directory:

    aitk edit "Refactor the main function to use async/await"
  7. Show help message:

    aitk help

Features

  • Recursively lists files in a directory
  • Supports multiple directory inputs
  • Uses .aitkignore files for custom ignoring rules
  • Supports a global ~/.aitkignore file for system-wide ignore rules
  • Dumps file contents with file paths as headers
  • Displays directory structure with tree-like formatting
  • Extracts and lists types and function signatures from TypeScript and JavaScript files
  • AI-powered question answering
  • AI-powered file editing with diff view and HTML report generation

Ignore Rules

You can create a .aitkignore file in any directory to specify ignore rules. Additionally, a global ~/.aitkignore file can be used for system-wide ignore rules. The syntax is similar to .gitignore files.

Example .aitkignore file:

node_modules
*.log
build/

This will ignore the node_modules directory, all files with the .log extension, and the build directory.

Type and Function Extraction

The types command extracts and displays:

  • Function declarations (including export status)
  • Method declarations
  • Arrow functions
  • Interface declarations
  • Type alias declarations
  • Class declarations (including methods and properties)

This feature is particularly useful for quickly understanding the structure and API of TypeScript and JavaScript projects.

AI-Powered Features

Ask Command

The ask command allows you to ask questions to an AI model. It will prompt you to select a model from the available options and then provide an answer to your question.

Edit Command

The edit command applies AI-powered edits to files in the current directory. It generates an HTML report with diffs between the original and suggested content, which opens automatically in your default browser.