0.1.2 • Published 6 months ago
gather-code v0.1.2
gather-code
Quick CLI tool to gather code snippets for prompting LLMs.
Installation
npm install gather-code
Usage
CLI
# Gather TypeScript files into a new file
gather --output output.ts src/**/*.ts
# Let gather auto-name the output based on content
gather src/**/*.ts
# Gather mixed file types
gather --output combined.ts src/**/*.{ts,js,svelte}
Module
import { gatherFiles } from "gather-code";
// Gather files with default options
await gatherFiles(["src/**/*.ts"]);
// Gather with custom options
await gatherFiles(["src/**/*.ts"], "output.ts", {
commentPrefix: "/**",
fileSeparation: 3,
outputDir: "generated",
});
Options
outputDir
: Directory to output gathered files to (default: "generated")commentPrefix
: Custom comment prefix for file headers (default: "//")fileSeparation
: Number of newlines between files (default: 2)createOutputDir
: Whether to create output directory if it doesn't exist (default: true)
File Type Priority
When mixing file types, the output extension is determined by priority:
- TypeScript (.ts)
- JavaScript (.js)
- Svelte (.svelte)
- GLSL (.glsl)
- Vertex Shader (.vert)
- Fragment Shader (.frag)
If no known extensions are found, defaults to .txt.
License
MIT