Coder Social home page Coder Social logo

a6b8 / repos2doc Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 14.37 MB

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

Home Page: https://www.npmjs.com/package/repos2doc

License: MIT License

JavaScript 100.00%
ai chatgpt gpt gpt-4 gpt4 openai custom-gpt

repos2doc's Introduction

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.

repos2doc's People

Contributors

a6b8 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

gitrjaa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.