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

@prmichaelsen/mage

v0.0.0

Published

CLI chatbot.

Downloads

3

Readme

Mage Terminal Chatbot

Mage is a command line interface chatbot that allows you to combine the power of your terminal with the power of LLM AI.

Mage is a simple utility that derives its potential from the command line tool ecosystem.

Features

  • Standard mode for quick queries
  • Interactive mode for extended conversations via --interactive
  • Output the generated prompts sent to the completion engine via --echo
  • Execute a command and analyze its output by prefixing a message with >

For instance, you can run > git diff, > ls, or > ps during an interactive session with Mage and ask it questions about the output.

Mage has no built in way to remember your conversations. Instead, you can leverage standard bash shell features such as output redirection and command substitution to persist conversations to disk or resume them later where you left off.

Installation

npm i -g @prmichaelsen/mage

Initial Setup

Mage is built on AWS Bedrock Claude Anthropic v2 and it requires CLI authentication with an AWS profile authorized to call Bedrock in order to work. See the AWS docs on CLI authentication.

aws sso login --profile my-profile

If you aren't authenticated and authorized, Mage fails silently.

Usage

mage "Hello Computer"

Hello!

API

mage [message]

--interactive, -i     Interactive mode for extended conversations
--echo, -e            Output the generated prompts sent to the completion engine

Examples

Quick query
mage "What is 2 + 2?"

2 + 2 = 4
Analyze command output

Here we use an interactive mage session to analyze the output of git diff.

mage -i


Hi there, I'm happy to help if I can. What can I assist you with?

---

> git diff

---

Okay, I've made a note of the command `git diff` that you ran and the output that was returned. Let me know if you need anything else!

---

Based on the diff, what does this code do?

---

This code implements a conversational AI assistant that allows the user to have a text conversation with an AI model. The user can provide input text, which is sent to the AI model to generate a response. The conversation continues interactively, with the user and AI model taking turns to add to the conversation. The code handles prompting the user for input, calling the AI model, printing the conversation with logging, and supporting some special commands like executing shell commands and capturing the output.

---
Persist a conversation to disk

Mage does not have any built in way to persist conversations. However, you can combine Mage with output redirection to persist conversations.

mage -ie "Hello World!" >> conversation.md
Continue a conversation from disk

Likewise, to continue a conversation, you can use command substitution.

mage -ie "$(cat conversation.md)" >> conversation.md

You can start any conversation using the command above the conversation file will be created if it doesn't exist.

-e or --echo tells Mage to format its output in the expected format for a Claude Anthropic prompt. If you plan to read from a persisted conversation, you need to include --echo in order for Mage to understand the preloaded conversation.

Tips

Use VS Code's Markdown Previewer to render your .md conversations.