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

@cogflows/promptcode-preset-mcp

v1.0.2

Published

CLI tool for managing file presets for code prompting

Readme

promptcode-preset-mcp

A CLI tool for managing file presets for code prompting. Quickly assemble collections of files from your codebase into prompts for AI/LLM interactions.

Installation

Global installation (recommended)

# Install from npm
pnpm install -g @cogflows/promptcode-preset-mcp

# Or install from GitHub
pnpm install -g github:cogflows/promptcode-preset-mcp

Local development

# Clone the repository
git clone https://github.com/cogflows/promptcode-preset-mcp.git
cd promptcode-preset-mcp

# Install dependencies
pnpm install

# Build and link globally
pnpm build
pnpm link --global

Usage

List presets

promptcode ls

Get preset content

# Export to temp file and print path
promptcode get <preset-name>

# Export and open in default editor
promptcode get <preset-name> --open

Set workspace directory

# Use environment variable
WORKSPACE=/path/to/project promptcode ls
WORKSPACE=/path/to/project promptcode get core

Creating Presets

Presets are JSON files stored in .promptcode/presets/ within your workspace directory.

Example preset file .promptcode/presets/core.json:

{
  "name": "core",
  "files": [
    "src/main.ts",
    "src/utils.ts",
    "README.md"
  ]
}

Example Workflow

  1. Create a presets directory in your project:

    mkdir -p .promptcode/presets
  2. Create preset files:

    echo '{
      "name": "api",
      "files": ["src/api/index.ts", "src/api/routes.ts", "src/types.ts"]
    }' > .promptcode/presets/api.json
  3. List available presets:

    promptcode ls

    Output:

    [
      {
        "name": "api",
        "fileCount": 3,
        "totalTokens": 1250
      }
    ]
  4. Export preset content:

    promptcode get api

    Output: /var/folders/.../T/preset-api-2025-06-02T19-12-41-238Z.txt

  5. Use the exported file with your AI tool:

    # Copy to clipboard (macOS)
    cat $(promptcode get api) | pbcopy
       
    # Or open directly
    promptcode get api --open

Features

  • Token counting: Uses OpenAI's tiktoken to count tokens in files
  • Caching: Token counts are cached for performance
  • Workspace support: Work with presets from any project directory
  • Clean output: Returns just the file path for easy scripting

Development

The project is written in TypeScript and uses:

  • Node.js ES modules
  • tiktoken for token counting
  • TypeScript for type safety

Project Structure

src/
├── cli.ts           # CLI interface
├── presetManager.ts # Preset loading/saving logic
├── tokenCounter.ts  # Token counting with caching
└── types/
    └── filePreset.ts # TypeScript interfaces