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.
To install the AI Toolkit globally, run:
npm install -g @markwylde/aitk
aitk [command] [options] [directory1] [directory2] ...
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"
cat
: Dump all file contents into a text filels
: Show a recursive directory tree of all filestypes
: List all types and function signatures for TypeScript and JavaScript filesask
: Ask a question to an AI modelprompt
: Ask an AI model to generate a prompt for changing your codeedit
: Apply AI-powered edits to files in the current directoryhelp
: Show the help message
--help
: Show help message
-
List all files in the current directory:
aitk ls
-
Dump contents of all files in a specific directory:
aitk cat /path/to/directory
-
List files in multiple directories:
aitk ls /path/to/dir1 /path/to/dir2
-
Extract types and function signatures from TypeScript and JavaScript files:
aitk types /path/to/directory
-
Ask a question to an AI model:
aitk ask "Who are you?"
-
Apply AI-powered edits to files in the current directory:
aitk edit "Refactor the main function to use async/await"
-
Show help message:
aitk help
- 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
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.
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.
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.
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.