@jagreehal/shepherd 0.17.0 → 0.18.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/gate/.shepherd/gate.yml +1 -1
- package/gate/src/policy.ts +2 -1
- package/gate/templates/policy-strict.yml +1 -1
- package/gate/templates/shepherd-gate.yml +1 -1
- package/package.json +1 -1
- package/skills/shepherd/SKILL.md +2 -1
- package/src/cli.ts +2 -0
- package/src/install.ts +9 -2
- package/templates/shepherd-audit.yml +2 -2
- package/templates/shepherd-incident.yml +2 -2
- package/templates/shepherd.yml +4 -4
package/gate/.shepherd/gate.yml
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# yaml-language-server: $schema=https://unpkg.com/@jagreehal/shepherd@0.
|
|
1
|
+
# yaml-language-server: $schema=https://unpkg.com/@jagreehal/shepherd@0.18.0/gate/.shepherd/gate.schema.json
|
|
2
2
|
# gate merge-gate policy.
|
|
3
3
|
#
|
|
4
4
|
# Read from the repository's DEFAULT BRANCH, never from the PR head, so a PR
|
package/gate/src/policy.ts
CHANGED
|
@@ -1306,7 +1306,8 @@ export function installWorkflow(template: string, o: { awsOidc?: boolean; enviro
|
|
|
1306
1306
|
if (o.region !== undefined && !/^[a-z]{2}(-[a-z]+)+-\d$/.test(o.region)) throw new Error(`--region: not an AWS region: ${o.region}`);
|
|
1307
1307
|
// The OIDC step runs before gate reads its policy, so it gets the region written in, under the variable.
|
|
1308
1308
|
const regional = o.region ? template.replace("aws-region: ${{ vars.AWS_REGION }}", `aws-region: \${{ vars.AWS_REGION || '${o.region}' }}`) : template;
|
|
1309
|
-
|
|
1309
|
+
// A SHEPHERD_VERSION repository variable overrides the pin, so a bump needs no workflow edit.
|
|
1310
|
+
const pinned = regional.replace(/^(\s*SHEPHERD_VERSION: )(?:\$\{\{ vars\.SHEPHERD_VERSION \|\| '[^']*' \}\}|\S+)/m, (_, lead: string) => `${lead}\${{ vars.SHEPHERD_VERSION || '${SHEPHERD_VERSION}' }}`);
|
|
1310
1311
|
const placed = o.environment ? pinned.replace(/^( {4}runs-on: .*\n)/m, `$1 environment: ${o.environment} # holds the model key: only this job can read it\n`) : pinned;
|
|
1311
1312
|
|
|
1312
1313
|
return o.awsOidc ? enableAwsOidc(placed) : placed;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# yaml-language-server: $schema=https://unpkg.com/@jagreehal/shepherd@0.
|
|
1
|
+
# yaml-language-server: $schema=https://unpkg.com/@jagreehal/shepherd@0.18.0/gate/.shepherd/gate.schema.json
|
|
2
2
|
# gate merge-gate policy, strict: `shepherd gate init --strict` writes this one.
|
|
3
3
|
# Auth, secrets, migrations, infrastructure, billing, public API and toolchain
|
|
4
4
|
# changes always go to a human.
|
|
@@ -60,7 +60,7 @@ jobs:
|
|
|
60
60
|
runs-on: ubuntu-latest
|
|
61
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
62
|
env:
|
|
63
|
-
SHEPHERD_VERSION: 0.
|
|
63
|
+
SHEPHERD_VERSION: ${{ vars.SHEPHERD_VERSION || '0.18.0' }} # pinned: the engine decides what gets auto-approved, so bumps are deliberate; the SHEPHERD_VERSION variable overrides it
|
|
64
64
|
steps:
|
|
65
65
|
- uses: actions/checkout@v4
|
|
66
66
|
with:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jagreehal/shepherd",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
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",
|
package/skills/shepherd/SKILL.md
CHANGED
|
@@ -105,7 +105,8 @@ model pushes what you hand it. An iteration then differs in six places:
|
|
|
105
105
|
A model that wrote review Markdown itself once posted bare comments with no
|
|
106
106
|
header, title or prompt. Under `suggest` the review is the whole output: a
|
|
107
107
|
run that ends with findings and no `round.json` has failed. Threads still
|
|
108
|
-
resolve and triage still runs with the job's token as before.
|
|
108
|
+
resolve and triage still runs with the job's token as before. Never comment
|
|
109
|
+
`/shepherd` or run `shepherd review`: that asks the workflow to run you again.
|
|
109
110
|
|
|
110
111
|
- **Commit, never push.** Commit on the PR branch as usual. Append the handoff
|
|
111
112
|
addition from `references/dispatch.md` to every runner brief. After a runner,
|
package/src/cli.ts
CHANGED
|
@@ -750,6 +750,8 @@ if (command === "install") {
|
|
|
750
750
|
console.log(`\nstage ${s.stage}\nnext ${s.next}`);
|
|
751
751
|
} else if (command === "review" && sub) {
|
|
752
752
|
// The loop runs in GitHub Actions, not here: a `/shepherd` comment starts it, as one typed on the PR would.
|
|
753
|
+
if (process.env.GITHUB_ACTIONS === "true") orExit(() => { throw new Error("shepherd review starts the loop from a terminal; inside GitHub Actions the workflow already runs it"); });
|
|
754
|
+
|
|
753
755
|
const since = new Date(Date.now() - 5_000).toISOString();
|
|
754
756
|
const posted = spawnSync("gh", ["pr", "comment", sub, "--body", "/shepherd"], { cwd: repoRoot, encoding: "utf8" });
|
|
755
757
|
|
package/src/install.ts
CHANGED
|
@@ -8,8 +8,15 @@ import { z } from "zod";
|
|
|
8
8
|
|
|
9
9
|
export const MARKER = ".shepherd-installed";
|
|
10
10
|
|
|
11
|
-
/** A
|
|
12
|
-
|
|
11
|
+
/** A bare pin (`SHEPHERD_VERSION: 0.3.0`) or the variable-with-fallback form, so --upgrade moves either to the latter. */
|
|
12
|
+
const VERSION_PIN = /SHEPHERD_VERSION: (?:\$\{\{ vars\.SHEPHERD_VERSION \|\| '[^']*' \}\}|\S+)/g;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A workflow template with every `SHEPHERD_VERSION:` pin set to `version`, so each job runs the CLI that wrote it.
|
|
16
|
+
* A `SHEPHERD_VERSION` repository variable overrides it, so a bump needs no workflow edit.
|
|
17
|
+
*/
|
|
18
|
+
export const pinWorkflow = (text: string, version: string) =>
|
|
19
|
+
text.replaceAll(VERSION_PIN, () => `SHEPHERD_VERSION: \${{ vars.SHEPHERD_VERSION || '${version}' }}`);
|
|
13
20
|
|
|
14
21
|
/** Run the model job in a GitHub environment, so model keys stored as its secrets reach that job and no other. */
|
|
15
22
|
export function environmentWorkflow(text: string, name: string): string {
|
|
@@ -37,7 +37,7 @@ jobs:
|
|
|
37
37
|
audit_plays: ${{ steps.settings.outputs.audit_plays }}
|
|
38
38
|
aws_region: ${{ steps.settings.outputs.aws_region }}
|
|
39
39
|
env:
|
|
40
|
-
SHEPHERD_VERSION: 0.3.0 # pinned, as in audit
|
|
40
|
+
SHEPHERD_VERSION: ${{ vars.SHEPHERD_VERSION || '0.3.0' }} # pinned, as in audit
|
|
41
41
|
steps:
|
|
42
42
|
# Settings from the default branch's .shepherd/config.yml (ci:), each overridden by its variable when set.
|
|
43
43
|
- uses: actions/checkout@v4
|
|
@@ -73,7 +73,7 @@ jobs:
|
|
|
73
73
|
permissions:
|
|
74
74
|
contents: read
|
|
75
75
|
env:
|
|
76
|
-
SHEPHERD_VERSION: 0.3.0 # pinned: this runs with the repo's secrets, so bumps are deliberate
|
|
76
|
+
SHEPHERD_VERSION: ${{ vars.SHEPHERD_VERSION || '0.3.0' }} # pinned: this runs with the repo's secrets, so bumps are deliberate; the SHEPHERD_VERSION variable overrides it
|
|
77
77
|
PLAYBOOK_SHA: 65d4efd2cd0b081d52101e9708792b944e4ddebb # OWASP/secure-agent-playbook, pinned: the plays are instructions
|
|
78
78
|
PLAYS: ${{ github.event.inputs.plays || needs.repo.outputs.audit_plays }}
|
|
79
79
|
steps:
|
|
@@ -54,7 +54,7 @@ jobs:
|
|
|
54
54
|
issues: write
|
|
55
55
|
actions: read
|
|
56
56
|
env:
|
|
57
|
-
SHEPHERD_VERSION: 0.3.0 # pinned: this runs with the repo's secrets, so bumps are deliberate
|
|
57
|
+
SHEPHERD_VERSION: ${{ vars.SHEPHERD_VERSION || '0.3.0' }} # pinned: this runs with the repo's secrets, so bumps are deliberate; the SHEPHERD_VERSION variable overrides it
|
|
58
58
|
steps:
|
|
59
59
|
- uses: actions/checkout@v4
|
|
60
60
|
with:
|
|
@@ -148,7 +148,7 @@ jobs:
|
|
|
148
148
|
outputs:
|
|
149
149
|
incident_paths: ${{ steps.settings.outputs.incident_paths }}
|
|
150
150
|
env:
|
|
151
|
-
SHEPHERD_VERSION: 0.3.0 # pinned, as in investigate
|
|
151
|
+
SHEPHERD_VERSION: ${{ vars.SHEPHERD_VERSION || '0.3.0' }} # pinned, as in investigate
|
|
152
152
|
steps:
|
|
153
153
|
# Settings from the default branch's .shepherd/config.yml (ci:), each overridden by its variable when set.
|
|
154
154
|
- uses: actions/checkout@v4
|
package/templates/shepherd.yml
CHANGED
|
@@ -80,7 +80,7 @@ jobs:
|
|
|
80
80
|
pull-requests: read
|
|
81
81
|
env:
|
|
82
82
|
GH_TOKEN: ${{ github.token }}
|
|
83
|
-
SHEPHERD_VERSION: 0.3.0 # pinned, as in iterate
|
|
83
|
+
SHEPHERD_VERSION: ${{ vars.SHEPHERD_VERSION || '0.3.0' }} # pinned, as in iterate
|
|
84
84
|
steps:
|
|
85
85
|
# Settings from the default branch's .shepherd/config.yml (ci:), each overridden by its variable when set.
|
|
86
86
|
- uses: actions/checkout@v4
|
|
@@ -145,7 +145,7 @@ jobs:
|
|
|
145
145
|
env:
|
|
146
146
|
PR: ${{ github.event.workflow_run.pull_requests[0].number || github.event.issue.number || github.event.pull_request.number || inputs.pr }}
|
|
147
147
|
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
|
148
|
-
SHEPHERD_VERSION: 0.3.0 # pinned, as in iterate
|
|
148
|
+
SHEPHERD_VERSION: ${{ vars.SHEPHERD_VERSION || '0.3.0' }} # pinned, as in iterate
|
|
149
149
|
steps:
|
|
150
150
|
# Settings from the default branch's .shepherd/config.yml (ci:), each overridden by its variable when set.
|
|
151
151
|
- uses: actions/checkout@v4
|
|
@@ -253,7 +253,7 @@ jobs:
|
|
|
253
253
|
statuses: read
|
|
254
254
|
env:
|
|
255
255
|
PR: ${{ github.event.workflow_run.pull_requests[0].number || github.event.issue.number || github.event.pull_request.number || inputs.pr }}
|
|
256
|
-
SHEPHERD_VERSION: 0.3.0 # pinned: this runs with the repo's secrets, so bumps are deliberate
|
|
256
|
+
SHEPHERD_VERSION: ${{ vars.SHEPHERD_VERSION || '0.3.0' }} # pinned: this runs with the repo's secrets, so bumps are deliberate; the SHEPHERD_VERSION variable overrides it
|
|
257
257
|
steps:
|
|
258
258
|
- uses: actions/checkout@v4
|
|
259
259
|
with:
|
|
@@ -382,7 +382,7 @@ jobs:
|
|
|
382
382
|
# Matched case-insensitively.
|
|
383
383
|
DENY: ${{ vars.SHEPHERD_PUSH_DENY || '^\.github/|^\.gitmodules$|(^|/)\.gitattributes$|(^|/)\.(husky|githooks|devcontainer|vscode)/|(^|/)\.(npmrc|yarnrc|yarnrc\.yml|pnpmfile\.cjs)$|(^|/)(package\.json|bunfig\.toml|go\.mod|cargo\.toml|build\.rs|pyproject\.toml|setup\.(py|cfg)|requirements[^/]*\.txt|gemfile|composer\.json|pom\.xml|build\.gradle(\.kts)?|settings\.gradle(\.kts)?|[^/]*\.lockb?|[^/]*[._-]lock\.(json|ya?ml|hcl|toml)|[^/]*\.lockfile|npm-shrinkwrap\.json|go\.sum|package\.resolved|(gnu)?makefile|\.?justfile|taskfile(\.dist)?\.ya?ml)$|(^|/)\.pre-commit-config\.yaml$|(^|/)\.cargo/|(^|/)(pnpm-workspace\.yaml|pipfile|deno\.jsonc?)$' }}
|
|
384
384
|
DENY_ADD: ${{ needs.gate.outputs.push_deny }} # ci.push_deny: only ever added to DENY
|
|
385
|
-
SHEPHERD_VERSION: 0.3.0 # pinned, as in iterate
|
|
385
|
+
SHEPHERD_VERSION: ${{ vars.SHEPHERD_VERSION || '0.3.0' }} # pinned, as in iterate
|
|
386
386
|
steps:
|
|
387
387
|
# First, before any setup that could fail: a stopped iteration must never leave the gate's pending standing.
|
|
388
388
|
- name: Report a stopped iteration
|