api
무료Use tree-sitter-language-pack api reference documentation.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use when the user wants to split source code into chunks for an LLM context window without breaking syntax mid-construct. Covers `ts-pack process --chunk-size`, why syntax-aware splits beat fixed-byte splits, picking a size, and the chunk JSON shape.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
실행 점수 미검증
설치 방법 보기설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.
Splitting code on a fixed byte or line count cuts functions in half and
strips context. ts-pack process <file> --chunk-size <bytes> splits on
syntactic boundaries (whole functions, classes, blocks) so each chunk is a
coherent unit, and emits them in the JSON chunks array.
# ~2 KB chunks aligned to syntax boundaries
ts-pack process src/app.ts --chunk-size 2000
--chunk-size is a maximum size in bytes. The splitter packs whole
syntactic units up to that bound; an oversized single construct becomes its
own chunk rather than being cut. Chunks are added to the normal process
JSON output under chunks.
--chunk-size 4000 is on the order of ~1k tokens.Chunking composes with the other process features, so you can attach
structure metadata to each request:
ts-pack process src/service.py --structure --chunk-size 3000 \
| jq '{chunks: (.chunks | length), functions: (.structure | length)}'
chunks is a list of code-chunk objects in the process JSON. Each chunk
carries its source text plus span information (line/byte offsets), so you
can cite or re-locate a chunk back in the original file. Iterate the array
to feed an LLM one coherent unit at a time:
ts-pack process big_module.py --chunk-size 2500 \
| jq -c '.chunks[]'
The SDK exposes chunking through the process config: set the
chunk_max_size field (in bytes) on ProcessConfig — the same value the
CLI's --chunk-size flag sets. ProcessConfig is a frozen dataclass, so
pass it to the constructor:
from tree_sitter_language_pack import process, ProcessConfig
config = ProcessConfig("python", chunk_max_size=2500)
result = process(source_code, config)
for chunk in result.chunks: # ProcessResult is an object, not a dict
send_to_llm(chunk.content)
For a single small file that already fits the context window, skip chunking and pass the file whole. Reach for chunking when a file is large, when you are batching many files into a RAG index, or when you need stable, syntactically coherent units to cite.
아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.
로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.
아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.
Use tree-sitter-language-pack api reference documentation.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use tree-sitter-language-pack cli reference documentation.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use tree-sitter-language-pack mcp reference documentation.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Parse and extract code intelligence from 372 programming languages using tree-sitter grammars. Use when writing code that parses source, extracts structure/imports/exports/symbols/docstrings/comments, detects a language, runs syntax diagnostics, or produces syntax-aware chunks for LLMs — in Rust, Python, Node.js/TypeScript, or the ts-pack CLI. Covers installation, the CLI surface, the SDK surface, and parser-cache management.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use when the user wants to know which programming language a file or snippet is. Covers implicit detection in `ts-pack parse`/`process`, confirming support with `ts-pack list`/`info`, and the SDK detection functions for path, extension, and raw content.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.
Use when the user wants structured code metadata from a source file — functions, classes, imports, exports, symbols, docstrings, comments, or syntax diagnostics. Covers `ts-pack process` feature flags, the JSON result shape, and the default feature set.
한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.