Coder Social home page Coder Social logo

context-for-prompt's Introduction

context-for-prompt

Creates a context made of all the files and their content. The content is copied to the clipboard.

Installation

cargo install context-for-prompt

Usage

Creates a context made of all the files and their content.

Usage: context-for-prompt [OPTIONS] <ROOT>

Arguments:
  <ROOT>  

Options:
  -e, --extensions-to-ignore <EXTENSIONS_TO_IGNORE>  
  -d, --debug                                        
      --hidden                                       
  -h, --help                                         Print help
  -V, --version                                      Print version
context-for-prompt /path/to/directory

The goal of this program is to walk through a directory and copy the content of each file to the clipboard. The file content should be copied in the following format:

file: /path/to/file
----------- content start -------------
file content
----------- content end -------------

This content can then be used as context for LLMS prompts.

Example

For a directory structure that looks like this:

src/
├── page.tsx
├── header.txt
└── misc/
    └── util.ts

Running context-for-prompt . will copy the content of page.tsx, header.txt, and util.ts to the clipboard in the following format:

file: ./src/misc/util.ts
----------- content start -------------
util content
----------- content end -------------
file: ./src/header.tsx
----------- content start -------------
header content
----------- content end -------------
file: ./src/page.tsx
----------- content start -------------
page content
----------- content end -------------

The search will ignore hidden files by default and anything contained in the .gitignore file. You can use the --hidden flag to include hidden files and directories. You can use the --extensions-to-ignore flag to ignore files with certain extensions. For instance, if you want to ignore .md and .lock files, you can use the following command:

context-for-prompt /path/to/directory -e=md,lock 

Note: This crate was inspired by https://github.com/simonw/files-to-prompt

context-for-prompt's People

Contributors

fmendez avatar

Watchers

 avatar

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.