Skip to content
Merged
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
22 changes: 21 additions & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ on:
description: Max total changed lines before the auditor's edits are reverted
type: string
default: '800'
commit-body-line-length:
description: Fallback max characters per commit-body line when the repo has no detectable commit convention (the auditor honors the repo's own body-max-line-length when it finds one)
type: string
default: '100'
skip-if-only-regex:
description: ERE — the gate skips the audit when EVERY changed file matches
type: string
Expand Down Expand Up @@ -266,14 +270,22 @@ jobs:
- name: Run docs auditor (Claude Code CLI)
env:
CLAUDE_VERSION: ${{ inputs.claude-code-version }}
COMMIT_BODY_LINE_LENGTH: ${{ inputs.commit-body-line-length }}
run: |
set -euo pipefail
# Install via npm (not bun) so the postinstall that fetches the native binary runs.
# Pinned version, isolated prefix -> deterministic, no global perms.
npm install -g --prefix "$RUNNER_TEMP/claude-cli" "@anthropic-ai/claude-code@$CLAUDE_VERSION"
export PATH="$RUNNER_TEMP/claude-cli/bin:$PATH"
claude --version
# Fallback commit-body line width injected into the prompt; validate before substituting.
LINE_MAX="${COMMIT_BODY_LINE_LENGTH:-100}"
if ! printf '%s' "$LINE_MAX" | grep -qE '^[1-9][0-9]*$'; then
echo "::error::commit-body-line-length must be a positive integer (got '$LINE_MAX')."; exit 1
fi
cat "$ENGINE_DIR/prompt-skeleton.md" "$POLICY_FILE" > "$RUNNER_TEMP/prompt.md"
sed "s/{{COMMIT_BODY_LINE_LENGTH}}/$LINE_MAX/g" "$RUNNER_TEMP/prompt.md" > "$RUNNER_TEMP/prompt.md.tmp"
mv "$RUNNER_TEMP/prompt.md.tmp" "$RUNNER_TEMP/prompt.md"
# --output-format json so we can lift the auditor's final summary into the commit
# message + PR body in a later step, instead of boilerplate.
set +e
Expand Down Expand Up @@ -493,12 +505,20 @@ jobs:
- name: Run docs auditor (Claude Code CLI)
env:
CLAUDE_VERSION: ${{ inputs.claude-code-version }}
COMMIT_BODY_LINE_LENGTH: ${{ inputs.commit-body-line-length }}
run: |
set -euo pipefail
npm install -g --prefix "$RUNNER_TEMP/claude-cli" "@anthropic-ai/claude-code@$CLAUDE_VERSION"
export PATH="$RUNNER_TEMP/claude-cli/bin:$PATH"
claude --version
# Fallback commit-body line width injected into the prompt; validate before substituting.
LINE_MAX="${COMMIT_BODY_LINE_LENGTH:-100}"
if ! printf '%s' "$LINE_MAX" | grep -qE '^[1-9][0-9]*$'; then
echo "::error::commit-body-line-length must be a positive integer (got '$LINE_MAX')."; exit 1
fi
cat "$ENGINE_DIR/prompt-skeleton.md" "$POLICY_FILE" > "$RUNNER_TEMP/prompt.md"
sed "s/{{COMMIT_BODY_LINE_LENGTH}}/$LINE_MAX/g" "$RUNNER_TEMP/prompt.md" > "$RUNNER_TEMP/prompt.md.tmp"
mv "$RUNNER_TEMP/prompt.md.tmp" "$RUNNER_TEMP/prompt.md"
set +e
claude -p "$(cat "$RUNNER_TEMP/prompt.md")" \
--allowed-tools "Read,Edit,Grep,Glob,Bash(git diff:*)" \
Expand Down Expand Up @@ -553,5 +573,5 @@ jobs:
base: ${{ github.ref_name }}
draft: true
commit-message: ${{ steps.compose.outputs.commit_message }}
title: "docs: sync documentation with code changes"
title: ${{ steps.compose.outputs.pr_title }}
body-path: ${{ steps.compose.outputs.body_path }}
3 changes: 3 additions & 0 deletions AGENT_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ Notes:
[README → Inputs](https://github.com/slingshot/docs-sentinel#inputs).
- If the repo pays for Anthropic directly instead of OpenRouter, use the
[Anthropic-native recipe](https://github.com/slingshot/docs-sentinel#using-anthropic-directly-instead-of-openrouter).
- The sync commit auto-matches your repo's commit convention (commitlint, commit templates,
commitizen/cocogitto/gitlint); `commit-body-line-length` (default 100) tunes the fallback body
wrap for repos with no detectable convention.

## Step 3 — Write the policy file

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ any documentation the change made inaccurate, and fixes it — surgically.
a churn budget (default 15 files / 800 lines), or every edit is reverted and the job fails.
- 🧾 **Receipts included** — commit messages and PR bodies are built from the auditor's own summary
plus the actual doc diff, so you always see exactly what changed and why.
- ✍️ **Convention-aware commits** — the auditor detects your commit rules (commitlint config, commit
templates, commitizen/cocogitto/gitlint) and shapes the sync commit's subject and body to match;
`commit-body-line-length` (default 100) is the fallback wrap for repos with no convention.

## Quickstart

Expand Down Expand Up @@ -99,6 +102,7 @@ All inputs are optional.
| `denylist-regex` | `(^\|/)CHANGELOG\.md$` | Forbidden even if allowlisted |
| `file-budget` | `15` | Max files the auditor may change |
| `line-budget` | `800` | Max total changed lines |
| `commit-body-line-length` | `100` | Fallback max chars per commit-body line when the repo has no detectable commit convention (the auditor matches the repo's own `body-max-line-length` when it finds one) |
| `skip-if-only-regex` | docs/tests + common lockfiles | Gate skips (no model call) when EVERY changed file matches |
| `diff-exclude` | common lockfiles | File patterns excluded from the diff text shown to the auditor |
| `sync-branch` | `docs/sync` | Fixed branch for the rolling docs-sync PR |
Expand Down
Loading
Loading