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

shared-file-guard

이 세션이 읽지 않았거나, 다른 세션이 읽은 이후 변경한 공유 파일(STATUS.md, CLAUDE.md, MEMORY.md 또는 사용자가 지정한 파일)에 대한 셸 쓰기를 거부합니다.

mutlumehmet@mutlumehmet

mutlumehmet/claude-plugins/tree/main/plugins/shared-file-guard

원본 게시물 이미지1
번역 완료

이 mod 소개

shared-file-guard

동일한 프로젝트에서 여러 세션을 실행하기 위한 Claude Code 모드입니다. 이 세션이 공유 파일(STATUS.md, CLAUDE.md, MEMORY.md 또는 사용자가 지정한 파일)을 한 번도 읽지 않았거나, 다른 세션이 읽은 이후 변경한 경우 해당 파일에 대한 셸 명령 쓰기를 거부합니다. claude-plugins의 일부입니다.

기능

  • 편집 및 쓰기 도구는 이미 읽은 이후 변경된 파일을 거부합니다. 이 모드는 heredocs, python3 스크립트, sed -i, tee, mv, cp와 같은 셸의 공백을 메웁니다.
  • 거부 시 파일 이름을 알려주고 Claude에게 다시 읽고, 병합한 다음 쓰도록 지시합니다.
  • cat 또는 grep는 읽기로 간주됩니다. 세션 자체의 쓰기는 다음 쓰기를 차단하지 않습니다. 아직 존재하지 않는 파일을 생성하는 것은 허용됩니다.
  • /shared-file-guard는 이 세션이 본 파일을 나열합니다. /shared-file-guard off|on.
  • 모드가 실패하면 명령은 정상적으로 실행됩니다.

설정

| 설정 | 기본값 | 기능 | |---|---|---| | watched_files | STATUS.md,CLAUDE.md,MEMORY.md | 쉼표로 구분된 파일 이름; *는 *register*.md와 같이 이름 문자의 모든 실행과 일치합니다. |

읽기 및 수행

  • 읽기: 이 세션이 어떤 공유 파일(프로젝트의 상태, 지침, 메모리 및 레지스터 파일)을 읽었는지, 디스크에서 마지막으로 변경된 시점, 그리고 각 셸 명령의 명령줄.
  • 수행: 이 세션이 읽은 이후 다른 세션이 변경한 공유 파일에 대한 셸 쓰기를 거부하고, 해당 내용을 한 줄로 기록합니다.
  • 훅: Read, Edit 및 Write의 tool.call는 읽은 내용만 기록합니다. Bash의 tool.call는 해당 명령을 거부할 수 있지만, 변경하지는 않습니다. command.run는 자체 /shared-file-guard 명령에만 응답하고 다른 명령에는 응답하지 않습니다.
  • 개인 정보 보호: PRIVACY.md를 참조하십시오.
  • 절대: 아무것도 어디로도 보내지 않습니다(네트워크 호출, 원격 분석 없음).

설치

Claude Code 2.1.287 이상(모드)이 필요합니다. 2.1.289에서 테스트되었습니다.

/plugin marketplace add mutlumehmet/claude-plugins
/plugin install shared-file-guard@mehmetmutlu

모드는 Claude Code 내에서 사용자 권한으로 실행됩니다. 모드를 설치하기 전에 코드를 읽으십시오. 설정은 설치 시 또는 나중에 /plugin configure shared-file-guard@mehmetmutlu를 사용하여 요청됩니다.

알려진 문제점

  • 스크립트 내에서 빌드된 경로와 동일한 명령 내에서 cd 이후의 상대 경로는 인식되지 않습니다.
  • 해시가 아닌 날짜와 크기를 비교합니다.

정보

Mehmet Mutlu: work that's shipped, at mehmetmutlu.dev

Mehmet Mutlu가 제작했으며, claude-plugins의 일부입니다. 그의 더 많은 작업은 mehmetmutlu.dev에서 확인할 수 있습니다.

라이선스

MIT

설치

먼저 작성자의 README에서 marketplace와 플러그인 이름을 확인하세요. 저장소 구조에 따라 명령어가 달라질 수 있습니다.

claude plugin marketplace add mutlumehmet/claude-plugins
claude plugin install shared-file-guard
원문 / README

shared-file-guard

A Claude Code mod for running several sessions on the same project. It refuses a shell command that would write a shared file (STATUS.md, CLAUDE.md, MEMORY.md, or the files you name) when this session never read it, or another session changed it since. Part of claude-plugins.

What it does

  • The Edit and Write tools already refuse a file that changed since it was read. This closes the shell gap: heredocs, python3 scripts, sed -i, tee, mv and cp.
  • The refusal names the file and tells Claude to read it again, merge, then write.
  • A cat or grep counts as a read; a session's own writes do not block its next one; creating a file that does not exist yet is allowed.
  • /shared-file-guard lists the files this session has seen; /shared-file-guard off|on.
  • If the mod fails, the command runs as normal.

Settings

| Setting | Default | What it does | |---|---|---| | watched_files | STATUS.md,CLAUDE.md,MEMORY.md | Comma separated file names; * matches any run of name characters, such as *register*.md |

What it reads and does

  • Reads: which shared files (the project's status, instructions, memory and register files) this session read and when they last changed on disk, and the command line of each shell command.
  • Does: refuses a shell write to a shared file that another session changed since this one read it, and logs a line saying so.
  • Hooks: tool.call on Read, Edit and Write only records what was read. tool.call on Bash may refuse that one command; it never changes it. command.run answers its own /shared-file-guard command and no other.
  • Privacy: see PRIVACY.md.
  • Never: sends anything anywhere (no network calls, no telemetry).

Install

Needs Claude Code 2.1.287 or later (mods). Tested on 2.1.289.

/plugin marketplace add mutlumehmet/claude-plugins
/plugin install shared-file-guard@mehmetmutlu

A mod runs inside Claude Code with your permissions. Read the code before you install any mod. Settings are asked for at install, or later with /plugin configure shared-file-guard@mehmetmutlu.

Known gaps

  • Paths built inside a script, and relative paths after a cd in the same command, are not seen.
  • It compares date and size, not a hash.

About

Mehmet Mutlu: work that's shipped, at mehmetmutlu.dev

Made by Mehmet Mutlu, part of claude-plugins. More of his work at mehmetmutlu.dev.

License

MIT

비슷한 프로젝트