

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1# AGENTS.md23This file provides guidance for AI agents working with the Linguist repository.45## Project Overview67Linguist is a Ruby library used on GitHub.com to:8- Detect blob languages9- Ignore binary and vendored files10- Suppress generated files in diffs11- Generate language breakdown graphs1213It's packaged as the `github-linguist` gem and includes CLI tools: `github-linguist` and `git-linguist`.1415## Key Files and Directories1617| Path | Purpose |18|------|---------|19| `lib/linguist/languages.yml` | Master list of all languages, extensions, filenames, and their properties |20| `lib/linguist/heuristics.yml` | Rules for disambiguating files with shared extensions |21| `lib/linguist/heuristics.rb` | Ruby code implementing heuristic logic |22| `lib/linguist/classifier.rb` | Centroid-based classifier for language detection |23| `samples/` | Sample code files for each language (used by classifier) |24| `grammars.yml` | Lists all TextMate grammars used for syntax highlighting |25| `vendor/` | Contains grammar submodules and cached license files for the grammars |26| `script/` | Utility scripts for maintenance tasks |2728## Development Environment2930Use GitHub Codespaces or the dev container for the easiest setup. The environment includes Ruby, Node.js, Docker, and all required dependencies.3132To bootstrap locally:33```bash34script/bootstrap35```3637To run Linguist from the repo:38```bash39bundle exec bin/github-linguist --breakdown40```4142## Common Tasks4344### Adding a Language Extension451. Add extension to the language entry in `lib/linguist/languages.yml` (alphabetical order, case-sensitive; primary extension first)462. Add sample files to `samples/<Language>/`473. If extension is shared with another language, ensure there are at least two samples and add a heuristic in `lib/linguist/heuristics.yml`4849### Adding a New Language501. Add entry to `lib/linguist/languages.yml` (omit `language_id` initially)512. Add grammar: `script/add-grammar <grammar-url>`523. Add samples to `samples/<Language>/`534. Generate ID: `script/update-ids`545. If an extension is shared with another language, ensure there are at least two samples and add a heuristic in `lib/linguist/heuristics.yml`5556### Replacing a Grammar57```bash58script/add-grammar --replace <GrammarName> <new-grammar-url>59```6061### Important Scripts62- `script/bootstrap` - Install dependencies63- `script/add-grammar` - Add or replace TextMate grammars64- `script/update-ids` - Generate unique language IDs65- `script/cross-validation` - Test the classifier66- `script/cibuild` - CI build script6768## Testing6970Run tests with:71```bash72bundle exec rake test73```7475Test the classifier:76```bash77bundle exec script/cross-validation --test78```7980Always ensure tests pass before submitting changes. GitHub Actions runs tests on all PRs.8182## Coding Conventions8384- **Ruby style**: Follow existing code patterns in the repository85- **languages.yml**: Keep alphabetically sorted (case-sensitive, uppercase before lowercase) with the comment at the top. Use the comment at the top to determine the fields to add for a language.86- **Extensions in languages.yml**: Keep alphabetically sorted (case-sensitive, uppercase before lowercase); primary extension first87- **Samples**: Use real-world code examples, not "Hello World" and other common examples used in tutorials88- **Heuristics**: Write patterns to minimize false positives. Patterns must be linear, safe from ReDoS attacks, and RE2 compatible. All heuristics must have tests.89- **Don't refactor unrelated code.** Keep changes scoped to the task at hand.9091## Generated and script maintained files — do not edit by hand9293- `.gitmodules`94- `grammars.yml`95- all files in `vendor/`9697These are all maintained by the `script/add-grammars` script.9899## PR Requirements100101All PRs must:1021. Use the provided PR template. Irrelevant sections may be removed.1032. Link to GitHub search results showing in-the-wild usage, excluding forks, for each extension being added (minimum 2000 files for common extensions, 200 for once-per-repo files or extensions).1043. Link to the original source of any samples added. This must not be a link to the fork of Linguist used for the contribution.1054. State the license of any sample code added individually.1065. Pass all CI tests.107108Do not open a PR if any of the above conditions are not met and notify the user why the PR has not been created.109110## Usage Requirements for New Languages/Extensions111112- At least 2000 files indexed on GitHub (or 200 for once-per-repo files like Makefile), excluding forks113- Reasonable distribution across unique `user/repo` combinations114- High-proportion users may be filtered out during assessment115116## Grammar Requirements117118Only add grammars with approved licenses (see `vendor/licenses/config.yml` for the list). TextMate-compatible grammars are used for syntax highlighting.119120## Key Dependencies121122- `charlock_holmes` - Character encoding detection (requires ICU)123- `rugged` - libgit2 bindings for Ruby124- Docker - Required for grammar operations125
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| vllm-project/vllmAGENTS.md · 89k | AGENTS.md | setuptestlint-formatstyle+5 | 100/100 | 14 days ago | |
| rails/railsAGENTS.md · 59k | AGENTS.md | teststylearchgit+4 | 100/100 | 14 days ago | |
| wpscanteam/wpscanAGENTS.md · 9.7k | AGENTS.md | setupbuildteststyle+6 | 100/100 | 13 days ago | |
| react/react-nativepackages/react-native-compatibility-check/AGENTS.md · 126k | AGENTS.md | testlint-formatstylearch+4 | 99/100 | 14 days ago | |
| elastic/ml-cppAGENTS.md · 157 | AGENTS.md | buildtestlint-formatstyle+4 | 96/100 | today | |
| dotnet/aspnetcoresrc/Components/AGENTS.md · 38k | AGENTS.md | buildteststylearch+3 | 96/100 | today | |
| Freika/dawarichAGENTS.md · 10k | AGENTS.md | buildtestlint-formatstyle+4 | 94/100 | today | |
| akodkod/operandiAGENTS.md · 73 | AGENTS.md | buildteststyletesting-strategy+3 | 93/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/github-linguist-linguist-agents)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.