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

repos2doc

v0.1.0

Published

Repos2Doc streamlines GitHub repositories into a single file in `text (.txt)`, `markdown (.md)`, or `pdf (.pdf)` format, facilitating uploads to the OpenAI GPT editor for question answering and code generation. Valuable for swiftly evolving software.

Downloads

8

Readme

CircleCI

Repos 2 Doc

Repos2Doc assists in preparing one or multiple GitHub repositories to consolidate their content into a single file. This file can be in one of the following formats: text (.txt), markdown (.md), or pdf (.pdf). You can then upload this file to the OpenAI GPT editor as a searchable document. This enables the AI to answer questions based on the document's content and even generate code. This can be especially valuable for very new software with rapid update cycles.

Designed for AI Embedding Generation

Quickstart

Command Line Interface

  1. Open your Terminal and install repos2doc
npm install -g repos2doc
  1. Run repos2doc
repos2doc
  1. Types: a6b8/repos2doc/main, a6b8/satNames/main which create a document from two repositories.
  _____                      ___  _____             
 |  __ \                    |__ \|  __ \            
 | |__) |___ _ __   ___  ___   ) | |  | | ___   ___ 
 |  _  // _ \ '_ \ / _ \/ __| / /| |  | |/ _ \ / __|
 | | \ \  __/ |_) | (_) \__ \/ /_| |__| | (_) | (__ 
 |_|  \_\___| .__/ \___/|___/____|_____/ \___/ \___|
            | |                                     
            |_|                                     

Insert Repositories
  - Use following structure: "name/repo/branch"
  - For multiple repositories, separate them with a comma "name/repo/branch, name/repo/branch"
? > a6b8/repos2doc/main, a6b8/satNames/main

Node.js

Terminal

npm init -y && npm i repos2doc

Node index.mjs

import { Repos2Doc } from 'repos2doc'

const r4g = new Repos2Doc()
await r4g.getDocument( {
    'repositories': [
        'EasyMina/easyMina/main',
        'EasyMina/minaData/main'
    ]
} )

Terminal

node index.mjs

Table of Contents

Methods

getDocument()

This method downloads the data, saves it in a temporary folder, then combines all the files, and finally moves them to the actual destinationFolder. Only 'repositories' is required, and one or more repositories can be specified. For multiple repositories, the data is written sequentially into the document.

| Key | Type | Description | Required | | ---------------- | --------------------- | ----------------------------------------------------- | -------- | | repositories | Array of Strings | GitHub repositories in the format "userName/repositoryName/branchName" | true | | name | String | Custom name | false | | formats | Array of Strings | At least one value from: "txt" (text), "md" (markdown), "pdf" (pdf) | false | | destinationFolder | String | Path starting with "./" | false | | options | Array of Objects | Insert additional content, currently only supported key 'description'. Will insert between overview and file cvontent. content | false |

Options can have following keys description and filter. Find more Information about filters here: ./src/data/config.mjs

Example

import { Repos2Doc } from 'repos2doc'

const r4g = new Repos2Doc()

await r4g.getDocument( {
    'repositories': [
        'EasyMina/easyMina/main',
        'EasyMina/minaData/main'
    ],
    'name': 'mina',
    'destinationFolder': './dataTest/',
    'formats': [ 'txt', 'md', 'pdf' ],
} )

setConfig()

All module settings are stored in a config file, see ./src/data/config.mjs. This file can be completely overridden by passing an object during initialization.

import { Repos2Doc } from 'repos2doc'

const myOwnConfig = {
    // Your custom configuration here
}

const r4g = new Repos2Doc()
r4g
    .setConfig( { myOwnConfig } )
    .getDocument( { ... } )

constructor()

The constructor can be provided with a variable used to suppress the displayed terminal messages. By default, silent is set to false.

const silent = true
const r2d = new Repos2Doc( silent )

Options

Example:

import { Repos2Doc } from 'repos2doc'
const repos2doc = new Repos2Doc()

const config = repos2doc.getConfig()
config['files']['test'] = [
    {
        'type': 'allow',
        'search': 'includes',
        'strings': [
            '404.html',
        ]
    }
]

repos2doc.getDocument( {
    'repositories': [ 'ordinals/ord/gh-pages' ],
    'name': 'ord',
    'destinationFolder': './result/docs/',
    'formats': [ 'pdf', 'txt', 'md' ],
    'options': [ 
        {
            'description': 'this is a test!',
            'filter': 'test'
        }
    ]
} )

License

The module is available as open source under the terms of the MIT License.