ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 ShriD5

night-mode

一个 Claude Code 插件,在可配置的深夜时间内,让 Claude 格外谨慎:危险的 Bash 命令(部署、强制推送、rm -rf、DROP/TRUNCATE)被保留以待确认,系统提示获得谨慎部分,状态行显示活跃窗口。

已翻译

关于这个 mod

night-mode 是一个 Claude Code 插件,在安全窗口激活(默认 01:00–05:00 本地时间)。在该窗口内,它通过 prompt.compose 钩子追加会话范围内的谨慎部分,通过 tool.call 钩子截获 Bash 命令,并分类危险操作如 wrangler/vercel/fly 部署、kubectl apply、terraform apply、git push --force、rm -rf、npm publish 和 SQL DROP/TRUNCATE。危险命令需要通过 $.ui.ask 进行明确认;如果没有人可以回答(例如 claude -p)或用户拒绝,命令将被保留,并指示手动运行或回复「是的,船它」。回复「是的,船它」在 10 分钟内绕过提示。状态行显示「🌙 night mode until 05:00」,/night on|off|(状态)控制每个会话的行为。选项包括 start、end 和 timezone(IANA 区域,回退到 $TZ 然后是机器时钟)。通过 claude --plugin-dir /path/to/claude-mods/night-mode 安装或通过添加 repo 作为市场并使用 /plugin。

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add ShriD5/claude-mods
claude plugin install night-mode
原文 / README

night-mode

Between 01:00 and 05:00, Claude Code gets more careful.

  • Claude's system prompt gets a short section: it's late, double-check anything destructive, prefer reversible steps, summarise the risks before acting.
  • Risky Bash commands stop and ask you first: It's 2:41am. Run this prod deploy (wrangler deploy)? That covers deploys (wrangler deploy, vercel --prod, fly deploy), kubectl apply, terraform apply, git push --force, rm -rf, npm publish and DROP/TRUNCATE in SQL. If nobody can answer (claude -p) or you pick "Not tonight", the command is held with: it's 2:41am. if you're sure, run it yourself or reply 'yes, ship it'.
  • Reply yes, ship it and risky commands run without asking for 10 minutes.
  • The status line shows 🌙 night mode until 05:00 while it's on.
  • /night off turns it off for the rest of the session. /night on brings it back, and /night says where things stand.

Install

claude --plugin-dir /path/to/claude-mods/night-mode

Or add the repo as a marketplace and install it with /plugin.

Options

| Option | Default | What it does | | --- | --- | --- | | start | 01:00 | local time night mode turns on | | end | 05:00 | local time it turns off (a window can wrap past midnight, e.g. 23:00 to 06:00) | | timezone | empty | an IANA zone like Asia/Kolkata; empty uses $TZ, then the machine's clock |

How it works

A prompt.compose hook appends a session-scoped section at night, a tool.call hook on Bash classifies the command and confirms it through $.ui.ask, which works in every permission mode, and a $.clock.every timer keeps the status line current.

更多类似作品