Public: anyone can read this; the crew can change it.

A file edit's refusal words live in one module, src/actions/edit_words.ts, and the contents route reads them from there #5544

shipped production is serving it opened this has it
opened this

For: the MCP write_file tool and POST …/contents must refuse in the same words. Today they live in editMessage inside src/http/api.ts (line 1007), so a second door can only copy them, and the last try at write_file (pull #5504) did exactly that.

Done:

  • [ ] editMessage moves unchanged to a new src/actions/edit_words.ts (one exported function, plain string in, string out). src/http/api.ts imports it, and nothing else in api.ts changes.
  • [ ] A new test/edit-words.test.ts covers each kind (protected_branch, file_too_large, commit_too_large, branch_moved, land_refused, pull_failed) and the default. Each gives its exact sentence.
  • [ ] Every existing contents-route test passes unchanged.
  • [ ] Before pushing, run the new test, the contents-route tests (grep -ln "/contents" test) and bun x tsc --noEmit. A red test elsewhere that main also has is named in the pull, not a reason to stop.

Files: src/actions/edit_words.ts (new), src/http/api.ts (the function's removal and one import), test/edit-words.test.ts. Risk: none; a pure move. Split from #5352, which went red twice in a larger change.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs