文档

最近更新:2026年6月

Seaworthy 在本地扫描您的项目以查找安全漏洞、配置错误和暴露的密钥。本指南涵盖安装、日常 CLI 使用、配置和编辑器集成。

安装

Seaworthy 运行在 Node.js 18 或更高版本上。您可以使用 npx 运行一次,或者全局安装 CLI。

无需安装直接运行

在您的项目目录下,运行:

npx seaworthycode ./my-project

全局安装

以便在任何地方使用 seaworthy 命令:

npm install -g seaworthycode
seaworthycode ./my-project

VS Code 插件

在 VS Code Marketplace 中搜索 Seaworthy,或从“扩展”视图中安装。设置参见下面的 VS Code 插件部分。

运行扫描

将 Seaworthy 指向任何目录。如果您省略路径,则会扫描当前工作目录。

seaworthy [路径] [选项]

免费层检查无需许可证即可运行。Pro 检查需要有效的许可证密钥和您自己的 LLM API 密钥以进行语义分析。

示例

seaworthy .
seaworthy ./my-project --json
seaworthy ./my-project --output report.html
seaworthy ./my-project --sarif seaworthy.sarif

CLI 标志

在路径后传递标志。某些输出标志不能组合使用 — 请参阅下面的说明。

标志描述
--json向 stdout 打印 JSON 报告。
--output <path>向指定文件路径写入自包含的 HTML 报告。
--sarif <path>为 GitHub 代码扫描或其他 SARIF 消费者写入 SARIF 2.1.0 报告。
--sarif-stdout向 stdout 打印 SARIF,而不是文件。
--fail-on-findings报告任何发现时以代码 5 退出(在 CI 中很有用)。
--tier <tier>覆盖此运行的许可证层级(free 或 pro)。通常取自您的 JWT。
--provider <name>LLM 提供商预设:anthropic、openai、kimi、moonshot、deepseek、gemini、minimax、ollama、openrouter。
--max-file-size <bytes>跳过大于此字节数的文件(默认值:1 MB)。
--baseline [ref]与 seaworthy.baseline.json 进行对比,或传递 save 将当前的发现写入为基线。
--min-confidence <level>隐藏低于此置信度的发现:high、medium 或 low。
--debug启用向 stderr 的调试日志记录。

--json 和 --output 不能同时使用。--sarif-stdout 不能与 --json 同时使用(将 JSON 写入文件请使用 --output)。--sarif 和 --sarif-stdout 不能同时使用。

配置

CLI 设置存储在您用户目录下的文件中:

~/.seaworthy/config

使用 config 命令设置值:

seaworthy config set licenseKey SW-XXXXXX
seaworthy config set llmProvider anthropic
seaworthy config set llmApiKey sk-ant-...
seaworthy config set llmModel claude-3-5-sonnet-latest
seaworthy config set llmApiUrl https://your-proxy.example.com/v1

列出当前值:

seaworthy config list

LLM 提供商设置

Pro 检查使用您的 API 密钥将代码上下文发送给您选择的 LLM。流量直接从您的机器发送到提供商 — 不经过 Seaworthy 服务器。

您可以在 ~/.seaworthy/config 或通过环境变量设置提供商和密钥。

seaworthy config set llmProvider kimi
seaworthy config set llmApiKey 您的-moonshot-密钥

常用环境变量:

export ANTHROPIC_API_KEY=sk-ant-...
export OPENAI_API_KEY=sk-...
export KIMI_API_KEY=您的-moonshot-密钥

内置预设(除非您使用代理,否则不需要自定义基础 URL):

  • anthropic — Claude(预设的默认模型)
  • openai — GPT 模型
  • kimi / moonshot — Kimi 模型
  • deepseek — DeepSeek 对话
  • gemini — Google Gemini
  • ollama — 本地模型
  • openrouter — 路由第三方模型
  • minimax — MiniMax 模型

输出格式

Seaworthy 可以在单次运行中输出几种报告格式(在标志允许的情况下):

  • 终端(默认)— 带有修复建议的彩色摘要。
  • JSON (--json) — 机器可读的完整报告。
  • HTML (--output) — 具有排序和过滤功能的交互式报告。
  • SARIF (--sarif 或 --sarif-stdout) — 用于 CI 和 GitHub Advanced Security 代码扫描。

示例:写入 SARIF,然后上传到 GitHub Actions:

seaworthy . --sarif seaworthy.sarif
# 然后:使用 github/codeql-action/upload-sarif 上传 seaworthy.sarif

基线

将已知的发现保存到项目根目录下的 seaworthy.baseline.json 中,然后在后续运行中进行对比以专注于新问题:

seaworthy . --baseline save
seaworthy . --baseline

VS Code 插件

该插件包装了与 CLI 相同的引擎:

  • 从 Marketplace 安装 Seaworthy。
  • 打开命令面板并运行 Seaworthy: Scan Workspace。
  • 在编辑器中查看诊断信息;在提供时打开 HTML 报告面板。

许可证密钥和 LLM 凭据存储在 VS Code SecretStorage(操作系统钥匙串)中,而不是 settings.json 中。在设置中配置 seaworthy.licenseKey、seaworthy.llmProvider 和 seaworthy.llmApiKey。

MCP 服务器(AI 编程代理)

Seaworthy 内置 MCP(Model Context Protocol)服务器,让 AI 编程代理无需离开其工作流即可运行扫描。一切均通过 stdio 在本地运行 —— 只有许可证验证会触碰 Seaworthy 服务器。

服务器提供两个工具:scan(扫描你明确指定的目录)和 get_finding(深入查看某个发现的解释与修复指引)。

把 Seaworthy 添加到你客户端的 MCP 配置中。免费档无需任何设置即可使用;Pro 档使用已存储在 ~/.seaworthy/config 中的许可证密钥和 LLM 提供商。

Claude Code(.mcp.json)、Cursor(.cursor/mcp.json)和 Claude Desktop(claude_desktop_config.json)

{
  "mcpServers": {
    "seaworthy": {
      "command": "npx",
      "args": ["-y", "seaworthycode", "mcp"]
    }
  }
}

VS Code(.vscode/mcp.json)

{
  "servers": {
    "seaworthy": {
      "command": "npx",
      "args": ["-y", "seaworthycode", "mcp"]
    }
  }
}

npx 每次在客户端启动服务器时都会解析最新发布版本。为了让代理行为可复现,请固定版本 —— 1.3.0 是首个提供 mcp 子命令的版本:

"args": ["-y", "[email protected]", "mcp"]

退出代码

脚本和 CI 可以依赖这些退出代码:

代码含义
0成功 — 扫描完成(使用 --fail-on-findings 在存在发现时以非零代码退出)。
1许可证无效或已过期。
2用户输入或配置错误(路径错误、标志无效、缺少配置值)。
3网络或 LLM 不可用(许可证服务器或提供商无法访问)。
4扫描失败。
5当设置了 --fail-on-findings 时存在发现。

方案与检查

Seaworthy 有两个层级。免费层包括无需账户的核心安全检查。Pro 解锁完整目录以及 LLM 辅助分析(自备 API 密钥)。

  • 免费层 — 核心安全检查(约 12 项),无限项目。
  • Pro — 完整检查目录包括 LLM 检查,无限项目。

在首页查看价格 · 浏览完整的检查项参考