帖子

通过配置 hooks 让 Claude Code 提醒你该授权啦,活干完啦~

  • ⚠️注意:请更换为你自己的 sk, 如果还没有 token 信息。可前往 令牌管理 页面获取
  • ⚠️注意:mac 用到了 terminal-notifier 发送通知,需要安装一下 brew install terminal-notifier
  • ⚠️注意:配置的通知是 mac 中的使用方式,如果使用的 windows 请自行查阅一下应该如和让 claude code 发送通知。
{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-xxxx",
    "ANTHROPIC_BASE_URL": "https://ai-router.plugins-world.cn",
    "API_TIMEOUT_MS": "3000000",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  },
  "includeCoAuthoredBy": false,
  "permissions": {
    "allow": [],
    "deny": [],
    "defaultMode": "plan"
  },
  "hooks": {
    "Notification": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "terminal-notifier -message 'Claude Code 所有任务已完成,正在休息中' -title 'Claude Code' -sound Hero"
          }
        ]
      }
    ],
    "Stop": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "terminal-notifier -message '任务完成' -title 'Claude Code' -sound Funk"
          }
        ]
      }
    ],
    "SubagentStop": [
      {
        "matcher": "",
        "hooks": [
          {
            "type": "command",
            "command": "terminal-notifier -message '任务完成' -title 'Claude Code' -sound Funk"
          }
        ]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "afplay /System/Library/Sounds/Glass.aiff"
          }
        ]
      }
    ]
  },
  "alwaysThinkingEnabled": false,
  "feedbackSurveyState": {
    "lastShownTime": 1754660473005
  }
}

https://discuss.plugins-world.cn/post/aFAtX2yr

未登录无法操作

登录 注册

评论 1

今天在测试的时候发现,似乎 claude code 更新后,~/.claude/settings.json 中的 env 配置不再生效。需要使用 export 的方式才有用。不知道是不是个例问题。有点奇怪🤔

https://discuss.plugins-world.cn/comment/qI8R3h4U
上滑加载更多