Ayle5678/dsh-auto-guard0

dsh-auto-guard

DSH Auto Guard: a Claude Code Auto Mode-like command approval mechanism that adds an LLM safety net on top of full access, with rules, caches, file tracker, and sensitive path gates.

AI 分析

核心用途是为 DSH 的高风险命令执行提供基于 LLM 的智能安全审批与过滤。适合开启了完全访问权限、需要防范恶意或误操作命令的安全敏感型用户。

パッケージ
dsh-auto-guard
バージョン
0.1.0
ライセンス
MIT
最終更新
2026/08/22

インストール

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Ayle5678/dsh-auto-guard

ドキュメント

README 全文を読む ↗

配置

- id: dsh-auto-guard
  name: dsh-auto-guard
  config:
    rulesPath: '~/.dsh/auto-guard/rules.json'
    defaultRulesPath: '~/.dsh/auto-guard/defaults.json'
    cachePath: '~/.dsh/auto-guard/cache.json'
    provider: 'deepseek'
    model: 'deepseek-v4-flash'
    reasoningEffort: 'off'
    fallbackProvider: 'deepseek-official'
    fallbackModel: 'deepseek-v4-flash'
    timeoutMs: 3000
    lowRiskTtlDays: 30
    mediumRiskTtlDays: 7
    onTimeout: 'deny'          # deny | ask
    notifyCacheHit: true
    notifyLlmDecision: true
    notifyAllow: 'page'        # page | context | off
    notifyDeny: 'context'      # page | context | off
    notifyAsk: 'context'       # page | context | off
    fileTrackerDefault: 'ask'  # ask | deny

使用示例

普通复合命令

git status; git branch --show-current; git log --oneline -5

拆成子命令后,已白名单 / 已缓存的直接过;未匹配的子命令单独 LLM 审查,通过后进入缓存。

状态改变命令

export PATH=/tmp/evil:$PATH && ls

因为出现 export,整条命令交给 LLM 审查,不会因为 ls 在白名单里就直接放行。

目录删除

第一次执行:

rm -rf ./dist

会被拒绝并提示:

Directory deletion requires a reason. Reply with [删除理由] , then retry the same command.

重试时附带理由:

[删除理由] 清理构建产物

插件提取理由后,将“命令 + 理由”交给 reasoningEffort: high 的 LLM 复核;只有 allow 才放行,其余结果转人工确认。

  • 注:虽然设计如此,但当前这部分还未调试好,多数情况下dsh+deepseek无法完成agent解释后的自动放行,可能需人工删除目录。