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 🙏

© 2026 – Pkg Stats / Ryan Hefner

fileofy

v1.0.1

Published

AI-powered file modification library using Gemini

Readme

Fileofy

npm version License: MIT TypeScript Node.js

A TypeScript library that uses Google's Gemini AI to interpret text instructions and perform file modifications. The library can create, update, or delete files based on natural language input.

Features

  • 🤖 Powered by Google's Gemini AI
  • 📝 Create, update, or delete files using natural language
  • 🎯 Precise line-based modifications
  • 🔒 Type-safe with TypeScript
  • 🌟 Simple, promise-based API

Installation

npm install fileofy

Setup

  1. Get a Gemini API key from Google AI Studio
  2. Create a .env file in your project root:
GEMINI_API_KEY=your_api_key_here

Usage

import { applyFileModification } from 'fileofy';

// Example: Create a new file
await applyFileModification('Create a new file called hello.txt with the content "Hello, World!"');

// Example: Update existing file
await applyFileModification('In main.ts, replace lines 5-10 with a console.log statement');

// Example: Delete file
await applyFileModification('Delete the temporary.txt file');

File Modification Schema

The library uses a structured schema for file modifications:

{
  filePath: string;    // Path to the file to modify
  operation: "create" | "update" | "delete";  // Type of operation
  content: string;     // Content for create/update operations
  startLine: number;   // Starting line (1-based, always 1 for create, -1 for last line)
  endLine: number;     // Ending line (1-based, -1 for last line)
}

Special Line Numbers

  • For create operations: startLine must be 1
  • For update operations: Use -1 to reference the last line of the file
  • Line numbers are 1-based (first line is 1, not 0)

API Reference

applyFileModification(text: string, customGenAI?: GoogleGenerativeAI): Promise<void>

Applies file modifications based on text input using Google's Generative AI.

Parameters

  • text: The text input containing file modification instructions
  • customGenAI (optional): Custom GoogleGenerativeAI instance for testing

Throws

  • Error if GEMINI_API_KEY is not set when no custom GenAI is provided
  • Error if file modification execution fails

Future Enhancements

  • [ ] Support for additional LLM providers (OpenAI, Anthropic, etc.)
  • [ ] Batch file modifications
  • [ ] Dry-run mode for previewing changes
  • [ ] File backup/restore functionality
  • [ ] Support for regex-based modifications
  • [ ] Custom prompt templates

Requirements

  • Node.js 16+
  • TypeScript 4.5+
  • Valid Gemini API key

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT


Note: This library currently only supports Google's Gemini AI. Support for other LLM providers is planned for future releases.