← 返回命令列表

Linux command

yek 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Serialize current directory

yek

Serialize specific directories

yek [src/] [tests/]

Serialize with token limit

yek --tokens [128k]

Serialize with size limit

yek --max-size [10MB]

Pipe output

yek | pbcopy

Include line numbers

yek --line-numbers

Include directory tree

yek --tree-header

Output as JSON

yek --json

Use glob patterns

yek "[src/**/*.ts]"

说明

yek (Farsi for "one") is a fast Rust-based CLI tool that serializes code repositories into text optimized for LLM (Large Language Model) consumption. It combines files into a single output with intelligent ordering and automatic filtering. The tool respects .gitignore rules, uses Git history to prioritize important files, and automatically skips binary and large files. Output can be split into chunks based on token count or byte size. When output is piped, yek automatically streams content instead of writing to files. This enables workflows like yek | pbcopy to quickly copy a codebase to clipboard for pasting into an LLM chat. Configuration can be stored in yek.toml or yek.yaml files for project-specific settings.

参数

--tokens _count_
Use token counting mode instead of byte mode (e.g., 128k, 100)
--max-size _size_
Limit output by byte size (e.g., 10MB, 128K); default: 10MB
--json
Output results in JSON format
--output-dir _path_
Directory for output files; uses temp directory if not specified
--output-name _name_
Filename written to current directory
--output-template _template_
Custom format using FILE_PATH and FILE_CONTENT placeholders
--ignore-patterns _patterns_
Additional patterns to ignore (extends .gitignore)
--unignore-patterns _patterns_
Override built-in ignore rules
--line-numbers
Include line numbers in output
-t, --tree-header
Include directory tree at the start of output
--tree-only
Show only directory structure without file contents
--no-config
Skip loading configuration files
--config-file _path_
Use specific configuration file
--debug
Enable debug logging

FAQ

What is the yek command used for?

yek (Farsi for "one") is a fast Rust-based CLI tool that serializes code repositories into text optimized for LLM (Large Language Model) consumption. It combines files into a single output with intelligent ordering and automatic filtering. The tool respects .gitignore rules, uses Git history to prioritize important files, and automatically skips binary and large files. Output can be split into chunks based on token count or byte size. When output is piped, yek automatically streams content instead of writing to files. This enables workflows like yek | pbcopy to quickly copy a codebase to clipboard for pasting into an LLM chat. Configuration can be stored in yek.toml or yek.yaml files for project-specific settings.

How do I run a basic yek example?

Run `yek` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --tokens _count_ do in yek?

Use token counting mode instead of byte mode (e.g., 128k, 100)