ClaudeMods
☰
KO
● 0 명 접속 중 · 조회 0 회
후원프로젝트 제출
GitHub 저장소 · 작성자 KilimcininKorOglu

config-parse

각 JSON, YAML, TOML 또는 .env 파일을 편집 또는 쓰기 터치로 구문 분석하고, 다음 빌드가 아닌 구문 분석 오류를 한 번에 기록하고, 나중에 편집하여 문제가 수정되면 다시 알려줍니다.

KilimcininKorOglu@KilimcininKorOglu

KilimcininKorOglu/claude-code-mods/tree/main/plugins/config-parse

번역 완료

이 mod 소개

구성 구문 분석

package.json에 쉼표가 없거나 YAML 파일에 들여쓰기가 잘못되어도 작성되는 순간 비용이 전혀 들지 않습니다. 다음 빌드에서 발견하거나 서비스 시작을 거부하는 경우가 종종 있는데, 이는 서비스를 유발한 편집과는 거리가 먼 경우가 많습니다. 이 모드는 편집 또는 쓰기가 닿은 직후 모든 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> 파일이 구문 분석됩니다. 다른 모든 파일은 그대로 유지됩니다. 자체 도구에서 주석(.jsonc, tsconfig*.json, jsconfig*.json, .vscode/*.json, devcontainer.json)이 포함된 JSON으로 읽는 파일에는 // 및 /* */ 주석과 후행 쉼표가 포함될 수 있습니다. 다른 모든 JSON 파일은 엄격하게 구문 분석됩니다. 2. JSON은 모드 자체에 의해 구문 분석됩니다. .env 파일은 한 줄씩 읽습니다. 비어 있지 않고, 주석도 아니고, KEY=value(앞에 export도 괜찮음)가 아닌 줄이 줄 번호와 함께 결과입니다. 3. YAML 및 TOML은 python3(안전 로더가 있는 yaml.load_all 및 tomllib.load)에 의해 구문 분석되며 파일 경로는 one argv 항목으로 전달됩니다. --- 스트림의 모든 문서를 읽고 !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는 자체 파일에 대해서만 응답합니다. 모드는 인덱스(git diff --cached --name-only -z)를 읽고 열려 있는 파일이 하나도 없을 때 커밋을 실행하도록 하며, 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 Code 2.1.288 이상에서는 기본적으로 로드하므로 스위치를 켤 것이 없습니다.

설치 후

  1. YAML 검사(python3 -m pip install pyyaml)를 위해 PyYAML과 함께 python3를 설치합니다. 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가 게이트를 통과할 때 모드가 읽을 수 없는 래퍼, 별칭 또는 스크립트를 통해 실행되는 git 명령입니다.
  • git commit -a, -am 및 -- 이후 pathspec이 있는 커밋은 인덱스에 아직 보관되지 않은 파일을 커밋하기 때문에 인덱스로 좁혀지지 않습니다. 공개된 모든 결과는 이에 중요합니다.
  • 명령이 실행되기 전에 인덱스를 읽습니다. 읽기와 실행 사이에 파일이 변경되는 커밋은 읽기 시 인덱스에 보관된 내용을 기준으로 측정됩니다.
  • .env 라인은 모양만 확인됩니다. 잘못된 값, 누락된 따옴표 또는 중복된 키는 결과가 아닙니다.
  • 모드가 알지 못하는 이름 아래에 주석이 있는 JSON 파일(항목 1의 목록 외부에 있는 .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

  1. After each Edit or Write the engine ran, it looks at the path. A .json, .jsonc, .yml, .yaml, .toml, .env or .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.

  2. JSON is parsed by the mod itself. A .env file is read line by line: a line that is not empty, not a comment and not KEY=value (an export in front is fine) is the finding, with its line number.

  3. YAML and TOML are parsed by python3 (yaml.load_all with a safe loader, and tomllib.load), with the file path passed as one argv item. Every document of a --- stream is read, and application tags such as !Ref or !vault are 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.

  4. A file that does not parse goes to two channels. The model gets a context note 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 as line 2 or (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 Bash cd moves the session's own directory.

  5. 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.

  6. It never denies an edit. The file is written first, then read.

  7. 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.

  8. In deny mode it also stops git commit, git push and git merge while 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. A git commit answers 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. A push and a merge have no index to read, so every finding counts there. There is no bypass: --dry-run, --help and -h pass, but a real commit of a broken file waits for the fix. note mode 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

  1. Install python3 with 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 .env still work.
  2. 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 deny mode only a commit, a push and a merge stop.
  • The deny mode 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|merge passes the gate.
  • A git commit -a, a -am and 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 .env line 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 .json name 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

비슷한 프로젝트