@thegpvc/gp-foundry 0.1.1 → 0.1.2
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/README.md +40 -42
- package/dist/cli/index.cjs +32 -32
- package/package.json +1 -1
- package/roles/software/fixer.md +3 -3
- package/roles/software/reviewer.md +3 -3
- package/roles/software/supervisor.md +3 -3
- package/skill/reference/node-types.md +3 -1
package/README.md
CHANGED
|
@@ -2,36 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
**Stand up a "dark factory" for your repo: issues in → reviewed, auto-merged PRs out.**
|
|
4
4
|
|
|
5
|
-
`gp-foundry`
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
the executor** (native events, per-job least-privilege, Environment approvals, secrets,
|
|
9
|
-
|
|
10
|
-
**self-healing** (rebases conflicts, re-drives
|
|
11
|
-
truly stuck) and **self-improving** (mines its
|
|
12
|
-
|
|
13
|
-
that ships a library can ship docs
|
|
5
|
+
`gp-foundry` lets you **declare an autonomous agent pipeline as a directed graph and compile
|
|
6
|
+
it** into a repo. You describe the crew and the flow in one `harness.dot`; a deterministic
|
|
7
|
+
compiler emits plain GitHub Actions workflows. There's no orchestrator to run — **GitHub is
|
|
8
|
+
the executor** (native events, per-job least-privilege, Environment approvals, secrets, cron).
|
|
9
|
+
|
|
10
|
+
The pipeline keeps itself moving: it's **self-healing** (rebases conflicts, re-drives
|
|
11
|
+
stranded work, escalates to a human only when truly stuck) and **self-improving** (mines its
|
|
12
|
+
own merged PRs and reviews for recurring lessons, then feeds them back to every agent). And
|
|
13
|
+
it isn't code-specific — the same shape that ships a library can ship docs or marketing copy.
|
|
14
14
|
|
|
15
15
|
## Why this exists (and what it deliberately isn't)
|
|
16
16
|
|
|
17
|
-
Most agent-pipeline systems ship an **orchestrator
|
|
18
|
-
graph, holds state, and
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
and the compiler
|
|
25
|
-
anything runs.
|
|
26
|
-
|
|
27
|
-
The
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this isn't one.
|
|
17
|
+
Most agent-pipeline systems ship an **orchestrator** — a long-running engine that walks the
|
|
18
|
+
graph, holds state, and runs the agents. (StrongDM's Attractor is one well-articulated
|
|
19
|
+
example; gp-foundry borrows its DOT-graph representation.) That buys rich control flow and
|
|
20
|
+
fast hops, but it's a stateful service you have to deploy, secure, and trust.
|
|
21
|
+
|
|
22
|
+
gp-foundry takes the opposite bet: **compile the graph away and let GitHub run it.** No
|
|
23
|
+
server — state lives in labels, PRs, reviews, and cron. Every transition is an artifact your
|
|
24
|
+
team already knows how to read *and override*, and the compiler checks the topology (bounded
|
|
25
|
+
loops, livelock detection) before anything runs.
|
|
26
|
+
|
|
27
|
+
The cost is real: everything round-trips through GitHub-observable events. Hops take minutes,
|
|
28
|
+
not milliseconds; gates poll on cron; data between agents narrows to labels and comment
|
|
29
|
+
markers; and GitHub's event model has sharp edges the runtime works around rather than owns.
|
|
30
|
+
|
|
31
|
+
So gp-foundry aims at one altitude — **issue → PR → review → merge** — where hops are slow
|
|
32
|
+
anyway and auditability matters more than latency, and it covers that without running any
|
|
33
|
+
infrastructure of its own. Need tight multi-agent choreography, dynamic subgraphs, or
|
|
34
|
+
streaming state between nodes? Run an orchestrator — this isn't one.
|
|
35
35
|
|
|
36
36
|
## Zero-install: point your coding agent at this
|
|
37
37
|
|
|
@@ -41,9 +41,9 @@ The fastest path — don't install anything yourself. Paste this into your codin
|
|
|
41
41
|
> Fetch https://unpkg.com/@thegpvc/gp-foundry/AGENTS.md and follow it to set up an
|
|
42
42
|
> autonomous delivery pipeline in this repository.
|
|
43
43
|
|
|
44
|
-
[`AGENTS.md`](./AGENTS.md) walks the agent through the
|
|
45
|
-
install
|
|
46
|
-
|
|
44
|
+
[`AGENTS.md`](./AGENTS.md) walks the agent through the bring-up via `npx` — no global
|
|
45
|
+
install: scaffold, adapt the toolchain/scope/roles with you, run `up`, then hand off the two
|
|
46
|
+
secrets only a human can set. Claude Code agents get steered to the richer
|
|
47
47
|
[Socratic skill](#or-set-it-up-conversationally-the-claude-skill) instead.
|
|
48
48
|
|
|
49
49
|
## Dark factory in 6 commands
|
|
@@ -102,10 +102,10 @@ takes an issue from triage to merge, plus the lanes that keep the factory health
|
|
|
102
102
|
| 🕵️ | scout | Triage an incoming issue; label it for a lane (`build` / `plan`). |
|
|
103
103
|
| 📋 | planner | For big/ambiguous issues, post a plan before any code is written (read-only). |
|
|
104
104
|
| 👷 | builder | Turn a labeled issue into a small, tested, shippable PR (the only code-writer). |
|
|
105
|
-
|
|
|
106
|
-
|
|
|
105
|
+
| ⚖️ | reviewer | Read the diff, run gates, post an approve / request-changes verdict. |
|
|
106
|
+
| 🔧 | fixer | Apply review feedback in a bounded retry loop with the reviewer. |
|
|
107
107
|
| 🧹 | janitor | Scheduled sweep: rebase PRs the gate flagged `needs-rebase` so they can merge. |
|
|
108
|
-
|
|
|
108
|
+
| 🧭 | supervisor | Scheduled sweep: re-drive stranded issues/PRs; escalate to `needs-human` after 2 nudges. |
|
|
109
109
|
| ♻️ | retro | Scheduled: mine merged PRs/reviews/CI for recurring lessons; write them to team memory. |
|
|
110
110
|
| 🔀 | merge_gate | **Policy gate, not a persona** — enforces merge policy (approval, CI green, size, protected paths); auto-merges or labels `needs-rebase`/`needs-human`. |
|
|
111
111
|
|
|
@@ -169,15 +169,15 @@ unbounded loops at build time. Full vocabulary in
|
|
|
169
169
|
|
|
170
170
|
## Self-healing & self-improving
|
|
171
171
|
|
|
172
|
-
**Self-healing** —
|
|
172
|
+
**Self-healing** — stuck work gets re-driven or escalated, not left silently stranded:
|
|
173
173
|
- 🧹 **janitor** runs on a schedule and rebases every PR the merge gate flagged
|
|
174
174
|
`needs-rebase`, so conflicts don't strand mergeable work.
|
|
175
|
-
-
|
|
175
|
+
- 🧭 **supervisor** runs on a schedule, re-drives stranded issues and PRs (no PR for a
|
|
176
176
|
`build`-labeled issue, idle PRs), and escalates to `needs-human` after 2 nudges.
|
|
177
177
|
- The **merge gate** posts a 🔀 audit comment explaining each decision and labels
|
|
178
178
|
`needs-rebase` on conflicts rather than merging a broken state.
|
|
179
179
|
- Agent **failures are visibly red** — no green no-ops. A failing job fails the run.
|
|
180
|
-
- The
|
|
180
|
+
- The 🔧 **fixer** has a real attempt budget: it stamps a marker comment each attempt and,
|
|
181
181
|
at `max_attempts`, labels the PR `needs-human` and stops instead of looping forever.
|
|
182
182
|
|
|
183
183
|
**Self-improving** — the factory learns from its own record:
|
|
@@ -198,11 +198,9 @@ unbounded loops at build time. Full vocabulary in
|
|
|
198
198
|
human-gate as mandatory for anything irreversible. The reviewer is also an LLM — the
|
|
199
199
|
gate's policy (CI green, size caps, protected paths) is the non-negotiable backstop.
|
|
200
200
|
- **Limits** — `parallel`/`fan_in` support **clean diamonds only** (one fan-out event, ≥2
|
|
201
|
-
agent lanes, one join)
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
Cross-workflow races (e.g. janitor and fixer pushing together) resolve by retry, not
|
|
205
|
-
transactions — the supervisor sweep is the safety net.
|
|
201
|
+
agent lanes, one join); staggered/non-diamond joins are a v2 concern. Merges are serialized
|
|
202
|
+
one per gate sweep. Cross-workflow races (e.g. janitor and fixer pushing at once) resolve by
|
|
203
|
+
retry, not transactions — the supervisor sweep is the safety net.
|
|
206
204
|
|
|
207
205
|
## Day-2 operations
|
|
208
206
|
|
|
@@ -242,7 +240,7 @@ spec change and the regenerated workflows together so `build --check` stays gree
|
|
|
242
240
|
| `roles/` | generic role packs (`software/`, `content/`, `docs/`) — the job descriptions |
|
|
243
241
|
| `skill/` | the packaged Claude skill: `SKILL.md`, `reference/`, and the scaffolding `templates/` |
|
|
244
242
|
| `schema/` | JSON Schema for `foundry.config.yaml` |
|
|
245
|
-
| `examples/` |
|
|
243
|
+
| `examples/` | a complete reference harness — [`examples/starter/`](./examples/starter/), exactly what `init` scaffolds |
|
|
246
244
|
| `docs/` | design docs (`docs/plans/`) |
|
|
247
245
|
|
|
248
246
|
## Docs
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";var rr=Object.create;var Ht=Object.defineProperty;var or=Object.getOwnPropertyDescriptor;var sr=Object.getOwnPropertyNames;var lr=Object.getPrototypeOf,ar=Object.prototype.hasOwnProperty;var cr=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(i){throw t=[i],i}};var Ae=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var ur=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of sr(e))!ar.call(r,o)&&o!==t&&Ht(r,o,{get:()=>e[o],enumerable:!(i=or(e,o))||i.enumerable});return r};var yn=(r,e,t)=>(t=r!=null?rr(lr(r)):{},ur(e||!r||!r.__esModule?Ht(t,"default",{value:r,enumerable:!0}):t,r));var fr,V,I=cr(()=>{"use strict";fr=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"?document.currentScript.src:new URL("main.js",document.baseURI).href,V=fr()});var Ke=Ae(qn=>{"use strict";I();var wn=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Dn=class extends wn{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};qn.CommanderError=wn;qn.InvalidArgumentError=Dn});var _n=Ae(Un=>{"use strict";I();var{InvalidArgumentError:dr}=Ke(),Bn=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new dr(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function pr(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}Un.Argument=Bn;Un.humanReadableArgName=pr});var Wn=Ae(It=>{"use strict";I();var{humanReadableArgName:hr}=_n(),Vn=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(o=>!o._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((o,s)=>o.name().localeCompare(s.name())),t}compareOptions(e,t){let i=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(o=>!o.hidden),i=e._getHelpOption();if(i&&!i.hidden){let o=i.short&&e._findOption(i.short),s=i.long&&e._findOption(i.long);!o&&!s?t.push(i):i.long&&!s?t.push(e.createOption(i.long,i.description)):i.short&&!o&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let o=i.options.filter(s=>!s.hidden);t.push(...o)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>hr(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,o)=>Math.max(i,t.subcommandTerm(o).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,o)=>Math.max(i,t.optionTerm(o).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,o)=>Math.max(i,t.optionTerm(o).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,o)=>Math.max(i,t.argumentTerm(o).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let o=e.parent;o;o=o.parent)i=o.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),o=t.helpWidth||80,s=2,a=2;function f($,
|
|
3
|
-
`).replace(/^/gm," ".repeat(s))}let c=[`Usage: ${t.commandUsage(e)}`,""],d=t.commandDescription(e);d.length>0&&(c=c.concat([t.wrap(d,o,0),""]));let m=t.visibleArguments(e).map($=>f(t.argumentTerm($),t.argumentDescription($)));m.length>0&&(c=c.concat(["Arguments:",u(m),""]));let g=t.visibleOptions(e).map($=>f(t.optionTerm($),t.optionDescription($)));if(g.length>0&&(c=c.concat(["Options:",u(g),""])),this.showGlobalOptions){let $=t.visibleGlobalOptions(e).map(
|
|
2
|
+
"use strict";var rr=Object.create;var Ht=Object.defineProperty;var or=Object.getOwnPropertyDescriptor;var sr=Object.getOwnPropertyNames;var lr=Object.getPrototypeOf,ar=Object.prototype.hasOwnProperty;var cr=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(i){throw t=[i],i}};var Ae=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}};var ur=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of sr(e))!ar.call(r,o)&&o!==t&&Ht(r,o,{get:()=>e[o],enumerable:!(i=or(e,o))||i.enumerable});return r};var yn=(r,e,t)=>(t=r!=null?rr(lr(r)):{},ur(e||!r||!r.__esModule?Ht(t,"default",{value:r,enumerable:!0}):t,r));var fr,V,I=cr(()=>{"use strict";fr=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"?document.currentScript.src:new URL("main.js",document.baseURI).href,V=fr()});var Ke=Ae(qn=>{"use strict";I();var wn=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},Dn=class extends wn{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};qn.CommanderError=wn;qn.InvalidArgumentError=Dn});var _n=Ae(Un=>{"use strict";I();var{InvalidArgumentError:dr}=Ke(),Bn=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new dr(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function pr(r){let e=r.name()+(r.variadic===!0?"...":"");return r.required?"<"+e+">":"["+e+"]"}Un.Argument=Bn;Un.humanReadableArgName=pr});var Wn=Ae(It=>{"use strict";I();var{humanReadableArgName:hr}=_n(),Vn=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(o=>!o._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((o,s)=>o.name().localeCompare(s.name())),t}compareOptions(e,t){let i=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(o=>!o.hidden),i=e._getHelpOption();if(i&&!i.hidden){let o=i.short&&e._findOption(i.short),s=i.long&&e._findOption(i.long);!o&&!s?t.push(i):i.long&&!s?t.push(e.createOption(i.long,i.description)):i.short&&!o&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let o=i.options.filter(s=>!s.hidden);t.push(...o)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>hr(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,o)=>Math.max(i,t.subcommandTerm(o).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,o)=>Math.max(i,t.optionTerm(o).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,o)=>Math.max(i,t.optionTerm(o).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,o)=>Math.max(i,t.argumentTerm(o).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let o=e.parent;o;o=o.parent)i=o.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),o=t.helpWidth||80,s=2,a=2;function f($,v){if(v){let O=`${$.padEnd(i+a)}${v}`;return t.wrap(O,o-s,i+a)}return $}function u($){return $.join(`
|
|
3
|
+
`).replace(/^/gm," ".repeat(s))}let c=[`Usage: ${t.commandUsage(e)}`,""],d=t.commandDescription(e);d.length>0&&(c=c.concat([t.wrap(d,o,0),""]));let m=t.visibleArguments(e).map($=>f(t.argumentTerm($),t.argumentDescription($)));m.length>0&&(c=c.concat(["Arguments:",u(m),""]));let g=t.visibleOptions(e).map($=>f(t.optionTerm($),t.optionDescription($)));if(g.length>0&&(c=c.concat(["Options:",u(g),""])),this.showGlobalOptions){let $=t.visibleGlobalOptions(e).map(v=>f(t.optionTerm(v),t.optionDescription(v)));$.length>0&&(c=c.concat(["Global Options:",u($),""]))}let x=t.visibleCommands(e).map($=>f(t.subcommandTerm($),t.subcommandDescription($)));return x.length>0&&(c=c.concat(["Commands:",u(x),""])),c.join(`
|
|
4
4
|
`)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,i,o=40){let s=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",a=new RegExp(`[\\n][${s}]+`);if(e.match(a))return e;let f=t-i;if(f<o)return e;let u=e.slice(0,i),c=e.slice(i).replace(`\r
|
|
5
5
|
`,`
|
|
6
6
|
`),d=" ".repeat(i),g="\\s\u200B",x=new RegExp(`
|
|
7
|
-
|.{1,${f-1}}([${g}]|$)|[^${g}]+?([${g}]|$)`,"g"),$=c.match(x)||[];return u+$.map((
|
|
8
|
-
`?"":(O>0?d:"")+
|
|
9
|
-
`)}};It.Help=Vn});var Jn=Ae(Kn=>{"use strict";I();var{InvalidArgumentError:mr}=Ke(),Gn=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let i=br(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new mr(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return gr(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Yn=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let o=this.negativeOptions.get(i).presetArg,s=o!==void 0?o:!1;return t.negate===(s===e)}};function gr(r){return r.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function br(r){let e,t,i=r.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(e=i.shift()),t=i.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}Kn.Option=Gn;Kn.DualOptions=Yn});var
|
|
7
|
+
|.{1,${f-1}}([${g}]|$)|[^${g}]+?([${g}]|$)`,"g"),$=c.match(x)||[];return u+$.map((v,O)=>v===`
|
|
8
|
+
`?"":(O>0?d:"")+v.trimEnd()).join(`
|
|
9
|
+
`)}};It.Help=Vn});var Jn=Ae(Kn=>{"use strict";I();var{InvalidArgumentError:mr}=Ke(),Gn=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let i=br(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new mr(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return gr(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Yn=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let o=this.negativeOptions.get(i).presetArg,s=o!==void 0?o:!1;return t.negate===(s===e)}};function gr(r){return r.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function br(r){let e,t,i=r.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(e=i.shift()),t=i.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}Kn.Option=Gn;Kn.DualOptions=Yn});var jt=Ae(Ft=>{"use strict";I();function yr(r,e){if(Math.abs(r.length-e.length)>3)return Math.max(r.length,e.length);let t=[];for(let i=0;i<=r.length;i++)t[i]=[i];for(let i=0;i<=e.length;i++)t[0][i]=i;for(let i=1;i<=e.length;i++)for(let o=1;o<=r.length;o++){let s=1;r[o-1]===e[i-1]?s=0:s=1,t[o][i]=Math.min(t[o-1][i]+1,t[o][i-1]+1,t[o-1][i-1]+s),o>1&&i>1&&r[o-1]===e[i-2]&&r[o-2]===e[i-1]&&(t[o][i]=Math.min(t[o][i],t[o-2][i-2]+1))}return t[r.length][e.length]}function wr(r,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=r.startsWith("--");t&&(r=r.slice(2),e=e.map(a=>a.slice(2)));let i=[],o=3,s=.4;return e.forEach(a=>{if(a.length<=1)return;let f=yr(r,a),u=Math.max(r.length,a.length);(u-f)/u>s&&(f<o?(o=f,i=[a]):f===o&&i.push(a))}),i.sort((a,f)=>a.localeCompare(f)),t&&(i=i.map(a=>`--${a}`)),i.length>1?`
|
|
10
10
|
(Did you mean one of ${i.join(", ")}?)`:i.length===1?`
|
|
11
|
-
(Did you mean ${i[0]}?)`:""}Ft.suggestSimilar=wr});var qt=Ae(Dt=>{"use strict";I();var _r=require("events").EventEmitter,zn=require("child_process"),me=require("path"),Xn=require("fs"),X=require("process"),{Argument:Ar,humanReadableArgName:xr}=_n(),{CommanderError:Qn}=Ke(),{Help:Cr}=Wn(),{Option:
|
|
11
|
+
(Did you mean ${i[0]}?)`:""}Ft.suggestSimilar=wr});var qt=Ae(Dt=>{"use strict";I();var _r=require("events").EventEmitter,zn=require("child_process"),me=require("path"),Xn=require("fs"),X=require("process"),{Argument:Ar,humanReadableArgName:xr}=_n(),{CommanderError:Qn}=Ke(),{Help:Cr}=Wn(),{Option:Mt,DualOptions:kr}=Jn(),{suggestSimilar:Lt}=jt(),Zn=class r extends _r{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>X.stdout.write(t),writeErr:t=>X.stderr.write(t),getOutHelpWidth:()=>X.stdout.isTTY?X.stdout.columns:void 0,getErrHelpWidth:()=>X.stderr.isTTY?X.stderr.columns:void 0,outputError:(t,i)=>i(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,i){let o=t,s=i;typeof o=="object"&&o!==null&&(s=o,o=null),s=s||{};let[,a,f]=e.match(/([^ ]+) *(.*)/),u=this.createCommand(a);return o&&(u.description(o),u._executableHandler=!0),s.isDefault&&(this._defaultCommandName=u._name),u._hidden=!!(s.noHelp||s.hidden),u._executableFile=s.executableFile||null,f&&u.arguments(f),this._registerCommand(u),u.parent=this,u.copyInheritedSettings(this),o?this:u}createCommand(e){return new r(e)}createHelp(){return Object.assign(new Cr,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
12
12
|
- specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new Ar(e,t)}argument(e,t,i,o){let s=this.createArgument(e,t);return typeof i=="function"?s.default(o).argParser(i):s.default(i),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,i,o]=e.match(/([^ ]+) *(.*)/),s=t??"display help for command",a=this.createCommand(i);return a.helpOption(!1),o&&a.arguments(o),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
|
|
13
|
-
Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new Qn(e,t,i)),X.exit(e)}action(e){let t=i=>{let o=this.registeredArguments.length,s=i.slice(0,o);return this._storeOptionsAsProperties?s[o]=this:s[o]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new
|
|
14
|
-
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=o=>[o.name()].concat(o.aliases()),i=t(e).find(o=>this._findCommand(o));if(i){let o=t(this._findCommand(i)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${o}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let o=(s,a,f)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let u=this.getOptionValue(i);s!==null&&e.parseArg?s=this._callParseArg(e,s,u,a):s!==null&&e.variadic&&(s=e._concatValue(s,u)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,f)};return this.on("option:"+t,s=>{let a=`error: option '${e.flags}' argument '${s}' is invalid.`;o(s,a,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let a=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;o(s,a,"env")}),this}_optionEx(e,t,i,o,s){if(typeof t=="object"&&t instanceof
|
|
13
|
+
Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new Qn(e,t,i)),X.exit(e)}action(e){let t=i=>{let o=this.registeredArguments.length,s=i.slice(0,o);return this._storeOptionsAsProperties?s[o]=this:s[o]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new Mt(e,t)}_callParseArg(e,t,i,o){try{return e.parseArg(t,i)}catch(s){if(s.code==="commander.invalidArgument"){let a=`${o} ${s.message}`;this.error(a,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let i=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
|
|
14
|
+
- already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=o=>[o.name()].concat(o.aliases()),i=t(e).find(o=>this._findCommand(o));if(i){let o=t(this._findCommand(i)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${o}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let o=(s,a,f)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let u=this.getOptionValue(i);s!==null&&e.parseArg?s=this._callParseArg(e,s,u,a):s!==null&&e.variadic&&(s=e._concatValue(s,u)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,f)};return this.on("option:"+t,s=>{let a=`error: option '${e.flags}' argument '${s}' is invalid.`;o(s,a,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let a=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;o(s,a,"env")}),this}_optionEx(e,t,i,o,s){if(typeof t=="object"&&t instanceof Mt)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let a=this.createOption(t,i);if(a.makeOptionMandatory(!!e.mandatory),typeof o=="function")a.default(s).argParser(o);else if(o instanceof RegExp){let f=o;o=(u,c)=>{let d=f.exec(u);return d?d[0]:c},a.default(s).argParser(o)}else a.default(o);return this.addOption(a)}option(e,t,i,o){return this._optionEx({},e,t,i,o)}requiredOption(e,t,i,o){return this._optionEx({mandatory:!0},e,t,i,o)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(e)!==void 0&&(t=i.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){X.versions?.electron&&(t.from="electron");let o=X.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(t.from="eval")}e===void 0&&(e=X.argv),this.rawArgs=e.slice();let i;switch(t.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":X.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;case"eval":i=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(e,t){let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_executeSubCommand(e,t){t=t.slice();let i=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function s(d,m){let g=me.resolve(d,m);if(Xn.existsSync(g))return g;if(o.includes(me.extname(m)))return;let x=o.find($=>Xn.existsSync(`${g}${$}`));if(x)return`${g}${x}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let a=e._executableFile||`${this._name}-${e._name}`,f=this._executableDir||"";if(this._scriptPath){let d;try{d=Xn.realpathSync(this._scriptPath)}catch{d=this._scriptPath}f=me.resolve(me.dirname(d),f)}if(f){let d=s(f,a);if(!d&&!e._executableFile&&this._scriptPath){let m=me.basename(this._scriptPath,me.extname(this._scriptPath));m!==this._name&&(d=s(f,`${m}-${e._name}`))}a=d||a}i=o.includes(me.extname(a));let u;X.platform!=="win32"?i?(t.unshift(a),t=Pt(X.execArgv).concat(t),u=zn.spawn(X.argv[0],t,{stdio:"inherit"})):u=zn.spawn(a,t,{stdio:"inherit"}):(t.unshift(a),t=Pt(X.execArgv).concat(t),u=zn.spawn(X.execPath,t,{stdio:"inherit"})),u.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(m=>{X.on(m,()=>{u.killed===!1&&u.exitCode===null&&u.kill(m)})});let c=this._exitCallback;u.on("close",d=>{d=d??1,c?c(new Qn(d,"commander.executeSubCommandAsync","(close)")):X.exit(d)}),u.on("error",d=>{if(d.code==="ENOENT"){let m=f?`searched for local subcommand relative to directory '${f}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",g=`'${a}' does not exist
|
|
15
15
|
- if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
16
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
17
|
- ${m}`;throw new Error(g)}else if(d.code==="EACCES")throw new Error(`'${a}' not executable`);if(!c)X.exit(1);else{let m=new Qn(1,"commander.executeSubCommandAsync","(error)");m.nestedError=d,c(m)}}),this.runningCommand=u}_dispatchSubcommand(e,t,i){let o=this._findCommand(e);o||this.help({error:!0});let s;return s=this._chainOrCallSubCommandHook(s,o,"preSubcommand"),s=this._chainOrCall(s,()=>{if(o._executableHandler)this._executeSubCommand(o,t.concat(i));else return o._parseCommand(t,i)}),s}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(i,o,s)=>{let a=o;if(o!==null&&i.parseArg){let f=`error: command-argument value '${o}' is invalid for argument '${i.name()}'.`;a=this._callParseArg(i,o,s,f)}return a};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,o)=>{let s=i.defaultValue;i.variadic?o<this.args.length?(s=this.args.slice(o),i.parseArg&&(s=s.reduce((a,f)=>e(i,f,a),i.defaultValue))):s===void 0&&(s=[]):o<this.args.length&&(s=this.args[o],i.parseArg&&(s=e(i,s,i.defaultValue))),t[o]=s}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,o=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(a=>{o.push({hookedCommand:s,callback:a})})}),t==="postAction"&&o.reverse(),o.forEach(s=>{i=this._chainOrCall(i,()=>s.callback(s.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let o=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(s=>{o=this._chainOrCall(o,()=>s(this,t))}),o}_parseCommand(e,t){let i=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(i.operands),t=i.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let a;return a=this._chainOrCallHooks(a,"preAction"),a=this._chainOrCall(a,()=>this._actionHandler(this.processedArgs)),this.parent&&(a=this._chainOrCall(a,()=>{this.parent.emit(s,e,t)})),a=this._chainOrCallHooks(a,"postAction"),a}if(this.parent&&this.parent.listenerCount(s))o(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(i=>{let o=i.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let o=e.find(s=>i.conflictsWith.includes(s.attributeName()));o&&this._conflictingOption(i,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],o=t,s=e.slice();function a(u){return u.length>1&&u[0]==="-"}let f=null;for(;s.length;){let u=s.shift();if(u==="--"){o===i&&o.push(u),o.push(...s);break}if(f&&!a(u)){this.emit(`option:${f.name()}`,u);continue}if(f=null,a(u)){let c=this._findOption(u);if(c){if(c.required){let d=s.shift();d===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,d)}else if(c.optional){let d=null;s.length>0&&!a(s[0])&&(d=s.shift()),this.emit(`option:${c.name()}`,d)}else this.emit(`option:${c.name()}`);f=c.variadic?c:null;continue}}if(u.length>2&&u[0]==="-"&&u[1]!=="-"){let c=this._findOption(`-${u[1]}`);if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${c.name()}`,u.slice(2)):(this.emit(`option:${c.name()}`),s.unshift(`-${u.slice(2)}`));continue}}if(/^--[^=]+=/.test(u)){let c=u.indexOf("="),d=this._findOption(u.slice(0,c));if(d&&(d.required||d.optional)){this.emit(`option:${d.name()}`,u.slice(c+1));continue}}if(a(u)&&(o=i),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&i.length===0){if(this._findCommand(u)){t.push(u),s.length>0&&i.push(...s);break}else if(this._getHelpCommand()&&u===this._getHelpCommand().name()){t.push(u),s.length>0&&t.push(...s);break}else if(this._defaultCommandName){i.push(u),s.length>0&&i.push(...s);break}}if(this._passThroughOptions){o.push(u),s.length>0&&o.push(...s);break}o.push(u)}return{operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;i<t;i++){let o=this.options[i].attributeName();e[o]=o===this._versionOptionName?this._version:this[o]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
|
|
@@ -20,47 +20,47 @@ Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
20
20
|
`),this.outputHelp({error:!0}));let i=t||{},o=i.exitCode||1,s=i.code||"commander.error";this._exit(o,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in X.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,X.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new kr(this.options),t=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(o=>!t(o)).forEach(o=>{this.setOptionValueWithSource(o,i.implied[o],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let i=a=>{let f=a.attributeName(),u=this.getOptionValue(f),c=this.options.find(m=>m.negate&&f===m.attributeName()),d=this.options.find(m=>!m.negate&&f===m.attributeName());return c&&(c.presetArg===void 0&&u===!1||c.presetArg!==void 0&&u===c.presetArg)?c:d||a},o=a=>{let f=i(a),u=f.attributeName();return this.getOptionValueSource(u)==="env"?`environment variable '${f.envVar}'`:`option '${f.flags}'`},s=`error: ${o(e)} cannot be used with ${o(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let o=[],s=this;do{let a=s.createHelp().visibleOptions(s).filter(f=>f.long).map(f=>f.long);o=o.concat(a),s=s.parent}while(s&&!s._enablePositionalOptions);t=Lt(e,o)}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(s=>{o.push(s.name()),s.alias()&&o.push(s.alias())}),t=Lt(e,o)}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"})}version(e,t,i){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let o=this.createOption(t,i);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
21
21
|
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(e);if(i){let o=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${o}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(i=>xr(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=me.basename(e,me.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},i;return t.error?i=o=>this._outputConfiguration.writeErr(o):i=o=>this._outputConfiguration.writeOut(o),t.write=e.write||i,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let o=this.helpInformation(i);if(t&&(o=t(o),typeof o!="string"&&!Buffer.isBuffer(o)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(o),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=X.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
22
22
|
Expecting one of '${i.join("', '")}'`);let o=`${e}Help`;return this.on(o,s=>{let a;typeof t=="function"?a=t({error:s.error,command:s.command}):a=t,a&&s.write(`${a}
|
|
23
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(o=>t.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Pt(r){return r.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",o="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?o=s[3]:i=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],i=s[3],o=s[4]),t&&o!=="0"?`${t}=${i}:${parseInt(o)+1}`:e})}Dt.Command=Zn});var Wt=Ae(se=>{"use strict";I();var{Argument:Bt}=_n(),{Command:et}=qt(),{CommanderError:Sr,InvalidArgumentError:Ut}=Ke(),{Help:Er}=Wn(),{Option:Vt}=Jn();se.program=new et;se.createCommand=r=>new et(r);se.createOption=(r,e)=>new Vt(r,e);se.createArgument=(r,e)=>new Bt(r,e);se.Command=et;se.Option=Vt;se.Argument=Bt;se.Help=Er;se.CommanderError=Sr;se.InvalidArgumentError=Ut;se.InvalidOptionArgumentError=Ut});var Cn=Ae((qo,nt)=>{"use strict";I();var xn=process||{},Kt=xn.argv||[],An=xn.env||{},vr=!(An.NO_COLOR||Kt.includes("--no-color"))&&(!!An.FORCE_COLOR||Kt.includes("--color")||xn.platform==="win32"||(xn.stdout||{}).isTTY&&An.TERM!=="dumb"||!!An.CI),Or=(r,e,t=r)=>i=>{let o=""+i,s=o.indexOf(e,r.length);return~s?r+$r(o,e,t,s)+e:r+o+e},$r=(r,e,t,i)=>{let o="",s=0;do o+=r.substring(s,i)+t,s=i+e.length,i=r.indexOf(e,s);while(~i);return o+r.substring(s)},Jt=(r=vr)=>{let e=r?Or:()=>String;return{isColorSupported:r,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};nt.exports=Jt();nt.exports.createColors=Jt});I();I();var Gt=yn(Wt(),1),{program:$o,createCommand:To,createArgument:Ro,createOption:No,CommanderError:Ho,InvalidArgumentError:Io,InvalidOptionArgumentError:Fo,Command:Yt,Argument:Mo,Option:jo,Help:Lo}=Gt.default;var Q=yn(Cn(),1),ir=require("child_process"),Y=require("fs"),ee=require("path");I();I();I();var kn=["analyst","issue-agent","producer","pr-review","pr-fix","scheduled-agent"];function zt(r){return r.uses!==void 0}I();function Je(r){let e=r.auth;return e?.mode?{mode:e.mode,appIdSecret:e.app_id_secret??r.identity.app_id_secret,appKeySecret:e.app_key_secret??r.identity.app_key_secret,tokenSecret:e.token_secret}:r.identity.app_id_secret&&r.identity.app_key_secret?{mode:"app",appIdSecret:r.identity.app_id_secret,appKeySecret:r.identity.app_key_secret}:{mode:"github-token"}}I();var Tr=new Set(kn);function Fe(r){let e=new Map(r.nodes.map(a=>[a.id,a])),t=new Map,i=new Map;for(let a of r.nodes)t.set(a.id,[]),i.set(a.id,[]);for(let a of r.edges)t.get(a.to)?.push(a),i.get(a.from)?.push(a);let o=new Map,s=new Set;for(let a of r.nodes){if(a.type!=="fan_in")continue;let f=t.get(a.id)??[];if(f.length<2)continue;let u=[],c,d=!0;for(let $ of f){let E=e.get($.from);if(!E||!Tr.has(E.type)){d=!1;break}let O=t.get(E.id)??[],F=i.get(E.id)??[];if(O.length!==1||F.length!==1||F[0].to!==a.id){d=!1;break}let j=e.get(O[0].from);if(!j||j.type!=="parallel"){d=!1;break}if(O[0].on||O[0].when){d=!1;break}if(c===void 0)c=j.id;else if(c!==j.id){d=!1;break}u.push(E.id)}if(!d||c===void 0)continue;let m=t.get(c)??[],g=i.get(c)??[];if(m.length!==1||!m[0].on)continue;let x=new Set(u);if(!(!g.every($=>x.has($.to))||g.length!==u.length)){o.set(a.id,{parallelId:c,entryEdge:m[0],legIds:u,faninId:a.id}),s.add(c);for(let $ of u)s.add($)}}return{byFanin:o,memberIds:s}}var tt=new Set(kn);function ze(r,e={}){let t=[],i=new Map(r.nodes.map(a=>[a.id,a]));for(let a of r.nodes)a.declared||t.push({level:"error",code:"node.undeclared",message:`node '${a.id}' is referenced in an edge but never declared`,where:{node:a.id,line:a.line},hint:`add a node statement, e.g. ${a.id} [type=...]`});for(let a of r.nodes)tt.has(a.type)&&!a.files.role&&t.push({level:"error",code:"node.missing-role",message:`agent node '${a.id}' (type ${a.type}) needs a role="..." job description`,where:{node:a.id,line:a.line}}),a.type==="human-gate"&&a.attrs.environment===void 0&&t.push({level:"error",code:"node.human-gate-no-environment",message:`human-gate '${a.id}' must set environment=<name> (maps to a protected GitHub Environment)`,where:{node:a.id,line:a.line}}),a.type==="merge-gate"&&!a.files.policy&&t.push({level:"warning",code:"node.merge-gate-no-policy",message:`merge-gate '${a.id}' has no policy="..."; default merge policy will be used`,where:{node:a.id,line:a.line}});if(e.fileExists)for(let a of r.nodes)for(let f of["role","policy","prompt","tools"]){let u=a.files[f];u&&!e.fileExists(u)&&t.push({level:"error",code:"file.missing",message:`node '${a.id}' references ${f}="${u}" which does not exist`,where:{node:a.id,line:a.line,file:u}})}if(e.roles){let a=new Map;for(let u of r.nodes)a.set(u.id,[]);for(let u of r.edges){let c=i.get(u.to);c&&a.get(u.from)?.push(c)}let f=u=>(e.roles?.get(u.id)?.role??u.id).toLowerCase();for(let u of r.nodes){let c=e.roles.get(u.id);if(!c?.handoffs)continue;let d=a.get(u.id)??[],m=new Set(d.flatMap(x=>[x.id.toLowerCase(),f(x)])),g=new Set(c.handoffs.map(x=>String(x.to).toLowerCase()));for(let x of c.handoffs)m.has(String(x.to).toLowerCase())||t.push({level:"warning",code:"role.handoff-no-edge",message:`role '${c.role}' (node '${u.id}') declares a handoff to '${x.to}' but there is no matching out-edge`,where:{node:u.id},hint:"add the edge, or remove the handoff so the job description matches the graph"});for(let x of d)x.type!=="exit"&&!g.has(x.id.toLowerCase())&&!g.has(f(x))&&t.push({level:"warning",code:"role.edge-no-handoff",message:`node '${u.id}' has an out-edge to '${x.id}' not declared as a handoff in role '${c.role}'`,where:{node:u.id,edge:[u.id,x.id]},hint:"document the handoff in the role, or remove the edge"})}}let o=(a,f)=>{if(typeof a=="string"){let u=a.match(/<[A-Za-z][^<>]{0,80}>/);u&&t.push({level:"error",code:"config.placeholder",message:`config value ${f} still contains the placeholder ${u[0]} \u2014 fill it in foundry.config.yaml`,hint:"generated workflows would be broken until every <placeholder> is replaced"})}else if(Array.isArray(a))a.forEach((u,c)=>o(u,`${f}[${c}]`));else if(a&&typeof a=="object")for(let[u,c]of Object.entries(a))o(c,f?`${f}.${u}`:u)};if(o(r.config,""),e.fileExists&&(r.config.runtime?.mode??"pinned")==="vendored"){let a=new Set,f=!1;for(let u of r.nodes)tt.has(u.type)&&(f=!0,a.add("run-agent")),tt.has(u.type)&&u.type!=="scheduled-agent"&&a.add("agent-context"),u.type==="producer"&&a.add("agent-fallback"),u.type==="merge-gate"&&a.add("merge-gate"),u.type==="pr-review"&&u.attrs.gates!==void 0&&a.add("wait-for-checks");for(let u of a)e.fileExists(`actions/${u}/action.yml`)||t.push({level:"warning",code:"runtime.action-not-vendored",message:`runtime.mode is 'vendored' but .github/actions/${u}/ is missing`,hint:"run `gp-foundry vendor` to copy the runtime actions into the repo"});f&&!e.fileExists("agent-setup/action.yml")&&t.push({level:"warning",code:"runtime.agent-setup-missing",message:"generated agent jobs use ./.github/agent-setup, which does not exist",hint:"run `gp-foundry vendor` (or `gp-foundry init`) to scaffold the agent-setup shim"})}{let{byFanin:a,memberIds:f}=Fe(r);for(let u of r.nodes)if(u.type==="parallel"&&!f.has(u.id)&&t.push({level:"error",code:"diamond.malformed",message:`parallel '${u.id}' is not part of a clean diamond (need: exactly one in-edge carrying on=, \u22652 bare out-edges to agent legs that each flow into one fan_in)`,where:{node:u.id,line:u.line},hint:"see reference/node-types.md \u2014 v1 supports clean parallel\u2192legs\u2192fan_in diamonds only"}),u.type==="fan_in"){let c=a.get(u.id);if(!c)t.push({level:"error",code:"diamond.malformed",message:`fan_in '${u.id}' is not the join of a clean diamond (need \u22652 legs, each with exactly one in-edge from a shared parallel and one out-edge into this fan_in)`,where:{node:u.id,line:u.line},hint:"see reference/node-types.md \u2014 v1 supports clean parallel\u2192legs\u2192fan_in diamonds only"});else{!u.files.role&&u.attrs.on_complete_label===void 0&&t.push({level:"error",code:"diamond.unobservable-join",message:`fan_in '${u.id}' has neither a role nor on_complete_label \u2014 its completion would be unobservable`,where:{node:u.id,line:u.line},hint:'give it a role="..." (synthesize the lanes) and/or on_complete_label=<label> to cascade the next stage'});let d=c.legIds.filter(m=>i.get(m)?.type==="pr-review");d.length&&t.push({level:"warning",code:"diamond.lane-verdict-risk",message:`fan_in '${u.id}' lanes [${d.join(", ")}] are pr-review typed \u2014 if a lane role posts a '**Verdict:**' review, the merge gate acts on ONE lane's opinion and the join is bypassed`,where:{node:u.id},hint:"lane roles must post ANALYSES (plain comments); only the fan_in role posts the verdict"})}}}if(Je(r.config).mode==="github-token"){let a=r.edges.filter(f=>/^(pull_request\.opened|pull_request\.synchronize|push)/.test(f.on??"")||/^(label=|verdict=)/.test(f.when??""));a.length&&t.push({level:r.config.auth?.mode==="github-token"?"error":"warning",code:"auth.github-token-no-cascade",message:`auth mode 'github-token': commits/PRs made with GITHUB_TOKEN do not trigger other workflows, so ${a.length} event-cascade edge(s) (pull_request.opened/synchronize/push) will not fire and the harness will stall`,hint:"use auth.mode 'app' or 'pat' (a fine-grained PAT secret), or drive those stages via explicit dispatch"})}return r.nodes.some(a=>a.type==="start"||a.attrs.schedule!==void 0||a.type==="merge-gate")||t.push({level:"warning",code:"graph.no-entry",message:"harness has no entry node (a start node or a scheduled node) \u2014 nothing will trigger it"}),t}I();var Rr=new Set(["exit","merge-gate","human-gate","scheduled-agent","fan_in"]),Xt=new Set(["start"]);function Xe(r){let e=[],t=new Set(r.nodes.map(c=>c.id)),i=new Map(r.nodes.map(c=>[c.id,c])),o=new Map;for(let c of t)o.set(c,[]);for(let c of r.edges)t.has(c.from)&&t.has(c.to)&&o.get(c.from).push(c.to);let s=r.nodes.filter(c=>Xt.has(c.type)||c.attrs.schedule!==void 0||c.type==="merge-gate"),a=new Set,f=s.map(c=>c.id);for(;f.length;){let c=f.pop();if(!a.has(c)){a.add(c);for(let d of o.get(c)??[])f.push(d)}}for(let c of r.nodes)!a.has(c.id)&&!Xt.has(c.type)&&e.push({level:"warning",code:"graph.unreachable",message:`node '${c.id}' is unreachable from any entry (start/scheduled) node`,where:{node:c.id,line:c.line},hint:"add an incoming edge, a schedule=, or a start node that leads here"});for(let c of r.nodes)(o.get(c.id)??[]).length===0&&!Rr.has(c.type)&&e.push({level:"warning",code:"graph.dead-end",message:`node '${c.id}' (type ${c.type}) has no outgoing edge and is not a sink (exit/merge-gate/human-gate)`,where:{node:c.id,line:c.line},hint:"route it to a next node, or make it an exit"});for(let c of Ir(t,o)){if(!(c.length>1||(o.get(c[0])??[]).includes(c[0])))continue;let m=new Set(c),g=[];for(let x of c)for(let $ of o.get(x)??[])m.has($)||g.push({from:x,to:$});g.length===0?e.push({level:"error",code:"graph.unbounded-loop",message:`cycle {${c.join(" \u2192 ")}} has no escape edge \u2014 this is a livelock`,where:{node:c[0]},hint:'add a bounded escape edge (e.g. when="attempts>=N" \u2192 needs-human/exit)'}):g.some(x=>Hr(Nr(r,x.from,x.to)))||e.push({level:"warning",code:"graph.loop-escape-unbounded",message:`cycle {${c.join(" \u2192 ")}} escapes, but no escape guard looks bounded (no >=, attempts, max, count, limit)`,where:{node:c[0]},hint:"guard the escape with an explicit bound so the loop provably terminates"})}let u=new Map;for(let c of r.edges){let d=`${c.on??""}|${c.when??""}`;u.has(c.from)||u.set(c.from,new Map);let m=u.get(c.from);m.has(d)||m.set(d,new Set),m.get(d).add(c.to)}for(let[c,d]of u)for(let[m,g]of d)g.size>1&&m!=="|"&&e.push({level:"warning",code:"graph.ambiguous-routing",message:`node '${c}' has multiple edges with identical trigger/guard (${m}) to different targets: ${[...g].join(", ")}`,where:{node:c},hint:"distinguish the guards, or the transition is nondeterministic"});return e}function Nr(r,e,t){return r.edges.find(i=>i.from===e&&i.to===t)?.when}function Hr(r){return r?/(>=|>|attempts|max|count|limit)/i.test(r):!1}function Ir(r,e){let t=0,i=new Map,o=new Map,s=new Set,a=[],f=[],u=c=>{i.set(c,t),o.set(c,t),t++,a.push(c),s.add(c);for(let d of e.get(c)??[])i.has(d)?s.has(d)&&o.set(c,Math.min(o.get(c),i.get(d))):(u(d),o.set(c,Math.min(o.get(c),o.get(d))));if(o.get(c)===i.get(c)){let d=[],m;do m=a.pop(),s.delete(m),d.push(m);while(m!==c);f.push(d.reverse())}};for(let c of r)i.has(c)||u(c);return f}I();var Fr=new Set(["pr-review","pr-fix"]);function Mr(r,e){return e.labels?.[r]??r}function En(r){return Fr.has(r.type)||r.context==="pr-diff"||r.context==="pr-review"}function Qt(r,e,t){let i=(o,s)=>{r[o]??={},r[o].types??=[],r[o].types.includes(s)||r[o].types.push(s)};switch(e){case"issues.opened":return i("issues","opened");case"issues.labeled":return i("issues","labeled");case"issue_comment.created":return i("issue_comment","created");case"pull_request.opened":return i("pull_request","opened");case"pull_request.synchronize":return i("pull_request","synchronize");case"pull_request.labeled":return i("pull_request","labeled");case"pull_request.closed":return i("pull_request","closed");case"pull_request_review.submitted":return i("pull_request_review","submitted");case"push":if(En(t))return i("pull_request","synchronize");r.push??={};return;case"workflow_dispatch":r.workflow_dispatch??={};return;default:r[e]??={}}}function Zt(r,e){return r==="push"&&En(e)?"pull_request.synchronize":r}function jr(r){let[e,t]=r.split(".");return t?`(github.event_name == '${e}' && github.event.action == '${t}')`:`github.event_name == '${e}'`}function Lr(r,e,t){if(r.on)return{events:r.on.split(",").map(s=>s.trim()).filter(Boolean),guard:r.when?Sn(r.when,e,t):void 0};if(!r.when)return;let i=r.when;if(i.startsWith("label="))return{events:[En(e)?"pull_request.labeled":"issues.labeled"],guard:Sn(i,e,t)};if(i.startsWith("verdict="))return{events:["pull_request_review.submitted"],guard:Sn(i,e,t)}}function Sn(r,e,t){if(r.startsWith("label="))return`github.event.label.name == '${Mr(r.slice(6),t)}'`;if(r==="verdict=approve")return"contains(github.event.review.body, '**Verdict:** APPROVE')";if(r==="verdict=request_changes")return"contains(github.event.review.body, '**Verdict:** REQUEST_CHANGES')"}function Pr(r){if(r.attrs.schedule!==void 0)return{group:r.id,"cancel-in-progress":!1};let t=En(r)||r.type==="human-gate"?"${{ github.event.pull_request.number }}":"${{ github.event.issue.number }}";return{group:`${r.id}-${t}`,"cancel-in-progress":r.type==="issue-agent"}}function ei(r){let e={},t=new Map(r.nodes.map(s=>[s.id,s])),i=new Map;for(let s of r.nodes)i.set(s.id,[]);for(let s of r.edges)i.get(s.to)?.push(s);let o=Fe(r);for(let s of r.nodes){if(s.type==="start"||s.type==="exit"||o.memberIds.has(s.id))continue;let a=o.byFanin.get(s.id);if(a){let x=a.entryEdge,$=t.get(a.legIds[0]),E={},O=(x.on??"").split(",").map(W=>W.trim()).filter(Boolean);for(let W of O)Qt(E,W,$);let F={nodeId:s.id,triggers:E,dispatches:[]},j=x.when?Sn(x.when,$,r.config):void 0;j&&(F.guard=j);let D=O.some(W=>Zt(W,$).startsWith("pull_request"))?"${{ github.event.pull_request.number }}":"${{ github.event.issue.number }}";F.concurrency={group:`${s.id}-${D}`,"cancel-in-progress":!1},e[s.id]=F;continue}if(s.type==="parallel"||s.type==="fan_in")continue;let f={},u=new Set,c=new Set,d=[];if(s.attrs.schedule!==void 0)f.schedule=[{cron:String(s.attrs.schedule)}],f.workflow_dispatch={};else{for(let x of i.get(s.id)??[]){let $=Lr(x,s,r.config);if($){for(let E of $.events)Qt(f,E,s);if($.guard)u.add($.guard);else for(let E of $.events)c.add(Zt(E,s))}}if(u.size&&c.size)for(let x of c)u.add(jr(x))}for(let x of r.edges)x.from===s.id&&x.do&&d.push({toNode:x.to,when:x.when});let m=u.size?[...u].join(" || "):void 0,g={nodeId:s.id,triggers:f,dispatches:d};m&&(g.guard=m),Object.keys(f).length&&(g.concurrency=Pr(s)),e[s.id]=g}return{perNode:e}}I();I();function Dr(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ne={},vn={},xe={},ni;function Qe(){if(ni)return xe;ni=1;function r(a){return typeof a>"u"||a===null}function e(a){return typeof a=="object"&&a!==null}function t(a){return Array.isArray(a)?a:r(a)?[]:[a]}function i(a,f){if(f){let u=Object.keys(f);for(let c=0,d=u.length;c<d;c+=1){let m=u[c];a[m]=f[m]}}return a}function o(a,f){let u="";for(let c=0;c<f;c+=1)u+=a;return u}function s(a){return a===0&&Number.NEGATIVE_INFINITY===1/a}return xe.isNothing=r,xe.isObject=e,xe.toArray=t,xe.repeat=o,xe.isNegativeZero=s,xe.extend=i,xe}var it,ti;function Ze(){if(ti)return it;ti=1;function r(t,i){let o="",s=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(o+='in "'+t.mark.name+'" '),o+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!i&&t.mark.snippet&&(o+=`
|
|
23
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(o=>t.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Pt(r){return r.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",o="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?o=s[3]:i=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],i=s[3],o=s[4]),t&&o!=="0"?`${t}=${i}:${parseInt(o)+1}`:e})}Dt.Command=Zn});var Wt=Ae(se=>{"use strict";I();var{Argument:Bt}=_n(),{Command:et}=qt(),{CommanderError:Sr,InvalidArgumentError:Ut}=Ke(),{Help:vr}=Wn(),{Option:Vt}=Jn();se.program=new et;se.createCommand=r=>new et(r);se.createOption=(r,e)=>new Vt(r,e);se.createArgument=(r,e)=>new Bt(r,e);se.Command=et;se.Option=Vt;se.Argument=Bt;se.Help=vr;se.CommanderError=Sr;se.InvalidArgumentError=Ut;se.InvalidOptionArgumentError=Ut});var Cn=Ae((Bo,nt)=>{"use strict";I();var xn=process||{},Kt=xn.argv||[],An=xn.env||{},Er=!(An.NO_COLOR||Kt.includes("--no-color"))&&(!!An.FORCE_COLOR||Kt.includes("--color")||xn.platform==="win32"||(xn.stdout||{}).isTTY&&An.TERM!=="dumb"||!!An.CI),Or=(r,e,t=r)=>i=>{let o=""+i,s=o.indexOf(e,r.length);return~s?r+$r(o,e,t,s)+e:r+o+e},$r=(r,e,t,i)=>{let o="",s=0;do o+=r.substring(s,i)+t,s=i+e.length,i=r.indexOf(e,s);while(~i);return o+r.substring(s)},Jt=(r=Er)=>{let e=r?Or:()=>String;return{isColorSupported:r,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};nt.exports=Jt();nt.exports.createColors=Jt});I();I();var Gt=yn(Wt(),1),{program:To,createCommand:Ro,createArgument:No,createOption:Ho,CommanderError:Io,InvalidArgumentError:Fo,InvalidOptionArgumentError:jo,Command:Yt,Argument:Mo,Option:Lo,Help:Po}=Gt.default;var Q=yn(Cn(),1),ir=require("child_process"),Y=require("fs"),ee=require("path");I();I();I();var kn=["analyst","issue-agent","producer","pr-review","pr-fix","scheduled-agent"];function zt(r){return r.uses!==void 0}I();function Je(r){let e=r.auth;return e?.mode?{mode:e.mode,appIdSecret:e.app_id_secret??r.identity.app_id_secret,appKeySecret:e.app_key_secret??r.identity.app_key_secret,tokenSecret:e.token_secret}:r.identity.app_id_secret&&r.identity.app_key_secret?{mode:"app",appIdSecret:r.identity.app_id_secret,appKeySecret:r.identity.app_key_secret}:{mode:"github-token"}}I();var Tr=new Set(kn);function Fe(r){let e=new Map(r.nodes.map(a=>[a.id,a])),t=new Map,i=new Map;for(let a of r.nodes)t.set(a.id,[]),i.set(a.id,[]);for(let a of r.edges)t.get(a.to)?.push(a),i.get(a.from)?.push(a);let o=new Map,s=new Set;for(let a of r.nodes){if(a.type!=="fan_in")continue;let f=t.get(a.id)??[];if(f.length<2)continue;let u=[],c,d=!0;for(let $ of f){let v=e.get($.from);if(!v||!Tr.has(v.type)){d=!1;break}let O=t.get(v.id)??[],F=i.get(v.id)??[];if(O.length!==1||F.length!==1||F[0].to!==a.id){d=!1;break}let M=e.get(O[0].from);if(!M||M.type!=="parallel"){d=!1;break}if(O[0].on||O[0].when){d=!1;break}if(c===void 0)c=M.id;else if(c!==M.id){d=!1;break}u.push(v.id)}if(!d||c===void 0)continue;let m=t.get(c)??[],g=i.get(c)??[];if(m.length!==1||!m[0].on)continue;let x=new Set(u);if(!(!g.every($=>x.has($.to))||g.length!==u.length)){o.set(a.id,{parallelId:c,entryEdge:m[0],legIds:u,faninId:a.id}),s.add(c);for(let $ of u)s.add($)}}return{byFanin:o,memberIds:s}}var tt=new Set(kn);function ze(r,e={}){let t=[],i=new Map(r.nodes.map(a=>[a.id,a]));for(let a of r.nodes)a.declared||t.push({level:"error",code:"node.undeclared",message:`node '${a.id}' is referenced in an edge but never declared`,where:{node:a.id,line:a.line},hint:`add a node statement, e.g. ${a.id} [type=...]`});for(let a of r.nodes)tt.has(a.type)&&!a.files.role&&t.push({level:"error",code:"node.missing-role",message:`agent node '${a.id}' (type ${a.type}) needs a role="..." job description`,where:{node:a.id,line:a.line}}),a.type==="human-gate"&&a.attrs.environment===void 0&&t.push({level:"error",code:"node.human-gate-no-environment",message:`human-gate '${a.id}' must set environment=<name> (maps to a protected GitHub Environment)`,where:{node:a.id,line:a.line}}),a.type==="merge-gate"&&!a.files.policy&&t.push({level:"warning",code:"node.merge-gate-no-policy",message:`merge-gate '${a.id}' has no policy="..."; default merge policy will be used`,where:{node:a.id,line:a.line}});if(e.fileExists)for(let a of r.nodes)for(let f of["role","policy","prompt","tools"]){let u=a.files[f];u&&!e.fileExists(u)&&t.push({level:"error",code:"file.missing",message:`node '${a.id}' references ${f}="${u}" which does not exist`,where:{node:a.id,line:a.line,file:u}})}if(e.roles){let a=new Map;for(let u of r.nodes)a.set(u.id,[]);for(let u of r.edges){let c=i.get(u.to);c&&a.get(u.from)?.push(c)}let f=u=>(e.roles?.get(u.id)?.role??u.id).toLowerCase();for(let u of r.nodes){let c=e.roles.get(u.id);if(!c?.handoffs)continue;let d=a.get(u.id)??[],m=new Set(d.flatMap(x=>[x.id.toLowerCase(),f(x)])),g=new Set(c.handoffs.map(x=>String(x.to).toLowerCase()));for(let x of c.handoffs)m.has(String(x.to).toLowerCase())||t.push({level:"warning",code:"role.handoff-no-edge",message:`role '${c.role}' (node '${u.id}') declares a handoff to '${x.to}' but there is no matching out-edge`,where:{node:u.id},hint:"add the edge, or remove the handoff so the job description matches the graph"});for(let x of d)x.type!=="exit"&&!g.has(x.id.toLowerCase())&&!g.has(f(x))&&t.push({level:"warning",code:"role.edge-no-handoff",message:`node '${u.id}' has an out-edge to '${x.id}' not declared as a handoff in role '${c.role}'`,where:{node:u.id,edge:[u.id,x.id]},hint:"document the handoff in the role, or remove the edge"})}}let o=(a,f)=>{if(typeof a=="string"){let u=a.match(/<[A-Za-z][^<>]{0,80}>/);u&&t.push({level:"error",code:"config.placeholder",message:`config value ${f} still contains the placeholder ${u[0]} \u2014 fill it in foundry.config.yaml`,hint:"generated workflows would be broken until every <placeholder> is replaced"})}else if(Array.isArray(a))a.forEach((u,c)=>o(u,`${f}[${c}]`));else if(a&&typeof a=="object")for(let[u,c]of Object.entries(a))o(c,f?`${f}.${u}`:u)};if(o(r.config,""),e.fileExists&&(r.config.runtime?.mode??"pinned")==="vendored"){let a=new Set,f=!1;for(let u of r.nodes)tt.has(u.type)&&(f=!0,a.add("run-agent")),tt.has(u.type)&&u.type!=="scheduled-agent"&&a.add("agent-context"),u.type==="producer"&&a.add("agent-fallback"),u.type==="merge-gate"&&a.add("merge-gate"),u.type==="pr-review"&&u.attrs.gates!==void 0&&a.add("wait-for-checks");for(let u of a)e.fileExists(`actions/${u}/action.yml`)||t.push({level:"warning",code:"runtime.action-not-vendored",message:`runtime.mode is 'vendored' but .github/actions/${u}/ is missing`,hint:"run `gp-foundry vendor` to copy the runtime actions into the repo"});f&&!e.fileExists("agent-setup/action.yml")&&t.push({level:"warning",code:"runtime.agent-setup-missing",message:"generated agent jobs use ./.github/agent-setup, which does not exist",hint:"run `gp-foundry vendor` (or `gp-foundry init`) to scaffold the agent-setup shim"})}{let{byFanin:a,memberIds:f}=Fe(r);for(let u of r.nodes)if(u.type==="parallel"&&!f.has(u.id)&&t.push({level:"error",code:"diamond.malformed",message:`parallel '${u.id}' is not part of a clean diamond (need: exactly one in-edge carrying on=, \u22652 bare out-edges to agent legs that each flow into one fan_in)`,where:{node:u.id,line:u.line},hint:"see reference/node-types.md \u2014 v1 supports clean parallel\u2192legs\u2192fan_in diamonds only"}),u.type==="fan_in"){let c=a.get(u.id);if(!c)t.push({level:"error",code:"diamond.malformed",message:`fan_in '${u.id}' is not the join of a clean diamond (need \u22652 legs, each with exactly one in-edge from a shared parallel and one out-edge into this fan_in)`,where:{node:u.id,line:u.line},hint:"see reference/node-types.md \u2014 v1 supports clean parallel\u2192legs\u2192fan_in diamonds only"});else{!u.files.role&&u.attrs.on_complete_label===void 0&&t.push({level:"error",code:"diamond.unobservable-join",message:`fan_in '${u.id}' has neither a role nor on_complete_label \u2014 its completion would be unobservable`,where:{node:u.id,line:u.line},hint:'give it a role="..." (synthesize the lanes) and/or on_complete_label=<label> to cascade the next stage'});let d=c.legIds.filter(m=>i.get(m)?.type==="pr-review");d.length&&t.push({level:"warning",code:"diamond.lane-verdict-risk",message:`fan_in '${u.id}' lanes [${d.join(", ")}] are pr-review typed \u2014 if a lane role posts a '**Verdict:**' review, the merge gate acts on ONE lane's opinion and the join is bypassed`,where:{node:u.id},hint:"lane roles must post ANALYSES (plain comments); only the fan_in role posts the verdict"})}}}if(Je(r.config).mode==="github-token"){let a=r.edges.filter(f=>/^(pull_request\.opened|pull_request\.synchronize|push)/.test(f.on??"")||/^(label=|verdict=)/.test(f.when??""));a.length&&t.push({level:r.config.auth?.mode==="github-token"?"error":"warning",code:"auth.github-token-no-cascade",message:`auth mode 'github-token': commits/PRs made with GITHUB_TOKEN do not trigger other workflows, so ${a.length} event-cascade edge(s) (pull_request.opened/synchronize/push) will not fire and the harness will stall`,hint:"use auth.mode 'app' or 'pat' (a fine-grained PAT secret), or drive those stages via explicit dispatch"})}return r.nodes.some(a=>a.type==="start"||a.attrs.schedule!==void 0||a.type==="merge-gate")||t.push({level:"warning",code:"graph.no-entry",message:"harness has no entry node (a start node or a scheduled node) \u2014 nothing will trigger it"}),t}I();var Rr=new Set(["exit","merge-gate","human-gate","scheduled-agent","fan_in"]),Xt=new Set(["start"]);function Xe(r){let e=[],t=new Set(r.nodes.map(c=>c.id)),i=new Map(r.nodes.map(c=>[c.id,c])),o=new Map;for(let c of t)o.set(c,[]);for(let c of r.edges)t.has(c.from)&&t.has(c.to)&&o.get(c.from).push(c.to);let s=r.nodes.filter(c=>Xt.has(c.type)||c.attrs.schedule!==void 0||c.type==="merge-gate"),a=new Set,f=s.map(c=>c.id);for(;f.length;){let c=f.pop();if(!a.has(c)){a.add(c);for(let d of o.get(c)??[])f.push(d)}}for(let c of r.nodes)!a.has(c.id)&&!Xt.has(c.type)&&e.push({level:"warning",code:"graph.unreachable",message:`node '${c.id}' is unreachable from any entry (start/scheduled) node`,where:{node:c.id,line:c.line},hint:"add an incoming edge, a schedule=, or a start node that leads here"});for(let c of r.nodes)(o.get(c.id)??[]).length===0&&!Rr.has(c.type)&&e.push({level:"warning",code:"graph.dead-end",message:`node '${c.id}' (type ${c.type}) has no outgoing edge and is not a sink (exit/merge-gate/human-gate)`,where:{node:c.id,line:c.line},hint:"route it to a next node, or make it an exit"});for(let c of Ir(t,o)){if(!(c.length>1||(o.get(c[0])??[]).includes(c[0])))continue;let m=new Set(c),g=[];for(let x of c)for(let $ of o.get(x)??[])m.has($)||g.push({from:x,to:$});g.length===0?e.push({level:"error",code:"graph.unbounded-loop",message:`cycle {${c.join(" \u2192 ")}} has no escape edge \u2014 this is a livelock`,where:{node:c[0]},hint:'add a bounded escape edge (e.g. when="attempts>=N" \u2192 needs-human/exit)'}):g.some(x=>Hr(Nr(r,x.from,x.to)))||e.push({level:"warning",code:"graph.loop-escape-unbounded",message:`cycle {${c.join(" \u2192 ")}} escapes, but no escape guard looks bounded (no >=, attempts, max, count, limit)`,where:{node:c[0]},hint:"guard the escape with an explicit bound so the loop provably terminates"})}let u=new Map;for(let c of r.edges){let d=`${c.on??""}|${c.when??""}`;u.has(c.from)||u.set(c.from,new Map);let m=u.get(c.from);m.has(d)||m.set(d,new Set),m.get(d).add(c.to)}for(let[c,d]of u)for(let[m,g]of d)g.size>1&&m!=="|"&&e.push({level:"warning",code:"graph.ambiguous-routing",message:`node '${c}' has multiple edges with identical trigger/guard (${m}) to different targets: ${[...g].join(", ")}`,where:{node:c},hint:"distinguish the guards, or the transition is nondeterministic"});return e}function Nr(r,e,t){return r.edges.find(i=>i.from===e&&i.to===t)?.when}function Hr(r){return r?/(>=|>|attempts|max|count|limit)/i.test(r):!1}function Ir(r,e){let t=0,i=new Map,o=new Map,s=new Set,a=[],f=[],u=c=>{i.set(c,t),o.set(c,t),t++,a.push(c),s.add(c);for(let d of e.get(c)??[])i.has(d)?s.has(d)&&o.set(c,Math.min(o.get(c),i.get(d))):(u(d),o.set(c,Math.min(o.get(c),o.get(d))));if(o.get(c)===i.get(c)){let d=[],m;do m=a.pop(),s.delete(m),d.push(m);while(m!==c);f.push(d.reverse())}};for(let c of r)i.has(c)||u(c);return f}I();var Fr=new Set(["pr-review","pr-fix"]);function jr(r,e){return e.labels?.[r]??r}function vn(r){return Fr.has(r.type)||r.context==="pr-diff"||r.context==="pr-review"}function Qt(r,e,t){let i=(o,s)=>{r[o]??={},r[o].types??=[],r[o].types.includes(s)||r[o].types.push(s)};switch(e){case"issues.opened":return i("issues","opened");case"issues.labeled":return i("issues","labeled");case"issue_comment.created":return i("issue_comment","created");case"pull_request.opened":return i("pull_request","opened");case"pull_request.synchronize":return i("pull_request","synchronize");case"pull_request.labeled":return i("pull_request","labeled");case"pull_request.closed":return i("pull_request","closed");case"pull_request_review.submitted":return i("pull_request_review","submitted");case"push":if(vn(t))return i("pull_request","synchronize");r.push??={};return;case"workflow_dispatch":r.workflow_dispatch??={};return;default:r[e]??={}}}function Zt(r,e){return r==="push"&&vn(e)?"pull_request.synchronize":r}function Mr(r){let[e,t]=r.split(".");return t?`(github.event_name == '${e}' && github.event.action == '${t}')`:`github.event_name == '${e}'`}function Lr(r,e,t){if(r.on)return{events:r.on.split(",").map(s=>s.trim()).filter(Boolean),guard:r.when?Sn(r.when,e,t):void 0};if(!r.when)return;let i=r.when;if(i.startsWith("label="))return{events:[vn(e)?"pull_request.labeled":"issues.labeled"],guard:Sn(i,e,t)};if(i.startsWith("verdict="))return{events:["pull_request_review.submitted"],guard:Sn(i,e,t)}}function Sn(r,e,t){if(r.startsWith("label="))return`github.event.label.name == '${jr(r.slice(6),t)}'`;if(r==="verdict=approve")return"contains(github.event.review.body, '**Verdict:** APPROVE')";if(r==="verdict=request_changes")return"contains(github.event.review.body, '**Verdict:** REQUEST_CHANGES')"}function Pr(r){if(r.attrs.schedule!==void 0)return{group:r.id,"cancel-in-progress":!1};let t=vn(r)||r.type==="human-gate"?"${{ github.event.pull_request.number }}":"${{ github.event.issue.number }}";return{group:`${r.id}-${t}`,"cancel-in-progress":r.type==="issue-agent"}}function ei(r){let e={},t=new Map(r.nodes.map(s=>[s.id,s])),i=new Map;for(let s of r.nodes)i.set(s.id,[]);for(let s of r.edges)i.get(s.to)?.push(s);let o=Fe(r);for(let s of r.nodes){if(s.type==="start"||s.type==="exit"||o.memberIds.has(s.id))continue;let a=o.byFanin.get(s.id);if(a){let x=a.entryEdge,$=t.get(a.legIds[0]),v={},O=(x.on??"").split(",").map(W=>W.trim()).filter(Boolean);for(let W of O)Qt(v,W,$);let F={nodeId:s.id,triggers:v,dispatches:[]},M=x.when?Sn(x.when,$,r.config):void 0;M&&(F.guard=M);let D=O.some(W=>Zt(W,$).startsWith("pull_request"))?"${{ github.event.pull_request.number }}":"${{ github.event.issue.number }}";F.concurrency={group:`${s.id}-${D}`,"cancel-in-progress":!1},e[s.id]=F;continue}if(s.type==="parallel"||s.type==="fan_in")continue;let f={},u=new Set,c=new Set,d=[];if(s.attrs.schedule!==void 0)f.schedule=[{cron:String(s.attrs.schedule)}],f.workflow_dispatch={};else{for(let x of i.get(s.id)??[]){let $=Lr(x,s,r.config);if($){for(let v of $.events)Qt(f,v,s);if($.guard)u.add($.guard);else for(let v of $.events)c.add(Zt(v,s))}}if(u.size&&c.size)for(let x of c)u.add(Mr(x))}for(let x of r.edges)x.from===s.id&&x.do&&d.push({toNode:x.to,when:x.when});let m=u.size?[...u].join(" || "):void 0,g={nodeId:s.id,triggers:f,dispatches:d};m&&(g.guard=m),Object.keys(f).length&&(g.concurrency=Pr(s)),e[s.id]=g}return{perNode:e}}I();I();function Dr(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ne={},En={},xe={},ni;function Qe(){if(ni)return xe;ni=1;function r(a){return typeof a>"u"||a===null}function e(a){return typeof a=="object"&&a!==null}function t(a){return Array.isArray(a)?a:r(a)?[]:[a]}function i(a,f){if(f){let u=Object.keys(f);for(let c=0,d=u.length;c<d;c+=1){let m=u[c];a[m]=f[m]}}return a}function o(a,f){let u="";for(let c=0;c<f;c+=1)u+=a;return u}function s(a){return a===0&&Number.NEGATIVE_INFINITY===1/a}return xe.isNothing=r,xe.isObject=e,xe.toArray=t,xe.repeat=o,xe.isNegativeZero=s,xe.extend=i,xe}var it,ti;function Ze(){if(ti)return it;ti=1;function r(t,i){let o="",s=t.reason||"(unknown reason)";return t.mark?(t.mark.name&&(o+='in "'+t.mark.name+'" '),o+="("+(t.mark.line+1)+":"+(t.mark.column+1)+")",!i&&t.mark.snippet&&(o+=`
|
|
24
24
|
|
|
25
|
-
`+t.mark.snippet),s+" "+o):s}function e(t,i){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=i,this.message=r(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(i){return this.name+": "+r(this,i)},it=e,it}var rt,ii;function qr(){if(ii)return rt;ii=1;let r=Qe();function e(o,s,a,f,u){let c="",d="",m=Math.floor(u/2)-1;return f-s>m&&(c=" ... ",s=f-m+c.length),a-f>m&&(d=" ...",a=f+m-d.length),{str:c+o.slice(s,a).replace(/\t/g,"\u2192")+d,pos:f-s+c.length}}function t(o,s){return r.repeat(" ",s-o.length)+o}function i(o,s){if(s=Object.create(s||null),!o.buffer)return null;s.maxLength||(s.maxLength=79),typeof s.indent!="number"&&(s.indent=1),typeof s.linesBefore!="number"&&(s.linesBefore=3),typeof s.linesAfter!="number"&&(s.linesAfter=2);let a=/\r?\n|\r|\0/g,f=[0],u=[],c,d=-1;for(;c=a.exec(o.buffer);)u.push(c.index),f.push(c.index+c[0].length),o.position<=c.index&&d<0&&(d=f.length-2);d<0&&(d=f.length-1);let m="",g=Math.min(o.line+s.linesAfter,u.length).toString().length,x=s.maxLength-(s.indent+g+3);for(let
|
|
25
|
+
`+t.mark.snippet),s+" "+o):s}function e(t,i){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=i,this.message=r(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(i){return this.name+": "+r(this,i)},it=e,it}var rt,ii;function qr(){if(ii)return rt;ii=1;let r=Qe();function e(o,s,a,f,u){let c="",d="",m=Math.floor(u/2)-1;return f-s>m&&(c=" ... ",s=f-m+c.length),a-f>m&&(d=" ...",a=f+m-d.length),{str:c+o.slice(s,a).replace(/\t/g,"\u2192")+d,pos:f-s+c.length}}function t(o,s){return r.repeat(" ",s-o.length)+o}function i(o,s){if(s=Object.create(s||null),!o.buffer)return null;s.maxLength||(s.maxLength=79),typeof s.indent!="number"&&(s.indent=1),typeof s.linesBefore!="number"&&(s.linesBefore=3),typeof s.linesAfter!="number"&&(s.linesAfter=2);let a=/\r?\n|\r|\0/g,f=[0],u=[],c,d=-1;for(;c=a.exec(o.buffer);)u.push(c.index),f.push(c.index+c[0].length),o.position<=c.index&&d<0&&(d=f.length-2);d<0&&(d=f.length-1);let m="",g=Math.min(o.line+s.linesAfter,u.length).toString().length,x=s.maxLength-(s.indent+g+3);for(let v=1;v<=s.linesBefore&&!(d-v<0);v++){let O=e(o.buffer,f[d-v],u[d-v],o.position-(f[d]-f[d-v]),x);m=r.repeat(" ",s.indent)+t((o.line-v+1).toString(),g)+" | "+O.str+`
|
|
26
26
|
`+m}let $=e(o.buffer,f[d],u[d],o.position,x);m+=r.repeat(" ",s.indent)+t((o.line+1).toString(),g)+" | "+$.str+`
|
|
27
27
|
`,m+=r.repeat("-",s.indent+g+3+$.pos)+`^
|
|
28
|
-
`;for(let
|
|
29
|
-
`}return m.replace(/\n$/,"")}return rt=i,rt}var ot,ri;function ie(){if(ri)return ot;ri=1;let r=Ze(),e=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],t=["scalar","sequence","mapping"];function i(s){let a={};return s!==null&&Object.keys(s).forEach(function(f){s[f].forEach(function(u){a[String(u)]=f})}),a}function o(s,a){if(a=a||{},Object.keys(a).forEach(function(f){if(e.indexOf(f)===-1)throw new r('Unknown option "'+f+'" is met in definition of "'+s+'" YAML type.')}),this.options=a,this.tag=s,this.kind=a.kind||null,this.resolve=a.resolve||function(){return!0},this.construct=a.construct||function(f){return f},this.instanceOf=a.instanceOf||null,this.predicate=a.predicate||null,this.represent=a.represent||null,this.representName=a.representName||null,this.defaultStyle=a.defaultStyle||null,this.multi=a.multi||!1,this.styleAliases=i(a.styleAliases||null),t.indexOf(this.kind)===-1)throw new r('Unknown kind "'+this.kind+'" is specified for "'+s+'" YAML type.')}return ot=o,ot}var st,oi;function
|
|
30
|
-
\r`;function t(a){if(a===null)return!1;let f=0,u=a.length,c=e;for(let d=0;d<u;d++){let m=c.indexOf(a.charAt(d));if(!(m>64)){if(m<0)return!1;f+=6}}return f%8===0}function i(a){let f=a.replace(/[\r\n=]/g,""),u=f.length,c=e,d=0,m=[];for(let x=0;x<u;x++)x%4===0&&x&&(m.push(d>>16&255),m.push(d>>8&255),m.push(d&255)),d=d<<6|c.indexOf(f.charAt(x));let g=u%4*6;return g===0?(m.push(d>>16&255),m.push(d>>8&255),m.push(d&255)):g===18?(m.push(d>>10&255),m.push(d>>2&255)):g===12&&m.push(d>>4&255),new Uint8Array(m)}function o(a){let f="",u=0,c=a.length,d=e;for(let g=0;g<c;g++)g%3===0&&g&&(f+=d[u>>18&63],f+=d[u>>12&63],f+=d[u>>6&63],f+=d[u&63]),u=(u<<8)+a[g];let m=c%3;return m===0?(f+=d[u>>18&63],f+=d[u>>12&63],f+=d[u>>6&63],f+=d[u&63]):m===2?(f+=d[u>>10&63],f+=d[u>>4&63],f+=d[u<<2&63],f+=d[64]):m===1&&(f+=d[u>>2&63],f+=d[u<<4&63],f+=d[64],f+=d[64]),f}function s(a){return Object.prototype.toString.call(a)==="[object Uint8Array]"}return wt=new r("tag:yaml.org,2002:binary",{kind:"scalar",resolve:t,construct:i,predicate:s,represent:o}),wt}var _t,wi;function Di(){if(wi)return _t;wi=1;let r=ie(),e=Object.prototype.hasOwnProperty,t=Object.prototype.toString;function i(s){if(s===null)return!0;let a=[],f=s;for(let u=0,c=f.length;u<c;u+=1){let d=f[u],m=!1;if(t.call(d)!=="[object Object]")return!1;let g;for(g in d)if(e.call(d,g))if(!m)m=!0;else return!1;if(!m)return!1;if(a.indexOf(g)===-1)a.push(g);else return!1}return!0}function o(s){return s!==null?s:[]}return _t=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:i,construct:o}),_t}var At,_i;function qi(){if(_i)return At;_i=1;let r=ie(),e=Object.prototype.toString;function t(o){if(o===null)return!0;let s=o,a=new Array(s.length);for(let f=0,u=s.length;f<u;f+=1){let c=s[f];if(e.call(c)!=="[object Object]")return!1;let d=Object.keys(c);if(d.length!==1)return!1;a[f]=[d[0],c[d[0]]]}return!0}function i(o){if(o===null)return[];let s=o,a=new Array(s.length);for(let f=0,u=s.length;f<u;f+=1){let c=s[f],d=Object.keys(c);a[f]=[d[0],c[d[0]]]}return a}return At=new r("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:t,construct:i}),At}var xt,Ai;function Bi(){if(Ai)return xt;Ai=1;let r=ie(),e=Object.prototype.hasOwnProperty;function t(o){if(o===null)return!0;let s=o;for(let a in s)if(e.call(s,a)&&s[a]!==null)return!1;return!0}function i(o){return o!==null?o:{}}return xt=new r("tag:yaml.org,2002:set",{kind:"mapping",resolve:t,construct:i}),xt}var Ct,xi;function St(){return xi||(xi=1,Ct=
|
|
31
|
-
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function L(n){return n<=65535?String.fromCharCode(n):String.fromCharCode((n-65536>>10)+55296,(n-65536&1023)+56320)}function ae(n,p,y){p==="__proto__"?Object.defineProperty(n,p,{configurable:!0,enumerable:!0,writable:!0,value:y}):n[p]=y}let sn=new Array(256),Ue=new Array(256);for(let n=0;n<256;n++)sn[n]=
|
|
32
|
-
`,p-1))}function cn(n,p,y){let A,b,
|
|
28
|
+
`;for(let v=1;v<=s.linesAfter&&!(d+v>=u.length);v++){let O=e(o.buffer,f[d+v],u[d+v],o.position-(f[d]-f[d+v]),x);m+=r.repeat(" ",s.indent)+t((o.line+v+1).toString(),g)+" | "+O.str+`
|
|
29
|
+
`}return m.replace(/\n$/,"")}return rt=i,rt}var ot,ri;function ie(){if(ri)return ot;ri=1;let r=Ze(),e=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],t=["scalar","sequence","mapping"];function i(s){let a={};return s!==null&&Object.keys(s).forEach(function(f){s[f].forEach(function(u){a[String(u)]=f})}),a}function o(s,a){if(a=a||{},Object.keys(a).forEach(function(f){if(e.indexOf(f)===-1)throw new r('Unknown option "'+f+'" is met in definition of "'+s+'" YAML type.')}),this.options=a,this.tag=s,this.kind=a.kind||null,this.resolve=a.resolve||function(){return!0},this.construct=a.construct||function(f){return f},this.instanceOf=a.instanceOf||null,this.predicate=a.predicate||null,this.represent=a.represent||null,this.representName=a.representName||null,this.defaultStyle=a.defaultStyle||null,this.multi=a.multi||!1,this.styleAliases=i(a.styleAliases||null),t.indexOf(this.kind)===-1)throw new r('Unknown kind "'+this.kind+'" is specified for "'+s+'" YAML type.')}return ot=o,ot}var st,oi;function vi(){if(oi)return st;oi=1;let r=Ze(),e=ie();function t(s,a){let f=[];return s[a].forEach(function(u){let c=f.length;f.forEach(function(d,m){d.tag===u.tag&&d.kind===u.kind&&d.multi===u.multi&&(c=m)}),f[c]=u}),f}function i(){let s={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function a(f){f.multi?(s.multi[f.kind].push(f),s.multi.fallback.push(f)):s[f.kind][f.tag]=s.fallback[f.tag]=f}for(let f=0,u=arguments.length;f<u;f+=1)arguments[f].forEach(a);return s}function o(s){return this.extend(s)}return o.prototype.extend=function(a){let f=[],u=[];if(a instanceof e)u.push(a);else if(Array.isArray(a))u=u.concat(a);else if(a&&(Array.isArray(a.implicit)||Array.isArray(a.explicit)))a.implicit&&(f=f.concat(a.implicit)),a.explicit&&(u=u.concat(a.explicit));else throw new r("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");f.forEach(function(d){if(!(d instanceof e))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(d.loadKind&&d.loadKind!=="scalar")throw new r("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(d.multi)throw new r("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),u.forEach(function(d){if(!(d instanceof e))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.")});let c=Object.create(o.prototype);return c.implicit=(this.implicit||[]).concat(f),c.explicit=(this.explicit||[]).concat(u),c.compiledImplicit=t(c,"implicit"),c.compiledExplicit=t(c,"explicit"),c.compiledTypeMap=i(c.compiledImplicit,c.compiledExplicit),c},st=o,st}var lt,si;function Ei(){if(si)return lt;si=1;let r=ie();return lt=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),lt}var at,li;function Oi(){if(li)return at;li=1;let r=ie();return at=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),at}var ct,ai;function $i(){if(ai)return ct;ai=1;let r=ie();return ct=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),ct}var ut,ci;function Ti(){if(ci)return ut;ci=1;let r=vi();return ut=new r({explicit:[Ei(),Oi(),$i()]}),ut}var ft,ui;function Ri(){if(ui)return ft;ui=1;let r=ie();function e(o){if(o===null)return!0;let s=o.length;return s===1&&o==="~"||s===4&&(o==="null"||o==="Null"||o==="NULL")}function t(){return null}function i(o){return o===null}return ft=new r("tag:yaml.org,2002:null",{kind:"scalar",resolve:e,construct:t,predicate:i,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),ft}var dt,fi;function Ni(){if(fi)return dt;fi=1;let r=ie();function e(o){if(o===null)return!1;let s=o.length;return s===4&&(o==="true"||o==="True"||o==="TRUE")||s===5&&(o==="false"||o==="False"||o==="FALSE")}function t(o){return o==="true"||o==="True"||o==="TRUE"}function i(o){return Object.prototype.toString.call(o)==="[object Boolean]"}return dt=new r("tag:yaml.org,2002:bool",{kind:"scalar",resolve:e,construct:t,predicate:i,represent:{lowercase:function(o){return o?"true":"false"},uppercase:function(o){return o?"TRUE":"FALSE"},camelcase:function(o){return o?"True":"False"}},defaultStyle:"lowercase"}),dt}var pt,di;function Hi(){if(di)return pt;di=1;let r=Qe(),e=ie();function t(c){return c>=48&&c<=57||c>=65&&c<=70||c>=97&&c<=102}function i(c){return c>=48&&c<=55}function o(c){return c>=48&&c<=57}function s(c){if(c===null)return!1;let d=c.length,m=0,g=!1;if(!d)return!1;let x=c[m];if((x==="-"||x==="+")&&(x=c[++m]),x==="0"){if(m+1===d)return!0;if(x=c[++m],x==="b"){for(m++;m<d;m++){if(x=c[m],x!=="0"&&x!=="1")return!1;g=!0}return g&&isFinite(a(c))}if(x==="x"){for(m++;m<d;m++){if(!t(c.charCodeAt(m)))return!1;g=!0}return g&&isFinite(a(c))}if(x==="o"){for(m++;m<d;m++){if(!i(c.charCodeAt(m)))return!1;g=!0}return g&&isFinite(a(c))}}for(;m<d;m++){if(!o(c.charCodeAt(m)))return!1;g=!0}return g?isFinite(a(c)):!1}function a(c){let d=c,m=1,g=d[0];if((g==="-"||g==="+")&&(g==="-"&&(m=-1),d=d.slice(1),g=d[0]),d==="0")return 0;if(g==="0"){if(d[1]==="b")return m*parseInt(d.slice(2),2);if(d[1]==="x")return m*parseInt(d.slice(2),16);if(d[1]==="o")return m*parseInt(d.slice(2),8)}return m*parseInt(d,10)}function f(c){return a(c)}function u(c){return Object.prototype.toString.call(c)==="[object Number]"&&c%1===0&&!r.isNegativeZero(c)}return pt=new e("tag:yaml.org,2002:int",{kind:"scalar",resolve:s,construct:f,predicate:u,represent:{binary:function(c){return c>=0?"0b"+c.toString(2):"-0b"+c.toString(2).slice(1)},octal:function(c){return c>=0?"0o"+c.toString(8):"-0o"+c.toString(8).slice(1)},decimal:function(c){return c.toString(10)},hexadecimal:function(c){return c>=0?"0x"+c.toString(16).toUpperCase():"-0x"+c.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),pt}var ht,pi;function Ii(){if(pi)return ht;pi=1;let r=Qe(),e=ie(),t=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),i=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function o(c){return c===null||!t.test(c)?!1:isFinite(parseFloat(c,10))?!0:i.test(c)}function s(c){let d=c.toLowerCase(),m=d[0]==="-"?-1:1;return"+-".indexOf(d[0])>=0&&(d=d.slice(1)),d===".inf"?m===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:d===".nan"?NaN:m*parseFloat(d,10)}let a=/^[-+]?[0-9]+e/;function f(c,d){if(isNaN(c))switch(d){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===c)switch(d){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===c)switch(d){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(r.isNegativeZero(c))return"-0.0";let m=c.toString(10);return a.test(m)?m.replace("e",".e"):m}function u(c){return Object.prototype.toString.call(c)==="[object Number]"&&(c%1!==0||r.isNegativeZero(c))}return ht=new e("tag:yaml.org,2002:float",{kind:"scalar",resolve:o,construct:s,predicate:u,represent:f,defaultStyle:"lowercase"}),ht}var mt,hi;function Fi(){return hi||(hi=1,mt=Ti().extend({implicit:[Ri(),Ni(),Hi(),Ii()]})),mt}var gt,mi;function ji(){return mi||(mi=1,gt=Fi()),gt}var bt,gi;function Mi(){if(gi)return bt;gi=1;let r=ie(),e=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),t=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function i(a){return a===null?!1:e.exec(a)!==null||t.exec(a)!==null}function o(a){let f=0,u=null,c=e.exec(a);if(c===null&&(c=t.exec(a)),c===null)throw new Error("Date resolve error");let d=+c[1],m=+c[2]-1,g=+c[3];if(!c[4])return new Date(Date.UTC(d,m,g));let x=+c[4],$=+c[5],v=+c[6];if(c[7]){for(f=c[7].slice(0,3);f.length<3;)f+="0";f=+f}if(c[9]){let F=+c[10],M=+(c[11]||0);u=(F*60+M)*6e4,c[9]==="-"&&(u=-u)}let O=new Date(Date.UTC(d,m,g,x,$,v,f));return u&&O.setTime(O.getTime()-u),O}function s(a){return a.toISOString()}return bt=new r("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:i,construct:o,instanceOf:Date,represent:s}),bt}var yt,bi;function Li(){if(bi)return yt;bi=1;let r=ie();function e(t){return t==="<<"||t===null}return yt=new r("tag:yaml.org,2002:merge",{kind:"scalar",resolve:e}),yt}var wt,yi;function Pi(){if(yi)return wt;yi=1;let r=ie(),e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
30
|
+
\r`;function t(a){if(a===null)return!1;let f=0,u=a.length,c=e;for(let d=0;d<u;d++){let m=c.indexOf(a.charAt(d));if(!(m>64)){if(m<0)return!1;f+=6}}return f%8===0}function i(a){let f=a.replace(/[\r\n=]/g,""),u=f.length,c=e,d=0,m=[];for(let x=0;x<u;x++)x%4===0&&x&&(m.push(d>>16&255),m.push(d>>8&255),m.push(d&255)),d=d<<6|c.indexOf(f.charAt(x));let g=u%4*6;return g===0?(m.push(d>>16&255),m.push(d>>8&255),m.push(d&255)):g===18?(m.push(d>>10&255),m.push(d>>2&255)):g===12&&m.push(d>>4&255),new Uint8Array(m)}function o(a){let f="",u=0,c=a.length,d=e;for(let g=0;g<c;g++)g%3===0&&g&&(f+=d[u>>18&63],f+=d[u>>12&63],f+=d[u>>6&63],f+=d[u&63]),u=(u<<8)+a[g];let m=c%3;return m===0?(f+=d[u>>18&63],f+=d[u>>12&63],f+=d[u>>6&63],f+=d[u&63]):m===2?(f+=d[u>>10&63],f+=d[u>>4&63],f+=d[u<<2&63],f+=d[64]):m===1&&(f+=d[u>>2&63],f+=d[u<<4&63],f+=d[64],f+=d[64]),f}function s(a){return Object.prototype.toString.call(a)==="[object Uint8Array]"}return wt=new r("tag:yaml.org,2002:binary",{kind:"scalar",resolve:t,construct:i,predicate:s,represent:o}),wt}var _t,wi;function Di(){if(wi)return _t;wi=1;let r=ie(),e=Object.prototype.hasOwnProperty,t=Object.prototype.toString;function i(s){if(s===null)return!0;let a=[],f=s;for(let u=0,c=f.length;u<c;u+=1){let d=f[u],m=!1;if(t.call(d)!=="[object Object]")return!1;let g;for(g in d)if(e.call(d,g))if(!m)m=!0;else return!1;if(!m)return!1;if(a.indexOf(g)===-1)a.push(g);else return!1}return!0}function o(s){return s!==null?s:[]}return _t=new r("tag:yaml.org,2002:omap",{kind:"sequence",resolve:i,construct:o}),_t}var At,_i;function qi(){if(_i)return At;_i=1;let r=ie(),e=Object.prototype.toString;function t(o){if(o===null)return!0;let s=o,a=new Array(s.length);for(let f=0,u=s.length;f<u;f+=1){let c=s[f];if(e.call(c)!=="[object Object]")return!1;let d=Object.keys(c);if(d.length!==1)return!1;a[f]=[d[0],c[d[0]]]}return!0}function i(o){if(o===null)return[];let s=o,a=new Array(s.length);for(let f=0,u=s.length;f<u;f+=1){let c=s[f],d=Object.keys(c);a[f]=[d[0],c[d[0]]]}return a}return At=new r("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:t,construct:i}),At}var xt,Ai;function Bi(){if(Ai)return xt;Ai=1;let r=ie(),e=Object.prototype.hasOwnProperty;function t(o){if(o===null)return!0;let s=o;for(let a in s)if(e.call(s,a)&&s[a]!==null)return!1;return!0}function i(o){return o!==null?o:{}}return xt=new r("tag:yaml.org,2002:set",{kind:"mapping",resolve:t,construct:i}),xt}var Ct,xi;function St(){return xi||(xi=1,Ct=ji().extend({implicit:[Mi(),Li()],explicit:[Pi(),Di(),qi(),Bi()]})),Ct}var Ci;function Br(){if(Ci)return En;Ci=1;let r=Qe(),e=Ze(),t=qr(),i=St(),o=Object.prototype.hasOwnProperty,s=1,a=2,f=3,u=4,c=1,d=2,m=3,g=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,x=/[\x85\u2028\u2029]/,$=/[,\[\]{}]/,v=/^(?:!|!!|![0-9A-Za-z-]+!)$/,O=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function F(n){return Object.prototype.toString.call(n)}function M(n){return n===10||n===13}function P(n){return n===9||n===32}function D(n){return n===9||n===32||n===10||n===13}function W(n){return n===44||n===91||n===93||n===123||n===125}function oe(n){if(n>=48&&n<=57)return n-48;let p=n|32;return p>=97&&p<=102?p-97+10:-1}function te(n){return n===120?2:n===117?4:n===85?8:0}function we(n){return n>=48&&n<=57?n-48:-1}function ve(n){switch(n){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
|
|
31
|
+
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"\x85";case 95:return"\xA0";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function L(n){return n<=65535?String.fromCharCode(n):String.fromCharCode((n-65536>>10)+55296,(n-65536&1023)+56320)}function ae(n,p,y){p==="__proto__"?Object.defineProperty(n,p,{configurable:!0,enumerable:!0,writable:!0,value:y}):n[p]=y}let sn=new Array(256),Ue=new Array(256);for(let n=0;n<256;n++)sn[n]=ve(n)?1:0,Ue[n]=ve(n);function Z(n,p){this.input=n,this.filename=p.filename||null,this.schema=p.schema||i,this.onWarning=p.onWarning||null,this.legacy=p.legacy||!1,this.json=p.json||!1,this.listener=p.listener||null,this.maxDepth=typeof p.maxDepth=="number"?p.maxDepth:100,this.maxTotalMergeKeys=typeof p.maxTotalMergeKeys=="number"?p.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=n.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function ln(n,p){let y={name:n.filename,buffer:n.input.slice(0,-1),position:n.position,line:n.line,column:n.position-n.lineStart};return y.snippet=t(y),new e(p,y)}function N(n,p){throw ln(n,p)}function Re(n,p){n.onWarning&&n.onWarning.call(null,ln(n,p))}function ue(n,p,y){let A=n.anchorMapTransactions;if(A.length!==0){let b=A[A.length-1];o.call(b,p)||(b[p]={existed:o.call(n.anchorMap,p),value:n.anchorMap[p]})}n.anchorMap[p]=y}function In(n){n.anchorMapTransactions.push(Object.create(null))}function Ee(n){let p=n.anchorMapTransactions.pop(),y=n.anchorMapTransactions;if(y.length===0)return;let A=y[y.length-1],b=Object.keys(p);for(let E=0,l=b.length;E<l;E+=1){let h=b[E];o.call(A,h)||(A[h]=p[h])}}function Fn(n){let p=n.anchorMapTransactions.pop(),y=Object.keys(p);for(let A=y.length-1;A>=0;A-=1){let b=p[y[A]];b.existed?n.anchorMap[y[A]]=b.value:delete n.anchorMap[y[A]]}}function Ve(n){return{position:n.position,line:n.line,lineStart:n.lineStart,lineIndent:n.lineIndent,firstTabInLine:n.firstTabInLine,tag:n.tag,anchor:n.anchor,kind:n.kind,result:n.result}}function Ne(n,p){n.position=p.position,n.line=p.line,n.lineStart=p.lineStart,n.lineIndent=p.lineIndent,n.firstTabInLine=p.firstTabInLine,n.tag=p.tag,n.anchor=p.anchor,n.kind=p.kind,n.result=p.result}let an={YAML:function(p,y,A){p.version!==null&&N(p,"duplication of %YAML directive"),A.length!==1&&N(p,"YAML directive accepts exactly one argument");let b=/^([0-9]+)\.([0-9]+)$/.exec(A[0]);b===null&&N(p,"ill-formed argument of the YAML directive");let E=parseInt(b[1],10),l=parseInt(b[2],10);E!==1&&N(p,"unacceptable YAML version of the document"),p.version=A[0],p.checkLineBreaks=l<2,l!==1&&l!==2&&Re(p,"unsupported YAML version of the document")},TAG:function(p,y,A){let b;A.length!==2&&N(p,"TAG directive accepts exactly two arguments");let E=A[0];b=A[1],v.test(E)||N(p,"ill-formed tag handle (first argument) of the TAG directive"),o.call(p.tagMap,E)&&N(p,'there is a previously declared suffix for "'+E+'" tag handle'),O.test(b)||N(p,"ill-formed tag prefix (second argument) of the TAG directive");try{b=decodeURIComponent(b)}catch{N(p,"tag prefix is malformed: "+b)}p.tagMap[E]=b}};function re(n,p,y,A){if(p<y){let b=n.input.slice(p,y);if(A)for(let E=0,l=b.length;E<l;E+=1){let h=b.charCodeAt(E);h===9||h>=32&&h<=1114111||N(n,"expected valid JSON character")}else g.test(b)&&N(n,"the stream contains non-printable characters");n.result+=b}}function _e(n,p,y,A){r.isObject(y)||N(n,"cannot merge mappings; the provided source object is unacceptable");let b=Object.keys(y);for(let E=0,l=b.length;E<l;E+=1){let h=b[E];n.maxTotalMergeKeys!==-1&&++n.totalMergeKeys>n.maxTotalMergeKeys&&N(n,"merge keys exceeded maxTotalMergeKeys ("+n.maxTotalMergeKeys+")"),o.call(p,h)||(ae(p,h,y[h]),A[h]=!0)}}function fe(n,p,y,A,b,E,l,h,k){if(Array.isArray(b)){b=Array.prototype.slice.call(b);for(let w=0,_=b.length;w<_;w+=1)Array.isArray(b[w])&&N(n,"nested arrays are not supported inside keys"),typeof b=="object"&&F(b[w])==="[object Object]"&&(b[w]="[object Object]")}if(typeof b=="object"&&F(b)==="[object Object]"&&(b="[object Object]"),b=String(b),p===null&&(p={}),A==="tag:yaml.org,2002:merge")if(Array.isArray(E))for(let w=0,_=E.length;w<_;w+=1)_e(n,p,E[w],y);else _e(n,p,E,y);else!n.json&&!o.call(y,b)&&o.call(p,b)&&(n.line=l||n.line,n.lineStart=h||n.lineStart,n.position=k||n.position,N(n,"duplicated mapping key")),ae(p,b,E),delete y[b];return p}function He(n){let p=n.input.charCodeAt(n.position);p===10?n.position++:p===13?(n.position++,n.input.charCodeAt(n.position)===10&&n.position++):N(n,"a line break is expected"),n.line+=1,n.lineStart=n.position,n.firstTabInLine=-1}function z(n,p,y){let A=0,b=n.input.charCodeAt(n.position);for(;b!==0;){for(;P(b);)b===9&&n.firstTabInLine===-1&&(n.firstTabInLine=n.position),b=n.input.charCodeAt(++n.position);if(p&&b===35)do b=n.input.charCodeAt(++n.position);while(b!==10&&b!==13&&b!==0);if(M(b))for(He(n),b=n.input.charCodeAt(n.position),A++,n.lineIndent=0;b===32;)n.lineIndent++,b=n.input.charCodeAt(++n.position);else break}return y!==-1&&A!==0&&n.lineIndent<y&&Re(n,"deficient indentation"),A}function Ie(n){let p=n.position,y=n.input.charCodeAt(p);return!!((y===45||y===46)&&y===n.input.charCodeAt(p+1)&&y===n.input.charCodeAt(p+2)&&(p+=3,y=n.input.charCodeAt(p),y===0||D(y)))}function de(n,p){p===1?n.result+=" ":p>1&&(n.result+=r.repeat(`
|
|
32
|
+
`,p-1))}function cn(n,p,y){let A,b,E,l,h,k,w=n.kind,_=n.result,S=n.input.charCodeAt(n.position);if(D(S)||W(S)||S===35||S===38||S===42||S===33||S===124||S===62||S===39||S===34||S===37||S===64||S===96)return!1;if(S===63||S===45){let C=n.input.charCodeAt(n.position+1);if(D(C)||y&&W(C))return!1}for(n.kind="scalar",n.result="",A=b=n.position,E=!1;S!==0;){if(S===58){let C=n.input.charCodeAt(n.position+1);if(D(C)||y&&W(C))break}else if(S===35){let C=n.input.charCodeAt(n.position-1);if(D(C))break}else{if(n.position===n.lineStart&&Ie(n)||y&&W(S))break;if(M(S))if(l=n.line,h=n.lineStart,k=n.lineIndent,z(n,!1,-1),n.lineIndent>=p){E=!0,S=n.input.charCodeAt(n.position);continue}else{n.position=b,n.line=l,n.lineStart=h,n.lineIndent=k;break}}E&&(re(n,A,b,!1),de(n,n.line-l),A=b=n.position,E=!1),P(S)||(b=n.position+1),S=n.input.charCodeAt(++n.position)}return re(n,A,b,!1),n.result?!0:(n.kind=w,n.result=_,!1)}function un(n,p){let y,A,b=n.input.charCodeAt(n.position);if(b!==39)return!1;for(n.kind="scalar",n.result="",n.position++,y=A=n.position;(b=n.input.charCodeAt(n.position))!==0;)if(b===39)if(re(n,y,n.position,!0),b=n.input.charCodeAt(++n.position),b===39)y=n.position,n.position++,A=n.position;else return!0;else M(b)?(re(n,y,A,!0),de(n,z(n,!1,p)),y=A=n.position):n.position===n.lineStart&&Ie(n)?N(n,"unexpected end of the document within a single quoted scalar"):(n.position++,P(b)||(A=n.position));N(n,"unexpected end of the stream within a single quoted scalar")}function We(n,p){let y,A,b,E=n.input.charCodeAt(n.position);if(E!==34)return!1;for(n.kind="scalar",n.result="",n.position++,y=A=n.position;(E=n.input.charCodeAt(n.position))!==0;){if(E===34)return re(n,y,n.position,!0),n.position++,!0;if(E===92){if(re(n,y,n.position,!0),E=n.input.charCodeAt(++n.position),M(E))z(n,!1,p);else if(E<256&&sn[E])n.result+=Ue[E],n.position++;else if((b=te(E))>0){let l=b,h=0;for(;l>0;l--)E=n.input.charCodeAt(++n.position),(b=oe(E))>=0?h=(h<<4)+b:N(n,"expected hexadecimal character");n.result+=L(h),n.position++}else N(n,"unknown escape sequence");y=A=n.position}else M(E)?(re(n,y,A,!0),de(n,z(n,!1,p)),y=A=n.position):n.position===n.lineStart&&Ie(n)?N(n,"unexpected end of the document within a double quoted scalar"):(n.position++,P(E)||(A=n.position))}N(n,"unexpected end of the stream within a double quoted scalar")}function fn(n,p){let y=!0,A,b,E,l=n.tag,h,k=n.anchor,w,_,S,C,R=Object.create(null),T,H,j,q=n.input.charCodeAt(n.position);if(q===91)w=93,C=!1,h=[];else if(q===123)w=125,C=!0,h={};else return!1;for(n.anchor!==null&&ue(n,n.anchor,h),q=n.input.charCodeAt(++n.position);q!==0;){if(z(n,!0,p),q=n.input.charCodeAt(n.position),q===w)return n.position++,n.tag=l,n.anchor=k,n.kind=C?"mapping":"sequence",n.result=h,!0;if(y?q===44&&N(n,"expected the node content, but found ','"):N(n,"missed comma between flow collection entries"),H=T=j=null,_=S=!1,q===63){let G=n.input.charCodeAt(n.position+1);D(G)&&(_=S=!0,n.position++,z(n,!0,p))}A=n.line,b=n.lineStart,E=n.position,he(n,p,s,!1,!0),H=n.tag,T=n.result,z(n,!0,p),q=n.input.charCodeAt(n.position),(S||n.line===A)&&q===58&&(_=!0,q=n.input.charCodeAt(++n.position),z(n,!0,p),he(n,p,s,!1,!0),j=n.result),C?fe(n,h,R,H,T,j,A,b,E):_?h.push(fe(n,null,R,H,T,j,A,b,E)):h.push(T),z(n,!0,p),q=n.input.charCodeAt(n.position),q===44?(y=!0,q=n.input.charCodeAt(++n.position)):y=!1}N(n,"unexpected end of the stream within a flow collection")}function dn(n,p){let y,A=c,b=!1,E=!1,l=p,h=0,k=!1,w,_=n.input.charCodeAt(n.position);if(_===124)y=!1;else if(_===62)y=!0;else return!1;for(n.kind="scalar",n.result="";_!==0;)if(_=n.input.charCodeAt(++n.position),_===43||_===45)c===A?A=_===43?m:d:N(n,"repeat of a chomping mode identifier");else if((w=we(_))>=0)w===0?N(n,"bad explicit indentation width of a block scalar; it cannot be less than one"):E?N(n,"repeat of an indentation width identifier"):(l=p+w-1,E=!0);else break;if(P(_)){do _=n.input.charCodeAt(++n.position);while(P(_));if(_===35)do _=n.input.charCodeAt(++n.position);while(!M(_)&&_!==0)}for(;_!==0;){for(He(n),n.lineIndent=0,_=n.input.charCodeAt(n.position);(!E||n.lineIndent<l)&&_===32;)n.lineIndent++,_=n.input.charCodeAt(++n.position);if(!E&&n.lineIndent>l&&(l=n.lineIndent),M(_)){h++;continue}if(!E&&l===0&&N(n,"missing indentation for block scalar"),n.lineIndent<l){A===m?n.result+=r.repeat(`
|
|
33
33
|
`,b?1+h:h):A===c&&b&&(n.result+=`
|
|
34
34
|
`);break}y?P(_)?(k=!0,n.result+=r.repeat(`
|
|
35
35
|
`,b?1+h:h)):k?(k=!1,n.result+=r.repeat(`
|
|
36
36
|
`,h+1)):h===0?b&&(n.result+=" "):n.result+=r.repeat(`
|
|
37
37
|
`,h):n.result+=r.repeat(`
|
|
38
|
-
`,b?1+h:h),b=!0,
|
|
39
|
-
`),n.charCodeAt(0)===65279&&(n=n.slice(1)));let y=new Z(n,p),A=n.indexOf("\0");for(A!==-1&&(y.position=A,N(y,"null byte is not allowed in input")),y.input+="\0";y.input.charCodeAt(y.position)===32;)y.lineIndent+=1,y.position+=1;for(;y.position<y.length-1;)Ln(y);return y.documents}function bn(n,p,y){p!==null&&typeof p=="object"&&typeof y>"u"&&(y=p,p=null);let A=gn(n,y);if(typeof p!="function")return A;for(let b=0,
|
|
38
|
+
`,b?1+h:h),b=!0,E=!0,h=0;let S=n.position;for(;!M(_)&&_!==0;)_=n.input.charCodeAt(++n.position);re(n,S,n.position,!1)}return!0}function pe(n,p){let y=n.tag,A=n.anchor,b=[],E=!1;if(n.firstTabInLine!==-1)return!1;n.anchor!==null&&ue(n,n.anchor,b);let l=n.input.charCodeAt(n.position);for(;l!==0&&(n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,N(n,"tab characters must not be used in indentation")),l===45);){let h=n.input.charCodeAt(n.position+1);if(!D(h))break;if(E=!0,n.position++,z(n,!0,-1)&&n.lineIndent<=p){b.push(null),l=n.input.charCodeAt(n.position);continue}let k=n.line;if(he(n,p,f,!1,!0),b.push(n.result),z(n,!0,-1),l=n.input.charCodeAt(n.position),(n.line===k||n.lineIndent>p)&&l!==0)N(n,"bad indentation of a sequence entry");else if(n.lineIndent<p)break}return E?(n.tag=y,n.anchor=A,n.kind="sequence",n.result=b,!0):!1}function pn(n,p,y){let A,b,E,l,h=n.tag,k=n.anchor,w={},_=Object.create(null),S=null,C=null,R=null,T=!1,H=!1;if(n.firstTabInLine!==-1)return!1;n.anchor!==null&&ue(n,n.anchor,w);let j=n.input.charCodeAt(n.position);for(;j!==0;){!T&&n.firstTabInLine!==-1&&(n.position=n.firstTabInLine,N(n,"tab characters must not be used in indentation"));let q=n.input.charCodeAt(n.position+1),G=n.line;if((j===63||j===58)&&D(q))j===63?(T&&(fe(n,w,_,S,C,null,b,E,l),S=C=R=null),H=!0,T=!0,A=!0):T?(T=!1,A=!0):N(n,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),n.position+=1,j=q;else{if(b=n.line,E=n.lineStart,l=n.position,!he(n,y,a,!1,!0))break;if(n.line===G){for(j=n.input.charCodeAt(n.position);P(j);)j=n.input.charCodeAt(++n.position);if(j===58)j=n.input.charCodeAt(++n.position),D(j)||N(n,"a whitespace character is expected after the key-value separator within a block mapping"),T&&(fe(n,w,_,S,C,null,b,E,l),S=C=R=null),H=!0,T=!1,A=!1,S=n.tag,C=n.result;else if(H)N(n,"can not read an implicit mapping pair; a colon is missed");else return n.tag=h,n.anchor=k,!0}else if(H)N(n,"can not read a block mapping entry; a multiline key may not be an implicit key");else return n.tag=h,n.anchor=k,!0}if((n.line===G||n.lineIndent>p)&&(T&&(b=n.line,E=n.lineStart,l=n.position),he(n,p,u,!0,A)&&(T?C=n.result:R=n.result),T||(fe(n,w,_,S,C,R,b,E,l),S=C=R=null),z(n,!0,-1),j=n.input.charCodeAt(n.position)),(n.line===G||n.lineIndent>p)&&j!==0)N(n,"bad indentation of a mapping entry");else if(n.lineIndent<p)break}return T&&fe(n,w,_,S,C,null,b,E,l),H&&(n.tag=h,n.anchor=k,n.kind="mapping",n.result=w),H}function jn(n){let p=!1,y=!1,A,b,E=n.input.charCodeAt(n.position);if(E!==33)return!1;n.tag!==null&&N(n,"duplication of a tag property"),E=n.input.charCodeAt(++n.position),E===60?(p=!0,E=n.input.charCodeAt(++n.position)):E===33?(y=!0,A="!!",E=n.input.charCodeAt(++n.position)):A="!";let l=n.position;if(p){do E=n.input.charCodeAt(++n.position);while(E!==0&&E!==62);n.position<n.length?(b=n.input.slice(l,n.position),E=n.input.charCodeAt(++n.position)):N(n,"unexpected end of the stream within a verbatim tag")}else{for(;E!==0&&!D(E);)E===33&&(y?N(n,"tag suffix cannot contain exclamation marks"):(A=n.input.slice(l-1,n.position+1),v.test(A)||N(n,"named tag handle cannot contain such characters"),y=!0,l=n.position+1)),E=n.input.charCodeAt(++n.position);b=n.input.slice(l,n.position),$.test(b)&&N(n,"tag suffix cannot contain flow indicator characters")}b&&!O.test(b)&&N(n,"tag name cannot contain such characters: "+b);try{b=decodeURIComponent(b)}catch{N(n,"tag name is malformed: "+b)}return p?n.tag=b:o.call(n.tagMap,A)?n.tag=n.tagMap[A]+b:A==="!"?n.tag="!"+b:A==="!!"?n.tag="tag:yaml.org,2002:"+b:N(n,'undeclared tag handle "'+A+'"'),!0}function hn(n){let p=n.input.charCodeAt(n.position);if(p!==38)return!1;n.anchor!==null&&N(n,"duplication of an anchor property"),p=n.input.charCodeAt(++n.position);let y=n.position;for(;p!==0&&!D(p)&&!W(p);)p=n.input.charCodeAt(++n.position);return n.position===y&&N(n,"name of an anchor node must contain at least one character"),n.anchor=n.input.slice(y,n.position),!0}function mn(n){let p=n.input.charCodeAt(n.position);if(p!==42)return!1;p=n.input.charCodeAt(++n.position);let y=n.position;for(;p!==0&&!D(p)&&!W(p);)p=n.input.charCodeAt(++n.position);n.position===y&&N(n,"name of an alias node must contain at least one character");let A=n.input.slice(y,n.position);return o.call(n.anchorMap,A)||N(n,'unidentified alias "'+A+'"'),n.result=n.anchorMap[A],z(n,!0,-1),!0}function Mn(n,p,y,A){let b=Ve(n);return In(n),Ne(n,p),n.tag=null,n.anchor=null,n.kind=null,n.result=null,pn(n,y,A)&&n.kind==="mapping"?(Ee(n),!0):(Fn(n),Ne(n,b),!1)}function he(n,p,y,A,b){let E,l,h=1,k=!1,w=!1,_=null,S,C,R;n.depth>=n.maxDepth&&N(n,"nesting exceeded maxDepth ("+n.maxDepth+")"),n.depth+=1,n.listener!==null&&n.listener("open",n),n.tag=null,n.anchor=null,n.kind=null,n.result=null;let T=E=l=u===y||f===y;if(A&&z(n,!0,-1)&&(k=!0,n.lineIndent>p?h=1:n.lineIndent===p?h=0:n.lineIndent<p&&(h=-1)),h===1)for(;;){let H=n.input.charCodeAt(n.position),j=Ve(n);if(k&&(H===33&&n.tag!==null||H===38&&n.anchor!==null)||!jn(n)&&!hn(n))break;_===null&&(_=j),z(n,!0,-1)?(k=!0,l=T,n.lineIndent>p?h=1:n.lineIndent===p?h=0:n.lineIndent<p&&(h=-1)):l=!1}if(l&&(l=k||b),h===1||u===y)if(s===y||a===y?C=p:C=p+1,R=n.position-n.lineStart,h===1)if(l&&(pe(n,R)||pn(n,R,C))||fn(n,C))w=!0;else{let H=n.input.charCodeAt(n.position);_!==null&&T&&!l&&H!==124&&H!==62&&Mn(n,_,_.position-_.lineStart,C)||E&&dn(n,C)||un(n,C)||We(n,C)?w=!0:mn(n)?(w=!0,(n.tag!==null||n.anchor!==null)&&N(n,"alias node should not have any properties")):cn(n,C,s===y)&&(w=!0,n.tag===null&&(n.tag="?")),n.anchor!==null&&ue(n,n.anchor,n.result)}else h===0&&(w=l&&pe(n,R));if(n.tag===null)n.anchor!==null&&ue(n,n.anchor,n.result);else if(n.tag==="?"){n.result!==null&&n.kind!=="scalar"&&N(n,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+n.kind+'"');for(let H=0,j=n.implicitTypes.length;H<j;H+=1)if(S=n.implicitTypes[H],S.resolve(n.result)){n.result=S.construct(n.result),n.tag=S.tag,n.anchor!==null&&ue(n,n.anchor,n.result);break}}else if(n.tag!=="!"){if(o.call(n.typeMap[n.kind||"fallback"],n.tag))S=n.typeMap[n.kind||"fallback"][n.tag];else{S=null;let H=n.typeMap.multi[n.kind||"fallback"];for(let j=0,q=H.length;j<q;j+=1)if(n.tag.slice(0,H[j].tag.length)===H[j].tag){S=H[j];break}}S||N(n,"unknown tag !<"+n.tag+">"),n.result!==null&&S.kind!==n.kind&&N(n,"unacceptable node kind for !<"+n.tag+'> tag; it should be "'+S.kind+'", not "'+n.kind+'"'),S.resolve(n.result,n.tag)?(n.result=S.construct(n.result,n.tag),n.anchor!==null&&ue(n,n.anchor,n.result)):N(n,"cannot resolve a node with !<"+n.tag+"> explicit tag")}return n.listener!==null&&n.listener("close",n),n.depth-=1,n.tag!==null||n.anchor!==null||w}function Ln(n){let p=n.position,y=!1,A;for(n.version=null,n.checkLineBreaks=n.legacy,n.tagMap=Object.create(null),n.anchorMap=Object.create(null);(A=n.input.charCodeAt(n.position))!==0&&(z(n,!0,-1),A=n.input.charCodeAt(n.position),!(n.lineIndent>0||A!==37));){y=!0,A=n.input.charCodeAt(++n.position);let b=n.position;for(;A!==0&&!D(A);)A=n.input.charCodeAt(++n.position);let E=n.input.slice(b,n.position),l=[];for(E.length<1&&N(n,"directive name must not be less than one character in length");A!==0;){for(;P(A);)A=n.input.charCodeAt(++n.position);if(A===35){do A=n.input.charCodeAt(++n.position);while(A!==0&&!M(A));break}if(M(A))break;for(b=n.position;A!==0&&!D(A);)A=n.input.charCodeAt(++n.position);l.push(n.input.slice(b,n.position))}A!==0&&He(n),o.call(an,E)?an[E](n,E,l):Re(n,'unknown document directive "'+E+'"')}if(z(n,!0,-1),n.lineIndent===0&&n.input.charCodeAt(n.position)===45&&n.input.charCodeAt(n.position+1)===45&&n.input.charCodeAt(n.position+2)===45?(n.position+=3,z(n,!0,-1)):y&&N(n,"directives end mark is expected"),he(n,n.lineIndent-1,u,!1,!0),z(n,!0,-1),n.checkLineBreaks&&x.test(n.input.slice(p,n.position))&&Re(n,"non-ASCII line breaks are interpreted as content"),n.documents.push(n.result),n.position===n.lineStart&&Ie(n)){n.input.charCodeAt(n.position)===46&&(n.position+=3,z(n,!0,-1));return}n.position<n.length-1&&N(n,"end of the stream or a document separator is expected")}function gn(n,p){n=String(n),p=p||{},n.length!==0&&(n.charCodeAt(n.length-1)!==10&&n.charCodeAt(n.length-1)!==13&&(n+=`
|
|
39
|
+
`),n.charCodeAt(0)===65279&&(n=n.slice(1)));let y=new Z(n,p),A=n.indexOf("\0");for(A!==-1&&(y.position=A,N(y,"null byte is not allowed in input")),y.input+="\0";y.input.charCodeAt(y.position)===32;)y.lineIndent+=1,y.position+=1;for(;y.position<y.length-1;)Ln(y);return y.documents}function bn(n,p,y){p!==null&&typeof p=="object"&&typeof y>"u"&&(y=p,p=null);let A=gn(n,y);if(typeof p!="function")return A;for(let b=0,E=A.length;b<E;b+=1)p(A[b])}function Pn(n,p){let y=gn(n,p);if(y.length!==0){if(y.length===1)return y[0];throw new e("expected a single document in the stream, but found more")}}return En.loadAll=bn,En.load=Pn,En}var kt={},ki;function Ur(){if(ki)return kt;ki=1;let r=Qe(),e=Ze(),t=St(),i=Object.prototype.toString,o=Object.prototype.hasOwnProperty,s=65279,a=9,f=10,u=13,c=32,d=33,m=34,g=35,x=37,$=38,v=39,O=42,F=44,M=45,P=58,D=61,W=62,oe=63,te=64,we=91,ve=93,L=96,ae=123,sn=124,Ue=125,Z={};Z[0]="\\0",Z[7]="\\a",Z[8]="\\b",Z[9]="\\t",Z[10]="\\n",Z[11]="\\v",Z[12]="\\f",Z[13]="\\r",Z[27]="\\e",Z[34]='\\"',Z[92]="\\\\",Z[133]="\\N",Z[160]="\\_",Z[8232]="\\L",Z[8233]="\\P";let ln=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],N=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Re(l,h){if(h===null)return{};let k={},w=Object.keys(h);for(let _=0,S=w.length;_<S;_+=1){let C=w[_],R=String(h[C]);C.slice(0,2)==="!!"&&(C="tag:yaml.org,2002:"+C.slice(2));let T=l.compiledTypeMap.fallback[C];T&&o.call(T.styleAliases,R)&&(R=T.styleAliases[R]),k[C]=R}return k}function ue(l){let h,k,w=l.toString(16).toUpperCase();if(l<=255)h="x",k=2;else if(l<=65535)h="u",k=4;else if(l<=4294967295)h="U",k=8;else throw new e("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+h+r.repeat("0",k-w.length)+w}let In=1,Ee=2;function Fn(l){this.schema=l.schema||t,this.indent=Math.max(1,l.indent||2),this.noArrayIndent=l.noArrayIndent||!1,this.skipInvalid=l.skipInvalid||!1,this.flowLevel=r.isNothing(l.flowLevel)?-1:l.flowLevel,this.styleMap=Re(this.schema,l.styles||null),this.sortKeys=l.sortKeys||!1,this.lineWidth=l.lineWidth||80,this.noRefs=l.noRefs||!1,this.noCompatMode=l.noCompatMode||!1,this.condenseFlow=l.condenseFlow||!1,this.quotingType=l.quotingType==='"'?Ee:In,this.forceQuotes=l.forceQuotes||!1,this.replacer=typeof l.replacer=="function"?l.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Ve(l,h){let k=r.repeat(" ",h),w=0,_="",S=l.length;for(;w<S;){let C,R=l.indexOf(`
|
|
40
40
|
`,w);R===-1?(C=l.slice(w),w=S):(C=l.slice(w,R+1),w=R+1),C.length&&C!==`
|
|
41
41
|
`&&(_+=k),_+=C}return _}function Ne(l,h){return`
|
|
42
|
-
`+r.repeat(" ",l.indent*h)}function an(l,h){for(let k=0,w=l.implicitTypes.length;k<w;k+=1)if(l.implicitTypes[k].resolve(h))return!0;return!1}function re(l){return l===c||l===a}function _e(l){return l>=32&&l<=126||l>=161&&l<=55295&&l!==8232&&l!==8233||l>=57344&&l<=65533&&l!==s||l>=65536&&l<=1114111}function fe(l){return _e(l)&&l!==s&&l!==u&&l!==f}function He(l,h,k){let w=fe(l),_=w&&!re(l);return(k?w:w&&l!==F&&l!==we&&l!==
|
|
42
|
+
`+r.repeat(" ",l.indent*h)}function an(l,h){for(let k=0,w=l.implicitTypes.length;k<w;k+=1)if(l.implicitTypes[k].resolve(h))return!0;return!1}function re(l){return l===c||l===a}function _e(l){return l>=32&&l<=126||l>=161&&l<=55295&&l!==8232&&l!==8233||l>=57344&&l<=65533&&l!==s||l>=65536&&l<=1114111}function fe(l){return _e(l)&&l!==s&&l!==u&&l!==f}function He(l,h,k){let w=fe(l),_=w&&!re(l);return(k?w:w&&l!==F&&l!==we&&l!==ve&&l!==ae&&l!==Ue)&&l!==g&&!(h===P&&!_)||fe(h)&&!re(h)&&l===g||h===P&&_}function z(l){return _e(l)&&l!==s&&!re(l)&&l!==M&&l!==oe&&l!==P&&l!==F&&l!==we&&l!==ve&&l!==ae&&l!==Ue&&l!==g&&l!==$&&l!==O&&l!==d&&l!==sn&&l!==D&&l!==W&&l!==v&&l!==m&&l!==x&&l!==te&&l!==L}function Ie(l){return!re(l)&&l!==P}function de(l,h){let k=l.charCodeAt(h),w;return k>=55296&&k<=56319&&h+1<l.length&&(w=l.charCodeAt(h+1),w>=56320&&w<=57343)?(k-55296)*1024+w-56320+65536:k}function cn(l){return/^\n* /.test(l)}let un=1,We=2,fn=3,dn=4,pe=5;function pn(l,h,k,w,_,S,C,R){let T,H=0,j=null,q=!1,G=!1,Nt=w!==-1,Ge=-1,Ye=z(de(l,0))&&Ie(de(l,l.length-1));if(h||C)for(T=0;T<l.length;H>=65536?T+=2:T++){if(H=de(l,T),!_e(H))return pe;Ye=Ye&&He(H,j,R),j=H}else{for(T=0;T<l.length;H>=65536?T+=2:T++){if(H=de(l,T),H===f)q=!0,Nt&&(G=G||T-Ge-1>w&&l[Ge+1]!==" ",Ge=T);else if(!_e(H))return pe;Ye=Ye&&He(H,j,R),j=H}G=G||Nt&&T-Ge-1>w&&l[Ge+1]!==" "}return!q&&!G?Ye&&!C&&!_(l)?un:S===Ee?pe:We:k>9&&cn(l)?pe:C?S===Ee?pe:We:G?dn:fn}function jn(l,h,k,w,_){l.dump=(function(){if(h.length===0)return l.quotingType===Ee?'""':"''";if(!l.noCompatMode&&(ln.indexOf(h)!==-1||N.test(h)))return l.quotingType===Ee?'"'+h+'"':"'"+h+"'";let S=l.indent*Math.max(1,k),C=l.lineWidth===-1?-1:Math.max(Math.min(l.lineWidth,40),l.lineWidth-S),R=w||l.flowLevel>-1&&k>=l.flowLevel;function T(H){return an(l,H)}switch(pn(h,R,l.indent,C,T,l.quotingType,l.forceQuotes&&!w,_)){case un:return h;case We:return"'"+h.replace(/'/g,"''")+"'";case fn:return"|"+hn(h,l.indent)+mn(Ve(h,S));case dn:return">"+hn(h,l.indent)+mn(Ve(Mn(h,C),S));case pe:return'"'+Ln(h)+'"';default:throw new e("impossible error: invalid scalar style")}})()}function hn(l,h){let k=cn(l)?String(h):"",w=l[l.length-1]===`
|
|
43
43
|
`,S=w&&(l[l.length-2]===`
|
|
44
44
|
`||l===`
|
|
45
45
|
`)?"+":w?"":"-";return k+S+`
|
|
46
46
|
`}function mn(l){return l[l.length-1]===`
|
|
47
|
-
`?l.slice(0,-1):l}function
|
|
47
|
+
`?l.slice(0,-1):l}function Mn(l,h){let k=/(\n+)([^\n]*)/g,w=(function(){let R=l.indexOf(`
|
|
48
48
|
`);return R=R!==-1?R:l.length,k.lastIndex=R,he(l.slice(0,R),h)})(),_=l[0]===`
|
|
49
49
|
`||l[0]===" ",S,C;for(;C=k.exec(l);){let R=C[1],T=C[2];S=T[0]===" ",w+=R+(!_&&!S&&T!==""?`
|
|
50
50
|
`:"")+he(T,h),_=S}return w}function he(l,h){if(l===""||l[0]===" ")return l;let k=/ [^ ]/g,w,_=0,S,C=0,R=0,T="";for(;w=k.exec(l);)R=w.index,R-_>h&&(S=C>_?C:R,T+=`
|
|
51
51
|
`+l.slice(_,S),_=S+1),C=R;return T+=`
|
|
52
52
|
`,l.length-_>h&&C>_?T+=l.slice(_,C)+`
|
|
53
|
-
`+l.slice(C+1):T+=l.slice(_),T.slice(1)}function Ln(l){let h="",k=0;for(let w=0;w<l.length;k>=65536?w+=2:w++){k=de(l,w);let _=Z[k];!_&&_e(k)?(h+=l[w],k>=65536&&(h+=l[w+1])):h+=_||ue(k)}return h}function gn(l,h,k){let w="",_=l.tag;for(let S=0,C=k.length;S<C;S+=1){let R=k[S];l.replacer&&(R=l.replacer.call(k,String(S),R)),(y(l,h,R,!1,!1)||typeof R>"u"&&y(l,h,null,!1,!1))&&(w!==""&&(w+=","+(l.condenseFlow?"":" ")),w+=l.dump)}l.tag=_,l.dump="["+w+"]"}function bn(l,h,k,w){let _="",S=l.tag;for(let C=0,R=k.length;C<R;C+=1){let T=k[C];l.replacer&&(T=l.replacer.call(k,String(C),T)),(y(l,h+1,T,!0,!0,!1,!0)||typeof T>"u"&&y(l,h+1,null,!0,!0,!1,!0))&&((!w||_!=="")&&(_+=Ne(l,h)),l.dump&&f===l.dump.charCodeAt(0)?_+="-":_+="- ",_+=l.dump)}l.tag=S,l.dump=_||"[]"}function Pn(l,h,k){let w="",_=l.tag,S=Object.keys(k);for(let C=0,R=S.length;C<R;C+=1){let T="";w!==""&&(T+=", "),l.condenseFlow&&(T+='"');let H=S[C],
|
|
54
|
-
`:""}return kt.dump=
|
|
55
|
-
git config user.email "$GIT_EMAIL"`})}function en(r,e,t){return{uses:r.actionRef("agent-context"),id:"ctx",name:"Fetch context",with:{type:e,number:t,token:ge(r)}}}function Le(r,e){let t=r.node,i=r.config,o={"role-file":
|
|
56
|
-
`)})),i.push(
|
|
53
|
+
`+l.slice(C+1):T+=l.slice(_),T.slice(1)}function Ln(l){let h="",k=0;for(let w=0;w<l.length;k>=65536?w+=2:w++){k=de(l,w);let _=Z[k];!_&&_e(k)?(h+=l[w],k>=65536&&(h+=l[w+1])):h+=_||ue(k)}return h}function gn(l,h,k){let w="",_=l.tag;for(let S=0,C=k.length;S<C;S+=1){let R=k[S];l.replacer&&(R=l.replacer.call(k,String(S),R)),(y(l,h,R,!1,!1)||typeof R>"u"&&y(l,h,null,!1,!1))&&(w!==""&&(w+=","+(l.condenseFlow?"":" ")),w+=l.dump)}l.tag=_,l.dump="["+w+"]"}function bn(l,h,k,w){let _="",S=l.tag;for(let C=0,R=k.length;C<R;C+=1){let T=k[C];l.replacer&&(T=l.replacer.call(k,String(C),T)),(y(l,h+1,T,!0,!0,!1,!0)||typeof T>"u"&&y(l,h+1,null,!0,!0,!1,!0))&&((!w||_!=="")&&(_+=Ne(l,h)),l.dump&&f===l.dump.charCodeAt(0)?_+="-":_+="- ",_+=l.dump)}l.tag=S,l.dump=_||"[]"}function Pn(l,h,k){let w="",_=l.tag,S=Object.keys(k);for(let C=0,R=S.length;C<R;C+=1){let T="";w!==""&&(T+=", "),l.condenseFlow&&(T+='"');let H=S[C],j=k[H];l.replacer&&(j=l.replacer.call(k,H,j)),y(l,h,H,!1,!1)&&(l.dump.length>1024&&(T+="? "),T+=l.dump+(l.condenseFlow?'"':"")+":"+(l.condenseFlow?"":" "),y(l,h,j,!1,!1)&&(T+=l.dump,w+=T))}l.tag=_,l.dump="{"+w+"}"}function n(l,h,k,w){let _="",S=l.tag,C=Object.keys(k);if(l.sortKeys===!0)C.sort();else if(typeof l.sortKeys=="function")C.sort(l.sortKeys);else if(l.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let R=0,T=C.length;R<T;R+=1){let H="";(!w||_!=="")&&(H+=Ne(l,h));let j=C[R],q=k[j];if(l.replacer&&(q=l.replacer.call(k,j,q)),!y(l,h+1,j,!0,!0,!0))continue;let G=l.tag!==null&&l.tag!=="?"||l.dump&&l.dump.length>1024;G&&(l.dump&&f===l.dump.charCodeAt(0)?H+="?":H+="? "),H+=l.dump,G&&(H+=Ne(l,h)),y(l,h+1,q,!0,G)&&(l.dump&&f===l.dump.charCodeAt(0)?H+=":":H+=": ",H+=l.dump,_+=H)}l.tag=S,l.dump=_||"{}"}function p(l,h,k){let w=k?l.explicitTypes:l.implicitTypes;for(let _=0,S=w.length;_<S;_+=1){let C=w[_];if((C.instanceOf||C.predicate)&&(!C.instanceOf||typeof h=="object"&&h instanceof C.instanceOf)&&(!C.predicate||C.predicate(h))){if(k?C.multi&&C.representName?l.tag=C.representName(h):l.tag=C.tag:l.tag="?",C.represent){let R=l.styleMap[C.tag]||C.defaultStyle,T;if(i.call(C.represent)==="[object Function]")T=C.represent(h,R);else if(o.call(C.represent,R))T=C.represent[R](h,R);else throw new e("!<"+C.tag+'> tag resolver accepts not "'+R+'" style');l.dump=T}return!0}}return!1}function y(l,h,k,w,_,S,C){l.tag=null,l.dump=k,p(l,k,!1)||p(l,k,!0);let R=i.call(l.dump),T=w;w&&(w=l.flowLevel<0||l.flowLevel>h);let H=R==="[object Object]"||R==="[object Array]",j,q;if(H&&(j=l.duplicates.indexOf(k),q=j!==-1),(l.tag!==null&&l.tag!=="?"||q||l.indent!==2&&h>0)&&(_=!1),q&&l.usedDuplicates[j])l.dump="*ref_"+j;else{if(H&&q&&!l.usedDuplicates[j]&&(l.usedDuplicates[j]=!0),R==="[object Object]")w&&Object.keys(l.dump).length!==0?(n(l,h,l.dump,_),q&&(l.dump="&ref_"+j+l.dump)):(Pn(l,h,l.dump),q&&(l.dump="&ref_"+j+" "+l.dump));else if(R==="[object Array]")w&&l.dump.length!==0?(l.noArrayIndent&&!C&&h>0?bn(l,h-1,l.dump,_):bn(l,h,l.dump,_),q&&(l.dump="&ref_"+j+l.dump)):(gn(l,h,l.dump),q&&(l.dump="&ref_"+j+" "+l.dump));else if(R==="[object String]")l.tag!=="?"&&jn(l,l.dump,h,S,T);else{if(R==="[object Undefined]")return!1;if(l.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+R)}if(l.tag!==null&&l.tag!=="?"){let G=encodeURI(l.tag[0]==="!"?l.tag.slice(1):l.tag).replace(/!/g,"%21");l.tag[0]==="!"?G="!"+G:G.slice(0,18)==="tag:yaml.org,2002:"?G="!!"+G.slice(18):G="!<"+G+">",l.dump=G+" "+l.dump}}return!0}function A(l,h){let k=[],w=[];b(l,k,w);let _=w.length;for(let S=0;S<_;S+=1)h.duplicates.push(k[w[S]]);h.usedDuplicates=new Array(_)}function b(l,h,k){if(l!==null&&typeof l=="object"){let w=h.indexOf(l);if(w!==-1)k.indexOf(w)===-1&&k.push(w);else if(h.push(l),Array.isArray(l))for(let _=0,S=l.length;_<S;_+=1)b(l[_],h,k);else{let _=Object.keys(l);for(let S=0,C=_.length;S<C;S+=1)b(l[_[S]],h,k)}}}function E(l,h){h=h||{};let k=new Fn(h);k.noRefs||A(l,k);let w=l;return k.replacer&&(w=k.replacer.call({"":w},"",w)),y(k,0,w,!0,!0)?k.dump+`
|
|
54
|
+
`:""}return kt.dump=E,kt}var Si;function Vr(){if(Si)return ne;Si=1;let r=Br(),e=Ur();function t(i,o){return function(){throw new Error("Function yaml."+i+" is removed in js-yaml 4. Use yaml."+o+" instead, which is now safe by default.")}}return ne.Type=ie(),ne.Schema=vi(),ne.FAILSAFE_SCHEMA=Ti(),ne.JSON_SCHEMA=Fi(),ne.CORE_SCHEMA=ji(),ne.DEFAULT_SCHEMA=St(),ne.load=r.load,ne.loadAll=r.loadAll,ne.dump=e.dump,ne.YAMLException=Ze(),ne.types={binary:Pi(),float:Ii(),map:$i(),null:Ri(),pairs:qi(),set:Bi(),timestamp:Mi(),bool:Ni(),int:Hi(),merge:Li(),omap:Di(),seq:Oi(),str:Ei()},ne.safeLoad=t("safeLoad","load"),ne.safeLoadAll=t("safeLoadAll","loadAll"),ne.safeDump=t("safeDump","dump"),ne}var Wr=Vr(),Oe=Dr(Wr),{Type:ls,Schema:as,FAILSAFE_SCHEMA:cs,JSON_SCHEMA:us,CORE_SCHEMA:fs,DEFAULT_SCHEMA:ds,load:ps,loadAll:hs,dump:ms,YAMLException:gs,types:bs,safeLoad:ys,safeLoadAll:ws,safeDump:_s}=Oe;I();I();function On(r){return`\${{ secrets.${r} }}`}function je(r,e){if(!e)return"";let t=r.specDir?.replace(/\/+$/,"");return t?`${t}/${e}`:e}function ge(r){let e=Je(r.config);return e.mode==="app"?"${{ steps.app-token.outputs.token }}":e.mode==="pat"?On(e.tokenSecret??"AGENT_PAT"):"${{ github.token }}"}function $n(r){let e=Je(r.config);if(!(e.mode!=="app"||!e.appIdSecret||!e.appKeySecret))return{uses:"actions/create-github-app-token@v3",id:"app-token",name:"Mint app token",with:{"app-id":On(e.appIdSecret),"private-key":On(e.appKeySecret)}}}function Tn(r,e={}){let t={token:ge(r)};return e.ref&&(t.ref=e.ref),e.fetchDepth!==void 0&&(t["fetch-depth"]=e.fetchDepth),{uses:"actions/checkout@v5",name:"Checkout",with:t}}function Me(){return{uses:"./.github/agent-setup",name:"Setup agent toolchain"}}function Ui(r){let e=r.config.identity,t=e.git_name??e.bot_login??"gp-foundry agent",i=e.git_email??`${e.bot_login??"gp-foundry-agent"}@users.noreply.github.com`;return Ce({name:"Configure git identity",env:{GIT_NAME:t,GIT_EMAIL:i},run:`git config user.name "$GIT_NAME"
|
|
55
|
+
git config user.email "$GIT_EMAIL"`})}function en(r,e,t){return{uses:r.actionRef("agent-context"),id:"ctx",name:"Fetch context",with:{type:e,number:t,token:ge(r)}}}function Le(r,e){let t=r.node,i=r.config,o={"role-file":je(r,t.files.role),model:i.agent.model,"comms-file":je(r,"agents/communication.md"),"scope-path":je(r,"agents/scope.yaml"),"claude-code-oauth-token":On(i.agent.oauth_token_secret??"CLAUDE_CODE_OAUTH_TOKEN"),"github-token":ge(r)};e.withContext&&(o["context-file"]="${{ steps.ctx.outputs.context-file }}"),i.agent.conventions&&(o.conventions=i.agent.conventions);let s=t.files.prompt;return s&&(o["prompt-override-file"]=je(r,s)),{uses:r.actionRef("run-agent"),name:"Run agent",with:o}}function Ce(r){return{shell:"bash",...r}}var $e="${{ github.event.issue.number }}",nn="${{ github.event.pull_request.number }}",Et="${{ github.event.pull_request.head.sha }}",Vi="${{ github.event.pull_request.head.ref }}";function Pe(r,e){let t=r.attrs.timeout;return typeof t=="number"?t:e}function Rn(r,e){let t=[],i=$n(r);return i&&t.push(i),t.push(Tn(r,e)),t.push(Ui(r)),t}function vt(r){let e=r.node,t=e.context??"issue",i=t==="pr-diff"||t==="pr-review",o=i?{contents:"read","pull-requests":"write"}:{contents:"read",issues:"write"},s=[],a=$n(r);a&&s.push(a),s.push(Tn(r,i?{ref:Et,fetchDepth:0}:void 0));let f=typeof e.attrs.gates=="string"?e.attrs.gates:void 0;if(i&&f)for(let c of f.split(",").map(d=>d.trim()).filter(Boolean))s.push({uses:r.actionRef("wait-for-checks"),name:`Wait for ${c}`,with:{sha:Et,"workflow-name":c,token:ge(r)}});s.push(Me());let u=t==="pr-diff"?"pr-diff":t==="pr-review"?"pr-review":"issue";return s.push(en(r,u,i?nn:$e)),s.push(Le(r,{withContext:!0})),{jobId:e.id,name:e.id,permissions:o,timeoutMinutes:Pe(e,15),steps:s}}function Gr(r){let e=r.node,t=r.config,i=Rn(r);return i.push(Ce({id:"branch",name:"Create branch",env:{ISSUE_NUMBER:$e,ISSUE_TITLE:"${{ github.event.issue.title }}",PREFIX:t.repo.branch_prefix},run:[`SLUG=$(printf '%s' "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9-' | cut -c1-50 | sed 's/-$//')`,'BRANCH="$PREFIX$ISSUE_NUMBER-$SLUG"','git checkout -b "$BRANCH"','echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"'].join(`
|
|
56
|
+
`)})),i.push(Me()),i.push(en(r,"issue",$e)),i.push(Le(r,{withContext:!0})),i.push({uses:r.actionRef("agent-fallback"),name:"Fallback: commit / push / PR",if:"${{ !cancelled() }}",with:{branch:"${{ steps.branch.outputs.branch }}",token:ge(r),"agent-name":e.id,"base-branch":t.repo.base_branch,"issue-number":$e,"pr-title":"${{ github.event.issue.title }}","pr-body":`### \u{1F6E0}\uFE0F Auto-created (fallback)
|
|
57
57
|
|
|
58
58
|
The agent finished but didn't open a PR itself, so one was created automatically. See the commits and the linked issue for context.
|
|
59
59
|
|
|
60
60
|
Closes #${$e}`}}),{jobId:e.id,name:e.id,permissions:{contents:"write","pull-requests":"write",issues:"write"},timeoutMinutes:Pe(e,30),steps:i}}function Yr(r){let e=r.node,t=Rn(r,{ref:Vi,fetchDepth:0}),i=typeof e.attrs.max_attempts=="number"?e.attrs.max_attempts:3,o=`<!-- gp-foundry:attempt:${e.id} -->`,s=r.config.labels?.["needs-human"]??"needs-human";t.push(Ce({id:"attempts",name:`Enforce attempt budget (max ${i})`,env:{GH_TOKEN:ge(r),PR:nn,MARKER:o,MAX:String(i)},run:[`COUNT=$(gh pr view "$PR" --json comments --jq '[.comments[].body | select(contains("'"$MARKER"'"))] | length')`,'echo "attempts so far: $COUNT / $MAX"','if [ "$COUNT" -ge "$MAX" ]; then',` gh pr edit "$PR" --add-label "${s}" 2>/dev/null || gh api --method POST "repos/$GITHUB_REPOSITORY/issues/$PR/labels" -f 'labels[]=${s}'`,` gh pr comment "$PR" --body "$(printf '## \u26D4 Attempt budget (${e.id})\\n\\nExhausted (%s/%s) \u2014 labeling \`${s}\` and stopping. A human should take this over.\\n\\n%s' "$COUNT" "$MAX" "$MARKER")"`,' echo "exhausted=true" >> "$GITHUB_OUTPUT"',"else",` gh pr comment "$PR" --body "$(printf '%s attempt %s of %s' "$MARKER" "$((COUNT+1))" "$MAX")" >/dev/null`,' echo "exhausted=false" >> "$GITHUB_OUTPUT"',"fi"].join(`
|
|
61
|
-
`)}));let a="steps.attempts.outputs.exhausted != 'true'";return t.push({...
|
|
62
|
-
`)})),{jobId:e.id,name:e.id,permissions:{contents:"write","pull-requests":"write"},timeoutMinutes:Pe(e,30),steps:t}}function Kr(r){let e=r.node,t=Rn(r,{fetchDepth:0});return t.push({uses:r.actionRef("merge-gate"),name:"Evaluate merge gate",with:{token:ge(r),"policy-path":
|
|
63
|
-
`)})),{jobId:e.id,name:e.id,permissions:{contents:"write",issues:"write","pull-requests":"write",actions:"write"},timeoutMinutes:Pe(e,15),steps:i}}function Wi(r,e,t){let i=r.node,o=[],s=$n(r);s&&o.push(s),o.push(Tn(r,t?{ref:
|
|
61
|
+
`)}));let a="steps.attempts.outputs.exhausted != 'true'";return t.push({...Me(),if:a}),t.push({...en(r,"pr-review",nn),if:a}),t.push({...Le(r,{withContext:!0}),if:a}),t.push(Ce({name:"Commit and push fixes",if:`${a} && !cancelled()`,env:{BRANCH:Vi},run:["# Commit anything the agent left uncommitted...",'if [ -n "$(git status --porcelain)" ]; then'," git add -A",` git commit -m "agent fix: ${e.id}"`,"fi","# ...then push if HEAD is ahead of the remote (the agent may have committed itself).",'git fetch origin "$BRANCH" --quiet 2>/dev/null || true','if [ "$(git rev-parse HEAD)" != "$(git rev-parse "origin/$BRANCH" 2>/dev/null || echo none)" ]; then',' git push origin "HEAD:$BRANCH"',' echo "pushed fix to $BRANCH"',"else",' echo "no changes to push"',"fi"].join(`
|
|
62
|
+
`)})),{jobId:e.id,name:e.id,permissions:{contents:"write","pull-requests":"write"},timeoutMinutes:Pe(e,30),steps:t}}function Kr(r){let e=r.node,t=Rn(r,{fetchDepth:0});return t.push({uses:r.actionRef("merge-gate"),name:"Evaluate merge gate",with:{token:ge(r),"policy-path":je(r,e.files.policy),"base-branch":r.config.repo.base_branch,"branch-prefix":r.config.repo.branch_prefix}}),{jobId:e.id,name:e.id,permissions:{contents:"write","pull-requests":"write",issues:"write"},timeoutMinutes:Pe(e,10),steps:t}}function Jr(r){let e=r.node,t=String(e.attrs.environment??"production");return{jobId:e.id,name:e.id,permissions:{},environment:t,steps:[Ce({name:"Awaiting approval",run:`echo "Approved for ${t}."`})]}}function zr(r){let e=r.node,t=r.config,i=Rn(r,{fetchDepth:0});return i.push(Me()),i.push(Le(r,{withContext:!1})),i.push(Ce({name:"Commit changes",env:{BRANCH:t.repo.base_branch},run:['if [ -n "$(git status --porcelain)" ]; then'," git add -A",` git commit -m "chore(${e.id}): scheduled update"`,"fi",'git fetch origin "$BRANCH" --quiet 2>/dev/null || true','if [ "$(git rev-parse HEAD)" != "$(git rev-parse "origin/$BRANCH" 2>/dev/null || echo none)" ]; then',' git push origin "HEAD:$BRANCH"',' echo "pushed changes to $BRANCH"',"else",' echo "no changes to commit"',"fi"].join(`
|
|
63
|
+
`)})),{jobId:e.id,name:e.id,permissions:{contents:"write",issues:"write","pull-requests":"write",actions:"write"},timeoutMinutes:Pe(e,15),steps:i}}function Wi(r,e,t){let i=r.node,o=[],s=$n(r);s&&o.push(s),o.push(Tn(r,t?{ref:Et,fetchDepth:0}:void 0)),o.push(Me()),o.push(en(r,t?"pr-review":"issue",t?nn:$e)),i.files.role&&o.push(Le(r,{withContext:!0}));let a=i.attrs.on_complete_label;if(typeof a=="string"&&a){let f=r.config.labels?.[a]??a;o.push(Ce({name:"Apply completion label",env:{GH_TOKEN:ge(r),NUM:t?nn:$e},run:`gh api --method POST "repos/$GITHUB_REPOSITORY/issues/$NUM/labels" -f 'labels[]=${f}'`}))}return{jobId:i.id,name:i.id,needs:e,permissions:t?{contents:"read","pull-requests":"write",issues:"write"}:{contents:"read",issues:"write"},timeoutMinutes:Pe(i,15),steps:o}}var Xr={analyst:vt,"issue-agent":vt,"pr-review":vt,producer:Gr,"pr-fix":Yr,"merge-gate":Kr,"human-gate":Jr,"scheduled-agent":zr,start:()=>null,exit:()=>null};function Ot(r,e,t){let i=Xr[r.type];return i?i(t):null}var Qr="# GENERATED FROM harness.dot \u2014 DO NOT EDIT.\n# Edit harness.dot / roles / foundry.config.yaml and run `gp-foundry build`.\n";function Zr(r){let e=r.runtime??{};if(e.mode==="vendored")return o=>`./.github/actions/${o}`;let t=e.owner_repo??"thegpvc/gp-foundry",i=e.ref??"v1";return o=>`${t}/actions/${o}@${i}`}function eo(r){let e={};return r.name&&(e.name=r.name),r.id&&(e.id=r.id),r.if&&(e.if=r.if),zt(r)?(e.uses=r.uses,r.with&&Object.keys(r.with).length&&(e.with=r.with)):(r.shell&&(e.shell=r.shell),r.env&&Object.keys(r.env).length&&(e.env=r.env),e.run=r.run),e}function Gi(r){return String(r.attrs.name??r.id)}function Yi(r,e,t=""){let i=[],o=Zr(r.config),s=new Map(r.nodes.map(g=>[g.id,g])),a=new Map,f=new Map;for(let g of r.nodes)a.set(g.id,[]),f.set(g.id,[]);for(let g of r.edges)a.get(g.from)?.push(g),f.get(g.to)?.push(g);let u=g=>({config:r.config,node:g,outEdges:a.get(g.id)??[],inEdges:f.get(g.id)??[],actionRef:o,specDir:t}),c=(g,x)=>{let $={"runs-on":"ubuntu-latest"},v=g.if??x;return v&&($.if=v),g.environment&&($.environment=g.environment),g.permissions&&Object.keys(g.permissions).length&&($.permissions=g.permissions),g.timeoutMinutes&&($["timeout-minutes"]=g.timeoutMinutes),g.needs?.length&&($.needs=g.needs),g.strategy&&($.strategy=g.strategy),$.steps=g.steps.map(eo),$},d=(g,x)=>{let $=Oe.dump(x,{lineWidth:-1,noRefs:!0,quotingType:'"'});i.push({path:`.github/workflows/${g}.yml`,contents:Qr+$,generated:!0})},m=Fe(r);for(let g of r.nodes){if(m.memberIds.has(g.id))continue;let x=e.perNode[g.id];if(!x||Object.keys(x.triggers).length===0)continue;let $=m.byFanin.get(g.id);if($){let O={};for(let P of $.legIds){let D=s.get(P),W=Ot(D,r,u(D));W&&(O[W.jobId]=c(W,x.guard))}let F=JSON.stringify(x.triggers).includes('"pull_request"'),M=Wi(u(g),$.legIds,F);O[M.jobId]=c(M),d(g.id,{name:Gi(g),on:x.triggers,...x.concurrency?{concurrency:x.concurrency}:{},permissions:{contents:"read"},jobs:O});continue}let v=Ot(g,r,u(g));v&&d(g.id,{name:Gi(g),on:x.triggers,...x.concurrency?{concurrency:x.concurrency}:{},permissions:{contents:"read"},jobs:{[v.jobId]:c(v,x.guard)}})}return i}I();function no(r){switch(r.type){case"start":case"exit":return["([","])"];case"human-gate":return["{{","}}"];case"merge-gate":return["[/","/]"];case"parallel":case"fan_in":return["[[","]]"];default:return["[","]"]}}function to(r){let e=r.files.role?.replace(/^.*\//,"").replace(/\.md$/,""),t=e&&e!==r.id?`${e} \xB7 ${r.type}`:r.type;return`${r.id}<br/><small>${t}</small>`}function Nn(r){let e=["```mermaid","flowchart TD"];for(let t of r.nodes){let[i,o]=no(t);e.push(` ${t.id}${i}"${to(t)}"${o}`)}for(let t of r.edges){let i=[t.on,t.when].filter(Boolean).join(" \xB7 ");e.push(i?` ${t.from} -->|"${i}"| ${t.to}`:` ${t.from} --> ${t.to}`)}return e.push("```",""),`<!-- GENERATED FROM harness.dot \u2014 DO NOT EDIT. Run \`gp-foundry build\`. -->
|
|
64
64
|
|
|
65
65
|
# ${r.config?.name&&r.config.name!=="harness"?r.config.name:r.name} \u2014 agent harness
|
|
66
66
|
|
|
@@ -69,12 +69,12 @@ ${e.join(`
|
|
|
69
69
|
`){i++,o++;continue}if(a===" "||a===" "||a==="\r"){o++;continue}if(a==="/"&&s[o+1]==="/"){for(;o<s.length&&s[o]!==`
|
|
70
70
|
`;)o++;continue}if(a==="/"&&s[o+1]==="*"){for(o+=2;o<s.length&&!(s[o]==="*"&&s[o+1]==="/");)s[o]===`
|
|
71
71
|
`&&i++,o++;o+=2;continue}if(a==="-"&&s[o+1]===">"){e.push({kind:"arrow",value:"->",line:i}),o+=2;continue}if(a==="{"){e.push({kind:"lbrace",value:a,line:i}),o++;continue}if(a==="}"){e.push({kind:"rbrace",value:a,line:i}),o++;continue}if(a==="["){e.push({kind:"lbrack",value:a,line:i}),o++;continue}if(a==="]"){e.push({kind:"rbrack",value:a,line:i}),o++;continue}if(a==="="){e.push({kind:"eq",value:a,line:i}),o++;continue}if(a===","){e.push({kind:"comma",value:a,line:i}),o++;continue}if(a===";"){e.push({kind:"semi",value:a,line:i}),o++;continue}if(a==='"'){let f=o+1,u="";for(;f<s.length&&s[f]!=='"';){if(s[f]==="\\"&&f+1<s.length){u+=s[f+1],f+=2;continue}s[f]===`
|
|
72
|
-
`&&i++,u+=s[f],f++}f>=s.length&&t.push({message:"unterminated string",line:i}),e.push({kind:"id",value:u,line:i}),o=f+1;continue}if(/[A-Za-z0-9_]/.test(a)){let f=o,u="";for(;f<s.length&&/[A-Za-z0-9_.\-]/.test(s[f]);)u+=s[f],f++;e.push({kind:"id",value:u,line:i}),o=f;continue}t.push({message:`unexpected character '${a}'`,line:i}),o++}return{toks:e,errors:t}}function so(r){return r==="true"?!0:r==="false"?!1:/^-?\d+$/.test(r)?Number(r):r}function tn(r){let{toks:e,errors:t}=oo(r),i=[],o=[],s=new Map,a="harness",f=0,u=()=>e[f],c=()=>e[f++],d=(
|
|
72
|
+
`&&i++,u+=s[f],f++}f>=s.length&&t.push({message:"unterminated string",line:i}),e.push({kind:"id",value:u,line:i}),o=f+1;continue}if(/[A-Za-z0-9_]/.test(a)){let f=o,u="";for(;f<s.length&&/[A-Za-z0-9_.\-]/.test(s[f]);)u+=s[f],f++;e.push({kind:"id",value:u,line:i}),o=f;continue}t.push({message:`unexpected character '${a}'`,line:i}),o++}return{toks:e,errors:t}}function so(r){return r==="true"?!0:r==="false"?!1:/^-?\d+$/.test(r)?Number(r):r}function tn(r){let{toks:e,errors:t}=oo(r),i=[],o=[],s=new Map,a="harness",f=0,u=()=>e[f],c=()=>e[f++],d=(v,O)=>t.push({message:v,line:O});u()?.kind==="id"&&u()?.value==="digraph"?(c(),u()?.kind==="id"&&u()?.value!==void 0&&(a=c().value),u()?.kind==="lbrace"?c():d("expected '{' after digraph header",u()?.line)):d("expected 'digraph' keyword",u()?.line);function m(){let v={};if(u()?.kind!=="lbrack")return{attrs:v};let O=c().line;for(;u()&&u().kind!=="rbrack";){let F=c();if(!F||F.kind!=="id"){d("expected attribute name",F?.line);break}if(u()?.kind!=="eq"){d(`expected '=' after attribute '${F.value}'`,F.line);break}c();let M=c();if(!M||M.kind!=="id"){d(`expected value for attribute '${F.value}'`,M?.line);break}v[F.value]=M.value,u()?.kind==="comma"&&c()}return u()?.kind==="rbrack"?c():d("unterminated attribute list '['",O),{attrs:v,line:O}}function g(v,O){let F=s.get(v);return F||(F={id:v,type:"analyst",attrs:{},files:{},raw:{},line:O},s.set(v,F),i.push(F)),F}function x(v,O,F){v.declared=!0,v.raw={...v.raw,...O},F!==void 0&&(v.line=v.line??F);for(let[M,P]of Object.entries(O))M==="type"?(io.has(P)||d(`unknown node type '${P}' on node '${v.id}'`,F),v.type=P):M==="context"?v.context=P:ro.has(M)?v.files[M]=P:v.attrs[M]=so(P)}let $=0;for(;u()&&u().kind!=="rbrace"&&!($++>1e5);){let v=u();if(v.kind==="semi"){c();continue}if(v.kind!=="id"){d(`unexpected token '${v.value}'`,v.line),c();continue}let O=c();if(u()?.kind==="arrow"){let F=[{id:O.value,line:O.line}];for(;u()?.kind==="arrow";){c();let D=c();if(!D||D.kind!=="id"){d("expected node id after '->'",D?.line);break}F.push({id:D.value,line:D.line})}let{attrs:M,line:P}=m();for(let D=0;D+1<F.length;D++){let W=F[D],oe=F[D+1];g(W.id,W.line),g(oe.id,oe.line);let te={from:W.id,to:oe.id,raw:{...M},line:P??W.line};M.on!==void 0&&(te.on=M.on),M.when!==void 0&&(te.when=M.when),M.do!==void 0&&(te.do=M.do),o.push(te)}}else{let{attrs:F,line:M}=m(),P=g(O.value,O.line);x(P,F,M??O.line)}u()?.kind==="semi"&&c()}return u()?.kind==="rbrace"&&c(),{name:a,nodes:i,edges:o,errors:t}}I();var rn=require("fs");var De={name:"harness",identity:{},agent:{cli:"claude",model:"claude-opus-4-8",oauth_token_secret:"CLAUDE_CODE_OAUTH_TOKEN"},repo:{base_branch:"main",branch_prefix:"agent/"},labels:{}};function Hn(r){if(!r||!(0,rn.existsSync)(r))return structuredClone(De);let e=Oe.load((0,rn.readFileSync)(r,"utf8"))??{};return{...De,...e,identity:{...De.identity,...e.identity??{}},agent:{...De.agent,...e.agent??{}},repo:{...De.repo,...e.repo??{}},labels:{...De.labels,...e.labels??{}}}}function ce(r,e){let t=tn((0,rn.readFileSync)(r,"utf8")),i=Hn(e);return{harness:{name:t.name,nodes:t.nodes,edges:t.edges,config:i,sourcePath:r},parseErrors:t.errors}}function qe(r,e={},t={}){let i=[...ze(r,e),...Xe(r)],o=Yi(r,ei(r),t.specDir??"");return o.push({path:".github/HARNESS.md",contents:Nn(r),generated:!0}),{files:o,diagnostics:i}}function on(r){return r.some(e=>e.level==="error")}I();var lo=/^---\r?\n([\s\S]*?)\r?\n---/;function Ki(r){let e=lo.exec(r);if(e)try{let t=Oe.load(e[1]);if(t&&typeof t=="object")return t}catch{return}}I();var Ji=require("fs"),be=require("path"),zi=require("url"),Te=yn(Cn(),1);function le(r){return(0,zi.fileURLToPath)(new URL(`../../${r}`,V))}function K(r){process.stdout.write(JSON.stringify(r,null,2)+`
|
|
73
73
|
`)}function $t(r){for(let e of r){let t=e.level==="error"?Te.default.red("error"):e.level==="warning"?Te.default.yellow("warn"):Te.default.blue("info"),i=e.where?.node?Te.default.dim(` [${e.where.node}]`):"";process.stderr.write(`${t} ${Te.default.dim(e.code)}${i} ${e.message}
|
|
74
74
|
`),e.hint&&process.stderr.write(` ${Te.default.dim("hint: "+e.hint)}
|
|
75
75
|
`)}}function ye(r){let e=(0,be.resolve)(r.dot??".github/harness.dot"),t=(0,be.dirname)(e),i=r.config?(0,be.resolve)(r.config):void 0;if(!i){for(let s of[(0,be.join)(t,"foundry.config.yaml"),(0,be.join)(t,"agents/foundry.config.yaml")])if((0,Ji.existsSync)(s)){i=s;break}}let o=t.endsWith(".github")?(0,be.dirname)(t):t;return{dot:e,config:i,base:t,root:o}}I();var Tt=require("child_process"),U=require("fs"),J=require("path"),B=yn(Cn(),1);var Rt=require("path");function Be(r,e={}){try{return{ok:!0,out:(0,Tt.execFileSync)("gh",r,{encoding:"utf8",stdio:["ignore","pipe","pipe"],cwd:e.cwd}).trim()}}catch(t){return{ok:!1,out:t.stderr?.toString().trim()??String(t.message)}}}function ke(r,e){let t=Be(r,{cwd:e});if(!t.ok)return null;try{return JSON.parse(t.out)}catch{return null}}function er(){let r=le("actions");return(0,U.readdirSync)(r,{withFileTypes:!0}).filter(e=>e.isDirectory()&&(0,U.existsSync)((0,J.join)(r,e.name,"action.yml"))).map(e=>e.name)}function nr(r){let e=Hn(r),t=new Map([["build","ready to implement"],["plan","needs design first"]]),i=[];for(let[o,s]of t)i.push({name:e.labels?.[o]??o,description:s,color:o==="build"?"0e8a16":"5319e7"});return i.push({name:"needs-human",description:"agents are blocked; a human should take over",color:"b60205"}),i.push({name:"needs-rebase",description:"PR conflicts with base; the janitor sweep rebases it",color:"d93f0b"}),i}function Xi(r){let e={ok:B.default.green("\u2713"),warn:B.default.yellow("!"),fail:B.default.red("\u2717"),skip:B.default.dim("-")};for(let t of r)process.stdout.write(`${e[t.status]} ${t.name.padEnd(28)} ${t.detail}
|
|
76
76
|
`),t.hint&&t.status!=="ok"&&process.stdout.write(` ${B.default.dim("hint: "+t.hint)}
|
|
77
|
-
`)}function Qi(r){let e=[];for(let i of er()){let o=le(`actions/${i}`),s=(0,J.join)(r,".github/actions",i);(0,U.mkdirSync)(s,{recursive:!0}),(0,U.cpSync)((0,J.join)(o,"action.yml"),(0,J.join)(s,"action.yml")),(0,U.existsSync)((0,J.join)(o,"dist"))&&(0,U.cpSync)((0,J.join)(o,"dist"),(0,J.join)(s,"dist"),{recursive:!0}),e.push(`.github/actions/${i}/`)}let t=(0,J.join)(r,".github/agent-setup/action.yml");return(0,U.existsSync)(t)||((0,U.mkdirSync)((0,J.dirname)(t),{recursive:!0}),(0,U.writeFileSync)(t,(0,U.readFileSync)(le("skill/templates/agent-setup.yml"),"utf8")),e.push(".github/agent-setup/action.yml")),e}function ao(r){(0,U.mkdirSync)(r,{recursive:!0}),(0,U.cpSync)(le("skill/SKILL.md"),(0,J.join)(r,"SKILL.md")),(0,U.cpSync)(le("skill/reference"),(0,J.join)(r,"reference"),{recursive:!0}),(0,U.cpSync)(le("skill/templates"),(0,J.join)(r,"templates"),{recursive:!0})}function Zi(r){let e=[],{dot:t,config:i,base:o,root:s}=ye(r);if(!(0,U.existsSync)(t))return e.push({name:"harness",status:"fail",detail:`no harness.dot at ${t}`,hint:"run `gp-foundry init`"}),{checks:e,failed:!0};let{harness:a,parseErrors:f}=ce(t,i),u=L=>(0,U.existsSync)((0,J.join)(o,L)),c=(0,Rt.relative)(s,o).replace(/\\/g,"/"),{files:d,diagnostics:m}=qe(a,{fileExists:u},{specDir:c}),g=m.filter(L=>L.level==="error").length+f.length,x=m.filter(L=>L.level==="warning");e.push(g?{name:"validate",status:"fail",detail:`${g} error(s)`,hint:"run `gp-foundry validate` for details"}:{name:"validate",status:x.length?"warn":"ok",detail:x.length?`${x.length} warning(s): ${x.map(L=>L.code).join(", ")}`:"no diagnostics"});let $=d.filter(L=>{let ae=(0,J.join)(s,L.path);return((0,U.existsSync)(ae)?(0,U.readFileSync)(ae,"utf8"):null)!==L.contents});if(e.push($.length?{name:"workflows in sync",status:"fail",detail:`${$.length} file(s) drifted: ${$.slice(0,3).map(L=>L.path).join(", ")}${$.length>3?", \u2026":""}`,hint:"run `gp-foundry build`"}:{name:"workflows in sync",status:"ok",detail:`${d.length} generated files match`}),(a.config.runtime?.mode??"pinned")==="vendored"){let L=er().filter(ae=>!(0,U.existsSync)((0,J.join)(s,".github/actions",ae,"action.yml")));e.push(L.length?{name:"vendored actions",status:"fail",detail:`missing: ${L.join(", ")}`,hint:"run `gp-foundry vendor`"}:{name:"vendored actions",status:"ok",detail:"all runtime actions vendored"})}if(e.push((0,U.existsSync)((0,J.join)(s,".github/agent-setup/action.yml"))?{name:"agent-setup shim",status:"ok",detail:".github/agent-setup/action.yml present"}:{name:"agent-setup shim",status:"fail",detail:"missing \u2014 every agent job needs it",hint:"run `gp-foundry vendor` (or `init`)"}),!Be(["auth","status"]).ok)return e.push({name:"gh cli",status:"skip",detail:"gh missing or unauthenticated \u2014 skipping repo checks",hint:"install GitHub CLI and `gh auth login`"}),{checks:e,failed:e.some(L=>L.status==="fail")};e.push({name:"gh cli",status:"ok",detail:"authenticated"});let O=ke(["repo","view","--json","nameWithOwner,defaultBranchRef"],s);if(!O)return e.push({name:"github repo",status:"skip",detail:"not a GitHub repo (or no remote) \u2014 skipping labels/secrets checks",hint:"create it with `gh repo create`, then re-run `gp-foundry up` to create labels"}),{checks:e,failed:e.some(L=>L.status==="fail")};e.push({name:"github repo",status:"ok",detail:O.nameWithOwner});let F=O.defaultBranchRef?.name;F&&e.push(F===a.config.repo.base_branch?{name:"base branch",status:"ok",detail:F}:{name:"base branch",status:"fail",detail:`config says '${a.config.repo.base_branch}' but the repo default is '${F}'`,hint:"fix repo.base_branch in foundry.config.yaml and re-run `gp-foundry up`"});let
|
|
77
|
+
`)}function Qi(r){let e=[];for(let i of er()){let o=le(`actions/${i}`),s=(0,J.join)(r,".github/actions",i);(0,U.mkdirSync)(s,{recursive:!0}),(0,U.cpSync)((0,J.join)(o,"action.yml"),(0,J.join)(s,"action.yml")),(0,U.existsSync)((0,J.join)(o,"dist"))&&(0,U.cpSync)((0,J.join)(o,"dist"),(0,J.join)(s,"dist"),{recursive:!0}),e.push(`.github/actions/${i}/`)}let t=(0,J.join)(r,".github/agent-setup/action.yml");return(0,U.existsSync)(t)||((0,U.mkdirSync)((0,J.dirname)(t),{recursive:!0}),(0,U.writeFileSync)(t,(0,U.readFileSync)(le("skill/templates/agent-setup.yml"),"utf8")),e.push(".github/agent-setup/action.yml")),e}function ao(r){(0,U.mkdirSync)(r,{recursive:!0}),(0,U.cpSync)(le("skill/SKILL.md"),(0,J.join)(r,"SKILL.md")),(0,U.cpSync)(le("skill/reference"),(0,J.join)(r,"reference"),{recursive:!0}),(0,U.cpSync)(le("skill/templates"),(0,J.join)(r,"templates"),{recursive:!0})}function Zi(r){let e=[],{dot:t,config:i,base:o,root:s}=ye(r);if(!(0,U.existsSync)(t))return e.push({name:"harness",status:"fail",detail:`no harness.dot at ${t}`,hint:"run `gp-foundry init`"}),{checks:e,failed:!0};let{harness:a,parseErrors:f}=ce(t,i),u=L=>(0,U.existsSync)((0,J.join)(o,L)),c=(0,Rt.relative)(s,o).replace(/\\/g,"/"),{files:d,diagnostics:m}=qe(a,{fileExists:u},{specDir:c}),g=m.filter(L=>L.level==="error").length+f.length,x=m.filter(L=>L.level==="warning");e.push(g?{name:"validate",status:"fail",detail:`${g} error(s)`,hint:"run `gp-foundry validate` for details"}:{name:"validate",status:x.length?"warn":"ok",detail:x.length?`${x.length} warning(s): ${x.map(L=>L.code).join(", ")}`:"no diagnostics"});let $=d.filter(L=>{let ae=(0,J.join)(s,L.path);return((0,U.existsSync)(ae)?(0,U.readFileSync)(ae,"utf8"):null)!==L.contents});if(e.push($.length?{name:"workflows in sync",status:"fail",detail:`${$.length} file(s) drifted: ${$.slice(0,3).map(L=>L.path).join(", ")}${$.length>3?", \u2026":""}`,hint:"run `gp-foundry build`"}:{name:"workflows in sync",status:"ok",detail:`${d.length} generated files match`}),(a.config.runtime?.mode??"pinned")==="vendored"){let L=er().filter(ae=>!(0,U.existsSync)((0,J.join)(s,".github/actions",ae,"action.yml")));e.push(L.length?{name:"vendored actions",status:"fail",detail:`missing: ${L.join(", ")}`,hint:"run `gp-foundry vendor`"}:{name:"vendored actions",status:"ok",detail:"all runtime actions vendored"})}if(e.push((0,U.existsSync)((0,J.join)(s,".github/agent-setup/action.yml"))?{name:"agent-setup shim",status:"ok",detail:".github/agent-setup/action.yml present"}:{name:"agent-setup shim",status:"fail",detail:"missing \u2014 every agent job needs it",hint:"run `gp-foundry vendor` (or `init`)"}),!Be(["auth","status"]).ok)return e.push({name:"gh cli",status:"skip",detail:"gh missing or unauthenticated \u2014 skipping repo checks",hint:"install GitHub CLI and `gh auth login`"}),{checks:e,failed:e.some(L=>L.status==="fail")};e.push({name:"gh cli",status:"ok",detail:"authenticated"});let O=ke(["repo","view","--json","nameWithOwner,defaultBranchRef"],s);if(!O)return e.push({name:"github repo",status:"skip",detail:"not a GitHub repo (or no remote) \u2014 skipping labels/secrets checks",hint:"create it with `gh repo create`, then re-run `gp-foundry up` to create labels"}),{checks:e,failed:e.some(L=>L.status==="fail")};e.push({name:"github repo",status:"ok",detail:O.nameWithOwner});let F=O.defaultBranchRef?.name;F&&e.push(F===a.config.repo.base_branch?{name:"base branch",status:"ok",detail:F}:{name:"base branch",status:"fail",detail:`config says '${a.config.repo.base_branch}' but the repo default is '${F}'`,hint:"fix repo.base_branch in foundry.config.yaml and re-run `gp-foundry up`"});let M=new Set((ke(["label","list","--json","name","--limit","1000"],s)??[]).map(L=>L.name)),P=nr(i).map(L=>L.name),D=P.filter(L=>!M.has(L));e.push(D.length?{name:"labels",status:"fail",detail:`missing: ${D.join(", ")}`,hint:"run `gp-foundry up` to create them"}:{name:"labels",status:"ok",detail:P.join(", ")});let W=new Set((ke(["secret","list","--json","name"],s)??[]).map(L=>L.name)),oe=[a.config.agent.oauth_token_secret??"CLAUDE_CODE_OAUTH_TOKEN"],te=a.config.auth;te?.mode==="pat"&&te.token_secret&&oe.push(te.token_secret),te?.mode==="app"&&oe.push(te.app_id_secret??"APP_ID",te.app_key_secret??"APP_PRIVATE_KEY");let we=oe.filter(L=>!W.has(L));e.push(we.length?{name:"secrets",status:"fail",detail:`missing: ${we.join(", ")}`,hint:`gh secret set ${we[0]}`}:{name:"secrets",status:"ok",detail:oe.join(", ")});let ve=Be(["--version"]);try{let L=(0,Tt.execFileSync)("git",["status","--porcelain",".github"],{cwd:s,encoding:"utf8"}).trim();e.push(L?{name:"committed",status:"warn",detail:".github/ has uncommitted changes",hint:"commit + push so GitHub picks them up"}:{name:"committed",status:"ok",detail:".github/ clean"})}catch{e.push({name:"committed",status:"skip",detail:"not a git repo"})}return{checks:e,failed:e.some(L=>L.status==="fail")}}function co(r){let{dot:e,config:t,root:i}=ye(r);if(!Be(["auth","status"]).ok)return{error:"gh missing or unauthenticated \u2014 status needs the GitHub CLI",hint:"install the GitHub CLI and run `gh auth login`"};let o=ke(["repo","view","--json","nameWithOwner"],i);if(!o)return{error:"not a GitHub repo (or no remote)",hint:"create it with `gh repo create`, push, then re-run `gp-foundry status`"};let{harness:s}=ce(e,t),a=s.config.repo.branch_prefix,f=Date.now(),u=O=>Math.round((f-Date.parse(O))/36e5),c={};for(let O of["plan","build","needs-human"]){let F=O==="needs-human"?"needs-human":s.config.labels?.[O]??O,M=ke(["issue","list","--label",F,"--state","open","--json","number,title,createdAt","--limit","50"],i)??[];c[F]=M.map(P=>({number:P.number,title:P.title,ageHours:u(P.createdAt)}))}let m=(ke(["pr","list","--state","open","--json","number,title,labels,mergeable,headRefName,body,updatedAt","--limit","50"],i)??[]).filter(O=>O.headRefName.startsWith(a)),g=[],x=new Set;for(let O of m)for(let F of O.body?.matchAll(/[Cc]loses #(\d+)/g)??[])x.add(Number(F[1]));let $=s.config.labels?.build??"build";for(let O of c[$]??[])!x.has(O.number)&&O.ageHours>=2&&g.push({kind:"issue-no-pr",number:O.number,title:O.title,detail:`labeled ${$} ${O.ageHours}h ago, no open PR closes it`});for(let O of m)O.updatedAt&&u(O.updatedAt)>=4&&g.push({kind:"pr-idle",number:O.number,title:O.title,detail:`no activity for ${u(O.updatedAt)}h`});let v=(ke(["run","list","--status","failure","--limit","15","--json","name,url,createdAt,conclusion"],i)??[]).filter(O=>u(O.createdAt)<=24).map(O=>({workflow:O.name,url:O.url,ageHours:u(O.createdAt)}));return{repo:o.nameWithOwner,lanes:c,prs:m.map(O=>({number:O.number,title:O.title,labels:O.labels.map(F=>F.name),mergeable:O.mergeable,headRefName:O.headRefName})),stalled:g,recentFailures:v}}function tr(r){r.command("vendor").description("Copy the runtime-core actions into .github/actions/ (self-contained repo)").option("--dir <path>","target repo root",".").option("--json","machine-readable output").action(e=>{let t=Qi(e.dir);if(e.json)return K({written:t});for(let i of t)process.stdout.write(B.default.green(`vendored ${i}
|
|
78
78
|
`));process.stdout.write(B.default.dim(`commit .github/actions/ \u2014 the generated workflows reference these local paths
|
|
79
79
|
`))}),r.command("skill").description("Install the Claude skill (Socratic setup) into .claude/skills/gp-foundry/").option("--user","install for all projects (~/.claude/skills/) instead of this repo").option("--dir <path>","target repo root (project mode)",".").option("--json","machine-readable output").action(e=>{let t=process.env.HOME??process.env.USERPROFILE??".",i=e.user?(0,J.join)(t,".claude/skills/gp-foundry"):(0,J.join)(e.dir,".claude/skills/gp-foundry");if(ao(i),e.json)return K({installed:i});process.stdout.write(B.default.green(`installed skill \u2192 ${i}
|
|
80
80
|
`)),process.stdout.write(B.default.dim(`In Claude Code, type /gp-foundry (or just ask: "set up an agent pipeline for this repo").
|
|
@@ -101,15 +101,15 @@ failed runs, last 24h (${t.recentFailures.length})
|
|
|
101
101
|
`));for(let i of t.recentFailures.slice(0,10))process.stdout.write(` ${i.workflow} ${B.default.dim(`${i.ageHours}h ago`)} ${i.url}
|
|
102
102
|
`)}!t.stalled.length&&!t.recentFailures.length&&process.stdout.write(B.default.green(`
|
|
103
103
|
no stalled work, no recent failures
|
|
104
|
-
`))}),r.command("up").description("Bring the factory up: create labels, vendor actions, build workflows, run doctor").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--json","machine-readable output").action(e=>{let{dot:t,config:i,base:o,root:s}=ye(e),a={};if(Be(["auth","status"]).ok&&ke(["repo","view","--json","nameWithOwner"],s)){let
|
|
104
|
+
`))}),r.command("up").description("Bring the factory up: create labels, vendor actions, build workflows, run doctor").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--json","machine-readable output").action(e=>{let{dot:t,config:i,base:o,root:s}=ye(e),a={};if(Be(["auth","status"]).ok&&ke(["repo","view","--json","nameWithOwner"],s)){let v=[];for(let O of nr(i))Be(["label","create",O.name,"--color",O.color,"--description",O.description],{cwd:s}).ok&&v.push(O.name);a.labels=v,e.json||process.stdout.write(B.default.green(`labels ensured (created: ${v.length?v.join(", "):"none \u2014 already present"})
|
|
105
105
|
`))}else a.labels="skipped (gh unavailable or no GitHub repo)",e.json||process.stdout.write(B.default.yellow("skipped label creation (gh unavailable or no GitHub repo yet) \u2014 re-run `gp-foundry up` once the repo exists\n"));let{harness:f}=ce(t,i);(f.config.runtime?.mode??"pinned")==="vendored"&&(a.vendored=Qi(s),e.json||process.stdout.write(B.default.green(`vendored ${a.vendored.length} runtime action(s)
|
|
106
|
-
`)));let u=
|
|
106
|
+
`)));let u=v=>(0,U.existsSync)((0,J.join)(o,v)),c=(0,Rt.relative)(s,o).replace(/\\/g,"/"),{files:d,diagnostics:m}=qe(f,{fileExists:u},{specDir:c});on(m)&&(e.json?K({ok:!1,diagnostics:m}):process.stderr.write(B.default.red("build errors \u2014 run `gp-foundry validate` for details\n")),process.exit(1));for(let v of d){let O=(0,J.join)(s,v.path);(0,U.mkdirSync)((0,J.dirname)(O),{recursive:!0}),(0,U.writeFileSync)(O,v.contents)}a.wrote=d.map(v=>v.path);let g=d.filter(v=>v.path.startsWith(".github/workflows/")).length;e.json||process.stdout.write(B.default.green(`built ${g} workflows + HARNESS.md
|
|
107
107
|
`));let{checks:x,failed:$}=Zi(e);if(a.checks=x,a.ok=!$,e.json)return K(a);process.stdout.write(`
|
|
108
108
|
`),Xi(x),process.stdout.write($?B.default.yellow(`
|
|
109
109
|
almost there \u2014 fix the \u2717 items above, commit .github/, push, then file an issue
|
|
110
110
|
`):B.default.green(`
|
|
111
111
|
factory is up \u2014 commit .github/, push, then file an issue to watch it run
|
|
112
|
-
`)),process.exit($?1:0)})}var Se=new Yt;Se.name("gp-foundry").description("Compile a DOT harness spec into GitHub Actions.").version(
|
|
112
|
+
`)),process.exit($?1:0)})}var Se=new Yt,uo=JSON.parse((0,Y.readFileSync)(le("package.json"),"utf8")).version;Se.name("gp-foundry").description("Compile a DOT harness spec into GitHub Actions.").version(uo);function fo(r,e){let t=new Map;for(let i of r.nodes){if(!i.files.role)continue;let o=(0,ee.join)(e,i.files.role);if((0,Y.existsSync)(o)){let s=Ki((0,Y.readFileSync)(o,"utf8"));s&&t.set(i.id,s)}}return t}var po=[["skill/templates/harness.dot",".github/harness.dot"],["skill/templates/foundry.config.yaml",".github/agents/foundry.config.yaml"],["skill/templates/scope.yaml",".github/agents/scope.yaml"],["skill/templates/policy-merge.yaml",".github/agents/policy/merge.yaml"],["skill/templates/communication.md",".github/agents/communication.md"],["skill/templates/agent-setup.yml",".github/agent-setup/action.yml"]];Se.command("init").description("Scaffold a starter harness (harness.dot + config + roles + scope + policy) into a repo").option("--dir <path>","target repo root",".").option("--force","overwrite existing files").option("--json","machine-readable output").action(r=>{let e=(0,ee.resolve)(r.dir),t=[],i=[],o=(f,u)=>{let c=(0,ee.join)(e,f);if((0,Y.existsSync)(c)&&!r.force){i.push(f);return}(0,Y.mkdirSync)((0,ee.dirname)(c),{recursive:!0}),(0,Y.writeFileSync)(c,u),t.push(f)},s="main";try{let f=(0,ir.execFileSync)("git",["symbolic-ref","--short","HEAD"],{cwd:e,encoding:"utf8"}).trim();f&&(s=f)}catch{}for(let[f,u]of po){let c=(0,Y.readFileSync)(le(f),"utf8");u.endsWith("foundry.config.yaml")&&s!=="main"&&(c=c.replace(/^(\s*base_branch:\s*)main\b/m,`$1${s}`)),o(u,c)}let a=(0,ee.join)(e,".github/harness.dot");if((0,Y.existsSync)(a))for(let f of tn((0,Y.readFileSync)(a,"utf8")).nodes){if(!f.files.role)continue;let u=f.files.role.replace(/^.*\//,"").replace(/\.md$/,""),c=le(`roles/software/${u}.md`),d=(0,Y.existsSync)(c)?c:le("skill/templates/role.md");o((0,ee.join)(".github",f.files.role),(0,Y.readFileSync)(d,"utf8"))}if(r.json)return K({written:t,skipped:i});for(let f of t)process.stdout.write(Q.default.green(`created ${f}
|
|
113
113
|
`));for(let f of i)process.stderr.write(Q.default.yellow(`skipped ${f} (exists; --force to overwrite)
|
|
114
114
|
`));process.stdout.write(["",Q.default.bold("Next steps \u2014 dark factory in 4 moves:"),` 1. ${Q.default.cyan("gp-foundry up")} vendor actions, create labels, build workflows, run checks`,` 2. set two secrets: ${Q.default.cyan("gh secret set CLAUDE_CODE_OAUTH_TOKEN")} (agent auth)`,` ${Q.default.cyan("gh secret set AGENT_PAT")} (fine-grained PAT: contents/PRs/issues RW)`,` 3. commit + push ${Q.default.cyan(".github/")}`," 4. file an issue \u2192 the \u{1F575}\uFE0F scout triages it and the factory takes it from there","",Q.default.dim("Tune later: .github/harness.dot (topology) \xB7 agents/roles/*.md (behavior) \xB7 agents/policy/merge.yaml (merge rules)"),""].join(`
|
|
115
115
|
`))});Se.command("build").description("Compile harness.dot \u2192 .github/workflows/*.yml (+ HARNESS.md)").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--out <dir>","output repo root (default: dir of harness.dot)").option("--check","verify generated files are in sync; exit 1 on drift").option("--dry-run","print what would be written; do not write").option("--force","write even if there are error diagnostics").option("--json","machine-readable output").action(r=>{let{dot:e,config:t,base:i,root:o}=ye(r);(0,Y.existsSync)(e)||(r.json?K({error:`no harness.dot at ${e}`}):process.stderr.write(Q.default.red(`no harness.dot at ${e}
|
|
@@ -121,7 +121,7 @@ factory is up \u2014 commit .github/, push, then file an issue to watch it run
|
|
|
121
121
|
`)+g.contents+`
|
|
122
122
|
`);return}for(let g of d){let x=(0,ee.join)(f,g.path);(0,Y.mkdirSync)((0,ee.dirname)(x),{recursive:!0}),(0,Y.writeFileSync)(x,g.contents),r.json||process.stdout.write(Q.default.green(`wrote ${g.path}
|
|
123
123
|
`))}r.json&&K({ok:!on(m),diagnostics:m,wrote:d.map(g=>g.path)})});Se.command("validate").description("Validate the harness (structural + files + role handoffs + topology)").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--json","machine-readable output").action(r=>{let{dot:e,config:t,base:i}=ye(r);(0,Y.existsSync)(e)||(r.json?K({ok:!1,error:`no harness.dot at ${e}`}):process.stderr.write(Q.default.red(`no harness.dot at ${e} \u2014 run \`gp-foundry init\` first
|
|
124
|
-
`)),process.exit(1));let{harness:o,parseErrors:s}=ce(e,t),a=d=>(0,Y.existsSync)((0,ee.join)(i,d)),f=
|
|
124
|
+
`)),process.exit(1));let{harness:o,parseErrors:s}=ce(e,t),a=d=>(0,Y.existsSync)((0,ee.join)(i,d)),f=fo(o,i),u=[...ze(o,{fileExists:a,roles:f}),...Xe(o)],c=u.some(d=>d.level==="error")||s.length>0;if(r.json)K({ok:!c,parseErrors:s,diagnostics:u});else{for(let d of s)process.stderr.write(Q.default.red(`parse: ${d.message}
|
|
125
125
|
`));$t(u)}process.exit(c?1:0)});Se.command("graph").description("Print the harness topology (Mermaid, or --json for the IR)").option("--dot <path>","path to harness.dot").option("--json","output the parsed nodes/edges as JSON").action(r=>{let{dot:e}=ye(r);(0,Y.existsSync)(e)||(r.json?K({error:`no harness.dot at ${e}`}):process.stderr.write(Q.default.red(`no harness.dot at ${e} \u2014 run \`gp-foundry init\` first
|
|
126
126
|
`)),process.exit(1));let{harness:t}=ce(e);r.json?K({name:t.name,nodes:t.nodes,edges:t.edges}):process.stdout.write(Nn(t)+`
|
|
127
127
|
`)});Se.command("explain <node>").description("Show the workflow a single node compiles to").option("--dot <path>","path to harness.dot").option("--config <path>","path to foundry.config.yaml").option("--json","machine-readable output").action((r,e)=>{let{dot:t,config:i}=ye(e);(0,Y.existsSync)(t)||(e.json?K({error:`no harness.dot at ${t}`}):process.stderr.write(Q.default.red(`no harness.dot at ${t} \u2014 run \`gp-foundry init\` first
|
package/package.json
CHANGED
package/roles/software/fixer.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
role: Fixer
|
|
3
|
-
emoji: "
|
|
3
|
+
emoji: "🔧"
|
|
4
4
|
type: pr-fix
|
|
5
5
|
mission: Address the Reviewer's requested changes on the PR branch and push a fix.
|
|
6
6
|
accountable_for: [addresses every requested change, the project's tests pass, stays in scope]
|
|
@@ -12,7 +12,7 @@ quality_bar: every requested change addressed; the checks pass; do not touch .gi
|
|
|
12
12
|
---
|
|
13
13
|
## Fixer
|
|
14
14
|
|
|
15
|
-
You are the
|
|
15
|
+
You are the **🔧 Fixer**. The Reviewer requested changes on this PR — its review + diff are in
|
|
16
16
|
your context.
|
|
17
17
|
|
|
18
18
|
1. Read the Reviewer's requested changes — treat the bulleted asks as your checklist.
|
|
@@ -20,7 +20,7 @@ your context.
|
|
|
20
20
|
3. Run the project's tests until they pass.
|
|
21
21
|
4. Commit your fix (`git commit -m "fix: <what you changed>"`). The workflow pushes the branch,
|
|
22
22
|
which re-triggers the Reviewer.
|
|
23
|
-
5. Post a short comment per the communication guide (`##
|
|
23
|
+
5. Post a short comment per the communication guide (`## 🔧 Fixer`) noting what you changed,
|
|
24
24
|
point-by-point against the review. If a requested change was already satisfied, say so plainly.
|
|
25
25
|
|
|
26
26
|
Do not modify anything under `.github/`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
role: Reviewer
|
|
3
|
-
emoji: "
|
|
3
|
+
emoji: "⚖️"
|
|
4
4
|
type: pr-review
|
|
5
5
|
mission: Review the PR for correctness, tests, and scope; post a verdict to the PR.
|
|
6
6
|
accountable_for: [catches incorrect or untested changes, enforces scope]
|
|
@@ -14,13 +14,13 @@ quality_bar: approve only if correct, tested, in-scope, and the checks pass.
|
|
|
14
14
|
---
|
|
15
15
|
## Reviewer
|
|
16
16
|
|
|
17
|
-
You are the
|
|
17
|
+
You are the **⚖️ Reviewer**. Review the open pull request (its number + diff are in your context).
|
|
18
18
|
|
|
19
19
|
1. Read the diff and the changed files. Check the CI result if present.
|
|
20
20
|
2. Assess: correctness; tests exist for new behavior; no changes to immutable paths; the diff is
|
|
21
21
|
small and clean; and — if the issue had a plan — that the change follows it.
|
|
22
22
|
3. **Post your review** with `gh pr review <n> --comment --body "..."`, following the communication
|
|
23
|
-
guide (lead with `##
|
|
23
|
+
guide (lead with `## ⚖️ Reviewer`, a one-line summary, then a `<details>` with your full read).
|
|
24
24
|
Use a COMMENT review (a bot can't APPROVE its own PR) — a review, not a plain comment, is what
|
|
25
25
|
re-triggers the downstream merge-gate / Fixer.
|
|
26
26
|
4. End with exactly one line: `**Verdict:** APPROVE` or `**Verdict:** REQUEST_CHANGES`. For
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
role: Supervisor
|
|
3
|
-
emoji: "
|
|
3
|
+
emoji: "🧭"
|
|
4
4
|
type: scheduled-agent
|
|
5
5
|
mission: Find stranded work and re-drive it — nothing sits silently; everything moves or escalates.
|
|
6
6
|
accountable_for: [no work item stalls unnoticed, escalations are actionable, never spams]
|
|
@@ -10,7 +10,7 @@ quality_bar: re-drive at most twice per item, then escalate with a diagnosis; on
|
|
|
10
10
|
---
|
|
11
11
|
## Supervisor
|
|
12
12
|
|
|
13
|
-
You are the
|
|
13
|
+
You are the **🧭 Supervisor**. The factory should never strand work: every issue and PR is
|
|
14
14
|
either moving, or has a clear escalation naming what's blocked and why. Once per run, sweep for
|
|
15
15
|
stranded items and re-drive or escalate them.
|
|
16
16
|
|
|
@@ -36,7 +36,7 @@ it has had. If **fewer than 2**:
|
|
|
36
36
|
reviewer/fixer run failed, push-free re-fire is not possible — comment is not enough, so
|
|
37
37
|
re-toggle the verdict path is unavailable: instead re-run the failed workflow:
|
|
38
38
|
`gh run rerun <run-id> --failed`.
|
|
39
|
-
- Post ONE short note: `##
|
|
39
|
+
- Post ONE short note: `## 🧭 Supervisor` + what you observed + what you re-drove, ending
|
|
40
40
|
with `<!-- supervisor:nudge -->`. Never post if an identical unresolved note already exists.
|
|
41
41
|
|
|
42
42
|
### 3. Escalate (nudges exhausted, or not self-healable)
|
|
@@ -73,7 +73,9 @@ conclusions, schedules) — because GitHub is the executor, not a custom engine.
|
|
|
73
73
|
- **human-gate has an environment;** analyst nodes are `contents: read`; `output=doc:<glob>`
|
|
74
74
|
means the only committed paths match `<glob>`.
|
|
75
75
|
|
|
76
|
-
## Reference example (
|
|
76
|
+
## Reference example (the `starter` harness)
|
|
77
|
+
|
|
78
|
+
The complete, generated version lives in [`examples/starter/`](../../examples/starter/).
|
|
77
79
|
|
|
78
80
|
```dot
|
|
79
81
|
digraph harness {
|