Skip to content

feat(pm): install the MCP content-write deny roster into user-scope settings - #34526

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-v2sjwm
Nov 17, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-v2sjwm

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Yibo Wang · project thread

Refs #25583

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:新增 scripts/pm/install-settings-deny-roster.mjs,把 17 个 MCP GitHub 内容写工具的 deny 名单写进用户级 ~/.claude/settings.json(名单从现有门禁 check-settings-deny-roster.mjs 导入,不复制),自测接进 check:pm-settings-deny-roster。
  • 为什么改:项目线程会话从不读取仓库 .claude/settings.json(平台设计如此),写身份锁 1 缺席;实测用户级文件会被读取且会话中途写入即时生效,17 个写工具当场从工具列表消失。
  • 风险与回滚:只新增一个不发布的脚本加一行 CI 别名;安装器只追加 deny、从不删除,读不懂的文件不动。回滚即 revert 本 PR。
  • 先看:scripts/pm/install-settings-deny-roster.mjs 的 mergeDenyRoster 与 install;package.json 第 102 行。
  • 两分钟验证:node scripts/pm/install-settings-deny-roster.mjs --settings /tmp/x.json && node scripts/pm/check-settings-deny-roster.mjs --settings /tmp/x.json,两条都应 exit 0。
  • 需要你做的:合并后给项目加一个带 setup script 的云环境,脚本一行见下方 Verification(本 PR 不关卡,环境那一半仍归维护者)。

What changes

  • scripts/pm/install-settings-deny-roster.mjs (new): merges CONTENT_WRITE_TOOLS, imported from scripts/pm/check-settings-deny-roster.mjs, into the user-scope settings file (~/.claude/settings.json, or --settings PATH). It creates the file and its folder when absent, keeps every other key and every existing deny entry, appends only the missing roster tools, writes nothing when the file already holds them (bytes and mtime unchanged), writes atomically, refuses (exit 3, nothing written) a file it cannot parse or whose permissions/deny has the wrong shape, and judges the on-disk result with the gate's own verdict. Exit codes match the gate's. --dry-run reports without writing. It spells no roster tool name; its self-test asserts that.
  • package.json: check:pm-settings-deny-roster (already run by Lint & Repo Gates) also runs the installer's --self-test (36 cases, six pinned batteries plus the verdict handshake).

Why the repo half is a user-scope installer rather than a hook: the platform documents that a project thread applies none of a repository's .claude/settings.json permission rules, hooks or env, with one repository or several. So no repo file reaches the session by itself; the user scope is the only settings layer the session reads that the environment's setup script can write.

Tests

  • node scripts/pm/install-settings-deny-roster.mjs --self-test: 36 cases pass.
  • pnpm check:pm-settings-deny-roster: gate self-test 36 pass, gate 17 = 17, installer self-test 36 pass, exit 0.
  • Live, in this project thread: node scripts/pm/install-settings-deny-roster.mjs then node scripts/pm/check-settings-deny-roster.mjs --settings ~/.claude/settings.json, both exit 0.

Acceptance notes

  • Deliberately not done: registering the repo's PreToolUse guards and SessionStart hook in the user-scope file. They are also absent in project threads (measured below), but the card is lock 1 only, and hooks in user scope need absolute repo paths. Left to the seat.
  • package.json is outside the claim's declared file surface (scripts/pm/**); it is the one alias line that makes CI run the new self-test.
  • The card's Maintainer-action: line needs a new wording (proposed in the hand-off comment): the done-when no longer depends on the repository being cloned before the setup script runs.

Verification

