这里是为你准备的纯代码块格式的 Markdown,你可以点击代码块右上角的“复制”按钮直接获取。 ### 1. `README.md` (英文版) # cliprepo `cliprepo` is a lightweight, efficient CLI tool written in Go that helps you package your repository's file tree and source code content into a formatted Markdown block. It is designed to quickly build comprehensive context for Large Language Models (LLMs) like GPT, Claude, or DeepSeek. ## Features - **File Tree Generation**: Automatically generates a clean ASCII directory tree, honoring your `.gitignore` rules. - **Flexible File Filtering**: Match files using flexible presets (`*`, `cmd/*`, or specific file paths). - **Gitignore Smart Filtering**: Automatically skips files and directories specified in your `.gitignore` (e.g., `.git`, `node_modules`, `.DS_Store`). - **Clipboard Integration**: Directly copies the generated prompt to your clipboard—no manual file saving required. - **Customizable Templates**: Define how your code blocks are presented to the LLM via a YAML configuration file. ## Installation Ensure you have [Go](https://go.dev/) installed (version 1.26 or higher), then clone the repository and run: ```bash chmod +x install.sh ./install.sh ``` This will compile and install the `cliprepo` binary into your `$GOPATH/bin` directory. ## Configuration Create a `.cliprepo.yaml` file in the root of your project to manage path modes, custom prompt templates, and file group presets: ```yaml config: path_mode: relative # Options: 'relative' or 'absolute' prompts: preset: "The following code is from file {{path}}:\n---\n{{content}}" preset: all: - "*" # Scans and includes all tracked files in the repo internal: - "internal/tree/*" - "internal/resolver/resolver.go" cmd: - "cmd/*" ``` ## Usage Run the tool using the `run` command by specifying a preset key defined in your `.cliprepo.yaml`. ### Print to Terminal ```bash cliprepo run --delineate cmd ``` ### Copy Directly to Clipboard ```bash cliprepo run --delineate all --clipboard ``` ### Flags * `--delineate` (string): The preset key to use from `.cliprepo.yaml` (Required). * `--clipboard` (bool): Copy the output directly to your system clipboard instead of printing it to stdout. ## Output Example When running `cliprepo run --delineate cmd`, the output format will look like this: ```text . ├── cmd │ ├── root.go │ └── run.go └── main.go The following code is from file cmd/root.go: --- package cmd ... The following code is from file cmd/run.go: --- package cmd ... ``` ## License [MIT License](https://www.google.com/search?q=LICENSE)