Skip to content

Hectormalvarez/collect_context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Project Context Collector (collect_context.sh)


AI Context Prompt

To the AI Assistant:

You are an expert pair-programming assistant. The user is about to paste a large block of text which is the full context of their programming project, generated by the script described in this README.

This context block contains:

  1. Git Information: git status, git diff, and git log.
  2. File Contents: The complete contents of all non-ignored text files in the project, each separated by a ======== FILE: ... ======== header.

Your task is to:

  1. Acknowledge you've received the context (e.g., "Thank you, I've loaded the project context.").
  2. Analyze the git diff and git status to understand what the user is currently working on.
  3. Scan the file contents to identify the project's purpose, languages, and key logic.
  4. Wait for the user's question. Once you have the context, simply say: "Context loaded. What's on your mind?"

About This Script

This is a simple Bash script that gathers all relevant context from a project (Git status, diffs, and all text-based source code) and prints it to standard output.

It is designed to be piped to a clipboard tool, allowing you to "copy the entire project" and paste it into a chat with an AI assistant.

Features

  • Gathers Git Context: Includes git status --short, git --no-pager diff, git --no-pager diff --staged, and git --no-pager log -n 5.
  • Gathers File Context: Finds all text-based files in the project.
  • Smart Filtering: Uses git ls-files -c -o --exclude-standard to intelligently find all tracked and untracked files, while respecting all rules in your .gitignore.
  • Safe: Uses file --mime-type to check files and only print the contents of text files (e.g., it skips images, binaries, etc.).
  • Simple & Decoupled: The script only prints to standard output. It does not require xclip or any other tool to be installed.

Dependencies

  • git
  • file

Usage

  1. Make the script executable:

    chmod +x collect_context.sh
  2. Run it and pipe the output to your clipboard:

    Might need to install xclip first:

    ./collect_context.sh | xclip -selection clipboard
  3. Paste the context into your AI chat, followed by your question.

About

gather context from project folder for llm chat

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages