用途:Guardrails Profiler 是一个技能(skill),对代码库做技术栈画像(profiling),产出本地护栏配置文件 .guardrails/profile.json,并把检测到的画像与默认护栏包上传到 SRAI(SecurityReview.ai),用于安全感知的 AI 代码生成。
主要能力与流程:
- 定位项目根目录(当前工作目录,用 .git/、package.json、go.mod 等标记确认)。
- 读取 <GUARDRAILS_SKILL_DIR>/references/signal-registry.json,用其分类(universal、languages、frameworks、auth_identity、ai_agent、infrastructure、ci_cd、cloud_compute、databases、messaging、api_protocols 等)把检测到的信号映射到护栏包 ID。
- 扫描信号:清单与配置文件检测(项目根 1–2 层,如 package.json、pyproject.toml、go.mod、pom.xml、Dockerfile、.github/workflows/、next.config.*);依赖解析并匹配 registry 的 dependency_signals(优先清单而非仅按扩展名猜测);按需对特定文件做定向内容信号 grep(如 Terraform providers、K8s apiVersion、CloudFormation),不整库读取;无清单时以主要文件扩展名兜底。
- 组装 profile 对象,字段包括 schema_version、project_name、profiled_at(ISO 8601)、profiled_by、detection_summary(languages、frameworks、infrastructure、databases、auth、ai_agent、ci_cd、cloud_compute、messaging、api_protocols、mobile)、guardrail_packs、pack_count。规则:始终包含 owasp-asvs;检测到移动栈(flutter、react-native、swift、objective-c、kotlin)时加入 owasp-masvs;按 registry 匹配添加语言、框架、认证、AI、基础设施、CI/CD、云、数据库、消息与 API 包;去重并设置 pack_count;不得虚构包或信号,空仓库仅用 universal 基线并留空相应类别数组。
- 写入 .guardrails/profile.json(按需创建 .guardrails/)。
- 上传至 SecurityReview.ai(security-review-mcp):用 find_project_by_name 解析 project_id(name="<SRAI_PROJECT_NAME>"),缺失时按 kit 规则 list_projects、create_project;调用 update_vibe_profile(直接映射 profile 对象字段)与 write_default_pack(project_id、guardrail_packs、pack_count)。资料明确不要向用户请求“批准 MCP”,应直接调用;若因权限失败,报告确切的 CLI 权限错误。
- 报告:简要汇总检测到的栈、包数量与上传状态。
何时运行:kit 初始化且用户选择对仓库画像并推送默认包;首次运行或缺少 profile 且威胁建模前需要护栏;开发者显式要求重新画像。若 .guardrails/profile.json 已存在且 schema_version 有效则跳过(除非被要求重做)。
IDE 说明:在 Cursor Agent CLI、GitHub Copilot CLI、Claude Code 或 Codex CLI 中运行时,将 profiled_by 设为稳定 ID(agent、cursor-agent、copilot、claude、codex)。
限制:资料未提供安装命令、价格、收费、平台支持范围与运行效果说明,均暂未提供,不得臆测。