본문으로 건너뛰기
cccskills
무료GitHub에 공개

tree-sitter-language-pack-detecting-languages

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

xberg-io/tree-sitter-language-pack스타 478(GitHub 478 + cccskills 0)

실행 점수 미검증

설치 방법 보기

포함된 파일(2)

  • SKILL.md3.2 KB
  • index.md571 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

<!-- AI-RULEZ :: GENERATED FILE — DO NOT EDIT Content-Hash: blake3:1d8f23b5f26e371f9ced71e7f86f664ef0731d0ad7acce227eba69b83b348582 Source-Hash: blake3:f6af1693d7e3d301871730c180582f140a9c6aeee0d040ba3edbfb33b5d38409 Schema-Version: v1 -->

Detecting languages

tree-sitter-language-pack maps a file to one of 372 supported languages. Detection works from a file path, a bare extension, or — via the SDK — the file content itself.

On the CLI: detection is implicit

There is no standalone ts-pack detect command. parse and process auto-detect the language from the file extension and act on it:

ts-pack parse src/app.ts      # detects "typescript", parses
ts-pack process app.py        # detects "python", extracts

When detection fails (no extension, ambiguous, or stdin), pass --language:

cat snippet | ts-pack parse - --language go

To check whether a language name is supported and cached without parsing anything, use list and info:

ts-pack list --filter type      # languages whose name contains "type"
ts-pack list --manifest         # every language in the remote manifest
ts-pack info typescript         # is it known? is it downloaded? cache path?

In the SDK: explicit detection

The core exposes three detection functions, including content-based detection that the CLI does not surface:

FunctionDetects from
detect_language_from_path(path)Full path (uses the extension).
detect_language_from_extension(ext)A bare extension like "rs".
detect_language_from_content(content)Raw source text — no path needed.

Each returns the language name or null/None when no grammar matches.

Python

from tree_sitter_language_pack import (
    detect_language_from_path,
    detect_language_from_extension,
    detect_language_from_content,
)

detect_language_from_path("src/app.py")      # "python"
detect_language_from_extension("rs")          # "rust"
detect_language_from_content(open("x").read())  # from the shebang line, if present

Node.js / TypeScript

import { detectLanguageFromPath, detectLanguageFromContent } from "@xberg-io/tree-sitter-language-pack";

const lang = detectLanguageFromPath("src/app.ts") ?? detectLanguageFromContent(source);

Choosing CLI vs SDK

  • Path or extension is enough, one-shot → just run ts-pack parse/process and let it auto-detect.
  • Only raw content (a pasted snippet, a stream, a file with no extension) → use the SDK's detect_language_from_content, then pass the result as --language to the CLI if needed.

When to reach for the other skills

Once the language is known, hand off to tree-sitter-language-pack-parsing-source (syntax tree) or tree-sitter-language-pack-extracting-code-structure (metadata). To see or prefetch the parser for a detected language, see tree-sitter-language-pack-managing-parsers.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

api

무료

Use tree-sitter-language-pack api reference documentation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

xberg-io/tree-sitter-language-pack4782026년 10월 26일 업데이트

cli

무료

Use tree-sitter-language-pack cli reference documentation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

xberg-io/tree-sitter-language-pack4782026년 10월 26일 업데이트

mcp

무료

Use tree-sitter-language-pack mcp reference documentation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

xberg-io/tree-sitter-language-pack4782026년 10월 26일 업데이트

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

xberg-io/tree-sitter-language-pack4782026년 10월 26일 업데이트

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

xberg-io/tree-sitter-language-pack4782026년 10월 26일 업데이트

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.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

xberg-io/tree-sitter-language-pack4782026년 10월 26일 업데이트

xberg-io의 스킬 모두 보기

이 스킬의 문제 신고