fix(hooks): ssh 옵션 값과 bash 실행을 세고 모듈 README를 desktop 파일로 센다
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Skipped
frontend-quality-gates / deploy-promoted-release (pull_request) Skipped
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Skipped
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Skipped
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Skipped
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Skipped
frontend-quality-gates / merge / static checks (pull_request) Successful in 3m16s
frontend-quality-gates / merge / tests (pull_request) Failing after 14m49s
frontend-quality-gates / merge / browser tests (pull_request) Failing after 8m20s
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Skipped
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Skipped
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Skipped
frontend-quality-gates / external-vulnerability-provider (pull_request) Skipped
frontend-quality-gates / external-provenance-provider (pull_request) Skipped
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Skipped
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Skipped
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Skipped
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Skipped
frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Skipped
frontend-quality-gates / main / checker self-tests (pull_request) Skipped
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Skipped
frontend-quality-gates / deploy-promoted-release (pull_request) Skipped
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Skipped
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Skipped
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Skipped
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Skipped
frontend-quality-gates / merge / static checks (pull_request) Successful in 3m16s
frontend-quality-gates / merge / tests (pull_request) Failing after 14m49s
frontend-quality-gates / merge / browser tests (pull_request) Failing after 8m20s
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Skipped
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Skipped
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Skipped
frontend-quality-gates / external-vulnerability-provider (pull_request) Skipped
frontend-quality-gates / external-provenance-provider (pull_request) Skipped
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Skipped
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Skipped
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Skipped
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Skipped
frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Skipped
frontend-quality-gates / main / checker self-tests (pull_request) Skipped
앞 두 커밋 뒤 확인 리뷰가 퇴행 하나와 빠진 곳 하나를 찾았다. - 실행 판정을 다시 쓰면서 ssh 뒤 `-`로 시작하는 낱말만 뺐다. 값을 받는 옵션 (`ssh -o BatchMode=yes desktop …`, `ssh -p 22 desktop …`)은 그 값을 호스트로 읽어 desktop 실행으로 세지 않는다. `bash scripts/verify.sh merge`도 첫 낱말이 verify.sh가 아니라 세지 않는다. origin/main 판은 셋 다 셌다. - 노트북 파일에서 문서를 뺀 것이 `.claude/`뿐이다. `scripts/hooks/README.md`와 `docs/ledger/README.md`도 desktop `verify:documentation`이 읽는다. 고른 방법: ssh 뒤 옵션은 값을 받는 것(-o -p -i -l -J -F 등)이면 다음 낱말까지 건너뛰고 남은 첫 낱말을 호스트로 본다. bash·sh를 감싸는 낱말에 더한다. scripts/hooks/·scripts/tests/·docs/ledger/ 패턴에서도 `.md`를 뺀다. README 문장을 같이 고친다. 검증: python3 -m unittest discover -s scripts/tests 74개 통과(노트북). 새 경우 다섯(bash, ssh -o, ssh -p, 두 README)이 고치기 전 코드에서 실패했다. Refs: 1112/08-04, 1112/08-09
This commit is contained in:
@@ -25,8 +25,8 @@ Bash 직후 ──> post-bash ──> desktop에서 pnpm·게이트를 돌
|
||||
| N2 | 같은 때, `*.md` | `scripts/check-work-docs.py`를 돌린다(작업 매뉴얼의 분량·이력 ID·뼈대·상대 링크) | 실패 줄. 고친 문서를 가리키는 줄이 있으면 그것만 |
|
||||
| N5 | Stop | 이 세션에서 desktop만 확인할 수 있는 파일(아래 밖의 모든 파일)을 고친 뒤 desktop 실행이 없으면 턴을 한 번 막고 이유를 준다 | `decision: block`, 다음 편집 전까지 한 번 |
|
||||
|
||||
- N5가 "desktop 실행"으로 치는 것: `ssh <desktop 호스트> …`로 pnpm·`ci:gate`·`verify.sh`·vitest·playwright·`node scripts/…`를 돌린 명령(로그를 읽기만 하는 `cat`·`grep`·`tail` 등은 빼고), 또는 `scripts/verify.sh`를 명령으로 `docs`·`hooks` 밖 단계로(`--on here`·`--dry-run` 없이) 돌린 명령. 앞의 `VAR=값`과 `timeout`·`nohup` 같은 감싸는 낱말은 건너뛴다. `verify.sh`를 읽는 명령(`sed`, `grep`, `git log -- scripts/verify.sh`)은 세지 않는다.
|
||||
- N5가 세지 않는 파일(노트북에서 확인되는 것): `.claude/`의 문서 밖 파일(설정·훅 상태), `scripts/hooks/`, `scripts/tests/`, `scripts/check-work-docs.py`, `docs/ledger/`. 이것들은 `scripts/verify.sh docs`·`hooks`가 노트북에서 본다. `CLAUDE.md`, `src/**/AGENTS.md`·`CLAUDE.md`, `.claude/**/*.md`는 desktop `verify:documentation`도 보므로 센다.
|
||||
- N5가 "desktop 실행"으로 치는 것: `ssh <desktop 호스트> …`로 pnpm·`ci:gate`·`verify.sh`·vitest·playwright·`node scripts/…`를 돌린 명령(로그를 읽기만 하는 `cat`·`grep`·`tail` 등은 빼고), 또는 `scripts/verify.sh`를 명령으로 `docs`·`hooks` 밖 단계로(`--on here`·`--dry-run` 없이) 돌린 명령. 앞의 `VAR=값`과 `timeout`·`nohup`·`bash` 같은 감싸는 낱말, ssh 옵션과 그 값(`-o BatchMode=yes`, `-p 22`)은 건너뛴다. `verify.sh`를 읽는 명령(`sed`, `grep`, `git log -- scripts/verify.sh`)은 세지 않는다.
|
||||
- N5가 세지 않는 파일(노트북에서 확인되는 것): `.claude/`의 설정·훅 상태, `scripts/hooks/`·`scripts/tests/`의 코드, `scripts/check-work-docs.py`, `docs/ledger/`의 장부. 이것들은 `scripts/verify.sh docs`·`hooks`가 노트북에서 본다. 그 폴더의 문서(`.md`)와 `CLAUDE.md`, `src/**/AGENTS.md`·`CLAUDE.md`는 desktop `verify:documentation`도 보므로 센다.
|
||||
- N5가 기억하는 것은 `.claude/hook-state/<session_id>.json`이다(git이 무시한다).
|
||||
- 권한 쪽 차단: `.claude/settings.json`의 `permissions.deny`가 실제 `.env`·`.env.local`·`.env.*.local`·`.env.<mode>` 읽기·쓰기를 막는다. `.env.example`은 막지 않는다.
|
||||
|
||||
|
||||
+23
-11
@@ -71,23 +71,26 @@ DOC_TIMEOUT = 20
|
||||
|
||||
# --- N5: an edit that only the desktop can check, until a desktop run --------------------------------------
|
||||
# Laptop-checkable on their own: the hooks and their tests, the work-manual checker, the ledger and the
|
||||
# Claude settings outside its documents. Everything else is checked by gates that need pnpm, documents
|
||||
# included: verify:documentation reads CLAUDE.md, the folder rule books under src/ and .claude/**/*.md
|
||||
# too (1112/08-04).
|
||||
# Claude settings, documents left out. Everything else is checked by gates that need pnpm, documents
|
||||
# included: verify:documentation reads CLAUDE.md, the folder rule books under src/, .claude/**/*.md and
|
||||
# the module READMEs of scripts/hooks/ and docs/ledger/ too (1112/08-04).
|
||||
LAPTOP_ONLY = (
|
||||
re.compile(r"^\.claude/(?!.*\.md$)"),
|
||||
re.compile(r"^scripts/hooks/"),
|
||||
re.compile(r"^scripts/tests/"),
|
||||
re.compile(r"^scripts/hooks/(?!.*\.md$)"),
|
||||
re.compile(r"^scripts/tests/(?!.*\.md$)"),
|
||||
re.compile(r"^scripts/check-work-docs\.py$"),
|
||||
re.compile(r"^docs/ledger/"),
|
||||
re.compile(r"^docs/ledger/(?!.*\.md$)"),
|
||||
)
|
||||
DESKTOP_HOST = re.compile(r"desktop")
|
||||
DESKTOP_WORK = re.compile(r"\b(?:pnpm|ci:gate|verify\.sh|vitest|playwright)\b|\bnode\s+scripts/")
|
||||
LAPTOP_STAGES = {"docs", "hooks"}
|
||||
# 1112/08-09. One command of a shell line: what follows ;, &&, ||, |, ( or a newline.
|
||||
COMMAND_SEPARATOR = re.compile(r"&&|\|\||;|\||\(|\)|\n")
|
||||
# Words that run the next command: `timeout 900 scripts/verify.sh …`.
|
||||
WRAPPERS = {"timeout": 1, "nohup": 0, "setsid": 0, "env": 0, "time": 0, "exec": 0}
|
||||
# Words that run the next command: `timeout 900 scripts/verify.sh …`, `bash scripts/verify.sh …`.
|
||||
WRAPPERS = {"timeout": 1, "nohup": 0, "setsid": 0, "env": 0, "time": 0, "exec": 0, "bash": 0, "sh": 0}
|
||||
# ssh options that take the next word as their value (`ssh -o BatchMode=yes desktop …`).
|
||||
SSH_VALUE_OPTIONS = {"-B", "-b", "-c", "-D", "-E", "-e", "-F", "-I", "-i", "-J", "-L", "-l", "-m", "-O",
|
||||
"-o", "-P", "-p", "-Q", "-R", "-S", "-W", "-w"}
|
||||
# A remote command made only of these reads logs; it runs nothing.
|
||||
READ_ONLY = {"cat", "grep", "tail", "head", "less", "ls", "sed", "awk", "wc", "find", "stat", "echo",
|
||||
"printf", "date", "uptime", "ps", "test", "true", "for", "do", "done", "if", "then", "fi"}
|
||||
@@ -305,6 +308,16 @@ def command_words(segment: str) -> list[str]:
|
||||
return words
|
||||
|
||||
|
||||
def ssh_host_and_remote(words: list[str]) -> tuple[str | None, str]:
|
||||
"""The host and the remote command of the words after `ssh`, its options and their values skipped."""
|
||||
position = 0
|
||||
while position < len(words) and words[position].startswith("-"):
|
||||
position += 2 if words[position] in SSH_VALUE_OPTIONS else 1
|
||||
if position >= len(words):
|
||||
return None, ""
|
||||
return words[position], " ".join(words[position + 1:])
|
||||
|
||||
|
||||
def runs_only_reads(remote: str) -> bool:
|
||||
segments = [command_words(part) for part in COMMAND_SEPARATOR.split(remote)]
|
||||
return all(not words or words[0] in READ_ONLY for words in segments)
|
||||
@@ -319,9 +332,8 @@ def ran_on_desktop(command: str) -> bool:
|
||||
words = split_words(command)
|
||||
for position, word in enumerate(words):
|
||||
if word.endswith("ssh"):
|
||||
rest = [w for w in words[position + 1:] if not w.startswith("-")]
|
||||
hosts, remote = rest[:1], " ".join(rest[1:])
|
||||
if (any(DESKTOP_HOST.search(host) for host in hosts) and DESKTOP_WORK.search(remote)
|
||||
host, remote = ssh_host_and_remote(words[position + 1:])
|
||||
if (host is not None and DESKTOP_HOST.search(host) and DESKTOP_WORK.search(remote)
|
||||
and not runs_only_reads(remote)):
|
||||
return True
|
||||
for segment in COMMAND_SEPARATOR.split(command):
|
||||
|
||||
Reference in New Issue
Block a user