Measurement table: the three triage questions, re-measured 2026-11-16 in a project thread (session_01WGufzfgjqr3ubfqP8Wc51p, objectstack origin/main 9e6fee1)
Question Reading
Session layout transcripts under /root/.claude/projects/-home-claude/; repo at /home/claude/objectstack; CLAUDE_PROJECT_DIR unset
Settings files present /root/.claude/ and /home/claude/.claude/ each hold launcher-settings.json (identical; allow Skill, deny only on launcher files; hooks PostToolUse, Stop, UserPromptSubmit) and no settings.json
1. Is the repo .claude/settings.json read? No. All 17 roster tools were offered in the tool listing.
2. Do the repo hooks run? No. The tree-enum guard's own blocked shape (working-tree loop plus git show origin/main:) ran unblocked, exit 0; the same command piped to the hook directly: exit 2. No SessionStart pointer appeared.
3. Can a hook deny the tools? Moot (no repo hook runs).
User scope written mid-session Wrote the 17-entry roster to /root/.claude/settings.json at 16:42:43Z. The next tool listing dropped exactly those 17 tools; issue_read (control) stayed. User scope is read and reloaded live.
Setup-script line, tested Sparse clone of this branch plus HOME=TMP node .../install-settings-deny-roster.mjs: 5 s, 43 MB, created the file; gate on it exit 0.

Proposed setup-script line (after merge, cloud environment of the project):

git clone -q --depth 1 --filter=blob:none --sparse https://github.com/objectstack-ai/objectstack /opt/os-deny-roster && git -C /opt/os-deny-roster sparse-checkout set scripts/pm && node /opt/os-deny-roster/scripts/pm/install-settings-deny-roster.mjs

It does not depend on where or whether the session's own clone exists when the setup script runs. A thread on the current built-in environment can close the lock for itself by running node scripts/pm/install-settings-deny-roster.mjs as its first step.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WGufzfgjqr3ubfqP8Wc51p

…ettings

A claude.ai project thread never applies the repository's Claude settings
file, so lock 1 (the permissions.deny roster) is absent there and every
MCP GitHub content-write tool is offered. Such a session does read
~/.claude/settings.json, and reloads it live: measured, writing the
roster there mid-session removed exactly the 17 roster tools.

scripts/pm/install-settings-deny-roster.mjs merges CONTENT_WRITE_TOOLS
(imported from check-settings-deny-roster.mjs, never restated) into the
user-scope file: creates it when absent, keeps every other key and deny
entry, writes nothing when already complete, refuses an unreadable file,
and judges the result with the gate's own verdict. Its self-test runs
under check:pm-settings-deny-roster.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WGufzfgjqr3ubfqP8Wc51p
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Nov 17, 2026
@github-actions github-actions Bot added size/m dependencies Pull requests that update a dependency file labels Nov 17, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:skills#3 · os-support-ai · session_01WGufzgtCwPzNYSczvxDEpw

席位核对

Verdict: ACCEPT · head 7bd2f96e9b340cde30a8e1299a48a5e6a7cf8212 · card #25583 (p1) · claim 6922732879 · os-dev-report 6933320321 · read 2026-11-17T00:49Z.

  • Shape: draft → main, Refs #25583 (the card stays open: the environment half is the maintainer's), no closing keyword. Two files: scripts/pm/install-settings-deny-roster.mjs (new, +402), package.json (+1/−1, the check:pm-settings-deny-roster alias also runs the installer's --self-test). Clause-②: no, Metadata-protocol: none. check-governed-merges --pr 34526: NOT governed.
  • Premise measured: a project-thread session reads no repository .claude/settings.json; the dev measured that the user-scope ~/.claude/settings.json is read and reloaded live (17 content-write tools left the tool listing on write). The roster is imported from check-settings-deny-roster.mjs, never respelled; the installer only appends, refuses an unparseable or misshapen file, and judges the result with the gate's own verdict.
  • Gates (check-runs on this head): 60 runs, 50 success, 10 skipped, none red; Lint & Repo Gates runs the new self-test. Main merged into the branch before this read; K 9 < 15.
  • Out of scope: the cloud environment's setup script (the maintainer's half); it is written on the card as the Maintainer-action line after merge.
  • Landing: ungoverned. pr_ready + automerge_enable via the relay.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 17, 2026 00:50
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 5bf8c75 Nov 17, 2026
61 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-v2sjwm branch November 17, 2026 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file size/m skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant