@jagreehal/shepherd 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +3 -3
- package/README.md +40 -27
- package/THIRD_PARTY_NOTICES.md +2 -0
- package/gate/.shepherd/gate.schema.json +657 -0
- package/gate/.shepherd/gate.yml +123 -0
- package/gate/.shepherd/review-guidance.md +95 -0
- package/gate/src/actions.ts +32 -0
- package/gate/src/cli.ts +1046 -0
- package/gate/src/config.ts +102 -0
- package/gate/src/delta.ts +29 -0
- package/gate/src/env.ts +30 -0
- package/gate/src/eval.ts +292 -0
- package/gate/src/familiarity.ts +461 -0
- package/gate/src/github.ts +761 -0
- package/gate/src/inline.ts +59 -0
- package/gate/src/isolated-cli.ts +281 -0
- package/gate/src/leads.ts +257 -0
- package/gate/src/llm.ts +647 -0
- package/gate/src/notify.ts +57 -0
- package/gate/src/policy.ts +1313 -0
- package/gate/src/prices.ts +62 -0
- package/gate/src/provider-errors.ts +80 -0
- package/gate/src/retention.ts +86 -0
- package/gate/src/reviewer.ts +739 -0
- package/gate/src/signals.ts +105 -0
- package/gate/src/smoke-live.ts +64 -0
- package/gate/src/stack.ts +87 -0
- package/gate/src/stories.ts +297 -0
- package/gate/templates/policy-strict.yml +128 -0
- package/gate/templates/reviewer.Dockerfile +8 -0
- package/gate/templates/rules/observability/SKILL.md +33 -0
- package/gate/templates/shepherd-gate-actions.yml +35 -0
- package/gate/templates/shepherd-gate-edited.yml +29 -0
- package/gate/templates/shepherd-gate.yml +111 -0
- package/lenses/dotnet/SKILL.md +1 -1
- package/lenses/go/SKILL.md +1 -1
- package/lenses/java/SKILL.md +1 -1
- package/lenses/nextjs/SKILL.md +1 -1
- package/lenses/node-api/SKILL.md +1 -1
- package/lenses/nx-monorepo/SKILL.md +1 -1
- package/lenses/observability/SKILL.md +1 -1
- package/lenses/owasp-asvs/SKILL.md +1 -1
- package/lenses/owasp-llm/SKILL.md +1 -1
- package/lenses/pstack/SKILL.md +1 -1
- package/lenses/python/SKILL.md +1 -1
- package/lenses/react/SKILL.md +1 -1
- package/lenses/rust/SKILL.md +1 -1
- package/package.json +21 -7
- package/schema/config.json +1 -1
- package/skills/branch-review/SKILL.md +123 -0
- package/skills/ci-repair/SKILL.md +79 -35
- package/skills/garden/SKILL.md +8 -8
- package/skills/garden/references/telemetry.md +4 -4
- package/skills/incident/SKILL.md +9 -9
- package/skills/lens-import/SKILL.md +7 -7
- package/skills/review-slop/SKILL.md +1 -1
- package/skills/shepherd/SKILL.md +43 -41
- package/skills/shepherd/references/degradation.md +3 -3
- package/skills/shepherd/references/dispatch.md +1 -1
- package/skills/shepherd/references/formats.md +5 -5
- package/skills/shepherd/references/models.md +2 -2
- package/skills/shepherd/references/policy.md +9 -9
- package/skills/swarm/SKILL.md +21 -17
- package/skills/swarm/references/custom-lenses.md +2 -2
- package/skills/swarm/references/formats.md +1 -1
- package/skills/triage/SKILL.md +10 -10
- package/src/bin.ts +10 -0
- package/src/cli.ts +285 -42
- package/src/config.ts +26 -25
- package/src/doctor.ts +31 -18
- package/src/garden-traces.ts +13 -13
- package/src/garden.ts +4 -4
- package/src/lens.ts +19 -7
- package/src/setup.ts +72 -0
- package/src/stack.ts +2 -2
- package/src/status.ts +80 -0
- package/src/summary.ts +52 -9
- package/src/trace.ts +4 -4
- package/src/working.ts +30 -0
- package/templates/shepherd-audit.yml +7 -15
- package/templates/shepherd-incident.yml +7 -12
- package/templates/shepherd.yml +39 -40
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# yaml-language-server: $schema=https://unpkg.com/@jagreehal/shepherd@0.17.0/gate/.shepherd/gate.schema.json
|
|
2
|
+
# gate merge-gate policy, strict: `shepherd gate init --strict` writes this one.
|
|
3
|
+
# Auth, secrets, migrations, infrastructure, billing, public API and toolchain
|
|
4
|
+
# changes always go to a human.
|
|
5
|
+
#
|
|
6
|
+
# Read from the repository's DEFAULT BRANCH, never from the PR head, so a PR
|
|
7
|
+
# cannot rewrite the policy that gates it. Patterns are regexes matched
|
|
8
|
+
# case-insensitively on word boundaries. Keep them single-quoted.
|
|
9
|
+
version: 1
|
|
10
|
+
|
|
11
|
+
# Settings. Each is optional. SHEPHERD_MODEL overrides `model`; `shepherd gate config` shows every value in effect
|
|
12
|
+
# and where it came from.
|
|
13
|
+
# Secrets never go here. Without a price for the model, the $ budget cannot fire ("budget guard inactive"); gate init
|
|
14
|
+
# writes the model's list price from models.dev, dated, for you to check against your region or contract.
|
|
15
|
+
# model: bedrock/minimax.minimax-m2.5
|
|
16
|
+
# backends: [api, bedrock:openai.gpt-oss-120b-1:0] # primary, then a second opinion
|
|
17
|
+
# pricing:
|
|
18
|
+
# openai.gpt-oss-120b: { inputPer1M: 0.18, outputPer1M: 0.70, as_of: 2026-11-14, source: aws.amazon.com/bedrock/pricing eu-west-1 }
|
|
19
|
+
# provider: { region: eu-west-1 } # also base_url (openai-compatible/) and anthropic_base_url
|
|
20
|
+
# guard: { budget_usd: 2, tokens: 3m, loop: 4/12, max_tools: 80, timeout: 15m }
|
|
21
|
+
# max_output_tokens: 16000
|
|
22
|
+
# effort: high # how hard the reviewer reasons (low, medium, high); unset leaves each model's default
|
|
23
|
+
# cli: { claude_model: claude-sonnet-5-5, codex_model: gpt-5.5 }
|
|
24
|
+
# label: gate # review only PRs carrying this label
|
|
25
|
+
# notify: { on: [REFUSED, ESCALATE, ERROR] }
|
|
26
|
+
# telemetry: { endpoint: https://otlp.example.com, service: gate }
|
|
27
|
+
# advise_on_deny: true # on a gate denial, still ask the model; its findings ride on the refusal, never approve
|
|
28
|
+
|
|
29
|
+
# How posted reviews look. Leave out for the defaults. Glyph keys: APPROVED, REFUSED, ESCALATE,
|
|
30
|
+
# ERROR, pass, fail, fix.
|
|
31
|
+
# branding:
|
|
32
|
+
# name: gate
|
|
33
|
+
# avatar: https://example.com/logo.png
|
|
34
|
+
# emoji: { ESCALATE: ⚠️ }
|
|
35
|
+
|
|
36
|
+
# T2: never AI-approved. Any changed file matching a `paths` or `any` pattern
|
|
37
|
+
# denies the PR before the LLM runs. `any` and `titles` patterns also scan the
|
|
38
|
+
# PR title, but a title hit is only a scrutiny flag for the reviewer, never a
|
|
39
|
+
# denial on its own (calibrated against ~440 PRs: most title-only hits were
|
|
40
|
+
# incidental mentions humans approved unchanged).
|
|
41
|
+
deny:
|
|
42
|
+
auth:
|
|
43
|
+
description: Authentication and authorization surfaces.
|
|
44
|
+
match:
|
|
45
|
+
any: ['auth', 'login', 'signup', 'oauth', 'saml', 'sso', 'oidc', 'credential', 'password', '2fa', 'mfa', 'two[_-]?factor']
|
|
46
|
+
titles: ['authenticated', 'authorized']
|
|
47
|
+
paths: ['session_auth', 'session_token', 'permission']
|
|
48
|
+
crypto_secrets:
|
|
49
|
+
description: Cryptography, secrets, and key material.
|
|
50
|
+
match:
|
|
51
|
+
any: ['crypto', 'encrypt', 'decrypt', 'vault']
|
|
52
|
+
paths: ['secret', 'api[_-]?key', 'private[_-]?key', 'signing[_-]?key', 'certificate', '\.env', '\.pem']
|
|
53
|
+
migrations:
|
|
54
|
+
description: Database and schema migrations.
|
|
55
|
+
match:
|
|
56
|
+
paths: ['migrations/', 'schema_change', 'drizzle/', 'prisma/migrations']
|
|
57
|
+
infra_cicd:
|
|
58
|
+
description: Infrastructure, CI, and deployment artifacts.
|
|
59
|
+
match:
|
|
60
|
+
any: ['terraform', 'kubernetes', 'helm']
|
|
61
|
+
paths: ['k8s', 'dockerfile', 'docker-compose', '\.github/workflows', 'iam', 'cloudflare', '(?:^|/)bin/deploy', 'deploy\.sh', 'vercel\.json', 'fly\.toml']
|
|
62
|
+
billing:
|
|
63
|
+
description: Payments and billing.
|
|
64
|
+
match:
|
|
65
|
+
any: ['billing', 'payment', 'stripe', 'invoice', 'pricing']
|
|
66
|
+
public_api:
|
|
67
|
+
description: Public API contracts and schemas.
|
|
68
|
+
match:
|
|
69
|
+
any: ['openapi', 'api_schema', 'swagger', 'public_api']
|
|
70
|
+
deps_toolchain:
|
|
71
|
+
description: Lockfiles and toolchain/build files. Manifests (package.json) without a lockfile change are flagged for the reviewer instead.
|
|
72
|
+
match:
|
|
73
|
+
paths: ['pnpm-lock\.yaml', 'package-lock\.json', 'yarn\.lock', 'bun\.lock', 'uv\.lock', 'poetry\.lock', 'Cargo\.lock', 'Gemfile\.lock', 'go\.sum', 'requirements[-\w]*\.(txt|in)', 'Makefile', '\.tool-versions', '\.nvmrc']
|
|
74
|
+
gate_policy:
|
|
75
|
+
description: gate's own policy, engine, and gate inputs. The gate cannot approve edits to itself.
|
|
76
|
+
match:
|
|
77
|
+
paths: ['\.shepherd/(gate\.yml|review-guidance\.md|steering\.md|rules/)', 'gate/src/', 'CODEOWNERS', 'AGENT_APPROVALS\.md', '\.github/workflows/shepherd-gate(-edited|-actions)?\.ya?ml']
|
|
78
|
+
|
|
79
|
+
# T0: docs/tests/config only. Still LLM-reviewed, lighter bar.
|
|
80
|
+
allow:
|
|
81
|
+
path_patterns: ['docs/', 'README', 'CHANGELOG', 'LICENSE', 'CONTRIBUTING', '.gitignore', '.editorconfig', '__snapshots__/']
|
|
82
|
+
extensions_only: ['.md', '.mdx', '.txt', '.rst', '.json', '.yaml', '.yml', '.toml', '.ini', '.cfg', '.csv', '.png', '.jpg', '.jpeg', '.gif', '.svg', '.webp', '.ico', '.snap']
|
|
83
|
+
|
|
84
|
+
# Substantive lines/files (docs, tests, snapshots, lockfiles, images excluded).
|
|
85
|
+
# Backtest: denied PRs that merged unchanged cluster at 500-750 lines;
|
|
86
|
+
# past ~800 the merged-unchanged rate collapses, so escalation is right there.
|
|
87
|
+
size_gate:
|
|
88
|
+
max_lines: 800
|
|
89
|
+
max_files: 30
|
|
90
|
+
|
|
91
|
+
# Contract ceilings for per-folder AGENT_APPROVALS.md grants. A folder may raise
|
|
92
|
+
# size_gate within these ceilings; grants are read from the default branch only.
|
|
93
|
+
overrides:
|
|
94
|
+
size_gate.max_lines: { ceiling: 1000 }
|
|
95
|
+
size_gate.max_files: { ceiling: 50 }
|
|
96
|
+
|
|
97
|
+
# Author familiarity: judgment layer only, never a gate.
|
|
98
|
+
familiarity:
|
|
99
|
+
strong:
|
|
100
|
+
min_blame_overlap_pct: 70
|
|
101
|
+
moderate:
|
|
102
|
+
min_prior_prs: 5
|
|
103
|
+
max_days_since_touch: 180
|
|
104
|
+
|
|
105
|
+
tiers:
|
|
106
|
+
T1a-trivial: { max_lines: 20, max_files: 3 }
|
|
107
|
+
T1b-small: { max_lines: 100, max_files: 5 }
|
|
108
|
+
T1c-medium: { max_lines: 300, max_files: 15 }
|
|
109
|
+
|
|
110
|
+
# Scrutiny paths: never deny on their own, but the reviewer is told these files changed and what
|
|
111
|
+
# would make the change a refusal. Deterministic detection, LLM judgment. This is how "CI is the
|
|
112
|
+
# wall that does not move" gets enforced: an agent will weaken a gate to reach green, and a linter
|
|
113
|
+
# cannot see its own config being loosened.
|
|
114
|
+
scrutiny:
|
|
115
|
+
quality_gates:
|
|
116
|
+
description: Lint, type-check, test and coverage configuration.
|
|
117
|
+
paths: ['\.oxlintrc', 'oxlint\.config', 'eslint\.config', '\.eslintrc', 'biome\.json', 'vitest\.config', 'vitest\.workspace', 'vite\.config', 'jest\.config', 'playwright\.config', 'codecov', '\.nycrc', 'ruff\.toml', 'pytest\.ini', 'mypy\.ini', '\.pre-commit-config', 'lefthook', '\.husky/', 'tools/oxlint/', '\.semgrepignore', '\.gitleaks\.toml', '\.gitleaksignore', '\.bandit', '\.golangci', '\.hadolint\.ya?ml', '\.shellcheckrc', '\.rubocop', '\.trivyignore']
|
|
118
|
+
instruction: REFUSE if a rule was disabled or downgraded, an ignore pattern widened, a coverage threshold lowered, a strict flag turned off, a test made skip/only, a hook removed, or a scanner rule or path excluded. Tightening is fine.
|
|
119
|
+
review_agents:
|
|
120
|
+
description: Configuration and house rules that review and fix agents follow on later PRs.
|
|
121
|
+
paths: ['\.shepherd/', '\.claude/skills/', '\.agents/skills/', '(?:^|/)AGENTS\.md$', '(?:^|/)CLAUDE\.md$', '(?:^|/)REVIEW\.md$', 'docs/adr/']
|
|
122
|
+
instruction: These files decide how agents review and fix future PRs. REFUSE if a lens was removed, its applies_to narrowed, a Review rule deleted or weakened, Fix guidance loosened (fewer Never touch or Escalate entries), or a house rule relaxed, or REVIEW.md told to skip a path or class of finding, lower a severity or cap findings. Adding or tightening rules is fine.
|
|
123
|
+
|
|
124
|
+
# Bots that leave 👀 while reviewing; gate waits for them before judging.
|
|
125
|
+
reviewer_bots: ['greptile-apps[bot]', 'coderabbitai[bot]', 'chatgpt-codex-connector[bot]', 'claude[bot]']
|
|
126
|
+
|
|
127
|
+
# Review services that report as a check run on the head; gate waits while one is queued or running.
|
|
128
|
+
reviewer_checks: ['Claude Code Review']
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Build from an empty context: never send the PR checkout to docker build.
|
|
2
|
+
FROM node:22.18.0-bookworm-slim@sha256:752ea8a2f758c34002a0461bd9f1cee4f9a3c36d48494586f60ffce1fc708e0e
|
|
3
|
+
RUN apt-get update && apt-get install -y --no-install-recommends git ripgrep ca-certificates \
|
|
4
|
+
&& rm -rf /var/lib/apt/lists/* \
|
|
5
|
+
&& npm install -g @anthropic-ai/claude-code@2.1.293 @openai/codex@0.161.0
|
|
6
|
+
USER 1000:1000
|
|
7
|
+
ENV HOME=/home/node
|
|
8
|
+
WORKDIR /review
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: observability
|
|
3
|
+
description: Observability rules for a code review. Flags new code that production cannot see, debug or alert on, or that leaks through telemetry. Covers entry points and outbound calls without a span, trace context lost across services, queues and background work, errors that lose their cause, logs that are unstructured or not tied to the trace, requests that carry no identifiers, secrets or personal data in telemetry, silent data drops, unbounded names and labels, metrics no alert can use, renamed telemetry, telemetry setup that can crash the app or lose data on exit, and user-facing changes with no signal. Use as a review lens or as a gate rule pack.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# observability
|
|
7
|
+
|
|
8
|
+
Production is where this code will fail. Review whether an on-call engineer who
|
|
9
|
+
has never seen this code could see it fail, find the one request, follow it
|
|
10
|
+
across services and know why, from the telemetry alone, without the telemetry
|
|
11
|
+
itself leaking data, costing too much or taking the app down.
|
|
12
|
+
|
|
13
|
+
## Review
|
|
14
|
+
|
|
15
|
+
- **boundary-signal**: Every new entry point (HTTP route, queue or event consumer, scheduled job, worker, CLI command) and every call that leaves the process (HTTP, database, cache, queue, model API, file or shell) runs inside a span, from framework instrumentation or the repository's tracing helper. Flag: a new route, consumer, job or outbound call outside any span. Why: an outage there is invisible.
|
|
16
|
+
- **context-propagation**: Trace context crosses every boundary the work does. Outbound HTTP goes through an instrumented client, a published message carries the context in its headers and its consumer continues or links it, and deferred work (a timer, an in-process queue, a fire-and-forget promise, `waitUntil`) runs inside the span that started it. Flag: a hand-built client that bypasses instrumentation, a message published without context, a consumer that starts a fresh root, a detached promise. Why: the trace breaks at the boundary, and so does the investigation.
|
|
17
|
+
- **error-context**: A caught or rethrown error keeps its cause (`new Error(msg, { cause })`), is recorded on the active span with status ERROR, and is logged once with the identifiers that find the request: ids, never payloads. Flag: an empty `catch`, a rethrow of a bare message, a log of `error.message` without the error, an error turned into a success response with no record, the same error logged at every layer. Why: the trail ends at the catch.
|
|
18
|
+
- **structured-logs**: Server code logs through the repository's structured logger with fields, at a level that matches what happened, and every line carries the trace and span id. Flag: interpolated log strings, `console.log` in server code, a second logger, a logger not wired to the trace, an error logged at info. Why: nobody can search, alert on or jump from a line of prose.
|
|
19
|
+
- **request-context**: A handler or job puts the bounded identifiers that find one request on its span or request-scoped logger (the wide event): tenant, user, order or job id, the outcome. A change that adds a decision to existing code (a branch, fallback, retry, cache hit or miss, flag variant, or a choice between providers or rules) records which way it went there, as a bounded value. Flag: a new handler whose span carries nothing beyond its route, or a new path through existing code that leaves no trace of having been taken. Why: the trace says what failed, not for whom or which way the code went.
|
|
20
|
+
- **no-sensitive-data**: Logs, span attributes, events and metric labels carry no secrets, tokens, passwords, cookies, whole request bodies or headers, or personal data beyond the ids the team has agreed to keep. Flag: logging a whole object built from user input, headers or credentials; an email, name, address or card field as an attribute. Why: telemetry becomes the leak.
|
|
21
|
+
- **silent-drop**: Code that skips, filters or discards records, gives up on a retry, times out, or falls back counts or logs what it dropped and why. Flag: a `continue`, default branch, swallowed timeout or fallback value that loses data without a trace. Why: data loss nobody notices.
|
|
22
|
+
- **bounded-attributes**: Span names, metric names and metric labels take bounded values: route templates, not URLs; an enum reason, not an error message. Ids belong on span attributes and logs, never in a span name or metric label. Flag: user ids, ids inside URLs, free text or raw input as a metric label or span name. Why: cardinality blows up cost and queries.
|
|
23
|
+
- **alertable-signal**: A new dependency, queue, job or money or auth path emits what an alert needs to isolate it: outcomes counted by a bounded result or reason, a duration histogram, and for queues and jobs the lag or last success. Flag: a new integration whose failures show up only as a generic 500, a job nobody would notice had stopped. Why: no one can page on it, so no one is paged.
|
|
24
|
+
- **feature-signal**: A change meant to move a user outcome emits the event or metric that shows whether it did. Flag: a new user-facing flow with no event or metric. Why: no one can tell it works.
|
|
25
|
+
- **telemetry-contract**: Span names, attribute keys, metric names and labels, and event names are a contract that dashboards, alerts and queries read. Flag: a renamed or removed name or key with no note of what reads it, a unit changed under the same metric name. Why: the dashboard goes quiet and nobody notices until the incident.
|
|
26
|
+
- **safe-telemetry**: Telemetry can neither take the app down nor lose what it buffered. Initialisation runs once, at startup, before the code it instruments, and an exporter or backend failure never throws into a request. The process flushes on shutdown, and short-lived work (serverless handlers, workers, CLIs, scripts) flushes before it exits. Every deployable sets its service name, version and environment from configuration. Flag: telemetry initialised inside a request or module that loads late, `process.exit` with no flush, a signal handler that does not wait for shutdown, a new deployable with no service name or version, an environment hard-coded per build. Why: the telemetry is missing exactly when the process is dying.
|
|
27
|
+
- **telemetry-config**: A change to sampling, exporters, redaction or log level keeps errors and slow requests sampled, keeps redaction on and keeps production at its agreed level. Flag: sampling that can drop error traces, redaction switched off, debug logging enabled in production, an exporter endpoint or key hard-coded. Why: the telemetry a team relied on is gone and nothing says so.
|
|
28
|
+
|
|
29
|
+
## Fix
|
|
30
|
+
|
|
31
|
+
- Prefer: the repository's existing logger, tracer and metrics helpers, found in code next to the change.
|
|
32
|
+
- Never touch: telemetry configuration, exporters, sampling or vendor setup.
|
|
33
|
+
- Escalate: adding a logging, tracing or metrics dependency or vendor, any rule where the repository has no logger or tracer yet, and `telemetry-config` and `telemetry-contract` breaks: they are the team's calls.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# gate: "Let shepherd fix it" on the gate card. Installed by `bunx @jagreehal/shepherd gate init`.
|
|
2
|
+
# Ticking the box edits gate's card comment; this dispatches shepherd's workflow for the PR, as a `/shepherd`
|
|
3
|
+
# comment would. A file of its own because it needs `actions: write`, which shepherd-gate.yml's review never does, and a
|
|
4
|
+
# workflow that shepherd-gate-edited.yml calls may not ask for more than its caller grants. No checkout and no model keys:
|
|
5
|
+
# it reads the event and calls the API, nothing else.
|
|
6
|
+
name: shepherd-gate-actions
|
|
7
|
+
on:
|
|
8
|
+
issue_comment:
|
|
9
|
+
types: [edited]
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
actions: write # workflow_dispatch of shepherd.yml
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
shepherd:
|
|
16
|
+
# The card (posted by the workflow token or a custom App, so any [bot] carrying the marker, as gate itself
|
|
17
|
+
# matches its reviews), and this edit is the one that ticked the box: an unrelated edit does nothing. The
|
|
18
|
+
# ticker's permission below is the guard.
|
|
19
|
+
if: >-
|
|
20
|
+
github.event.issue.pull_request != null && endsWith(github.event.comment.user.login, '[bot]') && startsWith(github.event.comment.body, '<!-- gate-actions -->')
|
|
21
|
+
&& contains(github.event.comment.body, '- [x] <!-- gate-action:shepherd -->')
|
|
22
|
+
&& !contains(github.event.changes.body.from, '- [x] <!-- gate-action:shepherd -->')
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
timeout-minutes: 5
|
|
25
|
+
steps:
|
|
26
|
+
- env:
|
|
27
|
+
GH_TOKEN: ${{ github.token }}
|
|
28
|
+
SENDER: ${{ github.event.sender.login }}
|
|
29
|
+
PR: ${{ github.event.issue.number }}
|
|
30
|
+
run: |
|
|
31
|
+
# Only someone who could merge may hand a PR on; anyone can tick a box they cannot actually save.
|
|
32
|
+
perm=$(gh api "repos/$GITHUB_REPOSITORY/collaborators/$SENDER/permission" --jq .permission 2>/dev/null || echo none)
|
|
33
|
+
case "$perm" in admin|maintain|write) ;; *) echo "$SENDER ($perm) cannot merge; not handing PR #$PR to shepherd"; exit 0 ;; esac
|
|
34
|
+
gh workflow run shepherd.yml -R "$GITHUB_REPOSITORY" -f pr="$PR" -f asked=true
|
|
35
|
+
echo "handed PR #$PR to shepherd for $SENDER"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# gate: re-review on the two PR edits that change what was reviewed. Installed by `bunx @jagreehal/shepherd gate init`.
|
|
2
|
+
# - A base retarget rewrites the diff without moving the head, so a standing approval would cover a diff
|
|
3
|
+
# nobody reviewed.
|
|
4
|
+
# - The author (or shepherd, posting as them) edits a body that carries shepherd's review-changes section:
|
|
5
|
+
# shepherd writes that disclosure after pushing its fixes, so the review of that head has to see it.
|
|
6
|
+
# Every other edit (a bot rewriting the description after each push) skips here, under this workflow's own
|
|
7
|
+
# name, so it never stacks a skipped "gate / review" run over the real one.
|
|
8
|
+
name: shepherd-gate-edited
|
|
9
|
+
on:
|
|
10
|
+
pull_request:
|
|
11
|
+
types: [edited]
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
pull-requests: write
|
|
16
|
+
issues: read # a called workflow gets no more than its caller grants
|
|
17
|
+
# shepherd-gate.yml reads the test-evidence artifact, and a called workflow gets no more than its caller grants.
|
|
18
|
+
actions: read
|
|
19
|
+
checks: read
|
|
20
|
+
#aws-oidc id-token: write # shepherd-gate.yml's Bedrock OIDC step: a called workflow gets no more than its caller grants
|
|
21
|
+
|
|
22
|
+
jobs:
|
|
23
|
+
review:
|
|
24
|
+
if: >-
|
|
25
|
+
github.event.changes.base != null
|
|
26
|
+
|| (github.event.changes.body != null && github.event.sender.login == github.event.pull_request.user.login
|
|
27
|
+
&& contains(github.event.pull_request.body, '<!-- shepherd:review-changes -->'))
|
|
28
|
+
uses: ./.github/workflows/shepherd-gate.yml
|
|
29
|
+
secrets: inherit
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# shepherd gate: approve-first PR review. Installed by `bunx @jagreehal/shepherd gate init`.
|
|
2
|
+
#
|
|
3
|
+
# Pick a model with the SHEPHERD_MODEL variable (provider/model, e.g. anthropic/claude-opus-5,
|
|
4
|
+
# bedrock/eu.amazon.nova-pro-v1:0, opencode-go/deepseek-v4.1-flash, openai/gpt-5.5) or `model:` in
|
|
5
|
+
# .shepherd/gate.yml, and add that provider's key as a secret under its usual name. Bedrock without a key uses
|
|
6
|
+
# OIDC: `shepherd gate init --aws-oidc` and the AWS_ROLE_ARN variable. Every other setting lives in the policy,
|
|
7
|
+
# read from the default branch; `shepherd gate config` prints what is in effect.
|
|
8
|
+
# Also: Settings → Actions → General → "Allow GitHub Actions to create and approve pull requests".
|
|
9
|
+
name: shepherd-gate
|
|
10
|
+
on:
|
|
11
|
+
# `/gate` in a PR comment re-runs the review: the fix loop otherwise needs an empty commit. So does ticking
|
|
12
|
+
# "Review again" on the gate card, which edits that comment.
|
|
13
|
+
issue_comment:
|
|
14
|
+
types: [created, edited]
|
|
15
|
+
pull_request:
|
|
16
|
+
# `converted_to_draft` and `unlabeled` withdraw a standing approval: the draft/label skip paths retract it.
|
|
17
|
+
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, labeled, unlabeled]
|
|
18
|
+
# Edits arrive through shepherd-gate-edited.yml, which calls this workflow for a base retarget or the author's
|
|
19
|
+
# review-changes disclosure. The job `if` below still names both, since a called run sees the `edited` event.
|
|
20
|
+
workflow_call:
|
|
21
|
+
|
|
22
|
+
concurrency:
|
|
23
|
+
# Only runs that review share the PR's group, so a newer review supersedes an older one. A run the
|
|
24
|
+
# job's `if` skips (an ordinary comment, or a bot rewriting the PR description after every push)
|
|
25
|
+
# gets a group of its own: in the shared group it cancelled the review in flight after that review
|
|
26
|
+
# had retracted the approval, leaving no verdict coming. The condition below is the job's `if`,
|
|
27
|
+
# verbatim, except that a comment joins the group only from an OWNER, MEMBER or COLLABORATOR: anyone
|
|
28
|
+
# else's `/gate` runs in a group of its own, so it cannot cancel a review before gate has checked
|
|
29
|
+
# their permission. A tick of "Review again" also runs in a group of its own: the ticker's permission is not in
|
|
30
|
+
# the event, so gate checks it before anything changes. A test keeps them in step. Two runs that do overlap order themselves by run marker.
|
|
31
|
+
group: gate-${{ github.event.pull_request.number || github.event.issue.number }}-${{ ((github.event_name == 'pull_request' && (github.event.action != 'edited' || github.event.changes.base != null || (github.event.changes.body != null && github.event.sender.login == github.event.pull_request.user.login && contains(github.event.pull_request.body, '<!-- shepherd:review-changes -->')))) || (github.event_name == 'issue_comment' && github.event.action == 'created' && github.event.issue.pull_request != null && startsWith(github.event.comment.body, '/gate') && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association))) && 'review' || github.run_id }}
|
|
32
|
+
cancel-in-progress: true # a newer head supersedes the review in flight
|
|
33
|
+
|
|
34
|
+
permissions:
|
|
35
|
+
contents: read
|
|
36
|
+
pull-requests: write
|
|
37
|
+
# Reads the PR's reactions (the issues API serves them) to wait for reviewer bots still at work.
|
|
38
|
+
issues: read
|
|
39
|
+
# Reads the test-evidence artifact when policy sets `stories:`.
|
|
40
|
+
actions: read
|
|
41
|
+
# Reads reviewer check runs, such as Claude Code Review, to wait while one is running.
|
|
42
|
+
checks: read
|
|
43
|
+
#aws-oidc id-token: write # Bedrock through OIDC: the AWS step exchanges it for the role's credentials
|
|
44
|
+
|
|
45
|
+
jobs:
|
|
46
|
+
review:
|
|
47
|
+
# No draft/bot/label filter here on purpose: gate itself decides whether to review, and it
|
|
48
|
+
# retracts its stale approval on every skip path. A job-level `if` would skip the retraction too.
|
|
49
|
+
# A comment never changes the head, so skipping one strands no approval. Only people who could
|
|
50
|
+
# merge anyway may spend a run this way: gate checks the commenter's permission first and exits
|
|
51
|
+
# without touching anything otherwise. That check is not here because author_association reads
|
|
52
|
+
# write access through a team, and a private org member, as CONTRIBUTOR.
|
|
53
|
+
if: >-
|
|
54
|
+
(github.event_name == 'pull_request' && (github.event.action != 'edited' || github.event.changes.base != null || (github.event.changes.body != null && github.event.sender.login == github.event.pull_request.user.login && contains(github.event.pull_request.body, '<!-- shepherd:review-changes -->'))))
|
|
55
|
+
|| (github.event_name == 'issue_comment' && github.event.action == 'created' && github.event.issue.pull_request != null
|
|
56
|
+
&& startsWith(github.event.comment.body, '/gate'))
|
|
57
|
+
|| (github.event_name == 'issue_comment' && github.event.action == 'edited' && github.event.issue.pull_request != null
|
|
58
|
+
&& endsWith(github.event.comment.user.login, '[bot]') && startsWith(github.event.comment.body, '<!-- gate-actions -->') && contains(github.event.comment.body, '- [x] <!-- gate-action:rereview -->')
|
|
59
|
+
&& !contains(github.event.changes.body.from, '- [x] <!-- gate-action:rereview -->'))
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
timeout-minutes: 20 # a hung model call must not burn a runner for six hours; a killed run is fail-closed (the approval is already retracted)
|
|
62
|
+
env:
|
|
63
|
+
SHEPHERD_VERSION: 0.17.0 # pinned: the engine decides what gets auto-approved, so bumps are deliberate
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/checkout@v4
|
|
66
|
+
with:
|
|
67
|
+
ref: ${{ github.event.pull_request.head.sha || github.sha }} # on a comment event gate fetches the head itself
|
|
68
|
+
persist-credentials: false # no token in .git/config for a reviewer to read; gate's fetches authenticate through gh
|
|
69
|
+
fetch-depth: 1 # gate fetches the base ref and origin/<default> itself, and unshallows only when a run reaches the familiarity signal
|
|
70
|
+
# Bedrock through OIDC (`shepherd gate init --aws-oidc`). The provider reads the credentials this step exports.
|
|
71
|
+
# A failed exchange must not skip gate: gate retracts its standing approvals before anything else, and
|
|
72
|
+
# the review then ends in ERROR for want of credentials. A `pull_request` run from a fork gets no OIDC token; a `/gate` comment runs in this repository and gets one.
|
|
73
|
+
#aws-oidc - uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
|
74
|
+
#aws-oidc continue-on-error: true
|
|
75
|
+
#aws-oidc with:
|
|
76
|
+
#aws-oidc role-to-assume: ${{ vars.AWS_ROLE_ARN }}
|
|
77
|
+
#aws-oidc aws-region: ${{ vars.AWS_REGION }}
|
|
78
|
+
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0: pinned, this job holds model keys
|
|
79
|
+
- run: bunx "@jagreehal/shepherd@$SHEPHERD_VERSION" gate "$PR" --post --json "$RUNNER_TEMP/gate.json"
|
|
80
|
+
env:
|
|
81
|
+
PR: ${{ github.event.pull_request.number || github.event.issue.number }}
|
|
82
|
+
GH_TOKEN: ${{ github.token }}
|
|
83
|
+
SHEPHERD_BOT_LOGIN: github-actions[bot]
|
|
84
|
+
SHEPHERD_CLI_IMAGE: gate-reviewer:local
|
|
85
|
+
SHEPHERD_BUILD_CLI_IMAGE: '1' # The gate prepares the packaged image after approval handling and gates
|
|
86
|
+
# Set the key for your provider; the others stay empty.
|
|
87
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
88
|
+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
89
|
+
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
|
|
90
|
+
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
|
|
91
|
+
GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
|
|
92
|
+
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
|
|
93
|
+
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
|
|
94
|
+
AI_GATEWAY_API_KEY: ${{ secrets.AI_GATEWAY_API_KEY }}
|
|
95
|
+
AWS_BEARER_TOKEN_BEDROCK: ${{ secrets.AWS_BEARER_TOKEN_BEDROCK }} # leave empty for OIDC (step above)
|
|
96
|
+
OPENAI_COMPATIBLE_API_KEY: ${{ secrets.OPENAI_COMPATIBLE_API_KEY }}
|
|
97
|
+
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} # backends: [claude]
|
|
98
|
+
CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }} # backends: [codex]
|
|
99
|
+
OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }}
|
|
100
|
+
TYPESAFE_API_KEY: ${{ secrets.TYPESAFE_API_KEY }}
|
|
101
|
+
SHEPHERD_NOTIFY_WEBHOOK: ${{ secrets.SHEPHERD_NOTIFY_WEBHOOK }} # Slack Incoming Webhook or any URL that takes JSON
|
|
102
|
+
SHEPHERD_MODEL: ${{ vars.SHEPHERD_MODEL }}
|
|
103
|
+
OPENAI_COMPATIBLE_BASE_URL: ${{ vars.OPENAI_COMPATIBLE_BASE_URL }}
|
|
104
|
+
ANTHROPIC_BASE_URL: ${{ vars.ANTHROPIC_BASE_URL }}
|
|
105
|
+
AWS_REGION: ${{ vars.AWS_REGION }}
|
|
106
|
+
OTEL_EXPORTER_OTLP_ENDPOINT: ${{ vars.OTEL_EXPORTER_OTLP_ENDPOINT }}
|
|
107
|
+
- uses: actions/upload-artifact@v4
|
|
108
|
+
if: always()
|
|
109
|
+
with:
|
|
110
|
+
name: gate-evidence-${{ github.event.pull_request.number || github.event.issue.number }}
|
|
111
|
+
path: ${{ runner.temp }}/gate.json
|
package/lenses/dotnet/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dotnet
|
|
3
|
-
description: C# and ASP.NET Core rules for a code review. Flags code that deadlocks, leaks, trusts input or loses data in ways the compiler and Roslyn analysers miss. Covers sync-over-async and async void, cancellation tokens not passed, missing authorization on endpoints, unvalidated input and over-posting, raw SQL and commands built from input, unsafe deserialisation, EF Core N+1 and tracking pitfalls, DI lifetime mismatches, HttpClient misuse, disposables not disposed, swallowed exceptions, and API and entity contract changes. Use as a review lens or as a
|
|
3
|
+
description: C# and ASP.NET Core rules for a code review. Flags code that deadlocks, leaks, trusts input or loses data in ways the compiler and Roslyn analysers miss. Covers sync-over-async and async void, cancellation tokens not passed, missing authorization on endpoints, unvalidated input and over-posting, raw SQL and commands built from input, unsafe deserialisation, EF Core N+1 and tracking pitfalls, DI lifetime mismatches, HttpClient misuse, disposables not disposed, swallowed exceptions, and API and entity contract changes. Use as a review lens or as a gate rule pack.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# dotnet
|
package/lenses/go/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: go
|
|
3
|
-
description: Go rules for a code review. Flags code that leaks goroutines, races, loses errors or hangs in production in ways go vet and staticcheck do not catch. Covers context not passed or ignored, goroutines with no way to stop, unsynchronised shared state, errors dropped or wrapped without %w, resources not closed, HTTP servers and clients with no timeouts, SQL and commands built from input, panics in library code, nil maps and interfaces holding typed nils, unbounded concurrency, and exported API changes. Use as a review lens or as a
|
|
3
|
+
description: Go rules for a code review. Flags code that leaks goroutines, races, loses errors or hangs in production in ways go vet and staticcheck do not catch. Covers context not passed or ignored, goroutines with no way to stop, unsynchronised shared state, errors dropped or wrapped without %w, resources not closed, HTTP servers and clients with no timeouts, SQL and commands built from input, panics in library code, nil maps and interfaces holding typed nils, unbounded concurrency, and exported API changes. Use as a review lens or as a gate rule pack.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# go
|
package/lenses/java/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: java
|
|
3
|
-
description: Java and Spring rules for a code review. Flags code that leaks resources, breaks transactions, trusts input or falls over under load in ways the compiler and static analysers miss. Covers @Transactional pitfalls, N+1 queries and unbounded fetches, missing authorisation on endpoints, unvalidated request bodies, queries and commands built from input, unsafe deserialisation and XML parsing, resources not closed, swallowed exceptions, thread-unsafe shared state in singletons, blocking calls without timeouts, and entity or API contract changes. Use as a review lens or as a
|
|
3
|
+
description: Java and Spring rules for a code review. Flags code that leaks resources, breaks transactions, trusts input or falls over under load in ways the compiler and static analysers miss. Covers @Transactional pitfalls, N+1 queries and unbounded fetches, missing authorisation on endpoints, unvalidated request bodies, queries and commands built from input, unsafe deserialisation and XML parsing, resources not closed, swallowed exceptions, thread-unsafe shared state in singletons, blocking calls without timeouts, and entity or API contract changes. Use as a review lens or as a gate rule pack.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# java
|
package/lenses/nextjs/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: nextjs
|
|
3
|
-
description: Next.js rules for a code review, meant to be composed with the react lens. Flags App Router and Pages Router code that leaks data across the server/client boundary, skips authorisation, caches the wrong thing or ships too much to the browser. Covers route handlers and server actions without auth, middleware matchers that miss routes, server-only code reaching the client, props that serialise secrets, user data cached across users, dynamic APIs that break static rendering, redirects built from input, unvalidated action input, heavy client bundles, and metadata or image misuse. Use as a review lens or as a
|
|
3
|
+
description: Next.js rules for a code review, meant to be composed with the react lens. Flags App Router and Pages Router code that leaks data across the server/client boundary, skips authorisation, caches the wrong thing or ships too much to the browser. Covers route handlers and server actions without auth, middleware matchers that miss routes, server-only code reaching the client, props that serialise secrets, user data cached across users, dynamic APIs that break static rendering, redirects built from input, unvalidated action input, heavy client bundles, and metadata or image misuse. Use as a review lens or as a gate rule pack.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# nextjs
|
package/lenses/node-api/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: node-api
|
|
3
|
-
description: Node.js HTTP service rules for a code review (Express, Fastify, Hono, Koa, NestJS). Flags handlers that skip auth, trust input, leak errors, hang or lose work. Covers middleware mount order, per-resource authorisation, unvalidated bodies and params, queries and commands built from input, error responses that leak internals, async errors that escape the handler, missing timeouts on outbound calls, unbounded bodies and lists, idempotency on retried writes, blocking the event loop, untyped request augmentation and unsafe CORS. Use as a review lens or as a
|
|
3
|
+
description: Node.js HTTP service rules for a code review (Express, Fastify, Hono, Koa, NestJS). Flags handlers that skip auth, trust input, leak errors, hang or lose work. Covers middleware mount order, per-resource authorisation, unvalidated bodies and params, queries and commands built from input, error responses that leak internals, async errors that escape the handler, missing timeouts on outbound calls, unbounded bodies and lists, idempotency on retried writes, blocking the event loop, untyped request augmentation and unsafe CORS. Use as a review lens or as a gate rule pack.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# node-api
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: nx-monorepo
|
|
3
|
-
description: Nx monorepo rules for a code review. Flags changes that break project boundaries or quietly switch off what keeps a monorepo honest. Covers deep imports past a project's public entry, circular project dependencies, shared contracts changed without their dependents, app code in shared libs, targets, inputs, outputs and cache settings that stop affected and caching from covering code, loosened tags and dependency constraints, path aliases that bypass boundaries, untagged projects, implicit dependency workarounds, environment and secrets in shared libs, and version drift between projects. Use as a review lens or as a
|
|
3
|
+
description: Nx monorepo rules for a code review. Flags changes that break project boundaries or quietly switch off what keeps a monorepo honest. Covers deep imports past a project's public entry, circular project dependencies, shared contracts changed without their dependents, app code in shared libs, targets, inputs, outputs and cache settings that stop affected and caching from covering code, loosened tags and dependency constraints, path aliases that bypass boundaries, untagged projects, implicit dependency workarounds, environment and secrets in shared libs, and version drift between projects. Use as a review lens or as a gate rule pack.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# nx-monorepo
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: observability
|
|
3
|
-
description: Observability rules for a code review. Flags new code that production cannot see, debug or alert on, or that leaks through telemetry. Covers entry points and outbound calls without a span, trace context lost across services, queues and background work, errors that lose their cause, logs that are unstructured or not tied to the trace, requests that carry no identifiers, secrets or personal data in telemetry, silent data drops, unbounded names and labels, metrics no alert can use, renamed telemetry, telemetry setup that can crash the app or lose data on exit, and user-facing changes with no signal. Use as a review lens or as a
|
|
3
|
+
description: Observability rules for a code review. Flags new code that production cannot see, debug or alert on, or that leaks through telemetry. Covers entry points and outbound calls without a span, trace context lost across services, queues and background work, errors that lose their cause, logs that are unstructured or not tied to the trace, requests that carry no identifiers, secrets or personal data in telemetry, silent data drops, unbounded names and labels, metrics no alert can use, renamed telemetry, telemetry setup that can crash the app or lose data on exit, and user-facing changes with no signal. Use as a review lens or as a gate rule pack.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# observability
|
|
@@ -9,7 +9,7 @@ description: >
|
|
|
9
9
|
password storage, account enumeration, cryptography, secrets and transport,
|
|
10
10
|
data exposure, error leakage and fail-open handling, and security event
|
|
11
11
|
logging. Each finding cites the ASVS requirement and CWE. Use as a review lens
|
|
12
|
-
or as a
|
|
12
|
+
or as a gate rule pack.
|
|
13
13
|
source: github:OWASP/secure-agent-playbook/plugins/code-security-skills/skills/security-guidance@65d4efd2cd0b081d52101e9708792b944e4ddebb
|
|
14
14
|
license: CC-BY-4.0
|
|
15
15
|
---
|
|
@@ -9,7 +9,7 @@ description: >
|
|
|
9
9
|
poisoned retrieval and memory, unbounded tokens and loops, MCP servers without
|
|
10
10
|
auth or scoped tools, unpinned models and tools, agent-to-agent trust, and
|
|
11
11
|
answers presented as fact without grounding. Each finding cites the LLM or ASI
|
|
12
|
-
id. Use as a review lens or as a
|
|
12
|
+
id. Use as a review lens or as a gate rule pack.
|
|
13
13
|
source: github:OWASP/secure-agent-playbook/plugins/ai-security-skills@65d4efd2cd0b081d52101e9708792b944e4ddebb
|
|
14
14
|
license: CC-BY-4.0
|
|
15
15
|
---
|
package/lenses/pstack/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pstack
|
|
3
|
-
description: pstack's engineering principles as code review rules. Flags changes that work against the principles pstack-driven agents are told to follow. Covers a symptom patched where the fault surfaced, guards that hide a state that should never exist, validation scattered past the boundary, raw external data trusted without a parse, interchangeable primitives, domain rules spread across conditionals, one-caller layers and wider mutable state, old APIs kept beside their replacement, steps that break when run twice, shared write targets, tests that cannot fail or are pinned to internals, and numbers or claims the PR states without evidence. Use as a review lens or as a
|
|
3
|
+
description: pstack's engineering principles as code review rules. Flags changes that work against the principles pstack-driven agents are told to follow. Covers a symptom patched where the fault surfaced, guards that hide a state that should never exist, validation scattered past the boundary, raw external data trusted without a parse, interchangeable primitives, domain rules spread across conditionals, one-caller layers and wider mutable state, old APIs kept beside their replacement, steps that break when run twice, shared write targets, tests that cannot fail or are pinned to internals, and numbers or claims the PR states without evidence. Use as a review lens or as a gate rule pack.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# pstack
|
package/lenses/python/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: python
|
|
3
|
-
description: Python rules for a code review (services, workers, Django, FastAPI, Flask). Flags code that trusts input, loses errors, blocks or misbehaves under load in ways ruff and mypy miss. Covers queries and commands built from input, unsafe deserialisation, missing authorization on views, unvalidated input, swallowed exceptions, blocking calls in async code, outbound calls with no timeout, mutable defaults and module state shared across requests, ORM N+1 and unbounded queries, transactions that commit half the work, naive datetimes, and API and model contract changes. Use as a review lens or as a
|
|
3
|
+
description: Python rules for a code review (services, workers, Django, FastAPI, Flask). Flags code that trusts input, loses errors, blocks or misbehaves under load in ways ruff and mypy miss. Covers queries and commands built from input, unsafe deserialisation, missing authorization on views, unvalidated input, swallowed exceptions, blocking calls in async code, outbound calls with no timeout, mutable defaults and module state shared across requests, ORM N+1 and unbounded queries, transactions that commit half the work, naive datetimes, and API and model contract changes. Use as a review lens or as a gate rule pack.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# python
|
package/lenses/react/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: react
|
|
3
|
-
description: React rules for a code review. Flags component code that renders wrong, leaks, races or locks out users in ways the hooks lint cannot see. Covers state derived in effects, effects that race or never clean up, stale closures, unstable identities that defeat memoisation, keys that lose state, uncontrolled-to-controlled switches, server data copied into local state, HTML injected from untrusted input, secrets in client bundles, error and loading states left out, and interactive elements no keyboard or screen reader can use. Use as a review lens or as a
|
|
3
|
+
description: React rules for a code review. Flags component code that renders wrong, leaks, races or locks out users in ways the hooks lint cannot see. Covers state derived in effects, effects that race or never clean up, stale closures, unstable identities that defeat memoisation, keys that lose state, uncontrolled-to-controlled switches, server data copied into local state, HTML injected from untrusted input, secrets in client bundles, error and loading states left out, and interactive elements no keyboard or screen reader can use. Use as a review lens or as a gate rule pack.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# react
|
package/lenses/rust/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: rust
|
|
3
|
-
description: Rust rules for a code review. Flags code that compiles and passes clippy but panics, blocks, leaks or breaks soundness in production. Covers unsafe blocks without a SAFETY argument, unwrap and expect on fallible input, panics across FFI, blocking calls in async code, locks held across await, unbounded channels and spawns, lost errors, integer overflow in release builds, untrusted deserialisation limits, SQL and commands built from input, and public API and serde changes. Use as a review lens or as a
|
|
3
|
+
description: Rust rules for a code review. Flags code that compiles and passes clippy but panics, blocks, leaks or breaks soundness in production. Covers unsafe blocks without a SAFETY argument, unwrap and expect on fallible input, panics across FFI, blocking calls in async code, locks held across await, unbounded channels and spawns, lost errors, integer overflow in release builds, untrusted deserialisation limits, SQL and commands built from input, and public API and serde changes. Use as a review lens or as a gate rule pack.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# rust
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jagreehal/shepherd",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Agent skills that drive a PR to merge-ready: a review swarm, thread triage, CI repair, and a loop that hands the result to
|
|
3
|
+
"version": "0.17.0",
|
|
4
|
+
"description": "Agent skills that drive a PR to merge-ready: a review swarm, thread triage, CI repair, and a loop that hands the result to the gate.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "github:jagreehal/shepherd",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|
|
9
|
-
"shepherd": "./src/
|
|
9
|
+
"shepherd": "./src/bin.ts"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"src",
|
|
@@ -19,7 +19,11 @@
|
|
|
19
19
|
"templates",
|
|
20
20
|
"schema",
|
|
21
21
|
"AGENTS.md",
|
|
22
|
-
"THIRD_PARTY_NOTICES.md"
|
|
22
|
+
"THIRD_PARTY_NOTICES.md",
|
|
23
|
+
"gate/src",
|
|
24
|
+
"!gate/src/*.test.ts",
|
|
25
|
+
"gate/.shepherd",
|
|
26
|
+
"gate/templates"
|
|
23
27
|
],
|
|
24
28
|
"engines": {
|
|
25
29
|
"bun": ">=1.2",
|
|
@@ -32,9 +36,9 @@
|
|
|
32
36
|
"test": "bun test",
|
|
33
37
|
"typecheck": "tsc --noEmit",
|
|
34
38
|
"check": "bun run lint && bun run typecheck && bun test",
|
|
35
|
-
"lint": "oxlint src",
|
|
39
|
+
"lint": "oxlint src gate/src",
|
|
36
40
|
"changeset": "changeset",
|
|
37
|
-
"version-packages": "changeset version",
|
|
41
|
+
"version-packages": "changeset version && bun tools/sync-gate-version.ts",
|
|
38
42
|
"release": "changeset publish",
|
|
39
43
|
"docs:dev": "bun run --cwd docs dev",
|
|
40
44
|
"docs:build": "bun run docs:check && bun run --cwd docs build && bun docs/scripts/check-built.ts",
|
|
@@ -53,7 +57,17 @@
|
|
|
53
57
|
"typescript": "^7.0.2"
|
|
54
58
|
},
|
|
55
59
|
"dependencies": {
|
|
56
|
-
"
|
|
60
|
+
"@ai-sdk/amazon-bedrock": "5.0.118",
|
|
61
|
+
"@ai-sdk/anthropic": "4.0.82",
|
|
62
|
+
"@ai-sdk/groq": "4.0.63",
|
|
63
|
+
"@ai-sdk/mistral": "4.0.66",
|
|
64
|
+
"@ai-sdk/openai": "4.0.96",
|
|
65
|
+
"@ai-sdk/openai-compatible": "3.0.71",
|
|
66
|
+
"@aws-sdk/credential-provider-node": "^3.972.86",
|
|
67
|
+
"ai": "7.0.143",
|
|
68
|
+
"autotel": "9.3.0",
|
|
69
|
+
"autotel-bedrock": "4.0.0",
|
|
70
|
+
"autotel-genai": "0.17.0",
|
|
57
71
|
"yaml": "^2.9.1",
|
|
58
72
|
"zod": "^4.6.7"
|
|
59
73
|
}
|