hlchunk.nvim AGENTS.md

A project instruction guide for hlchunk.nvim, a Lua plugin that highlights indentation and code blocks in Neovim, a text editor. It describes the supported tools, tests, checks, and source layout.

In plain words
What is it for?
Use it to run the plugin's tests, static checks, formatter checks, and type checks, understand its Lua modules, and follow the documented contribution and documentation structure.
Why use it?
It explains the project's technical constraints and the commands used to verify changes. This helps contributors avoid unsupported dependencies and catch formatting, lint, type, or test failures.

Instructions file for CodexOpenCode

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/shellraining/hlchunk.nvim/agents-md
Clone the repo
git clone --depth 1 https://github.com/shellRaining/hlchunk.nvim

Made for: Codex, OpenCode.

Per session 906 This file is loaded in full into every session.
When invoked 906 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00906 $0.00906
Opus 5 $0.00453 $0.00453
Sonnet 5 $0.00181 $0.00181
Haiku 4.5 $0.00091 $0.00091

Measured 2d ago against content hash f23d91cd3430, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

hlchunk.nvim AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 65 lines

How it starts

The opening of the file, as written. The whole thing — 65 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AGENTS.md

项目定位

hlchunk.nvim 是一个 Neovim(>= 0.10.0)缩进与代码块高亮插件,用 Lua 编写。核心能力:indent line、chunk 高亮(基于 treesitter 或括号匹配)、行号高亮、blank 修饰。所有渲染通过 nvim_buf_set_extmark 的 virt_text overlay 实现。

技术栈约束

  • Lua(LuaJIT),运行于 Neovim 内,不引入任何外部 Lua 依赖
  • 可选依赖:nvim-treesitter(indent 模块的 treesitter 缩进)
  • 渲染靠 Neovim extmark + namespace;性能关键路径用 FFI 直调 Neovim C API(见 lua/hlchunk/utils/cFunc.lua
  • 测试用 plenary.nvim 的 busted 格式,headless 运行

本地命令

make ci                 # 本地预演 CI:selene + stylua + test
make test               # 跑 plenary busted 测试(headless)
make selene             # selene 静态检查(linter)
make stylua             # 格式校验(只读 --check)
make fmt                # 格式写入(stylua 原地格式化)
make lua-language-server # 类型检查(基于 .luarc.json + neodev 类型库)
make dependencies       # 按 Makefile 中 pin 的 commit 拉取 plenary/neodev

CI 等价命令:make selene && make stylua && make testmake lua-language-server 对应单独的 typecheck workflow。

目录地图

详细架构与数据流见 ARCHITECTURE.md

用户向配置说明见 docs/en/<mod>.mddocs/zh_CN/<mod>.md

lua/hlchunk/
  init.lua              入口:setup() 遍历用户配置,按需加载 mod
  mods/
    base_mod/           BaseMod/BaseConf 基类,所有 mod 继承自它
    chunk/              块高亮(treesitter 优先,括号匹配回退)
    indent/             缩进线
    line_num/           块内行号高亮
    blank/              空白字符修饰(继承自 indent)
  utils/                工具:class/scope/cache/timer/ffi/indent/chunk/filetype/ts_node_type
test/features/          plenary busted 测试,命名 *_spec.lua
docs/                   用户文档

核心约定

  1. 新增模块继承 BaseMod,配置继承 BaseConf,严格遵守 UserXxxConf / XxxConf 二元类型模式
  2. 所有公开类型用 ---@class / ---@field 注解,函数用 ---@param / ---@return
  3. 错误处理:生命周期方法(enable/disable/render)用 pcall 包裹 + self:notify,不向上抛
  4. 性能:渲染必须可被 max_file_sizeexclude_filetypes 关闭;高频回调用 utils/timer.lua 的 debounce/throttle
  5. 不引入新依赖;优先 FFI 或纯 Lua 实现
  6. 行/列索引:API 层 0-index(row/col);vim.fn 层 1-index。混用时显式 ±1 并注释
  7. 修改 lua/hlchunk/utils/ts_node_type/ 下文件后,必须在 init.lua 注册

PR 流程

  1. 本地通过 make selene && make stylua && make test
  2. 新增功能补 test/features/*_spec.lua
  3. 用户可见行为变化同步更新 docs/endocs/zh_CN
  4. commit message 遵循现有风格(见 git log,如 feat(chunk): ...fix(indent): ...

Read the full file on GitHub · 65 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 65 lines · 906 tokens per session scan A f23d91cd3430

Subscribe to this mod's changes

hlchunk.nvim AGENTS.md is an instructions file published in the GitHub repository shellRaining/hlchunk.nvim (919 stars, last pushed 26d ago), licensed MIT. It adds 906 tokens to every session, about $0.0045 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.