KilimcininKorOglu/claude-code-mods/tree/main/plugins/config-parse
config-parse
編集または書き込みで触れた各 JSON、YAML、TOML、または .env ファイルを解析し、解析エラーを次のビルド時ではなく一度に記録し、後の編集で修正されたときに再度記録します。
この mod について
構成解析
package.json 内のカンマの欠落や YAML ファイル内の不正なインデントは、作成された時点では何も発生しません。次のビルド時、またはサービスの開始が拒否されたときに、原因となった編集とは程遠いことがわかります。この MOD は、編集または書き込みが行われた直後にすべての JSON、YAML、TOML、または .env ファイルを解析し、その場で解析エラーについてモデルに伝えます。
何をするのか
/config-parse on or off, the mode, and the files that do not parse
/config-parse on | off on by default
/config-parse mode note note only; the default
/config-parse mode deny a commit, a push and a merge also stop while a file does not parse
Q。編集または書き込みのたびにエンジンが実行された後、パスが調べられます。 .json、.jsonc、.yml、.yaml、.toml、.env、または .env.<name> ファイルが解析されます。他のファイルはすべてそのまま残されます。独自のツールがコメント付きの JSON として読み取るファイル (.jsonc、tsconfig*.json、jsconfig*.json、.vscode/*.json、devcontainer.json) には、// および /* */ コメントと末尾のカンマが含まれる場合があります。他のすべての JSON ファイルは厳密に解析されます。
2。 JSON は MOD 自体によって解析されます。 .env ファイルは 1 行ずつ読み取られます。空ではなく、コメントでも、KEY=value (前に export があっても問題ありません) でもない行が、行番号とともに検出結果となります。
3。 YAML と TOML は、one argv 項目として渡されるファイル パスを使用して、python3 (セーフ ローダーを使用する yaml.load_all、および tomllib.load) によって解析されます。 --- ストリームのすべてのドキュメントが読み取られ、!Ref や !vault などのアプリケーション タグは、両方とも有効な YAML であるため受け入れられます。 Python またはモジュールが欠落している場合、その種類はセッションではスキップされ、one 行で通知されます。
4。解析されないファイルは two チャネルに送られます。モデルは、ファイルとエラーの名前を示す context メモを取得します。 サイドバー ストリームに赤色のエントリ (最初にファイル、次にエラー。line 2 や (line 3, column 5) などのパーサー名の位置は黄色)、またはサイドバーが閉じているときのトランスクリプト行が表示されます。ファイルは、セッションが開始された git リポジトリ、またはリポジトリ外のセッションのディレクトリを基準にして表示されます。 Bash cd がセッション自体のディレクトリを移動するため、そのルートはセッションの開始時に一度読み取られます。
5。後の編集で同じファイルが再度解析されると、保存されているエントリがクリアされ、緑色の線がそのことを示します。モデル自体がファイルを修正したため、その行はあなたにのみ送信されます。検索結果が残っている間に削除されたファイルは、次の小節で同じように <file> is gone, and its parse error with it で閉じます。そこに存在するが読み取れないファイルは、検出されたままになります。
6。決して編集を否定するものではありません。ファイルは最初に書き込まれ、次に読み取られます。
7。モデルが閉じなかった検出結果は、メイン ループの各ターンの終わりに再度測定され、残ったものは次のプロンプトで one メモとしてモデルに到達します。
config-parse: 1 file(s) still do not parse: package.json. Fix them.
つまり、プロンプトごとの one ではなく、ターンごとの one ノートです。これがなければ、結果は編集時に一度言われ、モデルがそれを忘れている間、ペインに座ったままになってしまいます。ペインにはすでに同じ結果が表示されているため、新しい内容は何も表示されません。
8。 deny モードでは、ファイルが解析されていない間、git commit、git push、および git merge も停止します。 one を停止する前に、開いているすべてのファイルを再度解析するため、モデルがファイルを修正すると、コマンドは自動的に実行されます。 git commit は、自身のファイルのみに対して応答します。MOD はインデックス (git diff --cached --name-only -z) を読み取り、開いているファイルが 1 つも保持されていない場合にコミットを実行します。one 行は、まだ残っているファイルの数を示します。 config-parse: 1 file(s) still do not parse: package.json. Fix them.
Q と merge には読み取るインデックスがないため、すべての検出結果がそこでカウントされます。バイパスはありません。--dry-run、--help、および -h はパスしますが、壊れたファイルの実際のコミットは修正を待ちます。 note モードがデフォルトであり、何も停止しません。
ライブ チェックでは、末尾のカンマで壊れた JSON ファイルはメモ (Property name must be a string literal) を取得し、a: 1: 2 で壊れた YAML ファイルは Python エラーを取得し、a: 1 の次の書き込みで結果は parses as YAML again で閉じられました。
コマンド
/config-parse on or off, the mode, and the files that do not parse
/config-parse on | off on by default
/config-parse mode note note only; the default
/config-parse mode deny a commit, a push and a merge also stop while a file does not parse
インストール
claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install config-parse@kilimcininkoroglu-mods
関数フックは早期アクセスです。Claude 2.1.288 をコード化し、後でデフォルトでロードするため、オンにするものは何もありません。
インストール後
1。 YAML チェックのために python3 を PyYAML とともにインストールします (python3 -m pip install pyyaml)。 TOML には Python 3.11 以降のみが必要です。これらがないと、two 種類はスキップされます。 JSON と .env は引き続き機能します。
2。Claude Codeを再起動します。
到達できるもの
Claude Code 2.1.283 の claude plugin validate で検証済み:
❯ ./register.ts hooks: session.start, command.run{command=config-parse}, tool.call{tool=Edit}, tool.call{tool=Write}, turn.complete, prompt.submit, tool.call{tool=Bash}
❯ ./register.ts calls: $.command.register, $.fs.exists (via isGone), $.fs.read (via fileText), $.process.run (via pythonCheck, shownRootOf, stagedPaths), $.session.cwd, $.sidebar.clear (via closeOne), $.sidebar.set (via toPerson), $.store.get (via readSettings), $.store.set (via runCommand, setMode), $.ui.log
L2 に到達: ファイルを読み取り、プロセスを実行します。
1. Reads: the path of each Edit and Write, the command of each Bash call, and the text of the edited JSON and .env files, and each open file again at the turn's end
2. Runs: python3 -c, by argv, on YAML and TOML files; git rev-parse --show-toplevel once at the session's start, to name files against the repository root; and git rev-parse --show-toplevel plus git diff --cached --name-only -z at a commit in deny mode
3. Sends: the file name and the parse error to the model, and one more note with the next prompt while a finding stands; nothing leaves the machine
4. Persists: the on/off setting and the mode in $.store
5. Hostile input: the path comes from the tool call and reaches python as one argv item, never through a shell; the python program is fixed text and reads sys.argv[1]
制限
- 書き込み後にチェックが実行されるため、次の編集で修正されるまで壊れたファイルが存在します。編集が拒否されることはありません。
denyモードでは、コミット、プッシュ、マージのみが停止します。 denyモードにはバイパスがありません。所見を修正できない場合は、/config-parse mode noteでゲートをオフにします。git commit|push|mergeのように MOD が読み取れないラッパー、エイリアス、またはスクリプトを介して実行された git コマンドはゲートを通過します。git commit -a、-am、および--の後のパス指定を持つコミットは、インデックスがまだ保持していないファイルをコミットするため、インデックスに絞り込まれません。未解決の発見はすべてそれらにとって重要です。- インデックスはコマンドの実行前に読み取られます。読み取りと実行の間にファイルが変更されるコミットは、読み取り時にインデックスが保持していたものと比較して測定されます。
.envラインは、その形状のみがチェックされます。間違った値、引用符の欠落、または重複キーは検出結果ではありません。- MOD がコメント付き JSON (アイテム 1 のリスト外にある
.json名) として認識できない名前の下にコメントがある JSON ファイルは、その名前が厳密に読み取られるため、壊れていると報告されます。- YAML と TOML にはpython3が必要です。これがないマシンでは、これらのファイルは決してチェックされません。 - たとえば Bash
sedなど、編集と書き込み以外で行われた編集は表示されません。
開発
make install # eslint, typescript-eslint, typescript
make lint # complexity limit 10, the build fails above it
make typecheck # needs .claude/types/ from /plugin-types
make validate
make test # claude plugin test
インストール
まず作者の README で marketplace とプラグイン名を確認してください。コマンドはリポジトリの構成によって変わる場合があります。
claude plugin marketplace add KilimcininKorOglu/claude-code-mods claude plugin install config-parse
原文 / README
config-parse
A missing comma in package.json or a bad indent in a YAML file costs nothing at the moment it is made; you find out at the next build, or when a service refuses to start, often far from the edit that caused it. This mod parses every JSON, YAML, TOML or .env file right after an Edit or Write touches it, and tells the model about a parse error on the spot.
What it does
-
After each Edit or Write the engine ran, it looks at the path. A
.json,.jsonc,.yml,.yaml,.toml,.envor.env.<name>file is parsed; every other file is left alone. Files their own tool reads as JSON with comments (.jsonc,tsconfig*.json,jsconfig*.json,.vscode/*.json,devcontainer.json) may hold//and/* */comments and trailing commas. Every other JSON file is parsed strictly. -
JSON is parsed by the mod itself. A
.envfile is read line by line: a line that is not empty, not a comment and notKEY=value(anexportin front is fine) is the finding, with its line number. -
YAML and TOML are parsed by
python3(yaml.load_allwith a safe loader, andtomllib.load), with the file path passed as one argv item. Every document of a---stream is read, and application tags such as!Refor!vaultare accepted, because both are valid YAML. If python or the module is missing, that kind is skipped for the session and one line tells you. -
A file that does not parse goes to two channels. The model gets a
contextnote naming the file and the error. You get a red entry in the sidebar stream (the file first, then the error, with the position the parser names, such asline 2or(line 3, column 5), in yellow), or a transcript line when the sidebar is closed. The file is shown relative to the git repository the session started in, or to the session's directory outside a repository. That root is read once at the session's start, because a Bashcdmoves the session's own directory. -
When a later edit makes the same file parse again, the standing entry is cleared and a green line says so. That line goes to you only, because the model fixed the file itself. A file deleted while its finding stands closes the same way at the next measure, with
<file> is gone, and its parse error with it. A file that is there but cannot be read keeps its finding. -
It never denies an edit. The file is written first, then read.
-
A finding the model did not close is measured again at the end of each main-loop turn, and whatever is left reaches the model as one note with your next prompt:
config-parse: 1 file(s) still do not parse: package.json. Fix them.That is one note per turn, not one per prompt. Without it the finding would be said once, at the edit, and then sit in the pane while the model forgot about it. You read nothing new, because the pane already shows the same finding.
-
In
denymode it also stopsgit commit,git pushandgit mergewhile a file does not parse. Before stopping one it parses every open file again, so the command goes through by itself once the model fixed them. Agit commitanswers for its own files alone: the mod reads the index (git diff --cached --name-only -z) and lets the commit run when it holds none of the open files, with one line telling you how many still stand. Apushand amergehave no index to read, so every finding counts there. There is no bypass:--dry-run,--helpand-hpass, but a real commit of a broken file waits for the fix.notemode is the default and stops nothing.
In the live check a JSON file broken with a trailing comma got the note (Property name must be a string literal), a YAML file broken with a: 1: 2 got the python error, and the next Write of a: 1 closed the finding with parses as YAML again.
Command
/config-parse on or off, the mode, and the files that do not parse
/config-parse on | off on by default
/config-parse mode note note only; the default
/config-parse mode deny a commit, a push and a merge also stop while a file does not parse
Install
claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install config-parse@kilimcininkoroglu-mods
Function hooks are early access. Claude Code 2.1.288 and later load them by default, so there is nothing to switch on.
After installing
- Install
python3with PyYAML for the YAML check (python3 -m pip install pyyaml). TOML only needs python 3.11 or newer. Without them those two kinds are skipped; JSON and.envstill work. - Restart Claude Code.
What it can reach
Validated with claude plugin validate on Claude Code 2.1.283:
❯ ./register.ts hooks: session.start, command.run{command=config-parse}, tool.call{tool=Edit}, tool.call{tool=Write}, turn.complete, prompt.submit, tool.call{tool=Bash}
❯ ./register.ts calls: $.command.register, $.fs.exists (via isGone), $.fs.read (via fileText), $.process.run (via pythonCheck, shownRootOf, stagedPaths), $.session.cwd, $.sidebar.clear (via closeOne), $.sidebar.set (via toPerson), $.store.get (via readSettings), $.store.set (via runCommand, setMode), $.ui.log
Reach L2: it reads files and runs a process.
1. Reads: the path of each Edit and Write, the command of each Bash call, and the text of the edited JSON and .env files, and each open file again at the turn's end
2. Runs: python3 -c, by argv, on YAML and TOML files; git rev-parse --show-toplevel once at the session's start, to name files against the repository root; and git rev-parse --show-toplevel plus git diff --cached --name-only -z at a commit in deny mode
3. Sends: the file name and the parse error to the model, and one more note with the next prompt while a finding stands; nothing leaves the machine
4. Persists: the on/off setting and the mode in $.store
5. Hostile input: the path comes from the tool call and reaches python as one argv item, never through a shell; the python program is fixed text and reads sys.argv[1]
Limits
- The check runs after the write, so a broken file exists until the next edit fixes it. No edit is ever denied; in
denymode only a commit, a push and a merge stop. - The
denymode has no bypass. When a finding cannot be fixed, you turn the gate off with/config-parse mode note. - A git command run through a wrapper, an alias or a script that the mod cannot read as
git commit|push|mergepasses the gate. - A
git commit -a, a-amand a commit with a pathspec after--are not narrowed to the index, because they commit files the index does not hold yet. Every open finding counts for those. - The index is read before the command runs. A commit whose files change between that read and the run is measured against what the index held at the read.
- A
.envline is checked for its shape only. A wrong value, a missing quote or a duplicate key is not a finding. - A JSON file with comments under a name the mod does not know as JSON with comments (a
.jsonname outside the list in item 1) is reported as broken, because that name is read strictly. - YAML and TOML need
python3; on a machine without it those files are never checked. - An edit made outside Edit and Write, for example by a Bash
sed, is not seen.
Development
make install # eslint, typescript-eslint, typescript
make lint # complexity limit 10, the build fails above it
make typecheck # needs .claude/types/ from /plugin-types
make validate
make test # claude plugin test

