@thegpvc/gp-foundry 0.2.16 → 0.3.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 +8 -1
- package/README.md +37 -2
- package/actions/config-loader/dist/index.cjs +1 -1
- package/actions/merge-gate/README.md +50 -2
- package/actions/merge-gate/action.yml +28 -1
- package/actions/merge-gate/dist/index.cjs +61 -58
- package/actions/pr-scope/README.md +36 -0
- package/actions/pr-scope/action.yml +76 -0
- package/actions/pr-scope/dist/index.cjs +70 -0
- package/dist/cli/index.cjs +148 -106
- package/package.json +1 -1
- package/schema/config.schema.json +32 -2
- package/skill/SKILL.md +11 -2
- package/skill/reference/node-types.md +38 -4
- package/skill/templates/foundry.config.yaml +21 -2
- package/skill/templates/harness.dot +9 -5
- package/skill/templates/policy-merge.yaml +14 -3
package/AGENTS.md
CHANGED
|
@@ -38,6 +38,10 @@ Confirm with the user, then edit:
|
|
|
38
38
|
|
|
39
39
|
- **`.github/agent-setup/action.yml`** — add the project's toolchain (setup-python,
|
|
40
40
|
setup-go, pnpm, …) below the agent-CLI step, so pipeline agents can build and test.
|
|
41
|
+
- **`.github/agents/foundry.config.yaml`** — set `identity.bot_login` to the account the
|
|
42
|
+
pipeline posts as (under PAT auth, the PAT's owner): it is how the pipeline recognizes its
|
|
43
|
+
own PRs. Leave `rollout: { authors: [] }` to start with the pipeline's own PRs only; add
|
|
44
|
+
logins (or an `opt_in_label`) to have it review people's PRs too.
|
|
41
45
|
- **`.github/agents/scope.yaml`** — what must agents NEVER touch (`immutable_paths`)?
|
|
42
46
|
Add the repo's build/test commands to `guidance:` (e.g. "run `make test` before any PR").
|
|
43
47
|
- **`.github/agents/roles/*.md`** — the "Repo-specific guidance" of `builder.md`,
|
|
@@ -80,7 +84,10 @@ npx -y @thegpvc/gp-foundry@latest doctor # everything green?
|
|
|
80
84
|
```
|
|
81
85
|
|
|
82
86
|
Then have the user **file an issue** describing a small change. The 🕵️ scout triages it
|
|
83
|
-
within a minute and the factory takes it from there
|
|
87
|
+
within a minute and the factory takes it from there — up to a reviewed PR with the gate's
|
|
88
|
+
verdict on it as a check. **Merging starts off.** When the user wants the pipeline's own
|
|
89
|
+
PRs merged for them, change `merge="off"` to `merge="agent-only"` on the `merge_gate` node
|
|
90
|
+
in `.github/harness.dot` and rebuild. A person's PR is never merged by the pipeline. Day-2: `npx -y @thegpvc/gp-foundry@latest status`
|
|
84
91
|
shows work in flight and anything stalled; add `gp-foundry build --check` to CI as a
|
|
85
92
|
drift gate.
|
|
86
93
|
|
package/README.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
**Stand up a "dark factory" for your repo: issues in → reviewed, auto-merged PRs out.**
|
|
4
4
|
|
|
5
|
+
It works alongside people, not instead of them. Agents and humans open pull requests in
|
|
6
|
+
the same repo; the pipeline reviews whichever of them you roll it out to, publishes its
|
|
7
|
+
verdict on each as a check, and merges only the PRs it wrote itself — and only once you
|
|
8
|
+
turn that on. A person's PR is always merged by a person.
|
|
9
|
+
|
|
5
10
|
`gp-foundry` lets you **declare an autonomous agent pipeline as a directed graph and compile
|
|
6
11
|
it** into a repo. You describe the crew and the flow in one `harness.dot`; a deterministic
|
|
7
12
|
compiler emits plain GitHub Actions workflows. There's no orchestrator to run — **GitHub is
|
|
@@ -113,7 +118,7 @@ takes an issue from triage to merge, plus the lanes that keep the factory health
|
|
|
113
118
|
| 🧹 | janitor | Scheduled sweep: rebase PRs the gate flagged `needs-rebase` so they can merge. |
|
|
114
119
|
| 🧭 | supervisor | Scheduled sweep: re-drive stranded issues/PRs; escalate to `needs-human` after 2 nudges. |
|
|
115
120
|
| ♻️ | retro | Scheduled: mine merged PRs/reviews/CI for recurring lessons; write them to team memory. |
|
|
116
|
-
| 🔀 | merge_gate | **Policy gate, not a persona** —
|
|
121
|
+
| 🔀 | merge_gate | **Policy gate, not a persona** — judges every PR in scope against the merge policy (approval, CI green, size, protected paths) and publishes the result as a check. With `merge="agent-only"` it also merges the PRs the pipeline wrote, or labels them `needs-rebase`/`needs-human`. A new harness starts with `merge="off"`. |
|
|
117
122
|
|
|
118
123
|
Roles are generic; a consumer repo supplies its stack (label strings, build/test commands,
|
|
119
124
|
size thresholds, merge policy) via config and the `roles/*.md` overlay, never baked into the
|
|
@@ -151,7 +156,7 @@ digraph harness {
|
|
|
151
156
|
builder [type=producer, role="agents/roles/builder.md", context=issue]
|
|
152
157
|
reviewer [type=pr-review, role="agents/roles/reviewer.md", context="pr-diff"]
|
|
153
158
|
fixer [type=pr-fix, role="agents/roles/fixer.md", max_attempts=3]
|
|
154
|
-
merge_gate [type=merge-gate, policy="agents/policy/merge.yaml", schedule="*/30 * * * *"]
|
|
159
|
+
merge_gate [type=merge-gate, policy="agents/policy/merge.yaml", schedule="*/30 * * * *", merge="off"]
|
|
155
160
|
janitor [type=scheduled-agent, role="agents/roles/janitor.md", schedule="*/30 * * * *"]
|
|
156
161
|
supervisor [type=scheduled-agent, role="agents/roles/supervisor.md", schedule="17 * * * *"]
|
|
157
162
|
retro [type=scheduled-agent, role="agents/roles/retro.md", schedule="0 7 * * 1-5"]
|
|
@@ -173,6 +178,36 @@ Every cycle must keep a bounded escape edge to an `exit` node; the model-checker
|
|
|
173
178
|
unbounded loops at build time. Full vocabulary in
|
|
174
179
|
[skill/reference/node-types.md](./skill/reference/node-types.md).
|
|
175
180
|
|
|
181
|
+
## People and agents in one repo
|
|
182
|
+
|
|
183
|
+
A new harness is **hybrid**: its config has a `rollout` block, and that one block is the
|
|
184
|
+
scope every lane and the gate share.
|
|
185
|
+
|
|
186
|
+
```yaml
|
|
187
|
+
rollout:
|
|
188
|
+
authors: [] # nobody's PRs but the pipeline's own — the starting point
|
|
189
|
+
# authors: [alice, bob] # ...and these people's
|
|
190
|
+
# opt_in_label: agent-review # ...and any PR carrying this label
|
|
191
|
+
# skip_label: no-agent-review
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
- **What the pipeline looks at.** Its own PRs always; then whoever the rollout admits.
|
|
195
|
+
Drafts and other bots' PRs never. `rollout: {}` is every PR.
|
|
196
|
+
- **What it may change.** Lanes that read (the reviewer, the gate's check) run on any PR in
|
|
197
|
+
scope. Lanes that write (the fixer, a merge) act only on a PR the pipeline *wrote*:
|
|
198
|
+
opened by `identity.bot_login`, every commit its own. One commit from anyone else and a
|
|
199
|
+
person merges it.
|
|
200
|
+
- **Merging is a switch on the gate.** `merge="off"` (the default for a new harness)
|
|
201
|
+
publishes the gate's result as a check and merges nothing. `merge="agent-only"` also
|
|
202
|
+
merges the PRs the pipeline wrote. There is no setting that merges a person's PR.
|
|
203
|
+
|
|
204
|
+
Set `identity.bot_login` to the account the pipeline actually posts as (under PAT auth, the
|
|
205
|
+
PAT's owner). It is how the pipeline recognizes its own PRs; if it is wrong, the guard job's
|
|
206
|
+
log says so.
|
|
207
|
+
|
|
208
|
+
A harness without a `rollout` block is the original factory and compiles as it always has:
|
|
209
|
+
lanes scoped to `repo.branch_prefix` branches, and a gate that merges them.
|
|
210
|
+
|
|
176
211
|
## Self-healing & self-improving
|
|
177
212
|
|
|
178
213
|
**Self-healing** — stuck work gets re-driven or escalated, not left silently stranded:
|
|
@@ -81,7 +81,7 @@ ${s}`;break;case"retry":Rw(s)&&(A[n]=s);break;case"id":bw(s)&&(A[n]=s);break;cas
|
|
|
81
81
|
`+h.slice(R,M),R=M+1),N=G;return Y+=`
|
|
82
82
|
`,h.length-R>m&&N>R?Y+=h.slice(R,N)+`
|
|
83
83
|
`+h.slice(N+1):Y+=h.slice(R),Y.slice(1)}function Al(h){let m="",F=0;for(let k=0;k<h.length;F>=65536?k+=2:k++){F=mA(h,k);let R=pe[F];!R&&OA(F)?(m+=h[k],F>=65536&&(m+=h[k+1])):m+=R||CA(F)}return m}function ho(h,m,F){let k="",R=h.tag;for(let M=0,N=F.length;M<N;M+=1){let G=F[M];h.replacer&&(G=h.replacer.call(F,String(M),G)),(D(h,m,G,!1,!1)||typeof G>"u"&&D(h,m,null,!1,!1))&&(k!==""&&(k+=","+(h.condenseFlow?"":" ")),k+=h.dump)}h.tag=R,h.dump="["+k+"]"}function fo(h,m,F,k){let R="",M=h.tag;for(let N=0,G=F.length;N<G;N+=1){let Y=F[N];h.replacer&&(Y=h.replacer.call(F,String(N),Y)),(D(h,m+1,Y,!0,!0,!1,!0)||typeof Y>"u"&&D(h,m+1,null,!0,!0,!1,!0))&&((!k||R!=="")&&(R+=sn(h,m)),h.dump&&o===h.dump.charCodeAt(0)?R+="-":R+="- ",R+=h.dump)}h.tag=M,h.dump=R||"[]"}function rl(h,m,F){let k="",R=h.tag,M=Object.keys(F);for(let N=0,G=M.length;N<G;N+=1){let Y="";k!==""&&(Y+=", "),h.condenseFlow&&(Y+='"');let H=M[N],P=F[H];h.replacer&&(P=h.replacer.call(F,H,P)),D(h,m,H,!1,!1)&&(h.dump.length>1024&&(Y+="? "),Y+=h.dump+(h.condenseFlow?'"':"")+":"+(h.condenseFlow?"":" "),D(h,m,P,!1,!1)&&(Y+=h.dump,k+=Y))}h.tag=R,h.dump="{"+k+"}"}function a(h,m,F,k){let R="",M=h.tag,N=Object.keys(F);if(h.sortKeys===!0)N.sort();else if(typeof h.sortKeys=="function")N.sort(h.sortKeys);else if(h.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let G=0,Y=N.length;G<Y;G+=1){let H="";(!k||R!=="")&&(H+=sn(h,m));let P=N[G],ce=F[P];if(h.replacer&&(ce=h.replacer.call(F,P,ce)),!D(h,m+1,P,!0,!0,!0))continue;let De=h.tag!==null&&h.tag!=="?"||h.dump&&h.dump.length>1024;De&&(h.dump&&o===h.dump.charCodeAt(0)?H+="?":H+="? "),H+=h.dump,De&&(H+=sn(h,m)),D(h,m+1,ce,!0,De)&&(h.dump&&o===h.dump.charCodeAt(0)?H+=":":H+=": ",H+=h.dump,R+=H)}h.tag=M,h.dump=R||"{}"}function p(h,m,F){let k=F?h.explicitTypes:h.implicitTypes;for(let R=0,M=k.length;R<M;R+=1){let N=k[R];if((N.instanceOf||N.predicate)&&(!N.instanceOf||typeof m=="object"&&m instanceof N.instanceOf)&&(!N.predicate||N.predicate(m))){if(F?N.multi&&N.representName?h.tag=N.representName(m):h.tag=N.tag:h.tag="?",N.represent){let G=h.styleMap[N.tag]||N.defaultStyle,Y;if(r.call(N.represent)==="[object Function]")Y=N.represent(m,G);else if(n.call(N.represent,G))Y=N.represent[G](m,G);else throw new e("!<"+N.tag+'> tag resolver accepts not "'+G+'" style');h.dump=Y}return!0}}return!1}function D(h,m,F,k,R,M,N){h.tag=null,h.dump=F,p(h,F,!1)||p(h,F,!0);let G=r.call(h.dump),Y=k;k&&(k=h.flowLevel<0||h.flowLevel>m);let H=G==="[object Object]"||G==="[object Array]",P,ce;if(H&&(P=h.duplicates.indexOf(F),ce=P!==-1),(h.tag!==null&&h.tag!=="?"||ce||h.indent!==2&&m>0)&&(R=!1),ce&&h.usedDuplicates[P])h.dump="*ref_"+P;else{if(H&&ce&&!h.usedDuplicates[P]&&(h.usedDuplicates[P]=!0),G==="[object Object]")k&&Object.keys(h.dump).length!==0?(a(h,m,h.dump,R),ce&&(h.dump="&ref_"+P+h.dump)):(rl(h,m,h.dump),ce&&(h.dump="&ref_"+P+" "+h.dump));else if(G==="[object Array]")k&&h.dump.length!==0?(h.noArrayIndent&&!N&&m>0?fo(h,m-1,h.dump,R):fo(h,m,h.dump,R),ce&&(h.dump="&ref_"+P+h.dump)):(ho(h,m,h.dump),ce&&(h.dump="&ref_"+P+" "+h.dump));else if(G==="[object String]")h.tag!=="?"&&el(h,h.dump,m,M,Y);else{if(G==="[object Undefined]")return!1;if(h.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+G)}if(h.tag!==null&&h.tag!=="?"){let De=encodeURI(h.tag[0]==="!"?h.tag.slice(1):h.tag).replace(/!/g,"%21");h.tag[0]==="!"?De="!"+De:De.slice(0,18)==="tag:yaml.org,2002:"?De="!!"+De.slice(18):De="!<"+De+">",h.dump=De+" "+h.dump}}return!0}function b(h,m){let F=[],k=[];w(h,F,k);let R=k.length;for(let M=0;M<R;M+=1)m.duplicates.push(F[k[M]]);m.usedDuplicates=new Array(R)}function w(h,m,F){if(h!==null&&typeof h=="object"){let k=m.indexOf(h);if(k!==-1)F.indexOf(k)===-1&&F.push(k);else if(m.push(h),Array.isArray(h))for(let R=0,M=h.length;R<M;R+=1)w(h[R],m,F);else{let R=Object.keys(h);for(let M=0,N=R.length;M<N;M+=1)w(h[R[M]],m,F)}}}function L(h,m){m=m||{};let F=new Xc(m);F.noRefs||b(h,F);let k=h;return F.replacer&&(k=F.replacer.call({"":k},"",k)),D(F,0,k,!0,!0)?F.dump+`
|
|
84
|
-
`:""}return nd.dump=L,nd}var p0;function NG(){if(p0)return Xe;p0=1;let t=bG(),e=SG();function A(r,n){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}return Xe.Type=ot(),Xe.Schema=m0(),Xe.FAILSAFE_SCHEMA=k0(),Xe.JSON_SCHEMA=F0(),Xe.CORE_SCHEMA=M0(),Xe.DEFAULT_SCHEMA=sd(),Xe.load=t.load,Xe.loadAll=t.loadAll,Xe.dump=e.dump,Xe.YAMLException=Si(),Xe.types={binary:T0(),float:N0(),map:D0(),null:R0(),pairs:x0(),set:Y0(),timestamp:U0(),bool:b0(),int:S0(),merge:L0(),omap:v0(),seq:w0(),str:y0()},Xe.safeLoad=A("safeLoad","load"),Xe.safeLoadAll=A("safeLoadAll","loadAll"),Xe.safeDump=A("safeDump","dump"),Xe}var FG=NG(),id=kG(FG),{Type:M$,Schema:U$,FAILSAFE_SCHEMA:L$,JSON_SCHEMA:T$,CORE_SCHEMA:v$,DEFAULT_SCHEMA:x$,load:Y$,loadAll:G$,dump:_$,YAMLException:J$,types:H$,safeLoad:q$,safeLoadAll:V$,safeDump:O$}=id;var tE=Ht(Wf(),1),AE=Ht(bR(),1);var SR={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://gp-foundry/schema/config.schema.json",title:"FoundryConfig",description:"Consumer-repo global config (foundry.config.yaml). Mirrors src/ir/types.ts FoundryConfig, extended with an optional `personas` map keyed by node/role for per-persona overrides.",type:"object",required:["name","identity","agent","repo","labels"],additionalProperties:!0,properties:{name:{type:"string",minLength:1,description:"Human-readable name of the harness/agent fleet."},identity:{type:"object",additionalProperties:!1,description:"How the agent authenticates and signs commits. Generalized: no hardcoded bot login or app-secret names.",properties:{app_id_secret:{type:"string",description:"Name of the Actions secret holding the GitHub App id."},app_key_secret:{type:"string",description:"Name of the Actions secret holding the GitHub App private key."},bot_login:{type:"string",description:'The bot login used for commits/PRs, e.g. "my-agent[bot]".'},git_name:{type:"string"},git_email:{type:"string",format:"email"}}},agent:{type:"object",required:["cli","model"],additionalProperties:!1,description:"The coding-agent CLI + default model.",properties:{cli:{type:"string",minLength:1,description:'The agent CLI binary, e.g. "claude".'},model:{type:"string",minLength:1,description:'Default model id, e.g. "claude-opus-4-8".'},oauth_token_secret:{type:"string",description:"Name of the Actions secret holding the agent OAuth token."},api_key_secret:{type:"string",description:"Name of the Actions secret holding an Anthropic API key. When set, agents authenticate with it INSTEAD of the OAuth token: usage-billed and not bound to one person's subscription seat."},allowed_tools:{$ref:"#/$defs/allowedTools",description:"Default allowed-tools list for the agent CLI."}}},repo:{type:"object",required:["base_branch","branch_prefix"],additionalProperties:!1,properties:{base_branch:{type:"string",minLength:1},branch_prefix:{type:"string",minLength:1},authors:{type:"array",minItems:1,items:{type:"string",minLength:1},description:"Only pull requests opened by these GitHub logins reach the PR lanes (pr-review, pr-fix, PR-context analysts, review panels, sweeps). Case-insensitive. A node's own authors= attribute overrides it for that lane."}}},labels:{type:"object",description:"semantic role -> repo label (the drift-killer).",additionalProperties:{type:"string"}},markers:{type:"object",description:"parseable markers shared by prompts + guards + enforcers.",additionalProperties:{type:"string"}},size:{type:"object",additionalProperties:!1,properties:{warn_additions:{type:"integer",minimum:0},hard_additions:{type:"integer",minimum:0},exclude_globs:{type:"array",items:{type:"string"}}}},runtime:{type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["pinned","vendored"]},ref:{type:"string"},owner_repo:{type:"string"}}},personas:{type:"object",description:"Per-node/per-role overrides, keyed by the node/persona key passed as the `node` input. Any field here shadows the top-level default when that persona is resolved.",additionalProperties:{$ref:"#/$defs/persona"}}},$defs:{allowedTools:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},persona:{type:"object",additionalProperties:!0,description:"Overrides for one persona/role. Every field is optional; unspecified fields fall back to the top-level config.",properties:{model:{type:"string",minLength:1},cli:{type:"string",minLength:1},allowed_tools:{$ref:"#/$defs/allowedTools"},labels:{type:"object",additionalProperties:{type:"string"}},identity:{type:"object",additionalProperties:!1,properties:{app_id_secret:{type:"string"},app_key_secret:{type:"string"},bot_login:{type:"string"},git_name:{type:"string"},git_email:{type:"string",format:"email"}}}}}}};var LO=tE.default.default??tE.default,TO=AE.default.default??AE.default,Kc=null;function vO(){if(Kc)return Kc;let t=new LO({allErrors:!0,allowUnionTypes:!0});return TO(t),Kc=t.compile(SR),Kc}function FR(t){return t==null?[]:(Array.isArray(t)?t:t.split(",")).map(A=>A.trim()).filter(A=>A.length>0)}function MR(t,e){let A=e!=null&&t.personas?t.personas[e]??{}:{};e!=null&&t.personas&&!(e in t.personas)&&zw(`config-loader: node "${e}" has no persona entry; using top-level defaults.`);let r={...t.identity,...A.identity??{}},n={...t.labels,...A.labels??{}},s=FR(A.allowed_tools??t.agent.allowed_tools);return{name:t.name,node:e,model:A.model??t.agent.model,cli:A.cli??t.agent.cli,allowedTools:s,labels:n,identity:r,oauthTokenSecret:t.agent.oauth_token_secret??null,repo:t.repo,markers:t.markers??{},size:t.size??null,runtime:t.runtime??null}}function UR(t){let e;try{e=(0,NR.readFileSync)(t,"utf8")}catch(n){throw new Error(`config-loader: could not read config at "${t}": ${n.message}`)}let A;try{A=id.load(e)}catch(n){throw new Error(`config-loader: failed to parse YAML at "${t}": ${n.message}`)}if(A==null||typeof A!="object"||Array.isArray(A))throw new Error(`config-loader: config at "${t}" must be a YAML mapping.`);let r=vO();if(!r(A)){let n=(r.errors??[]).map(s=>` - ${s.instancePath||"/"} ${s.message??"is invalid"}`).join(`
|
|
84
|
+
`:""}return nd.dump=L,nd}var p0;function NG(){if(p0)return Xe;p0=1;let t=bG(),e=SG();function A(r,n){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}return Xe.Type=ot(),Xe.Schema=m0(),Xe.FAILSAFE_SCHEMA=k0(),Xe.JSON_SCHEMA=F0(),Xe.CORE_SCHEMA=M0(),Xe.DEFAULT_SCHEMA=sd(),Xe.load=t.load,Xe.loadAll=t.loadAll,Xe.dump=e.dump,Xe.YAMLException=Si(),Xe.types={binary:T0(),float:N0(),map:D0(),null:R0(),pairs:x0(),set:Y0(),timestamp:U0(),bool:b0(),int:S0(),merge:L0(),omap:v0(),seq:w0(),str:y0()},Xe.safeLoad=A("safeLoad","load"),Xe.safeLoadAll=A("safeLoadAll","loadAll"),Xe.safeDump=A("safeDump","dump"),Xe}var FG=NG(),id=kG(FG),{Type:M$,Schema:U$,FAILSAFE_SCHEMA:L$,JSON_SCHEMA:T$,CORE_SCHEMA:v$,DEFAULT_SCHEMA:x$,load:Y$,loadAll:G$,dump:_$,YAMLException:J$,types:H$,safeLoad:q$,safeLoadAll:V$,safeDump:O$}=id;var tE=Ht(Wf(),1),AE=Ht(bR(),1);var SR={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://gp-foundry/schema/config.schema.json",title:"FoundryConfig",description:"Consumer-repo global config (foundry.config.yaml). Mirrors src/ir/types.ts FoundryConfig, extended with an optional `personas` map keyed by node/role for per-persona overrides.",type:"object",required:["name","identity","agent","repo","labels"],additionalProperties:!0,properties:{name:{type:"string",minLength:1,description:"Human-readable name of the harness/agent fleet."},identity:{type:"object",additionalProperties:!1,description:"How the agent authenticates and signs commits. Generalized: no hardcoded bot login or app-secret names.",properties:{app_id_secret:{type:"string",description:"Name of the Actions secret holding the GitHub App id."},app_key_secret:{type:"string",description:"Name of the Actions secret holding the GitHub App private key."},bot_login:{type:"string",description:'The bot login used for commits/PRs, e.g. "my-agent[bot]".'},git_name:{type:"string"},git_email:{type:"string",format:"email"}}},agent:{type:"object",required:["cli","model"],additionalProperties:!1,description:"The coding-agent CLI + default model.",properties:{cli:{type:"string",minLength:1,description:'The agent CLI binary, e.g. "claude".'},model:{type:"string",minLength:1,description:'Default model id, e.g. "claude-opus-4-8".'},oauth_token_secret:{type:"string",description:"Name of the Actions secret holding the agent OAuth token."},api_key_secret:{type:"string",description:"Name of the Actions secret holding an Anthropic API key. When set, agents authenticate with it INSTEAD of the OAuth token: usage-billed and not bound to one person's subscription seat."},allowed_tools:{$ref:"#/$defs/allowedTools",description:"Default allowed-tools list for the agent CLI."}}},repo:{type:"object",required:["base_branch","branch_prefix"],additionalProperties:!1,properties:{base_branch:{type:"string",minLength:1},branch_prefix:{type:"string",minLength:1},authors:{type:"array",minItems:1,items:{type:"string",minLength:1},description:"Only pull requests opened by these GitHub logins reach the PR lanes (pr-review, pr-fix, PR-context analysts, review panels, sweeps). Case-insensitive. A node's own authors= attribute overrides it for that lane."}}},rollout:{type:"object",additionalProperties:!1,description:"The rollout dial: which human PRs the pipeline looks at while it is brought to a repo gradually. Leave the block out and every PR is in scope. PRs the harness bot opened are always in scope; drafts and other bots' PRs never are (a bot is reviewed only if named in authors).",properties:{authors:{type:"array",items:{type:"string",minLength:1},description:"GitHub logins whose PRs are in scope. Case-insensitive."},opt_in_label:{type:"string",minLength:1,description:"A PR carrying this label is in scope, whoever opened it. A key of `labels`, or a literal label name."},skip_label:{type:"string",minLength:1,description:"A PR carrying this label is never in scope. A key of `labels`, or a literal label name."}}},labels:{type:"object",description:"semantic role -> repo label (the drift-killer).",additionalProperties:{type:"string"}},markers:{type:"object",description:"parseable markers shared by prompts + guards + enforcers.",additionalProperties:{type:"string"}},size:{type:"object",additionalProperties:!1,properties:{warn_additions:{type:"integer",minimum:0},hard_additions:{type:"integer",minimum:0},exclude_globs:{type:"array",items:{type:"string"}}}},runtime:{type:"object",additionalProperties:!1,properties:{mode:{type:"string",enum:["pinned","vendored"]},ref:{type:"string",description:"Pinned mode: the git ref the runtime actions are referenced at. Omit it and the compiler uses its own release tag (v<version>), so the workflows and the actions they call always come from the same release. Name an exact tag or a commit to hold them elsewhere. Do not use v1: that tag has not moved since 0.1.2."},owner_repo:{type:"string"},runs_on:{type:"string",minLength:1,description:"The runner label every generated job uses. Default ubuntu-latest. A node's runs_on= attribute overrides it for that node's jobs."}}},personas:{type:"object",description:"Per-node/per-role overrides, keyed by the node/persona key passed as the `node` input. Any field here shadows the top-level default when that persona is resolved.",additionalProperties:{$ref:"#/$defs/persona"}}},$defs:{allowedTools:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},persona:{type:"object",additionalProperties:!0,description:"Overrides for one persona/role. Every field is optional; unspecified fields fall back to the top-level config.",properties:{model:{type:"string",minLength:1},cli:{type:"string",minLength:1},allowed_tools:{$ref:"#/$defs/allowedTools"},labels:{type:"object",additionalProperties:{type:"string"}},identity:{type:"object",additionalProperties:!1,properties:{app_id_secret:{type:"string"},app_key_secret:{type:"string"},bot_login:{type:"string"},git_name:{type:"string"},git_email:{type:"string",format:"email"}}}}}}};var LO=tE.default.default??tE.default,TO=AE.default.default??AE.default,Kc=null;function vO(){if(Kc)return Kc;let t=new LO({allErrors:!0,allowUnionTypes:!0});return TO(t),Kc=t.compile(SR),Kc}function FR(t){return t==null?[]:(Array.isArray(t)?t:t.split(",")).map(A=>A.trim()).filter(A=>A.length>0)}function MR(t,e){let A=e!=null&&t.personas?t.personas[e]??{}:{};e!=null&&t.personas&&!(e in t.personas)&&zw(`config-loader: node "${e}" has no persona entry; using top-level defaults.`);let r={...t.identity,...A.identity??{}},n={...t.labels,...A.labels??{}},s=FR(A.allowed_tools??t.agent.allowed_tools);return{name:t.name,node:e,model:A.model??t.agent.model,cli:A.cli??t.agent.cli,allowedTools:s,labels:n,identity:r,oauthTokenSecret:t.agent.oauth_token_secret??null,repo:t.repo,markers:t.markers??{},size:t.size??null,runtime:t.runtime??null}}function UR(t){let e;try{e=(0,NR.readFileSync)(t,"utf8")}catch(n){throw new Error(`config-loader: could not read config at "${t}": ${n.message}`)}let A;try{A=id.load(e)}catch(n){throw new Error(`config-loader: failed to parse YAML at "${t}": ${n.message}`)}if(A==null||typeof A!="object"||Array.isArray(A))throw new Error(`config-loader: config at "${t}" must be a YAML mapping.`);let r=vO();if(!r(A)){let n=(r.errors??[]).map(s=>` - ${s.instancePath||"/"} ${s.message??"is invalid"}`).join(`
|
|
85
85
|
`);throw new Error(`config-loader: config at "${t}" failed schema validation:
|
|
86
86
|
${n}`)}return A}function LR(){let t=vh("config-path",{required:!0}),e=vh("node"),A=e.trim()===""?null:e.trim(),r=UR(t),n=MR(r,A);Ft("name",n.name),Ft("model",n.model),Ft("cli",n.cli),Ft("allowed-tools",n.allowedTools.join(",")),Ft("labels-json",JSON.stringify(n.labels)),Ft("bot-login",n.identity.bot_login??""),Ft("git-name",n.identity.git_name??""),Ft("git-email",n.identity.git_email??""),Ft("app-id-secret",n.identity.app_id_secret??""),Ft("app-key-secret",n.identity.app_key_secret??""),Ft("oauth-token-secret",n.oauthTokenSecret??""),Ft("json",JSON.stringify(n)),jw(`config-loader: resolved "${n.name}"`+(A?` (persona: ${A})`:"")+` \u2192 model=${n.model}, cli=${n.cli}, tools=[${n.allowedTools.join(", ")}]`)}var xO=process.env.GITHUB_ACTIONS==="true"||process.env.CONFIG_LOADER_RUN==="1";if(xO)try{LR()}catch(t){$w(t.message)}0&&(module.exports={loadConfig,normalizeTools,resolveConfig,run});
|
|
87
87
|
/*! Bundled license information:
|
|
@@ -41,6 +41,15 @@ disqualifying first:
|
|
|
41
41
|
requested reviewer or team, else `review-requested`.
|
|
42
42
|
8. **Open review threads** (opt-in, `requireNoOpenThreads: true`) — no open
|
|
43
43
|
thread, else `open-threads`. See [Open threads](#open-threads).
|
|
44
|
+
Between those two, opt-in: **standing change requests**
|
|
45
|
+
(`requireNoHumanChangesRequested: true`) — no person whose latest deciding
|
|
46
|
+
review is "changes requested", else `changes-requested`. Without it the latest
|
|
47
|
+
verdict wins, so the bot's later approval overrides a teammate's block.
|
|
48
|
+
|
|
49
|
+
An **escalation label** (`escalationLabels: [...]`) is checked first, right after
|
|
50
|
+
blocking labels and in both lanes: a PR carrying one is never merged (`escalated`),
|
|
51
|
+
and in evaluate mode its check is `action_required` whether or not the approver
|
|
52
|
+
has given a verdict.
|
|
44
53
|
9. **Hand-written additions** — additions of non-`excludeGlobs` files must be
|
|
45
54
|
`<= maxAdditions`, else apply `labels.needsHuman`.
|
|
46
55
|
10. **Protected paths** — no changed file may match `protectedPaths`, else apply
|
|
@@ -97,6 +106,45 @@ Logins compare case-insensitively and with or without the `[bot]` suffix
|
|
|
97
106
|
(GraphQL drops it). A failed thread read fails closed: the PR is not evaluated
|
|
98
107
|
that run.
|
|
99
108
|
|
|
109
|
+
## The single gate (`merge`)
|
|
110
|
+
|
|
111
|
+
`merge: off | agent-only` is one gate for a repo where people and agents both
|
|
112
|
+
open pull requests. Each tick, for every PR in scope:
|
|
113
|
+
|
|
114
|
+
1. the result is worked out against the policy;
|
|
115
|
+
2. it is published as the check `check-name` on the PR's head;
|
|
116
|
+
3. with `agent-only`, a PR the pipeline **wrote** — opened by `bot-login`, every
|
|
117
|
+
commit its own — is acted on: merged when ready, labelled per the policy when
|
|
118
|
+
not. One merge per run.
|
|
119
|
+
|
|
120
|
+
A human-written PR gets the check and nothing else: no merge, no label, no
|
|
121
|
+
comment. With `agent-only` the check's text says who merges the PR and, for a
|
|
122
|
+
PR that is not agent-written, why not.
|
|
123
|
+
|
|
124
|
+
Scope comes from the `rollout` input (the dial in `foundry.config.yaml`), not
|
|
125
|
+
from a branch prefix: a draft never, a PR with the skip label never, a PR
|
|
126
|
+
`bot-login` opened always, another bot only if named in `authors`, then a listed
|
|
127
|
+
author or the opt-in label. With no rollout, every remaining PR. The policy's
|
|
128
|
+
`branchPrefix` clause is not applied. If the policy enables the dependabot lane,
|
|
129
|
+
dependabot's PRs are judged and merged on that lane as before.
|
|
130
|
+
|
|
131
|
+
`check-app` names the app whose runs the gate adopts. Leave it empty when the
|
|
132
|
+
check is published with `GITHUB_TOKEN`; pass the harness App's slug when
|
|
133
|
+
`checks-token` is that App's token, so a check published by any other workflow
|
|
134
|
+
is never taken for the gate's.
|
|
135
|
+
|
|
136
|
+
Which app owns the check matters twice over. A `GITHUB_TOKEN` check belongs to
|
|
137
|
+
`github-actions`, so any workflow in the repo can publish one under the same
|
|
138
|
+
name — it cannot safely be a required check — and GitHub files it under whatever
|
|
139
|
+
Actions check suite is already on the commit, so it can show up beneath an
|
|
140
|
+
unrelated workflow's name. A check written with the harness's App token belongs
|
|
141
|
+
to that App alone. Anything that requires it downstream (another gate's
|
|
142
|
+
`required-checks`, a ruleset) should name it pinned to the App:
|
|
143
|
+
`<check name>@<app slug>`.
|
|
144
|
+
|
|
145
|
+
`mode` (below) is the older interface and is unchanged; `merge` and `mode`
|
|
146
|
+
cannot both be set.
|
|
147
|
+
|
|
100
148
|
## Evaluate mode
|
|
101
149
|
|
|
102
150
|
`mode: evaluate` never merges, labels or comments. It evaluates the policy for
|
|
@@ -109,8 +157,8 @@ every open, non-draft PR on a `branchPrefix` branch (narrowed by `authors`,
|
|
|
109
157
|
| --- | --- |
|
|
110
158
|
| `success` | the gate's decision is `merge` |
|
|
111
159
|
| `action_required` | the trusted reviewer's latest verdict on the head is an escalation (`**Verdict:** ESCALATE`, or `escalationBodyRegex`) |
|
|
112
|
-
| `neutral` | `noVerdictConclusion: neutral` and the
|
|
113
|
-
| `failure` | anything else; `output.summary` carries the gate's `code` and `reason` |
|
|
160
|
+
| `neutral` | `noVerdictConclusion: neutral` and the trusted approver has given no verdict (approve, reject or escalate) on the head yet ("Awaiting the approver"), whatever else fails; `output.summary` lists every other clause still failing (CI counts, unanswered threads, review requests, size, protected paths) |
|
|
161
|
+
| `failure` | anything else (a rejected head, an approved head with a clause failing, or any unverdicted head without `noVerdictConclusion: neutral`); `output.summary` carries the gate's first failing `code` and `reason` |
|
|
114
162
|
|
|
115
163
|
`output.text` lists the open threads, the checks not passing and the pending
|
|
116
164
|
review requests. The run is written with `checks-token` (GITHUB_TOKEN) and is
|
|
@@ -81,8 +81,35 @@ inputs:
|
|
|
81
81
|
`checks: write`, `pull-requests: read` and `contents: read` on the token.
|
|
82
82
|
required: false
|
|
83
83
|
default: "merge"
|
|
84
|
+
merge:
|
|
85
|
+
description: >
|
|
86
|
+
The single gate. "off": judge every PR in scope and publish the result as
|
|
87
|
+
a check on its head; never merge, label or comment. "agent-only": the
|
|
88
|
+
same, and also act on the PRs the pipeline wrote (opened by bot-login,
|
|
89
|
+
every commit its own) — merge when ready, apply the policy's labels when
|
|
90
|
+
not. A human-written PR only ever gets the check. Scope comes from
|
|
91
|
+
`rollout`, not from a branch prefix. Replaces `mode`; set one, not both.
|
|
92
|
+
required: false
|
|
93
|
+
default: ""
|
|
94
|
+
rollout:
|
|
95
|
+
description: >
|
|
96
|
+
With `merge`: the rollout dial as JSON ({"authors":[...],"optInLabel":"...",
|
|
97
|
+
"skipLabel":"..."}), written by the compiler from foundry.config.yaml.
|
|
98
|
+
Empty means every PR is in scope. Drafts and other bots' PRs never are;
|
|
99
|
+
PRs opened by bot-login always are.
|
|
100
|
+
required: false
|
|
101
|
+
default: ""
|
|
102
|
+
check-app:
|
|
103
|
+
description: >
|
|
104
|
+
With `merge`: the slug of the app whose check runs this gate adopts and
|
|
105
|
+
updates. Default "github-actions" (the gate publishes with GITHUB_TOKEN).
|
|
106
|
+
When `checks-token` is the harness's App token, pass that App's slug: the
|
|
107
|
+
check is then published by the App, and no other workflow's GITHUB_TOKEN
|
|
108
|
+
can publish one this gate — or a ruleset pinned to the App — accepts.
|
|
109
|
+
required: false
|
|
110
|
+
default: ""
|
|
84
111
|
check-name:
|
|
85
|
-
description: "
|
|
112
|
+
description: "With `merge`, or mode evaluate: the check run to publish on each head (required there)."
|
|
86
113
|
required: false
|
|
87
114
|
default: ""
|
|
88
115
|
authors:
|