Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/GROK_BUILD_AUTOMATIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Grok Build (formerly Cursor) Automations

> Cursor was renamed to **Grok Build** (`2026-11-30`). The desktop app and project hook config continue to use `.cursor/hooks.json` (`"version": 1`).

## Recipe mapping

| Recipe | Grok Build event | Behavior |
|---|---|---|
| `commit-guard` | `beforeShellExecution` | Denies `git commit` / `git push` / `gh pr create` with `permission: "deny"` + `user_message` + `agent_message`. |
| `secret-on-edit` | `afterFileEdit` | Non-blocking secret check on edited files. |
| `pr-security-review` | `stop` (`status == "completed"`) | Sends `[secfoo]` `followup_message` with findings; capped with `loop_limit: 2`. |

## Setup

```bash
secfoo automations enable commit-guard --host grok-build
secfoo automations enable pr-security-review --host grok-build
```

## Privacy & Cloud Agents

- **PII stripping:** `user_email` and `transcript_path` from Grok Build stdin payloads are never stored in `HookEvent` or forwarded to run records.
- **Cloud agents:** Project hooks in `.cursor/hooks.json` run in cloud agents (`sessionStart` and `sessionEnd` do not run in cloud agents, so flush occurs at `stop`).
- **Terminal UI (`grok`):** `.grok/hooks/` format is separate from `.cursor/hooks.json` and is not yet auto-managed by `secfoo automations enable`.
28 changes: 28 additions & 0 deletions docs/automations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Secfoo Automations & `secfoo hook`

Secfoo provides a single tested hook entrypoint (`secfoo hook <recipe> --host <tool>`) and a recipe manager (`secfoo automations`) for AI coding tools.

## Recipes

Built-in recipes live in `src/secfoo/automations/recipes/*.toml` (and user overrides in `~/.secfoo/automations/*.toml` — never loaded from untrusted target repositories):

- `commit-guard`: Scans staged changes for secrets and high-risk issues before `git commit`, `git push`, or `gh pr create`.
- `secret-on-edit`: Scans edited files for credentials after file edits.
- `pr-security-review`: Runs quick SAST + reachability checks on changed files before PR creation.

## Host Support & Detection

Supported hosts: `claude` (reference adapter), `cursor`, `copilot`, `gemini`, `antigravity`, `kiro`, `droid`, `codex`, `opencode`.

`secfoo hook` detects the actual host from environment variables and stdin payload shape, warns on `--host` mismatches, enforces `SECFOO_HOOK_ACTIVE=1` recursion protection and `stop_hook_active` / `continuationActive` / `loop_count` loop guards, deduplicates concurrent hooks, and fails open on errors or expired budgets.

## CLI

```sh
secfoo automations list
secfoo automations enable commit-guard --host claude --dry-run
secfoo automations enable commit-guard --host claude
secfoo automations status
secfoo automations doctor
secfoo automations disable commit-guard --host claude
```
27 changes: 27 additions & 0 deletions plugins/cursor-secfoo/hooks/hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"version": 1,
"hooks": {
"beforeShellExecution": [
{
"command": "secfoo hook commit-guard --host grok-build",
"timeout": 150,
"secfoo_recipe": "commit-guard"
}
],
"afterFileEdit": [
{
"command": "secfoo hook secret-on-edit --host grok-build",
"timeout": 150,
"secfoo_recipe": "secret-on-edit"
}
],
"stop": [
{
"command": "secfoo hook pr-security-review --host grok-build",
"timeout": 150,
"loop_limit": 2,
"secfoo_recipe": "pr-security-review"
}
]
}
}
1 change: 1 addition & 0 deletions src/secfoo/automations/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading
Loading