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

sameweb-cli

v1.0.9

Published

A CLI tool to clone websites into local folders using Puppeteer and AI. Useful for developers, researchers, and learners who want to quickly grab a site's structure and assets.

Downloads

5

Readme

sameweb CLI

A powerful CLI tool to clone websites and modify them with AI using Puppeteer + OpenAI.
With sameweb CLI, you can scrape websites, save them locally, and then use natural language queries to modify the cloned content — perfect for prototyping, experimentation, and rapid website iteration.


✨ Features

  • 🌐 Clone entire websites into local folders with accurate DOM structure
  • 🤖 AI-powered modifications using OpenAI GPT models
  • 💬 Interactive query mode - ask the AI to modify your cloned website using natural language
  • 🖥️ Puppeteer-based scraping for accurate rendering and resource fetching
  • 📂 Persistent state management - remembers your cloned websites between sessions
  • Simple command-line interface with guided setup

🚀 Quick Start

Installation

npm install -g sameweb-cli
# or using pnpm
pnpm add -g sameweb-cli

First Run

Simply run the command to start the interactive setup:

sameweb

On first run, you'll be guided through:

  1. Website URL - Enter the website you want to clone
  2. OpenAI API Key - Provide your API key (or set OPENAI_API_KEY in .env)

Example Workflow

$ sameweb
🚀 Welcome to sameweb-cli!
📌 First time setup: You need to clone a website.
🌐 Enter website URL to clone: https://example.com
🔑 Enter your OpenAI API key: sk-...
⚡ Cloning website, please wait...

✅ Website cloned successfully into 'https://example.com'. Now you can ask queries to modify it.

💬 Enter a query (or type 'exit' / 'reset' ): 
> Change the header color to blue and add a contact form

🔧 Configuration

Environment Variables

Create a .env file in your project root to avoid entering your API key each time:

OPENAI_API_KEY=sk-your-openai-api-key-here

State Management

sameweb CLI automatically saves your session state in ~/.sameweb-state.json, including:

  • Previously cloned website URL
  • OpenAI API key
  • Clone status

📋 Commands

Interactive Mode

Once you've cloned a website, you can enter natural language queries to modify it:

  • "Change the background color to dark blue"
  • "Add a navigation menu with Home, About, Contact links"
  • "Remove all images and replace with placeholder text"
  • "Make the layout responsive for mobile devices"

Special Commands

  • exit - Quit the CLI
  • reset - Clear saved state and start fresh (will require re-cloning)

🛠️ Development Setup

Local Development

  1. Clone the repository

    git clone https://github.com/your-username/sameweb-cli.git
    cd sameweb-cli
  2. Install dependencies

    npm install
    # or
    pnpm install
  3. Create environment file

    cp .env.example .env
    # Edit .env with your OpenAI API key
  4. Run in development mode

    node cli.js
    # or if you have a dev script
    npm run dev

Project Structure

sameweb-cli/
├── cli.js          # Main CLI interface
├── cloner.js       # Core cloning and AI logic
├── package.json    # Dependencies and scripts
├── .env.example    # Environment template
└── README.md       # This file

🔑 API Key Setup

You'll need an OpenAI API key to use the AI modification features:

  1. Get API Key: Visit OpenAI Platform
  2. Set Environment Variable:
    export OPENAI_API_KEY=sk-your-key-here
    Or create a .env file as shown above

🤔 How It Works

  1. Clone Phase: Uses Puppeteer to scrape the target website, capturing HTML, CSS, images, and other resources
  2. AI Integration: Connects to OpenAI's API for processing modification requests
  3. Query Processing: Takes your natural language input and applies changes to the cloned website
  4. State Persistence: Remembers your setup between sessions for seamless continuation

⚠️ Requirements

  • Node.js 16+
  • OpenAI API Key (with sufficient credits)
  • Internet connection for initial cloning and AI requests

📝 License

MIT License - see LICENSE file for details


🤝 Contributing

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


💡 Tips

  • Complex queries: Be specific about what you want to change for better AI results
  • Backup originals: The tool modifies files in place, so keep backups if needed
  • Large websites: Cloning large sites may take time and consume API credits
  • State reset: Use reset command if you want to start fresh with a new website